/******************************************************************************/ /*! @addtogroup MID_USB_EDIT * @{ ******************************************************************************/ /******************************************************************************/ /*! * @file mid_usb_edit.c * * @brief 1.This file specifies the APIs used to store data to USB device,\n * it's only provide engineers to debug.\n * 2.Please "do not" use MID_USB_Edit_Printf at the ISR/DIR Function.\n * It will cause the system dead lock!\n * 3.Because Lambo86 system will not auto mount usb device, \n * so we need to call mid_partition_list to mount usb device,\n * and it limited this module can't design at the driver layer.\n * if u want to use this function at the driver layer, \n * please design a call back function by ur salf to hook the usb printf function. * @note Copyright (c) 2010 Sunplus Technology Co., Ltd. \n * All rights reserved. * @author 002401 Henry.Lu ********************************************************************************/ #ifndef __MID_USB_EDIT_H__ #define __MID_USB_EDIT_H__ /******************************************************************************* * Header include ******************************************************************************/ #include "types.h" typedef int USB_File_Handler_t ; typedef enum{ USB_E_SUCCESS = 0, USB_E_ERR_FAILURE, }USB_Edit_t; /******************************************************************************/ /** * @brief Init USB Engineer Mode * ******************************************************************************/ void MID_USB_Edit_Init(void); /******************************************************************************/ /** * @brief Uninit USB Engineer Mode * ******************************************************************************/ void MID_USB_Edit_Uninit(void); /******************************************************************************/ /** * @brief Use to open /create file from usb. * @param char* const FileName : File Name * @return USB_E_SUCCESS if successful\n * USB_E_ERR_FAILURE if Exception Error occurred. * ******************************************************************************/ USB_Edit_t MID_USB_Edit_Open_File(char* const FileName, Boolean Is_Append_Mode); /******************************************************************************/ /** * @brief Use to close file. * @return USB_E_SUCCESS if successful\n * USB_E_ERR_FAILURE if Exception Error occurred. * ******************************************************************************/ USB_Edit_t MID_USB_Edit_Close_File(void); /******************************************************************************/ /** * @brief Use to write data to usb, please call MID_USB_Edit_Open_File(),before u want to call this function. * @param UINT8* const Source_Addr : Source Address\n * UINT32 Data_Len : Data length. * @return USB_E_SUCCESS if successful\n * USB_E_ERR_FAILURE if Exception Error occurred. * ******************************************************************************/ USB_Edit_t MID_USB_Edit_Write_File(UINT8* const Source_Addr, UINT32 Data_Len); /******************************************************************************/ /** * @brief Use to read data from usb, please call MID_USB_Edit_Open_File(),before u want to call this function. * @param UINT8* Target_Addr: Target Address\n * UINT32 Data_Len : Data length. * @return USB_E_SUCCESS if successful\n * USB_E_ERR_FAILURE if Exception Error occurred. * ******************************************************************************/ USB_Edit_t MID_USB_Edit_Read_File(UINT8* Target_Addr, UINT32 Data_Len); /******************************************************************************/ /** * @brief Use to lseek opened data, please call MID_USB_Edit_Open_File(),before u want to call this function. * @param UINT32 Len : Offset length. * @return USB_E_SUCCESS if successful\n * USB_E_ERR_FAILURE if Exception Error occurred. * ******************************************************************************/ USB_Edit_t MID_USB_Edit_Seek_Set(UINT32 Len); USB_Edit_t MID_USB_Edit_Seek_Set_end(INT32 Len); /******************************************************************************/ /** * @brief Use to get opened file size, please call MID_USB_Edit_Open_File(),before u want to call this function. * @param UINT32* FileSize : output file size. * @return USB_E_SUCCESS if successful\n * USB_E_ERR_FAILURE if Exception Error occurred. * ******************************************************************************/ USB_Edit_t MID_USB_Edit_Get_File_Size(UINT32* FileSize); #endif /*! @} end of addtogroup MID_USB_EDIT*/