CI130X SDK API手册  2.2.0
本手册用于描述CI130X SDK各个组件和驱动API
romlib_runtime.h
浏览该文件的文档.
1 #ifndef ROMLIB_RUNTIME_H
2 #define ROMLIB_RUNTIME_H
3 
4 #include <stdlib.h>
5 #include <string.h>
6 #include <math.h>
7 #include <stdio.h>
8 
9 typedef void *HMP3Decoder;
10 
11 typedef void *MP3SaveLastInfo;
12 
13 typedef struct _MP3FrameInfo {
14  int bitrate;
15  int nChans;
16  int samprate;
19  int layer;
20  int version;
21 } MP3FrameInfo;
22 
23 typedef enum {
24  MPEG1 = 0,
25  MPEG2 = 1,
26  MPEG25 = 2
27 } MPEGVersion;
28 
29 enum {
43 
44  ERR_UNKNOWN = -9999
45 };
46 
47 typedef struct
48 {
49  uint16_t fftLen;
50  const float *pTwiddle;
51  const float *pTwiddle2;
52  const uint16_t *pBitRevTable;
53  uint16_t bitRevLength;
55 
56 typedef struct
57 {
59  uint16_t fftLenRFFT;
60  const float * pTwiddleRFFT;
61  const float * pTwiddleRFFT2;
63 
64 typedef struct romruntime_func_s {
66  uint32_t verison;
67  uint32_t reserved;
68  int (*init_lib_romruntime_p)(void);
69  struct mp3func_s {
70  void (*MP3Lib_Set_Func_p)(void* f1, void* f2,void* f3,void* f4,void* f5);
75  int (*MP3FindSyncWord_p)(unsigned char *buf, int nBytes);
76  int (*MP3Decode_p)(HMP3Decoder hMP3Decoder, unsigned char **inbuf, int *bytesLeft, short *outbuf, int useSize);
78  void (*MP3FreeDecoder_p)(HMP3Decoder hMP3Decoder);
79  }mp3func;
80  struct fftfunc_s {
81  void (*riscv_rfft_fast_f32_p)(riscv_rfft_fast_instance_f32 * S, float * p,float * pOut,uint8_t ifftFlag);
83  struct newlibcfunc_s {
84  void (*NEWLib_Set_Func_p)(void* f1,void* f2,void* f3);
85  int (*memcmp_p)(const void *, const void *, size_t);
86  void * (*memcpy_p)(void *__restrict, const void *__restrict, size_t);
87  void * (*memmove_p)(void *, const void *, size_t);
88  void * (*memset_p)(void *, int, size_t);
89  char * (*strcat_p)(char *__restrict, const char *__restrict);
90  int (*strcmp_p)(const char *, const char *);
91  char * (*strcpy_p)(char *__restrict, const char *__restrict);
92  size_t (*strlen_p)(const char *);
93  char * (*strncat_p)(char *__restrict, const char *__restrict, size_t);
94  int (*strncmp_p)(const char *, const char *, size_t);
95  char * (*strncpy_p)(char *__restrict, const char *__restrict, size_t);
96  char * (*strstr_p)(const char *, const char *);
97  char * (*stpcpy_p)(char *__restrict, const char *__restrict);
98  char * (*stpncpy_p)(char *__restrict, const char *__restrict, size_t);
99  size_t (*strnlen_p)(const char *, size_t);
100  unsigned long (*strtoul_p)(const char *__restrict __n, char **__restrict __end_PTR, int __base);
101  long (*atol_p)(const char *__nptr);
102  void (*qsort_p)(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar);
103  void * (*malloc_p)(size_t __size);
104  void (*free_p)(void *);
105  int (*vsnprintf_p)(char *__restrict, size_t, const char *__restrict, __VALIST);
106  int (*sprintf_p) (char *__restrict, const char *__restrict, ...);
107  int (*sscanf_p)(const char *__restrict, const char *__restrict, ...);
108  int (*abs_p)(int);
109  int (*isnan_p)(double);
110  int (*isinf_p)(double);
111  float (*cosf_p)(float);
112  float (*sinf_p)(float);
113  float (*tanf_p)(float);
114  float (*expf_p)(float);
115  float (*sqrtf_p)(float);
116  float (*fabsf_p)(float);
117  float (*logf_p)(float);
118  float (*log10f_p)(float);
119  }newlibcfunc;
121 
122 #define MASK_ROM_BOOT_CODE_ADDR (0x1F000000)
123 #define MASK_ROM_CORE_MAGIC_NUM_ADDR (0x1F000000+0x1C)
124 #define MASK_ROM_WINDOW_ADDR (0x1F000000+79*1024) // sin窗函数
125 #define MASK_ROM_FFT_BIT_ADDR (0x1F000000+8*1024) // 512fft的表1
126 #define MASK_ROM_FFT_COEF_R_ADDR (MASK_ROM_FFT_BIT_ADDR + sizeof(short)*440) // 512fft的表2
127 #define MASK_ROM_FFT_COEF_ADDR (MASK_ROM_FFT_COEF_R_ADDR + sizeof(float)*512) // 512fft的表3
128 #define MASK_ROM_MEL_SCALE_ADDR (MASK_ROM_FFT_COEF_ADDR + sizeof(float)*512) // mel需要的表1
129 #define MASK_ROM_MEL_OFFSET_ADDR (MASK_ROM_MEL_SCALE_ADDR + sizeof(float)*512) // mel需要的表2
130 #define MASK_ROM_ASR_WINDOW_ADDR (MASK_ROM_MEL_OFFSET_ADDR + sizeof(short)*(60)) // fe 需要的窗函数
131 #define MASK_ROM_PCM_TABLE_ADDR (MASK_ROM_ASR_WINDOW_ADDR + sizeof(short)*(400)) // ADPCM需要用的表
132 #define MASK_ROM_LIB_RUNTIME_ADDR (0x1F000000+16*1024)
133 
134 #define MASK_ROM_LIB_FUNC ((romruntime_func_tab_t* )MASK_ROM_LIB_RUNTIME_ADDR)
135 
136 
137 
138 #endif /*ROMLIB_RUNTIME_H*/
int(* memcmp_p)(const void *, const void *, size_t)
Definition: romlib_runtime.h:85
float(* logf_p)(float)
Definition: romlib_runtime.h:117
void(* qsort_p)(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar)
Definition: romlib_runtime.h:102
int(* strncmp_p)(const char *, const char *, size_t)
Definition: romlib_runtime.h:94
void(* MP3FreeDecoder_p)(HMP3Decoder hMP3Decoder)
Definition: romlib_runtime.h:78
int(* riscv_rfft_fast_init_f32_p)(riscv_rfft_fast_instance_f32 *S, unsigned int fft_len)
Definition: romlib_runtime.h:82
Definition: romlib_runtime.h:47
size_t(* strnlen_p)(const char *, size_t)
Definition: romlib_runtime.h:99
int samprate
Definition: romlib_runtime.h:16
const float * pTwiddleRFFT
Definition: romlib_runtime.h:60
float(* log10f_p)(float)
Definition: romlib_runtime.h:118
float(* tanf_p)(float)
Definition: romlib_runtime.h:113
Definition: romlib_runtime.h:33
void * MP3SaveLastInfo
Definition: romlib_runtime.h:11
Definition: romlib_runtime.h:24
riscv_cfft_instance_f32 Sint
Definition: romlib_runtime.h:58
int(* init_lib_romruntime_p)(void)
Definition: romlib_runtime.h:68
Definition: romlib_runtime.h:41
struct romruntime_func_s::fftfunc_s fftfunc
Definition: romlib_runtime.h:31
Definition: romlib_runtime.h:80
int outputSamps
Definition: romlib_runtime.h:18
Definition: romlib_runtime.h:56
Definition: romlib_runtime.h:36
float(* expf_p)(float)
Definition: romlib_runtime.h:114
int layer
Definition: romlib_runtime.h:19
int bitrate
Definition: romlib_runtime.h:14
uint16_t fftLenRFFT
Definition: romlib_runtime.h:59
Definition: romlib_runtime.h:32
int(* abs_p)(int)
Definition: romlib_runtime.h:108
Definition: romlib_runtime.h:38
float(* cosf_p)(float)
Definition: romlib_runtime.h:111
float(* fabsf_p)(float)
Definition: romlib_runtime.h:116
void(* riscv_rfft_fast_f32_p)(riscv_rfft_fast_instance_f32 *S, float *p, float *pOut, uint8_t ifftFlag)
Definition: romlib_runtime.h:81
Definition: romlib_runtime.h:42
Definition: romlib_runtime.h:44
struct _MP3FrameInfo MP3FrameInfo
Definition: romlib_runtime.h:35
long(* atol_p)(const char *__nptr)
Definition: romlib_runtime.h:101
Definition: romlib_runtime.h:40
int(* vsnprintf_p)(char *__restrict, size_t, const char *__restrict, __VALIST)
Definition: romlib_runtime.h:105
Definition: romlib_runtime.h:37
Definition: romlib_runtime.h:34
int(* isnan_p)(double)
Definition: romlib_runtime.h:109
float(* sinf_p)(float)
Definition: romlib_runtime.h:112
HMP3Decoder(* MP3InitDecoder_p)(void)
Definition: romlib_runtime.h:71
unsigned long(* strtoul_p)(const char *__restrict __n, char **__restrict __end_PTR, int __base)
Definition: romlib_runtime.h:100
const float * pTwiddleRFFT2
Definition: romlib_runtime.h:61
void(* free_p)(void *)
Definition: romlib_runtime.h:104
int nChans
Definition: romlib_runtime.h:15
Definition: romlib_runtime.h:26
int(* MP3FindSyncWord_p)(unsigned char *buf, int nBytes)
Definition: romlib_runtime.h:75
char ci_lib_romruntime[8]
Definition: romlib_runtime.h:65
float(* sqrtf_p)(float)
Definition: romlib_runtime.h:115
Definition: romlib_runtime.h:39
uint32_t reserved
Definition: romlib_runtime.h:67
uint32_t verison
Definition: romlib_runtime.h:66
size_t(* strlen_p)(const char *)
Definition: romlib_runtime.h:92
Definition: romlib_runtime.h:64
void(* MP3Lib_Set_Func_p)(void *f1, void *f2, void *f3, void *f4, void *f5)
Definition: romlib_runtime.h:70
const float * pTwiddle2
Definition: romlib_runtime.h:51
int(* MP3SaveLastDecodeMainData_p)(HMP3Decoder hMP3Decoder, MP3SaveLastInfo saveInfo)
Definition: romlib_runtime.h:73
Definition: romlib_runtime.h:83
int(* MP3ClearLastDecodeMainData_p)(HMP3Decoder hMP3Decoder)
Definition: romlib_runtime.h:72
int version
Definition: romlib_runtime.h:20
int(* strcmp_p)(const char *, const char *)
Definition: romlib_runtime.h:90
int(* sscanf_p)(const char *__restrict, const char *__restrict,...)
Definition: romlib_runtime.h:107
MPEGVersion
Definition: romlib_runtime.h:23
const float * pTwiddle
Definition: romlib_runtime.h:50
uint16_t bitRevLength
Definition: romlib_runtime.h:53
static MP3FrameInfo mp3FrameInfo
Definition: audio_play_decoder.c:29
Definition: romlib_runtime.h:69
void(* NEWLib_Set_Func_p)(void *f1, void *f2, void *f3)
Definition: romlib_runtime.h:84
Definition: romlib_runtime.h:25
int(* sprintf_p)(char *__restrict, const char *__restrict,...)
Definition: romlib_runtime.h:106
void(* MP3GetLastFrameInfo_p)(HMP3Decoder hMP3Decoder, MP3FrameInfo *mp3FrameInfo)
Definition: romlib_runtime.h:77
int(* MP3Decode_p)(HMP3Decoder hMP3Decoder, unsigned char **inbuf, int *bytesLeft, short *outbuf, int useSize)
Definition: romlib_runtime.h:76
struct romruntime_func_s::mp3func_s mp3func
uint16_t fftLen
Definition: romlib_runtime.h:49
void * HMP3Decoder
Definition: romlib_runtime.h:9
int(* isinf_p)(double)
Definition: romlib_runtime.h:110
struct romruntime_func_s romruntime_func_tab_t
struct romruntime_func_s::newlibcfunc_s newlibcfunc
int bitsPerSample
Definition: romlib_runtime.h:17
Definition: romlib_runtime.h:13
const uint16_t * pBitRevTable
Definition: romlib_runtime.h:52
Definition: romlib_runtime.h:30
int(* MP3LoadLastDecodeMainData_p)(HMP3Decoder hMP3Decoder, MP3SaveLastInfo saveInfo)
Definition: romlib_runtime.h:74