mid_usb_edit.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /******************************************************************************/
  2. /*! @addtogroup MID_USB_EDIT
  3. * @{
  4. ******************************************************************************/
  5. /******************************************************************************/
  6. /*!
  7. * @file mid_usb_edit.c
  8. *
  9. * @brief 1.This file specifies the APIs used to store data to USB device,\n
  10. * it's only provide engineers to debug.\n
  11. * 2.Please "do not" use MID_USB_Edit_Printf at the ISR/DIR Function.\n
  12. * It will cause the system dead lock!\n
  13. * 3.Because Lambo86 system will not auto mount usb device, \n
  14. * so we need to call mid_partition_list to mount usb device,\n
  15. * and it limited this module can't design at the driver layer.\n
  16. * if u want to use this function at the driver layer, \n
  17. * please design a call back function by ur salf to hook the usb printf function.
  18. * @note Copyright (c) 2010 Sunplus Technology Co., Ltd. \n
  19. * All rights reserved.
  20. * @author 002401 Henry.Lu
  21. ********************************************************************************/
  22. #ifndef __MID_USB_EDIT_H__
  23. #define __MID_USB_EDIT_H__
  24. /*******************************************************************************
  25. * Header include
  26. ******************************************************************************/
  27. #include "types.h"
  28. typedef int USB_File_Handler_t ;
  29. typedef enum{
  30. USB_E_SUCCESS = 0,
  31. USB_E_ERR_FAILURE,
  32. }USB_Edit_t;
  33. /******************************************************************************/
  34. /**
  35. * @brief Init USB Engineer Mode
  36. *
  37. ******************************************************************************/
  38. void MID_USB_Edit_Init(void);
  39. /******************************************************************************/
  40. /**
  41. * @brief Uninit USB Engineer Mode
  42. *
  43. ******************************************************************************/
  44. void MID_USB_Edit_Uninit(void);
  45. /******************************************************************************/
  46. /**
  47. * @brief Use to open /create file from usb.
  48. * @param char* const FileName : File Name
  49. * @return USB_E_SUCCESS if successful\n
  50. * USB_E_ERR_FAILURE if Exception Error occurred.
  51. *
  52. ******************************************************************************/
  53. USB_Edit_t MID_USB_Edit_Open_File(char* const FileName, Boolean Is_Append_Mode);
  54. /******************************************************************************/
  55. /**
  56. * @brief Use to close file.
  57. * @return USB_E_SUCCESS if successful\n
  58. * USB_E_ERR_FAILURE if Exception Error occurred.
  59. *
  60. ******************************************************************************/
  61. USB_Edit_t MID_USB_Edit_Close_File(void);
  62. /******************************************************************************/
  63. /**
  64. * @brief Use to write data to usb, please call MID_USB_Edit_Open_File(),before u want to call this function.
  65. * @param UINT8* const Source_Addr : Source Address\n
  66. * UINT32 Data_Len : Data length.
  67. * @return USB_E_SUCCESS if successful\n
  68. * USB_E_ERR_FAILURE if Exception Error occurred.
  69. *
  70. ******************************************************************************/
  71. USB_Edit_t MID_USB_Edit_Write_File(UINT8* const Source_Addr, UINT32 Data_Len);
  72. /******************************************************************************/
  73. /**
  74. * @brief Use to read data from usb, please call MID_USB_Edit_Open_File(),before u want to call this function.
  75. * @param UINT8* Target_Addr: Target Address\n
  76. * UINT32 Data_Len : Data length.
  77. * @return USB_E_SUCCESS if successful\n
  78. * USB_E_ERR_FAILURE if Exception Error occurred.
  79. *
  80. ******************************************************************************/
  81. USB_Edit_t MID_USB_Edit_Read_File(UINT8* Target_Addr, UINT32 Data_Len);
  82. /******************************************************************************/
  83. /**
  84. * @brief Use to lseek opened data, please call MID_USB_Edit_Open_File(),before u want to call this function.
  85. * @param UINT32 Len : Offset length.
  86. * @return USB_E_SUCCESS if successful\n
  87. * USB_E_ERR_FAILURE if Exception Error occurred.
  88. *
  89. ******************************************************************************/
  90. USB_Edit_t MID_USB_Edit_Seek_Set(UINT32 Len);
  91. USB_Edit_t MID_USB_Edit_Seek_Set_end(INT32 Len);
  92. /******************************************************************************/
  93. /**
  94. * @brief Use to get opened file size, please call MID_USB_Edit_Open_File(),before u want to call this function.
  95. * @param UINT32* FileSize : output file size.
  96. * @return USB_E_SUCCESS if successful\n
  97. * USB_E_ERR_FAILURE if Exception Error occurred.
  98. *
  99. ******************************************************************************/
  100. USB_Edit_t MID_USB_Edit_Get_File_Size(UINT32* FileSize);
  101. #endif
  102. /*!
  103. @} end of addtogroup MID_USB_EDIT*/