FreeCalypso > hg > tcs211-l1-reconst
comparison chipsetsw/layer1/tm_cfile/l1tm_func.c @ 225:d32a7e3ba63d
l1tm_func.c: removed LoCosto DRP-specific functions
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 14 Jan 2017 23:13:40 +0000 |
parents | a576fb23046e |
children | a5d619b2561c |
comparison
equal
deleted
inserted
replaced
224:a576fb23046e | 225:d32a7e3ba63d |
---|---|
148 | 148 |
149 #if(L1_FF_MULTIBAND == 1) | 149 #if(L1_FF_MULTIBAND == 1) |
150 extern UWORD8 tm_band; | 150 extern UWORD8 tm_band; |
151 #endif /*if (L1_FF_MULTIBAND == 1)*/ | 151 #endif /*if (L1_FF_MULTIBAND == 1)*/ |
152 | 152 |
153 | |
154 #if (DRP_FW_EXT==0) | |
155 #if (L1_DRP == 1) | |
156 #include "drp_drive.h" | |
157 #include "drp_defines.h" | |
158 #include "drp_api.h" | |
159 #include "drp_extern_dependencies.h" | |
160 #endif //L1_DRP | |
161 | |
162 #if (RF_FAM == 61) | |
163 extern T_DRP_SW_DATA drp_sw_data_init; | |
164 extern T_DRP_SW_DATA drp_sw_data_calib; | |
165 extern T_DRP_SW_DATA drp_sw_data_calib_saved; | |
166 extern UINT16 g_pcb_config; //ompas00090550 #262 removal | |
167 #endif // DRP_FW_EXT==0 | |
168 #endif | |
169 | |
170 extern void gpio_39_toggle(UINT16 state); | |
171 | |
172 | 153 |
173 // Prototypes from external functions | 154 // Prototypes from external functions |
174 //------------------------------------ | 155 //------------------------------------ |
175 UWORD16 Convert_l1_radio_freq(SYS_UWORD16 radio_freq); | 156 UWORD16 Convert_l1_radio_freq(SYS_UWORD16 radio_freq); |
176 | 157 |
192 | 173 |
193 #if (CODE_VERSION != SIMULATION) | 174 #if (CODE_VERSION != SIMULATION) |
194 void Cust_tm_tpu_table_write (T_TM_RETURN *tm_return, WORD8 index, UWORD8 size, UWORD8 table[]); | 175 void Cust_tm_tpu_table_write (T_TM_RETURN *tm_return, WORD8 index, UWORD8 size, UWORD8 table[]); |
195 void Cust_tm_tpu_table_read (T_TM_RETURN *tm_return, WORD8 index); | 176 void Cust_tm_tpu_table_read (T_TM_RETURN *tm_return, WORD8 index); |
196 #endif | 177 #endif |
197 | |
198 #if (L1_TPU_DEV == 1) | |
199 void Cust_tm_flexi_tpu_table_write(T_TM_RETURN * tm_return, WORD8 index, UWORD8 size, WORD16 table[ ]); | |
200 void Cust_tm_flexi_tpu_table_read(T_TM_RETURN * tm_return, WORD8 index); | |
201 | |
202 //Flexi ABB Delays | |
203 void Cust_tm_flexi_abb_write(T_TM_RETURN * tm_return, WORD8 index, UWORD8 size, WORD16 table[ ]); | |
204 void Cust_tm_flexi_abb_read(T_TM_RETURN * tm_return, WORD8 index); | |
205 | |
206 #endif | |
207 | |
208 // DRP Calibration | |
209 void l1tm_drp_calib_read(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return); | |
210 void l1tm_drp_calib_write(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return); | |
211 | 178 |
212 //------------------------------------ | 179 //------------------------------------ |
213 // Prototypes from external functions | 180 // Prototypes from external functions |
214 //------------------------------------ | 181 //------------------------------------ |
215 | 182 |
793 prim->u.tm_params.value); | 760 prim->u.tm_params.value); |
794 break; | 761 break; |
795 } | 762 } |
796 } // end switch | 763 } // end switch |
797 } | 764 } |
798 | |
799 #if (L1_DRP == 1) | |
800 void l1tm_drp_sw_write(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return) | |
801 { | |
802 WORD8 error=0; | |
803 tm_return->cid=DRP_SW_WRITE; | |
804 tm_return->index = prim->u.tm_table.index; | |
805 tm_return->size = 0; | |
806 | |
807 #if (ETM_PROTOCOL == 1) | |
808 tm_return->status = -ETM_OK; | |
809 #else | |
810 tm_return->status = E_OK; | |
811 #endif | |
812 | |
813 switch (prim->u.tm_table.index) | |
814 { | |
815 case FFS_TO_SRM: | |
816 { | |
817 #if (OP_L1_STANDALONE ==0) | |
818 // Call function to load ref sw from FFS to SRM | |
819 error = drp_ref_sw_upload_from_ffs(prim->u.tm_table.table); | |
820 if(error < 0) | |
821 { | |
822 #if (ETM_PROTOCOL == 1) | |
823 tm_return->status = -ETM_FATAL; | |
824 #else | |
825 tm_return->status = E_INVAL; | |
826 #endif | |
827 } | |
828 else | |
829 { | |
830 #if (ETM_PROTOCOL == 1) | |
831 tm_return->status = -ETM_OK; | |
832 #else | |
833 tm_return->status = E_OK; | |
834 #endif | |
835 } | |
836 #else // OP_L1_STANDALONE | |
837 #if (ETM_PROTOCOL == 1) | |
838 tm_return->status = -ETM_NOSYS; | |
839 #else | |
840 tm_return->status = (UWORD8)(-E_NOSYS); //omaps00090550 | |
841 #endif | |
842 #endif// OP_L1_STANDALONE | |
843 break; | |
844 } | |
845 | |
846 default: | |
847 { | |
848 // nothing to do now. | |
849 break; | |
850 } | |
851 } // end switch | |
852 } | |
853 #endif | |
854 | |
855 #if (L1_DRP == 1) | |
856 | |
857 void l1tm_drp_calib_read(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return) | |
858 { | |
859 // Do Nothing Possible Future use. Intentionally left blank | |
860 } | |
861 | |
862 void l1tm_drp_calib_write(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return) | |
863 { | |
864 INT32 error=0;//ompas00090550 | |
865 #if (OP_L1_STANDALONE == 1) | |
866 UINT8 *ptrsrc, *ptrdst; | |
867 UINT16 indx, strsize; | |
868 #endif | |
869 UINT16 band; | |
870 volatile UINT16 * ptr_gpio, temp16; | |
871 | |
872 #define GPIO2_LATCH_IN 0xfffe5800 // GPIO32-48 input register | |
873 #define GPIO2_LATCH_OUT 0xfffe5802 // GPIO32-48 output register | |
874 #define GPIO2_CNTL 0xfffe5804 // GPIO32-48 io config, 1=inp, 0= out | |
875 | |
876 #define GPIO0_LATCH_IN 0xfffe4800 // GPIO0-15 input register | |
877 #define GPIO0_LATCH_OUT 0xfffe4802 // GPIO0-15 output register | |
878 #define GPIO0_CNTL 0xfffe4804 // GPIO0-15 io config, 1=inp, 0= out | |
879 | |
880 tm_return->cid=DRP_CALIB_WRITE; | |
881 tm_return->index = prim->u.tm_params.index; | |
882 tm_return->size = 0; | |
883 | |
884 | |
885 #if (ETM_PROTOCOL == 1) | |
886 tm_return->status = -ETM_OK; | |
887 #else | |
888 tm_return->status = E_OK; | |
889 #endif | |
890 | |
891 //#if (OP_L1_STANDALONE == 1) | |
892 #if 0 | |
893 // Copy drp_sw_data_init into drp_sw_data_calib | |
894 strsize = sizeof(T_DRP_SW_DATA); | |
895 ptrsrc = (UINT8 *)(&drp_sw_data_init); | |
896 ptrdst = (UINT8 *)(&drp_sw_data_calib); | |
897 | |
898 for(indx=0;indx < strsize;indx++) | |
899 *ptrdst++ = *ptrsrc++; | |
900 #endif | |
901 | |
902 #if 0 | |
903 // GPIO-47 is used for timing measurement. | |
904 // To enable GPIO - 47as an output, Bit 15 of GPIO2_CNTL = 0 | |
905 ptr_gpio = (UINT16*)GPIO2_CNTL; | |
906 temp16 = *ptr_gpio; | |
907 temp16 &= ~(0x8000); | |
908 *ptr_gpio = temp16; | |
909 | |
910 // GPIO47 = 1 | |
911 ptr_gpio = (UINT16*)GPIO2_LATCH_OUT; | |
912 temp16 = *ptr_gpio; | |
913 temp16 |= 0x8000; | |
914 *ptr_gpio = temp16; | |
915 #endif | |
916 switch (tm_return->index) | |
917 { | |
918 case DRP_DUMMY: //Do Nothing Test Purposes | |
919 break; | |
920 | |
921 case DRP_READ_FROM_FLASH: // Force the Update of drp_sw_data_calib | |
922 { | |
923 // Call function to load data sw from FFS to SRM TBD Use the new Function | |
924 error = drp_sw_data_calib_upload_from_ffs(&drp_sw_data_calib); | |
925 | |
926 // error = drp_copy_ref_sw_to_drpsrm( (unsigned char *) &drp_ref_sw); | |
927 | |
928 error = drp_copy_sw_data_to_drpsrm(&drp_sw_data_calib); | |
929 | |
930 if(error < 0) | |
931 { | |
932 #if (ETM_PROTOCOL == 1) | |
933 tm_return->status = -ETM_FATAL; | |
934 #else | |
935 tm_return->status = E_INVAL; | |
936 #endif | |
937 } | |
938 else | |
939 { | |
940 #if (ETM_PROTOCOL == 1) | |
941 tm_return->status = -ETM_OK; | |
942 #else | |
943 tm_return->status = E_OK; | |
944 #endif | |
945 } | |
946 | |
947 break; | |
948 } | |
949 | |
950 | |
951 case DRP_DCXO_CALIB: | |
952 { | |
953 | |
954 #if (DRP_FW_EXT==1) //pinghua change it as 1 | |
955 band = GSM_BAND; | |
956 if((g_pcb_config == RF_EU_DUALBAND) || (g_pcb_config == RF_EU_TRIBAND) || (g_pcb_config == RF_PCS1900_900_DUALBAND)) | |
957 band = EGSM_BAND; | |
958 | |
959 error = drp_dcxo_calib(band, &drp_sw_data_calib); | |
960 #else | |
961 error = drp_dcxo_calib(GSM_BAND, &drp_sw_data_calib); | |
962 #endif | |
963 if(error < 0) | |
964 { | |
965 #if (ETM_PROTOCOL == 1) | |
966 tm_return->status = -ETM_FATAL; | |
967 #else | |
968 tm_return->status = E_INVAL; | |
969 #endif | |
970 } | |
971 else | |
972 { | |
973 #if (ETM_PROTOCOL == 1) | |
974 tm_return->status = -ETM_OK; | |
975 #else | |
976 tm_return->status = E_OK; | |
977 #endif | |
978 } | |
979 | |
980 break; | |
981 } | |
982 | |
983 | |
984 case DRP_TX_RX_COMMON: | |
985 { | |
986 error = drp_tx_rx_common_calib(&drp_sw_data_calib); | |
987 | |
988 if(error < 0) | |
989 { | |
990 #if (ETM_PROTOCOL == 1) | |
991 tm_return->status = -ETM_FATAL; | |
992 #else | |
993 tm_return->status = E_INVAL; | |
994 #endif | |
995 } | |
996 else | |
997 { | |
998 #if (ETM_PROTOCOL == 1) | |
999 tm_return->status = -ETM_OK; | |
1000 #else | |
1001 tm_return->status = E_OK; | |
1002 #endif | |
1003 } | |
1004 break; | |
1005 } | |
1006 | |
1007 | |
1008 case DRP_LNA_CFREQ: | |
1009 { | |
1010 error = drp_lna_cfreq_calib( (UWORD16) prim->u.tm_params.value, &drp_sw_data_calib); | |
1011 if(error < 0) | |
1012 { | |
1013 #if (ETM_PROTOCOL == 1) | |
1014 tm_return->status = -ETM_FATAL; | |
1015 #else | |
1016 tm_return->status = E_INVAL; | |
1017 #endif | |
1018 } | |
1019 else | |
1020 { | |
1021 #if (ETM_PROTOCOL == 1) | |
1022 tm_return->status = -ETM_OK; | |
1023 #else | |
1024 tm_return->status = E_OK; | |
1025 #endif | |
1026 } | |
1027 break; | |
1028 } | |
1029 | |
1030 | |
1031 case DRP_IQMC: | |
1032 { | |
1033 error = drp_iqmc_calib(prim->u.tm_params.value, &drp_sw_data_calib); | |
1034 if(error < 0) | |
1035 { | |
1036 #if (ETM_PROTOCOL == 1) | |
1037 tm_return->status = -ETM_FATAL; | |
1038 #else | |
1039 tm_return->status = E_INVAL; | |
1040 #endif | |
1041 } | |
1042 else | |
1043 { | |
1044 #if (ETM_PROTOCOL == 1) | |
1045 tm_return->status = -ETM_OK; | |
1046 #else | |
1047 tm_return->status = E_OK; | |
1048 #endif | |
1049 } | |
1050 break; | |
1051 } | |
1052 | |
1053 | |
1054 case DRP_MIXER_POLE: | |
1055 { | |
1056 error =drp_mixer_pole_calib(prim->u.tm_params.value, &drp_sw_data_calib); | |
1057 if(error < 0) | |
1058 { | |
1059 #if (ETM_PROTOCOL == 1) | |
1060 tm_return->status = -ETM_FATAL; | |
1061 #else | |
1062 tm_return->status = E_INVAL; | |
1063 #endif | |
1064 } | |
1065 else | |
1066 { | |
1067 #if (ETM_PROTOCOL == 1) | |
1068 tm_return->status = -ETM_OK; | |
1069 #else | |
1070 tm_return->status = E_OK; | |
1071 #endif | |
1072 } | |
1073 break; | |
1074 } | |
1075 | |
1076 case DRP_SCF_POLE: | |
1077 { | |
1078 error = drp_scf_pole_calib(prim->u.tm_params.value, &drp_sw_data_calib); | |
1079 if(error < 0) | |
1080 { | |
1081 #if (ETM_PROTOCOL == 1) | |
1082 tm_return->status = -ETM_FATAL; | |
1083 #else | |
1084 tm_return->status = E_INVAL; | |
1085 #endif | |
1086 } | |
1087 else | |
1088 { | |
1089 #if (ETM_PROTOCOL == 1) | |
1090 tm_return->status = -ETM_OK; | |
1091 #else | |
1092 tm_return->status = E_OK; | |
1093 #endif | |
1094 } | |
1095 break; | |
1096 } | |
1097 | |
1098 | |
1099 case DRP_AFE_GAIN_1: | |
1100 { | |
1101 error = drp_afe_gain_calib1 (prim->u.tm_params.value, &drp_sw_data_calib); | |
1102 if(error < 0) | |
1103 { | |
1104 #if (ETM_PROTOCOL == 1) | |
1105 tm_return->status = -ETM_FATAL; | |
1106 #else | |
1107 tm_return->status = E_INVAL; | |
1108 #endif | |
1109 } | |
1110 else | |
1111 { | |
1112 #if (ETM_PROTOCOL == 1) | |
1113 tm_return->status = -ETM_OK; | |
1114 #else | |
1115 tm_return->status = E_OK; | |
1116 #endif | |
1117 } | |
1118 break; | |
1119 } | |
1120 | |
1121 | |
1122 case DRP_AFE_GAIN_2: | |
1123 { | |
1124 error = drp_afe_gain_calib2 (prim->u.tm_params.value, &drp_sw_data_calib); | |
1125 if(error < 0) | |
1126 { | |
1127 #if (ETM_PROTOCOL == 1) | |
1128 tm_return->status = -ETM_FATAL; | |
1129 #else | |
1130 tm_return->status = E_INVAL; | |
1131 #endif | |
1132 } | |
1133 else | |
1134 { | |
1135 #if (ETM_PROTOCOL == 1) | |
1136 tm_return->status = -ETM_OK; | |
1137 #else //OP_L1_STANDALONE == 1 | |
1138 tm_return->status = E_OK; | |
1139 #endif | |
1140 } | |
1141 break; | |
1142 } | |
1143 | |
1144 | |
1145 | |
1146 case DRP_WRITE_TO_FLASH: | |
1147 { | |
1148 #if (OP_L1_STANDALONE ==0) | |
1149 // Call function to load data sw from FFS to SRM TBD Use the new Function | |
1150 error = drp_sw_data_calib_upload_to_ffs(&drp_sw_data_calib); | |
1151 | |
1152 // TBD the followign immediate error handling can be removed once the PS related FFS functionality is in. | |
1153 if (error < 0) | |
1154 { | |
1155 #if (ETM_PROTOCOL == 1) | |
1156 tm_return->status = -ETM_NOSYS; | |
1157 #else | |
1158 tm_return->status = E_NOSYS;//OMAPS00090550 | |
1159 #endif | |
1160 return; | |
1161 } | |
1162 | |
1163 #else // OP_L1_STANDALONE | |
1164 | |
1165 if(error < 0) | |
1166 { | |
1167 #if (ETM_PROTOCOL == 1) | |
1168 tm_return->status = -ETM_FATAL; | |
1169 #else | |
1170 tm_return->status = E_INVAL; | |
1171 #endif | |
1172 } | |
1173 else | |
1174 { | |
1175 #if (ETM_PROTOCOL == 1) | |
1176 tm_return->status = -ETM_OK; | |
1177 #else | |
1178 tm_return->status = E_OK; | |
1179 #endif | |
1180 } | |
1181 | |
1182 #endif //OP_L1_STANDALONE | |
1183 break; | |
1184 } | |
1185 | |
1186 default: | |
1187 { | |
1188 // nothing to do now. | |
1189 } | |
1190 } // end switch | |
1191 #if 0 | |
1192 // GPIO47 = 1 | |
1193 ptr_gpio = (UINT16*)GPIO2_LATCH_OUT; | |
1194 temp16 = *ptr_gpio; | |
1195 temp16 &= ~(0x8000); | |
1196 *ptr_gpio = temp16; | |
1197 #endif | |
1198 | |
1199 } | |
1200 | |
1201 #endif //L1_DRP | |
1202 | |
1203 | |
1204 | 765 |
1205 void l1tm_rx_param_read(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return) | 766 void l1tm_rx_param_read(T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return) |
1206 { | 767 { |
1207 volatile UWORD16 value; | 768 volatile UWORD16 value; |
1208 | 769 |
3285 { | 2846 { |
3286 Cust_tm_tpu_table_read(tm_return, prim->u.tm_table.index); | 2847 Cust_tm_tpu_table_read(tm_return, prim->u.tm_table.index); |
3287 } | 2848 } |
3288 #endif // (CODE_VERSION != SIMULATION) | 2849 #endif // (CODE_VERSION != SIMULATION) |
3289 | 2850 |
3290 #if (L1_TPU_DEV == 1) | |
3291 /******************************************************************* | |
3292 * l1tm_flexi_tpu_table_write | |
3293 * | |
3294 * DESCRIPTION: The function would be called by the switch case in the etm_rf. | |
3295 *******************************************************************/ | |
3296 void l1tm_flexi_tpu_table_write(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return) | |
3297 { | |
3298 Cust_tm_flexi_tpu_table_write(tm_return, | |
3299 prim->u.tm_table16.index, | |
3300 prim->str_len_in_bytes - 1, // subtract 8-bit index | |
3301 prim->u.tm_table16.table); | |
3302 } | |
3303 | |
3304 /******************************************************************* | |
3305 * l1tm_flexi_tpu_table_read | |
3306 * | |
3307 * DESCRIPTION: The function would be called by the switch case in the etm_rf. | |
3308 *******************************************************************/ | |
3309 void l1tm_flexi_tpu_table_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return) | |
3310 { | |
3311 Cust_tm_flexi_tpu_table_read(tm_return, prim->u.tm_table16.index); | |
3312 } | |
3313 | |
3314 //Flexi ABB Delays | |
3315 /******************************************************************* | |
3316 * l1tm_flexi_abb_write | |
3317 * | |
3318 * DESCRIPTION: The function would be called by the switch case in the etm_rf. | |
3319 *******************************************************************/ | |
3320 void l1tm_flexi_abb_write(T_TESTMODE_PRIM * prim, T_TM_RETURN * tm_return) | |
3321 { | |
3322 Cust_tm_flexi_abb_write(tm_return, | |
3323 prim->u.tm_table16.index, | |
3324 prim->str_len_in_bytes - 1, // subtract 8-bit index | |
3325 prim->u.tm_table16.table); | |
3326 } | |
3327 | |
3328 /******************************************************************* | |
3329 * l1tm_flexi_abb_read | |
3330 * | |
3331 * DESCRIPTION: The function would be called by the switch case in the etm_rf. | |
3332 *******************************************************************/ | |
3333 void l1tm_flexi_abb_read (T_TESTMODE_PRIM *prim, T_TM_RETURN *tm_return) | |
3334 { | |
3335 Cust_tm_flexi_abb_read(tm_return, prim->u.tm_table16.index); | |
3336 } | |
3337 | |
3338 | |
3339 | |
3340 #endif // Flexible TPU | |
3341 | 2851 |
3342 /*------------------------------------------------------------------*/ | 2852 /*------------------------------------------------------------------*/ |
3343 /* l1tm_PRBS1_generate() */ | 2853 /* l1tm_PRBS1_generate() */ |
3344 /*------------------------------------------------------------------*/ | 2854 /*------------------------------------------------------------------*/ |
3345 /* */ | 2855 /* */ |