1 /* 2 * Routines to access hardware 3 * 4 * Copyright (c) 2013 Realtek Semiconductor Corp. 5 * 6 * This module is a confidential and proprietary property of RealTek and 7 * possession or use of this module requires written permission of RealTek. 8 */ 9 10 #include "basic_types.h" 11 #include <stdarg.h> 12 #include <stddef.h> /* Compiler defns such as size_t, NULL etc. */ 13 #include "strproc.h" 14 #include "section_config.h" 15 #include "diag.h" 16 #include "ameba_soc.h" 17 18 LIBC_ROM_TEXT_SECTION _stratoi(const char * s)19_LONG_CALL_ int _stratoi(const char * s) 20 { 21 22 int num=0,flag=0; 23 u32 i; 24 for(i=0;i<=_strlen(s);i++) 25 { 26 if(s[i] >= '0' && s[i] <= '9') 27 num = num * 10 + s[i] -'0'; 28 else if(s[0] == '-' && i==0) 29 flag =1; 30 else 31 break; 32 } 33 34 if(flag == 1) 35 num = num * -1; 36 37 return(num); 38 39 } 40 41