Compare commits

...
3 Commits
Author SHA1 Message Date
Gatsby Van 07795a2b20 add power mode switch 2024-07-05 11:27:08 +08:00
Gatsby Van 21d3baec98 misc update 2024-07-05 11:26:51 +08:00
Gatsby Van ad0d589141 20240429: physical layer update. 2024-04-29 14:20:12 +08:00
7 changed files with 435 additions and 303 deletions
+172 -135
View File
@@ -28,42 +28,47 @@
#define CTRL_WORD_DEFAULT 0x00 #define CTRL_WORD_DEFAULT 0x00
#define ANT_MODE_BEAM_MASK 0xF0 #define ANT_MODE_BEAM_MASK 0xF0
#define ANT_MODE_NARROR_BEAM 0x00 // 8 #define ANT_BEAM_NARROR 0x00 // 8
#define ANT_MODE_WIDE_BEAM_1 0x10 // 25 #define ANT_BEAM_SUBNARROR_0 0x10 // 25
#define ANT_MODE_WIDE_BEAM_2 0x20 // 60 #define ANT_BEAM_SUBNARROR_1 0x20 // 60
#define ANT_MODE_WIDE_BEAM_3 0x30 // 120 #define ANT_BEAM_WIDE 0x30 // 120
#define ANT_MODE_HIGH_POWER 0x00 #define ANT_MODE_POWER_MASK 0x0F
#define ANT_MODE_LOWAPOWER 0x04 #define ANT_POWER_FULL 0x00
#define ANT_MODE_STANDBY 0x0F #define ANT_POWER_LOW 0x04
#define ATN_MODE_DEFAULT (ANT_MODE_WIDE_BEAM_1 | ANT_MODE_LOWAPOWER) #define ANT_POWER_STANDBY 0x0F
#define ATN_MODE_HIGH (ANT_MODE_WIDE_BEAM_1 | ANT_MODE_HIGH_POWER) #define ATN_MODE_SILENT (ANT_BEAM_SUBNARROR_0 | ANT_POWER_STANDBY)
#define ATN_MODE_LOWPOWER (ANT_BEAM_SUBNARROR_0 | ANT_POWER_LOW)
#define ATN_MODE_FULLPOWER (ANT_BEAM_SUBNARROR_0 | ANT_POWER_FULL)
#define ATN_MODE_DEFAULT ATN_MODE_SILENT
#define DEFAULT_CENTRTAL_FREQ 0x06D7 // 26.25GHz #define ATN_ATTENUATION_MAX 0x1F
#define ATN_ATTENUATION_SKIP 0xFF
#define RXTXMODE_RX 0x00 #define DEFAULT_CARRIER_FREQ 0x06D7 // 26.25GHz
#define RXTXMODE_TX 0x01
#define RXTXMODE_DEFAULT 0x00 #define TORMODE_RX 0x00
#define TORMODE_TX 0x01
#define TORMODE_DEFAULT 0x00
#define CALIBRMODE_NORMAL 0x00 #define CALIMODE_NORMAL 0x00
#define CALIBRMODE_SINGLE_TR_CAL 0x01 #define CALIMODE_SINGLE_TR_CAL 0x01
#define MODECTRL_DEFAULT 0x00 #define RF_CTRL_DEFAULT 0x00
// Pair by regex // Pair by regex
// Regex: (([0-9]+, ){8}) // Regex: (([0-9]+, ){8})
uint16_t hopPattern_Config[L1_FRAME_MAX_HOPS] = uint16_t hopPattern_Config[L1_FRAME_MAX_HOPS] =
{ {
0 0
}; };
uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] = uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] =
{ {
1500 1500
}; };
uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] = uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] =
{ {
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
@@ -78,104 +83,47 @@ uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] =
2400 2400
}; };
uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] = uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] =
{ {
1500 1500
}; };
uint16_t hopPattern_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, 1500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
1700, 1800, 1900 1700, 1800, 1900
}; };
uint16_t hopPattern_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, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
2400 2400
}; };
uint16_t hopPattern_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, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400, 2400,
2400, 2400, 2400 2400, 2400, 2400
}; };
uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] = uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] =
{ {
1500, 1600, 1700, 1800, 1900, 2000, 1500, 1600, 1500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
1700, 1800, 1900, 2000, 1500, 1600, 1700, 1800, 1700, 1800, 1900, 2000, 1500, 1600, 1700, 1800,
1900, 2000, 1500, 1500 1900, 2000, 1500, 1500
}; };
uint16_t hopPattern_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 , 500 , 600 , 700 , 800 , 900 , 1000, 500 , 600 ,
700 , 800 , 900 , 1000, 500 , 600 , 700 , 800 , 700 , 800 , 900 , 1000, 500 , 600 , 700 , 800 ,
900 , 1000, 500 , 500 900 , 1000, 500 , 500
}; };
// Pair by regex // Pair by regex
// Regex: ((\{\.oaxis = [0-9]+[ ,]+\.raxis = [0-9]+[ ]*\}, ){2}) // Regex: ((\{\.oaxis = [0-9]+[ ,]+\.raxis = [0-9]+[ ]*\}, ){2})
#if defined(PHY_BEAM_SET_PRESET) #if defined(PHY_BEAM_SET_PRESET)
PHY_ANT_ANGLE antSubnrrwPattern[L1_NUM_ANT_SUBNRRW_PATTERN] =
{
{.oaxis = 0 , .raxis = 222}, {.oaxis = 10, .raxis = 85 },
{.oaxis = 14, .raxis = 307}, {.oaxis = 17, .raxis = 170},
{.oaxis = 19, .raxis = 32 }, {.oaxis = 21, .raxis = 255},
{.oaxis = 24, .raxis = 117}, {.oaxis = 25, .raxis = 340},
{.oaxis = 27, .raxis = 202}, {.oaxis = 29, .raxis = 65 },
{.oaxis = 31, .raxis = 287}, {.oaxis = 32, .raxis = 150},
{.oaxis = 34, .raxis = 12 }, {.oaxis = 35, .raxis = 235},
{.oaxis = 36, .raxis = 97 }, {.oaxis = 38, .raxis = 320},
{.oaxis = 39, .raxis = 182}, {.oaxis = 40, .raxis = 45 },
{.oaxis = 41, .raxis = 267}, {.oaxis = 43, .raxis = 130},
{.oaxis = 44, .raxis = 352}, {.oaxis = 45, .raxis = 215},
{.oaxis = 46, .raxis = 77 }, {.oaxis = 47, .raxis = 300},
{.oaxis = 48, .raxis = 162}, {.oaxis = 49, .raxis = 25 },
{.oaxis = 50, .raxis = 247}, {.oaxis = 51, .raxis = 110},
{.oaxis = 52, .raxis = 332}, {.oaxis = 53, .raxis = 195},
{.oaxis = 54, .raxis = 57 }, {.oaxis = 55, .raxis = 280},
{.oaxis = 56, .raxis = 142}, {.oaxis = 57, .raxis = 5 },
{.oaxis = 58, .raxis = 227}, {.oaxis = 59, .raxis = 90 },
{.oaxis = 60, .raxis = 312}
};
PHY_ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN] =
{
{.oaxis = 0 , .raxis = 222}, {.oaxis = 7 , .raxis = 85 },
{.oaxis = 10, .raxis = 307}, {.oaxis = 13, .raxis = 170},
{.oaxis = 15, .raxis = 32 }, {.oaxis = 17, .raxis = 255},
{.oaxis = 18, .raxis = 117}, {.oaxis = 20, .raxis = 340},
{.oaxis = 21, .raxis = 202}, {.oaxis = 22, .raxis = 65 },
{.oaxis = 24, .raxis = 287}, {.oaxis = 25, .raxis = 150},
{.oaxis = 26, .raxis = 12 }, {.oaxis = 27, .raxis = 235},
{.oaxis = 28, .raxis = 97 }, {.oaxis = 29, .raxis = 320},
{.oaxis = 30, .raxis = 182}, {.oaxis = 31, .raxis = 45 },
{.oaxis = 32, .raxis = 267}, {.oaxis = 33, .raxis = 130},
{.oaxis = 34, .raxis = 352}, {.oaxis = 34, .raxis = 215},
{.oaxis = 35, .raxis = 77 }, {.oaxis = 36, .raxis = 300},
{.oaxis = 37, .raxis = 162}, {.oaxis = 38, .raxis = 25 },
{.oaxis = 38, .raxis = 247}, {.oaxis = 39, .raxis = 110},
{.oaxis = 40, .raxis = 332}, {.oaxis = 41, .raxis = 195},
{.oaxis = 41, .raxis = 57 }, {.oaxis = 42, .raxis = 280},
{.oaxis = 43, .raxis = 142}, {.oaxis = 44, .raxis = 5 },
{.oaxis = 44, .raxis = 227}, {.oaxis = 45, .raxis = 90 },
{.oaxis = 46, .raxis = 312}, {.oaxis = 46, .raxis = 175},
{.oaxis = 47, .raxis = 37 }, {.oaxis = 48, .raxis = 260},
{.oaxis = 48, .raxis = 122}, {.oaxis = 49, .raxis = 345},
{.oaxis = 49, .raxis = 207}, {.oaxis = 50, .raxis = 70 },
{.oaxis = 51, .raxis = 292}, {.oaxis = 51, .raxis = 155},
{.oaxis = 52, .raxis = 17 }, {.oaxis = 53, .raxis = 240},
{.oaxis = 53, .raxis = 102}, {.oaxis = 54, .raxis = 325},
{.oaxis = 54, .raxis = 187}, {.oaxis = 55, .raxis = 50 },
{.oaxis = 55, .raxis = 272}, {.oaxis = 56, .raxis = 135},
{.oaxis = 57, .raxis = 357}, {.oaxis = 57, .raxis = 220},
{.oaxis = 58, .raxis = 82 }, {.oaxis = 58, .raxis = 305},
{.oaxis = 59, .raxis = 167}, {.oaxis = 59, .raxis = 30 },
{.oaxis = 60, .raxis = 252}
};
#elif defined(PHY_BEAM_SET_PRESET_LSX)
ANT_ANGLE antSubnrrwPattern[L1_NUM_ANT_SUBNRRW_PATTERN] = { ANT_ANGLE antSubnrrwPattern[L1_NUM_ANT_SUBNRRW_PATTERN] = {
{.oaxis = 0 , .raxis =2225},{.oaxis = 96 , .raxis =850 }, {.oaxis = 0 , .raxis =2225},{.oaxis = 96 , .raxis =850 },
{.oaxis = 135, .raxis =3075},{.oaxis = 166, .raxis =1700}, {.oaxis = 135, .raxis =3075},{.oaxis = 166, .raxis =1700},
@@ -231,11 +179,11 @@ ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN] = {
{.oaxis = 600, .raxis =2520} {.oaxis = 600, .raxis =2520}
}; };
#else #else
PHY_ANT_ANGLE antSubnrrwPattern[L1_NUM_ANT_SUBNRRW_PATTERN] = PHY_ANT_ANGLE antSubnrrwPattern[L1_NUM_ANT_SUBNRRW_PATTERN] =
{ {
0 0
}; };
PHY_ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN] = PHY_ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN] =
{ {
0 0
}; };
@@ -252,14 +200,8 @@ PHY_ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN] =
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig) void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
{ {
ASSERT(antConfig != NULL); ASSERT(antConfig != NULL);
antConfig->head = ANT_COINFO_HEAD; antConfig->ctrlWord = CTRL_WORD_DEFAULT;
antConfig->tail = ANT_COINFO_TAIL;
antConfig->ctrlWord = 0x00;
#ifdef ANT_HIGH_POWER
antConfig->antMode = ATN_MODE_HIGH;
#else
antConfig->antMode = ATN_MODE_DEFAULT; antConfig->antMode = ATN_MODE_DEFAULT;
#endif
// FIXME: Dummy default value. // FIXME: Dummy default value.
// off axis angle setting // off axis angle setting
@@ -268,52 +210,120 @@ void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
// round axis angle setting // round axis angle setting
antConfig->raxis[0] = 0; antConfig->raxis[0] = 0;
antConfig->raxis[1] = 0; antConfig->raxis[1] = 0;
// ***********************
antConfig->antFreq[0] = (uint8_t)(DEFAULT_CENTRTAL_FREQ); antConfig->antFreq[0] = (uint8_t)(DEFAULT_CARRIER_FREQ);
antConfig->antFreq[1] = (uint8_t)(DEFAULT_CENTRTAL_FREQ >> 8); antConfig->antFreq[1] = (uint8_t)(DEFAULT_CARRIER_FREQ >> 8);
// FIXME: Dummy default value. // FIXME: Dummy default value.
// trSelect // trSelect
antConfig->trSlect = 0; antConfig->trSelect = 0;
// Antenna attenuation setting // Antenna attenuation setting
antConfig->antAtt = 20; antConfig->antAtt = 20;
// phase setting // phase setting
antConfig->phase = 0; antConfig->phase = 0;
antConfig->torMode = TORMODE_DEFAULT;
antConfig->caliMode = CALIMODE_NORMAL;
antConfig->antReserved = 0x00;
// *********************** // ***********************
antConfig->rxtxMode = RXTXMODE_RX;
antConfig->calibrMode = CALIBRMODE_NORMAL;
// FIXME: Dummy default value. // FIXME: Dummy default value.
// DD enable
antConfig->ddEn = 0;
// DD mgc
antConfig->ddMgc = 0;
// RF mode control // RF mode control
antConfig->rfCtrl = 0; antConfig->rfCtrl = RF_CTRL_DEFAULT;
// RF frequency
antConfig->rfFreq[0] = (uint8_t)(DEFAULT_CARRIER_FREQ);
antConfig->rfFreq[1] = (uint8_t)(DEFAULT_CARRIER_FREQ >> 8);
// RF MGC control // RF MGC control
antConfig->rfMgc = 0; antConfig->rfTxMgc = 0;
// RF channel 1&2 calibration mgc // RF channel 1&2 calibration mgc
antConfig->rf12CalMgc = 0; antConfig->rf12CalMgc = 0;
// RF channel 2&3 calibration mgc // RF channel 2&3 calibration mgc
antConfig->rf34CalMgc = 0; antConfig->rf34CalMgc = 0;
// Receive channel 1 MGC // Receive channel 1-4 MGC
antConfig->rcv1Mgc = 0; antConfig->rfRxMgc = 0;
// Receive channel 2 MGC antConfig->rfReserved0 = 0x00;
antConfig->rcv2Mgc = 0; antConfig->rfReserved1 = 0x00;
// Receive channel 3 MGC
antConfig->rcv3Mgc = 0;
// Receive channel 4 MGC
antConfig->rcv4Mgc = 0;
// ***********************
memset(antConfig->dummy, 0x00, sizeof(antConfig->dummy));
} }
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo) /*****************************************************************************/
/**
* @brief Update antenna power mode setting
*
* @param instPtr pointer to physical layer instance
* @param mode new antenna mode
*
* @return None.
*
******************************************************************************/
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
{ {
if (instPtr->beamWd.next == PHY_ANT_BEAM_8) ASSERT(instPtr != NULL);
uint8_t config = instPtr->antConfig.antMode & ANT_MODE_BEAM_MASK;
switch (mode)
{
case PHY_ANT_MODE_STANDBY:
config |= ANT_POWER_STANDBY;
break;
case PHY_ANT_MODE_POWER_LOW:
config |= ANT_POWER_LOW;
break;
case PHY_ANT_MODE_POWER_FULL:
config |= ANT_POWER_FULL;
break;
default:
DBG_ERROR("Unknown antenna mode: %" PRIu8 ", remain previous mode.\n", mode);
return;
}
instPtr->antConfig.antMode = config;
}
/*****************************************************************************/
/**
* @brief Update antenna attenuation
*
* @param instPtr pointer to physical layer instance
* @param rxAtt rx attenuation
* @param txAtt tx attenuation
*
* @return None.
*
******************************************************************************/
void Phy_AntConfigAttenuation(PHY_INST *instPtr, uint8_t rxAtt, uint8_t txAtt)
{
ASSERT(instPtr != NULL);
if(rxAtt <= ATN_ATTENUATION_MAX)
{
instPtr->antConfig.rfRxMgc = rxAtt;
}
else if(rxAtt != ATN_ATTENUATION_SKIP)
{
DBG_ERROR("RX Attenuation exceeds range, %u.", rxAtt);
}
if(txAtt <= ATN_ATTENUATION_MAX)
{
instPtr->antConfig.rfTxMgc = txAtt;
}
else if(txAtt != ATN_ATTENUATION_SKIP)
{
DBG_ERROR("TX Attenuation exceeds range, %u.", txAtt);
}
}
/*****************************************************************************/
/**
* @brief Update antenna point direction using predefined beam table
*
* @param instPtr pointer to physical layer instance
* @param beamNo new beam index
*
* @return SUCCESS.
* FAILURE beamNo exceeds the table size
*
******************************************************************************/
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo, PHY_ANT_BEAM_WIDTH beamWidth)
{
if (beamWidth == PHY_ANT_BEAM_16)
{ {
if (beamNo >= L1_NUM_ANT_NRRW_PATTERN) if (beamNo >= L1_NUM_ANT_NRRW_PATTERN)
{ {
@@ -329,7 +339,7 @@ int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
return SUCCESS; return SUCCESS;
} }
} }
else if (instPtr->beamWd.next == PHY_ANT_BEAM_25) else if (beamWidth == PHY_ANT_BEAM_25)
{ {
if (beamNo >= L1_NUM_ANT_SUBNRRW_PATTERN) if (beamNo >= L1_NUM_ANT_SUBNRRW_PATTERN)
{ {
@@ -345,7 +355,7 @@ int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
return SUCCESS; return SUCCESS;
} }
} }
else else if(beamWidth == PHY_ANT_BEAM_120)
{ {
// Beam number assign not support. // Beam number assign not support.
// Assign default angle (0,0) // Assign default angle (0,0)
@@ -357,27 +367,42 @@ int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
DBG_WARNING("Using default beam number...\n"); DBG_WARNING("Using default beam number...\n");
return SUCCESS; return SUCCESS;
} }
else
{
return FAILURE;
}
} }
/*****************************************************************************/
/**
* @brief Update antenna beam width setting
*
* @param instPtr pointer to physical layer instance
* @param beamWidth new beam width
*
* @return SUCCESS.
* EPARAM
*
******************************************************************************/
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth) int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
{ {
uint8_t beamConfig = instPtr->antConfig.antMode & (~ANT_MODE_BEAM_MASK); uint8_t beamConfig = instPtr->antConfig.antMode & (~ANT_MODE_BEAM_MASK);
switch (beamWidth) switch (beamWidth)
{ {
case PHY_ANT_BEAM_120: case PHY_ANT_BEAM_120:
beamConfig |= ANT_MODE_WIDE_BEAM_3; beamConfig |= ANT_BEAM_WIDE;
break; break;
case PHY_ANT_BEAM_60: case PHY_ANT_BEAM_60:
beamConfig |= ANT_MODE_WIDE_BEAM_2; beamConfig |= ANT_BEAM_SUBNARROR_1;
break; break;
case PHY_ANT_BEAM_25: case PHY_ANT_BEAM_25:
beamConfig |= ANT_MODE_WIDE_BEAM_1; beamConfig |= ANT_BEAM_SUBNARROR_0;
break; break;
case PHY_ANT_BEAM_8: case PHY_ANT_BEAM_16:
beamConfig |= ANT_MODE_NARROR_BEAM; beamConfig |= ANT_BEAM_NARROR;
break; break;
default: default:
DBG_ERROR("Beam width code: 0x%08X is illegal.\n\r", beamWidth); DBG_ERROR("Beam width code: 0x%08X is illegal.\n", beamWidth);
return EPARAM; return EPARAM;
break; break;
} }
@@ -386,7 +411,19 @@ int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
return SUCCESS; return SUCCESS;
} }
// Common version radius double input
/*****************************************************************************/
/**
* @brief Set antenna to a specific direction
*
* @param instPtr pointer to physical layer instance
* @param offAx elevation angle
* @param rndAx azimuth angle
*
* @return SUCCESS.
* EPARAM - the direction is exceeds predefined range
*
******************************************************************************/
int32_t Phy_SetBeamAngle(PHY_INST *instPtr, double offAx, double rndAx) int32_t Phy_SetBeamAngle(PHY_INST *instPtr, double offAx, double rndAx)
{ {
uint16_t offAxDeg = 0; uint16_t offAxDeg = 0;
+29 -18
View File
@@ -51,6 +51,7 @@
#define L1_FRAME_200KBPS_5MS_COMP 22493 // *10ns(Timer_L) #define L1_FRAME_200KBPS_5MS_COMP 22493 // *10ns(Timer_L)
#define L1_FRAME_1M2BPS_5MS_COMP 22493 // *10ns(Timer_L) #define L1_FRAME_1M2BPS_5MS_COMP 22493 // *10ns(Timer_L)
#define ANT_CONFIG_LEN 32 // bytes
#define L1_ANTCONFIG_MAX_LEN 8192 #define L1_ANTCONFIG_MAX_LEN 8192
/***************** Macros (Inline Functions) Definitions *********************/ /***************** Macros (Inline Functions) Definitions *********************/
@@ -61,7 +62,19 @@ static int32_t Phy_SetSendData(PHY_INST *instPtr, L1_FRAME_TYPE frameType, uint8
/**************************** Type Definitions *******************************/ /**************************** Type Definitions *******************************/
/************************** Variable Definitions *****************************/ /************************** Variable Definitions *****************************/
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_10MS[L1_FRAME_40KBPS_10MS_HOPS];
extern uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_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];
/*****************************************************************************/ /*****************************************************************************/
/** /**
* @brief Setup data will be sent in next slot. * @brief Setup data will be sent in next slot.
@@ -590,7 +603,7 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
default: default:
return EPARAM; return EPARAM;
} }
switch (frameType) switch (frameType)
{ {
case L1_2KBPS_20MS_FRAME: case L1_2KBPS_20MS_FRAME:
@@ -647,20 +660,18 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
uint8_t *dataSrcPtr = (uint8_t *)(&(instPtr->antConfig)); uint8_t *dataSrcPtr = (uint8_t *)(&(instPtr->antConfig));
for (int32_t i = 0; i < hopNum; i++) for (int32_t i = 0; i < hopNum; i++)
{ {
instPtr->antConfig.antFreq[1] = (uint8_t)(hopPattern[i] & 0x00FF); instPtr->antConfig.antFreq[1] = (uint8_t)hopPattern[i];
instPtr->antConfig.antFreq[0] = (uint8_t)((hopPattern[i] >> 8) & 0x00FF); instPtr->antConfig.antFreq[0] = (uint8_t)(hopPattern[i] >> 8);
instPtr->antConfig.rfFreq[1] = (uint8_t)hopPattern[i];
instPtr->antConfig.rfFreq[0] = (uint8_t)(hopPattern[i] >> 8);
memcpy((uint8_t *)(antConfigAddr + i * sizeof(PHY_ANT_CONFIG)), memcpy((uint8_t *)(antConfigAddr + i * sizeof(PHY_ANT_CONFIG)),
dataSrcPtr, sizeof(PHY_ANT_CONFIG)); dataSrcPtr, ANT_CONFIG_LEN);
} }
uint32_t antCtrl = (instPtr->antConfigOffset & ANT_CONFIG_OFFSET_MASK) | ((hopNum << ANT_CONFIG_NUM_SHIFT) & ANT_CONFIG_NUM_MASK) | ((sizeof(PHY_ANT_CONFIG) << ANT_CONFIG_LEN_SHIFT) & ANT_CONFIG_LEN_MASK); uint32_t antCtrl = (instPtr->antConfigOffset & ANT_CONFIG_OFFSET_MASK)
| ((hopNum << ANT_CONFIG_NUM_SHIFT) & ANT_CONFIG_NUM_MASK)
| ((ANT_CONFIG_LEN << ANT_CONFIG_LEN_SHIFT) & ANT_CONFIG_LEN_MASK);
/*
memcpy((uint8_t*)antConfigDataAddr, hopPattern, hopNum*sizeof(uint16_t));
uint32_t antCtrl = (instPtr->antCoinfigOffset & ANT_CONFIG_OFFSET_MASK)
| ((hopNum << ANT_CONFIG_NUM_SHIFT) & ANT_CONFIG_NUM_MASK)
| ((sizeof(uint16_t) << ANT_CONFIG_LEN_SHIFT) & ANT_CONFIG_LEN_MASK);
*/
PhyWrite(instPtr, ANT_CONFIG, antCtrl); PhyWrite(instPtr, ANT_CONFIG, antCtrl);
if (txrxMode == PHY_TOR_TX) if (txrxMode == PHY_TOR_TX)
@@ -674,8 +685,8 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
} }
// Trigger physical configuration. // Trigger physical configuration.
// Indicate physical layer that all the configurations were done. // Indicate physical layer that all the configurations were done.
PhyWrite(instPtr, SLOT_CMD, SLOT_CMD_KEY); PhyWrite(instPtr, SLOT_CMD, SLOT_CMD_KEY);
Phy_RcdShift(&(instPtr->tor), txrxMode); Phy_RcdShift(&(instPtr->tor), txrxMode);
Phy_RcdShift(&(instPtr->frameType), frameType); Phy_RcdShift(&(instPtr->frameType), frameType);
@@ -775,7 +786,7 @@ double Phy_GetFreqEst(PHY_INST *instPtr)
L1_FRAME_TYPE frameType; L1_FRAME_TYPE frameType;
double coarse, fine; double coarse, fine;
frameType = Phy_GetLastRecvFrameType(instPtr); frameType = Phy_GetLastRecvFrameType(instPtr);
if (frameType > L1_1M2BPS_5MS_FRAME || frameType <= L1_NONE_FRAME) if (frameType > L1_1M2BPS_5MS_FRAME || frameType <= L1_NONE_FRAME)
{ {
@@ -804,9 +815,9 @@ double Phy_GetFreqEst(PHY_INST *instPtr)
fine = 48e6/2048*((double)estAbs)/8192.0; fine = 48e6/2048*((double)estAbs)/8192.0;
} }
fine = ((fineReg & FINE_FREQEST_SIGN_MASK) == FINE_FREQEST_SIGN_NEG) ? fine = ((fineReg & FINE_FREQEST_SIGN_MASK) == FINE_FREQEST_SIGN_NEG) ?
-fine : fine; -fine : fine;
return (coarse + fine); return (coarse + fine);
} }
@@ -884,7 +895,7 @@ double Phy_GetFineFreqEst(PHY_INST *instPtr)
// 12M Rc // 12M Rc
freqEst = 48e6/2048*((double)estAbs)/8192.0; freqEst = 48e6/2048*((double)estAbs)/8192.0;
} }
freqEst = ((regValue & FINE_FREQEST_SIGN_MASK) == FINE_FREQEST_SIGN_NEG) ? freqEst = ((regValue & FINE_FREQEST_SIGN_MASK) == FINE_FREQEST_SIGN_NEG) ?
-freqEst : freqEst; -freqEst : freqEst;
return freqEst; return freqEst;
} }
+122 -104
View File
@@ -27,17 +27,25 @@
#include "phy_reg.h" #include "phy_reg.h"
#include "../common.h" #include "../common.h"
#include "../time_ctrl/time_ctrl.h" #include "../time_ctrl/time_ctrl.h"
/***************** Macros (Inline Functions) Definitions *********************/
/************************** Constant Definitions *****************************/ /************************** Constant Definitions *****************************/
/**
* @name PhysicalLayer_Common_Constant
* @{
*/
#define L1_NUM_ANT_SUBNRRW_PATTERN 37 #define L1_NUM_ANT_SUBNRRW_PATTERN 37
#define L1_NUM_ANT_NRRW_PATTERN 61 #define L1_NUM_ANT_NRRW_PATTERN 61
#define L1_INIT_BEAM_NO 0 #define L1_INIT_BEAM_NO 0
#define L1_INIT_ANT_WD PHY_ANT_BEAM_120 #define L1_INIT_ANT_WD PHY_ANT_BEAM_120
#define L1_INIT_ANT_NO 0 #define L1_INIT_ANT_NO 0
#define L1_FRAME_NONE_LEN UINT32_MAX // byte #define L1_ANT_NUM_CH 4
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L)
#define L1_FRAME_NONE_HOPS UINT32_MAX
#define L1_TXRXDATA_MAX_LEN 2048 #define L1_TXRXDATA_MAX_LEN 2048
#define L1_FRAME_NONE_LEN UINT32_MAX // byte
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L)
#define L1_FRAME_NONE_HOPS UINT32_MAX
#define L1_FRAME_MAX_HOPS 81 #define L1_FRAME_MAX_HOPS 81
#define L1_FRAME_2KBPS_20MS_HOPS 1 #define L1_FRAME_2KBPS_20MS_HOPS 1
#define L1_FRAME_2KBPS_100MS_HOPS 81 #define L1_FRAME_2KBPS_100MS_HOPS 81
@@ -47,10 +55,12 @@
#define L1_FRAME_40KBPS_10MS_HOPS 9 #define L1_FRAME_40KBPS_10MS_HOPS 9
#define L1_FRAME_200KBPS_5MS_HOPS 20 #define L1_FRAME_200KBPS_5MS_HOPS 20
#define L1_FRAME_1M2BPS_5MS_HOPS 20 #define L1_FRAME_1M2BPS_5MS_HOPS 20
/** @} */
/***************** Macros (Inline Functions) Definitions *********************/ /***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/ /**************************** Type Definitions *******************************/
/**
* @enum L1_FRAME_TYPE
*/
typedef enum typedef enum
{ {
L1_NONE_FRAME = 0, L1_NONE_FRAME = 0,
@@ -64,75 +74,67 @@ typedef enum
L1_1M2BPS_5MS_FRAME = 8 L1_1M2BPS_5MS_FRAME = 8
} L1_FRAME_TYPE; } L1_FRAME_TYPE;
/**
* @struct PHY_ANT_CONFIG
* @brief PhysicalLayer antenna config
*/
typedef struct typedef struct
{ {
/* Antenna control frame head 0xAA */ /*** Ant Control ***/
uint8_t head; uint8_t ctrlWord; ///< Antenna control frame head 0xAA\n
/* default 0, reserved for further use */ /// default 0, reserved for further use
uint8_t ctrlWord; uint8_t antMode; ///< high 4 bits specified beam mode.\n
/* high 4 bits specified beam mode. /// low 4 bits specified power control
* low 4 bits specified power control */ uint8_t oaxis[2]; ///< off-axis angle range is 0~60 \n
uint8_t antMode; /// 0.1 degree each LSB
/* off-axis angle range is 0~60, uint8_t raxis[2]; ///< round-axis angle range is 0~360, \n
* 0.1 degree each LSB */ /// 0.1 degree each LSB
uint8_t oaxis[2]; uint8_t antFreq[2]; ///< 0~3500Mhz, step 1MHz
/* round-axis angle range is 0~360, uint8_t trSelect; ///< in single tr mode, 0~63 specified tr channel \n
* 0.1 degree each LSB */ /// in single subarray mode, 0~3 specified the subarray
uint8_t raxis[2]; /// ! Only in debug mode!
/* 0~3500Mhz, step 1MHz */ uint8_t antAtt; ///< Antenna attenuation 0~31, 0.5dB each LSB, Only in debug mode
uint8_t antFreq[2]; uint8_t phase; ///< 0~63, 5.625 degree each LSB, Only in debug mode
/* in single tr mode, 0~63 specified tr channel uint8_t torMode; ///< Only for debug \n
* in single subarray mode, 0~3 specified the subarray /// default 0x00
* Only in debug mode*/ uint8_t caliMode; ///< 0x00 Normal, 0x01 single tr calibration
uint8_t trSlect; uint8_t antReserved; ///< reserved for further use
/* Antenna attenuation 0~31, 0.5dB each LSB, Only in debug mode */
uint8_t antAtt; /*** RF Control ***/
/* 0~63, 5.625 degree each LSB, Only in debug mode*/ uint8_t rfCtrl; ///< [7:4]RF enable: 0-On, 1-Off(Default); [3:0]Work mode: 0(default)
uint8_t phase; uint8_t rfFreq[2]; ///< 0~3500Mhz, step 1MHz
/* 0x00 Nromal RX, 0x01 Normal TX uint8_t rfTxMgc; ///< RF MGC control: 0~31, 1dB each LSB
* 0x11~0xA1 beam debug mode (TR duty 1%~10%)*/ uint8_t rf12CalMgc; ///< RF channel 1&2 calibration mgc\n
uint8_t rxtxMode; /// [7:4] Channle1 - max 15db, 1dB each LSB \n
/* 0x00 Normal, 0x01 single tr calibration */ /// [3:0] Channle2 - max 15db, 1dB each LSB
uint8_t calibrMode; uint8_t rf34CalMgc; ///< RF channel 3&4 calibration mgc\n
/* reserved for further use */ /// [7:4] Channle3 - max 15db, 1dB each LSB
uint8_t reserved; /// [3:0] Channle4 - max 15db, 1dB each LSB
/* DD enable */ uint8_t rfRxMgc; ///< Receive channel 1-4 MGC: 0~31, 1dB each LSB
uint8_t ddEn; uint8_t rfMonitor; ///< Receive monitor, 0-normal, 1-switch to monitor port
/* DD mgc */ uint8_t rfReserved0; ///< reserved for further use
uint8_t ddMgc; uint8_t rfReserved1; ///< reserved for further use
/* [7:4]RF enable: 0-On, 1-Off(Default); [3:0]Work mode: 0(default) */ uint8_t ch0Cal[2];
uint8_t rfCtrl; uint8_t ch1Cal[2];
/* RF MGC control: 0~31, 1dB each LSB*/ uint8_t ch2Cal[2];
uint8_t rfMgc; uint8_t ch3Cal[2];
/* RF channel 1&2 calibration mgc: [7:4] Channle1 - max 15db, 1dB each LSB
* [3:0] Channle2 - max 15db, 1dB each LSB*/
uint8_t rf12CalMgc;
/* RF channel 3&4 calibration mgc: [7:4] Channle3 - max 15db, 1dB each LSB
* [3:0] Channle4 - max 15db, 1dB each LSB*/
uint8_t rf34CalMgc;
/* Receive channel 1 MGC: 0~31, 1dB each LSB */
uint8_t rcv1Mgc;
/* Receive channel 2 MGC: 0~31, 1dB each LSB */
uint8_t rcv2Mgc;
/* Receive channel 3 MGC: 0~31, 1dB each LSB */
uint8_t rcv3Mgc;
/* Receive channel 4 MGC: 0~31, 1dB each LSB */
uint8_t rcv4Mgc;
/* Antenna control frame tail 0xCC */
uint8_t tail;
uint8_t dummy[6];
} PHY_ANT_CONFIG; } PHY_ANT_CONFIG;
/**
* @struct PHY_ANT_ANGLE
* @brief Describe the PhysicalLayer antenna angle
*/
typedef struct typedef struct
{ {
/* off-axis angle range is 0~60, uint16_t oaxis; ///< off-axis angle range is 0~60
* 0.1 degree each LSB */ /// 0.1 degree each LSB
uint16_t oaxis; uint16_t raxis; ///< round-axis angle range is 0~360
/* round-axis angle range is 0~360, /// 0.1 degree each LSB
* 0.1 degree each LSB */
uint16_t raxis;
} PHY_ANT_ANGLE; } PHY_ANT_ANGLE;
/**
* @enum PHY_TIME_WORD_TYPE
*/
typedef enum typedef enum
{ {
PHY_TIME_WORD_NONE = 0, PHY_TIME_WORD_NONE = 0,
@@ -140,15 +142,21 @@ typedef enum
PHY_TIME_WORD_LISTEN_TIMEOUT = 2 PHY_TIME_WORD_LISTEN_TIMEOUT = 2
} PHY_TIME_WORD_TYPE; } PHY_TIME_WORD_TYPE;
/**
* @enum PHY_ANT_BEAM_WIDTH
*/
typedef enum typedef enum
{ {
PHY_ANT_BEAM_NONE = 0, PHY_ANT_BEAM_NONE = 0,
PHY_ANT_BEAM_120 = 1, PHY_ANT_BEAM_120 = 1,
PHY_ANT_BEAM_60 = 2, PHY_ANT_BEAM_60 = 2,
PHY_ANT_BEAM_25 = 3, PHY_ANT_BEAM_25 = 3,
PHY_ANT_BEAM_8 = 4 PHY_ANT_BEAM_16 = 4
} PHY_ANT_BEAM_WIDTH; } PHY_ANT_BEAM_WIDTH;
/**
* @enum PHY_TOR_TYPE
*/
typedef enum typedef enum
{ {
PHY_TOR_SUSPEND = 0, PHY_TOR_SUSPEND = 0,
@@ -156,6 +164,9 @@ typedef enum
PHY_TOR_RX = 2 PHY_TOR_RX = 2
} PHY_TOR_TYPE; } PHY_TOR_TYPE;
/**
* @enum PHY_MODE
*/
typedef enum typedef enum
{ {
PHY_MODE_NONE = 0, PHY_MODE_NONE = 0,
@@ -164,6 +175,32 @@ typedef enum
PHY_MODE_PULL = 3 PHY_MODE_PULL = 3
} PHY_MODE; } PHY_MODE;
/**
* @enum PHY_ANT_MODE
*/
typedef enum
{
PHY_ANT_MODE_NONE = 0,
PHY_ANT_MODE_STANDBY = 1,
PHY_ANT_MODE_POWER_LOW = 2,
PHY_ANT_MODE_POWER_FULL = 3,
} PHY_ANT_MODE;
/**
* @struct PHY_RCD
* @brief Physical Layer recode buffer
*/
typedef struct
{
int32_t last;
int32_t curr;
int32_t next;
} PHY_RCD;
/**
* @struct PHY_CONFIG
* @brief struct holds all physical layer initialization parameters
*/
typedef struct typedef struct
{ {
uint32_t devId; uint32_t devId;
@@ -173,13 +210,10 @@ typedef struct
uintptr_t baseAddr; uintptr_t baseAddr;
} PHY_CONFIG; } PHY_CONFIG;
typedef struct /**
{ * @struct PHY_INST
int32_t last; * @brief Physical Layer operating instance
int32_t curr; */
int32_t next;
} PHY_RCD;
typedef struct typedef struct
{ {
PHY_CONFIG phyCofig; // Device address configs PHY_CONFIG phyCofig; // Device address configs
@@ -204,52 +238,28 @@ typedef struct
PHY_ANT_CONFIG antConfig; // antenna configuration pointer PHY_ANT_CONFIG antConfig; // antenna configuration pointer
} PHY_INST; } PHY_INST;
/************************** Variable Definitions *****************************/
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_10MS[L1_FRAME_40KBPS_10MS_HOPS];
extern uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_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];
/************************** Function Prototypes ******************************/ /************************** Function Prototypes ******************************/
int32_t Phy_InstInit(PHY_INST **instPtr, PHY_CONFIG *phyConfig); int32_t Phy_InstInit(PHY_INST **instPtr, PHY_CONFIG *phyConfig);
void Phy_Destroy(PHY_INST *instPtr); void Phy_Destroy(PHY_INST *instPtr);
void Phy_UpdateState(PHY_INST *instPtr);
void Phy_Start(PHY_INST *instPtr); void Phy_Start(PHY_INST *instPtr);
void Phy_Halt(PHY_INST *instPtr); void Phy_Halt(PHY_INST *instPtr);
int32_t Phy_SetMode(PHY_INST *instPtr, PHY_MODE modeCod);
int32_t Phy_SetMode(PHY_INST *instPtr, PHY_MODE modeCod);
int32_t Phy_SetTimeWord(PHY_INST *instPtr, const TIME_WORD *tmWord, PHY_TIME_WORD_TYPE tmType);
int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode, L1_FRAME_TYPE frameType, uint8_t *dataBuff); int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode, L1_FRAME_TYPE frameType, uint8_t *dataBuff);
void Phy_UpdateState(PHY_INST *instPtr);
void Phy_PeekRecvData(PHY_INST *instPtr, uint8_t *dataBuff); void Phy_PeekRecvData(PHY_INST *instPtr, uint8_t *dataBuff);
void Phy_RetrieveRecvData(PHY_INST *instPtr, uint8_t *dataBuff); void Phy_RetrieveRecvData(PHY_INST *instPtr, uint8_t *dataBuff);
bool Phy_IsFrameDetected(PHY_INST *instPtr); bool Phy_IsFrameDetected(PHY_INST *instPtr);
bool Phy_IsFrameReceived(PHY_INST *instPtr); bool Phy_IsFrameReceived(PHY_INST *instPtr);
bool Phy_IsFrameValid(PHY_INST *instPtr); bool Phy_IsFrameValid(PHY_INST *instPtr);
uint32_t Phy_GetFrameLen(L1_FRAME_TYPE frameType);
L1_FRAME_TYPE Phy_GetLastRecvFrameType(PHY_INST *instPtr);
L1_FRAME_TYPE Phy_GetLastSendFrameType(PHY_INST *instPtr);
int32_t Phy_SetHopPattern(void *patternBuff, uint32_t patternLen); int32_t Phy_SetHopPattern(void *patternBuff, uint32_t patternLen);
uint32_t Phy_GetHopLength(L1_FRAME_TYPE frameType); uint32_t Phy_GetHopLength(L1_FRAME_TYPE frameType);
uint32_t Phy_GetTimeComp(L1_FRAME_TYPE frameType); uint32_t Phy_GetTimeComp(L1_FRAME_TYPE frameType);
uint32_t Phy_GetFrameLen(L1_FRAME_TYPE frameType);
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig); L1_FRAME_TYPE Phy_GetLastRecvFrameType(PHY_INST *instPtr);
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth); L1_FRAME_TYPE Phy_GetLastSendFrameType(PHY_INST *instPtr);
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo);
int32_t Phy_SetBeamAngle(PHY_INST *phyInstPtr, double offAx, double rndAx);
int32_t Phy_SetTimeWord(PHY_INST *instPtr, const TIME_WORD *tmWord, PHY_TIME_WORD_TYPE tmType);
double Phy_GetFreqEst(PHY_INST *instPtr); double Phy_GetFreqEst(PHY_INST *instPtr);
double Phy_GetCoarseFreqEst(PHY_INST *instPtr); double Phy_GetCoarseFreqEst(PHY_INST *instPtr);
@@ -258,4 +268,12 @@ void Phy_GetFrameSyncTimeStamp(PHY_INST *instPtr, TIME_WORD *frameSyncT);
void Phy_GetLastReceivedFrameSyncTimeStamp(PHY_INST *instPtr, TIME_WORD *frameSyncT); void Phy_GetLastReceivedFrameSyncTimeStamp(PHY_INST *instPtr, TIME_WORD *frameSyncT);
void Phy_GetSlotStartTimeStamp(PHY_INST *instPtr, TIME_WORD *slotStart); void Phy_GetSlotStartTimeStamp(PHY_INST *instPtr, TIME_WORD *slotStart);
void Phy_GetLastReceivedSlotStartTimeStamp(PHY_INST *instPtr, TIME_WORD *slotStart); void Phy_GetLastReceivedSlotStartTimeStamp(PHY_INST *instPtr, TIME_WORD *slotStart);
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig);
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode);
void Phy_AntConfigAttenuation(PHY_INST *instPtr, uint8_t rxAtt, uint8_t txAtt);
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth);
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo, PHY_ANT_BEAM_WIDTH beamWidth);
int32_t Phy_SetBeamAngle(PHY_INST *phyInstPtr, double offAx, double rndAx);
#endif /* PHY_CTRL_H_ */ #endif /* PHY_CTRL_H_ */
@@ -398,7 +398,6 @@ TEST(linklayer_reconfig)
TEST(linklayer_master_routine) TEST(linklayer_master_routine)
{ {
int32_t Status; int32_t Status;
Linklayer_Start(linkInstPtr);
TIME_WORD timeStampA, timeStampB, timeGap; TIME_WORD timeStampA, timeStampB, timeGap;
uint32_t timeDiff; uint32_t timeDiff;
l2Config.myType = L2_NODE_HEAD; l2Config.myType = L2_NODE_HEAD;
@@ -406,6 +405,7 @@ TEST(linklayer_master_routine)
Status = Linklayer_Reconfig(linkInstPtr, &l2Config); Status = Linklayer_Reconfig(linkInstPtr, &l2Config);
ASSERT_EQUAL(SUCCESS, Status); ASSERT_EQUAL(SUCCESS, Status);
// 30 seconds // 30 seconds
Linklayer_Start(linkInstPtr);
for (int i = 0; i < 30 * L2_SLOTS_PER_FRAME; i++) for (int i = 0; i < 30 * L2_SLOTS_PER_FRAME; i++)
{ {
tmcReg[TIME_INT_REG]++; tmcReg[TIME_INT_REG]++;
@@ -486,7 +486,6 @@ TEST(linklayer_master_routine)
TEST(linklayer_slave_netsetup) TEST(linklayer_slave_netsetup)
{ {
int32_t Status; int32_t Status;
Linklayer_Start(linkInstPtr);
TIME_WORD timeStampA, timeStampB, timeGap; TIME_WORD timeStampA, timeStampB, timeGap;
TIME_WORD bmTime; TIME_WORD bmTime;
uint32_t netStart, timeDiff; uint32_t netStart, timeDiff;
@@ -502,6 +501,7 @@ TEST(linklayer_slave_netsetup)
// 74 is the index of bm frame in routine table. // 74 is the index of bm frame in routine table.
netStart = bmTime.int_part % L2_SLOTS_PER_FRAME + rand_range(-12, 12); netStart = bmTime.int_part % L2_SLOTS_PER_FRAME + rand_range(-12, 12);
Linklayer_Start(linkInstPtr);
for (int i = 0; i < 12 * L2_SLOTS_PER_FRAME * TIME_FRAC_MAX; i++) for (int i = 0; i < 12 * L2_SLOTS_PER_FRAME * TIME_FRAC_MAX; i++)
{ {
tmcReg[TIME_FRAC_REG]++; tmcReg[TIME_FRAC_REG]++;
@@ -596,8 +596,8 @@ TEST_SUITE(linklayer_unit_test)
{ {
TEST_SUITE_CONFIGURE(linklayer_setup, linklayer_teardown); TEST_SUITE_CONFIGURE(linklayer_setup, linklayer_teardown);
RUN_TEST(linklayer_reconfig); RUN_TEST(linklayer_reconfig);
RUN_TEST(linklayer_slave_netsetup);
RUN_TEST(linklayer_master_routine); RUN_TEST(linklayer_master_routine);
RUN_TEST(linklayer_slave_netsetup);
} }
int main(void) int main(void)
+83 -28
View File
@@ -1,18 +1,18 @@
/*****************************************************************************/ /*****************************************************************************/
/** /**
* Description: Inter-Communication protocol implementation. * Description: Inter-Communication protocol implementation.
* *
* Date: 2022-06-18 16:37 * Date: 2022-06-18 16:37
* LastEditTime: 2023-04-24 17:38 * LastEditTime: 2023-04-24 17:38
* Revisions: Rev 0.1 * Revisions: Rev 0.1
* History: * History:
* [2022-06-18]: Initial version. * [2022-06-18]: Initial version.
* [2023-04-24]: Bug fix: * [2023-04-24]: Bug fix:
* - Read frame type from PL status register. * - Read frame type from PL status register.
* *
* Copyright(c) 2022 Beijing Institute of Technology. * Copyright(c) 2022 Beijing Institute of Technology.
* Lab of Communication and Networking * Lab of Communication and Networking
* *
******************************************************************************/ ******************************************************************************/
/***************************** Include Files *********************************/ /***************************** Include Files *********************************/
#include <stdint.h> #include <stdint.h>
@@ -130,7 +130,7 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
torState = PHY_TOR_RX; torState = PHY_TOR_RX;
} }
else{ else{
DBG_ERROR("[PHY Control] Tx/Rx state cannot be recognized...\n\r"); DBG_ERROR("[PHY Control] Tx/Rx state cannot be recognized...\n");
return EIGNORE; return EIGNORE;
} }
instPtr->lastCtrlTimeTag = GetTimeWord(msgPtr+CTRL_TIME_OFFSET); instPtr->lastCtrlTimeTag = GetTimeWord(msgPtr+CTRL_TIME_OFFSET);
@@ -165,7 +165,7 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
frameType = L1_40KBPS_20MS_FRAME; frameType = L1_40KBPS_20MS_FRAME;
break; break;
default: default:
DBG_ERROR("[PHY Control] Frame Type cannot be recognized...\n\r"); DBG_ERROR("[PHY Control] Frame Type cannot be recognized...\n");
return EIGNORE; return EIGNORE;
break; break;
} }
@@ -187,8 +187,8 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
phyRef->isPresetHop = false; phyRef->isPresetHop = false;
} }
else{ else{
DBG_ERROR("[PHY Control] Hopping Pattern Configure cannot be recognized...\n\r"); DBG_ERROR("[PHY Control] Hopping Pattern Configure cannot be recognized...\n");
DBG_WARNING("[PHY Control] Using default preset hopping pattern instead...\n\r"); DBG_WARNING("[PHY Control] Using default preset hopping pattern instead...\n");
return EIGNORE; return EIGNORE;
} }
if(phyRef->isPresetHop == false){ if(phyRef->isPresetHop == false){
@@ -205,11 +205,11 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
beamWidth = PHY_ANT_BEAM_25; beamWidth = PHY_ANT_BEAM_25;
} }
else if(msgPtr[INTER_MSG_CTRL_BEAM_MODE_OFFSET] == BEAM_MODE_NRW){ else if(msgPtr[INTER_MSG_CTRL_BEAM_MODE_OFFSET] == BEAM_MODE_NRW){
beamWidth = PHY_ANT_BEAM_8; beamWidth = PHY_ANT_BEAM_16;
} }
else{ else{
DBG_ERROR("[PHY Control] Beam Width Configure cannot be recognized...\n\r"); DBG_ERROR("[PHY Control] Beam Width Configure cannot be recognized...\n");
DBG_WARNING("[PHY Control] Using default WILD beam (120 deg) instead...\n\r"); DBG_WARNING("[PHY Control] Using default WILD beam (120 deg) instead...\n");
return EIGNORE; return EIGNORE;
} }
Status = Phy_SetBeamWidth(phyRef, beamWidth); Status = Phy_SetBeamWidth(phyRef, beamWidth);
@@ -218,14 +218,14 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
} }
beamNo = (uint32_t)msgPtr[INTER_MSG_CTRL_BEAM_NO_OFFSET]; beamNo = (uint32_t)msgPtr[INTER_MSG_CTRL_BEAM_NO_OFFSET];
if((beamNo<L1_NUM_ANT_SUBNRRW_PATTERN && beamWidth == PHY_ANT_BEAM_25) if((beamNo<L1_NUM_ANT_SUBNRRW_PATTERN && beamWidth == PHY_ANT_BEAM_25)
||(beamNo<L1_NUM_ANT_NRRW_PATTERN && beamWidth == PHY_ANT_BEAM_8) ||(beamNo<L1_NUM_ANT_NRRW_PATTERN && beamWidth == PHY_ANT_BEAM_16)
|| (beamNo == 0 && beamWidth == PHY_ANT_BEAM_120)){ || (beamNo == 0 && beamWidth == PHY_ANT_BEAM_120)){
Phy_SetBeamNo(phyRef, beamNo); Phy_SetBeamNo(phyRef, beamNo, beamWidth);
} }
else{ else{
if(beamNo != 0x000000FF){ if(beamNo != 0x000000FF){
DBG_ERROR("[PHY Control] Beam Number Configure cannot be recognized...\n\r"); DBG_ERROR("[PHY Control] Beam Number Configure cannot be recognized...\n");
DBG_WARNING("[PHY Control] Using Beam Angle configure instead...\n\r"); DBG_WARNING("[PHY Control] Using Beam Angle configure instead...\n");
return EIGNORE; return EIGNORE;
} }
// the angle config is a 16 bit fixed point data // the angle config is a 16 bit fixed point data
@@ -242,6 +242,35 @@ static int32_t EvalPhyConfig(INTER_COMM_INST* instPtr, uint8_t* msgPtr){
} }
} }
// Power Mode and Attenuation control
if (msgPtr[INTER_MSG_CTRL_POWER_OFFSET] == CTRL_POWER_LOW)
{
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_LOW);
}
else if (msgPtr[INTER_MSG_CTRL_POWER_OFFSET] == CTRL_POWER_FULL)
{
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_FULL);
}
else
{
DBG_ERROR("[PHY Control] Unsupported power mode [0x%02X]\n",
msgPtr[INTER_MSG_CTRL_POWER_OFFSET]);
return FAILURE;
}
if(msgPtr[INTER_MSG_CTRL_RXATT_OFFSET] <= INTER_MSG_CTRL_RXATT_MAX
&& msgPtr[INTER_MSG_CTRL_TXATT_OFFSET] <= INTER_MSG_CTRL_TXATT_MAX)
{
Phy_AntConfigAttenuation(phyRef,
msgPtr[INTER_MSG_CTRL_RXATT_OFFSET],
msgPtr[INTER_MSG_CTRL_TXATT_OFFSET]
);
}
else
{
DBG_ERROR("[PHY Control] Attenuation exceeds max range.\n");
return FAILURE;
}
TIME_WORD tmWord = {0}; TIME_WORD tmWord = {0};
tmWord.int_part = (uint32_t)(instPtr->lastCtrlTimeTag >> 32); tmWord.int_part = (uint32_t)(instPtr->lastCtrlTimeTag >> 32);
tmWord.frac_part = (uint32_t)(instPtr->lastCtrlTimeTag); tmWord.frac_part = (uint32_t)(instPtr->lastCtrlTimeTag);
@@ -499,16 +528,42 @@ int32_t InterComm_MsgHandler(INTER_COMM_INST* instPtr){
break; break;
} }
case INTER_MSG_MODESW_CODE:{ case INTER_MSG_MODESW_CODE:{
if(msgRecvPtr[MODESW_MODE_OFFSET] == MODESW_MODE_NORMAL){ if(msgRecvPtr[MODESW_MODE_OFFSET] == MODESW_MODE_NORMAL)
{
Phy_SetMode(instPtr->phyInstPtr, PHY_MODE_PULL); Phy_SetMode(instPtr->phyInstPtr, PHY_MODE_PULL);
} }
else if(msgRecvPtr[MODESW_MODE_OFFSET] == MODESW_MODE_NETSET){ else if(msgRecvPtr[MODESW_MODE_OFFSET] == MODESW_MODE_NETSET)
{
PHY_INST* phyRef = instPtr->phyInstPtr;
// Power Mode and Attenuation control
if (msgRecvPtr[MODESW_POWER_OFFSET] == CTRL_POWER_LOW)
{
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_LOW);
}
else if (msgRecvPtr[MODESW_POWER_OFFSET] == CTRL_POWER_FULL)
{
Phy_AntConfigMode(phyRef, PHY_ANT_MODE_POWER_FULL);
}
else
{
DBG_ERROR("[PHY Control] Unsupported power mode [0x%02X]\n",
msgRecvPtr[MODESW_POWER_OFFSET]);
break;
}
if(msgRecvPtr[MODESW_RXATT_OFFSET] <= MODESW_RXATT_MAX)
{
Phy_AntConfigAttenuation(phyRef, msgRecvPtr[MODESW_RXATT_OFFSET], MODESW_TXATT_SKIP);
}
else
{
DBG_ERROR("[PHY Control] Attenuation exceeds max range.\n");
}
uint64_t timeTemp; uint64_t timeTemp;
TIME_WORD tmWord; TIME_WORD tmWord;
timeTemp = GetTimeWord(msgRecvPtr + MODESW_START_TIME_OFFSET); timeTemp = GetTimeWord(msgRecvPtr + MODESW_START_TIME_OFFSET);
tmWord.int_part = (uint32_t)(timeTemp>>32);; tmWord.int_part = (uint32_t)(timeTemp>>32);;
tmWord.frac_part = (uint32_t)(timeTemp); tmWord.frac_part = (uint32_t)(timeTemp);
Status = Phy_SetTimeWord(instPtr->phyInstPtr, &tmWord, PHY_TIME_WORD_POLL); Status = Phy_SetTimeWord(phyRef, &tmWord, PHY_TIME_WORD_POLL);
if(Status != SUCCESS){ if(Status != SUCCESS){
return EPARAM; return EPARAM;
} }
@@ -516,7 +571,7 @@ int32_t InterComm_MsgHandler(INTER_COMM_INST* instPtr){
if(timeTemp == 0){ if(timeTemp == 0){
tmWord.frac_part = 0; tmWord.frac_part = 0;
tmWord.int_part = 0; tmWord.int_part = 0;
Status = Phy_SetTimeWord(instPtr->phyInstPtr, &tmWord, PHY_TIME_WORD_LISTEN_TIMEOUT); Status = Phy_SetTimeWord(phyRef, &tmWord, PHY_TIME_WORD_LISTEN_TIMEOUT);
if(Status != SUCCESS){ if(Status != SUCCESS){
return EPARAM; return EPARAM;
} }
@@ -526,14 +581,14 @@ int32_t InterComm_MsgHandler(INTER_COMM_INST* instPtr){
tmWord.int_part += (uint32_t)(timeTemp>>32); tmWord.int_part += (uint32_t)(timeTemp>>32);
tmWord.int_part = (tmWord.frac_part >= TIME_FRAC_MAX) ? tmWord.int_part + 1:tmWord.int_part; tmWord.int_part = (tmWord.frac_part >= TIME_FRAC_MAX) ? tmWord.int_part + 1:tmWord.int_part;
tmWord.frac_part %= TIME_FRAC_MAX; tmWord.frac_part %= TIME_FRAC_MAX;
Status = Phy_SetTimeWord(instPtr->phyInstPtr, &tmWord, PHY_TIME_WORD_LISTEN_TIMEOUT); Status = Phy_SetTimeWord(phyRef, &tmWord, PHY_TIME_WORD_LISTEN_TIMEOUT);
if(Status != SUCCESS){ if(Status != SUCCESS){
return EPARAM; return EPARAM;
} }
} }
instPtr->phyInstPtr->isPresetHop = true ; phyRef->isPresetHop = true ;
Status = Phy_SetMode(instPtr->phyInstPtr, PHY_MODE_LISTEN); Status = Phy_SetMode(phyRef, PHY_MODE_LISTEN);
Status = Phy_SetupNextSlot(instPtr->phyInstPtr, PHY_TOR_RX, L1_10KBPS_20MS_FRAME, NULL); Status = Phy_SetupNextSlot(phyRef, PHY_TOR_RX, L1_10KBPS_20MS_FRAME, NULL);
} }
else{ else{
return EPARAM; return EPARAM;
@@ -787,13 +842,13 @@ int32_t InterComm_PhyDataUpload(INTER_COMM_INST* instPtr){
/*****************************************************************************/ /*****************************************************************************/
/** /**
* @brief Append frame CRC-16 result to frame data buffer. * @brief Append frame CRC-16 result to frame data buffer.
* *
* @param buffPtr * @param buffPtr
* @param dataLen * @param dataLen
* *
* @return SUCCESS append successfully * @return SUCCESS append successfully
* Other frame cannot be recognized. * Other frame cannot be recognized.
* *
******************************************************************************/ ******************************************************************************/
int AppendCrc(uint8_t* buffPtr, uint32_t dataLen) { int AppendCrc(uint8_t* buffPtr, uint32_t dataLen) {
ASSERT(buffPtr != NULL); ASSERT(buffPtr != NULL);
@@ -822,13 +877,13 @@ int AppendCrc(uint8_t* buffPtr, uint32_t dataLen) {
/** /**
* @brief Check the frame CRC-16, witch can infer the frame should be dump * @brief Check the frame CRC-16, witch can infer the frame should be dump
* or not. * or not.
* *
* @param frameBuffPtr * @param frameBuffPtr
* @param frameType * @param frameType
* *
* @return true CRC check passed, good frame. * @return true CRC check passed, good frame.
* false CRC check failed, bad frame. * false CRC check failed, bad frame.
* *
******************************************************************************/ ******************************************************************************/
bool CrcCheck(uint8_t* buffPtr, uint32_t dataLen){ bool CrcCheck(uint8_t* buffPtr, uint32_t dataLen){
if (dataLen == 0) { if (dataLen == 0) {
+24 -13
View File
@@ -1,19 +1,19 @@
/*****************************************************************************/ /*****************************************************************************/
/** /**
* Description: Inter-Communication protocol, definitions and function * Description: Inter-Communication protocol, definitions and function
* prototypes. * prototypes.
* *
* Date: 2022-06-18 16:37 * Date: 2022-06-18 16:37
* LastEditTime: 2023-04-24 17:38 * LastEditTime: 2023-04-24 17:38
* Revisions: Rev 0.2 * Revisions: Rev 0.2
* History: * History:
* [2022-06-18]: Initial version. * [2022-06-18]: Initial version.
* [2023-04-24]: Bug fix: * [2023-04-24]: Bug fix:
* - Read frame type from PL status register. * - Read frame type from PL status register.
* *
* Copyright(c) 2022 Beijing Institute of Technology. * Copyright(c) 2022 Beijing Institute of Technology.
* Lab of Communication and Networking * Lab of Communication and Networking
* *
******************************************************************************/ ******************************************************************************/
#ifndef INTER_COMM_H_ #ifndef INTER_COMM_H_
#define INTER_COMM_H_ #define INTER_COMM_H_
@@ -65,7 +65,7 @@
#define WAKE_CMD_LPW_UP 0xCCCC #define WAKE_CMD_LPW_UP 0xCCCC
// mode swicth command // mode swicth command
#define INTER_MSG_MODESW_LEN 0x0016 // 20byte + crc #define INTER_MSG_MODESW_LEN 0x0018 // 22byte + crc
#define INTER_MSG_MODESW_CODE 0x0041 #define INTER_MSG_MODESW_CODE 0x0041
#define MODESW_START_TIME_OFFSET 0x0002 #define MODESW_START_TIME_OFFSET 0x0002
#define MODESW_START_TIME_LEN 0x0008 #define MODESW_START_TIME_LEN 0x0008
@@ -75,6 +75,14 @@
#define MODESW_MODE_LEN 0x0002 #define MODESW_MODE_LEN 0x0002
#define MODESW_MODE_NORMAL 0x0001 #define MODESW_MODE_NORMAL 0x0001
#define MODESW_MODE_NETSET 0x0002 #define MODESW_MODE_NETSET 0x0002
#define MODESW_POWER_OFFSET 0x0014
#define MODESW_POWER_LEN 0x0001
#define MODESW_POWER_LOW 0xAA
#define MODESW_POWER_FULL 0xCC
#define MODESW_RXATT_OFFSET 0x0015
#define MODESW_RXATT_LEN 0x0001
#define MODESW_RXATT_MAX 0x1F
#define MODESW_TXATT_SKIP 0xFF
// physical layer control // physical layer control
#define INTER_MSG_CTRL_LEN 0x00BC // 186byte + 2byte crc #define INTER_MSG_CTRL_LEN 0x00BC // 186byte + 2byte crc
@@ -108,11 +116,10 @@
#define CTRL_TOR_TX 0xAA #define CTRL_TOR_TX 0xAA
#define CTRL_TOR_RX 0xCC #define CTRL_TOR_RX 0xCC
#define INTER_MSG_CTRL_SW_OFFSET 0x000D #define INTER_MSG_CTRL_POWER_OFFSET 0x000D
#define INTER_MSG_CTRL_SW_LEN 0x0001 #define INTER_MSG_CTRL_POWER_LEN 0x0001
#define CTRL_SW_PW BIT(0) #define CTRL_POWER_LOW 0xAA
#define CTRL_SW_TR BIT(1) #define CTRL_POWER_FULL 0xCC
#define CTRL_SW_TOR BIT(2)
#define INTER_MSG_CTRL_HOP_MODE_OFFSET 0x000E #define INTER_MSG_CTRL_HOP_MODE_OFFSET 0x000E
#define INTER_MSG_CTRL_HOP_MODE_LEN 0x0002 #define INTER_MSG_CTRL_HOP_MODE_LEN 0x0002
@@ -132,8 +139,12 @@
#define INTER_MSG_CTRL_BEAM_NO_OFFSET 0x00B3 #define INTER_MSG_CTRL_BEAM_NO_OFFSET 0x00B3
#define INTER_MSG_CTRL_BEAM_NO_LEN 0x0001 #define INTER_MSG_CTRL_BEAM_NO_LEN 0x0001
#define INTER_MSG_CTRL_AMP_WT_OFFSET 0x00B4 #define INTER_MSG_CTRL_RXATT_OFFSET 0x00B4
#define INTER_MSG_CTRL_AMP_WT_LEN 0x0002 #define INTER_MSG_CTRL_RXATT_LEN 0x0001
#define INTER_MSG_CTRL_RXATT_MAX 0x1F
#define INTER_MSG_CTRL_TXATT_OFFSET 0x00B5
#define INTER_MSG_CTRL_TXATT_LEN 0x0001
#define INTER_MSG_CTRL_TXATT_MAX 0x1F
#define INTER_MSG_CTRL_OFFAX_OFFSET 0x00B6 #define INTER_MSG_CTRL_OFFAX_OFFSET 0x00B6
#define INTER_MSG_CTRL_OFFAX_LEN 0x0002 #define INTER_MSG_CTRL_OFFAX_LEN 0x0002
+2 -2
View File
@@ -429,7 +429,7 @@ int32_t Intercom_C2cRecvData(void* buffPtr, int32_t buffSize){
return FAILURE; return FAILURE;
} }
} }
uint32_t recvLen = IO_In32((uintptr_t)(c2cRecvDataPtr + C2C_DLEN_OFFSET)) - C2C_HEADER_LEN; uint32_t recvLen = IO_In32((uintptr_t)(c2cRecvDataPtr + C2C_DLEN_OFFSET)) - C2C_HEADER_LEN;
memcpy(buffPtr, c2cRecvDataPtr + C2C_PLOAD_OFFSET, recvLen); memcpy(buffPtr, c2cRecvDataPtr + C2C_PLOAD_OFFSET, recvLen);
@@ -747,7 +747,7 @@ int main(void) {
else{ else{
Status = InterComm_MsgHandler(intrCommInstPtr); Status = InterComm_MsgHandler(intrCommInstPtr);
if(Status != SUCCESS){ if(Status != SUCCESS){
DBG_PRINT("####\tInterComm message handler finished with code: %d\n\r", Status); DBG_PRINT("####\tInterComm message handler finished with code: %d\n", Status);
continue; continue;
} }
} }