summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-13 11:33:50 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-17 08:56:31 +0200
commit7916139eab8aacb8d865f739a069db2cc603f055 (patch)
treeeefa0fa8ef5d0ac4ce9aafedea4a51f98be61959
parentpowerpc: Fix _CPU_Counter_read() for MPC860 (diff)
downloadrtems-7916139eab8aacb8d865f739a069db2cc603f055.tar.bz2
bsp/tqm8xx: Use custom string to uint32_t
Avoid C locale support which is not available at this stage.
-rw-r--r--bsps/powerpc/tqm8xx/start/bspstart.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/bsps/powerpc/tqm8xx/start/bspstart.c b/bsps/powerpc/tqm8xx/start/bspstart.c
index b42ce1ce6c..09208ac1e6 100644
--- a/bsps/powerpc/tqm8xx/start/bspstart.c
+++ b/bsps/powerpc/tqm8xx/start/bspstart.c
@@ -76,11 +76,28 @@ static const char *bsp_tqm_get_cib_string( const char *cib_id)
}
}
+static uint32_t str_to_u32(const char *s)
+{
+ uint32_t v = 0;
+
+ while (true) {
+ unsigned char digit = (unsigned char)*s - '0';
+
+ if (digit > 9) {
+ break;
+ }
+
+ v = (v * 10) + digit;
+ ++s;
+ }
+
+ return v;
+}
+
static rtems_status_code bsp_tqm_get_cib_uint32( const char *cib_id,
uint32_t *result)
{
const char *item_ptr;
- char *end_ptr;
item_ptr = bsp_tqm_get_cib_string(cib_id);
if (item_ptr == NULL) {
return RTEMS_INVALID_ID;
@@ -88,7 +105,7 @@ static rtems_status_code bsp_tqm_get_cib_uint32( const char *cib_id,
/*
* convert string to uint32
*/
- *result = strtoul(item_ptr,&end_ptr,10);
+ *result = str_to_u32(item_ptr);
return RTEMS_SUCCESSFUL;
}