Skip to content

Commit 035697f

Browse files
dlechdpgeorge
authored andcommitted
L0_HAL/usb: Pass USB_OTG_CfgTypeDef by reference.
USB_OTG_CfgTypeDef is a large struct, so passing by reference should be more efficient in terms of stack usage and code size. Signed-off-by: David Lechner <[email protected]>
1 parent 89fd6b1 commit 035697f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ typedef struct
169169
*/
170170

171171

172-
HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg);
173-
HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg);
172+
HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, const USB_CfgTypeDef *cfg);
173+
HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, const USB_CfgTypeDef *cfg);
174174
HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx);
175175
HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx);
176176
HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode);

STM32L0xx_HAL_Driver/Src/stm32l0xx_hal_pcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd)
194194
}
195195

196196
/* Init Device */
197-
if (USB_DevInit(hpcd->Instance, hpcd->Init) != HAL_OK)
197+
if (USB_DevInit(hpcd->Instance, &hpcd->Init) != HAL_OK)
198198
{
199199
hpcd->State = HAL_PCD_STATE_ERROR;
200200
return HAL_ERROR;

STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* the configuration information for the specified USBx peripheral.
6262
* @retval HAL status
6363
*/
64-
HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg)
64+
HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, const USB_CfgTypeDef *cfg)
6565
{
6666
/* Prevent unused argument(s) compilation warning */
6767
UNUSED(USBx);
@@ -148,7 +148,7 @@ HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode)
148148
* the configuration information for the specified USBx peripheral.
149149
* @retval HAL status
150150
*/
151-
HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg)
151+
HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, const USB_CfgTypeDef *cfg)
152152
{
153153
/* Prevent unused argument(s) compilation warning */
154154
UNUSED(cfg);

0 commit comments

Comments
 (0)