[libcpu][drivers] cortex-r52 abnormal takeover and software rtc naming change

This commit is contained in:
kurisaw 2024-11-28 17:10:42 +08:00
parent b8746961b5
commit b3c424372b
6 changed files with 67 additions and 33 deletions

View File

@ -52,7 +52,11 @@ static rt_err_t alarm_set(struct rt_alarm *alarm)
struct rt_rtc_wkalarm wkalarm;
rt_err_t ret;
#ifdef RT_USING_SOFT_RTC
device = rt_device_find("sw_rtc");
#else
device = rt_device_find("rtc");
#endif
if (device == RT_NULL)
{

View File

@ -226,8 +226,8 @@ static int rt_soft_rtc_init(void)
{
return 0;
}
/* make sure only one 'rtc' device */
RT_ASSERT(!rt_device_find("rtc"));
/* make sure only one 'sw_rtc' device */
RT_ASSERT(!rt_device_find("sw_rtc"));
#ifdef RT_USING_ALARM
rt_timer_init(&alarm_time,
@ -258,7 +258,9 @@ static int rt_soft_rtc_init(void)
/* no private */
soft_rtc_dev.user_data = RT_NULL;
rt_device_register(&soft_rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR);
rt_device_register(&soft_rtc_dev, "sw_rtc", RT_DEVICE_FLAG_RDWR);
source_device = &soft_rtc_dev;
init_ok = RT_TRUE;
@ -317,7 +319,7 @@ static void cmd_rtc_sync(int argc, char **argv)
rt_kprintf("local time: %.*s", 25, ctime(&now));
rt_kprintf("timestamps: %ld\n", (long)tv.tv_sec);
}
MSH_CMD_EXPORT_ALIAS(cmd_rtc_sync, rtc_sync, Update time by real rtc);
MSH_CMD_EXPORT_ALIAS(cmd_rtc_sync, rtc_sync, Update time by soft rtc);
#endif
#endif /* RT_USING_SYSTEM_WORKQUEUE */

View File

@ -12,8 +12,6 @@
@ (c) Texas Instruments 2009-2013, All rights reserved.
@
//#include <rtconfig.h>
.equ Mode_USR, 0x10
.equ Mode_FIQ, 0x11
.equ Mode_IRQ, 0x12
@ -47,7 +45,7 @@ stack_top:
.text
.arm
.globl _c_int00
.globl entry
.globl _reset
_reset:
@ -122,7 +120,7 @@ next2:
next3:
bl next4
next4:
ldr lr, =_c_int00
ldr lr, =entry
bx lr
.globl data_init
@ -479,26 +477,38 @@ turnon_VFP:
str lr, [r0, #14*4] @/* Save calling PC */
.endm
.globl vector_svc
vector_svc:
push_svc_reg
bl rt_hw_trap_svc
b .
.globl SWI_Handler
SWI_Handler:
push_svc_reg
bl rt_hw_trap_swi
b .
.globl vector_pabort
vector_pabort:
push_svc_reg
bl rt_hw_trap_pabt
b .
.globl Undefined_Handler
Undefined_Handler:
push_svc_reg
bl rt_hw_trap_undef
b .
.globl vector_dabort
vector_dabort:
push_svc_reg
bl rt_hw_trap_dabt
b .
.globl SVC_Handler
SVC_Handler:
push_svc_reg
b rt_hw_trap_svc
b .
.globl vector_resv
vector_resv:
push_svc_reg
bl rt_hw_trap_resv
b .
.globl Prefetch_Handler
Prefetch_Handler:
push_svc_reg
b rt_hw_trap_pabt
b .
.globl Abort_Handler
Abort_Handler:
push_svc_reg
b rt_hw_trap_dabt
b .
.globl Reserved_Handler
Reserved_Handler:
push_svc_reg
b rt_hw_trap_resv
b .

View File

@ -31,11 +31,13 @@ ABT_Stack_Size EQU 0x00000000
FIQ_Stack_Size EQU 0x00001000
IRQ_Stack_Size EQU 0x00001000
IMPORT _c_int00
IMPORT entry
IMPORT rt_hw_trap_svc
IMPORT rt_hw_trap_pabt
IMPORT rt_hw_trap_dabt
IMPORT rt_hw_trap_resv
IMPORT rt_hw_trap_swi
IMPORT rt_hw_trap_undef
IMPORT system_init
IMPORT __iar_program_start
@ -308,6 +310,18 @@ turnon_VFP:
str lr, [r0, #14*4] ;@/* Save calling PC */
endm
EXPORT SWI_Handler
SWI_Handler:
push_svc_reg
bl rt_hw_trap_swi
b .
EXPORT Undefined_Handler
Undefined_Handler:
push_svc_reg
bl rt_hw_trap_undef
b .
EXPORT SVC_Handler
SVC_Handler:
push_svc_reg

View File

@ -19,7 +19,8 @@
@ import reference for interrupt routines
.globl Reset_Handler
.globl turnon_VFP
.globl Undefined_Handler
.globl SWI_Handler
.globl SVC_Handler
.globl Prefetch_Handler
.globl Abort_Handler
@ -28,10 +29,11 @@
.globl FIQ_Handler
.globl system_vectors
system_vectors:
.globl system_vector
system_vector:
b Reset_Handler
b turnon_VFP
b Undefined_Handler
b SWI_Handler
b SVC_Handler
b Prefetch_Handler
b Abort_Handler

View File

@ -20,6 +20,7 @@
IMPORT Reset_Handler
IMPORT Undefined_Handler
IMPORT SWI_Handler
IMPORT SVC_Handler
IMPORT Prefetch_Handler
IMPORT Abort_Handler
@ -35,6 +36,7 @@
system_vectors:
b Reset_Handler
b Undefined_Handler
b SWI_Handler
b SVC_Handler
b Prefetch_Handler
b Abort_Handler