📄 ftmcp100.h
字号:
#define SCODE (0x10068 + pCodec->pCoreBaseAddr) #define VLASTWORD (0x1006c + pCodec->pCoreBaseAddr) #define VLDSTS (0x10074 + pCodec->pCoreBaseAddr) #define ABADR (0x10078 + pCodec->pCoreBaseAddr) #define READ_MCCTL(v) v=*(volatile unsigned long*)MCCTL; #define READ_QAR(v) v=*(volatile unsigned long*)QAR; #define READ_VADR(v) v=*(volatile unsigned long*)VADR; #define READ_BADR(v) v=*(volatile unsigned long*)BADR; #define READ_VOP0(v) v=*(volatile unsigned long*)VOP0; #define READ_CPSTS(v) v=*(volatile unsigned long*)CPSTS; #define READ_BALR(v) v=*(volatile unsigned long*)BALR; #define READ_VLDCTL(v) v=*(volatile unsigned long*)VLDCTL; #define READ_VLASTWORD(v) v=*(volatile unsigned long*)VLASTWORD; #define READ_VLDSTS(v) v=*(volatile unsigned long*)VLDSTS; //ABF clean #define READ_ABADR(v) v=*(volatile unsigned long*)ABADR; #define SET_MCUBR(v) *(volatile unsigned long*)MCUBR=v; #define SET_MECADDR(v) *(volatile unsigned long*)MECADDR=v; // mainly used for setting debugging marker during RTL simulation , note that MECADDR[3:0] is ignored #define SET_MCCTL(v) *(volatile unsigned long*)MCCTL=v; #define SET_MCCADDR(v) *(volatile unsigned long*)MCCADDR=v; #define SET_CPSTS(v) *(volatile unsigned long*)CPSTS=v; #define SET_MCUTIR(v) *(volatile unsigned long*)MCUTIR=v; #define SET_PYDCR(v) *(volatile unsigned long*)PYDCR=v; #define SET_PUVDCR(v) *(volatile unsigned long*)PUVDCR=v; #define SET_QAR(v) *(volatile unsigned long*)QAR=v; #define SET_CKR(v) *(volatile unsigned long*)CKR=v; #define SET_VADR(v) *(volatile unsigned long*)VADR=v; #define SET_BADR(v) *(volatile unsigned long*)BADR=v; #define SET_BALR(v) *(volatile unsigned long*)BALR=v; #define SET_MCIADDR(v) *(volatile unsigned long*)MCIADDR=v; #define SET_VLDCTL(v) *(volatile unsigned long*)VLDCTL=v; #define SET_VOP0(v) *(volatile unsigned long*)VOP0=v; #define SET_SCODE(v) *(volatile unsigned long*)SCODE=v; #define SET_ABADR(v) *(volatile unsigned long*)ABADR=v; #elif defined(CORE_VERSION_2) #define MDMA1 ((volatile MDMA *)(0x20400 + pCodec->pCoreBaseAddr)) #ifdef USE_INTERNAL_CPU #define JPG_DEC_INFO (0x8000 + pCodec->pCoreBaseAddr) #endif #define MCUBR (0x20008 + pCodec->pCoreBaseAddr) #define MECADDR (0x20014 + pCodec->pCoreBaseAddr) // mainly used for setting debugging marker during RTL simulation , note that MECADDR[3:0] is ignored #define MCCTL (0x2001c + pCodec->pCoreBaseAddr) #define MCCADDR (0x20020 + pCodec->pCoreBaseAddr) #ifdef USE_INTERNAL_CPU #define MEIADDR (0x20024 + pCodec->pCoreBaseAddr) // mainly used for setting debugging marker during RTL simulation , note that MEIADDR[2:0] is ignored #endif #define CPSTS (0x20028 + pCodec->pCoreBaseAddr) #define MCUTIR (0x2002c + pCodec->pCoreBaseAddr) #define PYDCR (0x20030 + pCodec->pCoreBaseAddr) #define PUVDCR (0x20034 + pCodec->pCoreBaseAddr) #define QAR (0x20038 + pCodec->pCoreBaseAddr) #define CKR (0x2003c + pCodec->pCoreBaseAddr) #define VADR (0x20044 + pCodec->pCoreBaseAddr) #define BADR (0x2004c + pCodec->pCoreBaseAddr) #define BALR (0x20050 + pCodec->pCoreBaseAddr) #define MCIADDR (0x20058 + pCodec->pCoreBaseAddr) #define VLDCTL (0x2005c + pCodec->pCoreBaseAddr) #define VOP0 (0x20060 + pCodec->pCoreBaseAddr) #define SCODE (0x20068 + pCodec->pCoreBaseAddr) #define VLASTWORD (0x2006c + pCodec->pCoreBaseAddr) #define VLDSTS (0x20074 + pCodec->pCoreBaseAddr) #define ABADR (0x20078 + pCodec->pCoreBaseAddr) #ifdef USE_INTERNAL_CPU #define INCTL (0x2007c + pCodec->pCoreBaseAddr) #endif #define READ_MCCTL(v) v=*(volatile unsigned long*)MCCTL; #define READ_QAR(v) v=*(volatile unsigned long*)QAR; #define READ_VADR(v) v=*(volatile unsigned long*)VADR; #define READ_BADR(v) v=*(volatile unsigned long*)BADR; #define READ_VOP0(v) v=*(volatile unsigned long*)VOP0; #define READ_CPSTS(v) v=*(volatile unsigned long*)CPSTS; #define READ_BALR(v) v=*(volatile unsigned long*)BALR; #define READ_VLDCTL(v) v=*(volatile unsigned long*)VLDCTL; #define READ_VLASTWORD(v) v=*(volatile unsigned long*)VLASTWORD; #define READ_VLDSTS(v) v=*(volatile unsigned long*)VLDSTS; //ABF clean #define READ_ABADR(v) v=*(volatile unsigned long*)ABADR; #ifdef USE_INTERNAL_CPU #define READ_INCTL(v) v=*(volatile unsigned long*)INCTL; #endif #define SET_MCUBR(v) *(volatile unsigned long*)MCUBR=v; #define SET_MECADDR(v) *(volatile unsigned long*)MECADDR=v; // mainly used for setting debugging marker during RTL simulation , note that MECADDR[3:0] is ignored #define SET_MCCTL(v) *(volatile unsigned long*)MCCTL=v; #define SET_MCCADDR(v) *(volatile unsigned long*)MCCADDR=v; #ifdef USE_INTERNAL_CPU #define SET_MEIADDR(v) *(volatile unsigned long*)MEIADDR=v; // mainly used for setting debugging marker during RTL simulation , note that MEIADDR[2:0] is ignored #endif #define SET_CPSTS(v) *(volatile unsigned long*)CPSTS=v; #define SET_MCUTIR(v) *(volatile unsigned long*)MCUTIR=v; #define SET_PYDCR(v) *(volatile unsigned long*)PYDCR=v; #define SET_PUVDCR(v) *(volatile unsigned long*)PUVDCR=v; #define SET_QAR(v) *(volatile unsigned long*)QAR=v; #define SET_CKR(v) *(volatile unsigned long*)CKR=v; #define SET_VADR(v) *(volatile unsigned long*)VADR=v; #define SET_BADR(v) *(volatile unsigned long*)BADR=v; #define SET_BALR(v) *(volatile unsigned long*)BALR=v; #define SET_MCIADDR(v) *(volatile unsigned long*)MCIADDR=v; #define SET_VLDCTL(v) *(volatile unsigned long*)VLDCTL=v; #define SET_VOP0(v) *(volatile unsigned long*)VOP0=v; #define SET_SCODE(v) *(volatile unsigned long*)SCODE=v; #define SET_ABADR(v) *(volatile unsigned long*)ABADR=v; #ifdef USE_INTERNAL_CPU #define SET_INCTL(v) *(volatile unsigned long*)INCTL=v; #endif #else #error "Please define the hardware core version (either CORE_VERSION_1 or CORE_VERSION_2)" #endif //---------------------------------------------------------------------------/* read n bits from bitstream */static unsigned int __inline BitstreamGetBits(j_decompress_ptr cinfo,unsigned int bitlen){ unsigned int v; FTMCP100_CODEC *pCodec=(FTMCP100_CODEC *)cinfo->pCodec; READ_BADR(v) SET_BALR(bitlen) return (v >> (32-bitlen));}EXTERN(void) ftmcp100_set_mcu_dma_params JPP((j_decompress_ptr cinfo));EXTERN(void) ftmcp100_set_mcu_dma_noninterleaved_params JPP((j_decompress_ptr cinfo));EXTERN(void) ftmcp100_dump_yuv JPP((j_decompress_ptr cinfo));EXTERN(void) generate_dma_chain_table JPP((j_decompress_ptr cinfo,unsigned int MCU_col_num,int buf_descriptor));EXTERN(void) generate_dma_noninterleaved_chain_table JPP((j_decompress_ptr cinfo,unsigned int MCU_col_num,unsigned int MCU_row_num,int buf_descriptor));//---------------------------------------------------------------------------//---------------------------------------------------------------------------//#ifdef HUFFTBL_BUILD// copied from GZIP source codes/* Huffman code lookup table entry--this entry is four bytes for machines that have 16-bit pointers (e.g. PC's in the small or medium model). Valid extra bits are 0..13. e == 15 is EOB (end of block), e == 16 means that v is a literal, 16 < e < 32 means that v is a pointer to the next table, which codes e - 16 bits, and lastly e == 99 indicates an unused code. If a code with e == 99 is looked up, this implies an error in the data. */struct huft { //unsigned char e; /* number of extra bits or operation */ //unsigned char b; /* number of bits in this code or subcode */ //union { // unsigned short n; /* literal, length base, or distance base */ // struct huft *t; /* pointer to next level of table */ //} v; // leo's fields struct huft *nextpt; /* pointer to next level of table */ unsigned int tblsize; /* the size of table, indicating the number of entry */ unsigned int tbl:1; /* indicate it's table entry or data entry */ unsigned int valid:1; /* indicate it is empty entry or valid data entry */ unsigned int codelen:3; /* indicate the code length of codeword that current entry represents */ union { unsigned int value:8; /* indicate the value if it is a data entry */ unsigned int offset:10; /* indicate the offset of next table */ } data;};/* If BMAX needs to be larger than 16, then h and x[] should be ulg. */#define BMAX 16 /* maximum bit length of any code (16 for explode) */#define N_MAX 256 /* maximum number of codes in any set *///unsigned *b; /* code lengths in bits (all assumed <= BMAX) *///unsigned n; /* number of codes (assumed <= N_MAX) *///unsigned s; /* number of simple-valued codes (0..s-1) *///unsigned *v; /* added by Leo, the array of huffman value *///unsigned *ct; /* added by Leo, the table of huffman codeword *///ush *d; /* list of base values for non-simple codes *///ush *e; /* list of extra bits for non-simple codes *///struct huft **t; /* result: starting table *///int *m; /* maximum lookup bits, returns actual */EXTERN(int) huft_build(j_decompress_ptr cinfo,unsigned *b,unsigned n,unsigned s,unsigned int *v,unsigned int *ct,unsigned short *d, unsigned short *e, struct huft **t, int *m);//EXTERN(int) huft_free(struct huft *t); /* table to free *//* * To transform the original Huffman table in JPEG header to a Huffman Multi-Level Table * for hardware VLD engine and store the transformed Huffman Multi-Level Table to * FTMCP100 Media Coprocessor's local memory or to a local file. * And we also set the first lookahead bit length for each huffman table (DC0,DC1,AC0,AC1) * by using VOP0 register in FTMC100 Media Coprocessor. * */EXTERN(void) ftmcp100_store_multilevel_huffman_table JPP((j_decompress_ptr cinfo));extern FILE *huffman_table_file;//#endif#ifndef USE_INTERNAL_CPU EXTERN(int) decompress_noninterleaved_data JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));#endifEXTERN(boolean) processing_restart_marker JPP((j_decompress_ptr cinfo));EXTERN(void) decrement_restart_interval JPP((j_decompress_ptr cinfo));EXTERN(int) check_restart_marker JPP((j_decompress_ptr cinfo));EXTERN(void) update_next_restart_number JPP((j_decompress_ptr cinfo));EXTERN(int) get_restart_action JPP((j_decompress_ptr cinfo));EXTERN(void) reset_previous_DC JPP((j_decompress_ptr cinfo));#ifdef USE_INTERNAL_CPU #ifdef RTL_PLATFORM // note that only MEIADDR[10:3] is valid fields #define ENTER_JPEG_READ_SCANLINES SET_MEIADDR(0x000) #define EXIT_JPEG_READ_SCANLINES SET_MEIADDR(0x001<<3) #define ENTER_PROCESS_DATA_SIMPLE_MAIN SET_MEIADDR(0x002<<3) #define EXIT_PROCESS_DATA_SIMPLE_MAIN SET_MEIADDR(0x003<<3) #define ENTER_PROCESS_DATA_CONTEXT_MAIN SET_MEIADDR(0x004<<3) #define EXIT_PROCESS_DATA_CONTEXT_MAIN SET_MEIADDR(0x005<<3) #define ENTER_DECOMPRESS_ONEPASS SET_MEIADDR(0x006<<3) #define EXIT_DECOMPRESS_ONEPASS SET_MEIADDR(0x007<<3) #define ENTER_DECOMPRESS_DATA SET_MEIADDR(0x008<<3) #define EXIT_DECOMPRESS_DATA SET_MEIADDR(0x009<<3) #define POLL_EXTERNAL_CPU_RESPONSE_START SET_MEIADDR(0x00a<<3) #define POLL_EXTERNAL_CPU_RESPONSE_END SET_MEIADDR(0x00b<<3) #else #define ENTER_JPEG_READ_SCANLINES #define EXIT_JPEG_READ_SCANLINES #define ENTER_PROCESS_DATA_SIMPLE_MAIN #define EXIT_PROCESS_DATA_SIMPLE_MAIN #define ENTER_PROCESS_DATA_CONTEXT_MAIN #define EXIT_PROCESS_DATA_CONTEXT_MAIN #define ENTER_DECOMPRESS_ONEPASS #define EXIT_DECOMPRESS_ONEPASS #define ENTER_DECOMPRESS_DATA #define EXIT_DECOMPRESS_DATA #define POLL_EXTERNAL_CPU_RESPONSE_START #define POLL_EXTERNAL_CPU_RESPONSE_END #endif#else // else of #ifdef USE_INTERNAL_CPU #ifdef RTL_PLATFORM // note that only MECADDR[10:4] is valid fields #define POLL_DMA_DONE_START_MARKER SET_MECADDR(0x0000) #define POLL_DMA_DONE_END_MARKER SET_MECADDR(0x0010) #define POLL_MC_DONE_START_MARKER SET_MECADDR(0x0020) #define POLL_MC_DONE_END_MARKER SET_MECADDR(0x0030) #define POLL_VLD_DONE_START_MARKER SET_MECADDR(0x0040) #define POLL_VLD_DONE_END_MARKER SET_MECADDR(0x0050) #else #define POLL_DMA_DONE_START_MARKER #define POLL_DMA_DONE_END_MARKER #define POLL_MC_DONE_START_MARKER #define POLL_MC_DONE_END_MARKER #define POLL_VLD_DONE_START_MARKER #define POLL_VLD_DONE_END_MARKER #endif#endif // end of #ifdef USE_INTERNAL_CPU#ifdef LINUX#define FA526_DrainWriteBuffer()#define FA526_CleanInvalidateDCacheAll()#elsestatic __inline void FA526_DrainWriteBuffer(void){ unsigned int tmp=0; __asm { MCR p15,0,tmp,c7,c10,4 }}static __inline void FA526_CleanInvalidateDCacheAll(){ unsigned int tmp=0; __asm { MCR p15,0,tmp,c7,c14,0 }}#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -