Skip to content

Commit 85e81c4

Browse files
authored
Merge pull request #4461 from mysterywolf/at32
[at32] auto formatted
2 parents 6bb07da + 1a6e348 commit 85e81c4

37 files changed

+392
-392
lines changed

bsp/at32/Libraries/rt_drivers/drv_adc.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -17,7 +17,7 @@
1717
#include <drv_log.h>
1818

1919
struct at32_adc
20-
{
20+
{
2121
struct rt_adc_device at32_adc_device;
2222
ADC_Type *ADC_Handler;
2323
char *name;
@@ -109,9 +109,9 @@ static rt_err_t at32_adc_enabled(struct rt_adc_device *device, rt_uint32_t chann
109109
ADC_InitType ADC_InitStructure;
110110
RT_ASSERT(device != RT_NULL);
111111
at32_adc_handler = device->parent.user_data;
112-
112+
113113
at32_msp_adc_init(at32_adc_handler);
114-
114+
115115
/* ADCx configuration ------------------------------------------------------*/
116116
ADC_StructInit(&ADC_InitStructure);
117117
ADC_InitStructure.ADC_Mode = ADC_Mode_Independent;
@@ -121,14 +121,14 @@ static rt_err_t at32_adc_enabled(struct rt_adc_device *device, rt_uint32_t chann
121121
ADC_InitStructure.ADC_DataAlign = ADC_DataAlign_Right;
122122
ADC_InitStructure.ADC_NumOfChannel = 1;
123123
ADC_Init(at32_adc_handler, &ADC_InitStructure);
124-
125-
/* ADCx regular channels configuration */
126-
ADC_RegularChannelConfig(at32_adc_handler, at32_adc_get_channel(channel), 1, ADC_SampleTime_28_5);
127-
124+
125+
/* ADCx regular channels configuration */
126+
ADC_RegularChannelConfig(at32_adc_handler, at32_adc_get_channel(channel), 1, ADC_SampleTime_28_5);
127+
128128
/* Enable ADCx */
129129
ADC_Ctrl(at32_adc_handler, ENABLE);
130-
131-
/* Enable ADCx reset calibration register */
130+
131+
/* Enable ADCx reset calibration register */
132132
ADC_RstCalibration(at32_adc_handler);
133133
/* Check the end of ADCx reset calibration register */
134134
while(ADC_GetResetCalibrationStatus(at32_adc_handler));
@@ -161,7 +161,7 @@ static rt_err_t at32_get_adc_value(struct rt_adc_device *device, rt_uint32_t cha
161161

162162
at32_adc_handler = device->parent.user_data;
163163

164-
/* Start ADCx Software Conversion */
164+
/* Start ADCx Software Conversion */
165165
ADC_SoftwareStartConvCtrl(at32_adc_handler, ENABLE);
166166

167167
/* Wait for the ADC to convert */

bsp/at32/Libraries/rt_drivers/drv_adc.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -19,32 +19,32 @@ extern "C" {
1919
#endif
2020

2121
#if defined(BSP_USING_ADC1) || defined(BSP_USING_ADC2) || defined(BSP_USING_ADC3)
22-
22+
2323
#ifndef ADC1_CONFIG
2424
#define ADC1_CONFIG \
2525
{ \
2626
.ADC_Handler = ADC1, \
2727
.name = "adc1", \
28-
}
28+
}
2929
#endif /* ADC1_CONFIG */
30-
30+
3131
#ifndef ADC2_CONFIG
3232
#define ADC2_CONFIG \
3333
{ \
3434
.ADC_Handler = ADC2, \
3535
.name = "adc2", \
36-
}
36+
}
3737
#endif /* ADC2_CONFIG */
38-
38+
3939
#ifndef ADC3_CONFIG
4040
#define ADC3_CONFIG \
4141
{ \
4242
.ADC_Handler = ADC3, \
4343
.name = "adc3", \
44-
}
45-
#endif /* ADC3_CONFIG */
46-
47-
#endif
44+
}
45+
#endif /* ADC3_CONFIG */
46+
47+
#endif
4848

4949

5050
#ifdef __cplusplus

bsp/at32/Libraries/rt_drivers/drv_can.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -311,8 +311,8 @@ static rt_err_t _can_control(struct rt_can_device *can, int cmd, void *arg)
311311
{
312312
can_instance->CanConfig.FilterConfig.CAN_FilterNumber = filter_cfg->items[i].hdr & (0x1fU);
313313
can_instance->CanConfig.FilterConfig.CAN_FilterIdHigh = (filter_cfg->items[i].id >> 13) & 0xFFFF;
314-
can_instance->CanConfig.FilterConfig.CAN_FilterIdLow = ((filter_cfg->items[i].id << 3) |
315-
(filter_cfg->items[i].ide << 2) |
314+
can_instance->CanConfig.FilterConfig.CAN_FilterIdLow = ((filter_cfg->items[i].id << 3) |
315+
(filter_cfg->items[i].ide << 2) |
316316
(filter_cfg->items[i].rtr << 1)) & 0xFFFF;
317317
can_instance->CanConfig.FilterConfig.CAN_FilterMskIdHigh = (filter_cfg->items[i].mask >> 16) & 0xFFFF;
318318
can_instance->CanConfig.FilterConfig.CAN_FilterMskIdLow = filter_cfg->items[i].mask & 0xFFFF;
@@ -499,7 +499,7 @@ static int _can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t fifo)
499499
else
500500
pmsg->ide = RxMessage.ExtId;
501501
pmsg->rtr = RxMessage.RTR;
502-
502+
503503
return RT_EOK;
504504
}
505505

bsp/at32/Libraries/rt_drivers/drv_can.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -22,7 +22,7 @@ extern "C" {
2222
#define CAN_TX_MAILBOX0 (0x00000001U) /*!< Tx Mailbox 0 */
2323
#define CAN_TX_MAILBOX1 (0x00000002U) /*!< Tx Mailbox 1 */
2424
#define CAN_TX_MAILBOX2 (0x00000004U) /*!< Tx Mailbox 2 */
25-
25+
2626
struct at32_baud_rate_tab
2727
{
2828
rt_uint32_t baud_rate;

bsp/at32/Libraries/rt_drivers/drv_eth.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -28,8 +28,8 @@
2828
//#define DRV_DEBUG
2929
#define LOG_TAG "drv.emac"
3030

31-
#define ETH_RXBUFNB 4
32-
#define ETH_TXBUFNB 2
31+
#define ETH_RXBUFNB 4
32+
#define ETH_TXBUFNB 2
3333

3434
#define LINK_THREAD_STACK_SIZE 256
3535
#define LINK_THREAD_PREORITY 21
@@ -131,14 +131,14 @@ void NVIC_Configuration(void)
131131
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
132132

133133
/* 2 bit for pre-emption priority, 2 bits for subpriority */
134-
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
134+
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
135135

136136
/* Enable the Ethernet global Interrupt */
137137
NVIC_InitStructure.NVIC_IRQChannel = ETH_IRQn;
138138
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
139139
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
140140
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
141-
NVIC_Init(&NVIC_InitStructure);
141+
NVIC_Init(&NVIC_InitStructure);
142142
}
143143

144144
/**
@@ -173,7 +173,7 @@ void GPIO_Configuration(void)
173173
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
174174
GPIO_Init(GPIOC, &GPIO_InitStructure);
175175

176-
/*MII Mode GPIO configuration*/
176+
/*MII Mode GPIO configuration*/
177177
#ifdef MII_MODE
178178
/**********************MII Tx Pin Define****************************/
179179
/*
@@ -193,7 +193,7 @@ void GPIO_Configuration(void)
193193
GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
194194
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
195195
GPIO_Init(GPIOC, &GPIO_InitStructure);
196-
/**********************MII Rx Pin Define****************************/
196+
/**********************MII Rx Pin Define****************************/
197197
#if MII_RX_REMAP /*IO PIN remaped*/
198198
/*
199199
ETH_MII_RX_DV-->PD8
@@ -208,7 +208,7 @@ void GPIO_Configuration(void)
208208
*/
209209
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_8 | GPIO_Pins_9 | GPIO_Pins_10 | GPIO_Pins_11 | GPIO_Pins_12;
210210
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
211-
GPIO_Init(GPIOD, &GPIO_InitStructure);
211+
GPIO_Init(GPIOD, &GPIO_InitStructure);
212212

213213
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_0 | GPIO_Pins_1 | GPIO_Pins_3;
214214
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
@@ -233,11 +233,11 @@ void GPIO_Configuration(void)
233233
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
234234
GPIO_Init(GPIOA, &GPIO_InitStructure);
235235

236-
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_4 | GPIO_Pins_5;
236+
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_4 | GPIO_Pins_5;
237237
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
238238
GPIO_Init(GPIOC, &GPIO_InitStructure);
239239

240-
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_0 | GPIO_Pins_1 | GPIO_Pins_10;
240+
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_0 | GPIO_Pins_1 | GPIO_Pins_10;
241241
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
242242
GPIO_Init(GPIOB, &GPIO_InitStructure);
243243

@@ -255,8 +255,8 @@ void GPIO_Configuration(void)
255255
GPIO_InitStructure.GPIO_MaxSpeed = GPIO_MaxSpeed_50MHz;
256256
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
257257
GPIO_Init(GPIOB, &GPIO_InitStructure);
258-
259-
/**********************RMII Rx Pin Define****************************/
258+
259+
/**********************RMII Rx Pin Define****************************/
260260
#if MII_RX_REMAP /*IO PIN remaped*/
261261
/*
262262
ETH_RMII_RX_DV-->PD8
@@ -266,7 +266,7 @@ void GPIO_Configuration(void)
266266
*/
267267
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_8 | GPIO_Pins_9 | GPIO_Pins_10;
268268
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
269-
GPIO_Init(GPIOD, &GPIO_InitStructure);
269+
GPIO_Init(GPIOD, &GPIO_InitStructure);
270270

271271
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_1;
272272
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
@@ -282,7 +282,7 @@ void GPIO_Configuration(void)
282282
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
283283
GPIO_Init(GPIOA, &GPIO_InitStructure);
284284

285-
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_4 | GPIO_Pins_5;
285+
GPIO_InitStructure.GPIO_Pins = GPIO_Pins_4 | GPIO_Pins_5;
286286
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
287287
GPIO_Init(GPIOC, &GPIO_InitStructure);
288288

@@ -314,7 +314,7 @@ static rt_err_t rt_at32_eth_init(rt_device_t dev)
314314

315315
RCC_AHBPeriphClockCmd(RCC_AHBPERIPH_ETHMAC | RCC_AHBPERIPH_ETHMACTX |
316316
RCC_AHBPERIPH_ETHMACRX, ENABLE);
317-
317+
318318
/* MII/RMII Media interface selection ------------------------------------------*/
319319
#ifdef MII_MODE /* Mode MII with AT32F407-EVAL */
320320
GPIO_ETH_MediaInterfaceConfig(GPIO_ETH_MediaInterface_MII);
@@ -361,31 +361,31 @@ static rt_err_t rt_at32_eth_init(rt_device_t dev)
361361
ETH_InitStructure.ETH_ChecksumOffload = ETH_ChecksumOffload_Enable;
362362
#endif
363363

364-
/*------------------------ DMA -----------------------------------*/
364+
/*------------------------ DMA -----------------------------------*/
365365

366-
/* When we use the Checksum offload feature, we need to enable the Store and Forward mode:
367-
the store and forward guarantee that a whole frame is stored in the FIFO, so the MAC can insert/verify the checksum,
366+
/* When we use the Checksum offload feature, we need to enable the Store and Forward mode:
367+
the store and forward guarantee that a whole frame is stored in the FIFO, so the MAC can insert/verify the checksum,
368368
if the checksum is OK the DMA can handle the frame otherwise the frame is dropped */
369-
ETH_InitStructure.ETH_DropTCPIPChecksumErrorFrame = ETH_DropTCPIPChecksumErrorFrame_Enable;//ETH_DropTCPIPChecksumErrorFrame_Enable;
370-
ETH_InitStructure.ETH_ReceiveStoreForward = ETH_ReceiveStoreForward_Enable;
371-
ETH_InitStructure.ETH_TransmitStoreForward = ETH_TransmitStoreForward_Enable;
372-
373-
ETH_InitStructure.ETH_ForwardErrorFrames = ETH_ForwardErrorFrames_Disable;
374-
ETH_InitStructure.ETH_ForwardUndersizedGoodFrames = ETH_ForwardUndersizedGoodFrames_Disable;
375-
ETH_InitStructure.ETH_SecondFrameOperate = ETH_SecondFrameOperate_Enable;
376-
ETH_InitStructure.ETH_AddressAlignedBeats = ETH_AddressAlignedBeats_Enable;
377-
ETH_InitStructure.ETH_FixedBurst = ETH_FixedBurst_Enable;
378-
ETH_InitStructure.ETH_RxDMABurstLength = ETH_RxDMABurstLength_32Beat;
379-
ETH_InitStructure.ETH_TxDMABurstLength = ETH_TxDMABurstLength_32Beat;
369+
ETH_InitStructure.ETH_DropTCPIPChecksumErrorFrame = ETH_DropTCPIPChecksumErrorFrame_Enable;//ETH_DropTCPIPChecksumErrorFrame_Enable;
370+
ETH_InitStructure.ETH_ReceiveStoreForward = ETH_ReceiveStoreForward_Enable;
371+
ETH_InitStructure.ETH_TransmitStoreForward = ETH_TransmitStoreForward_Enable;
372+
373+
ETH_InitStructure.ETH_ForwardErrorFrames = ETH_ForwardErrorFrames_Disable;
374+
ETH_InitStructure.ETH_ForwardUndersizedGoodFrames = ETH_ForwardUndersizedGoodFrames_Disable;
375+
ETH_InitStructure.ETH_SecondFrameOperate = ETH_SecondFrameOperate_Enable;
376+
ETH_InitStructure.ETH_AddressAlignedBeats = ETH_AddressAlignedBeats_Enable;
377+
ETH_InitStructure.ETH_FixedBurst = ETH_FixedBurst_Enable;
378+
ETH_InitStructure.ETH_RxDMABurstLength = ETH_RxDMABurstLength_32Beat;
379+
ETH_InitStructure.ETH_TxDMABurstLength = ETH_TxDMABurstLength_32Beat;
380380
ETH_InitStructure.ETH_DMAArbitration = ETH_DMAArbitration_RoundRobin_RxTx_2_1;
381381

382382
/* Configure Ethernet, check error */
383383
if(ETH_Init(&ETH_InitStructure, PHY_ADDRESS) == ((uint32_t)0)) {
384384
return RT_ERROR;
385-
}
385+
}
386386

387387
/* Enable DMA Receive interrupt (need to enable in this case Normal interrupt) */
388-
ETH_DMAITConfig(ETH_DMA_INT_NIS | ETH_DMA_INT_R, ENABLE);
388+
ETH_DMAITConfig(ETH_DMA_INT_NIS | ETH_DMA_INT_R, ENABLE);
389389

390390
/* Initialize Tx Descriptors list: Chain Mode */
391391
ETH_DMATxDescChainInit(DMATxDscrTab, &Tx_Buff[0][0], ETH_TXBUFNB);
@@ -396,7 +396,7 @@ static rt_err_t rt_at32_eth_init(rt_device_t dev)
396396
ETH_MACAddressConfig(ETH_MAC_Address0, (u8*)&at32_eth_device.dev_addr[0]);
397397

398398
/* Enable ETH transmition and recetion */
399-
ETH_Start();
399+
ETH_Start();
400400

401401
return RT_EOK;
402402
}
@@ -581,7 +581,7 @@ struct pbuf *rt_at32_eth_rx(rt_device_t dev)
581581
{
582582
rt_uint32_t i;
583583
rt_uint8_t *ptr = (rt_uint8_t*)(DMARxDescToGet->Buffer1Addr);
584-
584+
585585
AT32_ETH_PRINTF("rx_dump, len:%d\r\n", p->tot_len);
586586
for(i=0; i<p->tot_len; i++)
587587
{

bsp/at32/Libraries/rt_drivers/drv_eth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*

bsp/at32/Libraries/rt_drivers/drv_flash.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -160,14 +160,14 @@ int at32_flash_erase(rt_uint32_t addr, size_t size)
160160
addr += FLASH_PAGE_SIZE;
161161
}
162162

163-
FLASH_Lock();
164-
165-
__exit:
163+
FLASH_Lock();
164+
165+
__exit:
166166
if(result != RT_EOK)
167167
{
168168
return result;
169169
}
170-
170+
171171
return size;
172172
}
173173

@@ -177,7 +177,7 @@ static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size);
177177
static int fal_flash_write(long offset, const rt_uint8_t *buf, size_t size);
178178
static int fal_flash_erase(long offset, size_t size);
179179

180-
const struct fal_flash_dev at32_onchip_flash =
180+
const struct fal_flash_dev at32_onchip_flash =
181181
{
182182
"onchip_flash",
183183
AT32_FLASH_START_ADRESS,

bsp/at32/Libraries/rt_drivers/drv_flash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2018, RT-Thread Development Team
2+
* Copyright (c) 2006-2021, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*

0 commit comments

Comments
 (0)