Skip to content

Commit f447c8c

Browse files
committed
update struct xym_session and xymodem_session_init()
1 parent ade6427 commit f447c8c

File tree

4 files changed

+268
-252
lines changed

4 files changed

+268
-252
lines changed

port/Synwit/xymodem_port_swm190.c

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/**
22
*******************************************************************************************************************************************
33
* @file xymodem_port_swm190.c
4-
* @brief X / Y modem transport protocol port [SWM190]
4+
* @brief X / Y modem transport protocol port [SWM190]
55
* @since Change Logs:
66
* Date Author Notes
77
* 2023-11-30 lzh the first version
88
* @copyright (c) 2023 lzh <lzhoran@163.com>
99
* https://github.com/ZeHHHHH/Flexible-XYmodem.git
1010
* All rights reserved.
11-
*
11+
*
1212
* Licensed under the Apache License, Version 2.0 (the "License");
1313
* you may not use this file except in compliance with the License.
1414
* You may obtain a copy of the License at
15-
*
15+
*
1616
* http://www.apache.org/licenses/LICENSE-2.0
17-
*
17+
*
1818
* Unless required by applicable law or agreed to in writing, software
1919
* distributed under the License is distributed on an "AS IS" BASIS,
2020
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@
2525
#include "xymodem.h"
2626

2727
/*******************************************************************************************************************************************
28-
* Reference
28+
* Reference
2929
*******************************************************************************************************************************************/
3030
#include "SWM190.h"
3131

@@ -49,7 +49,7 @@
4949
/* UART Group X Attribute */
5050
#define UART_GROUP_X UART1
5151
#define UART_GROUP_X_ISR_FUN UART1_Handler
52-
#define UART_BAUDRATE 115200
52+
#define UART_BAUDRATE 115200
5353

5454
/* UART1 TX - E7 */
5555
#define UART1_TX_PORT PORTE
@@ -104,7 +104,7 @@ uint16_t xymodem_port_crc16(const uint8_t *data, const uint32_t cnt)
104104
#endif
105105

106106
/**
107-
* @brief peripheral hardware init
107+
* @brief peripheral hardware init
108108
* @param \
109109
* @retval enum xym_sta
110110
*/
@@ -126,7 +126,7 @@ xym_sta_t xymodem_port_init(void)
126126
UART_initStruct.TimeoutIEn = (DEV_MODE == MODE_ISR) ? 1 : 0;
127127
UART_Init(UART_GROUP_X, &UART_initStruct);
128128
UART_Open(UART_GROUP_X);
129-
129+
130130
#ifdef CRC16_HW_ENABLE
131131
/* CRC16 hardware init */
132132
return XYM_ERROR_HW;
@@ -206,23 +206,23 @@ static volatile uint8_t UART_TimeOut_Flag = 0;
206206

207207
void UART_GROUP_X_ISR_FUN(void)
208208
{
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+
217217
/* 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+
{
224224
/* Circular-Queue */
225-
UART_RX_Buffer[UART_Count_Index][UART_Size_Index] = chr;
225+
UART_RX_Buffer[UART_Count_Index][UART_Size_Index] = chr;
226226
if (++UART_Size_Index >= UART_RX_SIZE)
227227
{
228228
UART_Size_Index = 0;
@@ -231,8 +231,8 @@ void UART_GROUP_X_ISR_FUN(void)
231231
UART_Count_Index = 0;
232232
}
233233
}
234-
}
235-
}
236-
}
234+
}
235+
}
236+
}
237237
}
238238
#endif

0 commit comments

Comments
 (0)