20240429: physical layer update.

This commit is contained in:
Gatsby Van
2024-04-29 14:20:12 +08:00
parent 247700fee2
commit ad0d589141
5 changed files with 222 additions and 256 deletions
+41 -105
View File
@@ -28,16 +28,19 @@
#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 DEFAULT_CENTRTAL_FREQ 0x06D7 // 26.25GHz
@@ -49,7 +52,7 @@
#define CALIBRMODE_NORMAL 0x00 #define CALIBRMODE_NORMAL 0x00
#define CALIBRMODE_SINGLE_TR_CAL 0x01 #define CALIBRMODE_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})
@@ -119,63 +122,6 @@ uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] =
// 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},
@@ -252,14 +198,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,7 +208,6 @@ 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_CENTRTAL_FREQ);
antConfig->antFreq[1] = (uint8_t)(DEFAULT_CENTRTAL_FREQ >> 8); antConfig->antFreq[1] = (uint8_t)(DEFAULT_CENTRTAL_FREQ >> 8);
@@ -280,40 +219,33 @@ void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
antConfig->antAtt = 20; antConfig->antAtt = 20;
// phase setting // phase setting
antConfig->phase = 0; antConfig->phase = 0;
antConfig->rxtxMode = RXTXMODE_DEFAULT;
antConfig->calibrMode = CALIBRMODE_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_CENTRTAL_FREQ);
antConfig->rfFreq[1] = (uint8_t)(DEFAULT_CENTRTAL_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->rcvMgc = 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) int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo, PHY_ANT_BEAM_WIDTH beamWidth)
{ {
if (instPtr->beamWd.next == PHY_ANT_BEAM_8) if (beamWidth == PHY_ANT_BEAM_16)
{ {
if (beamNo >= L1_NUM_ANT_NRRW_PATTERN) if (beamNo >= L1_NUM_ANT_NRRW_PATTERN)
{ {
@@ -329,7 +261,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 +277,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,6 +289,10 @@ 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;
}
} }
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth) int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
@@ -365,19 +301,19 @@ int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
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;
} }
+22 -11
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.
@@ -647,19 +660,17 @@ 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);
memcpy((uint8_t *)(antConfigAddr + i * sizeof(PHY_ANT_CONFIG)), instPtr->antConfig.rfFreq[1] = (uint8_t)hopPattern[i];
dataSrcPtr, sizeof(PHY_ANT_CONFIG)); instPtr->antConfig.rfFreq[0] = (uint8_t)(hopPattern[i] >> 8);
memcpy((uint8_t *)(antConfigAddr + i * ANT_CONFIG_LEN),
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)
/*
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) | ((hopNum << ANT_CONFIG_NUM_SHIFT) & ANT_CONFIG_NUM_MASK)
| ((sizeof(uint16_t) << ANT_CONFIG_LEN_SHIFT) & ANT_CONFIG_LEN_MASK); | ((ANT_CONFIG_LEN << ANT_CONFIG_LEN_SHIFT) & ANT_CONFIG_LEN_MASK);
*/
PhyWrite(instPtr, ANT_CONFIG, antCtrl); PhyWrite(instPtr, ANT_CONFIG, antCtrl);
+107 -88
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_ANT_NUM_CH 4
#define L1_TXRXDATA_MAX_LEN 2048
#define L1_FRAME_NONE_LEN UINT32_MAX // byte #define L1_FRAME_NONE_LEN UINT32_MAX // byte
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L) #define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L)
#define L1_FRAME_NONE_HOPS UINT32_MAX #define L1_FRAME_NONE_HOPS UINT32_MAX
#define L1_TXRXDATA_MAX_LEN 2048
#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 trSlect; ///< 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 rxtxMode; ///< Only for debug \n
* in single subarray mode, 0~3 specified the subarray /// default 0x00
* Only in debug mode*/ uint8_t calibrMode; ///< 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 rcvMgc; ///< 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,21 +238,6 @@ 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);
@@ -247,7 +266,7 @@ uint32_t Phy_GetTimeComp(L1_FRAME_TYPE frameType);
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig); void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig);
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, PHY_ANT_BEAM_WIDTH beamWidth);
int32_t Phy_SetBeamAngle(PHY_INST *phyInstPtr, double offAx, double rndAx); 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); int32_t Phy_SetTimeWord(PHY_INST *instPtr, const TIME_WORD *tmWord, PHY_TIME_WORD_TYPE tmType);
+11 -11
View File
@@ -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
+1 -1
View File
@@ -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;
} }
} }