Skip to content

Commit 6b5302c

Browse files
bcostmcmonr
authored andcommitted
Add more comments
1 parent 5fa45e8 commit 6b5302c

File tree

8 files changed

+57
-9
lines changed

8 files changed

+57
-9
lines changed

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_def.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,13 @@ typedef enum
122122
(__HANDLE__)->Lock = HAL_UNLOCKED; \
123123
}while (0)
124124
#endif /* USE_RTOS */
125+
126+
// Added for MBED PR #3062
125127
#if defined (__CC_ARM)
126128
#pragma diag_suppress 3731
127129
#endif
128130

131+
// Added for MBED PR #3062
129132
static inline void atomic_set_u32(volatile uint32_t *ptr, uint32_t mask)
130133
{
131134
uint32_t newValue;
@@ -135,7 +138,7 @@ static inline void atomic_set_u32(volatile uint32_t *ptr, uint32_t mask)
135138
} while (__STREXW(newValue, ptr));
136139
}
137140

138-
141+
// Added for MBED PR #3062
139142
static inline void atomic_clr_u32(volatile uint32_t *ptr, uint32_t mask)
140143
{
141144
uint32_t newValue;

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_hcd.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ HAL_StatusTypeDef HAL_HCD_HC_Init(HCD_HandleTypeDef *hhcd,
206206
hhcd->hc[ch_num].ep_num = epnum & 0x7F;
207207
hhcd->hc[ch_num].ep_is_in = ((epnum & 0x80) == 0x80);
208208
hhcd->hc[ch_num].speed = speed;
209-
/* reset to 0 */
209+
210+
// Added for MBED PR #3432
211+
/* reset to 0 */
210212
hhcd->hc[ch_num].toggle_out = 0;
211213
hhcd->hc[ch_num].toggle_in = 0;
212214

@@ -346,6 +348,7 @@ HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd,
346348
uint16_t length,
347349
uint8_t do_ping)
348350
{
351+
// Added for MBED PR #3432
349352
if ((hhcd->hc[ch_num].ep_is_in != direction)) {
350353
if ((hhcd->hc[ch_num].ep_type == EP_TYPE_CTRL)){
351354
/* reconfigure the endpoint !!! from tx -> rx, and rx ->tx */
@@ -401,6 +404,7 @@ HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd,
401404
hhcd->hc[ch_num].do_ping = do_ping;
402405
}
403406
}
407+
// Added for MBED PR #3432
404408
else if ((token == 1) && (direction == 1))
405409
{
406410
if( hhcd->hc[ch_num].toggle_in == 0)
@@ -910,6 +914,7 @@ static void HCD_HC_IN_IRQHandler (HCD_HandleTypeDef *hhcd, uint8_t chnum)
910914
}
911915
else if ((USBx_HC(chnum)->HCINT) & USB_OTG_HCINT_CHH)
912916
{
917+
// Added for MBED PR #3432
913918
int reactivate = 0;
914919
__HAL_HCD_MASK_HALT_HC_INT(chnum);
915920

@@ -939,13 +944,15 @@ static void HCD_HC_IN_IRQHandler (HCD_HandleTypeDef *hhcd, uint8_t chnum)
939944
/* re-activate the channel */
940945
tmpreg = USBx_HC(chnum)->HCCHAR;
941946
tmpreg &= ~USB_OTG_HCCHAR_CHDIS;
947+
// Added for MBED PR #3432 #4231
942948
if ( hhcd->hc[chnum].urb_state != URB_ERROR) {
943949
tmpreg |= USB_OTG_HCCHAR_CHENA;
944950
reactivate = 1;
945951
}
946952
USBx_HC(chnum)->HCCHAR = tmpreg;
947953
}
948954
__HAL_HCD_CLEAR_HC_INT(chnum, USB_OTG_HCINT_CHH);
955+
// Added for MBED PR #3432 #4231
949956
if (hhcd->hc[chnum].state == 0) reactivate = 1;
950957
if (reactivate == 0) HAL_HCD_HC_NotifyURBChange_Callback(hhcd, chnum, hhcd->hc[chnum].urb_state);
951958
}

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_i2c.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,6 +2592,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Transmit_IT(I2C_HandleTypeDef *hi2c,
25922592
/* Prepare transfer parameters */
25932593
hi2c->pBuffPtr = pData;
25942594
hi2c->XferCount = Size;
2595+
// Added for MBED PR #3324
25952596
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
25962597
hi2c->XferISR = I2C_Master_ISR_IT;
25972598

@@ -2665,6 +2666,7 @@ HAL_StatusTypeDef HAL_I2C_Master_Sequential_Receive_IT(I2C_HandleTypeDef *hi2c,
26652666
/* Prepare transfer parameters */
26662667
hi2c->pBuffPtr = pData;
26672668
hi2c->XferCount = Size;
2669+
// Added for MBED PR #3324
26682670
hi2c->XferOptions = (XferOptions & (~I2C_RELOAD_MODE));
26692671
hi2c->XferISR = I2C_Master_ISR_IT;
26702672

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_pcd.c

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,11 @@ HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd)
162162
{
163163
/* Allocate lock resource and initialize it */
164164
hpcd->Lock = HAL_UNLOCKED;
165-
for (index = 0; index < hpcd->Init.dev_endpoints ; index++)
166-
hpcd->EPLock[index].Lock = HAL_UNLOCKED;
165+
166+
// Added for MBED PR #3062
167+
for (index = 0; index < hpcd->Init.dev_endpoints ; index++)
168+
hpcd->EPLock[index].Lock = HAL_UNLOCKED;
169+
167170
/* Init the low level hardware : GPIO, CLOCK, NVIC... */
168171
HAL_PCD_MspInit(hpcd);
169172
}
@@ -469,6 +472,8 @@ void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
469472
if(( epint & USB_OTG_DIEPINT_XFRC) == USB_OTG_DIEPINT_XFRC)
470473
{
471474
fifoemptymsk = 0x1 << epnum;
475+
476+
// Added for MBED PR #3062
472477
atomic_clr_u32(&USBx_DEVICE->DIEPEMPMSK, fifoemptymsk);
473478

474479
CLEAR_IN_EP_INTR(epnum, USB_OTG_DIEPINT_XFRC);
@@ -1188,6 +1193,7 @@ HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, u
11881193
ep->is_in = 0;
11891194
ep->num = ep_addr & 0x7F;
11901195

1196+
// Added for MBED PR #3062
11911197
__HAL_LOCK(&hpcd->EPLock[ep_addr & 0x7F]);
11921198

11931199
if ((ep_addr & 0x7F) == 0 )
@@ -1198,6 +1204,8 @@ HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, u
11981204
{
11991205
USB_EPStartXfer(hpcd->Instance, ep, hpcd->Init.dma_enable);
12001206
}
1207+
1208+
// Added for MBED PR #3062
12011209
__HAL_UNLOCK(&hpcd->EPLock[ep_addr & 0x7F]);
12021210

12031211
return HAL_OK;
@@ -1233,7 +1241,8 @@ HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr,
12331241
ep->xfer_count = 0;
12341242
ep->is_in = 1;
12351243
ep->num = ep_addr & 0x7F;
1236-
1244+
1245+
// Added for MBED PR #3062
12371246
__HAL_LOCK(&hpcd->EPLock[ep_addr & 0x7F]);
12381247

12391248
if ((ep_addr & 0x7F) == 0 )
@@ -1244,7 +1253,8 @@ HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr,
12441253
{
12451254
USB_EPStartXfer(hpcd->Instance, ep, hpcd->Init.dma_enable);
12461255
}
1247-
1256+
1257+
// Added for MBED PR #3062
12481258
__HAL_UNLOCK(&hpcd->EPLock[ep_addr & 0x7F]);
12491259

12501260
return HAL_OK;
@@ -1272,13 +1282,17 @@ HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
12721282
ep->is_stall = 1;
12731283
ep->num = ep_addr & 0x7F;
12741284
ep->is_in = ((ep_addr & 0x80) == 0x80);
1275-
1285+
1286+
// Added for MBED PR #3062
12761287
__HAL_LOCK(&hpcd->EPLock[ep_addr & 0x7F]);
1288+
12771289
USB_EPSetStall(hpcd->Instance , ep);
12781290
if((ep_addr & 0x7F) == 0)
12791291
{
12801292
USB_EP0_OutStart(hpcd->Instance, hpcd->Init.dma_enable, (uint8_t *)hpcd->Setup);
12811293
}
1294+
1295+
// Added for MBED PR #3062
12821296
__HAL_UNLOCK(&hpcd->EPLock[ep_addr & 0x7F]);
12831297

12841298
return HAL_OK;
@@ -1306,9 +1320,13 @@ HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
13061320
ep->is_stall = 0;
13071321
ep->num = ep_addr & 0x7F;
13081322
ep->is_in = ((ep_addr & 0x80) == 0x80);
1309-
1323+
1324+
// Added for MBED PR #3062
13101325
__HAL_LOCK(&hpcd->EPLock[ep_addr & 0x7F]);
1326+
13111327
USB_EPClearStall(hpcd->Instance , ep);
1328+
1329+
// Added for MBED PR #3062
13121330
__HAL_UNLOCK(&hpcd->EPLock[ep_addr & 0x7F]);
13131331

13141332
return HAL_OK;
@@ -1322,7 +1340,9 @@ HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
13221340
*/
13231341
HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
13241342
{
1343+
// Added for MBED PR #3062
13251344
__HAL_LOCK(&hpcd->EPLock[ep_addr & 0x7F]);
1345+
13261346
if ((ep_addr & 0x80) == 0x80)
13271347
{
13281348
USB_FlushTxFifo(hpcd->Instance, ep_addr & 0x7F);
@@ -1331,7 +1351,8 @@ HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
13311351
{
13321352
USB_FlushRxFifo(hpcd->Instance);
13331353
}
1334-
1354+
1355+
// Added for MBED PR #3062
13351356
__HAL_UNLOCK(&hpcd->EPLock[ep_addr & 0x7F]);
13361357

13371358
return HAL_OK;
@@ -1444,6 +1465,7 @@ static HAL_StatusTypeDef PCD_WriteEmptyTxFifo(PCD_HandleTypeDef *hpcd, uint32_t
14441465
if(len <= 0)
14451466
{
14461467
fifoemptymsk = 0x1 << epnum;
1468+
// Added for MBED PR #3062
14471469
atomic_clr_u32(&USBx_DEVICE->DIEPEMPMSK, fifoemptymsk);
14481470

14491471
}

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_pcd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ typedef USB_TypeDef PCD_TypeDef;
117117
typedef USB_CfgTypeDef PCD_InitTypeDef;
118118
typedef USB_EPTypeDef PCD_EPTypeDef;
119119
#endif /* USB */
120+
121+
// Added for MBED PR #3062
120122
typedef struct
121123
{
122124
HAL_LockTypeDef Lock;
@@ -133,6 +135,7 @@ typedef struct
133135
PCD_EPTypeDef IN_ep[15]; /*!< IN endpoint parameters */
134136
PCD_EPTypeDef OUT_ep[15]; /*!< OUT endpoint parameters */
135137
HAL_LockTypeDef Lock; /*!< PCD peripheral status */
138+
// Added for MBED PR #3062
136139
PCD_EPLockDef EPLock[15];
137140
__IO PCD_StateTypeDef State; /*!< PCD communication state */
138141
uint32_t Setup[12]; /*!< Setup packet buffer */

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_hal_spi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint
650650
hspi->ErrorCode = HAL_SPI_ERROR_FLAG;
651651
}
652652

653+
// Added for MBED PR #4975
653654
if (hspi->Init.Direction == SPI_DIRECTION_1LINE) {
654655
__HAL_SPI_DISABLE(hspi);
655656
}

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_ll_usb.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,7 @@ HAL_StatusTypeDef USB_EPStartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeDe
570570
/* Enable the Tx FIFO Empty Interrupt for this EP */
571571
if (ep->xfer_len > 0)
572572
{
573+
// Added for MBED PR #3062
573574
atomic_set_u32(&USBx_DEVICE->DIEPEMPMSK, 1 << ep->num);
574575
}
575576
}
@@ -680,6 +681,7 @@ HAL_StatusTypeDef USB_EP0StartXfer(USB_OTG_GlobalTypeDef *USBx , USB_OTG_EPTypeD
680681
/* Enable the Tx FIFO Empty Interrupt for this EP */
681682
if (ep->xfer_len > 0)
682683
{
684+
// Added for MBED PR #3062
683685
atomic_set_u32(&USBx_DEVICE->DIEPEMPMSK, 1 << (ep->num));
684686
}
685687

@@ -1406,6 +1408,7 @@ HAL_StatusTypeDef USB_HC_StartXfer(USB_OTG_GlobalTypeDef *USBx, USB_OTG_HCTypeDe
14061408

14071409
/* Write packet into the Tx FIFO. */
14081410
USB_WritePacket(USBx, hc->xfer_buff, hc->ch_num, hc->xfer_len, 0);
1411+
// Added for MBED PR #3432
14091412
hc->xfer_count = hc->xfer_len;
14101413

14111414
}

targets/TARGET_STM/TARGET_STM32L4/device/stm32l4xx_ll_utils.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@
3838
#include "stm32l4xx_ll_system.h"
3939
#include "stm32l4xx_ll_pwr.h"
4040

41+
// Removed from MBED PR #3410
42+
//#ifdef USE_FULL_ASSERT
43+
//#include "stm32_assert.h"
44+
//#else
45+
//#define assert_param(expr) ((void)0U)
46+
//#endif /* USE_FULL_ASSERT */
47+
4148
/** @addtogroup STM32L4xx_LL_Driver
4249
* @{
4350
*/

0 commit comments

Comments
 (0)