forked from gatsby/df_datalink
feat: 更新物理层接口, 删除波束相关内容, 增加天线ID, 修改天线模式配置
This commit is contained in:
@@ -38,53 +38,48 @@
|
|||||||
|
|
||||||
#define CTRL_WORD_DEFAULT 0x00
|
#define CTRL_WORD_DEFAULT 0x00
|
||||||
|
|
||||||
#define ANT_MODE_BEAM_MASK 0xF0
|
#define ANT_MODE_TX_MASK 0x70
|
||||||
#define ANT_BEAM_NARROR 0x00 // 8
|
#define ANT_MODE_RX_MASK 0x0F
|
||||||
#define ANT_BEAM_SUBNARROR_0 0x10 // 25
|
|
||||||
#define ANT_BEAM_SUBNARROR_1 0x20 // 60
|
|
||||||
#define ANT_BEAM_WIDE 0x30 // 120
|
|
||||||
|
|
||||||
#define ANT_MODE_POWER_MASK 0x0F
|
#define ANT_MODE_TX_OFF 0x00
|
||||||
#define ANT_POWER_FULL 0x00
|
#define ANT_MODE_TX1 BIT(4)
|
||||||
#define ANT_POWER_LOW 0x04
|
#define ANT_MODE_TX2 BIT(5)
|
||||||
#define ANT_POWER_STANDBY 0x0F
|
#define ANT_MODE_TX3 BIT(6)
|
||||||
#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 ANT_MODE_RX_AJ BIT(0)
|
||||||
|
#define ANT_MODE_RX_NORMAL 0x00
|
||||||
|
|
||||||
#define RXTXMODE_RX 0x00
|
#define ANT_MODE_RX_AJ1 (BIT(1) | ANT_MODE_RX_AJ)
|
||||||
#define RXTXMODE_TX 0x01
|
#define ANT_MODE_RX_AJ2 (BIT(2) | ANT_MODE_RX_AJ)
|
||||||
|
#define ANT_MODE_RX_AJ3 (BIT(3) | ANT_MODE_RX_AJ)
|
||||||
|
|
||||||
#define RXTXMODE_DEFAULT 0x00
|
#define ATN_MODE_DEFAULT (ANT_MODE_TX_OFF | ANT_MODE_RX_NORMAL)
|
||||||
|
|
||||||
#define CALIBRMODE_NORMAL 0x00
|
#define DEFAULT_CENTRTAL_FREQ 300U // 4 GHz
|
||||||
#define CALIBRMODE_SINGLE_TR_CAL 0x01
|
|
||||||
|
|
||||||
#define RF_CTRL_DEFAULT 0x00
|
|
||||||
|
|
||||||
// Pair by regex
|
// Pair by regex
|
||||||
// Regex: (([0-9]+, ){8})
|
// Regex: (([0-9]+, ){8})
|
||||||
const uint16_t freqTable[L1_FRAME_MAX_HOPS] =
|
const uint16_t freqTable[L1_FRAME_MAX_HOPS] =
|
||||||
{
|
{
|
||||||
1084U, 1097U, 1110U, 1123U, 1136U, 1149U, 1162U, 1175U,
|
0U, 7U, 15U, 22U, 30U, 37U, 45U, 52U,
|
||||||
1188U, 1201U, 1214U, 1227U, 1240U, 1253U, 1266U, 1279U,
|
60U, 67U, 75U, 82U, 90U, 97U, 105U, 112U,
|
||||||
1292U, 1305U, 1318U, 1331U, 1344U, 1357U, 1370U, 1383U,
|
120U, 127U, 135U, 142U, 150U, 157U, 165U, 172U,
|
||||||
1396U, 1409U, 1422U, 1435U, 1448U, 1461U, 1474U, 1487U,
|
180U, 187U, 195U, 202U, 210U, 217U, 225U, 232U,
|
||||||
1500U, 1513U, 1526U, 1539U, 1552U, 1565U, 1578U, 1591U,
|
240U, 247U, 255U, 262U, 270U, 277U, 285U, 292U,
|
||||||
1604U, 1617U, 1630U, 1643U, 1656U, 1669U, 1682U, 1695U,
|
300U, 307U, 315U, 322U, 330U, 337U, 345U, 352U,
|
||||||
1708U, 1721U, 1734U, 1747U, 1760U, 1773U, 1786U, 1799U,
|
360U, 367U, 375U, 382U, 390U, 397U, 405U, 412U,
|
||||||
1812U, 1825U, 1838U, 1851U, 1864U, 1877U, 1890U, 1903U,
|
420U, 427U, 435U, 442U, 450U, 457U, 465U, 472U,
|
||||||
1916U, 1929U, 1942U, 1955U, 1968U, 1981U, 1994U, 2007U,
|
480U, 487U, 495U, 502U, 510U, 517U, 525U, 532U,
|
||||||
2020U, 2033U, 2046U, 2059U, 2072U, 2085U, 2098U, 2111U,
|
540U, 547U, 555U, 562U, 570U, 577U, 585U, 592U,
|
||||||
2124U
|
600U,
|
||||||
};
|
};
|
||||||
|
|
||||||
const int16_t antCalTable[L1_FRAME_MAX_HOPS][L1_ANT_CH_NUM] =
|
|
||||||
|
const uint8_t antCalTable[L1_ANT_NUM][L1_FRAME_MAX_HOPS][L1_ANT_CH_NUM] =
|
||||||
//Antenna-JG01
|
//Antenna-JG01
|
||||||
{
|
{
|
||||||
|
// Antenna-1
|
||||||
|
{
|
||||||
{ 0, 2525, -7533, -6846}, { 0, 12726, -7818, -6860},
|
{ 0, 2525, -7533, -6846}, { 0, 12726, -7818, -6860},
|
||||||
{ 0, 2490, -7836, -6907}, { 0, 4479, -7716, -6837},
|
{ 0, 2490, -7836, -6907}, { 0, 4479, -7716, -6837},
|
||||||
{ 0, 6409, -7770, -6776}, { 0, 14616, -7977, -6816},
|
{ 0, 6409, -7770, -6776}, { 0, 14616, -7977, -6816},
|
||||||
@@ -126,43 +121,133 @@ const int16_t antCalTable[L1_FRAME_MAX_HOPS][L1_ANT_CH_NUM] =
|
|||||||
{ 0, 1616, -7436, -8572}, { 0, 1589, -7597, -8590},
|
{ 0, 1616, -7436, -8572}, { 0, 1589, -7597, -8590},
|
||||||
{ 0, 1722, -7550, -8568}, { 0, 1741, -7691, -8449},
|
{ 0, 1722, -7550, -8568}, { 0, 1741, -7691, -8449},
|
||||||
{ 0, 1767, -7775, -8328},
|
{ 0, 1767, -7775, -8328},
|
||||||
|
},
|
||||||
|
// Antenna-2
|
||||||
|
{
|
||||||
|
{ 0, 2525, -7533, -6846}, { 0, 12726, -7818, -6860},
|
||||||
|
{ 0, 2490, -7836, -6907}, { 0, 4479, -7716, -6837},
|
||||||
|
{ 0, 6409, -7770, -6776}, { 0, 14616, -7977, -6816},
|
||||||
|
{ 0, -22557, -8002, -6911}, { 0, -22587, -8121, -6918},
|
||||||
|
{ 0, -1124, -8123, -7030}, { 0, -152, -8219, -7042},
|
||||||
|
{ 0, 1823, -8209, -7130}, { 0, 1790, -8290, -7214},
|
||||||
|
{ 0, 1669, -8362, -7283}, { 0, 1634, -8459, -7276},
|
||||||
|
{ 0, 1615, -8315, -7415}, { 0, 1698, -8168, -7366},
|
||||||
|
{ 0, 1535, -8285, -7520}, { 0, 1619, -8285, -7532},
|
||||||
|
{ 0, 1609, -8201, -7693}, { 0, 1671, -8145, -7769},
|
||||||
|
{ 0, 1676, -8135, -7805}, { 0, 951, -10279, -8871},
|
||||||
|
{ 0, 976, -10235, -8978}, { 0, 1118, -10127, -9019},
|
||||||
|
{ 0, 1175, -10003, -9007}, { 0, 1386, -9847, -9039},
|
||||||
|
{ 0, 1535, -9572, -9058}, { 0, 1729, -9493, -9006},
|
||||||
|
{ 0, -1158, -9312, -9003}, { 0, 23771, -9147, -8928},
|
||||||
|
{ 0, 20733, -9074, -8924}, { 0, 2455, -8841, -8886},
|
||||||
|
{ 0, 2622, -8718, -8735}, { 0, 2791, -8615, -8705},
|
||||||
|
{ 0, 2861, -8168, -8331}, { 0, 3076, -8091, -8218},
|
||||||
|
{ 0, 3257, -8046, -8100}, { 0, 3331, -7923, -8073},
|
||||||
|
{ 0, 3396, -7826, -7994}, { 0, 3478, -7842, -8016},
|
||||||
|
{ 0, 3518, -7846, -7765}, { 0, 3585, -7753, -7715},
|
||||||
|
{ 0, 150, -8145, -8591}, { 0, 192, -8090, -8570},
|
||||||
|
{ 0, 207, -8150, -8597}, { 0, 178, -8142, -8656},
|
||||||
|
{ 0, 89, -8557, -8688}, { 0, 107, -8614, -8733},
|
||||||
|
{ 0, 194, -8605, -8782}, { 0, 153, -8655, -8881},
|
||||||
|
{ 0, 70, -8615, -8952}, { 0, 35, -8596, -9148},
|
||||||
|
{ 0, 49, -8636, -9286}, { 0, 6, -8587, -9435},
|
||||||
|
{ 0, -51, -8540, -9549}, { 0, -65, -8588, -9700},
|
||||||
|
{ 0, -55, -8503, -9820}, { 0, -20, -8414, -9907},
|
||||||
|
{ 0, -112, -8481, -10031}, { 0, -69, -8535, -10185},
|
||||||
|
{ 0, 2, -8550, -10052}, { 0, -1, -8493, -10291},
|
||||||
|
{ 0, -73, -8441, -10380}, { 0, 1958, -6930, -8295},
|
||||||
|
{ 0, -1148, -6939, -8396}, { 0, 1915, -6784, -8370},
|
||||||
|
{ 0, 1871, -6970, -8514}, { 0, 1821, -6974, -8387},
|
||||||
|
{ 0, 1781, -6906, -8431}, { 0, 1736, -6897, -8462},
|
||||||
|
{ 0, 1664, -7024, -8377}, { 0, 1629, -7127, -8436},
|
||||||
|
{ 0, 1603, -7148, -8528}, { 0, 1577, -7198, -8500},
|
||||||
|
{ 0, 1528, -7311, -8512}, { 0, 1577, -7390, -8570},
|
||||||
|
{ 0, 1616, -7436, -8572}, { 0, 1589, -7597, -8590},
|
||||||
|
{ 0, 1722, -7550, -8568}, { 0, 1741, -7691, -8449},
|
||||||
|
{ 0, 1767, -7775, -8328},
|
||||||
|
},
|
||||||
|
// Antenna-3
|
||||||
|
{
|
||||||
|
{ 0, 2525, -7533, -6846}, { 0, 12726, -7818, -6860},
|
||||||
|
{ 0, 2490, -7836, -6907}, { 0, 4479, -7716, -6837},
|
||||||
|
{ 0, 6409, -7770, -6776}, { 0, 14616, -7977, -6816},
|
||||||
|
{ 0, -22557, -8002, -6911}, { 0, -22587, -8121, -6918},
|
||||||
|
{ 0, -1124, -8123, -7030}, { 0, -152, -8219, -7042},
|
||||||
|
{ 0, 1823, -8209, -7130}, { 0, 1790, -8290, -7214},
|
||||||
|
{ 0, 1669, -8362, -7283}, { 0, 1634, -8459, -7276},
|
||||||
|
{ 0, 1615, -8315, -7415}, { 0, 1698, -8168, -7366},
|
||||||
|
{ 0, 1535, -8285, -7520}, { 0, 1619, -8285, -7532},
|
||||||
|
{ 0, 1609, -8201, -7693}, { 0, 1671, -8145, -7769},
|
||||||
|
{ 0, 1676, -8135, -7805}, { 0, 951, -10279, -8871},
|
||||||
|
{ 0, 976, -10235, -8978}, { 0, 1118, -10127, -9019},
|
||||||
|
{ 0, 1175, -10003, -9007}, { 0, 1386, -9847, -9039},
|
||||||
|
{ 0, 1535, -9572, -9058}, { 0, 1729, -9493, -9006},
|
||||||
|
{ 0, -1158, -9312, -9003}, { 0, 23771, -9147, -8928},
|
||||||
|
{ 0, 20733, -9074, -8924}, { 0, 2455, -8841, -8886},
|
||||||
|
{ 0, 2622, -8718, -8735}, { 0, 2791, -8615, -8705},
|
||||||
|
{ 0, 2861, -8168, -8331}, { 0, 3076, -8091, -8218},
|
||||||
|
{ 0, 3257, -8046, -8100}, { 0, 3331, -7923, -8073},
|
||||||
|
{ 0, 3396, -7826, -7994}, { 0, 3478, -7842, -8016},
|
||||||
|
{ 0, 3518, -7846, -7765}, { 0, 3585, -7753, -7715},
|
||||||
|
{ 0, 150, -8145, -8591}, { 0, 192, -8090, -8570},
|
||||||
|
{ 0, 207, -8150, -8597}, { 0, 178, -8142, -8656},
|
||||||
|
{ 0, 89, -8557, -8688}, { 0, 107, -8614, -8733},
|
||||||
|
{ 0, 194, -8605, -8782}, { 0, 153, -8655, -8881},
|
||||||
|
{ 0, 70, -8615, -8952}, { 0, 35, -8596, -9148},
|
||||||
|
{ 0, 49, -8636, -9286}, { 0, 6, -8587, -9435},
|
||||||
|
{ 0, -51, -8540, -9549}, { 0, -65, -8588, -9700},
|
||||||
|
{ 0, -55, -8503, -9820}, { 0, -20, -8414, -9907},
|
||||||
|
{ 0, -112, -8481, -10031}, { 0, -69, -8535, -10185},
|
||||||
|
{ 0, 2, -8550, -10052}, { 0, -1, -8493, -10291},
|
||||||
|
{ 0, -73, -8441, -10380}, { 0, 1958, -6930, -8295},
|
||||||
|
{ 0, -1148, -6939, -8396}, { 0, 1915, -6784, -8370},
|
||||||
|
{ 0, 1871, -6970, -8514}, { 0, 1821, -6974, -8387},
|
||||||
|
{ 0, 1781, -6906, -8431}, { 0, 1736, -6897, -8462},
|
||||||
|
{ 0, 1664, -7024, -8377}, { 0, 1629, -7127, -8436},
|
||||||
|
{ 0, 1603, -7148, -8528}, { 0, 1577, -7198, -8500},
|
||||||
|
{ 0, 1528, -7311, -8512}, { 0, 1577, -7390, -8570},
|
||||||
|
{ 0, 1616, -7436, -8572}, { 0, 1589, -7597, -8590},
|
||||||
|
{ 0, 1722, -7550, -8568}, { 0, 1741, -7691, -8449},
|
||||||
|
{ 0, 1767, -7775, -8328},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t hopPattern_ADV_24MS[L1_FRAME_ADV_24MS_HOPS] =
|
const uint8_t hopPattern_ADV_24MS[L1_FRAME_ADV_24MS_HOPS] =
|
||||||
{
|
{
|
||||||
0
|
0U, 35U, 66U, 47U, 40U, 16U, 30U, 65U,
|
||||||
|
43U, 7U, 70U, 63U, 7U, 65U, 42U, 28U,
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t hopPattern_ACK_8MS[L1_FRAME_ACK_8MS_HOPS] =
|
const uint8_t hopPattern_ACK_8MS[L1_FRAME_ACK_8MS_HOPS] =
|
||||||
{
|
{
|
||||||
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
|
0U, 5U, 49U, 25U,
|
||||||
8U, 9U, 10U, 11U, 12U, 13U, 14U, 15U,
|
|
||||||
16U, 17U, 18U, 19U, 20U, 21U, 22U, 23U,
|
|
||||||
24U, 25U, 26U, 27U, 28U, 29U, 30U, 31U,
|
|
||||||
32U, 33U, 34U, 35U, 36U, 37U, 38U, 39U,
|
|
||||||
40U, 41U, 42U, 43U, 44U, 45U, 46U, 47U,
|
|
||||||
48U, 49U, 50U, 51U, 52U, 53U, 54U, 55U,
|
|
||||||
56U, 57U, 58U, 59U, 60U, 61U, 62U, 63U,
|
|
||||||
64U, 65U, 66U, 67U, 68U, 69U, 70U, 71U,
|
|
||||||
72U, 73U, 74U, 75U, 76U, 77U, 78U, 79U,
|
|
||||||
80U
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t hopPattern_128KBPS_4MS[L1_FRAME_128KBPS_4MS_HOPS] =
|
const uint8_t hopPattern_128KBPS_4MS[L1_FRAME_128KBPS_4MS_HOPS] =
|
||||||
{
|
{
|
||||||
80U
|
80U, 16U, 17U, 65U, 60U, 54U, 31U, 15U,
|
||||||
|
6U, 19U, 79U, 52U, 29U, 42U, 23U, 59U,
|
||||||
|
60U, 58U, 76U, 67U, 31U, 76U, 77U, 79U,
|
||||||
|
79U, 14U, 61U, 5U, 71U, 50U, 32U, 77U,
|
||||||
|
60U,
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t hopPattern_512KBPS_4MS[L1_FRAME_512KBPS_4MS_HOPS] =
|
const uint8_t hopPattern_512KBPS_4MS[L1_FRAME_512KBPS_4MS_HOPS] =
|
||||||
{
|
{
|
||||||
80U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
|
80U, 62U, 40U, 66U, 65U, 33U, 55U, 33U,
|
||||||
8U, 9U, 10U
|
57U, 11U, 37U, 45U, 5U, 69U, 77U, 54U,
|
||||||
|
37U, 63U, 14U, 64U, 76U, 31U, 45U, 52U,
|
||||||
|
40U, 20U, 20U, 32U, 0U, 60U, 23U, 19U,
|
||||||
|
15U, 38U, 62U, 18U,
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t hopPattern_2MBPS_4MS[L1_FRAME_2MBPS_4MS_HOPS] =
|
const uint8_t hopPattern_2MBPS_4MS[L1_FRAME_2MBPS_4MS_HOPS] =
|
||||||
{
|
{
|
||||||
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
|
0U, 13U, 37U, 44U, 16U, 0U, 59U, 50U,
|
||||||
8U,
|
69U, 70U, 58U, 14U, 9U, 72U, 27U, 25U,
|
||||||
|
21U, 76U, 20U, 35U, 30U, 58U, 22U, 59U,
|
||||||
|
48U, 33U, 8U, 7U, 41U, 12U, 44U, 79U,
|
||||||
|
77U, 38U, 76U, 75U, 48U, 56U,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @} PhysicalLayer_AntennaConfig_Constants*/
|
/** @} PhysicalLayer_AntennaConfig_Constants*/
|
||||||
@@ -180,51 +265,26 @@ void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
|
|||||||
{
|
{
|
||||||
ASSERT(antConfig != NULL);
|
ASSERT(antConfig != NULL);
|
||||||
|
|
||||||
antConfig->ctrlWord = CTRL_WORD_DEFAULT;
|
antConfig->rfMode = ATN_MODE_DEFAULT;
|
||||||
antConfig->antMode = ATN_MODE_DEFAULT;
|
|
||||||
|
|
||||||
// FIXME: Dummy default value.
|
// FIXME: Dummy default value.
|
||||||
// off axis angle setting
|
for (uint8_t ii = 0; ii < L1_ANT_NUM; ii ++)
|
||||||
antConfig->oaxis[0] = 0;
|
{
|
||||||
antConfig->oaxis[1] = 0;
|
for (uint8_t jj = 0; jj < L1_ANT_CH_NUM; jj ++)
|
||||||
// round axis angle setting
|
{
|
||||||
antConfig->raxis[0] = 0;
|
antConfig->rfNormComp[ii][jj] = 0;
|
||||||
antConfig->raxis[1] = 0;
|
antConfig->rfNormIdpAttn[ii][jj] = 0;
|
||||||
// ***********************
|
}
|
||||||
|
antConfig->rfNormComAttn[ii] = 0;
|
||||||
|
antConfig->rfFreq[ii][0] = (uint8_t)(DEFAULT_CENTRTAL_FREQ);
|
||||||
|
antConfig->rfFreq[ii][1] = (uint8_t)(DEFAULT_CENTRTAL_FREQ >> 8);
|
||||||
|
}
|
||||||
|
|
||||||
antConfig->antFreq[0] = (uint8_t)(DEFAULT_CENTRTAL_FREQ);
|
for (uint8_t ii = 0; ii < L1_ANT_CH_NUM; ii ++)
|
||||||
antConfig->antFreq[1] = (uint8_t)(DEFAULT_CENTRTAL_FREQ >> 8);
|
{
|
||||||
|
antConfig->rfAntiAttn[ii] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Dummy default value.
|
|
||||||
// trSelect
|
|
||||||
antConfig->trSlect = 0;
|
|
||||||
// Antenna attenuation setting
|
|
||||||
antConfig->antAtt = 0;
|
|
||||||
// phase setting
|
|
||||||
antConfig->phase = 0;
|
|
||||||
// ***********************
|
|
||||||
|
|
||||||
antConfig->rxtxMode = RXTXMODE_DEFAULT;
|
|
||||||
antConfig->calibrMode = CALIBRMODE_NORMAL;
|
|
||||||
antConfig->antReserved = 0x00;
|
|
||||||
|
|
||||||
// FIXME: Dummy default value.
|
|
||||||
// RF mode control
|
|
||||||
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
|
|
||||||
antConfig->rfTxMgc = 0;
|
|
||||||
// RF channel 1&2 calibration mgc
|
|
||||||
antConfig->rf12CalMgc = 0;
|
|
||||||
// RF channel 2&3 calibration mgc
|
|
||||||
antConfig->rf34CalMgc = 0;
|
|
||||||
// Receive channel 1-4 MGC
|
|
||||||
antConfig->rcvMgc = 0;
|
|
||||||
antConfig->rfReserved0 = 0x00;
|
|
||||||
antConfig->rfReserved1 = 0x00;
|
|
||||||
// ***********************
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -240,168 +300,113 @@ void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
|
|||||||
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
|
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
|
||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
uint8_t config = instPtr->antConfig.antMode & ANT_MODE_BEAM_MASK;
|
uint8_t config = instPtr->antConfig.rfMode;
|
||||||
|
size_t antIndexCurr = Phy_GetCurrentAntIndex(instPtr);
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case PHY_ANT_MODE_STANDBY:
|
case PHY_ANT_MODE_STANDBY:
|
||||||
config |= ANT_POWER_STANDBY;
|
config &= ~ANT_MODE_TX_MASK;
|
||||||
|
config |= ANT_MODE_TX_OFF;
|
||||||
break;
|
break;
|
||||||
case PHY_ANT_MODE_POWER_LOW:
|
case PHY_ANT_MODE_NORMAL:
|
||||||
config |= ANT_POWER_LOW;
|
config &= ~(ANT_MODE_TX_MASK | ANT_MODE_RX_MASK);
|
||||||
|
config |= ANT_MODE_RX_NORMAL;
|
||||||
|
|
||||||
|
switch (antIndexCurr)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
config |= ANT_MODE_TX1;
|
||||||
break;
|
break;
|
||||||
case PHY_ANT_MODE_POWER_FULL:
|
case 1:
|
||||||
config |= ANT_POWER_FULL;
|
config |= ANT_MODE_TX2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
config |= ANT_MODE_TX3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
config |= ANT_MODE_TX_OFF;
|
||||||
|
DBG_WARNING("Unknown tx antenna number: %" PRIu8 ", tx is off.\n", antIndexCurr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case PHY_ANT_MODE_ANTI_JAM:
|
||||||
|
config &= ~(ANT_MODE_TX_MASK | ANT_MODE_RX_MASK);
|
||||||
|
|
||||||
|
switch (antIndexCurr)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
config |= ANT_MODE_TX1;
|
||||||
|
config |= ANT_MODE_RX_AJ1;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
config |= ANT_MODE_TX2;
|
||||||
|
config |= ANT_MODE_RX_AJ2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
config |= ANT_MODE_TX3;
|
||||||
|
config |= ANT_MODE_RX_AJ3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
config |= ANT_MODE_TX_OFF;
|
||||||
|
config |= ANT_MODE_RX_NORMAL;
|
||||||
|
DBG_WARNING("Unknown tx antenna number: %" PRIu8 ", remain normal mode.\n", antIndexCurr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG_ERROR("Unknown antenna mode: %" PRIu8 ", remain previous mode.\n", mode);
|
DBG_ERROR("Unknown antenna mode: %" PRIu8 ", remain previous mode.\n", mode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
instPtr->phyLog.antMode = mode;
|
instPtr->phyLog.rfMode = mode;
|
||||||
instPtr->antConfig.antMode = config;
|
instPtr->antConfig.rfMode = config;
|
||||||
// Sync logs to system monitor
|
// Sync logs to system monitor
|
||||||
SysMonitor_UpdatePhysicalLayerLog(&(instPtr->phyLog));
|
SysMonitor_UpdatePhysicalLayerLog(&(instPtr->phyLog));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
* @brief Update antenna beam table
|
* @brief Update antenna index of the next slot.
|
||||||
*
|
*
|
||||||
* @param instPtr pointer to physical layer instance
|
* @param instPtr pointer to physical layer instance
|
||||||
* @param table new beam table
|
* @param AntIndex antenna index
|
||||||
* @param offset table offset
|
|
||||||
*
|
|
||||||
* @return None
|
|
||||||
*
|
|
||||||
******************************************************************************/
|
|
||||||
void Phy_SetBeamTable(PHY_INST *instPtr, PHY_ANT_ANGLE *table, uint32_t offset)
|
|
||||||
{
|
|
||||||
ASSERT(instPtr != NULL);
|
|
||||||
ASSERT(table != NULL);
|
|
||||||
for (int i = 0; i < L1_ANT_PATTERN_NUM; i++)
|
|
||||||
{
|
|
||||||
instPtr->antNrrwPattern[i] = table[(i + offset) % L1_ANT_PATTERN_NUM];
|
|
||||||
}
|
|
||||||
memcpy((uint32_t *)instPtr->antInfoAddr, instPtr->antNrrwPattern,
|
|
||||||
L1_ANT_PATTERN_NUM * sizeof(PHY_ANT_ANGLE));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
|
||||||
* @brief Update antenna point direction using predefined beam table
|
|
||||||
*
|
|
||||||
* @param instPtr pointer to physical layer instance
|
|
||||||
* @param beamNo new beam index
|
|
||||||
*
|
*
|
||||||
* @return SUCCESS.
|
* @return SUCCESS.
|
||||||
* FAILURE beamNo exceeds the table size
|
* EPARAM - antenna index exceeds predefined range
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
int32_t Phy_SetBeamNo(PHY_INST *instPtr, size_t beamNo, PHY_ANT_BEAM_WIDTH beamWidth)
|
int32_t Phy_SetAntIndex(PHY_INST *instPtr, size_t antIndex)
|
||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
|
|
||||||
if (beamWidth == PHY_ANT_BEAM_16)
|
if (antIndex < 0 || antIndex >= L1_ANT_NUM)
|
||||||
{
|
{
|
||||||
if (beamNo >= L1_ANT_PATTERN_NUM)
|
DBG_ERROR("Antenna index out of range: %" PRIu8 ". \n", antIndex);
|
||||||
{
|
|
||||||
return FAILURE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
instPtr->beamNo.next = beamNo;
|
|
||||||
instPtr->antConfig.oaxis[0] = (uint8_t)(instPtr->antNrrwPattern[beamNo].oaxis >> 8);
|
|
||||||
instPtr->antConfig.oaxis[1] = (uint8_t)(instPtr->antNrrwPattern[beamNo].oaxis);
|
|
||||||
instPtr->antConfig.raxis[0] = (uint8_t)(instPtr->antNrrwPattern[beamNo].raxis >> 8);
|
|
||||||
instPtr->antConfig.raxis[1] = (uint8_t)(instPtr->antNrrwPattern[beamNo].raxis);
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Beam number assign not support.
|
|
||||||
// Assign default angle (0,0)
|
|
||||||
instPtr->beamNo.next = 0;
|
|
||||||
instPtr->antConfig.oaxis[0] = 0;
|
|
||||||
instPtr->antConfig.oaxis[1] = 0;
|
|
||||||
instPtr->antConfig.raxis[0] = 0;
|
|
||||||
instPtr->antConfig.raxis[1] = 0;
|
|
||||||
DBG_WARNING("Using default beam number...\n");
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
|
||||||
* @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)
|
|
||||||
{
|
|
||||||
ASSERT(instPtr != NULL);
|
|
||||||
uint8_t beamConfig = instPtr->antConfig.antMode & (~ANT_MODE_BEAM_MASK);
|
|
||||||
switch (beamWidth)
|
|
||||||
{
|
|
||||||
case PHY_ANT_BEAM_120:
|
|
||||||
beamConfig |= ANT_BEAM_WIDE;
|
|
||||||
break;
|
|
||||||
case PHY_ANT_BEAM_60:
|
|
||||||
beamConfig |= ANT_BEAM_SUBNARROR_1;
|
|
||||||
break;
|
|
||||||
case PHY_ANT_BEAM_25:
|
|
||||||
beamConfig |= ANT_BEAM_SUBNARROR_0;
|
|
||||||
break;
|
|
||||||
case PHY_ANT_BEAM_16:
|
|
||||||
beamConfig |= ANT_BEAM_NARROR;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
DBG_ERROR("Beam width code: 0x%08X is illegal.\n\r", beamWidth);
|
|
||||||
return EPARAM;
|
return EPARAM;
|
||||||
}
|
}
|
||||||
instPtr->antConfig.antMode = beamConfig;
|
DBG_INFO("Set new antenna index: %" PRId8 "\n", antIndex);
|
||||||
instPtr->beamWd.next = beamWidth;
|
instPtr->antIndex.next = antIndex;
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/**
|
/**
|
||||||
* @brief Set antenna to a specific direction
|
* @brief Get next antenna index.
|
||||||
*
|
*/
|
||||||
* @param instPtr pointer to physical layer instance
|
inline size_t Phy_GetCurrentAntIndex(PHY_INST *instPtr)
|
||||||
* @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)
|
|
||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
uint16_t offAxDeg = 0;
|
return instPtr->antIndex.curr;
|
||||||
uint16_t rndAxDeg = 0;
|
|
||||||
offAxDeg = (offAx >= 0) ? (((int32_t)(offAx * 180.0 / ANT_PI)) % 360) : (((int32_t)(offAx * 180.0 / ANT_PI)) % 360 + 360);
|
|
||||||
rndAxDeg = (rndAx >= 0) ? (((int32_t)(rndAx * 180.0 / ANT_PI)) % 360) : (((int32_t)(rndAx * 180.0 / ANT_PI)) % 360 + 360);
|
|
||||||
if (offAxDeg > 60)
|
|
||||||
{
|
|
||||||
DBG_ERROR("Angle out of range, off axis angle: %" PRIu16 " (should be 0~60), round axis angle: %" PRIu16 " (should be 0~360).\n",
|
|
||||||
offAxDeg, rndAxDeg);
|
|
||||||
return EPARAM;
|
|
||||||
}
|
|
||||||
offAxDeg = offAxDeg * 10;
|
|
||||||
rndAxDeg = rndAxDeg * 10;
|
|
||||||
instPtr->antConfig.oaxis[0] = (uint8_t)(offAxDeg >> 8);
|
|
||||||
instPtr->antConfig.oaxis[1] = (uint8_t)offAxDeg;
|
|
||||||
instPtr->antConfig.raxis[0] = (uint8_t)(rndAxDeg >> 8);
|
|
||||||
instPtr->antConfig.raxis[1] = (uint8_t)rndAxDeg;
|
|
||||||
return SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get current antenna index.
|
||||||
|
*/
|
||||||
|
inline size_t Phy_GetNextAntIndex(PHY_INST *instPtr)
|
||||||
|
{
|
||||||
|
ASSERT(instPtr != NULL);
|
||||||
|
return instPtr->antIndex.next;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** @} PhysicalLayer_AntennaControl*/
|
/** @} PhysicalLayer_AntennaControl*/
|
||||||
|
|
||||||
/** @} PhysicalLayer*/
|
/** @} PhysicalLayer*/
|
||||||
@@ -389,8 +389,7 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
|
|
||||||
memset(&((*instPtr))->tor, PHY_TOR_SUSPEND, sizeof(PHY_RCD));
|
memset(&((*instPtr))->tor, PHY_TOR_SUSPEND, sizeof(PHY_RCD));
|
||||||
memset(&((*instPtr)->frameType), L1_NONE_FRAME, sizeof(PHY_RCD));
|
memset(&((*instPtr)->frameType), L1_NONE_FRAME, sizeof(PHY_RCD));
|
||||||
memset(&((*instPtr)->beamNo), (int32_t)L1_INIT_BEAM_NO, sizeof(PHY_RCD));
|
memset(&((*instPtr)->antIndex), (int32_t)L1_INIT_ANT_IDX, sizeof(PHY_RCD));
|
||||||
memset(&((*instPtr)->beamWd), (int32_t)L1_INIT_ANT_WD, sizeof(PHY_RCD));
|
|
||||||
memset(&((*instPtr)->hwSate), 0x00, sizeof(HWSTATE));
|
memset(&((*instPtr)->hwSate), 0x00, sizeof(HWSTATE));
|
||||||
memset(&((*instPtr)->phyLog), 0x00, sizeof(PHYLOG));
|
memset(&((*instPtr)->phyLog), 0x00, sizeof(PHYLOG));
|
||||||
|
|
||||||
@@ -473,44 +472,6 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
(*instPtr)->recvDataAddr = rxDataBram.Config.MemBaseAddress;
|
(*instPtr)->recvDataAddr = rxDataBram.Config.MemBaseAddress;
|
||||||
(*instPtr)->sendDataAddr = txDataBram.Config.MemBaseAddress;
|
(*instPtr)->sendDataAddr = txDataBram.Config.MemBaseAddress;
|
||||||
|
|
||||||
// Setup antenna presets
|
|
||||||
XBram antInfoBram;
|
|
||||||
if (phyConfig->antInfoBramId != -1)
|
|
||||||
{
|
|
||||||
bramConfigPtr = XBram_LookupConfig(phyConfig->antInfoBramId);
|
|
||||||
if (bramConfigPtr == NULL)
|
|
||||||
{
|
|
||||||
Phy_Destroy(*instPtr);
|
|
||||||
return EDCONF;
|
|
||||||
}
|
|
||||||
Status = XBram_CfgInitialize(&antInfoBram, bramConfigPtr,
|
|
||||||
bramConfigPtr->CtrlBaseAddress);
|
|
||||||
if (Status != SUCCESS)
|
|
||||||
{
|
|
||||||
Phy_Destroy(*instPtr);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Execute the BRAM driver self test.
|
|
||||||
*/
|
|
||||||
Status = XBram_SelfTest(&antInfoBram, 0);
|
|
||||||
if (Status != SUCCESS)
|
|
||||||
{
|
|
||||||
Phy_Destroy(*instPtr);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
(*instPtr)->antInfoAddr = antInfoBram.Config.MemBaseAddress;
|
|
||||||
uint32_t phyMainCtrl = PhyRead(*instPtr, PHY_MAIN_CTRL);
|
|
||||||
phyMainCtrl &= ~PHY_MAIN_CTRL_NSCAN_MASK;
|
|
||||||
phyMainCtrl |= PHY_MAIN_CTRL_NSCAN_MASK &
|
|
||||||
(L1_ANT_PATTERN_NUM << PHY_MAIN_CTRL_NSCAN_SHIFT);
|
|
||||||
PhyWrite(*instPtr, PHY_MAIN_CTRL, phyMainCtrl);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
(*instPtr)->antInfoAddr = (uintptr_t)NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the XAdc driver. */
|
/* Initialize the XAdc driver. */
|
||||||
XAdcPs_Config *xadcConfigPtr;
|
XAdcPs_Config *xadcConfigPtr;
|
||||||
|
|
||||||
@@ -769,34 +730,24 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
|||||||
|
|
||||||
// TODO: Set antenna stand by, when suspend.
|
// TODO: Set antenna stand by, when suspend.
|
||||||
const uint8_t *dataSrcPtr = (uint8_t *)(&(instPtr->antConfig));
|
const uint8_t *dataSrcPtr = (uint8_t *)(&(instPtr->antConfig));
|
||||||
|
const size_t antIndexNext = Phy_GetNextAntIndex(instPtr);
|
||||||
size_t hopIdx;
|
size_t hopIdx;
|
||||||
uint16_t hopFreq;
|
uint16_t hopFreq;
|
||||||
int16_t hopCal;
|
uint8_t hopCal;
|
||||||
for (int32_t i = 0; i < hopNum; i++)
|
for (int32_t i = 0; i < hopNum; i++)
|
||||||
{
|
{
|
||||||
hopIdx = hopPattern[i];
|
hopIdx = hopPattern[i];
|
||||||
|
|
||||||
// Frequency setting
|
// Frequency setting
|
||||||
hopFreq = freqTable[hopIdx];
|
hopFreq = freqTable[hopIdx];
|
||||||
instPtr->antConfig.rfFreq[0] = (uint8_t)(hopFreq >> 8);
|
instPtr->antConfig.rfFreq[antIndexNext][0] = (uint8_t)(hopFreq >> 8);
|
||||||
instPtr->antConfig.rfFreq[1] = (uint8_t)hopFreq;
|
instPtr->antConfig.rfFreq[antIndexNext][1] = (uint8_t)hopFreq;
|
||||||
// Calibration setting
|
// Calibration setting
|
||||||
// -- CH0
|
for (uint8_t ii = 0; ii < L1_ANT_CH_NUM; ii ++)
|
||||||
hopCal = antCalTable[hopIdx][0];
|
{
|
||||||
instPtr->antConfig.ch0Cal[0] = (uint8_t)(hopCal >> 8);
|
hopCal = antCalTable[antIndexNext][hopIdx][ii];
|
||||||
instPtr->antConfig.ch0Cal[1] = (uint8_t)hopCal;
|
instPtr->antConfig.rfNormComp[antIndexNext][ii] = hopCal;
|
||||||
// -- CH1
|
}
|
||||||
hopCal = antCalTable[hopIdx][1];
|
|
||||||
instPtr->antConfig.ch1Cal[0] = (uint8_t)(hopCal >> 8);
|
|
||||||
instPtr->antConfig.ch1Cal[1] = (uint8_t)hopCal;
|
|
||||||
// -- CH2
|
|
||||||
hopCal = antCalTable[hopIdx][2];
|
|
||||||
instPtr->antConfig.ch2Cal[0] = (uint8_t)(hopCal >> 8);
|
|
||||||
instPtr->antConfig.ch2Cal[1] = (uint8_t)hopCal;
|
|
||||||
// -- CH3
|
|
||||||
hopCal = antCalTable[hopIdx][3];
|
|
||||||
instPtr->antConfig.ch3Cal[0] = (uint8_t)(hopCal >> 8);
|
|
||||||
instPtr->antConfig.ch3Cal[1] = (uint8_t)hopCal;
|
|
||||||
|
|
||||||
memcpy((uint8_t *)(antConfigAddr + i * ANT_COINFO_LEN),
|
memcpy((uint8_t *)(antConfigAddr + i * ANT_COINFO_LEN),
|
||||||
dataSrcPtr, sizeof(PHY_ANT_CONFIG));
|
dataSrcPtr, sizeof(PHY_ANT_CONFIG));
|
||||||
@@ -1107,17 +1058,17 @@ void Phy_RefreshHwSate(PHY_INST *instPtr)
|
|||||||
*/
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
* @brief Get the last scan beam number after autoscan.
|
* @brief Get the antenna number after physical listening.
|
||||||
*
|
*
|
||||||
* @param instPtr a pointer to physical instance
|
* @param instPtr a pointer to physical instance
|
||||||
*
|
*
|
||||||
* @return beam number
|
* @return antenna index
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
uint8_t Phy_LastScanBeamNo(PHY_INST *instPtr)
|
uint8_t Phy_ListenAntIndex(PHY_INST *instPtr)
|
||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
return (uint8_t)PhyRead(instPtr, BEAM_SELECT_INDEX);
|
return (uint8_t)PhyRead(instPtr, ANT_SELECT_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@@ -34,10 +34,9 @@
|
|||||||
* @name PhysicalLayer_Common_Constant
|
* @name PhysicalLayer_Common_Constant
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define L1_ANT_PATTERN_NUM 3U // 1 beam per antenna, and 3 antennas in total
|
#define L1_ANT_NUM 3U // 1 beam per antenna, and 3 antennas in total
|
||||||
#define L1_INIT_BEAM_NO 0U
|
|
||||||
#define L1_INIT_ANT_WD PHY_ANT_BEAM_FIXED
|
|
||||||
#define L1_ANT_CH_NUM 4U // channel number per antenna
|
#define L1_ANT_CH_NUM 4U // channel number per antenna
|
||||||
|
#define L1_INIT_ANT_IDX 0U
|
||||||
|
|
||||||
#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)
|
||||||
@@ -60,9 +59,9 @@ typedef enum
|
|||||||
L1_FRAME_NONE = 0,
|
L1_FRAME_NONE = 0,
|
||||||
L1_FRAME_ADV_24MS = 1,
|
L1_FRAME_ADV_24MS = 1,
|
||||||
L1_FRAME_ACK_8MS = 2,
|
L1_FRAME_ACK_8MS = 2,
|
||||||
L1_FRAME_128KBPS_4MS = 3,
|
L1_FRAME_128KBPS_4MS = 3, // 128kbps
|
||||||
L1_FRAME_512KBPS_4MS = 4,
|
L1_FRAME_512KBPS_4MS = 4, // 512kbps
|
||||||
L1_FRAME_2MBPS_4MS = 5
|
L1_FRAME_2MBPS_4MS = 5 // 2 Mbps
|
||||||
} L1_FRAME_TYPE;
|
} L1_FRAME_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,36 +71,35 @@ typedef enum
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
/*** Antenna & RF Control ***/
|
/*** Antenna & RF Control ***/
|
||||||
uint8_t antMode; ///< Antenna control mode
|
uint8_t rfNormComp[L1_ANT_NUM][L1_ANT_CH_NUM];
|
||||||
uint8_t rfNormComp[L1_ANT_PATTERN_NUM][L1_ANT_CH_NUM];
|
|
||||||
///< Normal mode RF phase compensation, 3 antennas
|
///< Normal mode RF phase compensation, 3 antennas
|
||||||
/// and 4 channels each: 0~63, 5.625° step
|
/// and 4 channels each: 0~63, 5.625° step
|
||||||
uint8_t rfNormAttn[L1_ANT_PATTERN_NUM][L1_ANT_CH_NUM + 1];
|
uint8_t rfNormIdpAttn[L1_ANT_NUM][L1_ANT_CH_NUM];
|
||||||
///< Normal mode RF attenuation, 3 antennas with 4
|
///< Normal mode RF attenuation for independent channel:
|
||||||
/// independent channel and 1 mix channel: 0~30 dB,
|
/// 0~30 dB, 1dB step
|
||||||
/// 1dB step
|
uint8_t rfNormComAttn[L1_ANT_NUM];
|
||||||
|
///< Normal mode RF attenuation for combined channel:
|
||||||
|
/// 0~30 dB, 1dB step
|
||||||
|
uint8_t rfMode; ///< Mode control:
|
||||||
|
/// [7]: reserved
|
||||||
|
/// [6]: Antenna 3 tx control, 1 - enable, 0 - disable
|
||||||
|
/// [5]: Antenna 2 tx control, 1 - enable, 0 - disable
|
||||||
|
/// [4]: Antenna 1 tx control, 1 - enable, 0 - disable
|
||||||
|
/// [3]: Anti-jamming antenna 3 select, 1 - enable, 0 - disable
|
||||||
|
/// [2]: Anti-jamming antenna 2 select, 1 - enable, 0 - disable
|
||||||
|
/// [1]: Anti-jamming antenna 1 select, 1 - enable, 0 - disable
|
||||||
|
/// only one antenna can be selected in anti-jamming mode
|
||||||
|
/// [0]: Anti-jamming mode control, 1 - enable, 0 - disable
|
||||||
uint8_t rfAntiAttn[L1_ANT_CH_NUM];
|
uint8_t rfAntiAttn[L1_ANT_CH_NUM];
|
||||||
///< Anti-jamming mode RF attenuation, 4 channels:
|
///< Anti-jamming mode RF attenuation, 4 channels:
|
||||||
/// 0~60 dB, 1dB step
|
/// 0~60 dB, 1dB step
|
||||||
uint8_t rfFreq[L1_ANT_PATTERN_NUM][2];
|
uint8_t rfFreq[L1_ANT_NUM][2];
|
||||||
///< RF synthesizer ping-pong frequency, 3 antennas
|
///< RF synthesizer ping-pong frequency, 3 antennas
|
||||||
/// and 2 byte each: 0~600 MHz, step 1MHz, with base
|
/// and 2 byte each: 0~600 MHz, step 1MHz, with base
|
||||||
/// frequency of 3700 MHz
|
/// frequency of 3700 MHz
|
||||||
uint8_t rfRsvd; ///< reserved for further use
|
uint8_t rfRsvd; ///< reserved for further use
|
||||||
} PHY_ANT_CONFIG;
|
} PHY_ANT_CONFIG;
|
||||||
|
|
||||||
/**
|
|
||||||
* @struct PHY_ANT_ANGLE
|
|
||||||
* @brief Describe the PhysicalLayer antenna angle
|
|
||||||
*/
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint16_t oaxis; ///< off-axis angle range is 0~60
|
|
||||||
/// 0.1 degree each LSB
|
|
||||||
uint16_t raxis; ///< round-axis angle range is 0~360
|
|
||||||
/// 0.1 degree each LSB
|
|
||||||
} PHY_ANT_ANGLE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum PHY_TIME_WORD_TYPE
|
* @enum PHY_TIME_WORD_TYPE
|
||||||
*/
|
*/
|
||||||
@@ -112,19 +110,6 @@ 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
|
|
||||||
{
|
|
||||||
PHY_ANT_BEAM_NONE = 0,
|
|
||||||
PHY_ANT_BEAM_120 = 1,
|
|
||||||
PHY_ANT_BEAM_60 = 2,
|
|
||||||
PHY_ANT_BEAM_25 = 3,
|
|
||||||
PHY_ANT_BEAM_16 = 4,
|
|
||||||
PHY_ANT_BEAM_FIXED = 5
|
|
||||||
} PHY_ANT_BEAM_WIDTH;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum PHY_TOR_TYPE
|
* @enum PHY_TOR_TYPE
|
||||||
*/
|
*/
|
||||||
@@ -177,7 +162,6 @@ typedef struct
|
|||||||
uint32_t txBramId; ///< tx bram ID
|
uint32_t txBramId; ///< tx bram ID
|
||||||
uint32_t rxBramId; ///< rx bram ID
|
uint32_t rxBramId; ///< rx bram ID
|
||||||
uint32_t antBramId; ///< antenna config bram ID
|
uint32_t antBramId; ///< antenna config bram ID
|
||||||
uint32_t antInfoBramId; ///< antenna beam info bram ID
|
|
||||||
uint32_t hwXadcId; ///< hardware xadc device ID
|
uint32_t hwXadcId; ///< hardware xadc device ID
|
||||||
uintptr_t baseAddr; ///< Physical layer controller base address
|
uintptr_t baseAddr; ///< Physical layer controller base address
|
||||||
#ifndef EMULATION
|
#ifndef EMULATION
|
||||||
@@ -198,7 +182,6 @@ typedef struct
|
|||||||
uintptr_t recvDataAddr; ///< receive data bram address
|
uintptr_t recvDataAddr; ///< receive data bram address
|
||||||
uintptr_t sendDataAddr; ///< send data bram address
|
uintptr_t sendDataAddr; ///< send data bram address
|
||||||
uintptr_t antConfigAddr; ///< antenna config data bram address
|
uintptr_t antConfigAddr; ///< antenna config data bram address
|
||||||
uintptr_t antInfoAddr; ///< antenna beam info data bram address
|
|
||||||
bool isPhyEn; ///< indicates if physical layer running
|
bool isPhyEn; ///< indicates if physical layer running
|
||||||
bool isAcq; ///< indicates if last reception acquisition success
|
bool isAcq; ///< indicates if last reception acquisition success
|
||||||
bool isFrameSync; ///< indicates if last reception frame sync success
|
bool isFrameSync; ///< indicates if last reception frame sync success
|
||||||
@@ -206,8 +189,7 @@ typedef struct
|
|||||||
bool isValid; ///< indicates if last reception frame data valid (crc check pass)
|
bool isValid; ///< indicates if last reception frame data valid (crc check pass)
|
||||||
TIME_WORD recvSlotTime; ///< last slot start time stamp
|
TIME_WORD recvSlotTime; ///< last slot start time stamp
|
||||||
TIME_WORD recvFsTime; ///< last frame sync time stamp
|
TIME_WORD recvFsTime; ///< last frame sync time stamp
|
||||||
PHY_RCD beamNo; ///< beam number record
|
PHY_RCD antIndex; ///< antenna number record
|
||||||
PHY_RCD beamWd; ///< beam width record
|
|
||||||
PHY_RCD tor; ///< tx rx state record
|
PHY_RCD tor; ///< tx rx state record
|
||||||
PHY_RCD frameType; ///< frame type record
|
PHY_RCD frameType; ///< frame type record
|
||||||
uint32_t sendDataOffset; ///< antenna configuration bram offset (to implement ping-pong data flow)
|
uint32_t sendDataOffset; ///< antenna configuration bram offset (to implement ping-pong data flow)
|
||||||
@@ -261,7 +243,7 @@ L1_FRAME_TYPE Phy_GetLastSendFrameType(PHY_INST *instPtr);
|
|||||||
* @defgroup PhysicalLayer_Receive_Estimations
|
* @defgroup PhysicalLayer_Receive_Estimations
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
uint8_t Phy_LastScanBeamNo(PHY_INST *instPtr);
|
uint8_t Phy_ListenAntIndex(PHY_INST *instPtr);
|
||||||
double Phy_GetFreqEst(PHY_INST *instPtr);
|
double Phy_GetFreqEst(PHY_INST *instPtr);
|
||||||
double Phy_GetCoarseFreqEst(PHY_INST *instPtr);
|
double Phy_GetCoarseFreqEst(PHY_INST *instPtr);
|
||||||
double Phy_GetFineFreqEst(PHY_INST *instPtr);
|
double Phy_GetFineFreqEst(PHY_INST *instPtr);
|
||||||
@@ -277,10 +259,9 @@ void Phy_GetLastReceivedSlotStartTimeStamp(PHY_INST *instPtr, TIME_WORD *slotSta
|
|||||||
*/
|
*/
|
||||||
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig);
|
void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig);
|
||||||
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode);
|
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode);
|
||||||
void Phy_SetBeamTable(PHY_INST *instPtr, PHY_ANT_ANGLE *table, uint32_t offset);
|
int32_t Phy_SetAntIndex(PHY_INST *instPtr, size_t antIndex);
|
||||||
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth);
|
size_t Phy_GetCurrentAntIndex(PHY_INST *instPtr);
|
||||||
int32_t Phy_SetBeamNo(PHY_INST *instPtr, size_t beamNo, PHY_ANT_BEAM_WIDTH beamWidth);
|
size_t Phy_GetNextAntIndex(PHY_INST *instPtr);
|
||||||
int32_t Phy_SetBeamAngle(PHY_INST *phyInstPtr, double offAx, double rndAx);
|
|
||||||
/** @} PhysicalLayer_AntennaControl*/
|
/** @} PhysicalLayer_AntennaControl*/
|
||||||
|
|
||||||
#endif // PHY_CTRL_H_
|
#endif // PHY_CTRL_H_
|
||||||
|
|||||||
@@ -252,23 +252,12 @@
|
|||||||
#define FINE_FREQEST_SIGN_NEG 0x01000000U
|
#define FINE_FREQEST_SIGN_NEG 0x01000000U
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register: BEAM_SELECT
|
* Register: ANT_SELECT
|
||||||
*/
|
*/
|
||||||
#define BEAM_SELECT_INDEX 0x00000044U
|
#define ANT_SELECT_INDEX 0x00000044U
|
||||||
#define BEAM_SELECT_INDEX_SHIFT 0
|
#define ANT_SELECT_INDEX_SHIFT 0
|
||||||
#define BEAM_SELECT_INDEX_WIDTH 32
|
#define ANT_SELECT_INDEX_WIDTH 32
|
||||||
#define BEAM_SELECT_INDEX_MASK 0xFFFFFFFFU
|
#define ANT_SELECT_INDEX_MASK 0xFFFFFFFFU
|
||||||
|
|
||||||
/**
|
|
||||||
* Register: BEAM_AXIS
|
|
||||||
*/
|
|
||||||
#define BEAM_AXIS 0x00000048U
|
|
||||||
#define BEAM_AXIS_EL_SHIFT 0
|
|
||||||
#define BEAM_AXIS_EL_WIDTH 16
|
|
||||||
#define BEAM_AXIS_EL_MASK 0x0000FFFFU
|
|
||||||
#define BEAM_AXIS_AZ_SHIFT 16
|
|
||||||
#define BEAM_AXIS_AZ_WIDTH 16
|
|
||||||
#define BEAM_AXIS_AZ_MASK 0xFFFF0000U
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register: ANT_STATUS_1
|
* Register: ANT_STATUS_1
|
||||||
|
|||||||
Reference in New Issue
Block a user