3 Commits
Author SHA1 Message Date
bit-cyber-fh f363d3afba misc update 2024-04-02 00:05:54 +08:00
bit-cyber-fh ff4b609a37 *add physical ID 2024-04-02 00:05:35 +08:00
bit-cyber-fh bbdaa49d53 *add calibration setting 2024-04-02 00:04:21 +08:00
15 changed files with 384 additions and 107 deletions
+176
View File
@@ -0,0 +1,176 @@
declare -A calMap
calMap[JG01]="\{\n\
\{ 0, 2525, -7533, -6846\}, \{ 0, 12726, -7818, -6860\},\n\
\{ 0, 2490, -7836, -6907\}, \{ 0, 4479, -7716, -6837\},\n\
\{ 0, 6409, -7770, -6776\}, \{ 0, 14616, -7977, -6816\},\n\
\{ 0, -22557, -8002, -6911\}, \{ 0, -22587, -8121, -6918\},\n\
\{ 0, -1124, -8123, -7030\}, \{ 0, -152, -8219, -7042\},\n\
\{ 0, 1823, -8209, -7130\}, \{ 0, 1790, -8290, -7214\},\n\
\{ 0, 1669, -8362, -7283\}, \{ 0, 1634, -8459, -7276\},\n\
\{ 0, 1615, -8315, -7415\}, \{ 0, 1698, -8168, -7366\},\n\
\{ 0, 1535, -8285, -7520\}, \{ 0, 1619, -8285, -7532\},\n\
\{ 0, 1609, -8201, -7693\}, \{ 0, 1671, -8145, -7769\},\n\
\{ 0, 1676, -8135, -7805\}, \{ 0, 951, -10279, -8871\},\n\
\{ 0, 976, -10235, -8978\}, \{ 0, 1118, -10127, -9019\},\n\
\{ 0, 1175, -10003, -9007\}, \{ 0, 1386, -9847, -9039\},\n\
\{ 0, 1535, -9572, -9058\}, \{ 0, 1729, -9493, -9006\},\n\
\{ 0, -1158, -9312, -9003\}, \{ 0, 23771, -9147, -8928\},\n\
\{ 0, 20733, -9074, -8924\}, \{ 0, 2455, -8841, -8886\},\n\
\{ 0, 2622, -8718, -8735\}, \{ 0, 2791, -8615, -8705\},\n\
\{ 0, 2861, -8168, -8331\}, \{ 0, 3076, -8091, -8218\},\n\
\{ 0, 3257, -8046, -8100\}, \{ 0, 3331, -7923, -8073\},\n\
\{ 0, 3396, -7826, -7994\}, \{ 0, 3478, -7842, -8016\},\n\
\{ 0, 3518, -7846, -7765\}, \{ 0, 3585, -7753, -7715\},\n\
\{ 0, 150, -8145, -8591\}, \{ 0, 192, -8090, -8570\},\n\
\{ 0, 207, -8150, -8597\}, \{ 0, 178, -8142, -8656\},\n\
\{ 0, 89, -8557, -8688\}, \{ 0, 107, -8614, -8733\},\n\
\{ 0, 194, -8605, -8782\}, \{ 0, 153, -8655, -8881\},\n\
\{ 0, 70, -8615, -8952\}, \{ 0, 35, -8596, -9148\},\n\
\{ 0, 49, -8636, -9286\}, \{ 0, 6, -8587, -9435\},\n\
\{ 0, -51, -8540, -9549\}, \{ 0, -65, -8588, -9700\},\n\
\{ 0, -55, -8503, -9820\}, \{ 0, -20, -8414, -9907\},\n\
\{ 0, -112, -8481, -10031\}, \{ 0, -69, -8535, -10185\},\n\
\{ 0, 2, -8550, -10052\}, \{ 0, -1, -8493, -10291\},\n\
\{ 0, -73, -8441, -10380\}, \{ 0, 1958, -6930, -8295\},\n\
\{ 0, -1148, -6939, -8396\}, \{ 0, 1915, -6784, -8370\},\n\
\{ 0, 1871, -6970, -8514\}, \{ 0, 1821, -6974, -8387\},\n\
\{ 0, 1781, -6906, -8431\}, \{ 0, 1736, -6897, -8462\},\n\
\{ 0, 1664, -7024, -8377\}, \{ 0, 1629, -7127, -8436\},\n\
\{ 0, 1603, -7148, -8528\}, \{ 0, 1577, -7198, -8500\},\n\
\{ 0, 1528, -7311, -8512\}, \{ 0, 1577, -7390, -8570\},\n\
\{ 0, 1616, -7436, -8572\}, \{ 0, 1589, -7597, -8590\},\n\
\{ 0, 1722, -7550, -8568\}, \{ 0, 1741, -7691, -8449\},\n\
\{ 0, 1767, -7775, -8328\}, \n\
};"
calMap[JG02]="\{\n\
\{ 0, 1573, -6646, -6900\}, \{ 0, 1251, -7021, -7119\},\n\
\{ 0, 1157, -7139, -7184\}, \{ 0, 970, -7380, -7280\},\n\
\{ 0, 803, -7646, -7340\}, \{ 0, 243, -7702, -7475\},\n\
\{ 0, 116, -7899, -7666\}, \{ 0, 345, -7915, -7779\},\n\
\{ 0, 257, -8072, -7835\}, \{ 0, 63, -8061, -7871\},\n\
\{ 0, -40, -8151, -7949\}, \{ 0, -144, -8363, -8066\},\n\
\{ 0, -184, -8320, -8111\}, \{ 0, -360, -8458, -8205\},\n\
\{ 0, -426, -8583, -8238\}, \{ 0, -444, -8534, -8338\},\n\
\{ 0, -451, -8508, -8371\}, \{ 0, -610, -8581, -8378\},\n\
\{ 0, -605, -8582, -8381\}, \{ 0, -1401, -8503, -8391\},\n\
\{ 0, -2160, -8656, -8346\}, \{ 0, 243, -9749, -9637\},\n\
\{ 0, -503, -9663, -9572\}, \{ 0, -444, -9526, -9554\},\n\
\{ 0, -495, -9581, -9559\}, \{ 0, -463, -9515, -9427\},\n\
\{ 0, -1209, -9399, -9343\}, \{ 0, -356, -9263, -9275\},\n\
\{ 0, -200, -9145, -9160\}, \{ 0, -110, -9062, -9013\},\n\
\{ 0, -165, -9138, -8950\}, \{ 0, -104, -9094, -8849\},\n\
\{ 0, -744, -9062, -8679\}, \{ 0, -743, -9084, -8557\},\n\
\{ 0, -613, -8622, -8069\}, \{ 0, -492, -8651, -7949\},\n\
\{ 0, 76, -8666, -7826\}, \{ 0, 362, -8890, -7855\},\n\
\{ 0, -204, -8686, -7668\}, \{ 0, -305, -8955, -7710\},\n\
\{ 0, -199, -8941, -7435\}, \{ 0, -141, -8992, -7377\},\n\
\{ 0, -1015, -8907, -7741\}, \{ 0, -886, -8961, -7784\},\n\
\{ 0, -594, -9151, -7921\}, \{ 0, -875, -9062, -7860\},\n\
\{ 0, -1280, -9528, -7885\}, \{ 0, -379, -9555, -8104\},\n\
\{ 0, -291, -9633, -8172\}, \{ 0, -1145, -9625, -8226\},\n\
\{ 0, -1437, -9653, -8314\}, \{ 0, -1372, -9610, -8489\},\n\
\{ 0, -208, -9649, -8693\}, \{ 0, -202, -9527, -8755\},\n\
\{ 0, 120, -9542, -8873\}, \{ 0, 126, -9448, -9003\},\n\
\{ 0, 167, -9519, -9142\}, \{ 0, 459, -9523, -9194\},\n\
\{ 0, 41, -9266, -9117\}, \{ 0, 189, -9303, -9236\},\n\
\{ 0, 7, -9305, -9289\}, \{ 0, -32, -9342, -9391\},\n\
\{ 0, -106, -9252, -9433\}, \{ 0, -195, -9450, -7698\},\n\
\{ 0, -84, -9434, -7715\}, \{ 0, 126, -9365, -7699\},\n\
\{ 0, 244, -9474, -7798\}, \{ 0, 112, -9616, -7895\},\n\
\{ 0, 514, -9631, -7921\}, \{ 0, 468, -9609, -7939\},\n\
\{ 0, -209, -9770, -7983\}, \{ 0, -329, -9925, -8028\},\n\
\{ 0, -845, -9918, -8117\}, \{ 0, 44, -9921, -8106\},\n\
\{ 0, 251, -10042, -8254\}, \{ 0, 277, -10008, -8327\},\n\
\{ 0, 737, -10139, -8391\}, \{ 0, 1260, -10272, -8496\},\n\
\{ 0, -17449, -10172, -8508\}, \{ 0, -6484, -10284, -8635\},\n\
\{ 0, 541, -10256, -8560\}, \n\
};"
calMap[JG03]="\{\n\
\{ 0, -5670, -14728, -16999\}, \{ 0, -5942, -14703, -17077\},\n\
\{ 0, -5889, -14421, -16670\}, \{ 0, -6039, -14464, -16644\},\n\
\{ 0, -5991, -14403, -16390\}, \{ 0, -6103, -14418, -16510\},\n\
\{ 0, -5953, -14364, -16180\}, \{ 0, -6154, -14364, -16125\},\n\
\{ 0, -5945, -14263, -15929\}, \{ 0, -6075, -14327, -15930\},\n\
\{ 0, -5928, -14392, -15878\}, \{ 0, -5986, -14443, -15932\},\n\
\{ 0, -5783, -14256, -15873\}, \{ 0, -5945, -14360, -15887\},\n\
\{ 0, -5749, -14536, -15874\}, \{ 0, -5733, -14684, -15887\},\n\
\{ 0, -5630, -14594, -15987\}, \{ 0, -5752, -14743, -16002\},\n\
\{ 0, -5490, -14694, -15993\}, \{ 0, -5481, -14866, -16056\},\n\
\{ 0, -5293, -14807, -16060\}, \{ 0, -7935, -20143, -18383\},\n\
\{ 0, -7733, -20142, -18482\}, \{ 0, -7628, -20060, -18538\},\n\
\{ 0, -7437, -20112, -18495\}, \{ 0, -7314, -20012, -18544\},\n\
\{ 0, -7072, -19980, -18573\}, \{ 0, -6986, -20006, -18632\},\n\
\{ 0, -6718, -20048, -18569\}, \{ 0, -6601, -19987, -18517\},\n\
\{ 0, -6485, -20035, -18537\}, \{ 0, -6292, -20047, -18537\},\n\
\{ 0, -6105, -20153, -18482\}, \{ 0, -6081, -20314, -18501\},\n\
\{ 0, -5865, -19916, -18164\}, \{ 0, -5786, -20218, -18174\},\n\
\{ 0, -5728, -20282, -18110\}, \{ 0, -5690, -20451, -18135\},\n\
\{ 0, -5643, -20768, -18154\}, \{ 0, -5603, -20874, -18273\},\n\
\{ 0, -5621, -21190, -18095\}, \{ 0, -5522, -21547, -18146\},\n\
\{ 0, -5549, -20721, -16825\}, \{ 0, -5547, -21087, -17001\},\n\
\{ 0, -5491, -21394, -17040\}, \{ 0, -5484, -21696, -17064\},\n\
\{ 0, -5542, -22265, -17091\}, \{ 0, -5483, -22543, -17198\},\n\
\{ 0, -5460, -22748, -17254\}, \{ 0, -5417, -22961, -17307\},\n\
\{ 0, -5455, -23299, -17323\}, \{ 0, -5445, -23552, -17382\},\n\
\{ 0, -5426, -23645, -17428\}, \{ 0, -5480, -23902, -17349\},\n\
\{ 0, -5558, -24011, -17360\}, \{ 0, -5569, -24032, -17326\},\n\
\{ 0, -5614, -24067, -17305\}, \{ 0, -5656, -24000, -17251\},\n\
\{ 0, -5739, -23971, -17228\}, \{ 0, -5777, -23886, -17215\},\n\
\{ 0, -5832, -23823, -17051\}, \{ 0, -5891, -23719, -16957\},\n\
\{ 0, -6007, -23598, -16925\}, \{ 0, -5893, -20829, -15256\},\n\
\{ 0, -5886, -20669, -15091\}, \{ 0, -5883, -20496, -14990\},\n\
\{ 0, -5969, -20469, -14898\}, \{ 0, -5971, -20245, -14876\},\n\
\{ 0, -5996, -20108, -14764\}, \{ 0, -5979, -19934, -14694\},\n\
\{ 0, -5997, -19721, -14571\}, \{ 0, -6046, -19573, -14456\},\n\
\{ 0, -6001, -19418, -14381\}, \{ 0, -5942, -19239, -14265\},\n\
\{ 0, -5978, -19040, -14240\}, \{ 0, -5928, -18873, -14317\},\n\
\{ 0, -5917, -18715, -14238\}, \{ 0, -5865, -18576, -14201\},\n\
\{ 0, -5750, -18386, -14200\}, \{ 0, -5772, -18299, -14235\},\n\
\{ 0, -5754, -18187, -14300\}, \n\
};"
calMap[JG05]="\{\n\
\{ 0, 178, -7222, 8474\}, \{ 0, 218, -7139, 8383\},\n\
\{ 0, 215, -7438, 8352\}, \{ 0, 198, -7247, 8498\},\n\
\{ 0, 138, -7640, 8644\}, \{ 0, 158, -7805, 8610\},\n\
\{ 0, 135, -7804, 8531\}, \{ 0, 143, -7881, 8575\},\n\
\{ 0, 165, -8096, 8584\}, \{ 0, 118, -7962, 8558\},\n\
\{ 0, 148, -7947, 8550\}, \{ 0, 118, -8193, 8494\},\n\
\{ 0, 149, -8042, 8441\}, \{ 0, 59, -8207, 8454\},\n\
\{ 0, 101, -8029, 8575\}, \{ 0, 156, -8029, 8422\},\n\
\{ 0, 205, -8074, 8451\}, \{ 0, 167, -7912, 8405\},\n\
\{ 0, 263, -7980, 8405\}, \{ 0, 258, -8007, 8404\},\n\
\{ 0, 288, -7790, 8342\}, \{ 0, -802, -10286, 6559\},\n\
\{ 0, -717, -10120, 6574\}, \{ 0, -590, -9884, 6675\},\n\
\{ 0, -446, -9651, 6686\}, \{ 0, -371, -9600, 6700\},\n\
\{ 0, -259, -9243, 6756\}, \{ 0, -77, -9216, 6768\},\n\
\{ 0, 108, -8979, 6844\}, \{ 0, 220, -8769, 6970\},\n\
\{ 0, 348, -8820, 6991\}, \{ 0, 569, -8618, 7028\},\n\
\{ 0, 688, -8430, 7162\}, \{ 0, 798, -8520, 7293\},\n\
\{ 0, 1050, -8141, 7758\}, \{ 0, 1284, -7775, 7850\},\n\
\{ 0, 1447, -7625, 7967\}, \{ 0, 1527, -7708, 8032\},\n\
\{ 0, 1661, -7547, 8153\}, \{ 0, 1784, -7532, 8169\},\n\
\{ 0, 1863, -7560, 8430\}, \{ 0, 1977, -7617, 8609\},\n\
\{ 0, 1318, -6902, 8849\}, \{ 0, 1390, -7060, 8848\},\n\
\{ 0, 1470, -6967, 8872\}, \{ 0, 1532, -6958, 8915\},\n\
\{ 0, 1607, -7162, 8946\}, \{ 0, 1718, -7119, 9030\},\n\
\{ 0, 1781, -6970, 9113\}, \{ 0, 1807, -6943, 9071\},\n\
\{ 0, 1831, -7114, 9061\}, \{ 0, 1899, -7105, 9088\},\n\
\{ 0, 1935, -7026, 9070\}, \{ 0, 2040, -6685, 9125\},\n\
\{ 0, -8187, -6757, 9115\}, \{ 0, -10749, -6464, 9194\},\n\
\{ 0, -21024, -6513, 9071\}, \{ 0, 6072, -6529, 9040\},\n\
\{ 0, -22290, -6590, 9075\}, \{ 0, -12054, -6510, 9114\},\n\
\{ 0, -18487, -6491, 9179\}, \{ 0, -12050, -6878, 9144\},\n\
\{ 0, -4425, -6526, 9189\}, \{ 0, 2575, -4991, 10202\},\n\
\{ 0, 2566, -4792, 10308\}, \{ 0, 2596, -4920, 10513\},\n\
\{ 0, 2585, -5106, 10573\}, \{ 0, 2538, -5290, 10578\},\n\
\{ 0, 2560, -5424, 10627\}, \{ 0, 2613, -5352, 10915\},\n\
\{ 0, 2531, -5578, 10919\}, \{ 0, 2545, -5652, 11012\},\n\
\{ 0, 2646, -5819, 11079\}, \{ 0, 2661, -6046, 11136\},\n\
\{ 0, 2692, -6314, 11187\}, \{ 0, 2759, -6284, 11209\},\n\
\{ 0, 2739, -6557, 11185\}, \{ 0, 2815, -6469, 11256\},\n\
\{ 0, 2849, -6807, 11103\}, \{ 0, 2850, -6769, 11097\},\n\
\{ 0, 2923, -6999, 11232\}, \n\
};"
-2
View File
@@ -88,7 +88,6 @@ L2_CONFIG linkConfig =
.clustId = 1,
.myId = 1,
.headId = 1,
.bkpHeadId = 0,
.netScale = 2,
.phyInstPtr = NULL, // physical layer reference
.tmcInstPtr = NULL
@@ -99,7 +98,6 @@ L2_CONFIG linkConfig =
// .clustId = 1,
// .myId = 2,
// .headId = 1,
// .bkpHeadId = 0,
// .netScale = 2,
// .phyInstPtr = NULL, // physical layer reference
// .tmcInstPtr = NULL
+4 -8
View File
@@ -45,13 +45,11 @@ typedef struct
* @brief create a FIFO queue
* @param queue The new queue
* @param queue_capacity maximum size of the queue
* @param a pool to allocate queue from
*/
bool CircQueueCreate(CIRC_QUEUE **queue, uint32_t queue_capacity);
/**
* @brief free queue memory -- call after destroy
* @note we do not free in destroy() to follow pthreads convention
*/
void CircQueueFree(CIRC_QUEUE *queue);
@@ -72,9 +70,8 @@ bool isCircQueueEmpty(CIRC_QUEUE *queue);
*
* @param queue the queue
* @param data the data
* @return RPA_EINTR the blocking was interrupted (try again)
* @return RPA_EOF the queue has been terminated
* @return RPA_SUCCESS on a successful push
* @return True on a successful push
* @return False push failed
*/
bool CircQueuePush(CIRC_QUEUE *queue, void *data);
@@ -83,9 +80,8 @@ bool CircQueuePush(CIRC_QUEUE *queue, void *data);
*
* @param queue the queue
* @param data the data
* @return RPA_EINTR the blocking was interrupted (try again)
* @return RPA_EOF if the queue has been terminated
* @return RPA_SUCCESS on a successful pop
* @return false pop failed
* @return true on a successful pop
*/
bool CircQueuePop(CIRC_QUEUE *queue, void **data);
+1 -3
View File
@@ -75,7 +75,6 @@ L2_CONFIG linkConfig = {
.clustId = 1,
.myId = 1,
.headId = 1,
.bkpHeadId = 0,
.netScale = 2,
.phyInstPtr = NULL, // physical layer reference
.tmcInstPtr = NULL
@@ -86,14 +85,13 @@ L2_CONFIG linkConfig = {
// .clustId = 1,
// .myId = 2,
// .headId = 1,
// .bkpHeadId = 0,
// .netScale = 2,
// .phyInstPtr = NULL, // physical layer reference
// .tmcInstPtr = NULL
// };
static PHY_CONFIG phyConfig = {
.devId = 0,
.devId = PHY_DEVICE_ID,
.baseAddr = PHY_BASEADDR,
.antBramId = PHY_ANTCONFIG_BRAM_DEVICE_ID,
.antInfoBramId = PHY_ANTINFO_BRAM_DEVICE_ID,
@@ -1146,8 +1146,7 @@ int32_t L2_SteerBeam2Node(L2_INST *instPtr, uint8_t nodeId)
* @param txrxMode tx/rx state for next slot
* @param frameType frame type of next slot.
*
* @return Corresponding frame length
* L2_FRAME_NONE_LEN if the frame type code cannot be recognized.
* @return SUCCESS/FAILURE
*
******************************************************************************/
int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE frameType)
@@ -39,11 +39,9 @@
typedef struct
{
L2_NODE_TYPE myType; ///< node type
bool isInterHead; ///< indicate if node is head node
uint8_t clustId; ///< node cluster id
uint8_t myId; ///< node id
uint8_t headId; ///< head node id
uint8_t bkpHeadId; ///< backup head id
uint8_t netScale; ///< net scale
PHY_INST *phyInstPtr; ///< pointer to system physical layer instance
TMC_INST *tmcInstPtr; ///< pointer to system timer controller layer instance
@@ -32,6 +32,10 @@
#include "error.h"
/***************** Macros (Inline Functions) Definitions *********************/
/**
* @brief Get the node list length
* @param list pointer to node list
*/
inline uint32_t L2_GetNodeListLen(NODE_LIST *list)
{
ASSERT(list != NULL);
@@ -1,20 +1,16 @@
/*****************************************************************************/
/**
* Description: Antenna configuration functions.
* @file phy_antenna.h
* @author FanHao ([email protected])
* @brief Physical layer control antenna configuration functions.
* @version 0.0
* @date 2023-04-24
*
* Author: Fan Hao
* Date: 2022-06-18 16:37
* LastEditors: Fan Hao
* LastEditTime: 2022-06-18 17:15
* Revisions: Rev 0.0
* History:
* [2024-01-20]: New branch for duifei.
* [2022-06-18]: Initial version.
*
* Copyright(c) 2022 Beijing Institute of Technology.
* Lab of Communication and Networking
* @copyright Copyright(c) 2024 Beijing Institute of Technology.\n
* Lab of Communication and Network
*
******************************************************************************/
/**
* @addtogroup PhysicalLayer
* @{
@@ -71,62 +67,123 @@
// Pair by regex
// Regex: (([0-9]+, ){8})
const uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] =
const uint16_t freqTable[L1_FRAME_MAX_HOPS] =
{
1500
1084, 1097, 1110, 1123, 1136, 1149, 1162, 1175,
1188, 1201, 1214, 1227, 1240, 1253, 1266, 1279,
1292, 1305, 1318, 1331, 1344, 1357, 1370, 1383,
1396, 1409, 1422, 1435, 1448, 1461, 1474, 1487,
1500, 1513, 1526, 1539, 1552, 1565, 1578, 1591,
1604, 1617, 1630, 1643, 1656, 1669, 1682, 1695,
1708, 1721, 1734, 1747, 1760, 1773, 1786, 1799,
1812, 1825, 1838, 1851, 1864, 1877, 1890, 1903,
1916, 1929, 1942, 1955, 1968, 1981, 1994, 2007,
2020, 2033, 2046, 2059, 2072, 2085, 2098, 2111,
2124
}
const uint16_t antCalTable[L1_FRAME_MAX_HOPS][L1_ANT_NUM_CH] =
//Antenna-JG01
{
{ 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 uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] =
const uint8_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] =
{
0, 44, 88, 131, 175, 219, 263, 306,
350, 394, 438, 481, 525, 569, 613, 656,
700, 744, 788, 831, 875, 919, 963, 1006,
1050, 1094, 1138, 1181, 1225, 1269, 1313, 1356,
1400, 1444, 1488, 1531, 1575, 1619, 1663, 1706,
1750, 1794, 1838, 1881, 1925, 1969, 2013, 2056,
2100, 2144, 2188, 2231, 2275, 2319, 2363, 2406,
2450, 2494, 2538, 2581, 2625, 2669, 2713, 2756,
2800, 2844, 2888, 2931, 2975, 3019, 3063, 3106,
3150, 3194, 3238, 3281, 3325, 3369, 3413, 3456,
3500
0
};
const uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] =
const uint8_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] =
{
1500
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80
};
const uint16_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] =
const uint8_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] =
{
1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500,
1500, 1500, 1500
0
};
const uint16_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] =
const uint8_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] =
{
1600, 1650, 1700, 1750, 1800, 1850, 1900, 1550,
1500
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10
};
const uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] =
const uint8_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] =
{
1700, 1800, 1900, 2000, 1700, 1700, 1700, 1700,
1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
1700, 1700, 1700
0, 1, 2, 3, 4, 5, 6, 7,
8,
};
const uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] =
const uint8_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] =
{
500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
1700, 1800, 1900, 2000, 1500, 1600, 1700, 1800,
1900, 2000, 1500, 1500
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18
};
const uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] =
const uint8_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] =
{
500, 600, 700, 800, 900, 1000, 500, 600,
700, 800, 900, 1000, 500, 600, 700, 800,
900, 1000, 500, 500
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19
};
const uint8_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19
};
/** @} PhysicalLayer_AntennaConfig_Constants*/
@@ -228,7 +285,7 @@ void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode)
/*****************************************************************************/
/**
* @brief Update antenna beam width setting
* @brief Update antenna beam table
*
* @param instPtr pointer to physical layer instance
* @param table new beam table
@@ -302,7 +359,7 @@ int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo, PHY_ANT_BEAM_WIDTH beam
* @param beamWidth new beam width
*
* @return SUCCESS.
* EPARAM - the direction is exceeds predefined range
* EPARAM
*
******************************************************************************/
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
@@ -72,14 +72,16 @@
/** @} PhysicalLayer_Private_Constants*/
/************************** Variable Definitions *****************************/
extern const uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
extern const uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
extern const uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
extern const uint16_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
extern const uint16_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
extern const uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS];
extern const uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
extern const uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
extern const uint16_t freqTable[L1_FRAME_MAX_HOPS];
extern const int16_t antCalTable[L1_FRAME_MAX_HOPS][L1_ANT_NUM_CH];
extern const uint8_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
extern const uint8_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
extern const uint8_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
extern const uint8_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
extern const uint8_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
extern const uint8_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS];
extern const uint8_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
extern const uint8_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS];
/***************** Macros (Inline Functions) Definitions *********************/
/************************** Function Prototypes ******************************/
@@ -423,7 +425,6 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
memset(&((*instPtr))->tor, PHY_TOR_SUSPEND, sizeof(PHY_RCD));
memset(&((*instPtr)->frameType), L1_NONE_FRAME, sizeof(PHY_RCD));
memset(&((*instPtr)->antNo), (int32_t)L1_INIT_BEAM_NO, sizeof(PHY_RCD));
memset(&((*instPtr)->beamNo), (int32_t)L1_INIT_ANT_NO, sizeof(PHY_RCD));
memset(&((*instPtr)->beamWd), (int32_t)L1_INIT_ANT_WD, sizeof(PHY_RCD));
memset(&((*instPtr)->hwSate), 0x00, sizeof(HWSTATE));
@@ -655,8 +656,8 @@ void Phy_Halt(PHY_INST *instPtr)
/**
* @brief Set physical layer working mode.
*
* @param instPtr a pointer to physical instance
* @param modeCod intened mode code
* @param instPtr physical instance
* @param modeCod intend mode code
*
* @return SUCCESS
* other
@@ -693,12 +694,12 @@ int32_t Phy_SetMode(PHY_INST *instPtr, PHY_MODE modeCod)
/**
* @brief Setup a specific timer word register in physical controller.
*
* @param instPtr
* @param tmWord
* @param tmType
* @param instPtr physical instance
* @param tmWord time word
* @param tmType time word type
*
* @return SUCCESS
* FAILURE pattern length exceeds maximum length.
* FAILURE
*
******************************************************************************/
int32_t Phy_SetTimeWord(PHY_INST *instPtr, const TIME_WORD *tmWord, PHY_TIME_WORD_TYPE tmType)
@@ -742,7 +743,7 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
ASSERT(instPtr != NULL);
int32_t Status;
uint32_t phyModeCtrl, hopNum;
const uint16_t *hopPattern;
const uint8_t *hopPattern;
// Implement a ping-pong flow, offset always is 0 or half of buffer depth.
instPtr->antConfigOffset = (L1_ANTCONFIG_MAX_LEN >> 1) - instPtr->antConfigOffset;
uint32_t antConfigAddr = instPtr->antConfigAddr + instPtr->antConfigOffset;
@@ -821,12 +822,37 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
// TODO: Set antenna stand by, when suspend.
const uint8_t *dataSrcPtr = (uint8_t *)(&(instPtr->antConfig));
size_t hopIdx;
uint16_t hopFreq;
int16_t hopCal;
for (int32_t i = 0; i < hopNum; i++)
{
instPtr->antConfig.antFreq[0] = (uint8_t)(hopPattern[i] >> 8);
instPtr->antConfig.antFreq[1] = (uint8_t)hopPattern[i];
instPtr->antConfig.rfFreq[0] = (uint8_t)(hopPattern[i] >> 8);
instPtr->antConfig.rfFreq[1] = (uint8_t)hopPattern[i];
hopIdx = hopPattern[i];
// Frequency setting
hopFreq = freqTable[hopIdx];
instPtr->antConfig.antFreq[0] = (uint8_t)(hopFreq >> 8);
instPtr->antConfig.antFreq[1] = (uint8_t)hopFreq;
instPtr->antConfig.rfFreq[0] = (uint8_t)(hopFreq >> 8);
instPtr->antConfig.rfFreq[1] = (uint8_t)hopFreq;
// Calibration setting
// -- CH0
hopCal = antCalTable[hopIdx][0];
instPtr->antConfig.ch0Cal[0] = (uint8_t)(hopCal >> 8);
instPtr->antConfig.ch0Cal[1] = (uint8_t)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),
dataSrcPtr, sizeof(PHY_ANT_CONFIG));
}
@@ -834,13 +860,6 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
| ((hopNum << ANT_CONFIG_NUM_SHIFT) & ANT_CONFIG_NUM_MASK)
| ((ANT_COINFO_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);
*/
// Set antenna configs
PhyWrite(instPtr, ANT_CONFIG, antCtrl);
@@ -862,7 +881,6 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
Phy_RcdShift(&(instPtr->tor), txrxMode);
Phy_RcdShift(&(instPtr->frameType), frameType);
// TODO:
Phy_RcdShift(&(instPtr->antNo), L1_INIT_ANT_NO);
Phy_RcdShift(&(instPtr->beamNo), L1_INIT_BEAM_NO);
Phy_RcdShift(&(instPtr->beamWd), L1_INIT_ANT_WD);
return SUCCESS;
@@ -872,7 +890,7 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
/**
* @brief Update physical layer status cache.
*
* @param instPtr A pointer to physical layer control instance.
* @param instPtr physical layer control instance.
*
* @return NONE.
*
@@ -905,7 +923,8 @@ void Phy_UpdateState(PHY_INST *instPtr)
/**
* @brief Copy ans store the received data, if received data valid.
*
* @param instPtr a pointer to physical layer control instance.
* @param instPtr to physical layer control instance.
* @param dataBuff data buffer.
*
* @return NONE
*
@@ -931,7 +950,8 @@ void Phy_PeekRecvData(PHY_INST *instPtr, uint8_t *dataBuff)
* @brief Get the received data (if valid), store it to data buffer.
* and clear data valid flag.
*
* @param instPtr a pointer to physical layer control instance.
* @param instPtr to physical layer control instance.
* @param dataBuff data buffer.
*
* @return NONE
*
@@ -995,10 +1015,9 @@ void Phy_UpdateLogging(PHY_INST *instPtr)
/*****************************************************************************/
/**
* @brief Setup a specific timer word register in physical controller.
* @brief Refresh hardware status.
*
* @param instPtr a pointer to hopping pattern buffer
* @param patternLen a integer indicate the length of hopping pattern.
*
* @return NONE
*
@@ -1133,6 +1152,8 @@ void Phy_RefreshHwSate(PHY_INST *instPtr)
instPtr->hwSate.isAntOk = (instPtr->hwSate.antVolt == (VOLT_ANT_PROC_OK | VOLT_ANT_RF_OK | VOLT_ANT_NIL_OK | ANT_STATE_OK))
&& (instPtr->hwSate.antPll == (CLK_ANT_BBPLL_LOCK | CLK_ANT_RFPLL0_LOCK | CLK_ANT_RFPLL1_LOCK));
instPtr->hwSate.phyId = instPtr.phyCofig.devId;
memset(instPtr->hwSate.reserve, 0x00, sizeof(instPtr->hwSate.reserve));
SysMonitor_UpdateHardwareStatus(&(instPtr->hwSate));
@@ -37,7 +37,7 @@
#define L1_NUM_ANT_NRRW_PATTERN 37
#define L1_INIT_BEAM_NO 0
#define L1_INIT_ANT_WD PHY_ANT_BEAM_120
#define L1_INIT_ANT_NO 0
#define L1_ANT_NUM_CH 4
#define L1_FRAME_NONE_LEN UINT32_MAX // byte
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L)
@@ -111,6 +111,10 @@ typedef struct
uint8_t rfMonitor; ///< Receive monitor, 0-normal, 1-switch to monitor port
uint8_t rfReserved0; ///< reserved for further use
uint8_t rfReserved1; ///< reserved for further use
uint8_t ch0Cal[2];
uint8_t ch1Cal[2];
uint8_t ch2Cal[2];
uint8_t ch3Cal[2];
} PHY_ANT_CONFIG;
/**
@@ -229,7 +233,6 @@ typedef struct
bool isValid; ///< indicates if last reception frame data valid (crc check pass)
TIME_WORD recvSlotTime; ///< last slot start time stamp
TIME_WORD recvFsTime; ///< last frame sync time stamp
PHY_RCD antNo; ///< antenna number record
PHY_RCD beamNo; ///< beam number record
PHY_RCD beamWd; ///< beam width record
PHY_RCD tor; ///< tx rx state record
+2 -1
View File
@@ -203,7 +203,8 @@ typedef struct __attribute__((packed))
uint8_t antPll; ///< Antenna rf lock state indicator
uint8_t antMgc0; ///< Antenna rf mgc0~1 indicator
uint8_t antMgc1; ///< Antenna rf mgc2~3 indicator
uint8_t reserve[2];
uint8_t phyId;
uint8_t reserve;
} HWSTATE;
/**
+1
View File
@@ -15,6 +15,7 @@
* @addtogroup SystemBus
* @{
*/
/***************************** Include Files *********************************/
#include <stdlib.h>
#include <string.h>
+2 -2
View File
@@ -53,8 +53,8 @@ typedef struct
SYSBUS_UART *uartInst; ///< physical uart controller instance
CIRC_QUEUE *txQueue; ///< tx queue
CIRC_QUEUE *rxQueue; ///< rx queue
bool isRxDone; ///< tx done indicator
bool isTxDone; ///< rx done indicator
bool isTxDone; ///< tx done indicator
bool isRxDone; ///< rx done indicator
} SYSBUS;
/************************** Function Prototypes ******************************/
@@ -10,6 +10,7 @@
* Lab of Communication and Network
*
******************************************************************************/
/**
* @addtogroup SystemBus
* @{
+28 -4
View File
@@ -1,14 +1,38 @@
#! /bin/sh
# GE Software
GE_TXATT=0
GE_RXATT=25
DST_DIR=`pwd`
PROJECT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cp -rL $PROJECT_DIR/df_datalink_sp/src $DST_DIR/df_datalink_sp
echo "Creating <df_datalink_ge>..."
cp -rL $PROJECT_DIR/df_datalink_ge/src $DST_DIR/df_datalink_ge
cd $DST_DIR/df_datalink_ge
sed -i'' -e "s/antConfig->rfTxMgc = 0;/antConfig->rfTxMgc = $GE_TXATT;/g" ./networking/phy_layer/phy_antenna.c
sed -i'' -e "s/antConfig->rcvMgc = 0;/antConfig->rcvMgc = $GE_RXATT;/g" ./networking/phy_layer/phy_antenna.c
cd $DST_DIR
cd $DST_DIR/df_datalink_ge/networking/phy_layer
sed -i'' -e "s/antConfig->rfTxMgc = 0;/antConfig->rfTxMgc = $GE_TXATT;/g" ./phy_antenna.c
sed -i'' -e "s/antConfig->rcvMgc = 0;/antConfig->rcvMgc = $GE_RXATT;/g" ./phy_antenna.c
# SP Software
source $PROJECT_DIR/caldata
for key in ${!calMap[*]};do
projName=df_datalink_$key
id=$(echo "$key" | grep -o -E '[0-9]+')
echo "Creating <$projName>..."
cp -rL $PROJECT_DIR/df_datalink_sp/src $DST_DIR/$projName
cd $DST_DIR/$projName
# subtitite ID
sed -i'' "s/#define PHY_DEVICE_ID 0/#define PHY_DEVICE_ID $id/g"
# subtitute table
sed -i'' "/^const uint16_t antCalTable\[L1_FRAME_MAX_HOPS\]\[L1_ANT_NUM_CH\] =/{
:table
N
/\};/!b table
s/=.*\};/=\n\/\/Antenna-$key\n$calMap[$key]/
}" ./networking/phy_layer/phy_antenna.c
cd $DST_DIR
done