feat: H7 support (#5738)
Co-authored-by: Richard Li <richard.li@ces.hk> Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
co-authored by
Richard Li
philmoz
raphaelcoeffic
parent
5a15ffb017
commit
3d25c2a0f8
@@ -63,6 +63,10 @@ enum _STM32_USART {
|
||||
_STM32_UART4,
|
||||
#endif
|
||||
|
||||
#if defined(UART5) && (defined(STM32H7) || defined(STM32H7RS))
|
||||
_STM32_UART5,
|
||||
#endif
|
||||
|
||||
#if defined(USART6)
|
||||
_STM32_USART6,
|
||||
#endif
|
||||
@@ -71,6 +75,10 @@ enum _STM32_USART {
|
||||
_STM32_UART7,
|
||||
#endif
|
||||
|
||||
#if defined(UART8)
|
||||
_STM32_UART8,
|
||||
#endif
|
||||
|
||||
_STM32_MAX_UARTS
|
||||
};
|
||||
|
||||
@@ -154,6 +162,10 @@ static inline void _usart_isr_handler(_STM32_USART n)
|
||||
DEFINE_USART_IRQ(UART4);
|
||||
#endif
|
||||
|
||||
#if defined (UART5) && (defined(STM32H7) || defined(STM32H7RS))
|
||||
DEFINE_USART_IRQ(UART5);
|
||||
#endif
|
||||
|
||||
#if defined (USART6)
|
||||
DEFINE_USART_IRQ(USART6);
|
||||
#endif
|
||||
@@ -162,6 +174,11 @@ static inline void _usart_isr_handler(_STM32_USART n)
|
||||
DEFINE_USART_IRQ(UART7);
|
||||
#endif
|
||||
|
||||
#if defined (UART8)
|
||||
DEFINE_USART_IRQ(UART8);
|
||||
#endif
|
||||
|
||||
|
||||
static stm32_serial_state* stm32_serial_find_state(const stm32_usart_t* usart)
|
||||
{
|
||||
#if defined (USART1)
|
||||
@@ -176,12 +193,18 @@ static stm32_serial_state* stm32_serial_find_state(const stm32_usart_t* usart)
|
||||
#if defined (UART4)
|
||||
if (usart->USARTx == UART4) return &_serial_states[_STM32_UART4];
|
||||
#endif
|
||||
#if defined (UART5) && (defined(STM32H7) || defined(STM32H7RS))
|
||||
if (usart->USARTx == UART5) return &_serial_states[_STM32_UART5];
|
||||
#endif
|
||||
#if defined (USART6)
|
||||
if (usart->USARTx == USART6) return &_serial_states[_STM32_USART6];
|
||||
#endif
|
||||
#if defined (UART7)
|
||||
if (usart->USARTx == UART7) return &_serial_states[_STM32_UART7];
|
||||
#endif
|
||||
#if defined (UART8)
|
||||
if (usart->USARTx == UART8) return &_serial_states[_STM32_UART8];
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -325,6 +348,9 @@ static void stm32_serial_send_buffer(void* ctx, const uint8_t* data, uint32_t si
|
||||
auto sp = st->sp;
|
||||
auto usart = sp->usart;
|
||||
if (usart->txDMA && !IS_CCM_RAM(data)) {
|
||||
#if defined(STM32H7) || defined(STM32H7RS)
|
||||
SCB_CleanDCache_by_Addr((void*)data, size);
|
||||
#endif
|
||||
stm32_usart_send_buffer(usart, data, size);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user