123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- #include <stdio.h>
- #include "main.h"
- #include "Bluecell_operate.h"
- #include "PE43711.h"
- extern volatile uint32_t LedTimerCnt;
- uint8_t Alarm_Status[MAX_ALARM_Len] = {0,};
- uint8_t ResultData[1024] = {0,};
- void Boot_LED_Toggle(void){
- if(LedTimerCnt > 500){
- HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_14);
- LedTimerCnt = 0;
- // printf("LED OF OFF\r\n");
- }
- }
- uint8_t* MBIC_HeaderDataSetting(uint8_t* data){
- ResultData[MBIC_PREAMBLE_0] = MBIC_PREAMBLE0;
- ResultData[MBIC_PREAMBLE_1] = MBIC_PREAMBLE1;
- ResultData[MBIC_PREAMBLE_2] = MBIC_PREAMBLE2;
- ResultData[MBIC_PREAMBLE_3] = MBIC_PREAMBLE3;
- ResultData[MBIC_SUBUID_0] = MBIC_SUBUID0;
- ResultData[MBIC_SUBUID_1] = MBIC_SUBUID1;
- ResultData[MBIC_RCODE_0] = data[MBIC_RCODE_0];
- ResultData[MBIC_TRID_0] = data[MBIC_TRID_0];
- ResultData[MBIC_TRID_1] = data[MBIC_TRID_1];
- ResultData[MBIC_SEQSUM_0] = data[MBIC_SEQSUM_0];
- ResultData[MBIC_TTL_0] = data[MBIC_TTL_0];
- ResultData[MBIC_TIME_0] = data[MBIC_TIME_0];
- ResultData[MBIC_TIME_1] = data[MBIC_TIME_1];
- ResultData[MBIC_TIME_2] = data[MBIC_TIME_2];
- ResultData[MBIC_TIME_3] = data[MBIC_TIME_3];
- ResultData[MBIC_TIME_4] = data[MBIC_TIME_4];
- ResultData[MBIC_TIME_5] = data[MBIC_TIME_5];
- return ResultData;
- }
- typedef enum{
- BLUECELL_DL_PATH1 = 0x01,
- BLUECELL_UL_PATH1,
- BLUECELL_DL_PATH2,
- BLUECELL_UL_PATH2,
- BLUECELL_DL_PATH3,
- BLUECELL_UL_PATH3,
- BLUECELL_DL_PATH4,
- BLUECELL_UL_PATH4,
- };
- typedef enum{
- BLUECELL_HEADER,
- BLUECELL_TYPE,
- BLUECELL_LENGTH,
- BLUECELL_CRCINDEX,
- BLUECELL_DATA,
- };
- extern ALL_PE43711_st ALL_ATT;
- bool Bluecell_Operate(uint8_t* data){
- uint8_t datatype = data[BLUECELL_TYPE];
- uint16_t tmp_h = 0,tmp_l = 0;
- double ret = 0 ,tmp = 0.1;
- uint8_t val = 0;
- switch(datatype){
- case ATTDL1 :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- tmp_h = data[BLUECELL_DATA];
- tmp_l = data[BLUECELL_DATA + 1];
- ret += ((tmp_h << 8) & 0xFF00);
- ret += (tmp_l & 0x00FF);
- ret /= 100;
- val = PE43711_DataToHexConvert(ret);
- PE43711_atten_ctrl(ALL_ATT.ATT_DL1,val);
-
- printf("ret : %f ,tmp %f \r\n",ret,tmp );
- break;
- case ATT_DL1_PATH_OFF :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_DL1_PATH_ON :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATTUL1 :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- tmp_h = data[BLUECELL_DATA];
- tmp_l = data[BLUECELL_DATA + 1];
- ret += ((tmp_h << 8) & 0xFF00);
- ret += (tmp_l & 0x00FF);
- ret /= 100;
- val = PE43711_DataToHexConvert(ret);
- PE43711_atten_ctrl(ALL_ATT.ATT_UL1,val);
- printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
- break;
- case ATT_UL1_PATH_OFF :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_UL1_PATH_ON :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_SelfTest1_OFF :
- HAL_GPIO_WritePin(_PATH_SW1_GPIO_Port,_PATH_SW1_Pin,GPIO_PIN_RESET);//CLOCK
- HAL_GPIO_WritePin(PATH_SW1_GPIO_Port,PATH_SW1_Pin,GPIO_PIN_SET);//CLOCK
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_SelfTest1_ON :
- HAL_GPIO_WritePin(_PATH_SW1_GPIO_Port,_PATH_SW1_Pin,GPIO_PIN_SET);//CLOCK
- HAL_GPIO_WritePin(PATH_SW1_GPIO_Port,PATH_SW1_Pin,GPIO_PIN_RESET);//CLOCK
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATTDL2 :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- tmp_h = data[BLUECELL_DATA];
- tmp_l = data[BLUECELL_DATA + 1];
- ret += ((tmp_h << 8) & 0xFF00);
- ret += (tmp_l & 0x00FF);
- ret /= 100;
- val = PE43711_DataToHexConvert(ret);
- PE43711_atten_ctrl(ALL_ATT.ATT_DL2,val);
- printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
- break;
- case ATT_DL2_PATH_OFF :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_DL2_PATH_ON :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATTUL2 :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- tmp_h = data[BLUECELL_DATA];
- tmp_l = data[BLUECELL_DATA + 1];
- ret += ((tmp_h << 8) & 0xFF00);
- ret += (tmp_l & 0x00FF);
- ret /= 100;
- val = PE43711_DataToHexConvert(ret);
- PE43711_atten_ctrl(ALL_ATT.ATT_UL2,val);
- printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
- break;
- case ATT_UL2_PATH_OFF :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_UL2_PATH_ON :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_SelfTest2_OFF :
- HAL_GPIO_WritePin(_PATH_SW2_GPIO_Port,_PATH_SW2_Pin,GPIO_PIN_RESET);//CLOCK
- HAL_GPIO_WritePin(PATH_SW2_GPIO_Port,PATH_SW2_Pin,GPIO_PIN_SET);//CLOCK
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_SelfTest2_ON :
- HAL_GPIO_WritePin(PATH_SW2_GPIO_Port,PATH_SW2_Pin,GPIO_PIN_RESET);//CLOCK
- HAL_GPIO_WritePin(_PATH_SW2_GPIO_Port,_PATH_SW2_Pin,GPIO_PIN_SET);//CLOCK
-
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATTDL3 :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- tmp_h = data[BLUECELL_DATA];
- tmp_l = data[BLUECELL_DATA + 1];
- ret += ((tmp_h << 8) & 0xFF00);
- ret += (tmp_l & 0x00FF);
- ret /= 100;
- val = PE43711_DataToHexConvert(ret);
- PE43711_atten_ctrl(ALL_ATT.ATT_DL3,val);
- printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
- break;
- case ATT_DL3_PATH_OFF :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_DL3_PATH_ON :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATTUL3 :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- tmp_h = data[BLUECELL_DATA];
- tmp_l = data[BLUECELL_DATA + 1];
- ret += ((tmp_h << 8) & 0xFF00);
- ret += (tmp_l & 0x00FF);
- ret /= 100;
- val = PE43711_DataToHexConvert(ret);
- PE43711_atten_ctrl(ALL_ATT.ATT_UL3,val);
- printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
- break;
- case ATT_UL3_PATH_OFF :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_UL3_PATH_ON :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_SelfTest3_OFF :
- HAL_GPIO_WritePin(_PATH_SW3_GPIO_Port,_PATH_SW3_Pin,GPIO_PIN_RESET);//CLOCK
- HAL_GPIO_WritePin(PATH_SW3_GPIO_Port,PATH_SW3_Pin,GPIO_PIN_SET);//CLOCK
-
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_SelfTest3_ON :
- HAL_GPIO_WritePin(PATH_SW3_GPIO_Port,PATH_SW3_Pin,GPIO_PIN_RESET);//CLOCK
- HAL_GPIO_WritePin(_PATH_SW3_GPIO_Port,_PATH_SW3_Pin,GPIO_PIN_SET);//CLOCK
-
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATTDL4 :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- tmp_h = data[BLUECELL_DATA];
- tmp_l = data[BLUECELL_DATA + 1];
- ret += ((tmp_h << 8) & 0xFF00);
- ret += (tmp_l & 0x00FF);
- ret /= 100;
- val = PE43711_DataToHexConvert(ret);
- PE43711_atten_ctrl(ALL_ATT.ATT_DL4,val);
- printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
- break;
- case ATT_DL4_PATH_OFF :
- HAL_GPIO_WritePin(_PATH_SW4_GPIO_Port,_PATH_SW4_Pin,GPIO_PIN_RESET);//CLOCK
- HAL_GPIO_WritePin(PATH_SW4_GPIO_Port,PATH_SW4_Pin,GPIO_PIN_SET);//CLOCK
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_DL4_PATH_ON :
- HAL_GPIO_WritePin(_PATH_SW4_GPIO_Port,_PATH_SW4_Pin,GPIO_PIN_SET);//CLOCK
- HAL_GPIO_WritePin(PATH_SW4_GPIO_Port,PATH_SW4_Pin,GPIO_PIN_RESET);//CLOCK
-
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATTUL4 :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- tmp_h = data[BLUECELL_DATA];
- tmp_l = data[BLUECELL_DATA + 1];
- ret += ((tmp_h << 8) & 0xFF00);
- ret += (tmp_l & 0x00FF);
- ret /= 100;
- val = PE43711_DataToHexConvert(ret);
- PE43711_atten_ctrl(ALL_ATT.ATT_UL4,val);
- printf("tmp_h : %x tmp_l : %x , ret : %x ,%f ,tmp %f \r\n",tmp_h,tmp_l,ret,tmp );
- break;
- case ATT_UL4_PATH_OFF:
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_UL4_PATH_ON :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_SelfTest4_OFF :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- case ATT_SelfTest4_ON :
- printf("Function : %s Line %d \r\n",__func__,__LINE__);
- break;
- }
- return true;
- }
- bool MBIC_Operate(uint8_t* data){
- uint16_t datatype = 0;
- switch(datatype){
- case Alarm_Bit_List:
- // �븣由� 鍮꾪듃
- Uart1_Data_Send(&Alarm_Status[0],MAX_ALARM_Len);
- break;
- case Alarm_Mask:
- break;
- case Alarm_Test_Mode:
- break;
- case Alarm_Test_Dummy:
- break;
- case CPU_Version:
- break;
- case ModuleINFORMATION_null1:
- break;
- case CPU_Current_Bank:
- break;
- case CPU_Bank_Select_Reboot_by:
- break;
- case CPU_Bank1_Image_Version:
- break;
- case CPU_Bank1_Image_BuildTime:
- break;
- case CPU_Bank1_Image_Name:
- break;
- case CPU_Bank2_Image_Version:
- break;
- case CPU_Bank2_Image_BuildTime:
- break;
- case CPU_Bank2_Image_Name:
- break;
- case SW_Reset:
- break;
- case Factory_Set_Initialization:
- break;
- case Temperature:
- break;
- case Temperature_Offset:
- break;
- case Temp_High_Threshold:
- break;
- case Temp_High_Threshold_Default:
- break;
- case Temp_High_Alarm:
- break;
- case LED_TEST:
- break;
- case Node:
- break;
- case Type:
- break;
- case PCB_Version:
- break;
- case Serial_Number:
- break;
- case Manufacture:
- break;
- case Manufacture_Date:
- break;
- case ENVIRONMENT_INVENTORY_null1:
- printf("Function : %s .... Line : %d\r\n",__func__,__LINE__);
- break;
- case Freq_ID:
- break;
- case Carrier_ID:
- break;
- case Carrier_ON_OFF:
- break;
- }
- return true;
- }
|