AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: 9: 10: 14: #ifndef __USB_MSC_API_H__ 15: #define __USB_MSC_API_H__ 16: 17: 18: #include "uhs_type.h" 19: 20: 21: #define USBSTOR_ERRCODE_BASE -0x0100 22: 23: 24: 25: #define USBSTOR_SUCCESS 0 26: 27: #define USBSTOR_API_MOUNTED_UNIT (USBSTOR_ERRCODE_BASE - 1) 28: 29: #define USBSTOR_API_PARAM_ERROR (USBSTOR_ERRCODE_BASE - 2) 30: 31: #define USBSTOR_API_UNMOUNT_DRIVE (USBSTOR_ERRCODE_BASE - 3) 32: 33: #define USBSTOR_API_NOT_FOUND_UNIT (USBSTOR_ERRCODE_BASE - 20) 34: 35: #define USBSTOR_API_UNIT_NOT_READY (USBSTOR_ERRCODE_BASE - 21) 36: 37: #define USBSTOR_API_UNIT_NOT_USE (USBSTOR_ERRCODE_BASE - 22) 38: 39: #define USBSTOR_API_ILLIGAL_UNIT (USBSTOR_ERRCODE_BASE - 23) 40: 41: #define USBSTOR_API_ILLIGAL_DRIVE (USBSTOR_ERRCODE_BASE - 24) 42: 43: #define USBSTOR_MEDIUM_COMMAND_ERROR (USBSTOR_ERRCODE_BASE - 4) 44: 45: #define USBSTOR_MEDIUM_COMMAND_NOT_SUPPORT (USBSTOR_ERRCODE_BASE - 5) 46: 47: #define USBSTOR_MEDIUM_FAILED_READ (USBSTOR_ERRCODE_BASE - 6) 48: 49: #define USBSTOR_MEDIUM_FAILED_WRITE (USBSTOR_ERRCODE_BASE - 7) 50: 51: #define USBSTOR_MEDIUM_MAY_HAVE_CHANGED (USBSTOR_ERRCODE_BASE - 8) 52: 53: #define USBSTOR_MEDIUM_NOT_PRESENT (USBSTOR_ERRCODE_BASE - 9) 54: 55: #define USBSTOR_MEDIUM_PARAMETER_ERROR (USBSTOR_ERRCODE_BASE - 10) 56: 57: #define USBSTOR_MEDIUM_PARAMETER_NOT_SUPPORT (USBSTOR_ERRCODE_BASE - 11) 58: 59: #define USBSTOR_MEDIUM_TRANSFER_ERROR (USBSTOR_ERRCODE_BASE - 12) 60: 61: #define USBSTOR_MEDIUM_UNKNOWN_SENSE_ERROR (USBSTOR_ERRCODE_BASE - 13) 62: 63: #define USBSTOR_MEDIUM_WRITE_PROTECT (USBSTOR_ERRCODE_BASE - 14) 64: 65: #define USBSTOR_INTERNAL_FAILED_CORE (USBSTOR_ERRCODE_BASE - 15) 66: 67: #define USBSTOR_INTERNAL_FAILED_MSC (USBSTOR_ERRCODE_BASE - 16) 68: 69: #define USBSTOR_SYS_OUT_OF_RESOURCE (USBSTOR_ERRCODE_BASE - 17) 70: 71: #define USBSTOR_SYS_SYSTEM_ERROR (USBSTOR_ERRCODE_BASE - 18) 72: 73: 74: 75: #define USBSTOR_LOG_ERRCODE_BASE 0x0100 76: 77: 78: #define USBSTOR_LOG_API_MOUNTED_UNIT (USBSTOR_LOG_ERRCODE_BASE + 1) 79: #define USBSTOR_LOG_API_PARAM_ERROR (USBSTOR_LOG_ERRCODE_BASE + 2) 80: #define USBSTOR_LOG_API_UNMOUNT_DRIVE (USBSTOR_LOG_ERRCODE_BASE + 3) 81: 82: #define USBSTOR_LOG_API_NOT_FOUND_UNIT (USBSTOR_LOG_ERRCODE_BASE + 20) 83: #define USBSTOR_LOG_API_UNIT_NOT_READY (USBSTOR_LOG_ERRCODE_BASE + 21) 84: #define USBSTOR_LOG_API_UNIT_NOT_USE (USBSTOR_LOG_ERRCODE_BASE + 22) 85: #define USBSTOR_LOG_API_ILLIGAL_UNIT (USBSTOR_LOG_ERRCODE_BASE + 23) 86: #define USBSTOR_LOG_API_ILLIGAL_DRIVE (USBSTOR_LOG_ERRCODE_BASE + 24) 87: 88: #define USBSTOR_LOG_MEDIUM_COMMAND_ERROR (USBSTOR_LOG_ERRCODE_BASE + 4) 89: #define USBSTOR_LOG_MEDIUM_COMMAND_NOT_SUPPORT (USBSTOR_LOG_ERRCODE_BASE + 5) 90: #define USBSTOR_LOG_MEDIUM_FAILED_READ (USBSTOR_LOG_ERRCODE_BASE + 6) 91: #define USBSTOR_LOG_MEDIUM_FAILED_WRITE (USBSTOR_LOG_ERRCODE_BASE + 7) 92: #define USBSTOR_LOG_MEDIUM_MAY_HAVE_CHANGED (USBSTOR_LOG_ERRCODE_BASE + 8) 93: #define USBSTOR_LOG_MEDIUM_NOT_PRESENT (USBSTOR_LOG_ERRCODE_BASE + 9) 94: #define USBSTOR_LOG_MEDIUM_PARAMETER_ERROR (USBSTOR_LOG_ERRCODE_BASE + 10) 95: #define USBSTOR_LOG_MEDIUM_PARAMETER_NOT_SUPPORT (USBSTOR_LOG_ERRCODE_BASE + 11) 96: #define USBSTOR_LOG_MEDIUM_TRANSFER_ERROR (USBSTOR_LOG_ERRCODE_BASE + 12) 97: #define USBSTOR_LOG_MEDIUM_UNKNOWN_SENSE_ERROR (USBSTOR_LOG_ERRCODE_BASE + 13) 98: #define USBSTOR_LOG_MEDIUM_WRITE_PROTECT (USBSTOR_LOG_ERRCODE_BASE + 14) 99: #define USBSTOR_LOG_INTERNAL_FAILED_CORE (USBSTOR_LOG_ERRCODE_BASE + 15) 100: #define USBSTOR_LOG_INTERNAL_FAILED_MSC (USBSTOR_LOG_ERRCODE_BASE + 16) 101: #define USBSTOR_LOG_SYS_OUT_OF_RESOURCE (USBSTOR_LOG_ERRCODE_BASE + 17) 102: #define USBSTOR_LOG_SYS_SYSTEM_ERROR (USBSTOR_LOG_ERRCODE_BASE + 18) 103: 104: 105: 106: #define USBSTOR_WARNCODE_BASE 0x0400 107: #define USBSTOR_WARNING_OVERCONN (USBSTOR_WARNCODE_BASE + 1) 108: #define USBSTOR_WARNING_NOT_SUPPORT_MULTI_LUN (USBSTOR_WARNCODE_BASE + 2) 109: 110: 111: 112: #define STOR_RW_MILESTONE_ERA FALSE 113: 114: 115: #define USBSTOR_CHECKPOINT_BASE 0x1000 116: #define USBSTOR_CHKPOINTS_API_INITIALIZE (USBSTOR_CHECKPOINT_BASE + 1) 117: #define USBSTOR_CHKPOINTS_API_FINALIZE (USBSTOR_CHECKPOINT_BASE + 2) 118: #define USBSTOR_CHKPOINTS_API_REREGISTCB (USBSTOR_CHECKPOINT_BASE + 3) 119: #define USBSTOR_CHKPOINTS_API_MOUNT (USBSTOR_CHECKPOINT_BASE + 4) 120: #define USBSTOR_CHKPOINTS_API_UNMOUNT (USBSTOR_CHECKPOINT_BASE + 5) 121: #define USBSTOR_CHKPOINTS_API_GETUNMOUNTUNIT (USBSTOR_CHECKPOINT_BASE + 6) 122: #define USBSTOR_CHKPOINTS_API_GETUNITINFO (USBSTOR_CHECKPOINT_BASE + 7) 123: #define USBSTOR_CHKPOINTS_API_GETUNITSTATUS (USBSTOR_CHECKPOINT_BASE + 8) 124: #define USBSTOR_CHKPOINTS_API_READSECTOR (USBSTOR_CHECKPOINT_BASE + 9) 125: #define USBSTOR_CHKPOINTS_API_WRITESECTOR (USBSTOR_CHECKPOINT_BASE + 10) 126: #define USBSTOR_CHKPOINTS_EVNT_ATTACH_DEVICE (USBSTOR_CHECKPOINT_BASE + 11) 127: #define USBSTOR_CHKPOINTS_EVNT_DETACH_DEVICE (USBSTOR_CHECKPOINT_BASE + 12) 128: #define USBSTOR_CHKPOINTS_API_STARTSTOP (USBSTOR_CHECKPOINT_BASE + 13) 129: 130: 131: #define STOR_MAJOR_VERSION (0x01) 132: 133: #define STOR_MINOR_VERSION (0x00) 134: 135: 136: typedef enum _STOR_CALLBACK_ID { 137: CBID_STOR_DEVATTACH, 138: CBID_STOR_DEVATTACH_NOT_READY, 139: CBID_STOR_DEVATTACH_NOT_USE, 140: CBID_STOR_DEVDETACH 141: } STOR_CALLBACK_ID; 142: 143: typedef enum _STOR_UNIT_STATUS { 144: STOR_READY, 145: STOR_NOT_READY, 146: STOR_NOT_USE 147: } STOR_UNIT_STATUS; 148: 149: typedef enum _STOR_IMMED_STATUS { 150: STOR_IMMED_CLR, 151: STOR_IMMED_SET 152: } STOR_IMMED_STATUS; 153: 154: typedef enum _STOR_LOEJ_STATUS { 155: STOR_LOEJ_CLR, 156: STOR_LOEJ_SET 157: } STOR_LOEJ_STATUS; 158: 159: typedef enum _STOR_START_STATUS { 160: STOR_START_CLR, 161: STOR_START_SET 162: } STOR_START_STATUS; 163: 164: 165: 167: typedef struct StorUnit* PSTOR_UNIT; 168: 169: 174: typedef void* PUSER_DRV; 175: 176: 180: typedef struct StorUnitInfo { 181: uhs_ubit16_t u16BlockSize; 182: uhs_ubit32_t u32LastBlockAddress; 183: uhs_boolean_t bRemovable; 184: uhs_ubit8_t u8VendorName[8 + 1]; 185: uhs_ubit8_t u8ProductName[16 + 1]; 186: } STOR_UNIT_INFO, *PSTOR_UNIT_INFO; 187: 188: 189: typedef struct StorStartStopUnitInfo { 190: STOR_IMMED_STATUS Immed; 191: STOR_LOEJ_STATUS LoEj; 192: STOR_START_STATUS Start; 193: } STOR_STARTSTOP_UNIT_INFO, *PSTOR_STARTSTOP_UNIT_INFO; 194: 195: 196: extern uhs_sbit32_t Usbh_Stor_Mount(PSTOR_UNIT pUnit, PUSER_DRV pDrv); 197: extern uhs_sbit32_t Usbh_Stor_Unmount(PUSER_DRV pDrv); 198: extern PSTOR_UNIT Usbh_Stor_GetUnmountUnit(void); 199: extern uhs_sbit32_t Usbh_Stor_GetUnitInfo(PSTOR_UNIT pUnit, STOR_UNIT_INFO *pInfo); 200: extern STOR_UNIT_STATUS Usbh_Stor_GetUnitStatus(PSTOR_UNIT pUnit); 201: extern uhs_sbit32_t Usbh_Stor_ReadSector(PUSER_DRV pDrv, uhs_ubit32_t u32LBA, uhs_ubit16_t u16BlockCount, uhs_ubit8_t *pDataBuffer); 202: extern uhs_sbit32_t Usbh_Stor_WriteSector(PUSER_DRV pDrv, uhs_ubit32_t u32LBA, uhs_ubit16_t u16BlockCount, uhs_ubit8_t *pDataBuffer); 203: extern uhs_sbit32_t Usbh_Stor_GetLastError(void *pObj); 204: extern uhs_status_t Usbh_Stor_GetVersion(uhs_ubit8_t* pu8MajorVersion, uhs_ubit8_t* pu8MinorVersion); 205: extern uhs_status_t Usbh_Stor_Api_StartStop(PSTOR_UNIT pUnit,PSTOR_STARTSTOP_UNIT_INFO pstData ); 206: extern int Usbh_Stor_GetAttachDevNum(void); 207: 208: 209: 210: 211: 212: 213: 214: 215: #define CONTEXT_BASE 0x70000000 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: #endif
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.