GD32F1x0: USB/GD32_USB_Device_Library/Class/msc/inc/usbd_msc_bot.h Source File

GD32F1x0

usbd_msc_bot.h
Go to the documentation of this file.
1 
11 /* Define to prevent recursive inclusion -------------------------------------*/
12 #ifndef __GD32F1X0_USBD_MSC_BOT_H
13 #define __GD32F1X0_USBD_MSC_BOT_H
14 
15 /* Includes ------------------------------------------------------------------*/
16 #include "usbd_core.h"
17 #include "usbd_msc_scsi.h"
18 #include "usbd_msc_mem.h"
19 
20 /* Exported defines ----------------------------------------------------------*/
21 #define BBB_IDLE 0 /* Idle state */
22 #define BBB_DATA_OUT 1 /* Data Out state */
23 #define BBB_DATA_IN 2 /* Data In state */
24 #define BBB_LAST_DATA_IN 3 /* Last Data In state */
25 #define BBB_SEND_DATA 4 /* Send Immediate data */
26 
27 #define BBB_CBW_SIGNATURE 0x43425355
28 #define BBB_CSW_SIGNATURE 0x53425355
29 #define BBB_CBW_LENGTH 31
30 #define BBB_CSW_LENGTH 13
31 
32 /* CSW Status Definitions */
33 #define CSW_CMD_PASSED 0x00
34 #define CSW_CMD_FAILED 0x01
35 #define CSW_PHASE_ERROR 0x02
36 
37 /* BOT Status */
38 #define BBB_STATUS_NORMAL 0
39 #define BBB_STATUS_RECOVERY 1
40 #define BBB_STATUS_ERROR 2
41 
42 /* Exported types ------------------------------------------------------------*/
43 typedef struct _MSC_BBB_CBW
44 {
45  uint32_t dCBWSignature;
46  uint32_t dCBWTag;
47  uint32_t dCBWDataTransferLength;
48  uint8_t bmCBWFlags;
49  uint8_t bCBWLUN;
50  uint8_t bCBWCBLength;
51  uint8_t CBWCB[16];
52 }
54 
55 
56 typedef struct _MSC_BBB_CSW
57 {
58  uint32_t dCSWSignature;
59  uint32_t dCSWTag;
60  uint32_t dCSWDataResidue;
61  uint8_t bCSWStatus;
62 }
64 
65 /* Exported variables --------------------------------------------------------*/
66 extern uint8_t MSC_BBB_Data[];
67 extern uint16_t MSC_BBB_DataLen;
68 extern uint8_t MSC_BBB_State;
69 
70 extern MSC_BBB_CBW_TypeDef MSC_BBB_cbw;
71 extern MSC_BBB_CSW_TypeDef MSC_BBB_csw;
72 
73 /* Exported functions ------------------------------------------------------- */
74 void MSC_BBB_Init (USB_DEVICE_HANDLE *pudev);
75 void MSC_BBB_Reset (USB_DEVICE_HANDLE *pudev);
76 void MSC_BBB_DeInit (USB_DEVICE_HANDLE *pudev);
77 void MSC_BBB_DataIn (USB_DEVICE_HANDLE *pudev, uint8_t EpID);
78 void MSC_BBB_DataOut (USB_DEVICE_HANDLE *pudev, uint8_t EpID);
79 void MSC_BBB_SendCSW (USB_DEVICE_HANDLE *pudev, uint8_t CSW_Status);
80 void MSC_BBB_CplClrFeature (USB_DEVICE_HANDLE *pudev, uint8_t EpID);
81 
82 #endif /* __GD32F1X0_USBD_MSC_BOT_H */
83 
84 /************************ (C) COPYRIGHT 2014 GIGADEVICE *****END OF FILE****/
85 
void MSC_BBB_DataOut(USB_DEVICE_HANDLE *pudev, uint8_t EpID)
Handle BBB OUT data stage.
Definition: usbd_msc_bot.c:108
Header for the STORAGE DISK file.
void MSC_BBB_SendCSW(USB_DEVICE_HANDLE *pudev, uint8_t CSW_Status)
Send the CSW(command status wrapper)
Definition: usbd_msc_bot.c:202
void MSC_BBB_DataIn(USB_DEVICE_HANDLE *pudev, uint8_t EpID)
Handle BBB IN data stage.
Definition: usbd_msc_bot.c:85
void MSC_BBB_CplClrFeature(USB_DEVICE_HANDLE *pudev, uint8_t EpID)
Complete the clear feature request.
Definition: usbd_msc_bot.c:251
Header file for the usbd_msc_scsi.c file.
void MSC_BBB_Init(USB_DEVICE_HANDLE *pudev)
Initialize the BBB process.
Definition: usbd_msc_bot.c:39
void MSC_BBB_DeInit(USB_DEVICE_HANDLE *pudev)
De-Initialize the BBB Machine.
Definition: usbd_msc_bot.c:74
void MSC_BBB_Reset(USB_DEVICE_HANDLE *pudev)
Reset the BBB machine.
Definition: usbd_msc_bot.c:58
USB device core function protoype.
Generated by   doxygen 1.8.10