Compare commits
39
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ba32bf8db | ||
|
|
fa2623130e | ||
|
|
6462daabdf | ||
|
|
85117688e1 | ||
|
|
347c0c1f74 | ||
|
|
831395d236 | ||
|
|
b9d7950b3a | ||
|
|
a24d8e8d35 | ||
|
|
3e7060965e | ||
|
|
fd9e7f54eb | ||
|
|
f8212892a2 | ||
|
|
884d9bcca9 | ||
|
|
5af74419e0 | ||
|
|
f0b28b55fb | ||
|
|
97b8f28e70 | ||
|
|
608bbf1cfa | ||
|
|
711cb50658 | ||
|
|
746e87df86 | ||
|
|
fa24e0f109 | ||
|
|
40fdf13fd1 | ||
|
|
55cd53b746 | ||
|
|
c7c81ddb83 | ||
|
|
52f9390981 | ||
|
|
475a625663 | ||
|
|
7b36324101 | ||
|
|
c9f827661b | ||
|
|
475314f2a5 | ||
|
|
68396cb7ac | ||
|
|
688534c117 | ||
|
|
98ec0e7855 | ||
|
|
45a13b9c5d | ||
|
|
f7f3d76d9a | ||
|
|
f8985df185 | ||
|
|
fdc37dab4a | ||
|
|
cfc538bd4d | ||
|
|
da1659a582 | ||
|
|
f363d3afba | ||
|
|
ff4b609a37 | ||
|
|
bbdaa49d53 |
@@ -55,3 +55,6 @@ dkms.conf
|
|||||||
# MacOS .DS_Store file
|
# MacOS .DS_Store file
|
||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
**/._.DS_Store
|
**/._.DS_Store
|
||||||
|
|
||||||
|
# Ignore handout files
|
||||||
|
handout/
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
DIR := $(shell pwd)
|
DIR := $(shell pwd)
|
||||||
|
|
||||||
compile_test:
|
compile_test:
|
||||||
|
cd $(DIR)/df_datalink_sp/bsp && make all
|
||||||
cd $(DIR)/df_datalink_sp/build && make all
|
cd $(DIR)/df_datalink_sp/build && make all
|
||||||
|
cd $(DIR)/df_datalink_ge/bsp && make all
|
||||||
cd $(DIR)/df_datalink_ge/build && make all
|
cd $(DIR)/df_datalink_ge/build && make all
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
cd $(DIR)/df_datalink_sp/bsp && make clean
|
||||||
cd $(DIR)/df_datalink_sp/build && make clean
|
cd $(DIR)/df_datalink_sp/build && make clean
|
||||||
|
cd $(DIR)/df_datalink_ge/bsp && make clean
|
||||||
cd $(DIR)/df_datalink_ge/build && make clean
|
cd $(DIR)/df_datalink_ge/build && make clean
|
||||||
.PHONY: clean compile_test
|
.PHONY: clean compile_test
|
||||||
@@ -0,0 +1,441 @@
|
|||||||
|
declare -A calMap
|
||||||
|
calMap[JG01]="\{\n\
|
||||||
|
\{ 0, 406, -10530, -8223\}, \{ 0, 697, -9933, -7988\},\n\
|
||||||
|
\{ 0, 296, -10497, -8272\}, \{ 0, 515, -10264, -8093\},\n\
|
||||||
|
\{ 0, 689, -10212, -8064\}, \{ 0, 40, -10960, -8572\},\n\
|
||||||
|
\{ 0, 722, -10878, -8518\}, \{ 0, 59, -10987, -8962\},\n\
|
||||||
|
\{ 0, 56, -11264, -8770\}, \{ 0, -464, -11341, -9159\},\n\
|
||||||
|
\{ 0, 19, -10924, -8887\}, \{ 0, -669, -10927, -8679\},\n\
|
||||||
|
\{ 0, -701, -11154, -8712\}, \{ 0, -255, -10739, -8009\},\n\
|
||||||
|
\{ 0, -192, -10509, -8242\}, \{ 0, -1057, -11183, -9007\},\n\
|
||||||
|
\{ 0, -57, -10606, -8350\}, \{ 0, -719, -10949, -8880\},\n\
|
||||||
|
\{ 0, -760, -11084, -8660\}, \{ 0, -457, -10735, -8833\},\n\
|
||||||
|
\{ 0, -188, -10623, -9119\}, \{ 0, -628, -12609, -10119\},\n\
|
||||||
|
\{ 0, -434, -12714, -10225\}, \{ 0, -727, -13074, -10685\},\n\
|
||||||
|
\{ 0, -12, -12408, -10190\}, \{ 0, 33, -12790, -10624\},\n\
|
||||||
|
\{ 0, 93, -13235, -10819\}, \{ 0, -363, -13301, -11183\},\n\
|
||||||
|
\{ 0, -514, -13955, -11557\}, \{ 0, -458, -13878, -11722\},\n\
|
||||||
|
\{ 0, 93, -13086, -11726\}, \{ 0, -663, -13597, -11868\},\n\
|
||||||
|
\{ 0, 174, -12814, -11295\}, \{ 0, 121, -12278, -11150\},\n\
|
||||||
|
\{ 0, 425, -11255, -10363\}, \{ 0, 430, -11645, -10189\},\n\
|
||||||
|
\{ 0, 277, -11844, -9499\}, \{ 0, -132, -12241, -9420\},\n\
|
||||||
|
\{ 0, 448, -11934, -9612\}, \{ 0, 200, -11778, -9582\},\n\
|
||||||
|
\{ 0, -40, -12069, -9336\}, \{ 0, 1692, -11315, -9085\},\n\
|
||||||
|
\{ 0, -1753, -11445, -9482\}, \{ 0, -2520, -12620, -10068\},\n\
|
||||||
|
\{ 0, -1976, -12674, -10218\}, \{ 0, -1984, -12525, -10354\},\n\
|
||||||
|
\{ 0, -2272, -13476, -10932\}, \{ 0, -2123, -13918, -11095\},\n\
|
||||||
|
\{ 0, -2883, -14447, -11659\}, \{ 0, -2826, -13946, -11563\},\n\
|
||||||
|
\{ 0, -2697, -13680, -11328\}, \{ 0, -3068, -13393, -11614\},\n\
|
||||||
|
\{ 0, -2935, -13074, -11882\}, \{ 0, -3017, -13038, -11163\},\n\
|
||||||
|
\{ 0, -2490, -12379, -11288\}, \{ 0, -2463, -12286, -10726\},\n\
|
||||||
|
\{ 0, -2686, -12167, -10673\}, \{ 0, -2428, -12077, -10555\},\n\
|
||||||
|
\{ 0, -2282, -12564, -10388\}, \{ 0, -2017, -12303, -10844\},\n\
|
||||||
|
\{ 0, -2329, -12637, -11250\}, \{ 0, -2703, -13362, -11807\},\n\
|
||||||
|
\{ 0, -1820, -12605, -11733\}, \{ 0, 596, -10833, -9852\},\n\
|
||||||
|
\{ 0, 9, -11140, -9776\}, \{ 0, 41, -11168, -9478\},\n\
|
||||||
|
\{ 0, -261, -11368, -9752\}, \{ 0, 226, -11282, -9879\},\n\
|
||||||
|
\{ 0, -68, -11454, -10148\}, \{ 0, -314, -12278, -10716\},\n\
|
||||||
|
\{ 0, -66, -11998, -10762\}, \{ 0, -58, -11469, -10664\},\n\
|
||||||
|
\{ 0, 319, -10759, -10212\}, \{ 0, 122, -11041, -9901\},\n\
|
||||||
|
\{ 0, -269, -11085, -10008\}, \{ 0, 637, -10569, -9674\},\n\
|
||||||
|
\{ 0, 1185, -10632, -9521\}, \{ 0, 902, -11053, -9681\},\n\
|
||||||
|
\{ 0, 560, -11408, -9588\}, \{ 0, 1162, -11079, -9371\},\n\
|
||||||
|
\{ 0, 1780, -10547, -9133\}, \n\
|
||||||
|
};"
|
||||||
|
|
||||||
|
calMap[JG02]="\{\n\
|
||||||
|
\{ 0, 509, -2785, -4375\}, \{ 0, 655, -3482, -4447\},\n\
|
||||||
|
\{ 0, 520, -3231, -4651\}, \{ 0, 680, -3122, -4790\},\n\
|
||||||
|
\{ 0, 328, -3648, -4712\}, \{ 0, 260, -3454, -4515\},\n\
|
||||||
|
\{ 0, 433, -3027, -4446\}, \{ 0, 34, -4304, -4676\},\n\
|
||||||
|
\{ 0, 54, -3707, -4650\}, \{ 0, -19, -3829, -5231\},\n\
|
||||||
|
\{ 0, -156, -4018, -5292\}, \{ 0, -331, -4155, -5423\},\n\
|
||||||
|
\{ 0, -424, -4210, -5207\}, \{ 0, -592, -4131, -5572\},\n\
|
||||||
|
\{ 0, -494, -4135, -5732\}, \{ 0, -687, -4055, -5030\},\n\
|
||||||
|
\{ 0, -1000, -4456, -5228\}, \{ 0, -337, -3931, -5340\},\n\
|
||||||
|
\{ 0, -168, -3962, -5326\}, \{ 0, -852, -4534, -5798\},\n\
|
||||||
|
\{ 0, -541, -4458, -5156\}, \{ 0, -842, -5570, -6166\},\n\
|
||||||
|
\{ 0, -1490, -5883, -6645\}, \{ 0, -1036, -5917, -6151\},\n\
|
||||||
|
\{ 0, -1369, -5946, -5969\}, \{ 0, -916, -5927, -6200\},\n\
|
||||||
|
\{ 0, -521, -5595, -6066\}, \{ 0, -823, -5731, -5925\},\n\
|
||||||
|
\{ 0, -262, -5267, -5315\}, \{ 0, -697, -5434, -5676\},\n\
|
||||||
|
\{ 0, -362, -5193, -4887\}, \{ 0, -430, -5147, -4911\},\n\
|
||||||
|
\{ 0, -94, -5403, -5159\}, \{ 0, -747, -5796, -4772\},\n\
|
||||||
|
\{ 0, -679, -4909, -4531\}, \{ 0, -500, -5364, -4694\},\n\
|
||||||
|
\{ 0, -147, -5225, -4463\}, \{ 0, -283, -5815, -4360\},\n\
|
||||||
|
\{ 0, -724, -6148, -4647\}, \{ 0, -295, -6069, -4375\},\n\
|
||||||
|
\{ 0, -397, -6086, -4105\}, \{ 0, -116, -6343, -4698\},\n\
|
||||||
|
\{ 0, -589, -6398, -5353\}, \{ 0, -1068, -6640, -5014\},\n\
|
||||||
|
\{ 0, -785, -7017, -5093\}, \{ 0, -29, -6238, -5186\},\n\
|
||||||
|
\{ 0, 380, -6370, -5063\}, \{ 0, -239, -7191, -5605\},\n\
|
||||||
|
\{ 0, 321, -7256, -5177\}, \{ 0, 430, -6673, -4887\},\n\
|
||||||
|
\{ 0, 226, -7136, -5687\}, \{ 0, 142, -7175, -5498\},\n\
|
||||||
|
\{ 0, 333, -6596, -5434\}, \{ 0, 315, -6574, -5520\},\n\
|
||||||
|
\{ 0, -109, -6681, -5798\}, \{ 0, -587, -7290, -5748\},\n\
|
||||||
|
\{ 0, -229, -7105, -5463\}, \{ 0, -480, -7092, -6033\},\n\
|
||||||
|
\{ 0, -1162, -7488, -6578\}, \{ 0, -1244, -8230, -6838\},\n\
|
||||||
|
\{ 0, -941, -7941, -6976\}, \{ 0, -1181, -7816, -6868\},\n\
|
||||||
|
\{ 0, -1792, -8128, -6590\}, \{ 0, -644, -7614, -4524\},\n\
|
||||||
|
\{ 0, -873, -7358, -3775\}, \{ 0, -1250, -7370, -4506\},\n\
|
||||||
|
\{ 0, -819, -7520, -4500\}, \{ 0, -1579, -8679, -4626\},\n\
|
||||||
|
\{ 0, -1332, -7353, -4338\}, \{ 0, -1128, -7821, -5030\},\n\
|
||||||
|
\{ 0, -927, -7988, -4954\}, \{ 0, -2035, -7884, -5097\},\n\
|
||||||
|
\{ 0, -2533, -8953, -6171\}, \{ 0, -1576, -8029, -5542\},\n\
|
||||||
|
\{ 0, -1185, -7297, -5523\}, \{ 0, -2139, -8830, -6236\},\n\
|
||||||
|
\{ 0, -2137, -8976, -6225\}, \{ 0, -1387, -8252, -6043\},\n\
|
||||||
|
\{ 0, -1139, -8286, -5988\}, \{ 0, -1252, -8224, -6388\},\n\
|
||||||
|
\{ 0, -1617, -8211, -5983\}, \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\
|
||||||
|
};"
|
||||||
|
|
||||||
|
calMap[JG06]="\{\n\
|
||||||
|
\{ 0, -3836, -1067, 4891\}, \{ 0, -4831, -2098, 4103\},\n\
|
||||||
|
\{ 0, -4849, -1871, 4566\}, \{ 0, -4534, -1666, 4512\},\n\
|
||||||
|
\{ 0, -5764, -2767, 4245\}, \{ 0, -5591, -2123, 4174\},\n\
|
||||||
|
\{ 0, -4727, -1565, 4368\}, \{ 0, -5834, -2262, 3942\},\n\
|
||||||
|
\{ 0, -5421, -2062, 3790\}, \{ 0, -4996, -1380, 4260\},\n\
|
||||||
|
\{ 0, -5538, -1861, 3494\}, \{ 0, -5272, -1652, 3740\},\n\
|
||||||
|
\{ 0, -5561, -1802, 4038\}, \{ 0, -5320, -1734, 3742\},\n\
|
||||||
|
\{ 0, -4354, -1230, 4170\}, \{ 0, -5705, -1862, 3840\},\n\
|
||||||
|
\{ 0, -6223, -2211, 3218\}, \{ 0, -5048, -1596, 3669\},\n\
|
||||||
|
\{ 0, -5235, -1541, 3735\}, \{ 0, -6009, -2219, 3301\},\n\
|
||||||
|
\{ 0, -5545, -1879, 3686\}, \{ 0, -7174, -2853, -434\},\n\
|
||||||
|
\{ 0, -6759, -3117, 56\}, \{ 0, -7376, -3291, 221\},\n\
|
||||||
|
\{ 0, -7601, -3243, 150\}, \{ 0, -7065, -2752, -42\},\n\
|
||||||
|
\{ 0, -7701, -2828, -144\}, \{ 0, -7598, -3002, 464\},\n\
|
||||||
|
\{ 0, -7312, -2476, 399\}, \{ 0, -7939, -2374, -62\},\n\
|
||||||
|
\{ 0, -7622, -2213, 482\}, \{ 0, -6715, -1688, 1033\},\n\
|
||||||
|
\{ 0, -6755, -1445, 722\}, \{ 0, -6817, -1385, 1061\},\n\
|
||||||
|
\{ 0, -6155, -864, 1431\}, \{ 0, -6700, -1746, 1070\},\n\
|
||||||
|
\{ 0, -6973, -1127, 835\}, \{ 0, -6456, -1152, 686\},\n\
|
||||||
|
\{ 0, -6542, -1505, 1059\}, \{ 0, -6659, -1374, 584\},\n\
|
||||||
|
\{ 0, -6605, -983, 630\}, \{ 0, -6366, -1046, 800\},\n\
|
||||||
|
\{ 0, -4668, 343, 1086\}, \{ 0, -5072, 560, 468\},\n\
|
||||||
|
\{ 0, -4124, 1399, 1284\}, \{ 0, -3465, 10068, 22599\},\n\
|
||||||
|
\{ 0, -4167, 2018, 1119\}, \{ 0, -4910, 1612, 717\},\n\
|
||||||
|
\{ 0, -4917, 1600, 968\}, \{ 0, -4171, 1731, 430\},\n\
|
||||||
|
\{ 0, -3432, 13873, 166\}, \{ 0, -3571, 2840, 870\},\n\
|
||||||
|
\{ 0, -3060, 2468, 463\}, \{ 0, -2858, 2369, 373\},\n\
|
||||||
|
\{ 0, -2948, 3186, 438\}, \{ 0, -3305, 2984, -160\},\n\
|
||||||
|
\{ 0, -2027, 3128, -798\}, \{ 0, -2663, 3320, -865\},\n\
|
||||||
|
\{ 0, -3992, -562, -1509\}, \{ 0, -2913, 2844, -1081\},\n\
|
||||||
|
\{ 0, -3205, 3373, -1418\}, \{ 0, -3366, 3063, -1645\},\n\
|
||||||
|
\{ 0, -3878, 2873, -920\}, \{ 0, -1801, 6168, 2384\},\n\
|
||||||
|
\{ 0, -1252, 6409, 2308\}, \{ 0, -1724, 6027, 2474\},\n\
|
||||||
|
\{ 0, -1937, 5849, 2730\}, \{ 0, -1921, 5622, 2349\},\n\
|
||||||
|
\{ 0, -2162, 5995, -1804\}, \{ 0, -1707, 6306, 2744\},\n\
|
||||||
|
\{ 0, -1334, 5651, 3112\}, \{ 0, -2132, 5216, 2588\},\n\
|
||||||
|
\{ 0, -1878, 5912, 2448\}, \{ 0, -1233, 5205, 2467\},\n\
|
||||||
|
\{ 0, -1139, 5350, 2967\}, \{ 0, -2373, 5368, -23580\},\n\
|
||||||
|
\{ 0, -1706, 5450, 2374\}, \{ 0, -1718, 5876, 2333\},\n\
|
||||||
|
\{ 0, -1569, 5961, 2570\}, \{ 0, -1177, 6423, 2665\},\n\
|
||||||
|
\{ 0, -1210, 5976, 2608\}, \n\
|
||||||
|
};"
|
||||||
|
|
||||||
|
calMap[LJ01]="\{\n\
|
||||||
|
\{ 0, 5716, -1041, -12697\}, \{ 0, 5110, -1450, -13222\},\n\
|
||||||
|
\{ 0, 4487, -1630, -13282\}, \{ 0, 4606, -1821, -13197\},\n\
|
||||||
|
\{ 0, 4663, -2299, -13302\}, \{ 0, 4092, -2324, -13451\},\n\
|
||||||
|
\{ 0, 4233, -2419, -13189\}, \{ 0, 3702, -2961, -14147\},\n\
|
||||||
|
\{ 0, 3167, -3408, -14660\}, \{ 0, 3564, -3255, -13877\},\n\
|
||||||
|
\{ 0, 3320, -3407, -13671\}, \{ 0, 3137, -3350, -13820\},\n\
|
||||||
|
\{ 0, 3342, -3703, -13808\}, \{ 0, 3519, -3970, -14069\},\n\
|
||||||
|
\{ 0, 2983, -4415, -14335\}, \{ 0, 3636, -3825, -13840\},\n\
|
||||||
|
\{ 0, 3461, -3922, -14323\}, \{ 0, 3419, -4022, -14031\},\n\
|
||||||
|
\{ 0, 3763, -4066, -13832\}, \{ 0, 3929, -3504, -13827\},\n\
|
||||||
|
\{ 0, 3634, -4035, -14096\}, \{ 0, 3195, -6232, -14808\},\n\
|
||||||
|
\{ 0, 3428, -6179, -14913\}, \{ 0, 3506, -5525, -14510\},\n\
|
||||||
|
\{ 0, 3754, -5724, -14134\}, \{ 0, 3630, -5791, -14743\},\n\
|
||||||
|
\{ 0, 3857, -5548, -14269\}, \{ 0, 4654, -4964, -13701\},\n\
|
||||||
|
\{ 0, 4853, -4388, -13822\}, \{ 0, 4735, -4632, -13864\},\n\
|
||||||
|
\{ 0, 4981, -4381, -13979\}, \{ 0, 5528, -3984, -13626\},\n\
|
||||||
|
\{ 0, 5130, -4326, -13639\}, \{ 0, 5095, -3792, -13638\},\n\
|
||||||
|
\{ 0, 5346, -3366, -13030\}, \{ 0, 5498, -3496, -13682\},\n\
|
||||||
|
\{ 0, 5144, -3120, -13986\}, \{ 0, 5427, -2871, -12931\},\n\
|
||||||
|
\{ 0, 5939, -2824, -12646\}, \{ 0, 6030, -2983, -12662\},\n\
|
||||||
|
\{ 0, 5959, -3142, -12116\}, \{ 0, 5903, -2700, -11731\},\n\
|
||||||
|
\{ 0, 6256, -3546, -10932\}, \{ 0, 6384, -3767, -11326\},\n\
|
||||||
|
\{ 0, 6086, -3399, -11769\}, \{ 0, 5915, -3257, -12066\},\n\
|
||||||
|
\{ 0, 6257, -4021, -12273\}, \{ 0, 6084, -4192, -12153\},\n\
|
||||||
|
\{ 0, 5482, -4102, -12637\}, \{ 0, 5836, -3698, -12767\},\n\
|
||||||
|
\{ 0, 6025, -4014, -13219\}, \{ 0, 5713, -3812, -14315\},\n\
|
||||||
|
\{ 0, 5997, -3855, -14788\}, \{ 0, 5866, -3905, -15408\},\n\
|
||||||
|
\{ 0, 5328, -4627, -16458\}, \{ 0, 5686, -3646, -14885\},\n\
|
||||||
|
\{ 0, 5551, -3407, -15112\}, \{ 0, 5720, -3165, -14247\},\n\
|
||||||
|
\{ 0, 6044, -3818, -14224\}, \{ 0, 5963, -3342, -14531\},\n\
|
||||||
|
\{ 0, 6128, -3225, -13495\}, \{ 0, 6564, -3662, -13408\},\n\
|
||||||
|
\{ 0, 6000, -3479, -13609\}, \{ 0, 5876, -3190, -11817\},\n\
|
||||||
|
\{ 0, 7165, -2876, -10874\}, \{ 0, 6593, -4000, -11565\},\n\
|
||||||
|
\{ 0, 6207, -3694, -11278\}, \{ 0, 6732, -2326, -11167\},\n\
|
||||||
|
\{ 0, 6335, -3650, -11508\}, \{ 0, 6220, -4220, -12438\},\n\
|
||||||
|
\{ 0, 6069, -3838, -12545\}, \{ 0, 6182, -4635, -12472\},\n\
|
||||||
|
\{ 0, 5696, -4834, -12334\}, \{ 0, 6047, -4121, -11691\},\n\
|
||||||
|
\{ 0, 6324, -4125, -10980\}, \{ 0, 6102, -3923, -10939\},\n\
|
||||||
|
\{ 0, 6091, -3829, -10736\}, \{ 0, 5858, -4001, -10473\},\n\
|
||||||
|
\{ 0, 5473, -4773, -11209\}, \{ 0, 6045, -4642, -10361\},\n\
|
||||||
|
\{ 0, 5494, -4391, -10203\}, \n\
|
||||||
|
};"
|
||||||
|
|
||||||
|
calMap[LJ02]="\{\n\
|
||||||
|
\{ 0, -726, 598, -2561\}, \{ 0, -743, 864, -2549\},\n\
|
||||||
|
\{ 0, -769, 992, -2477\}, \{ 0, -905, 665, -2742\},\n\
|
||||||
|
\{ 0, -944, 665, -2710\}, \{ 0, -1180, 727, -2794\},\n\
|
||||||
|
\{ 0, -1012, 642, -2599\}, \{ 0, -1195, 690, -2770\},\n\
|
||||||
|
\{ 0, -1191, 667, -2846\}, \{ 0, -1173, 684, -2759\},\n\
|
||||||
|
\{ 0, -1158, 708, -2795\}, \{ 0, -1072, 678, -2852\},\n\
|
||||||
|
\{ 0, -1175, 872, -2747\}, \{ 0, -1011, 862, -2673\},\n\
|
||||||
|
\{ 0, -1086, 755, -2927\}, \{ 0, -1042, 1076, -2731\},\n\
|
||||||
|
\{ 0, -1042, 914, -2765\}, \{ 0, -758, 1182, -2443\},\n\
|
||||||
|
\{ 0, -757, 1219, -2500\}, \{ 0, -534, 1472, -2295\},\n\
|
||||||
|
\{ 0, -497, 1543, -2104\}, \{ 0, -1267, -632, -3273\},\n\
|
||||||
|
\{ 0, -1133, -761, -3048\}, \{ 0, -1065, -375, -2952\},\n\
|
||||||
|
\{ 0, -722, -133, -2551\}, \{ 0, -586, 52, -2505\},\n\
|
||||||
|
\{ 0, -546, 67, -2219\}, \{ 0, -477, 177, -2017\},\n\
|
||||||
|
\{ 0, -317, 317, -1888\}, \{ 0, -161, 364, -1712\},\n\
|
||||||
|
\{ 0, 5, 359, -1770\}, \{ 0, -283, 214, -1901\},\n\
|
||||||
|
\{ 0, -59, 353, -1551\}, \{ 0, 108, 454, -1465\},\n\
|
||||||
|
\{ 0, -74, 796, -1225\}, \{ 0, 41, 685, -1221\},\n\
|
||||||
|
\{ 0, 84, 576, -1318\}, \{ 0, 14, 504, -1313\},\n\
|
||||||
|
\{ 0, 37, 448, -1301\}, \{ 0, 18, 344, -1408\},\n\
|
||||||
|
\{ 0, -70, 240, -1384\}, \{ 0, -27, 186, -1595\},\n\
|
||||||
|
\{ 0, 622, 981, -855\}, \{ 0, 351, 889, -1188\},\n\
|
||||||
|
\{ 0, 475, 758, -1328\}, \{ 0, 305, 1025, -1222\},\n\
|
||||||
|
\{ 0, 526, 609, -1397\}, \{ 0, 398, 426, -1695\},\n\
|
||||||
|
\{ 0, 237, 543, -1835\}, \{ 0, 357, 739, -1747\},\n\
|
||||||
|
\{ 0, 400, 699, -1834\}, \{ 0, 319, 943, -1998\},\n\
|
||||||
|
\{ 0, 244, 783, -2197\}, \{ 0, 249, 976, -2195\},\n\
|
||||||
|
\{ 0, 266, 859, -2406\}, \{ 0, 332, 959, -2477\},\n\
|
||||||
|
\{ 0, 225, 968, -2554\}, \{ 0, 97, 808, -2815\},\n\
|
||||||
|
\{ 0, 73, 895, -2852\}, \{ 0, -155, 877, -2986\},\n\
|
||||||
|
\{ 0, -71, 914, -2943\}, \{ 0, -232, 862, -2966\},\n\
|
||||||
|
\{ 0, -347, 772, -3176\}, \{ 0, 675, 250, -956\},\n\
|
||||||
|
\{ 0, 589, 204, -935\}, \{ 0, 459, 110, -867\},\n\
|
||||||
|
\{ 0, 149, -88, -1251\}, \{ 0, 272, -145, -930\},\n\
|
||||||
|
\{ 0, 304, -62, -857\}, \{ 0, 24, -487, -1384\},\n\
|
||||||
|
\{ 0, 51, -31, -984\}, \{ 0, 154, -77, -992\},\n\
|
||||||
|
\{ 0, -23, -238, -1234\}, \{ 0, 28, -331, -1323\},\n\
|
||||||
|
\{ 0, 104, -415, -1424\}, \{ 0, -177, -633, -1704\},\n\
|
||||||
|
\{ 0, 21, -514, -1572\}, \{ 0, 210, -796, -1584\},\n\
|
||||||
|
\{ 0, 133, -693, -1782\}, \{ 0, 161, -882, -1824\},\n\
|
||||||
|
\{ 0, 118, -1098, -1994\}, \n\
|
||||||
|
};"
|
||||||
|
|
||||||
|
calMap[LJ03]="\{\n\
|
||||||
|
\{ 0, 13063, -4747, -10433\}, \{ 0, 3443, -4140, -9849\},\n\
|
||||||
|
\{ 0, 7069, -4629, -10540\}, \{ 0, 13946, -4544, -10775\},\n\
|
||||||
|
\{ 0, 12968, -4307, -10347\}, \{ 0, 20281, -5019, -11282\},\n\
|
||||||
|
\{ 0, 22661, -5079, -11148\}, \{ 0, 16734, -4442, -10374\},\n\
|
||||||
|
\{ 0, 15423, -4074, -10422\}, \{ 0, 22851, -4441, -10405\},\n\
|
||||||
|
\{ 0, 14291, -3978, -9960\}, \{ 0, 4367, -3954, -9810\},\n\
|
||||||
|
\{ 0, 11785, -3957, -10150\}, \{ 0, 3218, -3775, -9825\},\n\
|
||||||
|
\{ 0, 3344, -3314, -9254\}, \{ 0, 6873, -3528, -9614\},\n\
|
||||||
|
\{ 0, 3630, -3230, -9069\}, \{ 0, 3442, -3275, -9653\},\n\
|
||||||
|
\{ 0, 3346, -3858, -9895\}, \{ 0, 3721, -3391, -9296\},\n\
|
||||||
|
\{ 0, 3261, -3428, -9383\}, \{ 0, -24770, -8031, -10490\},\n\
|
||||||
|
\{ 0, -24608, -7690, -10198\}, \{ 0, -24868, -7897, -9937\},\n\
|
||||||
|
\{ 0, -24880, -7994, -10295\}, \{ 0, -24908, -7089, -10312\},\n\
|
||||||
|
\{ 0, -24547, -7588, -10044\}, \{ 0, -24905, -8076, -9985\},\n\
|
||||||
|
\{ 0, -24646, -7229, -9709\}, \{ 0, -24916, -7800, -10193\},\n\
|
||||||
|
\{ 0, -25334, -8019, -10733\}, \{ 0, -24839, -7637, -10037\},\n\
|
||||||
|
\{ 0, -25020, -7138, -9907\}, \{ 0, -24502, -7503, -10369\},\n\
|
||||||
|
\{ 0, -24471, -7222, -10546\}, \{ 0, -24537, -7066, -10359\},\n\
|
||||||
|
\{ 0, -24407, -6616, -9797\}, \{ 0, -23898, -7370, -10755\},\n\
|
||||||
|
\{ 0, -24587, -7630, -10656\}, \{ 0, -24411, -7258, -11072\},\n\
|
||||||
|
\{ 0, -24028, -7203, -10471\}, \{ 0, -24139, -7585, -10014\},\n\
|
||||||
|
\{ 0, -23817, -6456, -10002\}, \{ 0, -24122, -6453, -10354\},\n\
|
||||||
|
\{ 0, 25236, -6345, -9380\}, \{ 0, 25260, -6144, -9727\},\n\
|
||||||
|
\{ 0, -25031, -6591, -10264\}, \{ 0, 11624, -6478, -10071\},\n\
|
||||||
|
\{ 0, 11896, -5407, -9780\}, \{ 0, 14144, -5554, -10328\},\n\
|
||||||
|
\{ 0, 5556, -5558, -10775\}, \{ 0, 3406, -5945, -10115\},\n\
|
||||||
|
\{ 0, 3384, -5384, -10050\}, \{ 0, 3263, -4468, -9634\},\n\
|
||||||
|
\{ 0, 5991, -4734, -9494\}, \{ 0, 3953, -5377, -10430\},\n\
|
||||||
|
\{ 0, 4514, -3687, -9547\}, \{ 0, 4487, -3691, -9332\},\n\
|
||||||
|
\{ 0, 5085, -4417, -9657\}, \{ 0, 5222, -3694, -9115\},\n\
|
||||||
|
\{ 0, 4960, -4086, -8862\}, \{ 0, 4994, -4292, -9127\},\n\
|
||||||
|
\{ 0, 5162, -4509, -8554\}, \{ 0, 4337, -5390, -8443\},\n\
|
||||||
|
\{ 0, 4628, -4976, -9047\}, \{ 0, 4293, -4876, -9218\},\n\
|
||||||
|
\{ 0, 4465, -5352, -9014\}, \{ 0, 4428, -4936, -9521\},\n\
|
||||||
|
\{ 0, 4048, -5497, -9795\}, \{ 0, 4290, -6034, -9032\},\n\
|
||||||
|
\{ 0, 4184, -4996, -8434\}, \{ 0, 3950, -4983, -8474\},\n\
|
||||||
|
\{ 0, 4247, -4407, -7955\}, \{ 0, 4386, -4769, -8079\},\n\
|
||||||
|
\{ 0, 4311, -5367, -8478\}, \{ 0, 4283, -4809, -8025\},\n\
|
||||||
|
\{ 0, 3885, -4011, -7495\}, \{ 0, 3885, -4593, -7577\},\n\
|
||||||
|
\{ 0, 3622, -5239, -8157\}, \{ 0, 3576, -5007, -7816\},\n\
|
||||||
|
\{ 0, 3778, -3793, -7362\}, \n\
|
||||||
|
};"
|
||||||
|
|
||||||
|
calMap[LJ04]="\{\n\
|
||||||
|
\{ 0, -3188, -5668, -7029\}, \{ 0, -3144, -5592, -6708\},\n\
|
||||||
|
\{ 0, -3332, -5859, -7135\}, \{ 0, -3402, -5694, -6908\},\n\
|
||||||
|
\{ 0, -3376, -5858, -7070\}, \{ 0, -3383, -5474, -6886\},\n\
|
||||||
|
\{ 0, -3518, -5487, -6925\}, \{ 0, -3383, -5342, -6659\},\n\
|
||||||
|
\{ 0, -3487, -5535, -6848\}, \{ 0, -3472, -5206, -6576\},\n\
|
||||||
|
\{ 0, -3432, -5335, -6581\}, \{ 0, -3502, -5071, -6421\},\n\
|
||||||
|
\{ 0, -3549, -5020, -6390\}, \{ 0, -3618, -4961, -6310\},\n\
|
||||||
|
\{ 0, -3774, -4938, -6377\}, \{ 0, -3868, -5039, -6488\},\n\
|
||||||
|
\{ 0, -3865, -4778, -6328\}, \{ 0, -3812, -4602, -6360\},\n\
|
||||||
|
\{ 0, -3990, -4498, -6189\}, \{ 0, -3820, -4493, -6070\},\n\
|
||||||
|
\{ 0, -3793, -4262, -5963\}, \{ 0, -4355, -5745, -6648\},\n\
|
||||||
|
\{ 0, -4372, -5742, -6633\}, \{ 0, -4458, -5618, -6650\},\n\
|
||||||
|
\{ 0, -4484, -5695, -6732\}, \{ 0, -4367, -5513, -6642\},\n\
|
||||||
|
\{ 0, -4433, -5498, -6628\}, \{ 0, -4364, -5480, -6563\},\n\
|
||||||
|
\{ 0, -4344, -5382, -6497\}, \{ 0, -4255, -5470, -6465\},\n\
|
||||||
|
\{ 0, -4154, -5145, -6183\}, \{ 0, -4211, -5200, -6136\},\n\
|
||||||
|
\{ 0, -4086, -5205, -6195\}, \{ 0, -4113, -5261, -6338\},\n\
|
||||||
|
\{ 0, -4069, -4832, -5831\}, \{ 0, -3835, -4826, -5801\},\n\
|
||||||
|
\{ 0, -4030, -5011, -6065\}, \{ 0, -3711, -4838, -5795\},\n\
|
||||||
|
\{ 0, -3644, -4881, -5899\}, \{ 0, -3507, -4813, -5800\},\n\
|
||||||
|
\{ 0, -3453, -4947, -5520\}, \{ 0, -3374, -4954, -5642\},\n\
|
||||||
|
\{ 0, -4837, -5736, -7500\}, \{ 0, -4470, -5620, -7385\},\n\
|
||||||
|
\{ 0, -4401, -5408, -7370\}, \{ 0, -4271, -5626, -7496\},\n\
|
||||||
|
\{ 0, -4286, -5828, -7556\}, \{ 0, -4184, -5982, -7565\},\n\
|
||||||
|
\{ 0, -3923, -5491, -7415\}, \{ 0, -3926, -5554, -7685\},\n\
|
||||||
|
\{ 0, -3657, -5235, -7542\}, \{ 0, -3530, -5104, -7717\},\n\
|
||||||
|
\{ 0, -3370, -4853, -7737\}, \{ 0, -3224, -4703, -7679\},\n\
|
||||||
|
\{ 0, -3100, -4620, -7733\}, \{ 0, -3010, -4547, -7648\},\n\
|
||||||
|
\{ 0, -2838, -4318, -7619\}, \{ 0, -2907, -4260, -7604\},\n\
|
||||||
|
\{ 0, -2883, -4306, -7768\}, \{ 0, -2878, -3949, -7601\},\n\
|
||||||
|
\{ 0, -2927, -4097, -7840\}, \{ 0, -2816, -3790, -7544\},\n\
|
||||||
|
\{ 0, -2853, -3654, -7534\}, \{ 0, -2052, -2142, -3986\},\n\
|
||||||
|
\{ 0, -2109, -2259, -4027\}, \{ 0, -2132, -2002, -3745\},\n\
|
||||||
|
\{ 0, -2275, -2181, -3810\}, \{ 0, -2353, -1951, -3419\},\n\
|
||||||
|
\{ 0, -2428, -2046, -3391\}, \{ 0, -2537, -1974, -3301\},\n\
|
||||||
|
\{ 0, -2568, -1805, -3074\}, \{ 0, -2764, -1930, -3068\},\n\
|
||||||
|
\{ 0, -2793, -1922, -2816\}, \{ 0, -2931, -2060, -2982\},\n\
|
||||||
|
\{ 0, -3118, -2158, -2858\}, \{ 0, -3370, -2240, -3088\},\n\
|
||||||
|
\{ 0, -3411, -2369, -3055\}, \{ 0, -3867, -2590, -3016\},\n\
|
||||||
|
\{ 0, -3965, -2696, -3099\}, \{ 0, -4112, -2907, -3438\},\n\
|
||||||
|
\{ 0, -4226, -2747, -3341\}, \n\
|
||||||
|
};"
|
||||||
|
|
||||||
|
calMap[LJ06]="\{\n\
|
||||||
|
\{ 0, -4989, -7102, -2178\}, \{ 0, -5092, -7204, -2325\},\n\
|
||||||
|
\{ 0, -4959, -7013, -2137\}, \{ 0, -4960, -6784, -1920\},\n\
|
||||||
|
\{ 0, -5025, -6734, -2104\}, \{ 0, -5181, -6637, -2017\},\n\
|
||||||
|
\{ 0, -5262, -6792, -2110\}, \{ 0, -5362, -6621, -2110\},\n\
|
||||||
|
\{ 0, -5258, -6451, -2031\}, \{ 0, -5375, -6390, -2064\},\n\
|
||||||
|
\{ 0, -5280, -6288, -2052\}, \{ 0, -5445, -6434, -2101\},\n\
|
||||||
|
\{ 0, -5553, -6402, -2272\}, \{ 0, -5603, -6628, -2477\},\n\
|
||||||
|
\{ 0, -5661, -6626, -2492\}, \{ 0, -5731, -6618, -2616\},\n\
|
||||||
|
\{ 0, -5746, -6626, -2664\}, \{ 0, -6007, -7024, -2951\},\n\
|
||||||
|
\{ 0, -6018, -7010, -2969\}, \{ 0, -5746, -6939, -2833\},\n\
|
||||||
|
\{ 0, -5770, -7034, -3026\}, \{ 0, -8509, -8777, -6863\},\n\
|
||||||
|
\{ 0, -8593, -9060, -6868\}, \{ 0, -8514, -9104, -6795\},\n\
|
||||||
|
\{ 0, -8401, -9387, -6931\}, \{ 0, -8236, -9191, -6586\},\n\
|
||||||
|
\{ 0, -8155, -9371, -6595\}, \{ 0, -8192, -9551, -6363\},\n\
|
||||||
|
\{ 0, -7995, -9550, -6185\}, \{ 0, -7968, -9690, -6220\},\n\
|
||||||
|
\{ 0, -7826, -9694, -6052\}, \{ 0, -7694, -9660, -5763\},\n\
|
||||||
|
\{ 0, -7857, -10020, -5947\}, \{ 0, -7543, -9682, -5463\},\n\
|
||||||
|
\{ 0, -7184, -9071, -4747\}, \{ 0, -7282, -9220, -4767\},\n\
|
||||||
|
\{ 0, -7417, -9371, -4765\}, \{ 0, -7238, -9321, -4430\},\n\
|
||||||
|
\{ 0, -7320, -9420, -4560\}, \{ 0, -7254, -9185, -4270\},\n\
|
||||||
|
\{ 0, -7378, -9262, -4324\}, \{ 0, -7078, -9074, -3976\},\n\
|
||||||
|
\{ 0, -10047, -10956, -7258\}, \{ 0, -10107, -10961, -7192\},\n\
|
||||||
|
\{ 0, -10264, -11167, -7427\}, \{ 0, -10160, -10823, -7282\},\n\
|
||||||
|
\{ 0, -10276, -11378, -7508\}, \{ 0, -10576, -11282, -7688\},\n\
|
||||||
|
\{ 0, -10801, -11460, -7845\}, \{ 0, -10822, -10983, -7809\},\n\
|
||||||
|
\{ 0, -10947, -10998, -8018\}, \{ 0, -11215, -10876, -8255\},\n\
|
||||||
|
\{ 0, -11247, -10590, -8188\}, \{ 0, -11302, -10269, -8237\},\n\
|
||||||
|
\{ 0, -11583, -10213, -8413\}, \{ 0, -11561, -10001, -8448\},\n\
|
||||||
|
\{ 0, -11482, -9425, -8273\}, \{ 0, -11573, -9203, -8344\},\n\
|
||||||
|
\{ 0, -11661, -8895, -8267\}, \{ 0, -11843, -8879, -8259\},\n\
|
||||||
|
\{ 0, -11799, -8715, -8112\}, \{ 0, -12002, -8422, -8238\},\n\
|
||||||
|
\{ 0, -12022, -8434, -8409\}, \{ 0, -8755, -4274, -4932\},\n\
|
||||||
|
\{ 0, -9183, -4523, -5458\}, \{ 0, -9293, -4300, -5260\},\n\
|
||||||
|
\{ 0, -9530, -4543, -5569\}, \{ 0, -9573, -4168, -5429\},\n\
|
||||||
|
\{ 0, -9847, -4448, -5638\}, \{ 0, -9999, -4504, -5969\},\n\
|
||||||
|
\{ 0, -9858, -4176, -5716\}, \{ 0, -9988, -4378, -5978\},\n\
|
||||||
|
\{ 0, -9760, -3942, -5627\}, \{ 0, -10072, -4163, -6002\},\n\
|
||||||
|
\{ 0, -9892, -4091, -5833\}, \{ 0, -9873, -3867, -5828\},\n\
|
||||||
|
\{ 0, -9911, -4149, -5877\}, \{ 0, -9844, -4016, -5908\},\n\
|
||||||
|
\{ 0, -9528, -3912, -5604\}, \{ 0, -9432, -3911, -5648\},\n\
|
||||||
|
\{ 0, -9314, -3730, -5422\}, \n\
|
||||||
|
};"
|
||||||
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
clear;clc;
|
||||||
|
|
||||||
|
fid = fopen("../caldata", "w");
|
||||||
|
fprintf(fid, "declare -A calMap\n");
|
||||||
|
|
||||||
|
for i = 1:6
|
||||||
|
id = sprintf("JG%02d", i);
|
||||||
|
write_data(fid, pwd, id);
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1:6
|
||||||
|
id = sprintf("LJ%02d", i);
|
||||||
|
write_data(fid, pwd, id);
|
||||||
|
end
|
||||||
|
|
||||||
|
fclose(fid);
|
||||||
|
|
||||||
|
function write_data(fid, folder_name, dev_id)
|
||||||
|
file_path = sprintf("%s/phase_%s.mat", folder_name, dev_id);
|
||||||
|
if ~isfile(file_path)
|
||||||
|
warning('[%s] dose not exist.\n', file_path);
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
load(file_path);
|
||||||
|
data = sortrows(dataDec1, 1);
|
||||||
|
fprintf(fid, 'calMap[%s]="\\{\\n\\\n', dev_id);
|
||||||
|
for i = 1:size(data,1)
|
||||||
|
if (mod(i, 2) == 1)
|
||||||
|
fprintf(fid, "\t");
|
||||||
|
end
|
||||||
|
fprintf(fid, "\\{%6d, %6d, %6d, %6d\\},", ...
|
||||||
|
data(i,2), data(i,3), data(i,4), data(i,5));
|
||||||
|
if (mod(i, 2) == 1)
|
||||||
|
fprintf(fid, " ");
|
||||||
|
else
|
||||||
|
fprintf(fid, "\\n\\\n");
|
||||||
|
end
|
||||||
|
end
|
||||||
|
fprintf(fid, '\\n\\\n};"\n\n');
|
||||||
|
end
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -22,7 +22,7 @@ except ImportError:
|
|||||||
from COMTool.widgets import statusBar
|
from COMTool.widgets import statusBar
|
||||||
|
|
||||||
class Plugin(Plugin_Base):
|
class Plugin(Plugin_Base):
|
||||||
id = "DEIFEI"
|
id = "DUIFEI"
|
||||||
name = _("DUIFEI")
|
name = _("DUIFEI")
|
||||||
showReceiveDataSignal = pyqtSignal(str)
|
showReceiveDataSignal = pyqtSignal(str)
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ class Plugin(Plugin_Base):
|
|||||||
self.config["customSendItems"] = newItems
|
self.config["customSendItems"] = newItems
|
||||||
self.showReceiveDataSignal.connect(self.showReceivedData)
|
self.showReceiveDataSignal.connect(self.showReceivedData)
|
||||||
# frame struct
|
# frame struct
|
||||||
self.structSelfTestRsp = Struct("<BB B BBBbbb BbBBB H")
|
self.structSelfTestRsp = Struct("<BB B BBBbbb BbBBB BB")
|
||||||
self.structStatusCheckRsp = Struct("<BB Q HIII IBBBBI BBHH HHHIIIIII i II 4s IIII d Q dBB dB H B 3s BBBbbb BbBBB 2s")
|
self.structStatusCheckRsp = Struct("<BB Q HIII IBBBBI BBHH HHHIIIIII i II 4s IIII d Q dBB dB H B 3s BBBbbb BbBBB 2s")
|
||||||
self.structFljData = Struct("<dddd IHI fff fff")
|
self.structFljData = Struct("<dddd IHI fff fff")
|
||||||
self.structLjData = Struct("<IHI ffff IHI fff fff fff IHI fff fff fff IHI fff fff fff I")
|
self.structLjData = Struct("<IHI ffff IHI fff fff fff IHI fff fff fff IHI fff fff fff I")
|
||||||
@@ -260,6 +260,8 @@ class Plugin(Plugin_Base):
|
|||||||
|
|
||||||
ret = "----------- 自检回令 -----------\n"
|
ret = "----------- 自检回令 -----------\n"
|
||||||
|
|
||||||
|
ret += f"节点编号: 0x{payload[-2]:02X}\n"
|
||||||
|
|
||||||
ret += "节点类型: "
|
ret += "节点类型: "
|
||||||
if payload[1] == 0xDD:
|
if payload[1] == 0xDD:
|
||||||
ret += f"K频段 (0x{payload[1]:02X})\n"
|
ret += f"K频段 (0x{payload[1]:02X})\n"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ C_DEPS += \
|
|||||||
src/dev_profile/%.o: ../src/dev_profile/%.c
|
src/dev_profile/%.o: ../src/dev_profile/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ C_DEPS += \
|
|||||||
src/systembus/%.o: ../src/systembus/%.c
|
src/systembus/%.o: ../src/systembus/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ C_DEPS += \
|
|||||||
src/networking/link_layer/geometry/%.o: ../src/networking/link_layer/geometry/%.c
|
src/networking/link_layer/geometry/%.o: ../src/networking/link_layer/geometry/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ C_DEPS += \
|
|||||||
src/networking/link_layer/%.o: ../src/networking/link_layer/%.c
|
src/networking/link_layer/%.o: ../src/networking/link_layer/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ C_DEPS += \
|
|||||||
src/networking/phy_layer/%.o: ../src/networking/phy_layer/%.c
|
src/networking/phy_layer/%.o: ../src/networking/phy_layer/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ C_DEPS += \
|
|||||||
src/%.o: ../src/%.c
|
src/%.o: ../src/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ C_DEPS += \
|
|||||||
src/time_ctrl/%.o: ../src/time_ctrl/%.c
|
src/time_ctrl/%.o: ../src/time_ctrl/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ C_DEPS += \
|
|||||||
src/util/%.o: ../src/util/%.c
|
src/util/%.o: ../src/util/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#define APP_EMULATE_DATA
|
#define APP_EMULATE_DATA
|
||||||
#define DATALINK_ENABLE_AUTORECONNECT
|
#define DATALINK_ENABLE_AUTORECONNECT
|
||||||
#define DATALINK_ENABLE_AUTOTIMESYNC
|
#define DATALINK_ENABLE_AUTOTIMESYNC
|
||||||
//#define DATALINK_ENABLE_BERTEST
|
#define DATALINK_ENABLE_BERTEST 10
|
||||||
|
|
||||||
|
|
||||||
/************ Hardware Configs ************/
|
/************ Hardware Configs ************/
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ L2_CONFIG linkConfig =
|
|||||||
.clustId = 1,
|
.clustId = 1,
|
||||||
.myId = 1,
|
.myId = 1,
|
||||||
.headId = 1,
|
.headId = 1,
|
||||||
.bkpHeadId = 0,
|
|
||||||
.netScale = 2,
|
.netScale = 2,
|
||||||
.phyInstPtr = NULL, // physical layer reference
|
.phyInstPtr = NULL, // physical layer reference
|
||||||
.tmcInstPtr = NULL
|
.tmcInstPtr = NULL
|
||||||
@@ -99,7 +98,6 @@ L2_CONFIG linkConfig =
|
|||||||
// .clustId = 1,
|
// .clustId = 1,
|
||||||
// .myId = 2,
|
// .myId = 2,
|
||||||
// .headId = 1,
|
// .headId = 1,
|
||||||
// .bkpHeadId = 0,
|
|
||||||
// .netScale = 2,
|
// .netScale = 2,
|
||||||
// .phyInstPtr = NULL, // physical layer reference
|
// .phyInstPtr = NULL, // physical layer reference
|
||||||
// .tmcInstPtr = NULL
|
// .tmcInstPtr = NULL
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ static int32_t Mpc_SystemConfig(MPC *instPtr, uint8_t *msg)
|
|||||||
* @param InstPtr A double pointer to MPC instance.
|
* @param InstPtr A double pointer to MPC instance.
|
||||||
* @param config A pointer to MPC configurations.
|
* @param config A pointer to MPC configurations.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return Error code.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
|
int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
|
||||||
@@ -290,7 +290,7 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
|
|||||||
(*instPtr) = malloc(sizeof(MPC));
|
(*instPtr) = malloc(sizeof(MPC));
|
||||||
if ((*instPtr) == NULL)
|
if ((*instPtr) == NULL)
|
||||||
{
|
{
|
||||||
return FAILURE;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
(*instPtr)->rxQueue = NULL;
|
(*instPtr)->rxQueue = NULL;
|
||||||
(*instPtr)->txQueue = NULL;
|
(*instPtr)->txQueue = NULL;
|
||||||
@@ -307,14 +307,15 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
|
|||||||
bramConfigPtr = XBram_LookupConfig(config->bramId);
|
bramConfigPtr = XBram_LookupConfig(config->bramId);
|
||||||
if (bramConfigPtr == NULL)
|
if (bramConfigPtr == NULL)
|
||||||
{
|
{
|
||||||
Status = EDCONF;
|
Mpc_Destroy(*instPtr);
|
||||||
goto mpc_init_error;
|
return EDCONF;
|
||||||
}
|
}
|
||||||
Status = XBram_CfgInitialize(&mpcBram, bramConfigPtr,
|
Status = XBram_CfgInitialize(&mpcBram, bramConfigPtr,
|
||||||
bramConfigPtr->CtrlBaseAddress);
|
bramConfigPtr->CtrlBaseAddress);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto mpc_init_error;
|
Mpc_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Execute the BRAM driver selftest.
|
* Execute the BRAM driver selftest.
|
||||||
@@ -322,7 +323,8 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
|
|||||||
Status = XBram_SelfTest(&mpcBram, 0);
|
Status = XBram_SelfTest(&mpcBram, 0);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto mpc_init_error;
|
Mpc_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
mpcHwConfig.txBuffAddr = mpcBram.Config.MemBaseAddress;
|
mpcHwConfig.txBuffAddr = mpcBram.Config.MemBaseAddress;
|
||||||
@@ -332,32 +334,47 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
|
|||||||
Status = MpcHw_Init(&((*instPtr)->mpchwDesc), &mpcHwConfig);
|
Status = MpcHw_Init(&((*instPtr)->mpchwDesc), &mpcHwConfig);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
Status = ENOMEM;
|
Mpc_Destroy(*instPtr);
|
||||||
goto mpc_init_error;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
if (CircQueueCreate(&((*instPtr)->txQueue), (*instPtr)->config.txQueueMax) == false)
|
if (CircQueueCreate(&((*instPtr)->txQueue), (*instPtr)->config.txQueueMax) == false)
|
||||||
{
|
{
|
||||||
Status = ENOMEM;
|
Mpc_Destroy(*instPtr);
|
||||||
goto mpc_init_error;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
if (CircQueueCreate(&((*instPtr)->rxQueue), (*instPtr)->config.rxQueueMax) == false)
|
if (CircQueueCreate(&((*instPtr)->rxQueue), (*instPtr)->config.rxQueueMax) == false)
|
||||||
{
|
{
|
||||||
Status = ENOMEM;
|
Mpc_Destroy(*instPtr);
|
||||||
goto mpc_init_error;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
(*instPtr)->isEnable = false; // nothing received.
|
(*instPtr)->isEnable = false; // nothing received.
|
||||||
(*instPtr)->isRxDone = false; // nothing received.
|
(*instPtr)->isRxDone = false; // nothing received.
|
||||||
(*instPtr)->isTxDone = true; // nothing to be sent.
|
(*instPtr)->isTxDone = true; // nothing to be sent.
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
|
||||||
mpc_init_error:
|
|
||||||
free((*instPtr)->mpchwDesc);
|
|
||||||
free((*instPtr)->txQueue);
|
|
||||||
free((*instPtr)->rxQueue);
|
|
||||||
free(*instPtr);
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/**
|
||||||
|
* @brief Destroy MPC instance.
|
||||||
|
*
|
||||||
|
* @param InstPtr A pointer to MPC instance.
|
||||||
|
*
|
||||||
|
* @return None.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
void Mpc_Destroy(MPC *instPtr)
|
||||||
|
{
|
||||||
|
if (instPtr == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
free(instPtr->mpchwDesc);
|
||||||
|
free(instPtr->txQueue);
|
||||||
|
free(instPtr->rxQueue);
|
||||||
|
free(instPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**
|
/**
|
||||||
* @brief Generate a remote test response message.
|
* @brief Generate a remote test response message.
|
||||||
@@ -534,17 +551,16 @@ int32_t Mpc_RxIrqHandler(MPC *instPtr)
|
|||||||
Status = MpcHw_Recv(instPtr->mpchwDesc, mpcReq);
|
Status = MpcHw_Recv(instPtr->mpchwDesc, mpcReq);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto recv_error;
|
DBG_ERROR("SystemBus::RX error!\n");
|
||||||
|
free(mpcReq);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
if (CircQueuePush(instPtr->rxQueue, (void *)mpcReq) == false)
|
if (CircQueuePush(instPtr->rxQueue, (void *)mpcReq) == false)
|
||||||
{
|
{
|
||||||
DBG_ERROR("SystemBus::RX Queue overflowed!\n");
|
DBG_ERROR("SystemBus::RX Queue overflowed!\n");
|
||||||
Status = EQUEUE;
|
free(mpcReq);
|
||||||
goto recv_error;
|
return EQUEUE;
|
||||||
}
|
}
|
||||||
instPtr->isRxDone = false; // another reception is undergoing.
|
instPtr->isRxDone = false; // another reception is undergoing.
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
recv_error:
|
|
||||||
free(mpcReq);
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ typedef struct
|
|||||||
/************************** Function Prototypes ******************************/
|
/************************** Function Prototypes ******************************/
|
||||||
|
|
||||||
int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config);
|
int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config);
|
||||||
|
void Mpc_Destroy(MPC *instPtr);
|
||||||
|
|
||||||
int32_t Mpc_HandleCmd(MPC *instPtr);
|
int32_t Mpc_HandleCmd(MPC *instPtr);
|
||||||
int32_t Mpc_PendRemoteTest(MPC *instPtr);
|
int32_t Mpc_PendRemoteTest(MPC *instPtr);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ C_DEPS += \
|
|||||||
src/dev_profile/%.o: ../src/dev_profile/%.c
|
src/dev_profile/%.o: ../src/dev_profile/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ C_DEPS += \
|
|||||||
src/networking/link_layer/geometry/%.o: ../src/networking/link_layer/geometry/%.c
|
src/networking/link_layer/geometry/%.o: ../src/networking/link_layer/geometry/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ C_DEPS += \
|
|||||||
src/networking/link_layer/%.o: ../src/networking/link_layer/%.c
|
src/networking/link_layer/%.o: ../src/networking/link_layer/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ C_DEPS += \
|
|||||||
src/networking/phy_layer/%.o: ../src/networking/phy_layer/%.c
|
src/networking/phy_layer/%.o: ../src/networking/phy_layer/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ C_DEPS += \
|
|||||||
src/%.o: ../src/%.c
|
src/%.o: ../src/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ C_DEPS += \
|
|||||||
src/systembus/%.o: ../src/systembus/%.c
|
src/systembus/%.o: ../src/systembus/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ C_DEPS += \
|
|||||||
src/time_ctrl/%.o: ../src/time_ctrl/%.c
|
src/time_ctrl/%.o: ../src/time_ctrl/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
arm-none-eabi-gcc -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
arm-none-eabi-gcc -std=c17 -pedantic -Wall -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ C_DEPS += \
|
|||||||
src/util/%.o: ../src/util/%.c
|
src/util/%.o: ../src/util/%.c
|
||||||
@echo 'Building file: $<'
|
@echo 'Building file: $<'
|
||||||
@echo 'Invoking: ARM v7 gcc compiler'
|
@echo 'Invoking: ARM v7 gcc compiler'
|
||||||
$(CC) -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
$(CC) -std=c17 -pedantic -Wall -Wformat=2 -O0 -g3 -I../bsp/ps7_cortexa9_0/include -I../src/include -c -fmessage-length=0 -MT"$@" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
|
||||||
@echo 'Finished building: $<'
|
@echo 'Finished building: $<'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#define DATALINK_ENABLE_AUTORECONNECT
|
#define DATALINK_ENABLE_AUTORECONNECT
|
||||||
#define DATALINK_ENABLE_AUTOTIMESYNC
|
#define DATALINK_ENABLE_AUTOTIMESYNC
|
||||||
//#define DATALINK_ENABLE_BERTEST
|
#define DATALINK_ENABLE_BERTEST 10
|
||||||
|
|
||||||
/************ Hardware Configs ************/
|
/************ Hardware Configs ************/
|
||||||
#define CPU_CLK_HZ XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ
|
#define CPU_CLK_HZ XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ
|
||||||
@@ -179,7 +179,6 @@ typedef enum
|
|||||||
#define HMC7044_SPI_ENGINE_CS_DELAY 3
|
#define HMC7044_SPI_ENGINE_CS_DELAY 3
|
||||||
#define HMC7044_SPI_CS_HMC7044 0x00
|
#define HMC7044_SPI_CS_HMC7044 0x00
|
||||||
|
|
||||||
|
|
||||||
// Configuration Check
|
// Configuration Check
|
||||||
#if defined(PHY_BEAM_SET_PRESET) && !defined(PHY_BEAM_FORMING_ENABLE)
|
#if defined(PHY_BEAM_SET_PRESET) && !defined(PHY_BEAM_FORMING_ENABLE)
|
||||||
#define PHY_BEAM_FORMING_ENABLE
|
#define PHY_BEAM_FORMING_ENABLE
|
||||||
|
|||||||
@@ -34,9 +34,9 @@
|
|||||||
|
|
||||||
/************************** Function Prototypes ******************************/
|
/************************** Function Prototypes ******************************/
|
||||||
/*********************** Driver Instance Definitions **************************/
|
/*********************** Driver Instance Definitions **************************/
|
||||||
static struct hmc7044_dev *hmc7044_inst;
|
static struct hmc7044_dev *hmc7044_inst = NULL;
|
||||||
static struct ad9361_reg_dev *ad9361_1_reg_inst;
|
static struct ad9361_reg_dev *ad9361_1_reg_inst = NULL;
|
||||||
static struct ad9361_reg_dev *ad9361_2_reg_inst;
|
static struct ad9361_reg_dev *ad9361_2_reg_inst = NULL;
|
||||||
// static struct ad9361_rf_phy *ad9361_phy;
|
// static struct ad9361_rf_phy *ad9361_phy;
|
||||||
// static struct ad9361_rf_phy *ad9361_2_phy;
|
// static struct ad9361_rf_phy *ad9361_2_phy;
|
||||||
|
|
||||||
@@ -214,6 +214,11 @@ int32_t Hardware_Init(void)
|
|||||||
Status = Hardware_SwitchFreq(ad9361_1_reg_inst, TX_FREQ_4125);
|
Status = Hardware_SwitchFreq(ad9361_1_reg_inst, TX_FREQ_4125);
|
||||||
XGpioPs_WritePin(&Gpio, AD9361_TX_SWITCH, 0);
|
XGpioPs_WritePin(&Gpio, AD9361_TX_SWITCH, 0);
|
||||||
|
|
||||||
|
Status = ad9361_reg_write(ad9361_1_reg_inst, 0x0109, 0x00); // Rx Gain
|
||||||
|
Status = ad9361_reg_write(ad9361_1_reg_inst, 0x010C, 0x00); // Rx Gain
|
||||||
|
Status = ad9361_reg_write(ad9361_2_reg_inst, 0x0109, 0x00); // Rx Gain
|
||||||
|
Status = ad9361_reg_write(ad9361_2_reg_inst, 0x010C, 0x00); // Rx Gain
|
||||||
|
|
||||||
DBG_PRINT("Done.\n");
|
DBG_PRINT("Done.\n");
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
@@ -396,12 +401,15 @@ int32_t Hardware_SwitchFreq(struct ad9361_reg_dev *dev, ad9361TxFreq freq)
|
|||||||
int8_t Hardware_GetAD9361Temp_1(void)
|
int8_t Hardware_GetAD9361Temp_1(void)
|
||||||
{
|
{
|
||||||
int8_t scaleTemp;
|
int8_t scaleTemp;
|
||||||
|
double temp;
|
||||||
|
|
||||||
|
ad9361_reg_write(ad9361_1_reg_inst, 0x000B, -64);
|
||||||
ad9361_reg_write(ad9361_1_reg_inst, 0x001D, 0x01); // disable aux adc
|
ad9361_reg_write(ad9361_1_reg_inst, 0x001D, 0x01); // disable aux adc
|
||||||
ad9361_reg_read(ad9361_1_reg_inst, 0x000E, (uint8_t*)&scaleTemp);
|
ad9361_reg_read(ad9361_1_reg_inst, 0x000E, (uint8_t*)&scaleTemp);
|
||||||
ad9361_reg_write(ad9361_1_reg_inst, 0x001D, 0x00); // enable aux adc
|
ad9361_reg_write(ad9361_1_reg_inst, 0x001D, 0x00); // enable aux adc
|
||||||
|
|
||||||
return (int8_t) scaleTemp/1.16;
|
temp = ((double)scaleTemp + 64)/1.16;
|
||||||
|
return ((temp > INT8_MAX) ? INT8_MAX : (int8_t)temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ Get AD9361 - 2 temperature (Celsius Degree)
|
// @ Get AD9361 - 2 temperature (Celsius Degree)
|
||||||
@@ -411,12 +419,14 @@ int8_t Hardware_GetAD9361Temp_1(void)
|
|||||||
int8_t Hardware_GetAD9361Temp_2(void)
|
int8_t Hardware_GetAD9361Temp_2(void)
|
||||||
{
|
{
|
||||||
int8_t scaleTemp;
|
int8_t scaleTemp;
|
||||||
|
double temp;
|
||||||
|
|
||||||
|
ad9361_reg_write(ad9361_2_reg_inst, 0x000B, -64);
|
||||||
ad9361_reg_write(ad9361_2_reg_inst, 0x001D, 0x01); // disable aux adc
|
ad9361_reg_write(ad9361_2_reg_inst, 0x001D, 0x01); // disable aux adc
|
||||||
ad9361_reg_read(ad9361_2_reg_inst, 0x000E, (uint8_t*)&scaleTemp);
|
ad9361_reg_read(ad9361_2_reg_inst, 0x000E, (uint8_t*)&scaleTemp);
|
||||||
ad9361_reg_write(ad9361_2_reg_inst, 0x001D, 0x00); // enable aux adc
|
ad9361_reg_write(ad9361_2_reg_inst, 0x001D, 0x00); // enable aux adc
|
||||||
|
temp = ((double)scaleTemp + 64)/1.16;
|
||||||
return (int8_t) scaleTemp/1.16;
|
return ((temp > INT8_MAX) ? INT8_MAX : (int8_t)temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ Determine AD9361 lock state
|
// @ Determine AD9361 lock state
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
* Copyright(c) 2024 Beijing Institute of Technology.
|
* Copyright(c) 2024 Beijing Institute of Technology.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
#ifndef HWCONFIG_H_
|
||||||
|
#define HWCONFIG_H_
|
||||||
/***************************** Include Files *********************************/
|
/***************************** Include Files *********************************/
|
||||||
// Standard
|
// Standard
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@@ -29,4 +30,4 @@ int8_t Hardware_GetAD9361Temp_2(void);
|
|||||||
uint8_t Hardware_GetAD9361LockStatus(void);
|
uint8_t Hardware_GetAD9361LockStatus(void);
|
||||||
uint8_t Hardware_GetHMC7044LockStatus(void);
|
uint8_t Hardware_GetHMC7044LockStatus(void);
|
||||||
|
|
||||||
|
#endif // HWCONFIG_H_
|
||||||
|
|||||||
@@ -45,13 +45,11 @@ typedef struct
|
|||||||
* @brief create a FIFO queue
|
* @brief create a FIFO queue
|
||||||
* @param queue The new queue
|
* @param queue The new queue
|
||||||
* @param queue_capacity maximum size of the 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);
|
bool CircQueueCreate(CIRC_QUEUE **queue, uint32_t queue_capacity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief free queue memory -- call after destroy
|
* @brief free queue memory -- call after destroy
|
||||||
* @note we do not free in destroy() to follow pthreads convention
|
|
||||||
*/
|
*/
|
||||||
void CircQueueFree(CIRC_QUEUE *queue);
|
void CircQueueFree(CIRC_QUEUE *queue);
|
||||||
|
|
||||||
@@ -72,9 +70,8 @@ bool isCircQueueEmpty(CIRC_QUEUE *queue);
|
|||||||
*
|
*
|
||||||
* @param queue the queue
|
* @param queue the queue
|
||||||
* @param data the data
|
* @param data the data
|
||||||
* @return RPA_EINTR the blocking was interrupted (try again)
|
* @return True on a successful push
|
||||||
* @return RPA_EOF the queue has been terminated
|
* @return False push failed
|
||||||
* @return RPA_SUCCESS on a successful push
|
|
||||||
*/
|
*/
|
||||||
bool CircQueuePush(CIRC_QUEUE *queue, void *data);
|
bool CircQueuePush(CIRC_QUEUE *queue, void *data);
|
||||||
|
|
||||||
@@ -83,9 +80,8 @@ bool CircQueuePush(CIRC_QUEUE *queue, void *data);
|
|||||||
*
|
*
|
||||||
* @param queue the queue
|
* @param queue the queue
|
||||||
* @param data the data
|
* @param data the data
|
||||||
* @return RPA_EINTR the blocking was interrupted (try again)
|
* @return false pop failed
|
||||||
* @return RPA_EOF if the queue has been terminated
|
* @return true on a successful pop
|
||||||
* @return RPA_SUCCESS on a successful pop
|
|
||||||
*/
|
*/
|
||||||
bool CircQueuePop(CIRC_QUEUE *queue, void **data);
|
bool CircQueuePop(CIRC_QUEUE *queue, void **data);
|
||||||
|
|
||||||
|
|||||||
+18
-20
@@ -72,28 +72,26 @@ struct callback_desc scutm_callback_desc = {
|
|||||||
|
|
||||||
L2_CONFIG linkConfig = {
|
L2_CONFIG linkConfig = {
|
||||||
.myType = L2_NODE_HEAD,
|
.myType = L2_NODE_HEAD,
|
||||||
.clustId = 1,
|
.clustId = 1U,
|
||||||
.myId = 1,
|
.myId = 1U,
|
||||||
.headId = 1,
|
.headId = 1U,
|
||||||
.bkpHeadId = 0,
|
.netScale = 2U,
|
||||||
.netScale = 2,
|
|
||||||
.phyInstPtr = NULL, // physical layer reference
|
.phyInstPtr = NULL, // physical layer reference
|
||||||
.tmcInstPtr = NULL
|
.tmcInstPtr = NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
// L2_CONFIG linkConfig = {
|
// L2_CONFIG linkConfig = {
|
||||||
// .myType = L2_NODE_MEMBER,
|
// .myType = L2_NODE_MEMBER,
|
||||||
// .clustId = 1,
|
// .clustId = 1U,
|
||||||
// .myId = 2,
|
// .myId = 2U,
|
||||||
// .headId = 1,
|
// .headId = 1U,
|
||||||
// .bkpHeadId = 0,
|
// .netScale = 2U,
|
||||||
// .netScale = 2,
|
|
||||||
// .phyInstPtr = NULL, // physical layer reference
|
// .phyInstPtr = NULL, // physical layer reference
|
||||||
// .tmcInstPtr = NULL
|
// .tmcInstPtr = NULL
|
||||||
// };
|
// };
|
||||||
|
|
||||||
static PHY_CONFIG phyConfig = {
|
static PHY_CONFIG phyConfig = {
|
||||||
.devId = 0,
|
.devId = PHY_DEVICE_ID,
|
||||||
.baseAddr = PHY_BASEADDR,
|
.baseAddr = PHY_BASEADDR,
|
||||||
.antBramId = PHY_ANTCONFIG_BRAM_DEVICE_ID,
|
.antBramId = PHY_ANTCONFIG_BRAM_DEVICE_ID,
|
||||||
.antInfoBramId = PHY_ANTINFO_BRAM_DEVICE_ID,
|
.antInfoBramId = PHY_ANTINFO_BRAM_DEVICE_ID,
|
||||||
@@ -108,21 +106,21 @@ static PHY_CONFIG phyConfig = {
|
|||||||
|
|
||||||
TMC_CONFIG tmcConfig = {
|
TMC_CONFIG tmcConfig = {
|
||||||
.baseAddr = TIME_CONTROLLER_BASEADDR,
|
.baseAddr = TIME_CONTROLLER_BASEADDR,
|
||||||
.reset = 10
|
.reset = 10U
|
||||||
};
|
};
|
||||||
|
|
||||||
static SYSBUS_CONFIG sysbusConfig = {
|
static SYSBUS_CONFIG sysbusConfig = {
|
||||||
.baseAddr = SYSBUS_BASE_ADDR,
|
.baseAddr = SYSBUS_BASE_ADDR,
|
||||||
.txQueueMax = 16,
|
.txQueueMax = 16U,
|
||||||
.rxQueueMax = 16
|
.rxQueueMax = 16U
|
||||||
};
|
};
|
||||||
/*********************** Driver Instance Definitions **************************/
|
/*********************** Driver Instance Definitions **************************/
|
||||||
static struct irq_ctrl_desc *intcDescPtr; // General interrupt controller descriptor
|
static struct irq_ctrl_desc *intcDescPtr = NULL; // General interrupt controller descriptor
|
||||||
static struct timer_desc *logTmPtr;
|
static struct timer_desc *logTmPtr = NULL;
|
||||||
static SYSBUS *sysbusDescPtr;
|
static SYSBUS *sysbusDescPtr = NULL;
|
||||||
static PHY_INST *phyInstPtr;
|
static PHY_INST *phyInstPtr = NULL;
|
||||||
static TMC_INST *tmcInstPtr = NULL;
|
static TMC_INST *tmcInstPtr = NULL;
|
||||||
L2_INST *linkInstPtr;
|
L2_INST *linkInstPtr = NULL;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
@@ -484,7 +482,7 @@ int main(void)
|
|||||||
DBG_PRINT("Physical started...\n");
|
DBG_PRINT("Physical started...\n");
|
||||||
Phy_Start(phyInstPtr);
|
Phy_Start(phyInstPtr);
|
||||||
|
|
||||||
// Linklayer_Start(linkInstPtr);
|
Linklayer_Start(linkInstPtr);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ bool L2_CrcCheck(uint8_t *dataBuff, uint32_t dataLen, L2_CRC_TYPE crcType)
|
|||||||
ASSERT(dataBuff != NULL);
|
ASSERT(dataBuff != NULL);
|
||||||
int32_t Status;
|
int32_t Status;
|
||||||
uint32_t crcVal;
|
uint32_t crcVal;
|
||||||
crcVal = 0;
|
crcVal = 0U;
|
||||||
Status = L2_CrcGen(dataBuff, dataLen, crcType, &crcVal);
|
Status = L2_CrcGen(dataBuff, dataLen, crcType, &crcVal);
|
||||||
if (Status == SUCCESS)
|
if (Status == SUCCESS)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,6 +75,10 @@ COORD Coord_GetScalarMult(COORD a, double t)
|
|||||||
/** @brief Divides a coordinate vector by a real number. */
|
/** @brief Divides a coordinate vector by a real number. */
|
||||||
void Coord_ScalarDiv(COORD *a, double t)
|
void Coord_ScalarDiv(COORD *a, double t)
|
||||||
{
|
{
|
||||||
|
if (t == 0.0) {
|
||||||
|
*a = COORD_NIL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
a->x /= t;
|
a->x /= t;
|
||||||
a->y /= t;
|
a->y /= t;
|
||||||
a->z /= t;
|
a->z /= t;
|
||||||
@@ -83,6 +87,9 @@ void Coord_ScalarDiv(COORD *a, double t)
|
|||||||
/** @brief Divides a coordinate vector by a real number. */
|
/** @brief Divides a coordinate vector by a real number. */
|
||||||
COORD Coord_GetScalarDiv(COORD a, double t)
|
COORD Coord_GetScalarDiv(COORD a, double t)
|
||||||
{
|
{
|
||||||
|
if (t == 0.0) {
|
||||||
|
return COORD_NIL;
|
||||||
|
}
|
||||||
COORD ret;
|
COORD ret;
|
||||||
ret.x = a.x / t;
|
ret.x = a.x / t;
|
||||||
ret.y = a.y / t;
|
ret.y = a.y / t;
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ EULERANGLES EulerAngles_GetScalarMult(EULERANGLES e, double f)
|
|||||||
/** @brief Normalize EulerAngles. */
|
/** @brief Normalize EulerAngles. */
|
||||||
void EulerAngles_Normalize(EULERANGLES *e)
|
void EulerAngles_Normalize(EULERANGLES *e)
|
||||||
{
|
{
|
||||||
e->alpha = fmod(e->alpha, 2 * EUL_PI);
|
e->alpha = fmod(e->alpha, 2.0 * EUL_PI);
|
||||||
e->beta = fmod(e->beta, 2 * EUL_PI);
|
e->beta = fmod(e->beta, 2.0 * EUL_PI);
|
||||||
e->gamma = fmod(e->gamma, 2 * EUL_PI);
|
e->gamma = fmod(e->gamma, 2.0 * EUL_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Normalize EulerAngles. */
|
/** @brief Normalize EulerAngles. */
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
#define EUL_PI 3.14159265358979323846
|
#define EUL_PI 3.14159265358979323846
|
||||||
|
|
||||||
#define DEG2RAD(d) ((EUL_PI / 180.0) * d)
|
#define DEG2RAD(d) ((EUL_PI / 180.0) * (d))
|
||||||
#define RAD2DEG(r) ((180.0 / EUL_PI) * r)
|
#define RAD2DEG(r) ((180.0 / EUL_PI) * (r))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Orientations are represented by 3D double precision Tait-Bryan (Euler) tuples
|
* Orientations are represented by 3D double precision Tait-Bryan (Euler) tuples
|
||||||
|
|||||||
@@ -91,6 +91,10 @@ QUATERNION Quaternion_GetScalarMult(QUATERNION a, double t)
|
|||||||
/** @brief Divides a quaternion by a real number. */
|
/** @brief Divides a quaternion by a real number. */
|
||||||
void Quaternion_ScalarDiv(QUATERNION *q, double t)
|
void Quaternion_ScalarDiv(QUATERNION *q, double t)
|
||||||
{
|
{
|
||||||
|
if (t == 0.0) {
|
||||||
|
*q = QUATERNION_NIL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
q->s /= t;
|
q->s /= t;
|
||||||
q->i /= t;
|
q->i /= t;
|
||||||
q->j /= t;
|
q->j /= t;
|
||||||
@@ -190,6 +194,9 @@ inline double Quaternion_GetRotationAngle(QUATERNION q)
|
|||||||
/** @brief Get axis of quaternion. */
|
/** @brief Get axis of quaternion. */
|
||||||
COORD Quaternion_GetRotationAxis(QUATERNION q)
|
COORD Quaternion_GetRotationAxis(QUATERNION q)
|
||||||
{
|
{
|
||||||
|
if ((q.s > 1.0) || (q.s < -1.0)) {
|
||||||
|
return COORD_NIL;
|
||||||
|
}
|
||||||
double sin_theta_inv;
|
double sin_theta_inv;
|
||||||
COORD ret;
|
COORD ret;
|
||||||
sin_theta_inv = 1.0 / sin(acos(q.s));
|
sin_theta_inv = 1.0 / sin(acos(q.s));
|
||||||
@@ -202,6 +209,12 @@ COORD Quaternion_GetRotationAxis(QUATERNION q)
|
|||||||
/** @brief Get the axis and rotate angle of a unit Quaternion */
|
/** @brief Get the axis and rotate angle of a unit Quaternion */
|
||||||
void Quaternion_GetRotationAxisAndAngle(QUATERNION q, COORD *axis, double *angle)
|
void Quaternion_GetRotationAxisAndAngle(QUATERNION q, COORD *axis, double *angle)
|
||||||
{
|
{
|
||||||
|
if ((q.s > 1.0) || (q.s < -1.0)) {
|
||||||
|
*axis = COORD_NIL;
|
||||||
|
*angle = NAN;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
double sin_theta_inv;
|
double sin_theta_inv;
|
||||||
*angle = acos(q.s);
|
*angle = acos(q.s);
|
||||||
|
|
||||||
@@ -218,6 +231,11 @@ void Quaternion_GetRotationAxisAndAngle(QUATERNION q, COORD *axis, double *angle
|
|||||||
/** @brief Decompose the rotation on to 2 parts. */
|
/** @brief Decompose the rotation on to 2 parts. */
|
||||||
void Quaternion_GetSwingAndTwist(QUATERNION q, COORD axis, QUATERNION *swing, QUATERNION *twist)
|
void Quaternion_GetSwingAndTwist(QUATERNION q, COORD axis, QUATERNION *swing, QUATERNION *twist)
|
||||||
{
|
{
|
||||||
|
if ((swing == NULL) || (twist == NULL))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
double p;
|
double p;
|
||||||
COORD v;
|
COORD v;
|
||||||
v.x = q.i;
|
v.x = q.i;
|
||||||
@@ -326,7 +344,7 @@ EULERANGLES Quaternion_ToEulerAngles(QUATERNION q, EULERANGLES_TYPE type)
|
|||||||
if (mask1 || mask2)
|
if (mask1 || mask2)
|
||||||
{
|
{
|
||||||
ret.alpha = 0;
|
ret.alpha = 0;
|
||||||
ret.gamma = (asinValue > 0) ? (2.0 * atan2(q.i, q.s)) : (-2.0 * atan2(q.i, q.s));
|
ret.gamma = (asinValue > 0.0) ? (2.0 * atan2(q.i, q.s)) : (-2.0 * atan2(q.i, q.s));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -339,6 +357,7 @@ EULERANGLES Quaternion_ToEulerAngles(QUATERNION q, EULERANGLES_TYPE type)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
ret = EULERANGLES_NIL;
|
ret = EULERANGLES_NIL;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -428,7 +447,7 @@ QUATERNION Quaternion_RotationFromTo(COORD from, COORD to)
|
|||||||
QUATERNION Quaternion_Lerp(QUATERNION q1, QUATERNION q2, double t)
|
QUATERNION Quaternion_Lerp(QUATERNION q1, QUATERNION q2, double t)
|
||||||
{
|
{
|
||||||
QUATERNION ret;
|
QUATERNION ret;
|
||||||
Quaternion_ScalarMult(&q1, 1 - t);
|
Quaternion_ScalarMult(&q1, 1.0 - t);
|
||||||
Quaternion_ScalarMult(&q1, t);
|
Quaternion_ScalarMult(&q1, t);
|
||||||
ret = Quaternion_Add(q1, q2);
|
ret = Quaternion_Add(q1, q2);
|
||||||
Quaternion_Normalize(&ret);
|
Quaternion_Normalize(&ret);
|
||||||
|
|||||||
@@ -56,13 +56,13 @@ QUATERNION Quaternion_Add(QUATERNION q1, QUATERNION q2);
|
|||||||
void Quaternion_ScalarMult(QUATERNION *q, double t);
|
void Quaternion_ScalarMult(QUATERNION *q, double t);
|
||||||
|
|
||||||
/** @brief Multiplies a quaternion by a real number. */
|
/** @brief Multiplies a quaternion by a real number. */
|
||||||
QUATERNION Quaternion_GetScalarMult(QUATERNION a, double t);
|
QUATERNION Quaternion_GetScalarMult(QUATERNION q, double t);
|
||||||
|
|
||||||
/** @brief Divides a quaternion by a real number. */
|
/** @brief Divides a quaternion by a real number. */
|
||||||
void Quaternion_ScalarDiv(QUATERNION *q, double t);
|
void Quaternion_ScalarDiv(QUATERNION *q, double t);
|
||||||
|
|
||||||
/** @brief Divides a quaternion by a real number. */
|
/** @brief Divides a quaternion by a real number. */
|
||||||
QUATERNION Quaternion_GetScalarDiv(QUATERNION a, double t);
|
QUATERNION Quaternion_GetScalarDiv(QUATERNION q, double t);
|
||||||
|
|
||||||
/** @brief Multiplies two quaternions. */
|
/** @brief Multiplies two quaternions. */
|
||||||
QUATERNION Quaternion_Mult(QUATERNION q1, QUATERNION q2);
|
QUATERNION Quaternion_Mult(QUATERNION q1, QUATERNION q2);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
/***************** Macros (Inline Functions) Definitions *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
/**************************** Type Definitions *******************************/
|
/**************************** Type Definitions *******************************/
|
||||||
/************************** Function Prototypes ******************************/
|
/************************** Function Prototypes ******************************/
|
||||||
static void L2_RcdShift(L2_RCD *rcd, int32_t netxVal);
|
static void L2_RcdShift(L2_RCD *rcd, uint32_t netxVal);
|
||||||
static void UpdateMainSate(L2_INST *instPtr, L2_NODE_STATE newSate);
|
static void UpdateMainSate(L2_INST *instPtr, L2_NODE_STATE newSate);
|
||||||
static void L2_SetSlotNum(L2_INST *instPtr, uint32_t newSlotNum);
|
static void L2_SetSlotNum(L2_INST *instPtr, uint32_t newSlotNum);
|
||||||
static void L2_SetFrameNum(L2_INST *instPtr, uint32_t newFrameNum);
|
static void L2_SetFrameNum(L2_INST *instPtr, uint32_t newFrameNum);
|
||||||
@@ -50,7 +50,7 @@ static void L2_FrameStateUpdate(L2_INST *instPtr);
|
|||||||
/**
|
/**
|
||||||
* @brief Shift L2 status record.(newval->next->curr->last)
|
* @brief Shift L2 status record.(newval->next->curr->last)
|
||||||
*/
|
*/
|
||||||
inline void L2_RcdShift(L2_RCD *rcd, int32_t netxVal)
|
inline void L2_RcdShift(L2_RCD *rcd, uint32_t netxVal)
|
||||||
{
|
{
|
||||||
ASSERT(rcd != NULL);
|
ASSERT(rcd != NULL);
|
||||||
rcd->last = rcd->curr;
|
rcd->last = rcd->curr;
|
||||||
@@ -132,6 +132,7 @@ static void L2_FrameStateUpdate(L2_INST *instPtr)
|
|||||||
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||||
bool isValid;
|
bool isValid;
|
||||||
L2_FRAME_TYPE recvType = L2_GetLastOptFrameType(instPtr);
|
L2_FRAME_TYPE recvType = L2_GetLastOptFrameType(instPtr);
|
||||||
|
isValid = false;
|
||||||
// Update frame state.
|
// Update frame state.
|
||||||
if (Phy_IsFrameValid(phyRef) == false)
|
if (Phy_IsFrameValid(phyRef) == false)
|
||||||
{
|
{
|
||||||
@@ -162,7 +163,7 @@ static void L2_FrameStateUpdate(L2_INST *instPtr)
|
|||||||
#ifndef DATALINK_ENABLE_BERTEST
|
#ifndef DATALINK_ENABLE_BERTEST
|
||||||
isValid = L2_CrcCheck(instPtr->recvPktData, L2_SVC_PACK_LEN, L2_CRC16_1021);
|
isValid = L2_CrcCheck(instPtr->recvPktData, L2_SVC_PACK_LEN, L2_CRC16_1021);
|
||||||
#else
|
#else
|
||||||
isValid = true;
|
isValid = L2_Service_PktCheck(instPtr, instPtr->recvPktData);
|
||||||
#endif
|
#endif
|
||||||
instPtr->log.svcRecvCnt++;
|
instPtr->log.svcRecvCnt++;
|
||||||
instPtr->log.svcCorrectCnt = isValid ? instPtr->log.svcCorrectCnt + 1 : instPtr->log.svcCorrectCnt;
|
instPtr->log.svcCorrectCnt = isValid ? instPtr->log.svcCorrectCnt + 1 : instPtr->log.svcCorrectCnt;
|
||||||
@@ -419,10 +420,14 @@ L1_FRAME_TYPE L2_L2frame2L1frame(L2_FRAME_TYPE l2Frame)
|
|||||||
case L2_SCAN_FRAME:
|
case L2_SCAN_FRAME:
|
||||||
return L1_10KBPS_10MS_FRAME;
|
return L1_10KBPS_10MS_FRAME;
|
||||||
case L2_ADV_FRAME:
|
case L2_ADV_FRAME:
|
||||||
return L1_10KBPS_20MS_FRAME;
|
|
||||||
case L2_CFM_FRAME:
|
case L2_CFM_FRAME:
|
||||||
|
return L1_10KBPS_20MS_FRAME;
|
||||||
case L2_SVC_FRAME:
|
case L2_SVC_FRAME:
|
||||||
|
#if DATALINK_ENABLE_BERTEST == 10
|
||||||
|
return L1_10KBPS_20MS_FRAME;
|
||||||
|
#else
|
||||||
return L1_40KBPS_20MS_FRAME;
|
return L1_40KBPS_20MS_FRAME;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return L1_NONE_FRAME;
|
return L1_NONE_FRAME;
|
||||||
}
|
}
|
||||||
@@ -470,6 +475,12 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
|
|||||||
|
|
||||||
// Clear random content
|
// Clear random content
|
||||||
memset(*instPtr, 0x00, sizeof(L2_INST));
|
memset(*instPtr, 0x00, sizeof(L2_INST));
|
||||||
|
(*instPtr)->sendPktData = NULL;
|
||||||
|
(*instPtr)->recvPktData = NULL;
|
||||||
|
(*instPtr)->schdEventPool = NULL;
|
||||||
|
(*instPtr)->nodeList = NULL;
|
||||||
|
(*instPtr)->scanFSM = NULL;
|
||||||
|
(*instPtr)->serviceFSM = NULL;
|
||||||
memcpy(&((*instPtr)->config), config, sizeof(L2_CONFIG));
|
memcpy(&((*instPtr)->config), config, sizeof(L2_CONFIG));
|
||||||
|
|
||||||
// Packet buffer
|
// Packet buffer
|
||||||
@@ -477,15 +488,15 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
|
|||||||
if ((*instPtr)->sendPktData == NULL)
|
if ((*instPtr)->sendPktData == NULL)
|
||||||
{
|
{
|
||||||
DBG_ERROR("Allocate memory for sendPktData failed.\n");
|
DBG_ERROR("Allocate memory for sendPktData failed.\n");
|
||||||
Status = ENOMEM;
|
Linklayer_Destroy(*instPtr);
|
||||||
goto init_error;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
(*instPtr)->recvPktData = calloc(L2_PACK_LEN_MAX / sizeof(uint64_t), sizeof(uint64_t));
|
(*instPtr)->recvPktData = calloc(L2_PACK_LEN_MAX / sizeof(uint64_t), sizeof(uint64_t));
|
||||||
if ((*instPtr)->recvPktData == NULL)
|
if ((*instPtr)->recvPktData == NULL)
|
||||||
{
|
{
|
||||||
DBG_ERROR("Allocate memory for recvPktData failed.\n");
|
DBG_ERROR("Allocate memory for recvPktData failed.\n");
|
||||||
Status = ENOMEM;
|
Linklayer_Destroy(*instPtr);
|
||||||
goto init_error;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
// Reset basic info
|
// Reset basic info
|
||||||
(*instPtr)->netStartTime = NET_START_TIME_INFTY;
|
(*instPtr)->netStartTime = NET_START_TIME_INFTY;
|
||||||
@@ -528,32 +539,33 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
|
|||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
DBG_ERROR("L2_CreateSchedEventPool runs failed, with error code: %" PRId32 ".\n", Status);
|
DBG_ERROR("L2_CreateSchedEventPool runs failed, with error code: %" PRId32 ".\n", Status);
|
||||||
goto init_error;
|
Linklayer_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = L2_NodeList_Init(&((*instPtr)->nodeList));
|
Status = L2_NodeList_Init(&((*instPtr)->nodeList));
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
DBG_ERROR("NodeList_Init runs failed, with error code: %" PRId32 ".\n", Status);
|
DBG_ERROR("NodeList_Init runs failed, with error code: %" PRId32 ".\n", Status);
|
||||||
goto init_error;
|
Linklayer_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = L2_Scan_Init(&((*instPtr)->scanFSM));
|
Status = L2_Scan_Init(&((*instPtr)->scanFSM));
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Linklayer_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = L2_Service_Init(&((*instPtr)->serviceFSM));
|
Status = L2_Service_Init(&((*instPtr)->serviceFSM));
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Linklayer_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
init_error:
|
|
||||||
Linklayer_Destroy(*instPtr);
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -589,7 +601,7 @@ int32_t Linklayer_Reconfig(L2_INST *instPtr, const L2_CONFIG *config)
|
|||||||
instPtr->rtneConfig.last = NULL;
|
instPtr->rtneConfig.last = NULL;
|
||||||
instPtr->rtneConfig.curr = NULL;
|
instPtr->rtneConfig.curr = NULL;
|
||||||
instPtr->rtneConfig.next = NULL;
|
instPtr->rtneConfig.next = NULL;
|
||||||
instPtr->cxn2Net = false;
|
instPtr->cxn2Net = (config->myType == L2_NODE_HEAD) ? true : false;
|
||||||
instPtr->dataAvail = false;
|
instPtr->dataAvail = false;
|
||||||
instPtr->frameNum.last = 0;
|
instPtr->frameNum.last = 0;
|
||||||
instPtr->frameNum.curr = 0;
|
instPtr->frameNum.curr = 0;
|
||||||
@@ -637,7 +649,10 @@ int32_t Linklayer_Reconfig(L2_INST *instPtr, const L2_CONFIG *config)
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void Linklayer_Destroy(L2_INST *instPtr)
|
void Linklayer_Destroy(L2_INST *instPtr)
|
||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
if (instPtr == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
free(instPtr->sendPktData);
|
free(instPtr->sendPktData);
|
||||||
free(instPtr->recvPktData);
|
free(instPtr->recvPktData);
|
||||||
// Destroy FSMs and nodeList
|
// Destroy FSMs and nodeList
|
||||||
@@ -1050,7 +1065,7 @@ int32_t Linklayer_Proc(L2_INST *instPtr)
|
|||||||
instPtr->linkLog.tuNum = instPtr->frameNum.curr;
|
instPtr->linkLog.tuNum = instPtr->frameNum.curr;
|
||||||
instPtr->linkLog.slotNum = (uint8_t)instPtr->slotNum.curr;
|
instPtr->linkLog.slotNum = (uint8_t)instPtr->slotNum.curr;
|
||||||
instPtr->linkLog.nodeType = (L2_GetNodeType(instPtr) == L2_NODE_HEAD) ? 0xAA : 0xCC;
|
instPtr->linkLog.nodeType = (L2_GetNodeType(instPtr) == L2_NODE_HEAD) ? 0xAA : 0xCC;
|
||||||
instPtr->linkLog.cxnStatus = (instPtr->cxn2Net) ? 0x11 : 0x00;
|
instPtr->linkLog.cxnStatus = (L2_isCxn2Net(instPtr)) ? 0x11 : 0x00;
|
||||||
instPtr->linkLog.linkStage = (instPtr->mainState == L2_INIT_STATE) ? 0x11 : 0x22;
|
instPtr->linkLog.linkStage = (instPtr->mainState == L2_INIT_STATE) ? 0x11 : 0x22;
|
||||||
instPtr->linkLog.recxnCnt = instPtr->log.reconnectCnt;
|
instPtr->linkLog.recxnCnt = instPtr->log.reconnectCnt;
|
||||||
instPtr->linkLog.beamNo = instPtr->scanFSM->beamNo;
|
instPtr->linkLog.beamNo = instPtr->scanFSM->beamNo;
|
||||||
@@ -1146,8 +1161,7 @@ int32_t L2_SteerBeam2Node(L2_INST *instPtr, uint8_t nodeId)
|
|||||||
* @param txrxMode tx/rx state for next slot
|
* @param txrxMode tx/rx state for next slot
|
||||||
* @param frameType frame type of next slot.
|
* @param frameType frame type of next slot.
|
||||||
*
|
*
|
||||||
* @return Corresponding frame length
|
* @return SUCCESS/FAILURE
|
||||||
* L2_FRAME_NONE_LEN if the frame type code cannot be recognized.
|
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE frameType)
|
int32_t L2_SetupNextSlot(L2_INST *instPtr, L2_TOR_TYPE txrxMode, L2_FRAME_TYPE frameType)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include "../../system_monitor.h"
|
#include "../../system_monitor.h"
|
||||||
/************************** Constant Definitions *****************************/
|
/************************** Constant Definitions *****************************/
|
||||||
/***************** Macros (Inline Functions) Definitions *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
#define AssertL2Event(instPtr, event) Linklayer_EventHandler(instPtr, event)
|
#define AssertL2Event(instPtr, event) (Linklayer_EventHandler((instPtr), (event)))
|
||||||
/**************************** Type Definitions *******************************/
|
/**************************** Type Definitions *******************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,11 +39,9 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L2_NODE_TYPE myType; ///< node type
|
L2_NODE_TYPE myType; ///< node type
|
||||||
bool isInterHead; ///< indicate if node is head node
|
|
||||||
uint8_t clustId; ///< node cluster id
|
uint8_t clustId; ///< node cluster id
|
||||||
uint8_t myId; ///< node id
|
uint8_t myId; ///< node id
|
||||||
uint8_t headId; ///< head node id
|
uint8_t headId; ///< head node id
|
||||||
uint8_t bkpHeadId; ///< backup head id
|
|
||||||
uint8_t netScale; ///< net scale
|
uint8_t netScale; ///< net scale
|
||||||
PHY_INST *phyInstPtr; ///< pointer to system physical layer instance
|
PHY_INST *phyInstPtr; ///< pointer to system physical layer instance
|
||||||
TMC_INST *tmcInstPtr; ///< pointer to system timer controller layer instance
|
TMC_INST *tmcInstPtr; ///< pointer to system timer controller layer instance
|
||||||
@@ -175,6 +173,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *schedEntry)
|
|||||||
int32_t L2_Service_Init(L2_SVC_FSM **svcFSMPtr);
|
int32_t L2_Service_Init(L2_SVC_FSM **svcFSMPtr);
|
||||||
void L2_Service_Reset(L2_SVC_FSM *svcFSMPtr);
|
void L2_Service_Reset(L2_SVC_FSM *svcFSMPtr);
|
||||||
void L2_Service_Destroy(L2_SVC_FSM *svcFSMPtr);
|
void L2_Service_Destroy(L2_SVC_FSM *svcFSMPtr);
|
||||||
|
bool L2_Service_PktCheck(L2_INST *instPtr, uint8_t *msg);
|
||||||
int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg);
|
int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg);
|
||||||
int32_t L2_Service_Proc(L2_INST *instPtr);
|
int32_t L2_Service_Proc(L2_INST *instPtr);
|
||||||
int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *schedEntry);
|
int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *schedEntry);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ typedef enum
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
L2_EVENT_TYPE event; ///< event type
|
L2_EVENT_TYPE event; ///< event type
|
||||||
void *msg; ///< event message
|
void *msg; ///< event message (MUST be a heap item)
|
||||||
} L2_EVENT;
|
} L2_EVENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#define L2_PACK_LEN_MAX 512 // bytes
|
#define L2_PACK_LEN_MAX 512 // bytes
|
||||||
|
|
||||||
#define L2_ADV_PACK_LEN 28 // bytes
|
#define L2_ADV_PACK_LEN 28 // bytes
|
||||||
#define L2_CMF_PACK_LEN 268 // bytes
|
#define L2_CMF_PACK_LEN 28 // bytes
|
||||||
#define L2_SVC_PACK_LEN 268 // bytes
|
#define L2_SVC_PACK_LEN 268 // bytes
|
||||||
|
|
||||||
// Common structure:
|
// Common structure:
|
||||||
@@ -81,17 +81,7 @@
|
|||||||
#define L2_MSG_CFM_SRC_POSY_LEN 4
|
#define L2_MSG_CFM_SRC_POSY_LEN 4
|
||||||
#define L2_MSG_CFM_SRC_POSZ 16
|
#define L2_MSG_CFM_SRC_POSZ 16
|
||||||
#define L2_MSG_CFM_SRC_POSZ_LEN 4
|
#define L2_MSG_CFM_SRC_POSZ_LEN 4
|
||||||
#define L2_MSG_CFM_SRC_SPEEDX 20
|
#define L2_MSG_CFM_CRC 26
|
||||||
#define L2_MSG_CFM_SRC_SPEEDX_LEN 4
|
|
||||||
#define L2_MSG_CFM_SRC_SPEEDY 24
|
|
||||||
#define L2_MSG_CFM_SRC_SPEEDY_LEN 4
|
|
||||||
#define L2_MSG_CFM_SRC_SPEEDZ 28
|
|
||||||
#define L2_MSG_CFM_SRC_SPEEDZ_LEN 4
|
|
||||||
#define L2_MSG_CFM_PAYLOAD_ID 32
|
|
||||||
#define L2_MSG_CFM_PAYLOAD_ID_LEN 4
|
|
||||||
#define L2_MSG_CFM_PAYLOAD 36
|
|
||||||
#define L2_MSG_CFM_PAYLOAD_LEN 230
|
|
||||||
#define L2_MSG_CFM_CRC 266
|
|
||||||
#define L2_MSG_CFM_CRC_LEN 2
|
#define L2_MSG_CFM_CRC_LEN 2
|
||||||
|
|
||||||
// service payload structure:
|
// service payload structure:
|
||||||
|
|||||||
@@ -32,6 +32,10 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
/***************** Macros (Inline Functions) Definitions *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
|
/**
|
||||||
|
* @brief Get the node list length
|
||||||
|
* @param list pointer to node list
|
||||||
|
*/
|
||||||
inline uint32_t L2_GetNodeListLen(NODE_LIST *list)
|
inline uint32_t L2_GetNodeListLen(NODE_LIST *list)
|
||||||
{
|
{
|
||||||
ASSERT(list != NULL);
|
ASSERT(list != NULL);
|
||||||
@@ -40,7 +44,7 @@ inline uint32_t L2_GetNodeListLen(NODE_LIST *list)
|
|||||||
/**************************** Type Definitions *******************************/
|
/**************************** Type Definitions *******************************/
|
||||||
|
|
||||||
/************************** Variable Definitions *****************************/
|
/************************** Variable Definitions *****************************/
|
||||||
static NODE_ENTRY util_entry;
|
static NODE_ENTRY util_entry = { 0 };
|
||||||
/************************** Function Prototypes ******************************/
|
/************************** Function Prototypes ******************************/
|
||||||
/**
|
/**
|
||||||
* @brief helper function to free node entry.
|
* @brief helper function to free node entry.
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ static void PendCfmAck(L2_SCAN_FSM *scanFsmPtr)
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
static void StageUpdate(L2_SCAN_FSM *scanFsmPtr, SCAN_STAGE newStage)
|
static void StageUpdate(L2_SCAN_FSM *scanFsmPtr, SCAN_STAGE newStage)
|
||||||
{
|
{
|
||||||
ASSERT(newStage >= L2_SCAN_NONE_STAGE && newStage <= L2_SCAN_CFM_STAGE);
|
ASSERT((newStage >= L2_SCAN_NONE_STAGE) && (newStage <= L2_SCAN_CFM_STAGE));
|
||||||
DBG_INFO("ScanNet current stage: %" PRIu8 " -> ScanNet new stage: %" PRIu8 " \n",
|
DBG_INFO("ScanNet current stage: %" PRIu8 " -> ScanNet new stage: %" PRIu8 " \n",
|
||||||
scanFsmPtr->scanStage, newStage);
|
scanFsmPtr->scanStage, newStage);
|
||||||
scanFsmPtr->scanStage = newStage;
|
scanFsmPtr->scanStage = newStage;
|
||||||
@@ -237,7 +237,6 @@ static int32_t Scan_InitScanHandler(L2_INST *instPtr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Member node scan net BmAdvt stage handler.
|
* @brief Member node scan net BmAdvt stage handler.
|
||||||
*
|
*
|
||||||
@@ -252,6 +251,7 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
|
|||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
|
||||||
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||||
|
TMC_INST *tmcRef = instPtr->config.tmcInstPtr;
|
||||||
DBG_INFO("** Net-Setup - Advertisement Procedure (Timeout: %" PRIu8 ") **\n", scanFsmPtr->advTimeout);
|
DBG_INFO("** Net-Setup - Advertisement Procedure (Timeout: %" PRIu8 ") **\n", scanFsmPtr->advTimeout);
|
||||||
|
|
||||||
// if received a valid bm frame.
|
// if received a valid bm frame.
|
||||||
@@ -264,7 +264,20 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
|
|||||||
|
|
||||||
// Update scan stage
|
// Update scan stage
|
||||||
StageUpdate(scanFsmPtr, L2_SCAN_CFM_STAGE);
|
StageUpdate(scanFsmPtr, L2_SCAN_CFM_STAGE);
|
||||||
DBG_INFO("Received Adv frame, skipping 10ms for turn around...\n");
|
|
||||||
|
// start a confirm frame reception if in the target slot
|
||||||
|
if ((TimeCtrl_GetIntCnt(tmcRef) + 1) % CFM_FRAME_SLOTS == 0)
|
||||||
|
{
|
||||||
|
// using pull mode to receive confirm frame
|
||||||
|
// since first time sync procedure is accomplished in ADV stage.
|
||||||
|
(void)Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_16);
|
||||||
|
(void)Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
||||||
|
(void)Phy_SetMode(phyRef, PHY_MODE_PULL);
|
||||||
|
(void)L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_CFM_FRAME);
|
||||||
|
scanFsmPtr->cfmTimeout++; // increase counter.
|
||||||
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
|
}
|
||||||
|
// otherwise skip...
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
// no valid bm frame was received.
|
// no valid bm frame was received.
|
||||||
@@ -274,17 +287,17 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
|
|||||||
if (scanFsmPtr->advTimeout > ADV_LISTEN_TIMEOUT)
|
if (scanFsmPtr->advTimeout > ADV_LISTEN_TIMEOUT)
|
||||||
{
|
{
|
||||||
/* Antenna steering (reserved, automatically accomplished by physical layer) */
|
/* Antenna steering (reserved, automatically accomplished by physical layer) */
|
||||||
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
(void)Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
||||||
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_SCAN_FRAME);
|
(void)L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_SCAN_FRAME);
|
||||||
DBG_WARNING("Adv timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
DBG_WARNING("Adv timeout, restart net scan from L2_SCAN_INIT_STAGE.\n");
|
||||||
L2_Scan_Reset(scanFsmPtr);
|
(void)L2_Scan_Reset(scanFsmPtr);
|
||||||
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Antenna steering (reserved, automatically accomplished by physical layer) */
|
/* Antenna steering (reserved, automatically accomplished by physical layer) */
|
||||||
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
(void)Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
||||||
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_ADV_FRAME);
|
(void)L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_ADV_FRAME);
|
||||||
scanFsmPtr->advTimeout++;
|
scanFsmPtr->advTimeout++;
|
||||||
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
}
|
}
|
||||||
@@ -319,10 +332,10 @@ static int32_t Scan_CfmHandler(L2_INST *instPtr)
|
|||||||
{
|
{
|
||||||
// using pull mode to receive confirm frame
|
// using pull mode to receive confirm frame
|
||||||
// since first time sync procedure is accomplished in ADV stage.
|
// since first time sync procedure is accomplished in ADV stage.
|
||||||
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_16);
|
(void)Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_16);
|
||||||
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
(void)Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
|
||||||
Phy_SetMode(phyRef, PHY_MODE_PULL);
|
(void)Phy_SetMode(phyRef, PHY_MODE_PULL);
|
||||||
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_CFM_FRAME);
|
(void)L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_CFM_FRAME);
|
||||||
scanFsmPtr->cfmTimeout++; // increase counter.
|
scanFsmPtr->cfmTimeout++; // increase counter.
|
||||||
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
}
|
}
|
||||||
@@ -346,7 +359,7 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
int32_t Status;
|
int32_t Status;
|
||||||
uint32_t dataChunk;
|
uint32_t dataChunk;
|
||||||
uint8_t *buff = instPtr->sendPktData;
|
uint8_t *buff = instPtr->sendPktData;
|
||||||
if (type < L2_ADV_FRAME || type > L2_CFM_FRAME)
|
if ((type < L2_ADV_FRAME) || (type > L2_CFM_FRAME))
|
||||||
{
|
{
|
||||||
DBG_ERROR("Unexpected frame type: %" PRId8 ".\n", type);
|
DBG_ERROR("Unexpected frame type: %" PRId8 ".\n", type);
|
||||||
return EPARAM;
|
return EPARAM;
|
||||||
@@ -396,27 +409,6 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_POSX, L2_MSG_CFM_SRC_POSX_LEN, &(instPtr->sysInfo.posX));
|
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_POSX, L2_MSG_CFM_SRC_POSX_LEN, &(instPtr->sysInfo.posX));
|
||||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_POSY, L2_MSG_CFM_SRC_POSY_LEN, &(instPtr->sysInfo.posY));
|
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_POSY, L2_MSG_CFM_SRC_POSY_LEN, &(instPtr->sysInfo.posY));
|
||||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_POSZ, L2_MSG_CFM_SRC_POSZ_LEN, &(instPtr->sysInfo.posZ));
|
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_POSZ, L2_MSG_CFM_SRC_POSZ_LEN, &(instPtr->sysInfo.posZ));
|
||||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_SPEEDX, L2_MSG_CFM_SRC_SPEEDX_LEN, &(instPtr->sysInfo.vX));
|
|
||||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_SPEEDY, L2_MSG_CFM_SRC_SPEEDY_LEN, &(instPtr->sysInfo.vY));
|
|
||||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_SRC_SPEEDZ, L2_MSG_CFM_SRC_SPEEDZ_LEN, &(instPtr->sysInfo.vZ));
|
|
||||||
|
|
||||||
// Packing extra payload
|
|
||||||
uint32_t dataId;
|
|
||||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
|
||||||
{
|
|
||||||
SysMonitor_GetSendPayload(buff + L2_MSG_CFM_PAYLOAD, &dataId, PAYLOAD_LEN_FLJ_TX);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SysMonitor_GetSendPayload(buff + L2_MSG_CFM_PAYLOAD, &dataId, PAYLOAD_LEN_LJ_TX);
|
|
||||||
}
|
|
||||||
|
|
||||||
L2_FrameInsertChunk(buff, L2_MSG_CFM_PAYLOAD_ID, L2_MSG_CFM_PAYLOAD_ID_LEN, &dataId);
|
|
||||||
if (dataId == DATA_ID_NONE)
|
|
||||||
{
|
|
||||||
memset(buff + L2_MSG_CFM_PAYLOAD, 0xAA, L2_MSG_CFM_PAYLOAD_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append CRC
|
// Append CRC
|
||||||
Status = L2_CrcAppend(buff, L2_CMF_PACK_LEN - L2_MSG_CFM_CRC_LEN, L2_MSG_CFM_CRC, L2_CRC16_1021);
|
Status = L2_CrcAppend(buff, L2_CMF_PACK_LEN - L2_MSG_CFM_CRC_LEN, L2_MSG_CFM_CRC, L2_CRC16_1021);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
@@ -424,10 +416,6 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
|
DBG_ERROR("Fail to append CRC, error code: %" PRId32 ".\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Logging...
|
|
||||||
memcpy(instPtr->log.txLog.data, buff, L2_CMF_PACK_LEN);
|
|
||||||
instPtr->log.txLog.dataId = dataId;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -551,13 +539,6 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
node->nodeInfo.pos.y = (double)nodePos;
|
node->nodeInfo.pos.y = (double)nodePos;
|
||||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_POSZ, L2_MSG_CFM_SRC_POSZ_LEN, &nodePos);
|
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_POSZ, L2_MSG_CFM_SRC_POSZ_LEN, &nodePos);
|
||||||
node->nodeInfo.pos.z = (double)nodePos;
|
node->nodeInfo.pos.z = (double)nodePos;
|
||||||
float nodeSpeed;
|
|
||||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_SPEEDX, L2_MSG_CFM_SRC_SPEEDX_LEN, &nodeSpeed);
|
|
||||||
node->nodeInfo.speed.x = (double)nodePos;
|
|
||||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_SPEEDY, L2_MSG_CFM_SRC_SPEEDY_LEN, &nodeSpeed);
|
|
||||||
node->nodeInfo.speed.y = (double)nodePos;
|
|
||||||
L2_FrameGetChunk(msg, L2_MSG_CFM_SRC_SPEEDZ, L2_MSG_CFM_SRC_SPEEDZ_LEN, &nodeSpeed);
|
|
||||||
node->nodeInfo.speed.z = (double)nodePos;
|
|
||||||
|
|
||||||
// Reset node ttl
|
// Reset node ttl
|
||||||
node->ttlCnt = 0;
|
node->ttlCnt = 0;
|
||||||
@@ -593,9 +574,11 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
};
|
};
|
||||||
newRtneConfig.rtneTable = initTable;
|
newRtneConfig.rtneTable = initTable;
|
||||||
newRtneConfig.rtnePrd = ARRAY_SIZE(initTable);
|
newRtneConfig.rtnePrd = ARRAY_SIZE(initTable);
|
||||||
AssertL2Event(instPtr, &rtneUpEvent);
|
(void)AssertL2Event(instPtr, &rtneUpEvent);
|
||||||
}
|
}
|
||||||
PendCfmAck(instPtr->scanFSM);
|
PendCfmAck(instPtr->scanFSM);
|
||||||
|
// Time sync.
|
||||||
|
L2_TimeAdjust(instPtr, &(instPtr->log.timeDev));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -607,29 +590,10 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
L2_NODE_STATE newState = L2_NORMAL_STATE;
|
L2_NODE_STATE newState = L2_NORMAL_STATE;
|
||||||
l2Event.event = L2_EV_MAIN_STATE_UPDATE;
|
l2Event.event = L2_EV_MAIN_STATE_UPDATE;
|
||||||
l2Event.msg = &newState;
|
l2Event.msg = &newState;
|
||||||
AssertL2Event(instPtr, &l2Event);
|
(void)AssertL2Event(instPtr, &l2Event);
|
||||||
}
|
}
|
||||||
// Time sync.
|
|
||||||
L2_TimeAdjust(instPtr, &(instPtr->log.timeDev));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get data payload
|
|
||||||
uint32_t dataId;
|
|
||||||
L2_FrameGetChunk(msg, L2_MSG_CFM_PAYLOAD_ID, L2_MSG_CFM_PAYLOAD_ID_LEN, &dataId);
|
|
||||||
|
|
||||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD)
|
|
||||||
{
|
|
||||||
SysMonitor_UpdateRecvPayload(msg + L2_MSG_CFM_PAYLOAD, dataId, PAYLOAD_LEN_FLJ_RX);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SysMonitor_UpdateRecvPayload(msg + L2_MSG_CFM_PAYLOAD, dataId, PAYLOAD_LEN_LJ_RX);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logging...
|
|
||||||
memcpy(instPtr->log.rxLog.data, msg, L2_CMF_PACK_LEN);
|
|
||||||
instPtr->log.rxLog.dataId = dataId;
|
|
||||||
|
|
||||||
Status = SUCCESS;
|
Status = SUCCESS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -783,7 +747,6 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
|||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
L2_TOR_TYPE torState;
|
L2_TOR_TYPE torState;
|
||||||
int32_t Status;
|
|
||||||
const NODE_ENTRY *commNode;
|
const NODE_ENTRY *commNode;
|
||||||
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
PHY_INST *phyRef = instPtr->config.phyInstPtr;
|
||||||
DBG_INFO("-------- Scan Routine --------\n");
|
DBG_INFO("-------- Scan Routine --------\n");
|
||||||
@@ -815,7 +778,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
|||||||
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
|
||||||
if (commNode != NULL)
|
if (commNode != NULL)
|
||||||
{
|
{
|
||||||
Phy_SetBeamNo(phyRef, commNode->nodeInfo.beamNo, PHY_ANT_BEAM_16);
|
(void)Phy_SetBeamNo(phyRef, commNode->nodeInfo.beamNo, PHY_ANT_BEAM_16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -833,7 +796,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
|||||||
torState = L2_TOR_SUSPEND;
|
torState = L2_TOR_SUSPEND;
|
||||||
}
|
}
|
||||||
// Setup antenna beam
|
// Setup antenna beam
|
||||||
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_120);
|
(void)Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_120);
|
||||||
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_120;
|
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_120;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -843,10 +806,9 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
|||||||
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD && torState == L2_TOR_TX)
|
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD && torState == L2_TOR_TX)
|
||||||
{
|
{
|
||||||
DBG_ERROR("Only head node can send init-scan Frame.\n");
|
DBG_ERROR("Only head node can send init-scan Frame.\n");
|
||||||
Status = FAILURE;
|
return FAILURE;
|
||||||
goto routine_err;
|
|
||||||
}
|
}
|
||||||
L2_SetupNextSlot(instPtr, torState, L2_SCAN_FRAME);
|
(void)L2_SetupNextSlot(instPtr, torState, L2_SCAN_FRAME);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L2_SLOT_ADVERTISE:
|
case L2_SLOT_ADVERTISE:
|
||||||
@@ -855,18 +817,16 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
|||||||
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
||||||
{
|
{
|
||||||
DBG_ERROR("Only head node can send ADV Frame.\n");
|
DBG_ERROR("Only head node can send ADV Frame.\n");
|
||||||
Status = FAILURE;
|
return FAILURE;
|
||||||
goto routine_err;
|
|
||||||
}
|
}
|
||||||
memset(instPtr->sendPktData, 0xAA, L2_PACK_LEN_MAX);
|
memset(instPtr->sendPktData, 0xAA, L2_PACK_LEN_MAX);
|
||||||
if (ScanMsg_Packing(instPtr, L2_ADV_FRAME, rtneEntry->dst) != SUCCESS)
|
if (ScanMsg_Packing(instPtr, L2_ADV_FRAME, rtneEntry->dst) != SUCCESS)
|
||||||
{
|
{
|
||||||
Status = FAILURE;
|
return FAILURE;
|
||||||
goto routine_err;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Antenna setting (reserved.) */
|
/* Antenna setting (reserved.) */
|
||||||
L2_SetupNextSlot(instPtr, torState, L2_ADV_FRAME);
|
(void)L2_SetupNextSlot(instPtr, torState, L2_ADV_FRAME);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case L2_SLOT_CONFIRM:
|
case L2_SLOT_CONFIRM:
|
||||||
@@ -883,21 +843,17 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
|
|||||||
memset(instPtr->sendPktData, 0xAA, L2_PACK_LEN_MAX);
|
memset(instPtr->sendPktData, 0xAA, L2_PACK_LEN_MAX);
|
||||||
if (ScanMsg_Packing(instPtr, L2_CFM_FRAME, rtneEntry->dst) != SUCCESS)
|
if (ScanMsg_Packing(instPtr, L2_CFM_FRAME, rtneEntry->dst) != SUCCESS)
|
||||||
{
|
{
|
||||||
Status = FAILURE;
|
return FAILURE;
|
||||||
goto routine_err;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Antenna setting (reserved.) */
|
/* Antenna setting (reserved.) */
|
||||||
L2_SetupNextSlot(instPtr, torState, L2_CFM_FRAME);
|
(void)L2_SetupNextSlot(instPtr, torState, L2_CFM_FRAME);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBG_ERROR("Cannot start a routine for slot type [%" PRId8 "] properly.\n", rtneEntry->slotType);
|
DBG_ERROR("Cannot start a routine for slot type [%" PRId8 "] properly.\n", rtneEntry->slotType);
|
||||||
Status = FAILURE;
|
return FAILURE;
|
||||||
goto routine_err;
|
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
routine_err:
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} LinkLayer_Scan*/
|
/** @} LinkLayer_Scan*/
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ void L2_EventPoolHandler(L2_INST *instPtr)
|
|||||||
if (event->schdFrame == L2_GetCurrentFrameNum(instPtr) && event->schdSlot == L2_GetCurrentSlotNum(instPtr))
|
if (event->schdFrame == L2_GetCurrentFrameNum(instPtr) && event->schdSlot == L2_GetCurrentSlotNum(instPtr))
|
||||||
{
|
{
|
||||||
DBG_INFO("Asserting scheduled event [%" PRIu32 "].\n", event->eventId);
|
DBG_INFO("Asserting scheduled event [%" PRIu32 "].\n", event->eventId);
|
||||||
AssertL2Event(instPtr, &(event->l2Event));
|
(void)AssertL2Event(instPtr, &(event->l2Event));
|
||||||
if (event->isVolatile == true)
|
if (event->isVolatile == true)
|
||||||
{
|
{
|
||||||
DBG_INFO("Deleting scheduled event [%" PRIu32 "], since it is volatile.\n", event->eventId);
|
DBG_INFO("Deleting scheduled event [%" PRIu32 "], since it is volatile.\n", event->eventId);
|
||||||
|
|||||||
@@ -155,8 +155,9 @@ static int32_t Service_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
|
|||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
#else
|
#else
|
||||||
DBG_ERROR("Unexpected call of Service_Packing in BER test mode.\n");
|
size_t packLen = Phy_GetFrameLen(L2_L2frame2L1frame(L2_SVC_FRAME));
|
||||||
return EUNEXP;
|
memcpy(instPtr->sendPktData, testData, packLen);
|
||||||
|
return SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,33 +261,63 @@ int32_t L2_Service_PktHandler(L2_INST *instPtr, uint8_t *msg)
|
|||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
#else
|
#else
|
||||||
|
NODE_ENTRY *node;
|
||||||
|
uint8_t nodeId = (L2_GetNodeType(instPtr) == L2_NODE_HEAD) ? 0x02 : 0x01;
|
||||||
|
node = L2_GetNodeById(instPtr->nodeList, nodeId);
|
||||||
|
if (node == NULL)
|
||||||
|
{
|
||||||
|
node = L2_AppendNode(instPtr->nodeList, nodeId, L2_NODE_MEMBER);
|
||||||
|
if (node == NULL)
|
||||||
|
{
|
||||||
|
DBG_ERROR("Failed to append new node [id: %" PRIu8 "]", nodeId);
|
||||||
|
return ENOMEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Reset node ttl
|
||||||
|
node->ttlCnt = 0;
|
||||||
|
|
||||||
|
// Calculate time deviation
|
||||||
|
uint32_t frameNum = L2_GetCurrentFrameNum(instPtr);
|
||||||
|
uint32_t slotNum = L2_GetCurrentSlotNum(instPtr);
|
||||||
|
|
||||||
|
// //NOTE: Service frame length is 20ms with 5ms idle
|
||||||
|
// if(slotNum < 5)
|
||||||
|
// {
|
||||||
|
// slotNum = L2_SLOTS_PER_FRAME - 5;
|
||||||
|
// frameNum = frameNum - 1;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// slotNum = slotNum / 5 * 5 - 5;
|
||||||
|
// }
|
||||||
|
// Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
|
||||||
|
// if (Status != SUCCESS)
|
||||||
|
// {
|
||||||
|
// DBG_ERROR("Failed to compute time deviation.\n")
|
||||||
|
// return Status;
|
||||||
|
// }
|
||||||
|
// // Implement a auto time sync.
|
||||||
|
// if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
||||||
|
// {
|
||||||
|
// // Time sync.
|
||||||
|
// L2_TimeAdjust(instPtr, &(instPtr->log.timeDev));
|
||||||
|
// }
|
||||||
|
return SUCCESS;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool L2_Service_PktCheck(L2_INST *instPtr, uint8_t *msg)
|
||||||
|
{
|
||||||
|
size_t packLen = Phy_GetFrameLen(L2_L2frame2L1frame(L2_SVC_FRAME)) & 0xFFFFFFFE;
|
||||||
uint32_t errorBits = 0;
|
uint32_t errorBits = 0;
|
||||||
for (int i = 0; i < L2_SVC_PACK_LEN; i++)
|
for (int i = 0; i < packLen; i++)
|
||||||
{
|
{
|
||||||
errorBits += count_ones(msg[i] ^ testData[i]);
|
errorBits += count_ones(msg[i] ^ testData[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
instPtr->serviceFSM->bitError += errorBits;
|
instPtr->serviceFSM->bitError += errorBits;
|
||||||
instPtr->serviceFSM->bitTotal += L2_SVC_PACK_LEN * 8;
|
instPtr->serviceFSM->bitTotal += packLen * 8;
|
||||||
|
return (errorBits == 0);
|
||||||
// Calculate time deviation
|
|
||||||
uint32_t frameNum, slotNum = 0;
|
|
||||||
L2_FrameGetChunk(msg, L2_MSG_FRAME_NUM, L2_MSG_FRAME_NUM_LEN, &frameNum);
|
|
||||||
L2_FrameGetChunk(msg, L2_MSG_SLOT_NUM, L2_MSG_SLOT_NUM_LEN, &slotNum);
|
|
||||||
Status = L2_GetTimeDeviation(instPtr, frameNum, slotNum, true, &(instPtr->log.timeDev));
|
|
||||||
if (Status != SUCCESS)
|
|
||||||
{
|
|
||||||
DBG_ERROR("Failed to compute time deviation.\n")
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
// Implement a auto time sync.
|
|
||||||
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
|
|
||||||
{
|
|
||||||
// Time sync.
|
|
||||||
L2_TimeAdjust(instPtr, &(instPtr->log.timeDev));
|
|
||||||
}
|
|
||||||
return SUCCESS;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -406,12 +437,7 @@ int32_t L2_Service_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntr
|
|||||||
if (torState == L2_TOR_TX)
|
if (torState == L2_TOR_TX)
|
||||||
{
|
{
|
||||||
svcFSMPtr->txCnt++;
|
svcFSMPtr->txCnt++;
|
||||||
#ifndef DATALINK_ENABLE_BERTEST
|
|
||||||
// Packing service data
|
|
||||||
Service_Packing(instPtr, L2_SVC_FRAME, rtneEntry->dst);
|
Service_Packing(instPtr, L2_SVC_FRAME, rtneEntry->dst);
|
||||||
#else
|
|
||||||
memcpy(instPtr->sendPktData, testData, L2_SVC_PACK_LEN);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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
|
* @copyright Copyright(c) 2024 Beijing Institute of Technology.\n
|
||||||
* Date: 2022-06-18 16:37
|
* Lab of Communication and Network
|
||||||
* 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
|
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup PhysicalLayer
|
* @addtogroup PhysicalLayer
|
||||||
* @{
|
* @{
|
||||||
@@ -71,62 +67,123 @@
|
|||||||
|
|
||||||
// Pair by regex
|
// Pair by regex
|
||||||
// Regex: (([0-9]+, ){8})
|
// Regex: (([0-9]+, ){8})
|
||||||
const uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] =
|
const uint16_t freqTable[L1_FRAME_MAX_HOPS] =
|
||||||
{
|
{
|
||||||
1500
|
1084U, 1097U, 1110U, 1123U, 1136U, 1149U, 1162U, 1175U,
|
||||||
|
1188U, 1201U, 1214U, 1227U, 1240U, 1253U, 1266U, 1279U,
|
||||||
|
1292U, 1305U, 1318U, 1331U, 1344U, 1357U, 1370U, 1383U,
|
||||||
|
1396U, 1409U, 1422U, 1435U, 1448U, 1461U, 1474U, 1487U,
|
||||||
|
1500U, 1513U, 1526U, 1539U, 1552U, 1565U, 1578U, 1591U,
|
||||||
|
1604U, 1617U, 1630U, 1643U, 1656U, 1669U, 1682U, 1695U,
|
||||||
|
1708U, 1721U, 1734U, 1747U, 1760U, 1773U, 1786U, 1799U,
|
||||||
|
1812U, 1825U, 1838U, 1851U, 1864U, 1877U, 1890U, 1903U,
|
||||||
|
1916U, 1929U, 1942U, 1955U, 1968U, 1981U, 1994U, 2007U,
|
||||||
|
2020U, 2033U, 2046U, 2059U, 2072U, 2085U, 2098U, 2111U,
|
||||||
|
2124U
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] =
|
const int16_t antCalTable[L1_FRAME_MAX_HOPS][L1_ANT_NUM_CH] =
|
||||||
|
//Antenna-JG01
|
||||||
{
|
{
|
||||||
0, 44, 88, 131, 175, 219, 263, 306,
|
{ 0, 2525, -7533, -6846}, { 0, 12726, -7818, -6860},
|
||||||
350, 394, 438, 481, 525, 569, 613, 656,
|
{ 0, 2490, -7836, -6907}, { 0, 4479, -7716, -6837},
|
||||||
700, 744, 788, 831, 875, 919, 963, 1006,
|
{ 0, 6409, -7770, -6776}, { 0, 14616, -7977, -6816},
|
||||||
1050, 1094, 1138, 1181, 1225, 1269, 1313, 1356,
|
{ 0, -22557, -8002, -6911}, { 0, -22587, -8121, -6918},
|
||||||
1400, 1444, 1488, 1531, 1575, 1619, 1663, 1706,
|
{ 0, -1124, -8123, -7030}, { 0, -152, -8219, -7042},
|
||||||
1750, 1794, 1838, 1881, 1925, 1969, 2013, 2056,
|
{ 0, 1823, -8209, -7130}, { 0, 1790, -8290, -7214},
|
||||||
2100, 2144, 2188, 2231, 2275, 2319, 2363, 2406,
|
{ 0, 1669, -8362, -7283}, { 0, 1634, -8459, -7276},
|
||||||
2450, 2494, 2538, 2581, 2625, 2669, 2713, 2756,
|
{ 0, 1615, -8315, -7415}, { 0, 1698, -8168, -7366},
|
||||||
2800, 2844, 2888, 2931, 2975, 3019, 3063, 3106,
|
{ 0, 1535, -8285, -7520}, { 0, 1619, -8285, -7532},
|
||||||
3150, 3194, 3238, 3281, 3325, 3369, 3413, 3456,
|
{ 0, 1609, -8201, -7693}, { 0, 1671, -8145, -7769},
|
||||||
3500
|
{ 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_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] =
|
const uint8_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] =
|
||||||
{
|
{
|
||||||
1500
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint16_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] =
|
const uint8_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] =
|
||||||
{
|
{
|
||||||
1500, 1500, 1500, 1500, 1500, 1500, 1500, 1500,
|
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
|
||||||
1500, 1500, 1500
|
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 uint16_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] =
|
const uint8_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] =
|
||||||
{
|
{
|
||||||
1600, 1650, 1700, 1750, 1800, 1850, 1900, 1550,
|
80U
|
||||||
1500
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] =
|
const uint8_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] =
|
||||||
{
|
{
|
||||||
1700, 1800, 1900, 2000, 1700, 1700, 1700, 1700,
|
80U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
|
||||||
1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700,
|
8U, 9U, 10U
|
||||||
1700, 1700, 1700
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] =
|
const uint8_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] =
|
||||||
{
|
{
|
||||||
500, 1600, 1700, 1800, 1900, 2000, 1500, 1600,
|
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
|
||||||
1700, 1800, 1900, 2000, 1500, 1600, 1700, 1800,
|
8U,
|
||||||
1900, 2000, 1500, 1500
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] =
|
const uint8_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] =
|
||||||
{
|
{
|
||||||
500, 600, 700, 800, 900, 1000, 500, 600,
|
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
|
||||||
700, 800, 900, 1000, 500, 600, 700, 800,
|
8U, 9U, 10U, 11U, 12U, 13U, 14U, 15U,
|
||||||
900, 1000, 500, 500
|
16U, 17U, 18U
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] =
|
||||||
|
{
|
||||||
|
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
|
||||||
|
8U, 9U, 10U, 11U, 12U, 13U, 14U, 15U,
|
||||||
|
16U, 17U, 18U, 19U
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_HOPS] =
|
||||||
|
{
|
||||||
|
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
|
||||||
|
8U, 9U, 10U, 11U, 12U, 13U, 14U, 15U,
|
||||||
|
16U, 17U, 18U, 19U
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @} PhysicalLayer_AntennaConfig_Constants*/
|
/** @} PhysicalLayer_AntennaConfig_Constants*/
|
||||||
@@ -163,7 +220,7 @@ void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig)
|
|||||||
// trSelect
|
// trSelect
|
||||||
antConfig->trSlect = 0;
|
antConfig->trSlect = 0;
|
||||||
// Antenna attenuation setting
|
// Antenna attenuation setting
|
||||||
antConfig->antAtt = 20;
|
antConfig->antAtt = 0;
|
||||||
// phase setting
|
// phase setting
|
||||||
antConfig->phase = 0;
|
antConfig->phase = 0;
|
||||||
// ***********************
|
// ***********************
|
||||||
@@ -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 instPtr pointer to physical layer instance
|
||||||
* @param table new beam table
|
* @param table new beam table
|
||||||
@@ -260,7 +317,7 @@ void Phy_SetBeamTable(PHY_INST *instPtr, PHY_ANT_ANGLE *table, uint32_t offset)
|
|||||||
* FAILURE beamNo exceeds the table size
|
* FAILURE beamNo exceeds the table size
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo, PHY_ANT_BEAM_WIDTH beamWidth)
|
int32_t Phy_SetBeamNo(PHY_INST *instPtr, size_t beamNo, PHY_ANT_BEAM_WIDTH beamWidth)
|
||||||
{
|
{
|
||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
|
|
||||||
@@ -302,7 +359,7 @@ int32_t Phy_SetBeamNo(PHY_INST *instPtr, int32_t beamNo, PHY_ANT_BEAM_WIDTH beam
|
|||||||
* @param beamWidth new beam width
|
* @param beamWidth new beam width
|
||||||
*
|
*
|
||||||
* @return SUCCESS.
|
* @return SUCCESS.
|
||||||
* EPARAM - the direction is exceeds predefined range
|
* EPARAM
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
|
int32_t Phy_SetBeamWidth(PHY_INST *instPtr, PHY_ANT_BEAM_WIDTH beamWidth)
|
||||||
@@ -349,8 +406,8 @@ int32_t Phy_SetBeamAngle(PHY_INST *instPtr, double offAx, double rndAx)
|
|||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
uint16_t offAxDeg = 0;
|
uint16_t offAxDeg = 0;
|
||||||
uint16_t rndAxDeg = 0;
|
uint16_t rndAxDeg = 0;
|
||||||
offAxDeg = (offAx >= 0) ? (((int32_t)(offAx * 180 / ANT_PI)) % 360) : (((int32_t)(offAx * 180 / ANT_PI)) % 360 + 360);
|
offAxDeg = (offAx >= 0) ? (((int32_t)(offAx * 180.0 / ANT_PI)) % 360) : (((int32_t)(offAx * 180.0 / ANT_PI)) % 360 + 360);
|
||||||
rndAxDeg = (rndAx >= 0) ? (((int32_t)(rndAx * 180 / ANT_PI)) % 360) : (((int32_t)(rndAx * 180 / 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)
|
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",
|
DBG_ERROR("Angle out of range, off axis angle: %" PRIu16 " (should be 0~60), round axis angle: %" PRIu16 " (should be 0~360).\n",
|
||||||
|
|||||||
@@ -63,23 +63,25 @@
|
|||||||
#define ATTN_DEFAULT 0
|
#define ATTN_DEFAULT 0
|
||||||
#define ATTN_2KBPS_100MS ATTN_DEFAULT
|
#define ATTN_2KBPS_100MS ATTN_DEFAULT
|
||||||
#define ATTN_2KBPS_20MS ATTN_DEFAULT
|
#define ATTN_2KBPS_20MS ATTN_DEFAULT
|
||||||
#define ATTN_10KBPS_10MS 31
|
#define ATTN_10KBPS_10MS 12
|
||||||
#define ATTN_10KBPS_20MS 31
|
#define ATTN_10KBPS_20MS 12
|
||||||
#define ATTN_40KBPS_10MS 21
|
#define ATTN_40KBPS_10MS 0
|
||||||
#define ATTN_40KBPS_20MS 21
|
#define ATTN_40KBPS_20MS 0
|
||||||
#define ATTN_200KBPS_5MS ATTN_DEFAULT
|
#define ATTN_200KBPS_5MS ATTN_DEFAULT
|
||||||
#define ATTN_1M2BPS_5MS ATTN_DEFAULT
|
#define ATTN_1M2BPS_5MS ATTN_DEFAULT
|
||||||
/** @} PhysicalLayer_Private_Constants*/
|
/** @} PhysicalLayer_Private_Constants*/
|
||||||
|
|
||||||
/************************** Variable Definitions *****************************/
|
/************************** Variable Definitions *****************************/
|
||||||
extern const uint16_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
|
extern const uint16_t freqTable[L1_FRAME_MAX_HOPS];
|
||||||
extern const uint16_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
|
extern const int16_t antCalTable[L1_FRAME_MAX_HOPS][L1_ANT_NUM_CH];
|
||||||
extern const uint16_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
|
extern const uint8_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS];
|
||||||
extern const uint16_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
|
extern const uint8_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS];
|
||||||
extern const uint16_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
|
extern const uint8_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS];
|
||||||
extern const uint16_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS];
|
extern const uint8_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS];
|
||||||
extern const uint16_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS];
|
extern const uint8_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS];
|
||||||
extern const uint16_t hopPattern_1M2BPS_5MS[L1_FRAME_1M2BPS_5MS_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 *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
/************************** Function Prototypes ******************************/
|
/************************** Function Prototypes ******************************/
|
||||||
@@ -333,7 +335,7 @@ inline L1_FRAME_TYPE Phy_GetLastRecvFrameType(PHY_INST *instPtr)
|
|||||||
{
|
{
|
||||||
return L1_NONE_FRAME;
|
return L1_NONE_FRAME;
|
||||||
}
|
}
|
||||||
int32_t frame_type = (PhyRead(instPtr, COASE_FREQEST) & COASE_TYPE_MASK);
|
uint32_t frame_type = (PhyRead(instPtr, COASE_FREQEST) & COASE_TYPE_MASK);
|
||||||
switch (frame_type)
|
switch (frame_type)
|
||||||
{
|
{
|
||||||
case COASE_TYPE_2KBPS_20MS:
|
case COASE_TYPE_2KBPS_20MS:
|
||||||
@@ -423,8 +425,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)->antNo), (int32_t)L1_INIT_BEAM_NO, sizeof(PHY_RCD));
|
memset(&((*instPtr)->beamNo), (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)->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));
|
||||||
@@ -438,14 +439,15 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
bramConfigPtr = XBram_LookupConfig(phyConfig->antBramId);
|
bramConfigPtr = XBram_LookupConfig(phyConfig->antBramId);
|
||||||
if (bramConfigPtr == NULL)
|
if (bramConfigPtr == NULL)
|
||||||
{
|
{
|
||||||
Status = EDCONF;
|
Phy_Destroy(*instPtr);
|
||||||
goto init_error;
|
return EDCONF;
|
||||||
}
|
}
|
||||||
Status = XBram_CfgInitialize(&antConfigBram, bramConfigPtr,
|
Status = XBram_CfgInitialize(&antConfigBram, bramConfigPtr,
|
||||||
bramConfigPtr->CtrlBaseAddress);
|
bramConfigPtr->CtrlBaseAddress);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Phy_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Execute the BRAM driver selftest.
|
* Execute the BRAM driver selftest.
|
||||||
@@ -453,20 +455,22 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
Status = XBram_SelfTest(&antConfigBram, 0);
|
Status = XBram_SelfTest(&antConfigBram, 0);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Phy_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
bramConfigPtr = XBram_LookupConfig(phyConfig->txBramId);
|
bramConfigPtr = XBram_LookupConfig(phyConfig->txBramId);
|
||||||
if (bramConfigPtr == NULL)
|
if (bramConfigPtr == NULL)
|
||||||
{
|
{
|
||||||
Status = EDCONF;
|
Phy_Destroy(*instPtr);
|
||||||
goto init_error;
|
return EDCONF;
|
||||||
}
|
}
|
||||||
Status = XBram_CfgInitialize(&txDataBram, bramConfigPtr,
|
Status = XBram_CfgInitialize(&txDataBram, bramConfigPtr,
|
||||||
bramConfigPtr->CtrlBaseAddress);
|
bramConfigPtr->CtrlBaseAddress);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Phy_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Execute the BRAM driver selftest.
|
* Execute the BRAM driver selftest.
|
||||||
@@ -474,20 +478,22 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
Status = XBram_SelfTest(&txDataBram, 0);
|
Status = XBram_SelfTest(&txDataBram, 0);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Phy_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
bramConfigPtr = XBram_LookupConfig(phyConfig->rxBramId);
|
bramConfigPtr = XBram_LookupConfig(phyConfig->rxBramId);
|
||||||
if (bramConfigPtr == NULL)
|
if (bramConfigPtr == NULL)
|
||||||
{
|
{
|
||||||
Status = EDCONF;
|
Phy_Destroy(*instPtr);
|
||||||
goto init_error;
|
return EDCONF;
|
||||||
}
|
}
|
||||||
Status = XBram_CfgInitialize(&rxDataBram, bramConfigPtr,
|
Status = XBram_CfgInitialize(&rxDataBram, bramConfigPtr,
|
||||||
bramConfigPtr->CtrlBaseAddress);
|
bramConfigPtr->CtrlBaseAddress);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Phy_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Execute the BRAM driver selftest.
|
* Execute the BRAM driver selftest.
|
||||||
@@ -495,7 +501,8 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
Status = XBram_SelfTest(&rxDataBram, 0);
|
Status = XBram_SelfTest(&rxDataBram, 0);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Phy_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*instPtr)->antConfigAddr = antConfigBram.Config.MemBaseAddress;
|
(*instPtr)->antConfigAddr = antConfigBram.Config.MemBaseAddress;
|
||||||
@@ -509,14 +516,15 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
bramConfigPtr = XBram_LookupConfig(phyConfig->antInfoBramId);
|
bramConfigPtr = XBram_LookupConfig(phyConfig->antInfoBramId);
|
||||||
if (bramConfigPtr == NULL)
|
if (bramConfigPtr == NULL)
|
||||||
{
|
{
|
||||||
Status = EDCONF;
|
Phy_Destroy(*instPtr);
|
||||||
goto init_error;
|
return EDCONF;
|
||||||
}
|
}
|
||||||
Status = XBram_CfgInitialize(&antInfoBram, bramConfigPtr,
|
Status = XBram_CfgInitialize(&antInfoBram, bramConfigPtr,
|
||||||
bramConfigPtr->CtrlBaseAddress);
|
bramConfigPtr->CtrlBaseAddress);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Phy_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Execute the BRAM driver self test.
|
* Execute the BRAM driver self test.
|
||||||
@@ -524,7 +532,8 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
Status = XBram_SelfTest(&antInfoBram, 0);
|
Status = XBram_SelfTest(&antInfoBram, 0);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Phy_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
(*instPtr)->antInfoAddr = antInfoBram.Config.MemBaseAddress;
|
(*instPtr)->antInfoAddr = antInfoBram.Config.MemBaseAddress;
|
||||||
uint32_t phyMainCtrl = PhyRead(*instPtr, PHY_MAIN_CTRL);
|
uint32_t phyMainCtrl = PhyRead(*instPtr, PHY_MAIN_CTRL);
|
||||||
@@ -544,8 +553,8 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
xadcConfigPtr = XAdcPs_LookupConfig(phyConfig->hwXadcId);
|
xadcConfigPtr = XAdcPs_LookupConfig(phyConfig->hwXadcId);
|
||||||
if (xadcConfigPtr == NULL)
|
if (xadcConfigPtr == NULL)
|
||||||
{
|
{
|
||||||
Status = EDCONF;
|
Phy_Destroy(*instPtr);
|
||||||
goto init_error;
|
return EDCONF;
|
||||||
}
|
}
|
||||||
XAdcPs_CfgInitialize(&((*instPtr)->hwXadc), xadcConfigPtr, xadcConfigPtr->BaseAddress);
|
XAdcPs_CfgInitialize(&((*instPtr)->hwXadc), xadcConfigPtr, xadcConfigPtr->BaseAddress);
|
||||||
|
|
||||||
@@ -553,36 +562,37 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
|
|||||||
Status = XAdcPs_SelfTest(&((*instPtr)->hwXadc));
|
Status = XAdcPs_SelfTest(&((*instPtr)->hwXadc));
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto init_error;
|
Phy_Destroy(*instPtr);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disable the Channel Sequencer before configuring the Sequence registers. */
|
/* Disable the Channel Sequencer before configuring the Sequence registers. */
|
||||||
XAdcPs_SetSequencerMode(&((*instPtr)->hwXadc), XADCPS_SEQ_MODE_SAFE);
|
XAdcPs_SetSequencerMode(&((*instPtr)->hwXadc), XADCPS_SEQ_MODE_SAFE);
|
||||||
#else
|
#else
|
||||||
|
(*instPtr)->antConfigAddr = NULL;
|
||||||
|
(*instPtr)->recvDataAddr = NULL;
|
||||||
|
(*instPtr)->sendDataAddr = NULL;
|
||||||
(*instPtr)->antConfigAddr = (uintptr_t)calloc(L1_ANTCONFIG_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
|
(*instPtr)->antConfigAddr = (uintptr_t)calloc(L1_ANTCONFIG_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
|
||||||
if ((*instPtr)->antConfigAddr == (uintptr_t)NULL)
|
if ((*instPtr)->antConfigAddr == (uintptr_t)NULL)
|
||||||
{
|
{
|
||||||
Status = EDCONF;
|
Phy_Destroy(*instPtr);
|
||||||
goto init_error;
|
return EDCONF;
|
||||||
}
|
}
|
||||||
(*instPtr)->recvDataAddr = (uintptr_t)calloc(L1_TXRXDATA_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
|
(*instPtr)->recvDataAddr = (uintptr_t)calloc(L1_TXRXDATA_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
|
||||||
if ((*instPtr)->recvDataAddr == (uintptr_t)NULL)
|
if ((*instPtr)->recvDataAddr == (uintptr_t)NULL)
|
||||||
{
|
{
|
||||||
Status = EDCONF;
|
Phy_Destroy(*instPtr);
|
||||||
goto init_error;
|
return EDCONF;
|
||||||
}
|
}
|
||||||
(*instPtr)->sendDataAddr = (uintptr_t)calloc(L1_TXRXDATA_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
|
(*instPtr)->sendDataAddr = (uintptr_t)calloc(L1_TXRXDATA_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
|
||||||
if ((*instPtr)->sendDataAddr == (uintptr_t)NULL)
|
if ((*instPtr)->sendDataAddr == (uintptr_t)NULL)
|
||||||
{
|
{
|
||||||
Status = EDCONF;
|
Phy_Destroy(*instPtr);
|
||||||
goto init_error;
|
return EDCONF;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
init_error:
|
|
||||||
Phy_Destroy(*instPtr);
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -655,8 +665,8 @@ void Phy_Halt(PHY_INST *instPtr)
|
|||||||
/**
|
/**
|
||||||
* @brief Set physical layer working mode.
|
* @brief Set physical layer working mode.
|
||||||
*
|
*
|
||||||
* @param instPtr a pointer to physical instance
|
* @param instPtr physical instance
|
||||||
* @param modeCod intened mode code
|
* @param modeCod intend mode code
|
||||||
*
|
*
|
||||||
* @return SUCCESS
|
* @return SUCCESS
|
||||||
* other
|
* other
|
||||||
@@ -693,12 +703,12 @@ int32_t Phy_SetMode(PHY_INST *instPtr, PHY_MODE modeCod)
|
|||||||
/**
|
/**
|
||||||
* @brief Setup a specific timer word register in physical controller.
|
* @brief Setup a specific timer word register in physical controller.
|
||||||
*
|
*
|
||||||
* @param instPtr
|
* @param instPtr physical instance
|
||||||
* @param tmWord
|
* @param tmWord time word
|
||||||
* @param tmType
|
* @param tmType time word type
|
||||||
*
|
*
|
||||||
* @return SUCCESS
|
* @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)
|
int32_t Phy_SetTimeWord(PHY_INST *instPtr, const TIME_WORD *tmWord, PHY_TIME_WORD_TYPE tmType)
|
||||||
@@ -742,7 +752,7 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
|||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
int32_t Status;
|
int32_t Status;
|
||||||
uint32_t phyModeCtrl, hopNum;
|
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.
|
// Implement a ping-pong flow, offset always is 0 or half of buffer depth.
|
||||||
instPtr->antConfigOffset = (L1_ANTCONFIG_MAX_LEN >> 1) - instPtr->antConfigOffset;
|
instPtr->antConfigOffset = (L1_ANTCONFIG_MAX_LEN >> 1) - instPtr->antConfigOffset;
|
||||||
uint32_t antConfigAddr = instPtr->antConfigAddr + instPtr->antConfigOffset;
|
uint32_t antConfigAddr = instPtr->antConfigAddr + instPtr->antConfigOffset;
|
||||||
@@ -821,12 +831,37 @@ 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));
|
||||||
|
size_t hopIdx;
|
||||||
|
uint16_t hopFreq;
|
||||||
|
int16_t hopCal;
|
||||||
for (int32_t i = 0; i < hopNum; i++)
|
for (int32_t i = 0; i < hopNum; i++)
|
||||||
{
|
{
|
||||||
instPtr->antConfig.antFreq[0] = (uint8_t)(hopPattern[i] >> 8);
|
hopIdx = hopPattern[i];
|
||||||
instPtr->antConfig.antFreq[1] = (uint8_t)hopPattern[i];
|
|
||||||
instPtr->antConfig.rfFreq[0] = (uint8_t)(hopPattern[i] >> 8);
|
// Frequency setting
|
||||||
instPtr->antConfig.rfFreq[1] = (uint8_t)hopPattern[i];
|
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),
|
memcpy((uint8_t *)(antConfigAddr + i * ANT_COINFO_LEN),
|
||||||
dataSrcPtr, sizeof(PHY_ANT_CONFIG));
|
dataSrcPtr, sizeof(PHY_ANT_CONFIG));
|
||||||
}
|
}
|
||||||
@@ -834,13 +869,6 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
|||||||
| ((hopNum << ANT_CONFIG_NUM_SHIFT) & ANT_CONFIG_NUM_MASK)
|
| ((hopNum << ANT_CONFIG_NUM_SHIFT) & ANT_CONFIG_NUM_MASK)
|
||||||
| ((ANT_COINFO_LEN << ANT_CONFIG_LEN_SHIFT) & ANT_CONFIG_LEN_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
|
// Set antenna configs
|
||||||
PhyWrite(instPtr, ANT_CONFIG, antCtrl);
|
PhyWrite(instPtr, ANT_CONFIG, antCtrl);
|
||||||
|
|
||||||
@@ -862,7 +890,6 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
|||||||
Phy_RcdShift(&(instPtr->tor), txrxMode);
|
Phy_RcdShift(&(instPtr->tor), txrxMode);
|
||||||
Phy_RcdShift(&(instPtr->frameType), frameType);
|
Phy_RcdShift(&(instPtr->frameType), frameType);
|
||||||
// TODO:
|
// TODO:
|
||||||
Phy_RcdShift(&(instPtr->antNo), L1_INIT_ANT_NO);
|
|
||||||
Phy_RcdShift(&(instPtr->beamNo), L1_INIT_BEAM_NO);
|
Phy_RcdShift(&(instPtr->beamNo), L1_INIT_BEAM_NO);
|
||||||
Phy_RcdShift(&(instPtr->beamWd), L1_INIT_ANT_WD);
|
Phy_RcdShift(&(instPtr->beamWd), L1_INIT_ANT_WD);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
@@ -872,7 +899,7 @@ int32_t Phy_SetupNextSlot(PHY_INST *instPtr, PHY_TOR_TYPE txrxMode,
|
|||||||
/**
|
/**
|
||||||
* @brief Update physical layer status cache.
|
* @brief Update physical layer status cache.
|
||||||
*
|
*
|
||||||
* @param instPtr A pointer to physical layer control instance.
|
* @param instPtr physical layer control instance.
|
||||||
*
|
*
|
||||||
* @return NONE.
|
* @return NONE.
|
||||||
*
|
*
|
||||||
@@ -905,7 +932,8 @@ void Phy_UpdateState(PHY_INST *instPtr)
|
|||||||
/**
|
/**
|
||||||
* @brief Copy ans store the received data, if received data valid.
|
* @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
|
* @return NONE
|
||||||
*
|
*
|
||||||
@@ -931,7 +959,8 @@ void Phy_PeekRecvData(PHY_INST *instPtr, uint8_t *dataBuff)
|
|||||||
* @brief Get the received data (if valid), store it to data buffer.
|
* @brief Get the received data (if valid), store it to data buffer.
|
||||||
* and clear data valid flag.
|
* 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
|
* @return NONE
|
||||||
*
|
*
|
||||||
@@ -995,10 +1024,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 instPtr a pointer to hopping pattern buffer
|
||||||
* @param patternLen a integer indicate the length of hopping pattern.
|
|
||||||
*
|
*
|
||||||
* @return NONE
|
* @return NONE
|
||||||
*
|
*
|
||||||
@@ -1008,7 +1036,7 @@ void Phy_RefreshHwSate(PHY_INST *instPtr)
|
|||||||
ASSERT(instPtr != NULL);
|
ASSERT(instPtr != NULL);
|
||||||
uint32_t rawData;
|
uint32_t rawData;
|
||||||
#ifndef EMULATION
|
#ifndef EMULATION
|
||||||
float evalData;
|
double evalData;
|
||||||
instPtr->hwSate.isSpOk = true;
|
instPtr->hwSate.isSpOk = true;
|
||||||
// -- Update FPGA voltage status;
|
// -- Update FPGA voltage status;
|
||||||
instPtr->hwSate.spFpgaVolt = 0;
|
instPtr->hwSate.spFpgaVolt = 0;
|
||||||
@@ -1133,6 +1161,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.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.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));
|
memset(instPtr->hwSate.reserve, 0x00, sizeof(instPtr->hwSate.reserve));
|
||||||
|
|
||||||
SysMonitor_UpdateHardwareStatus(&(instPtr->hwSate));
|
SysMonitor_UpdateHardwareStatus(&(instPtr->hwSate));
|
||||||
@@ -1229,7 +1259,7 @@ double Phy_GetCoarseFreqEst(PHY_INST *instPtr)
|
|||||||
double freqEst;
|
double freqEst;
|
||||||
|
|
||||||
frameType = Phy_GetLastRecvFrameType(instPtr);
|
frameType = Phy_GetLastRecvFrameType(instPtr);
|
||||||
if (frameType > L1_1M2BPS_5MS_FRAME || frameType <= L1_NONE_FRAME)
|
if ((frameType > L1_1M2BPS_5MS_FRAME) || (frameType <= L1_NONE_FRAME))
|
||||||
{
|
{
|
||||||
return INFINITY; // FIXME
|
return INFINITY; // FIXME
|
||||||
}
|
}
|
||||||
@@ -1267,14 +1297,14 @@ double Phy_GetFineFreqEst(PHY_INST *instPtr)
|
|||||||
double freqEst;
|
double freqEst;
|
||||||
L1_FRAME_TYPE frameType;
|
L1_FRAME_TYPE frameType;
|
||||||
frameType = Phy_GetLastRecvFrameType(instPtr);
|
frameType = Phy_GetLastRecvFrameType(instPtr);
|
||||||
if (frameType > L1_1M2BPS_5MS_FRAME || frameType <= L1_NONE_FRAME)
|
if ((frameType > L1_1M2BPS_5MS_FRAME) || (frameType <= L1_NONE_FRAME))
|
||||||
{
|
{
|
||||||
return INFINITY; // FIXME
|
return INFINITY; // FIXME
|
||||||
}
|
}
|
||||||
|
|
||||||
regValue = PhyRead(instPtr, FINE_FREQEST);
|
regValue = PhyRead(instPtr, FINE_FREQEST);
|
||||||
estAbs = regValue & FINE_FREQEST_VAL_MASK;
|
estAbs = regValue & FINE_FREQEST_VAL_MASK;
|
||||||
if (frameType >= L1_200KBPS_5MS_FRAME)
|
if ((frameType >= L1_200KBPS_5MS_FRAME))
|
||||||
{
|
{
|
||||||
// 12M Rc
|
// 12M Rc
|
||||||
freqEst = 48e6 / 2048 * ((double)estAbs) / 8192.0;
|
freqEst = 48e6 / 2048 * ((double)estAbs) / 8192.0;
|
||||||
|
|||||||
@@ -34,24 +34,24 @@
|
|||||||
* @name PhysicalLayer_Common_Constant
|
* @name PhysicalLayer_Common_Constant
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define L1_NUM_ANT_NRRW_PATTERN 37
|
#define L1_NUM_ANT_NRRW_PATTERN 37U
|
||||||
#define L1_INIT_BEAM_NO 0
|
#define L1_INIT_BEAM_NO 0U
|
||||||
#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_ANT_NUM_CH 4U
|
||||||
|
|
||||||
#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_FRAME_MAX_HOPS 81
|
#define L1_FRAME_MAX_HOPS 81U
|
||||||
#define L1_FRAME_2KBPS_20MS_HOPS 1
|
#define L1_FRAME_2KBPS_20MS_HOPS 1U
|
||||||
#define L1_FRAME_2KBPS_100MS_HOPS 81
|
#define L1_FRAME_2KBPS_100MS_HOPS 81U
|
||||||
#define L1_FRAME_10KBPS_10MS_HOPS 1
|
#define L1_FRAME_10KBPS_10MS_HOPS 1U
|
||||||
#define L1_FRAME_10KBPS_20MS_HOPS 11
|
#define L1_FRAME_10KBPS_20MS_HOPS 11U
|
||||||
#define L1_FRAME_40KBPS_20MS_HOPS 19
|
#define L1_FRAME_40KBPS_20MS_HOPS 19U
|
||||||
#define L1_FRAME_40KBPS_10MS_HOPS 9
|
#define L1_FRAME_40KBPS_10MS_HOPS 9U
|
||||||
#define L1_FRAME_200KBPS_5MS_HOPS 20
|
#define L1_FRAME_200KBPS_5MS_HOPS 20U
|
||||||
#define L1_FRAME_1M2BPS_5MS_HOPS 20
|
#define L1_FRAME_1M2BPS_5MS_HOPS 20U
|
||||||
#define PHY_LOG_EXPIRE 40 // 50*5ms
|
#define PHY_LOG_EXPIRE 40U // 50*5ms
|
||||||
/** @} */
|
/** @} */
|
||||||
/***************** Macros (Inline Functions) Definitions *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
/**************************** Type Definitions *******************************/
|
/**************************** Type Definitions *******************************/
|
||||||
@@ -111,6 +111,10 @@ typedef struct
|
|||||||
uint8_t rfMonitor; ///< Receive monitor, 0-normal, 1-switch to monitor port
|
uint8_t rfMonitor; ///< Receive monitor, 0-normal, 1-switch to monitor port
|
||||||
uint8_t rfReserved0; ///< reserved for further use
|
uint8_t rfReserved0; ///< reserved for further use
|
||||||
uint8_t rfReserved1; ///< 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;
|
} PHY_ANT_CONFIG;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -229,7 +233,6 @@ 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 antNo; ///< antenna number record
|
|
||||||
PHY_RCD beamNo; ///< beam number record
|
PHY_RCD beamNo; ///< beam number record
|
||||||
PHY_RCD beamWd; ///< beam width record
|
PHY_RCD beamWd; ///< beam width record
|
||||||
PHY_RCD tor; ///< tx rx state record
|
PHY_RCD tor; ///< tx rx state record
|
||||||
@@ -303,7 +306,7 @@ 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);
|
void Phy_SetBeamTable(PHY_INST *instPtr, PHY_ANT_ANGLE *table, uint32_t offset);
|
||||||
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, PHY_ANT_BEAM_WIDTH beamWidth);
|
int32_t Phy_SetBeamNo(PHY_INST *instPtr, size_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);
|
||||||
/** @} PhysicalLayer_AntennaControl*/
|
/** @} PhysicalLayer_AntennaControl*/
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/***************** Macros (Inline Functions) Definitions *********************/
|
/***************** Macros (Inline Functions) Definitions *********************/
|
||||||
#define PhyRead(instPtr, addr) IO_In32((instPtr)->phyCofig.baseAddr + addr)
|
#define PhyRead(instPtr, addr) IO_In32((instPtr)->phyCofig.baseAddr + (addr))
|
||||||
#define PhyWrite(instPtr, addr, value) IO_Out32((instPtr)->phyCofig.baseAddr + addr, value)
|
#define PhyWrite(instPtr, addr, value) IO_Out32((instPtr)->phyCofig.baseAddr + (addr), (value))
|
||||||
|
|
||||||
/************************** Constant Definitions *****************************/
|
/************************** Constant Definitions *****************************/
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ void SysMonitor_Destroy(void)
|
|||||||
*/
|
*/
|
||||||
void SysMonitor_UpdateSysinfo(const SYSINFO *info)
|
void SysMonitor_UpdateSysinfo(const SYSINFO *info)
|
||||||
{
|
{
|
||||||
|
ASSERT(info != NULL);
|
||||||
uint8_t buffIndx;
|
uint8_t buffIndx;
|
||||||
buffIndx = GetWritable(sysMonitorInst->sysInfoCtrl);
|
buffIndx = GetWritable(sysMonitorInst->sysInfoCtrl);
|
||||||
sysMonitorInst->sysInfoCtrl.wBusy = buffIndx;
|
sysMonitorInst->sysInfoCtrl.wBusy = buffIndx;
|
||||||
@@ -143,6 +144,7 @@ void SysMonitor_UpdateSysinfo(const SYSINFO *info)
|
|||||||
void SysMonitor_GetSysinfo(SYSINFO *info)
|
void SysMonitor_GetSysinfo(SYSINFO *info)
|
||||||
{
|
{
|
||||||
ASSERT(sysMonitorInst != NULL);
|
ASSERT(sysMonitorInst != NULL);
|
||||||
|
ASSERT(info != NULL);
|
||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->sysInfoCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->sysInfoCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
@@ -201,9 +203,13 @@ void SysMonitor_GetSendPayload(uint8_t *buff, uint32_t *id, size_t len)
|
|||||||
uint8_t buffIndx, buffIndex_old;
|
uint8_t buffIndx, buffIndex_old;
|
||||||
buffIndex_old = sysMonitorInst->sendCtrl.rBusy;
|
buffIndex_old = sysMonitorInst->sendCtrl.rBusy;
|
||||||
if (buffIndex_old != BUFF_NONE)
|
if (buffIndex_old != BUFF_NONE)
|
||||||
|
{
|
||||||
buffIndx = buffIndex_old; // Keep it busy
|
buffIndx = buffIndex_old; // Keep it busy
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
buffIndx = GetReadable(sysMonitorInst->sendCtrl);
|
buffIndx = GetReadable(sysMonitorInst->sendCtrl);
|
||||||
|
}
|
||||||
sysMonitorInst->sendCtrl.rBusy = buffIndx;
|
sysMonitorInst->sendCtrl.rBusy = buffIndx;
|
||||||
if (sysMonitorInst->send[buffIndx].dataId != DATA_ID_NONE)
|
if (sysMonitorInst->send[buffIndx].dataId != DATA_ID_NONE)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,12 +54,12 @@
|
|||||||
// #define IS_PL_VALID(x) (x <= 1.03 && x >= 0.97)
|
// #define IS_PL_VALID(x) (x <= 1.03 && x >= 0.97)
|
||||||
// #define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
// #define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
||||||
// #define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.97)
|
// #define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.97)
|
||||||
#define IS_PS_VALID(x) (x <= 1.05 && x >= 0.95)
|
#define IS_PS_VALID(x) ((x) <= 1.1 && (x) >= 0.9)
|
||||||
#define IS_PSAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
#define IS_PSAUX_VALID(x) ((x) <= 2.0 && (x) >= 1.6)
|
||||||
#define IS_DDR_VALID(x) (x <= 1.89 && x >= 1.14)
|
#define IS_DDR_VALID(x) ((x) <= 1.7 && (x) >= 1.3)
|
||||||
#define IS_PL_VALID(x) (x <= 1.03 && x >= 0.96)
|
#define IS_PL_VALID(x) (x <= 1.1 && (x) >= 0.9)
|
||||||
#define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
|
#define IS_PLAUX_VALID(x) ((x) <= 2.0 && (x) >= 1.6)
|
||||||
#define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.96)
|
#define IS_BRAM_VALID(x) ((x) <= 1.1 && (x) >= 0.9)
|
||||||
|
|
||||||
#define CLK_SP_PLL0_LOCK BIT(0)
|
#define CLK_SP_PLL0_LOCK BIT(0)
|
||||||
#define CLK_SP_PLL1_LOCK BIT(2)
|
#define CLK_SP_PLL1_LOCK BIT(2)
|
||||||
@@ -194,16 +194,17 @@ typedef struct __attribute__((packed))
|
|||||||
uint8_t spFpgaVolt; ///< Signal processor voltage state indicator
|
uint8_t spFpgaVolt; ///< Signal processor voltage state indicator
|
||||||
uint8_t spClkState; ///< Signal processor clock state indicator
|
uint8_t spClkState; ///< Signal processor clock state indicator
|
||||||
uint8_t spAdLockState; ///< Signal processor adc lock state indicator
|
uint8_t spAdLockState; ///< Signal processor adc lock state indicator
|
||||||
uint8_t spAdTemp_0; ///< Signal processor adc0 temperature
|
int8_t spAdTemp_0; ///< Signal processor adc0 temperature
|
||||||
uint8_t spAdTemp_1; ///< Signal processor adc1 temperature
|
int8_t spAdTemp_1; ///< Signal processor adc1 temperature
|
||||||
uint8_t spFpgaTemp; ///< Signal processor FPGA temperature
|
int8_t spFpgaTemp; ///< Signal processor FPGA temperature
|
||||||
// -- Antenna status
|
// -- Antenna status
|
||||||
uint8_t antVolt; ///< Antenna voltage state indicator
|
uint8_t antVolt; ///< Antenna voltage state indicator
|
||||||
uint8_t antTemp; ///< Antenna rf temperature
|
int8_t antTemp; ///< Antenna rf temperature
|
||||||
uint8_t antPll; ///< Antenna rf lock state indicator
|
uint8_t antPll; ///< Antenna rf lock state indicator
|
||||||
uint8_t antMgc0; ///< Antenna rf mgc0~1 indicator
|
uint8_t antMgc0; ///< Antenna rf mgc0~1 indicator
|
||||||
uint8_t antMgc1; ///< Antenna rf mgc2~3 indicator
|
uint8_t antMgc1; ///< Antenna rf mgc2~3 indicator
|
||||||
uint8_t reserve[2];
|
uint8_t phyId;
|
||||||
|
uint8_t reserve[1];
|
||||||
} HWSTATE;
|
} HWSTATE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
* @addtogroup SystemBus
|
* @addtogroup SystemBus
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/***************************** Include Files *********************************/
|
/***************************** Include Files *********************************/
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -657,7 +658,7 @@ int32_t SystemBus_MakeResp(SYSBUS *instPtr)
|
|||||||
* @param InstPtr A double pointer to System Bus instance.
|
* @param InstPtr A double pointer to System Bus instance.
|
||||||
* @param config A pointer to System Bus configurations.
|
* @param config A pointer to System Bus configurations.
|
||||||
*
|
*
|
||||||
* @return None.
|
* @return Error code.
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
|
int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
|
||||||
@@ -669,7 +670,7 @@ int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
|
|||||||
(*instPtr) = malloc(sizeof(SYSBUS));
|
(*instPtr) = malloc(sizeof(SYSBUS));
|
||||||
if ((*instPtr) == NULL)
|
if ((*instPtr) == NULL)
|
||||||
{
|
{
|
||||||
return FAILURE;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
(*instPtr)->rxQueue = NULL;
|
(*instPtr)->rxQueue = NULL;
|
||||||
(*instPtr)->txQueue = NULL;
|
(*instPtr)->txQueue = NULL;
|
||||||
@@ -683,29 +684,45 @@ int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
|
|||||||
Status = SysbusUart_Init(&((*instPtr)->uartInst), &uartConfig);
|
Status = SysbusUart_Init(&((*instPtr)->uartInst), &uartConfig);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
Status = ENOMEM;
|
SystemBus_Destroy(*instPtr);
|
||||||
goto sysbus_init_error;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
if (CircQueueCreate(&((*instPtr)->txQueue), (*instPtr)->config.txQueueMax) == false)
|
if (CircQueueCreate(&((*instPtr)->txQueue), (*instPtr)->config.txQueueMax) == false)
|
||||||
{
|
{
|
||||||
Status = ENOMEM;
|
SystemBus_Destroy(*instPtr);
|
||||||
goto sysbus_init_error;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
if (CircQueueCreate(&((*instPtr)->rxQueue), (*instPtr)->config.rxQueueMax) == false)
|
if (CircQueueCreate(&((*instPtr)->rxQueue), (*instPtr)->config.rxQueueMax) == false)
|
||||||
{
|
{
|
||||||
Status = ENOMEM;
|
SystemBus_Destroy(*instPtr);
|
||||||
goto sysbus_init_error;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
(*instPtr)->isRxDone = false; // nothing received.
|
(*instPtr)->isRxDone = false; // nothing received.
|
||||||
(*instPtr)->isTxDone = true; // nothing to be sent.
|
(*instPtr)->isTxDone = true; // nothing to be sent.
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
sysbus_init_error:
|
|
||||||
free((*instPtr)->uartInst);
|
/*****************************************************************************/
|
||||||
free((*instPtr)->txQueue);
|
/**
|
||||||
free((*instPtr)->rxQueue);
|
* @brief Destroy System Bus instance.
|
||||||
free(*instPtr);
|
*
|
||||||
return Status;
|
* @param InstPtr A pointer to System Bus instance.
|
||||||
|
*
|
||||||
|
* @return None.
|
||||||
|
*
|
||||||
|
******************************************************************************/
|
||||||
|
void SystemBus_Destroy(SYSBUS *instPtr)
|
||||||
|
{
|
||||||
|
if (instPtr == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(instPtr->uartInst);
|
||||||
|
free(instPtr->txQueue);
|
||||||
|
free(instPtr->rxQueue);
|
||||||
|
free(instPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -747,19 +764,17 @@ int32_t SystemBus_RxIntrHandler(SYSBUS *instPtr)
|
|||||||
Status = SysbusUart_Recv(instPtr->uartInst, sysbusReq);
|
Status = SysbusUart_Recv(instPtr->uartInst, sysbusReq);
|
||||||
if (Status != SUCCESS)
|
if (Status != SUCCESS)
|
||||||
{
|
{
|
||||||
goto recv_error;
|
free(sysbusReq);
|
||||||
|
return Status;
|
||||||
}
|
}
|
||||||
if (CircQueuePush(instPtr->rxQueue, (void *)sysbusReq) == false)
|
if (CircQueuePush(instPtr->rxQueue, (void *)sysbusReq) == false)
|
||||||
{
|
{
|
||||||
DBG_ERROR("SystemBus::RX Queue overflowed!\n");
|
DBG_ERROR("SystemBus::RX Queue overflowed!\n");
|
||||||
Status = EQUEUE;
|
free(sysbusReq);
|
||||||
goto recv_error;
|
return EQUEUE;
|
||||||
}
|
}
|
||||||
instPtr->isRxDone = false; // another reception is undergoing.
|
instPtr->isRxDone = false; // another reception is undergoing.
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
recv_error:
|
|
||||||
free(sysbusReq);
|
|
||||||
return Status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} SystemBus*/
|
/** @} SystemBus*/
|
||||||
@@ -53,13 +53,14 @@ typedef struct
|
|||||||
SYSBUS_UART *uartInst; ///< physical uart controller instance
|
SYSBUS_UART *uartInst; ///< physical uart controller instance
|
||||||
CIRC_QUEUE *txQueue; ///< tx queue
|
CIRC_QUEUE *txQueue; ///< tx queue
|
||||||
CIRC_QUEUE *rxQueue; ///< rx queue
|
CIRC_QUEUE *rxQueue; ///< rx queue
|
||||||
bool isRxDone; ///< tx done indicator
|
bool isTxDone; ///< tx done indicator
|
||||||
bool isTxDone; ///< rx done indicator
|
bool isRxDone; ///< rx done indicator
|
||||||
} SYSBUS;
|
} SYSBUS;
|
||||||
|
|
||||||
/************************** Function Prototypes ******************************/
|
/************************** Function Prototypes ******************************/
|
||||||
|
|
||||||
int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config);
|
int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config);
|
||||||
|
void SystemBus_Destroy(SYSBUS *instPtr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup SystemBus_Protocol_Routine
|
* @defgroup SystemBus_Protocol_Routine
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
* Lab of Communication and Network
|
* Lab of Communication and Network
|
||||||
*
|
*
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup SystemBus
|
* @addtogroup SystemBus
|
||||||
* @{
|
* @{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ bool CircQueueCreate(CIRC_QUEUE **q, uint32_t queueCapacity)
|
|||||||
ASSERT(q != NULL);
|
ASSERT(q != NULL);
|
||||||
CIRC_QUEUE *queue;
|
CIRC_QUEUE *queue;
|
||||||
queue = malloc(sizeof(CIRC_QUEUE));
|
queue = malloc(sizeof(CIRC_QUEUE));
|
||||||
if (!queue)
|
if (queue == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -65,16 +65,14 @@ bool CircQueueCreate(CIRC_QUEUE **q, uint32_t queueCapacity)
|
|||||||
queue->data = malloc(queueCapacity * sizeof(void *));
|
queue->data = malloc(queueCapacity * sizeof(void *));
|
||||||
if (queue->data == NULL)
|
if (queue->data == NULL)
|
||||||
{
|
{
|
||||||
goto error;
|
free(queue);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
queue->bounds = queueCapacity;
|
queue->bounds = queueCapacity;
|
||||||
queue->nelts = 0;
|
queue->nelts = 0;
|
||||||
queue->in = 0;
|
queue->in = 0;
|
||||||
queue->out = 0;
|
queue->out = 0;
|
||||||
return true;
|
return true;
|
||||||
error:
|
|
||||||
free(queue);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,14 +1,45 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
|
# GE Software
|
||||||
GE_TXATT=0
|
GE_TXATT=0
|
||||||
GE_RXATT=25
|
GE_RXATT=25
|
||||||
|
|
||||||
DST_DIR=`pwd`
|
DST_DIR="$(pwd)/handout"
|
||||||
PROJECT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && 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 ${DST_DIR}
|
||||||
cp -rL $PROJECT_DIR/df_datalink_ge/src $DST_DIR/df_datalink_ge
|
|
||||||
|
|
||||||
cd $DST_DIR/df_datalink_ge/networking/phy_layer
|
mkdir -p ${DST_DIR}
|
||||||
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
|
echo "Creating <df_datalink_ge>..."
|
||||||
|
cp -rL $PROJECT_DIR/df_datalink_ge/src $DST_DIR/df_datalink_ge
|
||||||
|
sed -i'' -e "s/antConfig->rfTxMgc = 0;/antConfig->rfTxMgc = $GE_TXATT;/g" $DST_DIR/df_datalink_ge/networking/phy_layer/phy_antenna.c
|
||||||
|
sed -i'' -e "s/antConfig->rcvMgc = 0;/antConfig->rcvMgc = $GE_RXATT;/g" $DST_DIR/df_datalink_ge/networking/phy_layer/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]+')
|
||||||
|
type=$(echo "$key" | grep -o -E '(LJ)|(JG)')
|
||||||
|
echo "Creating <$projName>..."
|
||||||
|
cp -rL $PROJECT_DIR/df_datalink_sp/src $DST_DIR/$projName
|
||||||
|
|
||||||
|
# substitute ID
|
||||||
|
if [ $type == "LJ" ]; then
|
||||||
|
sed -i'' "s/#define PHY_DEVICE_ID 0/#define PHY_DEVICE_ID (0x$id | 0x80)/g" $DST_DIR/$projName/config/app_config.h
|
||||||
|
elif [ $type == "JG" ]; then
|
||||||
|
sed -i'' "s/#define PHY_DEVICE_ID 0/#define PHY_DEVICE_ID (0x$id | 0x00)/g" $DST_DIR/$projName/config/app_config.h
|
||||||
|
else
|
||||||
|
echo "Unrecognized node Type [$type] ID [$id]"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# substitute 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]}/
|
||||||
|
}" $DST_DIR/$projName/networking/phy_layer/phy_antenna.c
|
||||||
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user