Changeset 7916139 in rtems for bsps


Ignore:
Timestamp:
Sep 13, 2018, 9:33:50 AM (13 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
94ea8a8
Parents:
fe283f6c
git-author:
Sebastian Huber <sebastian.huber@…> (09/13/18 09:33:50)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/17/18 06:56:31)
Message:

bsp/tqm8xx: Use custom string to uint32_t

Avoid C locale support which is not available at this stage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bsps/powerpc/tqm8xx/start/bspstart.c

    rfe283f6c r7916139  
    7777}
    7878
     79static uint32_t str_to_u32(const char *s)
     80{
     81  uint32_t v = 0;
     82
     83  while (true) {
     84    unsigned char digit = (unsigned char)*s - '0';
     85
     86    if (digit > 9) {
     87      break;
     88    }
     89
     90    v = (v * 10) + digit;
     91    ++s;
     92  }
     93
     94  return v;
     95}
     96
    7997static rtems_status_code  bsp_tqm_get_cib_uint32( const char *cib_id,
    8098                                           uint32_t   *result)
    8199{
    82100  const char *item_ptr;
    83   char *end_ptr;
    84101  item_ptr = bsp_tqm_get_cib_string(cib_id);
    85102  if (item_ptr == NULL) {
     
    89106   * convert string to uint32
    90107   */
    91   *result = strtoul(item_ptr,&end_ptr,10);
     108  *result = str_to_u32(item_ptr);
    92109  return RTEMS_SUCCESSFUL;
    93110}
Note: See TracChangeset for help on using the changeset viewer.