diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/inc/usbd_hid_core.h b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/inc/usbd_hid_core.h index 96e654725..00971a591 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/inc/usbd_hid_core.h +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/inc/usbd_hid_core.h @@ -89,7 +89,7 @@ * @{ */ -extern USBD_Class_cb_TypeDef USBD_HID_cb; +extern const USBD_Class_cb_TypeDef USBD_HID_cb; /** * @} */ diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c index eef2b9c63..5af6c40d4 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c @@ -101,7 +101,7 @@ uint8_t USBD_MSC_DataIn (void *pdev, uint8_t USBD_MSC_DataOut (void *pdev, uint8_t epnum); -uint8_t *USBD_MSC_GetCfgDesc (uint8_t speed, +const uint8_t *USBD_MSC_GetCfgDesc (uint8_t speed, uint16_t *length); #ifdef USB_OTG_HS_CORE @@ -458,7 +458,7 @@ uint8_t USBD_MSC_DataOut (void *pdev, * @param length : pointer data length * @retval pointer to descriptor buffer */ -uint8_t *USBD_MSC_GetCfgDesc (uint8_t speed, uint16_t *length) +const uint8_t *USBD_MSC_GetCfgDesc (uint8_t speed, uint16_t *length) { *length = sizeof (USBD_MSC_CfgDesc); return USBD_MSC_CfgDesc; diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_core.h b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_core.h index 184e8d4a7..40aa25cc4 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_core.h +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_core.h @@ -90,9 +90,9 @@ typedef enum { */ void USBD_Init(USB_OTG_CORE_HANDLE *pdev, USB_OTG_CORE_ID_TypeDef coreID, - USBD_DEVICE *pDevice, - USBD_Class_cb_TypeDef *class_cb, - USBD_Usr_cb_TypeDef *usr_cb); + const USBD_DEVICE *pDevice, + const USBD_Class_cb_TypeDef *class_cb, + const USBD_Usr_cb_TypeDef *usr_cb); USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev); diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h index 3f6aea1a9..8ffeb328a 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h @@ -83,7 +83,7 @@ */ USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev, - uint8_t *buf, + const uint8_t *buf, uint16_t len); USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev, diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_usr.h b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_usr.h index bd5ff3e2e..9ee54928b 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_usr.h +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc/usbd_usr.h @@ -51,9 +51,9 @@ * @{ */ -extern USBD_Usr_cb_TypeDef USR_cb; -extern USBD_Usr_cb_TypeDef USR_FS_cb; -extern USBD_Usr_cb_TypeDef USR_HS_cb; +extern const USBD_Usr_cb_TypeDef USR_cb; +extern const USBD_Usr_cb_TypeDef USR_FS_cb; +extern const USBD_Usr_cb_TypeDef USR_HS_cb; diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_core.c b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_core.c index 80fc241f9..7e9fc3b99 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_core.c +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_core.c @@ -96,7 +96,7 @@ static uint8_t USBD_RunTestMode (USB_OTG_CORE_HANDLE *pdev) ; __IO USB_OTG_DCTL_TypeDef SET_TEST_MODE; -USBD_DCD_INT_cb_TypeDef USBD_DCD_INT_cb = +const USBD_DCD_INT_cb_TypeDef USBD_DCD_INT_cb = { USBD_DataOutStage, USBD_DataInStage, @@ -113,7 +113,7 @@ USBD_DevDisconnected, #endif }; -USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops = &USBD_DCD_INT_cb; +const USBD_DCD_INT_cb_TypeDef * const USBD_DCD_INT_fops = &USBD_DCD_INT_cb; /** * @} */ @@ -133,9 +133,9 @@ USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops = &USBD_DCD_INT_cb; */ void USBD_Init(USB_OTG_CORE_HANDLE *pdev, USB_OTG_CORE_ID_TypeDef coreID, - USBD_DEVICE *pDevice, - USBD_Class_cb_TypeDef *class_cb, - USBD_Usr_cb_TypeDef *usr_cb) + const USBD_DEVICE *pDevice, + const USBD_Class_cb_TypeDef *class_cb, + const USBD_Usr_cb_TypeDef *usr_cb) { /* Hardware Init */ USB_OTG_BSP_Init(pdev); diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c index a9e4a8636..ae06adb33 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c @@ -93,7 +93,7 @@ * @retval status */ USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev, - uint8_t *pbuf, + const uint8_t *pbuf, uint16_t len) { USBD_Status ret = USBD_OK; diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c index d94189f68..67de98d8d 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c @@ -83,7 +83,7 @@ __ALIGN_BEGIN uint32_t USBD_ep_status __ALIGN_END = 0; #pragma data_alignment=4 #endif #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ -__ALIGN_BEGIN uint32_t USBD_default_cfg __ALIGN_END = 0; +__ALIGN_BEGIN const uint32_t USBD_default_cfg __ALIGN_END = 0; #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED #if defined ( __ICCARM__ ) /*!< IAR Compiler */ @@ -381,7 +381,7 @@ static void USBD_GetDescriptor(USB_OTG_CORE_HANDLE *pdev, break; case USB_DESC_TYPE_CONFIGURATION: - pbuf = (uint8_t *)pdev->dev.class_cb->GetConfigDescriptor(pdev->cfg.speed, &len); + pbuf = (uint8_t *)pdev->dev.class_cb->GetConfigDescriptor(pdev->cfg.speed, &len); #ifdef USB_OTG_HS_CORE if((pdev->cfg.speed == USB_OTG_SPEED_FULL )&& (pdev->cfg.phy_itface == USB_OTG_ULPI_PHY)) @@ -397,7 +397,7 @@ static void USBD_GetDescriptor(USB_OTG_CORE_HANDLE *pdev, switch ((uint8_t)(req->wValue)) { case USBD_IDX_LANGID_STR: - pbuf = pdev->dev.usr_device->GetLangIDStrDescriptor(pdev->cfg.speed, &len); + pbuf = pdev->dev.usr_device->GetLangIDStrDescriptor(pdev->cfg.speed, &len); break; case USBD_IDX_MFC_STR: @@ -625,7 +625,7 @@ static void USBD_GetConfig(USB_OTG_CORE_HANDLE *pdev, case USB_OTG_ADDRESSED: USBD_CtlSendData (pdev, - (uint8_t *)&USBD_default_cfg, + (const uint8_t *)&USBD_default_cfg, 1); break; diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_core.h b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_core.h index d44003b4f..f68d949ff 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_core.h +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_core.h @@ -222,9 +222,9 @@ typedef struct _Device_cb uint8_t (*IsoINIncomplete) (void *pdev); uint8_t (*IsoOUTIncomplete) (void *pdev); - uint8_t *(*GetConfigDescriptor)( uint8_t speed , uint16_t *length); + const uint8_t *(*GetConfigDescriptor)( uint8_t speed , uint16_t *length); #ifdef USB_OTG_HS_CORE - uint8_t *(*GetOtherConfigDescriptor)( uint8_t speed , uint16_t *length); + const uint8_t *(*GetOtherConfigDescriptor)( uint8_t speed , uint16_t *length); #endif #ifdef USB_SUPPORT_USER_STRING_DESC @@ -262,9 +262,9 @@ typedef struct _DCD USB_OTG_EP in_ep [USB_OTG_MAX_TX_FIFOS]; USB_OTG_EP out_ep [USB_OTG_MAX_TX_FIFOS]; uint8_t setup_packet [8*3]; - USBD_Class_cb_TypeDef *class_cb; - USBD_Usr_cb_TypeDef *usr_cb; - USBD_DEVICE *usr_device; + const USBD_Class_cb_TypeDef *class_cb; + const USBD_Usr_cb_TypeDef *usr_cb; + const USBD_DEVICE *usr_device; uint8_t *pConfig_descriptor; } DCD_DEV , *DCD_PDEV; diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd.h b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd.h index a1eb7a5e3..5027c878c 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd.h +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd.h @@ -127,7 +127,7 @@ uint32_t DCD_EP_PrepareRx ( USB_OTG_CORE_HANDLE *pdev, uint32_t DCD_EP_Tx (USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr, - uint8_t *pbuf, + const uint8_t *pbuf, uint32_t buf_len); uint32_t DCD_EP_Stall (USB_OTG_CORE_HANDLE *pdev, uint8_t epnum); diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h index e2369e5dd..351eeb232 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h @@ -65,7 +65,7 @@ typedef struct _USBD_DCD_INT }USBD_DCD_INT_cb_TypeDef; -extern USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops; +extern const USBD_DCD_INT_cb_TypeDef * const USBD_DCD_INT_fops; /** * @} */ diff --git a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c index eac8c3371..85df8652e 100644 --- a/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c +++ b/radio/src/targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c @@ -260,7 +260,7 @@ uint32_t DCD_EP_PrepareRx( USB_OTG_CORE_HANDLE *pdev, */ uint32_t DCD_EP_Tx ( USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr, - uint8_t *pbuf, + const uint8_t *pbuf, uint32_t buf_len) { USB_OTG_EP *ep; @@ -270,7 +270,7 @@ uint32_t DCD_EP_Tx ( USB_OTG_CORE_HANDLE *pdev, /* Setup and start the Transfer */ ep->is_in = 1; ep->num = ep_addr & 0x7F; - ep->xfer_buff = pbuf; + ep->xfer_buff = (uint8_t*)pbuf; //remove const qualifier, safe to do because we are sending ep->dma_addr = (uint32_t)pbuf; ep->xfer_count = 0; ep->xfer_len = buf_len; diff --git a/radio/src/targets/taranis/usbd_desc.c b/radio/src/targets/taranis/usbd_desc.c index 9e476b161..d9e8b353e 100644 --- a/radio/src/targets/taranis/usbd_desc.c +++ b/radio/src/targets/taranis/usbd_desc.c @@ -26,6 +26,7 @@ */ /* Includes ------------------------------------------------------------------*/ +#include #include "usbd_core.h" #include "usbd_desc.h" #include "usbd_req.h" @@ -81,7 +82,7 @@ #endif #endif -USBD_DEVICE USR_desc = +const USBD_DEVICE USR_desc = { USBD_USR_DeviceDescriptor, USBD_USR_LangIDStrDescriptor, @@ -93,7 +94,7 @@ USBD_DEVICE USR_desc = }; /* USB Standard Device Descriptor */ -__ALIGN_BEGIN uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END = +__ALIGN_BEGIN const uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END = { 0x12, /*bLength */ USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/ @@ -116,7 +117,7 @@ __ALIGN_BEGIN uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END = } ; /* USB_DeviceDescriptor */ /* USB Standard Device Descriptor */ -__ALIGN_BEGIN uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END = +__ALIGN_BEGIN const uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALIGN_END = { USB_LEN_DEV_QUALIFIER_DESC, USB_DESC_TYPE_DEVICE_QUALIFIER, @@ -131,7 +132,7 @@ __ALIGN_BEGIN uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC] __ALI }; /* USB Standard Device Descriptor */ -__ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID] __ALIGN_END = +__ALIGN_BEGIN const uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID] __ALIGN_END = { USB_SIZ_STRING_LANGID, USB_DESC_TYPE_STRING, @@ -149,7 +150,8 @@ __ALIGN_BEGIN uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID] __ALIGN_END = uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length) { *length = sizeof(USBD_DeviceDesc); - return USBD_DeviceDesc; + memcpy(USBD_StrDesc, USBD_DeviceDesc, *length); + return USBD_StrDesc; } /** @@ -162,7 +164,8 @@ uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length) uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length) { *length = sizeof(USBD_LangIDDesc); - return USBD_LangIDDesc; + memcpy(USBD_StrDesc, USBD_LangIDDesc, *length); + return USBD_StrDesc; } diff --git a/radio/src/targets/taranis/usbd_desc.h b/radio/src/targets/taranis/usbd_desc.h index a6dc86291..7a9d5b564 100644 --- a/radio/src/targets/taranis/usbd_desc.h +++ b/radio/src/targets/taranis/usbd_desc.h @@ -77,12 +77,12 @@ /** @defgroup USBD_DESC_Exported_Variables * @{ */ -extern uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC]; -extern uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ]; -extern uint8_t USBD_OtherSpeedCfgDesc[USB_LEN_CFG_DESC]; -extern uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC]; -extern uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID]; -extern USBD_DEVICE USR_desc; +extern const uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC]; +extern uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ]; +extern const uint8_t USBD_OtherSpeedCfgDesc[USB_LEN_CFG_DESC]; +extern const uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC]; +extern const uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID]; +extern const USBD_DEVICE USR_desc; /** * @} */ diff --git a/radio/src/targets/taranis/usbd_hid_joystick.c b/radio/src/targets/taranis/usbd_hid_joystick.c index 29870a824..33a6c3d85 100644 --- a/radio/src/targets/taranis/usbd_hid_joystick.c +++ b/radio/src/targets/taranis/usbd_hid_joystick.c @@ -102,7 +102,7 @@ static uint8_t USBD_HID_DeInit (void *pdev, static uint8_t USBD_HID_Setup (void *pdev, USB_SETUP_REQ *req); -static uint8_t *USBD_HID_GetCfgDesc (uint8_t speed, uint16_t *length); +static const uint8_t *USBD_HID_GetCfgDesc (uint8_t speed, uint16_t *length); static uint8_t USBD_HID_DataIn (void *pdev, uint8_t epnum); /** @@ -135,7 +135,7 @@ static uint8_t USBD_HID_DataIn (void *pdev, uint8_t epnum); uint8_t S2; //analog value, mapped to channel 8 } */ -__ALIGN_BEGIN static uint8_t HID_JOYSTICK_ReportDesc[] __ALIGN_END = +__ALIGN_BEGIN static const uint8_t HID_JOYSTICK_ReportDesc[] __ALIGN_END = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x05, // USAGE (Game Pad) @@ -172,7 +172,7 @@ __ALIGN_BEGIN static uint8_t HID_JOYSTICK_ReportDesc[] __ALIGN_END = * @{ */ -USBD_Class_cb_TypeDef USBD_HID_cb = +const USBD_Class_cb_TypeDef USBD_HID_cb = { USBD_HID_Init, USBD_HID_DeInit, @@ -217,7 +217,7 @@ __ALIGN_BEGIN static uint32_t USBD_HID_IdleState __ALIGN_END = 0; #endif #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ /* USB HID device Configuration Descriptor */ -__ALIGN_BEGIN static uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] __ALIGN_END = +__ALIGN_BEGIN static const uint8_t USBD_HID_CfgDesc[USB_HID_CONFIG_DESC_SIZ] __ALIGN_END = { 0x09, /* bLength: Configuration Descriptor size */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */ @@ -334,7 +334,7 @@ static uint8_t USBD_HID_Setup (void *pdev, USB_SETUP_REQ *req) { uint16_t len = 0; - uint8_t *pbuf = NULL; + const uint8_t *pbuf = NULL; switch (req->bmRequest & USB_REQ_TYPE_MASK) { @@ -439,7 +439,7 @@ uint8_t USBD_HID_SendReport (USB_OTG_CORE_HANDLE *pdev, * @param length : pointer data length * @retval pointer to descriptor buffer */ -static uint8_t *USBD_HID_GetCfgDesc (uint8_t speed, uint16_t *length) +static const uint8_t *USBD_HID_GetCfgDesc (uint8_t speed, uint16_t *length) { *length = sizeof (USBD_HID_CfgDesc); return USBD_HID_CfgDesc; diff --git a/radio/src/targets/taranis/usbd_usr.cpp b/radio/src/targets/taranis/usbd_usr.cpp index 28717401e..a1d241f4c 100644 --- a/radio/src/targets/taranis/usbd_usr.cpp +++ b/radio/src/targets/taranis/usbd_usr.cpp @@ -35,7 +35,7 @@ extern "C" { /* The purpose of this register is to speed up the execution */ -USBD_Usr_cb_TypeDef USR_cb = +const USBD_Usr_cb_TypeDef USR_cb = { USBD_USR_Init, USBD_USR_DeviceReset,