omit redundant code.

This commit is contained in:
Gatsby Van
2023-12-26 21:20:55 +08:00
parent 9dabdf0984
commit 28e4428468
3 changed files with 29 additions and 98 deletions
@@ -50,34 +50,15 @@
// Pair by regex
// Regex: (([0-9]+, ){8})
uint16_t hopRxPattern_Config[L1_FRAME_MAX_HOPS] = {
0
};
uint16_t hopTxPattern_Config[L1_FRAME_MAX_HOPS] = {
uint16_t hopPattern_Config[L1_FRAME_MAX_HOPS] = {
0
};
uint16_t hopTxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] = {
1500
};
uint16_t hopRxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] = {
uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] = {
1500
};
//uint16_t hopTxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
// 0, 44, 88, 131, 175, 219, 263, 306,
// 350, 394, 438, 481, 525, 569, 613, 656,
// 700, 744, 788, 831, 875, 919, 963, 1006,
// 1050, 1094, 1138, 1181, 1225, 1269, 1313, 1356,
// 1400, 1444, 1488, 1531, 1575, 1619, 1663, 1706,
// 1750, 1794, 1838, 1881, 1925, 1969, 2013, 2056,
// 2100, 2144, 2188, 2231, 2275, 2319, 2363, 2406,
// 2450, 2494, 2538, 2581, 2625, 2669, 2713, 2756,
// 2800, 2844, 2888, 2931, 2975, 3019, 3063, 3106,
// 3150, 3194, 3238, 3281, 3325, 3369, 3413, 3456,
// 3500
//};
//uint16_t hopRxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
//uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
// 0, 44, 88, 131, 175, 219, 263, 306,
// 350, 394, 438, 481, 525, 569, 613, 656,
// 700, 744, 788, 831, 875, 919, 963, 1006,
@@ -91,66 +72,35 @@ uint16_t hopRxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] = {
// 3500
//};
uint16_t hopTxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
1500
};
uint16_t hopRxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = {
1500
};
uint16_t hopTxPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] = {
1500
};
uint16_t hopRxPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] = {
uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] = {
1500
};
uint16_t hopTxPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] = {
1500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
1700, 1800, 1900
};
uint16_t hopRxPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] = {
uint16_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] = {
1500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
1700, 1800, 1900
};
uint16_t hopTxPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] = {
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
2400, 2400, 2400
};
uint16_t hopRxPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] = {
uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] = {
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
2400, 2400, 2400
};
uint16_t hopTxPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] = {
uint16_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] = {
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
2400
};
uint16_t hopRxPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] = {
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
2400
};
uint16_t hopTxPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] ={
uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] ={
500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
1700, 1800, 1900, 2000, 1500, 1600, 1700, 1800,
1900, 2000, 1500, 1500
};
uint16_t hopRxPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] = {
1500, 1900, 2000, 1500, 1600, 1700, 1800, 1900,
2000, 1500, 1600, 1700, 1800, 1900, 2000, 1500,
1500, 1500, 1700, 1800
};
uint16_t hopTxPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] = {
500, 600, 700, 800, 900, 1000, 500, 600,
700, 800, 900, 1000, 500, 600, 700, 800,
900, 1000, 500, 500
};
uint16_t hopRxPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] = {
uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] = {
500, 600, 700, 800, 900, 1000, 500, 600,
700, 800, 900, 1000, 500, 600, 700, 800,
900, 1000, 500, 500
@@ -49,16 +49,6 @@
#define L1_FRAME_200KBPS_5MS_LEN (2048/8)// byte
#define L1_FRAME_1M2BPS_5MS_LEN (8184/8)// byte
//#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns
//#define L1_FRAME_2KBPS_20MS_COMP 282900 // *10ns
//#define L1_FRAME_2KBPS_100MS_COMP 282900 // *10ns
//#define L1_FRAME_10KBPS_10MS_COMP 282900 // *10ns
//#define L1_FRAME_10KBPS_20MS_COMP 282900 // *10ns
//#define L1_FRAME_40KBPS_20MS_COMP 282900 // *10ns
//#define L1_FRAME_40KBPS_10MS_COMP 282900 // *10ns
//#define L1_FRAME_200KBPS_5MS_COMP 17067 // *10ns
//#define L1_FRAME_1M2BPS_5MS_COMP 282900 // *10ns
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns
#define L1_FRAME_2KBPS_20MS_COMP 1622400 // *10ns
#define L1_FRAME_2KBPS_100MS_COMP 1622400 // *10ns
@@ -588,7 +578,7 @@ int32_t Phy_SetupNextSlot(PHY_INST* instPtr, PHY_TOR_TYPE txrxMode,
return EPARAM;
}
if (instPtr->isPresetHop == false) {
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_Config : hopRxPattern_Config;
hopPattern = hopPattern_Config;
}
else {
switch (frameType) {
@@ -596,43 +586,43 @@ int32_t Phy_SetupNextSlot(PHY_INST* instPtr, PHY_TOR_TYPE txrxMode,
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_20MS;
hopNum = L1_FRAME_2KBPS_20MS_HOPS;
// FIXME: For DUIFEI net setup.
// hopPattern = (txrxMode == TOR_TX) ? hopTxPattern_2KBPS_20MS : hopRxPattern_2KBPS_20MS;
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_2KBPS_100MS : hopRxPattern_2KBPS_100MS;
// hopPattern = (txrxMode == TOR_TX) ? hopPattern_2KBPS_20MS;
hopPattern = hopPattern_2KBPS_100MS;
break;
case L1_2KBPS_100MS_FRAME:
phyModeCtrl |= PHY_MODE_CTRL_FRAME_2KBPS_100MS;
hopNum = L1_FRAME_2KBPS_100MS_HOPS;
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_2KBPS_100MS : hopRxPattern_2KBPS_100MS;
hopPattern = hopPattern_2KBPS_100MS;
break;
case L1_10KBPS_10MS_FRAME:
phyModeCtrl |= PHY_MODE_CTRL_FRAME_10KBPS_10MS;
hopNum = L1_FRAME_10KBPS_10MS_HOPS;
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_10KBPS_10MS : hopRxPattern_10KBPS_10MS;
hopPattern = hopPattern_10KBPS_10MS;
break;
case L1_10KBPS_20MS_FRAME:
phyModeCtrl |= PHY_MODE_CTRL_FRAME_10KBPS_20MS;
hopNum = L1_FRAME_10KBPS_20MS_HOPS;
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_10KBPS_20MS : hopRxPattern_10KBPS_20MS;
hopPattern = hopPattern_10KBPS_20MS;
break;
case L1_40KBPS_20MS_FRAME:
phyModeCtrl |= PHY_MODE_CTRL_FRAME_200KBPS_5MS;
hopNum = L1_FRAME_200KBPS_5MS_HOPS;
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_200KBPS_5MS : hopRxPattern_200KBPS_5MS;
hopPattern = hopPattern_200KBPS_5MS;
break;
case L1_40KBPS_10MS_FRAME:
phyModeCtrl |= PHY_MODE_CTRL_FRAME_40KBPS_10MS;
hopNum = L1_FRAME_40KBPS_10MS_HOPS;
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_40KBPS_10MS : hopRxPattern_40KBPS_10MS;
hopPattern = hopPattern_40KBPS_10MS;
break;
case L1_200KBPS_5MS_FRAME:
phyModeCtrl |= PHY_MODE_CTRL_FRAME_200KBPS_5MS;
hopNum = L1_FRAME_200KBPS_5MS_HOPS;
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_200KBPS_5MS : hopRxPattern_200KBPS_5MS;
hopPattern = hopPattern_200KBPS_5MS;
break;
case L1_1M2BPS_5MS_FRAME:
phyModeCtrl |= PHY_MODE_CTRL_FRAME_1M2BPS_5MS;
hopNum = L1_FRAME_1M2BPS_5MS_HOPS;
hopPattern = (txrxMode == PHY_TOR_TX) ? hopTxPattern_1M2BPS_5MS : hopRxPattern_1M2BPS_5MS;
hopPattern = hopPattern_1M2BPS_5MS;
break;
default:
return EPARAM;
@@ -191,24 +191,15 @@ typedef struct {
} PHY_INST;
/************************** Variable Definitions *****************************/
extern uint16_t hopRxPattern_Config[L1_FRAME_MAX_HOPS];
extern uint16_t hopTxPattern_Config[L1_FRAME_MAX_HOPS];
extern uint16_t hopTxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
extern uint16_t hopRxPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
extern uint16_t hopTxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
extern uint16_t hopRxPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
extern uint16_t hopTxPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
extern uint16_t hopRxPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
extern uint16_t hopTxPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
extern uint16_t hopRxPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
extern uint16_t hopTxPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS];
extern uint16_t hopRxPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS];
extern uint16_t hopTxPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
extern uint16_t hopRxPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
extern uint16_t hopTxPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
extern uint16_t hopRxPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
extern uint16_t hopTxPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
extern uint16_t hopRxPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
extern uint16_t hopPattern_Config[L1_FRAME_MAX_HOPS];
extern uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
extern uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
extern uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
extern uint16_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
extern uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS];
extern uint16_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
extern uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
extern uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
extern PHY_ANT_ANGLE antSubnrrwPattern[L1_NUM_ANT_SUBNRRW_PATTERN];
extern PHY_ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN];