Skip to content

Commit 92e1f63

Browse files
committed
Removed magic numbers for bitrate
1 parent f04aac6 commit 92e1f63

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

include/uart_flash.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@
3333
#include <stdint.h>
3434

3535
#ifdef UART_FLASH
36-
int uart_init(uint32_t bitrate, uint8_t data, char parity, uint8_t stop);
37-
void uart_send_current_version(void);
36+
#define UART_FLASH_BITRATE 460800
37+
int uart_init(uint32_t bitrate, uint8_t data, char parity, uint8_t stop);
38+
void uart_send_current_version(void);
3839
#else
39-
#define uart_init(...) (-1)
40-
#define uart_send_current_version() do{}while(0)
40+
#define uart_init(...) (-1)
41+
#define uart_send_current_version() do{}while(0)
4142
#endif /* UART_FLASH */
4243

4344
#endif /* !UART_FLASH_DRI_H */

src/loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ int main(void)
174174
hal_init();
175175
spi_flash_probe();
176176
#ifdef UART_FLASH
177-
uart_init((4 * 115200), 8, 'N', 1);
177+
uart_init((UART_FLASH_BITRATE, 8, 'N', 1);
178178
uart_send_current_version();
179179
#endif
180180
#ifdef WOLFTPM2_NO_WOLFCRYPT

tools/uart-flash-server/ufserver.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
#define FIRMWARE_PARTITION_SIZE 0x4000
4949
#define SWAP_SIZE 0x4000
50+
#define UART_BITRATE 460800
5051

5152
const char msgSha[] = "Verifying SHA digest...";
5253
const char msgReadUpdate[] = "Fetching update blocks ";
@@ -214,7 +215,7 @@ uint32_t fw_version(uint8_t *fw)
214215

215216
int open_uart(const char *uart_dev)
216217
{
217-
return serial_open(uart_dev, 4 * 115200);
218+
return serial_open(uart_dev, UART_BITRATE);
218219
}
219220

220221
static void send_ack(int ud)

0 commit comments

Comments
 (0)