43 #define CPU_CORE_MODULE
95 #ifndef CPU_CFG_LEAD_ZEROS_ASM_PRESENT
96 static const CPU_INT08U CPU_CntLeadZerosTbl[256] = {
97 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
98 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
99 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
102 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
103 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
104 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
108 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
131 #if (CPU_CFG_NAME_EN == DEF_ENABLED)
132 static void CPU_NameInit (
void);
137 #if ((CPU_CFG_TS_TMR_EN == DEF_ENABLED) || \
138 (CPU_CFG_TS_EN == DEF_ENABLED))
142 #if (CPU_CFG_TS_EN == DEF_ENABLED)
148 #ifdef CPU_CFG_INT_DIS_MEAS_EN
149 static void CPU_IntDisMeasInit (
void);
151 static CPU_TS CPU_IntDisMeasMaxCalc(
CPU_TS time_max_cnts_raw);
200 #if ((CPU_CFG_TS_TMR_EN == DEF_ENABLED) || \
201 (CPU_CFG_TS_EN == DEF_ENABLED))
205 #ifdef CPU_CFG_INT_DIS_MEAS_EN
206 CPU_IntDisMeasInit();
210 #if (CPU_CFG_NAME_EN == DEF_ENABLED)
237 #if (CPU_CFG_NAME_EN == DEF_ENABLED)
238 void CPU_NameClr (
void)
282 #if (CPU_CFG_NAME_EN == DEF_ENABLED)
331 #if (CPU_CFG_NAME_EN == DEF_ENABLED)
408 #if (CPU_CFG_TS_EN == DEF_ENABLED)
462 #if (CPU_CFG_TS_EN == DEF_ENABLED)
499 #if (CPU_CFG_TS_EN == DEF_ENABLED)
532 #ifdef CPU_CFG_INT_DIS_MEAS_EN
533 CPU_TS CPU_IntDisMeasMaxCurReset (
void)
539 time_max_cnts = CPU_IntDisMeasMaxCurGet();
541 CPU_IntDisMeasMaxCurRaw_cnts = 0;
544 return (time_max_cnts);
574 #ifdef CPU_CFG_INT_DIS_MEAS_EN
575 CPU_TS CPU_IntDisMeasMaxCurGet (
void)
583 time_max_cnts_raw = CPU_IntDisMeasMaxCurRaw_cnts;
585 time_max_cnts = CPU_IntDisMeasMaxCalc(time_max_cnts_raw);
587 return (time_max_cnts);
617 #ifdef CPU_CFG_INT_DIS_MEAS_EN
618 CPU_TS CPU_IntDisMeasMaxGet (
void)
626 time_max_cnts_raw = CPU_IntDisMeasMaxRaw_cnts;
628 time_max_cnts = CPU_IntDisMeasMaxCalc(time_max_cnts_raw);
630 return (time_max_cnts);
655 #ifdef CPU_CFG_INT_DIS_MEAS_EN
656 void CPU_IntDisMeasStart (
void)
658 if (CPU_IntDisNestCtr == 0) {
849 #ifdef CPU_CFG_INT_DIS_MEAS_EN
850 void CPU_IntDisMeasStop (
void)
852 CPU_TS time_ints_disd_cnts;
856 if (CPU_IntDisNestCtr == 0) {
859 time_ints_disd_cnts = CPU_IntDisMeasStopRaw_cnts -
860 CPU_IntDisMeasStartRaw_cnts;
862 if (CPU_IntDisMeasMaxCurRaw_cnts < time_ints_disd_cnts) {
863 CPU_IntDisMeasMaxCurRaw_cnts = time_ints_disd_cnts;
865 if (CPU_IntDisMeasMaxRaw_cnts < time_ints_disd_cnts) {
866 CPU_IntDisMeasMaxRaw_cnts = time_ints_disd_cnts;
951 #ifndef CPU_CFG_LEAD_ZEROS_ASM_PRESENT
961 #if (CPU_CFG_DATA_SIZE == CPU_WORD_SIZE_08)
964 nbr_lead_zeros_msb = 0;
967 #elif (CPU_CFG_DATA_SIZE == CPU_WORD_SIZE_16)
970 nbr_lead_zeros_msb = 0;
974 nbr_lead_zeros_msb = 8;
978 #elif (CPU_CFG_DATA_SIZE == CPU_WORD_SIZE_32)
979 if (val > 0x0000FFFFL) {
980 if (val > 0x00FFFFFFL) {
982 nbr_lead_zeros_msb = 0;
986 nbr_lead_zeros_msb = 8;
990 if (val > 0x000000FFL) {
992 nbr_lead_zeros_msb = 16;
996 nbr_lead_zeros_msb = 24;
1008 nbr_lead_zeros_tbl = (
CPU_DATA ) CPU_CntLeadZerosTbl[ix];
1009 nbr_lead_zeros_tot = (
CPU_DATA ) nbr_lead_zeros_msb +
1013 return (nbr_lead_zeros_tot);
1043 #if (CPU_CFG_NAME_EN == DEF_ENABLED)
1044 static void CPU_NameInit (
void)
1075 #if ((CPU_CFG_TS_TMR_EN == DEF_ENABLED) || \
1076 (CPU_CFG_TS_EN == DEF_ENABLED))
1079 #if (CPU_CFG_TS_TMR_EN == DEF_ENABLED)
1083 #if (CPU_CFG_TS_EN == DEF_ENABLED)
1121 #if (CPU_CFG_TS_EN == DEF_ENABLED)
1143 CPU_TS_Prev = ts_cur;
1149 if (p_ts_lo != (
CPU_TS *)0) {
1150 *p_ts_lo = (
CPU_TS )ts_lo;
1152 if (p_ts_hi != (
CPU_TS *)0) {
1153 *p_ts_hi = (
CPU_TS )ts_hi;
1198 #ifdef CPU_CFG_INT_DIS_MEAS_EN
1199 static void CPU_IntDisMeasInit (
void)
1201 CPU_TS time_meas_tot_cnts;
1206 CPU_IntDisNestCtr = 0;
1207 CPU_IntDisMeasStartRaw_cnts = 0;
1208 CPU_IntDisMeasStopRaw_cnts = 0;
1209 CPU_IntDisMeasMaxCurRaw_cnts = 0;
1210 CPU_IntDisMeasMaxRaw_cnts = 0;
1211 CPU_IntDisMeasOvrhdRaw_cnts = 0;
1214 time_meas_tot_cnts = 0;
1217 CPU_IntDisMeasMaxCurRaw_cnts = 0;
1218 CPU_IntDisMeasStart();
1219 CPU_IntDisMeasStop();
1220 time_meas_tot_cnts += CPU_IntDisMeasMaxCurRaw_cnts;
1223 CPU_IntDisMeasOvrhdRaw_cnts = (time_meas_tot_cnts + (CPU_CFG_INT_DIS_MEAS_OVRHD_NBR / 2))
1225 CPU_IntDisMeasMaxCurRaw_cnts = 0;
1226 CPU_IntDisMeasMaxRaw_cnts = 0;
1341 #ifdef CPU_CFG_INT_DIS_MEAS_EN
1342 static CPU_TS CPU_IntDisMeasMaxCalc (
CPU_TS time_max_cnts_raw)
1347 time_max_cnts = time_max_cnts_raw;
1348 if (time_max_cnts > CPU_IntDisMeasOvrhdRaw_cnts) {
1349 time_max_cnts -= CPU_IntDisMeasOvrhdRaw_cnts;
1356 return (time_max_cnts);