#ifndef _MID_PTLIST_H #define _MID_PTLIST_H #include "types.h" #include "../../../../middleware/partitionmng/automount/usb_lib.h" #define MID_PTLIST_MAX_DEVICE (20) #define MID_PTLIST_MAX_PORTSTR (20) #define MID_PTLIST_MAX_PARTITIONNAME (128) #define MAX_PORT_LAYER (7) #define MID_DISK_NAME_MAX_LEN (16) typedef enum MID_PTLIST_MountModule { MntModule_FileBrowser_A = (1 << 0), MntModule_FileBrowser_B = (1 << 1), MntModule_DiskManager_A = (1 << 2), MntModule_DiskManager_B = (1 << 3), MntModule_PvrRecorder_A = (1 << 4), MntModule_PvrRecorder_B = (1 << 5), MntModule_RXDMA = (1 << 6), MntModule_Network = (1 << 7),//add for network,ycguan add for DVB MntModule_PvrPlayback = (1 << 8), MntModule_ALL = 0xFFFFFFFF, } MID_PTLIST_MountModule_e; typedef enum { MID_DEVICEMOUNT_EVENT_ATTACHED, MID_DEVICEMOUNT_EVENT_DETACHED, MID_DEVICEMOUNT_EVENT_MOUNT_SUCCESS, MID_DEVICEMOUNT_EVENT_MOUNT_FAIL, } MID_DeviceMount_Event_e; typedef enum { MID_FILESYSTEM_NOTEXIST = 0, //device not exist MID_FILESYSTEM_VFAT, MID_FILESYSTEM_NTFS, MID_FILESYSTEM_EXFAT, MID_FILESYSTEM_EXT3, MID_FILESYSTEM_EXT2, MID_FILESYSTEM_UNKNOWN, //unkown file system }MID_FILESYSTEM_TYPE; typedef struct _PartitionPath { UINT32 layerNumber; UINT8 layerInfo[MAX_PORT_LAYER]; }PartitionPath_t; typedef struct _PortsCurrentList { UINT32 ListCnt; UINT8 listInfo[MID_PTLIST_MAX_DEVICE]; }PortsCurrentList_t; typedef enum _LayerType { CURRENTLAYER = 0, CHILDLAYER, CHILD_CNT_OF_TOPLAYER, }LayerType; #define DETACHED_PATH_LEN 8 typedef struct { char USBPath[DETACHED_PATH_LEN]; UINT8 USBPathlen; unsigned short USBVersion; unsigned short USBPort; char usb_busid[MID_PTLIST_MAX_PORTSTR];// KOBJ_NAME_LEN == 20 } MID_DeviceMount_Event_Detail_t; typedef int (*iMidPtRenameCallback)(int sdMessageType, int sdDevNum, char *szName); typedef void(*MID_DeviceMount_Status_Post_t)(MID_DeviceMount_Event_e Event, MID_DeviceMount_Event_Detail_t* Detail); /***************************************************************************** * Function Name: MID_PartitionList_Init * Description: Initialize partition list module. * Parameters: Mount_Status_Post_Func - callback function to notify events such as mount, unmount etc. * Returns: none *****************************************************************************/ void MID_PartitionList_Init(MID_DeviceMount_Status_Post_t Mount_Status_Post_Func); /***************************************************************************** * Function Name: MID_PartitionList_FindItem * Description: Find partition list number of a particular node with device number * Parameters: dev_num - device number of the node to be found * Returns: index in partition list if success, -1 otherwise *****************************************************************************/ int MID_PartitionList_FindItem(int dev_num); /***************************************************************************** * Function Name: MID_PartitionList_GetCount * Description: Obtain the number of node, including unmounted ones. * Parameters: none * Returns: Number of node *****************************************************************************/ int MID_PartitionList_GetCount(void); /***************************************************************************** * Function Name: MID_PartitionList_GetMountedCount * Description: Obtain the number of mounted node * Parameters: none * Returns: Number of mounted node *****************************************************************************/ int MID_PartitionList_GetMountedCount(void); /***************************************************************************** * Function Name: MID_PartitionList_GetMountName * Description: Get the mounted name of the specified node, note that pMountName should not be null. * Parameters: index - index of that mounted node pMountName - address where the mounted name to be stored * Returns: return mounted name if success, NULL otherwise *****************************************************************************/ char *MID_PartitionList_GetMountName(int index, char *pMountName); /***************************************************************************** * Function Name: MID_PartitionList_IsNtfsDirty * Description: Check whether ntfsdirty bit is set * Parameters: index - index of that mounted node * Returns: return NtfsDirty dit *****************************************************************************/ int MID_PartitionList_IsNtfsDirty(int index); /***************************************************************************** * Function Name: MID_PartitionList_PintItem * Description: Print all the nodes currently mounted * Parameters: none * Returns: return 0 if success, -1 otherwise *****************************************************************************/ int MID_PartitionList_PrintItem(void); /***************************************************************************** * Function Name: MID_PartitionList_SetDiskChecked * Description: Set whether partition speed test is done or not * Parameters: index - index of mounted node to be set * checked - checked result to be set * Returns: return -1 if failed, 0 if success *****************************************************************************/ int MID_PartitionList_SetDiskChecked(int index, UINT32 checked); /***************************************************************************** * Function Name: MID_PartitionList_GetDiskChecked * Description: Get whether partition speed test is done or not * Parameters: index - index of mounted node to be checked * Returns: return 0 if not set or invalid index, return 1 if set *****************************************************************************/ UINT32 MID_PartitionList_GetDiskChecked(int index); /***************************************************************************** * Function Name: MID_PartitionList_GetPvrInfo * Description: Get pvr info from index * Parameters: index - index of that mounted node * Returns: return corresponding pvrinfo if success, 0 otherwise *****************************************************************************/ int MID_PartitionList_GetPvrInfo(int index); /***************************************************************************** * Function Name: MID_PartitionList_SetPvrInfo * Description: Store pvr info into global variable * Parameters: index - index of that mounted node pvrinfo - pvr info to be stored * Returns: return 0 if success, -1 otherwise *****************************************************************************/ int MID_PartitionList_SetPvrInfo(int index, UINT32 pvrinfo); /***************************************************************************** * Function Name: MID_PartitionList_IsIndexValid * Description: Check whether the specified index has corresponding node * Parameters: index - index of device node to be checked * Returns: return 1 if the specified node exist and mounted, return 0 otherwise *****************************************************************************/ int MID_PartitionList_IsIndexValid(int index); /***************************************************************************** * Function Name: MID_PartitionList_GetDevName * Description: Obtain device name of mounted node specified by inedx * Parameters: index - index of that mounted node * Returns: device name *****************************************************************************/ char *MID_PartitionList_GetDevName(int index); /***************************************************************************** * Function Name: MID_GetFileSystemType * Description: Obtain filesystem of the mounted node with specified index * Parameters: index - index of that mounted node * Returns: filesystem type such as MID_FILESYSTEM_VFAT, MID_FILESYSTEM_NTFA... *****************************************************************************/ MID_FILESYSTEM_TYPE MID_GetFileSystemType(int index); /***************************************************************************** * Function Name: MID_PartitionList_GetVersion * Description: Get USB device version * Parameters: nMajor-nMinor mounted usb device * Returns: 0x0110(usb1.1), 0x0200(usb2.0), 0x0210(usb3.0) *****************************************************************************/ UINT16 MID_PartitionList_GetVersion(UINT8 nMajor, UINT8 nMinor); /*port begin*/ UINT8 MID_PartitionList_GetMountPort(int index); char *MID_PartitionList_GetBusid(int index); const PortsCurrentList_t* MID_PartitionList_GetPortsList(UINT8 *cpath, LayerType flag,UINT32 pathlen); UINT32 MID_PartitionList_GetPartitionsCntByPath(UINT8 *cpath,UINT32 pathlen); UINT32 MID_PartitionList_GetPartitionIndexByPathandNum(UINT8 *cpath,UINT32 pathlen, UINT8 Num); /*port end*/ #endif //_MID_PTLIST_H