15 Commits
Author SHA1 Message Date
Gatsby Van a24d8e8d35 update (GJB8114) 2024-07-04 11:01:59 +08:00
Gatsby Van 3e7060965e misc update: make it more conform with GJB-8114 2024-06-27 13:37:51 +08:00
Gatsby Van fd9e7f54eb update make file 2024-06-25 11:00:10 +08:00
Gatsby Van f8212892a2 avoid usage of goto` 2024-06-25 10:59:54 +08:00
bit-cyber-fh 884d9bcca9 update hardware validation constrain 2024-06-12 10:28:38 +08:00
Gatsby Van 5af74419e0 update calibration data script. 2024-06-10 21:46:03 +08:00
Gatsby Van f0b28b55fb update calibration data 2024-06-10 21:23:59 +08:00
bit-cyber-fh 97b8f28e70 update calibration data (add LJ02) 2024-05-23 18:23:06 +08:00
bit-cyber-fh 608bbf1cfa add LJ06 calibration data 2024-05-23 18:16:56 +08:00
bit-cyber-fh 711cb50658 Merge branch 'master' of http://nas.gatsby.icu:3000/gatsby/df_datalink 2024-05-23 18:16:15 +08:00
bit-cyber-fh 746e87df86 add calibration data 2024-05-23 18:14:24 +08:00
bit-cyber-fh fa24e0f109 add 9361 rx gain config 2024-05-23 18:11:36 +08:00
bit-cyber-fh 40fdf13fd1 Revert "misc update"
This reverts commit 268e724c72ca625fadaad6897a273ffc21e3f723.
2024-05-23 18:06:34 +08:00
bit-cyber-fh 55cd53b746 misc update 2024-05-23 18:03:29 +08:00
bit-cyber-fh c7c81ddb83 clear calibration data 2024-05-23 17:42:42 +08:00
52 changed files with 724 additions and 573 deletions
+292 -247
View File
@@ -1,90 +1,90 @@
declare -A calMap
calMap[JG01]="\{\n\
\{ 0, 2525, -7533, -6846\}, \{ 0, 12726, -7818, -6860\},\n\
\{ 0, 2490, -7836, -6907\}, \{ 0, 4479, -7716, -6837\},\n\
\{ 0, 6409, -7770, -6776\}, \{ 0, 14616, -7977, -6816\},\n\
\{ 0, -22557, -8002, -6911\}, \{ 0, -22587, -8121, -6918\},\n\
\{ 0, -1124, -8123, -7030\}, \{ 0, -152, -8219, -7042\},\n\
\{ 0, 1823, -8209, -7130\}, \{ 0, 1790, -8290, -7214\},\n\
\{ 0, 1669, -8362, -7283\}, \{ 0, 1634, -8459, -7276\},\n\
\{ 0, 1615, -8315, -7415\}, \{ 0, 1698, -8168, -7366\},\n\
\{ 0, 1535, -8285, -7520\}, \{ 0, 1619, -8285, -7532\},\n\
\{ 0, 1609, -8201, -7693\}, \{ 0, 1671, -8145, -7769\},\n\
\{ 0, 1676, -8135, -7805\}, \{ 0, 951, -10279, -8871\},\n\
\{ 0, 976, -10235, -8978\}, \{ 0, 1118, -10127, -9019\},\n\
\{ 0, 1175, -10003, -9007\}, \{ 0, 1386, -9847, -9039\},\n\
\{ 0, 1535, -9572, -9058\}, \{ 0, 1729, -9493, -9006\},\n\
\{ 0, -1158, -9312, -9003\}, \{ 0, 23771, -9147, -8928\},\n\
\{ 0, 20733, -9074, -8924\}, \{ 0, 2455, -8841, -8886\},\n\
\{ 0, 2622, -8718, -8735\}, \{ 0, 2791, -8615, -8705\},\n\
\{ 0, 2861, -8168, -8331\}, \{ 0, 3076, -8091, -8218\},\n\
\{ 0, 3257, -8046, -8100\}, \{ 0, 3331, -7923, -8073\},\n\
\{ 0, 3396, -7826, -7994\}, \{ 0, 3478, -7842, -8016\},\n\
\{ 0, 3518, -7846, -7765\}, \{ 0, 3585, -7753, -7715\},\n\
\{ 0, 150, -8145, -8591\}, \{ 0, 192, -8090, -8570\},\n\
\{ 0, 207, -8150, -8597\}, \{ 0, 178, -8142, -8656\},\n\
\{ 0, 89, -8557, -8688\}, \{ 0, 107, -8614, -8733\},\n\
\{ 0, 194, -8605, -8782\}, \{ 0, 153, -8655, -8881\},\n\
\{ 0, 70, -8615, -8952\}, \{ 0, 35, -8596, -9148\},\n\
\{ 0, 49, -8636, -9286\}, \{ 0, 6, -8587, -9435\},\n\
\{ 0, -51, -8540, -9549\}, \{ 0, -65, -8588, -9700\},\n\
\{ 0, -55, -8503, -9820\}, \{ 0, -20, -8414, -9907\},\n\
\{ 0, -112, -8481, -10031\}, \{ 0, -69, -8535, -10185\},\n\
\{ 0, 2, -8550, -10052\}, \{ 0, -1, -8493, -10291\},\n\
\{ 0, -73, -8441, -10380\}, \{ 0, 1958, -6930, -8295\},\n\
\{ 0, -1148, -6939, -8396\}, \{ 0, 1915, -6784, -8370\},\n\
\{ 0, 1871, -6970, -8514\}, \{ 0, 1821, -6974, -8387\},\n\
\{ 0, 1781, -6906, -8431\}, \{ 0, 1736, -6897, -8462\},\n\
\{ 0, 1664, -7024, -8377\}, \{ 0, 1629, -7127, -8436\},\n\
\{ 0, 1603, -7148, -8528\}, \{ 0, 1577, -7198, -8500\},\n\
\{ 0, 1528, -7311, -8512\}, \{ 0, 1577, -7390, -8570\},\n\
\{ 0, 1616, -7436, -8572\}, \{ 0, 1589, -7597, -8590\},\n\
\{ 0, 1722, -7550, -8568\}, \{ 0, 1741, -7691, -8449\},\n\
\{ 0, 1767, -7775, -8328\}, \n\
\{ 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, 1573, -6646, -6900\}, \{ 0, 1251, -7021, -7119\},\n\
\{ 0, 1157, -7139, -7184\}, \{ 0, 970, -7380, -7280\},\n\
\{ 0, 803, -7646, -7340\}, \{ 0, 243, -7702, -7475\},\n\
\{ 0, 116, -7899, -7666\}, \{ 0, 345, -7915, -7779\},\n\
\{ 0, 257, -8072, -7835\}, \{ 0, 63, -8061, -7871\},\n\
\{ 0, -40, -8151, -7949\}, \{ 0, -144, -8363, -8066\},\n\
\{ 0, -184, -8320, -8111\}, \{ 0, -360, -8458, -8205\},\n\
\{ 0, -426, -8583, -8238\}, \{ 0, -444, -8534, -8338\},\n\
\{ 0, -451, -8508, -8371\}, \{ 0, -610, -8581, -8378\},\n\
\{ 0, -605, -8582, -8381\}, \{ 0, -1401, -8503, -8391\},\n\
\{ 0, -2160, -8656, -8346\}, \{ 0, 243, -9749, -9637\},\n\
\{ 0, -503, -9663, -9572\}, \{ 0, -444, -9526, -9554\},\n\
\{ 0, -495, -9581, -9559\}, \{ 0, -463, -9515, -9427\},\n\
\{ 0, -1209, -9399, -9343\}, \{ 0, -356, -9263, -9275\},\n\
\{ 0, -200, -9145, -9160\}, \{ 0, -110, -9062, -9013\},\n\
\{ 0, -165, -9138, -8950\}, \{ 0, -104, -9094, -8849\},\n\
\{ 0, -744, -9062, -8679\}, \{ 0, -743, -9084, -8557\},\n\
\{ 0, -613, -8622, -8069\}, \{ 0, -492, -8651, -7949\},\n\
\{ 0, 76, -8666, -7826\}, \{ 0, 362, -8890, -7855\},\n\
\{ 0, -204, -8686, -7668\}, \{ 0, -305, -8955, -7710\},\n\
\{ 0, -199, -8941, -7435\}, \{ 0, -141, -8992, -7377\},\n\
\{ 0, -1015, -8907, -7741\}, \{ 0, -886, -8961, -7784\},\n\
\{ 0, -594, -9151, -7921\}, \{ 0, -875, -9062, -7860\},\n\
\{ 0, -1280, -9528, -7885\}, \{ 0, -379, -9555, -8104\},\n\
\{ 0, -291, -9633, -8172\}, \{ 0, -1145, -9625, -8226\},\n\
\{ 0, -1437, -9653, -8314\}, \{ 0, -1372, -9610, -8489\},\n\
\{ 0, -208, -9649, -8693\}, \{ 0, -202, -9527, -8755\},\n\
\{ 0, 120, -9542, -8873\}, \{ 0, 126, -9448, -9003\},\n\
\{ 0, 167, -9519, -9142\}, \{ 0, 459, -9523, -9194\},\n\
\{ 0, 41, -9266, -9117\}, \{ 0, 189, -9303, -9236\},\n\
\{ 0, 7, -9305, -9289\}, \{ 0, -32, -9342, -9391\},\n\
\{ 0, -106, -9252, -9433\}, \{ 0, -195, -9450, -7698\},\n\
\{ 0, -84, -9434, -7715\}, \{ 0, 126, -9365, -7699\},\n\
\{ 0, 244, -9474, -7798\}, \{ 0, 112, -9616, -7895\},\n\
\{ 0, 514, -9631, -7921\}, \{ 0, 468, -9609, -7939\},\n\
\{ 0, -209, -9770, -7983\}, \{ 0, -329, -9925, -8028\},\n\
\{ 0, -845, -9918, -8117\}, \{ 0, 44, -9921, -8106\},\n\
\{ 0, 251, -10042, -8254\}, \{ 0, 277, -10008, -8327\},\n\
\{ 0, 737, -10139, -8391\}, \{ 0, 1260, -10272, -8496\},\n\
\{ 0, -17449, -10172, -8508\}, \{ 0, -6484, -10284, -8635\},\n\
\{ 0, 541, -10256, -8560\}, \n\
\{ 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\
@@ -176,135 +176,179 @@ calMap[JG05]="\{\n\
};"
calMap[JG06]="\{\n\
\{ 0, -3193, -1212, 1843\}, \{ 0, -3191, -1331, 1701\},\n\
\{ 0, -3257, -1489, 1654\}, \{ 0, -3460, -1572, 1522\},\n\
\{ 0, -3552, -1697, 1526\}, \{ 0, -3709, -1915, 1292\},\n\
\{ 0, -3824, -2028, 1254\}, \{ 0, -3932, -2082, 1069\},\n\
\{ 0, -3929, -2154, 1109\}, \{ 0, -4073, -2215, 949\},\n\
\{ 0, -4078, -2261, 970\}, \{ 0, -3980, -2076, 1035\},\n\
\{ 0, -3976, -2215, 807\}, \{ 0, -4119, -2390, 631\},\n\
\{ 0, -3947, -1939, 778\}, \{ 0, -3860, -1811, 773\},\n\
\{ 0, -3941, -2073, 812\}, \{ 0, -4011, -2152, 603\},\n\
\{ 0, -4004, -2293, 666\}, \{ 0, -3763, -1990, 981\},\n\
\{ 0, -3795, -2080, 955\}, \{ 0, -5422, -4014, -3352\},\n\
\{ 0, -5334, -3839, -3198\}, \{ 0, -5003, -3704, -3127\},\n\
\{ 0, -4923, -3459, -2822\}, \{ 0, -4880, -3634, -2927\},\n\
\{ 0, -4626, -3279, -2818\}, \{ 0, -4459, -3158, -2737\},\n\
\{ 0, -4451, -3021, -2714\}, \{ 0, -4232, -2966, -2584\},\n\
\{ 0, -4121, -2834, -2596\}, \{ 0, -3976, -2641, -2334\},\n\
\{ 0, -3794, -2439, -2238\}, \{ 0, -3675, -2262, -2175\},\n\
\{ 0, -3362, -1706, -1623\}, \{ 0, -3528, -2164, -1984\},\n\
\{ 0, -3152, -1630, -1687\}, \{ 0, -3263, -1802, -1695\},\n\
\{ 0, -2947, -1336, -1531\}, \{ 0, -3096, -1405, -1527\},\n\
\{ 0, -3166, -1540, -1558\}, \{ 0, -3138, -1467, -1543\},\n\
\{ 0, -903, 658, -935\}, \{ 0, -828, 762, -1026\},\n\
\{ 0, -550, 1350, -713\}, \{ 0, -829, 1110, -1164\},\n\
\{ 0, -752, 1063, -1160\}, \{ 0, -705, 1128, -1506\},\n\
\{ 0, -659, 1257, -1704\}, \{ 0, -719, 1290, -1965\},\n\
\{ 0, -544, 1695, -1719\}, \{ 0, -687, 1528, -2183\},\n\
\{ 0, -478, -21223, -2095\}, \{ 0, -653, 1741, -2397\},\n\
\{ 0, -651, 1813, -2513\}, \{ 0, -511, -21073, -2543\},\n\
\{ 0, -499, -23598, -2642\}, \{ 0, -851, 1982, -2660\},\n\
\{ 0, -872, 1961, -2673\}, \{ 0, -810, 2043, -2845\},\n\
\{ 0, -1060, 1924, -2732\}, \{ 0, -1115, -3044, -2581\},\n\
\{ 0, -1129, 2014, -2828\}, \{ 0, 731, 4892, 234\},\n\
\{ 0, 570, 4718, 22\}, \{ 0, 100, 4534, -37\},\n\
\{ 0, 254, 4653, -65\}, \{ 0, 182, 4873, 90\},\n\
\{ 0, 164, 4680, -74\}, \{ 0, 148, 4590, -196\},\n\
\{ 0, 208, 4540, -186\}, \{ 0, 250, 4615, -126\},\n\
\{ 0, 308, 4559, -37\}, \{ 0, 409, 4640, -129\},\n\
\{ 0, 474, 4646, -81\}, \{ 0, 388, 4486, -12\},\n\
\{ 0, 513, 4546, -96\}, \{ 0, 673, 4704, 72\},\n\
\{ 0, 509, 4312, -42\}, \{ 0, 584, 4564, -44\},\n\
\{ 0, 672, 4597, -120\}, \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, 3306, -5061, -13611\}, \{ 0, 3049, -4933, -13418\},\n\
\{ 0, 2843, -4962, -13208\}, \{ 0, 2486, -5123, -13136\},\n\
\{ 0, 2205, -5473, -13265\}, \{ 0, 1928, -5988, -13506\},\n\
\{ 0, 1513, -6709, -13935\}, \{ 0, 1546, -7568, -14632\},\n\
\{ 0, 1468, -8336, -15205\}, \{ 0, 1509, -8794, -15543\},\n\
\{ 0, 1528, -8973, -15639\}, \{ 0, 1768, -8853, -15558\},\n\
\{ 0, 1854, -8520, -15319\}, \{ 0, 2002, -7988, -14884\},\n\
\{ 0, 2042, -7457, -14526\}, \{ 0, 2193, -7051, -14249\},\n\
\{ 0, 2132, -6802, -14131\}, \{ 0, 2334, -6767, -14073\},\n\
\{ 0, 2332, -6824, -14227\}, \{ 0, 2407, -7012, -14338\},\n\
\{ 0, 2424, -7273, -14748\}, \{ 0, 1718, -10180, -16828\},\n\
\{ 0, 1928, -10432, -17197\}, \{ 0, 2107, -10502, -17293\},\n\
\{ 0, 2327, -10335, -17211\}, \{ 0, 2557, -9919, -16856\},\n\
\{ 0, 2665, -9220, -16289\}, \{ 0, 2983, -8285, -15322\},\n\
\{ 0, 3093, -7289, -14604\}, \{ 0, 3304, -6536, -13885\},\n\
\{ 0, 3407, -6161, -13705\}, \{ 0, 3661, -6183, -13598\},\n\
\{ 0, 3822, -6287, -13834\}, \{ 0, 3895, -6650, -14020\},\n\
\{ 0, 4111, -6621, -14034\}, \{ 0, 4166, -7000, -14249\},\n\
\{ 0, 4359, -7249, -14543\}, \{ 0, 4517, -7372, -14492\},\n\
\{ 0, 4690, -7235, -14442\}, \{ 0, 4726, -7000, -14150\},\n\
\{ 0, 4733, -6447, -13781\}, \{ 0, 4759, -5776, -13242\},\n\
\{ 0, 4952, -5584, -11867\}, \{ 0, 4956, -5281, -11959\},\n\
\{ 0, 4989, -5306, -12400\}, \{ 0, 5018, -5623, -12991\},\n\
\{ 0, 5109, -6646, -13788\}, \{ 0, 5286, -7245, -14517\},\n\
\{ 0, 5265, -7781, -15215\}, \{ 0, 5337, -8198, -15738\},\n\
\{ 0, 5185, -8507, -16106\}, \{ 0, 5238, -8605, -16296\},\n\
\{ 0, 4984, -8648, -16398\}, \{ 0, 4892, -8510, -16338\},\n\
\{ 0, 4755, -8181, -16074\}, \{ 0, 4728, -7720, -15674\},\n\
\{ 0, 4671, -7183, -15300\}, \{ 0, 4673, -6820, -15154\},\n\
\{ 0, 4608, -6671, -15163\}, \{ 0, 4730, -6867, -15411\},\n\
\{ 0, 4841, -7249, -15716\}, \{ 0, 4945, -7583, -15995\},\n\
\{ 0, 4855, -8092, -16198\}, \{ 0, 5183, -8078, -14677\},\n\
\{ 0, 5069, -8370, -14651\}, \{ 0, 4786, -8613, -14604\},\n\
\{ 0, 4567, -8865, -14570\}, \{ 0, 4417, -9059, -14590\},\n\
\{ 0, 4347, -9189, -14516\}, \{ 0, 4180, -9222, -14315\},\n\
\{ 0, 4076, -9148, -14113\}, \{ 0, 4036, -9148, -13980\},\n\
\{ 0, 4057, -9343, -14037\}, \{ 0, 4073, -9499, -14209\},\n\
\{ 0, 4109, -9701, -14466\}, \{ 0, 4200, -9811, -14607\},\n\
\{ 0, 4245, -9975, -14787\}, \{ 0, 4320, -9969, -14682\},\n\
\{ 0, 4147, -9974, -14613\}, \{ 0, 4026, -9853, -14365\},\n\
\{ 0, 3899, -9675, -14231\}, \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, 1349, -5364, -8244\}, \{ 0, 1305, -5313, -8123\},\n\
\{ 0, 1346, -5207, -8048\}, \{ 0, 1267, -5433, -8294\},\n\
\{ 0, 1432, -5184, -8028\}, \{ 0, 1300, -5323, -7882\},\n\
\{ 0, 1344, -5252, -7874\}, \{ 0, 1471, -4946, -7465\},\n\
\{ 0, 1463, -4744, -7438\}, \{ 0, 1343, -4772, -7414\},\n\
\{ 0, 1327, -4773, -7466\}, \{ 0, 1529, -4640, -7207\},\n\
\{ 0, 1361, -4649, -7166\}, \{ 0, 1282, -4773, -7277\},\n\
\{ 0, 1395, -4358, -6842\}, \{ 0, 1460, -4368, -6891\},\n\
\{ 0, 1453, -4271, -6791\}, \{ 0, 1508, -3985, -6433\},\n\
\{ 0, 1631, -3986, -6168\}, \{ 0, 1703, -3670, -6021\},\n\
\{ 0, 1721, -3765, -5929\}, \{ 0, -945, -8000, -7277\},\n\
\{ 0, -760, -7667, -6891\}, \{ 0, -674, -7604, -6809\},\n\
\{ 0, -651, -7716, -6859\}, \{ 0, -564, -7489, -6550\},\n\
\{ 0, -619, -7426, -6299\}, \{ 0, -548, -7423, -6400\},\n\
\{ 0, -594, -7559, -6385\}, \{ 0, -454, -7217, -6158\},\n\
\{ 0, -652, -7475, -6376\}, \{ 0, -515, -7409, -6425\},\n\
\{ 0, -594, -7547, -6704\}, \{ 0, -624, -7454, -6696\},\n\
\{ 0, -632, -7298, -6673\}, \{ 0, -618, -7398, -6976\},\n\
\{ 0, -448, -7026, -6590\}, \{ 0, -403, -7384, -6981\},\n\
\{ 0, -309, -7243, -6984\}, \{ 0, -244, -7224, -7184\},\n\
\{ 0, -149, -7332, -7120\}, \{ 0, 3, -6982, -7051\},\n\
\{ 0, 637, -5403, -6598\}, \{ 0, 741, -5338, -6589\},\n\
\{ 0, 1061, -5151, -6684\}, \{ 0, 1132, -5092, -6982\},\n\
\{ 0, 1395, -5371, -6885\}, \{ 0, 1576, -5046, -7027\},\n\
\{ 0, 1685, -5036, -7188\}, \{ 0, -4861, -4954, -7182\},\n\
\{ 0, 7528, -4764, -7106\}, \{ 0, 7402, -4883, -7450\},\n\
\{ 0, 2421, -4626, -7362\}, \{ 0, 2537, -4763, -7522\},\n\
\{ 0, 2625, -4445, -7453\}, \{ 0, 2812, -4555, -7423\},\n\
\{ 0, 2817, -4220, -7536\}, \{ 0, 2871, -4363, -7597\},\n\
\{ 0, 2991, -4147, -7377\}, \{ 0, 3022, -4280, -7546\},\n\
\{ 0, 3081, -4477, -7607\}, \{ 0, 3207, -4288, -7445\},\n\
\{ 0, 3222, -4523, -7341\}, \{ 0, 2538, -5235, -7880\},\n\
\{ 0, 2556, -5329, -7867\}, \{ 0, 2637, -5562, -7906\},\n\
\{ 0, 2615, -5434, -7647\}, \{ 0, 2526, -5602, -7602\},\n\
\{ 0, 2506, -5612, -7705\}, \{ 0, 2365, -5521, -7538\},\n\
\{ 0, 7423, -5500, -7675\}, \{ 0, 2264, -5602, -7646\},\n\
\{ 0, 2263, -5490, -7639\}, \{ 0, -15024, -5463, -7460\},\n\
\{ 0, -4834, -5419, -7484\}, \{ 0, -3118, -5570, -7579\},\n\
\{ 0, -6596, -5413, -7525\}, \{ 0, 1877, -5315, -7328\},\n\
\{ 0, 1874, -5682, -7534\}, \{ 0, 1759, -5330, -7287\},\n\
\{ 0, 1735, -5507, -7305\}, \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\
@@ -352,45 +396,46 @@ calMap[LJ04]="\{\n\
};"
calMap[LJ06]="\{\n\
\{ 0, -2262, -6113, 0\}, \{ 0, -2289, -5998, 0\},\n\
\{ 0, -2389, -5908, 0\}, \{ 0, -2400, -5772, 0\},\n\
\{ 0, -2453, -5681, 0\}, \{ 0, -2499, -5388, 0\},\n\
\{ 0, -2697, -5347, 0\}, \{ 0, -2711, -5354, 0\},\n\
\{ 0, -2706, -5191, 0\}, \{ 0, -2735, -5041, 0\},\n\
\{ 0, -2774, -5210, 0\}, \{ 0, -2786, -5058, 0\},\n\
\{ 0, -2678, -4895, 0\}, \{ 0, -2919, -5057, 0\},\n\
\{ 0, -2721, -4910, 0\}, \{ 0, -2907, -5193, 0\},\n\
\{ 0, -2788, -5127, 0\}, \{ 0, -2740, -5244, 0\},\n\
\{ 0, -2952, -5528, 0\}, \{ 0, -2780, -5636, 0\},\n\
\{ 0, -2699, -5809, 0\}, \{ 0, -5951, -7685, 0\},\n\
\{ 0, -5919, -8016, 0\}, \{ 0, -5825, -7896, 0\},\n\
\{ 0, -5678, -8137, 0\}, \{ 0, -5540, -7997, 0\},\n\
\{ 0, -5402, -8086, 0\}, \{ 0, -5177, -8028, 0\},\n\
\{ 0, -5086, -8084, 0\}, \{ 0, -4956, -8329, 0\},\n\
\{ 0, -4540, -7947, 0\}, \{ 0, -4522, -8167, 0\},\n\
\{ 0, -4236, -8042, 0\}, \{ 0, -4221, -8116, 0\},\n\
\{ 0, -4065, -7614, 0\}, \{ 0, -3927, -7733, 0\},\n\
\{ 0, -4279, -8023, 0\}, \{ 0, -3821, -7745, 0\},\n\
\{ 0, -3811, -7711, 0\}, \{ 0, -3622, -7571, 0\},\n\
\{ 0, -3670, -7673, 0\}, \{ 0, -3468, -7280, 0\},\n\
\{ 0, -7748, -9555, 0\}, \{ 0, -7489, -9416, 0\},\n\
\{ 0, -7519, -9207, 0\}, \{ 0, -7465, -9536, 0\},\n\
\{ 0, -7860, -9780, 0\}, \{ 0, -7653, -9649, 0\},\n\
\{ 0, -7797, -9516, 0\}, \{ 0, -7830, -9363, 0\},\n\
\{ 0, -7742, -9205, 0\}, \{ 0, -7527, -8705, 0\},\n\
\{ 0, -7519, -8575, 0\}, \{ 0, -7595, -8404, 0\},\n\
\{ 0, -7486, -8284, 0\}, \{ 0, -7580, -7872, 0\},\n\
\{ 0, -7538, -7504, 0\}, \{ 0, -7962, -7643, 0\},\n\
\{ 0, -8127, -7655, 0\}, \{ 0, -8093, -6990, 0\},\n\
\{ 0, -8134, -6976, 0\}, \{ 0, -8124, -6803, 0\},\n\
\{ 0, -8197, -6536, 0\}, \{ 0, -3942, -1676, 0\},\n\
\{ 0, -4183, -1856, 0\}, \{ 0, -4299, -1592, 0\},\n\
\{ 0, -4544, -1886, 0\}, \{ 0, -4665, -1528, 0\},\n\
\{ 0, -4565, -1494, 0\}, \{ 0, -4739, -1559, 0\},\n\
\{ 0, -4674, -1424, 0\}, \{ 0, -5024, -1639, 0\},\n\
\{ 0, -4809, -1556, 0\}, \{ 0, -5018, -1704, 0\},\n\
\{ 0, -4793, -1466, 0\}, \{ 0, -5107, -1687, 0\},\n\
\{ 0, -4760, -1739, 0\}, \{ 0, -5083, -1904, 0\},\n\
\{ 0, -5023, -2034, 0\}, \{ 0, -4848, -2186, 0\},\n\
\{ 0, -4732, -1999, 0\}, \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\
};"
+37 -16
View File
@@ -1,19 +1,40 @@
clear;clc;
name = 'LJ06';
load(['phase_' name '.mat']);
data = sortrows(dataDec1, 1);
fprintf('calMap[%s]="\\{\\n\\\n', name);
for i = 1:size(data,1)
if (mod(i, 2) == 1)
fprintf("\t");
end
fprintf("\\{%6d, %6d, %6d, %6d\\},", ...
data(i,2), data(i,3), data(i,4), data(i,5));
if (mod(i, 2) == 1)
fprintf(" ");
else
fprintf("\\n\\\n");
end
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
fprintf('\\n\\\n};"\n');
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.
@@ -2,28 +2,28 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/dev_profile/global_timer_profile.c \
../src/dev_profile/intc_profile.c \
../src/dev_profile/timer_profile.c
../src/dev_profile/timer_profile.c
OBJS += \
./src/dev_profile/global_timer_profile.o \
./src/dev_profile/intc_profile.o \
./src/dev_profile/timer_profile.o
./src/dev_profile/timer_profile.o
C_DEPS += \
./src/dev_profile/global_timer_profile.d \
./src/dev_profile/intc_profile.d \
./src/dev_profile/timer_profile.d
./src/dev_profile/timer_profile.d
# Each subdirectory must supply rules for building sources it contributes
src/dev_profile/%.o: ../src/dev_profile/%.c
@echo 'Building file: $<'
@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 ' '
+1 -1
View File
@@ -20,7 +20,7 @@ C_DEPS += \
src/systembus/%.o: ../src/systembus/%.c
@echo 'Building file: $<'
@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 ' '
@@ -2,28 +2,28 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/link_layer/geometry/coord.c \
../src/networking/link_layer/geometry/eulerangles.c \
../src/networking/link_layer/geometry/quaternion.c
../src/networking/link_layer/geometry/quaternion.c
OBJS += \
./src/networking/link_layer/geometry/coord.o \
./src/networking/link_layer/geometry/eulerangles.o \
./src/networking/link_layer/geometry/quaternion.o
./src/networking/link_layer/geometry/quaternion.o
C_DEPS += \
./src/networking/link_layer/geometry/coord.d \
./src/networking/link_layer/geometry/eulerangles.d \
./src/networking/link_layer/geometry/quaternion.d
./src/networking/link_layer/geometry/quaternion.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/link_layer/geometry/%.o: ../src/networking/link_layer/geometry/%.c
@echo 'Building file: $<'
@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 ' '
@@ -2,7 +2,7 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/link_layer/framing.c \
../src/networking/link_layer/link_layer.c \
@@ -11,7 +11,7 @@ C_SRCS += \
../src/networking/link_layer/scan.c \
../src/networking/link_layer/schdevent.c \
../src/networking/link_layer/service.c \
../src/networking/link_layer/time_sync.c
../src/networking/link_layer/time_sync.c
OBJS += \
./src/networking/link_layer/framing.o \
@@ -21,7 +21,7 @@ OBJS += \
./src/networking/link_layer/scan.o \
./src/networking/link_layer/schdevent.o \
./src/networking/link_layer/service.o \
./src/networking/link_layer/time_sync.o
./src/networking/link_layer/time_sync.o
C_DEPS += \
./src/networking/link_layer/framing.d \
@@ -31,14 +31,14 @@ C_DEPS += \
./src/networking/link_layer/scan.d \
./src/networking/link_layer/schdevent.d \
./src/networking/link_layer/service.d \
./src/networking/link_layer/time_sync.d
./src/networking/link_layer/time_sync.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/link_layer/%.o: ../src/networking/link_layer/%.c
@echo 'Building file: $<'
@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 ' '
@@ -2,25 +2,25 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/phy_layer/phy_antenna.c \
../src/networking/phy_layer/phy_layer.c
../src/networking/phy_layer/phy_layer.c
OBJS += \
./src/networking/phy_layer/phy_antenna.o \
./src/networking/phy_layer/phy_layer.o
./src/networking/phy_layer/phy_layer.o
C_DEPS += \
./src/networking/phy_layer/phy_antenna.d \
./src/networking/phy_layer/phy_layer.d
./src/networking/phy_layer/phy_layer.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/phy_layer/%.o: ../src/networking/phy_layer/%.c
@echo 'Building file: $<'
@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 ' '
+6 -6
View File
@@ -2,28 +2,28 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
LD_SRCS += \
../src/lscript.ld
../src/lscript.ld
C_SRCS += \
../src/main.c \
../src/system_monitor.c
../src/system_monitor.c
OBJS += \
./src/main.o \
./src/system_monitor.o
./src/system_monitor.o
C_DEPS += \
./src/main.d \
./src/system_monitor.d
./src/system_monitor.d
# Each subdirectory must supply rules for building sources it contributes
src/%.o: ../src/%.c
@echo 'Building file: $<'
@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 ' '
+5 -5
View File
@@ -2,22 +2,22 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/time_ctrl/time_ctrl.c
../src/time_ctrl/time_ctrl.c
OBJS += \
./src/time_ctrl/time_ctrl.o
./src/time_ctrl/time_ctrl.o
C_DEPS += \
./src/time_ctrl/time_ctrl.d
./src/time_ctrl/time_ctrl.d
# Each subdirectory must supply rules for building sources it contributes
src/time_ctrl/%.o: ../src/time_ctrl/%.c
@echo 'Building file: $<'
@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 ' '
+5 -5
View File
@@ -2,14 +2,14 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/util/circ_queue.c \
../src/util/clist.c \
../src/util/common.c \
../src/util/crc.c \
../src/util/list.c \
../src/util/util.c
../src/util/util.c
OBJS += \
./src/util/circ_queue.o \
@@ -17,7 +17,7 @@ OBJS += \
./src/util/common.o \
./src/util/crc.o \
./src/util/list.o \
./src/util/util.o
./src/util/util.o
C_DEPS += \
./src/util/circ_queue.d \
@@ -25,14 +25,14 @@ C_DEPS += \
./src/util/common.d \
./src/util/crc.d \
./src/util/list.d \
./src/util/util.d
./src/util/util.d
# Each subdirectory must supply rules for building sources it contributes
src/util/%.o: ../src/util/%.c
@echo 'Building file: $<'
@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 ' '
+41 -25
View File
@@ -278,7 +278,7 @@ static int32_t Mpc_SystemConfig(MPC *instPtr, uint8_t *msg)
* @param InstPtr A double pointer to MPC instance.
* @param config A pointer to MPC configurations.
*
* @return None.
* @return Error code.
*
******************************************************************************/
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));
if ((*instPtr) == NULL)
{
return FAILURE;
return ENOMEM;
}
(*instPtr)->rxQueue = NULL;
(*instPtr)->txQueue = NULL;
@@ -307,14 +307,15 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
bramConfigPtr = XBram_LookupConfig(config->bramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&mpcBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver selftest.
@@ -322,7 +323,8 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
Status = XBram_SelfTest(&mpcBram, 0);
if (Status != SUCCESS)
{
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return Status;
}
mpcHwConfig.txBuffAddr = mpcBram.Config.MemBaseAddress;
@@ -332,32 +334,47 @@ int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config)
Status = MpcHw_Init(&((*instPtr)->mpchwDesc), &mpcHwConfig);
if (Status != SUCCESS)
{
Status = ENOMEM;
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return ENOMEM;
}
if (CircQueueCreate(&((*instPtr)->txQueue), (*instPtr)->config.txQueueMax) == false)
{
Status = ENOMEM;
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return ENOMEM;
}
if (CircQueueCreate(&((*instPtr)->rxQueue), (*instPtr)->config.rxQueueMax) == false)
{
Status = ENOMEM;
goto mpc_init_error;
Mpc_Destroy(*instPtr);
return ENOMEM;
}
(*instPtr)->isEnable = false; // nothing received.
(*instPtr)->isRxDone = false; // nothing received.
(*instPtr)->isTxDone = true; // nothing to be sent.
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.
@@ -534,17 +551,16 @@ int32_t Mpc_RxIrqHandler(MPC *instPtr)
Status = MpcHw_Recv(instPtr->mpchwDesc, mpcReq);
if (Status != SUCCESS)
{
goto recv_error;
DBG_ERROR("SystemBus::RX error!\n");
free(mpcReq);
return Status;
}
if (CircQueuePush(instPtr->rxQueue, (void *)mpcReq) == false)
{
DBG_ERROR("SystemBus::RX Queue overflowed!\n");
Status = EQUEUE;
goto recv_error;
free(mpcReq);
return EQUEUE;
}
instPtr->isRxDone = false; // another reception is undergoing.
return SUCCESS;
recv_error:
free(mpcReq);
return Status;
}
+1
View File
@@ -52,6 +52,7 @@ typedef struct
/************************** Function Prototypes ******************************/
int32_t Mpc_Init(MPC **instPtr, MPC_CONFIG *config);
void Mpc_Destroy(MPC *instPtr);
int32_t Mpc_HandleCmd(MPC *instPtr);
int32_t Mpc_PendRemoteTest(MPC *instPtr);
@@ -2,14 +2,14 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/dev_profile/ad9361_profile.c \
../src/dev_profile/ad9361_reg_profile.c \
../src/dev_profile/global_timer_profile.c \
../src/dev_profile/hmc7044_profile.c \
../src/dev_profile/intc_profile.c \
../src/dev_profile/timer_profile.c
../src/dev_profile/timer_profile.c
OBJS += \
./src/dev_profile/ad9361_profile.o \
@@ -17,7 +17,7 @@ OBJS += \
./src/dev_profile/global_timer_profile.o \
./src/dev_profile/hmc7044_profile.o \
./src/dev_profile/intc_profile.o \
./src/dev_profile/timer_profile.o
./src/dev_profile/timer_profile.o
C_DEPS += \
./src/dev_profile/ad9361_profile.d \
@@ -25,14 +25,14 @@ C_DEPS += \
./src/dev_profile/global_timer_profile.d \
./src/dev_profile/hmc7044_profile.d \
./src/dev_profile/intc_profile.d \
./src/dev_profile/timer_profile.d
./src/dev_profile/timer_profile.d
# Each subdirectory must supply rules for building sources it contributes
src/dev_profile/%.o: ../src/dev_profile/%.c
@echo 'Building file: $<'
@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 ' '
@@ -2,28 +2,28 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/link_layer/geometry/coord.c \
../src/networking/link_layer/geometry/eulerangles.c \
../src/networking/link_layer/geometry/quaternion.c
../src/networking/link_layer/geometry/quaternion.c
OBJS += \
./src/networking/link_layer/geometry/coord.o \
./src/networking/link_layer/geometry/eulerangles.o \
./src/networking/link_layer/geometry/quaternion.o
./src/networking/link_layer/geometry/quaternion.o
C_DEPS += \
./src/networking/link_layer/geometry/coord.d \
./src/networking/link_layer/geometry/eulerangles.d \
./src/networking/link_layer/geometry/quaternion.d
./src/networking/link_layer/geometry/quaternion.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/link_layer/geometry/%.o: ../src/networking/link_layer/geometry/%.c
@echo 'Building file: $<'
@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 ' '
@@ -2,7 +2,7 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/link_layer/framing.c \
../src/networking/link_layer/link_layer.c \
@@ -11,7 +11,7 @@ C_SRCS += \
../src/networking/link_layer/scan.c \
../src/networking/link_layer/schdevent.c \
../src/networking/link_layer/service.c \
../src/networking/link_layer/time_sync.c
../src/networking/link_layer/time_sync.c
OBJS += \
./src/networking/link_layer/framing.o \
@@ -21,7 +21,7 @@ OBJS += \
./src/networking/link_layer/scan.o \
./src/networking/link_layer/schdevent.o \
./src/networking/link_layer/service.o \
./src/networking/link_layer/time_sync.o
./src/networking/link_layer/time_sync.o
C_DEPS += \
./src/networking/link_layer/framing.d \
@@ -31,14 +31,14 @@ C_DEPS += \
./src/networking/link_layer/scan.d \
./src/networking/link_layer/schdevent.d \
./src/networking/link_layer/service.d \
./src/networking/link_layer/time_sync.d
./src/networking/link_layer/time_sync.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/link_layer/%.o: ../src/networking/link_layer/%.c
@echo 'Building file: $<'
@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 ' '
@@ -2,25 +2,25 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/networking/phy_layer/phy_antenna.c \
../src/networking/phy_layer/phy_layer.c
../src/networking/phy_layer/phy_layer.c
OBJS += \
./src/networking/phy_layer/phy_antenna.o \
./src/networking/phy_layer/phy_layer.o
./src/networking/phy_layer/phy_layer.o
C_DEPS += \
./src/networking/phy_layer/phy_antenna.d \
./src/networking/phy_layer/phy_layer.d
./src/networking/phy_layer/phy_layer.d
# Each subdirectory must supply rules for building sources it contributes
src/networking/phy_layer/%.o: ../src/networking/phy_layer/%.c
@echo 'Building file: $<'
@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 ' '
+1 -1
View File
@@ -26,7 +26,7 @@ C_DEPS += \
src/%.o: ../src/%.c
@echo 'Building file: $<'
@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 ' '
+5 -5
View File
@@ -2,25 +2,25 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/systembus/systembus.c \
../src/systembus/systembus_uart.c
../src/systembus/systembus_uart.c
OBJS += \
./src/systembus/systembus.o \
./src/systembus/systembus_uart.o
./src/systembus/systembus_uart.o
C_DEPS += \
./src/systembus/systembus.d \
./src/systembus/systembus_uart.d
./src/systembus/systembus_uart.d
# Each subdirectory must supply rules for building sources it contributes
src/systembus/%.o: ../src/systembus/%.c
@echo 'Building file: $<'
@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 ' '
+5 -5
View File
@@ -2,22 +2,22 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/time_ctrl/time_ctrl.c
../src/time_ctrl/time_ctrl.c
OBJS += \
./src/time_ctrl/time_ctrl.o
./src/time_ctrl/time_ctrl.o
C_DEPS += \
./src/time_ctrl/time_ctrl.d
./src/time_ctrl/time_ctrl.d
# Each subdirectory must supply rules for building sources it contributes
src/time_ctrl/%.o: ../src/time_ctrl/%.c
@echo 'Building file: $<'
@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 ' '
+5 -5
View File
@@ -2,14 +2,14 @@
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../src/util/circ_queue.c \
../src/util/clist.c \
../src/util/common.c \
../src/util/crc.c \
../src/util/list.c \
../src/util/util.c
../src/util/util.c
OBJS += \
./src/util/circ_queue.o \
@@ -17,7 +17,7 @@ OBJS += \
./src/util/common.o \
./src/util/crc.o \
./src/util/list.o \
./src/util/util.o
./src/util/util.o
C_DEPS += \
./src/util/circ_queue.d \
@@ -25,14 +25,14 @@ C_DEPS += \
./src/util/common.d \
./src/util/crc.d \
./src/util/list.d \
./src/util/util.d
./src/util/util.d
# Each subdirectory must supply rules for building sources it contributes
src/util/%.o: ../src/util/%.c
@echo 'Building file: $<'
@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 ' '
+1 -1
View File
@@ -52,7 +52,7 @@
#define SCUTIMER_INTR_ID XPAR_SCUTIMER_INTR
// Physical Layer Configs
#define PHY_DEVICE_ID 0
#define PHY_DEVICE_ID 0X00
#define PHY_BASEADDR XPAR_PHYC_BASEADDR
#define PHY_BEAM_FORMING_ENABLE
// -- Antenna Bram Configs
+16 -6
View File
@@ -34,9 +34,9 @@
/************************** Function Prototypes ******************************/
/*********************** Driver Instance Definitions **************************/
static struct hmc7044_dev *hmc7044_inst;
static struct ad9361_reg_dev *ad9361_1_reg_inst;
static struct ad9361_reg_dev *ad9361_2_reg_inst;
static struct hmc7044_dev *hmc7044_inst = NULL;
static struct ad9361_reg_dev *ad9361_1_reg_inst = NULL;
static struct ad9361_reg_dev *ad9361_2_reg_inst = NULL;
// static struct ad9361_rf_phy *ad9361_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);
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");
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 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_read(ad9361_1_reg_inst, 0x000E, (uint8_t*)&scaleTemp);
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)
@@ -411,12 +419,14 @@ int8_t Hardware_GetAD9361Temp_1(void)
int8_t Hardware_GetAD9361Temp_2(void)
{
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_read(ad9361_2_reg_inst, 0x000E, (uint8_t*)&scaleTemp);
ad9361_reg_write(ad9361_2_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);
}
// @ Determine AD9361 lock state
+3 -2
View File
@@ -13,7 +13,8 @@
* Copyright(c) 2024 Beijing Institute of Technology.
*
******************************************************************************/
#ifndef HWCONFIG_H_
#define HWCONFIG_H_
/***************************** Include Files *********************************/
// Standard
#include <stdint.h>
@@ -29,4 +30,4 @@ int8_t Hardware_GetAD9361Temp_2(void);
uint8_t Hardware_GetAD9361LockStatus(void);
uint8_t Hardware_GetHMC7044LockStatus(void);
#endif // HWCONFIG_H_
+16 -16
View File
@@ -72,20 +72,20 @@ struct callback_desc scutm_callback_desc = {
L2_CONFIG linkConfig = {
.myType = L2_NODE_HEAD,
.clustId = 1,
.myId = 1,
.headId = 1,
.netScale = 2,
.clustId = 1U,
.myId = 1U,
.headId = 1U,
.netScale = 2U,
.phyInstPtr = NULL, // physical layer reference
.tmcInstPtr = NULL
};
// L2_CONFIG linkConfig = {
// .myType = L2_NODE_MEMBER,
// .clustId = 1,
// .myId = 2,
// .headId = 1,
// .netScale = 2,
// .clustId = 1U,
// .myId = 2U,
// .headId = 1U,
// .netScale = 2U,
// .phyInstPtr = NULL, // physical layer reference
// .tmcInstPtr = NULL
// };
@@ -106,21 +106,21 @@ static PHY_CONFIG phyConfig = {
TMC_CONFIG tmcConfig = {
.baseAddr = TIME_CONTROLLER_BASEADDR,
.reset = 10
.reset = 10U
};
static SYSBUS_CONFIG sysbusConfig = {
.baseAddr = SYSBUS_BASE_ADDR,
.txQueueMax = 16,
.rxQueueMax = 16
.txQueueMax = 16U,
.rxQueueMax = 16U
};
/*********************** Driver Instance Definitions **************************/
static struct irq_ctrl_desc *intcDescPtr; // General interrupt controller descriptor
static struct timer_desc *logTmPtr;
static SYSBUS *sysbusDescPtr;
static PHY_INST *phyInstPtr;
static struct irq_ctrl_desc *intcDescPtr = NULL; // General interrupt controller descriptor
static struct timer_desc *logTmPtr = NULL;
static SYSBUS *sysbusDescPtr = NULL;
static PHY_INST *phyInstPtr = NULL;
static TMC_INST *tmcInstPtr = NULL;
L2_INST *linkInstPtr;
L2_INST *linkInstPtr = NULL;
/****************************************************************************/
@@ -165,7 +165,7 @@ bool L2_CrcCheck(uint8_t *dataBuff, uint32_t dataLen, L2_CRC_TYPE crcType)
ASSERT(dataBuff != NULL);
int32_t Status;
uint32_t crcVal;
crcVal = 0;
crcVal = 0U;
Status = L2_CrcGen(dataBuff, dataLen, crcType, &crcVal);
if (Status == SUCCESS)
{
@@ -75,6 +75,10 @@ COORD Coord_GetScalarMult(COORD a, double t)
/** @brief Divides a coordinate vector by a real number. */
void Coord_ScalarDiv(COORD *a, double t)
{
if (t == 0.0) {
*a = COORD_NIL;
return;
}
a->x /= t;
a->y /= t;
a->z /= t;
@@ -83,6 +87,9 @@ void Coord_ScalarDiv(COORD *a, double t)
/** @brief Divides a coordinate vector by a real number. */
COORD Coord_GetScalarDiv(COORD a, double t)
{
if (t == 0.0) {
return COORD_NIL;
}
COORD ret;
ret.x = a.x / t;
ret.y = a.y / t;
@@ -69,9 +69,9 @@ EULERANGLES EulerAngles_GetScalarMult(EULERANGLES e, double f)
/** @brief Normalize EulerAngles. */
void EulerAngles_Normalize(EULERANGLES *e)
{
e->alpha = fmod(e->alpha, 2 * EUL_PI);
e->beta = fmod(e->beta, 2 * EUL_PI);
e->gamma = fmod(e->gamma, 2 * EUL_PI);
e->alpha = fmod(e->alpha, 2.0 * EUL_PI);
e->beta = fmod(e->beta, 2.0 * EUL_PI);
e->gamma = fmod(e->gamma, 2.0 * EUL_PI);
}
/** @brief Normalize EulerAngles. */
@@ -30,8 +30,8 @@
#define EUL_PI 3.14159265358979323846
#define DEG2RAD(d) ((EUL_PI / 180.0) * d)
#define RAD2DEG(r) ((180.0 / EUL_PI) * r)
#define DEG2RAD(d) ((EUL_PI / 180.0) * (d))
#define RAD2DEG(r) ((180.0 / EUL_PI) * (r))
/**
* 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. */
void Quaternion_ScalarDiv(QUATERNION *q, double t)
{
if (t == 0.0) {
*q = QUATERNION_NIL;
return;
}
q->s /= t;
q->i /= t;
q->j /= t;
@@ -190,6 +194,9 @@ inline double Quaternion_GetRotationAngle(QUATERNION q)
/** @brief Get axis of quaternion. */
COORD Quaternion_GetRotationAxis(QUATERNION q)
{
if ((q.s > 1.0) || (q.s < -1.0)) {
return COORD_NIL;
}
double sin_theta_inv;
COORD ret;
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 */
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;
*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. */
void Quaternion_GetSwingAndTwist(QUATERNION q, COORD axis, QUATERNION *swing, QUATERNION *twist)
{
if ((swing == NULL) || (twist == NULL))
{
return;
}
double p;
COORD v;
v.x = q.i;
@@ -326,7 +344,7 @@ EULERANGLES Quaternion_ToEulerAngles(QUATERNION q, EULERANGLES_TYPE type)
if (mask1 || mask2)
{
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
{
@@ -339,6 +357,7 @@ EULERANGLES Quaternion_ToEulerAngles(QUATERNION q, EULERANGLES_TYPE type)
default:
ret = EULERANGLES_NIL;
break;
}
return ret;
}
@@ -428,7 +447,7 @@ QUATERNION Quaternion_RotationFromTo(COORD from, COORD to)
QUATERNION Quaternion_Lerp(QUATERNION q1, QUATERNION q2, double t)
{
QUATERNION ret;
Quaternion_ScalarMult(&q1, 1 - t);
Quaternion_ScalarMult(&q1, 1.0 - t);
Quaternion_ScalarMult(&q1, t);
ret = Quaternion_Add(q1, q2);
Quaternion_Normalize(&ret);
@@ -56,13 +56,13 @@ QUATERNION Quaternion_Add(QUATERNION q1, QUATERNION q2);
void Quaternion_ScalarMult(QUATERNION *q, double t);
/** @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. */
void Quaternion_ScalarDiv(QUATERNION *q, double t);
/** @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. */
QUATERNION Quaternion_Mult(QUATERNION q1, QUATERNION q2);
@@ -39,7 +39,7 @@
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
/************************** 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 L2_SetSlotNum(L2_INST *instPtr, uint32_t newSlotNum);
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)
*/
inline void L2_RcdShift(L2_RCD *rcd, int32_t netxVal)
inline void L2_RcdShift(L2_RCD *rcd, uint32_t netxVal)
{
ASSERT(rcd != NULL);
rcd->last = rcd->curr;
@@ -132,6 +132,7 @@ static void L2_FrameStateUpdate(L2_INST *instPtr)
PHY_INST *phyRef = instPtr->config.phyInstPtr;
bool isValid;
L2_FRAME_TYPE recvType = L2_GetLastOptFrameType(instPtr);
isValid = false;
// Update frame state.
if (Phy_IsFrameValid(phyRef) == false)
{
@@ -470,6 +471,12 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
// Clear random content
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));
// Packet buffer
@@ -477,15 +484,15 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
if ((*instPtr)->sendPktData == NULL)
{
DBG_ERROR("Allocate memory for sendPktData failed.\n");
Status = ENOMEM;
goto init_error;
Linklayer_Destroy(*instPtr);
return ENOMEM;
}
(*instPtr)->recvPktData = calloc(L2_PACK_LEN_MAX / sizeof(uint64_t), sizeof(uint64_t));
if ((*instPtr)->recvPktData == NULL)
{
DBG_ERROR("Allocate memory for recvPktData failed.\n");
Status = ENOMEM;
goto init_error;
Linklayer_Destroy(*instPtr);
return ENOMEM;
}
// Reset basic info
(*instPtr)->netStartTime = NET_START_TIME_INFTY;
@@ -528,32 +535,33 @@ int32_t Linklayer_Init(L2_INST **instPtr, const L2_CONFIG *config)
if (Status != SUCCESS)
{
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));
if (Status != SUCCESS)
{
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));
if (Status != SUCCESS)
{
goto init_error;
Linklayer_Destroy(*instPtr);
return Status;
}
Status = L2_Service_Init(&((*instPtr)->serviceFSM));
if (Status != SUCCESS)
{
goto init_error;
Linklayer_Destroy(*instPtr);
return Status;
}
return SUCCESS;
init_error:
Linklayer_Destroy(*instPtr);
return Status;
}
/*****************************************************************************/
@@ -637,7 +645,10 @@ int32_t Linklayer_Reconfig(L2_INST *instPtr, const L2_CONFIG *config)
******************************************************************************/
void Linklayer_Destroy(L2_INST *instPtr)
{
ASSERT(instPtr != NULL);
if (instPtr == NULL)
{
return;
}
free(instPtr->sendPktData);
free(instPtr->recvPktData);
// Destroy FSMs and nodeList
@@ -29,7 +29,7 @@
#include "../../system_monitor.h"
/************************** Constant Definitions *****************************/
/***************** Macros (Inline Functions) Definitions *********************/
#define AssertL2Event(instPtr, event) Linklayer_EventHandler(instPtr, event)
#define AssertL2Event(instPtr, event) (Linklayer_EventHandler((instPtr), (event)))
/**************************** Type Definitions *******************************/
/**
@@ -145,7 +145,7 @@ typedef enum
typedef struct
{
L2_EVENT_TYPE event; ///< event type
void *msg; ///< event message
void *msg; ///< event message (MUST be a heap item)
} L2_EVENT;
/**
@@ -44,7 +44,7 @@ inline uint32_t L2_GetNodeListLen(NODE_LIST *list)
/**************************** Type Definitions *******************************/
/************************** Variable Definitions *****************************/
static NODE_ENTRY util_entry;
static NODE_ENTRY util_entry = { 0 };
/************************** Function Prototypes ******************************/
/**
* @brief helper function to free node entry.
+27 -35
View File
@@ -182,7 +182,7 @@ static void PendCfmAck(L2_SCAN_FSM *scanFsmPtr)
******************************************************************************/
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",
scanFsmPtr->scanStage, newStage);
scanFsmPtr->scanStage = newStage;
@@ -270,10 +270,10 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
{
// using pull mode to receive confirm frame
// since first time sync procedure is accomplished in ADV stage.
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_16);
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
Phy_SetMode(phyRef, PHY_MODE_PULL);
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_CFM_FRAME);
(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;
}
@@ -287,17 +287,17 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
if (scanFsmPtr->advTimeout > ADV_LISTEN_TIMEOUT)
{
/* Antenna steering (reserved, automatically accomplished by physical layer) */
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_SCAN_FRAME);
(void)Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
(void)L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_SCAN_FRAME);
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;
}
else
{
/* Antenna steering (reserved, automatically accomplished by physical layer) */
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_ADV_FRAME);
(void)Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
(void)L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_ADV_FRAME);
scanFsmPtr->advTimeout++;
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
}
@@ -332,10 +332,10 @@ static int32_t Scan_CfmHandler(L2_INST *instPtr)
{
// using pull mode to receive confirm frame
// since first time sync procedure is accomplished in ADV stage.
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_16);
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
Phy_SetMode(phyRef, PHY_MODE_PULL);
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_CFM_FRAME);
(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;
}
@@ -359,7 +359,7 @@ static int32_t ScanMsg_Packing(L2_INST *instPtr, L2_FRAME_TYPE type, uint8_t dst
int32_t Status;
uint32_t dataChunk;
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);
return EPARAM;
@@ -606,7 +606,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
};
newRtneConfig.rtneTable = initTable;
newRtneConfig.rtnePrd = ARRAY_SIZE(initTable);
AssertL2Event(instPtr, &rtneUpEvent);
(void)AssertL2Event(instPtr, &rtneUpEvent);
}
PendCfmAck(instPtr->scanFSM);
// Time sync.
@@ -622,7 +622,7 @@ int32_t L2_Scan_PktHandler(L2_INST *instPtr, uint8_t *msg)
L2_NODE_STATE newState = L2_NORMAL_STATE;
l2Event.event = L2_EV_MAIN_STATE_UPDATE;
l2Event.msg = &newState;
AssertL2Event(instPtr, &l2Event);
(void)AssertL2Event(instPtr, &l2Event);
}
}
@@ -796,7 +796,6 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
{
ASSERT(instPtr != NULL);
L2_TOR_TYPE torState;
int32_t Status;
const NODE_ENTRY *commNode;
PHY_INST *phyRef = instPtr->config.phyInstPtr;
DBG_INFO("-------- Scan Routine --------\n");
@@ -828,7 +827,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
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
@@ -846,7 +845,7 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
torState = L2_TOR_SUSPEND;
}
// 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;
}
@@ -856,10 +855,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)
{
DBG_ERROR("Only head node can send init-scan Frame.\n");
Status = FAILURE;
goto routine_err;
return FAILURE;
}
L2_SetupNextSlot(instPtr, torState, L2_SCAN_FRAME);
(void)L2_SetupNextSlot(instPtr, torState, L2_SCAN_FRAME);
break;
case L2_SLOT_ADVERTISE:
@@ -868,18 +866,16 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
if (L2_GetNodeType(instPtr) != L2_NODE_HEAD)
{
DBG_ERROR("Only head node can send ADV Frame.\n");
Status = FAILURE;
goto routine_err;
return FAILURE;
}
memset(instPtr->sendPktData, 0xAA, L2_PACK_LEN_MAX);
if (ScanMsg_Packing(instPtr, L2_ADV_FRAME, rtneEntry->dst) != SUCCESS)
{
Status = FAILURE;
goto routine_err;
return FAILURE;
}
}
/* Antenna setting (reserved.) */
L2_SetupNextSlot(instPtr, torState, L2_ADV_FRAME);
(void)L2_SetupNextSlot(instPtr, torState, L2_ADV_FRAME);
break;
case L2_SLOT_CONFIRM:
@@ -896,21 +892,17 @@ int32_t L2_Scan_Routine(L2_INST *instPtr, const L2_RTNE_TABLE_ENTRY *rtneEntry)
memset(instPtr->sendPktData, 0xAA, L2_PACK_LEN_MAX);
if (ScanMsg_Packing(instPtr, L2_CFM_FRAME, rtneEntry->dst) != SUCCESS)
{
Status = FAILURE;
goto routine_err;
return FAILURE;
}
}
/* Antenna setting (reserved.) */
L2_SetupNextSlot(instPtr, torState, L2_CFM_FRAME);
(void)L2_SetupNextSlot(instPtr, torState, L2_CFM_FRAME);
break;
default:
DBG_ERROR("Cannot start a routine for slot type [%" PRId8 "] properly.\n", rtneEntry->slotType);
Status = FAILURE;
goto routine_err;
return FAILURE;
}
return SUCCESS;
routine_err:
return Status;
}
/** @} LinkLayer_Scan*/
@@ -365,7 +365,7 @@ void L2_EventPoolHandler(L2_INST *instPtr)
if (event->schdFrame == L2_GetCurrentFrameNum(instPtr) && event->schdSlot == L2_GetCurrentSlotNum(instPtr))
{
DBG_INFO("Asserting scheduled event [%" PRIu32 "].\n", event->eventId);
AssertL2Event(instPtr, &(event->l2Event));
(void)AssertL2Event(instPtr, &(event->l2Event));
if (event->isVolatile == true)
{
DBG_INFO("Deleting scheduled event [%" PRIu32 "], since it is volatile.\n", event->eventId);
@@ -69,20 +69,20 @@
// Regex: (([0-9]+, ){8})
const uint16_t freqTable[L1_FRAME_MAX_HOPS] =
{
1084, 1097, 1110, 1123, 1136, 1149, 1162, 1175,
1188, 1201, 1214, 1227, 1240, 1253, 1266, 1279,
1292, 1305, 1318, 1331, 1344, 1357, 1370, 1383,
1396, 1409, 1422, 1435, 1448, 1461, 1474, 1487,
1500, 1513, 1526, 1539, 1552, 1565, 1578, 1591,
1604, 1617, 1630, 1643, 1656, 1669, 1682, 1695,
1708, 1721, 1734, 1747, 1760, 1773, 1786, 1799,
1812, 1825, 1838, 1851, 1864, 1877, 1890, 1903,
1916, 1929, 1942, 1955, 1968, 1981, 1994, 2007,
2020, 2033, 2046, 2059, 2072, 2085, 2098, 2111,
2124
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 antCalTable[L1_FRAME_MAX_HOPS][L1_ANT_NUM_CH] =
const int16_t antCalTable[L1_FRAME_MAX_HOPS][L1_ANT_NUM_CH] =
//Antenna-JG01
{
{ 0, 2525, -7533, -6846}, { 0, 12726, -7818, -6860},
@@ -135,55 +135,55 @@ const uint8_t hopPattern_2KBPS_20MS[L1_FRAME_2KBPS_20MS_HOPS] =
const uint8_t hopPattern_2KBPS_100MS[L1_FRAME_2KBPS_100MS_HOPS] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79,
80
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
8U, 9U, 10U, 11U, 12U, 13U, 14U, 15U,
16U, 17U, 18U, 19U, 20U, 21U, 22U, 23U,
24U, 25U, 26U, 27U, 28U, 29U, 30U, 31U,
32U, 33U, 34U, 35U, 36U, 37U, 38U, 39U,
40U, 41U, 42U, 43U, 44U, 45U, 46U, 47U,
48U, 49U, 50U, 51U, 52U, 53U, 54U, 55U,
56U, 57U, 58U, 59U, 60U, 61U, 62U, 63U,
64U, 65U, 66U, 67U, 68U, 69U, 70U, 71U,
72U, 73U, 74U, 75U, 76U, 77U, 78U, 79U,
80U
};
const uint8_t hopPattern_10KBPS_10MS[L1_FRAME_10KBPS_10MS_HOPS] =
{
80
80U
};
const uint8_t hopPattern_10KBPS_20MS[L1_FRAME_10KBPS_20MS_HOPS] =
{
80, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10
80U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
8U, 9U, 10U
};
const uint8_t hopPattern_40KBPS_10MS[L1_FRAME_40KBPS_10MS_HOPS] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8,
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
8U,
};
const uint8_t hopPattern_40KBPS_20MS[L1_FRAME_40KBPS_20MS_HOPS] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
8U, 9U, 10U, 11U, 12U, 13U, 14U, 15U,
16U, 17U, 18U
};
const uint8_t hopPattern_200KBPS_5MS[L1_FRAME_200KBPS_5MS_HOPS] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19
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] =
{
0, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19
0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U,
8U, 9U, 10U, 11U, 12U, 13U, 14U, 15U,
16U, 17U, 18U, 19U
};
/** @} PhysicalLayer_AntennaConfig_Constants*/
@@ -317,7 +317,7 @@ void Phy_SetBeamTable(PHY_INST *instPtr, PHY_ANT_ANGLE *table, uint32_t offset)
* 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);
@@ -406,8 +406,8 @@ int32_t Phy_SetBeamAngle(PHY_INST *instPtr, double offAx, double rndAx)
ASSERT(instPtr != NULL);
uint16_t offAxDeg = 0;
uint16_t rndAxDeg = 0;
offAxDeg = (offAx >= 0) ? (((int32_t)(offAx * 180 / ANT_PI)) % 360) : (((int32_t)(offAx * 180 / ANT_PI)) % 360 + 360);
rndAxDeg = (rndAx >= 0) ? (((int32_t)(rndAx * 180 / ANT_PI)) % 360) : (((int32_t)(rndAx * 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.0 / ANT_PI)) % 360) : (((int32_t)(rndAx * 180.0 / ANT_PI)) % 360 + 360);
if (offAxDeg > 60)
{
DBG_ERROR("Angle out of range, off axis angle: %" PRIu16 " (should be 0~60), round axis angle: %" PRIu16 " (should be 0~360).\n",
@@ -335,7 +335,7 @@ inline L1_FRAME_TYPE Phy_GetLastRecvFrameType(PHY_INST *instPtr)
{
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)
{
case COASE_TYPE_2KBPS_20MS:
@@ -439,14 +439,15 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
bramConfigPtr = XBram_LookupConfig(phyConfig->antBramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&antConfigBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver selftest.
@@ -454,20 +455,22 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XBram_SelfTest(&antConfigBram, 0);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
bramConfigPtr = XBram_LookupConfig(phyConfig->txBramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&txDataBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver selftest.
@@ -475,20 +478,22 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XBram_SelfTest(&txDataBram, 0);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
bramConfigPtr = XBram_LookupConfig(phyConfig->rxBramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&rxDataBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver selftest.
@@ -496,7 +501,8 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XBram_SelfTest(&rxDataBram, 0);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
(*instPtr)->antConfigAddr = antConfigBram.Config.MemBaseAddress;
@@ -510,14 +516,15 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
bramConfigPtr = XBram_LookupConfig(phyConfig->antInfoBramId);
if (bramConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
Status = XBram_CfgInitialize(&antInfoBram, bramConfigPtr,
bramConfigPtr->CtrlBaseAddress);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/*
* Execute the BRAM driver self test.
@@ -525,7 +532,8 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XBram_SelfTest(&antInfoBram, 0);
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
(*instPtr)->antInfoAddr = antInfoBram.Config.MemBaseAddress;
uint32_t phyMainCtrl = PhyRead(*instPtr, PHY_MAIN_CTRL);
@@ -545,8 +553,8 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
xadcConfigPtr = XAdcPs_LookupConfig(phyConfig->hwXadcId);
if (xadcConfigPtr == NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
XAdcPs_CfgInitialize(&((*instPtr)->hwXadc), xadcConfigPtr, xadcConfigPtr->BaseAddress);
@@ -554,36 +562,37 @@ int32_t Phy_Init(PHY_INST **instPtr, PHY_CONFIG *phyConfig)
Status = XAdcPs_SelfTest(&((*instPtr)->hwXadc));
if (Status != SUCCESS)
{
goto init_error;
Phy_Destroy(*instPtr);
return Status;
}
/* Disable the Channel Sequencer before configuring the Sequence registers. */
XAdcPs_SetSequencerMode(&((*instPtr)->hwXadc), XADCPS_SEQ_MODE_SAFE);
#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));
if ((*instPtr)->antConfigAddr == (uintptr_t)NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
(*instPtr)->recvDataAddr = (uintptr_t)calloc(L1_TXRXDATA_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
if ((*instPtr)->recvDataAddr == (uintptr_t)NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
(*instPtr)->sendDataAddr = (uintptr_t)calloc(L1_TXRXDATA_MAX_LEN / sizeof(uint64_t), sizeof(uint64_t));
if ((*instPtr)->sendDataAddr == (uintptr_t)NULL)
{
Status = EDCONF;
goto init_error;
Phy_Destroy(*instPtr);
return EDCONF;
}
#endif
return SUCCESS;
init_error:
Phy_Destroy(*instPtr);
return Status;
}
/*****************************************************************************/
@@ -1027,7 +1036,7 @@ void Phy_RefreshHwSate(PHY_INST *instPtr)
ASSERT(instPtr != NULL);
uint32_t rawData;
#ifndef EMULATION
float evalData;
double evalData;
instPtr->hwSate.isSpOk = true;
// -- Update FPGA voltage status;
instPtr->hwSate.spFpgaVolt = 0;
@@ -1250,7 +1259,7 @@ double Phy_GetCoarseFreqEst(PHY_INST *instPtr)
double freqEst;
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
}
@@ -1288,14 +1297,14 @@ double Phy_GetFineFreqEst(PHY_INST *instPtr)
double freqEst;
L1_FRAME_TYPE frameType;
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
}
regValue = PhyRead(instPtr, FINE_FREQEST);
estAbs = regValue & FINE_FREQEST_VAL_MASK;
if (frameType >= L1_200KBPS_5MS_FRAME)
if ((frameType >= L1_200KBPS_5MS_FRAME))
{
// 12M Rc
freqEst = 48e6 / 2048 * ((double)estAbs) / 8192.0;
@@ -34,24 +34,24 @@
* @name PhysicalLayer_Common_Constant
* @{
*/
#define L1_NUM_ANT_NRRW_PATTERN 37
#define L1_INIT_BEAM_NO 0
#define L1_NUM_ANT_NRRW_PATTERN 37U
#define L1_INIT_BEAM_NO 0U
#define L1_INIT_ANT_WD PHY_ANT_BEAM_120
#define L1_ANT_NUM_CH 4
#define L1_ANT_NUM_CH 4U
#define L1_FRAME_NONE_LEN UINT32_MAX // byte
#define L1_FRAME_NONE_COMP UINT32_MAX // *10ns(Timer_L)
#define L1_FRAME_NONE_HOPS UINT32_MAX
#define L1_FRAME_MAX_HOPS 81
#define L1_FRAME_2KBPS_20MS_HOPS 1
#define L1_FRAME_2KBPS_100MS_HOPS 81
#define L1_FRAME_10KBPS_10MS_HOPS 1
#define L1_FRAME_10KBPS_20MS_HOPS 11
#define L1_FRAME_40KBPS_20MS_HOPS 19
#define L1_FRAME_40KBPS_10MS_HOPS 9
#define L1_FRAME_200KBPS_5MS_HOPS 20
#define L1_FRAME_1M2BPS_5MS_HOPS 20
#define PHY_LOG_EXPIRE 40 // 50*5ms
#define L1_FRAME_MAX_HOPS 81U
#define L1_FRAME_2KBPS_20MS_HOPS 1U
#define L1_FRAME_2KBPS_100MS_HOPS 81U
#define L1_FRAME_10KBPS_10MS_HOPS 1U
#define L1_FRAME_10KBPS_20MS_HOPS 11U
#define L1_FRAME_40KBPS_20MS_HOPS 19U
#define L1_FRAME_40KBPS_10MS_HOPS 9U
#define L1_FRAME_200KBPS_5MS_HOPS 20U
#define L1_FRAME_1M2BPS_5MS_HOPS 20U
#define PHY_LOG_EXPIRE 40U // 50*5ms
/** @} */
/***************** Macros (Inline Functions) Definitions *********************/
/**************************** Type Definitions *******************************/
@@ -306,7 +306,7 @@ void Phy_AntConfigInit(PHY_ANT_CONFIG *antConfig);
void Phy_AntConfigMode(PHY_INST *instPtr, PHY_ANT_MODE mode);
void Phy_SetBeamTable(PHY_INST *instPtr, PHY_ANT_ANGLE *table, uint32_t offset);
int32_t Phy_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);
/** @} PhysicalLayer_AntennaControl*/
@@ -26,8 +26,8 @@
#include "util.h"
/***************** Macros (Inline Functions) Definitions *********************/
#define PhyRead(instPtr, addr) IO_In32((instPtr)->phyCofig.baseAddr + addr)
#define PhyWrite(instPtr, addr, value) IO_Out32((instPtr)->phyCofig.baseAddr + addr, value)
#define PhyRead(instPtr, addr) IO_In32((instPtr)->phyCofig.baseAddr + (addr))
#define PhyWrite(instPtr, addr, value) IO_Out32((instPtr)->phyCofig.baseAddr + (addr), (value))
/************************** Constant Definitions *****************************/
/**
+6
View File
@@ -127,6 +127,7 @@ void SysMonitor_Destroy(void)
*/
void SysMonitor_UpdateSysinfo(const SYSINFO *info)
{
ASSERT(info != NULL);
uint8_t buffIndx;
buffIndx = GetWritable(sysMonitorInst->sysInfoCtrl);
sysMonitorInst->sysInfoCtrl.wBusy = buffIndx;
@@ -143,6 +144,7 @@ void SysMonitor_UpdateSysinfo(const SYSINFO *info)
void SysMonitor_GetSysinfo(SYSINFO *info)
{
ASSERT(sysMonitorInst != NULL);
ASSERT(info != NULL);
uint8_t buffIndx, buffIndex_old;
buffIndex_old = sysMonitorInst->sysInfoCtrl.rBusy;
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;
buffIndex_old = sysMonitorInst->sendCtrl.rBusy;
if (buffIndex_old != BUFF_NONE)
{
buffIndx = buffIndex_old; // Keep it busy
}
else
{
buffIndx = GetReadable(sysMonitorInst->sendCtrl);
}
sysMonitorInst->sendCtrl.rBusy = buffIndx;
if (sysMonitorInst->send[buffIndx].dataId != DATA_ID_NONE)
{
+10 -10
View File
@@ -54,12 +54,12 @@
// #define IS_PL_VALID(x) (x <= 1.03 && x >= 0.97)
// #define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
// #define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.97)
#define IS_PS_VALID(x) (x <= 1.05 && x >= 0.95)
#define IS_PSAUX_VALID(x) (x <= 1.89 && x >= 1.71)
#define IS_DDR_VALID(x) (x <= 1.89 && x >= 1.14)
#define IS_PL_VALID(x) (x <= 1.03 && x >= 0.96)
#define IS_PLAUX_VALID(x) (x <= 1.89 && x >= 1.71)
#define IS_BRAM_VALID(x) (x <= 1.03 && x >= 0.96)
#define IS_PS_VALID(x) ((x) <= 1.1 && (x) >= 0.9)
#define IS_PSAUX_VALID(x) ((x) <= 2.0 && (x) >= 1.6)
#define IS_DDR_VALID(x) ((x) <= 1.7 && (x) >= 1.3)
#define IS_PL_VALID(x) (x <= 1.1 && (x) >= 0.9)
#define IS_PLAUX_VALID(x) ((x) <= 2.0 && (x) >= 1.6)
#define IS_BRAM_VALID(x) ((x) <= 1.1 && (x) >= 0.9)
#define CLK_SP_PLL0_LOCK BIT(0)
#define CLK_SP_PLL1_LOCK BIT(2)
@@ -194,12 +194,12 @@ typedef struct __attribute__((packed))
uint8_t spFpgaVolt; ///< Signal processor voltage state indicator
uint8_t spClkState; ///< Signal processor clock state indicator
uint8_t spAdLockState; ///< Signal processor adc lock state indicator
uint8_t spAdTemp_0; ///< Signal processor adc0 temperature
uint8_t spAdTemp_1; ///< Signal processor adc1 temperature
uint8_t spFpgaTemp; ///< Signal processor FPGA temperature
int8_t spAdTemp_0; ///< Signal processor adc0 temperature
int8_t spAdTemp_1; ///< Signal processor adc1 temperature
int8_t spFpgaTemp; ///< Signal processor FPGA temperature
// -- Antenna status
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 antMgc0; ///< Antenna rf mgc0~1 indicator
uint8_t antMgc1; ///< Antenna rf mgc2~3 indicator
+34 -20
View File
@@ -658,7 +658,7 @@ int32_t SystemBus_MakeResp(SYSBUS *instPtr)
* @param InstPtr A double pointer to System Bus instance.
* @param config A pointer to System Bus configurations.
*
* @return None.
* @return Error code.
*
******************************************************************************/
int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
@@ -670,7 +670,7 @@ int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
(*instPtr) = malloc(sizeof(SYSBUS));
if ((*instPtr) == NULL)
{
return FAILURE;
return ENOMEM;
}
(*instPtr)->rxQueue = NULL;
(*instPtr)->txQueue = NULL;
@@ -684,29 +684,45 @@ int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config)
Status = SysbusUart_Init(&((*instPtr)->uartInst), &uartConfig);
if (Status != SUCCESS)
{
Status = ENOMEM;
goto sysbus_init_error;
SystemBus_Destroy(*instPtr);
return ENOMEM;
}
if (CircQueueCreate(&((*instPtr)->txQueue), (*instPtr)->config.txQueueMax) == false)
{
Status = ENOMEM;
goto sysbus_init_error;
SystemBus_Destroy(*instPtr);
return ENOMEM;
}
if (CircQueueCreate(&((*instPtr)->rxQueue), (*instPtr)->config.rxQueueMax) == false)
{
Status = ENOMEM;
goto sysbus_init_error;
SystemBus_Destroy(*instPtr);
return ENOMEM;
}
(*instPtr)->isRxDone = false; // nothing received.
(*instPtr)->isTxDone = true; // nothing to be sent.
return SUCCESS;
}
sysbus_init_error:
free((*instPtr)->uartInst);
free((*instPtr)->txQueue);
free((*instPtr)->rxQueue);
free(*instPtr);
return Status;
/*****************************************************************************/
/**
* @brief Destroy System Bus instance.
*
* @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);
}
/*****************************************************************************/
@@ -748,19 +764,17 @@ int32_t SystemBus_RxIntrHandler(SYSBUS *instPtr)
Status = SysbusUart_Recv(instPtr->uartInst, sysbusReq);
if (Status != SUCCESS)
{
goto recv_error;
free(sysbusReq);
return Status;
}
if (CircQueuePush(instPtr->rxQueue, (void *)sysbusReq) == false)
{
DBG_ERROR("SystemBus::RX Queue overflowed!\n");
Status = EQUEUE;
goto recv_error;
free(sysbusReq);
return EQUEUE;
}
instPtr->isRxDone = false; // another reception is undergoing.
return SUCCESS;
recv_error:
free(sysbusReq);
return Status;
}
/** @} SystemBus*/
+1
View File
@@ -60,6 +60,7 @@ typedef struct
/************************** Function Prototypes ******************************/
int32_t SystemBus_Init(SYSBUS **instPtr, SYSBUS_CONFIG *config);
void SystemBus_Destroy(SYSBUS *instPtr);
/**
* @defgroup SystemBus_Protocol_Routine
+3 -5
View File
@@ -54,7 +54,7 @@ bool CircQueueCreate(CIRC_QUEUE **q, uint32_t queueCapacity)
ASSERT(q != NULL);
CIRC_QUEUE *queue;
queue = malloc(sizeof(CIRC_QUEUE));
if (!queue)
if (queue == NULL)
{
return false;
}
@@ -65,16 +65,14 @@ bool CircQueueCreate(CIRC_QUEUE **q, uint32_t queueCapacity)
queue->data = malloc(queueCapacity * sizeof(void *));
if (queue->data == NULL)
{
goto error;
free(queue);
return false;
}
queue->bounds = queueCapacity;
queue->nelts = 0;
queue->in = 0;
queue->out = 0;
return true;
error:
free(queue);
return false;
}
/**