File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
source/hic_hal/cmsis-driver/uart Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* @file uart.c
3
- * @brief
3
+ * @brief UART Function for HIC using CMSIS-Driver
4
4
*
5
5
* DAPLink Interface Firmware
6
6
* Copyright (c) 2020 Arm Limited, All Rights Reserved
@@ -38,6 +38,9 @@ circ_buf_t write_buffer;
38
38
uint8_t write_buffer_data [BUFFER_SIZE ];
39
39
circ_buf_t read_buffer ;
40
40
uint8_t read_buffer_data [BUFFER_SIZE ];
41
+ uint16_t cur_line_state ;
42
+ uint32_t cur_control ;
43
+ uint32_t cur_baud ;
41
44
42
45
struct {
43
46
// Number of bytes pending to be transferred. This is 0 if there is no
@@ -61,6 +64,9 @@ int32_t uart_initialize(void)
61
64
cb_buf .tx_size = 0 ;
62
65
CMSIS_UART_INSTANCE .Initialize (uart_handler );
63
66
CMSIS_UART_INSTANCE .PowerControl (ARM_POWER_FULL );
67
+ cur_line_state = 0 ;
68
+ cur_control = 0 ;
69
+ cur_baud = 0 ;
64
70
65
71
return 1 ;
66
72
}
@@ -156,6 +162,12 @@ int32_t uart_set_configuration(UART_Configuration *config)
156
162
break ;
157
163
}
158
164
165
+ if ((control == cur_control ) && (config -> Baudrate == cur_baud )) {
166
+ return 1 ;
167
+ }
168
+ cur_control = control ;
169
+ cur_baud = config -> Baudrate ;
170
+
159
171
NVIC_DisableIRQ (CMSIS_UART_IRQ );
160
172
clear_buffers ();
161
173
if (cb_buf .tx_size != 0 ) {
@@ -188,6 +200,10 @@ int32_t uart_get_configuration(UART_Configuration *config)
188
200
189
201
void uart_set_control_line_state (uint16_t ctrl_bmp )
190
202
{
203
+ if (ctrl_bmp != cur_line_state ) {
204
+ uart_reset ();
205
+ cur_line_state = ctrl_bmp ;
206
+ }
191
207
}
192
208
193
209
int32_t uart_write_free (void )
You can’t perform that action at this time.
0 commit comments