1
1
/**
2
2
*******************************************************************************************************************************************
3
3
* @file xymodem_port_swm190.c
4
- * @brief X / Y modem transport protocol port [SWM190]
4
+ * @brief X / Y modem transport protocol port [SWM190]
5
5
* @since Change Logs:
6
6
* Date Author Notes
7
7
* 2023-11-30 lzh the first version
8
8
* @copyright (c) 2023 lzh <lzhoran@163.com>
9
9
* https://github.com/ZeHHHHH/Flexible-XYmodem.git
10
10
* All rights reserved.
11
- *
11
+ *
12
12
* Licensed under the Apache License, Version 2.0 (the "License");
13
13
* you may not use this file except in compliance with the License.
14
14
* You may obtain a copy of the License at
15
- *
15
+ *
16
16
* http://www.apache.org/licenses/LICENSE-2.0
17
- *
17
+ *
18
18
* Unless required by applicable law or agreed to in writing, software
19
19
* distributed under the License is distributed on an "AS IS" BASIS,
20
20
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
25
#include "xymodem.h"
26
26
27
27
/*******************************************************************************************************************************************
28
- * Reference
28
+ * Reference
29
29
*******************************************************************************************************************************************/
30
30
#include "SWM190.h"
31
31
49
49
/* UART Group X Attribute */
50
50
#define UART_GROUP_X UART1
51
51
#define UART_GROUP_X_ISR_FUN UART1_Handler
52
- #define UART_BAUDRATE 115200
52
+ #define UART_BAUDRATE 115200
53
53
54
54
/* UART1 TX - E7 */
55
55
#define UART1_TX_PORT PORTE
@@ -104,7 +104,7 @@ uint16_t xymodem_port_crc16(const uint8_t *data, const uint32_t cnt)
104
104
#endif
105
105
106
106
/**
107
- * @brief peripheral hardware init
107
+ * @brief peripheral hardware init
108
108
* @param \
109
109
* @retval enum xym_sta
110
110
*/
@@ -126,7 +126,7 @@ xym_sta_t xymodem_port_init(void)
126
126
UART_initStruct .TimeoutIEn = (DEV_MODE == MODE_ISR ) ? 1 : 0 ;
127
127
UART_Init (UART_GROUP_X , & UART_initStruct );
128
128
UART_Open (UART_GROUP_X );
129
-
129
+
130
130
#ifdef CRC16_HW_ENABLE
131
131
/* CRC16 hardware init */
132
132
return XYM_ERROR_HW ;
@@ -206,23 +206,23 @@ static volatile uint8_t UART_TimeOut_Flag = 0;
206
206
207
207
void UART_GROUP_X_ISR_FUN (void )
208
208
{
209
- uint32_t chr = 0 ;
210
-
211
- if (UART_INTStat (UART_GROUP_X , UART_IT_RX_THR | UART_IT_RX_TOUT ))
212
- {
213
- if (UART_INTStat (UART_GROUP_X , UART_IT_RX_TOUT ))
214
- {
215
- UART_INTClr (UART_GROUP_X , UART_IT_RX_TOUT );
216
-
209
+ uint32_t chr = 0 ;
210
+
211
+ if (UART_INTStat (UART_GROUP_X , UART_IT_RX_THR | UART_IT_RX_TOUT ))
212
+ {
213
+ if (UART_INTStat (UART_GROUP_X , UART_IT_RX_TOUT ))
214
+ {
215
+ UART_INTClr (UART_GROUP_X , UART_IT_RX_TOUT );
216
+
217
217
/* IDLE Timeout */
218
- UART_TimeOut_Flag = 1 ;
219
- }
220
- while (UART_IsRXFIFOEmpty (UART_GROUP_X ) == 0 )
221
- {
222
- if (UART_ReadByte (UART_GROUP_X , & chr ) == 0 )
223
- {
218
+ UART_TimeOut_Flag = 1 ;
219
+ }
220
+ while (UART_IsRXFIFOEmpty (UART_GROUP_X ) == 0 )
221
+ {
222
+ if (UART_ReadByte (UART_GROUP_X , & chr ) == 0 )
223
+ {
224
224
/* Circular-Queue */
225
- UART_RX_Buffer [UART_Count_Index ][UART_Size_Index ] = chr ;
225
+ UART_RX_Buffer [UART_Count_Index ][UART_Size_Index ] = chr ;
226
226
if (++ UART_Size_Index >= UART_RX_SIZE )
227
227
{
228
228
UART_Size_Index = 0 ;
@@ -231,8 +231,8 @@ void UART_GROUP_X_ISR_FUN(void)
231
231
UART_Count_Index = 0 ;
232
232
}
233
233
}
234
- }
235
- }
236
- }
234
+ }
235
+ }
236
+ }
237
237
}
238
238
#endif
0 commit comments