Skip to content

Commit c2ae568

Browse files
committed
[xuantie] 添加玄铁R,C全系列RTOS支持
1 parent 8903606 commit c2ae568

File tree

174 files changed

+18968
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+18968
-230
lines changed

bsp/xuantie/libraries/device_drivers/drv_usart.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <rtdbg.h>
2828

2929
#if !defined(BSP_USING_UART0) && !defined(BSP_USING_UART1) && !defined(BSP_USING_UART2) && !defined(BSP_USING_UART3) \
30-
&& !defined(BSP_USING_UART4) && !defined(BSP_USING_UART5) && !defined(BSP_USING_UART6) && !defined(BSP_USING_UART7)
30+
&& !defined(BSP_USING_UART4) && !defined(BSP_USING_UART5) && !defined(BSP_USING_UART6) && !defined(BSP_USING_UART7)
3131
#error "Please define at least one BSP_USING_UARTx"
3232
/* this driver can be disabled at menuconfig -> RT-Thread Components -> Device Drivers */
3333
#endif
@@ -148,7 +148,7 @@ static int xuantie_putc(struct rt_serial_device *serial, char c)
148148
ret = csi_uart_send(&uart->uart, &c, 1, 50);
149149
if (ret == 1)
150150
return RT_EOK;
151-
151+
152152
return RT_ERROR;
153153
}
154154

@@ -160,7 +160,7 @@ static int xuantie_getc(struct rt_serial_device *serial)
160160

161161
csi_uart_receive(&uart->uart, &c, 1, 0x5);
162162
dw_uart_enable_recv_irq(uart_base);
163-
return c;
163+
return c;
164164
}
165165

166166
static const struct rt_uart_ops xuantie_uart_ops =

bsp/xuantie/libraries/device_drivers/drv_usart.h

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

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/include/asm/riscv_asm_macro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/*
2020
* attention: don't modify this file as a suggest
2121
* you should copy from chip_riscv_dummy/include/asm/riscv_asm_macro.h and keep it newer
22-
* please contact xuantie-rtos os team if have question
22+
* please contact xuantie-rtos os team if have question
2323
*/
2424

2525
#ifndef __RISCV_ASM_MACRO_H__

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/include/asm/riscv_csr.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,30 @@
1919
/*
2020
* attention: don't modify this file as a suggest
2121
* you should copy from chip_riscv_dummy/include/asm/riscv_csr.h and keep it newer
22-
* please contact xuantie-rtos os team if have question
22+
* please contact xuantie-rtos os team if have question
2323
*/
2424

2525
#ifndef __RISCV_CSR_H__
2626
#define __RISCV_CSR_H__
2727

2828
#if __riscv_xlen == 64
29-
#define portWORD_SIZE 8
30-
#define store_x sd
31-
#define load_x ld
29+
#define portWORD_SIZE 8
30+
#define store_x sd
31+
#define load_x ld
3232
#elif __riscv_xlen == 32
33-
#define store_x sw
34-
#define load_x lw
35-
#define portWORD_SIZE 4
33+
#define store_x sw
34+
#define load_x lw
35+
#define portWORD_SIZE 4
3636
#else
37-
#error Assembler did not define __riscv_xlen
37+
#error Assembler did not define __riscv_xlen
3838
#endif
3939

4040
#if __riscv_flen == 64
41-
#define fstore_x fsd
42-
#define fload_x fld
41+
#define fstore_x fsd
42+
#define fload_x fld
4343
#elif __riscv_flen == 32
44-
#define fstore_x fsw
45-
#define fload_x flw
44+
#define fstore_x fsw
45+
#define fload_x flw
4646
#endif
4747

4848
#if defined(CONFIG_RISCV_SMODE) && CONFIG_RISCV_SMODE
@@ -136,7 +136,7 @@
136136
#define MSTATUS_FS_SHIFT 13
137137
#define MSTATUS_MS_SHIFT 25
138138

139-
#define INSERT_FIELD(val, which, fieldval) (((val) & ~(which)) | ((fieldval) * ((which) & ~((which)-1))))
139+
#define INSERT_FIELD(val, which, fieldval) (((val) & ~(which)) | ((fieldval) * ((which) & ~((which)-1))))
140140

141141
#if CONFIG_CPU_XUANTIE_C906 || CONFIG_CPU_XUANTIE_C906FD || CONFIG_CPU_XUANTIE_C906FDV || CONFIG_CPU_XUANTIE_C908 || CONFIG_CPU_XUANTIE_C908V ||CONFIG_CPU_XUANTIE_C908I || CONFIG_CPU_XUANTIE_R910 || CONFIG_CPU_XUANTIE_R920
142142
#define ATTR_SO (1ull << 4)

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/include/drv/dev_tag.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ typedef enum {
9090
DEV_RAMBUS_120SI_TAG,
9191
DEV_RAMBUS_120SII_TAG,
9292
DEV_RAMBUS_120SIII_TAG,
93-
DEV_WJ_AVFS_TAG,
93+
DEV_WJ_AVFS_TAG,
9494
DEV_WJ_BMU_TAG,
9595
} csi_dev_tag_t;
9696

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/include/dw_timer_ll.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
2-
* Copyright (C) 2017-2024 Alibaba Group Holding Limited
2+
* Copyright (C) 2017-2024 Alibaba Group Holding Limited
33
*/
44

55
/*******************************************************
6-
* @file dw_timer_ll.h
7-
* @brief header file for timer ll driver
6+
* @file dw_timer_ll.h
7+
* @brief header file for timer ll driver
88
* @version V1.0
9-
* @date 9. April 2020
9+
* @date 9. April 2020
1010
* ******************************************************/
1111

1212
#ifndef _DW_TIMER_LL_H_
@@ -21,7 +21,7 @@ extern "C"
2121
{
2222
#endif
2323

24-
/*! Timer1 Control Reg, offset: 0x08 */
24+
/*! Timer1 Control Reg, offset: 0x08 */
2525
#define DW_TIMER_CTL_ENABLE_SEL_Pos (0U)
2626
#define DW_TIMER_CTL_ENABLE_SEL_Msk (0x1U << DW_TIMER_CTL_ENABLE_SEL_Pos)
2727
#define DW_TIMER_CTL_ENABLE_SEL_EN DW_TIMER_CTL_ENABLE_SEL_Msk

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/src/drivers/aes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2024 Alibaba Group Holding Limited
2+
* Copyright (C) 2017-2024 Alibaba Group Holding Limited
33
*/
44

55
/*******************************************************

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/src/drivers/crc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <string.h>
2828
#include <drv/crc.h>
2929
#include <drv/common.h>
30-
#include <assert.h>
30+
#include <assert.h>
3131

3232
/**
3333
\brief CRC State
@@ -124,7 +124,7 @@ csi_error_t csi_crc_config(csi_crc_t *crc, csi_crc_config_t *config)
124124
///< TODO:设置模式
125125
///< TODO:设置极性
126126
///< TODO:设置初始值
127-
127+
128128
break;
129129

130130
case CRC_STANDARD_IBM:

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/src/drivers/i2s.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ int32_t csi_i2s_send(csi_i2s_t *i2s, const void *data, uint32_t size)
651651

652652
if ((uint8_t *)i2s->priv) { ///< if dma is stop, then start it
653653
soc_dcache_clean_invalid_range((unsigned long)(i2s->tx_buf->buffer + i2s->tx_buf->read), i2s->tx_period);
654-
654+
655655
///< TODO:调用csi_dma_ch_start开启DMA通道发送数据
656656
i2s->priv = (void *)0U;
657657
}

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/src/drivers/iic.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void dw_iic_slave_rx_handler(void *arg)
7171

7272
///< TODO:根据中断状态接收数据
7373
///< TODO:根据中断状态处理异常并执行用户回调函数
74-
74+
7575
}
7676

7777
/**
@@ -121,7 +121,7 @@ csi_error_t csi_iic_init(csi_iic_t *iic, uint32_t idx)
121121
///< TODO:关闭IIC所有的中断
122122
///< TODO:设置IIC从机在接收到来自主机的读取请求时不刷新FIFO中的数据
123123
}
124-
124+
125125
iic->state.writeable = 1U;
126126
iic->state.readable = 1U;
127127
iic->state.error = 0U;
@@ -158,8 +158,8 @@ void csi_iic_uninit(csi_iic_t *iic)
158158
///< TODO:关闭IIC
159159

160160
// 禁止中断控制器对应的中断,注销中断服务函数
161-
csi_irq_disable((uint32_t)iic->dev.irq_num);
162-
csi_irq_detach((uint32_t)iic->dev.irq_num);
161+
csi_irq_disable((uint32_t)iic->dev.irq_num);
162+
csi_irq_detach((uint32_t)iic->dev.irq_num);
163163
}
164164

165165
/**
@@ -238,7 +238,7 @@ csi_error_t csi_iic_speed(csi_iic_t *iic, csi_iic_speed_t speed)
238238

239239
ret = CSI_OK;
240240
} else if (speed == IIC_BUS_SPEED_FAST) {
241-
241+
242242
///< TODO:设置IIC为快速模式,400KHz
243243
///< TODO:获取IIC使用的频率
244244
///< TODO:快速模式设置SCL时钟的高周期计数
@@ -370,7 +370,7 @@ static csi_error_t iic_master_send_intr(csi_iic_t *iic, uint32_t devaddr, const
370370
///< TODO:使能发送中断
371371
///< TODO:设置发送FIFO的触发级别
372372
///< TODO:打开IIC
373-
373+
374374
}
375375
}
376376

@@ -410,7 +410,7 @@ static csi_error_t iic_master_send_dma(csi_iic_t *iic, uint32_t devaddr, const v
410410

411411
soc_dcache_clean_invalid_range((unsigned long)iic->data, iic->size);
412412

413-
///< TODO:调用csi_dma_ch_start开启IIC使用的DMA通道
413+
///< TODO:调用csi_dma_ch_start开启IIC使用的DMA通道
414414
///< TODO:打开IIC
415415

416416
return ret;
@@ -662,7 +662,7 @@ int32_t csi_iic_mem_receive(csi_iic_t *iic, uint32_t devaddr, uint16_t memaddr,
662662
///< TODO:设置IIC为接收数据模式
663663
}
664664

665-
///< TODO:等待接收数据,超时则超时退出
665+
///< TODO:等待接收数据,超时则超时退出
666666

667667
if (ret == CSI_OK) {
668668
for (read_count = 0; read_count < (int32_t)size; read_count++) {
@@ -689,7 +689,7 @@ int32_t csi_iic_mem_receive(csi_iic_t *iic, uint32_t devaddr, uint16_t memaddr,
689689
}
690690

691691
///< TODO:IIC读数据寄存器接收数据
692-
692+
693693
read_count ++;
694694

695695
if (cmd_num > 0U) {
@@ -874,7 +874,7 @@ csi_error_t csi_iic_slave_send_async(csi_iic_t *iic, const void *data, uint32_t
874874
///< 注册发送中断服务函数、使能中断控制器对应的中断
875875
csi_irq_attach((uint32_t)iic->dev.irq_num, &dw_iic_slave_tx_handler, &iic->dev);
876876
csi_irq_enable((uint32_t)iic->dev.irq_num);
877-
877+
878878
///< 开始IIC从机模式以中断方式发送数据
879879
iic_slave_send_intr(iic, data, size);
880880
}
@@ -972,7 +972,7 @@ csi_error_t csi_iic_slave_receive_async(csi_iic_t *iic, void *data, uint32_t siz
972972
///< 初始化接收中断服务函数、使能中断控制器对应的中断
973973
csi_irq_attach((uint32_t)iic->dev.irq_num, &dw_iic_slave_rx_handler, &iic->dev);
974974
csi_irq_enable((uint32_t)iic->dev.irq_num);
975-
975+
976976
///< TODO:开始IIC从机模式以中断方式发送数据
977977
iic_slave_receive_intr(iic, data, size);
978978
}

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/src/drivers/mbox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ int32_t csi_mbox_receive(csi_mbox_t *mbox, uint32_t channel_id, void *data, uint
166166
///< TODO:往指定的CPU以及该CPU的某个通道写数据(0)
167167
}
168168

169-
///< TODO:禁止指定的CPU以及该CPU的某个通道的中断
169+
///< TODO:禁止指定的CPU以及该CPU的某个通道的中断
170170
memcpy(data, buf, size);
171171

172172
///< TODO:往指定的CPU以及该CPU的某个通道写数据((MBOX_ACK << 16U) | 1U)

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/src/drivers/pwm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2024 Alibaba Group Holding Limited
2+
* Copyright (C) 2017-2024 Alibaba Group Holding Limited
33
*/
44

55
/*******************************************************
@@ -100,7 +100,7 @@ csi_error_t csi_pwm_out_start(csi_pwm_t *pwm, uint32_t channel)
100100
{
101101
CSI_PARAM_CHK(pwm, CSI_ERROR);
102102

103-
///< TODO:打开输出使能
103+
///< TODO:打开输出使能
104104

105105
return CSI_OK;
106106
}

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/src/drivers/qspi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ csi_error_t csi_qspi_mode(csi_qspi_t *qspi, csi_qspi_mode_t mode)
100100
case QSPI_CLOCK_MODE_2:
101101
///< TODO:配置QSPI时钟的极性和相位
102102
break;
103-
103+
104104
case QSPI_CLOCK_MODE_3:
105105
///< TODO:配置QSPI时钟的极性和相位
106106
break;

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/src/drivers/rsa.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
#define GET_KEY_WORD(k) (k >> 5U)
3737

3838
///< TODO:RSA_KEY_LEN需要根据实际情况进行设置
39-
#define RSA_KEY_LEN 2048U ///< 支持RSA秘钥的最大长度
40-
#define RSA_KEY_BYTE (RSA_KEY_LEN >> 3U)
41-
#define RSA_KEY_WORD (RSA_KEY_LEN >> 5U)
39+
#define RSA_KEY_LEN 2048U ///< 支持RSA秘钥的最大长度
40+
#define RSA_KEY_BYTE (RSA_KEY_LEN >> 3U)
41+
#define RSA_KEY_WORD (RSA_KEY_LEN >> 5U)
4242

4343
#define BN_MAX_BITS ((RSA_KEY_LEN << 1U) + 32U)
4444
#define BN_MAX_BYTES ((BN_MAX_BITS + 7U) >> 3U)

bsp/xuantie/libraries/xuantie_libraries/chip_riscv_dummy/src/drivers/sha.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
2-
* Copyright (C) 2017-2024 Alibaba Group Holding Limited
2+
* Copyright (C) 2017-2024 Alibaba Group Holding Limited
33
*/
44

55
/*******************************************************
6-
* @file wj_sha.c
7-
* @brief source file for sha csi driver
6+
* @file wj_sha.c
7+
* @brief source file for sha csi driver
88
* @version V2.0
9-
* @date 14. Sept 2020
9+
* @date 14. Sept 2020
1010
* ******************************************************/
1111

1212
#include <drv/sha.h>
@@ -281,7 +281,7 @@ csi_error_t csi_sha_update(csi_sha_t *sha, csi_sha_context_t *context, const voi
281281
sha->state.busy = 1U;
282282

283283
///< TODO:设置SHA 模式
284-
///< TODO:用context->state初始化HASH
284+
///< TODO:用context->state初始化HASH
285285

286286
block_size = SHA_GET_BOLOCK_SIZE_BYTES(context->mode);
287287

@@ -378,7 +378,7 @@ csi_error_t csi_sha_finish(csi_sha_t *sha, csi_sha_context_t *context, void *out
378378
uint64_t pad_bit_len;
379379

380380
///< TODO:设置SHA 模式
381-
///< TODO:用context->state初始化HASH
381+
///< TODO:用context->state初始化HASH
382382

383383
block_size = SHA_GET_BOLOCK_SIZE_BYTES(context->mode);
384384
msg_length = SHA_GET_MSGLEN_TAIL_4BYTES(context->mode);

0 commit comments

Comments
 (0)