correct naming.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "../error.h"
|
||||
|
||||
#define ANT_PI 3.14159265358979323846
|
||||
|
||||
#define ANT_COINFO_HEAD 0xAA
|
||||
#define ANT_COINFO_TAIL 0xCC
|
||||
|
||||
@@ -62,7 +63,8 @@ uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] =
|
||||
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,
|
||||
@@ -117,7 +119,7 @@ uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] =
|
||||
// Pair by regex
|
||||
// Regex: ((\{\.oaxis = [0-9]+[ ,]+\.raxis = [0-9]+[ ]*\}, ){2})
|
||||
#if defined(PHY_BEAM_SET_PRESET)
|
||||
PHY_ANT_ANGLE antSubnrrwPattern[NUM_ANT_SUBNRRW_PATTERN] =
|
||||
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},
|
||||
@@ -139,7 +141,8 @@ PHY_ANT_ANGLE antSubnrrwPattern[NUM_ANT_SUBNRRW_PATTERN] =
|
||||
{.oaxis = 58, .raxis = 227}, {.oaxis = 59, .raxis = 90 },
|
||||
{.oaxis = 60, .raxis = 312}
|
||||
};
|
||||
PHY_ANT_ANGLE antNrrwPattern[NUM_ANT_NRRW_PATTERN] = {
|
||||
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},
|
||||
@@ -173,7 +176,7 @@ PHY_ANT_ANGLE antNrrwPattern[NUM_ANT_NRRW_PATTERN] = {
|
||||
{.oaxis = 60, .raxis = 252}
|
||||
};
|
||||
#elif defined(PHY_BEAM_SET_PRESET_LSX)
|
||||
ANT_ANGLE antSubnrrwPattern[NUM_ANT_SUBNRRW_PATTERN] = {
|
||||
ANT_ANGLE antSubnrrwPattern[L1_NUM_ANT_SUBNRRW_PATTERN] = {
|
||||
{.oaxis = 0 , .raxis =2225},{.oaxis = 96 , .raxis =850 },
|
||||
{.oaxis = 135, .raxis =3075},{.oaxis = 166, .raxis =1700},
|
||||
{.oaxis = 192, .raxis =325 },{.oaxis = 215, .raxis =2550},
|
||||
@@ -194,7 +197,7 @@ ANT_ANGLE antSubnrrwPattern[NUM_ANT_SUBNRRW_PATTERN] = {
|
||||
{.oaxis = 581, .raxis =2272},{.oaxis = 591, .raxis =897 },
|
||||
{.oaxis = 600, .raxis =3122}
|
||||
};
|
||||
ANT_ANGLE antNrrwPattern[NUM_ANT_NRRW_PATTERN] = {
|
||||
ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN] = {
|
||||
{.oaxis = 0 , .raxis =2225},{.oaxis = 74 , .raxis =850 },
|
||||
{.oaxis = 105, .raxis =3075},{.oaxis = 128, .raxis =1700},
|
||||
{.oaxis = 148, .raxis =325 },{.oaxis = 166, .raxis =2550},
|
||||
@@ -228,11 +231,11 @@ ANT_ANGLE antNrrwPattern[NUM_ANT_NRRW_PATTERN] = {
|
||||
{.oaxis = 600, .raxis =2520}
|
||||
};
|
||||
#else
|
||||
PHY_ANT_ANGLE antSubnrrwPattern[NUM_ANT_SUBNRRW_PATTERN] =
|
||||
PHY_ANT_ANGLE antSubnrrwPattern[L1_NUM_ANT_SUBNRRW_PATTERN] =
|
||||
{
|
||||
0
|
||||
};
|
||||
PHY_ANT_ANGLE antNrrwPattern[NUM_ANT_NRRW_PATTERN] =
|
||||
PHY_ANT_ANGLE antNrrwPattern[L1_NUM_ANT_NRRW_PATTERN] =
|
||||
{
|
||||
0
|
||||
};
|
||||
@@ -241,109 +244,104 @@ PHY_ANT_ANGLE antNrrwPattern[NUM_ANT_NRRW_PATTERN] =
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param antCoinfoPtr
|
||||
* @param antConfig
|
||||
*
|
||||
* @return
|
||||
*
|
||||
******************************************************************************/
|
||||
int32_t Phy_AntCoinfoInit(PHY_ANT_CONFIG *antCoinfoPtr)
|
||||
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
|
||||
{
|
||||
if (antCoinfoPtr == NULL)
|
||||
{
|
||||
return FAILURE;
|
||||
}
|
||||
antCoinfoPtr->head = ANT_COINFO_HEAD;
|
||||
antCoinfoPtr->tail = ANT_COINFO_TAIL;
|
||||
antCoinfoPtr->ctrlWord = 0x00;
|
||||
ASSERT(antConfig != NULL);
|
||||
antConfig->head = ANT_COINFO_HEAD;
|
||||
antConfig->tail = ANT_COINFO_TAIL;
|
||||
antConfig->ctrlWord = 0x00;
|
||||
#ifdef ANT_HIGH_POWER
|
||||
antCoinfoPtr->antMode = ATN_MODE_HIGH;
|
||||
antConfig->antMode = ATN_MODE_HIGH;
|
||||
#else
|
||||
antCoinfoPtr->antMode = ATN_MODE_DEFAULT;
|
||||
antConfig->antMode = ATN_MODE_DEFAULT;
|
||||
#endif
|
||||
|
||||
// FIXME: Dummy default value.
|
||||
// off axis angle setting
|
||||
antCoinfoPtr->oaxis[0] = 0;
|
||||
antCoinfoPtr->oaxis[1] = 0;
|
||||
antConfig->oaxis[0] = 0;
|
||||
antConfig->oaxis[1] = 0;
|
||||
// round axis angle setting
|
||||
antCoinfoPtr->raxis[0] = 0;
|
||||
antCoinfoPtr->raxis[1] = 0;
|
||||
antConfig->raxis[0] = 0;
|
||||
antConfig->raxis[1] = 0;
|
||||
// ***********************
|
||||
|
||||
antCoinfoPtr->antFreq[0] = (uint8_t)(DEFAULT_CENTRTAL_FREQ);
|
||||
antCoinfoPtr->antFreq[1] = (uint8_t)(DEFAULT_CENTRTAL_FREQ >> 8);
|
||||
antConfig->antFreq[0] = (uint8_t)(DEFAULT_CENTRTAL_FREQ);
|
||||
antConfig->antFreq[1] = (uint8_t)(DEFAULT_CENTRTAL_FREQ >> 8);
|
||||
|
||||
// FIXME: Dummy default value.
|
||||
// trSelect
|
||||
antCoinfoPtr->trSlect = 0;
|
||||
antConfig->trSlect = 0;
|
||||
// Antenna attenuation setting
|
||||
antCoinfoPtr->antAtt = 20;
|
||||
antConfig->antAtt = 20;
|
||||
// phase setting
|
||||
antCoinfoPtr->phase = 0;
|
||||
antConfig->phase = 0;
|
||||
// ***********************
|
||||
|
||||
antCoinfoPtr->rxtxMode = RXTXMODE_RX;
|
||||
antCoinfoPtr->calibrMode = CALIBRMODE_NORMAL;
|
||||
antConfig->rxtxMode = RXTXMODE_RX;
|
||||
antConfig->calibrMode = CALIBRMODE_NORMAL;
|
||||
|
||||
// FIXME: Dummy default value.
|
||||
// DD enable
|
||||
antCoinfoPtr->ddEn = 0;
|
||||
antConfig->ddEn = 0;
|
||||
// DD mgc
|
||||
antCoinfoPtr->ddMgc = 0;
|
||||
antConfig->ddMgc = 0;
|
||||
// RF mode control
|
||||
antCoinfoPtr->rfCtrl = 0;
|
||||
antConfig->rfCtrl = 0;
|
||||
// RF MGC control
|
||||
antCoinfoPtr->rfMgc = 0;
|
||||
antConfig->rfMgc = 0;
|
||||
// RF channel 1&2 calibration mgc
|
||||
antCoinfoPtr->rf12CalMgc = 0;
|
||||
antConfig->rf12CalMgc = 0;
|
||||
// RF channel 2&3 calibration mgc
|
||||
antCoinfoPtr->rf34CalMgc = 0;
|
||||
antConfig->rf34CalMgc = 0;
|
||||
// Receive channel 1 MGC
|
||||
antCoinfoPtr->rcv1Mgc = 0;
|
||||
antConfig->rcv1Mgc = 0;
|
||||
// Receive channel 2 MGC
|
||||
antCoinfoPtr->rcv2Mgc = 0;
|
||||
antConfig->rcv2Mgc = 0;
|
||||
// Receive channel 3 MGC
|
||||
antCoinfoPtr->rcv3Mgc = 0;
|
||||
antConfig->rcv3Mgc = 0;
|
||||
// Receive channel 4 MGC
|
||||
antCoinfoPtr->rcv4Mgc = 0;
|
||||
antConfig->rcv4Mgc = 0;
|
||||
// ***********************
|
||||
|
||||
memset(antCoinfoPtr->dummy, 0x00, sizeof(antCoinfoPtr->dummy));
|
||||
|
||||
return SUCCESS;
|
||||
memset(antConfig->dummy, 0x00, sizeof(antConfig->dummy));
|
||||
}
|
||||
|
||||
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
|
||||
{
|
||||
if (instPtr->beamWd.next == PHY_ANT_BEAM_8)
|
||||
{
|
||||
if (beamNo >= NUM_ANT_NRRW_PATTERN)
|
||||
if (beamNo >= L1_NUM_ANT_NRRW_PATTERN)
|
||||
{
|
||||
return FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
instPtr->beamNo.next = beamNo;
|
||||
instPtr->antCoinfoPtr.oaxis[1] = (uint8_t)(antNrrwPattern[beamNo].oaxis);
|
||||
instPtr->antCoinfoPtr.oaxis[0] = (uint8_t)((antNrrwPattern[beamNo].oaxis) >> 8);
|
||||
instPtr->antCoinfoPtr.raxis[1] = (uint8_t)(antNrrwPattern[beamNo].raxis);
|
||||
instPtr->antCoinfoPtr.raxis[0] = (uint8_t)((antNrrwPattern[beamNo].raxis) >> 8);
|
||||
instPtr->antConfig.oaxis[1] = (uint8_t)(antNrrwPattern[beamNo].oaxis);
|
||||
instPtr->antConfig.oaxis[0] = (uint8_t)((antNrrwPattern[beamNo].oaxis) >> 8);
|
||||
instPtr->antConfig.raxis[1] = (uint8_t)(antNrrwPattern[beamNo].raxis);
|
||||
instPtr->antConfig.raxis[0] = (uint8_t)((antNrrwPattern[beamNo].raxis) >> 8);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
else if (instPtr->beamWd.next == PHY_ANT_BEAM_25)
|
||||
{
|
||||
if (beamNo >= NUM_ANT_SUBNRRW_PATTERN)
|
||||
if (beamNo >= L1_NUM_ANT_SUBNRRW_PATTERN)
|
||||
{
|
||||
return FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
instPtr->beamNo.next = beamNo;
|
||||
instPtr->antCoinfoPtr.oaxis[1] = (uint8_t)(antSubnrrwPattern[beamNo].oaxis);
|
||||
instPtr->antCoinfoPtr.oaxis[0] = (uint8_t)((antSubnrrwPattern[beamNo].oaxis) >> 8);
|
||||
instPtr->antCoinfoPtr.raxis[1] = (uint8_t)(antSubnrrwPattern[beamNo].raxis);
|
||||
instPtr->antCoinfoPtr.raxis[0] = (uint8_t)((antSubnrrwPattern[beamNo].raxis) >> 8);
|
||||
instPtr->antConfig.oaxis[1] = (uint8_t)(antSubnrrwPattern[beamNo].oaxis);
|
||||
instPtr->antConfig.oaxis[0] = (uint8_t)((antSubnrrwPattern[beamNo].oaxis) >> 8);
|
||||
instPtr->antConfig.raxis[1] = (uint8_t)(antSubnrrwPattern[beamNo].raxis);
|
||||
instPtr->antConfig.raxis[0] = (uint8_t)((antSubnrrwPattern[beamNo].raxis) >> 8);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -352,18 +350,18 @@ int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
|
||||
// Beam number assign not support.
|
||||
// Assign default angle (0,0)
|
||||
instPtr->beamNo.next = 0;
|
||||
instPtr->antCoinfoPtr.oaxis[1] = 0;
|
||||
instPtr->antCoinfoPtr.oaxis[0] = 0;
|
||||
instPtr->antCoinfoPtr.raxis[1] = 0;
|
||||
instPtr->antCoinfoPtr.raxis[0] = 0;
|
||||
DBG_WARNING("Using default beam number...");
|
||||
instPtr->antConfig.oaxis[1] = 0;
|
||||
instPtr->antConfig.oaxis[0] = 0;
|
||||
instPtr->antConfig.raxis[1] = 0;
|
||||
instPtr->antConfig.raxis[0] = 0;
|
||||
DBG_WARNING("Using default beam number...\n");
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
|
||||
{
|
||||
uint8_t beamConfig = instPtr->antCoinfoPtr.antMode & (~ANT_MODE_BEAM_MASK);
|
||||
uint8_t beamConfig = instPtr->antConfig.antMode & (~ANT_MODE_BEAM_MASK);
|
||||
switch (beamWidth)
|
||||
{
|
||||
case PHY_ANT_BEAM_120:
|
||||
@@ -383,7 +381,7 @@ int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
|
||||
return EPARAM;
|
||||
break;
|
||||
}
|
||||
instPtr->antCoinfoPtr.antMode = beamConfig;
|
||||
instPtr->antConfig.antMode = beamConfig;
|
||||
instPtr->beamWd.next = beamWidth;
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -393,19 +391,19 @@ int32_t Phy_SetBeamAngle(PHY_INST *instPtr, double offAx, double rndAx)
|
||||
{
|
||||
uint16_t offAxDeg = 0;
|
||||
uint16_t rndAxDeg = 0;
|
||||
offAxDeg = (offAx > 0) ? (((int32_t)(offAx * 180 / ANT_PI)) % 360) : (((int32_t)(offAx * 180 / ANT_PI)) % 360 + 360);
|
||||
rndAxDeg = (rndAx > 0) ? (((int32_t)(rndAx * 180 / ANT_PI)) % 360) : (((int32_t)(rndAx * 180 / ANT_PI)) % 360 + 360);
|
||||
offAxDeg = (offAx >= 0) ? (((int32_t)(offAx * 180 / ANT_PI)) % 360) : (((int32_t)(offAx * 180 / ANT_PI)) % 360 + 360);
|
||||
rndAxDeg = (rndAx >= 0) ? (((int32_t)(rndAx * 180 / ANT_PI)) % 360) : (((int32_t)(rndAx * 180 / ANT_PI)) % 360 + 360);
|
||||
if (offAxDeg > 60)
|
||||
{
|
||||
DBG_ERROR("Angle out of range, off axis angle: %u(should be 0~60), round axis angle: %u(should be 0~360).",
|
||||
DBG_ERROR("Angle out of range, off axis angle: %u (should be 0~60), round axis angle: %u (should be 0~360).\n",
|
||||
offAxDeg, rndAxDeg);
|
||||
return EPARAM;
|
||||
}
|
||||
offAxDeg = offAxDeg * 10;
|
||||
rndAxDeg = rndAxDeg * 10;
|
||||
instPtr->antCoinfoPtr.oaxis[1] = (uint8_t)offAxDeg;
|
||||
instPtr->antCoinfoPtr.oaxis[0] = (uint8_t)(offAxDeg >> 8);
|
||||
instPtr->antCoinfoPtr.raxis[1] = (uint8_t)rndAxDeg;
|
||||
instPtr->antCoinfoPtr.raxis[0] = (uint8_t)(rndAxDeg >> 8);
|
||||
instPtr->antConfig.oaxis[1] = (uint8_t)offAxDeg;
|
||||
instPtr->antConfig.oaxis[0] = (uint8_t)(offAxDeg >> 8);
|
||||
instPtr->antConfig.raxis[1] = (uint8_t)rndAxDeg;
|
||||
instPtr->antConfig.raxis[0] = (uint8_t)(rndAxDeg >> 8);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user