📄 vs1003b.i
字号:
#line 32 "C:\\Keil\\ARM\\RV31\\INC\\ctype.h"
#line 46 "C:\\Keil\\ARM\\RV31\\INC\\ctype.h"
#line 56 "C:\\Keil\\ARM\\RV31\\INC\\ctype.h"
#line 78 "C:\\Keil\\ARM\\RV31\\INC\\ctype.h"
#line 130 "C:\\Keil\\ARM\\RV31\\INC\\ctype.h"
extern __declspec(__nothrow) __pure unsigned char **__rt_ctype_table(void);
extern int (isalnum)(int );
extern int (isalpha)(int );
extern int (iscntrl)(int );
extern int (isdigit)(int );
extern int (isblank)(int );
extern int (isgraph)(int );
extern int (islower)(int );
extern int (isprint)(int );
extern int (ispunct)(int );
extern int (isspace)(int );
extern int (isupper)(int );
__inline int __isxdigit_helper(int __t) { return (__t ^ (__t << 2)); }
extern int (isxdigit)(int );
extern int tolower(int );
extern int toupper(int );
#line 269 "C:\\Keil\\ARM\\RV31\\INC\\ctype.h"
#line 9 "global.h"
#line 1 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
#line 45 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
typedef unsigned int size_t;
typedef unsigned short wchar_t;
#line 74 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
typedef struct div_t { int quot, rem; } div_t;
typedef struct ldiv_t { long int quot, rem; } ldiv_t;
typedef struct lldiv_t { __int64 quot, rem; } lldiv_t;
#line 95 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
#line 114 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
extern __declspec(__nothrow) int __aeabi_MB_CUR_MAX(void);
extern __declspec(__nothrow) double atof(const char * );
extern __declspec(__nothrow) int atoi(const char * );
extern __declspec(__nothrow) long int atol(const char * );
extern __declspec(__nothrow) __int64 atoll(const char * );
extern __declspec(__nothrow) double strtod(const char * __restrict , char ** __restrict );
extern __declspec(__nothrow) float strtof(const char * __restrict , char ** __restrict );
extern __declspec(__nothrow) long double strtold(const char * __restrict , char ** __restrict );
extern __declspec(__nothrow) long int strtol(const char * __restrict ,
char ** __restrict , int );
extern __declspec(__nothrow) unsigned long int strtoul(const char * __restrict ,
char ** __restrict , int );
extern __declspec(__nothrow) __int64 strtoll(const char * __restrict ,
char ** __restrict , int );
extern __declspec(__nothrow) unsigned __int64 strtoull(const char * __restrict ,
char ** __restrict , int );
extern __declspec(__nothrow) int rand(void);
extern __declspec(__nothrow) void srand(unsigned int );
extern __declspec(__nothrow) void *calloc(size_t , size_t );
extern __declspec(__nothrow) void free(void * );
extern __declspec(__nothrow) void *malloc(size_t );
extern __declspec(__nothrow) void *realloc(void * , size_t );
typedef int (*__heapprt)(void *, char const *, ...);
extern __declspec(__nothrow) void __heapstats(int (* )(void * ,
char const * , ...),
void * );
extern __declspec(__nothrow) int __heapvalid(int (* )(void * ,
char const * , ...),
void * , int );
extern __declspec(__nothrow) __declspec(__noreturn) void abort(void);
extern __declspec(__nothrow) int atexit(void (* )(void));
#line 379 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
extern __declspec(__nothrow) __declspec(__noreturn) void exit(int );
extern __declspec(__nothrow) __declspec(__noreturn) void _Exit(int );
extern __declspec(__nothrow) char *getenv(const char * );
extern __declspec(__nothrow) int system(const char * );
extern void *bsearch(const void * , const void * ,
size_t , size_t ,
int (* )(const void *, const void *));
#line 463 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
extern void qsort(void * , size_t , size_t ,
int (* )(const void *, const void *));
#line 489 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
extern __declspec(__nothrow) __pure int abs(int );
extern __declspec(__nothrow) __pure div_t div(int , int );
extern __declspec(__nothrow) __pure long int labs(long int );
extern __declspec(__nothrow) __pure ldiv_t ldiv(long int , long int );
extern __declspec(__nothrow) __pure __int64 llabs(__int64 );
extern __declspec(__nothrow) __pure lldiv_t lldiv(__int64 , __int64 );
#line 570 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
typedef struct __sdiv32by16 { int quot, rem; } __sdiv32by16;
typedef struct __udiv32by16 { unsigned int quot, rem; } __udiv32by16;
typedef struct __sdiv64by32 { int rem, quot; } __sdiv64by32;
__value_in_regs extern __declspec(__nothrow) __pure __sdiv32by16 __rt_sdiv32by16(
int ,
short int );
__value_in_regs extern __declspec(__nothrow) __pure __udiv32by16 __rt_udiv32by16(
unsigned int ,
unsigned short );
__value_in_regs extern __declspec(__nothrow) __pure __sdiv64by32 __rt_sdiv64by32(
int , unsigned int ,
int );
extern __declspec(__nothrow) unsigned int __fp_status(unsigned int , unsigned int );
extern __declspec(__nothrow) int mblen(const char * , size_t );
extern __declspec(__nothrow) int mbtowc(wchar_t * __restrict ,
const char * __restrict , size_t );
extern __declspec(__nothrow) int wctomb(char * , wchar_t );
extern __declspec(__nothrow) size_t mbstowcs(wchar_t * __restrict ,
const char * __restrict , size_t );
extern __declspec(__nothrow) size_t wcstombs(char * __restrict ,
const wchar_t * __restrict , size_t );
extern __declspec(__nothrow) void __use_realtime_heap(void);
extern __declspec(__nothrow) void __use_realtime_division(void);
extern __declspec(__nothrow) void __use_two_region_memory(void);
extern __declspec(__nothrow) void __use_no_heap(void);
extern __declspec(__nothrow) void __use_no_heap_region(void);
extern __declspec(__nothrow) char const *__C_library_version_string(void);
extern __declspec(__nothrow) int __C_library_version_number(void);
#line 807 "C:\\Keil\\ARM\\RV31\\INC\\stdlib.h"
#line 10 "global.h"
#line 1 "C:\\Keil\\ARM\\RV31\\INC\\setjmp.h"
#line 38 "C:\\Keil\\ARM\\RV31\\INC\\setjmp.h"
typedef __int64 jmp_buf[48];
extern const int __aeabi_JMP_BUF_SIZE;
extern __declspec(__nothrow) int setjmp(jmp_buf );
extern __declspec(__nothrow) __declspec(__noreturn) void longjmp(jmp_buf , int );
#line 101 "C:\\Keil\\ARM\\RV31\\INC\\setjmp.h"
#line 11 "global.h"
#line 1 "C:\\Keil\\ARM\\RV31\\INC\\rt_misc.h"
extern void _getenv_init(void);
extern void _clock_init(void);
extern void *__user_libspace(void);
struct __argc_argv {
int argc;
char **argv;
int r2, r3;
};
extern __value_in_regs struct __argc_argv
__rt_lib_init(unsigned , unsigned );
__value_in_regs struct __argc_argv __ARM_get_argv(void * );
extern void __rt_lib_shutdown(void);
extern void __rt_exit(int );
struct __initial_stackheap {
unsigned heap_base;
unsigned stack_base;
unsigned heap_limit;
unsigned stack_limit;
};
extern __value_in_regs struct __initial_stackheap
__user_initial_stackheap(unsigned , unsigned ,
unsigned , unsigned );
struct __heap_extent {
unsigned base, range;
};
extern __value_in_regs struct __heap_extent
__user_heap_extent(unsigned , unsigned );
struct __stack_slop {
unsigned always, cleanup;
};
extern __value_in_regs struct __stack_slop
__user_stack_slop(unsigned , unsigned );
extern unsigned __user_heap_extend(int ,
void ** ,
unsigned );
int __raise(int , int );
int __default_signal_handler(int , int );
void __rt_raise(int , int );
#line 12 "global.h"
#line 37 "global.h"
extern unsigned short get16(unsigned char * addr);
extern unsigned short get16_big(unsigned char * addr);
extern unsigned short get16_little(unsigned char * addr);
extern unsigned int get32(unsigned char * addr);
extern unsigned int get32_big(unsigned char * addr);
extern unsigned int get32_little(unsigned char * addr);
extern void put16(unsigned char * addr, unsigned short val);
extern void put16_big(unsigned char * addr, unsigned short val);
extern void put16_little(unsigned char * addr, unsigned short val);
extern void put32(unsigned char * addr, unsigned int val);
extern void put32_big(unsigned char * addr, unsigned int val);
extern void put32_little(unsigned char * addr, unsigned int val);
extern unsigned short swap16(unsigned short val);
extern unsigned int swap32(unsigned int val);
void dump_memory(unsigned char * addr, unsigned int length);
void soft_delay_ms(unsigned int t);
#line 25 "VS1003B.h"
#line 50 "VS1003B.h"
#line 79 "VS1003B.h"
#line 127 "VS1003B.h"
extern unsigned char VS1003B_Init(void);
extern void VS1003B_SoftReset(void);
extern unsigned short VS1003B_ReadDecodeTime(void);
extern void VS1003B_Fill2048Zero(void);
extern void VS1003B_Write32B(unsigned char * buf);
extern unsigned char VS1003B_NeedData(void);
extern void VS1003B_SetVolume(unsigned short vol);
#line 20 "VS1003B.c"
void VS1003B_SPI_Low(void);
void VS1003B_SPI_High(void);
unsigned char VS1003B_WriteByte(unsigned char CH);
void VS1003B_WriteCMD(unsigned char addr, unsigned short dat);
unsigned short VS1003B_ReadCMD(unsigned char addr);
void VS1003B_SPI_Low(void)
{
(*((volatile unsigned char *) 0xE002000C)) = 100;
(*((volatile unsigned char *) 0xE0020000)) = (0 << 3) |
(1 << 4) |
(1 << 5) |
(0 << 6) |
(0 << 7);
#line 52 "VS1003B.c"
}
void VS1003B_SPI_High(void)
{
(*((volatile unsigned char *) 0xE002000C)) = 6;
(*((volatile unsigned char *) 0xE0020000)) = (0 << 3) |
(1 << 4) |
(1 << 5) |
(0 << 6) |
(0 << 7);
#line 74 "VS1003B.c"
}
unsigned char VS1003B_WriteByte(unsigned char val)
{
(*((volatile unsigned char *) 0xE0020008)) = val;
while(0 == ((*((volatile unsigned char *) 0xE0020004)) & 0x80));
return((*((volatile unsigned char *) 0xE0020008)));
#line 96 "VS1003B.c"
}
unsigned char VS1003B_ReadByte()
{
(*((volatile unsigned char *) 0xE0020008)) = 0xff;
while(0 == ((*((volatile unsigned char *) 0xE0020004)) & 0x80));
return((*((volatile unsigned char *) 0xE0020008)));
#line 118 "VS1003B.c"
}
void VS1003B_WriteCMD(unsigned char addr, unsigned short dat)
{
(*((volatile unsigned long *) 0xE0028014)) |= (0x01 << 24);
(*((volatile unsigned long *) 0xE002800C)) |= (0x01 << 7);;
VS1003B_WriteByte(0x02);
VS1003B_WriteByte(addr);
VS1003B_WriteByte(dat>>8);
VS1003B_WriteByte(dat);
(*((volatile unsigned long *) 0xE0028004)) |= (0x01 << 7);;
}
unsigned short VS1003B_ReadCMD(unsigned char addr)
{
unsigned short temp;
(*((volatile unsigned long *) 0xE0028014)) |= (0x01 << 24);
(*((volatile unsigned long *) 0xE002800C)) |= (0x01 << 7);;
VS1003B_WriteByte(0x03);
VS1003B_WriteByte(addr);
temp = VS1003B_ReadByte();
temp <<= 8;
temp += VS1003B_ReadByte();
(*((volatile unsigned long *) 0xE0028004)) |= (0x01 << 7);;
return temp;
}
void VS1003B_Fill2048Zero()
{
unsigned char i,j;
VS1003B_SPI_High();
for(i=0;i<64;i++)
{
(*((volatile unsigned long *) 0xE002801C)) |= (0x01 << 24);
while(VS1003B_NeedData()==0);
for(j=0;j<32;j++)
{
VS1003B_WriteByte(0x00);
}
(*((volatile unsigned long *) 0xE0028014)) |= (0x01 << 24);
}
}
void VS1003B_Write32B(unsigned char * buf)
{
unsigned char n = 32;
VS1003B_SPI_High();
(*((volatile unsigned long *) 0xE002801C)) |= (0x01 << 24);
while(n--)
{
VS1003B_WriteByte(*buf++);
}
(*((volatile unsigned long *) 0xE0028014)) |= (0x01 << 24);
}
unsigned char VS1003B_Init(void)
{
unsigned char retry;
{ (*((volatile unsigned long *) 0xE002C000)) &= ~(0x03 << 14); (*((volatile unsigned long *) 0xE0028008)) |= (0x01 << 7);; (*((volatile unsigned long *) 0xE0028004)) |= (0x01 << 7); (*((volatile unsigned long *) 0xE002C014)) &= ~(0x02 <<4); (*((volatile unsigned long *) 0xE0028018)) |= (0x01 << 24); (*((volatile unsigned long *) 0xE0028014)) |= (0x01 << 24) ; (*((volatile unsigned long *) 0xE002C000)) &= ~(0x03 << 6); (*((volatile unsigned long *) 0xE0028008)) |= (0x01 << 3); (*((volatile unsigned long *) 0xE0028004)) = (0x01 << 3); (*((volatile unsigned long *) 0xE002C014)) &= ~(0x02 <<4); (*((volatile unsigned long *) 0xE0028018)) &= ~(0x01 << 25); (*((volatile unsigned long *) 0xE002C000)) &= ~((0x03 << 8) + (0x03 << 10) + (0x03 << 12)); (*((volatile unsigned long *) 0xE002C000)) |= (0x01 << 8) + (0x01 << 10) + (0x01 << 12); };
#line 208 "VS1003B.c"
VS1003B_SPI_Low();
(*((volatile unsigned long *) 0xE002800C)) = (0x01 << 3);
soft_delay_ms(20);
(*((volatile unsigned long *) 0xE0028004)) = (0x01 << 3);
VS1003B_SPI_Low();
soft_delay_ms(20);
retry=0;
while(VS1003B_ReadCMD(0x03) != 0xe000)
{
VS1003B_WriteCMD(0x03,0xe000);
if(retry++ >10 )return 1;
}
soft_delay_ms(20);
VS1003B_WriteCMD(0x05,0x000a);
retry=0;
while(VS1003B_ReadCMD(0x0b) != 0xfefe)
{
VS1003B_WriteCMD(0x0b,0xfefe);
if(retry++ >10 )return 1;
}
VS1003B_WriteCMD(0x05,0xac45);
retry=0;
while(VS1003B_ReadCMD(0x0b) != 0x2828)
{
VS1003B_WriteCMD(0x0b,0x2828);
if(retry++ >10 )return 1;
}
retry=0;
while(VS1003B_ReadCMD(0x00) != 0x0800)
{
VS1003B_WriteCMD(0x00,0x0800);
if(retry++ >10 )return 1;
}
soft_delay_ms(1);
retry=0;
while(VS1003B_ReadCMD(0x02) != ((8<<12)|(8<<8)|(8<<4)|(8)))
{
VS1003B_WriteCMD(0x02,((8<<12)|(8<<8)|(8<<4)|(8)));
if(retry++ >10 )return 1;
}
soft_delay_ms(20);
VS1003B_SoftReset();
soft_delay_ms(20);
VS1003B_SPI_High();
return 0;
}
void VS1003B_SoftReset()
{
VS1003B_SPI_High();
VS1003B_WriteCMD(0x00,0x0804);
soft_delay_ms(20);
}
unsigned short VS1003B_ReadDecodeTime()
{
VS1003B_SPI_High();
return VS1003B_ReadCMD(0x04);
}
unsigned char VS1003B_NeedData(void)
{
if(((*((volatile unsigned long *) 0xE0028010)) & (0x01 << 25))!=0)return 1;
else return 0;
}
void VS1003B_SetVolume(unsigned short vol)
{
VS1003B_SPI_High();
VS1003B_WriteCMD(0x0b,vol);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -