summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--stmhal/usbd_cdc_interface.c16
-rw-r--r--stmhal/usbd_hid_interface.c16
-rw-r--r--stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h8
-rw-r--r--stmhal/usbdev/class/src/usbd_cdc_msc_hid.c8
4 files changed, 24 insertions, 24 deletions
diff --git a/stmhal/usbd_cdc_interface.c b/stmhal/usbd_cdc_interface.c
index 9410255152..942e51e984 100644
--- a/stmhal/usbd_cdc_interface.c
+++ b/stmhal/usbd_cdc_interface.c
@@ -82,10 +82,10 @@ static uint8_t UserTxBufPtrWaitCount = 0; // used to implement a timeout waiting
static uint8_t UserTxNeedEmptyPacket = 0; // used to flush the USB IN endpoint if the last packet was exactly the endpoint packet size
/* Private function prototypes -----------------------------------------------*/
-static int8_t CDC_Itf_Init (void);
+static int8_t CDC_Itf_Init (USBD_HandleTypeDef *pdev);
static int8_t CDC_Itf_DeInit (void);
static int8_t CDC_Itf_Control (uint8_t cmd, uint8_t* pbuf, uint16_t length);
-static int8_t CDC_Itf_Receive (uint8_t* pbuf, uint32_t *Len);
+static int8_t CDC_Itf_Receive (USBD_HandleTypeDef *pdev, uint8_t* pbuf, uint32_t *Len);
const USBD_CDC_ItfTypeDef USBD_CDC_fops = {
CDC_Itf_Init,
@@ -102,7 +102,7 @@ const USBD_CDC_ItfTypeDef USBD_CDC_fops = {
* @param None
* @retval Result of the opeartion: USBD_OK if all operations are OK else USBD_FAIL
*/
-static int8_t CDC_Itf_Init(void)
+static int8_t CDC_Itf_Init(USBD_HandleTypeDef *pdev)
{
#if 0
/*##-1- Configure the UART peripheral ######################################*/
@@ -141,8 +141,8 @@ static int8_t CDC_Itf_Init(void)
#endif
/*##-5- Set Application Buffers ############################################*/
- USBD_CDC_SetTxBuffer(&hUSBDDevice, UserTxBuffer, 0);
- USBD_CDC_SetRxBuffer(&hUSBDDevice, cdc_rx_packet_buf);
+ USBD_CDC_SetTxBuffer(pdev, UserTxBuffer, 0);
+ USBD_CDC_SetRxBuffer(pdev, cdc_rx_packet_buf);
cdc_rx_buf_put = 0;
cdc_rx_buf_get = 0;
@@ -317,7 +317,7 @@ void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) {
* @note The buffer we are passed here is just cdc_rx_packet_buf, so we are
* free to modify it.
*/
-static int8_t CDC_Itf_Receive(uint8_t* Buf, uint32_t *Len) {
+static int8_t CDC_Itf_Receive(USBD_HandleTypeDef *pdev, uint8_t* Buf, uint32_t *Len) {
#if 0
// this sends the data over the UART using DMA
HAL_UART_Transmit_DMA(&UartHandle, Buf, *Len);
@@ -339,8 +339,8 @@ static int8_t CDC_Itf_Receive(uint8_t* Buf, uint32_t *Len) {
}
// initiate next USB packet transfer
- USBD_CDC_SetRxBuffer(&hUSBDDevice, cdc_rx_packet_buf);
- USBD_CDC_ReceivePacket(&hUSBDDevice);
+ USBD_CDC_SetRxBuffer(pdev, cdc_rx_packet_buf);
+ USBD_CDC_ReceivePacket(pdev);
return USBD_OK;
}
diff --git a/stmhal/usbd_hid_interface.c b/stmhal/usbd_hid_interface.c
index 7a420c3306..9eee451f3c 100644
--- a/stmhal/usbd_hid_interface.c
+++ b/stmhal/usbd_hid_interface.c
@@ -51,8 +51,8 @@ static uint32_t last_read_len = 0; // length of last read
static int8_t current_write_buffer = 0; // which buffer to write to
/* Private function prototypes -----------------------------------------------*/
-static int8_t HID_Itf_Init (void);
-static int8_t HID_Itf_Receive (uint8_t* pbuf, uint32_t Len);
+static int8_t HID_Itf_Init (USBD_HandleTypeDef *pdev);
+static int8_t HID_Itf_Receive (USBD_HandleTypeDef *pdev, uint8_t* pbuf, uint32_t Len);
const USBD_HID_ItfTypeDef USBD_HID_fops = {
HID_Itf_Init,
@@ -65,12 +65,12 @@ const USBD_HID_ItfTypeDef USBD_HID_fops = {
* @param None
* @retval Result of the opeartion: USBD_OK if all operations are OK else USBD_FAIL
*/
-static int8_t HID_Itf_Init(void)
+static int8_t HID_Itf_Init(USBD_HandleTypeDef *pdev)
{
current_read_buffer = 0;
last_read_len = 0;
current_write_buffer = 0;
- USBD_HID_SetRxBuffer(&hUSBDDevice, buffer[current_write_buffer]);
+ USBD_HID_SetRxBuffer(pdev, buffer[current_write_buffer]);
return USBD_OK;
}
@@ -83,14 +83,14 @@ static int8_t HID_Itf_Init(void)
* @note The buffer we are passed here is just UserRxBuffer, so we are
* free to modify it.
*/
-static int8_t HID_Itf_Receive(uint8_t* Buf, uint32_t Len) {
+static int8_t HID_Itf_Receive(USBD_HandleTypeDef *pdev, uint8_t* Buf, uint32_t Len) {
current_write_buffer = !current_write_buffer;
last_read_len = Len;
// initiate next USB packet transfer, to append to existing data in buffer
- USBD_HID_SetRxBuffer(&hUSBDDevice, buffer[current_write_buffer]);
- USBD_HID_ReceivePacket(&hUSBDDevice);
+ USBD_HID_SetRxBuffer(pdev, buffer[current_write_buffer]);
+ USBD_HID_ReceivePacket(pdev);
// Set NAK to indicate we need to process read buffer
- USBD_HID_SetNAK(&hUSBDDevice);
+ USBD_HID_SetNAK(pdev);
return USBD_OK;
}
diff --git a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h
index 5f05027667..96617b1077 100644
--- a/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h
+++ b/stmhal/usbdev/class/inc/usbd_cdc_msc_hid.h
@@ -28,10 +28,10 @@ typedef struct {
} USBD_CDC_LineCodingTypeDef;
typedef struct _USBD_CDC_Itf {
- int8_t (* Init) (void);
+ int8_t (* Init) (USBD_HandleTypeDef *pdev);
int8_t (* DeInit) (void);
int8_t (* Control) (uint8_t, uint8_t * , uint16_t);
- int8_t (* Receive) (uint8_t *, uint32_t *);
+ int8_t (* Receive) (USBD_HandleTypeDef *pdev, uint8_t *, uint32_t *);
} USBD_CDC_ItfTypeDef;
typedef struct {
@@ -48,8 +48,8 @@ typedef struct {
} USBD_CDC_HandleTypeDef;
typedef struct _USBD_HID_Itf {
- int8_t (* Init) (void);
- int8_t (* Receive)(uint8_t *, uint32_t);
+ int8_t (* Init) (USBD_HandleTypeDef *pdev);
+ int8_t (* Receive)(USBD_HandleTypeDef *pdev, uint8_t *, uint32_t);
} USBD_HID_ItfTypeDef;
typedef struct _USBD_STORAGE {
diff --git a/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c
index cfae7224d4..e0edf13702 100644
--- a/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c
+++ b/stmhal/usbdev/class/src/usbd_cdc_msc_hid.c
@@ -669,7 +669,7 @@ static uint8_t USBD_CDC_MSC_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) {
CDC_CMD_PACKET_SIZE);
// Init physical Interface components
- CDC_fops->Init();
+ CDC_fops->Init(pdev);
// Init Xfer states
CDC_ClassData.TxState =0;
@@ -724,7 +724,7 @@ static uint8_t USBD_CDC_MSC_HID_Init(USBD_HandleTypeDef *pdev, uint8_t cfgidx) {
USBD_EP_TYPE_INTR,
mps_out);
- HID_fops->Init();
+ HID_fops->Init(pdev);
// Prepare Out endpoint to receive next packet
USBD_LL_PrepareReceive(pdev, hid_out_ep, HID_ClassData.RxBuffer, mps_out);
@@ -963,7 +963,7 @@ static uint8_t USBD_CDC_MSC_HID_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum)
/* USB data will be immediately processed, this allow next USB traffic being
NAKed till the end of the application Xfer */
- CDC_fops->Receive(CDC_ClassData.RxBuffer, &CDC_ClassData.RxLength);
+ CDC_fops->Receive(pdev, CDC_ClassData.RxBuffer, &CDC_ClassData.RxLength);
return USBD_OK;
} else if ((usbd_mode & USBD_MODE_MSC) && epnum == (MSC_OUT_EP & 0x7f)) {
@@ -971,7 +971,7 @@ static uint8_t USBD_CDC_MSC_HID_DataOut(USBD_HandleTypeDef *pdev, uint8_t epnum)
return USBD_OK;
} else if ((usbd_mode & USBD_MODE_HID) && epnum == (hid_out_ep & 0x7f)) {
HID_ClassData.RxLength = USBD_LL_GetRxDataSize(pdev, epnum);
- HID_fops->Receive(HID_ClassData.RxBuffer, HID_ClassData.RxLength);
+ HID_fops->Receive(pdev, HID_ClassData.RxBuffer, HID_ClassData.RxLength);
}
return USBD_OK;