forked from gatsby/df_datalink
*add Phy_AntConfigMode api
This commit is contained in:
@@ -35,9 +35,9 @@
|
|||||||
#define ANT_MODE_WIDE_BEAM_3 0x30 // 120
|
#define ANT_MODE_WIDE_BEAM_3 0x30 // 120
|
||||||
|
|
||||||
#define ANT_MODE_HIGH_POWER 0x00
|
#define ANT_MODE_HIGH_POWER 0x00
|
||||||
#define ANT_MODE_LOWAPOWER 0x04
|
#define ANT_MODE_LOW_POWER 0x04
|
||||||
#define ANT_MODE_STANDBY 0x0F
|
#define ANT_MODE_STANDBY 0x0F
|
||||||
#define ATN_MODE_DEFAULT (ANT_MODE_WIDE_BEAM_1 | ANT_MODE_LOWAPOWER)
|
#define ATN_MODE_DEFAULT (ANT_MODE_WIDE_BEAM_1 | ANT_MODE_LOW_POWER)
|
||||||
#define ATN_MODE_HIGH (ANT_MODE_WIDE_BEAM_1 | ANT_MODE_HIGH_POWER)
|
#define ATN_MODE_HIGH (ANT_MODE_WIDE_BEAM_1 | ANT_MODE_HIGH_POWER)
|
||||||
|
|
||||||
#define DEFAULT_CENTRTAL_FREQ 0x06D7 // 26.25GHz
|
#define DEFAULT_CENTRTAL_FREQ 0x06D7 // 26.25GHz
|
||||||
@@ -242,8 +242,30 @@ void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
|
|||||||
// ***********************
|
// ***********************
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
|
||||||
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
|
uint8_t config = instPtr->antConfig.antMode & (~ANT_MODE_BEAM_MASK);
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case PHY_ANT_MODE_SILENT:
|
||||||
|
config |= ANT_MODE_STANDBY;
|
||||||
|
break;
|
||||||
|
case PHY_ANT_MODE_LOW_POWER:
|
||||||
|
config |= ANT_MODE_LOW_POWER;
|
||||||
|
break;
|
||||||
|
case PHY_ANT_MODE_HIGH_POWER:
|
||||||
|
config |= ANT_MODE_HIGH_POWER;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DBG_ERROR("Unknown antenna mode: %" PRIu8 ", remain previous mode.\n", mode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
|
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
|
||||||
{
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
if (instPtr->beamWd.next == PHY_ANT_BEAM_8)
|
if (instPtr->beamWd.next == PHY_ANT_BEAM_8)
|
||||||
{
|
{
|
||||||
if (beamNo >= L1_NUM_ANT_NRRW_PATTERN)
|
if (beamNo >= L1_NUM_ANT_NRRW_PATTERN)
|
||||||
@@ -292,6 +314,7 @@ int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo)
|
|||||||
|
|
||||||
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
|
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
|
||||||
{
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
uint8_t beamConfig = instPtr->antConfig.antMode & (~ANT_MODE_BEAM_MASK);
|
uint8_t beamConfig = instPtr->antConfig.antMode & (~ANT_MODE_BEAM_MASK);
|
||||||
switch (beamWidth)
|
switch (beamWidth)
|
||||||
{
|
{
|
||||||
@@ -320,6 +343,7 @@ int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
|
|||||||
// Common version radius double input
|
// Common version radius double input
|
||||||
int32_t Phy_SetBeamAngle(PHY_INST *instPtr, double offAx, double rndAx)
|
int32_t Phy_SetBeamAngle(PHY_INST *instPtr, double offAx, double rndAx)
|
||||||
{
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
uint16_t offAxDeg = 0;
|
uint16_t offAxDeg = 0;
|
||||||
uint16_t rndAxDeg = 0;
|
uint16_t rndAxDeg = 0;
|
||||||
offAxDeg = (offAx >= 0) ? (((int32_t)(offAx * 180 / ANT_PI)) % 360) : (((int32_t)(offAx * 180 / ANT_PI)) % 360 + 360);
|
offAxDeg = (offAx >= 0) ? (((int32_t)(offAx * 180 / ANT_PI)) % 360) : (((int32_t)(offAx * 180 / ANT_PI)) % 360 + 360);
|
||||||
|
|||||||
@@ -167,6 +167,14 @@ typedef enum
|
|||||||
PHY_MODE_PULL = 3
|
PHY_MODE_PULL = 3
|
||||||
} PHY_MODE;
|
} PHY_MODE;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
PHY_ANT_MODE_NONE = 0,
|
||||||
|
PHY_ANT_MODE_SILENT = 1,
|
||||||
|
PHY_ANT_MODE_LOW_POWER = 2,
|
||||||
|
PHY_ANT_MODE_HIGH_POWER = 3,
|
||||||
|
} PHY_ANT_MODE;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t devId;
|
uint32_t devId;
|
||||||
@@ -255,6 +263,7 @@ uint32_t Phy_GetHopLength(L1_FRAME_TYPE frameType);
|
|||||||
uint32_t Phy_GetTimeComp(L1_FRAME_TYPE frameType);
|
uint32_t Phy_GetTimeComp(L1_FRAME_TYPE frameType);
|
||||||
|
|
||||||
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig);
|
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig);
|
||||||
|
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode);
|
||||||
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth);
|
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth);
|
||||||
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo);
|
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo);
|
||||||
int32_t Phy_SetBeamAngle(PHY_INST *phyInstPtr, double offAx, double rndAx);
|
int32_t Phy_SetBeamAngle(PHY_INST *phyInstPtr, double offAx, double rndAx);
|
||||||
|
|||||||
Reference in New Issue
Block a user