Skip to content

Commit 9ee1fad

Browse files
committed
formatting 格式化
1 parent dc5412d commit 9ee1fad

26 files changed

Lines changed: 153 additions & 122 deletions

bsp/rdk/s100/applications/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ int main(void)
1414
rt_kprintf("Hi, RT-Thread!\n");
1515
return 0;
1616
}
17+

bsp/rdk/s100/board/board.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ void rt_hw_board_init(void)
2929
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
3030
#endif
3131
}
32+

bsp/rdk/s100/board/board.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,4 @@ rt_inline rt_uint32_t platform_get_gic_redist_base(void)
9696
#endif
9797

9898
#endif
99+

bsp/rdk/s100/board/rsc_table.c

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,61 +13,62 @@ extern uint32_t CAN_START_ADDR;
1313
extern uint32_t FLASH_SEC_ADDR;
1414
extern uint32_t FLASH_STARTUP_LEN;
1515

16-
#define NUM_TABLE_ENTRIES (7)
17-
#define HB_SECTION_T(S) __attribute__((__section__(#S)))
18-
#define HB_RESOURCE HB_SECTION_T(.resource_table)
19-
#define MCU_FLASH_START_BASE_ADDR (0x0CAA5000)
20-
#define MCU_FLASH_BASE_ADDR (0x0CAA5400)
16+
#define NUM_TABLE_ENTRIES (7)
17+
#define HB_SECTION_T(S) __attribute__((__section__(#S)))
18+
#define HB_RESOURCE HB_SECTION_T(.resource_table)
19+
#define MCU_FLASH_START_BASE_ADDR (0x0CAA5000)
20+
#define MCU_FLASH_BASE_ADDR (0x0CAA5400)
2121
#define MCU_FREERTOS_HEAP_BASE_ADDR ((uint32_t)&OS_HEAP_START_ADDR)
2222
#define MCU_LOG_BASE_ADDR ((uint32_t)&MCU_LOG_START_ADDR)
2323
#define MCU_SCMI_BASE_ADDR ((uint32_t)&__SCMI_IPC_START_ADDR)
24-
#define MCU_ATCM_ADDR ((uint32_t)&ATCM_START_ADDR)
25-
#define MCU_FLASH_START_DDR_ADDR (0x0CAB0000)
26-
#define MCU_FLASH_DDR_ADDR ((uint32_t)&FLASH_SEC_ADDR)
24+
#define MCU_ATCM_ADDR ((uint32_t)&ATCM_START_ADDR)
25+
#define MCU_FLASH_START_DDR_ADDR (0x0CAB0000)
26+
#define MCU_FLASH_DDR_ADDR ((uint32_t)&FLASH_SEC_ADDR)
2727
#define MCU_FREERTOS_HEAP_DDR_ADDR ((uint32_t)&OS_HEAP_START_ADDR)
2828
#define MCU_LOG_DDR_ADDR ((uint32_t)&MCU_LOG_START_ADDR)
2929
#define MCU_SCMI_DDR_ADDR ((uint32_t)&__SCMI_IPC_START_ADDR)
30-
#define MCU_BTCM_ADDR ((uint32_t)&CAN_START_ADDR)
31-
#define MCU_FLASH_START_SIZE ((uint32_t)&FLASH_STARTUP_LEN)
32-
#define MCU_FLASH_SIZE (0x2AAC00)
30+
#define MCU_BTCM_ADDR ((uint32_t)&CAN_START_ADDR)
31+
#define MCU_FLASH_START_SIZE ((uint32_t)&FLASH_STARTUP_LEN)
32+
#define MCU_FLASH_SIZE (0x2AAC00)
3333
#define MCU_RTTHREAD_HEAP_ADDR ((uint32_t)&OS_HEAP_START_ADDR)
34-
#define MCU_RTTHREAD_HEAP_SIZE ((uint32_t)&OS_HEAP_SIZE)
35-
#define MCU_LOG_SIZE ((uint32_t)&MCU_LOG_SIZE)
36-
#define MCU_SCMI_SIZE ((uint32_t)&__SCMI_IPC_SIZE)
37-
#define MCU_ATCM_SIZE ((uint32_t)&ATCM_SIZE)
34+
#define MCU_RTTHREAD_HEAP_SIZE ((uint32_t)&OS_HEAP_SIZE)
35+
#define MCU_LOG_SIZE ((uint32_t)&MCU_LOG_SIZE)
36+
#define MCU_SCMI_SIZE ((uint32_t)&__SCMI_IPC_SIZE)
37+
#define MCU_ATCM_SIZE ((uint32_t)&ATCM_SIZE)
3838

3939
const struct remote_resource_table HB_RESOURCE resources = {
40-
/* Version */
41-
1,
40+
/* Version */
41+
1,
4242

43-
/* NUmber of table entries */
44-
NUM_TABLE_ENTRIES,
45-
/* reserved fields */
46-
{0x0, 0x0,},
43+
/* NUmber of table entries */
44+
NUM_TABLE_ENTRIES,
45+
/* reserved fields */
46+
{0x0, 0x0,},
4747

48-
/* Offsets of rsc entries */
49-
{
50-
// offsetof(struct remote_resource_table, rproc_version),
51-
// offsetof(struct remote_resource_table, fw_chksum),
52-
// offsetof(struct remote_resource_table, ddr_devmem),
53-
// offsetof(struct remote_resource_table, tcm_devmem),
54-
// offsetof(struct remote_resource_table, rpmsg_vdev),
55-
offsetof(struct remote_resource_table, fw_version),
56-
offsetof(struct remote_resource_table, startup_devmem),
57-
offsetof(struct remote_resource_table, flash_devmem),
58-
offsetof(struct remote_resource_table, freertos_heap_devmem),
59-
offsetof(struct remote_resource_table, log_devmem),
60-
offsetof(struct remote_resource_table, scmi_devmem),
61-
offsetof(struct remote_resource_table, atcm_devmem),
62-
},
48+
/* Offsets of rsc entries */
49+
{
50+
/* offsetof(struct remote_resource_table, rproc_version), */
51+
/* offsetof(struct remote_resource_table, fw_chksum), */
52+
/* offsetof(struct remote_resource_table, ddr_devmem), */
53+
/* offsetof(struct remote_resource_table, tcm_devmem), */
54+
/* offsetof(struct remote_resource_table, rpmsg_vdev), */
55+
offsetof(struct remote_resource_table, fw_version),
56+
offsetof(struct remote_resource_table, startup_devmem),
57+
offsetof(struct remote_resource_table, flash_devmem),
58+
offsetof(struct remote_resource_table, freertos_heap_devmem),
59+
offsetof(struct remote_resource_table, log_devmem),
60+
offsetof(struct remote_resource_table, scmi_devmem),
61+
offsetof(struct remote_resource_table, atcm_devmem),
62+
},
6363

64-
{(uint32_t)RSC_VERSION, {0}, {0}, {0}},
65-
/* flash_start_mem entry */
66-
{(uint32_t)RSC_DEVMEM, MCU_FLASH_START_DDR_ADDR, MCU_FLASH_START_DDR_ADDR, MCU_FLASH_START_SIZE, 0, 0, "startup devmem"},
67-
{(uint32_t)RSC_DEVMEM, MCU_FLASH_DDR_ADDR, MCU_FLASH_DDR_ADDR, MCU_FLASH_SIZE, 0, 0, "flash devmem"},
68-
{(uint32_t)RSC_DEVMEM, MCU_RTTHREAD_HEAP_ADDR, MCU_RTTHREAD_HEAP_ADDR, MCU_RTTHREAD_HEAP_SIZE, 0, 0, "rtthread_heap devmem"},
69-
{(uint32_t)RSC_DEVMEM, MCU_LOG_DDR_ADDR, MCU_LOG_DDR_ADDR, MCU_LOG_SIZE, 0, 0, "log devmem"},
70-
{(uint32_t)RSC_DEVMEM, MCU_SCMI_DDR_ADDR, MCU_SCMI_DDR_ADDR, MCU_SCMI_SIZE, 0, 0, "scmi devmem"},
71-
{(uint32_t)RSC_DEVMEM, MCU_ATCM_ADDR, MCU_BTCM_ADDR, MCU_ATCM_SIZE, 0, 0, "atcm devmem"},
64+
{(uint32_t)RSC_VERSION, {0}, {0}, {0}},
65+
/* flash_start_mem entry */
66+
{(uint32_t)RSC_DEVMEM, MCU_FLASH_START_DDR_ADDR, MCU_FLASH_START_DDR_ADDR, MCU_FLASH_START_SIZE, 0, 0, "startup devmem"},
67+
{(uint32_t)RSC_DEVMEM, MCU_FLASH_DDR_ADDR, MCU_FLASH_DDR_ADDR, MCU_FLASH_SIZE, 0, 0, "flash devmem"},
68+
{(uint32_t)RSC_DEVMEM, MCU_RTTHREAD_HEAP_ADDR, MCU_RTTHREAD_HEAP_ADDR, MCU_RTTHREAD_HEAP_SIZE, 0, 0, "rtthread_heap devmem"},
69+
{(uint32_t)RSC_DEVMEM, MCU_LOG_DDR_ADDR, MCU_LOG_DDR_ADDR, MCU_LOG_SIZE, 0, 0, "log devmem"},
70+
{(uint32_t)RSC_DEVMEM, MCU_SCMI_DDR_ADDR, MCU_SCMI_DDR_ADDR, MCU_SCMI_SIZE, 0, 0, "scmi devmem"},
71+
{(uint32_t)RSC_DEVMEM, MCU_ATCM_ADDR, MCU_BTCM_ADDR, MCU_ATCM_SIZE, 0, 0, "atcm devmem"},
7272

7373
};
74+

bsp/rdk/s100/board/rsc_table.h

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,57 +33,58 @@
3333
* for use by the Linux Master */
3434
#ifndef HB_RSC_TABLE_H
3535
#define HB_RSC_TABLE_H
36-
36+
3737
#include <stddef.h>
3838
#include <stdint.h>
3939

4040
struct fw_rsc_version_with_type {
41-
uint32_t typefw_rsc_version;
42-
uint8_t version[48];
43-
uint8_t compile_time[16];
44-
uint8_t git_hash_id[40];
41+
uint32_t typefw_rsc_version;
42+
uint8_t version[48];
43+
uint8_t compile_time[16];
44+
uint8_t git_hash_id[40];
4545
};
4646

4747
enum fw_resource_type {
48-
RSC_CARVEOUT = 0,
49-
RSC_DEVMEM = 1,
50-
RSC_TRACE = 2,
51-
RSC_VDEV = 3,
52-
RSC_RPROC_MEM = 4U,
53-
RSC_FW_CHKSUM = 5U,
54-
RSC_VERSION = 6U,
55-
RSC_LAST = 7U,
56-
RSC_VENDOR_START = 128,
57-
RSC_VENDOR_END = 512,
48+
RSC_CARVEOUT = 0,
49+
RSC_DEVMEM = 1,
50+
RSC_TRACE = 2,
51+
RSC_VDEV = 3,
52+
RSC_RPROC_MEM = 4U,
53+
RSC_FW_CHKSUM = 5U,
54+
RSC_VERSION = 6U,
55+
RSC_LAST = 7U,
56+
RSC_VENDOR_START = 128,
57+
RSC_VENDOR_END = 512,
5858
};
5959

6060
struct fw_rsc_devmem_with_type {
61-
uint32_t typefw_rsc_devmem;
62-
uint32_t da;
63-
uint32_t pa;
64-
uint32_t len;
65-
uint32_t flags;
66-
uint32_t reserved;
67-
uint8_t name[32];
61+
uint32_t typefw_rsc_devmem;
62+
uint32_t da;
63+
uint32_t pa;
64+
uint32_t len;
65+
uint32_t flags;
66+
uint32_t reserved;
67+
uint8_t name[32];
6868
};
6969

7070
#define NO_RESOURCE_ENTRIES (7U)
7171

7272
/* Resource table for the given remote */
7373
struct remote_resource_table {
74-
uint32_t version;
75-
uint32_t num;
76-
uint32_t reserved[2];
77-
uint32_t offset[NO_RESOURCE_ENTRIES];
78-
struct fw_rsc_version_with_type fw_version; /*PRQA S ALL*/
79-
struct fw_rsc_devmem_with_type startup_devmem;
80-
struct fw_rsc_devmem_with_type flash_devmem;
81-
struct fw_rsc_devmem_with_type freertos_heap_devmem;
82-
struct fw_rsc_devmem_with_type log_devmem;
83-
struct fw_rsc_devmem_with_type scmi_devmem;
84-
struct fw_rsc_devmem_with_type atcm_devmem;
74+
uint32_t version;
75+
uint32_t num;
76+
uint32_t reserved[2];
77+
uint32_t offset[NO_RESOURCE_ENTRIES];
78+
struct fw_rsc_version_with_type fw_version; /*PRQA S ALL*/
79+
struct fw_rsc_devmem_with_type startup_devmem;
80+
struct fw_rsc_devmem_with_type flash_devmem;
81+
struct fw_rsc_devmem_with_type freertos_heap_devmem;
82+
struct fw_rsc_devmem_with_type log_devmem;
83+
struct fw_rsc_devmem_with_type scmi_devmem;
84+
struct fw_rsc_devmem_with_type atcm_devmem;
8585
}__attribute__((packed, aligned(0x100)));
8686

8787
extern const struct remote_resource_table resources;
8888

8989
#endif /* RSC_TABLE_H_ */
90+

bsp/rdk/s100/drivers/drv_can.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ static rt_uint32_t s100_can_basic_build_mb_cs(rt_uint32_t code, rt_uint32_t dlc,
318318
{
319319
cs |= (1UL << 21) | (1UL << 22);
320320
}
321+
321322
if (rtr != RT_FALSE)
322323
{
323324
cs |= (1UL << 20);
@@ -437,6 +438,7 @@ static void s100_can_basic_update_irq_mask(struct s100_can_basic *ctrl, rt_uint3
437438
{
438439
imask1_tx |= (1UL << i);
439440
}
441+
440442
for (i = 0U; i < (S100_CAN_MAX_MB_INDEX - 32U); i++)
441443
{
442444
imask2_tx |= (1UL << i);
@@ -974,7 +976,7 @@ static rt_err_t s100_can_basic_configure(struct rt_can_device *can, struct can_c
974976
CAN_RET(-RT_EINVAL, "configure invalid sndboxnumber=0");
975977
}
976978

977-
//TODO legacy RXFIFO 0-S100_CAN_MAX_MB_INDEX
979+
/* TODO legacy RXFIFO 0-S100_CAN_MAX_MB_INDEX */
978980
if (cfg->sndboxnumber > S100_CAN_MAX_MB_INDEX - S100_CAN_BASIC_TX_MB_START)
979981
{
980982
CAN_RET_FMT(-RT_EINVAL, "configure sndboxnumber too large=%lu",
@@ -1048,6 +1050,7 @@ static rt_err_t s100_can_basic_control(struct rt_can_device *can, int cmd, void
10481050
{
10491051
can->config.baud_rate = new_baud;
10501052
}
1053+
10511054
if (ret != RT_EOK)
10521055
{
10531056
CAN_RET_FMT(ret, "control set baud failed ctrl=%s baud=%lu",
@@ -1066,6 +1069,7 @@ static rt_err_t s100_can_basic_control(struct rt_can_device *can, int cmd, void
10661069
{
10671070
can->config.mode = new_mode;
10681071
}
1072+
10691073
if (ret != RT_EOK)
10701074
{
10711075
CAN_RET_FMT(ret, "control set mode failed ctrl=%s mode=%lu",
@@ -1148,6 +1152,7 @@ static rt_ssize_t s100_can_basic_sendmsg_nonblocking(struct rt_can_device *can,
11481152
{
11491153
return RT_EOK;
11501154
}
1155+
11511156
if (ret != -RT_EBUSY)
11521157
{
11531158
CAN_RET_FMT(ret, "sendmsg nonblocking failed boxno=%lu", (unsigned long)boxno);
@@ -1283,7 +1288,7 @@ int rt_hw_can_init(void)
12831288
s100_can_board_enable_transceiver();
12841289

12851290
for (i = 0U; i < (sizeof(s100_can_basics) / sizeof(s100_can_basics[0])); i++)
1286-
{
1291+
{
12871292
s100_can_basics[i].can_dev.config = cfg;
12881293
s100_can_basics[i].can_dev.parent.user_data = &s100_can_basics[i];
12891294

@@ -1311,3 +1316,4 @@ int rt_hw_can_init(void)
13111316
return RT_EOK;
13121317
}
13131318
INIT_DEVICE_EXPORT(rt_hw_can_init);
1319+

bsp/rdk/s100/drivers/drv_can.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ typedef struct
237237
#define FLEXCAN_CTRL1_SMP_WIDTH (1U)
238238
#define FLEXCAN_CTRL1_SMP(x) (((rt_uint32_t)(((rt_uint32_t)(x)) << FLEXCAN_CTRL1_SMP_SHIFT)) & FLEXCAN_CTRL1_SMP_MASK)
239239

240-
#define FLEXCAN_CTRL1_CLKSRC_MASK (0x2000U)//zjh add
240+
#define FLEXCAN_CTRL1_CLKSRC_MASK (0x2000U)/* zjh add */
241241
#define FLEXCAN_CTRL1_CLKSRC_SHIFT (13U)
242242
#define FLEXCAN_CTRL1_CLKSRC(x) (((rt_uint32_t)(((rt_uint32_t)(x)) << FLEXCAN_CTRL1_CLKSRC_SHIFT)) & FLEXCAN_CTRL1_CLKSRC_MASK)
243243

@@ -1221,3 +1221,4 @@ typedef struct
12211221
#define FLEXCAN_IP_FEATURE_EXPANDABLE_MEMORY_NUM (6U)
12221222

12231223
#endif
1224+

bsp/rdk/s100/drivers/drv_gpio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,3 +492,4 @@ int rt_hw_pin_init(void)
492492
return rt_device_pin_register("pin", &s100_pin_ops, RT_NULL);
493493
}
494494
INIT_DEVICE_EXPORT(rt_hw_pin_init);
495+

bsp/rdk/s100/drivers/drv_gpio.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ void s100_gpio_write(rt_uint8_t pin, rt_uint8_t value);
2828
rt_uint8_t s100_gpio_read(rt_uint8_t pin);
2929

3030
#endif
31+

bsp/rdk/s100/drivers/drv_pinmux.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,4 @@ rt_err_t s100_pin_set_pull(s100_pin_t pin, s100_pin_pull_t pull)
145145
s100_pin_cfg_regs[pin].value = cfg.value;
146146
return RT_EOK;
147147
}
148+

0 commit comments

Comments
 (0)