1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef __EXPORT_FN_ROM_H__ 5 #define __EXPORT_FN_ROM_H__ 6 7 #ifdef __cplusplus 8 extern "C" { 9 #endif 10 11 #include "stdint.h" 12 #include "stdarg.h" 13 14 typedef void (*__BOOT_FROM_FLASH_REENT)(void); 15 typedef unsigned long (*__CRC32)(unsigned long crc, const unsigned char *buf, unsigned int len); 16 typedef int (*__VERIFY_SIGNATURE)(const unsigned char *key, const unsigned char *sig, const unsigned char *data, unsigned int len); 17 typedef const uint8_t* (*__SHA256_HASH)(const void* data, uint32_t len, uint8_t* digest); 18 typedef void (*__SHA256_INIT)(void* ctx); 19 typedef void (*__SHA256_UPDATE)(void* ctx, const void* data, uint32_t len); 20 typedef const uint8_t* (*__SHA256_FINAL)(void* ctx); 21 22 typedef char * (*__STRSEP)(char **stringp, const char *delim); 23 typedef char * (*__STRTOK_R)(char *,const char *, char **); 24 typedef char * (*__STRCPY)(char *,const char *); 25 typedef char * (*__STRNCPY)(char *,const char *, size_t); 26 typedef char * (*__STRCAT)(char *, const char *); 27 typedef char * (*__STRNCAT)(char *, const char *,size_t); 28 typedef int (*__STRCMP)(const char *,const char *); 29 typedef int (*__STRNCMP)(const char *,const char *,size_t); 30 typedef int (*__STRNICMP)(const char *, const char *, size_t); 31 typedef char * (*__STRCHR)(const char *,int); 32 typedef char * (*__STRRCHR)(const char *,int); 33 typedef char * (*__STRSTR)(const char *,const char *); 34 typedef size_t (*__STRLEN)(const char *); 35 typedef size_t (*__STRNLEN)(const char *,size_t); 36 typedef void * (*__MEMSET)(void *,int,size_t); 37 typedef void * (*__MEMCPY)(void *,const void *,size_t); 38 typedef void * (*__MEMMOVE)(void *,const void *,size_t); 39 typedef void * (*__MEMSCAN)(void *,int,size_t); 40 typedef int (*__MEMCMP)(const void *,const void *,size_t); 41 typedef void * (*__MEMCHR)(const void *,int,size_t); 42 typedef size_t (*__STRCSPN)(const char *s, const char *reject); 43 typedef size_t (*__STRSPN)(const char *s1, const char *s2); 44 typedef int (*__SPRINTF)(char * buf, const char *fmt, ...); 45 typedef int (*__SNPRINTF)(char * buf, size_t len, const char *fmt, ...); 46 typedef int (*__SSCANF)(const char * buf, const char * fmt, ...); 47 typedef int (*__VSPRINTF)(char *buf, const char *fmt, va_list ap); 48 typedef int (*__VSNPRINTF)(char *buf, size_t size, const char *fmt, va_list ap); 49 typedef int (*__VSSCANF)(const char *fp, const char *fmt0, va_list ap); 50 typedef int (*__ATOI)(const char *s); 51 typedef long (*__STRTOL)(const char *nptr, char **endptr, int base); 52 typedef unsigned long (*__STRTOUL)(const char *nptr, char **endptr, int base); 53 typedef void (*__QSORT)(void *baseP, size_t nElem, size_t width, int (*compar)(const void *, const void *)); 54 typedef void * (*__BSEARCH)(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); 55 56 struct EXPORT_FN_ROM_T { 57 __BOOT_FROM_FLASH_REENT boot_from_flash_reent; 58 __CRC32 crc32; 59 __VERIFY_SIGNATURE verify_signature; 60 __SHA256_HASH SHA256_hash; 61 __SHA256_INIT SHA256_init; 62 __SHA256_UPDATE SHA256_update; 63 __SHA256_FINAL SHA256_final; 64 65 __STRSEP strsep; 66 __STRTOK_R strtok_r; 67 __STRNCAT strncat; 68 __STRNICMP strnicmp; 69 __STRSTR strstr; 70 __MEMSET memset; 71 __MEMCPY memcpy; 72 __MEMMOVE memmove; 73 __ATOI atoi; 74 __STRTOL strtol; 75 __STRTOUL strtoul; 76 __QSORT qsort; 77 __BSEARCH bsearch; 78 __SPRINTF sprintf; 79 __SNPRINTF snprintf; 80 __SSCANF sscanf; 81 __VSPRINTF vsprintf; 82 __VSNPRINTF vsnprintf; 83 __VSSCANF vsscanf; 84 85 #ifdef CHIP_HAS_AUDIO_CONST_ROM 86 const unsigned int *audio_const; 87 #endif 88 }; 89 90 extern struct EXPORT_FN_ROM_T __export_fn_rom; 91 92 #ifdef __cplusplus 93 } 94 #endif 95 96 #endif 97 98