• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include <wchar.h>
17 #include <sys/types.h>
18 #include <sys/stat.h>
19 #include <stdarg.h>
20 #include "duet_cm4.h"
21 #include "printf_uart.h"
22 
23 #define DEC_BASE 10
24 #define ITOA_BASE 3
25 
itoa(char * p,unsigned x)26 char *itoa(char *p, unsigned x)
27 {
28     unsigned tmp_x = x;
29     char *tmp_p = p;
30     tmp_p += ITOA_BASE * sizeof(int);
31     *--tmp_p = 0;
32     do {
33         *--tmp_p = '0' + tmp_x % DEC_BASE;
34         tmp_x /= DEC_BASE;
35     } while (tmp_x);
36     return tmp_p;
37 }
38 
__locale_ctype_ptr(void)39 const char *__locale_ctype_ptr (void)
40 {
41     return "1.0.0-LiteOS_M";
42 }
43 
sscanf(const char * __restrict __s,const char * __restrict __format,...)44 int sscanf(const char *__restrict __s, const char *__restrict __format, ...)
45 {
46     va_list args;
47     int i;
48 
49     va_start(args, __format);
50     i = sys_vsscanf(__s, __format, args);
51     va_end(args);
52 
53     return i;
54 }
55