Skip to content

Commit

Permalink
Release v1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ASEHSTM committed Jul 2, 2024
1 parent 2d3131e commit 98f52ec
Show file tree
Hide file tree
Showing 2,306 changed files with 574,052 additions and 5,958 deletions.
2 changes: 1 addition & 1 deletion Drivers/BSP/B-G474E-DPOW1
2 changes: 1 addition & 1 deletion Drivers/BSP/STM32G474E-EVAL
2 changes: 1 addition & 1 deletion Drivers/STM32G4xx_HAL_Driver
Submodule STM32G4xx_HAL_Driver updated 71 files
+477 −22 Inc/Legacy/stm32_hal_legacy.h
+2 −0 Inc/stm32g4xx_hal.h
+1 −1 Inc/stm32g4xx_hal_adc.h
+7 −7 Inc/stm32g4xx_hal_adc_ex.h
+161 −161 Inc/stm32g4xx_hal_comp.h
+16 −5 Inc/stm32g4xx_hal_cordic.h
+2 −2 Inc/stm32g4xx_hal_dac.h
+4 −4 Inc/stm32g4xx_hal_dac_ex.h
+4 −8 Inc/stm32g4xx_hal_fmac.h
+15 −0 Inc/stm32g4xx_hal_i2c_ex.h
+217 −4 Inc/stm32g4xx_hal_irda_ex.h
+2 −2 Inc/stm32g4xx_hal_lptim.h
+4 −2 Inc/stm32g4xx_hal_opamp.h
+4 −2 Inc/stm32g4xx_hal_opamp_ex.h
+7 −10 Inc/stm32g4xx_hal_pcd.h
+0 −1 Inc/stm32g4xx_hal_pcd_ex.h
+28 −2 Inc/stm32g4xx_hal_rcc_ex.h
+4 −0 Inc/stm32g4xx_hal_sai.h
+4 −0 Inc/stm32g4xx_hal_sai_ex.h
+52 −0 Inc/stm32g4xx_hal_smartcard.h
+4 −0 Inc/stm32g4xx_hal_smbus_ex.h
+2 −3 Inc/stm32g4xx_hal_uart.h
+280 −4 Inc/stm32g4xx_hal_uart_ex.h
+53 −2 Inc/stm32g4xx_hal_usart.h
+1 −1 Inc/stm32g4xx_ll_adc.h
+12 −16 Inc/stm32g4xx_ll_cordic.h
+0 −6 Inc/stm32g4xx_ll_fmac.h
+15 −0 Inc/stm32g4xx_ll_lpuart.h
+2 −0 Inc/stm32g4xx_ll_pwr.h
+10 −0 Inc/stm32g4xx_ll_rcc.h
+1 −1 Inc/stm32g4xx_ll_rng.h
+8 −1 Inc/stm32g4xx_ll_system.h
+6 −6 Inc/stm32g4xx_ll_ucpd.h
+3 −4 Inc/stm32g4xx_ll_utils.h
+203 −111 Release_Notes.html
+6 −5 Src/stm32g4xx_hal.c
+1 −1 Src/stm32g4xx_hal_comp.c
+1 −1 Src/stm32g4xx_hal_cordic.c
+5 −7 Src/stm32g4xx_hal_cryp.c
+3 −4 Src/stm32g4xx_hal_dac_ex.c
+1 −1 Src/stm32g4xx_hal_dma.c
+2 −2 Src/stm32g4xx_hal_flash_ex.c
+1 −6 Src/stm32g4xx_hal_fmac.c
+27 −13 Src/stm32g4xx_hal_i2c.c
+3 −4 Src/stm32g4xx_hal_opamp.c
+2 −0 Src/stm32g4xx_hal_opamp_ex.c
+2 −4 Src/stm32g4xx_hal_pcd.c
+0 −2 Src/stm32g4xx_hal_pcd_ex.c
+4 −4 Src/stm32g4xx_hal_pwr_ex.c
+44 −3 Src/stm32g4xx_hal_rcc_ex.c
+6 −4 Src/stm32g4xx_hal_sai.c
+4 −1 Src/stm32g4xx_hal_sai_ex.c
+1 −1 Src/stm32g4xx_hal_smartcard.c
+2 −0 Src/stm32g4xx_hal_smbus_ex.c
+24 −0 Src/stm32g4xx_hal_uart.c
+1 −1 Src/stm32g4xx_hal_uart_ex.c
+8 −9 Src/stm32g4xx_hal_usart.c
+1 −1 Src/stm32g4xx_hal_usart_ex.c
+2 −2 Src/stm32g4xx_ll_adc.c
+146 −146 Src/stm32g4xx_ll_comp.c
+6 −6 Src/stm32g4xx_ll_dac.c
+0 −2 Src/stm32g4xx_ll_fmac.c
+2 −0 Src/stm32g4xx_ll_i2c.c
+25 −5 Src/stm32g4xx_ll_rcc.c
+1 −1 Src/stm32g4xx_ll_rng.c
+1 −1 Src/stm32g4xx_ll_ucpd.c
+4 −0 Src/stm32g4xx_ll_usart.c
+ _htmresc/favicon.png
+177 −180 _htmresc/mini-st.css
+ _htmresc/st_logo.png
+ _htmresc/st_logo_2020.png
243 changes: 143 additions & 100 deletions Middlewares/ST/STM32_USBPD_Library/Devices/STM32G4XX/Release_Notes.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ extern "C" {
usbpd_hw.c
-------------------------------------------------------------------------------*/

/* defined used to configure function : USBPD_HW_GetUSPDInstance */
/* Define used to configure function : USBPD_HW_GetUSPDInstance */
#define UCPD_INSTANCE0 UCPD1

/* defined used to configure function : USBPD_HW_Init_DMARxInstance,USBPD_HW_DeInit_DMARxInstance */
/* Define used to configure function : USBPD_HW_Init_DMARxInstance,USBPD_HW_DeInit_DMARxInstance */
#define UCPDDMA_INSTANCE0_CLOCKENABLE_RX \
do \
{ \
Expand All @@ -71,7 +71,7 @@ extern "C" {

#define UCPDDMA_INSTANCE0_CHANNEL_RX DMA1_Channel5

/* defined used to configure function : USBPD_HW_Init_DMATxInstance, USBPD_HW_DeInit_DMATxInstance */
/* Define used to configure function : USBPD_HW_Init_DMATxInstance, USBPD_HW_DeInit_DMATxInstance */
#define UCPDDMA_INSTANCE0_CLOCKENABLE_TX \
do \
{ \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
******************************************************************************
*/

#ifndef USBPD_HW_H
#define USBPD_HW_H
#ifndef __USBPD_HW_H_
#define __USBPD_HW_H_

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
/* Private typedef -----------------------------------------------------------*/
/* Variable containing ADC conversions results */
Expand All @@ -30,5 +35,9 @@ DMA_Channel_TypeDef *USBPD_HW_Init_DMATxInstance(uint8_t PortNum);
void USBPD_HW_DeInit_DMATxInstance(uint8_t PortNum);
uint32_t USBPD_HW_GetRpResistorValue(uint8_t Portnum);
void USBPD_HW_SetFRSSignalling(uint8_t Portnum, uint8_t cc);
#endif /* USBPD_BSP_HW_H */

#ifdef __cplusplus
}
#endif

#endif /* __USBPD_HW_H_ */

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ UCPD_TypeDef *USBPD_HW_GetUSPDInstance(uint8_t PortNum)
return UCPD_INSTANCE0;
}

#if !defined(USBPDCORE_LIB_NO_PD)
DMA_Channel_TypeDef *USBPD_HW_Init_DMARxInstance(uint8_t PortNum)
{
LL_DMA_InitTypeDef DMA_InitStruct;
Expand Down Expand Up @@ -92,6 +93,7 @@ void USBPD_HW_DeInit_DMATxInstance(uint8_t PortNum)
{
(void)PortNum;
}
#endif /* !USBPDCORE_LIB_NO_PD */

uint32_t USBPD_HW_GetRpResistorValue(uint8_t PortNum)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ USBPD_StatusTypeDef USBPD_PHY_Init(uint8_t PortNum, const USBPD_PHY_Callbacks *p
{
(void)PowerRole;

/* set all callbacks */
/* Set all callbacks */
Ports[PortNum].cbs.USBPD_HW_IF_TxCompleted = pCallbacks->USBPD_PHY_TxCompleted;
Ports[PortNum].cbs.USBPD_HW_IF_BistCompleted = pCallbacks->USBPD_PHY_BistCompleted;
Ports[PortNum].cbs.USBPD_HW_IF_RX_ResetIndication = pCallbacks->USBPD_PHY_ResetIndication;
Expand Down Expand Up @@ -165,8 +165,8 @@ uint16_t USBPD_PHY_GetMinGOODCRCTimerValue(uint8_t PortNum)
void USBPD_PHY_Reset(uint8_t PortNum)
{
(void)PortNum;
/* reset PHY layer */
/* reset HW_IF layer */
/* Reset PHY layer */
/* Reset HW_IF layer */
}

/**
Expand Down Expand Up @@ -322,13 +322,13 @@ void PHY_Rx_Completed(uint8_t PortNum, uint32_t MsgType)

_msgtype = tab_sop_value[MsgType];

/* check if the message must be forwarded to usbpd stack */
/* Check if the message must be forwarded to usbpd stack */
switch (_msgtype)
{
case USBPD_SOPTYPE_CABLE_RESET :
if (0x1Eu == (PHY_Ports[PortNum].SupportedSOP & 0x1Eu))
{
/* nothing to do the message will be discarded and the port partner retry the send */
/* Nothing to do the message will be discarded and the port partner retry the send */
Ports[PortNum].cbs.USBPD_HW_IF_RX_ResetIndication(PortNum, USBPD_SOPTYPE_CABLE_RESET);
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void USBPD_HW_IF_GlobalHwInit(void)
/* PWR register access (for disabling dead battery feature) */
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
LL_AHB1_GRP1_EnableClock(LL_AHB1_GRP1_PERIPH_CRC);

}

#if !defined(USBPDCORE_LIB_NO_PD)
Expand Down Expand Up @@ -146,6 +147,11 @@ void USBPD_HW_IF_Send_BIST_Pattern(uint8_t PortNum)
}
#endif /* !USBPDCORE_LIB_NO_PD */

/**
* @brief Assert Rp resistors
* @param PortNum Port
* @retval None
*/
void USBPDM1_AssertRp(uint8_t PortNum)
{
switch (Ports[PortNum].params->RpResistor)
Expand Down Expand Up @@ -178,13 +184,22 @@ void USBPDM1_AssertRp(uint8_t PortNum)
BSP_USBPD_PWR_SetRole(PortNum, POWER_ROLE_SOURCE);
#endif /* TCPP0203_SUPPORT */
}

/**
* @brief De-assert Rp resistors
* @param PortNum Port
* @retval None
*/
void USBPDM1_DeAssertRp(uint8_t PortNum)
{
/* not needed on STM32G4xx, so nothing to do, keep only for compatibility */
/* Not needed on STM32G4xx, so nothing to do, keep only for compatibility */
UNUSED(PortNum);
}

/**
* @brief Assert Rd resistors
* @param PortNum Port
* @retval None
*/
void USBPDM1_AssertRd(uint8_t PortNum)
{
LL_UCPD_TypeCDetectionCC2Disable(Ports[PortNum].husbpd);
Expand Down Expand Up @@ -214,34 +229,55 @@ void USBPDM1_AssertRd(uint8_t PortNum)
#endif /* TCPP0203_SUPPORT */
}

/**
* @brief Assert Rd resistors
* @param PortNum Port
* @retval none
*/
void USBPDM1_DeAssertRd(uint8_t PortNum)
{
/* not needed on STM32G4xx, so nothing to do, keep only for compatibility */
/* Not needed on STM32G4xx, so nothing to do, keep only for compatibility */
UNUSED(PortNum);
}

/**
* @brief Enter error recovery
* @param PortNum Port
* @retval None
*/
void USBPDM1_EnterErrorRecovery(uint8_t PortNum)
{
LL_UCPD_SetSRCRole(Ports[PortNum].husbpd);
LL_UCPD_SetRpResistor(Ports[PortNum].husbpd, LL_UCPD_RESISTOR_NONE);
LL_UCPD_RxDisable(Ports[PortNum].husbpd);

#if defined(USBPD_REV30_SUPPORT)
#if !defined(USBPDCORE_LIB_NO_PD)
if (Ports[PortNum].settings->PE_PD3_Support.d.PE_FastRoleSwapSupport == USBPD_TRUE)
{
/* Set GPIO to disallow the FRSTX handling */
/* Set GPIO to disallow the FRS RX handling */
LL_UCPD_FRSDetectionDisable(Ports[PortNum].husbpd);
}
#endif /* USBPD_REV30_SUPPORT */
#endif /* USBPDCORE_LIB_NO_PD */
}

/**
* @brief Set the correct CC pin on the comparator
* @param PortNum Port
* @param cc CC pin based on @ref CCxPin_TypeDef
* @retval None
*/
void USBPDM1_Set_CC(uint8_t PortNum, CCxPin_TypeDef cc)
{
/* Set the correct pin on the comparator*/
/* Set the correct pin on the comparator */
Ports[PortNum].CCx = cc;
LL_UCPD_SetCCPin(Ports[PortNum].husbpd, (cc == CC1) ? LL_UCPD_CCPIN_CC1 : LL_UCPD_CCPIN_CC2);
}

/**
* @brief Enable RX interrupt
* @param PortNum Port
* @retval None
*/
void USBPDM1_RX_EnableInterrupt(uint8_t PortNum)
{
/* Enable the RX interrupt process */
Expand All @@ -251,11 +287,21 @@ void USBPDM1_RX_EnableInterrupt(uint8_t PortNum)
LL_UCPD_RxDMAEnable(Ports[PortNum].husbpd);
}

/**
* @brief Enable RX
* @param PortNum Port
* @retval None
*/
void USBPD_HW_IF_EnableRX(uint8_t PortNum)
{
LL_UCPD_RxEnable(Ports[PortNum].husbpd);
}

/**
* @brief Disable RX
* @param PortNum Port
* @retval None
*/
void USBPD_HW_IF_DisableRX(uint8_t PortNum)
{
LL_UCPD_RxDisable(Ports[PortNum].husbpd);
Expand Down Expand Up @@ -287,7 +333,7 @@ void HW_SignalAttachement(uint8_t PortNum, CCxPin_TypeDef cc)
_temp = (uint32_t)&Ports[PortNum].husbpd->TXDR;
Ports[PortNum].hdmatx->CPAR = _temp;

/* disabled non Rd line set CC line enable */
/* Disabled non Rd line set CC line enable */
#define INTERRUPT_MASK UCPD_IMR_TXMSGDISCIE | UCPD_IMR_TXMSGSENTIE | UCPD_IMR_HRSTDISCIE | UCPD_IMR_HRSTSENTIE | \
UCPD_IMR_TXMSGABTIE | UCPD_IMR_TXUNDIE | UCPD_IMR_RXORDDETIE | UCPD_IMR_RXHRSTDETIE | \
UCPD_IMR_RXOVRIE | UCPD_IMR_RXMSGENDIE
Expand All @@ -308,15 +354,14 @@ void HW_SignalAttachement(uint8_t PortNum, CCxPin_TypeDef cc)
(void)BSP_USBPD_PWR_VCONNInit(PortNum, (Ports[PortNum].CCx == CC1) ? 1u : 2u);
#endif /* _VCONN_SUPPORT */

#if defined(USBPD_REV30_SUPPORT)
if (Ports[PortNum].settings->PE_PD3_Support.d.PE_FastRoleSwapSupport == USBPD_TRUE)
{
/* Set GPIO to allow the FRSTX handling */
/* Set GPIO to allow the FRS TX handling */
USBPD_HW_SetFRSSignalling(PortNum, (Ports[PortNum].CCx == CC1) ? 1u : 2u);
/* Enable FRS RX */
LL_UCPD_FRSDetectionEnable(Ports[PortNum].husbpd);
Ports[PortNum].husbpd->IMR |= UCPD_IMR_FRSEVTIE;
}
#endif /* USBPD_REV30_SUPPORT */

/* Disable the Resistor on Vconn PIN */
if (Ports[PortNum].CCx == CC1)
Expand All @@ -339,7 +384,7 @@ void HW_SignalAttachement(uint8_t PortNum, CCxPin_TypeDef cc)
void HW_SignalDetachment(uint8_t PortNum)
{
#if !defined(USBPDCORE_LIB_NO_PD)
/* stop DMA RX/TX */
/* Stop DMA RX/TX */
LL_UCPD_RxDMADisable(Ports[PortNum].husbpd);
LL_UCPD_TxDMADisable(Ports[PortNum].husbpd);
LL_UCPD_RxDisable(Ports[PortNum].husbpd);
Expand All @@ -348,11 +393,13 @@ void HW_SignalDetachment(uint8_t PortNum)
/* Enable only detection interrupt */
WRITE_REG(Ports[PortNum].husbpd->IMR, UCPD_IMR_TYPECEVT1IE | UCPD_IMR_TYPECEVT2IE);
#elif defined(_LOW_POWER)
#if !defined(_DRP)
if (USBPD_PORTPOWERROLE_SRC == Ports[PortNum].params->PE_PowerRole)
{
/* Enable detection interrupt */
WRITE_REG(Ports[PortNum].husbpd->IMR, UCPD_IMR_TYPECEVT1IE | UCPD_IMR_TYPECEVT2IE);
}
#endif /* !_DRP */
#endif /* !_LOW_POWER && !USBPDM1_VCC_FEATURE_ENABLED */

USBPD_HW_DeInit_DMATxInstance(PortNum);
Expand All @@ -370,13 +417,11 @@ void HW_SignalDetachment(uint8_t PortNum)
(void)BSP_USBPD_PWR_VBUSDeInit(PortNum);
}

#if defined(USBPD_REV30_SUPPORT)
if (Ports[PortNum].settings->PE_PD3_Support.d.PE_FastRoleSwapSupport == USBPD_TRUE)
{
/* Set GPIO to disallow the FRSTX handling */
/* Set GPIO to disallow the FRS RX handling */
LL_UCPD_FRSDetectionDisable(Ports[PortNum].husbpd);
}
#endif /* USBPD_REV30_SUPPORT */

#endif /* !USBPDCORE_LIB_NO_PD */
Ports[PortNum].CCx = CCNONE;
Expand All @@ -386,18 +431,33 @@ void HW_SignalDetachment(uint8_t PortNum)
#endif /* !USBPDCORE_LIB_NO_PD */
}

/**
* @brief Set resistors to SinkTxNG
* @param PortNum Port
* @retval None
*/
void USBPD_HW_IF_SetResistor_SinkTxNG(uint8_t PortNum)
{
/* set the resistor SinkTxNG 1.5A5V */
/* Set the resistor SinkTxNG 1.5A5V */
LL_UCPD_SetRpResistor(Ports[PortNum].husbpd, LL_UCPD_RESISTOR_1_5A);
}

/**
* @brief Set resistors to SinkTxOk
* @param PortNum Port
* @retval None
*/
void USBPD_HW_IF_SetResistor_SinkTxOK(uint8_t PortNum)
{
/* set the resistor SinkTxNG 3.0A5V */
/* Set the resistor SinkTxNG 3.0A5V */
LL_UCPD_SetRpResistor(Ports[PortNum].husbpd, LL_UCPD_RESISTOR_3_0A);
}

/**
* @brief Check if resistors are set to SinkTxOk
* @param PortNum Port
* @retval USBPD_TRUE if resistor is set to SinkTxOk, else USBPD_FALSE
*/
uint8_t USBPD_HW_IF_IsResistor_SinkTxOk(uint8_t PortNum)
{
#if defined(_LOW_POWER)
Expand Down Expand Up @@ -438,6 +498,11 @@ uint8_t USBPD_HW_IF_IsResistor_SinkTxOk(uint8_t PortNum)
return USBPD_FALSE;
}

/**
* @brief Signal a Fast Role Swap
* @param PortNum Port
* @retval None
*/
void USBPD_HW_IF_FastRoleSwapSignalling(uint8_t PortNum)
{
LL_UCPD_SignalFRSTX(Ports[PortNum].husbpd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,19 @@ void USBPD_TIM_Init(void)
/* Counter mode: select up-counting mode */
LL_TIM_SetCounterMode(TIMX, LL_TIM_COUNTERMODE_UP);

#if defined(TIMX_CLK_FREQ)
/* Set the pre-scaler value to have TIMx counter clock equal to 1 MHz */
LL_TIM_SetPrescaler(TIMX, __LL_TIM_CALC_PSC(TIMX_CLK_FREQ, 1000000u));

/* Set the auto-reload value to have a counter frequency of 100Hz */
LL_TIM_SetAutoReload(TIMX, __LL_TIM_CALC_ARR(TIMX_CLK_FREQ, LL_TIM_GetPrescaler(TIMX), 100u));
#else
/* Set the pre-scaler value to have TIMx counter clock equal to 1 MHz */
LL_TIM_SetPrescaler(TIMX, __LL_TIM_CALC_PSC(SystemCoreClock, 1000000u));

/* Set the auto-reload value to have a counter frequency of 100Hz */
LL_TIM_SetAutoReload(TIMX, __LL_TIM_CALC_ARR(SystemCoreClock, LL_TIM_GetPrescaler(TIMX), 100u));
#endif /* TIMX_CLK_FREQ */

/*********************************/
/* Output waveform configuration */
Expand Down
Loading

0 comments on commit 98f52ec

Please sign in to comment.