mid_partition_list.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. #ifndef _MID_PTLIST_H
  2. #define _MID_PTLIST_H
  3. #include "types.h"
  4. #include "../../../../middleware/partitionmng/automount/usb_lib.h"
  5. #define MID_PTLIST_MAX_DEVICE (20)
  6. #define MID_PTLIST_MAX_PORTSTR (20)
  7. #define MID_PTLIST_MAX_PARTITIONNAME (128)
  8. #define MAX_PORT_LAYER (7)
  9. #define MID_DISK_NAME_MAX_LEN (16)
  10. typedef enum MID_PTLIST_MountModule
  11. {
  12. MntModule_FileBrowser_A = (1 << 0),
  13. MntModule_FileBrowser_B = (1 << 1),
  14. MntModule_DiskManager_A = (1 << 2),
  15. MntModule_DiskManager_B = (1 << 3),
  16. MntModule_PvrRecorder_A = (1 << 4),
  17. MntModule_PvrRecorder_B = (1 << 5),
  18. MntModule_RXDMA = (1 << 6),
  19. MntModule_Network = (1 << 7),//add for network,ycguan add for DVB
  20. MntModule_PvrPlayback = (1 << 8),
  21. MntModule_ALL = 0xFFFFFFFF,
  22. } MID_PTLIST_MountModule_e;
  23. typedef enum
  24. {
  25. MID_DEVICEMOUNT_EVENT_ATTACHED,
  26. MID_DEVICEMOUNT_EVENT_DETACHED,
  27. MID_DEVICEMOUNT_EVENT_MOUNT_SUCCESS,
  28. MID_DEVICEMOUNT_EVENT_MOUNT_FAIL,
  29. } MID_DeviceMount_Event_e;
  30. typedef enum
  31. {
  32. MID_FILESYSTEM_NOTEXIST = 0, //device not exist
  33. MID_FILESYSTEM_VFAT,
  34. MID_FILESYSTEM_NTFS,
  35. MID_FILESYSTEM_EXFAT,
  36. MID_FILESYSTEM_EXT3,
  37. MID_FILESYSTEM_EXT2,
  38. MID_FILESYSTEM_UNKNOWN, //unkown file system
  39. }MID_FILESYSTEM_TYPE;
  40. typedef struct _PartitionPath
  41. {
  42. UINT32 layerNumber;
  43. UINT8 layerInfo[MAX_PORT_LAYER];
  44. }PartitionPath_t;
  45. typedef struct _PortsCurrentList
  46. {
  47. UINT32 ListCnt;
  48. UINT8 listInfo[MID_PTLIST_MAX_DEVICE];
  49. }PortsCurrentList_t;
  50. typedef enum _LayerType
  51. {
  52. CURRENTLAYER = 0,
  53. CHILDLAYER,
  54. CHILD_CNT_OF_TOPLAYER,
  55. }LayerType;
  56. #define DETACHED_PATH_LEN 8
  57. typedef struct
  58. {
  59. char USBPath[DETACHED_PATH_LEN];
  60. UINT8 USBPathlen;
  61. unsigned short USBVersion;
  62. unsigned short USBPort;
  63. char usb_busid[MID_PTLIST_MAX_PORTSTR];// KOBJ_NAME_LEN == 20
  64. } MID_DeviceMount_Event_Detail_t;
  65. typedef int (*iMidPtRenameCallback)(int sdMessageType, int sdDevNum, char *szName);
  66. typedef void(*MID_DeviceMount_Status_Post_t)(MID_DeviceMount_Event_e Event, MID_DeviceMount_Event_Detail_t* Detail);
  67. /*****************************************************************************
  68. * Function Name: MID_PartitionList_Init
  69. * Description: Initialize partition list module.
  70. * Parameters: Mount_Status_Post_Func - callback function to notify events
  71. such as mount, unmount etc.
  72. * Returns: none
  73. *****************************************************************************/
  74. void MID_PartitionList_Init(MID_DeviceMount_Status_Post_t Mount_Status_Post_Func);
  75. /*****************************************************************************
  76. * Function Name: MID_PartitionList_FindItem
  77. * Description: Find partition list number of a particular node with device number
  78. * Parameters: dev_num - device number of the node to be found
  79. * Returns: index in partition list if success, -1 otherwise
  80. *****************************************************************************/
  81. int MID_PartitionList_FindItem(int dev_num);
  82. /*****************************************************************************
  83. * Function Name: MID_PartitionList_GetCount
  84. * Description: Obtain the number of node, including unmounted ones.
  85. * Parameters: none
  86. * Returns: Number of node
  87. *****************************************************************************/
  88. int MID_PartitionList_GetCount(void);
  89. /*****************************************************************************
  90. * Function Name: MID_PartitionList_GetMountedCount
  91. * Description: Obtain the number of mounted node
  92. * Parameters: none
  93. * Returns: Number of mounted node
  94. *****************************************************************************/
  95. int MID_PartitionList_GetMountedCount(void);
  96. /*****************************************************************************
  97. * Function Name: MID_PartitionList_GetMountName
  98. * Description: Get the mounted name of the specified node, note that pMountName
  99. should not be null.
  100. * Parameters: index - index of that mounted node
  101. pMountName - address where the mounted name to be stored
  102. * Returns: return mounted name if success, NULL otherwise
  103. *****************************************************************************/
  104. char *MID_PartitionList_GetMountName(int index, char *pMountName);
  105. /*****************************************************************************
  106. * Function Name: MID_PartitionList_IsNtfsDirty
  107. * Description: Check whether ntfsdirty bit is set
  108. * Parameters: index - index of that mounted node
  109. * Returns: return NtfsDirty dit
  110. *****************************************************************************/
  111. int MID_PartitionList_IsNtfsDirty(int index);
  112. /*****************************************************************************
  113. * Function Name: MID_PartitionList_PintItem
  114. * Description: Print all the nodes currently mounted
  115. * Parameters: none
  116. * Returns: return 0 if success, -1 otherwise
  117. *****************************************************************************/
  118. int MID_PartitionList_PrintItem(void);
  119. /*****************************************************************************
  120. * Function Name: MID_PartitionList_SetDiskChecked
  121. * Description: Set whether partition speed test is done or not
  122. * Parameters: index - index of mounted node to be set
  123. * checked - checked result to be set
  124. * Returns: return -1 if failed, 0 if success
  125. *****************************************************************************/
  126. int MID_PartitionList_SetDiskChecked(int index, UINT32 checked);
  127. /*****************************************************************************
  128. * Function Name: MID_PartitionList_GetDiskChecked
  129. * Description: Get whether partition speed test is done or not
  130. * Parameters: index - index of mounted node to be checked
  131. * Returns: return 0 if not set or invalid index, return 1 if set
  132. *****************************************************************************/
  133. UINT32 MID_PartitionList_GetDiskChecked(int index);
  134. /*****************************************************************************
  135. * Function Name: MID_PartitionList_GetPvrInfo
  136. * Description: Get pvr info from index
  137. * Parameters: index - index of that mounted node
  138. * Returns: return corresponding pvrinfo if success, 0 otherwise
  139. *****************************************************************************/
  140. int MID_PartitionList_GetPvrInfo(int index);
  141. /*****************************************************************************
  142. * Function Name: MID_PartitionList_SetPvrInfo
  143. * Description: Store pvr info into global variable
  144. * Parameters: index - index of that mounted node
  145. pvrinfo - pvr info to be stored
  146. * Returns: return 0 if success, -1 otherwise
  147. *****************************************************************************/
  148. int MID_PartitionList_SetPvrInfo(int index, UINT32 pvrinfo);
  149. /*****************************************************************************
  150. * Function Name: MID_PartitionList_IsIndexValid
  151. * Description: Check whether the specified index has corresponding node
  152. * Parameters: index - index of device node to be checked
  153. * Returns: return 1 if the specified node exist and mounted, return 0 otherwise
  154. *****************************************************************************/
  155. int MID_PartitionList_IsIndexValid(int index);
  156. /*****************************************************************************
  157. * Function Name: MID_PartitionList_GetDevName
  158. * Description: Obtain device name of mounted node specified by inedx
  159. * Parameters: index - index of that mounted node
  160. * Returns: device name
  161. *****************************************************************************/
  162. char *MID_PartitionList_GetDevName(int index);
  163. /*****************************************************************************
  164. * Function Name: MID_GetFileSystemType
  165. * Description: Obtain filesystem of the mounted node with specified index
  166. * Parameters: index - index of that mounted node
  167. * Returns: filesystem type such as MID_FILESYSTEM_VFAT, MID_FILESYSTEM_NTFA...
  168. *****************************************************************************/
  169. MID_FILESYSTEM_TYPE MID_GetFileSystemType(int index);
  170. /*****************************************************************************
  171. * Function Name: MID_PartitionList_GetVersion
  172. * Description: Get USB device version
  173. * Parameters: nMajor-nMinor mounted usb device
  174. * Returns: 0x0110(usb1.1), 0x0200(usb2.0), 0x0210(usb3.0)
  175. *****************************************************************************/
  176. UINT16 MID_PartitionList_GetVersion(UINT8 nMajor, UINT8 nMinor);
  177. /*port begin*/
  178. UINT8 MID_PartitionList_GetMountPort(int index);
  179. char *MID_PartitionList_GetBusid(int index);
  180. const PortsCurrentList_t* MID_PartitionList_GetPortsList(UINT8 *cpath, LayerType flag,UINT32 pathlen);
  181. UINT32 MID_PartitionList_GetPartitionsCntByPath(UINT8 *cpath,UINT32 pathlen);
  182. UINT32 MID_PartitionList_GetPartitionIndexByPathandNum(UINT8 *cpath,UINT32 pathlen, UINT8 Num);
  183. /*port end*/
  184. #endif //_MID_PTLIST_H