From 1d7ed1f65e339c4c111f14d55bc0ba7220b2f62e Mon Sep 17 00:00:00 2001 From: Nathael Pajani Date: Thu, 17 Apr 2014 11:13:07 +0200 Subject: [PATCH] There are more than the division routines in ROM. Prepare for inclusion of the other ones. --- core/bootstrap.c | 4 ++-- core/{uidiv.c => rom_helpers.c} | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) rename core/{uidiv.c => rom_helpers.c} (90%) diff --git a/core/bootstrap.c b/core/bootstrap.c index 8b414b3..c59bba2 100644 --- a/core/bootstrap.c +++ b/core/bootstrap.c @@ -129,7 +129,7 @@ void *vector_table[] __attribute__ ((section(".vectors"))) = { }; -extern void rom_div_helpers_init(void); +extern void rom_helpers_init(void); /* * This is the entry point of the programm * It does the set up of the memory and then starts the main. @@ -149,7 +149,7 @@ void Reset_Handler(void) { *dst++ = 0; /* Initialize rom based division helpers */ - rom_div_helpers_init(); + rom_helpers_init(); /* Start main programm */ main(); } diff --git a/core/uidiv.c b/core/rom_helpers.c similarity index 90% rename from core/uidiv.c rename to core/rom_helpers.c index b484b96..ec823ea 100644 --- a/core/uidiv.c +++ b/core/rom_helpers.c @@ -1,5 +1,5 @@ /**************************************************************************** - * core/uidiv.c + * core/rom_helpers.c * * * @@ -44,14 +44,8 @@ struct lpc_rom_div_helpers { struct uidiv_return (*rom_uidivmod)(unsigned numerator, unsigned denominator); }; -#define LPC_122x_DIVROM_LOC (0x1FFC0000) static struct lpc_rom_div_helpers* rom_div_helpers; -void rom_div_helpers_init(void) -{ - rom_div_helpers = *((struct lpc_rom_div_helpers**)LPC_122x_DIVROM_LOC); -} - /* Division (/) */ int __aeabi_idiv(int numerator, int denominator) { @@ -78,3 +72,14 @@ void __aeabi_uidivmod(unsigned numerator, unsigned denominator) asm volatile("" : "+r"(r0), "+r"(r1) : "r"(r0), "r"(r1)); } + +/*******************************************************************************/ +/* Rom based routines initialisation */ +/*******************************************************************************/ +#define LPC_122x_DIVROM_LOC (0x1FFC0000) + +void rom_helpers_init(void) +{ + rom_div_helpers = *((struct lpc_rom_div_helpers**)LPC_122x_DIVROM_LOC); +} + -- 2.43.0