diff --git a/drivers/drivers-x2600/include/x2600_ll_riscv.h b/drivers/drivers-x2600/include/x2600_ll_riscv.h new file mode 100755 index 0000000000000000000000000000000000000000..8a219503835d1a26a6b81b985a95e23ec85a8413 --- /dev/null +++ b/drivers/drivers-x2600/include/x2600_ll_riscv.h @@ -0,0 +1,165 @@ +/** + * @file x2600_ll_riscv.h + * @author MPU系统软件部团队 + * @brief [!!!!删除此内容,添加文件简介!!!!] + * + * @copyright 版权所有 (北京君正集成电路股份有限公司) {2022} + * @copyright Copyright© 2022 Ingenic Semiconductor Co.,Ltd + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + */ + +#ifndef __X2600_LL_RISCV_H__ +#define __X2600_LL_RISCV_H__ + +#ifdef __cplusplus + extern "C" { +#endif + +/** + * @addtogroup group_RISCV + * @{ + */ + +/** + * @addtogroup g_X2600_RISCV_LL_Driver RISCV LL 驱动 + * @{ + */ + +/* 1. 头文件 (Includes)----------------------------------------------- */ +#include +/* 2. 导出的类型 (Exported Types)--------------------------------------- */ +/** + * @defgroup RISCV_exported_types RISCV 导出的类型 (Exported Types) + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 3. 导出常量定义 Exported Constants ----------------------------------- */ +/** + * @defgroup RISCV_exported_constants RISCV 导出的常量 Exported Constants + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 4. 导出宏定义 Exported Macros --------------------------------------- */ +/** + * @defgroup RISCV_exported_macros RISCV 导出宏 Exported Macros + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 5. 导出函数申明 Exported Funcs --------------------------------------- */ +/** + * @defgroup RISCV_exported_funcs RISCV 导出函数申明 Exported Funcs + * @{ + */ +void ingenic_mbx_sendmsg(unsigned int data); +void init_systick(void); +void systick_delay_ms(unsigned int ms); + +/** + * @} + */ +/* 6. 导出变量申明 (Exported Variables) --------------------------------- */ +/** + * @defgroup RISCV_exported_var RISCV 导出变量申明 (Exported Variables) + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 7. 私有类型定义 (Private Types) -------------------------------------- */ +/** + * @defgroup RISCV_private_types RISCV 私有类型定义 (Private Types) + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 8. 私有常量定义Private Constants ------------------------------------- */ +/** + * @defgroup RISCV_private_constants RISCV 私有常量定义Private Constants + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 9. 私有宏定义 (Private Macros) -------------------------------------- */ +/** + * @defgroup RISCV_private_macros RISCV 私有宏定义 (Private Macros) + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 10. 私有函数申明 (Private Funcs) ------------------------------------- */ +/** + * @defgroup RISCV_private_funcs RISCV 私有函数申明 (Private Funcs) + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 11. 私有变量申明 Private Variables ----------------------------------- */ +/** + * @defgroup RISCV_private_var RISCV 私有变量申明 (Private Variables) + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ + +/** + * @} + */ + +/** + * @} + */ +#ifdef __cplusplus +} +#endif +#endif /* __X2600_LL_RISCV_H__ */ diff --git a/drivers/drivers-x2600/src/x2600_ll_riscv.c b/drivers/drivers-x2600/src/x2600_ll_riscv.c new file mode 100755 index 0000000000000000000000000000000000000000..c3dc5578c1d73d1d87ba0e94d2b45acd7a8e1235 --- /dev/null +++ b/drivers/drivers-x2600/src/x2600_ll_riscv.c @@ -0,0 +1,160 @@ +/** + * @file x2600_ll_riscv.c + * @author MPU系统软件部团队 + * @brief [!!!!删除此内容,添加文件简介!!!!] + * + * @copyright 版权所有 (北京君正集成电路股份有限公司) {2022} + * @copyright Copyright© 2022 Ingenic Semiconductor Co.,Ltd + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + @verbatim + ============================================================================== + ##### 使用说明 ##### + ============================================================================== + [!!!!删除此内容,添加针对模块的使用方法说明,例如: 配置,启动/停止,状态,重点提醒等等.!!!!] + @endverbatim + */ + +/* 1.头文件 (Includes)------------------------------------------------ */ +#include + +/** @addtogroup g_X2600_PDMA_LL_Driver + * @{ + */ + +/* 2.私有常量定义Private Constants -------------------------------------- */ +/** + * @addtogroup PDMA_private_constants + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 3. 私有类型定义 (Private Types) -------------------------------------- */ +/** + * @addtogroup PDMA_private_types + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 4. 私有宏定义 (Private Macros) -------------------------------------- */ +/** + * @addtogroup PDMA_private_macros + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 5. 私有变量申明 Private Variables ------------------------------------ */ +/** + * @addtogroup PDMA_private_var + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 6. 私有函数申明 (Private Funcs) -------------------------------------- */ +/** + * @addtogroup PDMA_private_funcs + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 7. 私有函数实现 (Private Funcs) -------------------------------------- */ +/** + * @defgroup PDMA_private_funcs_impl PDMA 私有函数实现 + * @{ + */ + +// 删除此行, 添加内容 +// 删除此行, 添加内容 + +/** + * @} + */ +/* 8. 导出函数实现------------------------------------------------------- */ +/** + * @defgroup PDMA_exported_funcs_impl PDMA 导出函数实现 + * @{ + */ + +/** + * @brief 发送mailbox中断到大核 + * + */ + +void ingenic_mbx_sendmsg(unsigned int data) +{ + WRITE_REG(RISC_CCU_Instance->MBOX_TO_HOST, data); +} + +void init_systick() +{ + CLEAR_BIT(RISC_CCU_Instance->CCSR, (1 << 5)); //Disable timer + + WRITE_REG(RISC_CCU_Instance->TIME_L, 0); + WRITE_REG(RISC_CCU_Instance->TIME_H, 0); + WRITE_REG(RISC_CCU_Instance->TIME_CMP_H, 0x0fffffff); + WRITE_REG(RISC_CCU_Instance->TIME_CMP_L, 0x0fffffff); +} + +void systick_delay_ms(unsigned int ms) +{ + unsigned int time_count = 0; + CLEAR_BIT(RISC_CCU_Instance->CCSR, (1 << 5)); //Disable timer + + WRITE_REG(RISC_CCU_Instance->TIME_L, 0); + WRITE_REG(RISC_CCU_Instance->TIME_H, 0); + WRITE_REG(RISC_CCU_Instance->TIME_CMP_H, 0x0fffffff); + WRITE_REG(RISC_CCU_Instance->TIME_CMP_L, 0x0fffffff); + + SET_BIT(RISC_CCU_Instance->CCSR, (1 << 5)); //Enable timer + + while(time_countTIME_L) <= 600*1000); + WRITE_REG(RISC_CCU_Instance->TIME_H, 0); + WRITE_REG(RISC_CCU_Instance->TIME_L, 0); + time_count++; + //printf("time_count:%d\n",time_count); + } + + CLEAR_BIT(RISC_CCU_Instance->CCSR, (1 << 5)); //Disable timer + + WRITE_REG(RISC_CCU_Instance->TIME_L, 0); + WRITE_REG(RISC_CCU_Instance->TIME_H, 0); + WRITE_REG(RISC_CCU_Instance->TIME_CMP_H, 0x0fffffff); + WRITE_REG(RISC_CCU_Instance->TIME_CMP_L, 0x0fffffff); +} + +/** + * @} + */ + +/** + * @} + */