Browse code

Add source code of the firmware for the IO Board

Pawel Jablonski authored on 05/06/2023 17:01:27
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,146 @@
1
+/**
2
+  ******************************************************************************
3
+  * @file    usbd_msc_bot.h
4
+  * @author  MCD Application Team
5
+  * @brief   Header for the usbd_msc_bot.c file
6
+  ******************************************************************************
7
+  * @attention
8
+  *
9
+  * Copyright (c) 2015 STMicroelectronics.
10
+  * All rights reserved.
11
+  *
12
+  * This software is licensed under terms that can be found in the LICENSE file
13
+  * in the root directory of this software component.
14
+  * If no LICENSE file comes with this software, it is provided AS-IS.
15
+  *
16
+  ******************************************************************************
17
+  */
18
+
19
+/* Define to prevent recursive inclusion -------------------------------------*/
20
+#ifndef __USBD_MSC_BOT_H
21
+#define __USBD_MSC_BOT_H
22
+
23
+#ifdef __cplusplus
24
+extern "C" {
25
+#endif
26
+
27
+/* Includes ------------------------------------------------------------------*/
28
+#include "usbd_core.h"
29
+
30
+/** @addtogroup STM32_USB_DEVICE_LIBRARY
31
+  * @{
32
+  */
33
+
34
+/** @defgroup MSC_BOT
35
+  * @brief This file is the Header file for usbd_msc_bot.c
36
+  * @{
37
+  */
38
+
39
+
40
+/** @defgroup USBD_CORE_Exported_Defines
41
+  * @{
42
+  */
43
+#define USBD_BOT_IDLE                      0U       /* Idle state */
44
+#define USBD_BOT_DATA_OUT                  1U       /* Data Out state */
45
+#define USBD_BOT_DATA_IN                   2U       /* Data In state */
46
+#define USBD_BOT_LAST_DATA_IN              3U       /* Last Data In Last */
47
+#define USBD_BOT_SEND_DATA                 4U       /* Send Immediate data */
48
+#define USBD_BOT_NO_DATA                   5U       /* No data Stage */
49
+
50
+#define USBD_BOT_CBW_SIGNATURE             0x43425355U
51
+#define USBD_BOT_CSW_SIGNATURE             0x53425355U
52
+#define USBD_BOT_CBW_LENGTH                31U
53
+#define USBD_BOT_CSW_LENGTH                13U
54
+#define USBD_BOT_MAX_DATA                  256U
55
+
56
+/* CSW Status Definitions */
57
+#define USBD_CSW_CMD_PASSED                0x00U
58
+#define USBD_CSW_CMD_FAILED                0x01U
59
+#define USBD_CSW_PHASE_ERROR               0x02U
60
+
61
+/* BOT Status */
62
+#define USBD_BOT_STATUS_NORMAL             0U
63
+#define USBD_BOT_STATUS_RECOVERY           1U
64
+#define USBD_BOT_STATUS_ERROR              2U
65
+
66
+
67
+#define USBD_DIR_IN                        0U
68
+#define USBD_DIR_OUT                       1U
69
+#define USBD_BOTH_DIR                      2U
70
+
71
+/**
72
+  * @}
73
+  */
74
+
75
+/** @defgroup MSC_CORE_Private_TypesDefinitions
76
+  * @{
77
+  */
78
+
79
+typedef struct
80
+{
81
+  uint32_t dSignature;
82
+  uint32_t dTag;
83
+  uint32_t dDataLength;
84
+  uint8_t  bmFlags;
85
+  uint8_t  bLUN;
86
+  uint8_t  bCBLength;
87
+  uint8_t  CB[16];
88
+  uint8_t  ReservedForAlign;
89
+} USBD_MSC_BOT_CBWTypeDef;
90
+
91
+
92
+typedef struct
93
+{
94
+  uint32_t dSignature;
95
+  uint32_t dTag;
96
+  uint32_t dDataResidue;
97
+  uint8_t  bStatus;
98
+  uint8_t  ReservedForAlign[3];
99
+} USBD_MSC_BOT_CSWTypeDef;
100
+
101
+/**
102
+  * @}
103
+  */
104
+
105
+
106
+/** @defgroup USBD_CORE_Exported_Types
107
+  * @{
108
+  */
109
+
110
+/**
111
+  * @}
112
+  */
113
+/** @defgroup USBD_CORE_Exported_FunctionsPrototypes
114
+  * @{
115
+  */
116
+void MSC_BOT_Init(USBD_HandleTypeDef  *pdev);
117
+void MSC_BOT_Reset(USBD_HandleTypeDef  *pdev);
118
+void MSC_BOT_DeInit(USBD_HandleTypeDef  *pdev);
119
+void MSC_BOT_DataIn(USBD_HandleTypeDef  *pdev,
120
+                    uint8_t epnum);
121
+
122
+void MSC_BOT_DataOut(USBD_HandleTypeDef  *pdev,
123
+                     uint8_t epnum);
124
+
125
+void MSC_BOT_SendCSW(USBD_HandleTypeDef  *pdev,
126
+                     uint8_t CSW_Status);
127
+
128
+void  MSC_BOT_CplClrFeature(USBD_HandleTypeDef  *pdev,
129
+                            uint8_t epnum);
130
+/**
131
+  * @}
132
+  */
133
+
134
+#ifdef __cplusplus
135
+}
136
+#endif
137
+
138
+#endif /* __USBD_MSC_BOT_H */
139
+/**
140
+  * @}
141
+  */
142
+
143
+/**
144
+  * @}
145
+  */
146
+