#include "mergeImage.h" #include #include "gpioset.h" #ifdef OP_IRCommandType #define showMsg( args... ) printf( args ) CUSTIMIZATION_TABLE OptionData; int GetOptionData(void ) { //unsigned char i, j; showMsg( "\n**** GetOptionData ****\n"); memset(&OptionData, 0, sizeof(OptionData)); /* ------------------------------------------------*/ #if 0 OptionData.GPIOSET[0] = 0x1e; OptionData.GPIOSET[1] = 0x02; OptionData.GPIOSET[2] = 0x15; OptionData.GPIOSET[3] = 0x16; OptionData.GPIOSET[4] = 0xe0; OptionData.GPIOSET[5] = 0xa4; OptionData.GPIOSET[6] = 0x88; OptionData.GPIOSET[7] = 0x09; OptionData.GPIOSET[8] = 0x0a; OptionData.GPIOSET[9] = 0x0b; OptionData.GPIOSET[10] = 0x0c; OptionData.GPIOSET[11] = 0x0d; OptionData.GPIOSET[12] = 0x0e; OptionData.GPIOSET[13] = 0x11; OptionData.GPIOSET[14] = 0xc3; OptionData.GPIOSET[15] = 0xbf; OptionData.GPIOSET[16] = 0xff; OptionData.GPIOSET[17] = 0x00; #endif /*------------------------------------------------*/ OptionData.IRCommandType = OP_IRCommandType; // IR setting OptionData.pIR_Set[0] = OP_IR_Protocol_reg; /* 0xbe080004 */ showMsg( "OP_IR_Protocol_reg=%x\tpIR_Set=%x\n", (unsigned int)OP_IR_Protocol_reg, (unsigned int)OptionData.pIR_Set[0]); OptionData.pIR_Set[1] = OP_IR_Interrupt_en_reg; /* 0xbe080008 */ OptionData.pIR_Set[2] = OP_IR_Interrupt_staus; /* 0xbe08000c */ OptionData.pIR_Set[3] = OP_IR_MinSpaceBetweenPacket; /* 0xbe080010 */ OptionData.pIR_Set[4] = OP_IR_Max_Min_Symbol; /* 0xbe080014 */ OptionData.pIR_Set[5] = OP_IR_Max_Min_Short_Mark; /* 0xbe080018 */ OptionData.pIR_Set[6] = OP_IR_Max_Min_Short_Space; /* 0xbe08001c */ OptionData.pIR_Set[7] = OP_IR_Max_Min_Long_Mark; /* 0xbe080020 */ OptionData.pIR_Set[8] = OP_IR_Max_Min_Head_Mark; /* 0xbe080024 */ OptionData.pIR_Set[9] = OP_IR_Max_Min_Head_Space; /* 0xbe080028 */ OptionData.pIR_Set[10] =OP_IR_REG_2C; /* 0xbe08002c */ OptionData.pIR_Set[11] =OP_IR_Max_Min_Repeat_Space; /* 0xbe080030 */ OptionData.pIR_Set[12] =OP_IR_Extra_Decode_Option; /* 0xbe080034 */ OptionData.pIR_Set[13] =OP_IR_REG_38; /* 0xbe080038 */ OptionData.pIR_Set[14] =OP_IR_WatchDog_Timeout; /* 0xbe08003c */ OptionData.pIR_Set[15] =OP_IR_Repeat_Threshold; /* 0xbe080040 */ OptionData.pIR_Set[16] =OP_IR_Packet_Timeout_Threshold; /* 0xbe080044 */ OptionData.pIR_Set[17] =OP_IR_Key_Press_Counter; /* 0xbe080048 */ OptionData.pIR_Set[18] =OP_IR_Protocol_Type_Option; /* 0xbe08004c */ OptionData.pIR_Set[19] =OP_IR_Internal_Counter; /* 0xbe080050 */ OptionData.pIR_Set[20] =OP_IR_Bit47_to_Bit16; /* 0xbe080054 */ OptionData.pIR_Set[21] =OP_IR_Receiver_Signal; /* 0xbe080058 */ OptionData.pIR_Set[22] =OP_IR_Power_Code_Option; /* 0xbe08005c */ OptionData.pIR_Set[23] =OP_IR_Power_Code_A_Low_Channel; /* 0xbe080060 */ OptionData.pIR_Set[24] =OP_IR_Power_Code_A_High_Channel;/* 0xbe080064 */ OptionData.pIR_Set[25] =OP_IR_Power_Code_B_Low_Channel; /* 0xbe080068 */ OptionData.pIR_Set[26] =OP_IR_Power_Code_B_High_Channel;/* 0xbe08006c */ OptionData.pIR_Set[27] =OP_IR_Power_Code_C_Low_Channel; /* 0xbe080070 */ OptionData.pIR_Set[28] =OP_IR_Power_Code_C_High_Channel;/* 0xbe080074 */ OptionData.pIR_Set[29] =OP_IR_Power_Code_D_Low_Channel; /* 0xbe080078 */ OptionData.pIR_Set[30] =OP_IR_Power_Code_D_High_Channel;/* 0xbe08007c */ OptionData.pIR_Set[31] =OP_IR_Max_Min_Long1_MarkSpace; /* 0xbe080080 */ OptionData.pIR_Set[32] =OP_IR_Max_Min_Long2_MarkSpace; /* 0xbe080084 */ //------------------------------------------------// OptionData.PowerOnKeySets = 2; OptionData.KEYPAD_PWR_ON_KEY = OP_KEYPAD_PWR_ON_KEY; showMsg("----\n"); //------------------------------------------------// // LED OptionData.GreenLEDNum = 0x01; // GPIO 01 as Green LED OptionData.GreenLEDMode = 1; // GPIO mode OptionData.RedLEDNum = 1; // PWM0 as Red LED OptionData.RedLEDMode = 0; // PWM mode OptionData.LEDOnStatus = 0x80; OptionData.LEDOffStatus = 0x40; // Panel OptionData.PanelPWROnGPIONum = 2; // GPIO 02 as panel power control OptionData.PanelBackLightGPIONum = 30; // GPIO 30 as Back Light control OptionData.PanelPWMNum = 2; // PWM 2 as Back Light Brig //------------------------------------------------// OptionData.DVD_IROUT_GPIO_NO = 28; /* 0xbe080098 */ //------------------------------------------------// OptionData.HDMISwitchMap = OP_HDMI_SWITCH; /* 0xbe08009A */ OptionData.HDMIPortMap = OP_HDMI_PORT_MAP; /* 0xbe08009C */ OptionData.IR_PowerOnKey[0].Custom_Code = 0x09f6; /* 0xbe0800A0 */ OptionData.IR_PowerOnKey[0].Key_Code[0] = 0x45ba; OptionData.IR_PowerOnKey[1].Custom_Code = 0x649b; /* 0xbe0800C0 */ OptionData.IR_PowerOnKey[1].Key_Code[0] = 0x50af; showMsg( "\n**** GetOptionData done ****\n"); //------------------------------------------------// showMsg( "**** size of Option:%x ****\n", sizeof(OptionData)); return 0; } int GPIOini2Bin(unsigned char *GPIOData) { int i, j; char pChar[256]; PADJUST_GPIO GPIOiniData; GPIO_FORMAT GPIOset[64]; FILE *fPtr; char GPIOdescript[256]; int nFieldNum; showMsg( "\n**** GPIOini2Bin ****\n"); memset(pChar, 0xFF, sizeof(pChar)); memset(GPIOset, 0, sizeof(GPIOset)); memset(GPIOdescript, 0, sizeof(GPIOdescript)); GPIOiniData = (PADJUST_GPIO)(pChar); fPtr = fopen(GPIOSetIniFileName, "r"); if ( fPtr == NULL ) { showMsg("### Open %s file fail ###\n", GPIOSetIniFileName); return -1; } do { // Get string from file if(fgets(GPIOdescript, sizeof(GPIOdescript), fPtr)); } while (((GPIOdescript[0]=='#')&&(GPIOdescript[1]!='i')&&(GPIOdescript[2]!='n')&&(GPIOdescript[3]!='d')&&(GPIOdescript[4]!='e')&&(GPIOdescript[5]!='x')) || \ ((GPIOdescript[0]!='i')&&(GPIOdescript[1]!='n')&&(GPIOdescript[2]!='d')&&(GPIOdescript[3]!='e')&&(GPIOdescript[4]!='x')) ); j = 0; for ( i=0;i<64;i++) { nFieldNum = fscanf(fPtr,"%d %d %d %d %d %d %d %d %d %d %d %x",(int *)&GPIOset[i].index, \ (int *)&GPIOset[i].AuxEnalbe,\ (int *)&GPIOset[i].AuxMode,\ (int *)&GPIOset[i].AuxValue,\ (int *)&GPIOset[i].AInternalPU,\ (int *)&GPIOset[i].AInternalPD, \ (int *)&GPIOset[i].MainEnalbe,\ (int *)&GPIOset[i].MainMode,\ (int *)&GPIOset[i].MainValue,\ (int *)&GPIOset[i].MInternalPU, \ (int *)&GPIOset[i].MInternalPD, \ (int *)&GPIOset[i].MDELAY_TIME); GPIOiniData->GPIO[j] = GPIOset[i].index; GPIOiniData->GPIO[j+1] = GPIOset[i].AuxEnalbe +\ (GPIOset[i].AuxMode<<1) +\ (GPIOset[i].AuxValue<<2) +\ (GPIOset[i].AInternalPU<<3) +\ (GPIOset[i].AInternalPD<<4) +\ (GPIOset[i].MainEnalbe<<5) +\ (GPIOset[i].MainMode<<6) +\ (GPIOset[i].MainValue<<7); GPIOiniData->GPIO[j+2] = (GPIOset[i].MInternalPU<<6) +\ (GPIOset[i].MInternalPD<<7) +\ (GPIOset[i].MDELAY_TIME&0x3F); //showMsg("\n**** GPIO%d:%02x %02x ****\n", GPIOiniData->GPIO[j], GPIOiniData->GPIO[j+1], GPIOiniData->GPIO[j+2]); j = j+3; if ( feof(fPtr) ) break; } fclose(fPtr); memcpy(GPIOData, GPIOiniData, sizeof(ADJUST_GPIO)); showMsg( "\n**** GPIOini2Bin done (%d sets) ****\n", nFieldNum); return 0; } #endif // OP_IRCommandType