⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mktable.c

📁 一个不错的硬盘播放器程序,包含VFD显示程序,红外线遥控程序,硬盘读写程序,及解码程序等.
💻 C
📖 第 1 页 / 共 2 页
字号:
    {1, "m2vram2_ucode",(char *)m2vram2_ucode, sizeof(m2vram2_ucode), INT},#endif    {0, "nonpage_ucode", (char *)nonpage_ucode, sizeof(nonpage_ucode), INT},    {0, "two2one_ucode", (char *)two2one_ucode, sizeof(two2one_ucode), INT},    {0, "pal2ntsc_ucode", (char *)pal2ntsc_ucode, sizeof(pal2ntsc_ucode), INT},    {0, "ntsc2pal_ucode", (char *)ntsc2pal_ucode, sizeof(ntsc2pal_ucode), INT},    {0, "ksearch_ucode", (char *)ksearch_ucode, sizeof(ksearch_ucode), INT},    {0, "cdda_ucode", (char *)cdda_ucode, sizeof(cdda_ucode), INT},#ifdef SPATIAL    {0, "spatial_ucode", (char *)spatial_ucode, sizeof(spatial_ucode), INT},#endif#ifdef BF43    {0, "hscale_ucode", (char *)hscale_ucode, sizeof(hscale_ucode), INT},#endif#endif/*************************************************************************** For Musicam only. ***************************************************************************/#ifdef MUSICAM    {1, "Wj",(char *)Wj, sizeof(Wj), INT},    {1, "nbal3B2b", (char *)nbal3B2b, sizeof(nbal3B2b), CHAR},    {1, "nbal3B2d", (char *)nbal3B2d, sizeof(nbal3B2d), CHAR},    {1, "index3B2b", (char *)index3B2b, sizeof(index3B2b), CHAR},    {1, "index3B2d", (char *)index3B2d, sizeof(index3B2d), CHAR},    {1, "look_div3", (char *)look_div3, sizeof(look_div3), CHAR},    {1, "look_div5", (char *)look_div5, sizeof(look_div5), USHORT},#ifdef USE_LOOK_DIV9    {1, "look_div9", (char *)look_div9, sizeof(look_div9), USHORT},#endif    {1, "job_security", (char *)job_security, sizeof(job_security), UCHAR},    {1, "qinfo", (char *)qinfo, sizeof(qinfo), CHAR},    {1, "ctable", (char *)ctable, sizeof(ctable), USHORT},    {1, "bitrate", (char *)bitrate, sizeof(bitrate), SHORT},    {1, "framesize_table", (char *)framesize_table, sizeof(framesize_table),     SHORT},    {1, "jsb_table", (char *)jsb_table, sizeof(jsb_table), INT},    {1, "scf", (char *)scf, sizeof(scf), USHORT},#endif/*************************************************************************** Xport ucode. ***************************************************************************/#if (!(MPEG1 && MKROM))    {0, "uCode_VIDEO_ELM_ONLY",	(char *)uCode_VIDEO_ELM_ONLY, sizeof(uCode_VIDEO_ELM_ONLY), INT},    {0, "pid_VIDEO_ELM_ONLY",	(char *)pid_VIDEO_ELM_ONLY, sizeof(pid_VIDEO_ELM_ONLY), INT},    {0, "uCode_AUDIO_ELM_ONLY",	(char *)uCode_AUDIO_ELM_ONLY, sizeof(uCode_AUDIO_ELM_ONLY), INT},    {0, "pid_AUDIO_ELM_ONLY",	(char *)pid_AUDIO_ELM_ONLY, sizeof(pid_AUDIO_ELM_ONLY), INT},#endif#ifdef MPEG1    {0, "uCode_MPEG1_PS", (char *)uCode_MPEG1_PS, sizeof(uCode_MPEG1_PS), INT},    {0, "pid_MPEG1_PS", (char *)pid_MPEG1_PS, sizeof(pid_MPEG1_PS), INT},#endif#ifdef CD_SERVO    {1, "ABS2TRK",(char *)ABS2TRK, sizeof(ABS2TRK), USHORT},#ifdef C80    {1, "KRAMTBL",(char *)KRAMTBL, sizeof(KRAMTBL), UCHAR},    {1, "AVRGTBL",(char *)AVRGTBL, sizeof(AVRGTBL), INT},#endif    {1, "AITBL",(char *)AITBL, sizeof(AITBL), UCHAR},#endif  /* CD_SERVO */#ifdef MPEG2    {0, "uCode_DVD_SIMPLE",	(char *)uCode_DVD_SIMPLE, sizeof(uCode_DVD_SIMPLE), INT},    {0, "pid_DVD_SIMPLE", (char *)pid_DVD_SIMPLE, sizeof(pid_DVD_SIMPLE), INT},    {0, "uCode_DSS_SIMPLE",	(char *)uCode_DSS_SIMPLE, sizeof(uCode_DSS_SIMPLE), INT},    {0, "pid_DSS_SIMPLE", (char *)pid_DSS_SIMPLE, sizeof(pid_DSS_SIMPLE), INT},#endif    /********************************************************************     * NGAME related data						*     * Since ngame.c is protected, but costomers can optionally not	*     * define -DNGAME, so I would rather not #ifdef these guys; 	*     * otherwise, people may be confused by compilation error.		*     ********************************************************************/    {1, "NGAME_clr_ram", (char *)NGAME_clr_ram, sizeof(NGAME_clr_ram), UCHAR},    {1, "NGAME_reset_vector", (char *)NGAME_reset_vector,        sizeof(NGAME_reset_vector), UCHAR},    /********************************************************************     * 3.0 related data							*     ********************************************************************/#ifdef VCDROM    {1, "fontTbl", (char *)fontTbl, sizeof(fontTbl), UCHAR},    {0, "ucode_30", (char *)ucode_30, sizeof(ucode_30), INT},#endif    /********************************************************************     * Put all the large tables at the end so as many pointers as  	*     * possible can have offset less than 64K (i.e. as few large 	*     * constants as possible to save DRAM space)			*     ********************************************************************/#ifdef OSD_COMPRESS    {0, "osd_code_book",(char*)&code_book, 0, COMPFONTCODE},    {0, "osd_offset_tbl",(char*)&osd_offset_tbl, 0, COMPFONTOFFSET},    {0, "osd_comp_font",(char*)&osd_comp_font, 0, COMPFONTDATA},#else    {1, "osd_font",(char *)&osd_font,sizeof(osd_font00)+sizeof(osd_font01),      FONT},    {1, "osd_cfont",(char *)&osd_cfont,sizeof(osd_cfont00)+sizeof(osd_cfont01),     FONT},#endif#ifdef NOLOGO    {1, "powerupScreen",(char *)NULL, 0, CHAR},	/* No logo */#else    {1, "powerupScreen",(char *)powerupScreen, sizeof(powerupScreen), CHAR},#endif#ifdef CUST4    {1, "cust4Logo",(char *)cust4Logo, sizeof(cust4Logo), ULONG},#endif};/*************************************************************************** End of data section. ***************************************************************************/char *type_def[32] = {    "(int *)", "(short *)", "(char *)", "(long *)", "(unsigned short *)",    "(unsigned char *)", "(unsigned long *)", "(unsigned int *)",    "(filter_set *)", "(char *)", "(unsigned short *)", "(unsigned char *)",    "(unsigned char *)", "(unsigned short *)",};char *stype_def[32] = {    "int *", "short *", "char *", "long *", "unsigned short *",     "unsigned char *", "unsigned long *" , "unsigned int *",    "filter_set *", "char *", "unsigned short *", "unsigned char *",    "unsigned char *", "unsigned short *",};main(){   int i;   unsigned long tablesz = 0;   FILE *fp, *fph;   if ((fp = fopen("const.dat","wb")) == NULL) {	fprintf(stderr, "mpeg2.dat open error!\n");	exit(1);   }   if ((fph = fopen("const.h", "w")) == NULL) {	fprintf(stderr, "mpeg2.dat open error!\n");	exit(1);   }#ifdef FONT18   /* Special larger font */   process_osd(18, 108, 216, (unsigned int *) osd_font00, 	                     (unsigned int *) osd_cfont00, 	       		     (unsigned short *) osd_font01, 			     (unsigned short *) osd_cfont01);#else   /* Default font */   process_osd(16, 96, 192, (unsigned int *) osd_font00, 	                    (unsigned int *) osd_cfont00, 	       		    (unsigned short *) osd_font01, 			    (unsigned short *) osd_cfont01);#endif   for (i = 0; i < MAX_TBL_NUM ; i++) {	tablesz = output_table(i,fp);   }   fprintf(fph, "/* Automatically generated header file. DO NOT EDIT. */\n\n");   fprintf(fph, "#ifdef SRAM\n#ifndef INIT_CONST \n");   fprintf(fph, "extern char *vcx_romdatastart;\n");   fprintf(fph, "#endif\n#else\n");   fprintf(fph, "#ifdef INIT_CONST\n");   fprintf(fph, "unsigned long vcx_romdatastart = 0x8000;\n");   fprintf(fph, "#else\n");   fprintf(fph, "extern unsigned long vcx_romdatastart ;\n");   fprintf(fph, "#endif\n");   fprintf(fph, "#endif\n");#ifdef P2O   fprintf(fph, "\ntypedef short filter_set[20];\n\n");#endif   fprintf(fph, "/*\n * Size of each ROM-based table\n */\n");   for (i = 0; i < MAX_TBL_NUM ; i++) {	fprintf(fph, "#define T_%s_SZ		%d\n", tables[i].name, tables[i].size);   }   fprintf(fph, "\n");   fprintf(fph, "/*\n * Starting location of each ROM-based table\n*/\n");   tablesz = 0;   for (i = 0; i < MAX_TBL_NUM ; i++) {	fprintf(fph, "#define T_%s	", tables[i].name, tablesz);	fprintf(fph, "(%s (vcx_romdatastart + 0x%lx))\n", 		type_def[tables[i].type-1], tablesz);	tablesz += SIZE(tables[i].size);   }   fprintf(fph, "\n\n#ifdef INIT_CONST\n");   for (i = 0; i < MAX_TBL_NUM ; i++) {	if (tables[i].genvar) {	    fprintf(fph, "%s %s;\n", stype_def[tables[i].type-1],		    tables[i].name);	}   }   fprintf(fph, "#else\n");   for (i = 0; i < MAX_TBL_NUM ; i++) {	if (tables[i].genvar) {	    fprintf(fph, "extern %s %s;\n", stype_def[tables[i].type-1],		    tables[i].name);	}   }   fprintf(fph, "#endif\n");   /* Output defines for messages */   fprintf(fph, "\n/* Offset of OSD messages */\n");   for (i = 0; i < MAX_TBL_NUM; i++) {	if (tables[i].type == OSDMESSAGE)	  write_message_defines((OSDMSG *) tables[i].table, i, fph);    }   fclose(fp);   fclose(fph);   fp = fopen("init_t.c","w");   fprintf(fp, "/* Init Constant Table */\n");   fprintf(fp, "#define INIT_CONST\n");   fprintf(fp, "#include \"const.h\"\n");   fprintf(fp, "#ifdef SRAM\n");   fprintf(fp, "#include \"constdat\"\n");   fprintf(fp, "#endif\n");   fprintf(fp, "Init_const()\n{\n");   for (i = 0; i < MAX_TBL_NUM ; i++) {       if (tables[i].genvar) {	   fprintf(fp,"    %s = T_%s;\n", tables[i].name, tables[i].name);       }   }   fprintf(fp, "}\n");   fclose(fp);#ifdef SRAM   merge_constdat();#endif   exit(0);}#ifdef SRAMint merge_constdat(){  FILE *fp, *fp0;  unsigned char ch;  int  i = 0;  fp0 = fopen("const.dat", "rb");  fp = fopen("constdat","w");  fprintf(fp, "char vcx_romdatastart[]={\n");  while (fread(&ch, sizeof(char), 1, fp0)) {     fprintf(fp,"0x%x,", ch);     i++;     if (i == 10) {       i = 0;       fprintf(fp, "\n");     }  }  fprintf(fp, "};\n");    return 1;}#endifunsigned longoutput_table(int tb, FILE *fp){   int i;   unsigned long ndata;   switch (tables[tb].type) {     case SHORT:     case USHORT:     case FILTER_SET:       ndata = write_short((short *)tables[tb].table, 			   SIZE(tables[tb].size)/sizeof(short), fp);       break;     case FONT:       ndata = write_short((short *)(*(int *)(tables[tb].table)), 			   SIZE(tables[tb].size)/sizeof(short), fp);       break;     case CHAR:     case UCHAR:       ndata = write_char(tables[tb].table, SIZE(tables[tb].size), fp);       break;     case COMPFONTDATA:       tables[tb].size = szCompFont + szCompCFont;       ndata = write_char((unsigned char *)(*(int *)(tables[tb].table)), 			   SIZE(tables[tb].size), fp);       break;     case COMPFONTCODE:       tables[tb].size = szCodeBook;       ndata = write_char((unsigned char *)(*(int *)(tables[tb].table)), 			   SIZE(tables[tb].size), fp);       break;     case COMPFONTOFFSET:       tables[tb].size = szOffsetTbl * 2;       ndata = write_short((short *)(*(int *)(tables[tb].table)), 			   SIZE(tables[tb].size)/sizeof(short), fp);       break;     case INT:     case UINT:     case LONG:     case ULONG:       ndata = write_long((long *) tables[tb].table, 			  SIZE(tables[tb].size)/sizeof(long), fp);       break;     case OSDMESSAGE:       ndata = write_osdmsg((OSDMSG *) tables[tb].table, tb, fp);       break;   }   return ndata;}/* write a long to file */unsigned long write_long(unsigned long *dataptr, long count, FILE *fp){    long i;    unsigned long data;     for (i = 0; i < count; i++) {        data = *dataptr++;        fputc( (unsigned char) ( (data>>24) & 0xff), fp);        fputc( (unsigned char) ( (data>>16) & 0xff), fp);        fputc( (unsigned char) ( (data>> 8) & 0xff), fp);        fputc( (unsigned char) ( data & 0xff), fp);    }    return (count * sizeof(long));}/* write a short to file */unsigned long write_short(unsigned short *dataptr, long count, FILE *fp){    long i;    unsigned short data;     for (i = 0; i < count; i++) {        data = *dataptr++;        fputc( (unsigned char) ( (data>> 8) & 0xff), fp);        fputc( (unsigned char) ( data & 0xff), fp);    }    return (count * sizeof(short));} /* write a char to file */unsigned long write_char(unsigned char *dataptr, long count, FILE *fp){    long i;    unsigned char data;     for (i = 0; i < count; i++) {        data = *dataptr++;        fputc( (unsigned char) data, fp);    }    return (count * sizeof(char));}/* write OSD message */PRIVATE unsigned long write_osdmsg(osdmsg, index, fp)OSDMSG * osdmsg;int index;FILE * fp;{    int num_msg = tables[index].entries;    unsigned int len, newlen;    int i;    for (i = len = 0; i < num_msg; i++) {	fprintf(fp, "%s%c", osdmsg[i].osd, '\000');	len += (strlen(osdmsg[i].osd) + 1);    }    /* Align length to 4B boundary */    if (len & 0x3) {	newlen = len + 4;	newlen &= ~3;    }    else	newlen = len;    for (i = newlen - len; i > 0; i --)      fputc('\000', fp);    tables[index].size = newlen;	/* Fill the length of data! */    return(newlen);}/* Output #define's for message */PRIVATE void write_message_defines(osdmsg, index, fp)OSDMSG * osdmsg;FILE * fp;{    int num_msg = tables[index].entries;    OSDMSG * ptr = osdmsg;    int i, len;    for (i = len = 0; i < num_msg; i++) {	fprintf(fp, "#define MSG_%-20s (&MSG_array[%4d])\n", 		ptr[i].name, len);	len += (strlen(ptr[i].osd) + 1);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -