From 7129d77bee6e1016f849290dbd5aa33874548486 Mon Sep 17 00:00:00 2001 From: 勤为本 <1207280597@qq.com> Date: Thu, 10 Aug 2017 15:35:03 +0800 Subject: 增加龙芯1c硬浮点的支持(可以使用硬浮点了) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/ls1cdev/drivers/board.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'bsp/ls1cdev') diff --git a/bsp/ls1cdev/drivers/board.c b/bsp/ls1cdev/drivers/board.c index f9c7454a16..29d7fa7142 100644 --- a/bsp/ls1cdev/drivers/board.c +++ b/bsp/ls1cdev/drivers/board.c @@ -51,6 +51,31 @@ void rt_hw_timer_init(void) write_c0_count(0); } + +/** + * init hardware FPU + */ +void rt_hw_fpu_init(void) +{ + rt_uint32_t c0_status = 0; + rt_uint32_t c1_status = 0; + + // ʹÄÜЭ´¦ÀíÆ÷1--FPU + c0_status = read_c0_status(); + c0_status |= (ST0_CU1 | ST0_FR); + write_c0_status(c0_status); + + // ÅäÖÃFPU + c1_status = read_c1_status(); + c1_status |= (FPU_CSR_FS | FPU_CSR_FO | FPU_CSR_FN); // set FS, FO, FN + c1_status &= ~(FPU_CSR_ALL_E); // disable exception + c1_status = (c1_status & (~FPU_CSR_RM)) | FPU_CSR_RN; // set RN + write_c1_status(c1_status); + + return ; +} + + /** * This function will initial sam7s64 board. */ @@ -69,6 +94,9 @@ void rt_hw_board_init(void) /* init operating system timer */ rt_hw_timer_init(); + /* init hardware fpu */ + rt_hw_fpu_init(); + rt_kprintf("current sr: 0x%08x\n", read_c0_status()); } -- cgit v1.3.1