summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authoralt-0191 <[email protected]>2026-03-13 23:58:18 +0800
committeralt-0191 <[email protected]>2026-03-18 15:23:28 +0800
commitdc87bab45f8123cbfa2b4b0ac6e1831c1172651f (patch)
tree5a3c925e849ae3b523e6e519df55402fe2b1b1d8 /hw
parent56f94bbb46bebf88e9be0332ebb9db03b30d1cb1 (diff)
ch58x: code cleanup and minor fixes
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/ch58x/ch58x_it.h6
-rw-r--r--hw/bsp/ch58x/debug_uart.c6
-rw-r--r--hw/bsp/ch58x/debug_uart.h8
-rw-r--r--hw/bsp/ch58x/system_ch58x.h6
4 files changed, 17 insertions, 9 deletions
diff --git a/hw/bsp/ch58x/ch58x_it.h b/hw/bsp/ch58x/ch58x_it.h
index c98f732e1..18ea52bc9 100644
--- a/hw/bsp/ch58x/ch58x_it.h
+++ b/hw/bsp/ch58x/ch58x_it.h
@@ -24,8 +24,8 @@
* This file is part of the TinyUSB stack.
*/
-#ifndef __CH58X_IT_H
-#define __CH58X_IT_H
+#ifndef CH58X_IT_H_
+#define CH58X_IT_H_
#ifdef __cplusplus
extern "C" {
@@ -43,4 +43,4 @@ void SysTick_Handler(void);
}
#endif
-#endif /* __CH58X_IT_H */
+#endif /* CH58X_IT_H_ */
diff --git a/hw/bsp/ch58x/debug_uart.c b/hw/bsp/ch58x/debug_uart.c
index e63606f33..7dd133cb2 100644
--- a/hw/bsp/ch58x/debug_uart.c
+++ b/hw/bsp/ch58x/debug_uart.c
@@ -35,11 +35,11 @@
#define UART_RINGBUFFER_MASK_TX (UART_RINGBUFFER_SIZE_TX - 1)
static char tx_buf[UART_RINGBUFFER_SIZE_TX];
-static unsigned int tx_produce;
-static volatile unsigned int tx_consume;
+static uint32_t tx_produce;
+static volatile uint32_t tx_consume;
void uart_write(char c) {
- unsigned int tx_produce_next = (tx_produce + 1) & UART_RINGBUFFER_MASK_TX;
+ uint32_t tx_produce_next = (tx_produce + 1) & UART_RINGBUFFER_MASK_TX;
// If ring buffer is full, wait
while (tx_produce_next == tx_consume) {}
diff --git a/hw/bsp/ch58x/debug_uart.h b/hw/bsp/ch58x/debug_uart.h
index 458d838d9..44c3e7948 100644
--- a/hw/bsp/ch58x/debug_uart.h
+++ b/hw/bsp/ch58x/debug_uart.h
@@ -29,8 +29,16 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void uart_write(char c);
void uart_sync(void);
void usart_printf_init(uint32_t baudrate);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* DEBUG_UART_H_ */
diff --git a/hw/bsp/ch58x/system_ch58x.h b/hw/bsp/ch58x/system_ch58x.h
index ef32e603f..e96741ee8 100644
--- a/hw/bsp/ch58x/system_ch58x.h
+++ b/hw/bsp/ch58x/system_ch58x.h
@@ -24,8 +24,8 @@
* This file is part of the TinyUSB stack.
*/
-#ifndef __SYSTEM_CH58X_H
-#define __SYSTEM_CH58X_H
+#ifndef SYSTEM_CH58X_H_
+#define SYSTEM_CH58X_H_
#ifdef __cplusplus
extern "C" {
@@ -40,4 +40,4 @@ extern void SystemCoreClockUpdate(void);
}
#endif
-#endif /* __SYSTEM_CH58X_H */
+#endif /* SYSTEM_CH58X_H_ */