author
int64
658
755k
date
stringlengths
19
19
timezone
int64
-46,800
43.2k
hash
stringlengths
40
40
message
stringlengths
5
490
mods
list
language
stringclasses
20 values
license
stringclasses
3 values
repo
stringlengths
5
68
original_message
stringlengths
12
491
61,745
18.01.2023 08:05:29
0
43d73d760fb2a91a138de60ae8de0a267b724067
Remove old main reference
[ { "change_type": "DELETE", "old_path": "Test/Images/Small/astc_reference-main-avx2_fast_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-Small,4x4,hdr-rgb-00.hdr,33.7117,0.0963,0.0119,5.4994\n-Small,4x4,hdr-rgb-r16.ktx,999.0000,0.0028,0.0004,0.5727\n-Small,4x4,hdr-rgb-r32.ktx,999.0000,0.0028,0.0004,0.5874\n-Small,4x4,hdr-rgb-rg16.ktx,999.0000,0.0028,0.0004,0.5896\n-Small,4x4,hdr-rgb-rg32.ktx,999.0000,0.0028,0.0004,0.5702\n-Small,4x4,hdr-rgb-rgb16.ktx,999.0000,0.0028,0.0005,0.5678\n-Small,4x4,hdr-rgb-rgb32.ktx,999.0000,0.0028,0.0004,0.5776\n-Small,4x4,hdr-rgba-rgba16.ktx,999.0000,0.0028,0.0005,0.5540\n-Small,4x4,hdr-rgba-rgba32.ktx,999.0000,0.0028,0.0004,0.5727\n-Small,4x4,ldr-rgb-00.png,38.2209,0.0132,0.0080,8.1889\n-Small,4x4,ldr-rgb-01.png,39.9051,0.0117,0.0067,9.7364\n-Small,4x4,ldr-rgb-02.png,35.1290,0.0156,0.0105,6.2221\n-Small,4x4,ldr-rgb-03.png,46.0444,0.0071,0.0024,27.0363\n-Small,4x4,ldr-rgb-04.png,41.9409,0.0096,0.0047,14.0631\n-Small,4x4,ldr-rgb-05.png,37.3196,0.0155,0.0104,6.2865\n-Small,4x4,ldr-rgb-06.png,35.3348,0.0146,0.0096,6.8112\n-Small,4x4,ldr-rgb-07.png,38.1269,0.0158,0.0109,6.0135\n-Small,4x4,ldr-rgb-08.png,43.8182,0.0086,0.0038,17.2467\n-Small,4x4,ldr-rgb-09.png,41.8937,0.0097,0.0048,13.7570\n-Small,4x4,ldr-rgb-10.png,44.4076,0.0044,0.0014,11.3676\n-Small,4x4,ldr-rgba-00.png,35.5880,0.0158,0.0105,6.2649\n-Small,4x4,ldr-rgba-01.png,38.8442,0.0113,0.0061,10.7416\n-Small,4x4,ldr-rgba-02.png,34.8566,0.0140,0.0087,7.5572\n-Small,4x4,ldr-xy-00.png,37.5753,0.0114,0.0043,15.3477\n-Small,4x4,ldr-xy-01.png,44.1982,0.0124,0.0053,12.4706\n-Small,4x4,ldr-xy-02.png,48.2321,0.0105,0.0034,19.5337\n-Small,4x4,ldrs-rgba-00.png,35.5929,0.0157,0.0105,6.2689\n-Small,4x4,ldrs-rgba-01.png,38.8641,0.0114,0.0061,10.6948\n-Small,4x4,ldrs-rgba-02.png,34.8607,0.0141,0.0087,7.5079\n-Small,5x5,hdr-rgb-00.hdr,29.4931,0.0972,0.0119,5.4902\n-Small,5x5,hdr-rgb-r16.ktx,999.0000,0.0036,0.0005,0.5331\n-Small,5x5,hdr-rgb-r32.ktx,999.0000,0.0036,0.0005,0.5566\n-Small,5x5,hdr-rgb-rg16.ktx,999.0000,0.0037,0.0005,0.5345\n-Small,5x5,hdr-rgb-rg32.ktx,999.0000,0.0036,0.0005,0.5300\n-Small,5x5,hdr-rgb-rgb16.ktx,999.0000,0.0036,0.0004,0.5690\n-Small,5x5,hdr-rgb-rgb32.ktx,999.0000,0.0036,0.0005,0.5379\n-Small,5x5,hdr-rgba-rgba16.ktx,999.0000,0.0036,0.0005,0.5604\n-Small,5x5,hdr-rgba-rgba32.ktx,999.0000,0.0035,0.0004,0.5791\n-Small,5x5,ldr-rgb-00.png,34.4166,0.0135,0.0076,8.6712\n-Small,5x5,ldr-rgb-01.png,36.2361,0.0108,0.0051,12.7625\n-Small,5x5,ldr-rgb-02.png,31.0780,0.0137,0.0080,8.2095\n-Small,5x5,ldr-rgb-03.png,42.7340,0.0074,0.0020,32.7821\n-Small,5x5,ldr-rgb-04.png,37.2624,0.0100,0.0042,15.6039\n-Small,5x5,ldr-rgb-05.png,33.2632,0.0159,0.0101,6.4778\n-Small,5x5,ldr-rgb-06.png,31.1149,0.0135,0.0077,8.4617\n-Small,5x5,ldr-rgb-07.png,35.0545,0.0139,0.0082,7.9534\n-Small,5x5,ldr-rgb-08.png,40.1764,0.0087,0.0033,20.1464\n-Small,5x5,ldr-rgb-09.png,37.2883,0.0100,0.0043,15.2051\n-Small,5x5,ldr-rgb-10.png,40.1910,0.0048,0.0012,14.0120\n-Small,5x5,ldr-rgba-00.png,32.0869,0.0164,0.0105,6.2462\n-Small,5x5,ldr-rgba-01.png,35.1888,0.0117,0.0057,11.5301\n-Small,5x5,ldr-rgba-02.png,31.1173,0.0141,0.0081,8.0619\n-Small,5x5,ldr-xy-00.png,36.7217,0.0118,0.0035,18.7886\n-Small,5x5,ldr-xy-01.png,39.7489,0.0124,0.0043,15.2017\n-Small,5x5,ldr-xy-02.png,43.9350,0.0112,0.0032,20.7518\n-Small,5x5,ldrs-rgba-00.png,32.0882,0.0166,0.0107,6.1462\n-Small,5x5,ldrs-rgba-01.png,35.1966,0.0118,0.0058,11.2512\n-Small,5x5,ldrs-rgba-02.png,31.1181,0.0142,0.0082,7.9795\n-Small,6x6,hdr-rgb-00.hdr,27.0495,0.0972,0.0118,5.5651\n-Small,6x6,hdr-rgb-r16.ktx,999.0000,0.0036,0.0005,0.5323\n-Small,6x6,hdr-rgb-r32.ktx,999.0000,0.0035,0.0004,0.5702\n-Small,6x6,hdr-rgb-rg16.ktx,999.0000,0.0035,0.0005,0.5651\n-Small,6x6,hdr-rgb-rg32.ktx,999.0000,0.0035,0.0004,0.5714\n-Small,6x6,hdr-rgb-rgb16.ktx,999.0000,0.0035,0.0005,0.5604\n-Small,6x6,hdr-rgb-rgb32.ktx,999.0000,0.0035,0.0004,0.5690\n-Small,6x6,hdr-rgba-rgba16.ktx,999.0000,0.0036,0.0005,0.5678\n-Small,6x6,hdr-rgba-rgba32.ktx,999.0000,0.0036,0.0004,0.5727\n-Small,6x6,ldr-rgb-00.png,31.6998,0.0149,0.0089,7.3595\n-Small,6x6,ldr-rgb-01.png,32.9198,0.0114,0.0058,11.3268\n-Small,6x6,ldr-rgb-02.png,27.4737,0.0144,0.0086,7.5789\n-Small,6x6,ldr-rgb-03.png,40.5514,0.0074,0.0020,32.8173\n-Small,6x6,ldr-rgb-04.png,33.9239,0.0105,0.0048,13.6619\n-Small,6x6,ldr-rgb-05.png,29.9690,0.0172,0.0114,5.7247\n-Small,6x6,ldr-rgb-06.png,27.5382,0.0141,0.0083,7.8525\n-Small,6x6,ldr-rgb-07.png,32.9319,0.0136,0.0079,8.3306\n-Small,6x6,ldr-rgb-08.png,37.7991,0.0087,0.0032,20.5639\n-Small,6x6,ldr-rgb-09.png,33.4925,0.0108,0.0050,13.0317\n-Small,6x6,ldr-rgb-10.png,36.6382,0.0050,0.0013,12.5520\n-Small,6x6,ldr-rgba-00.png,29.5977,0.0180,0.0120,5.4833\n-Small,6x6,ldr-rgba-01.png,32.0782,0.0121,0.0062,10.5329\n-Small,6x6,ldr-rgba-02.png,27.8398,0.0149,0.0088,7.4541\n-Small,6x6,ldr-xy-00.png,35.8063,0.0118,0.0036,17.9941\n-Small,6x6,ldr-xy-01.png,37.0625,0.0131,0.0051,12.9263\n-Small,6x6,ldr-xy-02.png,41.9418,0.0108,0.0029,22.8912\n-Small,6x6,ldrs-rgba-00.png,29.5925,0.0182,0.0122,5.3657\n-Small,6x6,ldrs-rgba-01.png,32.0839,0.0122,0.0063,10.4524\n-Small,6x6,ldrs-rgba-02.png,27.8375,0.0150,0.0090,7.2752\n-Small,8x8,hdr-rgb-00.hdr,23.7739,0.1003,0.0140,4.6738\n-Small,8x8,hdr-rgb-r16.ktx,999.0000,0.0042,0.0005,0.5540\n-Small,8x8,hdr-rgb-r32.ktx,999.0000,0.0042,0.0004,0.5702\n-Small,8x8,hdr-rgb-rg16.ktx,999.0000,0.0042,0.0004,0.5727\n-Small,8x8,hdr-rgb-rg32.ktx,999.0000,0.0042,0.0004,0.5754\n-Small,8x8,hdr-rgb-rgb16.ktx,999.0000,0.0042,0.0004,0.5754\n-Small,8x8,hdr-rgb-rgb32.ktx,999.0000,0.0042,0.0004,0.5730\n-Small,8x8,hdr-rgba-rgba16.ktx,999.0000,0.0042,0.0005,0.5616\n-Small,8x8,hdr-rgba-rgba32.ktx,999.0000,0.0042,0.0005,0.5529\n-Small,8x8,ldr-rgb-00.png,28.0488,0.0163,0.0097,6.7884\n-Small,8x8,ldr-rgb-01.png,28.7761,0.0141,0.0076,8.6018\n-Small,8x8,ldr-rgb-02.png,23.1000,0.0179,0.0116,5.6590\n-Small,8x8,ldr-rgb-03.png,37.3080,0.0083,0.0023,29.0876\n-Small,8x8,ldr-rgb-04.png,29.3451,0.0133,0.0069,9.4815\n-Small,8x8,ldr-rgb-05.png,25.8017,0.0197,0.0133,4.9095\n-Small,8x8,ldr-rgb-06.png,23.1661,0.0182,0.0116,5.6302\n-Small,8x8,ldr-rgb-07.png,29.8439,0.0141,0.0076,8.5725\n-Small,8x8,ldr-rgb-08.png,34.4715,0.0095,0.0034,19.1633\n-Small,8x8,ldr-rgb-09.png,28.6322,0.0129,0.0065,10.1013\n-Small,8x8,ldr-rgb-10.png,31.9939,0.0059,0.0015,10.8883\n-Small,8x8,ldr-rgba-00.png,25.6784,0.0199,0.0133,4.9391\n-Small,8x8,ldr-rgba-01.png,28.2682,0.0154,0.0087,7.5019\n-Small,8x8,ldr-rgba-02.png,23.9333,0.0192,0.0123,5.3199\n-Small,8x8,ldr-xy-00.png,33.3023,0.0137,0.0045,14.4452\n-Small,8x8,ldr-xy-01.png,34.4386,0.0144,0.0053,12.4312\n-Small,8x8,ldr-xy-02.png,39.9000,0.0110,0.0020,33.3509\n-Small,8x8,ldrs-rgba-00.png,25.6786,0.0202,0.0134,4.9080\n-Small,8x8,ldrs-rgba-01.png,28.2710,0.0156,0.0088,7.4177\n-Small,8x8,ldrs-rgba-02.png,23.9335,0.0192,0.0125,5.2287\n-Small,12x12,hdr-rgb-00.hdr,20.5343,0.1093,0.0206,3.1797\n-Small,12x12,hdr-rgb-r16.ktx,999.0000,0.0068,0.0005,0.5355\n-Small,12x12,hdr-rgb-r32.ktx,999.0000,0.0068,0.0005,0.5481\n-Small,12x12,hdr-rgb-rg16.ktx,999.0000,0.0068,0.0005,0.5616\n-Small,12x12,hdr-rgb-rg32.ktx,999.0000,0.0067,0.0005,0.5540\n-Small,12x12,hdr-rgb-rgb16.ktx,999.0000,0.0067,0.0005,0.5470\n-Small,12x12,hdr-rgb-rgb32.ktx,999.0000,0.0068,0.0005,0.5628\n-Small,12x12,hdr-rgba-rgba16.ktx,999.0000,0.0068,0.0005,0.5663\n-Small,12x12,hdr-rgba-rgba32.ktx,999.0000,0.0068,0.0005,0.5675\n-Small,12x12,ldr-rgb-00.png,23.7994,0.0177,0.0085,7.6885\n-Small,12x12,ldr-rgb-01.png,24.7706,0.0151,0.0061,10.7228\n-Small,12x12,ldr-rgb-02.png,19.2291,0.0225,0.0135,4.8664\n-Small,12x12,ldr-rgb-03.png,33.2407,0.0104,0.0016,40.2280\n-Small,12x12,ldr-rgb-04.png,24.5750,0.0148,0.0057,11.4114\n-Small,12x12,ldr-rgb-05.png,21.4889,0.0209,0.0118,5.5530\n-Small,12x12,ldr-rgb-06.png,19.2240,0.0231,0.0139,4.7091\n-Small,12x12,ldr-rgb-07.png,25.3851,0.0148,0.0056,11.7009\n-Small,12x12,ldr-rgb-08.png,30.2920,0.0115,0.0027,23.8402\n-Small,12x12,ldr-rgb-09.png,23.7357,0.0164,0.0074,8.8014\n-Small,12x12,ldr-rgb-10.png,27.3235,0.0090,0.0021,7.8833\n-Small,12x12,ldr-rgba-00.png,21.6066,0.0228,0.0135,4.8562\n-Small,12x12,ldr-rgba-01.png,24.5233,0.0164,0.0073,9.0195\n-Small,12x12,ldr-rgba-02.png,20.1709,0.0249,0.0154,4.2432\n-Small,12x12,ldr-xy-00.png,29.2241,0.0171,0.0047,13.8848\n-Small,12x12,ldr-xy-01.png,30.5471,0.0166,0.0041,16.0625\n-Small,12x12,ldr-xy-02.png,37.9951,0.0131,0.0010,63.9400\n-Small,12x12,ldrs-rgba-00.png,21.6105,0.0230,0.0137,4.7816\n-Small,12x12,ldrs-rgba-01.png,24.5251,0.0167,0.0074,8.8900\n-Small,12x12,ldrs-rgba-02.png,20.1707,0.0252,0.0157,4.1679\n-Small,3x3x3,ldr-l-00-3.dds,50.8334,0.0153,0.0075,35.0129\n-Small,3x3x3,ldr-l-01-3.dds,54.0740,0.0074,0.0032,21.2728\n-Small,6x6x6,ldr-l-00-3.dds,32.5376,0.0472,0.0345,7.5887\n-Small,6x6x6,ldr-l-01-3.dds,40.9072,0.0228,0.0133,5.1828\n" }, { "change_type": "DELETE", "old_path": "Test/Images/Small/astc_reference-main-avx2_fastest_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-Small,4x4,hdr-rgb-00.hdr,33.3306,0.0913,0.0074,8.8874\n-Small,4x4,hdr-rgb-r16.ktx,999.0000,0.0023,0.0005,0.5445\n-Small,4x4,hdr-rgb-r32.ktx,999.0000,0.0023,0.0005,0.5651\n-Small,4x4,hdr-rgb-rg16.ktx,999.0000,0.0023,0.0004,0.5702\n-Small,4x4,hdr-rgb-rg32.ktx,999.0000,0.0023,0.0004,0.5714\n-Small,4x4,hdr-rgb-rgb16.ktx,999.0000,0.0023,0.0004,0.5767\n-Small,4x4,hdr-rgb-rgb32.ktx,999.0000,0.0022,0.0004,0.5807\n-Small,4x4,hdr-rgba-rgba16.ktx,999.0000,0.0023,0.0004,0.5858\n-Small,4x4,hdr-rgba-rgba32.ktx,999.0000,0.0022,0.0004,0.5858\n-Small,4x4,ldr-rgb-00.png,37.2222,0.0091,0.0045,14.4482\n-Small,4x4,ldr-rgb-01.png,39.5245,0.0085,0.0040,16.3103\n-Small,4x4,ldr-rgb-02.png,34.7577,0.0104,0.0059,11.1989\n-Small,4x4,ldr-rgb-03.png,45.4679,0.0060,0.0018,35.8521\n-Small,4x4,ldr-rgb-04.png,41.6623,0.0075,0.0031,21.3963\n-Small,4x4,ldr-rgb-05.png,36.8538,0.0105,0.0062,10.5739\n-Small,4x4,ldr-rgb-06.png,34.9316,0.0101,0.0055,11.8722\n-Small,4x4,ldr-rgb-07.png,37.3401,0.0104,0.0060,10.9723\n-Small,4x4,ldr-rgb-08.png,42.9155,0.0067,0.0025,25.7425\n-Small,4x4,ldr-rgb-09.png,41.7013,0.0076,0.0031,21.3199\n-Small,4x4,ldr-rgb-10.png,43.9103,0.0034,0.0010,15.8749\n-Small,4x4,ldr-rgba-00.png,34.7263,0.0105,0.0058,11.3717\n-Small,4x4,ldr-rgba-01.png,38.6457,0.0091,0.0044,14.8840\n-Small,4x4,ldr-rgba-02.png,34.5443,0.0110,0.0061,10.7031\n-Small,4x4,ldr-xy-00.png,37.5056,0.0097,0.0032,20.4355\n-Small,4x4,ldr-xy-01.png,43.8548,0.0103,0.0037,17.5093\n-Small,4x4,ldr-xy-02.png,48.2399,0.0092,0.0026,25.0801\n-Small,4x4,ldrs-rgba-00.png,34.7306,0.0106,0.0059,11.1417\n-Small,4x4,ldrs-rgba-01.png,38.6640,0.0091,0.0044,15.0207\n-Small,4x4,ldrs-rgba-02.png,34.5473,0.0111,0.0062,10.5686\n-Small,5x5,hdr-rgb-00.hdr,28.8489,0.0918,0.0073,8.9226\n-Small,5x5,hdr-rgb-r16.ktx,999.0000,0.0027,0.0004,0.5730\n-Small,5x5,hdr-rgb-r32.ktx,999.0000,0.0027,0.0004,0.5845\n-Small,5x5,hdr-rgb-rg16.ktx,999.0000,0.0027,0.0004,0.5730\n-Small,5x5,hdr-rgb-rg32.ktx,999.0000,0.0027,0.0004,0.5754\n-Small,5x5,hdr-rgb-rgb16.ktx,999.0000,0.0027,0.0004,0.5829\n-Small,5x5,hdr-rgb-rgb32.ktx,999.0000,0.0027,0.0004,0.5791\n-Small,5x5,hdr-rgba-rgba16.ktx,999.0000,0.0027,0.0004,0.5887\n-Small,5x5,hdr-rgba-rgba32.ktx,999.0000,0.0027,0.0004,0.5969\n-Small,5x5,ldr-rgb-00.png,33.7080,0.0093,0.0043,15.1215\n-Small,5x5,ldr-rgb-01.png,36.0661,0.0084,0.0036,18.0000\n-Small,5x5,ldr-rgb-02.png,30.9741,0.0105,0.0056,11.6203\n-Small,5x5,ldr-rgb-03.png,42.3108,0.0062,0.0017,38.9842\n-Small,5x5,ldr-rgb-04.png,37.0268,0.0081,0.0032,20.2518\n-Small,5x5,ldr-rgb-05.png,32.9461,0.0113,0.0064,10.1939\n-Small,5x5,ldr-rgb-06.png,31.0218,0.0104,0.0055,11.9113\n-Small,5x5,ldr-rgb-07.png,34.3931,0.0103,0.0054,12.1230\n-Small,5x5,ldr-rgb-08.png,39.5677,0.0068,0.0022,29.3078\n-Small,5x5,ldr-rgb-09.png,37.0647,0.0080,0.0032,20.6675\n-Small,5x5,ldr-rgb-10.png,39.8998,0.0038,0.0010,16.7607\n-Small,5x5,ldr-rgba-00.png,31.0989,0.0111,0.0060,10.9500\n-Small,5x5,ldr-rgba-01.png,35.0302,0.0093,0.0043,15.2625\n-Small,5x5,ldr-rgba-02.png,31.0219,0.0114,0.0062,10.5112\n-Small,5x5,ldr-xy-00.png,36.6320,0.0100,0.0028,23.2809\n-Small,5x5,ldr-xy-01.png,39.1483,0.0104,0.0032,20.7392\n-Small,5x5,ldr-xy-02.png,43.8491,0.0097,0.0025,26.1415\n-Small,5x5,ldrs-rgba-00.png,31.1004,0.0113,0.0061,10.7770\n-Small,5x5,ldrs-rgba-01.png,35.0367,0.0094,0.0043,15.2093\n-Small,5x5,ldrs-rgba-02.png,31.0226,0.0113,0.0063,10.4556\n-Small,6x6,hdr-rgb-00.hdr,26.7310,0.0914,0.0066,9.8774\n-Small,6x6,hdr-rgb-r16.ktx,999.0000,0.0028,0.0005,0.5445\n-Small,6x6,hdr-rgb-r32.ktx,999.0000,0.0027,0.0004,0.5874\n-Small,6x6,hdr-rgb-rg16.ktx,999.0000,0.0027,0.0004,0.5845\n-Small,6x6,hdr-rgb-rg32.ktx,999.0000,0.0027,0.0004,0.5845\n-Small,6x6,hdr-rgb-rgb16.ktx,999.0000,0.0027,0.0004,0.5804\n-Small,6x6,hdr-rgb-rgb32.ktx,999.0000,0.0027,0.0004,0.5767\n-Small,6x6,hdr-rgba-rgba16.ktx,999.0000,0.0027,0.0004,0.5807\n-Small,6x6,hdr-rgba-rgba32.ktx,999.0000,0.0027,0.0004,0.5858\n-Small,6x6,ldr-rgb-00.png,31.3204,0.0101,0.0049,13.3475\n-Small,6x6,ldr-rgb-01.png,32.8330,0.0089,0.0040,16.2371\n-Small,6x6,ldr-rgb-02.png,27.3837,0.0110,0.0059,11.0331\n-Small,6x6,ldr-rgb-03.png,40.3163,0.0062,0.0016,41.8192\n-Small,6x6,ldr-rgb-04.png,33.7467,0.0085,0.0035,18.4817\n-Small,6x6,ldr-rgb-05.png,29.7319,0.0117,0.0068,9.6165\n-Small,6x6,ldr-rgb-06.png,27.4658,0.0109,0.0060,10.9118\n-Small,6x6,ldr-rgb-07.png,32.3322,0.0099,0.0050,13.0832\n-Small,6x6,ldr-rgb-08.png,37.4336,0.0068,0.0022,30.1335\n-Small,6x6,ldr-rgb-09.png,33.3053,0.0084,0.0035,18.5278\n-Small,6x6,ldr-rgb-10.png,36.5144,0.0039,0.0011,15.1517\n-Small,6x6,ldr-rgba-00.png,28.8376,0.0114,0.0062,10.6114\n-Small,6x6,ldr-rgba-01.png,31.9910,0.0097,0.0046,14.3562\n-Small,6x6,ldr-rgba-02.png,27.7796,0.0114,0.0061,10.6927\n-Small,6x6,ldr-xy-00.png,35.6056,0.0099,0.0027,24.6373\n-Small,6x6,ldr-xy-01.png,36.4953,0.0106,0.0035,18.9362\n-Small,6x6,ldr-xy-02.png,41.7981,0.0092,0.0023,29.0876\n-Small,6x6,ldrs-rgba-00.png,28.8344,0.0115,0.0063,10.3928\n-Small,6x6,ldrs-rgba-01.png,31.9975,0.0098,0.0047,14.0905\n-Small,6x6,ldrs-rgba-02.png,27.7778,0.0113,0.0060,10.8360\n-Small,8x8,hdr-rgb-00.hdr,23.6012,0.0956,0.0098,6.7133\n-Small,8x8,hdr-rgb-r16.ktx,999.0000,0.0040,0.0005,0.5589\n-Small,8x8,hdr-rgb-r32.ktx,999.0000,0.0040,0.0004,0.5871\n-Small,8x8,hdr-rgb-rg16.ktx,999.0000,0.0040,0.0004,0.5845\n-Small,8x8,hdr-rgb-rg32.ktx,999.0000,0.0040,0.0004,0.5804\n-Small,8x8,hdr-rgb-rgb16.ktx,999.0000,0.0040,0.0004,0.5845\n-Small,8x8,hdr-rgb-rgb32.ktx,999.0000,0.0040,0.0004,0.5739\n-Small,8x8,hdr-rgba-rgba16.ktx,999.0000,0.0040,0.0004,0.5791\n-Small,8x8,hdr-rgba-rgba32.ktx,999.0000,0.0040,0.0004,0.5779\n-Small,8x8,ldr-rgb-00.png,27.7031,0.0130,0.0067,9.7714\n-Small,8x8,ldr-rgb-01.png,28.6856,0.0117,0.0056,11.7746\n-Small,8x8,ldr-rgb-02.png,23.0240,0.0146,0.0085,7.7319\n-Small,8x8,ldr-rgb-03.png,37.0258,0.0077,0.0018,35.8708\n-Small,8x8,ldr-rgb-04.png,29.1260,0.0116,0.0053,12.4735\n-Small,8x8,ldr-rgb-05.png,25.6018,0.0158,0.0097,6.7823\n-Small,8x8,ldr-rgb-06.png,23.0810,0.0150,0.0087,7.5111\n-Small,8x8,ldr-rgb-07.png,29.4659,0.0117,0.0056,11.7049\n-Small,8x8,ldr-rgb-08.png,33.9551,0.0085,0.0026,25.5202\n-Small,8x8,ldr-rgb-09.png,28.4467,0.0112,0.0050,13.0292\n-Small,8x8,ldr-rgb-10.png,31.9058,0.0055,0.0012,13.0468\n-Small,8x8,ldr-rgba-00.png,25.3128,0.0154,0.0089,7.3538\n-Small,8x8,ldr-rgba-01.png,28.1781,0.0128,0.0064,10.2559\n-Small,8x8,ldr-rgba-02.png,23.8711,0.0153,0.0087,7.5450\n-Small,8x8,ldr-xy-00.png,33.2750,0.0125,0.0036,18.2147\n-Small,8x8,ldr-xy-01.png,34.1754,0.0129,0.0041,15.9497\n-Small,8x8,ldr-xy-02.png,39.7771,0.0105,0.0016,39.7452\n-Small,8x8,ldrs-rgba-00.png,25.3134,0.0155,0.0090,7.2744\n-Small,8x8,ldrs-rgba-01.png,28.1794,0.0129,0.0064,10.1905\n-Small,8x8,ldrs-rgba-02.png,23.8706,0.0153,0.0088,7.4685\n-Small,12x12,hdr-rgb-00.hdr,20.4489,0.1023,0.0144,4.5530\n-Small,12x12,hdr-rgb-r16.ktx,999.0000,0.0058,0.0004,0.5779\n-Small,12x12,hdr-rgb-r32.ktx,999.0000,0.0058,0.0005,0.5675\n-Small,12x12,hdr-rgb-rg16.ktx,999.0000,0.0058,0.0004,0.5727\n-Small,12x12,hdr-rgb-rg32.ktx,999.0000,0.0058,0.0004,0.5690\n-Small,12x12,hdr-rgb-rgb16.ktx,999.0000,0.0058,0.0004,0.5817\n-Small,12x12,hdr-rgb-rgb32.ktx,999.0000,0.0058,0.0005,0.5601\n-Small,12x12,hdr-rgba-rgba16.ktx,999.0000,0.0058,0.0004,0.5714\n-Small,12x12,hdr-rgba-rgba32.ktx,999.0000,0.0058,0.0005,0.5687\n-Small,12x12,ldr-rgb-00.png,23.7098,0.0144,0.0061,10.7736\n-Small,12x12,ldr-rgb-01.png,24.7256,0.0123,0.0044,14.9252\n-Small,12x12,ldr-rgb-02.png,19.1930,0.0175,0.0095,6.8818\n-Small,12x12,ldr-rgb-03.png,33.1431,0.0092,0.0014,46.4478\n-Small,12x12,ldr-rgb-04.png,24.3870,0.0125,0.0044,15.0552\n-Small,12x12,ldr-rgb-05.png,21.3834,0.0167,0.0086,7.6238\n-Small,12x12,ldr-rgb-06.png,19.1690,0.0179,0.0098,6.6608\n-Small,12x12,ldr-rgb-07.png,25.3142,0.0124,0.0042,15.6858\n-Small,12x12,ldr-rgb-08.png,30.1204,0.0100,0.0021,31.2823\n-Small,12x12,ldr-rgb-09.png,23.5983,0.0137,0.0055,11.8278\n-Small,12x12,ldr-rgb-10.png,27.2834,0.0075,0.0015,10.8796\n-Small,12x12,ldr-rgba-00.png,21.3613,0.0176,0.0093,7.0469\n-Small,12x12,ldr-rgba-01.png,24.4808,0.0138,0.0054,12.1252\n-Small,12x12,ldr-rgba-02.png,20.1381,0.0196,0.0111,5.9116\n-Small,12x12,ldr-xy-00.png,28.8908,0.0151,0.0035,18.4717\n-Small,12x12,ldr-xy-01.png,29.6770,0.0146,0.0032,20.7989\n-Small,12x12,ldr-xy-02.png,37.9716,0.0124,0.0010,62.6003\n-Small,12x12,ldrs-rgba-00.png,21.3627,0.0178,0.0093,7.0280\n-Small,12x12,ldrs-rgba-01.png,24.4817,0.0137,0.0054,12.1295\n-Small,12x12,ldrs-rgba-02.png,20.1379,0.0195,0.0110,5.9454\n-Small,3x3x3,ldr-l-00-3.dds,50.6979,0.0142,0.0073,35.6950\n-Small,3x3x3,ldr-l-01-3.dds,54.0388,0.0065,0.0031,22.0332\n-Small,6x6x6,ldr-l-00-3.dds,32.5210,0.0471,0.0345,7.5909\n-Small,6x6x6,ldr-l-01-3.dds,40.9072,0.0227,0.0134,5.1533\n" }, { "change_type": "DELETE", "old_path": "Test/Images/Small/astc_reference-main-avx2_medium_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-Small,4x4,hdr-rgb-00.hdr,34.1228,0.1034,0.0181,3.6172\n-Small,4x4,hdr-rgb-r16.ktx,999.0000,0.0037,0.0005,0.4689\n-Small,4x4,hdr-rgb-r32.ktx,999.0000,0.0036,0.0005,0.5313\n-Small,4x4,hdr-rgb-rg16.ktx,999.0000,0.0035,0.0004,0.5764\n-Small,4x4,hdr-rgb-rg32.ktx,999.0000,0.0036,0.0005,0.5205\n-Small,4x4,hdr-rgb-rgb16.ktx,999.0000,0.0036,0.0005,0.5506\n-Small,4x4,hdr-rgb-rgb32.ktx,999.0000,0.0036,0.0005,0.5663\n-Small,4x4,hdr-rgba-rgba16.ktx,999.0000,0.0036,0.0005,0.5601\n-Small,4x4,hdr-rgba-rgba32.ktx,999.0000,0.0036,0.0005,0.5459\n-Small,4x4,ldr-rgb-00.png,38.8085,0.0252,0.0194,3.3816\n-Small,4x4,ldr-rgb-01.png,40.2008,0.0223,0.0167,3.9241\n-Small,4x4,ldr-rgb-02.png,35.2653,0.0229,0.0171,3.8298\n-Small,4x4,ldr-rgb-03.png,47.2368,0.0152,0.0098,6.7024\n-Small,4x4,ldr-rgb-04.png,42.1830,0.0189,0.0131,4.9898\n-Small,4x4,ldr-rgb-05.png,37.7972,0.0247,0.0190,3.4404\n-Small,4x4,ldr-rgb-06.png,35.4535,0.0209,0.0151,4.3488\n-Small,4x4,ldr-rgb-07.png,39.2642,0.0300,0.0243,2.6993\n-Small,4x4,ldr-rgb-08.png,45.1563,0.0175,0.0121,5.4006\n-Small,4x4,ldr-rgb-09.png,42.1193,0.0191,0.0135,4.8520\n-Small,4x4,ldr-rgb-10.png,44.8973,0.0060,0.0023,7.0619\n-Small,4x4,ldr-rgba-00.png,36.2347,0.0278,0.0218,3.0093\n-Small,4x4,ldr-rgba-01.png,38.9491,0.0183,0.0123,5.3070\n-Small,4x4,ldr-rgba-02.png,34.9259,0.0208,0.0144,4.5410\n-Small,4x4,ldr-xy-00.png,37.7517,0.0188,0.0115,5.7142\n-Small,4x4,ldr-xy-01.png,45.1812,0.0248,0.0176,3.7135\n-Small,4x4,ldr-xy-02.png,50.9688,0.0293,0.0219,2.9921\n-Small,4x4,ldrs-rgba-00.png,36.2421,0.0280,0.0220,2.9738\n-Small,4x4,ldrs-rgba-01.png,38.9681,0.0186,0.0126,5.2141\n-Small,4x4,ldrs-rgba-02.png,34.9301,0.0199,0.0139,4.7168\n-Small,5x5,hdr-rgb-00.hdr,29.8788,0.1057,0.0193,3.3881\n-Small,5x5,hdr-rgb-r16.ktx,999.0000,0.0046,0.0005,0.5423\n-Small,5x5,hdr-rgb-r32.ktx,999.0000,0.0047,0.0005,0.5235\n-Small,5x5,hdr-rgb-rg16.ktx,999.0000,0.0047,0.0005,0.5470\n-Small,5x5,hdr-rgb-rg32.ktx,999.0000,0.0047,0.0005,0.4887\n-Small,5x5,hdr-rgb-rgb16.ktx,999.0000,0.0047,0.0005,0.5636\n-Small,5x5,hdr-rgb-rgb32.ktx,999.0000,0.0046,0.0005,0.5266\n-Small,5x5,hdr-rgba-rgba16.ktx,999.0000,0.0047,0.0005,0.5578\n-Small,5x5,hdr-rgba-rgba32.ktx,999.0000,0.0046,0.0004,0.5702\n-Small,5x5,ldr-rgb-00.png,35.1351,0.0269,0.0199,3.2876\n-Small,5x5,ldr-rgb-01.png,36.4365,0.0211,0.0142,4.6084\n-Small,5x5,ldr-rgb-02.png,31.1194,0.0215,0.0145,4.5069\n-Small,5x5,ldr-rgb-03.png,43.9924,0.0126,0.0060,10.9426\n-Small,5x5,ldr-rgb-04.png,37.6524,0.0196,0.0128,5.1108\n-Small,5x5,ldr-rgb-05.png,33.5352,0.0278,0.0210,3.1252\n-Small,5x5,ldr-rgb-06.png,31.1617,0.0206,0.0136,4.8054\n-Small,5x5,ldr-rgb-07.png,36.1272,0.0313,0.0243,2.6917\n-Small,5x5,ldr-rgb-08.png,41.6078,0.0168,0.0101,6.4836\n-Small,5x5,ldr-rgb-09.png,37.5763,0.0189,0.0121,5.4042\n-Small,5x5,ldr-rgb-10.png,40.5644,0.0073,0.0025,6.6216\n-Small,5x5,ldr-rgba-00.png,32.7850,0.0316,0.0244,2.6833\n-Small,5x5,ldr-rgba-01.png,35.3079,0.0200,0.0130,5.0502\n-Small,5x5,ldr-rgba-02.png,31.1309,0.0218,0.0146,4.4931\n-Small,5x5,ldr-xy-00.png,37.0775,0.0191,0.0106,6.1751\n-Small,5x5,ldr-xy-01.png,40.5669,0.0244,0.0158,4.1530\n-Small,5x5,ldr-xy-02.png,49.0821,0.0200,0.0115,5.6988\n-Small,5x5,ldrs-rgba-00.png,32.7888,0.0321,0.0246,2.6683\n-Small,5x5,ldrs-rgba-01.png,35.3171,0.0203,0.0131,5.0062\n-Small,5x5,ldrs-rgba-02.png,31.1320,0.0220,0.0147,4.4531\n-Small,6x6,hdr-rgb-00.hdr,27.4909,0.1067,0.0199,3.2871\n-Small,6x6,hdr-rgb-r16.ktx,999.0000,0.0048,0.0005,0.4867\n-Small,6x6,hdr-rgb-r32.ktx,999.0000,0.0047,0.0005,0.5289\n-Small,6x6,hdr-rgb-rg16.ktx,999.0000,0.0046,0.0005,0.5079\n-Small,6x6,hdr-rgb-rg32.ktx,999.0000,0.0046,0.0005,0.5675\n-Small,6x6,hdr-rgb-rgb16.ktx,999.0000,0.0046,0.0004,0.5807\n-Small,6x6,hdr-rgb-rgb32.ktx,999.0000,0.0045,0.0005,0.5625\n-Small,6x6,hdr-rgba-rgba16.ktx,999.0000,0.0045,0.0005,0.5540\n-Small,6x6,hdr-rgba-rgba32.ktx,999.0000,0.0045,0.0005,0.5613\n-Small,6x6,ldr-rgb-00.png,32.3857,0.0274,0.0205,3.1974\n-Small,6x6,ldr-rgb-01.png,33.0808,0.0206,0.0138,4.7583\n-Small,6x6,ldr-rgb-02.png,27.5038,0.0212,0.0144,4.5370\n-Small,6x6,ldr-rgb-03.png,41.7098,0.0110,0.0046,14.3689\n-Small,6x6,ldr-rgb-04.png,34.1969,0.0188,0.0118,5.5719\n-Small,6x6,ldr-rgb-05.png,30.1352,0.0278,0.0211,3.1083\n-Small,6x6,ldr-rgb-06.png,27.5711,0.0210,0.0142,4.6283\n-Small,6x6,ldr-rgb-07.png,33.8758,0.0296,0.0228,2.8759\n-Small,6x6,ldr-rgb-08.png,39.1905,0.0140,0.0076,8.6128\n-Small,6x6,ldr-rgb-09.png,33.6644,0.0181,0.0114,5.7371\n-Small,6x6,ldr-rgb-10.png,36.9239,0.0074,0.0025,6.6242\n-Small,6x6,ldr-rgba-00.png,30.2369,0.0334,0.0264,2.4780\n-Small,6x6,ldr-rgba-01.png,32.1917,0.0203,0.0133,4.9316\n-Small,6x6,ldr-rgba-02.png,27.8514,0.0226,0.0155,4.2219\n-Small,6x6,ldr-xy-00.png,36.2471,0.0174,0.0090,7.2537\n-Small,6x6,ldr-xy-01.png,37.9375,0.0197,0.0113,5.8033\n-Small,6x6,ldr-xy-02.png,46.0669,0.0165,0.0083,7.9083\n-Small,6x6,ldrs-rgba-00.png,30.2351,0.0334,0.0264,2.4862\n-Small,6x6,ldrs-rgba-01.png,32.1977,0.0204,0.0133,4.9146\n-Small,6x6,ldrs-rgba-02.png,27.8496,0.0226,0.0155,4.2368\n-Small,8x8,hdr-rgb-00.hdr,24.1284,0.1129,0.0254,2.5850\n-Small,8x8,hdr-rgb-r16.ktx,999.0000,0.0056,0.0004,0.5804\n-Small,8x8,hdr-rgb-r32.ktx,999.0000,0.0057,0.0005,0.5625\n-Small,8x8,hdr-rgb-rg16.ktx,999.0000,0.0056,0.0004,0.5832\n-Small,8x8,hdr-rgb-rg32.ktx,999.0000,0.0057,0.0004,0.5754\n-Small,8x8,hdr-rgb-rgb16.ktx,999.0000,0.0056,0.0005,0.5279\n-Small,8x8,hdr-rgb-rgb32.ktx,999.0000,0.0057,0.0004,0.5727\n-Small,8x8,hdr-rgba-rgba16.ktx,999.0000,0.0057,0.0005,0.5215\n-Small,8x8,hdr-rgba-rgba32.ktx,999.0000,0.0058,0.0005,0.5334\n-Small,8x8,ldr-rgb-00.png,28.7284,0.0353,0.0272,2.4133\n-Small,8x8,ldr-rgb-01.png,28.9370,0.0254,0.0173,3.7834\n-Small,8x8,ldr-rgb-02.png,23.1614,0.0268,0.0189,3.4697\n-Small,8x8,ldr-rgb-03.png,38.5560,0.0129,0.0054,12.1946\n-Small,8x8,ldr-rgb-04.png,29.6452,0.0249,0.0171,3.8363\n-Small,8x8,ldr-rgb-05.png,25.9412,0.0335,0.0256,2.5624\n-Small,8x8,ldr-rgb-06.png,23.2047,0.0273,0.0192,3.4119\n-Small,8x8,ldr-rgb-07.png,30.7489,0.0348,0.0268,2.4444\n-Small,8x8,ldr-rgb-08.png,35.9057,0.0169,0.0093,7.0265\n-Small,8x8,ldr-rgb-09.png,28.9902,0.0229,0.0152,4.3124\n-Small,8x8,ldr-rgb-10.png,32.1710,0.0092,0.0033,4.8584\n-Small,8x8,ldr-rgba-00.png,26.4438,0.0405,0.0324,2.0210\n-Small,8x8,ldr-rgba-01.png,28.3667,0.0253,0.0172,3.8167\n-Small,8x8,ldr-rgba-02.png,23.9414,0.0283,0.0201,3.2685\n-Small,8x8,ldr-xy-00.png,33.9178,0.0233,0.0124,5.3026\n-Small,8x8,ldr-xy-01.png,34.9386,0.0231,0.0124,5.2975\n-Small,8x8,ldr-xy-02.png,41.6877,0.0189,0.0083,7.9305\n-Small,8x8,ldrs-rgba-00.png,26.4457,0.0409,0.0327,2.0011\n-Small,8x8,ldrs-rgba-01.png,28.3702,0.0255,0.0173,3.7933\n-Small,8x8,ldrs-rgba-02.png,23.9416,0.0286,0.0204,3.2141\n-Small,12x12,hdr-rgb-00.hdr,20.7755,0.1280,0.0366,1.7906\n-Small,12x12,hdr-rgb-r16.ktx,999.0000,0.0094,0.0005,0.4813\n-Small,12x12,hdr-rgb-r32.ktx,999.0000,0.0093,0.0005,0.5235\n-Small,12x12,hdr-rgb-rg16.ktx,999.0000,0.0093,0.0005,0.5225\n-Small,12x12,hdr-rgb-rg32.ktx,999.0000,0.0092,0.0005,0.5495\n-Small,12x12,hdr-rgb-rgb16.ktx,999.0000,0.0092,0.0005,0.5651\n-Small,12x12,hdr-rgb-rgb32.ktx,999.0000,0.0094,0.0005,0.4903\n-Small,12x12,hdr-rgba-rgba16.ktx,999.0000,0.0094,0.0005,0.5459\n-Small,12x12,hdr-rgba-rgba32.ktx,999.0000,0.0094,0.0005,0.5578\n-Small,12x12,ldr-rgb-00.png,24.6915,0.0442,0.0324,2.0227\n-Small,12x12,ldr-rgb-01.png,25.0393,0.0342,0.0226,2.9018\n-Small,12x12,ldr-rgb-02.png,19.2743,0.0390,0.0275,2.3863\n-Small,12x12,ldr-rgb-03.png,34.9505,0.0173,0.0059,11.0628\n-Small,12x12,ldr-rgb-04.png,24.9006,0.0331,0.0217,3.0212\n-Small,12x12,ldr-rgb-05.png,21.6514,0.0448,0.0332,1.9732\n-Small,12x12,ldr-rgb-06.png,19.2513,0.0399,0.0281,2.3350\n-Small,12x12,ldr-rgb-07.png,26.7396,0.0410,0.0293,2.2391\n-Small,12x12,ldr-rgb-08.png,31.6566,0.0214,0.0101,6.5151\n-Small,12x12,ldr-rgb-09.png,24.1576,0.0323,0.0207,3.1641\n-Small,12x12,ldr-rgb-10.png,28.0433,0.0159,0.0064,2.5273\n-Small,12x12,ldr-rgba-00.png,22.2473,0.0490,0.0373,1.7561\n-Small,12x12,ldr-rgba-01.png,24.6500,0.0335,0.0217,3.0198\n-Small,12x12,ldr-rgba-02.png,20.1848,0.0419,0.0299,2.1917\n-Small,12x12,ldr-xy-00.png,30.2110,0.0301,0.0146,4.4798\n-Small,12x12,ldr-xy-01.png,31.8412,0.0312,0.0157,4.1751\n-Small,12x12,ldr-xy-02.png,38.5222,0.0187,0.0036,18.3988\n-Small,12x12,ldrs-rgba-00.png,22.2476,0.0491,0.0371,1.7649\n-Small,12x12,ldrs-rgba-01.png,24.6522,0.0337,0.0218,3.0098\n-Small,12x12,ldrs-rgba-02.png,20.1848,0.0426,0.0305,2.1480\n-Small,3x3x3,ldr-l-00-3.dds,51.8769,0.0195,0.0108,24.1895\n-Small,3x3x3,ldr-l-01-3.dds,54.6166,0.0085,0.0034,20.3188\n-Small,6x6x6,ldr-l-00-3.dds,32.9597,0.0575,0.0426,6.1493\n-Small,6x6x6,ldr-l-01-3.dds,41.0140,0.0248,0.0134,5.1372\n" }, { "change_type": "DELETE", "old_path": "Test/Images/Small/astc_reference-main-avx2_thorough_results.csv", "new_path": null, "diff": "-Image Set,Block Size,Name,PSNR,Total Time,Coding Time,Coding Rate\n-Small,4x4,hdr-rgb-00.hdr,34.3983,0.1205,0.0352,1.8601\n-Small,4x4,hdr-rgb-r16.ktx,999.0000,0.0037,0.0006,0.4548\n-Small,4x4,hdr-rgb-r32.ktx,999.0000,0.0037,0.0005,0.5321\n-Small,4x4,hdr-rgb-rg16.ktx,999.0000,0.0036,0.0005,0.5300\n-Small,4x4,hdr-rgb-rg32.ktx,999.0000,0.0037,0.0005,0.5256\n-Small,4x4,hdr-rgb-rgb16.ktx,999.0000,0.0036,0.0005,0.5377\n-Small,4x4,hdr-rgb-rgb32.ktx,999.0000,0.0036,0.0005,0.5651\n-Small,4x4,hdr-rgba-rgba16.ktx,999.0000,0.0037,0.0006,0.4604\n-Small,4x4,hdr-rgba-rgba32.ktx,999.0000,0.0037,0.0005,0.5279\n-Small,4x4,ldr-rgb-00.png,39.1342,0.0458,0.0399,1.6426\n-Small,4x4,ldr-rgb-01.png,40.3876,0.0440,0.0383,1.7131\n-Small,4x4,ldr-rgb-02.png,35.4467,0.0416,0.0358,1.8324\n-Small,4x4,ldr-rgb-03.png,47.7047,0.0408,0.0352,1.8596\n-Small,4x4,ldr-rgb-04.png,42.3334,0.0375,0.0316,2.0707\n-Small,4x4,ldr-rgb-05.png,37.9699,0.0453,0.0395,1.6591\n-Small,4x4,ldr-rgb-06.png,35.6101,0.0369,0.0310,2.1113\n-Small,4x4,ldr-rgb-07.png,39.8549,0.0541,0.0484,1.3549\n-Small,4x4,ldr-rgb-08.png,45.8134,0.0411,0.0354,1.8533\n-Small,4x4,ldr-rgb-09.png,42.2661,0.0403,0.0344,1.9027\n-Small,4x4,ldr-rgb-10.png,45.1066,0.0083,0.0046,3.5456\n-Small,4x4,ldr-rgba-00.png,36.7021,0.0480,0.0420,1.5598\n-Small,4x4,ldr-rgba-01.png,39.0813,0.0349,0.0288,2.2770\n-Small,4x4,ldr-rgba-02.png,35.0140,0.0347,0.0286,2.2949\n-Small,4x4,ldr-xy-00.png,37.7753,0.0458,0.0384,1.7047\n-Small,4x4,ldr-xy-01.png,45.2569,0.0510,0.0438,1.4954\n-Small,4x4,ldr-xy-02.png,50.9912,0.0627,0.0553,1.1847\n-Small,4x4,ldrs-rgba-00.png,36.7101,0.0488,0.0426,1.5384\n-Small,4x4,ldrs-rgba-01.png,39.1033,0.0352,0.0290,2.2607\n-Small,4x4,ldrs-rgba-02.png,35.0190,0.0348,0.0286,2.2923\n-Small,5x5,hdr-rgb-00.hdr,30.2798,0.1247,0.0378,1.7343\n-Small,5x5,hdr-rgb-r16.ktx,999.0000,0.0047,0.0005,0.5289\n-Small,5x5,hdr-rgb-r32.ktx,999.0000,0.0047,0.0005,0.5366\n-Small,5x5,hdr-rgb-rg16.ktx,999.0000,0.0047,0.0005,0.5355\n-Small,5x5,hdr-rgb-rg32.ktx,999.0000,0.0047,0.0005,0.5563\n-Small,5x5,hdr-rgb-rgb16.ktx,999.0000,0.0047,0.0005,0.5651\n-Small,5x5,hdr-rgb-rgb32.ktx,999.0000,0.0047,0.0005,0.5675\n-Small,5x5,hdr-rgba-rgba16.ktx,999.0000,0.0046,0.0005,0.5666\n-Small,5x5,hdr-rgba-rgba32.ktx,999.0000,0.0046,0.0004,0.5804\n-Small,5x5,ldr-rgb-00.png,35.3621,0.0515,0.0444,1.4766\n-Small,5x5,ldr-rgb-01.png,36.5321,0.0452,0.0382,1.7156\n-Small,5x5,ldr-rgb-02.png,31.1870,0.0401,0.0332,1.9750\n-Small,5x5,ldr-rgb-03.png,44.5330,0.0445,0.0380,1.7262\n-Small,5x5,ldr-rgb-04.png,37.8081,0.0415,0.0345,1.9006\n-Small,5x5,ldr-rgb-05.png,33.6831,0.0521,0.0452,1.4510\n-Small,5x5,ldr-rgb-06.png,31.2225,0.0378,0.0308,2.1257\n-Small,5x5,ldr-rgb-07.png,36.7056,0.0613,0.0545,1.2034\n-Small,5x5,ldr-rgb-08.png,42.3670,0.0438,0.0371,1.7662\n-Small,5x5,ldr-rgb-09.png,37.6985,0.0452,0.0383,1.7117\n-Small,5x5,ldr-rgb-10.png,40.7256,0.0101,0.0053,3.0516\n-Small,5x5,ldr-rgba-00.png,33.0948,0.0561,0.0490,1.3387\n-Small,5x5,ldr-rgba-01.png,35.4017,0.0390,0.0319,2.0518\n-Small,5x5,ldr-rgba-02.png,31.1706,0.0379,0.0307,2.1360\n-Small,5x5,ldr-xy-00.png,37.2349,0.0494,0.0409,1.6028\n-Small,5x5,ldr-xy-01.png,41.4147,0.0600,0.0515,1.2721\n-Small,5x5,ldr-xy-02.png,49.2617,0.0672,0.0587,1.1173\n-Small,5x5,ldrs-rgba-00.png,33.0983,0.0566,0.0496,1.3220\n-Small,5x5,ldrs-rgba-01.png,35.4095,0.0394,0.0321,2.0407\n-Small,5x5,ldrs-rgba-02.png,31.1715,0.0379,0.0307,2.1335\n-Small,6x6,hdr-rgb-00.hdr,27.6969,0.1257,0.0396,1.6552\n-Small,6x6,hdr-rgb-r16.ktx,999.0000,0.0047,0.0005,0.5029\n-Small,6x6,hdr-rgb-r32.ktx,999.0000,0.0046,0.0005,0.5345\n-Small,6x6,hdr-rgb-rg16.ktx,999.0000,0.0047,0.0005,0.5470\n-Small,6x6,hdr-rgb-rg32.ktx,999.0000,0.0046,0.0005,0.5628\n-Small,6x6,hdr-rgb-rgb16.ktx,999.0000,0.0046,0.0005,0.5313\n-Small,6x6,hdr-rgb-rgb32.ktx,999.0000,0.0047,0.0005,0.5448\n-Small,6x6,hdr-rgba-rgba16.ktx,999.0000,0.0047,0.0005,0.5636\n-Small,6x6,hdr-rgba-rgba32.ktx,999.0000,0.0046,0.0005,0.5628\n-Small,6x6,ldr-rgb-00.png,32.6234,0.0549,0.0479,1.3674\n-Small,6x6,ldr-rgb-01.png,33.1846,0.0471,0.0404,1.6222\n-Small,6x6,ldr-rgb-02.png,27.5522,0.0416,0.0346,1.8964\n-Small,6x6,ldr-rgb-03.png,42.5760,0.0376,0.0312,2.1009\n-Small,6x6,ldr-rgb-04.png,34.3279,0.0417,0.0347,1.8886\n-Small,6x6,ldr-rgb-05.png,30.2792,0.0523,0.0455,1.4409\n-Small,6x6,ldr-rgb-06.png,27.6242,0.0396,0.0327,2.0021\n-Small,6x6,ldr-rgb-07.png,34.4203,0.0642,0.0575,1.1397\n-Small,6x6,ldr-rgb-08.png,40.0074,0.0382,0.0316,2.0743\n-Small,6x6,ldr-rgb-09.png,33.8156,0.0439,0.0372,1.7603\n-Small,6x6,ldr-rgb-10.png,37.1109,0.0117,0.0067,2.4379\n-Small,6x6,ldr-rgba-00.png,30.4928,0.0609,0.0539,1.2169\n-Small,6x6,ldr-rgba-01.png,32.2709,0.0427,0.0355,1.8482\n-Small,6x6,ldr-rgba-02.png,27.8884,0.0399,0.0326,2.0108\n-Small,6x6,ldr-xy-00.png,36.3580,0.0404,0.0320,2.0485\n-Small,6x6,ldr-xy-01.png,38.1144,0.0559,0.0474,1.3825\n-Small,6x6,ldr-xy-02.png,47.4637,0.0678,0.0593,1.1059\n-Small,6x6,ldrs-rgba-00.png,30.4893,0.0607,0.0536,1.2220\n-Small,6x6,ldrs-rgba-01.png,32.2774,0.0429,0.0358,1.8306\n-Small,6x6,ldrs-rgba-02.png,27.8865,0.0400,0.0329,1.9925\n-Small,8x8,hdr-rgb-00.hdr,24.3310,0.1411,0.0520,1.2613\n-Small,8x8,hdr-rgb-r16.ktx,999.0000,0.0072,0.0005,0.5321\n-Small,8x8,hdr-rgb-r32.ktx,999.0000,0.0070,0.0005,0.5212\n-Small,8x8,hdr-rgb-rg16.ktx,999.0000,0.0070,0.0004,0.5714\n-Small,8x8,hdr-rgb-rg32.ktx,999.0000,0.0070,0.0004,0.5779\n-Small,8x8,hdr-rgb-rgb16.ktx,999.0000,0.0070,0.0005,0.5529\n-Small,8x8,hdr-rgb-rgb32.ktx,999.0000,0.0070,0.0005,0.5675\n-Small,8x8,hdr-rgba-rgba16.ktx,999.0000,0.0069,0.0005,0.5448\n-Small,8x8,hdr-rgba-rgba32.ktx,999.0000,0.0070,0.0005,0.5589\n-Small,8x8,ldr-rgb-00.png,28.9743,0.0700,0.0602,1.0883\n-Small,8x8,ldr-rgb-01.png,29.0250,0.0574,0.0481,1.3624\n-Small,8x8,ldr-rgb-02.png,23.2010,0.0542,0.0448,1.4626\n-Small,8x8,ldr-rgb-03.png,39.4059,0.0283,0.0194,3.3828\n-Small,8x8,ldr-rgb-04.png,29.7753,0.0527,0.0434,1.5087\n-Small,8x8,ldr-rgb-05.png,26.0443,0.0637,0.0543,1.2059\n-Small,8x8,ldr-rgb-06.png,23.2548,0.0530,0.0435,1.5081\n-Small,8x8,ldr-rgb-07.png,31.1950,0.0763,0.0670,0.9776\n-Small,8x8,ldr-rgb-08.png,36.5527,0.0401,0.0309,2.1204\n-Small,8x8,ldr-rgb-09.png,29.1512,0.0460,0.0367,1.7881\n-Small,8x8,ldr-rgb-10.png,32.3269,0.0151,0.0077,2.1214\n-Small,8x8,ldr-rgba-00.png,26.7455,0.0764,0.0669,0.9802\n-Small,8x8,ldr-rgba-01.png,28.4290,0.0551,0.0455,1.4403\n-Small,8x8,ldr-rgba-02.png,23.9672,0.0519,0.0423,1.5492\n-Small,8x8,ldr-xy-00.png,34.1954,0.0474,0.0364,1.7992\n-Small,8x8,ldr-xy-01.png,35.2284,0.0494,0.0386,1.6984\n-Small,8x8,ldr-xy-02.png,44.4736,0.0619,0.0511,1.2829\n-Small,8x8,ldrs-rgba-00.png,26.7459,0.0769,0.0673,0.9744\n-Small,8x8,ldrs-rgba-01.png,28.4323,0.0549,0.0453,1.4479\n-Small,8x8,ldrs-rgba-02.png,23.9676,0.0521,0.0425,1.5437\n-Small,12x12,hdr-rgb-00.hdr,21.0278,0.1708,0.0766,0.8561\n-Small,12x12,hdr-rgb-r16.ktx,999.0000,0.0116,0.0005,0.5182\n-Small,12x12,hdr-rgb-r32.ktx,999.0000,0.0117,0.0005,0.5540\n-Small,12x12,hdr-rgb-rg16.ktx,999.0000,0.0117,0.0005,0.5473\n-Small,12x12,hdr-rgb-rg32.ktx,999.0000,0.0117,0.0005,0.5616\n-Small,12x12,hdr-rgb-rgb16.ktx,999.0000,0.0117,0.0005,0.5601\n-Small,12x12,hdr-rgb-rgb32.ktx,999.0000,0.0117,0.0005,0.5578\n-Small,12x12,hdr-rgba-rgba16.ktx,999.0000,0.0117,0.0005,0.5651\n-Small,12x12,hdr-rgba-rgba32.ktx,999.0000,0.0117,0.0005,0.5459\n-Small,12x12,ldr-rgb-00.png,25.0567,0.0953,0.0811,0.8078\n-Small,12x12,ldr-rgb-01.png,25.1428,0.0783,0.0640,1.0248\n-Small,12x12,ldr-rgb-02.png,19.2937,0.0869,0.0730,0.8981\n-Small,12x12,ldr-rgb-03.png,36.1599,0.0343,0.0205,3.1944\n-Small,12x12,ldr-rgb-04.png,24.9934,0.0709,0.0568,1.1538\n-Small,12x12,ldr-rgb-05.png,21.7356,0.0865,0.0725,0.9044\n-Small,12x12,ldr-rgb-06.png,19.2955,0.0837,0.0695,0.9435\n-Small,12x12,ldr-rgb-07.png,27.0999,0.0962,0.0820,0.7989\n-Small,12x12,ldr-rgb-08.png,32.4850,0.0428,0.0289,2.2707\n-Small,12x12,ldr-rgb-09.png,24.3014,0.0674,0.0532,1.2316\n-Small,12x12,ldr-rgb-10.png,28.1869,0.0256,0.0135,1.2071\n-Small,12x12,ldr-rgba-00.png,22.7181,0.1000,0.0856,0.7656\n-Small,12x12,ldr-rgba-01.png,24.7277,0.0798,0.0654,1.0026\n-Small,12x12,ldr-rgba-02.png,20.2040,0.0822,0.0679,0.9655\n-Small,12x12,ldr-xy-00.png,30.5815,0.0640,0.0481,1.3614\n-Small,12x12,ldr-xy-01.png,32.1781,0.0517,0.0361,1.8138\n-Small,12x12,ldr-xy-02.png,40.2787,0.0388,0.0232,2.8212\n-Small,12x12,ldrs-rgba-00.png,22.7169,0.1006,0.0860,0.7622\n-Small,12x12,ldrs-rgba-01.png,24.7295,0.0797,0.0653,1.0036\n-Small,12x12,ldrs-rgba-02.png,20.2043,0.0827,0.0683,0.9597\n-Small,3x3x3,ldr-l-00-3.dds,52.3094,0.0328,0.0242,10.8476\n-Small,3x3x3,ldr-l-01-3.dds,55.2511,0.0145,0.0095,7.2740\n-Small,6x6x6,ldr-l-00-3.dds,33.2738,0.0790,0.0614,4.2727\n-Small,6x6x6,ldr-l-01-3.dds,41.7409,0.0281,0.0140,4.9399\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Remove old main reference
61,745
24.01.2023 13:14:17
0
0808704c70b9732a9b5c6916c08c5e8bd3f8c2a7
Fix CLI option typo for -2/3/4partitioncandidatelimit Fixes
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel.cpp", "new_path": "Source/astcenccli_toplevel.cpp", "diff": "// SPDX-License-Identifier: Apache-2.0\n// ----------------------------------------------------------------------------\n-// Copyright 2011-2022 Arm Limited\n+// Copyright 2011-2023 Arm Limited\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n// use this file except in compliance with the License. You may obtain a copy\n@@ -931,7 +931,7 @@ static int edit_astcenc_config(\nconfig.tune_2partition_index_limit = atoi(argv[argidx - 1]);\n}\n- else if (!strcmp(argv[argidx], \"-2partitioncandiatelimit\"))\n+ else if (!strcmp(argv[argidx], \"-2partitioncandidatelimit\"))\n{\nargidx += 2;\nif (argidx > argc)\n@@ -942,23 +942,23 @@ static int edit_astcenc_config(\nconfig.tune_2partitioning_candidate_limit = atoi(argv[argidx - 1]);\n}\n- else if (!strcmp(argv[argidx], \"-3partitioncandiatelimit\"))\n+ else if (!strcmp(argv[argidx], \"-3partitioncandidatelimit\"))\n{\nargidx += 2;\nif (argidx > argc)\n{\n- printf(\"ERROR: -3partitioncandiatelimit switch with no argument\\n\");\n+ printf(\"ERROR: -3partitioncandidatelimit switch with no argument\\n\");\nreturn 1;\n}\nconfig.tune_3partitioning_candidate_limit = atoi(argv[argidx - 1]);\n}\n- else if (!strcmp(argv[argidx], \"-4partitioncandiatelimit\"))\n+ else if (!strcmp(argv[argidx], \"-4partitioncandidatelimit\"))\n{\nargidx += 2;\nif (argidx > argc)\n{\n- printf(\"ERROR: -4partitioncandiatelimit switch with no argument\\n\");\n+ printf(\"ERROR: -4partitioncandidatelimit switch with no argument\\n\");\nreturn 1;\n}\n" }, { "change_type": "MODIFY", "old_path": "Test/astc_test_functional.py", "new_path": "Test/astc_test_functional.py", "diff": "#!/usr/bin/env python3\n# SPDX-License-Identifier: Apache-2.0\n# -----------------------------------------------------------------------------\n-# Copyright 2020-2022 Arm Limited\n+# Copyright 2020-2023 Arm Limited\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n# use this file except in compliance with the License. You may obtain a copy\n@@ -1275,6 +1275,74 @@ class CLIPTest(CLITestBase):\n# RMSE should get worse (higher) if we reduce search space\nself.assertGreater(testRMSE, refRMSE)\n+ def test_2partition_candidate_limit(self):\n+ \"\"\"\n+ Test 2 partition partitioning candidate limit.\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\"]\n+\n+ self.exec(command)\n+ refRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ command += [\"-2partitioncandidatelimit\", \"1\"]\n+ self.exec(command)\n+ testRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ # RMSE should get worse (higher) if we reduce search space\n+ self.assertGreater(testRMSE, refRMSE)\n+\n+ def test_3partition_candidate_limit(self):\n+ \"\"\"\n+ Test 3 partition partitioning candidate limit.\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\"]\n+\n+ self.exec(command)\n+ refRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ command += [\"-3partitioncandidatelimit\", \"1\"]\n+ self.exec(command)\n+ testRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ # RMSE should get worse (higher) if we reduce search space\n+ self.assertGreater(testRMSE, refRMSE)\n+\n+ def test_4partition_candidate_limit(self):\n+ \"\"\"\n+ Test 4 partition partitioning candidate limit.\n+ \"\"\"\n+ inputFile = \"./Test/Images/Small/LDR-RGBA/ldr-rgba-00.png\"\n+ decompFile = self.get_tmp_image_path(\"LDR\", \"decomp\")\n+\n+ # Compute the basic image without any channel weights\n+ command = [\n+ self.binary, \"-tl\",\n+ inputFile, decompFile, \"4x4\", \"-medium\"]\n+\n+ self.exec(command)\n+ refRMSE = sum(self.get_channel_rmse(inputFile, decompFile))\n+\n+ command += [\"-4partitioncandidatelimit\", \"1\"]\n+ self.exec(command)\n+\n+ # RMSE should get worse (higher) if we reduce search space\n+ # Don't check this here, as 4 partitions not used in any Small image\n+ # even for -exhaustive, BUT command line option must be accepted and\n+ # not error ...\n+ # self.assertGreater(testRMSE, refRMSE)\n+\n@unittest.skipIf(os.cpu_count() == 1, \"Cannot test on single core host\")\ndef test_thread_count(self):\n\"\"\"\n@@ -1770,7 +1838,7 @@ class CLINTest(CLITestBase):\n# Run the command, incrementally omitting arguments\nself.exec_with_omit(command, 7)\n- def test_cl_2partitionlimit_missing_args(self):\n+ def test_cl_2partitionindexlimit_missing_args(self):\n\"\"\"\nTest -cl with -2partitionindexlimit and missing arguments.\n\"\"\"\n@@ -1785,7 +1853,7 @@ class CLINTest(CLITestBase):\n# Run the command, incrementally omitting arguments\nself.exec_with_omit(command, 7)\n- def test_cl_3partitionlimit_missing_args(self):\n+ def test_cl_3partitionindexlimit_missing_args(self):\n\"\"\"\nTest -cl with -3partitionindexlimit and missing arguments.\n\"\"\"\n@@ -1800,7 +1868,7 @@ class CLINTest(CLITestBase):\n# Run the command, incrementally omitting arguments\nself.exec_with_omit(command, 7)\n- def test_cl_4partitionlimit_missing_args(self):\n+ def test_cl_4partitionindexlimit_missing_args(self):\n\"\"\"\nTest -cl with -4partitionindexlimit and missing arguments.\n\"\"\"\n@@ -1815,6 +1883,52 @@ class CLINTest(CLITestBase):\n# Run the command, incrementally omitting arguments\nself.exec_with_omit(command, 7)\n+ def test_cl_2partitioncandidatelimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -2partitioncandidatelimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-2partitioncandidatelimit\", \"1\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+ def test_cl_3partitioncandidatelimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -3partitioncandidatelimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-3partitioncandidatelimit\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\n+\n+ def test_cl_4partitioncandidatelimit_missing_args(self):\n+ \"\"\"\n+ Test -cl with -4partitioncandidatelimit and missing arguments.\n+ \"\"\"\n+ # Build a valid command\n+ command = [\n+ self.binary, \"-cl\",\n+ self.get_ref_image_path(\"LDR\", \"input\", \"A\"),\n+ self.get_tmp_image_path(\"LDR\", \"comp\"),\n+ \"4x4\", \"-fast\",\n+ \"-4partitioncandidatelimit\", \"3\"]\n+\n+ # Run the command, incrementally omitting arguments\n+ self.exec_with_omit(command, 7)\n+\ndef test_cl_blockmodelimit_missing_args(self):\n\"\"\"\nTest -cl with -blockmodelimit and missing arguments.\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix CLI option typo for -2/3/4partitioncandidatelimit Fixes #395
61,745
24.01.2023 22:27:37
0
82523e9162f73f09e7ff17e00aed0ed8bde9672b
Fix -3/4partitionindexlimit CLI options
[ { "change_type": "MODIFY", "old_path": "Source/astcenccli_toplevel.cpp", "new_path": "Source/astcenccli_toplevel.cpp", "diff": "@@ -918,7 +918,7 @@ static int edit_astcenc_config(\nreturn 1;\n}\n- config.tune_2partition_index_limit = atoi(argv[argidx - 1]);\n+ config.tune_3partition_index_limit = atoi(argv[argidx - 1]);\n}\nelse if (!strcmp(argv[argidx], \"-4partitionindexlimit\"))\n{\n@@ -929,7 +929,7 @@ static int edit_astcenc_config(\nreturn 1;\n}\n- config.tune_2partition_index_limit = atoi(argv[argidx - 1]);\n+ config.tune_4partition_index_limit = atoi(argv[argidx - 1]);\n}\nelse if (!strcmp(argv[argidx], \"-2partitioncandidatelimit\"))\n{\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix -3/4partitionindexlimit CLI options
61,745
29.01.2023 20:11:15
0
6ea9ef711d7550b267f4f1d3cff2afda7e835b7d
Update to stb_image.h v2.28
[ { "change_type": "MODIFY", "old_path": "Docs/ChangeLog-4x.md", "new_path": "Docs/ChangeLog-4x.md", "diff": "@@ -6,6 +6,20 @@ release of the 4.x series.\nAll performance data on this page is measured on an Intel Core i5-9600K\nclocked at 4.2 GHz, running `astcenc` using AVX2 and 6 threads.\n+<!-- ---------------------------------------------------------------------- -->\n+## 4.4.0\n+\n+**Status:** In development\n+\n+The 4.4.0 release is a minor maintenance release. No performance or image\n+quality changes are expected.\n+\n+* **General:**\n+ * **Bug-fix:** Fixed typo in -2/3/4partitioncandidatelimit CLI options.\n+ * **Bug-fix:** Fixed handling for -3/4partitionindexlimit CLI options.\n+ * **Bug-fix:** Updated to stb_image.h v2.28, which includes multiple fixes\n+ and improvements for image loading.\n+\n<!-- ---------------------------------------------------------------------- -->\n## 4.3.0\n" }, { "change_type": "MODIFY", "old_path": "Source/cmake_core.cmake", "new_path": "Source/cmake_core.cmake", "diff": "@@ -297,6 +297,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES \"GNU|Clang\")\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-cast-qual>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-reserved-identifier>\"\n\" $<$<CXX_COMPILER_ID:Clang>: -Wno-missing-prototypes>\"\n+ \" $<$<CXX_COMPILER_ID:Clang>: -Wno-missing-field-initializers>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-suggest-override>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-used-but-marked-unused>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-noexcept-type>\"\n" }, { "change_type": "MODIFY", "old_path": "Source/stb_image.h", "new_path": "Source/stb_image.h", "diff": "-/* stb_image - v2.27 - public domain image loader - http://nothings.org/stb\n+/* stb_image - v2.28 - public domain image loader - http://nothings.org/stb\nno warranty implied; use at your own risk\nDo this:\n@@ -48,6 +48,7 @@ LICENSE\nRECENT REVISION HISTORY:\n+ 2.28 (2023-01-29) many error fixes, security errors, just tons of stuff\n2.27 (2021-07-11) document stbi_info better, 16-bit PNM support, bug fixes\n2.26 (2020-07-13) many minor fixes\n2.25 (2020-02-02) fix warnings\n@@ -108,7 +109,7 @@ RECENT REVISION HISTORY:\nCass Everitt Ryamond Barbiero github:grim210\nPaul Du Bois Engin Manap Aldo Culquicondor github:sammyhw\nPhilipp Wiesemann Dale Weiler Oriol Ferrer Mesia github:phprus\n- Josh Tobin Matthew Gregan github:poppolopoppo\n+ Josh Tobin Neil Bickford Matthew Gregan github:poppolopoppo\nJulian Raschke Gregory Mullen Christian Floisand github:darealshinji\nBaldur Karlsson Kevin Schmidt JR Smith github:Michaelangel007\nBrad Weinberger Matvey Cherevko github:mosra\n@@ -140,7 +141,7 @@ RECENT REVISION HISTORY:\n// // ... x = width, y = height, n = # 8-bit components per pixel ...\n// // ... replace '0' with '1'..'4' to force that many components per pixel\n// // ... but 'n' will always be the number that it would have been if you said 0\n-// stbi_image_free(data)\n+// stbi_image_free(data);\n//\n// Standard parameters:\n// int *x -- outputs image width in pixels\n@@ -635,7 +636,7 @@ STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const ch\n#endif\n#endif\n-#ifdef _MSC_VER\n+#if defined(_MSC_VER) || defined(__SYMBIAN32__)\ntypedef unsigned short stbi__uint16;\ntypedef signed short stbi__int16;\ntypedef unsigned int stbi__uint32;\n@@ -1032,7 +1033,7 @@ static int stbi__mad3sizes_valid(int a, int b, int c, int add)\n}\n// returns 1 if \"a*b*c*d + add\" has no negative terms/factors and doesn't overflow\n-#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)\n+#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) || !defined(STBI_NO_PNM)\nstatic int stbi__mad4sizes_valid(int a, int b, int c, int d, int add)\n{\nreturn stbi__mul2sizes_valid(a, b) && stbi__mul2sizes_valid(a*b, c) &&\n@@ -1055,7 +1056,7 @@ static void *stbi__malloc_mad3(int a, int b, int c, int add)\nreturn stbi__malloc(a*b*c + add);\n}\n-#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR)\n+#if !defined(STBI_NO_LINEAR) || !defined(STBI_NO_HDR) || !defined(STBI_NO_PNM)\nstatic void *stbi__malloc_mad4(int a, int b, int c, int d, int add)\n{\nif (!stbi__mad4sizes_valid(a, b, c, d, add)) return NULL;\n@@ -1063,6 +1064,23 @@ static void *stbi__malloc_mad4(int a, int b, int c, int d, int add)\n}\n#endif\n+// returns 1 if the sum of two signed ints is valid (between -2^31 and 2^31-1 inclusive), 0 on overflow.\n+static int stbi__addints_valid(int a, int b)\n+{\n+ if ((a >= 0) != (b >= 0)) return 1; // a and b have different signs, so no overflow\n+ if (a < 0 && b < 0) return a >= INT_MIN - b; // same as a + b >= INT_MIN; INT_MIN - b cannot overflow since b < 0.\n+ return a <= INT_MAX - b;\n+}\n+\n+// returns 1 if the product of two signed shorts is valid, 0 on overflow.\n+static int stbi__mul2shorts_valid(short a, short b)\n+{\n+ if (b == 0 || b == -1) return 1; // multiplication by 0 is always 0; check for -1 so SHRT_MIN/b doesn't overflow\n+ if ((a >= 0) == (b >= 0)) return a <= SHRT_MAX/b; // product is positive, so similar to mul2sizes_valid\n+ if (b < 0) return a <= SHRT_MIN / b; // same as a * b >= SHRT_MIN\n+ return a >= SHRT_MIN / b;\n+}\n+\n// stbi__err - error\n// stbi__errpf - error returning pointer to float\n// stbi__errpuc - error returning pointer to unsigned char\n@@ -1985,9 +2003,12 @@ static int stbi__build_huffman(stbi__huffman *h, int *count)\nint i,j,k=0;\nunsigned int code;\n// build size list for each symbol (from JPEG spec)\n- for (i=0; i < 16; ++i)\n- for (j=0; j < count[i]; ++j)\n+ for (i=0; i < 16; ++i) {\n+ for (j=0; j < count[i]; ++j) {\nh->size[k++] = (stbi_uc) (i+1);\n+ if(k >= 257) return stbi__err(\"bad size list\",\"Corrupt JPEG\");\n+ }\n+ }\nh->size[k] = 0;\n// compute actual symbols (from jpeg spec)\n@@ -2112,6 +2133,8 @@ stbi_inline static int stbi__jpeg_huff_decode(stbi__jpeg *j, stbi__huffman *h)\n// convert the huffman code to the symbol id\nc = ((j->code_buffer >> (32 - k)) & stbi__bmask[k]) + h->delta[k];\n+ if(c < 0 || c >= 256) // symbol id out of bounds!\n+ return -1;\nSTBI_ASSERT((((j->code_buffer) >> (32 - h->size[c])) & stbi__bmask[h->size[c]]) == h->code[c]);\n// convert the id to a symbol\n@@ -2130,6 +2153,7 @@ stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n)\nunsigned int k;\nint sgn;\nif (j->code_bits < n) stbi__grow_buffer_unsafe(j);\n+ if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s intead of continuing\nsgn = j->code_buffer >> 31; // sign bit always in MSB; 0 if MSB clear (positive), 1 if MSB set (negative)\nk = stbi_lrot(j->code_buffer, n);\n@@ -2144,6 +2168,7 @@ stbi_inline static int stbi__jpeg_get_bits(stbi__jpeg *j, int n)\n{\nunsigned int k;\nif (j->code_bits < n) stbi__grow_buffer_unsafe(j);\n+ if (j->code_bits < n) return 0; // ran out of bits from stream, return 0s intead of continuing\nk = stbi_lrot(j->code_buffer, n);\nj->code_buffer = k & ~stbi__bmask[n];\nk &= stbi__bmask[n];\n@@ -2155,6 +2180,7 @@ stbi_inline static int stbi__jpeg_get_bit(stbi__jpeg *j)\n{\nunsigned int k;\nif (j->code_bits < 1) stbi__grow_buffer_unsafe(j);\n+ if (j->code_bits < 1) return 0; // ran out of bits from stream, return 0s intead of continuing\nk = j->code_buffer;\nj->code_buffer <<= 1;\n--j->code_bits;\n@@ -2192,8 +2218,10 @@ static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman\nmemset(data,0,64*sizeof(data[0]));\ndiff = t ? stbi__extend_receive(j, t) : 0;\n+ if (!stbi__addints_valid(j->img_comp[b].dc_pred, diff)) return stbi__err(\"bad delta\",\"Corrupt JPEG\");\ndc = j->img_comp[b].dc_pred + diff;\nj->img_comp[b].dc_pred = dc;\n+ if (!stbi__mul2shorts_valid(dc, dequant[0])) return stbi__err(\"can't merge dc and ac\", \"Corrupt JPEG\");\ndata[0] = (short) (dc * dequant[0]);\n// decode AC components, see JPEG spec\n@@ -2207,6 +2235,7 @@ static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman\nif (r) { // fast-AC path\nk += (r >> 4) & 15; // run\ns = r & 15; // combined length\n+ if (s > j->code_bits) return stbi__err(\"bad huffman code\", \"Combined length longer than code bits available\");\nj->code_buffer <<= s;\nj->code_bits -= s;\n// decode into unzigzag'd location\n@@ -2246,8 +2275,10 @@ static int stbi__jpeg_decode_block_prog_dc(stbi__jpeg *j, short data[64], stbi__\nif (t < 0 || t > 15) return stbi__err(\"can't merge dc and ac\", \"Corrupt JPEG\");\ndiff = t ? stbi__extend_receive(j, t) : 0;\n+ if (!stbi__addints_valid(j->img_comp[b].dc_pred, diff)) return stbi__err(\"bad delta\", \"Corrupt JPEG\");\ndc = j->img_comp[b].dc_pred + diff;\nj->img_comp[b].dc_pred = dc;\n+ if (!stbi__mul2shorts_valid(dc, 1 << j->succ_low)) return stbi__err(\"can't merge dc and ac\", \"Corrupt JPEG\");\ndata[0] = (short) (dc * (1 << j->succ_low));\n} else {\n// refinement scan for DC coefficient\n@@ -2282,6 +2313,7 @@ static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__\nif (r) { // fast-AC path\nk += (r >> 4) & 15; // run\ns = r & 15; // combined length\n+ if (s > j->code_bits) return stbi__err(\"bad huffman code\", \"Combined length longer than code bits available\");\nj->code_buffer <<= s;\nj->code_bits -= s;\nzig = stbi__jpeg_dezigzag[k++];\n@@ -3102,6 +3134,7 @@ static int stbi__process_marker(stbi__jpeg *z, int m)\nsizes[i] = stbi__get8(z->s);\nn += sizes[i];\n}\n+ if(n > 256) return stbi__err(\"bad DHT header\",\"Corrupt JPEG\"); // Loop over i < n would write past end of values!\nL -= 17;\nif (tc == 0) {\nif (!stbi__build_huffman(z->huff_dc+th, sizes)) return 0;\n@@ -3267,6 +3300,13 @@ static int stbi__process_frame_header(stbi__jpeg *z, int scan)\nif (z->img_comp[i].v > v_max) v_max = z->img_comp[i].v;\n}\n+ // check that plane subsampling factors are integer ratios; our resamplers can't deal with fractional ratios\n+ // and I've never seen a non-corrupted JPEG file actually use them\n+ for (i=0; i < s->img_n; ++i) {\n+ if (h_max % z->img_comp[i].h != 0) return stbi__err(\"bad H\",\"Corrupt JPEG\");\n+ if (v_max % z->img_comp[i].v != 0) return stbi__err(\"bad V\",\"Corrupt JPEG\");\n+ }\n+\n// compute interleaved mcu info\nz->img_h_max = h_max;\nz->img_v_max = v_max;\n@@ -3344,6 +3384,28 @@ static int stbi__decode_jpeg_header(stbi__jpeg *z, int scan)\nreturn 1;\n}\n+static int stbi__skip_jpeg_junk_at_end(stbi__jpeg *j)\n+{\n+ // some JPEGs have junk at end, skip over it but if we find what looks\n+ // like a valid marker, resume there\n+ while (!stbi__at_eof(j->s)) {\n+ int x = stbi__get8(j->s);\n+ while (x == 255) { // might be a marker\n+ if (stbi__at_eof(j->s)) return STBI__MARKER_none;\n+ x = stbi__get8(j->s);\n+ if (x != 0x00 && x != 0xff) {\n+ // not a stuffed zero or lead-in to another marker, looks\n+ // like an actual marker, return it\n+ return x;\n+ }\n+ // stuffed zero has x=0 now which ends the loop, meaning we go\n+ // back to regular scan loop.\n+ // repeated 0xff keeps trying to read the next byte of the marker.\n+ }\n+ }\n+ return STBI__MARKER_none;\n+}\n+\n// decode image to YCbCr format\nstatic int stbi__decode_jpeg_image(stbi__jpeg *j)\n{\n@@ -3360,26 +3422,23 @@ static int stbi__decode_jpeg_image(stbi__jpeg *j)\nif (!stbi__process_scan_header(j)) return 0;\nif (!stbi__parse_entropy_coded_data(j)) return 0;\nif (j->marker == STBI__MARKER_none ) {\n- // handle 0s at the end of image data from IP Kamera 9060\n- while (!stbi__at_eof(j->s)) {\n- int x = stbi__get8(j->s);\n- if (x == 255) {\n- j->marker = stbi__get8(j->s);\n- break;\n- }\n- }\n+ j->marker = stbi__skip_jpeg_junk_at_end(j);\n// if we reach eof without hitting a marker, stbi__get_marker() below will fail and we'll eventually return 0\n}\n+ m = stbi__get_marker(j);\n+ if (STBI__RESTART(m))\n+ m = stbi__get_marker(j);\n} else if (stbi__DNL(m)) {\nint Ld = stbi__get16be(j->s);\nstbi__uint32 NL = stbi__get16be(j->s);\nif (Ld != 4) return stbi__err(\"bad DNL len\", \"Corrupt JPEG\");\nif (NL != j->s->img_y) return stbi__err(\"bad DNL height\", \"Corrupt JPEG\");\n+ m = stbi__get_marker(j);\n} else {\n- if (!stbi__process_marker(j, m)) return 0;\n- }\n+ if (!stbi__process_marker(j, m)) return 1;\nm = stbi__get_marker(j);\n}\n+ }\nif (j->progressive)\nstbi__jpeg_finish(j);\nreturn 1;\n@@ -3969,6 +4028,7 @@ static void *stbi__jpeg_load(stbi__context *s, int *x, int *y, int *comp, int re\nunsigned char* result;\nstbi__jpeg* j = (stbi__jpeg*) stbi__malloc(sizeof(stbi__jpeg));\nif (!j) return stbi__errpuc(\"outofmem\", \"Out of memory\");\n+ memset(j, 0, sizeof(stbi__jpeg));\nSTBI_NOTUSED(ri);\nj->s = s;\nstbi__setup_jpeg(j);\n@@ -3982,6 +4042,7 @@ static int stbi__jpeg_test(stbi__context *s)\nint r;\nstbi__jpeg* j = (stbi__jpeg*)stbi__malloc(sizeof(stbi__jpeg));\nif (!j) return stbi__err(\"outofmem\", \"Out of memory\");\n+ memset(j, 0, sizeof(stbi__jpeg));\nj->s = s;\nstbi__setup_jpeg(j);\nr = stbi__decode_jpeg_header(j, STBI__SCAN_type);\n@@ -4007,6 +4068,7 @@ static int stbi__jpeg_info(stbi__context *s, int *x, int *y, int *comp)\nint result;\nstbi__jpeg* j = (stbi__jpeg*) (stbi__malloc(sizeof(stbi__jpeg)));\nif (!j) return stbi__err(\"outofmem\", \"Out of memory\");\n+ memset(j, 0, sizeof(stbi__jpeg));\nj->s = s;\nresult = stbi__jpeg_info_raw(j, x, y, comp);\nSTBI_FREE(j);\n@@ -4249,11 +4311,12 @@ static int stbi__parse_huffman_block(stbi__zbuf *a)\na->zout = zout;\nreturn 1;\n}\n+ if (z >= 286) return stbi__err(\"bad huffman code\",\"Corrupt PNG\"); // per DEFLATE, length codes 286 and 287 must not appear in compressed data\nz -= 257;\nlen = stbi__zlength_base[z];\nif (stbi__zlength_extra[z]) len += stbi__zreceive(a, stbi__zlength_extra[z]);\nz = stbi__zhuffman_decode(a, &a->z_distance);\n- if (z < 0) return stbi__err(\"bad huffman code\",\"Corrupt PNG\");\n+ if (z < 0 || z >= 30) return stbi__err(\"bad huffman code\",\"Corrupt PNG\"); // per DEFLATE, distance codes 30 and 31 must not appear in compressed data\ndist = stbi__zdist_base[z];\nif (stbi__zdist_extra[z]) dist += stbi__zreceive(a, stbi__zdist_extra[z]);\nif (zout - a->zout_start < dist) return stbi__err(\"bad dist\",\"Corrupt PNG\");\n@@ -4948,7 +5011,7 @@ STBIDEF void stbi_convert_iphone_png_to_rgb(int flag_true_if_should_convert)\nstatic STBI_THREAD_LOCAL int stbi__unpremultiply_on_load_local, stbi__unpremultiply_on_load_set;\nstatic STBI_THREAD_LOCAL int stbi__de_iphone_flag_local, stbi__de_iphone_flag_set;\n-STBIDEF void stbi__unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply)\n+STBIDEF void stbi_set_unpremultiply_on_load_thread(int flag_true_if_should_unpremultiply)\n{\nstbi__unpremultiply_on_load_local = flag_true_if_should_unpremultiply;\nstbi__unpremultiply_on_load_set = 1;\n@@ -5057,14 +5120,13 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)\nif (!pal_img_n) {\ns->img_n = (color & 2 ? 3 : 1) + (color & 4 ? 1 : 0);\nif ((1 << 30) / s->img_x / s->img_n < s->img_y) return stbi__err(\"too large\", \"Image too large to decode\");\n- if (scan == STBI__SCAN_header) return 1;\n} else {\n// if paletted, then pal_n is our final components, and\n// img_n is # components to decompress/filter.\ns->img_n = 1;\nif ((1 << 30) / s->img_x / 4 < s->img_y) return stbi__err(\"too large\",\"Corrupt PNG\");\n- // if SCAN_header, have to scan to see if we have a tRNS\n}\n+ // even with SCAN_header, have to scan to see if we have a tRNS\nbreak;\n}\n@@ -5096,6 +5158,8 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)\nif (!(s->img_n & 1)) return stbi__err(\"tRNS with alpha\",\"Corrupt PNG\");\nif (c.length != (stbi__uint32) s->img_n*2) return stbi__err(\"bad tRNS len\",\"Corrupt PNG\");\nhas_trans = 1;\n+ // non-paletted with tRNS = constant alpha. if header-scanning, we can stop now.\n+ if (scan == STBI__SCAN_header) { ++s->img_n; return 1; }\nif (z->depth == 16) {\nfor (k = 0; k < s->img_n; ++k) tc16[k] = (stbi__uint16)stbi__get16be(s); // copy the values as-is\n} else {\n@@ -5108,7 +5172,13 @@ static int stbi__parse_png_file(stbi__png *z, int scan, int req_comp)\ncase STBI__PNG_TYPE('I','D','A','T'): {\nif (first) return stbi__err(\"first not IHDR\", \"Corrupt PNG\");\nif (pal_img_n && !pal_len) return stbi__err(\"no PLTE\",\"Corrupt PNG\");\n- if (scan == STBI__SCAN_header) { s->img_n = pal_img_n; return 1; }\n+ if (scan == STBI__SCAN_header) {\n+ // header scan definitely stops at first IDAT\n+ if (pal_img_n)\n+ s->img_n = pal_img_n;\n+ return 1;\n+ }\n+ if (c.length > (1u << 30)) return stbi__err(\"IDAT size limit\", \"IDAT section larger than 2^30 bytes\");\nif ((int)(ioff + c.length) < (int)ioff) return 0;\nif (ioff + c.length > idata_limit) {\nstbi__uint32 idata_limit_old = idata_limit;\n@@ -5491,8 +5561,22 @@ static void *stbi__bmp_load(stbi__context *s, int *x, int *y, int *comp, int req\npsize = (info.offset - info.extra_read - info.hsz) >> 2;\n}\nif (psize == 0) {\n- if (info.offset != s->callback_already_read + (s->img_buffer - s->img_buffer_original)) {\n+ // accept some number of extra bytes after the header, but if the offset points either to before\n+ // the header ends or implies a large amount of extra data, reject the file as malformed\n+ int bytes_read_so_far = s->callback_already_read + (int)(s->img_buffer - s->img_buffer_original);\n+ int header_limit = 1024; // max we actually read is below 256 bytes currently.\n+ int extra_data_limit = 256*4; // what ordinarily goes here is a palette; 256 entries*4 bytes is its max size.\n+ if (bytes_read_so_far <= 0 || bytes_read_so_far > header_limit) {\n+ return stbi__errpuc(\"bad header\", \"Corrupt BMP\");\n+ }\n+ // we established that bytes_read_so_far is positive and sensible.\n+ // the first half of this test rejects offsets that are either too small positives, or\n+ // negative, and guarantees that info.offset >= bytes_read_so_far > 0. this in turn\n+ // ensures the number computed in the second half of the test can't overflow.\n+ if (info.offset < bytes_read_so_far || info.offset - bytes_read_so_far > extra_data_limit) {\nreturn stbi__errpuc(\"bad offset\", \"Corrupt BMP\");\n+ } else {\n+ stbi__skip(s, info.offset - bytes_read_so_far);\n}\n}\n@@ -7180,12 +7264,12 @@ static float *stbi__hdr_load(stbi__context *s, int *x, int *y, int *comp, int re\n// Run\nvalue = stbi__get8(s);\ncount -= 128;\n- if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf(\"corrupt\", \"bad RLE data in HDR\"); }\n+ if ((count == 0) || (count > nleft)) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf(\"corrupt\", \"bad RLE data in HDR\"); }\nfor (z = 0; z < count; ++z)\nscanline[i++ * 4 + k] = value;\n} else {\n// Dump\n- if (count > nleft) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf(\"corrupt\", \"bad RLE data in HDR\"); }\n+ if ((count == 0) || (count > nleft)) { STBI_FREE(hdr_data); STBI_FREE(scanline); return stbi__errpf(\"corrupt\", \"bad RLE data in HDR\"); }\nfor (z = 0; z < count; ++z)\nscanline[i++ * 4 + k] = stbi__get8(s);\n}\n@@ -7439,10 +7523,17 @@ static void *stbi__pnm_load(stbi__context *s, int *x, int *y, int *comp, int req\nout = (stbi_uc *) stbi__malloc_mad4(s->img_n, s->img_x, s->img_y, ri->bits_per_channel / 8, 0);\nif (!out) return stbi__errpuc(\"outofmem\", \"Out of memory\");\n- stbi__getn(s, out, s->img_n * s->img_x * s->img_y * (ri->bits_per_channel / 8));\n+ if (!stbi__getn(s, out, s->img_n * s->img_x * s->img_y * (ri->bits_per_channel / 8))) {\n+ STBI_FREE(out);\n+ return stbi__errpuc(\"bad PNM\", \"PNM file truncated\");\n+ }\nif (req_comp && req_comp != s->img_n) {\n+ if (ri->bits_per_channel == 16) {\n+ out = (stbi_uc *) stbi__convert_format16((stbi__uint16 *) out, s->img_n, req_comp, s->img_x, s->img_y);\n+ } else {\nout = stbi__convert_format(out, s->img_n, req_comp, s->img_x, s->img_y);\n+ }\nif (out == NULL) return out; // stbi__convert_format frees input on failure\n}\nreturn out;\n@@ -7479,6 +7570,8 @@ static int stbi__pnm_getinteger(stbi__context *s, char *c)\nwhile (!stbi__at_eof(s) && stbi__pnm_isdigit(*c)) {\nvalue = value*10 + (*c - '0');\n*c = (char) stbi__get8(s);\n+ if((value > 214748364) || (value == 214748364 && *c > '7'))\n+ return stbi__err(\"integer parse overflow\", \"Parsing an integer in the PPM header overflowed a 32-bit int\");\n}\nreturn value;\n@@ -7509,9 +7602,13 @@ static int stbi__pnm_info(stbi__context *s, int *x, int *y, int *comp)\nstbi__pnm_skip_whitespace(s, &c);\n*x = stbi__pnm_getinteger(s, &c); // read width\n+ if(*x == 0)\n+ return stbi__err(\"invalid width\", \"PPM image header had zero or overflowing width\");\nstbi__pnm_skip_whitespace(s, &c);\n*y = stbi__pnm_getinteger(s, &c); // read height\n+ if (*y == 0)\n+ return stbi__err(\"invalid width\", \"PPM image header had zero or overflowing width\");\nstbi__pnm_skip_whitespace(s, &c);\nmaxv = stbi__pnm_getinteger(s, &c); // read max value\n" }, { "change_type": "MODIFY", "old_path": "Source/stb_image_write.h", "new_path": "Source/stb_image_write.h", "diff": "@@ -511,7 +511,7 @@ static int stbi_write_bmp_core(stbi__write_context *s, int x, int y, int comp, c\nSTBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)\n{\n- stbi__write_context s {};\n+ stbi__write_context s = { 0 };\nstbi__start_write_callbacks(&s, func, context);\nreturn stbi_write_bmp_core(&s, x, y, comp, data);\n}\n@@ -519,7 +519,7 @@ STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int x,\n#ifndef STBI_WRITE_NO_STDIO\nSTBIWDEF int stbi_write_bmp(char const *filename, int x, int y, int comp, const void *data)\n{\n- stbi__write_context s {};\n+ stbi__write_context s = { 0 };\nif (stbi__start_write_file(&s,filename)) {\nint r = stbi_write_bmp_core(&s, x, y, comp, data);\nstbi__end_write_file(&s);\n@@ -610,7 +610,7 @@ static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, v\nSTBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)\n{\n- stbi__write_context s {};\n+ stbi__write_context s = { 0 };\nstbi__start_write_callbacks(&s, func, context);\nreturn stbi_write_tga_core(&s, x, y, comp, (void *) data);\n}\n@@ -618,7 +618,7 @@ STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x,\n#ifndef STBI_WRITE_NO_STDIO\nSTBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)\n{\n- stbi__write_context s {};\n+ stbi__write_context s = { 0 };\nif (stbi__start_write_file(&s,filename)) {\nint r = stbi_write_tga_core(&s, x, y, comp, (void *) data);\nstbi__end_write_file(&s);\n@@ -786,14 +786,14 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f\nSTBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data)\n{\n- stbi__write_context s {};\n+ stbi__write_context s = { 0 };\nstbi__start_write_callbacks(&s, func, context);\nreturn stbi_write_hdr_core(&s, x, y, comp, (float *) data);\n}\nSTBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data)\n{\n- stbi__write_context s {};\n+ stbi__write_context s = { 0 };\nif (stbi__start_write_file(&s,filename)) {\nint r = stbi_write_hdr_core(&s, x, y, comp, (float *) data);\nstbi__end_write_file(&s);\n@@ -1606,7 +1606,7 @@ static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, in\nSTBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality)\n{\n- stbi__write_context s {};\n+ stbi__write_context s = { 0 };\nstbi__start_write_callbacks(&s, func, context);\nreturn stbi_write_jpg_core(&s, x, y, comp, (void *) data, quality);\n}\n@@ -1615,7 +1615,7 @@ STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x,\n#ifndef STBI_WRITE_NO_STDIO\nSTBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality)\n{\n- stbi__write_context s {};\n+ stbi__write_context s = { 0 };\nif (stbi__start_write_file(&s,filename)) {\nint r = stbi_write_jpg_core(&s, x, y, comp, data, quality);\nstbi__end_write_file(&s);\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Update to stb_image.h v2.28
61,745
30.01.2023 21:10:38
0
409d88f550a82eb5d98572793b9d2ca67ebf1c4b
Fix compile warnings on AppleClang
[ { "change_type": "MODIFY", "old_path": "Source/cmake_core.cmake", "new_path": "Source/cmake_core.cmake", "diff": "@@ -296,8 +296,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES \"GNU|Clang\")\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-tautological-type-limit-compare>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-cast-qual>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-reserved-identifier>\"\n- \" $<$<CXX_COMPILER_ID:Clang>: -Wno-missing-prototypes>\"\n- \" $<$<CXX_COMPILER_ID:Clang>: -Wno-missing-field-initializers>\"\n+ \" $<$<CXX_COMPILER_ID:${CLANG_LIKE}>: -Wno-missing-prototypes>\"\n+ \" $<$<CXX_COMPILER_ID:${CLANG_LIKE}>: -Wno-missing-field-initializers>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-suggest-override>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-used-but-marked-unused>\"\n\" $<$<NOT:$<CXX_COMPILER_ID:MSVC>>: -Wno-noexcept-type>\"\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Fix compile warnings on AppleClang
61,745
30.01.2023 21:11:19
0
376c55e80d0ce1e014257f59e6aa422d8fdbaf5c
Increase version to 4.3.1
[ { "change_type": "MODIFY", "old_path": "CMakeLists.txt", "new_path": "CMakeLists.txt", "diff": "@@ -24,7 +24,7 @@ if(MSVC)\nadd_compile_options(\"/wd4324\") # Disable structure was padded due to alignment specifier\nendif()\n-project(astcencoder VERSION 4.3.0)\n+project(astcencoder VERSION 4.3.1)\nset(CMAKE_CXX_STANDARD 14)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Increase version to 4.3.1
61,745
04.02.2023 08:56:53
0
7c45b2a9d4a149b4a494543db75f5d080886db53
Shrink oversized color array
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_compress_symbolic.cpp", "new_path": "Source/astcenc_compress_symbolic.cpp", "diff": "@@ -561,7 +561,7 @@ static float compress_symbolic_block_for_partition_1plane(\nworkscb.color_formats_matched = 0;\nif (partition_count >= 2 && all_same)\n{\n- uint8_t colorvals[BLOCK_MAX_PARTITIONS][12];\n+ uint8_t colorvals[BLOCK_MAX_PARTITIONS][8];\nuint8_t color_formats_mod[BLOCK_MAX_PARTITIONS] { 0 };\nbool all_same_mod = true;\nfor (unsigned int j = 0; j < partition_count; j++)\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Shrink oversized color array
61,745
04.02.2023 09:13:29
0
7b96663b7b839e3597b09085cd7bda57d7e4f6b5
Use bool return type
[ { "change_type": "MODIFY", "old_path": "Source/astcenc_color_quantize.cpp", "new_path": "Source/astcenc_color_quantize.cpp", "diff": "@@ -217,7 +217,7 @@ static bool try_quantize_rgb_blue_contract(\n*\n* @return Returns @c false on failure, @c true on success.\n*/\n-static int try_quantize_rgba_blue_contract(\n+static bool try_quantize_rgba_blue_contract(\nvfloat4 color0,\nvfloat4 color1,\nuint8_t output[8],\n" } ]
C
Apache License 2.0
arm-software/astc-encoder
Use bool return type
491,590
16.01.2017 15:59:54
-3,600
9ed9f910f706bba8e0d3e8d1d2523ec23f462f6c
Reduce baudrate to improve reliability and ensure backwards compatibility.
[ { "change_type": "MODIFY", "old_path": "SConscript", "new_path": "SConscript", "diff": "@@ -543,7 +543,7 @@ class OpenMoteCC2538_bootloadThread(threading.Thread):\ndef run(self):\nprint 'starting bootloading on {0}'.format(self.comPort)\nsubprocess.call(\n- 'python '+os.path.join('bootloader','openmote-cc2538','cc2538-bsl.py')+' -e --bootloader-invert-lines -w -b 500000 -p {0} {1}'.format(self.comPort,self.hexFile),\n+ 'python '+os.path.join('bootloader','openmote-cc2538','cc2538-bsl.py')+' -e --bootloader-invert-lines -w -b 400000 -p {0} {1}'.format(self.comPort,self.hexFile),\nshell=True\n)\nprint 'done bootloading on {0}'.format(self.comPort)\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
Reduce baudrate to improve reliability and ensure backwards compatibility.
491,595
17.01.2017 19:28:33
-3,600
d41badd39e8d9d35efebd6ba64c8de612baaaa1f
add bsp_eui64 project for telosb.
[ { "change_type": "DELETE", "old_path": "projects/telosb/00std_eui64_uart/00std_eui64_uart.c", "new_path": null, "diff": "-/**\n-\\brief This is a standalone test program for retrieving the unique identifier\n- from the DS2411 chip on the TelosB.\n-\n-The datasheet of the chip at http://pdfserv.maxim-ic.com/en/ds/DS2411.pdf.\n-\n-Run the program, put a breakpoint a the last line of main(), and when you get\n-there, watch variable eui. I contains the 64-bits read from the DS2411, i.e.\n-- [1B] CRC8\n-- [6B] unique 48-bit identifier\n-- [1B] always 0x01\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, March 2012.\n-*/\n-\n-#include \"msp430f1611.h\"\n-#include \"stdint.h\"\n-#include \"string.h\"\n-\n-//=========================== defines =========================================\n-\n-#define PIN_1WIRE 0x10\n-\n-//=========================== variable ========================================\n-\n-uint8_t buffer_index;\n-uint8_t eui[8];\n-\n-//=========================== enums ===========================================\n-\n-enum {\n- OW_DLY_A = 6,\n- OW_DLY_B = 64,\n- OW_DLY_C = 60,\n- OW_DLY_D = 10,\n- OW_DLY_E = 9,\n- OW_DLY_F = 55,\n- OW_DLY_G = 0,\n- OW_DLY_H = 480,\n- OW_DLY_I = 90,\n- OW_DLY_J = 220,\n-};\n-\n-//=========================== prototypes ======================================\n-\n-// chip\n-void owchip_geteui(uint8_t* eui);\n-// 1Wire\n-uint8_t ow_reset();\n-void ow_write_byte(uint8_t byte);\n-uint8_t ow_read_byte();\n-void ow_write_bit(int is_one);\n-uint8_t ow_read_bit();\n-void ow_write_bit_one();\n-void ow_write_bit_zero();\n-// CRC\n-uint8_t crc8_byte(uint8_t crc, uint8_t byte);\n-uint8_t crc8_bytes(uint8_t crc, uint8_t* bytes, uint8_t len);\n-// timer\n-void delay_us(uint16_t delay);\n-// pin\n-void owpin_init();\n-void owpin_output_low();\n-void owpin_output_high();\n-void owpin_prepare_read();\n-uint8_t owpin_read();\n-\n-//=========================== main ============================================\n-\n-/**\n-\\brief The program starts executing here.\n-*/\n-int main(void) {\n-\n- WDTCTL = WDTPW + WDTHOLD; // disable watchdog timer\n-\n- DCOCTL = DCO0 | DCO1 | DCO2; // MCLK at 8MHz\n- BCSCTL1 = RSEL0 | RSEL1 | RSEL2; // MCLK at 8MHz\n-\n- owchip_geteui(eui);\n-\n- P5DIR |= 0x70; // P5DIR = 0bx111xxxx for LEDs\n- P5OUT |= 0x70; // P5OUT = 0bx111xxxx, all LEDs off\n-\n- P3SEL = 0xC0; // P3.6,7 = UART1TX/RX\n-\n- //9600 baud, clocked from 32kHz ACLK\n- ME2 |= UTXE1 + URXE1; // enable UART1 TX/RX\n- UCTL1 |= CHAR; // 8-bit character\n- UTCTL1 |= SSEL0; // clocking from ACLK\n- UBR01 = 0x03; // 32768/9600 = 3.41\n- UBR11 = 0x00; //\n- UMCTL1 = 0x4A; // modulation\n- UCTL1 &= ~SWRST; // clear UART1 reset bit\n- IE2 |= UTXIE1; // enable UART1 TX interrupt\n-\n- // enable interrupts\n- __bis_SR_register(GIE);\n-\n- buffer_index = 0;\n- U1TXBUF = eui[0];\n- while(1);\n-}\n-\n-/**\n-\\brief This function is called when the UART module has received a byte.\n-*/\n-\n-#pragma vector = USART1TX_VECTOR\n-__interrupt void USART1TX_ISR (void)\n-{\n- if (buffer_index < 8 ) {\n- U1TXBUF = eui[buffer_index++];\n- }\n-}\n-\n-//=========================== private =========================================\n-\n-//===== chip\n-\n-void owchip_geteui(uint8_t* eui) { // >= 6000us\n- uint8_t id[8];\n- int retry;\n- int crc;\n- uint8_t* byte;\n- uint16_t oldTactl;\n-\n- retry = 5;\n- memset(eui,0,8);\n-\n- // store current value of TACTL\n- oldTactl = TACTL;\n-\n- // start timer in continuous mode at 1MHz\n- TACTL = TASSEL_2 | ID_2 | MC_2;\n-\n- owpin_init();\n- while (retry-- > 0) {\n- crc = 0;\n-\n- if(ow_reset()) {\n- ow_write_byte(0x33); //read rom\n- for(byte=id+7; byte>=id; byte--) {\n- crc = crc8_byte( crc, *byte=ow_read_byte() );\n- }\n- if(crc==0) {\n- // CRC valid\n- memcpy(eui,id,8);\n- }\n- }\n- }\n-\n- // restore value of TACTL\n- TACTL = oldTactl;\n-}\n-\n-//===== 1Wire\n-\n-// admin\n-\n-uint8_t ow_reset() { // >= 960us\n- int present;\n- owpin_output_low();\n- delay_us(OW_DLY_H); // t_RSTL\n- owpin_prepare_read();\n- delay_us(OW_DLY_I); // t_MSP\n- present = owpin_read();\n- delay_us(OW_DLY_J); // t_REC\n- return (present==0);\n-}\n-\n-// byte-level access\n-\n-void ow_write_byte(uint8_t byte) { // >= 560us\n- uint8_t bit;\n- for(bit=0x01;bit!=0;bit<<=1) {\n- ow_write_bit(byte & bit);\n- }\n-}\n-\n-uint8_t ow_read_byte() { // >= 560us\n- uint8_t byte = 0;\n- uint8_t bit;\n- for( bit=0x01; bit!=0; bit<<=1 ) {\n- if(ow_read_bit()) {\n- byte |= bit;\n- }\n- }\n- return byte;\n-}\n-\n-// bit-level access\n-\n-void ow_write_bit(int is_one) { // >= 70us\n- if(is_one) {\n- ow_write_bit_one();\n- } else {\n- ow_write_bit_zero();\n- }\n-}\n-\n-uint8_t ow_read_bit() { // >= 70us\n- int bit;\n- owpin_output_low();\n- delay_us(OW_DLY_A); // t_RL\n- owpin_prepare_read();\n- delay_us(OW_DLY_E); // near-max t_MSR\n- bit = owpin_read();\n- delay_us(OW_DLY_F); // t_REC\n- return bit;\n-}\n-\n-void ow_write_bit_one() { // >= 70us\n- owpin_output_low();\n- delay_us(OW_DLY_A); // t_W1L\n- owpin_output_high();\n- delay_us(OW_DLY_B); // t_SLOT - t_W1L\n-}\n-\n-void ow_write_bit_zero() { // >= 70us\n- owpin_output_low();\n- delay_us(OW_DLY_C); // t_W0L\n- owpin_output_high();\n- delay_us(OW_DLY_D); // t_SLOT - t_W0L\n-}\n-\n-//===== CRC\n-\n-uint8_t crc8_byte(uint8_t crc, uint8_t byte) {\n- int i;\n- crc ^= byte;\n- for( i=0; i<8; i++ )\n- {\n- if( crc & 1 )\n- crc = (crc >> 1) ^ 0x8c;\n- else\n- crc >>= 1;\n- }\n- return crc;\n-}\n-\n-uint8_t crc8_bytes(uint8_t crc, uint8_t* bytes, uint8_t len) {\n- uint8_t* end = bytes+len;\n- while( bytes != end )\n- crc = crc8_byte( crc, *bytes++ );\n- return crc;\n-}\n-\n-//===== timer\n-\n-void delay_us(uint16_t delay) {\n- uint16_t startTime;\n- startTime = TAR;\n- while (TAR<startTime+delay);\n-}\n-\n-//===== pin\n-\n-void owpin_init() {\n- P2DIR &= ~PIN_1WIRE; // set as input\n- P2OUT &= ~PIN_1WIRE; // pull low\n-}\n-\n-void owpin_output_low() {\n- P2DIR |= PIN_1WIRE; // set as output\n-}\n-\n-void owpin_output_high() {\n- P2DIR &= ~PIN_1WIRE; // set as input\n-}\n-\n-void owpin_prepare_read() {\n- P2DIR &= ~PIN_1WIRE; // set as input\n-}\n-\n-uint8_t owpin_read() {\n- return (P2IN & PIN_1WIRE);\n-}\n\\ No newline at end of file\n" }, { "change_type": "RENAME", "old_path": "projects/telosb/00std_eui64_uart/00std_eui64_uart.ewd", "new_path": "projects/telosb/01bsp_eui64/01bsp_eui64.ewd", "diff": "" }, { "change_type": "RENAME", "old_path": "projects/telosb/00std_eui64_uart/00std_eui64_uart.ewp", "new_path": "projects/telosb/01bsp_eui64/01bsp_eui64.ewp", "diff": "</option>\n<option>\n<name>newCCIncludePaths</name>\n- <state></state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\</state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\</state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\</state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\</state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\sht11\\</state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\inc\\</state>\n</option>\n<option>\n<name>CCStdIncCheck</name>\n</option>\n<option>\n<name>OutputFile</name>\n- <state>00std_eui64_uart.d43</state>\n+ <state>01bsp_eui64.d43</state>\n</option>\n<option>\n<name>OutputFormat</name>\n</option>\n<option>\n<name>SecondaryOutputFile</name>\n- <state>(None for the selected format)</state>\n+ <state></state>\n</option>\n<option>\n<name>XDefines</name>\n</option>\n<option>\n<name>XclFile</name>\n- <state>$TOOLKIT_DIR$\\CONFIG\\lnk430F1611.xcl</state>\n+ <state>lnk0t.xcl</state>\n</option>\n<option>\n<name>XclFileSlave</name>\n</option>\n<option>\n<name>xcProgramEntryLabel</name>\n- <state>__program_start</state>\n+ <state></state>\n</option>\n<option>\n<name>DebugInformation</name>\n</option>\n<option>\n<name>ExtraOutputFile</name>\n- <state>00std_eui64_uart.a43</state>\n+ <state></state>\n</option>\n<option>\n<name>ExtraOutputFormat</name>\n<data/>\n</settings>\n</configuration>\n+ <group>\n+ <name>bsp</name>\n+ <group>\n+ <name>boards</name>\n+ <group>\n+ <name>common</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\abstimer.c</name>\n+ <excluded>\n+ <configuration>Debug</configuration>\n+ </excluded>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\abstimers2.c</name>\n+ <excluded>\n+ <configuration>Debug</configuration>\n+ </excluded>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_cbc.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_cbc.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ccms.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ccms.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ctr.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ctr.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ecb.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\aes_ecb.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\dummy_crypto_engine.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\dummy_crypto_engine.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\firmware_crypto_engine.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\common\\firmware_crypto_engine.h</name>\n+ </file>\n+ </group>\n+ <group>\n+ <name>telosb</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\adc_sensor.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\adc_sensor.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_crypto_engine.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_crypto_engine.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_info.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\bsp_timer.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\debugpins.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\eui64.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\leds.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\radiotimer.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\sensors.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\spi.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\uart.c</name>\n+ </file>\n+ </group>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\board.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\bsp_timer.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\crypto_engine.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\debugpins.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\eui64.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\i2c.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\leds.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\radio.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\radiotimer.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\sctimer.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\sensors.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\spi.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\toolchain_defs.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\uart.h</name>\n+ </file>\n+ </group>\n+ <group>\n+ <name>chips</name>\n+ <group>\n+ <name>cc2420</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420_crypto.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\cc2420_crypto.h</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\cc2420\\radio.c</name>\n+ </file>\n+ </group>\n+ <group>\n+ <name>sht11</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\sht11\\sht11.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\chips\\sht11\\sht11.h</name>\n+ </file>\n+ </group>\n+ </group>\n+ </group>\n+ <group>\n+ <name>inc</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\inc\\opendefs.h</name>\n+ </file>\n+ </group>\n+ <group>\n+ <name>project</name>\n<file>\n- <name>$PROJ_DIR$\\00std_eui64_uart.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\common\\01bsp_eui64\\01bsp_eui64.c</name>\n</file>\n+ </group>\n</project>\n" }, { "change_type": "MODIFY", "old_path": "projects/telosb/telosb.eww", "new_path": "projects/telosb/telosb.eww", "diff": "<project>\n<path>$WS_DIR$\\01bsp_debugpins\\01bsp_debugpins.ewp</path>\n</project>\n+ <project>\n+ <path>$WS_DIR$\\01bsp_eui64\\01bsp_eui64.ewp</path>\n+ </project>\n<project>\n<path>$WS_DIR$\\01bsp_leds\\01bsp_leds.ewp</path>\n</project>\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-614. add bsp_eui64 project for telosb.
491,608
10.01.2017 15:25:46
-3,600
446addc691b95d6751c7420397b6c5b8315792d3
Fixed timer period computation when synchronizing for the first time.
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -1993,24 +1993,33 @@ void synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived) {\nPORT_SIGNED_INT_WIDTH timeCorrection;\nPORT_RADIOTIMER_WIDTH newPeriod;\nPORT_RADIOTIMER_WIDTH currentValue;\n- PORT_RADIOTIMER_WIDTH currentPeriod;\n// record the current timer value and period\ncurrentValue = radio_getTimerValue();\n- currentPeriod = radio_getTimerPeriod();\n// calculate new period\ntimeCorrection = (PORT_SIGNED_INT_WIDTH)((PORT_SIGNED_INT_WIDTH)timeReceived - (PORT_SIGNED_INT_WIDTH)TsTxOffset);\n- newPeriod = ieee154e_vars.slotDuration;\n+\n+ // The interrupt beginning a new slot can either occur after the packet has been\n+ // or while it is being received, possibly because the mote is not yet synchronized.\n+ // In the former case we simply take the usual slotLength and correct it.\n+ // In the latter case the timer did already roll over and\n+ // currentValue < timeReceived. slotLength did then already pass which is why\n+ // we need the new slot to end after the remaining time which is timeCorrection\n+ // and in this constellation is guaranteed to be positive.\n+ if (currentValue < timeReceived) {\n+ newPeriod = (PORT_RADIOTIMER_WIDTH)timeCorrection;\n+ } else {\n+ newPeriod = (PORT_RADIOTIMER_WIDTH)((PORT_SIGNED_INT_WIDTH)ieee154e_vars.slotDuration + timeCorrection);\n+ }\n// detect whether I'm too close to the edge of the slot, in that case,\n// skip a slot and increase the temporary slot length to be 2 slots long\n- if (currentValue<timeReceived || currentPeriod-currentValue<RESYNCHRONIZATIONGUARD) {\n+ if ((PORT_SIGNED_INT_WIDTH)newPeriod - (PORT_SIGNED_INT_WIDTH)currentValue < (PORT_SIGNED_INT_WIDTH)RESYNCHRONIZATIONGUARD) {\nnewPeriod += ieee154e_vars.slotDuration;\nincrementAsnOffset();\n}\n- newPeriod = (PORT_RADIOTIMER_WIDTH)((PORT_SIGNED_INT_WIDTH)newPeriod+timeCorrection);\n// resynchronize by applying the new period\nradio_setTimerPeriod(newPeriod);\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-446. Fixed timer period computation when synchronizing for the first time.
491,595
18.01.2017 23:21:02
-3,600
b46e6c92b2b55e489b4424d2f423237ab2bc5469
remove sixtop state maintenance for handling incoming request and response senddone.
[ { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -891,10 +891,10 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\nsixtop_vars.six2six_state == SIX_STATE_WAIT_COUNTREQUEST_SENDDONE ||\nsixtop_vars.six2six_state == SIX_STATE_WAIT_CLEARREQUEST_SENDDONE\n){\n- // reset handler if the request is failed to send out\n+ // reset handler and state if the request is failed to send out\n+ sixtop_vars.six2six_state = SIX_STATE_IDLE;\nsixtop_vars.handler = SIX_HANDLER_NONE;\n}\n- sixtop_vars.six2six_state = SIX_STATE_IDLE;\nopenqueue_freePacketBuffer(msg);\nreturn;\n}\n@@ -915,7 +915,11 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\ncase SIX_STATE_WAIT_CLEARREQUEST_SENDDONE:\nsixtop_vars.six2six_state = SIX_STATE_WAIT_CLEARRESPONSE;\nbreak;\n- case SIX_STATE_WAIT_RESPONSE_SENDDONE:\n+ default:\n+ break;\n+ }\n+\n+ // in case a response is sent out, check the return code\nif (msg->l2_sixtop_returnCode == IANA_6TOP_RC_SUCCESS){\nif (\nmsg->l2_sixtop_requestCommand == IANA_6TOP_CMD_ADD ||\n@@ -931,7 +935,7 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\ncellList[i].choffset |= (*(ptr+3))<<8;\nptr += 4;\n// mark with linkoptions as ocuppied\n- cellList[i].linkoptions = CELLTYPE_TX;\n+ cellList[i].linkoptions = CELLTYPE_RX;\n}\nif (msg->l2_sixtop_requestCommand == IANA_6TOP_CMD_ADD){\nsixtop_addCellsByState(\n@@ -946,7 +950,6 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\n&(msg->l2_nextORpreviousHop));\n}\n}\n-\n} else {\nif (msg->l2_sixtop_requestCommand == IANA_6TOP_CMD_CLEAR){\nschedule_removeAllCells(msg->l2_sixtop_frameID,\n@@ -957,12 +960,6 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\n}\n}\n}\n- sixtop_vars.six2six_state = SIX_STATE_IDLE;\n- break;\n- default:\n- // should never happens\n- break;\n- }\nif (\nsixtop_vars.six2six_state == SIX_STATE_WAIT_ADDRESPONSE ||\n@@ -1112,8 +1109,6 @@ void sixtop_notifyReceiveCommand(\nif (sixtop_vars.six2six_state != SIX_STATE_IDLE){\ncode = IANA_6TOP_RC_ERR_BUSY;\n} else {\n- sixtop_vars.six2six_state = SIX_STATE_REQUEST_RECEIVED;\n-\nswitch(commandIdORcode){\ncase IANA_6TOP_CMD_ADD:\ncase IANA_6TOP_CMD_DELETE:\n@@ -1191,15 +1186,8 @@ void sixtop_notifyReceiveCommand(\nif (sixtop_vars.isResponseEnabled){\n// send packet\nsixtop_send(response_pkt);\n- if (code == IANA_6TOP_RC_ERR_BUSY){\n- // do not update status, I'm in a sixtop transaction already\n- } else {\n- // update state\n- sixtop_vars.six2six_state = SIX_STATE_WAIT_RESPONSE_SENDDONE;\n- }\n} else {\nopenqueue_freePacketBuffer(response_pkt);\n- sixtop_vars.six2six_state = SIX_STATE_IDLE;\n}\n} else {\n//------ if this is a return code\n@@ -1393,36 +1381,16 @@ void sixtop_addCellsByState(\n//set schedule according links\nfor(i = 0;i<SCHEDULEIEMAXNUMCELLS;i++){\n- //only schedule when the request side wants to schedule a tx cell\nif(cellList[i].linkoptions != CELLTYPE_OFF){\n- switch(state) {\n- case SIX_STATE_WAIT_RESPONSE_SENDDONE:\nmemcpy(&temp_neighbor,previousHop,sizeof(open_addr_t));\n//add a RX link\nschedule_addActiveSlot(\ncellList[i].tsNum,\n- CELLTYPE_RX,\n- FALSE,\n- cellList[i].choffset,\n- &temp_neighbor\n- );\n-\n- break;\n- case SIX_STATE_WAIT_ADDRESPONSE:\n- memcpy(&temp_neighbor,previousHop,sizeof(open_addr_t));\n- //add a TX link\n- schedule_addActiveSlot(\n- cellList[i].tsNum,\n- CELLTYPE_TX,\n+ cellList[i].linkoptions,\nFALSE,\ncellList[i].choffset,\n&temp_neighbor\n);\n- break;\n- default:\n- //log error\n- break;\n- }\n}\n}\n}\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-610. remove sixtop state maintenance for handling incoming request and response senddone.
491,595
18.01.2017 23:30:46
-3,600
95751b31f1749158f5506b4a242120fcef433b06
assign sixtop handler only when current handler is none and state is IDLE.
[ { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -164,7 +164,10 @@ void sixtop_setEBPeriod(uint8_t ebPeriod) {\n}\nbool sixtop_setHandler(six2six_handler_t handler) {\n- if (sixtop_vars.handler == SIX_HANDLER_NONE){\n+ if (\n+ sixtop_vars.handler == SIX_HANDLER_NONE &&\n+ sixtop_vars.six2six_state == SIX_STATE_IDLE\n+ ){\nsixtop_vars.handler = handler;\nreturn TRUE;\n} else {\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-610. assign sixtop handler only when current handler is none and state is IDLE.
491,595
19.01.2017 10:32:28
-3,600
2913cd88ecd5d3a0b19a0bc9433bc65b3f4be4eb
Update mote's rank to current parent before scanning through neighbor.
[ { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/icmpv6rpl.c", "new_path": "openstack/03b-IPv6/icmpv6rpl.c", "diff": "@@ -362,10 +362,21 @@ void icmpv6rpl_updateMyDAGrankAndParentSelection() {\n}\n// prep for loop, remember state before neighbor table scanning\n- previousDAGrank = icmpv6rpl_vars.myDAGrank;\nprevParentIndex = icmpv6rpl_vars.ParentIndex;\nprevHadParent = icmpv6rpl_vars.haveParent;\nprevRankIncrease = icmpv6rpl_vars.rankIncrease;\n+ // update my rank to current parent first\n+ if (icmpv6rpl_vars.haveParent==TRUE){\n+ rankIncrease = neighbors_getLinkMetric(icmpv6rpl_vars.ParentIndex);\n+ neighborRank = neighbors_getNeighborRank(icmpv6rpl_vars.ParentIndex);\n+ tentativeDAGrank = (uint32_t)neighborRank+rankIncrease;\n+ if (tentativeDAGrank>65535) {\n+ icmpv6rpl_vars.myDAGrank = 65535;\n+ } else {\n+ icmpv6rpl_vars.myDAGrank = (uint16_t)tentativeDAGrank;\n+ }\n+ }\n+ previousDAGrank = icmpv6rpl_vars.myDAGrank;\nfoundBetterParent = FALSE;\nicmpv6rpl_vars.haveParent = FALSE;\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-616. Update mote's rank to current parent before scanning through neighbor.
491,595
19.01.2017 17:08:44
-3,600
e7804873e8d46fb2b127a42549c69efd7b1f8484
correct comments.
[ { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/neighbors.c", "new_path": "openstack/02b-MAChigh/neighbors.c", "diff": "@@ -479,7 +479,7 @@ void neighbors_removeOld() {\nreturn;\n}\n- // remove all neighbor that either f6PNORES is set or recorded as lowest 3 rank neighbors\n+ // remove all neighbors except the ones that f6PNORES flag is set or is recorded as lowest 3 rank neighbors\nfor (i=0;i<MAXNUMNEIGHBORS;i++) {\nif (neighbors_vars.neighbors[i].used==1) {\nif (\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-618. correct comments.
491,595
20.10.2016 11:12:13
-7,200
994b900a96b49415df1608cac35f85d3d8f1e0c0
Move frequency calculation right after the currentScheduleEntry is updated and before the incrementAsnOffset for skipping slot.
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -888,6 +888,9 @@ port_INLINE void activity_ti1ORri1() {\n// advance the schedule\nschedule_advanceSlot();\n+ // calculate the frequency to transmit on\n+ ieee154e_vars.freq = calculateFrequency(schedule_getChannelOffset());\n+\n// find the next one\nieee154e_vars.nextActiveSlotOffset = schedule_getNextActiveSlotOffset();\nif (idmanager_getIsSlotSkip() && idmanager_getIsDAGroot()==FALSE) {\n@@ -1048,9 +1051,6 @@ port_INLINE void activity_ti2() {\n// add 2 CRC bytes only to the local copy as we end up here for each retransmission\npacketfunctions_reserveFooterSize(&ieee154e_vars.localCopyForTransmission, 2);\n- // calculate the frequency to transmit on\n- ieee154e_vars.freq = calculateFrequency(schedule_getChannelOffset());\n-\n// configure the radio for that frequency\nradio_setFrequency(ieee154e_vars.freq);\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-576. Move frequency calculation right after the currentScheduleEntry is updated and before the incrementAsnOffset for skipping slot.
491,595
20.10.2016 13:29:45
-7,200
fc74a2e0d98d44e8e7f753df93a613ed24c7b1fc
process slot skipping at the end of slot.
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -890,20 +890,6 @@ port_INLINE void activity_ti1ORri1() {\n// find the next one\nieee154e_vars.nextActiveSlotOffset = schedule_getNextActiveSlotOffset();\n- if (idmanager_getIsSlotSkip() && idmanager_getIsDAGroot()==FALSE) {\n- if (ieee154e_vars.nextActiveSlotOffset>ieee154e_vars.slotOffset) {\n- ieee154e_vars.numOfSleepSlots = ieee154e_vars.nextActiveSlotOffset-ieee154e_vars.slotOffset;\n- } else {\n- ieee154e_vars.numOfSleepSlots = schedule_getFrameLength()+ieee154e_vars.nextActiveSlotOffset-ieee154e_vars.slotOffset;\n- }\n-\n- radio_setTimerPeriod(TsSlotDuration*(ieee154e_vars.numOfSleepSlots));\n-\n- //increase ASN by numOfSleepSlots-1 slots as at this slot is already incremented by 1\n- for (i=0;i<ieee154e_vars.numOfSleepSlots-1;i++){\n- incrementAsnOffset();\n- }\n- }\n} else {\n// this is NOT the next active slot, abort\n// stop using serial\n@@ -2249,9 +2235,26 @@ function should already have been done. If this is not the case, this function\nwill do that for you, but assume that something went wrong.\n*/\nvoid endSlot() {\n+ uint8_t i;\n// turn off the radio\nradio_rfOff();\n+\n+ if (idmanager_getIsSlotSkip() && idmanager_getIsDAGroot()==FALSE) {\n+ if (ieee154e_vars.nextActiveSlotOffset>ieee154e_vars.slotOffset) {\n+ ieee154e_vars.numOfSleepSlots = ieee154e_vars.nextActiveSlotOffset-ieee154e_vars.slotOffset;\n+ } else {\n+ ieee154e_vars.numOfSleepSlots = schedule_getFrameLength()+ieee154e_vars.nextActiveSlotOffset-ieee154e_vars.slotOffset;\n+ }\n+ radio_setTimerPeriod(TsSlotDuration*(ieee154e_vars.numOfSleepSlots));\n+\n+ //increase ASN by numOfSleepSlots-1 slots as at this slot is already incremented by 1\n+ for (i=0;i<ieee154e_vars.numOfSleepSlots-1;i++){\n+ incrementAsnOffset();\n+ }\n+ }\n+\n+\n// compute the duty cycle if radio has been turned on\nif (ieee154e_vars.radioOnThisSlot==TRUE){\nieee154e_vars.radioOnTics+=(radio_getTimerValue()-ieee154e_vars.radioOnInit);\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-576. process slot skipping at the end of slot.
491,595
19.01.2017 18:27:06
-3,600
9f74c140759bf80a58b6deaba02e61edd1e821a4
calculate number sleep at the beginning of slot. also calculate the frequency before starting a slot.
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -888,8 +888,26 @@ port_INLINE void activity_ti1ORri1() {\n// advance the schedule\nschedule_advanceSlot();\n+ // calculate the frequency to transmit on\n+ ieee154e_vars.freq = calculateFrequency(schedule_getChannelOffset());\n+\n// find the next one\nieee154e_vars.nextActiveSlotOffset = schedule_getNextActiveSlotOffset();\n+ if (idmanager_getIsSlotSkip() && idmanager_getIsDAGroot()==FALSE) {\n+ if (ieee154e_vars.nextActiveSlotOffset>ieee154e_vars.slotOffset) {\n+ ieee154e_vars.numOfSleepSlots = ieee154e_vars.nextActiveSlotOffset-ieee154e_vars.slotOffset;\n+ } else {\n+ ieee154e_vars.numOfSleepSlots = schedule_getFrameLength()+ieee154e_vars.nextActiveSlotOffset-ieee154e_vars.slotOffset;\n+ }\n+\n+ radio_setTimerPeriod(TsSlotDuration*(ieee154e_vars.numOfSleepSlots));\n+\n+ //increase ASN by numOfSleepSlots-1 slots as at this slot is already incremented by 1\n+ for (i=0;i<ieee154e_vars.numOfSleepSlots-1;i++){\n+ incrementAsnOffset();\n+ }\n+ }\n+ ieee154e_vars.nextActiveSlotOffset = schedule_getNextActiveSlotOffset();\n} else {\n// this is NOT the next active slot, abort\n// stop using serial\n@@ -1034,9 +1052,6 @@ port_INLINE void activity_ti2() {\n// add 2 CRC bytes only to the local copy as we end up here for each retransmission\npacketfunctions_reserveFooterSize(&ieee154e_vars.localCopyForTransmission, 2);\n- // calculate the frequency to transmit on\n- ieee154e_vars.freq = calculateFrequency(schedule_getChannelOffset());\n-\n// configure the radio for that frequency\nradio_setFrequency(ieee154e_vars.freq);\n@@ -1153,9 +1168,6 @@ port_INLINE void activity_ti6() {\n// change state\nchangeState(S_RXACKPREPARE);\n- // calculate the frequency to transmit on\n- ieee154e_vars.freq = calculateFrequency(schedule_getChannelOffset());\n-\n// configure the radio for that frequency\nradio_setFrequency(ieee154e_vars.freq);\n@@ -1368,9 +1380,6 @@ port_INLINE void activity_ri2() {\n// change state\nchangeState(S_RXDATAPREPARE);\n- // calculate the frequency to transmit on\n- ieee154e_vars.freq = calculateFrequency(schedule_getChannelOffset());\n-\n// configure the radio for that frequency\nradio_setFrequency(ieee154e_vars.freq);\n@@ -1648,9 +1657,6 @@ port_INLINE void activity_ri6() {\n// space for 2-byte CRC\npacketfunctions_reserveFooterSize(ieee154e_vars.ackToSend,2);\n- // calculate the frequency to transmit on\n- ieee154e_vars.freq = calculateFrequency(schedule_getChannelOffset());\n-\n// configure the radio for that frequency\nradio_setFrequency(ieee154e_vars.freq);\n@@ -2235,26 +2241,9 @@ function should already have been done. If this is not the case, this function\nwill do that for you, but assume that something went wrong.\n*/\nvoid endSlot() {\n- uint8_t i;\n-\n// turn off the radio\nradio_rfOff();\n- if (idmanager_getIsSlotSkip() && idmanager_getIsDAGroot()==FALSE) {\n- if (ieee154e_vars.nextActiveSlotOffset>ieee154e_vars.slotOffset) {\n- ieee154e_vars.numOfSleepSlots = ieee154e_vars.nextActiveSlotOffset-ieee154e_vars.slotOffset;\n- } else {\n- ieee154e_vars.numOfSleepSlots = schedule_getFrameLength()+ieee154e_vars.nextActiveSlotOffset-ieee154e_vars.slotOffset;\n- }\n- radio_setTimerPeriod(TsSlotDuration*(ieee154e_vars.numOfSleepSlots));\n-\n- //increase ASN by numOfSleepSlots-1 slots as at this slot is already incremented by 1\n- for (i=0;i<ieee154e_vars.numOfSleepSlots-1;i++){\n- incrementAsnOffset();\n- }\n- }\n-\n-\n// compute the duty cycle if radio has been turned on\nif (ieee154e_vars.radioOnThisSlot==TRUE){\nieee154e_vars.radioOnTics+=(radio_getTimerValue()-ieee154e_vars.radioOnInit);\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-576. calculate number sleep at the beginning of slot. also calculate the frequency before starting a slot.
491,595
19.01.2017 18:49:56
-3,600
3235354ac513ca68869b892ac7297e281eb8e670
use current period rather than slotduration in synchronizePacket.
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -1984,10 +1984,12 @@ port_INLINE void channelhoppingTemplateIDStoreFromEB(uint8_t id){\nvoid synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived) {\nPORT_SIGNED_INT_WIDTH timeCorrection;\nPORT_RADIOTIMER_WIDTH newPeriod;\n+ PORT_RADIOTIMER_WIDTH currentPeriod;\nPORT_RADIOTIMER_WIDTH currentValue;\n// record the current timer value and period\ncurrentValue = radio_getTimerValue();\n+ currentPeriod = radio_getTimerPeriod();\n// calculate new period\ntimeCorrection = (PORT_SIGNED_INT_WIDTH)((PORT_SIGNED_INT_WIDTH)timeReceived - (PORT_SIGNED_INT_WIDTH)TsTxOffset);\n@@ -2003,7 +2005,7 @@ void synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived) {\nif (currentValue < timeReceived) {\nnewPeriod = (PORT_RADIOTIMER_WIDTH)timeCorrection;\n} else {\n- newPeriod = (PORT_RADIOTIMER_WIDTH)((PORT_SIGNED_INT_WIDTH)ieee154e_vars.slotDuration + timeCorrection);\n+ newPeriod = (PORT_RADIOTIMER_WIDTH)((PORT_SIGNED_INT_WIDTH)currentPeriod + timeCorrection);\n}\n// detect whether I'm too close to the edge of the slot, in that case,\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-608. use current period rather than slotduration in synchronizePacket.
491,595
20.01.2017 10:17:03
-3,600
bedaa2c1c2476ca64b89bd7d7eebdfabd875475a
rename files to different names and update project file.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/i2c.c", "new_path": "bsp/boards/openmote-cc2538/i2c.c", "diff": "#include <headers/hw_types.h>\n#include <source/gpio.h>\n-#include <source/i2c.h>\n+#include <source/i2c_lib.h>\n#include <source/ioc.h>\n#include <source/sys_ctrl.h>\n" }, { "change_type": "RENAME", "old_path": "bsp/boards/openmote-cc2538/source/i2c.c", "new_path": "bsp/boards/openmote-cc2538/source/i2c_lib.c", "diff": "#include <headers/hw_memmap.h>\n#include <headers/hw_sys_ctrl.h>\n#include \"debug.h\"\n-#include \"i2c.h\"\n+#include \"i2c_lib.h\"\n#include \"interrupt.h\"\n//*****************************************************************************\n" }, { "change_type": "RENAME", "old_path": "bsp/boards/openmote-cc2538/source/i2c.h", "new_path": "bsp/boards/openmote-cc2538/source/i2c_lib.h", "diff": "" }, { "change_type": "RENAME", "old_path": "bsp/boards/openmote-cc2538/source/uart.c", "new_path": "bsp/boards/openmote-cc2538/source/uarthal.c", "diff": "#include <headers/hw_uart.h>\n#include \"debug.h\"\n#include \"interrupt.h\"\n-#include \"uart.h\"\n+#include \"uarthal.h\"\n//*****************************************************************************\n//\n" }, { "change_type": "RENAME", "old_path": "bsp/boards/openmote-cc2538/source/uart.h", "new_path": "bsp/boards/openmote-cc2538/source/uarthal.h", "diff": "" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/uart.c", "new_path": "bsp/boards/openmote-cc2538/uart.c", "diff": "#include <source/interrupt.h>\n#include <source/ioc.h>\n#include <source/sys_ctrl.h>\n-#include <source/uart.h>\n+#include <source/uarthal.h>\n#include \"board.h\"\n" }, { "change_type": "MODIFY", "old_path": "projects/common/03oos_sniffer/03oos_sniffer.c", "new_path": "projects/common/03oos_sniffer/03oos_sniffer.c", "diff": "@@ -178,7 +178,7 @@ void schedule_setFrameLength(uint16_t frameLength) {return;}\nvoid sixtop_setEBPeriod(uint8_t ebPeriod) {return;}\nvoid sixtop_addORremoveCellByInfo(uint8_t code,open_addr_t* neighbor,cellInfo_ht* cellInfo){return;}\nvoid sixtop_request(uint8_t code,open_addr_t* neighbor, uint8_t numCells) {return;}\n-bool sixtop_setHandler(six2six_handler_t handler) {return;}\n+bool sixtop_setHandler(six2six_handler_t handler) {return TRUE;}\nvoid sixtop_setIsResponseEnabled(bool isEnabled) {return;}\nvoid sixtop_setKaPeriod(uint16_t kaPeriod) {return;}\nvoid sf0_appPktPeriod(uint8_t numAppPacketsPerSlotFrame) {return;}\n" }, { "change_type": "MODIFY", "old_path": "projects/openmote-cc2538/03oos_macpong/03oos_macpong.ewp", "new_path": "projects/openmote-cc2538/03oos_macpong/03oos_macpong.ewp", "diff": "<group>\n<name>headers</name>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_aes.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_aes.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ana_regs.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ana_regs.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_cctest.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_cctest.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_flash_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_flash_ctrl.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_gpio.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_gpio.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_gptimer.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_gptimer.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_i2cm.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_i2cm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_i2cs.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_i2cs.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ints.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ints.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ioc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_memmap.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_memmap.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_nvic.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_nvic.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_pka.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_pka.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_ffsm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_sfr.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_sfr.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_xreg.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_xreg.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_smwdthrosc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_smwdthrosc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_soc_adc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ssi.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ssi.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_sys_ctrl.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_types.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_types.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_uart.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_uart.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_udma.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_udma.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_udmachctl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_udmachctl.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_usb.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\adc.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\adc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\adc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\aes.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\aes.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\aes.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\bl_commands.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\cpu.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\cpu.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\cpu.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\debug.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\debug.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\debug.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ecc_curveinfo.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ecc_curveinfo.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\flash.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\flash.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\flash.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gpio.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gpio.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gpio.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gptimer.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gptimer.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gptimer.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\i2c_lib.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\i2c_lib.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\i2c_lib.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\interrupt.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\interrupt.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\interrupt.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ioc.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ioc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\pka.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\pka.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\pka.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\rom.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sha256.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sha256.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sha256.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sleepmode.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sleepmode.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sleepmode.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ssi.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ssi.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ssi.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sys_ctrl.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sys_ctrl.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\systick.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\systick.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\systick.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\uarthal.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\uarthal.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\uarthal.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\udma.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\udma.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\udma.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\watchdog.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\watchdog.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\watchdog.h</name>\n</file>\n</group>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\adc_sensor.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\adc_sensor.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\adc_sensor.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\board.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\board_info.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\board_info.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\bsp_timer.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\cc2538rf.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\cc2538rf.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\debugpins.c</name>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\IEEE802154.h</name>\n</file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\IEEE802154_dummy_security.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\IEEE802154_dummy_security.h</name>\n+ </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\IEEE802154E.c</name>\n</file>\n" }, { "change_type": "MODIFY", "old_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp", "new_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp", "diff": "<state>$PROJ_DIR$\\..\\..\\..\\openapps\\cstorm\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\rrt\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\openapps\\uinject\\</state>\n+ <state>$PROJ_DIR$\\..\\..\\..\\openapps\\userialbridge\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\</state>\n<state>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\</state>\n<group>\n<name>headers</name>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_aes.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_aes.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ana_regs.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ana_regs.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_cctest.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_cctest.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_flash_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_flash_ctrl.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_gpio.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_gpio.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_gptimer.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_gptimer.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_i2cm.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_i2cm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_i2cs.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_i2cs.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ints.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ints.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ioc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_memmap.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_memmap.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_nvic.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_nvic.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_pka.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_pka.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_ffsm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_sfr.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_sfr.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_xreg.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_xreg.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_smwdthrosc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_smwdthrosc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_soc_adc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_soc_adc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ssi.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ssi.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_sys_ctrl.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_types.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_types.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_uart.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_uart.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_udma.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_udma.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_udmachctl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_udmachctl.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_usb.h</name>\n<group>\n<name>source</name>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\adc.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\adc.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\adc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\adc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\aes.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\aes.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\aes.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\aes.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\bl_commands.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ccm.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ccm.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ccm.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ccm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\cpu.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\cpu.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\cpu.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\cpu.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\debug.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\debug.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\debug.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\debug.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ecc_curveinfo.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ecc_curveinfo.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\flash.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\flash.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\flash.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\flash.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gpio.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gpio.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gpio.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gpio.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gptimer.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gptimer.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gptimer.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gptimer.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\i2c_lib.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\i2c_lib.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\i2c_lib.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\i2c_lib.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\interrupt.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\interrupt.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\interrupt.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\interrupt.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ioc.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ioc.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ioc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\pka.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\pka.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\pka.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\pka.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\rom.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\rom.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sha256.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sha256.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sha256.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sha256.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sleepmode.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sleepmode.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sleepmode.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sleepmode.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ssi.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ssi.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ssi.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ssi.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sys_ctrl.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sys_ctrl.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sys_ctrl.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\systick.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\systick.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\systick.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\systick.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\uarthal.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\uarthal.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\uarthal.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\uarthal.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\udma.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\udma.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\udma.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\udma.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\watchdog.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\watchdog.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\watchdog.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\watchdog.h</name>\n</file>\n</group>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\adc_sensor.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\adc_sensor.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\adc_sensor.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\board.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\board_info.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\board_info.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\bsp_timer.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\cc2538_crypto_engine.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\cc2538_crypto_engine.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\cc2538_crypto_engine.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\cc2538rf.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\cc2538rf.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\debugpins.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\leds.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\radio.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\radio.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\radiotimer.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\startup_iar.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\uart.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\uart.c</name>\n</file>\n</group>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openapps\\uinject\\uinject.h</name>\n</file>\n</group>\n+ <group>\n+ <name>userialbridge</name>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\userialbridge\\userialbridge.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openapps\\userialbridge\\userialbridge.h</name>\n+ </file>\n+ </group>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openapps\\openapps.c</name>\n</file>\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-619. rename files to different names and update project file.
491,592
21.01.2017 14:05:10
-3,600
b5418e1c2043ed14bcc35d56a2c189fdcea2e5fc
adding udp compression through lowpan_NHC
[ { "change_type": "MODIFY", "old_path": "openstack/03a-IPHC/iphc.c", "new_path": "openstack/03a-IPHC/iphc.c", "diff": "@@ -737,6 +737,7 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\nuint8_t page;\nuint8_t temp_8b;\nuint8_t ipinip_length;\n+ uint8_t lowpan_nhc;\ntemp_8b = *((uint8_t*)(msg->payload)+ipv6_header->header_length+previousLen);\n@@ -949,6 +950,16 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\nbreak;\n}\n}\n+ //TODO, check NH if compressed no?\n+ if (ipv6_header->next_header_compressed){\n+ lowpan_nhc = *(msg->payload+ipv6_header->header_length+previousLen);//get the next element after addresses\n+ if ((lowpan_nhc & NHC_UDP_ID) == NHC_UDP_ID){ //check if it is UDP LOWPAN_NHC\n+ ipv6_header->next_header = IANA_UDP;\n+ }\n+ else{\n+ //error?\n+ }\n+ }\n} else {\n// we are in 6LoRH now\nif (page == 1){\n" }, { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/forwarding.c", "new_path": "openstack/03b-IPv6/forwarding.c", "diff": "@@ -74,6 +74,7 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) {\nuint8_t sam;\nuint8_t m;\nuint8_t dam;\n+ uint8_t next_header;\n// take ownership over the packet\nmsg->owner = COMPONENT_FORWARDING;\n@@ -138,11 +139,17 @@ owerror_t forwarding_send(OpenQueueEntry_t* msg) {\n}\n}\n//IPHC inner header and NHC IPv6 header will be added at here\n+\n+ if (msg->l4_protocol_compressed){\n+ next_header = IPHC_NH_COMPRESSED;\n+ }else{\n+ next_header = IPHC_NH_INLINE;\n+ }\niphc_prependIPv6Header(msg,\nIPHC_TF_ELIDED,\nflow_label, // value_flowlabel\n- IPHC_NH_INLINE,\n- msg->l4_protocol,\n+ next_header,\n+ msg->l4_protocol, // value nh. If compressed this is ignored as LOWPAN_NH is already there.\nIPHC_HLIM_64,\nipv6_outer_header.hop_limit,\nIPHC_CID_NO,\n@@ -193,6 +200,7 @@ void forwarding_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\nopentcp_sendDone(msg,error);\nbreak;\ncase IANA_UDP:\n+ printf(\"udp packet send done\\n\");\nopenudp_sendDone(msg,error);\nbreak;\ncase IANA_ICMPv6:\n@@ -234,6 +242,7 @@ void forwarding_receive(\n// take ownership\nmsg->owner = COMPONENT_FORWARDING;\n+\n// determine L4 protocol\n// get information from ipv6_header\nmsg->l4_protocol = ipv6_inner_header->next_header;\n@@ -243,6 +252,8 @@ void forwarding_receive(\nmemcpy(&(msg->l3_destinationAdd),&ipv6_inner_header->dest, sizeof(open_addr_t));\nmemcpy(&(msg->l3_sourceAdd), &ipv6_inner_header->src, sizeof(open_addr_t));\n+ printf(\"FW received packet 1 %d\\n\", msg->l3_sourceAdd.addr_64b[7] );\n+\nif (\n(\nidmanager_isMyAddress(&(msg->l3_destinationAdd))\n@@ -269,6 +280,7 @@ void forwarding_receive(\nicmpv6_receive(msg);\nbreak;\ndefault:\n+ printf(\"L4 protocol is %d\\n\", msg->l4_protocol);\n// log error\nopenserial_printError(\nCOMPONENT_FORWARDING,ERR_WRONG_TRAN_PROTOCOL,\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/openudp.c", "new_path": "openstack/04-TRAN/openudp.c", "diff": "@@ -21,15 +21,100 @@ void openudp_init() {\n}\nowerror_t openudp_send(OpenQueueEntry_t* msg) {\n+ uint8_t* checksum_position;\nmsg->owner = COMPONENT_OPENUDP;\nmsg->l4_protocol = IANA_UDP;\nmsg->l4_payload = msg->payload;\nmsg->l4_length = msg->length;\n+\n+ msg->l4_protocol_compressed = FALSE; // by default\n+ uint8_t compType = NHC_UDP_PORTS_INLINE;\n+\n+ //check if the header can be compressed.\n+ if (msg->l4_destination_port>=0xf000 && msg->l4_destination_port<0xf100){\n+ // destination can be compressed 8 bit\n+ msg->l4_protocol_compressed = TRUE;\n+ compType = NHC_UDP_PORTS_16S_8D;\n+ //check source now\n+ if (msg->l4_sourcePortORicmpv6Type>=0xf000 && msg->l4_sourcePortORicmpv6Type<0xf100){\n+ //source can be compressed -> 8bit\n+ compType = NHC_UDP_PORTS_8S_8D;\n+ }\n+ //check now if both can still be more compressed 4b each\n+ if (msg->l4_destination_port>=0xf0b0 &&\n+ msg->l4_destination_port<=0xf0bf &&\n+ msg->l4_sourcePortORicmpv6Type>=0xf0b0 &&\n+ msg->l4_sourcePortORicmpv6Type<=0xf0bf){\n+ //can be fully compressed\n+ compType = NHC_UDP_PORTS_4S_4D;\n+ }\n+ }\n+\n+ // fill in the header in the packet\n+ if (msg->l4_protocol_compressed){\n+\n+ //add checksum space in the packet.\n+ packetfunctions_reserveHeaderSize(msg,2);\n+ //keep position and calculatre checksum at the end.\n+ checksum_position = &msg->payload[0];\n+\n+ //length is always omitted\n+ /*\n+ RFC6282 -> The UDP Length field\n+ MUST always be elided and is inferred from lower layers using the\n+ 6LoWPAN Fragmentation header or the IEEE 802.15.4 header.\n+ */\n+\n+ switch (compType) {\n+ case NHC_UDP_PORTS_INLINE:\n+ // error this is not possible.\n+ break;\n+ case NHC_UDP_PORTS_16S_8D:\n+ // dest port: 0xf0 + 8 bits in-line\n+ // source port: 16 bits in-line\n+ packetfunctions_reserveHeaderSize(msg,1);\n+ msg->payload[0] = (uint8_t) (msg->l4_destination_port & 0x00ff);\n+ packetfunctions_reserveHeaderSize(msg,2);\n+ packetfunctions_htons(msg->l4_sourcePortORicmpv6Type,&(msg->payload[0]));\n+ //write proper LOWPAN_NHC\n+ packetfunctions_reserveHeaderSize(msg,1);\n+ msg->payload[0] = NHC_UDP_ID|NHC_UDP_PORTS_16S_8D;\n+ break;\n+ case NHC_UDP_PORTS_8S_8D:\n+ // dest port: 0xf0 + 8 bits in-line\n+ // source port: 0xf0 + 8 bits in-line\n+ packetfunctions_reserveHeaderSize(msg,1);\n+ msg->payload[0] = (uint8_t) (msg->l4_destination_port & 0x00ff);\n+ packetfunctions_reserveHeaderSize(msg,1);\n+ msg->payload[0] = (uint8_t) (msg->l4_sourcePortORicmpv6Type & 0x00ff);\n+ //write proper LOWPAN_NHC\n+ packetfunctions_reserveHeaderSize(msg,1);\n+ msg->payload[0] = NHC_UDP_ID|NHC_UDP_PORTS_8S_8D;\n+ break;\n+ case NHC_UDP_PORTS_4S_4D:\n+ // source port: 0xf0b + 4 bits in-line (high 4)\n+ // dest port: 0xf0b + 4 bits in-line (low 4)\n+ packetfunctions_reserveHeaderSize(msg,1);\n+ msg->payload[0] = (msg->l4_sourcePortORicmpv6Type & 0x000f)<<4;\n+ msg->payload[0] |= (msg->l4_destination_port & 0x000f);\n+ //write proper LOWPAN_NHC\n+ packetfunctions_reserveHeaderSize(msg,1);\n+ msg->payload[0] = NHC_UDP_ID|NHC_UDP_PORTS_4S_4D;\n+ break;\n+ }\n+\n+ //after filling the packet we calculate the checksum\n+ packetfunctions_calculateChecksum(msg,checksum_position);\n+ printf(\"sending udp packet\\n\");\n+\n+ } else{\npacketfunctions_reserveHeaderSize(msg,sizeof(udp_ht));\npacketfunctions_htons(msg->l4_sourcePortORicmpv6Type,&(msg->payload[0]));\npacketfunctions_htons(msg->l4_destination_port,&(msg->payload[2]));\n+ //TODO check this as the lenght MUST be ommited.\npacketfunctions_htons(msg->length,&(msg->payload[4]));\npacketfunctions_calculateChecksum(msg,(uint8_t*)&(((udp_ht*)msg->payload)->checksum));\n+ }\nreturn forwarding_send(msg);\n}\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/openudp.h", "new_path": "openstack/04-TRAN/openudp.h", "diff": "@@ -37,7 +37,7 @@ enum UDP_PORTS_enums {\ntypedef struct {\nuint16_t port_src;\nuint16_t port_dest;\n- uint16_t length;\n+ uint16_t length; // this should not be here. See RFC6282 section 4.3.3.\nuint16_t checksum;\n} udp_ht;\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
adding udp compression through lowpan_NHC
491,592
21.01.2017 14:23:23
-3,600
8ba5721e5b20795808229ede3fb3118e54a212a9
removing debug printf
[ { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/forwarding.c", "new_path": "openstack/03b-IPv6/forwarding.c", "diff": "@@ -200,7 +200,6 @@ void forwarding_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\nopentcp_sendDone(msg,error);\nbreak;\ncase IANA_UDP:\n- printf(\"udp packet send done\\n\");\nopenudp_sendDone(msg,error);\nbreak;\ncase IANA_ICMPv6:\n@@ -252,8 +251,6 @@ void forwarding_receive(\nmemcpy(&(msg->l3_destinationAdd),&ipv6_inner_header->dest, sizeof(open_addr_t));\nmemcpy(&(msg->l3_sourceAdd), &ipv6_inner_header->src, sizeof(open_addr_t));\n- printf(\"FW received packet 1 %d\\n\", msg->l3_sourceAdd.addr_64b[7] );\n-\nif (\n(\nidmanager_isMyAddress(&(msg->l3_destinationAdd))\n@@ -280,7 +277,6 @@ void forwarding_receive(\nicmpv6_receive(msg);\nbreak;\ndefault:\n- printf(\"L4 protocol is %d\\n\", msg->l4_protocol);\n// log error\nopenserial_printError(\nCOMPONENT_FORWARDING,ERR_WRONG_TRAN_PROTOCOL,\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/openudp.c", "new_path": "openstack/04-TRAN/openudp.c", "diff": "@@ -105,7 +105,6 @@ owerror_t openudp_send(OpenQueueEntry_t* msg) {\n//after filling the packet we calculate the checksum\npacketfunctions_calculateChecksum(msg,checksum_position);\n- printf(\"sending udp packet\\n\");\n} else{\npacketfunctions_reserveHeaderSize(msg,sizeof(udp_ht));\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-620 removing debug printf
491,595
22.01.2017 23:37:17
-3,600
15f78fe27ad665f4bc5f6fab228153a9066dbc4e
correct UDP compression code.
[ { "change_type": "MODIFY", "old_path": "openstack/03a-IPHC/iphc.c", "new_path": "openstack/03a-IPHC/iphc.c", "diff": "@@ -953,7 +953,7 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\n//TODO, check NH if compressed no?\nif (ipv6_header->next_header_compressed){\nlowpan_nhc = *(msg->payload+ipv6_header->header_length+previousLen);//get the next element after addresses\n- if ((lowpan_nhc & NHC_UDP_ID) == NHC_UDP_ID){ //check if it is UDP LOWPAN_NHC\n+ if ((lowpan_nhc & NHC_UDP_MASK) == NHC_UDP_ID){ //check if it is UDP LOWPAN_NHC\nipv6_header->next_header = IANA_UDP;\n}\nelse{\n" }, { "change_type": "MODIFY", "old_path": "openstack/03a-IPHC/iphc.h", "new_path": "openstack/03a-IPHC/iphc.h", "diff": "@@ -75,7 +75,7 @@ enum NHC_UDP_enums {\nenum NHC_UDP_PORTS_enums {\nNHC_UDP_PORTS_INLINE = 0,\nNHC_UDP_PORTS_16S_8D = 1,\n- NHC_UDP_PORTS_8S_8D = 2,\n+ NHC_UDP_PORTS_8S_16D = 2,\nNHC_UDP_PORTS_4S_4D = 3,\n};\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/openudp.c", "new_path": "openstack/04-TRAN/openudp.c", "diff": "@@ -35,19 +35,23 @@ owerror_t openudp_send(OpenQueueEntry_t* msg) {\n// destination can be compressed 8 bit\nmsg->l4_protocol_compressed = TRUE;\ncompType = NHC_UDP_PORTS_16S_8D;\n- //check source now\n- if (msg->l4_sourcePortORicmpv6Type>=0xf000 && msg->l4_sourcePortORicmpv6Type<0xf100){\n- //source can be compressed -> 8bit\n- compType = NHC_UDP_PORTS_8S_8D;\n- }\n//check now if both can still be more compressed 4b each\n- if (msg->l4_destination_port>=0xf0b0 &&\n+ if (\n+ msg->l4_destination_port >= 0xf0b0 &&\nmsg->l4_destination_port <= 0xf0bf &&\nmsg->l4_sourcePortORicmpv6Type >= 0xf0b0 &&\n- msg->l4_sourcePortORicmpv6Type<=0xf0bf){\n+ msg->l4_sourcePortORicmpv6Type <= 0xf0bf\n+ ){\n//can be fully compressed\ncompType = NHC_UDP_PORTS_4S_4D;\n}\n+ } else {\n+ //check source now\n+ if (msg->l4_sourcePortORicmpv6Type>=0xf000 && msg->l4_sourcePortORicmpv6Type<0xf100){\n+ //source can be compressed -> 8bit\n+ msg->l4_protocol_compressed = TRUE;\n+ compType = NHC_UDP_PORTS_8S_16D;\n+ }\n}\n// fill in the header in the packet\n@@ -80,16 +84,16 @@ owerror_t openudp_send(OpenQueueEntry_t* msg) {\npacketfunctions_reserveHeaderSize(msg,1);\nmsg->payload[0] = NHC_UDP_ID|NHC_UDP_PORTS_16S_8D;\nbreak;\n- case NHC_UDP_PORTS_8S_8D:\n- // dest port: 0xf0 + 8 bits in-line\n+ case NHC_UDP_PORTS_8S_16D:\n+ // dest port: 0xf0 + 16 bits in-line\n// source port: 0xf0 + 8 bits in-line\n- packetfunctions_reserveHeaderSize(msg,1);\n- msg->payload[0] = (uint8_t) (msg->l4_destination_port & 0x00ff);\n+ packetfunctions_reserveHeaderSize(msg,2);\n+ packetfunctions_htons(msg->l4_destination_port,&(msg->payload[0]));\npacketfunctions_reserveHeaderSize(msg,1);\nmsg->payload[0] = (uint8_t) (msg->l4_sourcePortORicmpv6Type & 0x00ff);\n//write proper LOWPAN_NHC\npacketfunctions_reserveHeaderSize(msg,1);\n- msg->payload[0] = NHC_UDP_ID|NHC_UDP_PORTS_8S_8D;\n+ msg->payload[0] = NHC_UDP_ID|NHC_UDP_PORTS_8S_16D;\nbreak;\ncase NHC_UDP_PORTS_4S_4D:\n// source port: 0xf0b + 4 bits in-line (high 4)\n@@ -167,12 +171,12 @@ void openudp_receive(OpenQueueEntry_t* msg) {\nmsg->l4_destination_port = 0xf000 + msg->payload[2];\npacketfunctions_tossHeader(msg,2+1);\nbreak;\n- case NHC_UDP_PORTS_8S_8D:\n+ case NHC_UDP_PORTS_8S_16D:\n// source port: 0xf0 + 8 bits in-line\n// dest port: 0xf0 + 8 bits in-line\nmsg->l4_sourcePortORicmpv6Type = 0xf000 + msg->payload[0];\n- msg->l4_destination_port = 0xf000 + msg->payload[1];\n- packetfunctions_tossHeader(msg,1+1);\n+ msg->l4_destination_port = msg->payload[1]*256+msg->payload[2];\n+ packetfunctions_tossHeader(msg,1+2);\nbreak;\ncase NHC_UDP_PORTS_4S_4D:\n// source port: 0xf0b + 4 bits in-line\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-620. correct UDP compression code.
491,595
23.01.2017 11:41:01
-3,600
82191c739f6e0a813ca58268d9a34650e1d31ce3
use 0xf0b1 as udpinject sourcePort/DestPort to test UDP header compression.
[ { "change_type": "MODIFY", "old_path": "inc/opendefs.h", "new_path": "inc/opendefs.h", "diff": "@@ -89,7 +89,7 @@ enum {\n//UDP\nWKP_UDP_COAP = 5683,\nWKP_UDP_ECHO = 7,\n- WKP_UDP_INJECT = 2000,\n+ WKP_UDP_INJECT = 61617,// 0xf0b1\nWKP_UDP_RINGMASTER = 15000,\nWKP_UDP_SERIALBRIDGE = 2001,\n};\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-620. use 0xf0b1 as udpinject sourcePort/DestPort to test UDP header compression.
491,595
23.01.2017 20:40:17
-3,600
07fc54cf6da524360f2d334ad22851fa7f216f69
reset l4_protocol_compressed when reset an queue buffer entry.
[ { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/icmpv6rpl.c", "new_path": "openstack/03b-IPv6/icmpv6rpl.c", "diff": "@@ -575,6 +575,7 @@ void sendDIO() {\n// set transport information\nmsg->l4_protocol = IANA_ICMPv6;\n+ msg->l4_protocol_compressed = FALSE;\nmsg->l4_sourcePortORicmpv6Type = IANA_ICMPv6_RPL;\n// set DIO destination\n" }, { "change_type": "MODIFY", "old_path": "openstack/cross-layers/openqueue.c", "new_path": "openstack/cross-layers/openqueue.c", "diff": "@@ -295,6 +295,7 @@ void openqueue_reset_entry(OpenQueueEntry_t* entry) {\nentry->length = 0;\n//l4\nentry->l4_protocol = IANA_UNDEFINED;\n+ entry->l4_protocol_compressed = FALSE;\n//l3\nentry->l3_destinationAdd.type = ADDR_NONE;\nentry->l3_sourceAdd.type = ADDR_NONE;\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-620. reset l4_protocol_compressed when reset an queue buffer entry.
491,595
24.01.2017 16:37:58
-3,600
106ea72a2cd08ca83af7c875541a658cad7bef57
Fixed. set container as frameId no matter which command.
[ { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -212,21 +212,19 @@ void sixtop_request(uint8_t code, open_addr_t* neighbor, uint8_t numCells){\nif (sixtop_candidateAddCellList(&frameID,cellList,numCells)==FALSE){\nsixtop_vars.handler = SIX_HANDLER_NONE;\nreturn;\n- } else{\n- // container to be define by SF, currently equals to frameID\n- container = frameID;\n}\n}\nif (code == IANA_6TOP_CMD_DELETE){\nif (sixtop_candidateRemoveCellList(&frameID,cellList,neighbor,numCells)==FALSE){\nsixtop_vars.handler = SIX_HANDLER_NONE;\nreturn;\n- } else{\n- // container to be define by SF, currently equals to frameID\n- container = frameID;\n}\n}\n+ // container to be define by SF, currently equals to frameID\n+ frameID = SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE;\n+ container = frameID;\n+\n// get a free packet buffer\npkt = openqueue_getFreePacketBuffer(COMPONENT_SIXTOP_RES);\nif (pkt==NULL) {\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
Fixed. set container as frameId no matter which command.
491,587
26.01.2017 17:24:30
-3,600
2e7331de4f5be8e691eff61f2a9842bb80b93629
Bug fix TelosB mote is on for 1ms too long because radio_rxEnable() is called in activity_ri2 rather than activity_ri3.
[ { "change_type": "MODIFY", "old_path": "bsp/chips/cc2420/radio.c", "new_path": "bsp/chips/cc2420/radio.c", "diff": "@@ -236,25 +236,23 @@ void radio_rxEnable(void) {\n// change state\nradio_vars.state = RADIOSTATE_ENABLING_RX;\n- // put radio in reception mode\n- cc2420_spiStrobe(CC2420_SRXON, &radio_vars.radioStatusByte);\n- cc2420_spiStrobe(CC2420_SFLUSHRX, &radio_vars.radioStatusByte);\n-\n// wiggle debug pin\ndebugpins_radio_set();\nleds_radio_on();\n-\n- // busy wait until radio really listening\n- while (radio_vars.radioStatusByte.rssi_valid==0) {\n- cc2420_spiStrobe(CC2420_SNOP, &radio_vars.radioStatusByte);\n}\n+void radio_rxNow(void) {\n// change state\nradio_vars.state = RADIOSTATE_LISTENING;\n-}\n-void radio_rxNow(void) {\n- // nothing to do, the radio is already listening.\n+ // put radio in reception mode\n+ cc2420_spiStrobe(CC2420_SRXON, &radio_vars.radioStatusByte);\n+ cc2420_spiStrobe(CC2420_SFLUSHRX, &radio_vars.radioStatusByte);\n+\n+ // busy wait until radio really listening\n+ while (radio_vars.radioStatusByte.rssi_valid==0) {\n+ cc2420_spiStrobe(CC2420_SNOP, &radio_vars.radioStatusByte);\n+ }\n}\nvoid radio_getReceivedFrame(\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
Bug fix FW-583 TelosB mote is on for 1ms too long because radio_rxEnable() is called in activity_ri2 rather than activity_ri3.
491,609
18.07.2015 12:55:40
-7,200
578ce565e6243aafe2e3872a920387ff9b946b4c
Add packetfunction to reverse byte order in an array of var length.
[ { "change_type": "MODIFY", "old_path": "openstack/cross-layers/packetfunctions.c", "new_path": "openstack/cross-layers/packetfunctions.c", "diff": "@@ -468,4 +468,16 @@ uint32_t packetfunctions_ntohl( uint8_t* src ) {\n);\n}\n+// reverse byte order in the array\n+void packetfunctions_reverseArrayByteOrder(uint8_t* start, uint8_t len) {\n+ uint8_t *lo = start;\n+ uint8_t *hi = start + len - 1;\n+ uint8_t swap;\n+ while (lo < hi) {\n+ swap = *lo;\n+ *lo++ = *hi;\n+ *hi-- = swap;\n+ }\n+}\n+\n//=========================== private =========================================\n" }, { "change_type": "MODIFY", "old_path": "openstack/cross-layers/packetfunctions.h", "new_path": "openstack/cross-layers/packetfunctions.h", "diff": "@@ -55,6 +55,7 @@ void packetfunctions_htons( uint16_t val, uint8_t* dest );\nuint16_t packetfunctions_ntohs( uint8_t* src );\nvoid packetfunctions_htonl( uint32_t val, uint8_t* dest );\nuint32_t packetfunctions_ntohl( uint8_t* src );\n+void packetfunctions_reverseArrayByteOrder(uint8_t* start, uint8_t len);\n/**\n\\}\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-433. Add packetfunction to reverse byte order in an array of var length.
491,609
18.07.2015 12:55:57
-7,200
9e59b6ef78d58aec93e5185f639d97746c179757
Use big endian ASN within security nonce.
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154_security.c", "new_path": "openstack/02a-MAClow/IEEE802154_security.c", "diff": "@@ -334,6 +334,7 @@ owerror_t IEEE802154_security_outgoingFrameSecurity(OpenQueueEntry_t* msg){\n// Fill last 5 bytes with the ASN part of the nonce\nieee154e_getAsn(&nonce[8]);\n+ packetfunctions_reverseArrayByteOrder(&nonce[8], 5); // reverse ASN bytes to big endian\n//identify data to be authenticated and data to be encrypted\nswitch (msg->l2_securityLevel) {\n@@ -586,6 +587,7 @@ owerror_t IEEE802154_security_incomingFrame(OpenQueueEntry_t* msg){\nmemcpy(&nonce[0],msg->l2_nextORpreviousHop.addr_64b, 8);\n// Fill last 5 bytes with ASN part of the nonce\nieee154e_getAsn(&nonce[8]);\n+ packetfunctions_reverseArrayByteOrder(&nonce[8], 5); // reverse ASN bytes to big endian\n//identify data to be authenticated and data to be decrypted\nswitch (msg->l2_securityLevel) {\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-433. Use big endian ASN within security nonce.
491,595
01.02.2017 00:49:53
-3,600
fd487b5ab43e63dbc92ca641919fe8bc267bc2cf
remove piggybackEB feature.
[ { "change_type": "MODIFY", "old_path": "inc/opendefs.h", "new_path": "inc/opendefs.h", "diff": "@@ -38,8 +38,6 @@ static const uint8_t infoStackName[] = \"OpenWSN \";\n#define MAXNUMNEIGHBORS 10\n-#define EB_DIO_PIGGYBACK\n-\nenum {\nE_SUCCESS = 0,\nE_FAIL = 1,\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -949,42 +949,6 @@ port_INLINE void activity_ti1ORri1() {\n// look for an EB packet in the queue\nieee154e_vars.dataToSend = openqueue_macGetEBPacket();\n}\n-#ifdef EB_DIO_PIGGYBACK\n- // send piggyback'ed EB_DIO on shared slot 0, send others packet on shared slot 1-3\n- // this is caused EB has a highest sending rate for fast joining when ChannelHopping is enabled.\n- // seperate the EB traffic from others\n- switch(ieee154e_vars.slotOffset){\n- case 0:\n- // only send piggyback'ed EB_DIO\n- couldSendEB=TRUE;\n- ieee154e_vars.dataToSend = openqueue_macGetDIOPacket();\n- break;\n- case 1:\n- case 2:\n- case 3:\n- case 4:\n- case 5:\n- case 6:\n- case 7:\n- case 8:\n- case 9:\n- couldSendEB=FALSE;\n- // only send Unicast\n- ieee154e_vars.dataToSend = openqueue_macGetUnicastPacket(&neighbor);\n- // if I have Tx slot for the unicast packet, send it at that Tx slot\n- if (ieee154e_vars.dataToSend!=NULL){\n- if (schedule_getCellsCounts(SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE,CELLTYPE_TX,&(ieee154e_vars.dataToSend->l2_nextORpreviousHop))>0){\n- ieee154e_vars.dataToSend = NULL;\n- }\n- }\n-\n- break;\n- default:\n- couldSendEB=FALSE;\n- ieee154e_vars.dataToSend = openqueue_macGetUnicastPacket(&neighbor);\n- break;\n- }\n-#else\nswitch(ieee154e_vars.slotOffset){\ncase 0:\n// only send EB\n@@ -1015,7 +979,6 @@ port_INLINE void activity_ti1ORri1() {\nieee154e_vars.dataToSend = openqueue_macGetUnicastPacket(&neighbor);\nbreak;\n}\n-#endif\n}\n/*\n// don't send DAO or replying packet on shared slot(TxRx slot),\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -51,7 +51,6 @@ void timer_sixtop_sendEb_fired(void);\nvoid timer_sixtop_management_fired(void);\nvoid sixtop_sendEB(void);\nvoid sixtop_sendKA(void);\n-void sixtop_sendEB_piggyback(OpenQueueEntry_t* eb);\n//=== six2six task\n@@ -387,21 +386,12 @@ owerror_t sixtop_send(OpenQueueEntry_t *msg) {\n// set metadata\nmsg->owner = COMPONENT_SIXTOP;\n-#ifdef EB_DIO_PIGGYBACK\n- if (packetfunctions_isBroadcastMulticast(&(msg->l2_nextORpreviousHop))){\n- // this is a DIO, do piggyback on EB\n- sixtop_sendEB_piggyback(msg);\n- } else {\n- msg->l2_frameType = IEEE154_TYPE_DATA;\n- }\n-#else\nmsg->l2_frameType = IEEE154_TYPE_DATA;\n// set l2-security attributes\nmsg->l2_securityLevel = IEEE802154_SECURITY_LEVEL;\nmsg->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE;\nmsg->l2_keyIndex = IEEE802154_SECURITY_K2_KEY_INDEX;\n-#endif\nif (msg->l2_payloadIEpresent == FALSE) {\nreturn sixtop_send_internal(\n@@ -551,20 +541,10 @@ void task_sixtopNotifReceive() {\ncase IEEE154_TYPE_CMD:\nif (msg->length>0) {\nif (msg->l2_frameType == IEEE154_TYPE_BEACON){\n-#ifdef EB_DIO_PIGGYBACK\n- // I have one byte frequence field\n- packetfunctions_tossHeader(msg,1);\n- if (msg->length==0){\n- openqueue_freePacketBuffer(msg);\n- } else {\n- // this is a piggy back packet, forward to iphc later\n- }\n-#else\n// I have one byte frequence field, no useful for upper layer\n// free up the RAM\nopenqueue_freePacketBuffer(msg);\nbreak;\n-#endif\n}\n// send to upper layer\niphc_receive(msg);\n@@ -806,43 +786,6 @@ port_INLINE void sixtop_sendEB() {\nsixtop_vars.busySendingEB = TRUE;\n}\n-\n-port_INLINE void sixtop_sendEB_piggyback(OpenQueueEntry_t* eb){\n- uint8_t len;\n-\n- len = 0;\n-\n- eb->owner = COMPONENT_SIXTOP;\n-\n- // reserve one byte to indicate the real frequence\n- packetfunctions_reserveHeaderSize(eb,1);\n- eb->l2_realFrequence = eb->payload;\n-\n- // reserve space for EB-specific header\n- // reserving for IEs.\n- len += processIE_prependSlotframeLinkIE(eb);\n- len += processIE_prependChannelHoppingIE(eb);\n- len += processIE_prependTSCHTimeslotIE(eb);\n- len += processIE_prependSyncIE(eb);\n-\n- //add IE header\n- processIE_prependMLMEIE(eb,len);\n-\n- // some l2 information about this packet\n- eb->l2_frameType = IEEE154_TYPE_BEACON;\n- eb->l2_nextORpreviousHop.type = ADDR_16B;\n- eb->l2_nextORpreviousHop.addr_16b[0] = 0xff;\n- eb->l2_nextORpreviousHop.addr_16b[1] = 0xff;\n-\n- //I has an IE in my payload\n- eb->l2_payloadIEpresent = TRUE;\n-\n- // set l2-security attributes\n- eb->l2_securityLevel = IEEE802154_SECURITY_LEVEL_BEACON;\n- eb->l2_keyIdMode = IEEE802154_SECURITY_KEYIDMODE;\n- eb->l2_keyIndex = IEEE802154_SECURITY_K1_KEY_INDEX;\n-}\n-\n/**\n\\brief Send an keep-alive message, if necessary.\n" }, { "change_type": "MODIFY", "old_path": "projects/python/SConscript.env", "new_path": "projects/python/SConscript.env", "diff": "@@ -543,8 +543,6 @@ functionsToChange = [\n'neighbors_removeOld',\n'debugPrint_neighbors',\n'registerNewNeighbor',\n- 'neighbors_setNeighborNoResource',\n- 'neighbors_getNeighborNoResource',\n'isNeighbor',\n'removeNeighbor',\n'isThisRowMatching',\n@@ -639,10 +637,8 @@ functionsToChange = [\n'sixtop_sendingEb_timer_cb',\n'timer_sixtop_sendEb_fired',\n'timer_sixtop_management_fired',\n- 'timer_sixtop_sendEb_fired',\n'sixtop_sendEB',\n'sixtop_sendKA',\n- 'sixtop_sendEB_piggyback',\n'timer_sixtop_six2six_timeout_fired',\n'sixtop_six2six_sendDone',\n'sixtop_processIEs',\n@@ -773,7 +769,6 @@ functionsToChange = [\n'openqueue_sixtopGetNumberOfPacketCreatedBy',\n'openqueue_macGetDataPacket',\n'openqueue_macGetEBPacket',\n- 'openqueue_isHighPriorityEntryEnough',\n'openqueue_reset_entry',\n'openqueue_macGetDIOPacket',\n'openqueue_macGetUnicastPacket',\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-548. remove piggybackEB feature.
491,595
01.02.2017 01:38:49
28,800
2934bdb71b4a15ed24d82a7bd76b2257a0bc473c
revert M3 project Sconscript.env file
[ { "change_type": "MODIFY", "old_path": "projects/iot-lab_M3/SConscript.env", "new_path": "projects/iot-lab_M3/SConscript.env", "diff": "@@ -13,21 +13,16 @@ buildEnv['ENV'] = os.environ\n# configuration for the same board.\nbuildEnv['BSP'] = buildEnv['board']\n-# include board/bsp-specific directories\n-buildEnv.Append(\n- CPPPATH = [\n- os.path.join('#','bsp','boards',buildEnv['board']),\n- ]\n-)\n+bsp_dir = os.path.join('#','bsp','boards',buildEnv['board'])\n# include board/bsp-specific directories\nbuildEnv.Append(\nCPPPATH = [\n- os.path.join('#','bsp','boards',buildEnv['board']),\n- os.path.join('#','bsp','boards',buildEnv['board'],'library','inc'),\n- os.path.join('#','bsp','boards',buildEnv['board'],'Libraries','CMSIS','CM3','DeviceSupport','ST','STM32F10x'),\n- os.path.join('#','bsp','boards',buildEnv['board'],'Libraries','CMSIS','CM3','CoreSupport'),\n- os.path.join('#','bsp','boards',buildEnv['board'],'configure'),\n+ bsp_dir,\n+ os.path.join(bsp_dir,'library','STM32F10x_StdPeriph_Lib_V3.5.0','Libraries','STM32F10x_StdPeriph_Driver','inc'),\n+ os.path.join(bsp_dir,'library','STM32F10x_StdPeriph_Lib_V3.5.0','Libraries','CMSIS','CM3','DeviceSupport','ST','STM32F10x'),\n+ os.path.join(bsp_dir,'library','STM32F10x_StdPeriph_Lib_V3.5.0','Libraries','CMSIS','CM3','CoreSupport'),\n+ os.path.join(bsp_dir,'configure'),\n]\n)\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-548. revert M3 project Sconscript.env file
491,595
01.02.2017 13:46:26
-3,600
de0ea537c9e8b8e67037e908c3d84ec1de03bebe
handle multiple sixtop response return code.
[ { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -875,15 +875,22 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\nptr = msg->l2_sixtop_cellObjects;\nnumOfCells = msg->l2_sixtop_numOfCells;\nmsg->owner = COMPONENT_SIXTOP_RES;\n-\n- if (msg->l2_sixtop_returnCode == IANA_6TOP_RC_ERR_BUSY){\n- // no matter successfully being sent out or not, if this is\n- // a sixtop response with ERR_BUSY code, there is nothing need to do\n- // free the buffer\n+ // if this is a response send done\n+ if (\n+ msg->l2_sixtop_returnCode == IANA_6TOP_RC_ERR_VER ||\n+ msg->l2_sixtop_returnCode == IANA_6TOP_RC_ERR_SFID ||\n+ msg->l2_sixtop_returnCode == IANA_6TOP_RC_ERR_BUSY ||\n+ msg->l2_sixtop_returnCode == IANA_6TOP_RC_ERR_NORES ||\n+ msg->l2_sixtop_returnCode == IANA_6TOP_RC_ERR_RESET ||\n+ msg->l2_sixtop_returnCode == IANA_6TOP_RC_ERR\n+ ){\n+ // no matter successfully being sent out or failed with\n+ // 3 times retries, if this is a sixtop response, free\n+ // the buffer and end the transcation on my side.\nopenqueue_freePacketBuffer(msg);\nreturn;\n}\n-\n+ // if this is a request send done\nif(error == E_FAIL) {\nif (\nsixtop_vars.six2six_state == SIX_STATE_WAIT_ADDREQUEST_SENDDONE ||\n@@ -956,8 +963,8 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\nschedule_removeAllCells(msg->l2_sixtop_frameID,\n&(msg->l2_nextORpreviousHop));\n} else {\n- // the return code is RC_ERR_NORES or RC_ERR_RESET\n- // nothing needs to do\n+ // for the request command of List or Count, there\n+ // is no need to handle on response side.\n}\n}\n}\n@@ -1089,14 +1096,6 @@ void sixtop_notifyReceiveCommand(\nsizeof(open_addr_t)\n);\n- //===== if the version or sfID are correct\n- if (version != IANA_6TOP_6P_VERSION || sfId != SFID_SF0){\n- if (version != IANA_6TOP_6P_VERSION){\n- code = IANA_6TOP_RC_ERR_VER;\n- } else {\n- code = IANA_6TOP_RC_ERR_SFID;\n- }\n- } else {\n//====== the version and sfID are correct\n//------ if this is a command\nif (\n@@ -1106,6 +1105,14 @@ void sixtop_notifyReceiveCommand(\ncommandIdORcode == IANA_6TOP_CMD_LIST ||\ncommandIdORcode == IANA_6TOP_CMD_CLEAR\n){\n+ // if the version or sfID is correct\n+ if (version != IANA_6TOP_6P_VERSION || sfId != SFID_SF0){\n+ if (version != IANA_6TOP_6P_VERSION){\n+ code = IANA_6TOP_RC_ERR_VER;\n+ } else {\n+ code = IANA_6TOP_RC_ERR_SFID;\n+ }\n+ } else {\n// if I am already in a 6top transactions\nif (sixtop_vars.six2six_state != SIX_STATE_IDLE){\ncode = IANA_6TOP_RC_ERR_BUSY;\n@@ -1176,6 +1183,7 @@ void sixtop_notifyReceiveCommand(\ncode = IANA_6TOP_RC_ERR;\n}\n}\n+ }\nresponse_pkt->l2_sixtop_requestCommand = commandIdORcode;\nresponse_pkt->l2_sixtop_frameID = frameID;\n@@ -1255,7 +1263,15 @@ void sixtop_notifyReceiveCommand(\nif (commandIdORcode==IANA_6TOP_RC_ERR){\n// TBD: the neighbor can't statisfy the 6p request, call sf0 to make a decision\n} else {\n- // TBD...\n+ if (commandIdORcode==IANA_6TOP_RC_ERR_VER){\n+ // TBD: the 6p verion does not match\n+ } else {\n+ if (commandIdORcode==IANA_6TOP_RC_ERR_SFID){\n+ // TBD: the sfId does not match\n+ } else {\n+ // TBD: ...\n+ }\n+ }\n}\n}\n}\n@@ -1269,7 +1285,6 @@ void sixtop_notifyReceiveCommand(\nopentimers_stop(sixtop_vars.timeoutTimerId);\n}\n}\n-}\nuint8_t sixtop_getCelllist(\nuint8_t frameID,\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.h", "new_path": "openstack/02b-MAChigh/sixtop.h", "diff": "@@ -60,10 +60,6 @@ typedef enum {\nSIX_STATE_WAIT_COUNTRESPONSE = 0x09,\nSIX_STATE_WAIT_LISTRESPONSE = 0x0a,\nSIX_STATE_WAIT_CLEARRESPONSE = 0x0b,\n-\n- // response senddone\n- SIX_STATE_REQUEST_RECEIVED = 0x0c,\n- SIX_STATE_WAIT_RESPONSE_SENDDONE = 0x0d,\n} six2six_state_t;\n// before sixtop protocol is called, sixtop handler must be set\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-610. handle multiple sixtop response return code.
491,595
02.02.2017 02:30:07
-3,600
ce124fc8fef9866ae1c45690dfdfebc2c0ceb845
create scheduling function y: hashtable.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/python/openwsnmodule.c", "new_path": "bsp/boards/python/openwsnmodule.c", "diff": "@@ -66,6 +66,7 @@ static PyObject* OpenMote_getState(OpenMote* self) {\nPyObject* schedule_vars;\nPyObject* schedule_dbg;\nPyObject* sfx_vars;\n+ PyObject* sfy_hashtable_vars;\nPyObject* ieee154e_vars;\nPyObject* ieee154e_stats;\nPyObject* ieee154e_dbg;\n@@ -152,6 +153,11 @@ static PyObject* OpenMote_getState(OpenMote* self) {\n// TODO\nPyDict_SetItemString(returnVal, \"sfx_vars\", sfx_vars);\n+ // sfy_hashtable_vars\n+ sfy_hashtable_vars = PyDict_New();\n+ // TODO\n+ PyDict_SetItemString(returnVal, \"sfy_hashtable_vars\", sfy_hashtable_vars);\n+\n// schedule_dbg\nschedule_dbg = PyDict_New();\n// TODO\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/openwsnmodule_obj.h", "new_path": "bsp/boards/python/openwsnmodule_obj.h", "diff": "#include \"sixtop_obj.h\"\n#include \"sf0_obj.h\"\n#include \"sfx_obj.h\"\n+#include \"sfy_hashtable_obj.h\"\n#include \"schedule_obj.h\"\n#include \"icmpv6echo_obj.h\"\n#include \"icmpv6rpl_obj.h\"\n@@ -226,6 +227,7 @@ struct OpenMote {\nschedule_vars_t schedule_vars;\nsf0_vars_t sf0_vars;\nsfx_vars_t sfx_vars;\n+ sfy_hashtable_vars_t sfy_hashtable_vars;\n// l2a\nadaptive_sync_vars_t adaptive_sync_vars;\nieee802154_security_vars_t ieee802154_security_vars;\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "#include \"adaptive_sync.h\"\n#include \"processIE.h\"\n#include \"openrandom.h\"\n+#include \"sfy_hashtable.h\"\n//=========================== definition ======================================\n@@ -960,47 +961,23 @@ port_INLINE void activity_ti1ORri1() {\ncouldSendEB=FALSE;\nieee154e_vars.dataToSend = openqueue_macGetDIOPacket();\nbreak;\n- case 2:\n- case 3:\n- case 4:\n+ default:\ncouldSendEB=FALSE;\n// only send Unicast\nieee154e_vars.dataToSend = openqueue_macGetUnicastPacket(&neighbor);\n// if I have Tx slot for the unicast packet, send it at that Tx slot\n- if (ieee154e_vars.dataToSend!=NULL){\n+ if (\n+ ieee154e_vars.dataToSend != NULL &&\n+ ieee154e_vars.dataToSend->creator>COMPONENT_SIXTOP_RES &&\n+ ieee154e_vars.slotOffset == sfy_hashtable_getSharedSlotMe()\n+ ){\nif (schedule_getCellsCounts(SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE,CELLTYPE_TX,&(ieee154e_vars.dataToSend->l2_nextORpreviousHop))>0){\nieee154e_vars.dataToSend = NULL;\n}\n}\n-\n- break;\n- default:\n- couldSendEB=FALSE;\n- ieee154e_vars.dataToSend = openqueue_macGetUnicastPacket(&neighbor);\nbreak;\n}\n}\n- /*\n- // don't send DAO or replying packet on shared slot(TxRx slot),\n- // but still record in as having packet to be sent (just done above).\n- // later sfx will reserve at least one cell for sending DAO, if there is no cell in schedule yet.\n- if (ieee154e_vars.dataToSend !=NULL) {\n- if (\n- cellType==CELLTYPE_TXRX &&\n- ( // rpl packet but not boardcast (DAO, not DIO)\n- (\n- ieee154e_vars.dataToSend->creator==COMPONENT_ICMPv6RPL &&\n- packetfunctions_isBroadcastMulticast(&(ieee154e_vars.dataToSend->l2_nextORpreviousHop))==FALSE\n- )||\n- // packet requied to be replied\n- ieee154e_vars.dataToSend->creator==COMPONENT_FORWARDING\n- )\n- ) {\n- // disselect the packet to change to Rx mode.\n- ieee154e_vars.dataToSend=NULL;\n- }\n- }\n- */\n// udpate cell usgae bitmap, set as true if I have packet to send\nif (ieee154e_vars.dataToSend==NULL) {\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/schedule.h", "new_path": "openstack/02b-MAChigh/schedule.h", "diff": "@@ -20,7 +20,7 @@ The superframe repears over time and can be arbitrarly long.\n#define SLOTFRAME_LENGTH 101 //should be 101\n//draft-ietf-6tisch-minimal-06\n-#define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS 10\n+#define SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS 2\n#define SCHEDULE_MINIMAL_6TISCH_SLOTOFFSET 0\n#define SCHEDULE_MINIMAL_6TISCH_CHANNELOFFSET 0\n#define SCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE 1 //id of slotframe\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sfx.c", "new_path": "openstack/02b-MAChigh/sfx.c", "diff": "#include \"idmanager.h\"\n#include \"icmpv6rpl.h\"\n#include \"scheduler.h\"\n+#include \"sfy_hashtable.h\"\n//=========================== definition ======================================\n@@ -125,6 +126,8 @@ void sfx_cellUsageCalculation_task(){\nreturn;\n}\n+ sfy_hashtable_updateSharedslotParent(&neighbor);\n+\nnumberOfCells = schedule_getCellsCounts(\nSCHEDULE_MINIMAL_6TISCH_DEFAULT_SLOTFRAME_HANDLE,\nCELLTYPE_TX,\n" }, { "change_type": "ADD", "old_path": null, "new_path": "openstack/02b-MAChigh/sfy_hashtable.c", "diff": "+/**\n+\\brief A mechanism to calculate the slotoffset and channel offset of shared\n+ cell installed at runtime based on a hash table.\n+\\author: Tengfei Chang <tengfei.chang@inria.fr>, February 2017\n+*/\n+\n+#include \"packetfunctions.h\"\n+#include \"sfy_hashtable.h\"\n+#include \"schedule.h\"\n+#include \"idmanager.h\"\n+\n+//=========================== definition ======================================\n+\n+//=========================== variable ========================================\n+\n+sfy_hashtable_vars_t sfy_hashtable_vars;\n+\n+//=========================== public ==========================================\n+\n+void sfy_hashtable_init(){\n+ uint16_t slotOffset;\n+ uint8_t channelOffset;\n+ open_addr_t temp_neighbor;\n+\n+ memset(&sfy_hashtable_vars,0,sizeof(sfy_hashtable_vars_t));\n+ // calculate my shared slot offset\n+ sfy_hashtable_getCellInfo(idmanager_getMyID(ADDR_16B),&slotOffset,&channelOffset);\n+ sfy_hashtable_vars.sharedSlot_me = slotOffset;\n+\n+ memset(&temp_neighbor,0,sizeof(temp_neighbor));\n+ temp_neighbor.type = ADDR_ANYCAST;\n+\n+ schedule_addActiveSlot(\n+ slotOffset, // slot offset\n+ CELLTYPE_TXRX, // type of slot\n+ TRUE, // shared?\n+ channelOffset, // channel offset\n+ &temp_neighbor // neighbor\n+ );\n+}\n+\n+bool sfy_hashtable_getCellInfo(\n+ open_addr_t* address,\n+ uint16_t* slotOffset,\n+ uint8_t* channelOffset\n+ ){\n+ uint16_t moteId;\n+ if (address->type != ADDR_16B){\n+ // I need a 16b type address\n+ return FALSE;\n+ }\n+ moteId = address->addr_16b[0]*256 + address->addr_16b[1];\n+ if (moteId%SLOTFRAME_LENGTH<SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS+NUMSERIALRX){\n+ *slotOffset = SCHEDULE_MINIMAL_6TISCH_ACTIVE_CELLS+NUMSERIALRX;\n+ } else {\n+ *slotOffset = moteId%SLOTFRAME_LENGTH;\n+ }\n+ // it may do something advanced on channel offset selection\n+ // e.g. channelOffset = moteId%16, then there will be a problem that\n+ // pair of node (parent&child) has same slotOffset but different channelOffset\n+ // for now, just use unique number\n+ *channelOffset = 0;\n+ return TRUE;\n+}\n+\n+void sfy_hashtable_updateSharedslotParent(open_addr_t* address){\n+ uint16_t slotOffset;\n+ uint8_t channelOffset;\n+ open_addr_t temp_neighbor_16b;\n+\n+ packetfunctions_mac64bToMac16b(address,&temp_neighbor_16b);\n+\n+ sfy_hashtable_getCellInfo(&temp_neighbor_16b,&slotOffset,&channelOffset);\n+\n+ if (slotOffset==sfy_hashtable_vars.sharedSlot_me){\n+ // the shared cells to parent and mine are the same\n+ sfy_hashtable_vars.sharedSlot_parent = slotOffset;\n+ return;\n+ }\n+ if (slotOffset==sfy_hashtable_vars.sharedSlot_parent){\n+ // new parent use the same slot as previous one\n+ // do nothing\n+ } else {\n+ if (schedule_addActiveSlot(\n+ slotOffset,\n+ CELLTYPE_TXRX,\n+ TRUE,\n+ channelOffset,\n+ address\n+ )==E_SUCCESS\n+ ){\n+ if (sfy_hashtable_vars.sharedSlot_parent!=0){\n+ // remove previous parent shared cell\n+ schedule_removeActiveSlot(\n+ sfy_hashtable_vars.sharedSlot_parent,\n+ &sfy_hashtable_vars.previousParent\n+ );\n+ } else {\n+ // this is the first time having parent.\n+ // no cell to remove.\n+ }\n+ // update previous parent as current parent and slotoffset\n+ memcpy(&sfy_hashtable_vars.previousParent,address,sizeof(open_addr_t));\n+ sfy_hashtable_vars.sharedSlot_parent = slotOffset;\n+ } else {\n+ // this slotoffset may be occupied by tx cell reserved to previous\n+ // parent, but the schedule house keeping will remove them. Finallly\n+ // this slot will be available. so nothing to do here.\n+ }\n+ }\n+}\n+\n+uint16_t sfy_hashtable_getSharedSlotMe(){\n+ return sfy_hashtable_vars.sharedSlot_me;\n+}\n+\n+uint16_t sfy_hashtable_getSharedSlotParent(){\n+ return sfy_hashtable_vars.sharedSlot_parent;\n+}\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "openstack/02b-MAChigh/sfy_hashtable.h", "diff": "+#ifndef __SFY_HASHTABLE_H\n+#define __SFY_HASHTABLE_H\n+\n+/**\n+\\addtogroup MAChigh\n+\\{\n+\\addtogroup sfy_hashtable\n+\\{\n+*/\n+\n+#include \"opendefs.h\"\n+\n+//=========================== define ==========================================\n+\n+//=========================== typedef =========================================\n+\n+typedef struct {\n+ uint16_t sharedSlot_me;\n+ uint16_t sharedSlot_parent;\n+ open_addr_t previousParent;\n+}sfy_hashtable_vars_t;\n+\n+//=========================== module variables ================================\n+\n+//=========================== prototypes ======================================\n+\n+// admin\n+void sfy_hashtable_init();\n+\n+bool sfy_hashtable_getCellInfo(open_addr_t* address,uint16_t* slotOffset, uint8_t* channelOffset);\n+void sfy_hashtable_updateSharedslotParent(open_addr_t* address);\n+// ==== getter\n+uint16_t sfy_hashtable_getSharedSlotMe();\n+uint16_t sfy_hashtable_getSharedSlotParent();\n+/**\n+\\}\n+\\}\n+*/\n+\n+#endif\n" }, { "change_type": "MODIFY", "old_path": "openstack/SConscript", "new_path": "openstack/SConscript", "diff": "@@ -21,6 +21,7 @@ sources_c = [\nos.path.join('02b-MAChigh','processIE.c'),\nos.path.join('02b-MAChigh','schedule.c'),\nos.path.join('02b-MAChigh','sixtop.c'),\n+ os.path.join('02b-MAChigh','sfy_hashtable.c'),\n#=== 03a-IPHC\nos.path.join('03a-IPHC','iphc.c'),\nos.path.join('03a-IPHC','openbridge.c'),\n@@ -56,6 +57,7 @@ sources_h = [\nos.path.join('02b-MAChigh','processIE.h'),\nos.path.join('02b-MAChigh','schedule.h'),\nos.path.join('02b-MAChigh','sixtop.h'),\n+ os.path.join('02b-MAChigh','sfy_hashtable.h'),\n#=== 03a-IPHC\nos.path.join('03a-IPHC','iphc.h'),\nos.path.join('03a-IPHC','openbridge.h'),\n" }, { "change_type": "MODIFY", "old_path": "openstack/openstack.c", "new_path": "openstack/openstack.c", "diff": "#include \"neighbors.h\"\n#include \"sf0.h\"\n#include \"sfx.h\"\n+#include \"sfy_hashtable.h\"\n//-- 03a-IPHC\n#include \"openbridge.h\"\n#include \"iphc.h\"\n@@ -64,6 +65,7 @@ void openstack_init(void) {\nIEEE802154_SECURITY.init();\n//-- 02b-RES\nschedule_init();\n+ sfy_hashtable_init();\nsixtop_init();\nneighbors_init();\nsf0_init();\n" }, { "change_type": "MODIFY", "old_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp", "new_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp", "diff": "<group>\n<name>headers</name>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_aes.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_aes.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ana_regs.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ana_regs.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_cctest.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_cctest.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_flash_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_flash_ctrl.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_gpio.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_gpio.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_gptimer.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_gptimer.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_i2cm.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_i2cm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_i2cs.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_i2cs.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ints.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ints.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ioc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_memmap.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_memmap.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_nvic.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_nvic.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_pka.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_pka.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_ffsm.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_sfr.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_sfr.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_rfcore_xreg.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_rfcore_xreg.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_smwdthrosc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_smwdthrosc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_soc_adc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_soc_adc.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_ssi.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_ssi.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_sys_ctrl.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_types.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_types.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_uart.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_uart.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_udma.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_udma.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\headers\\hw_udmachctl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_udmachctl.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\headers\\hw_usb.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\adc.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\adc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\adc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\aes.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\aes.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\aes.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\bl_commands.h</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ccm.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ccm.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ccm.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\cpu.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\cpu.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\cpu.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\debug.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\debug.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\debug.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ecc_curveinfo.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ecc_curveinfo.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\flash.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\flash.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\flash.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gpio.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gpio.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gpio.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gptimer.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\gptimer.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\gptimer.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\i2c_lib.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\i2c_lib.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\i2c_lib.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\interrupt.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\interrupt.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\interrupt.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ioc.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ioc.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ioc.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\pka.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\pka.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\pka.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\rom.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\rom.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sha256.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sha256.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sha256.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sleepmode.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sleepmode.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sleepmode.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ssi.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\ssi.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\ssi.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sys_ctrl.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\sys_ctrl.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\sys_ctrl.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\systick.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\systick.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\systick.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\uarthal.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\uarthal.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\uarthal.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\udma.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\udma.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\udma.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\watchdog.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\source\\watchdog.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\source\\watchdog.h</name>\n</file>\n</group>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\adc_sensor.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\adc_sensor.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\adc_sensor.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\board.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\board_info.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\board_info.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\bsp_timer.c</name>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\cc2538_crypto_engine.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\cc2538_crypto_engine.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\cc2538_crypto_engine.h</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmote-cc2538\\cc2538rf.h</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\cc2538rf.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\OpenMote-CC2538\\debugpins.c</name>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02b-MAChigh\\sfx.h</name>\n</file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openstack\\02b-MAChigh\\sfy_hashtable.c</name>\n+ </file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\openstack\\02b-MAChigh\\sfy_hashtable.h</name>\n+ </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02b-MAChigh\\sixtop.c</name>\n</file>\n" }, { "change_type": "MODIFY", "old_path": "projects/python/SConscript.env", "new_path": "projects/python/SConscript.env", "diff": "@@ -132,6 +132,7 @@ varsToChange = [\n'schedule_vars',\n'sf0_vars',\n'sfx_vars',\n+ 'sfy_hashtable_vars',\n# 03a-IPHC\n# 03b-IPv6\n'icmpv6echo_vars',\n@@ -618,6 +619,12 @@ functionsToChange = [\n'sfx_notifyNewSlotframe',\n'sfx_setBackoff',\n'sfx_cellUsageCalculation_task',\n+ # sfy_hashtable\n+ 'sfy_hashtable_init',\n+ 'sfy_hashtable_getCellInfo',\n+ 'sfy_hashtable_updateSharedslotParent',\n+ 'sfy_hashtable_getSharedSlotMe',\n+ 'sfy_hashtable_getSharedSlotParent',\n# sixtop\n'sixtop_init',\n'sixtop_setKaPeriod',\n@@ -903,6 +910,7 @@ headerFiles = [\n'sixtop',\n'sf0',\n'sfx',\n+ 'sfy_hashtable',\n# 02.5-MPLS\n# TODO\n# 03a-IPHC\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-548. create scheduling function y: hashtable.
491,602
09.02.2017 17:54:21
-3,600
798f8742b9ecc4f8262b1323c2677b2165c264a3
Making transctr variable 2bytes long
[ { "change_type": "MODIFY", "old_path": "projects/common/03oos_mercator/03oos_mercator.c", "new_path": "projects/common/03oos_mercator/03oos_mercator.c", "diff": "@@ -142,6 +142,7 @@ void serial_rx_REQ_IDLE(void) {\n}\nvoid serial_rx_REQ_TX(void) {\n+ uint16_t transctr;\nuint16_t pkctr;\nREQ_TX_ht* req;\n@@ -161,11 +162,12 @@ void serial_rx_REQ_TX(void) {\n// prepare packet\nmemcpy(mercator_vars.rfbuftx, mercator_vars.mac, 8);\n- memcpy(&mercator_vars.rfbuftx[8], &req->transctr, 1);\n+ transctr = htons(req->transctr);\n+ memcpy(&mercator_vars.rfbuftx[8], &transctr, 2);\npkctr = htons(mercator_vars.txpk_numpk);\n- memcpy(mercator_vars.rfbuftx + 9, &pkctr, 2);\n- memset(mercator_vars.rfbuftx + 11, req->txfillbyte,\n- mercator_vars.txpk_len - 11 - LENGTH_CRC);\n+ memcpy(mercator_vars.rfbuftx + 10, &pkctr, 2);\n+ memset(mercator_vars.rfbuftx + 12, req->txfillbyte,\n+ mercator_vars.txpk_len - 12 - LENGTH_CRC);\n// prepare radio\nradio_rfOn();\n@@ -193,7 +195,7 @@ void serial_rx_REQ_RX(void) {\n}\nreq = (REQ_RX_ht*)mercator_vars.uartbufrx;\n- mercator_vars.rxpk_transctr = req->transctr;\n+ mercator_vars.rxpk_transctr = htons(req->transctr);\nmercator_vars.rxpk_txfillbyte = req->txfillbyte;\nmemcpy(mercator_vars.rxpk_srcmac, req->srcmac, 8);\n@@ -397,7 +399,7 @@ void cb_startFrame(uint16_t timestamp){\nvoid cb_endFrame(uint16_t timestamp) {\n// local vars\nuint8_t srcmac[8];\n- uint8_t transctr;\n+ uint16_t transctr;\nuint16_t pkctr;\nuint8_t txfillbyte;\nbool is_expected = TRUE;\n@@ -418,9 +420,9 @@ void cb_endFrame(uint16_t timestamp) {\n);\nmemcpy(srcmac, mercator_vars.rxpk_buf , 8);\n- memcpy(&transctr, &mercator_vars.rxpk_buf[8] , 1);\n- memcpy(&pkctr, mercator_vars.rxpk_buf + 9 , 2);\n- memcpy(&txfillbyte, &mercator_vars.rxpk_buf[11], 1);\n+ memcpy(&transctr, &mercator_vars.rxpk_buf[8] , 2);\n+ memcpy(&pkctr, mercator_vars.rxpk_buf +10 , 2);\n+ memcpy(&txfillbyte, &mercator_vars.rxpk_buf[12], 1);\n// check srcmac\nif (memcmp(srcmac, mercator_vars.rxpk_srcmac, 8) != 0){\n@@ -493,6 +495,6 @@ void cb_sendPacket(opentimer_id_t id){\n// update pkctr\nmercator_vars.txpk_numpk++;\npkctr = htons(mercator_vars.txpk_numpk);\n- memcpy(mercator_vars.rfbuftx + 9, &pkctr, 2);\n+ memcpy(mercator_vars.rfbuftx + 10, &pkctr, 2);\nreturn;\n}\n" }, { "change_type": "MODIFY", "old_path": "projects/common/03oos_mercator/03oos_mercator.h", "new_path": "projects/common/03oos_mercator/03oos_mercator.h", "diff": "@@ -57,7 +57,7 @@ typedef struct {\nuint8_t type;\nuint8_t frequency;\nint8_t txpower;\n- uint8_t transctr;\n+ uint16_t transctr;\nuint16_t txnumpk;\nuint16_t txifdur;\nuint8_t txlength;\n@@ -76,7 +76,7 @@ typedef struct {\nuint8_t type;\nuint8_t frequency;\nuint8_t srcmac[8];\n- uint8_t transctr;\n+ uint16_t transctr;\nuint8_t txlength;\nuint8_t txfillbyte;\n} REQ_RX_ht;\n@@ -148,8 +148,7 @@ typedef struct {\nbool rxpk_crc;\nuint8_t rxpk_txfillbyte;\nuint8_t rxpk_srcmac[8];\n- uint8_t rxpk_transctr;\n-\n+ uint16_t rxpk_transctr;\n} mercator_vars_t;\nmercator_vars_t mercator_vars;\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
Making transctr variable 2bytes long
491,602
10.02.2017 13:37:17
-3,600
80a43ae6d9397ed90e40f9e034476608f08aa108
[Mercator] Removing magic values
[ { "change_type": "MODIFY", "old_path": "projects/common/03oos_mercator/03oos_mercator.c", "new_path": "projects/common/03oos_mercator/03oos_mercator.c", "diff": "*/\n#include \"03oos_mercator.h\"\n+#include <stddef.h>\n//=========================== initialization ==================================\n@@ -119,7 +120,7 @@ void serial_tx_RESP_ST(void) {\nresp->status = mercator_vars.status;\nresp->numnotifications = htons(mercator_vars.numnotifications);\n- memcpy(resp->mac, mercator_vars.mac, 8);\n+ memcpy(resp->mac, mercator_vars.mac, MAC_LEN);\nmercator_vars.uartbuftxfill = sizeof(RESP_ST_ht);\n@@ -161,13 +162,19 @@ void serial_rx_REQ_TX(void) {\nmercator_vars.txpk_totalnumpk = htons(req->txnumpk);\n// prepare packet\n- memcpy(mercator_vars.rfbuftx, mercator_vars.mac, 8);\n+ memcpy(mercator_vars.rfbuftx, mercator_vars.mac, MAC_LEN);\ntransctr = htons(req->transctr);\n- memcpy(&mercator_vars.rfbuftx[8], &transctr, 2);\n+ memcpy(&mercator_vars.rfbuftx[offsetof(RF_PACKET_ht, transctr)],\n+ &transctr,\n+ sizeof(((REQ_TX_ht){0}).transctr)\n+ );\npkctr = htons(mercator_vars.txpk_numpk);\n- memcpy(mercator_vars.rfbuftx + 10, &pkctr, 2);\n- memset(mercator_vars.rfbuftx + 12, req->txfillbyte,\n- mercator_vars.txpk_len - 12 - LENGTH_CRC);\n+ memcpy(&mercator_vars.rfbuftx[offsetof(RF_PACKET_ht, pkctr)],\n+ &pkctr, sizeof(((mercator_vars_t){0}).txpk_numpk));\n+\n+ // fill remaining packet space\n+ memset(&mercator_vars.rfbuftx[offsetof(RF_PACKET_ht, txfillbyte)], req->txfillbyte,\n+ mercator_vars.txpk_len - offsetof(RF_PACKET_ht, txfillbyte) - LENGTH_CRC);\n// prepare radio\nradio_rfOn();\n@@ -398,10 +405,7 @@ void cb_startFrame(uint16_t timestamp){\nvoid cb_endFrame(uint16_t timestamp) {\n// local vars\n- uint8_t srcmac[8];\n- uint16_t transctr;\n- uint16_t pkctr;\n- uint8_t txfillbyte;\n+ RF_PACKET_ht* rx_temp;\nbool is_expected = TRUE;\nIND_RX_ht* resp;\n@@ -419,23 +423,21 @@ void cb_endFrame(uint16_t timestamp) {\n&mercator_vars.rxpk_crc\n);\n- memcpy(srcmac, mercator_vars.rxpk_buf , 8);\n- memcpy(&transctr, &mercator_vars.rxpk_buf[8] , 2);\n- memcpy(&pkctr, mercator_vars.rxpk_buf +10 , 2);\n- memcpy(&txfillbyte, &mercator_vars.rxpk_buf[12], 1);\n+ // unpack rx buffer\n+ rx_temp = (RF_PACKET_ht *)mercator_vars.rxpk_buf;\n// check srcmac\n- if (memcmp(srcmac, mercator_vars.rxpk_srcmac, 8) != 0){\n+ if (memcmp(rx_temp->srcmac, mercator_vars.rxpk_srcmac, MAC_LEN) != 0){\nis_expected = FALSE;\n}\n// check transctr\n- if (transctr != mercator_vars.rxpk_transctr){\n+ if (rx_temp->transctr != mercator_vars.rxpk_transctr){\nis_expected = FALSE;\n}\n// check txfillbyte\n- if (txfillbyte != mercator_vars.rxpk_txfillbyte){\n+ if (rx_temp->txfillbyte != mercator_vars.rxpk_txfillbyte){\nis_expected = FALSE;\n}\n@@ -446,7 +448,7 @@ void cb_endFrame(uint16_t timestamp) {\nresp->length = mercator_vars.rxpk_len;\nresp->rssi = mercator_vars.rxpk_rssi;\nresp->flags = mercator_vars.rxpk_crc << 7 | is_expected << 6;\n- resp->pkctr = pkctr;\n+ resp->pkctr = rx_temp->pkctr;\nmercator_vars.uartbuftxfill = sizeof(IND_RX_ht);\n@@ -463,6 +465,8 @@ void cb_endFrame(uint16_t timestamp) {\nvoid cb_sendPacket(opentimer_id_t id){\nIND_TXDONE_ht* resp;\nuint16_t pkctr;\n+ uint8_t pkctr_offset = 10; // srcmac[8] + transctr[2]\n+\n// send packet\nleds_error_on();\n@@ -495,6 +499,6 @@ void cb_sendPacket(opentimer_id_t id){\n// update pkctr\nmercator_vars.txpk_numpk++;\npkctr = htons(mercator_vars.txpk_numpk);\n- memcpy(mercator_vars.rfbuftx + 10, &pkctr, 2);\n+ memcpy(mercator_vars.rfbuftx + pkctr_offset, &pkctr, sizeof(pkctr));\nreturn;\n}\n" }, { "change_type": "MODIFY", "old_path": "projects/common/03oos_mercator/03oos_mercator.h", "new_path": "projects/common/03oos_mercator/03oos_mercator.h", "diff": "#define UART_BUF_LEN 30\n#define RF_BUF_LEN 125+LENGTH_CRC // maximum length is 127 bytes\n+#define MAC_LEN 8\n#define TASK_PRIO_SERIAL TASKPRIO_MAX\n#define TASK_PRIO_WIRELESS TASKPRIO_SIXTOP_TIMEOUT\n@@ -42,7 +43,7 @@ typedef struct {\nuint8_t type;\nuint8_t status;\nuint16_t numnotifications;\n- uint8_t mac[8];\n+ uint8_t mac[MAC_LEN];\n} RESP_ST_ht;\nEND_PACK\n@@ -75,7 +76,7 @@ BEGIN_PACK\ntypedef struct {\nuint8_t type;\nuint8_t frequency;\n- uint8_t srcmac[8];\n+ uint8_t srcmac[MAC_LEN];\nuint16_t transctr;\nuint8_t txlength;\nuint8_t txfillbyte;\n@@ -98,6 +99,16 @@ typedef struct {\n} IND_UP_ht;\nEND_PACK\n+BEGIN_PACK\n+typedef struct {\n+ uint8_t srcmac[MAC_LEN];\n+ uint16_t transctr;\n+ uint16_t pkctr;\n+ uint8_t txfillbyte;\n+ uint8_t padding[RF_BUF_LEN-sizeof(uint8_t)-2*sizeof(uint16_t)];\n+} RF_PACKET_ht;\n+END_PACK\n+\n//=========================== variables =======================================\ntypedef struct {\n@@ -138,7 +149,7 @@ typedef struct {\nuint16_t txpk_numpk;\nuint8_t txpk_len;\nuint16_t txpk_totalnumpk;\n- uint8_t mac[8];\n+ uint8_t mac[MAC_LEN];\n// rx\nuint8_t rxpk_buf[RF_BUF_LEN];\nuint8_t rxpk_len;\n@@ -147,7 +158,7 @@ typedef struct {\nuint8_t rxpk_lqi;\nbool rxpk_crc;\nuint8_t rxpk_txfillbyte;\n- uint8_t rxpk_srcmac[8];\n+ uint8_t rxpk_srcmac[MAC_LEN];\nuint16_t rxpk_transctr;\n} mercator_vars_t;\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
[Mercator] Removing magic values
491,595
23.02.2017 15:09:00
-3,600
06f3ede76f7fc41b3ffeac611a01cfdd7985783c
recover remove old neighbor feature. (disabled during updating new removing policy: only keep 3 lowest rank neighbor.)
[ { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/neighbors.c", "new_path": "openstack/02b-MAChigh/neighbors.c", "diff": "@@ -417,6 +417,25 @@ void neighbors_removeOld() {\nbool haveParent;\nuint8_t neighborIndexWithLowestRank[3];\ndagrank_t lowestRank;\n+ PORT_RADIOTIMER_WIDTH timeSinceHeard;\n+\n+ // remove old neighbor\n+ for (i=0;i<MAXNUMNEIGHBORS;i++) {\n+ if (neighbors_vars.neighbors[i].used==1) {\n+ timeSinceHeard = ieee154e_asnDiff(&neighbors_vars.neighbors[i].asn);\n+ if (timeSinceHeard>DESYNCTIMEOUT) {\n+ haveParent = icmpv6rpl_getPreferredParentIndex(&j);\n+ if (haveParent && (i==j)) { // this is our preferred parent, carefully!\n+ icmpv6rpl_killPreferredParent();\n+ removeNeighbor(i);\n+ icmpv6rpl_updateMyDAGrankAndParentSelection();\n+ } else {\n+ removeNeighbor(i);\n+ }\n+ }\n+ }\n+ }\n+\n// neighbors marked as NO_RES will never removed.\n// first round\n@@ -488,7 +507,7 @@ void neighbors_removeOld() {\ni!= neighborIndexWithLowestRank[2]\n) {\nhaveParent = icmpv6rpl_getPreferredParentIndex(&j);\n- if (haveParent && (i==j)) { // this is our preferred parent, carefull!\n+ if (haveParent && (i==j)) { // this is our preferred parent, carefully!\nicmpv6rpl_killPreferredParent();\nicmpv6rpl_updateMyDAGrankAndParentSelection();\n}\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-214. recover remove old neighbor feature. (disabled during updating new removing policy: only keep 3 lowest rank neighbor.)
491,595
07.03.2017 17:48:45
-3,600
92c75df0d5bb0d9be490f3c09c8e855828add47f
Fixed: Time correction is not standard compliant.
[ { "change_type": "MODIFY", "old_path": "inc/opendefs.h", "new_path": "inc/opendefs.h", "diff": "@@ -313,6 +313,7 @@ typedef struct {\nbool l2_IEListPresent; // did have IE field?\nbool l2_payloadIEpresent; // did I have payload IE field\nbool l2_joinPriorityPresent;\n+ bool l2_isNegativeACK; // is the negative ACK?\nint16_t l2_timeCorrection; // record the timeCorrection and print out at endOfslot\n//layer-2 security\nuint8_t l2_securityLevel; // the security level specified for the current frame\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154.c", "new_path": "openstack/02a-MAClow/IEEE802154.c", "diff": "@@ -37,6 +37,7 @@ void ieee802154_prependHeader(OpenQueueEntry_t* msg,\nuint8_t ielistpresent = IEEE154_IELIST_NO;\nbool securityEnabled;\nint16_t timeCorrection;\n+ uint16_t timeSyncInfo;\nheader_IE_ht header_desc;\nbool headerIEPresent = FALSE;\nuint8_t destAddrMode;\n@@ -85,8 +86,12 @@ void ieee802154_prependHeader(OpenQueueEntry_t* msg,\n// add the payload to the ACK (i.e. the timeCorrection)\npacketfunctions_reserveHeaderSize(msg,sizeof(timecorrection_IE_ht));\ntimeCorrection *= US_PER_TICK;\n- msg->payload[0] = (uint8_t)((((uint16_t)timeCorrection) ) & 0xff);\n- msg->payload[1] = (uint8_t)((((uint16_t)timeCorrection)>>8) & 0xff);\n+ timeSyncInfo = ((uint16_t)timeCorrection) & 0x0fff;\n+ if (msg->l2_isNegativeACK){\n+ timeSyncInfo |= 0x8000;\n+ }\n+ msg->payload[0] = (uint8_t)(((timeSyncInfo) ) & 0xff);\n+ msg->payload[1] = (uint8_t)(((timeSyncInfo)>>8) & 0xff);\n// add header IE header -- xv poipoi -- pkt is filled in reverse order..\npacketfunctions_reserveHeaderSize(msg,sizeof(header_IE_ht));\n@@ -198,6 +203,7 @@ void ieee802154_retrieveHeader(OpenQueueEntry_t* msg,\nuint8_t byte0;\nuint8_t byte1;\nint16_t timeCorrection;\n+ uint16_t timeSyncInfo;\n// by default, let's assume the header is not valid, in case we leave this\n// function because the packet ends up being shorter than the header.\nieee802514_header->valid=FALSE;\n@@ -362,9 +368,20 @@ void ieee802154_retrieveHeader(OpenQueueEntry_t* msg,\n// timecorrection IE\nbyte0 = *((uint8_t*)(msg->payload)+ieee802514_header->headerLength);\nbyte1 = *((uint8_t*)(msg->payload)+ieee802514_header->headerLength+1);\n-\n- timeCorrection = (int16_t)((uint16_t)byte1<<8 | (uint16_t)byte0);\n- timeCorrection = (timeCorrection / (PORT_SIGNED_INT_WIDTH)US_PER_TICK);\n+ timeSyncInfo = (uint16_t)byte1<<8 | (uint16_t)byte0;\n+ // negative ACK or not\n+ if (timeSyncInfo & 0x8000){\n+ msg->l2_isNegativeACK = TRUE;\n+ } else {\n+ msg->l2_isNegativeACK = FALSE;\n+ }\n+ // negative timeCorrection or not, cast from 12 to 16 bit signed integer\n+ if (timeSyncInfo & 0x0800){\n+ timeCorrection = timeSyncInfo | 0xf000;\n+ } else {\n+ timeCorrection = timeSyncInfo & 0x0fff;\n+ }\n+ timeCorrection = ((int16_t)timeCorrection / (PORT_SIGNED_INT_WIDTH)US_PER_TICK);\nieee802514_header->timeCorrection = timeCorrection;\nieee802514_header->headerLength += len;\n" }, { "change_type": "MODIFY", "old_path": "openstack/cross-layers/openqueue.c", "new_path": "openstack/cross-layers/openqueue.c", "diff": "@@ -304,6 +304,7 @@ void openqueue_reset_entry(OpenQueueEntry_t* entry) {\nentry->l2_frameType = IEEE154_TYPE_UNDEFINED;\nentry->l2_retriesLeft = 0;\nentry->l2_IEListPresent = 0;\n+ entry->l2_isNegativeACK = 0;\nentry->l2_payloadIEpresent = 0;\n//l2-security\nentry->l2_securityLevel = 0;\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-628. Fixed: Time correction is not standard compliant.
491,599
22.03.2017 16:02:22
-32,400
b7a237ced106c4a891c49e5eab32a43e8e696e4f
correct comments that has some typos
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -761,7 +761,7 @@ port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) {\ncase IEEE802154E_MLME_TIMESLOT_IE_SUBID:\nif (idmanager_getIsDAGroot()==FALSE) {\n- // timelsot template ID\n+ // timeslot template ID\ntimeslotTemplateIDStoreFromEB(*((uint8_t*)(pkt->payload)+ptr));\nptr = ptr + 1;\nif (ieee154e_vars.tsTemplateId != TIMESLOT_TEMPLATE_ID){\n@@ -775,7 +775,7 @@ port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) {\ncase IEEE802154E_MLME_CHANNELHOPPING_IE_SUBID:\nif (idmanager_getIsDAGroot()==FALSE) {\n- // timelsot template ID\n+ // channelhopping template ID\nchannelhoppingTemplateIDStoreFromEB(*((uint8_t*)(pkt->payload)+ptr));\nptr = ptr + 1;\n}\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/processIE.c", "new_path": "openstack/02b-MAChigh/processIE.c", "diff": "@@ -230,7 +230,7 @@ port_INLINE uint8_t processIE_prependChannelHoppingIE(OpenQueueEntry_t* pkt){\nlen = 0;\n- // reserve space for timeslot template ID\n+ // reserve space for channelhopping template ID\npacketfunctions_reserveHeaderSize(pkt,sizeof(uint8_t));\n// write header\n*((uint8_t*)(pkt->payload)) = CHANNELHOPPING_TEMPLATE_ID;\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
correct comments that has some typos
491,595
06.04.2017 10:16:42
-7,200
914dd2c3a0319f80c37cb04301333d70df517579
organizing IE processing for EB.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/radiotimer.c", "new_path": "bsp/boards/openmote-cc2538/radiotimer.c", "diff": "@@ -191,14 +191,14 @@ void radiotimer_cancel() {\n//===== capture\nport_INLINE PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime() {\n- volatile PORT_RADIOTIMER_WIDTH value=0;\n+ PORT_RADIOTIMER_WIDTH value=0;\n//select period register in the selector so it can be read\nHWREG(RFCORE_SFR_MTMSEL) = (0x00 << RFCORE_SFR_MTMSEL_MTMOVFSEL_S) & RFCORE_SFR_MTMSEL_MTMOVFSEL_M;\n// compute value by adding m0 and m1 registers\nvalue = HWREG(RFCORE_SFR_MTMOVF0);\n- value+=(HWREG(RFCORE_SFR_MTMOVF1)<<8);\n- value+=(HWREG(RFCORE_SFR_MTMOVF2)<<16);\n+ value = value + (HWREG(RFCORE_SFR_MTMOVF1)<<8);\n+ value = value + (HWREG(RFCORE_SFR_MTMOVF2)<<16);\nreturn value;\n}\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -66,19 +66,9 @@ bool isValidRxFrame(ieee802154_header_iht* ieee802514_header);\nbool isValidAck(ieee802154_header_iht* ieee802514_header,\nOpenQueueEntry_t* packetSent);\nbool isValidJoin(OpenQueueEntry_t* eb, ieee802154_header_iht *parsedHeader);\n-// IEs Handling\n-bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE);\n// ASN handling\nvoid incrementAsnOffset(void);\nvoid ieee154e_resetAsn(void);\n-void ieee154e_syncSlotOffset(void);\n-void asnStoreFromEB(uint8_t* asn);\n-void joinPriorityStoreFromEB(uint8_t jp);\n-\n-// timeslot template handling\n-void timeslotTemplateIDStoreFromEB(uint8_t id);\n-// channelhopping template handling\n-void channelhoppingTemplateIDStoreFromEB(uint8_t id);\n// synchronization\nvoid synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived);\nvoid synchronizeAck(PORT_SIGNED_INT_WIDTH timeCorrection);\n@@ -617,7 +607,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_RADIOTIMER_WIDTH capturedT\nieee802514_header.ieListPresent==TRUE &&\nieee802514_header.frameType==IEEE154_TYPE_BEACON &&\npacketfunctions_sameAddress(&ieee802514_header.panid,idmanager_getMyID(ADDR_PANID)) &&\n- ieee154e_processIEs(ieee154e_vars.dataReceived,&lenIE)\n+ processIE_EB_IE(ieee154e_vars.dataReceived,&lenIE)\n)==FALSE) {\n// break from the do-while loop and execute the clean-up code below\nbreak;\n@@ -667,162 +657,6 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_RADIOTIMER_WIDTH capturedT\nchangeState(S_SYNCLISTEN);\n}\n-port_INLINE bool ieee154e_processIEs(OpenQueueEntry_t* pkt, uint16_t* lenIE) {\n- uint8_t ptr;\n- uint8_t temp_8b;\n- uint8_t gr_elem_id;\n- uint8_t subid;\n- uint16_t temp_16b;\n- uint16_t len;\n- uint16_t sublen;\n- // flag used for understanding if the slotoffset should be inferred from both ASN and slotframe length\n- bool f_asn2slotoffset;\n- uint8_t i; // used for find the index in channel hopping template\n-\n- ptr=0;\n-\n- // payload IE header, header IE is processed before when retrieve header\n-\n- //candidate IE header if type ==0 header IE if type==1 payload IE\n- temp_8b = *((uint8_t*)(pkt->payload)+ptr);\n- ptr++;\n-\n- temp_16b = temp_8b + ((*((uint8_t*)(pkt->payload)+ptr)) << 8);\n- ptr++;\n-\n- *lenIE = ptr;\n-\n- if ((temp_16b & IEEE802154E_DESC_TYPE_PAYLOAD_IE) == IEEE802154E_DESC_TYPE_PAYLOAD_IE){\n- // payload IE\n-\n- len = temp_16b & IEEE802154E_DESC_LEN_PAYLOAD_IE_MASK;\n- gr_elem_id = (temp_16b & IEEE802154E_DESC_GROUPID_PAYLOAD_IE_MASK)>>IEEE802154E_DESC_GROUPID_PAYLOAD_IE_SHIFT;\n- } else {\n- // header IE\n-\n- len = temp_16b & IEEE802154E_DESC_LEN_HEADER_IE_MASK;\n- gr_elem_id = (temp_16b & IEEE802154E_DESC_ELEMENTID_HEADER_IE_MASK)>>IEEE802154E_DESC_ELEMENTID_HEADER_IE_SHIFT;\n- }\n-\n- *lenIE += len;\n-\n- //===== sub-elements\n-\n- switch(gr_elem_id){\n-\n- case IEEE802154E_MLME_IE_GROUPID:\n- // MLME IE\n- f_asn2slotoffset = FALSE;\n- do {\n-\n- //read sub IE header\n- temp_8b = *((uint8_t*)(pkt->payload)+ptr);\n- ptr = ptr + 1;\n- temp_16b = temp_8b + ((*((uint8_t*)(pkt->payload)+ptr))<<8);\n- ptr = ptr + 1;\n-\n- len = len - 2; //remove header fields len\n-\n- if ((temp_16b & IEEE802154E_DESC_TYPE_LONG) == IEEE802154E_DESC_TYPE_LONG){\n- // long sub-IE\n-\n- sublen = temp_16b & IEEE802154E_DESC_LEN_LONG_MLME_IE_MASK;\n- subid = (temp_16b & IEEE802154E_DESC_SUBID_LONG_MLME_IE_MASK)>>IEEE802154E_DESC_SUBID_LONG_MLME_IE_SHIFT;\n- } else {\n- // short sub-IE\n-\n- sublen = temp_16b & IEEE802154E_DESC_LEN_SHORT_MLME_IE_MASK;\n- subid = (temp_16b & IEEE802154E_DESC_SUBID_SHORT_MLME_IE_MASK)>>IEEE802154E_DESC_SUBID_SHORT_MLME_IE_SHIFT;\n- }\n-\n- switch(subid){\n-\n- case IEEE802154E_MLME_SYNC_IE_SUBID:\n- // Sync IE: ASN and Join Priority\n-\n- if (idmanager_getIsDAGroot()==FALSE) {\n- // ASN\n- asnStoreFromEB((uint8_t*)(pkt->payload)+ptr);\n- // ASN is known, but the frame length is not\n- // frame length will be known after parsing the frame and link IE\n- f_asn2slotoffset = TRUE;\n- ptr = ptr + 5;\n- // join priority\n- joinPriorityStoreFromEB(*((uint8_t*)(pkt->payload)+ptr));\n- ptr = ptr + 1;\n- }\n- break;\n-\n- case IEEE802154E_MLME_SLOTFRAME_LINK_IE_SUBID:\n- if ((idmanager_getIsDAGroot()==FALSE) && (ieee154e_isSynch()==FALSE)) {\n- processIE_retrieveSlotframeLinkIE(pkt,&ptr);\n- }\n- break;\n-\n- case IEEE802154E_MLME_TIMESLOT_IE_SUBID:\n- if (idmanager_getIsDAGroot()==FALSE) {\n- // timeslot template ID\n- timeslotTemplateIDStoreFromEB(*((uint8_t*)(pkt->payload)+ptr));\n- ptr = ptr + 1;\n- if (ieee154e_vars.tsTemplateId != TIMESLOT_TEMPLATE_ID){\n- ieee154e_vars.slotDuration = *((uint8_t*)(pkt->payload)+ptr);\n- ptr = ptr + 1;\n- ieee154e_vars.slotDuration |= ((*((uint8_t*)(pkt->payload)+ptr))<<8) & 0xff00;\n- ptr = ptr + 1;\n- }\n- }\n- break;\n-\n- case IEEE802154E_MLME_CHANNELHOPPING_IE_SUBID:\n- if (idmanager_getIsDAGroot()==FALSE) {\n- // channelhopping template ID\n- channelhoppingTemplateIDStoreFromEB(*((uint8_t*)(pkt->payload)+ptr));\n- ptr = ptr + 1;\n- }\n- break;\n- default:\n- return FALSE;\n- break;\n- }\n-\n- len = len - sublen;\n- } while(len>0);\n- if (f_asn2slotoffset == TRUE) {\n- // at this point, ASN and frame length are known\n- // the current slotoffset can be inferred\n- ieee154e_syncSlotOffset();\n- schedule_syncSlotOffset(ieee154e_vars.slotOffset);\n- ieee154e_vars.nextActiveSlotOffset = schedule_getNextActiveSlotOffset();\n- /*\n- infer the asnOffset based on the fact that\n- ieee154e_vars.freq = 11 + (asnOffset + channelOffset)%16\n- */\n- for (i=0;i<16;i++){\n- if ((ieee154e_vars.freq - 11)==ieee154e_vars.chTemplate[i]){\n- break;\n- }\n- }\n- ieee154e_vars.asnOffset = i - schedule_getChannelOffset();\n- }\n- break;\n-\n- default:\n- *lenIE = 0; //no header or not recognized.\n- return FALSE;\n- }\n-\n- if(*lenIE>127) {\n- // log the error\n- openserial_printError(\n- COMPONENT_IEEE802154E,\n- ERR_HEADER_TOO_LONG,\n- (errorparameter_t)*lenIE,\n- (errorparameter_t)1\n- );\n- }\n- return TRUE;\n-}\n-\n//======= TX\nport_INLINE void activity_ti1ORri1() {\n@@ -1666,7 +1500,7 @@ port_INLINE void activity_ri5(PORT_RADIOTIMER_WIDTH capturedTime) {\nieee802514_header.ieListPresent==TRUE &&\nieee802514_header.frameType==IEEE154_TYPE_BEACON && // if it is not a beacon and have ie, the ie will be processed in sixtop\npacketfunctions_sameAddress(&ieee802514_header.panid,idmanager_getMyID(ADDR_PANID)) &&\n- ieee154e_processIEs(ieee154e_vars.dataReceived,&lenIE))==FALSE) {\n+ processIE_EB_IE(ieee154e_vars.dataReceived,&lenIE))==FALSE) {\n//log that the packet is not carrying IEs\n}\n@@ -2073,7 +1907,7 @@ port_INLINE uint16_t ieee154e_getTimeCorrection() {\nreturn returnVal;\n}\n-port_INLINE void joinPriorityStoreFromEB(uint8_t jp){\n+port_INLINE void ieee154e_joinPriorityStoreFromEB(uint8_t jp){\nieee154e_vars.dataReceived->l2_joinPriority = jp;\nieee154e_vars.dataReceived->l2_joinPriorityPresent = TRUE;\n}\n@@ -2096,7 +1930,7 @@ bool isValidJoin(OpenQueueEntry_t* eb, ieee802154_header_iht *parsedHeader) {\nparsedHeader->ieListPresent==TRUE &&\nparsedHeader->frameType==IEEE154_TYPE_BEACON &&\npacketfunctions_sameAddress(&parsedHeader->panid,idmanager_getMyID(ADDR_PANID)) &&\n- ieee154e_processIEs(eb,&lenIE)\n+ processIE_EB_IE(eb,&lenIE)\n)==FALSE) {\nreturn FALSE;\n}\n@@ -2113,7 +1947,7 @@ bool isValidJoin(OpenQueueEntry_t* eb, ieee802154_header_iht *parsedHeader) {\nreturn FALSE;\n}\n-port_INLINE void asnStoreFromEB(uint8_t* asn) {\n+port_INLINE void ieee154e_asnStoreFromEB(uint8_t* asn) {\n// store the ASN\nieee154e_vars.asn.bytes0and1 = asn[0]+\n@@ -2126,6 +1960,7 @@ port_INLINE void asnStoreFromEB(uint8_t* asn) {\nport_INLINE void ieee154e_syncSlotOffset() {\nframeLength_t frameLength;\nuint32_t slotOffset;\n+ uint8_t i;\nframeLength = schedule_getFrameLength();\n@@ -2140,6 +1975,19 @@ port_INLINE void ieee154e_syncSlotOffset() {\nslotOffset = slotOffset % frameLength;\nieee154e_vars.slotOffset = (slotOffset_t) slotOffset;\n+\n+ schedule_syncSlotOffset(ieee154e_vars.slotOffset);\n+ ieee154e_vars.nextActiveSlotOffset = schedule_getNextActiveSlotOffset();\n+ /*\n+ infer the asnOffset based on the fact that\n+ ieee154e_vars.freq = 11 + (asnOffset + channelOffset)%16\n+ */\n+ for (i=0;i<16;i++){\n+ if ((ieee154e_vars.freq - 11)==ieee154e_vars.chTemplate[i]){\n+ break;\n+ }\n+ }\n+ ieee154e_vars.asnOffset = i - schedule_getChannelOffset();\n}\nvoid ieee154e_setIsAckEnabled(bool isEnabled){\n@@ -2171,12 +2019,19 @@ uint16_t ieee154e_getSlotDuration(){\n}\n// timeslot template handling\n-port_INLINE void timeslotTemplateIDStoreFromEB(uint8_t id){\n- ieee154e_vars.tsTemplateId = id;\n+port_INLINE void ieee154e_timeslotTemplateIDStoreFromEB(uint8_t* pkt,uint8_t* ptr){\n+ ieee154e_vars.tsTemplateId = *pkt;\n+ *ptr = *ptr+1;\n+ if (ieee154e_vars.tsTemplateId != TIMESLOT_TEMPLATE_ID){\n+ ieee154e_vars.slotDuration = (uint16_t)(*((pkt)+*ptr));\n+ *ptr = *ptr+1;\n+ ieee154e_vars.slotDuration |= (uint16_t)(((*((pkt)+*ptr))<<8) & 0xff00);\n+ *ptr = *ptr+1;\n+ }\n}\n// channelhopping template handling\n-port_INLINE void channelhoppingTemplateIDStoreFromEB(uint8_t id){\n+port_INLINE void ieee154e_channelhoppingTemplateIDStoreFromEB(uint8_t id){\nieee154e_vars.chTemplateId = id;\n}\n//======= synchronization\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.h", "new_path": "openstack/02a-MAClow/IEEE802154E.h", "diff": "@@ -286,8 +286,17 @@ void ieee154e_setSingleChannel(uint8_t channel);\nvoid ieee154e_setIsSecurityEnabled(bool isEnabled);\nvoid ieee154e_setSlotDuration(uint16_t duration);\nuint16_t ieee154e_getSlotDuration(void);\n+void ieee154e_syncSlotOffset(void);\nuint16_t ieee154e_getTimeCorrection(void);\n+\n+void ieee154e_asnStoreFromEB(uint8_t* asn);\n+void ieee154e_joinPriorityStoreFromEB(uint8_t jp);\n+\n+// timeslot template handling\n+void ieee154e_timeslotTemplateIDStoreFromEB(uint8_t* pkt,uint8_t* ptr);\n+// channelhopping template handling\n+void ieee154e_channelhoppingTemplateIDStoreFromEB(uint8_t id);\n// events\nvoid ieee154e_startOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);\nvoid ieee154e_endOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/processIE.c", "new_path": "openstack/02b-MAChigh/processIE.c", "diff": "@@ -455,3 +455,139 @@ port_INLINE void processIE_retrieve_sixCelllist(\ni++;\n}\n}\n+\n+port_INLINE bool processIE_EB_IE(OpenQueueEntry_t* pkt, uint16_t* lenIE) {\n+ uint8_t ptr;\n+ uint8_t temp_8b;\n+ uint8_t gr_elem_id;\n+ uint8_t subid;\n+ uint16_t temp_16b;\n+ uint16_t len;\n+ uint16_t sublen;\n+ // flag used for understanding if the slotoffset should be inferred from both ASN and slotframe length\n+ bool f_asn2slotoffset;\n+\n+ ptr=0;\n+\n+ // payload IE header, header IE is processed before when retrieve header\n+\n+ //candidate IE header if type ==0 header IE if type==1 payload IE\n+ temp_8b = *((uint8_t*)(pkt->payload)+ptr);\n+ ptr++;\n+\n+ temp_16b = temp_8b + ((*((uint8_t*)(pkt->payload)+ptr)) << 8);\n+ ptr++;\n+\n+ *lenIE = ptr;\n+\n+ if ((temp_16b & IEEE802154E_DESC_TYPE_PAYLOAD_IE) == IEEE802154E_DESC_TYPE_PAYLOAD_IE){\n+ // payload IE\n+\n+ len = temp_16b & IEEE802154E_DESC_LEN_PAYLOAD_IE_MASK;\n+ gr_elem_id = (temp_16b & IEEE802154E_DESC_GROUPID_PAYLOAD_IE_MASK)>>IEEE802154E_DESC_GROUPID_PAYLOAD_IE_SHIFT;\n+ } else {\n+ // header IE\n+\n+ len = temp_16b & IEEE802154E_DESC_LEN_HEADER_IE_MASK;\n+ gr_elem_id = (temp_16b & IEEE802154E_DESC_ELEMENTID_HEADER_IE_MASK)>>IEEE802154E_DESC_ELEMENTID_HEADER_IE_SHIFT;\n+ }\n+\n+ *lenIE += len;\n+\n+ //===== sub-elements\n+\n+ switch(gr_elem_id){\n+\n+ case IEEE802154E_MLME_IE_GROUPID:\n+ // MLME IE\n+ f_asn2slotoffset = FALSE;\n+ do {\n+\n+ //read sub IE header\n+ temp_8b = *((uint8_t*)(pkt->payload)+ptr);\n+ ptr = ptr + 1;\n+ temp_16b = temp_8b + ((*((uint8_t*)(pkt->payload)+ptr))<<8);\n+ ptr = ptr + 1;\n+\n+ len = len - 2; //remove header fields len\n+\n+ if ((temp_16b & IEEE802154E_DESC_TYPE_LONG) == IEEE802154E_DESC_TYPE_LONG){\n+ // long sub-IE\n+\n+ sublen = temp_16b & IEEE802154E_DESC_LEN_LONG_MLME_IE_MASK;\n+ subid = (temp_16b & IEEE802154E_DESC_SUBID_LONG_MLME_IE_MASK)>>IEEE802154E_DESC_SUBID_LONG_MLME_IE_SHIFT;\n+ } else {\n+ // short sub-IE\n+\n+ sublen = temp_16b & IEEE802154E_DESC_LEN_SHORT_MLME_IE_MASK;\n+ subid = (temp_16b & IEEE802154E_DESC_SUBID_SHORT_MLME_IE_MASK)>>IEEE802154E_DESC_SUBID_SHORT_MLME_IE_SHIFT;\n+ }\n+\n+ switch(subid){\n+\n+ case IEEE802154E_MLME_SYNC_IE_SUBID:\n+ // Sync IE: ASN and Join Priority\n+\n+ if (idmanager_getIsDAGroot()==FALSE) {\n+ // ASN\n+ ieee154e_asnStoreFromEB((uint8_t*)(pkt->payload)+ptr);\n+ // ASN is known, but the frame length is not\n+ // frame length will be known after parsing the frame and link IE\n+ f_asn2slotoffset = TRUE;\n+ ptr = ptr + 5;\n+ // join priority\n+ ieee154e_joinPriorityStoreFromEB(*((uint8_t*)(pkt->payload)+ptr));\n+ ptr = ptr + 1;\n+ }\n+ break;\n+\n+ case IEEE802154E_MLME_SLOTFRAME_LINK_IE_SUBID:\n+ if ((idmanager_getIsDAGroot()==FALSE) && (ieee154e_isSynch()==FALSE)) {\n+ processIE_retrieveSlotframeLinkIE(pkt,&ptr);\n+ }\n+ break;\n+\n+ case IEEE802154E_MLME_TIMESLOT_IE_SUBID:\n+ if (idmanager_getIsDAGroot()==FALSE) {\n+ // timeslot template ID\n+ ieee154e_timeslotTemplateIDStoreFromEB((uint8_t*)(pkt->payload),&ptr);\n+ }\n+ break;\n+\n+ case IEEE802154E_MLME_CHANNELHOPPING_IE_SUBID:\n+ if (idmanager_getIsDAGroot()==FALSE) {\n+ // channelhopping template ID\n+ ieee154e_channelhoppingTemplateIDStoreFromEB(*((uint8_t*)(pkt->payload)+ptr));\n+ ptr = ptr + 1;\n+ }\n+ break;\n+ default:\n+ return FALSE;\n+ break;\n+ }\n+\n+ len = len - sublen;\n+ } while(len>0);\n+ if (f_asn2slotoffset == TRUE) {\n+ // at this point, ASN and frame length are known\n+ // the current slotoffset can be inferred\n+ ieee154e_syncSlotOffset();\n+ }\n+ break;\n+\n+ default:\n+ *lenIE = 0; //no header or not recognized.\n+ return FALSE;\n+ }\n+\n+ if(*lenIE>127) {\n+ // log the error\n+ openserial_printError(\n+ COMPONENT_IEEE802154E,\n+ ERR_HEADER_TOO_LONG,\n+ (errorparameter_t)*lenIE,\n+ (errorparameter_t)1\n+ );\n+ }\n+ return TRUE;\n+}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/processIE.h", "new_path": "openstack/02b-MAChigh/processIE.h", "diff": "#define __PROCESSIE_H\n#include \"opendefs.h\"\n+#include \"openqueue.h\"\n//=========================== define ==========================================\n@@ -185,4 +186,6 @@ void processIE_retrieve_sixCelllist(\ncellInfo_ht* cellList\n);\n+bool processIE_EB_IE(OpenQueueEntry_t* pkt, uint16_t* lenIE);\n+\n#endif\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/schedule.c", "new_path": "openstack/02b-MAChigh/schedule.c", "diff": "#include \"sixtop.h\"\n#include \"idmanager.h\"\n#include \"sf0.h\"\n+#include \"icmpv6rpl.h\"\n//=========================== variables =======================================\n" }, { "change_type": "MODIFY", "old_path": "projects/python/SConscript.env", "new_path": "projects/python/SConscript.env", "diff": "@@ -475,7 +475,6 @@ functionsToChange = [\n'activity_ri8',\n'activity_rie6',\n'activity_ri9',\n- 'ieee154e_processIEs',\n'ieee154e_getTimeCorrection',\n'isValidRxFrame',\n'isValidAck',\n@@ -485,10 +484,10 @@ functionsToChange = [\n'ieee154e_getAsn',\n'asnWriteToSerial',\n'ieee154e_syncSlotOffset',\n- 'asnStoreFromEB',\n- 'joinPriorityStoreFromEB',\n- 'timeslotTemplateIDStoreFromEB',\n- 'channelhoppingTemplateIDStoreFromEB',\n+ 'ieee154e_asnStoreFromEB',\n+ 'ieee154e_joinPriorityStoreFromEB',\n+ 'ieee154e_timeslotTemplateIDStoreFromEB',\n+ 'ieee154e_channelhoppingTemplateIDStoreFromEB',\n'synchronizePacket',\n'synchronizeAck',\n'changeIsSync',\n@@ -545,6 +544,7 @@ functionsToChange = [\n'processIE_prepend_sixResponse',\n'processIE_retrieveSlotframeLinkIE',\n'processIE_retrieve_sixCelllist',\n+ 'processIE_EB_IE',\n# schedule\n'schedule_init',\n'schedule_startDAGroot',\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-631. organizing IE processing for EB.
491,595
07.04.2017 17:15:59
-7,200
dcc78e6452250ff67178448d778775b5e39014e5
add sctimer.c for openmote-cc2538.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/SConscript", "new_path": "bsp/boards/SConscript", "diff": "@@ -15,6 +15,7 @@ sources_h = [\n'radio.h',\n'radiotimer.h',\n'uart.h',\n+ 'sctimer.h',\n]\n#============================ SCons targets ===================================\n" }, { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/openmote-cc2538/sctimer.c", "diff": "+/**\n+\\brief A timer module with only a single compare value. Can be used to replace\n+ the \"bsp_timer\" and \"radiotimer\" modules with the help of abstimer.\n+\\author: Xavier Vilajosana (xvilajosana@eecs.berkeley.edu)\n+\\author Christian Hopfner <christian.hopfner@pcm.endress.com>, September 2016\n+*/\n+\n+#include \"board_info.h\"\n+#include \"sctimer.h\"\n+#include \"sleepmode.h\"\n+#include \"debugpins.h\"\n+#include <headers/hw_ints.h>\n+\n+\n+// ========================== define ==========================================\n+\n+static void sctimer_isr(void);\n+\n+// ========================== variable ========================================\n+\n+typedef struct {\n+ sctimer_cbt sctimer_cb;\n+} sctimer_vars_t;\n+\n+sctimer_vars_t sctimer_vars;\n+\n+// ========================== protocol =========================================\n+\n+/**\n+\\brief Initialization sctimer.\n+*/\n+void sctimer_init(void){\n+ memset(&sctimer_vars, 0, sizeof(sctimer_vars_t));\n+ IntRegister(INT_SMTIM, sctimer_isr);\n+ IntDisable(INT_SMTIM);\n+}\n+\n+void sctimer_setCb(sctimer_cbt cb){\n+ sctimer_vars.sctimer_cb = cb;\n+}\n+\n+/**\n+\\brief set compare\n+*/\n+void sctimer_setCompare(uint32_t val){\n+ IntEnable(INT_SMTIM);\n+ SleepModeTimerCompareSet(val);\n+}\n+\n+/**\n+\\brief Return the current value of the timer's counter.\n+\n+ \\returns The current value of the timer's counter.\n+*/\n+uint32_t sctimer_readCounter(void){\n+ return SleepModeTimerCountGet();\n+}\n+\n+void sctimer_enable(void){\n+ IntEnable(INT_SMTIM);\n+}\n+\n+void sctimer_disable(void){\n+ IntDisable(INT_SMTIM);\n+}\n+\n+void sctimer_isr(void) {\n+ debugpins_isr_set();\n+ IntPendClear(INT_SMTIM);\n+ sctimer_vars.sctimer_cb();\n+ debugpins_isr_clr();\n+}\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/sctimer.h", "new_path": "bsp/boards/sctimer.h", "diff": "@@ -26,6 +26,7 @@ typedef kick_scheduler_t (*sctimer_cbt)(void);\nvoid sctimer_init(void);\nvoid sctimer_setCompare(uint32_t val);\n+void sctimer_setCb(sctimer_cbt cb);\nuint32_t sctimer_readCounter(void);\nvoid sctimer_enable(void);\nvoid sctimer_disable(void);\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-634. add sctimer.c for openmote-cc2538.
491,595
09.04.2017 15:57:36
-7,200
e096dd43fb790e7e5cf3ebc5002bcc2deaf3c782
create sctimer project for cc2538.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/board.c", "new_path": "bsp/boards/openmote-cc2538/board.c", "diff": "#include <source/sys_ctrl.h>\n#include \"board.h\"\n-#include \"bsp_timer.h\"\n#include \"debugpins.h\"\n#include \"i2c.h\"\n#include \"leds.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n#include \"sensors.h\"\n+#include \"sctimer.h\"\n#include \"uart.h\"\n//=========================== variables =======================================\n@@ -71,8 +70,7 @@ void board_init(void) {\nleds_init();\ndebugpins_init();\nbutton_init();\n- bsp_timer_init();\n- radiotimer_init();\n+ sctimer_init();\nuart_init();\nradio_init();\ni2c_init();\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/radio.c", "new_path": "bsp/boards/openmote-cc2538/radio.c", "diff": "#include \"debugpins.h\"\n#include \"leds.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n+#include \"sctimer.h\"\n//=========================== defines =========================================\n//=========================== variables =======================================\ntypedef struct {\n- radiotimer_capture_cbt startFrame_cb;\n- radiotimer_capture_cbt endFrame_cb;\n+ sctimer_capture_cbt startFrame_cb;\n+ sctimer_capture_cbt endFrame_cb;\nradio_state_t state;\n} radio_vars_t;\n@@ -157,19 +157,11 @@ void radio_init() {\nradio_vars.state = RADIOSTATE_RFOFF;\n}\n-void radio_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_setOverflowCb(cb);\n-}\n-\n-void radio_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_setCompareCb(cb);\n-}\n-\n-void radio_setStartFrameCb(radiotimer_capture_cbt cb) {\n+void radio_setStartFrameCb(sctimer_capture_cbt cb) {\nradio_vars.startFrame_cb = cb;\n}\n-void radio_setEndFrameCb(radiotimer_capture_cbt cb) {\n+void radio_setEndFrameCb(sctimer_capture_cbt cb) {\nradio_vars.endFrame_cb = cb;\n}\n@@ -190,24 +182,6 @@ void radio_reset() {\nradio_init();\n}\n-//===== timer\n-\n-void radio_startTimer(PORT_TIMER_WIDTH period) {\n- radiotimer_start(period);\n-}\n-\n-PORT_TIMER_WIDTH radio_getTimerValue() {\n- return radiotimer_getValue();\n-}\n-\n-void radio_setTimerPeriod(PORT_TIMER_WIDTH period) {\n- radiotimer_setPeriod(period);\n-}\n-\n-PORT_TIMER_WIDTH radio_getTimerPeriod() {\n- return radiotimer_getPeriod();\n-}\n-\n//===== RF admin\nvoid radio_setFrequency(uint8_t frequency) {\n@@ -467,7 +441,7 @@ void radio_isr_internal(void) {\nuint8_t irq_status0,irq_status1;\n// capture the time\n- capturedTime = radiotimer_getCapturedTime();\n+ capturedTime = sctimer_readCounter();\n// reading IRQ_STATUS\nirq_status0 = HWREG(RFCORE_SFR_RFIRQF0);\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/sctimer.c", "new_path": "bsp/boards/openmote-cc2538/sctimer.c", "diff": "/**\n-\\brief A timer module with only a single compare value. Can be used to replace\n- the \"bsp_timer\" and \"radiotimer\" modules with the help of abstimer.\n-\\author: Xavier Vilajosana (xvilajosana@eecs.berkeley.edu)\n+\\brief A timer module with only a single compare value.\n+\n+\\author Xavier Vilajosana <xvilajosana@eecs.berkeley.edu>\n\\author Christian Hopfner <christian.hopfner@pcm.endress.com>, September 2016\n+\\author Tengfei Chang <tengfei.chang@inria.fr> April 2017\n*/\n#include \"board_info.h\"\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/radio.h", "new_path": "bsp/boards/radio.h", "diff": "\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012.\n*/\n-#include \"radiotimer.h\"\n+#include \"sctimer.h\"\n//=========================== define ==========================================\n@@ -50,17 +50,10 @@ typedef enum {\n// admin\nvoid radio_init(void);\n-void radio_setOverflowCb(radiotimer_compare_cbt cb);\n-void radio_setCompareCb(radiotimer_compare_cbt cb);\n-void radio_setStartFrameCb(radiotimer_capture_cbt cb);\n-void radio_setEndFrameCb(radiotimer_capture_cbt cb);\n+void radio_setStartFrameCb(sctimer_capture_cbt cb);\n+void radio_setEndFrameCb(sctimer_capture_cbt cb);\n// reset\nvoid radio_reset(void);\n-// timer\n-void radio_startTimer(PORT_TIMER_WIDTH period);\n-PORT_TIMER_WIDTH radio_getTimerValue(void);\n-void radio_setTimerPeriod(PORT_TIMER_WIDTH period);\n-PORT_TIMER_WIDTH radio_getTimerPeriod(void);\n// RF admin\nvoid radio_setFrequency(uint8_t frequency);\nvoid radio_rfOn(void);\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/sctimer.h", "new_path": "bsp/boards/sctimer.h", "diff": "//=========================== typedef =========================================\n-typedef kick_scheduler_t (*sctimer_cbt)(void);\n+typedef void (*sctimer_cbt) (void);\n+typedef void (*sctimer_capture_cbt)(uint32_t timestamp);\n//=========================== variables =======================================\n" }, { "change_type": "MODIFY", "old_path": "projects/openmote-cc2538/OpenMote-CC2538.eww", "new_path": "projects/openmote-cc2538/OpenMote-CC2538.eww", "diff": "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<workspace>\n+ <project>\n+ <path>$WS_DIR$\\01bsp_sctimer\\01bsp_sctimer.ewp</path>\n+ </project>\n<project>\n<path>$WS_DIR$\\03oos_macpong\\03oos_macpong.ewp</path>\n</project>\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-634. create sctimer project for cc2538.
491,595
10.04.2017 23:25:28
-7,200
05163eb30b2ef2f53d246ecd9498653d5b483242
implement opentimer2 timer schedule function.
[ { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.c", "new_path": "drivers/common/opentimers2.c", "diff": "@@ -17,7 +17,6 @@ at most MAX_NUM_TIMERS timers.\n//=========================== variables =======================================\nopentimers2_vars_t opentimers2_vars;\n-//uint32_t counter; //counts the elapsed time.\n//=========================== prototypes ======================================\n@@ -33,44 +32,205 @@ Initializes data structures and hardware timer.\nvoid opentimer2_init(){\n// initialize local variables\nmemset(&opentimers2_vars,0,sizeof(opentimers2_vars_t));\n-\n// set callback for sctimer module\nsctimer_set_callback(opentimers2_timer_callback);\n}\n+/**\n+\\brief create a timer by assigning an entry from timer buffer.\n+\n+create a timer by reserving an Id for the timer.\n+ */\nopentimer2_id_t opentimer2_create(void){\n- return 0;\n+ uint8_t id;\n+ for (id=0;id<MAX_NUM_TIMERS;id++){\n+ if (opentimers2_vars.timersBuf[id].isrunning==FALSE){\n+ return id;\n+ }\n+ }\n+ // there is no available buffer for this timer\n+ return TOO_MANY_TIMERS_ERROR;\n}\n+/**\n+\\brief schedule a period refer to comparing value set last time.\n+\n+This function will schedule a timer which expires when the timer count reach\n+to lastCompareValue + duration.\n+\n+Note: as this function schedule time depending on last compare value. It\n+can't be called firstly after the timer is created.\n+\n+\\param id the timer id\n+\\param duration the period asked for schedule since last comparing value\n+\\param uint_type the unit type of this schedule: ticks or ms\n+\\param cb when this scheduled timer fired, call this callback function.\n+ */\nvoid opentimer2_scheduleRelative(opentimer2_id_t id,\nuint32_t duration,\nuint_type_t uint_type,\nopentimers2_cbt cb){\n+ uint8_t i;\n+ uint32_t durationTicks;\n+ uint32_t timerGap;\n+ // 1. make sure the timer exist\n+ for (i=0;i<MAX_NUM_TIMERS;i++){\n+ if (opentimers2_vars.timersBuf[i].isrunning && i == id){\n+ break;\n+ }\n+ }\n+ if (i==MAX_NUM_TIMERS){\n+ // doesn't find the timer\n+ return;\n+ }\n+ // 2. updat the timer content\n+ switch (uint_type){\n+ case TIME_MS:\n+ if (duration>MAX_TICKS_NUMBER/PORT_TICS_PER_MS){\n+ // openserail_printError();\n+ return;\n+ } else {\n+ durationTicks = duration*PORT_TICS_PER_MS;\n+ }\n+ break;\n+ case TIME_TICS:\n+ durationTicks = duration;\n+ break;\n}\n+ opentimers2_vars.timersBuf[id].currentCompareValue = durationTicks+opentimers2_vars.timersBuf[id].lastCompareValue;\n+\n+ // 3. update the next timer to fire\n+ timerGap = opentimers2_vars.timersBuf[id].currentCompareValue-opentimers2_vars.currentTimeout;\n+ for (i=0;i<MAX_NUM_TIMERS;i++){\n+ if (opentimers2_vars.timersBuf[i].isrunning){\n+ if (opentimers2_vars.timersBuf[i].currentCompareValue - opentimers2_vars.currentTimeout < timerGap){\n+ // there is one timer will fired before the given timer, needn't update\n+ return;\n+ }\n+ }\n+ }\n+ // if I got here, assign the next to be fired timer to given timer\n+ opentimers2_vars.currentTimeout = opentimers2_vars.timersBuf[id].currentCompareValue;\n+ sctimer_setCompare(opentimers2_vars.currentTimeout);\n+ opentimers2_vars.running = TRUE;\n+}\n+\n+/**\n+\\brief schedule a period refer to given reference.\n+\n+This function will schedule a timer which expires when the timer count reach\n+to lastCompareValue + reference.\n+\n+\\param id the timer id\n+\\param duration the period asked for schedule after a given time indicated by reference parameter.\n+\\param uint_type the unit type of this schedule: ticks or ms\n+\\param cb when this scheduled timer fired, call this callback function.\n+ */\nvoid opentimer2_scheduleAbsolute(opentimer2_id_t id,\nuint32_t duration,\nuint32_t reference ,\nuint_type_t uint_type,\nopentimers2_cbt cb){\n+ uint8_t i;\n+ uint32_t durationTicks;\n+ uint32_t timerGap;\n+ // 1. make sure the timer exist\n+ for (i=0;i<MAX_NUM_TIMERS;i++){\n+ if (opentimers2_vars.timersBuf[i].isrunning && i == id){\n+ break;\n+ }\n+ }\n+ if (i==MAX_NUM_TIMERS){\n+ // doesn't find the timer\n+ return;\n+ }\n+ // 2. updat the timer content\n+ switch (uint_type){\n+ case TIME_MS:\n+ if (duration>MAX_TICKS_NUMBER/PORT_TICS_PER_MS){\n+ // openserail_printError();\n+ return;\n+ } else {\n+ durationTicks = duration*PORT_TICS_PER_MS;\n+ }\n+ break;\n+ case TIME_TICS:\n+ durationTicks = duration;\n+ break;\n}\n-void opentimer2_cancel(opentimer2_id_t id){\n+ opentimers2_vars.timersBuf[id].currentCompareValue = durationTicks+reference;\n+ // 3. update the next timer to fire\n+ timerGap = opentimers2_vars.timersBuf[id].currentCompareValue-opentimers2_vars.currentTimeout;\n+ for (i=0;i<MAX_NUM_TIMERS;i++){\n+ if (opentimers2_vars.timersBuf[i].isrunning){\n+ if (opentimers2_vars.timersBuf[i].currentCompareValue - opentimers2_vars.currentTimeout < timerGap){\n+ // there is one timer will fired before the given timer, needn't update\n+ return;\n+ }\n+ }\n+ }\n+ // if I got here, assign the next to be fired timer to given timer\n+ opentimers2_vars.currentTimeout = opentimers2_vars.timersBuf[id].currentCompareValue;\n+ sctimer_setCompare(opentimers2_vars.currentTimeout);\n+ opentimers2_vars.running = TRUE;\n+}\n+\n+/**\n+\\brief cancel a running timer.\n+\n+This function disable the timer temperally by removing its callback and marking\n+isrunning as false. The timer may be recover later.\n+\n+\\param id the timer id\n+ */\n+void opentimer2_cancel(opentimer2_id_t id){\n+ opentimers2_vars.timersBuf[id].isrunning = FALSE;\n+ opentimers2_vars.timersBuf[id].callback = NULL;\n}\n-void opentimer2_destroy(opentimer2_id_t id){\n+/**\n+\\brief destroy a stored timer.\n+\n+Reset the whole entry of given timer including the id.\n+\n+\\param id the timer id\n+\\returns False if the given can't be found or return Success\n+ */\n+bool opentimer2_destroy(opentimer2_id_t id){\n+ if (id<MAX_NUM_TIMERS){\n+ memset(&opentimers2_vars.timersBuf[id],0,sizeof(opentimers2_t));\n+ return TRUE;\n+ } else {\n+ return FALSE;\n+ }\n}\n+/**\n+\\brief get the counter value of given timer.\n+\n+\\param id the timer id\n+\n+\\returns the current counter value.\n+ */\nuint32_t opentimer2_getValue(opentimer2_id_t id){\n- return 0;\n+ return sctimer_readCounter();\n}\n// ========================== callback ========================================\n+/**\n+\\brief this is the callback function of opentimer2.\n+\n+This function is called when sctimer interrupt happens. The function looks the\n+whole timer buffer and find out the correct timer responding to the interrupt\n+and call the callback recorded for that timer.\n+ */\nvoid opentimers2_timer_callback(void){\n}\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.h", "new_path": "drivers/common/opentimers2.h", "diff": "/// Maximum number of timers that can run concurrently\n#define MAX_NUM_TIMERS 10\n-#define MAX_TICKS_IN_SINGLE_CLOCK ((PORT_TIMER_WIDTH)0xFFFFFFFF)\n+#define MAX_TICKS_NUMBER ((PORT_TIMER_WIDTH)0xFFFFFFFF)\n#define TOO_MANY_TIMERS_ERROR 255\n#define opentimer2_id_t uint8_t\n@@ -35,11 +35,10 @@ typedef enum {\n} uint_type_t;\ntypedef struct {\n- uint32_t duration_ticks; // total number of clock ticks\n- uint32_t ticks_remaining; // ticks remaining before elapses\n+ uint32_t currentCompareValue;// total number of clock ticks\n+ uint32_t lastCompareValue; // the previous compare value\nbool isrunning; // is running?\nopentimers2_cbt callback; // function to call when elapses\n- bool hasExpired; // whether the callback has to be called\n} opentimers2_t;\n//=========================== module variables ================================\n@@ -64,7 +63,7 @@ void opentimer2_scheduleAbsolute(opentimer2_id_t id,\nuint_type_t uint_type,\nopentimers2_cbt cb);\nvoid opentimer2_cancel(opentimer2_id_t id);\n-void opentimer2_destroy(opentimer2_id_t id);\n+bool opentimer2_destroy(opentimer2_id_t id);\nuint32_t opentimer2_getValue(opentimer2_id_t id);\n/**\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. implement opentimer2 timer schedule function.
491,595
12.04.2017 18:39:00
-7,200
c29689a3cbb5947642cdb967cb2bdf4e39b5578b
implement opentimer2_timer_callback.
[ { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.c", "new_path": "drivers/common/opentimers2.c", "diff": "@@ -151,7 +151,7 @@ void opentimer2_scheduleAbsolute(opentimer2_id_t id,\nswitch (uint_type){\ncase TIME_MS:\nif (duration>MAX_TICKS_NUMBER/PORT_TICS_PER_MS){\n- // openserail_printError();\n+ // openserail_printError(\"unsupported large duration\");\nreturn;\n} else {\ndurationTicks = duration*PORT_TICS_PER_MS;\n@@ -232,5 +232,41 @@ whole timer buffer and find out the correct timer responding to the interrupt\nand call the callback recorded for that timer.\n*/\nvoid opentimers2_timer_callback(void){\n+ uint8_t i;\n+ uint8_t id;\n+ uint32_t timerGap=MAX_TICKS_NUMBER;\n+ // 1. find the expired timer\n+ for (i=0;i<MAX_NUM_TIMERS;i++){\n+ if (opentimers2_vars.timersBuf[i].isrunning==TRUE){\n+ if (opentimers2_vars.currentTimeout-opentimers2_vars.timersBuf[i].currentCompareValue < MAX_DURATION_ISR){\n+ // this timer expired, break\n+ id = i;\n+ break;\n+ }\n+ }\n+ }\n+ // 2. call the callback of expired timer\n+ if (i==MAX_NUM_TIMERS){\n+ // openserail_printError(\"failed to find expired timer\")\n+ return;\n+ }\n+ opentimers2_vars.timersBuf[id].callback(id);\n+ opentimers2_vars.timersBuf[id].isrunning = FALSE;\n+\n+\n+ // 3. find the next timer to be fired\n+ for (i=0;i<MAX_NUM_TIMERS;i++){\n+ if (opentimers2_vars.timersBuf[i].isrunning==TRUE){\n+ if (opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.currentTimeout<timerGap){\n+ timerGap = opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.currentTimeout;\n+ id = i;\n+ }\n+ }\n+ }\n+\n+ // 4. reschedule the timer\n+ opentimers2_vars.currentTimeout = opentimers2_vars.timersBuf[id].currentCompareValue;\n+ sctimer_setCompare(opentimers2_vars.currentTimeout);\n+ opentimers2_vars.running = TRUE;\n}\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.h", "new_path": "drivers/common/opentimers2.h", "diff": "#define MAX_NUM_TIMERS 10\n#define MAX_TICKS_NUMBER ((PORT_TIMER_WIDTH)0xFFFFFFFF)\n#define TOO_MANY_TIMERS_ERROR 255\n+#define MAX_DURATION_ISR 33 // 33@32768Hz = 1ms\n#define opentimer2_id_t uint8_t\ntypedef void (*opentimers2_cbt)(opentimer2_id_t id);\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. implement opentimer2_timer_callback.
491,595
13.04.2017 15:55:13
-7,200
e9efa77560045a59e64297bbae7697763f7c0344
opentimer2 project passed.
[ { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.c", "new_path": "drivers/common/opentimers2.c", "diff": "@@ -44,7 +44,8 @@ create a timer by reserving an Id for the timer.\nopentimer2_id_t opentimer2_create(void){\nuint8_t id;\nfor (id=0;id<MAX_NUM_TIMERS;id++){\n- if (opentimers2_vars.timersBuf[id].isrunning==FALSE){\n+ if (opentimers2_vars.timersBuf[id].isUsed==FALSE){\n+ opentimers2_vars.timersBuf[id].isUsed = TRUE;\nreturn id;\n}\n}\n@@ -75,7 +76,7 @@ void opentimer2_scheduleRelative(opentimer2_id_t id,\nuint32_t timerGap;\n// 1. make sure the timer exist\nfor (i=0;i<MAX_NUM_TIMERS;i++){\n- if (opentimers2_vars.timersBuf[i].isrunning && i == id){\n+ if (opentimers2_vars.timersBuf[i].isUsed && i == id){\nbreak;\n}\n}\n@@ -100,6 +101,8 @@ void opentimer2_scheduleRelative(opentimer2_id_t id,\n}\nopentimers2_vars.timersBuf[id].currentCompareValue = durationTicks+opentimers2_vars.timersBuf[id].lastCompareValue;\n+ opentimers2_vars.timersBuf[id].isrunning = TRUE;\n+ opentimers2_vars.timersBuf[id].callback = cb;\n// 3. update the next timer to fire\ntimerGap = opentimers2_vars.timersBuf[id].currentCompareValue-opentimers2_vars.currentTimeout;\n@@ -138,7 +141,7 @@ void opentimer2_scheduleAbsolute(opentimer2_id_t id,\nuint32_t timerGap;\n// 1. make sure the timer exist\nfor (i=0;i<MAX_NUM_TIMERS;i++){\n- if (opentimers2_vars.timersBuf[i].isrunning && i == id){\n+ if (opentimers2_vars.timersBuf[i].isUsed && i == id){\nbreak;\n}\n}\n@@ -163,6 +166,8 @@ void opentimer2_scheduleAbsolute(opentimer2_id_t id,\n}\nopentimers2_vars.timersBuf[id].currentCompareValue = durationTicks+reference;\n+ opentimers2_vars.timersBuf[id].isrunning = TRUE;\n+ opentimers2_vars.timersBuf[id].callback = cb;\n// 3. update the next timer to fire\ntimerGap = opentimers2_vars.timersBuf[id].currentCompareValue-opentimers2_vars.currentTimeout;\n@@ -251,8 +256,10 @@ void opentimers2_timer_callback(void){\n// openserail_printError(\"failed to find expired timer\")\nreturn;\n}\n- opentimers2_vars.timersBuf[id].callback(id);\n+\nopentimers2_vars.timersBuf[id].isrunning = FALSE;\n+ opentimers2_vars.timersBuf[i].lastCompareValue = opentimers2_vars.timersBuf[i].currentCompareValue;\n+ opentimers2_vars.timersBuf[id].callback(id);\n// 3. find the next timer to be fired\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.h", "new_path": "drivers/common/opentimers2.h", "diff": "@@ -39,6 +39,7 @@ typedef struct {\nuint32_t currentCompareValue;// total number of clock ticks\nuint32_t lastCompareValue; // the previous compare value\nbool isrunning; // is running?\n+ bool isUsed; // true when this entry is occupied\nopentimers2_cbt callback; // function to call when elapses\n} opentimers2_t;\n" }, { "change_type": "MODIFY", "old_path": "projects/common/02drv_opentimers2/02drv_opentimers2.c", "new_path": "projects/common/02drv_opentimers2/02drv_opentimers2.c", "diff": "@@ -50,12 +50,13 @@ void cb_timer2(opentimer2_id_t id);\n\\brief The program starts executing here.\n*/\nint mote_main(void) {\n- uint32_t reference = sctimer_readCounter(); // reference\n+ uint32_t reference; // reference\nmemset(&app_vars,0,sizeof(app_vars_t));\nboard_init();\nopentimer2_init();\n+ reference = sctimer_readCounter();\napp_vars.timer0 = opentimer2_create();\nopentimer2_scheduleAbsolute(\napp_vars.timer0, // timerId\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. opentimer2 project passed.
491,595
14.04.2017 09:41:09
-7,200
41a92c274c01e90e1c4197b7b2c51d580484c7cc
replace operation of radio module related timer by radiotimer module.
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -144,7 +144,7 @@ void ieee154e_init() {\nradio_setStartFrameCb(ieee154e_startOfFrame);\nradio_setEndFrameCb(ieee154e_endOfFrame);\n// have the radio start its timer\n- radio_startTimer(ieee154e_vars.slotDuration);\n+ radiotimer_start(ieee154e_vars.slotDuration);\n}\n//=========================== public ==========================================\n@@ -188,7 +188,7 @@ PORT_RADIOTIMER_WIDTH ieee154e_asnDiff(asn_t* someASN) {\nThis function executes in ISR mode, when the new slot timer fires.\n*/\nvoid isr_ieee154e_newSlot() {\n- radio_setTimerPeriod(ieee154e_vars.slotDuration);\n+ radiotimer_setPeriod(ieee154e_vars.slotDuration);\nif (ieee154e_vars.isSync==FALSE) {\nif (idmanager_getIsDAGroot()==TRUE) {\nchangeIsSync(TRUE);\n@@ -444,7 +444,7 @@ port_INLINE void activity_synchronize_newSlot() {\n// switch on the radio in Rx mode.\nradio_rxEnable();\n- ieee154e_vars.radioOnInit=radio_getTimerValue();\n+ ieee154e_vars.radioOnInit=radiotimer_getValue();\nieee154e_vars.radioOnThisSlot=TRUE;\nradio_rxNow();\n}\n@@ -464,7 +464,7 @@ port_INLINE void activity_synchronize_newSlot() {\n// switch on the radio in Rx mode.\nradio_rxEnable();\n- ieee154e_vars.radioOnInit=radio_getTimerValue();\n+ ieee154e_vars.radioOnInit=radiotimer_getValue();\nieee154e_vars.radioOnThisSlot=TRUE;\nradio_rxNow();\nieee154e_vars.singleChannelChanged = FALSE;\n@@ -627,7 +627,7 @@ port_INLINE void activity_synchronize_endOfFrame(PORT_RADIOTIMER_WIDTH capturedT\nradio_rfOff();\n// compute radio duty cycle\n- ieee154e_vars.radioOnTics += (radio_getTimerValue()-ieee154e_vars.radioOnInit);\n+ ieee154e_vars.radioOnTics += (radiotimer_getValue()-ieee154e_vars.radioOnInit);\n// toss the IEs\npacketfunctions_tossHeader(ieee154e_vars.dataReceived,lenIE);\n@@ -900,7 +900,7 @@ port_INLINE void activity_ti1ORri1() {\nieee154e_vars.numOfSleepSlots = schedule_getFrameLength()+ieee154e_vars.nextActiveSlotOffset-ieee154e_vars.slotOffset;\n}\n- radio_setTimerPeriod(TsSlotDuration*(ieee154e_vars.numOfSleepSlots));\n+ radiotimer_setPeriod(TsSlotDuration*(ieee154e_vars.numOfSleepSlots));\n//increase ASN by numOfSleepSlots-1 slots as at this slot is already incremented by 1\nfor (i=0;i<ieee154e_vars.numOfSleepSlots-1;i++){\n@@ -1049,7 +1049,7 @@ port_INLINE void activity_ti1ORri1() {\n}\n}\n// set the timer based on calcualted number of slots to skip\n- radio_setTimerPeriod(TsSlotDuration*(ieee154e_vars.numOfSleepSlots));\n+ radiotimer_setPeriod(TsSlotDuration*(ieee154e_vars.numOfSleepSlots));\n#ifdef ADAPTIVE_SYNC\n// deal with the case when schedule multi slots\n@@ -1108,7 +1108,7 @@ port_INLINE void activity_ti2() {\n// enable the radio in Tx mode. This does not send the packet.\nradio_txEnable();\n- ieee154e_vars.radioOnInit=radio_getTimerValue();\n+ ieee154e_vars.radioOnInit=radiotimer_getValue();\nieee154e_vars.radioOnThisSlot=TRUE;\n// change state\nchangeState(S_TXDATAREADY);\n@@ -1197,7 +1197,7 @@ port_INLINE void activity_ti5(PORT_RADIOTIMER_WIDTH capturedTime) {\n#endif\n// turn off the radio\nradio_rfOff();\n- ieee154e_vars.radioOnTics+=(radio_getTimerValue()-ieee154e_vars.radioOnInit);\n+ ieee154e_vars.radioOnTics+=(radiotimer_getValue()-ieee154e_vars.radioOnInit);\n// record the captured time\nieee154e_vars.lastCapturedTime = capturedTime;\n@@ -1257,7 +1257,7 @@ port_INLINE void activity_ti6() {\n#endif\n//caputre init of radio for duty cycle calculation\n- ieee154e_vars.radioOnInit=radio_getTimerValue();\n+ ieee154e_vars.radioOnInit=radiotimer_getValue();\nieee154e_vars.radioOnThisSlot=TRUE;\n// change state\n@@ -1356,7 +1356,7 @@ port_INLINE void activity_ti9(PORT_RADIOTIMER_WIDTH capturedTime) {\n// turn off the radio\nradio_rfOff();\n//compute tics radio on.\n- ieee154e_vars.radioOnTics+=(radio_getTimerValue()-ieee154e_vars.radioOnInit);\n+ ieee154e_vars.radioOnTics+=(radiotimer_getValue()-ieee154e_vars.radioOnInit);\n// record the captured time\nieee154e_vars.lastCapturedTime = capturedTime;\n@@ -1492,7 +1492,7 @@ port_INLINE void activity_ri2() {\n// enable the radio in Rx mode. The radio does not actively listen yet.\nradio_rxEnable();\n#endif\n- ieee154e_vars.radioOnInit=radio_getTimerValue();\n+ ieee154e_vars.radioOnInit=radiotimer_getValue();\nieee154e_vars.radioOnThisSlot=TRUE;\n// change state\n@@ -1578,7 +1578,7 @@ port_INLINE void activity_ri5(PORT_RADIOTIMER_WIDTH capturedTime) {\n#endif\n// turn off the radio\nradio_rfOff();\n- ieee154e_vars.radioOnTics+=radio_getTimerValue()-ieee154e_vars.radioOnInit;\n+ ieee154e_vars.radioOnTics+=radiotimer_getValue()-ieee154e_vars.radioOnInit;\n// get a buffer to put the (received) data in\nieee154e_vars.dataReceived = openqueue_getFreePacketBuffer(COMPONENT_IEEE802154E);\nif (ieee154e_vars.dataReceived==NULL) {\n@@ -1854,7 +1854,7 @@ port_INLINE void activity_ri6() {\n// enable the radio in Tx mode. This does not send that packet.\nradio_txEnable();\n- ieee154e_vars.radioOnInit=radio_getTimerValue();\n+ ieee154e_vars.radioOnInit=radiotimer_getValue();\nieee154e_vars.radioOnThisSlot=TRUE;\n// change state\nchangeState(S_TXACKREADY);\n@@ -2188,8 +2188,8 @@ void synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived) {\nPORT_RADIOTIMER_WIDTH currentValue;\n// record the current timer value and period\n- currentValue = radio_getTimerValue();\n- currentPeriod = radio_getTimerPeriod();\n+ currentValue = radiotimer_getValue();\n+ currentPeriod = radiotimer_getPeriod();\n// calculate new period\ntimeCorrection = (PORT_SIGNED_INT_WIDTH)((PORT_SIGNED_INT_WIDTH)timeReceived - (PORT_SIGNED_INT_WIDTH)TsTxOffset);\n@@ -2216,7 +2216,7 @@ void synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived) {\n}\n// resynchronize by applying the new period\n- radio_setTimerPeriod(newPeriod);\n+ radiotimer_setPeriod(newPeriod);\n#ifdef ADAPTIVE_SYNC\n// indicate time correction to adaptive sync module\nadaptive_sync_indicateTimeCorrection(timeCorrection,ieee154e_vars.dataReceived->l2_nextORpreviousHop);\n@@ -2252,11 +2252,11 @@ void synchronizeAck(PORT_SIGNED_INT_WIDTH timeCorrection) {\nPORT_RADIOTIMER_WIDTH currentPeriod;\n// calculate new period\n- currentPeriod = radio_getTimerPeriod();\n+ currentPeriod = radiotimer_getPeriod();\nnewPeriod = (PORT_RADIOTIMER_WIDTH)((PORT_SIGNED_INT_WIDTH)currentPeriod+timeCorrection);\n// resynchronize by applying the new period\n- radio_setTimerPeriod(newPeriod);\n+ radiotimer_setPeriod(newPeriod);\n// reset the de-synchronization timeout\nieee154e_vars.deSyncTimeout = DESYNCTIMEOUT;\n@@ -2448,7 +2448,7 @@ void endSlot() {\n// compute the duty cycle if radio has been turned on\nif (ieee154e_vars.radioOnThisSlot==TRUE){\n- ieee154e_vars.radioOnTics+=(radio_getTimerValue()-ieee154e_vars.radioOnInit);\n+ ieee154e_vars.radioOnTics+=(radiotimer_getValue()-ieee154e_vars.radioOnInit);\n}\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\nradiotimer_cancel(ACTION_ALL_RADIOTIMER_INTERRUPT);\n@@ -2462,7 +2462,7 @@ void endSlot() {\n//computing duty cycle.\nieee154e_stats.numTicsOn+=ieee154e_vars.radioOnTics;//accumulate and tics the radio is on for that window\n- ieee154e_stats.numTicsTotal+=radio_getTimerPeriod();//increment total tics by timer period.\n+ ieee154e_stats.numTicsTotal+=radiotimer_getPeriod();//increment total tics by timer period.\nif (ieee154e_stats.numTicsTotal>DUTY_CYCLE_WINDOW_LIMIT){\nieee154e_stats.numTicsTotal = ieee154e_stats.numTicsTotal>>1;\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/adaptive_sync.c", "new_path": "openstack/02a-MAClow/adaptive_sync.c", "diff": "@@ -196,7 +196,7 @@ void adaptive_sync_countCompensationTimeout() {\nadaptive_sync_vars.compensateTicks += SYNC_ACCURACY;\n}\n// update current slot duration and reload compensationTimeout\n- radio_setTimerPeriod(newSlotDuration);\n+ radiotimer_setPeriod(newSlotDuration);\nadaptive_sync_vars.compensationTimeout = adaptive_sync_vars.compensationInfo_vars.compensationSlots;\n#ifdef OPENSIM\ndebugpins_debug_set();\n@@ -251,7 +251,7 @@ void adaptive_sync_countCompensationTimeout_compoundSlots(uint16_t compoundSlots\nnewSlotDuration += compensateTicks*SYNC_ACCURACY;\nadaptive_sync_vars.compensateTicks += compensateTicks * SYNC_ACCURACY;\n}\n- radio_setTimerPeriod(newSlotDuration);\n+ radiotimer_setPeriod(newSlotDuration);\n#ifdef OPENSIM\ndebugpins_debug_set();\ndebugpins_debug_clr();\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. replace operation of radio module related timer by radiotimer module.
491,595
17.04.2017 21:50:17
-7,200
05ad8539638ca308392d96955a202144877442f8
update opentimers2.
[ { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.h", "new_path": "drivers/common/opentimers.h", "diff": "@@ -36,12 +36,6 @@ typedef enum {\nTIMER_ONESHOT,\n} timer_type_t;\n-/*the time can be in tics or in ms*/\n-typedef enum {\n- TIME_MS,\n- TIME_TICS,\n-} time_type_t;\n-\ntypedef struct {\nuint32_t period_ticks; // total number of clock ticks\nPORT_TIMER_WIDTH ticks_remaining; // ticks remaining before elapses\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.c", "new_path": "drivers/common/opentimers2.c", "diff": "@@ -29,7 +29,7 @@ void opentimers2_timer_callback(void);\nInitializes data structures and hardware timer.\n*/\n-void opentimer2_init(){\n+void opentimers2_init(){\n// initialize local variables\nmemset(&opentimers2_vars,0,sizeof(opentimers2_vars_t));\n// set callback for sctimer module\n@@ -41,7 +41,7 @@ void opentimer2_init(){\ncreate a timer by reserving an Id for the timer.\n*/\n-opentimer2_id_t opentimer2_create(void){\n+opentimers2_id_t opentimers2_create(void){\nuint8_t id;\nfor (id=0;id<MAX_NUM_TIMERS;id++){\nif (opentimers2_vars.timersBuf[id].isUsed==FALSE){\n@@ -67,9 +67,9 @@ can't be called firstly after the timer is created.\n\\param uint_type the unit type of this schedule: ticks or ms\n\\param cb when this scheduled timer fired, call this callback function.\n*/\n-void opentimer2_scheduleRelative(opentimer2_id_t id,\n+void opentimers2_scheduleRelative(opentimers2_id_t id,\nuint32_t duration,\n- uint_type_t uint_type,\n+ time_type_t uint_type,\nopentimers2_cbt cb){\nuint8_t i;\nuint8_t idToSchedule;\n@@ -133,10 +133,10 @@ to lastCompareValue + reference.\n\\param uint_type the unit type of this schedule: ticks or ms\n\\param cb when this scheduled timer fired, call this callback function.\n*/\n-void opentimer2_scheduleAbsolute(opentimer2_id_t id,\n+void opentimers2_scheduleAbsolute(opentimers2_id_t id,\nuint32_t duration,\nuint32_t reference ,\n- uint_type_t uint_type,\n+ time_type_t uint_type,\nopentimers2_cbt cb){\nuint8_t i;\nuint8_t idToSchedule;\n@@ -197,7 +197,7 @@ isrunning as false. The timer may be recover later.\n\\param id the timer id\n*/\n-void opentimer2_cancel(opentimer2_id_t id){\n+void opentimers2_cancel(opentimers2_id_t id){\nopentimers2_vars.timersBuf[id].isrunning = FALSE;\nopentimers2_vars.timersBuf[id].callback = NULL;\n}\n@@ -211,7 +211,7 @@ Reset the whole entry of given timer including the id.\n\\returns False if the given can't be found or return Success\n*/\n-bool opentimer2_destroy(opentimer2_id_t id){\n+bool opentimers2_destroy(opentimers2_id_t id){\nif (id<MAX_NUM_TIMERS){\nmemset(&opentimers2_vars.timersBuf[id],0,sizeof(opentimers2_t));\nreturn TRUE;\n@@ -227,10 +227,19 @@ bool opentimer2_destroy(opentimer2_id_t id){\n\\returns the current counter value.\n*/\n-uint32_t opentimer2_getValue(opentimer2_id_t id){\n+uint32_t opentimers2_getValue(opentimers2_id_t id){\nreturn sctimer_readCounter();\n}\n+/**\n+\\brief get the currentTimeout variable of opentimer2.\n+\n+\\returns currentTimeout.\n+ */\n+uint32_t opentimers2_getCurrentTimeout(){\n+ return opentimers2_vars.currentTimeout;\n+}\n+\n// ========================== callback ========================================\n/**\n@@ -260,7 +269,7 @@ void opentimers2_timer_callback(void){\nopentimers2_vars.timersBuf[i].isrunning = FALSE;\nopentimers2_vars.timersBuf[i].lastCompareValue = opentimers2_vars.timersBuf[i].currentCompareValue;\nopentimers2_vars.timersBuf[i].hasExpired = FALSE;\n- opentimers2_vars.timersBuf[i].callback(i);\n+ opentimers2_vars.timersBuf[i].callback();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.h", "new_path": "drivers/common/opentimers2.h", "diff": "\\author Tengfei Chang <tengfei.chang@inria.fr>, April 2017.\n*/\n-#ifndef __OPENTIMERS_H\n-#define __OPENTIMERS_H\n+#ifndef __OPENTIMERS2_H\n+#define __OPENTIMERS2_H\n#include \"opendefs.h\"\n#define MAX_TICKS_NUMBER ((PORT_TIMER_WIDTH)0xFFFFFFFF)\n#define TOO_MANY_TIMERS_ERROR 255\n#define MAX_DURATION_ISR 33 // 33@32768Hz = 1ms\n-#define opentimer2_id_t uint8_t\n+#define opentimers2_id_t uint8_t\n-typedef void (*opentimers2_cbt)(opentimer2_id_t id);\n+typedef void (*opentimers2_cbt)(void);\n//=========================== typedef =========================================\n-/*the time can be in tics or in ms*/\n-typedef enum {\n- TIME_MS,\n- TIME_TICS,\n-} uint_type_t;\n-\ntypedef struct {\nuint32_t currentCompareValue;// total number of clock ticks\nuint32_t lastCompareValue; // the previous compare value\n@@ -54,20 +48,21 @@ typedef struct {\n//=========================== prototypes ======================================\n-void opentimer2_init(void);\n-opentimer2_id_t opentimer2_create(void);\n-void opentimer2_scheduleRelative(opentimer2_id_t id,\n+void opentimers2_init(void);\n+opentimers2_id_t opentimers2_create(void);\n+void opentimers2_scheduleRelative(opentimers2_id_t id,\nuint32_t duration,\n- uint_type_t uint_type,\n+ time_type_t uint_type,\nopentimers2_cbt cb);\n-void opentimer2_scheduleAbsolute(opentimer2_id_t id,\n+void opentimers2_scheduleAbsolute(opentimers2_id_t id,\nuint32_t duration,\nuint32_t reference ,\n- uint_type_t uint_type,\n+ time_type_t uint_type,\nopentimers2_cbt cb);\n-void opentimer2_cancel(opentimer2_id_t id);\n-bool opentimer2_destroy(opentimer2_id_t id);\n-uint32_t opentimer2_getValue(opentimer2_id_t id);\n+void opentimers2_cancel(opentimers2_id_t id);\n+bool opentimers2_destroy(opentimers2_id_t id);\n+uint32_t opentimers2_getValue(opentimers2_id_t id);\n+uint32_t opentimers2_getCurrentTimeout();\n/**\n\\}\n" }, { "change_type": "MODIFY", "old_path": "inc/opendefs.h", "new_path": "inc/opendefs.h", "diff": "@@ -54,6 +54,12 @@ enum {\nADDR_ANYCAST = 6,\n};\n+// type of timer\n+typedef enum {\n+ TIME_MS,\n+ TIME_TICS,\n+} time_type_t;\n+\nenum {\nOW_LITTLE_ENDIAN = TRUE,\nOW_BIG_ENDIAN = FALSE,\n" }, { "change_type": "MODIFY", "old_path": "projects/common/02drv_opentimers2/02drv_opentimers2.c", "new_path": "projects/common/02drv_opentimers2/02drv_opentimers2.c", "diff": "@@ -31,18 +31,18 @@ radio and sync). When you run the application, you should see the LEDs\n//=========================== variables =======================================\ntypedef struct {\n- opentimer2_id_t timer0;\n- opentimer2_id_t timer1;\n- opentimer2_id_t timer2;\n+ opentimers2_id_t timer0;\n+ opentimers2_id_t timer1;\n+ opentimers2_id_t timer2;\n} app_vars_t;\napp_vars_t app_vars;\n//=========================== prototypes ======================================\n-void cb_timer0(opentimer2_id_t id);\n-void cb_timer1(opentimer2_id_t id);\n-void cb_timer2(opentimer2_id_t id);\n+void cb_timer0(void);\n+void cb_timer1(void);\n+void cb_timer2(void);\n//=========================== main ============================================\n@@ -54,11 +54,11 @@ int mote_main(void) {\nmemset(&app_vars,0,sizeof(app_vars_t));\nboard_init();\n- opentimer2_init();\n+ opentimers2_init();\nreference = sctimer_readCounter();\n- app_vars.timer0 = opentimer2_create();\n- opentimer2_scheduleAbsolute(\n+ app_vars.timer0 = opentimers2_create();\n+ opentimers2_scheduleAbsolute(\napp_vars.timer0, // timerId\nAPP_DLY_TIMER0_ms, // duration\nreference, // reference\n@@ -66,8 +66,8 @@ int mote_main(void) {\ncb_timer0 // callback\n);\n- app_vars.timer1 = opentimer2_create();\n- opentimer2_scheduleAbsolute(\n+ app_vars.timer1 = opentimers2_create();\n+ opentimers2_scheduleAbsolute(\napp_vars.timer1, // timerId\nAPP_DLY_TIMER1_ms, // duration\nreference, // reference\n@@ -75,8 +75,8 @@ int mote_main(void) {\ncb_timer1 // callback\n);\n- app_vars.timer2 = opentimer2_create();\n- opentimer2_scheduleAbsolute(\n+ app_vars.timer2 = opentimers2_create();\n+ opentimers2_scheduleAbsolute(\napp_vars.timer2, // timerId\nAPP_DLY_TIMER2_ms, // duration\nreference, // reference\n@@ -91,10 +91,10 @@ int mote_main(void) {\n//=========================== callbacks =======================================\n-void cb_timer0(opentimer2_id_t id) {\n+void cb_timer0(void) {\nleds_error_toggle();\n// re-schedule refer to previous scheduled value\n- opentimer2_scheduleRelative(\n+ opentimers2_scheduleRelative(\napp_vars.timer0, // timerId\nAPP_DLY_TIMER0_ms, // duration\nTIME_MS, // timetype\n@@ -102,10 +102,10 @@ void cb_timer0(opentimer2_id_t id) {\n);\n}\n-void cb_timer1(opentimer2_id_t id) {\n+void cb_timer1(void) {\nleds_radio_toggle();\n// re-schedule refer to previous scheduled value\n- opentimer2_scheduleRelative(\n+ opentimers2_scheduleRelative(\napp_vars.timer1, // timerId\nAPP_DLY_TIMER1_ms, // duration\nTIME_MS, // timetype\n@@ -113,10 +113,10 @@ void cb_timer1(opentimer2_id_t id) {\n);\n}\n-void cb_timer2(opentimer2_id_t id) {\n+void cb_timer2(void) {\nleds_sync_toggle();\n// re-schedule refer to previous scheduled value\n- opentimer2_scheduleRelative(\n+ opentimers2_scheduleRelative(\napp_vars.timer2, // timerId\nAPP_DLY_TIMER2_ms, // duration\nTIME_MS, // timetype\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. update opentimers2.
491,585
19.04.2017 13:30:42
-7,200
5914cb8f4ca3634af7ee907ca3fdca8a65bf71be
Fix compile warnings for openstack and drivers.
[ { "change_type": "MODIFY", "old_path": "drivers/common/openserial.c", "new_path": "drivers/common/openserial.c", "diff": "@@ -58,6 +58,9 @@ void inputHdlcOpen(void);\nvoid inputHdlcWrite(uint8_t b);\nvoid inputHdlcClose(void);\n+// sniffer\n+void sniffer_setListeningChannel(uint8_t channel);\n+\n//=========================== public ==========================================\n//===== admin\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/schedule.c", "new_path": "openstack/02b-MAChigh/schedule.c", "diff": "#include \"sixtop.h\"\n#include \"idmanager.h\"\n#include \"sf0.h\"\n+#include \"icmpv6rpl.h\"\n//=========================== variables =======================================\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/schedule.h", "new_path": "openstack/02b-MAChigh/schedule.h", "diff": "/**\n\\brief The length of the superframe, in slots.\n-The superframe repears over time and can be arbitrarly long.\n+The superframe reappears over time and can be arbitrarily long.\n*/\n#define SLOTFRAME_LENGTH 11 //should be 101\n@@ -36,7 +36,7 @@ The superframe repears over time and can be arbitrarly long.\nMAXACTIVESLOTS < SLOTFRAME_LENGTH\nThis would make sure number of slots are available (SLOTFRAME_LENGTH-MAXACTIVESLOTS)\n- for seiral port to tranmit data to dagroot.\n+ for serial port to transmit data to dagroot.\n*/\n#define NUMSLOTSOFF 5\n@@ -184,7 +184,7 @@ void schedule_removeAllCells(\n);\nscheduleEntry_t* schedule_getCurrentScheduleEntry(void);\nuint8_t schedule_getNumOfSlotsByType(cellType_t type);\n-uint8_t schedule_getNumberOfFreeEntries();\n+uint8_t schedule_getNumberOfFreeEntries(void);\n// from IEEE802154E\nvoid schedule_syncSlotOffset(slotOffset_t targetSlotOffset);\nvoid schedule_advanceSlot(void);\n@@ -203,7 +203,7 @@ void schedule_indicateTx(\nbool succesfullTx\n);\n-void schedule_housekeeping();\n+void schedule_housekeeping(void);\n/**\n\\}\n\\}\n" }, { "change_type": "MODIFY", "old_path": "openstack/03a-IPHC/iphc.c", "new_path": "openstack/03a-IPHC/iphc.c", "diff": "@@ -28,7 +28,7 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\nopen_addr_t* temp_addr_64b,\nuint8_t* dispatch,\nuint8_t* tf,\n- bool* nh,\n+ uint8_t* nh,\nuint8_t* hlim,\nuint8_t* sam,\nuint8_t* m,\n@@ -278,7 +278,7 @@ owerror_t iphc_prependIPv6Header(\nOpenQueueEntry_t* msg,\nuint8_t tf,\nuint32_t value_flowLabel,\n- bool nh,\n+ uint8_t nh,\nuint8_t value_nextHeader,\nuint8_t hlim,\nuint8_t value_hopLimit,\n@@ -524,7 +524,7 @@ void iphc_retrieveIPv6Header(OpenQueueEntry_t* msg, ipv6_header_iht* ipv6_outer_\nopen_addr_t temp_addr_64b;\nuint8_t dispatch;\nuint8_t tf;\n- bool nh;\n+ uint8_t nh;\nuint8_t hlim;\nuint8_t sam;\nuint8_t m;\n@@ -725,7 +725,7 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\nopen_addr_t* temp_addr_64b,\nuint8_t* dispatch,\nuint8_t* tf,\n- bool* nh,\n+ uint8_t* nh,\nuint8_t* hlim,\nuint8_t* sam,\nuint8_t* m,\n" }, { "change_type": "MODIFY", "old_path": "openstack/03a-IPHC/iphc.h", "new_path": "openstack/03a-IPHC/iphc.h", "diff": "@@ -237,7 +237,7 @@ owerror_t iphc_prependIPv6Header(\nOpenQueueEntry_t* msg,\nuint8_t tf,\nuint32_t value_flowLabel,\n- bool nh,\n+ uint8_t nh,\nuint8_t value_nextHeader,\nuint8_t hlim,\nuint8_t value_hopLimit,\n" }, { "change_type": "MODIFY", "old_path": "openstack/cross-layers/openqueue.h", "new_path": "openstack/cross-layers/openqueue.h", "diff": "@@ -38,7 +38,7 @@ OpenQueueEntry_t* openqueue_getFreePacketBuffer(uint8_t creator);\nowerror_t openqueue_freePacketBuffer(OpenQueueEntry_t* pkt);\nvoid openqueue_removeAllCreatedBy(uint8_t creator);\nvoid openqueue_removeAllOwnedBy(uint8_t owner);\n-bool openqueue_isHighPriorityEntryEnough();\n+bool openqueue_isHighPriorityEntryEnough(void);\n// called by res\nOpenQueueEntry_t* openqueue_sixtopGetSentPacket(void);\nOpenQueueEntry_t* openqueue_sixtopGetReceivedPacket(void);\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Fix compile warnings for openstack and drivers.
491,585
19.04.2017 13:33:07
-7,200
ee7b5838a5f1c4d5496e02a70e4ce82db8461781
Fixed compile warnings for telosb board.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/telosb/board.c", "new_path": "bsp/boards/telosb/board.c", "diff": "// these are part of the TelosB port only, so not present in debugpins.h, only\n// in debugpins.c. We therefore need to extern them.\n-extern void debugpins_isruarttx_toggle();\n-extern void debugpins_isruarttx_clr();\n-extern void debugpins_isruarttx_set();\n-extern void debugpins_isruartrx_toggle();\n-extern void debugpins_isruartrx_clr();\n-extern void debugpins_isruartrx_set();\n+extern void debugpins_isruarttx_toggle(void);\n+extern void debugpins_isruarttx_clr(void);\n+extern void debugpins_isruarttx_set(void);\n+extern void debugpins_isruartrx_toggle(void);\n+extern void debugpins_isruartrx_clr(void);\n+extern void debugpins_isruartrx_set(void);\n//=========================== main ============================================\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/telosb/debugpins.c", "new_path": "bsp/boards/telosb/debugpins.c", "diff": "@@ -82,24 +82,24 @@ void debugpins_isr_set() {\n}\n// P3.5\n-void debugpins_isruarttx_toggle() {\n+void debugpins_isruarttx_toggle(void) {\nP3OUT ^= 0x20;\n}\n-void debugpins_isruarttx_clr() {\n+void debugpins_isruarttx_clr(void) {\nP3OUT &= ~0x20;\n}\n-void debugpins_isruarttx_set() {\n+void debugpins_isruarttx_set(void) {\nP3OUT |= 0x20;\n}\n// P3.4\n-void debugpins_isruartrx_toggle() {\n+void debugpins_isruartrx_toggle(void) {\nP3OUT ^= 0x10;\n}\n-void debugpins_isruartrx_clr() {\n+void debugpins_isruartrx_clr(void) {\nP3OUT &= ~0x10;\n}\n-void debugpins_isruartrx_set() {\n+void debugpins_isruartrx_set(void) {\nP3OUT |= 0x10;\n}\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Fixed compile warnings for telosb board.
491,585
19.04.2017 13:39:07
-7,200
5f34b874cbd655ca2a3d6f2eac935e3eb9282c02
Introduced openudp_register().
[ { "change_type": "MODIFY", "old_path": "bsp/boards/python/openwsnmodule_obj.h", "new_path": "bsp/boards/python/openwsnmodule_obj.h", "diff": "#include \"icmpv6rpl_obj.h\"\n#include \"opencoap_obj.h\"\n#include \"opentcp_obj.h\"\n+#include \"openudp_obj.h\"\n#include \"idmanager_obj.h\"\n#include \"openqueue_obj.h\"\n#include \"openrandom_obj.h\"\n@@ -218,6 +219,7 @@ struct OpenMote {\nicmpv6rpl_vars_t icmpv6rpl_vars;\nopencoap_vars_t opencoap_vars;\ntcp_vars_t tcp_vars;\n+ openudp_vars_t openudp_vars;\n// l3\n// l2b\nsixtop_vars_t sixtop_vars;\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/openudp.c", "new_path": "openstack/04-TRAN/openudp.c", "diff": "//=========================== variables =======================================\n+openudp_vars_t openudp_vars;\n+\n//=========================== prototypes ======================================\n//=========================== public ==========================================\nvoid openudp_init() {\n+ // initialize the resource linked list\n+ openudp_vars.resources = NULL;\n+}\n+\n+void openudp_register(udp_resource_desc_t* desc) {\n+ // chain the new resource to head of resource list\n+ desc->next = openudp_vars.resources;\n+ openudp_vars.resources = desc;\n}\nowerror_t openudp_send(OpenQueueEntry_t* msg) {\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/openudp.h", "new_path": "openstack/04-TRAN/openudp.h", "diff": "@@ -41,11 +41,31 @@ typedef struct {\nuint16_t checksum;\n} udp_ht;\n+\n+typedef void (*udp_callbackReceive_cbt)(OpenQueueEntry_t* msg);\n+typedef void (*udp_callbackSendDone_cbt)(OpenQueueEntry_t* msg, owerror_t error);\n+\n+typedef struct udp_resource_desc_t udp_resource_desc_t;\n+\n+struct udp_resource_desc_t {\n+ uint16_t port; ///< UDP port that is associated with the resource\n+ udp_callbackReceive_cbt callbackReceive; ///< receive callback,\n+ ///< if NULL, all message received for port will be discarded\n+ udp_callbackSendDone_cbt callbackSendDone; ///< send completion callback,\n+ ///< if NULL, the associated message will be release without notification\n+ udp_resource_desc_t* next;\n+};\n+\n//=========================== variables =======================================\n+typedef struct {\n+ udp_resource_desc_t* resources;\n+} openudp_vars_t;\n+\n//=========================== prototypes ======================================\nvoid openudp_init(void);\n+void openudp_register(udp_resource_desc_t* desc);\nowerror_t openudp_send(OpenQueueEntry_t* msg);\nvoid openudp_sendDone(OpenQueueEntry_t* msg, owerror_t error);\nvoid openudp_receive(OpenQueueEntry_t* msg);\n" }, { "change_type": "MODIFY", "old_path": "projects/python/SConscript.env", "new_path": "projects/python/SConscript.env", "diff": "@@ -146,6 +146,7 @@ varsToChange = [\n#- debug\n#- common\n'udpstorm_vars',\n+ 'openudp_vars',\n#+++++ CoAP\n#- debug\n#- common\n@@ -719,6 +720,7 @@ functionsToChange = [\n'openudp_sendDone',\n'openudp_receive',\n'openudp_debugPrint',\n+ 'openudp_register',\n# rsvp\n'rsvp_qos_request',\n'rsvp_timer_cb',\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Introduced openudp_register().
491,585
19.04.2017 13:50:25
-7,200
f3a5f9c02033e5ef06d9689ed55703311102afe0
Registered opencoap module as UDP service.
[ { "change_type": "MODIFY", "old_path": "openapps/openapps.c", "new_path": "openapps/openapps.c", "diff": "//=========================== private =========================================\nvoid openapps_init(void) {\n+ //-- 04-TRAN\n+ opencoap_init(); // initialize before any of the CoAP applications\n+\n// CoAP\nc6t_init();\ncinfo_init();\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/opencoap.c", "new_path": "openstack/04-TRAN/opencoap.c", "diff": "#include \"opendefs.h\"\n#include \"opencoap.h\"\n-#include \"openudp.h\"\n#include \"openqueue.h\"\n#include \"openserial.h\"\n#include \"openrandom.h\"\n@@ -30,6 +29,12 @@ void opencoap_init() {\n// initialize the messageID\nopencoap_vars.messageID = openrandom_get16b();\n+\n+ // register at UDP stack\n+ opencoap_vars.desc.port = WKP_UDP_COAP;\n+ opencoap_vars.desc.callbackReceive = &opencoap_receive;\n+ opencoap_vars.desc.callbackSendDone = opencoap_sendDone;\n+ openudp_register(&opencoap_vars.desc);\n}\n/**\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/opencoap.h", "new_path": "openstack/04-TRAN/opencoap.h", "diff": "*/\n#include \"opentimers.h\"\n+#include \"openudp.h\"\n//=========================== define ==========================================\n@@ -145,6 +146,7 @@ struct coap_resource_desc_t {\n//=========================== module variables ================================\ntypedef struct {\n+ udp_resource_desc_t desc;\ncoap_resource_desc_t* resources;\nbool busySending;\nuint8_t delayCounter;\n" }, { "change_type": "MODIFY", "old_path": "openstack/openstack.c", "new_path": "openstack/openstack.c", "diff": "@@ -77,7 +77,6 @@ void openstack_init(void) {\n//-- 04-TRAN\nopentcp_init();\nopenudp_init();\n- opencoap_init(); // initialize before any of the CoAP applications\n//===== applications\nopenapps_init();\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Registered opencoap module as UDP service.
491,585
19.04.2017 13:58:13
-7,200
feea1fbdf2349176d90f8b3026f6232e2c90d226
Registered uecho application as UDP service.
[ { "change_type": "MODIFY", "old_path": "openapps/uecho/uecho.c", "new_path": "openapps/uecho/uecho.c", "diff": "#include \"opendefs.h\"\n#include \"uecho.h\"\n-#include \"openudp.h\"\n#include \"openqueue.h\"\n#include \"openserial.h\"\n#include \"packetfunctions.h\"\n//=========================== variables =======================================\n+uecho_vars_t uecho_vars;\n+\n//=========================== prototypes ======================================\n//=========================== public ==========================================\nvoid uecho_init() {\n+ // clear local variables\n+ memset(&uecho_vars,0,sizeof(uecho_vars_t));\n+\n+ // register at UDP stack\n+ uecho_vars.desc.port = WKP_UDP_ECHO;\n+ uecho_vars.desc.callbackReceive = &uecho_receive;\n+ uecho_vars.desc.callbackSendDone = &uecho_sendDone;\n+ openudp_register(&uecho_vars.desc);\n}\nvoid uecho_receive(OpenQueueEntry_t* request) {\n" }, { "change_type": "MODIFY", "old_path": "openapps/uecho/uecho.h", "new_path": "openapps/uecho/uecho.h", "diff": "\\{\n*/\n+#include \"openudp.h\"\n+\n//=========================== define ==========================================\n//=========================== typedef =========================================\n//=========================== variables =======================================\n+typedef struct {\n+ udp_resource_desc_t desc; ///< resource descriptor for this module, used to register at UDP stack\n+} uecho_vars_t;\n+\n//=========================== prototypes ======================================\nvoid uecho_init(void);\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Registered uecho application as UDP service.
491,585
19.04.2017 13:59:10
-7,200
7addee815b1ff59cc46f6bdcca2f4f99a7631660
Registered uinject application as UDP service.
[ { "change_type": "MODIFY", "old_path": "openapps/uinject/uinject.c", "new_path": "openapps/uinject/uinject.c", "diff": "#include \"opendefs.h\"\n#include \"uinject.h\"\n-#include \"openudp.h\"\n#include \"openqueue.h\"\n#include \"opentimers.h\"\n#include \"openserial.h\"\n@@ -30,8 +29,13 @@ void uinject_init() {\n// clear local variables\nmemset(&uinject_vars,0,sizeof(uinject_vars_t));\n- uinject_vars.period = UINJECT_PERIOD_MS;\n+ // register at UDP stack\n+ uinject_vars.desc.port = WKP_UDP_INJECT;\n+ uinject_vars.desc.callbackReceive = &uinject_receive;\n+ uinject_vars.desc.callbackSendDone = &uinject_sendDone;\n+ openudp_register(&uinject_vars.desc);\n+ uinject_vars.period = UINJECT_PERIOD_MS;\n// start periodic timer\nuinject_vars.timerId = opentimers_start(\nuinject_vars.period,\n" }, { "change_type": "MODIFY", "old_path": "openapps/uinject/uinject.h", "new_path": "openapps/uinject/uinject.h", "diff": "*/\n#include \"opentimers.h\"\n+#include \"openudp.h\"\n//=========================== define ==========================================\n@@ -22,6 +23,7 @@ typedef struct {\nopentimer_id_t timerId; ///< periodic timer which triggers transmission\nuint16_t counter; ///< incrementing counter which is written into the packet\nuint16_t period; ///< uinject packet sending period>\n+ udp_resource_desc_t desc; ///< resource descriptor for this module, used to register at UDP stack\n} uinject_vars_t;\n//=========================== prototypes ======================================\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Registered uinject application as UDP service.
491,585
19.04.2017 14:02:07
-7,200
eb1bf6cf0f1355582deee9140953d8dcf5acc28a
Registered userialbridge application as UDP service.
[ { "change_type": "MODIFY", "old_path": "openapps/userialbridge/userialbridge.c", "new_path": "openapps/userialbridge/userialbridge.c", "diff": "#include \"opendefs.h\"\n#include \"userialbridge.h\"\n-#include \"openudp.h\"\n#include \"openqueue.h\"\n#include \"opentimers.h\"\n#include \"openserial.h\"\n@@ -34,16 +33,18 @@ void userialbridge_init() {\nuserialbridge_vars.openserial_rsvp.cb = userialbridge_triggerData;\nuserialbridge_vars.openserial_rsvp.next = NULL;\nopenserial_register(&userialbridge_vars.openserial_rsvp);\n+\n+ // register at UDP stack\n+ userialbridge_vars.desc.port = WKP_UDP_SERIALBRIDGE;\n+ userialbridge_vars.desc.callbackReceive = NULL;\n+ userialbridge_vars.desc.callbackSendDone = &userialbridge_sendDone;\n+ openudp_register(&userialbridge_vars.desc);\n}\nvoid userialbridge_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\nopenqueue_freePacketBuffer(msg);\n}\n-void userialbridge_receive(OpenQueueEntry_t* pkt) {\n- openqueue_freePacketBuffer(pkt);\n-}\n-\n//=========================== private =========================================\nvoid userialbridge_triggerData(void) {\n" }, { "change_type": "MODIFY", "old_path": "openapps/userialbridge/userialbridge.h", "new_path": "openapps/userialbridge/userialbridge.h", "diff": "\\{\n*/\n-#include \"opentimers.h\"\n#include \"openserial.h\"\n+#include \"openudp.h\"\n+\n//=========================== define ==========================================\n@@ -23,13 +24,13 @@ typedef struct {\nuint8_t txbuf[USERIALBRIDGE_MAXPAYLEN];\nuint8_t txbufLen;\nopenserial_rsvpt openserial_rsvp;\n+ udp_resource_desc_t desc; ///< resource descriptor for this module, used to register at UDP stack\n} userialbridge_vars_t;\n//=========================== prototypes ======================================\nvoid userialbridge_init(void);\nvoid userialbridge_sendDone(OpenQueueEntry_t* msg, owerror_t error);\n-void userialbridge_receive(OpenQueueEntry_t* msg);\nvoid userialbridge_triggerData(void);\n/**\n\\}\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Registered userialbridge application as UDP service.
491,585
19.04.2017 14:09:11
-7,200
3d6f880e29b4f9b797d42cc5f68ad5ffeb6d1e52
Used registered services instead of hard-coded functions to handle UDP transfers.
[ { "change_type": "MODIFY", "old_path": "openapps/rrt/rrt.c", "new_path": "openapps/rrt/rrt.c", "diff": "@@ -237,9 +237,7 @@ void rrt_sendCoAPMsg(char actionMsg, uint8_t *ipv6mote) {\n//metada\npkt->l4_destination_port = WKP_UDP_RINGMASTER;\n- pkt->l4_sourcePortORicmpv6Type = WKP_UDP_RINGMASTER;\npkt->l3_destinationAdd.type = ADDR_128B;\n-\n// set destination address here\nif (!ipv6mote) { //if mote ptr is NULL, then send to ringmaster\nmemcpy(&pkt->l3_destinationAdd.addr_128b[0], &ipAddr_ringmaster, 16);\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/openudp.c", "new_path": "openstack/04-TRAN/openudp.c", "diff": "@@ -17,6 +17,9 @@ openudp_vars_t openudp_vars;\n//=========================== prototypes ======================================\n+static void openudp_sendDone_default_handler(OpenQueueEntry_t* msg, owerror_t error);\n+static void openudp_receive_default_handler(OpenQueueEntry_t* msg);\n+\n//=========================== public ==========================================\nvoid openudp_init() {\n@@ -132,36 +135,42 @@ owerror_t openudp_send(OpenQueueEntry_t* msg) {\n}\nvoid openudp_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\n+ udp_resource_desc_t* resource;\n+ udp_callbackSendDone_cbt udp_send_done_callback_ptr = NULL;\n+\nmsg->owner = COMPONENT_OPENUDP;\n- switch(msg->l4_sourcePortORicmpv6Type) {\n- case WKP_UDP_COAP:\n- opencoap_sendDone(msg,error);\n- break;\n- case WKP_UDP_ECHO:\n- uecho_sendDone(msg,error);\n- break;\n- case WKP_UDP_INJECT:\n- uinject_sendDone(msg,error);\n- break;\n- case WKP_UDP_SERIALBRIDGE:\n- userialbridge_sendDone(msg,error);\n- break;\n- case WKP_UDP_RINGMASTER:\n- //udpprint_sendDone(msg, error);\n- rrt_sendDone(msg, error);\n+\n+ // iterate list of registered resources\n+ resource = openudp_vars.resources;\n+ while (NULL != resource) {\n+ if (resource->port == msg->l4_sourcePortORicmpv6Type) {\n+ // there is a registration for this port, either forward the send completion or simply release the message\n+ udp_send_done_callback_ptr = (resource->callbackSendDone == NULL) ? openudp_sendDone_default_handler\n+ : resource->callbackSendDone;\nbreak;\n- default:\n+ }\n+ resource = resource->next;\n+ }\n+\n+ if (udp_send_done_callback_ptr == NULL) {\nopenserial_printError(COMPONENT_OPENUDP,ERR_UNSUPPORTED_PORT_NUMBER,\n(errorparameter_t)msg->l4_sourcePortORicmpv6Type,\n(errorparameter_t)5);\nopenqueue_freePacketBuffer(msg);\n+ return;\n}\n+\n+ // handle send completion\n+ udp_send_done_callback_ptr(msg, error);\n}\nvoid openudp_receive(OpenQueueEntry_t* msg) {\nuint8_t temp_8b;\n+ udp_resource_desc_t* resource;\n+ udp_callbackReceive_cbt udp_receive_done_callback_ptr = NULL;\nmsg->owner = COMPONENT_OPENUDP;\n+\nif (msg->l4_protocol_compressed==TRUE) {\n// get the UDP header encoding byte\ntemp_8b = *((uint8_t*)(msg->payload));\n@@ -202,29 +211,26 @@ void openudp_receive(OpenQueueEntry_t* msg) {\npacketfunctions_tossHeader(msg,sizeof(udp_ht));\n}\n- switch(msg->l4_destination_port) {\n- case WKP_UDP_COAP:\n- opencoap_receive(msg);\n+ // iterate list of registered resources\n+ resource = openudp_vars.resources;\n+ while (NULL != resource) {\n+ if (resource->port == msg->l4_destination_port) {\n+ udp_receive_done_callback_ptr = (resource->callbackReceive == NULL) ? openudp_receive_default_handler\n+ : resource->callbackReceive;\nbreak;\n- case WKP_UDP_RINGMASTER:\n- if (msg->l4_payload[0] > 90) {\n- rrt_sendCoAPMsg('B', NULL);\n+ }\n+ resource = resource->next;\n}\n- openqueue_freePacketBuffer(msg);\n- break;\n- case WKP_UDP_ECHO:\n- uecho_receive(msg);\n- break;\n- case WKP_UDP_INJECT:\n- uinject_receive(msg);\n- break;\n- default:\n+ if (udp_receive_done_callback_ptr == NULL) {\nopenserial_printError(COMPONENT_OPENUDP,ERR_UNSUPPORTED_PORT_NUMBER,\n(errorparameter_t)msg->l4_destination_port,\n(errorparameter_t)6);\nopenqueue_freePacketBuffer(msg);\n}\n+\n+ // forward message to resource\n+ udp_receive_done_callback_ptr(msg);\n}\nbool openudp_debugPrint() {\n@@ -232,3 +238,13 @@ bool openudp_debugPrint() {\n}\n//=========================== private =========================================\n+\n+static void openudp_sendDone_default_handler(OpenQueueEntry_t* msg, owerror_t error) {\n+ openqueue_freePacketBuffer(msg);\n+}\n+\n+static void openudp_receive_default_handler(OpenQueueEntry_t* msg) {\n+ openqueue_freePacketBuffer(msg);\n+}\n+\n+\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Used registered services instead of hard-coded functions to handle UDP transfers.
491,585
19.04.2017 14:20:49
-7,200
0d08fa521dccb49e1a27559c92f4863c0ca29be0
Fixed linker library dependency.
[ { "change_type": "MODIFY", "old_path": "SConscript", "new_path": "SConscript", "diff": "@@ -767,7 +767,7 @@ def buildLibs(projectDir):\n'00std': [ ],\n'01bsp': [ 'libbsp'],\n'02drv': [ 'libkernel','libdrivers','libbsp'],\n- '03oos': ['libopenstack','libopenapps','libkernel','libdrivers','libbsp'], # this order needed for mspgcc\n+ '03oos': ['libopenstack','libopenapps','libopenstack','libkernel','libdrivers','libbsp'], # this order needed for mspgcc\n}\nreturnVal = None\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Fixed linker library dependency.
491,585
19.04.2017 14:21:24
-7,200
48cf8b5888ff163afb8dd8490c00ee075c8b38b2
Fixed build errors for python board.
[ { "change_type": "MODIFY", "old_path": "projects/python/SConscript.env", "new_path": "projects/python/SConscript.env", "diff": "@@ -721,6 +721,10 @@ functionsToChange = [\n'openudp_receive',\n'openudp_debugPrint',\n'openudp_register',\n+ 'openudp_sendDone_default_handler',\n+ 'openudp_receive_default_handler',\n+ 'udp_send_done_callback_ptr',\n+ 'udp_receive_done_callback_ptr',\n# rsvp\n'rsvp_qos_request',\n'rsvp_timer_cb',\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Fixed build errors for python board.
491,585
19.04.2017 16:03:36
-7,200
47e5f866f06db45a7e665a160c6e609455f2e654
Fixed inconsitencies in doxygen comments.
[ { "change_type": "MODIFY", "old_path": "drivers/common/opensensors.c", "new_path": "drivers/common/opensensors.c", "diff": "@@ -36,7 +36,7 @@ void opensensors_init(void) {\n/**\n\\brief Return the number of registered OpenSensors\n- \\param[out] the number of registered OpenSensors.\n+ \\returns the number of registered OpenSensors.\n*/\nuint8_t opensensors_getNumSensors(void) {\nreturn opensensors_vars.numSensors;\n@@ -45,7 +45,7 @@ uint8_t opensensors_getNumSensors(void) {\n/**\n\\brief Return an OpenSensors resource structure\n\\param[in] index Index of the OpenSensors resource within Opensensors vars.\n- \\param[out] the OpenSensors resource within Opensensors vars.\n+ \\returns the OpenSensors resource within Opensensors vars.\n*/\nopensensors_resource_desc_t* opensensors_getResource(uint8_t index) {\nreturn &(opensensors_vars.opensensors_resource[index]);\n@@ -57,8 +57,6 @@ opensensors_resource_desc_t* opensensors_getResource(uint8_t index) {\n\\brief Register a OpenSensors resource\n\\param[in] sensorType the sensor type representation.\n- \\param[in] callbackRead callback to read rough sensor data.\n- \\param[in] callbackConvert callback to convert rough sensor data to human understandable.\n*/\nvoid opensensors_register(uint8_t sensorType) {\nif (sensors_is_present(sensorType)) {\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opensensors.h", "new_path": "drivers/common/opensensors.h", "diff": "@@ -41,4 +41,9 @@ opensensors_resource_desc_t* opensensors_getResource(\nuint8_t index\n);\n+/**\n+\\}\n+\\}\n+*/\n+\n#endif // __OPENSENSORS_H__\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/schedule.c", "new_path": "openstack/02b-MAChigh/schedule.c", "diff": "@@ -252,7 +252,7 @@ void schedule_getSlotInfo(\n/**\n\\brief Get the maximum number of active slots.\n-\\param[out] maximum number of active slots\n+\\returns maximum number of active slots\n*/\nuint16_t schedule_getMaxActiveSlots() {\nreturn schedule_vars.maxActiveSlots;\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -616,9 +616,8 @@ virtual component COMPONENT_SIXTOP_TO_IEEE802154E. Whenever it gets a change,\nIEEE802154E will handle the packet.\n\\param[in] msg The packet to the transmitted\n-\\param[in] iePresent Indicates wheter an Information Element is present in the\n+\\param[in] payloadIEPresent Indicates wheter an Information Element is present in the\npacket.\n-\\param[in] frameVersion The frame version to write in the packet.\n\\returns E_SUCCESS iff successful.\n*/\n" }, { "change_type": "MODIFY", "old_path": "openstack/03a-IPHC/iphc.c", "new_path": "openstack/03a-IPHC/iphc.c", "diff": "@@ -1026,7 +1026,6 @@ uint8_t iphc_retrieveIphcHeader(open_addr_t* temp_addr_16b,\n\\param[in,out] msg The message to prepend the header to.\n\\param[in] nextheader The next header value to use.\n-\\param[in] nh Whether the next header is inline or compressed.\n\\param[in] rpl_option The RPL option to include.\n*/\nvoid iphc_prependIPv6HopByHopHeader(\n@@ -1062,10 +1061,8 @@ void iphc_prependIPv6HopByHopHeader(\n\\brief Retrieve an IPv6 hop-by-hop header from a message.\n\\param[in,out] msg The message to retrieve the header from.\n-\\param[out] hopbyhop_header Pointer to the structure to hold the retrieved\n- hop-by-hop option.\n-\\param[out] rpl_option Pointer to the structure to hold the retrieved\n- RPL option.\n+\\param[out] rpl_option Pointer to the structure to hold the retrieved RPL option.\n+\\returns the header length in bytes.\n*/\nuint8_t iphc_retrieveIPv6HopByHopHeader(\nOpenQueueEntry_t* msg,\n" }, { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/forwarding.c", "new_path": "openstack/03b-IPv6/forwarding.c", "diff": "@@ -225,8 +225,8 @@ void forwarding_sendDone(OpenQueueEntry_t* msg, owerror_t error) {\n\\brief Indicates a packet was received.\n\\param[in,out] msg The packet just sent.\n-\\param[in] ipv6_header The information contained in the IPv6 header.\n-\\param[in] ipv6_hop_header The hop-by-hop header present in the packet.\n+\\param[in] ipv6_outer_header The information contained in the IPv6 header.\n+\\param[in] ipv6_inner_header The hop-by-hop header present in the packet.\n\\param[in] rpl_option The hop-by-hop options present in the packet.\n*/\nvoid forwarding_receive(\n@@ -393,7 +393,8 @@ void forwarding_getNextHop(open_addr_t* destination128b, open_addr_t* addressToW\n\\brief Send a packet using the routing table to find the next hop.\n\\param[in,out] msg The packet to send.\n-\\param[in] ipv6_header The packet's IPv6 header.\n+\\param[in] ipv6_outer_header The packet's IPv6 outer header.\n+\\param[in] ipv6_inner_header The packet's IPv6 inner header.\n\\param[in] rpl_option The hop-by-hop option to add in this packet.\n\\param[in] flow_label The flowlabel to add in the 6LoWPAN header.\n\\param[in] fw_SendOrfw_Rcv The packet is originating from this mote\n@@ -446,7 +447,9 @@ How to process the routing header is detailed in\nhttp://tools.ietf.org/html/rfc6554#page-9.\n\\param[in,out] msg The packet to send.\n-\\param[in] ipv6_header The packet's IPv6 header.\n+\\param[in] ipv6_outer_header The packet's IPv6 outer header.\n+\\param[in] ipv6_inner_header The packet's IPv6 inner header.\n+\\param[in] rpl_option The hop-by-hop option to add in this packet.\n*/\nowerror_t forwarding_send_internal_SourceRouting(\nOpenQueueEntry_t* msg,\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-637. Fixed inconsitencies in doxygen comments.
491,595
19.04.2017 16:41:58
-7,200
6aea6b96d260eabce41e54aa72a7040ff33f3908
update sixtop.c.
[ { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -144,13 +144,6 @@ void sixtop_init() {\n);\nsixtop_vars.timeoutTimerId = opentimers2_create();\n- opentimers2_scheduleAbsolute(\n- sixtop_vars.timeoutTimerId,\n- SIX2SIX_TIMEOUT_MS,\n- opentimers2_getValue(sixtop_vars.timeoutTimerId),\n- TIME_MS,\n- sixtop_timeout_timer_cb\n- );\n}\nvoid sixtop_setKaPeriod(uint16_t kaPeriod) {\n@@ -459,12 +452,6 @@ void task_sixtopNotifSendDone() {\n// not busy sending EB anymore\nsixtop_vars.busySendingEB = FALSE;\n- opentimers2_scheduleRelative(\n- sixtop_vars.ebSendingTimerId,\n- (sixtop_vars.ebPeriod-EBPERIOD_RANDOM_RANG+(openrandom_get16b()%(2*EBPERIOD_RANDOM_RANG))),\n- TIME_MS,\n- sixtop_sendingEb_timer_cb\n- );\n} else {\n// this is a KA\n@@ -474,15 +461,6 @@ void task_sixtopNotifSendDone() {\n// discard packets\nopenqueue_freePacketBuffer(msg);\n- // restart a random timer\n- sixtop_vars.periodMaintenance = 872+(openrandom_get16b()&0xff);\n- opentimers2_scheduleAbsolute(\n- sixtop_vars.maintenanceTimerId,\n- sixtop_vars.periodMaintenance,\n- opentimers2_getValue(sixtop_vars.maintenanceTimerId),\n- TIME_MS,\n- sixtop_maintenance_timer_cb\n- );\nbreak;\ncase COMPONENT_SIXTOP_RES:\n@@ -691,6 +669,15 @@ The body of this function executes one of the MAC management task.\n*/\nvoid timer_sixtop_management_fired(void) {\n+ sixtop_vars.periodMaintenance = 872+(openrandom_get16b()&0xff);\n+ opentimers2_scheduleAbsolute(\n+ sixtop_vars.maintenanceTimerId,\n+ sixtop_vars.periodMaintenance,\n+ opentimers2_getValue(sixtop_vars.maintenanceTimerId),\n+ TIME_MS,\n+ sixtop_maintenance_timer_cb\n+ );\n+\nsixtop_vars.mgtTaskCounter = (sixtop_vars.mgtTaskCounter+1)%MAINTENANCE_PERIOD;\nswitch (sixtop_vars.mgtTaskCounter) {\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. update sixtop.c.
491,595
19.04.2017 16:45:41
-7,200
429d0a84e3b67f19ce891a56b279acc725748aea
correct the reference time to calculate the next to be expired timer.
[ { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.c", "new_path": "drivers/common/opentimers2.c", "diff": "@@ -176,8 +176,8 @@ void opentimers2_scheduleAbsolute(opentimers2_id_t id,\ntimerGap = MAX_TICKS_NUMBER;\nfor (i=0;i<MAX_NUM_TIMERS;i++){\nif (opentimers2_vars.timersBuf[i].isrunning){\n- if (opentimers2_vars.timersBuf[i].currentCompareValue - opentimers2_vars.currentTimeout < timerGap){\n- timerGap = opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.currentTimeout;\n+ if (opentimers2_vars.timersBuf[i].currentCompareValue - opentimers2_vars.lastTimeout < timerGap){\n+ timerGap = opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.lastTimeout;\nidToSchedule = i;\n}\n}\n@@ -281,12 +281,14 @@ void opentimers2_timer_callback(void){\nopentimers2_vars.timersBuf[i].callback();\n}\n}\n+ // update lastTimeout\n+ opentimers2_vars.lastTimeout = opentimers2_vars.currentTimeout;\n// 3. find the next timer to be fired\nfor (i=0;i<MAX_NUM_TIMERS;i++){\nif (opentimers2_vars.timersBuf[i].isrunning==TRUE){\n- if (opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.currentTimeout<timerGap){\n- timerGap = opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.currentTimeout;\n+ if (opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.lastTimeout<timerGap){\n+ timerGap = opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.lastTimeout;\nidToSchedule = i;\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.h", "new_path": "drivers/common/opentimers2.h", "diff": "@@ -44,6 +44,7 @@ typedef struct {\nopentimers2_t timersBuf[MAX_NUM_TIMERS];\nbool running;\nuint32_t currentTimeout; // current timeout, in ticks\n+ uint32_t lastTimeout; // last timeout, in ticks. This is the reference time to calculate the next to be expired timer.\n} opentimers2_vars_t;\n//=========================== prototypes ======================================\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. correct the reference time to calculate the next to be expired timer.
491,595
20.04.2017 16:45:49
-7,200
b3be3b3e167ad91656cfb74b07478d50c67ed1eb
give priority of each timer to deal with timer schedule threshold problem. section 13.2 at Page 363:
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/board_info.h", "new_path": "bsp/boards/openmote-cc2538/board_info.h", "diff": "#define NUMSENSORS 7\n+//===== sctimer scheduling\n+// If the timer compared value is to set to TIMERTHRESHOLD ticks (or less) later than\n+// current timer count, the compared interrupt will be missed.\n+// The value for C2538 is 5 as datasheet indicate, in case the interrupt routine takes\n+// long (should avoid this case), set it larger than 5\n+#define TIMERTHRESHOLD 10\n+\n//=========================== typedef ========================================\n//=========================== variables =======================================\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/openserial.c", "new_path": "drivers/common/openserial.c", "diff": "@@ -173,7 +173,7 @@ owerror_t openserial_printCritical(\nleds_error_blink();\n// schedule for the mote to reboot in 10s\n- id = opentimers2_create();\n+ id = opentimers2_create(0);\nreference = opentimers2_getValue(id);\nopentimers2_scheduleAbsolute(\nid, // timerId\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.c", "new_path": "drivers/common/opentimers2.c", "diff": "@@ -41,11 +41,12 @@ void opentimers2_init(){\ncreate a timer by reserving an Id for the timer.\n*/\n-opentimers2_id_t opentimers2_create(void){\n+opentimers2_id_t opentimers2_create(uint8_t priority){\nuint8_t id;\nfor (id=0;id<MAX_NUM_TIMERS;id++){\nif (opentimers2_vars.timersBuf[id].isUsed == FALSE){\nopentimers2_vars.timersBuf[id].isUsed = TRUE;\n+ opentimers2_vars.timersBuf[id].priority = priority;\nreturn id;\n}\n}\n@@ -75,6 +76,7 @@ void opentimers2_scheduleRelative(opentimers2_id_t id,\nuint8_t idToSchedule;\nuint32_t durationTicks;\nuint32_t timerGap;\n+ uint32_t tempTimerGap;\n// 1. make sure the timer exist\nfor (i=0;i<MAX_NUM_TIMERS;i++){\nif (opentimers2_vars.timersBuf[i].isUsed && i == id){\n@@ -106,13 +108,38 @@ void opentimers2_scheduleRelative(opentimers2_id_t id,\nopentimers2_vars.timersBuf[id].callback = cb;\n// 3. find the next timer to fire\n- timerGap = MAX_TICKS_NUMBER;\n- for (i=0;i<MAX_NUM_TIMERS;i++){\n+ timerGap = opentimers2_vars.timersBuf[0].currentCompareValue-opentimers2_vars.lastTimeout;\n+ idToSchedule = 0;\n+ for (i=1;i<MAX_NUM_TIMERS;i++){\nif (opentimers2_vars.timersBuf[i].isrunning){\n- if (opentimers2_vars.timersBuf[i].currentCompareValue - opentimers2_vars.currentTimeout < timerGap){\n- timerGap = opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.currentTimeout;\n+ tempTimerGap = opentimers2_vars.timersBuf[i].currentCompareValue - opentimers2_vars.lastTimeout;\n+ if (tempTimerGap < timerGap){\n+ // if a timer \"i\" has low priority but has compare value less than\n+ // candidate timer \"idToSchedule\" more than TIMERTHRESHOLD ticks,\n+ // replace candidate timer by this timer \"i\".\n+ if (opentimers2_vars.timersBuf[i].priority < opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (timerGap-tempTimerGap > TIMERTHRESHOLD){\n+ timerGap = tempTimerGap;\nidToSchedule = i;\n}\n+ } else {\n+ // a timer \"i\" has higher priority than candidate timer \"idToSchedule\"\n+ // and compare value less than candidate timer replace candidate\n+ // timer by timer \"i\".\n+ timerGap = tempTimerGap;\n+ idToSchedule = i;\n+ }\n+ } else {\n+ // if a timer \"i\" has higher priority than candidate timer \"idToSchedule\"\n+ // and its compare value is larger than timer \"i\" no more than TIMERTHRESHOLD ticks,\n+ // replace candidate timer by timer \"i\".\n+ if (opentimers2_vars.timersBuf[i].priority > opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (tempTimerGap - timerGap < TIMERTHRESHOLD){\n+ timerGap = tempTimerGap;\n+ idToSchedule = 1;\n+ }\n+ }\n+ }\n}\n}\n@@ -142,6 +169,7 @@ void opentimers2_scheduleAbsolute(opentimers2_id_t id,\nuint8_t idToSchedule;\nuint32_t durationTicks;\nuint32_t timerGap;\n+ uint32_t tempTimerGap;\n// 1. make sure the timer exist\nfor (i=0;i<MAX_NUM_TIMERS;i++){\nif (opentimers2_vars.timersBuf[i].isUsed && i == id){\n@@ -173,13 +201,38 @@ void opentimers2_scheduleAbsolute(opentimers2_id_t id,\nopentimers2_vars.timersBuf[id].callback = cb;\n// 3. find the next timer to fire\n- timerGap = MAX_TICKS_NUMBER;\n- for (i=0;i<MAX_NUM_TIMERS;i++){\n+ timerGap = opentimers2_vars.timersBuf[0].currentCompareValue-opentimers2_vars.lastTimeout;\n+ idToSchedule = 0;\n+ for (i=1;i<MAX_NUM_TIMERS;i++){\nif (opentimers2_vars.timersBuf[i].isrunning){\n- if (opentimers2_vars.timersBuf[i].currentCompareValue - opentimers2_vars.lastTimeout < timerGap){\n- timerGap = opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.lastTimeout;\n+ tempTimerGap = opentimers2_vars.timersBuf[i].currentCompareValue - opentimers2_vars.lastTimeout;\n+ if (tempTimerGap < timerGap){\n+ // if a timer \"i\" has low priority but has compare value less than\n+ // candidate timer \"idToSchedule\" more than TIMERTHRESHOLD ticks,\n+ // replace candidate timer by this timer \"i\".\n+ if (opentimers2_vars.timersBuf[i].priority < opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (timerGap-tempTimerGap > TIMERTHRESHOLD){\n+ timerGap = tempTimerGap;\n+ idToSchedule = i;\n+ }\n+ } else {\n+ // a timer \"i\" has higher priority than candidate timer \"idToSchedule\"\n+ // and compare value less than candidate timer replace candidate\n+ // timer by timer \"i\".\n+ timerGap = tempTimerGap;\nidToSchedule = i;\n}\n+ } else {\n+ // if a timer \"i\" has higher priority than candidate timer \"idToSchedule\"\n+ // and its compare value is larger than timer \"i\" no more than TIMERTHRESHOLD ticks,\n+ // replace candidate timer by timer \"i\".\n+ if (opentimers2_vars.timersBuf[i].priority > opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (tempTimerGap - timerGap < TIMERTHRESHOLD){\n+ timerGap = tempTimerGap;\n+ idToSchedule = 1;\n+ }\n+ }\n+ }\n}\n}\n@@ -260,37 +313,98 @@ and call the callback recorded for that timer.\n*/\nvoid opentimers2_timer_callback(void){\nuint8_t i;\n+ uint8_t j;\n+ uint8_t idToCallCB;\nuint8_t idToSchedule;\n- uint32_t timerGap=MAX_TICKS_NUMBER;\n+ uint32_t timerGap;\n+ uint32_t tempTimerGap;\n+ uint32_t tempLastTimeout = opentimers2_vars.currentTimeout;\n// 1. find the expired timer\nfor (i=0;i<MAX_NUM_TIMERS;i++){\nif (opentimers2_vars.timersBuf[i].isrunning==TRUE){\n- if (opentimers2_vars.currentTimeout-opentimers2_vars.timersBuf[i].currentCompareValue < MAX_DURATION_ISR){\n+ // all timers in the past within TIMERTHRESHOLD ticks\n+ // (probably with low priority) will mared as Expired.\n+ if (opentimers2_vars.currentTimeout-opentimers2_vars.timersBuf[i].currentCompareValue < TIMERTHRESHOLD){\n// this timer expired, mark as expired\nopentimers2_vars.timersBuf[i].hasExpired = TRUE;\n+ // find the fired timer who has the smallest currentTimeout as last Timeout\n+ if (tempLastTimeout>opentimers2_vars.timersBuf[i].currentCompareValue){\n+ tempLastTimeout = opentimers2_vars.timersBuf[i].currentCompareValue;\n+ }\n}\n}\n}\n+ // update lastTimeout\n+ opentimers2_vars.lastTimeout = tempLastTimeout;\n+\n// 2. call the callback of expired timers\nfor (i=0;i<MAX_NUM_TIMERS;i++){\n- if (opentimers2_vars.timersBuf[i].hasExpired == TRUE){\n- opentimers2_vars.timersBuf[i].isrunning = FALSE;\n- opentimers2_vars.timersBuf[i].lastCompareValue = opentimers2_vars.timersBuf[i].currentCompareValue;\n- opentimers2_vars.timersBuf[i].hasExpired = FALSE;\n- opentimers2_vars.timersBuf[i].callback();\n+ idToCallCB = TOO_MANY_TIMERS_ERROR;\n+ // find out the timer expired with highest priority\n+ for (j=0;j<MAX_NUM_TIMERS;j++){\n+ if (opentimers2_vars.timersBuf[j].hasExpired == TRUE){\n+ if (idToCallCB==TOO_MANY_TIMERS_ERROR){\n+ idToCallCB = j;\n+ } else {\n+ if (opentimers2_vars.timersBuf[j].priority>opentimers2_vars.timersBuf[idToCallCB].priority){\n+ idToCallCB = j;\n+ }\n+ }\n+ }\n+ }\n+ if (idToCallCB==TOO_MANY_TIMERS_ERROR){\n+ // no more timer expired\n+ break;\n+ } else {\n+ // call all timers expired having the same priority with timer idToCallCB\n+ for (j=0;j<MAX_NUM_TIMERS;j++){\n+ if (\n+ opentimers2_vars.timersBuf[j].hasExpired == TRUE &&\n+ opentimers2_vars.timersBuf[j].priority == opentimers2_vars.timersBuf[idToCallCB].priority\n+ ){\n+ opentimers2_vars.timersBuf[j].isrunning = FALSE;\n+ opentimers2_vars.timersBuf[j].lastCompareValue = opentimers2_vars.timersBuf[j].currentCompareValue;\n+ opentimers2_vars.timersBuf[j].hasExpired = FALSE;\n+ opentimers2_vars.timersBuf[j].callback();\n+ }\n+ }\n}\n}\n- // update lastTimeout\n- opentimers2_vars.lastTimeout = opentimers2_vars.currentTimeout;\n// 3. find the next timer to be fired\n- for (i=0;i<MAX_NUM_TIMERS;i++){\n- if (opentimers2_vars.timersBuf[i].isrunning==TRUE){\n- if (opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.lastTimeout<timerGap){\n- timerGap = opentimers2_vars.timersBuf[i].currentCompareValue-opentimers2_vars.lastTimeout;\n+ timerGap = opentimers2_vars.timersBuf[0].currentCompareValue-opentimers2_vars.lastTimeout;\n+ idToSchedule = 0;\n+ for (i=1;i<MAX_NUM_TIMERS;i++){\n+ if (opentimers2_vars.timersBuf[i].isrunning){\n+ tempTimerGap = opentimers2_vars.timersBuf[i].currentCompareValue - opentimers2_vars.lastTimeout;\n+ if (tempTimerGap < timerGap){\n+ // if a timer \"i\" has low priority but has compare value less than\n+ // candidate timer \"idToSchedule\" more than TIMERTHRESHOLD ticks,\n+ // replace candidate timer by this timer \"i\".\n+ if (opentimers2_vars.timersBuf[i].priority < opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (timerGap-tempTimerGap > TIMERTHRESHOLD){\n+ timerGap = tempTimerGap;\n+ idToSchedule = i;\n+ }\n+ } else {\n+ // a timer \"i\" has higher priority than candidate timer \"idToSchedule\"\n+ // and compare value less than candidate timer replace candidate\n+ // timer by timer \"i\".\n+ timerGap = tempTimerGap;\nidToSchedule = i;\n}\n+ } else {\n+ // if a timer \"i\" has higher priority than candidate timer \"idToSchedule\"\n+ // and its compare value is larger than timer \"i\" no more than TIMERTHRESHOLD ticks,\n+ // replace candidate timer by timer \"i\".\n+ if (opentimers2_vars.timersBuf[i].priority > opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (tempTimerGap - timerGap < TIMERTHRESHOLD){\n+ timerGap = tempTimerGap;\n+ idToSchedule = 1;\n+ }\n+ }\n+ }\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.h", "new_path": "drivers/common/opentimers2.h", "diff": "@@ -35,6 +35,7 @@ typedef struct {\nbool isrunning; // is running?\nbool isUsed; // true when this entry is occupied\nbool hasExpired; // in case there are more than one interrupt occur at same time\n+ uint8_t priority; // high priority timer could take over the compare timer scheduled early than it for TIMERTHRESHOLD ticks.\nopentimers2_cbt callback; // function to call when elapses\n} opentimers2_t;\n@@ -50,7 +51,7 @@ typedef struct {\n//=========================== prototypes ======================================\nvoid opentimers2_init(void);\n-opentimers2_id_t opentimers2_create(void);\n+opentimers2_id_t opentimers2_create(uint8_t priority);\nvoid opentimers2_scheduleRelative(opentimers2_id_t id,\nuint32_t duration,\ntime_type_t uint_type,\n" }, { "change_type": "MODIFY", "old_path": "openapps/cexample/cexample.c", "new_path": "openapps/cexample/cexample.c", "diff": "@@ -52,7 +52,7 @@ void cexample_init() {\nopencoap_register(&cexample_vars.desc);\n- cexample_vars.timerId = opentimers2_create();\n+ cexample_vars.timerId = opentimers2_create(0);\nopentimers2_scheduleAbsolute(cexample_vars.timerId,\nCEXAMPLEPERIOD,\nopentimers2_getValue(cexample_vars.timerId),\n" }, { "change_type": "MODIFY", "old_path": "openapps/csensors/csensors.c", "new_path": "openapps/csensors/csensors.c", "diff": "@@ -396,7 +396,7 @@ void csensors_setPeriod(uint32_t period,\n);\n}\n} else {\n- csensors_vars.csensors_resource[id].timerId = opentimers2_create();\n+ csensors_vars.csensors_resource[id].timerId = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\ncsensors_vars.csensors_resource[id].timerId,\n(uint32_t)((period*openrandom_get16b())/0xffff),\n" }, { "change_type": "MODIFY", "old_path": "openapps/cstorm/cstorm.c", "new_path": "openapps/cstorm/cstorm.c", "diff": "@@ -54,7 +54,7 @@ void cstorm_init(void) {\n//comment : not running by default\ncstorm_vars.period = 6553;\n- cstorm_vars.timerId = opentimers2_create();\n+ cstorm_vars.timerId = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\ncstorm_vars.timerId,\ncstorm_vars.period,\n" }, { "change_type": "MODIFY", "old_path": "openapps/uinject/uinject.c", "new_path": "openapps/uinject/uinject.c", "diff": "@@ -32,7 +32,7 @@ void uinject_init() {\nuinject_vars.period = UINJECT_PERIOD_MS;\n// start periodic timer\n- uinject_vars.timerId = opentimers2_create();\n+ uinject_vars.timerId = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\nuinject_vars.period,\nUINJECT_PERIOD_MS,\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -145,7 +145,7 @@ void ieee154e_init() {\nradio_setStartFrameCb(ieee154e_startOfFrame);\nradio_setEndFrameCb(ieee154e_endOfFrame);\n// have the radio start its timer\n- ieee154e_vars.timerId = opentimers2_create();\n+ ieee154e_vars.timerId = opentimers2_create(255);\nopentimers2_scheduleAbsolute(\nieee154e_vars.timerId, // timerId\nieee154e_vars.slotDuration, // duration\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -125,7 +125,7 @@ void sixtop_init() {\nsixtop_vars.isResponseEnabled = TRUE;\nsixtop_vars.handler = SIX_HANDLER_NONE;\n- sixtop_vars.ebSendingTimerId = opentimers2_create();\n+ sixtop_vars.ebSendingTimerId = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\nsixtop_vars.ebSendingTimerId,\n(sixtop_vars.ebPeriod-EBPERIOD_RANDOM_RANG+(openrandom_get16b()%(2*EBPERIOD_RANDOM_RANG))),\n@@ -134,7 +134,7 @@ void sixtop_init() {\nsixtop_sendingEb_timer_cb\n);\n- sixtop_vars.maintenanceTimerId = opentimers2_create();\n+ sixtop_vars.maintenanceTimerId = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\nsixtop_vars.maintenanceTimerId,\nsixtop_vars.periodMaintenance,\n@@ -143,7 +143,7 @@ void sixtop_init() {\nsixtop_maintenance_timer_cb\n);\n- sixtop_vars.timeoutTimerId = opentimers2_create();\n+ sixtop_vars.timeoutTimerId = opentimers2_create(0);\n}\nvoid sixtop_setKaPeriod(uint16_t kaPeriod) {\n" }, { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/icmpv6rpl.c", "new_path": "openstack/03b-IPv6/icmpv6rpl.c", "diff": "@@ -83,7 +83,7 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.dioPeriod = TIMER_DIO_TIMEOUT;\ndioPeriod = icmpv6rpl_vars.dioPeriod - 0x80 + (openrandom_get16b()&0xff);\n- icmpv6rpl_vars.timerIdDIO = opentimers2_create();\n+ icmpv6rpl_vars.timerIdDIO = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\nicmpv6rpl_vars.timerIdDIO,\ndioPeriod,\n@@ -133,7 +133,7 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.daoPeriod = TIMER_DAO_TIMEOUT;\ndaoPeriod = icmpv6rpl_vars.daoPeriod - 0x80 + (openrandom_get16b()&0xff);\n- icmpv6rpl_vars.timerIdDAO = opentimers2_create();\n+ icmpv6rpl_vars.timerIdDAO = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\nicmpv6rpl_vars.timerIdDAO,\ndaoPeriod,\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/opentcp.c", "new_path": "openstack/04-TRAN/opentcp.c", "diff": "@@ -690,7 +690,7 @@ void tcp_change_state(uint8_t new_tcp_state) {\n}\n} else {\nif (tcp_vars.timerStarted==FALSE) {\n- tcp_vars.timerId = opentimers2_create();\n+ tcp_vars.timerId = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\ntcp_vars.timerId,\nTCP_TIMEOUT,\n" }, { "change_type": "MODIFY", "old_path": "projects/common/02drv_opentimers2/02drv_opentimers2.c", "new_path": "projects/common/02drv_opentimers2/02drv_opentimers2.c", "diff": "@@ -24,9 +24,9 @@ radio and sync). When you run the application, you should see the LEDs\n//=========================== defines =========================================\n-#define APP_DLY_TIMER0_ms 400\n-#define APP_DLY_TIMER1_ms 800\n-#define APP_DLY_TIMER2_ms 1600\n+#define APP_DLY_TIMER0_ticks 16384 // half second @ 32kHz\n+#define APP_DLY_TIMER1_ticks 16385 // a little bit more than half second @ 32kHz\n+#define APP_DLY_TIMER2_ticks 32768 // one second @ 32kHz\n//=========================== variables =======================================\n@@ -57,30 +57,30 @@ int mote_main(void) {\nopentimers2_init();\nreference = sctimer_readCounter();\n- app_vars.timer0 = opentimers2_create();\n+ app_vars.timer0 = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\napp_vars.timer0, // timerId\n- APP_DLY_TIMER0_ms, // duration\n+ APP_DLY_TIMER0_ticks, // duration\nreference, // reference\n- TIME_MS, // timetype\n+ TIME_TICS, // timetype\ncb_timer0 // callback\n);\n- app_vars.timer1 = opentimers2_create();\n+ app_vars.timer1 = opentimers2_create(255);\nopentimers2_scheduleAbsolute(\napp_vars.timer1, // timerId\n- APP_DLY_TIMER1_ms, // duration\n+ APP_DLY_TIMER1_ticks, // duration\nreference, // reference\n- TIME_MS, // timetype\n+ TIME_TICS, // timetype\ncb_timer1 // callback\n);\n- app_vars.timer2 = opentimers2_create();\n+ app_vars.timer2 = opentimers2_create(0);\nopentimers2_scheduleAbsolute(\napp_vars.timer2, // timerId\n- APP_DLY_TIMER2_ms, // duration\n+ APP_DLY_TIMER2_ticks, // duration\nreference, // reference\n- TIME_MS, // timetype\n+ TIME_TICS, // timetype\ncb_timer2 // callback\n);\n@@ -96,8 +96,8 @@ void cb_timer0(void) {\n// re-schedule refer to previous scheduled value\nopentimers2_scheduleRelative(\napp_vars.timer0, // timerId\n- APP_DLY_TIMER0_ms, // duration\n- TIME_MS, // timetype\n+ APP_DLY_TIMER0_ticks, // duration\n+ TIME_TICS, // timetype\ncb_timer0 // callback\n);\n}\n@@ -107,8 +107,8 @@ void cb_timer1(void) {\n// re-schedule refer to previous scheduled value\nopentimers2_scheduleRelative(\napp_vars.timer1, // timerId\n- APP_DLY_TIMER1_ms, // duration\n- TIME_MS, // timetype\n+ APP_DLY_TIMER1_ticks, // duration\n+ TIME_TICS, // timetype\ncb_timer1 // callback\n);\n}\n@@ -118,8 +118,8 @@ void cb_timer2(void) {\n// re-schedule refer to previous scheduled value\nopentimers2_scheduleRelative(\napp_vars.timer2, // timerId\n- APP_DLY_TIMER2_ms, // duration\n- TIME_MS, // timetype\n+ APP_DLY_TIMER2_ticks, // duration\n+ TIME_TICS, // timetype\ncb_timer2 // callback\n);\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp", "new_path": "projects/openmote-cc2538/03oos_openwsn/03oos_openwsn.ewp", "diff": "<option>\n<name>OOCOutputFormat</name>\n<version>2</version>\n- <state>2</state>\n+ <state>1</state>\n</option>\n<option>\n<name>OCOutputOverride</name>\n</option>\n<option>\n<name>OOCOutputFile</name>\n- <state>03oos_openwsn.bin</state>\n+ <state>03oos_openwsn.hex</state>\n</option>\n<option>\n<name>OOCCommandLineProducer</name>\n</option>\n<option>\n<name>OOCObjCopyEnable</name>\n- <state>0</state>\n+ <state>1</state>\n</option>\n</data>\n</settings>\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. give priority of each timer to deal with timer schedule threshold problem. section 13.2 at Page 363: http://www.ti.com/lit/ug/swru319c/swru319c.pdf
491,595
20.04.2017 20:45:23
-7,200
3eadcee5484bc08193245d146240c7a9b343d248
when the timer is already late, schedule the ISR manually immediately.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/sctimer.c", "new_path": "bsp/boards/openmote-cc2538/sctimer.c", "diff": "#include \"debugpins.h\"\n#include <headers/hw_ints.h>\n+// ========================== define ==========================================\n+\n+#define TIMERLOOP_THRESHOLD 0xffffff // 511 seconds @ 32768Hz clock\n+\n// ========================== variable ========================================\ntypedef struct {\n@@ -45,8 +49,14 @@ void sctimer_set_callback(sctimer_cbt cb){\n*/\nvoid sctimer_setCompare(uint32_t val){\nIntEnable(INT_SMTIM);\n+ if (SleepModeTimerCountGet() - val < TIMERLOOP_THRESHOLD){\n+ // the timer is already late, schedule the ISR right now manually\n+ IntPendSet(INT_SMTIM);\n+ } else {\n+ // schedule the timer at val\nSleepModeTimerCompareSet(val);\n}\n+}\n/**\n\\brief Return the current value of the timer's counter.\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. when the timer is already late, schedule the ISR manually immediately.
491,595
21.04.2017 15:50:24
-7,200
3a1df1e0e5438f3d7d7fa5213ea3139b9ddbb4dc
use the right slot duration variable.
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -1924,7 +1924,7 @@ port_INLINE void activity_ri5(PORT_RADIOTIMER_WIDTH capturedTime) {\n// radiotimer_schedule(DURATION_rt5);\n#endif\n} else {\n- // synchronize to the received packet iif I'm not a DAGroot and this is my preferred parent\n+ // synchronize to the received packet if I'm not a DAGroot and this is my preferred parent\nif (idmanager_getIsDAGroot()==FALSE && icmpv6rpl_isPreferredParent(&(ieee154e_vars.dataReceived->l2_nextORpreviousHop))) {\nsynchronizePacket(ieee154e_vars.syncCapturedTime);\n}\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/processIE.c", "new_path": "openstack/02b-MAChigh/processIE.c", "diff": "@@ -181,12 +181,9 @@ port_INLINE uint8_t processIE_prependTSCHTimeslotIE(OpenQueueEntry_t* pkt){\nuint8_t len;\nmlme_IE_ht mlme_subHeader;\n- uint16_t duration;\n-\nlen = 0;\n- duration = ieee154e_getSlotDuration();\n- if (duration==328){\n+ if (TsSlotDuration==328){\n// reserve space for timeslot template ID\npacketfunctions_reserveHeaderSize(pkt,sizeof(uint8_t));\n// write header\n@@ -196,8 +193,8 @@ port_INLINE uint8_t processIE_prependTSCHTimeslotIE(OpenQueueEntry_t* pkt){\n// reserve space for timeslot template ID\npacketfunctions_reserveHeaderSize(pkt,sizeof(uint16_t));\n// write header\n- pkt->payload[0] = (uint8_t)(duration & 0x00ff);\n- pkt->payload[1] = (uint8_t)((duration>>8) & 0x00ff);\n+ pkt->payload[0] = (uint8_t)( TsSlotDuration & 0x00ff);\n+ pkt->payload[1] = (uint8_t)((TsSlotDuration>>8) & 0x00ff);\n// reserve space for timeslot template ID\npacketfunctions_reserveHeaderSize(pkt,sizeof(uint8_t));\n// write header\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. use the right slot duration variable.
491,595
21.04.2017 19:23:52
-7,200
d57c761620a625a18d3c1469bf88d49d4432b6aa
re-schedule timers relatively inside the callback.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/radio.c", "new_path": "bsp/boards/openmote-cc2538/radio.c", "diff": "@@ -440,6 +440,8 @@ void radio_isr_internal(void) {\nvolatile PORT_TIMER_WIDTH capturedTime;\nuint8_t irq_status0,irq_status1;\n+ debugpins_isr_set();\n+\n// capture the time\ncapturedTime = sctimer_readCounter();\n@@ -461,6 +463,7 @@ void radio_isr_internal(void) {\nif (radio_vars.startFrame_cb!=NULL) {\n// call the callback\nradio_vars.startFrame_cb(capturedTime);\n+ debugpins_isr_clr();\n// kick the OS\nreturn;\n} else {\n@@ -475,6 +478,7 @@ void radio_isr_internal(void) {\nif (radio_vars.endFrame_cb!=NULL) {\n// call the callback\nradio_vars.endFrame_cb(capturedTime);\n+ debugpins_isr_clr();\n// kick the OS\nreturn;\n} else {\n@@ -489,6 +493,7 @@ void radio_isr_internal(void) {\nif (radio_vars.endFrame_cb!=NULL) {\n// call the callback\nradio_vars.endFrame_cb(capturedTime);\n+ debugpins_isr_clr();\n// kick the OS\nreturn;\n} else {\n@@ -504,12 +509,14 @@ void radio_isr_internal(void) {\nif (radio_vars.endFrame_cb!=NULL) {\n// call the callback\nradio_vars.endFrame_cb(capturedTime);\n+ debugpins_isr_clr();\n// kick the OS\nreturn;\n} else {\nwhile(1);\n}\n}\n+ debugpins_isr_clr();\nreturn;\n}\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -643,10 +643,23 @@ owerror_t sixtop_send_internal(\n// timer interrupt callbacks\nvoid sixtop_sendingEb_timer_cb(void){\nscheduler_push_task(timer_sixtop_sendEb_fired,TASKPRIO_SIXTOP);\n+ opentimers2_scheduleRelative(\n+ sixtop_vars.ebSendingTimerId,\n+ (sixtop_vars.ebPeriod-EBPERIOD_RANDOM_RANG+(openrandom_get16b()%(2*EBPERIOD_RANDOM_RANG))),\n+ TIME_MS,\n+ sixtop_sendingEb_timer_cb\n+ );\n}\nvoid sixtop_maintenance_timer_cb(void) {\nscheduler_push_task(timer_sixtop_management_fired,TASKPRIO_SIXTOP);\n+ sixtop_vars.periodMaintenance = 872+(openrandom_get16b()&0xff);\n+ opentimers2_scheduleRelative(\n+ sixtop_vars.maintenanceTimerId,\n+ sixtop_vars.periodMaintenance,\n+ TIME_MS,\n+ sixtop_maintenance_timer_cb\n+ );\n}\nvoid sixtop_timeout_timer_cb(void) {\n@@ -669,15 +682,6 @@ The body of this function executes one of the MAC management task.\n*/\nvoid timer_sixtop_management_fired(void) {\n- sixtop_vars.periodMaintenance = 872+(openrandom_get16b()&0xff);\n- opentimers2_scheduleAbsolute(\n- sixtop_vars.maintenanceTimerId,\n- sixtop_vars.periodMaintenance,\n- opentimers2_getValue(sixtop_vars.maintenanceTimerId),\n- TIME_MS,\n- sixtop_maintenance_timer_cb\n- );\n-\nsixtop_vars.mgtTaskCounter = (sixtop_vars.mgtTaskCounter+1)%MAINTENANCE_PERIOD;\nswitch (sixtop_vars.mgtTaskCounter) {\n@@ -704,13 +708,6 @@ port_INLINE void sixtop_sendEB() {\nOpenQueueEntry_t* eb;\nuint8_t len;\n- opentimers2_scheduleRelative(\n- sixtop_vars.ebSendingTimerId,\n- (sixtop_vars.ebPeriod-EBPERIOD_RANDOM_RANG+(openrandom_get16b()%(2*EBPERIOD_RANDOM_RANG))),\n- TIME_MS,\n- sixtop_sendingEb_timer_cb\n- );\n-\nlen = 0;\nif ((ieee154e_isSynch()==FALSE) || (icmpv6rpl_getMyDAGrank()==DEFAULTDAGRANK)){\n" }, { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/icmpv6rpl.c", "new_path": "openstack/03b-IPv6/icmpv6rpl.c", "diff": "@@ -520,6 +520,13 @@ void icmpv6rpl_killPreferredParent() {\n*/\nvoid icmpv6rpl_timer_DIO_cb(void) {\nscheduler_push_task(icmpv6rpl_timer_DIO_task,TASKPRIO_RPL);\n+ // arm the DIO timer with this new value\n+ opentimers2_scheduleRelative(\n+ icmpv6rpl_vars.timerIdDIO,\n+ icmpv6rpl_vars.dioPeriod - 0x80 + (openrandom_get16b()&0xff),\n+ TIME_MS,\n+ icmpv6rpl_timer_DIO_cb\n+ );\n}\n/**\n@@ -528,18 +535,7 @@ void icmpv6rpl_timer_DIO_cb(void) {\n\\note This function is executed in task context, called by the scheduler.\n*/\nvoid icmpv6rpl_timer_DIO_task() {\n- uint32_t dioPeriod;\n- // send DIO\nsendDIO();\n-\n- // arm the DIO timer with this new value\n- dioPeriod = icmpv6rpl_vars.dioPeriod - 0x80 + (openrandom_get16b()&0xff);\n- opentimers2_scheduleRelative(\n- icmpv6rpl_vars.timerIdDIO,\n- dioPeriod,\n- TIME_MS,\n- icmpv6rpl_timer_DIO_task\n- );\n}\n/**\n@@ -634,6 +630,13 @@ void sendDIO() {\n*/\nvoid icmpv6rpl_timer_DAO_cb(void) {\nscheduler_push_task(icmpv6rpl_timer_DAO_task,TASKPRIO_RPL);\n+ // arm the DAO timer with this new value\n+ opentimers2_scheduleRelative(\n+ icmpv6rpl_vars.timerIdDAO,\n+ icmpv6rpl_vars.daoPeriod - 0x80 + (openrandom_get16b()&0xff),\n+ TIME_MS,\n+ icmpv6rpl_timer_DAO_cb\n+ );\n}\n/**\n@@ -642,19 +645,7 @@ void icmpv6rpl_timer_DAO_cb(void) {\n\\note This function is executed in task context, called by the scheduler.\n*/\nvoid icmpv6rpl_timer_DAO_task() {\n- uint32_t daoPeriod;\n-\n- // send DAO\nsendDAO();\n-\n- // arm the DAO timer with this new value\n- daoPeriod = icmpv6rpl_vars.daoPeriod - 0x80 + (openrandom_get16b()&0xff);\n- opentimers2_scheduleRelative(\n- icmpv6rpl_vars.timerIdDAO,\n- daoPeriod,\n- TIME_MS,\n- icmpv6rpl_timer_DAO_task\n- );\n}\n/**\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-653. re-schedule timers relatively inside the callback.
491,595
21.04.2017 19:25:45
-7,200
02619d94283bfe3e756cbcf5b576b5b6a67ce60c
trigger interrupt manually if timer is to be scheduled within TIMERTHRESHOLD ticks.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/sctimer.c", "new_path": "bsp/boards/openmote-cc2538/sctimer.c", "diff": "@@ -52,11 +52,17 @@ void sctimer_setCompare(uint32_t val){\nif (SleepModeTimerCountGet() - val < TIMERLOOP_THRESHOLD){\n// the timer is already late, schedule the ISR right now manually\nIntPendSet(INT_SMTIM);\n+ } else {\n+ if (val-SleepModeTimerCountGet()<TIMERTHRESHOLD){\n+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ // schedule ISR right now manually\n+ IntPendSet(INT_SMTIM);\n} else {\n// schedule the timer at val\nSleepModeTimerCompareSet(val);\n}\n}\n+}\n/**\n\\brief Return the current value of the timer's counter.\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. trigger interrupt manually if timer is to be scheduled within TIMERTHRESHOLD ticks.
491,595
26.04.2017 11:23:39
-7,200
d0262c9ba9d4e7d45b8734e4d844f0e0a6d1fd85
radio should have higher interrupt priority than sleeptimer. Fixed.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/radio.c", "new_path": "bsp/boards/openmote-cc2538/radio.c", "diff": "@@ -143,9 +143,6 @@ void radio_init() {\nIntRegister(INT_RFCORERTX, radio_isr_internal);\nIntRegister(INT_RFCOREERR, radio_error_isr);\n- IntPrioritySet(INT_RFCORERTX, HAL_INT_PRIOR_MAC);\n- IntPrioritySet(INT_RFCOREERR, HAL_INT_PRIOR_MAC);\n-\nIntEnable(INT_RFCORERTX);\n/* Enable all RF Error interrupts */\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. radio should have higher interrupt priority than sleeptimer. Fixed.
491,595
26.04.2017 11:31:48
-7,200
c00e77df7108152271800f8f45c1c6bdd2ed7759
call only one timer's callback which has the high priority inside of opentimers2 callback.
[ { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.c", "new_path": "drivers/common/opentimers2.c", "diff": "@@ -339,7 +339,6 @@ void opentimers2_timer_callback(void){\nopentimers2_vars.lastTimeout = tempLastTimeout;\n// 2. call the callback of expired timers\n- for (i=0;i<MAX_NUM_TIMERS;i++){\nidToCallCB = TOO_MANY_TIMERS_ERROR;\n// find out the timer expired with highest priority\nfor (j=0;j<MAX_NUM_TIMERS;j++){\n@@ -355,7 +354,6 @@ void opentimers2_timer_callback(void){\n}\nif (idToCallCB==TOO_MANY_TIMERS_ERROR){\n// no more timer expired\n- break;\n} else {\n// call all timers expired having the same priority with timer idToCallCB\nfor (j=0;j<MAX_NUM_TIMERS;j++){\n@@ -370,7 +368,6 @@ void opentimers2_timer_callback(void){\n}\n}\n}\n- }\n// 3. find the next timer to be fired\ntimerGap = opentimers2_vars.timersBuf[0].currentCompareValue-opentimers2_vars.lastTimeout;\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. call only one timer's callback which has the high priority inside of opentimers2 callback.
491,595
27.04.2017 17:20:26
-7,200
74ad33ee15eae3d914f56f2f5f40831cddb6ad19
openmote-cc2538 armgcc compiler support.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/SConscript", "new_path": "bsp/boards/SConscript", "diff": "@@ -7,13 +7,11 @@ localEnv = env.Clone()\nsources_h = [\n'board.h',\n- 'bsp_timer.h',\n'crypto_engine.h',\n'debugpins.h',\n'eui64.h',\n'leds.h',\n'radio.h',\n- 'radiotimer.h',\n'uart.h',\n'sctimer.h',\n]\n" }, { "change_type": "MODIFY", "old_path": "drivers/SConscript", "new_path": "drivers/SConscript", "diff": "@@ -10,13 +10,13 @@ sources_c = [\nos.path.join('common','openhdlc.c'),\nos.path.join('common','opensensors.c'),\nos.path.join('common','openserial.c'),\n- os.path.join('common','opentimers.c'),\n+ os.path.join('common','opentimers2.c'),\n]\nsources_h = [\nos.path.join('common','openhdlc.h'),\nos.path.join('common','opensensors.h'),\nos.path.join('common','openserial.h'),\n- os.path.join('common','opentimers.h'),\n+ os.path.join('common','opentimers2.h'),\n]\nif localEnv['board']=='python':\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/openserial.c", "new_path": "drivers/common/openserial.c", "diff": "@@ -44,7 +44,7 @@ void openserial_handleEcho(uint8_t* but, uint8_t bufLen);\nvoid openserial_handleCommands(void);\n// misc\n-void openserial_board_reset_cb();\n+void openserial_board_reset_cb(void);\n// HDLC output\nvoid outputHdlcOpen(void);\n@@ -700,7 +700,7 @@ void openserial_handleCommands(void){\n//===== misc\n-void openserial_board_reset_cb() {\n+void openserial_board_reset_cb(void) {\nboard_reset();\n}\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.c", "new_path": "drivers/common/opentimers2.c", "diff": "@@ -29,7 +29,7 @@ void opentimers2_timer_callback(void);\nInitializes data structures and hardware timer.\n*/\n-void opentimers2_init(){\n+void opentimers2_init(void){\n// initialize local variables\nmemset(&opentimers2_vars,0,sizeof(opentimers2_vars_t));\n// set callback for sctimer module\n@@ -289,7 +289,7 @@ uint32_t opentimers2_getValue(opentimers2_id_t id){\n\\returns currentTimeout.\n*/\n-uint32_t opentimers2_getCurrentTimeout(){\n+uint32_t opentimers2_getCurrentTimeout(void){\nreturn opentimers2_vars.currentTimeout;\n}\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.h", "new_path": "drivers/common/opentimers2.h", "diff": "@@ -65,7 +65,7 @@ void opentimers2_cancel(opentimers2_id_t id);\nbool opentimers2_destroy(opentimers2_id_t id);\nuint32_t opentimers2_getValue(opentimers2_id_t id);\n-uint32_t opentimers2_getCurrentTimeout();\n+uint32_t opentimers2_getCurrentTimeout(void);\nbool opentimers2_isRunning(opentimers2_id_t id);\n/**\n\\}\n" }, { "change_type": "MODIFY", "old_path": "openstack/SConscript", "new_path": "openstack/SConscript", "diff": "@@ -11,7 +11,7 @@ sources_c = [\nos.path.join('02a-MAClow','topology.c'),\nos.path.join('02a-MAClow','IEEE802154.c'),\nos.path.join('02a-MAClow','IEEE802154E.c'),\n- os.path.join('02a-MAClow','adaptive_sync.c'),\n+# os.path.join('02a-MAClow','adaptive_sync.c'),\nos.path.join('02a-MAClow','IEEE802154_security.c'),\nos.path.join('02a-MAClow','IEEE802154_dummy_security.c'),\n#=== 02b-MAChigh\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. openmote-cc2538 armgcc compiler support.
491,595
27.04.2017 18:18:24
-7,200
5bca1f47cfcb4e39ef3868ab4a594566accea08d
change priority feature (small value indicates high priority)
[ { "change_type": "MODIFY", "old_path": "drivers/common/openserial.c", "new_path": "drivers/common/openserial.c", "diff": "@@ -176,7 +176,7 @@ owerror_t openserial_printCritical(\nleds_error_blink();\n// schedule for the mote to reboot in 10s\n- id = opentimers2_create(0);\n+ id = opentimers2_create();\nreference = opentimers2_getValue(id);\nopentimers2_scheduleAbsolute(\nid, // timerId\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.c", "new_path": "drivers/common/opentimers2.c", "diff": "@@ -30,8 +30,13 @@ void opentimers2_timer_callback(void);\nInitializes data structures and hardware timer.\n*/\nvoid opentimers2_init(void){\n+ uint8_t i;\n// initialize local variables\nmemset(&opentimers2_vars,0,sizeof(opentimers2_vars_t));\n+ for (i=0;i<MAX_NUM_TIMERS;i++){\n+ // by default, all timers have the priority of 0xff (lowest priority)\n+ opentimers2_vars.timersBuf[i].priority = 0xff;\n+ }\n// set callback for sctimer module\nsctimer_set_callback(opentimers2_timer_callback);\n}\n@@ -39,14 +44,15 @@ void opentimers2_init(void){\n/**\n\\brief create a timer by assigning an entry from timer buffer.\n-create a timer by reserving an Id for the timer.\n+create a timer by assigning an Id for the timer.\n+\n+\\returns the id of the timer will be returned\n*/\n-opentimers2_id_t opentimers2_create(uint8_t priority){\n+opentimers2_id_t opentimers2_create(){\nuint8_t id;\nfor (id=0;id<MAX_NUM_TIMERS;id++){\nif (opentimers2_vars.timersBuf[id].isUsed == FALSE){\nopentimers2_vars.timersBuf[id].isUsed = TRUE;\n- opentimers2_vars.timersBuf[id].priority = priority;\nreturn id;\n}\n}\n@@ -63,10 +69,10 @@ to lastCompareValue + duration.\nNote: as this function schedule time depending on last compare value. It\ncan't be called firstly after the timer is created.\n-\\param id the timer id\n-\\param duration the period asked for schedule since last comparing value\n-\\param uint_type the unit type of this schedule: ticks or ms\n-\\param cb when this scheduled timer fired, call this callback function.\n+\\param[in] id indicates the timer id\n+\\param[in] duration indicates the period asked for schedule since last comparing value\n+\\param[in] uint_type indicates the unit type of this schedule: ticks or ms\n+\\param[in] cb indicates when this scheduled timer fired, call this callback function.\n*/\nvoid opentimers2_scheduleRelative(opentimers2_id_t id,\nuint32_t duration,\n@@ -117,7 +123,7 @@ void opentimers2_scheduleRelative(opentimers2_id_t id,\n// if a timer \"i\" has low priority but has compare value less than\n// candidate timer \"idToSchedule\" more than TIMERTHRESHOLD ticks,\n// replace candidate timer by this timer \"i\".\n- if (opentimers2_vars.timersBuf[i].priority < opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (opentimers2_vars.timersBuf[i].priority > opentimers2_vars.timersBuf[idToSchedule].priority){\nif (timerGap-tempTimerGap > TIMERTHRESHOLD){\ntimerGap = tempTimerGap;\nidToSchedule = i;\n@@ -133,7 +139,7 @@ void opentimers2_scheduleRelative(opentimers2_id_t id,\n// if a timer \"i\" has higher priority than candidate timer \"idToSchedule\"\n// and its compare value is larger than timer \"i\" no more than TIMERTHRESHOLD ticks,\n// replace candidate timer by timer \"i\".\n- if (opentimers2_vars.timersBuf[i].priority > opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (opentimers2_vars.timersBuf[i].priority < opentimers2_vars.timersBuf[idToSchedule].priority){\nif (tempTimerGap - timerGap < TIMERTHRESHOLD){\ntimerGap = tempTimerGap;\nidToSchedule = i;\n@@ -155,10 +161,10 @@ void opentimers2_scheduleRelative(opentimers2_id_t id,\nThis function will schedule a timer which expires when the timer count reach\nto lastCompareValue + reference.\n-\\param id the timer id\n-\\param duration the period asked for schedule after a given time indicated by reference parameter.\n-\\param uint_type the unit type of this schedule: ticks or ms\n-\\param cb when this scheduled timer fired, call this callback function.\n+\\param[in] id indicates the timer id\n+\\param[in] duration indicates the period asked for schedule after a given time indicated by reference parameter.\n+\\param[in] uint_type indicates the unit type of this schedule: ticks or ms\n+\\param[in] cb indicates when this scheduled timer fired, call this callback function.\n*/\nvoid opentimers2_scheduleAbsolute(opentimers2_id_t id,\nuint32_t duration,\n@@ -210,7 +216,7 @@ void opentimers2_scheduleAbsolute(opentimers2_id_t id,\n// if a timer \"i\" has low priority but has compare value less than\n// candidate timer \"idToSchedule\" more than TIMERTHRESHOLD ticks,\n// replace candidate timer by this timer \"i\".\n- if (opentimers2_vars.timersBuf[i].priority < opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (opentimers2_vars.timersBuf[i].priority > opentimers2_vars.timersBuf[idToSchedule].priority){\nif (timerGap-tempTimerGap > TIMERTHRESHOLD){\ntimerGap = tempTimerGap;\nidToSchedule = i;\n@@ -226,7 +232,7 @@ void opentimers2_scheduleAbsolute(opentimers2_id_t id,\n// if a timer \"i\" has higher priority than candidate timer \"idToSchedule\"\n// and its compare value is larger than timer \"i\" no more than TIMERTHRESHOLD ticks,\n// replace candidate timer by timer \"i\".\n- if (opentimers2_vars.timersBuf[i].priority > opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (opentimers2_vars.timersBuf[i].priority < opentimers2_vars.timersBuf[idToSchedule].priority){\nif (tempTimerGap - timerGap < TIMERTHRESHOLD){\ntimerGap = tempTimerGap;\nidToSchedule = i;\n@@ -248,7 +254,7 @@ void opentimers2_scheduleAbsolute(opentimers2_id_t id,\nThis function disable the timer temperally by removing its callback and marking\nisrunning as false. The timer may be recover later.\n-\\param id the timer id\n+\\param[in] id the timer id\n*/\nvoid opentimers2_cancel(opentimers2_id_t id){\nopentimers2_vars.timersBuf[id].isrunning = FALSE;\n@@ -260,7 +266,7 @@ void opentimers2_cancel(opentimers2_id_t id){\nReset the whole entry of given timer including the id.\n-\\param id the timer id\n+\\param[in] id the timer id\n\\returns False if the given can't be found or return Success\n*/\n@@ -276,7 +282,7 @@ bool opentimers2_destroy(opentimers2_id_t id){\n/**\n\\brief get the counter value of given timer.\n-\\param id the timer id\n+\\param[in] id the timer id\n\\returns the current counter value.\n*/\n@@ -302,6 +308,21 @@ bool opentimers2_isRunning(opentimers2_id_t id){\nreturn opentimers2_vars.timersBuf[id].isrunning;\n}\n+\n+/**\n+\\brief set the priority of given timer\n+\n+\\param[in] id indicates the timer to be assigned.\n+\\param[in] priority indicates the priority of given timer.\n+ */\n+void opentimers2_setPriority(opentimers2_id_t id, uint8_t priority){\n+ if (opentimers2_vars.timersBuf[id].isUsed == TRUE){\n+ opentimers2_vars.timersBuf[id].priority = priority;\n+ } else {\n+ // the given timer is not used, do nothing.\n+ }\n+}\n+\n// ========================== callback ========================================\n/**\n@@ -346,7 +367,7 @@ void opentimers2_timer_callback(void){\nif (idToCallCB==TOO_MANY_TIMERS_ERROR){\nidToCallCB = j;\n} else {\n- if (opentimers2_vars.timersBuf[j].priority>opentimers2_vars.timersBuf[idToCallCB].priority){\n+ if (opentimers2_vars.timersBuf[j].priority<opentimers2_vars.timersBuf[idToCallCB].priority){\nidToCallCB = j;\n}\n}\n@@ -379,7 +400,7 @@ void opentimers2_timer_callback(void){\n// if a timer \"i\" has low priority but has compare value less than\n// candidate timer \"idToSchedule\" more than TIMERTHRESHOLD ticks,\n// replace candidate timer by this timer \"i\".\n- if (opentimers2_vars.timersBuf[i].priority < opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (opentimers2_vars.timersBuf[i].priority > opentimers2_vars.timersBuf[idToSchedule].priority){\nif (timerGap-tempTimerGap > TIMERTHRESHOLD){\ntimerGap = tempTimerGap;\nidToSchedule = i;\n@@ -395,7 +416,7 @@ void opentimers2_timer_callback(void){\n// if a timer \"i\" has higher priority than candidate timer \"idToSchedule\"\n// and its compare value is larger than timer \"i\" no more than TIMERTHRESHOLD ticks,\n// replace candidate timer by timer \"i\".\n- if (opentimers2_vars.timersBuf[i].priority > opentimers2_vars.timersBuf[idToSchedule].priority){\n+ if (opentimers2_vars.timersBuf[i].priority < opentimers2_vars.timersBuf[idToSchedule].priority){\nif (tempTimerGap - timerGap < TIMERTHRESHOLD){\ntimerGap = tempTimerGap;\nidToSchedule = i;\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers2.h", "new_path": "drivers/common/opentimers2.h", "diff": "@@ -51,7 +51,7 @@ typedef struct {\n//=========================== prototypes ======================================\nvoid opentimers2_init(void);\n-opentimers2_id_t opentimers2_create(uint8_t priority);\n+opentimers2_id_t opentimers2_create();\nvoid opentimers2_scheduleRelative(opentimers2_id_t id,\nuint32_t duration,\ntime_type_t uint_type,\n@@ -67,6 +67,7 @@ bool opentimers2_destroy(opentimers2_id_t id);\nuint32_t opentimers2_getValue(opentimers2_id_t id);\nuint32_t opentimers2_getCurrentTimeout(void);\nbool opentimers2_isRunning(opentimers2_id_t id);\n+void opentimers2_setPriority(opentimers2_id_t id, uint8_t priority);\n/**\n\\}\n\\}\n" }, { "change_type": "MODIFY", "old_path": "openapps/cexample/cexample.c", "new_path": "openapps/cexample/cexample.c", "diff": "@@ -52,7 +52,7 @@ void cexample_init() {\nopencoap_register(&cexample_vars.desc);\n- cexample_vars.timerId = opentimers2_create(0);\n+ cexample_vars.timerId = opentimers2_create();\nopentimers2_scheduleAbsolute(cexample_vars.timerId,\nCEXAMPLEPERIOD,\nopentimers2_getValue(cexample_vars.timerId),\n" }, { "change_type": "MODIFY", "old_path": "openapps/csensors/csensors.c", "new_path": "openapps/csensors/csensors.c", "diff": "@@ -396,7 +396,7 @@ void csensors_setPeriod(uint32_t period,\n);\n}\n} else {\n- csensors_vars.csensors_resource[id].timerId = opentimers2_create(0);\n+ csensors_vars.csensors_resource[id].timerId = opentimers2_create();\nopentimers2_scheduleAbsolute(\ncsensors_vars.csensors_resource[id].timerId,\n(uint32_t)((period*openrandom_get16b())/0xffff),\n" }, { "change_type": "MODIFY", "old_path": "openapps/cstorm/cstorm.c", "new_path": "openapps/cstorm/cstorm.c", "diff": "@@ -54,7 +54,7 @@ void cstorm_init(void) {\n//comment : not running by default\ncstorm_vars.period = 6553;\n- cstorm_vars.timerId = opentimers2_create(0);\n+ cstorm_vars.timerId = opentimers2_create();\nopentimers2_scheduleAbsolute(\ncstorm_vars.timerId,\ncstorm_vars.period,\n" }, { "change_type": "MODIFY", "old_path": "openapps/uinject/uinject.c", "new_path": "openapps/uinject/uinject.c", "diff": "@@ -36,7 +36,7 @@ void uinject_init() {\nuinject_vars.period = UINJECT_PERIOD_MS;\n// start periodic timer\n- uinject_vars.timerId = opentimers2_create(0);\n+ uinject_vars.timerId = opentimers2_create();\nopentimers2_scheduleAbsolute(\nuinject_vars.period,\nUINJECT_PERIOD_MS,\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -145,7 +145,9 @@ void ieee154e_init() {\nradio_setStartFrameCb(ieee154e_startOfFrame);\nradio_setEndFrameCb(ieee154e_endOfFrame);\n// have the radio start its timer\n- ieee154e_vars.timerId = opentimers2_create(255);\n+ ieee154e_vars.timerId = opentimers2_create();\n+ // assign ieee802154e timer with highest priority\n+ opentimers2_setPriority(ieee154e_vars.timerId,0);\nopentimers2_scheduleAbsolute(\nieee154e_vars.timerId, // timerId\nieee154e_vars.slotDuration, // duration\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -125,7 +125,7 @@ void sixtop_init() {\nsixtop_vars.isResponseEnabled = TRUE;\nsixtop_vars.handler = SIX_HANDLER_NONE;\n- sixtop_vars.ebSendingTimerId = opentimers2_create(0);\n+ sixtop_vars.ebSendingTimerId = opentimers2_create();\nopentimers2_scheduleAbsolute(\nsixtop_vars.ebSendingTimerId,\n(sixtop_vars.ebPeriod-EBPERIOD_RANDOM_RANG+(openrandom_get16b()%(2*EBPERIOD_RANDOM_RANG))),\n@@ -134,7 +134,7 @@ void sixtop_init() {\nsixtop_sendingEb_timer_cb\n);\n- sixtop_vars.maintenanceTimerId = opentimers2_create(0);\n+ sixtop_vars.maintenanceTimerId = opentimers2_create();\nopentimers2_scheduleAbsolute(\nsixtop_vars.maintenanceTimerId,\nsixtop_vars.periodMaintenance,\n@@ -143,7 +143,7 @@ void sixtop_init() {\nsixtop_maintenance_timer_cb\n);\n- sixtop_vars.timeoutTimerId = opentimers2_create(0);\n+ sixtop_vars.timeoutTimerId = opentimers2_create();\n}\nvoid sixtop_setKaPeriod(uint16_t kaPeriod) {\n" }, { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/icmpv6rpl.c", "new_path": "openstack/03b-IPv6/icmpv6rpl.c", "diff": "@@ -83,7 +83,7 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.dioPeriod = TIMER_DIO_TIMEOUT;\ndioPeriod = icmpv6rpl_vars.dioPeriod - 0x80 + (openrandom_get16b()&0xff);\n- icmpv6rpl_vars.timerIdDIO = opentimers2_create(0);\n+ icmpv6rpl_vars.timerIdDIO = opentimers2_create();\nopentimers2_scheduleAbsolute(\nicmpv6rpl_vars.timerIdDIO,\ndioPeriod,\n@@ -133,7 +133,7 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.daoPeriod = TIMER_DAO_TIMEOUT;\ndaoPeriod = icmpv6rpl_vars.daoPeriod - 0x80 + (openrandom_get16b()&0xff);\n- icmpv6rpl_vars.timerIdDAO = opentimers2_create(0);\n+ icmpv6rpl_vars.timerIdDAO = opentimers2_create();\nopentimers2_scheduleAbsolute(\nicmpv6rpl_vars.timerIdDAO,\ndaoPeriod,\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/opentcp.c", "new_path": "openstack/04-TRAN/opentcp.c", "diff": "@@ -690,7 +690,7 @@ void tcp_change_state(uint8_t new_tcp_state) {\n}\n} else {\nif (tcp_vars.timerStarted==FALSE) {\n- tcp_vars.timerId = opentimers2_create(0);\n+ tcp_vars.timerId = opentimers2_create();\nopentimers2_scheduleAbsolute(\ntcp_vars.timerId,\nTCP_TIMEOUT,\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. change priority feature (small value indicates high priority)
491,595
27.04.2017 18:32:39
-7,200
c282d93c910c6c4ee9098690af03907fefc0d6ad
remove opentimers module.
[ { "change_type": "DELETE", "old_path": "drivers/common/opentimers.c", "new_path": null, "diff": "-/**\n-\\brief Definition of the \"opentimers\" driver.\n-\n-This driver uses a single hardware timer, which it virtualizes to support\n-at most MAX_NUM_TIMERS timers.\n-\n-\\author Xavi Vilajosana <xvilajosana@eecs.berkeley.edu>, March 2012.\n- */\n-\n-#include \"opendefs.h\"\n-#include \"opentimers.h\"\n-#include \"bsp_timer.h\"\n-#include \"leds.h\"\n-\n-//=========================== define ==========================================\n-\n-//=========================== variables =======================================\n-\n-opentimers_vars_t opentimers_vars;\n-//uint32_t counter; //counts the elapsed time.\n-\n-//=========================== prototypes ======================================\n-\n-void opentimers_timer_callback(void);\n-\n-//=========================== public ==========================================\n-\n-/**\n-\\brief Initialize this module.\n-\n-Initializes data structures and hardware timer.\n- */\n-void opentimers_init(){\n- uint8_t i;\n-\n- // initialize local variables\n- opentimers_vars.running=FALSE;\n- for (i=0;i<MAX_NUM_TIMERS;i++) {\n- opentimers_vars.timersBuf[i].period_ticks = 0;\n- opentimers_vars.timersBuf[i].ticks_remaining = 0;\n- opentimers_vars.timersBuf[i].type = TIMER_ONESHOT;\n- opentimers_vars.timersBuf[i].isrunning = FALSE;\n- opentimers_vars.timersBuf[i].callback = NULL;\n- opentimers_vars.timersBuf[i].hasExpired = FALSE;\n- }\n-\n- // set callback for bsp_timers module\n- bsp_timer_set_callback(opentimers_timer_callback);\n-}\n-\n-/**\n-\\brief Start a timer.\n-\n-The timer works as follows:\n-- currentTimeout is the number of ticks before the next timer expires.\n-- if a new timer is inserted, we check that it is not earlier than the soonest\n-- if it is earliest, replace it\n-- if not, insert it in the list\n-\n-\\param duration Number milli-seconds after which the timer will fire.\n-\\param type Type of timer:\n- - #TIMER_PERIODIC for a periodic timer.\n- - #TIMER_ONESHOT for a on-shot timer.\n-\\param timetype Units of the <tt>duration</tt>:\n- - #TIME_MS when <tt>duration</tt> is in ms.\n- - #TIME_TICS when <tt>duration</tt> is in clock ticks.\n-\\param callback The function to call when the timer fires.\n-\n-\\returns The id of the timer (which serves as a handler to stop it) if the\n- timer could be started.\n-\\returns TOO_MANY_TIMERS_ERROR if the timer could NOT be started.\n- */\n-opentimer_id_t opentimers_start(uint32_t duration, timer_type_t type, time_type_t timetype, opentimers_cbt callback) {\n-\n- uint8_t id;\n-\n- // find an unused timer\n- for (id=0; id<MAX_NUM_TIMERS && opentimers_vars.timersBuf[id].isrunning==TRUE; id++);\n-\n- if (id<MAX_NUM_TIMERS) {\n- // we found an unused timer\n-\n- // register the timer\n- if (timetype==TIME_MS) {\n- opentimers_vars.timersBuf[id].period_ticks = duration*PORT_TICS_PER_MS;\n- opentimers_vars.timersBuf[id].wraps_remaining = (duration*PORT_TICS_PER_MS/MAX_TICKS_IN_SINGLE_CLOCK);//65535=maxValue of uint16_t\n- } else if (timetype==TIME_TICS) {\n- opentimers_vars.timersBuf[id].period_ticks = duration;\n- opentimers_vars.timersBuf[id].wraps_remaining = (duration/MAX_TICKS_IN_SINGLE_CLOCK);//65535=maxValue of uint16_t\n- } else {\n- while (1); //error\n- }\n- //if the number of ticks falls below a 16bit value, use it, otherwise set to max 16bit value\n- if(opentimers_vars.timersBuf[id].wraps_remaining==0){\n- if (timetype==TIME_MS){\n- opentimers_vars.timersBuf[id].ticks_remaining = duration*PORT_TICS_PER_MS;\n- } else if (timetype==TIME_TICS) {\n- opentimers_vars.timersBuf[id].ticks_remaining = duration;\n- } else {\n- // this should never happpen!\n-\n- // we can not print from within the drivers. Instead:\n- // blink the error LED\n- leds_error_blink();\n- // reset the board\n- board_reset();\n- }\n- }else{\n- opentimers_vars.timersBuf[id].ticks_remaining = MAX_TICKS_IN_SINGLE_CLOCK;\n- }\n- opentimers_vars.timersBuf[id].type = type;\n- opentimers_vars.timersBuf[id].isrunning = TRUE;\n- opentimers_vars.timersBuf[id].callback = callback;\n- opentimers_vars.timersBuf[id].hasExpired = FALSE;\n-\n- // re-schedule the running timer, if needed\n- if (\n- (opentimers_vars.running==FALSE)\n- ||\n- (opentimers_vars.timersBuf[id].ticks_remaining < opentimers_vars.currentTimeout)\n- ) {\n- opentimers_vars.currentTimeout = opentimers_vars.timersBuf[id].ticks_remaining;\n- if (opentimers_vars.running==FALSE) {\n- bsp_timer_reset();\n- }\n- bsp_timer_scheduleIn(opentimers_vars.timersBuf[id].ticks_remaining);\n- }\n-\n- opentimers_vars.running = TRUE;\n-\n- } else {\n- return TOO_MANY_TIMERS_ERROR;\n- }\n-\n- return id;\n-}\n-\n-/**\n-\\brief Replace the period of a running timer.\n- */\n-void opentimers_setPeriod(opentimer_id_t id,time_type_t timetype,uint32_t newDuration) {\n- if (timetype==TIME_MS) {\n- opentimers_vars.timersBuf[id].period_ticks = newDuration*PORT_TICS_PER_MS;\n- opentimers_vars.timersBuf[id].wraps_remaining = (newDuration*PORT_TICS_PER_MS/MAX_TICKS_IN_SINGLE_CLOCK);//65535=maxValue of uint16_t\n- } else if (timetype==TIME_TICS) {\n- opentimers_vars.timersBuf[id].period_ticks = newDuration;\n- opentimers_vars.timersBuf[id].wraps_remaining = (newDuration/MAX_TICKS_IN_SINGLE_CLOCK);//65535=maxValue of uint16_t\n- } else {\n- // this should never happpen!\n-\n- // we can not print from within the drivers. Instead:\n- // blink the error LED\n- leds_error_blink();\n- // reset the board\n- board_reset();\n- }\n- if(opentimers_vars.timersBuf[id].wraps_remaining==0) {\n- if (timetype==TIME_MS){\n- opentimers_vars.timersBuf[id].ticks_remaining = newDuration*PORT_TICS_PER_MS;\n- } else if (timetype==TIME_TICS){\n- opentimers_vars.timersBuf[id].ticks_remaining = newDuration;\n- }\n- } else {\n- opentimers_vars.timersBuf[id].ticks_remaining = MAX_TICKS_IN_SINGLE_CLOCK;\n- }\n-}\n-\n-/**\n-\\brief Stop a running timer.\n-\n-Sets the timer to \"not running\". the system recovers even if this was the next\n-timer to expire.\n- */\n-void opentimers_stop(opentimer_id_t id) {\n- opentimers_vars.timersBuf[id].isrunning=FALSE;\n-}\n-\n-/**\n-\\brief Restart a stop timer.\n-\n-Sets the timer to \" running\".\n- */\n-void opentimers_restart(opentimer_id_t id) {\n- opentimers_vars.timersBuf[id].isrunning=TRUE;\n-}\n-\n-\n-//=========================== private =========================================\n-\n-/**\n-\\brief Function called when the hardware timer expires.\n-\n-Executed in interrupt mode.\n-\n-This function maps the expiration event to possibly multiple timers, calls the\n-corresponding callback(s), and restarts the hardware timer with the next timer\n-to expire.\n- */\n-void opentimers_timer_callback() {\n-\n- opentimer_id_t id;\n- PORT_TIMER_WIDTH min_timeout;\n- bool found;\n-\n- // step 1. Identify expired timers\n- for(id=0; id<MAX_NUM_TIMERS; id++) {\n- if (opentimers_vars.timersBuf[id].isrunning==TRUE) {\n-\n- if(opentimers_vars.currentTimeout >= opentimers_vars.timersBuf[id].ticks_remaining) {\n- // this timer has expired\n- //check to see if we have completed the whole timer, or we're just wrapping around the max 16bit value\n- if(opentimers_vars.timersBuf[id].wraps_remaining == 0){\n- // declare as so\n- opentimers_vars.timersBuf[id].hasExpired = TRUE;\n- }else{\n- opentimers_vars.timersBuf[id].wraps_remaining--;\n- if(opentimers_vars.timersBuf[id].wraps_remaining == 0){\n- //if we have fully wrapped around, then set the remainring ticks to the modulus of the total ticks and the max clock value\n- opentimers_vars.timersBuf[id].ticks_remaining = (opentimers_vars.timersBuf[id].period_ticks) % MAX_TICKS_IN_SINGLE_CLOCK;\n- }else{\n- opentimers_vars.timersBuf[id].ticks_remaining = MAX_TICKS_IN_SINGLE_CLOCK;\n- }\n- }\n- } else {\n- // this timer is not expired\n-\n- // update its counter\n- opentimers_vars.timersBuf[id].ticks_remaining -= opentimers_vars.currentTimeout;\n- }\n- }\n- }\n-\n- // step 2. call callbacks of expired timers\n- for(id=0; id<MAX_NUM_TIMERS; id++) {\n- if (opentimers_vars.timersBuf[id].hasExpired==TRUE){\n-\n- // call the callback\n- opentimers_vars.timersBuf[id].callback(id);\n- opentimers_vars.timersBuf[id].hasExpired = FALSE;\n-\n- // reload the timer, if applicable\n- if (opentimers_vars.timersBuf[id].type==TIMER_PERIODIC) {\n- opentimers_vars.timersBuf[id].wraps_remaining = (opentimers_vars.timersBuf[id].period_ticks/MAX_TICKS_IN_SINGLE_CLOCK);//65535=maxValue of uint16_t\n- //if the number of ticks falls below a 16bit value, use it, otherwise set to max 16bit value\n- if(opentimers_vars.timersBuf[id].wraps_remaining==0)\n- opentimers_vars.timersBuf[id].ticks_remaining = opentimers_vars.timersBuf[id].period_ticks;\n- else\n- opentimers_vars.timersBuf[id].ticks_remaining = MAX_TICKS_IN_SINGLE_CLOCK;\n-\n- } else {\n- opentimers_vars.timersBuf[id].isrunning = FALSE;\n- }\n- }\n-\n- }\n-\n- // step 3. find the minimum remaining timeout among running timers\n- found = FALSE;\n- for(id=0;id<MAX_NUM_TIMERS;id++) {\n- if (\n- opentimers_vars.timersBuf[id].isrunning==TRUE &&\n- (\n- found==FALSE\n- ||\n- opentimers_vars.timersBuf[id].ticks_remaining < min_timeout\n- )\n- ) {\n- min_timeout = opentimers_vars.timersBuf[id].ticks_remaining;\n- found = TRUE;\n- }\n- }\n-\n- // step 4. schedule next timeout\n- if (found==TRUE) {\n- // at least one timer pending\n- opentimers_vars.currentTimeout = min_timeout;\n- bsp_timer_scheduleIn(opentimers_vars.currentTimeout);\n- } else {\n- // no more timers pending\n- opentimers_vars.running = FALSE;\n- }\n-}\n" }, { "change_type": "DELETE", "old_path": "drivers/common/opentimers.h", "new_path": null, "diff": "-/**\n-\\brief Declaration of the \"opentimers\" driver.\n-\n-\\author Xavi Vilajosana <xvilajosana@eecs.berkeley.edu>, March 2012.\n-*/\n-\n-#ifndef __OPENTIMERS_H\n-#define __OPENTIMERS_H\n-\n-#include \"opendefs.h\"\n-\n-/**\n-\\addtogroup drivers\n-\\{\n-\\addtogroup OpenTimers\n-\\{\n-*/\n-\n-//=========================== define ==========================================\n-\n-/// Maximum number of timers that can run concurrently\n-#define MAX_NUM_TIMERS 10\n-\n-#define MAX_TICKS_IN_SINGLE_CLOCK ((PORT_TIMER_WIDTH)0xFFFFFFFF)\n-\n-#define TOO_MANY_TIMERS_ERROR 255\n-\n-#define opentimer_id_t uint8_t\n-\n-typedef void (*opentimers_cbt)(opentimer_id_t id);\n-\n-//=========================== typedef =========================================\n-\n-typedef enum {\n- TIMER_PERIODIC,\n- TIMER_ONESHOT,\n-} timer_type_t;\n-\n-typedef struct {\n- uint32_t period_ticks; // total number of clock ticks\n- PORT_TIMER_WIDTH ticks_remaining; // ticks remaining before elapses\n- uint16_t wraps_remaining; // the clock register is 16 bit, and can't count beyond 32k...\n- // so period_ticks = wraps_remaining*(32k or uint16_t)\n- timer_type_t type; // periodic or one-shot\n- bool isrunning; // is running?\n- opentimers_cbt callback; // function to call when elapses\n- bool hasExpired; // whether the callback has to be called\n-} opentimers_t;\n-\n-//=========================== module variables ================================\n-\n-typedef struct {\n- opentimers_t timersBuf[MAX_NUM_TIMERS];\n- bool running;\n- PORT_TIMER_WIDTH currentTimeout; // current timeout, in ticks\n-} opentimers_vars_t;\n-\n-//=========================== prototypes ======================================\n-\n-void opentimers_init(void);\n-opentimer_id_t opentimers_start(uint32_t duration,\n- timer_type_t type,\n- time_type_t timetype,\n- opentimers_cbt callback);\n-void opentimers_setPeriod(opentimer_id_t id,time_type_t timetype, uint32_t newPeriod);\n-void opentimers_stop(opentimer_id_t id);\n-void opentimers_restart(opentimer_id_t id);\n-\n-/**\n-\\}\n-\\}\n-*/\n-\n-#endif\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. remove opentimers module.
491,595
28.04.2017 13:30:08
-7,200
a4c90d940f083f5955e4a882c7770eda17f30939
rename sctimer_capture_cbt to radio_capture_cbt.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/radio.c", "new_path": "bsp/boards/openmote-cc2538/radio.c", "diff": "//=========================== variables =======================================\ntypedef struct {\n- sctimer_capture_cbt startFrame_cb;\n- sctimer_capture_cbt endFrame_cb;\n+ radio_capture_cbt startFrame_cb;\n+ radio_capture_cbt endFrame_cb;\nradio_state_t state;\n} radio_vars_t;\n@@ -154,11 +154,11 @@ void radio_init() {\nradio_vars.state = RADIOSTATE_RFOFF;\n}\n-void radio_setStartFrameCb(sctimer_capture_cbt cb) {\n+void radio_setStartFrameCb(radio_capture_cbt cb) {\nradio_vars.startFrame_cb = cb;\n}\n-void radio_setEndFrameCb(sctimer_capture_cbt cb) {\n+void radio_setEndFrameCb(radio_capture_cbt cb) {\nradio_vars.endFrame_cb = cb;\n}\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/radio.h", "new_path": "bsp/boards/radio.h", "diff": "@@ -44,14 +44,16 @@ typedef enum {\n//=========================== typedef =========================================\n+typedef void (*radio_capture_cbt)(uint32_t timestamp);\n+\n//=========================== variables =======================================\n//=========================== prototypes ======================================\n// admin\nvoid radio_init(void);\n-void radio_setStartFrameCb(sctimer_capture_cbt cb);\n-void radio_setEndFrameCb(sctimer_capture_cbt cb);\n+void radio_setStartFrameCb(radio_capture_cbt cb);\n+void radio_setEndFrameCb(radio_capture_cbt cb);\n// reset\nvoid radio_reset(void);\n// RF admin\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/sctimer.h", "new_path": "bsp/boards/sctimer.h", "diff": "//=========================== typedef =========================================\ntypedef void (*sctimer_cbt) (void);\n-typedef void (*sctimer_capture_cbt)(uint32_t timestamp);\n//=========================== variables =======================================\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. rename sctimer_capture_cbt to radio_capture_cbt.
491,595
28.04.2017 19:33:43
-7,200
15ad992ab3be5bf7afd2c49fa8253194baf21dff
clean up project.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/radio.h", "new_path": "bsp/boards/radio.h", "diff": "\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012.\n*/\n-#include \"sctimer.h\"\n+#include \"board.h\"\n//=========================== define ==========================================\n@@ -44,7 +44,7 @@ typedef enum {\n//=========================== typedef =========================================\n-typedef void (*radio_capture_cbt)(uint32_t timestamp);\n+typedef void (*radio_capture_cbt)(PORT_TIMER_WIDTH timestamp);\n//=========================== variables =======================================\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/sctimer.h", "new_path": "bsp/boards/sctimer.h", "diff": "@@ -25,9 +25,9 @@ typedef void (*sctimer_cbt) (void);\n//=========================== prototypes ======================================\nvoid sctimer_init(void);\n-void sctimer_setCompare(uint32_t val);\n+void sctimer_setCompare(PORT_TIMER_WIDTH val);\nvoid sctimer_set_callback(sctimer_cbt cb);\n-uint32_t sctimer_readCounter(void);\n+PORT_TIMER_WIDTH sctimer_readCounter(void);\nvoid sctimer_enable(void);\nvoid sctimer_disable(void);\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.c", "new_path": "drivers/common/opentimers.c", "diff": "@@ -431,57 +431,3 @@ void opentimers_timer_callback(void){\nsctimer_setCompare(opentimers_vars.currentTimeout);\nopentimers_vars.running = TRUE;\n}\n\\ No newline at end of file\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.h", "new_path": "drivers/common/opentimers.h", "diff": "@@ -79,17 +79,3 @@ void opentimers_setPriority(opentimers_id_t id, uint8_t priority);\n*/\n#endif\n\\ No newline at end of file\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "#include \"opendefs.h\"\n#include \"IEEE802154E.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n#include \"IEEE802154.h\"\n#include \"ieee802154_security_driver.h\"\n#include \"openqueue.h\"\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/opentcp.c", "new_path": "openstack/04-TRAN/opentcp.c", "diff": "#include \"openqueue.h\"\n#include \"forwarding.h\"\n#include \"packetfunctions.h\"\n-#include \"bsp_timer.h\"\n#include \"scheduler.h\"\n// applications\n#include \"techo.h\"\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. clean up project.
491,595
28.04.2017 19:34:17
-7,200
4dc604b371990fae2c4fcec8aa82bdd99b898016
port for python simulated board.
[ { "change_type": "DELETE", "old_path": "bsp/boards/bsp_timer.h", "new_path": null, "diff": "-#ifndef __BSP_TIMERS_H\n-#define __BSP_TIMERS_H\n-\n-/**\n-\\addtogroup BSP\n-\\{\n-\\addtogroup bsp_timer\n-\\{\n-\n-\\brief Cross-platform declaration \"bsp_timer\" bsp module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, March 2012.\n-*/\n-\n-#include \"stdint.h\"\n-#include \"board.h\"\n-\n-//=========================== define ==========================================\n-\n-//=========================== typedef =========================================\n-\n-typedef void (*bsp_timer_cbt)(void);\n-\n-//=========================== variables =======================================\n-\n-//=========================== prototypes ======================================\n-\n-void bsp_timer_init(void);\n-void bsp_timer_set_callback(bsp_timer_cbt cb);\n-void bsp_timer_reset(void);\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks);\n-void bsp_timer_cancel_schedule(void);\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue(void);\n-\n-// interrupt handlers\n-kick_scheduler_t bsp_timer_isr(void);\n-\n-/**\n-\\}\n-\\}\n-*/\n-\n-#endif\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/SConscript", "new_path": "bsp/boards/python/SConscript", "diff": "@@ -8,14 +8,13 @@ localEnv = env.Clone()\ntarget = 'libbsp'\nsources_c = [\n'board_obj.c',\n- 'bsp_timer_obj.c',\n'debugpins_obj.c',\n'eui64_obj.c',\n'leds_obj.c',\n#'openwsnmodule.c', # Note: added to main build target\n- 'radio_obj.c',\n- 'radiotimer_obj.c',\n'uart_obj.c',\n+ 'radio_obj.c',\n+ 'sctimer_obj.c',\n'supply_obj.c',\n]\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/board_info.h", "new_path": "bsp/boards/python/board_info.h", "diff": "#define SYNC_ACCURACY 1 // when using openmoteSTM, change to 2\n+//===== sctimer scheduling\n+#define TIMERTHRESHOLD 10\n+\n//=========================== typedef ========================================\n//=========================== variables =======================================\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/board_obj.c", "new_path": "bsp/boards/python/board_obj.c", "diff": "#include \"debugpins_obj.h\"\n#include \"leds_obj.h\"\n#include \"uart_obj.h\"\n-#include \"bsp_timer_obj.h\"\n#include \"radio_obj.h\"\n-#include \"radiotimer_obj.h\"\n#include \"eui64_obj.h\"\n+#include \"sctimer_obj.h\"\n//=========================== variables =======================================\n@@ -31,10 +30,9 @@ void board_init(OpenMote* self) {\n// initialize bsp modules\ndebugpins_init(self);\nleds_init(self);\n+ sctimer_init(self);\nuart_init(self);\n- bsp_timer_init(self);\nradio_init(self);\n- radiotimer_init(self);\n// forward to Python\nresult = PyObject_CallObject(self->callback[MOTE_NOTIF_board_init],NULL);\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/python/bsp_timer_obj.c", "new_path": null, "diff": "-/**\n-\\brief Python-specific definition of the \"bsp_timer\" bsp module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, May 2013.\n-*/\n-\n-#include <stdio.h>\n-#include \"bsp_timer_obj.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== callbacks =======================================\n-\n-void bsp_timer_set_callback(OpenMote* self, bsp_timer_cbt cb) {\n- self->bsp_timer_icb.cb = cb;\n-}\n-\n-//=========================== public ==========================================\n-\n-void bsp_timer_init(OpenMote* self) {\n- PyObject* result;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: bsp_timer_init()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_bsp_timer_init],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] bsp_timer_init() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-void bsp_timer_reset(OpenMote* self) {\n- PyObject* result;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: bsp_timer_reset()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_bsp_timer_reset],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] bsp_timer_reset() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-void bsp_timer_scheduleIn(OpenMote* self, PORT_TIMER_WIDTH delayTicks) {\n- PyObject* result;\n- PyObject* arglist;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: bsp_timer_scheduleIn(delayTicks=%d)... \\n\",self,delayTicks);\n-#endif\n-\n- // forward to Python\n- arglist = Py_BuildValue(\"(i)\",delayTicks);\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_bsp_timer_scheduleIn],arglist);\n- if (result == NULL) {\n- printf(\"[CRITICAL] bsp_timer_scheduleIn() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n- Py_DECREF(arglist);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-void bsp_timer_cancel_schedule(OpenMote* self) {\n- PyObject* result;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: bsp_timer_cancel_schedule()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_bsp_timer_cancel_schedule],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] bsp_timer_cancel_schedule() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue(OpenMote* self) {\n- PyObject* result;\n- PORT_TIMER_WIDTH returnVal;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: bsp_timer_get_currentValue()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_bsp_timer_get_currentValue],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] bsp_timer_get_currentValue() returned NULL\\r\\n\");\n- return 0;\n- }\n- returnVal = (PORT_TIMER_WIDTH)PyInt_AsLong(result);\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"returnVal=%d.\\n\",returnVal);\n-#endif\n-\n- return returnVal;\n-}\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t bsp_timer_isr(OpenMote* self) {\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: bsp_timer_isr()...\\n\",self);\n-#endif\n-\n- self->bsp_timer_icb.cb(self);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-\n- return 0;//poipoi\n-}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/openwsnmodule.c", "new_path": "bsp/boards/python/openwsnmodule.c", "diff": "#include <stdio.h>\n#include \"openwsnmodule.h\"\n-#include \"bsp_timer.h\"\n-\n//=========================== OpenMote Class ==================================\n//===== members\n@@ -49,11 +47,9 @@ static PyObject* OpenMote_getState(OpenMote* self) {\nPyObject* returnVal;\nPyObject* uart_icb_tx;\nPyObject* uart_icb_rx;\n- PyObject* bsp_timer_icb_cb;\nPyObject* radio_icb_startFrame_cb;\nPyObject* radio_icb_endFrame_cb;\n- PyObject* radiotimer_icb_overflow_cb;\n- PyObject* radiotimer_icb_compare_cb;\n+ PyObject* sctimer_icb_compare_cb;\n//PyObject* ohlone_vars;\nPyObject* tcpinject_vars;\nPyObject* icmpv6echo_vars;\n@@ -83,16 +79,12 @@ static PyObject* OpenMote_getState(OpenMote* self) {\nPyDict_SetItemString(returnVal, \"uart_icb_tx\", uart_icb_tx);\nuart_icb_rx = PyInt_FromLong((intptr_t)self->uart_icb.rxCb);\nPyDict_SetItemString(returnVal, \"uart_icb_rx\", uart_icb_rx);\n- bsp_timer_icb_cb = PyInt_FromLong((intptr_t)self->bsp_timer_icb.cb);\n- PyDict_SetItemString(returnVal, \"bsp_timer_icb_cb\", bsp_timer_icb_cb);\nradio_icb_startFrame_cb = PyInt_FromLong((intptr_t)self->radio_icb.startFrame_cb);\nPyDict_SetItemString(returnVal, \"radio_icb_startFrame_cb\", radio_icb_startFrame_cb);\nradio_icb_endFrame_cb = PyInt_FromLong((intptr_t)self->radio_icb.endFrame_cb);\nPyDict_SetItemString(returnVal, \"radio_icb_endFrame_cb\", radio_icb_endFrame_cb );\n- radiotimer_icb_overflow_cb = PyInt_FromLong((intptr_t)self->radiotimer_icb.overflow_cb);\n- PyDict_SetItemString(returnVal, \"radiotimer_icb_overflow_cb\", radiotimer_icb_overflow_cb);\n- radiotimer_icb_compare_cb = PyInt_FromLong((intptr_t)self->radiotimer_icb.compare_cb);\n- PyDict_SetItemString(returnVal, \"radiotimer_icb_compare_cb\", radiotimer_icb_compare_cb);\n+ sctimer_icb_compare_cb = PyInt_FromLong((intptr_t)self->sctimer_icb.compare_cb);\n+ PyDict_SetItemString(returnVal, \"sctimer_icb_compare_cb\", sctimer_icb_compare_cb);\n// ohlone_vars\n/*\n@@ -204,17 +196,6 @@ static PyObject* OpenMote_getState(OpenMote* self) {\nreturn returnVal;\n}\n-static PyObject* OpenMote_bsp_timer_isr(OpenMote* self) {\n-\n- // no arguments\n-\n- // call the callback\n- bsp_timer_isr(self);\n-\n- // return successfully\n- Py_RETURN_NONE;\n-}\n-\nstatic PyObject* OpenMote_radio_isr_startFrame(OpenMote* self, PyObject* args) {\nint capturedTime;\n@@ -261,23 +242,12 @@ static PyObject* OpenMote_radio_isr_endFrame(OpenMote* self, PyObject* args) {\nPy_RETURN_NONE;\n}\n-static PyObject* OpenMote_radiotimer_isr_compare(OpenMote* self) {\n-\n- // no arguments\n-\n- // call the callback\n- radiotimer_intr_compare(self);\n-\n- // return successfully\n- Py_RETURN_NONE;\n-}\n-\n-static PyObject* OpenMote_radiotimer_isr_overflow(OpenMote* self) {\n+static PyObject* OpenMote_sctimer_isr_compare(OpenMote* self) {\n// no arguments\n// call the callback\n- radiotimer_intr_overflow(self);\n+ sctimer_intr_compare(self);\n// return successfully\nPy_RETURN_NONE;\n@@ -338,11 +308,9 @@ static PyMethodDef OpenMote_methods[] = {\n{ \"set_callback\", (PyCFunction)OpenMote_set_callback, METH_VARARGS, \"\"},\n{ \"getState\", (PyCFunction)OpenMote_getState, METH_NOARGS, \"\"},\n//=== BSP\n- { \"bsp_timer_isr\", (PyCFunction)OpenMote_bsp_timer_isr, METH_NOARGS, \"\"},\n{ \"radio_isr_startFrame\", (PyCFunction)OpenMote_radio_isr_startFrame, METH_VARARGS, \"\"},\n{ \"radio_isr_endFrame\", (PyCFunction)OpenMote_radio_isr_endFrame, METH_VARARGS, \"\"},\n- { \"radiotimer_isr_compare\", (PyCFunction)OpenMote_radiotimer_isr_compare, METH_NOARGS, \"\"},\n- { \"radiotimer_isr_overflow\", (PyCFunction)OpenMote_radiotimer_isr_overflow, METH_NOARGS, \"\"},\n+ { \"sctimer_isr_compare\", (PyCFunction)OpenMote_sctimer_isr_compare, METH_NOARGS, \"\"},\n{ \"uart_isr_tx\", (PyCFunction)OpenMote_uart_isr_tx, METH_NOARGS, \"\"},\n{ \"uart_isr_rx\", (PyCFunction)OpenMote_uart_isr_rx, METH_NOARGS, \"\"},\n{ \"supply_on\", (PyCFunction)OpenMote_supply_on, METH_NOARGS, \"\"},\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/openwsnmodule_obj.h", "new_path": "bsp/boards/python/openwsnmodule_obj.h", "diff": "void radio_intr_startOfFrame(OpenMote* self, uint16_t capturedTime);\nvoid radio_intr_endOfFrame(OpenMote* self, uint16_t capturedTime);\n-// radiotimer\n-void radiotimer_intr_compare(OpenMote* self);\n-void radiotimer_intr_overflow(OpenMote* self);\n+// sctimer\n+void sctimer_intr_compare(OpenMote* self);\n// uart\nvoid uart_intr_tx(OpenMote* self);\n@@ -70,12 +69,13 @@ enum {\nMOTE_NOTIF_board_init = 0,\nMOTE_NOTIF_board_sleep,\nMOTE_NOTIF_board_reset,\n- // bsp_timer\n- MOTE_NOTIF_bsp_timer_init,\n- MOTE_NOTIF_bsp_timer_reset,\n- MOTE_NOTIF_bsp_timer_scheduleIn,\n- MOTE_NOTIF_bsp_timer_cancel_schedule,\n- MOTE_NOTIF_bsp_timer_get_currentValue,\n+ // sctimer\n+ MOTE_NOTIF_sctimer_init,\n+ MOTE_NOTIF_sctimer_setCompare,\n+ MOTE_NOTIF_sctimer_set_callback,\n+ MOTE_NOTIF_sctimer_readCounter,\n+ MOTE_NOTIF_sctimer_enable,\n+ MOTE_NOTIF_sctimer_disable,\n// debugpins\nMOTE_NOTIF_debugpins_init,\nMOTE_NOTIF_debugpins_frame_toggle,\n@@ -133,10 +133,6 @@ enum {\n// radio\nMOTE_NOTIF_radio_init,\nMOTE_NOTIF_radio_reset,\n- MOTE_NOTIF_radio_startTimer,\n- MOTE_NOTIF_radio_getTimerValue,\n- MOTE_NOTIF_radio_setTimerPeriod,\n- MOTE_NOTIF_radio_getTimerPeriod,\nMOTE_NOTIF_radio_setFrequency,\nMOTE_NOTIF_radio_rfOn,\nMOTE_NOTIF_radio_rfOff,\n@@ -146,15 +142,6 @@ enum {\nMOTE_NOTIF_radio_rxEnable,\nMOTE_NOTIF_radio_rxNow,\nMOTE_NOTIF_radio_getReceivedFrame,\n- // radiotimer\n- MOTE_NOTIF_radiotimer_init,\n- MOTE_NOTIF_radiotimer_start,\n- MOTE_NOTIF_radiotimer_getValue,\n- MOTE_NOTIF_radiotimer_setPeriod,\n- MOTE_NOTIF_radiotimer_getPeriod,\n- MOTE_NOTIF_radiotimer_schedule,\n- MOTE_NOTIF_radiotimer_cancel,\n- MOTE_NOTIF_radiotimer_getCapturedTime,\n// uart\nMOTE_NOTIF_uart_init,\nMOTE_NOTIF_uart_enableInterrupts,\n@@ -179,25 +166,19 @@ typedef struct {\nuart_rx_cbt rxCb;\n} uart_icb_t;\n-typedef void (*bsp_timer_cbt)(OpenMote* self);\n+typedef void (*radio_capture_cbt)(OpenMote* self, PORT_TIMER_WIDTH timestamp);\ntypedef struct {\n- bsp_timer_cbt cb;\n-} bsp_timer_icb_t;\n-\n-typedef void (*radiotimer_capture_cbt)(OpenMote* self, PORT_TIMER_WIDTH timestamp);\n-\n-typedef struct {\n- radiotimer_capture_cbt startFrame_cb;\n- radiotimer_capture_cbt endFrame_cb;\n+ radio_capture_cbt startFrame_cb;\n+ radio_capture_cbt endFrame_cb;\n} radio_icb_t;\n-typedef void (*radiotimer_compare_cbt)(OpenMote* self);\n+typedef void (*sctimer_cbt)(OpenMote* self);\ntypedef struct {\n- radiotimer_compare_cbt overflow_cb;\n- radiotimer_compare_cbt compare_cb;\n-} radiotimer_icb_t;\n+ sctimer_cbt compare_cb;\n+} sctimer_icb_t;\n+\n//=========================== struct ==========================================\n@@ -210,9 +191,8 @@ struct OpenMote {\nPyObject* callback[MOTE_NOTIF_LAST];\n//===== internal C callbacks\nuart_icb_t uart_icb;\n- bsp_timer_icb_t bsp_timer_icb;\n+ sctimer_icb_t sctimer_icb;\nradio_icb_t radio_icb;\n- radiotimer_icb_t radiotimer_icb;\n//===== openstack\n// l4\nicmpv6echo_vars_t icmpv6echo_vars;\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/radio_obj.c", "new_path": "bsp/boards/python/radio_obj.c", "diff": "//=========================== prototypes ======================================\n-//=========================== callbacks =======================================\n-void radio_setOverflowCb(OpenMote* self, radiotimer_compare_cbt cb) {\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radio_setOverflowCb(cb=0x%x)... \\n\",self,cb);\n-#endif\n-\n- radiotimer_setOverflowCb(self, cb);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-void radio_setCompareCb(OpenMote* self, radiotimer_compare_cbt cb) {\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radio_setCompareCb(cb=0x%x)... \\n\",self,cb);\n-#endif\n-\n- radiotimer_setCompareCb(self, cb);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-void radio_setStartFrameCb(OpenMote* self, radiotimer_capture_cbt cb) {\n+void radio_setStartFrameCb(OpenMote* self, radio_capture_cbt cb) {\n#ifdef TRACE_ON\nprintf(\"C@0x%x: radio_setStartFrameCb(cb=0x%x)... \\n\",self,cb);\n@@ -53,7 +26,7 @@ void radio_setStartFrameCb(OpenMote* self, radiotimer_capture_cbt cb) {\n#endif\n}\n-void radio_setEndFrameCb(OpenMote* self, radiotimer_capture_cbt cb) {\n+void radio_setEndFrameCb(OpenMote* self, radio_capture_cbt cb) {\n#ifdef TRACE_ON\nprintf(\"C@0x%x: radio_setEndFrameCb(cb=0x%x)... \\n\",self,cb);\n@@ -112,114 +85,6 @@ void radio_reset(OpenMote* self) {\n#endif\n}\n-//===== timer\n-\n-void radio_startTimer(OpenMote* self, PORT_TIMER_WIDTH period) {\n- PyObject* result;\n- PyObject* arglist;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radio_startTimer(period=%d)... \\n\",self,period);\n-#endif\n-\n- // forward to Python\n- arglist = Py_BuildValue(\"(i)\",period);\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radio_startTimer],arglist);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radio_startTimer() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n- Py_DECREF(arglist);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-PORT_TIMER_WIDTH radio_getTimerValue(OpenMote* self) {\n- PyObject* result;\n- PORT_TIMER_WIDTH returnVal;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radio_getTimerValue()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radio_getTimerValue],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radio_getTimerValue() returned NULL\\r\\n\");\n- return 0;\n- }\n- if (!PyInt_Check(result)) {\n- printf(\"[CRITICAL] radio_getTimerValue() returned NULL\\r\\n\");\n- return 0;\n- }\n- returnVal = PyInt_AsLong(result);\n-\n- // dispose of returned value\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...got %d.\\n\",self,returnVal);\n-#endif\n-\n- return returnVal;\n-}\n-\n-void radio_setTimerPeriod(OpenMote* self, PORT_TIMER_WIDTH period) {\n- PyObject* result;\n- PyObject* arglist;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radio_setTimerPeriod(period=%d)... \\n\",self,period);\n-#endif\n-\n- // forward to Python\n- arglist = Py_BuildValue(\"(i)\",period);\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radio_setTimerPeriod],arglist);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radio_setTimerPeriod() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n- Py_DECREF(arglist);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-PORT_TIMER_WIDTH radio_getTimerPeriod(OpenMote* self) {\n- PyObject* result;\n- PORT_TIMER_WIDTH returnVal;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radio_getTimerPeriod()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radio_getTimerPeriod],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radio_getTimerPeriod() returned NULL\\r\\n\");\n- return 0;\n- }\n- if (!PyInt_Check(result)) {\n- printf(\"[CRITICAL] radio_getTimerPeriod() returned something which is not an int\\r\\n\");\n- return 0;\n- }\n- returnVal = PyInt_AsLong(result);\n-\n- // dispose of returned value\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...got %d.\\n\",self,returnVal);\n-#endif\n-\n- return returnVal;\n-}\n-\n//===== RF admin\nvoid radio_setFrequency(OpenMote* self, uint8_t frequency) {\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/python/radiotimer_obj.c", "new_path": null, "diff": "-/**\n-\\brief Python-specific definition of the \"radiotimer\" bsp module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, May 2013.\n-*/\n-\n-#include \"radiotimer_obj.h\"\n-\n-//=========================== variables =======================================\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== callback ========================================\n-\n-void radiotimer_setOverflowCb(OpenMote* self, radiotimer_compare_cbt cb) {\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_setOverflowCb(cb=0x%x)... \\n\",self,cb);\n-#endif\n-\n- self->radiotimer_icb.overflow_cb = cb;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-void radiotimer_setCompareCb(OpenMote* self, radiotimer_compare_cbt cb) {\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_setCompareCb(cb=0x%x)... \\n\",self,cb);\n-#endif\n-\n- self->radiotimer_icb.compare_cb = cb;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init(OpenMote* self) {\n- PyObject* result;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_init()... \\n\",self,self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radiotimer_init],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radiotimer_init() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-void radiotimer_start(OpenMote* self, PORT_RADIOTIMER_WIDTH period) {\n- PyObject* result;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_start(period=%d)... \\n\",self,period);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radiotimer_start],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radiotimer_start() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue(OpenMote* self) {\n- PyObject* result;\n- PORT_RADIOTIMER_WIDTH returnVal;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_getValue()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radiotimer_getValue],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radiotimer_getValue() returned NULL\\r\\n\");\n- return 0;\n- }\n- if (!PyInt_Check(result)) {\n- printf(\"[CRITICAL] radiotimer_getValue() returned NULL\\r\\n\");\n- return 0;\n- }\n- returnVal = PyInt_AsLong(result);\n-\n- // dispose of returned value\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...got %d.\\n\",self,returnVal);\n-#endif\n-\n- return returnVal;\n-}\n-\n-void radiotimer_setPeriod(OpenMote* self, PORT_RADIOTIMER_WIDTH period) {\n- PyObject* result;\n- PyObject* arglist;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_setPeriod(period=%d)... \\n\",self,period);\n-#endif\n-\n- // forward to Python\n- arglist = Py_BuildValue(\"(i)\",period);\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radiotimer_setPeriod],arglist);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radiotimer_setPeriod() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n- Py_DECREF(arglist);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod(OpenMote* self) {\n- PyObject* result;\n- PORT_RADIOTIMER_WIDTH returnVal;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_getPeriod()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radiotimer_getPeriod],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radiotimer_getPeriod() returned NULL\\r\\n\");\n- return 0;\n- }\n- if (!PyInt_Check(result)) {\n- printf(\"[CRITICAL] radiotimer_getPeriod() returned NULL\\r\\n\");\n- return 0;\n- }\n- returnVal = PyInt_AsLong(result);\n-\n- // dispose of returned value\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...got %d.\\n\",self,returnVal);\n-#endif\n-\n- return returnVal;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(OpenMote* self, PORT_RADIOTIMER_WIDTH offset) {\n- PyObject* result;\n- PyObject* arglist;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_schedule(offset=%d)... \\n\",self,offset);\n-#endif\n-\n- // forward to Python\n- arglist = Py_BuildValue(\"(i)\",offset);\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radiotimer_schedule],arglist);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radiotimer_schedule() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n- Py_DECREF(arglist);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-void radiotimer_cancel(OpenMote* self) {\n- PyObject* result;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_cancel()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radiotimer_cancel],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radiotimer_cancel() returned NULL\\r\\n\");\n- return;\n- }\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-//===== capture\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime(OpenMote* self) {\n- PyObject* result;\n- PORT_RADIOTIMER_WIDTH returnVal;\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_getCapturedTime()... \\n\",self);\n-#endif\n-\n- // forward to Python\n- result = PyObject_CallObject(self->callback[MOTE_NOTIF_radiotimer_getCapturedTime],NULL);\n- if (result == NULL) {\n- printf(\"[CRITICAL] radiotimer_getCapturedTime() returned NULL\\r\\n\");\n- return 0;\n- }\n- if (!PyInt_Check(result)) {\n- printf(\"[CRITICAL] radiotimer_getCapturedTime() returned NULL\\r\\n\");\n- return 0;\n- }\n- returnVal = PyInt_AsLong(result);\n-\n- // dispose of returned value\n- Py_DECREF(result);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...got %d.\\n\",self,returnVal);\n-#endif\n-\n- return returnVal;\n-}\n-\n-//=========================== interrupt handlers ==============================\n-\n-void radiotimer_intr_compare(OpenMote* self) {\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_intr_compare(), calling 0x%x... \\n\",self,self->radiotimer_icb.compare_cb);\n-#endif\n-\n- self->radiotimer_icb.compare_cb(self);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-void radiotimer_intr_overflow(OpenMote* self) {\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: radiotimer_intr_overflow(), calling 0x%x... \\n\",self,self->radiotimer_icb.overflow_cb);\n-#endif\n-\n- self->radiotimer_icb.overflow_cb(self);\n-\n-#ifdef TRACE_ON\n- printf(\"C@0x%x: ...done.\\n\",self);\n-#endif\n-}\n-\n-//=========================== private =========================================\n\\ No newline at end of file\n" }, { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/python/sctimer_obj.c", "diff": "+/**\n+\\brief Python-specific definition of the \"sctimer\" bsp module.\n+\n+\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, May 2013.\n+*/\n+\n+#include \"sctimer_obj.h\"\n+\n+//=========================== variables =======================================\n+\n+//=========================== prototypes ======================================\n+\n+//=========================== callback ========================================\n+\n+void sctimer_set_callback(OpenMote* self, sctimer_cbt cb) {\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: sctimer_set_callback(cb=0x%x)... \\n\",self,cb);\n+#endif\n+\n+ self->sctimer_icb.compare_cb = cb;\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: ...done.\\n\",self);\n+#endif\n+}\n+\n+//=========================== public ==========================================\n+\n+//===== admin\n+\n+void sctimer_init(OpenMote* self) {\n+ PyObject* result;\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: sctimer_init()... \\n\",self,self);\n+#endif\n+\n+ // forward to Python\n+ result = PyObject_CallObject(self->callback[MOTE_NOTIF_sctimer_init],NULL);\n+ if (result == NULL) {\n+ printf(\"[CRITICAL] sctimer_init() returned NULL\\r\\n\");\n+ return;\n+ }\n+ Py_DECREF(result);\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: ...done.\\n\",self);\n+#endif\n+}\n+\n+//===== direct access\n+\n+PORT_RADIOTIMER_WIDTH sctimer_readCounter(OpenMote* self) {\n+ PyObject* result;\n+ PORT_RADIOTIMER_WIDTH returnVal;\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: sctimer_readCounter()... \\n\",self);\n+#endif\n+\n+ // forward to Python\n+ result = PyObject_CallObject(self->callback[MOTE_NOTIF_sctimer_readCounter],NULL);\n+ if (result == NULL) {\n+ printf(\"[CRITICAL] sctimer_readCounter() returned NULL\\r\\n\");\n+ return 0;\n+ }\n+ if (!PyInt_Check(result)) {\n+ printf(\"[CRITICAL] sctimer_readCounter() returned NULL\\r\\n\");\n+ return 0;\n+ }\n+ returnVal = PyInt_AsLong(result);\n+\n+ // dispose of returned value\n+ Py_DECREF(result);\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: ...got %d.\\n\",self,returnVal);\n+#endif\n+\n+ return returnVal;\n+}\n+\n+//===== compare\n+\n+void sctimer_setCompare(OpenMote* self, PORT_RADIOTIMER_WIDTH value) {\n+ PyObject* result;\n+ PyObject* arglist;\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: sctimer_setCompare(value=%d)... \\n\",self,value);\n+#endif\n+\n+ // forward to Python\n+ arglist = Py_BuildValue(\"(i)\",value);\n+ result = PyObject_CallObject(self->callback[MOTE_NOTIF_sctimer_setCompare],arglist);\n+ if (result == NULL) {\n+ printf(\"[CRITICAL] sctimer_setCompare() returned NULL\\r\\n\");\n+ return;\n+ }\n+ Py_DECREF(result);\n+ Py_DECREF(arglist);\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: ...done.\\n\",self);\n+#endif\n+}\n+\n+void sctimer_enable(OpenMote* self) {\n+ PyObject* result;\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: sctimer_enable()... \\n\",self);\n+#endif\n+\n+ // forward to Python\n+ result = PyObject_CallObject(self->callback[MOTE_NOTIF_sctimer_enable],NULL);\n+ if (result == NULL) {\n+ printf(\"[CRITICAL] sctimer_enable() returned NULL\\r\\n\");\n+ return;\n+ }\n+ Py_DECREF(result);\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: ...done.\\n\",self);\n+#endif\n+}\n+\n+void sctimer_disable(OpenMote* self) {\n+ PyObject* result;\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: sctimer_disable()... \\n\",self);\n+#endif\n+\n+ // forward to Python\n+ result = PyObject_CallObject(self->callback[MOTE_NOTIF_sctimer_disable],NULL);\n+ if (result == NULL) {\n+ printf(\"[CRITICAL] sctimer_disable() returned NULL\\r\\n\");\n+ return;\n+ }\n+ Py_DECREF(result);\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: ...done.\\n\",self);\n+#endif\n+}\n+\n+//=========================== interrupt handlers ==============================\n+\n+void sctimer_intr_compare(OpenMote* self) {\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: sctimer_intr_compare(), calling 0x%x... \\n\",self,self->sctimer_icb.compare_cb);\n+#endif\n+\n+ self->sctimer_icb.compare_cb(self);\n+\n+#ifdef TRACE_ON\n+ printf(\"C@0x%x: ...done.\\n\",self);\n+#endif\n+}\n+\n+//=========================== private =========================================\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/radiotimer.h", "new_path": null, "diff": "-#ifndef __RADIOTIMER_H\n-#define __RADIOTIMER_H\n-\n-/**\n-\\addtogroup BSP\n-\\{\n-\\addtogroup radiotimer\n-\\{\n-\n-\\brief Cross-platform declaration \"radiotimer\" bsp module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012.\n-*/\n-\n-#include \"stdint.h\"\n-#include \"board.h\"\n-\n-//=========================== define ==========================================\n-#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\n-\n-enum radiotimer_action_enum {\n- // action items\n- ACTION_LOAD_PACKET = 0x01,\n- ACTION_SEND_PACKET = 0x02,\n- ACTION_RADIORX_ENABLE = 0x03,\n- ACTION_NORMAL_TIMER = 0x04,\n- ACTION_TX_SFD_DONE = 0x05,\n- ACTION_RX_SFD_DONE = 0x06,\n- ACTION_TX_SEND_DONE = 0x07,\n- ACTION_RX_DONE = 0x08,\n- ACTION_ALL_RADIOTIMER_INTERRUPT = 0x09,\n-};\n-\n-#else\n-#endif\n-\n-//=========================== typedef =========================================\n-\n-typedef void (*radiotimer_compare_cbt)(void);\n-typedef void (*radiotimer_capture_cbt)(PORT_TIMER_WIDTH timestamp);\n-\n-//=========================== variables =======================================\n-\n-//=========================== prototypes ======================================\n-\n-// admin\n-void radiotimer_init(void);\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb);\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb);\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb);\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb);\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period);\n-// direct access\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue(void);\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period);\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod(void);\n-// compare\n-#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\n-void radiotimer_schedule(uint8_t type,PORT_RADIOTIMER_WIDTH offset);\n-void radiotimer_cancel(uint8_t type);\n-void radiotimer_setCapture(uint8_t type);\n-#else\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset);\n-void radiotimer_cancel(void);\n-#endif\n-// capture\n-PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime(void);\n-\n-// interrupt handlers\n-kick_scheduler_t radiotimer_isr(void);\n-\n-/**\n-\\}\n-\\}\n-*/\n-\n-#endif\n" }, { "change_type": "MODIFY", "old_path": "projects/python/SConscript.env", "new_path": "projects/python/SConscript.env", "diff": "@@ -163,7 +163,7 @@ returnTypes = [\n'uint16_t',\n'uint32_t',\n'bool',\n- 'opentimer_id_t',\n+ 'opentimers_id_t',\n'PORT_TIMER_WIDTH',\n'PORT_RADIOTIMER_WIDTH',\n'dagrank_t',\n@@ -193,10 +193,8 @@ callbackFunctionsToChange = [\n# radio\n'startFrame_cb',\n'endFrame_cb',\n- # radiotimer\n- 'overflow_cb',\n- 'compare_cb',\n# sctimer\n+ 'compare_cb',\n# uart\n'txCb',\n'rxCb',\n@@ -411,12 +409,16 @@ functionsToChange = [\n'isr_openserial_rx',\n# opentimers\n'opentimers_init',\n- 'opentimers_start',\n- 'opentimers_setPeriod',\n- 'opentimers_stop',\n- 'opentimers_restart',\n+ 'opentimers_create',\n+ 'opentimers_scheduleRelative',\n+ 'opentimers_scheduleAbsolute',\n+ 'opentimers_cancel',\n+ 'opentimers_destroy',\n+ 'opentimers_getValue',\n+ 'opentimers_getCurrentTimeout',\n+ 'opentimers_isRunning',\n+ 'opentimers_setPriority',\n'opentimers_timer_callback',\n- 'opentimers_sleepTimeCompesation',\n#===== kernel\n# scheduler\n'scheduler_init',\n@@ -854,12 +856,11 @@ headerFiles = [\n'opendefs',\n#=== libbsp\n'board',\n- 'bsp_timer',\n+ 'sctimer',\n'debugpins',\n'eui64',\n'leds',\n'radio',\n- 'radiotimer',\n'uart',\n#=== libdrivers,\n'openhdlc',\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. port for python simulated board.
491,595
02.05.2017 08:35:09
-7,200
8ec933c8202e02338726d1ba950131ecda7f36ec
Fixed simulation.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/python/board_info.h", "new_path": "bsp/boards/python/board_info.h", "diff": "//===== timer\n-#define PORT_TIMER_WIDTH uint16_t\n-#define PORT_RADIOTIMER_WIDTH uint16_t\n+#define PORT_TIMER_WIDTH uint32_t\n+#define PORT_RADIOTIMER_WIDTH uint32_t\n-#define PORT_SIGNED_INT_WIDTH int16_t\n+#define PORT_SIGNED_INT_WIDTH int32_t\n#define PORT_TICS_PER_MS 33\n// on GINA, we use the comparatorA interrupt for the OS\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/openwsnmodule.c", "new_path": "bsp/boards/python/openwsnmodule.c", "diff": "@@ -203,8 +203,8 @@ static PyObject* OpenMote_radio_isr_startFrame(OpenMote* self, PyObject* args) {\nif (!PyArg_ParseTuple(args, \"i\", &capturedTime)) {\nreturn NULL;\n}\n- if (capturedTime>0xffff) {\n- fprintf(stderr,\"[OpenMote_radio_isr_startFrame] FATAL: capturedTime larger than 0xffff\\n\");\n+ if (capturedTime>0xffffffff) {\n+ fprintf(stderr,\"[OpenMote_radio_isr_startFrame] FATAL: capturedTime larger than 0xffffffff\\n\");\n// TODO raise exception\nreturn NULL;\n}\n@@ -212,7 +212,7 @@ static PyObject* OpenMote_radio_isr_startFrame(OpenMote* self, PyObject* args) {\n// call the callback\nradio_intr_startOfFrame(\nself,\n- (uint16_t)capturedTime\n+ (uint32_t)capturedTime\n);\n// return successfully\n@@ -226,8 +226,8 @@ static PyObject* OpenMote_radio_isr_endFrame(OpenMote* self, PyObject* args) {\nif (!PyArg_ParseTuple(args, \"i\", &capturedTime)) {\nreturn NULL;\n}\n- if (capturedTime>0xffff) {\n- fprintf(stderr,\"[OpenMote_radio_isr_startFrame] FATAL: capturedTime larger than 0xffff\\n\");\n+ if (capturedTime>0xffffffff) {\n+ fprintf(stderr,\"[OpenMote_radio_isr_startFrame] FATAL: capturedTime larger than 0xffffffff\\n\");\n// TODO raise exception\nreturn NULL;\n}\n@@ -235,14 +235,14 @@ static PyObject* OpenMote_radio_isr_endFrame(OpenMote* self, PyObject* args) {\n// call the callback\nradio_intr_endOfFrame(\nself,\n- (uint16_t)capturedTime\n+ (uint32_t)capturedTime\n);\n// return successfully\nPy_RETURN_NONE;\n}\n-static PyObject* OpenMote_sctimer_isr_compare(OpenMote* self) {\n+static PyObject* OpenMote_sctimer_isr(OpenMote* self) {\n// no arguments\n@@ -310,7 +310,7 @@ static PyMethodDef OpenMote_methods[] = {\n//=== BSP\n{ \"radio_isr_startFrame\", (PyCFunction)OpenMote_radio_isr_startFrame, METH_VARARGS, \"\"},\n{ \"radio_isr_endFrame\", (PyCFunction)OpenMote_radio_isr_endFrame, METH_VARARGS, \"\"},\n- { \"sctimer_isr_compare\", (PyCFunction)OpenMote_sctimer_isr_compare, METH_NOARGS, \"\"},\n+ { \"sctimer_isr\", (PyCFunction)OpenMote_sctimer_isr, METH_NOARGS, \"\"},\n{ \"uart_isr_tx\", (PyCFunction)OpenMote_uart_isr_tx, METH_NOARGS, \"\"},\n{ \"uart_isr_rx\", (PyCFunction)OpenMote_uart_isr_rx, METH_NOARGS, \"\"},\n{ \"supply_on\", (PyCFunction)OpenMote_supply_on, METH_NOARGS, \"\"},\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/openwsnmodule_obj.h", "new_path": "bsp/boards/python/openwsnmodule_obj.h", "diff": "//=========================== prototypes ======================================\n// radio\n-void radio_intr_startOfFrame(OpenMote* self, uint16_t capturedTime);\n-void radio_intr_endOfFrame(OpenMote* self, uint16_t capturedTime);\n+void radio_intr_startOfFrame(OpenMote* self, uint32_t capturedTime);\n+void radio_intr_endOfFrame(OpenMote* self, uint32_t capturedTime);\n// sctimer\nvoid sctimer_intr_compare(OpenMote* self);\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/radio_obj.c", "new_path": "bsp/boards/python/radio_obj.c", "diff": "@@ -330,11 +330,11 @@ void radio_getReceivedFrame(OpenMote* self,\n//=========================== interrupts ======================================\n-void radio_intr_startOfFrame(OpenMote* self, uint16_t capturedTime) {\n+void radio_intr_startOfFrame(OpenMote* self, uint32_t capturedTime) {\nself->radio_icb.startFrame_cb(self, capturedTime);\n}\n-void radio_intr_endOfFrame(OpenMote* self, uint16_t capturedTime) {\n+void radio_intr_endOfFrame(OpenMote* self, uint32_t capturedTime) {\nself->radio_icb.endFrame_cb(self, capturedTime);\n}\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/python/sctimer_obj.c", "new_path": "bsp/boards/python/sctimer_obj.c", "diff": "@@ -65,17 +65,11 @@ PORT_RADIOTIMER_WIDTH sctimer_readCounter(OpenMote* self) {\nprintf(\"[CRITICAL] sctimer_readCounter() returned NULL\\r\\n\");\nreturn 0;\n}\n- if (!PyInt_Check(result)) {\n- printf(\"[CRITICAL] sctimer_readCounter() returned NULL\\r\\n\");\n- return 0;\n- }\n- returnVal = PyInt_AsLong(result);\n-\n- // dispose of returned value\n+ returnVal = (PORT_TIMER_WIDTH)PyInt_AsLong(result);\nPy_DECREF(result);\n#ifdef TRACE_ON\n- printf(\"C@0x%x: ...got %d.\\n\",self,returnVal);\n+ printf(\"returnVal=%d.\\n\",returnVal);\n#endif\nreturn returnVal;\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/sctimer.h", "new_path": "bsp/boards/sctimer.h", "diff": "\\brief A timer module with only a single compare value.\n-\\author Tengfei Chang <tengfei.chang@eecs.berkeley.edu>, April 2017.\n+\\author Tengfei Chang <tengfei.chang@inria.fr>, April 2017.\n*/\n#include \"stdint.h\"\n" }, { "change_type": "MODIFY", "old_path": "projects/python/test_openwsn.py", "new_path": "projects/python/test_openwsn.py", "diff": "@@ -34,8 +34,8 @@ def eui64_get():\nprint \"P: eui64_get()\"\nreturn range(8)\n-def bsp_timer_scheduleIn(delay):\n- print \"P: bsp_timer_scheduleIn({0})\".format(delay)\n+def sctimer_setCompare(delay):\n+ print \"P: sctimer_setCompare({0})\".format(delay)\n# create instance\nmote = oos_openwsn.OpenMote()\n@@ -48,7 +48,7 @@ for i in range(len(notifString)-1):\n# overwrite some callbacks\nmote.set_callback(notifId('eui64_get'), eui64_get)\n-mote.set_callback(notifId('bsp_timer_scheduleIn'),bsp_timer_scheduleIn)\n+mote.set_callback(notifId('sctimer_setCompare'),sctimer_setCompare)\n# start the mote\nmote.supply_on()\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. Fixed simulation.
491,595
03.05.2017 15:50:25
-7,200
48be20275dc3df80dd53f2e896a4c90b47fee789
port sctimer on openmotestm.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/sctimer.c", "new_path": "bsp/boards/openmote-cc2538/sctimer.c", "diff": "/**\n\\brief A timer module with only a single compare value.\n-\\author Xavier Vilajosana <xvilajosana@eecs.berkeley.edu>\n-\\author Christian Hopfner <christian.hopfner@pcm.endress.com>, September 2016\n\\author Tengfei Chang <tengfei.chang@inria.fr> April 2017\n*/\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/board.c", "new_path": "bsp/boards/openmotestm/board.c", "diff": "#include \"leds.h\"\n#include \"uart.h\"\n#include \"spi.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n#include \"rcc.h\"\n#include \"nvic.h\"\n#include \"debugpins.h\"\n@@ -91,9 +90,8 @@ void board_init(){\nleds_init();\nuart_init();\nspi_init();\n- bsp_timer_init();\n+ sctimer_init();\nradio_init();\n- radiotimer_init();\ndebugpins_init();\n//enable nvic for the radio\nNVIC_radio();\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/board_info.h", "new_path": "bsp/boards/openmotestm/board_info.h", "diff": "@@ -29,10 +29,10 @@ to return the board's description.\n//===== timer\n-#define PORT_TIMER_WIDTH uint16_t\n-#define PORT_RADIOTIMER_WIDTH uint16_t\n+#define PORT_TIMER_WIDTH uint32_t\n+#define PORT_RADIOTIMER_WIDTH uint32_t\n-#define PORT_SIGNED_INT_WIDTH int16_t\n+#define PORT_SIGNED_INT_WIDTH int32_t\n#define PORT_TICS_PER_MS 32\n#define SCHEDULER_WAKEUP() EXTI->SWIER |= EXTI_Line1;\n#define SCHEDULER_ENABLE_INTERRUPT() //enable in board use EXTI_Line1\n@@ -70,6 +70,10 @@ to return the board's description.\n#define SYNC_ACCURACY 2 // by ticks\n+//===== opentimers\n+\n+#define TIMERTHRESHOLD 10\n+\n//=========================== typedef ========================================\n//=========================== variables =======================================\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/configure/stm32f10x_it.c", "new_path": "bsp/boards/openmotestm/configure/stm32f10x_it.c", "diff": "/* Includes ------------------------------------------------------------------*/\n#include \"stm32f10x_it.h\"\n#include \"leds.h\"\n-#include \"bsp_timer.h\"\n-#include \"radiotimer.h\"\n+#include \"sctimer.h\"\n#include \"spi.h\"\n#include \"radio.h\"\n#include \"uart.h\"\n@@ -476,14 +475,6 @@ void TIM1_CC_IRQHandler(void)\n*******************************************************************************/\nvoid TIM2_IRQHandler(void)\n{\n- debugpins_isr_set();\n- if(TIM_GetFlagStatus(TIM2,TIM_FLAG_CC1) != RESET)\n- {\n- TIM_ClearFlag(TIM2,TIM_FLAG_CC1);\n- //leds_error_toggle();\n- bsp_timer_isr();\n- }\n- debugpins_isr_clr();\n}\n/*******************************************************************************\n@@ -637,8 +628,7 @@ void USART3_IRQHandler(void)\n* Output : None\n* Return : None\n*******************************************************************************/\n-void EXTI15_10_IRQHandler(void)\n-{\n+void EXTI15_10_IRQHandler(void){\ndebugpins_isr_set();\nif(EXTI_GetITStatus(EXTI_Line10) != RESET)\n{\n@@ -665,7 +655,7 @@ void RTCAlarm_IRQHandler(void)\nif(EXTI_GetITStatus(EXTI_Line17) != RESET)\n{\nEXTI_ClearITPendingBit(EXTI_Line17);\n- radiotimer_isr();\n+ sctimer_isr();\n}\ndebugpins_isr_clr();\n}\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/nvic.c", "new_path": "bsp/boards/openmotestm/nvic.c", "diff": "@@ -45,20 +45,8 @@ void NVIC_spi(void) {\n#endif\n}\n-//configuration bsptimer interrput\n-void NVIC_bsptimer(void) {\n-\n- //Configure NVIC: Preemption Priority = 2 and Sub Priority = 1\n- NVIC_InitTypeDef NVIC_InitStructure;\n- NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQChannel;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\n- NVIC_Init(&NVIC_InitStructure);\n-}\n-\n//configuration radiotimer interrput\n-void NVIC_radiotimer(void) {\n+void NVIC_sctimer(void) {\nNVIC_InitTypeDef NVIC_InitStructure;\n//Configure RTC Alarm interrupt:\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/nvic.h", "new_path": "bsp/boards/openmotestm/nvic.h", "diff": "@@ -22,8 +22,7 @@ void NVIC_Configuration(void);\n//configuration module interrput on openmotestm32\nvoid NVIC_uart(void);\nvoid NVIC_spi(void);\n-void NVIC_bsptimer(void);\n-void NVIC_radiotimer(void);\n+void NVIC_sctimer(void);\nvoid NVIC_radio(void);\n#endif\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/sctimer.h", "new_path": "bsp/boards/sctimer.h", "diff": "@@ -31,6 +31,8 @@ PORT_TIMER_WIDTH sctimer_readCounter(void);\nvoid sctimer_enable(void);\nvoid sctimer_disable(void);\n+kick_scheduler_t sctimer_isr(void);\n+\n/**\n\\}\n\\}\n" }, { "change_type": "MODIFY", "old_path": "bsp/chips/at86rf231/radio.c", "new_path": "bsp/chips/at86rf231/radio.c", "diff": "#include \"radio.h\"\n#include \"at86rf231.h\"\n#include \"spi.h\"\n-#include \"radiotimer.h\"\n#include \"debugpins.h\"\n#include \"leds.h\"\n+#include \"sctimer.h\"\n//=========================== defines =========================================\n//=========================== variables =======================================\ntypedef struct {\n- radiotimer_capture_cbt startFrame_cb;\n- radiotimer_capture_cbt endFrame_cb;\n+ radio_capture_cbt startFrame_cb;\n+ radio_capture_cbt endFrame_cb;\nradio_state_t state;\n} radio_vars_t;\n@@ -70,19 +70,11 @@ void radio_init() {\nradio_vars.state = RADIOSTATE_RFOFF;\n}\n-void radio_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_setOverflowCb(cb);\n-}\n-\n-void radio_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_setCompareCb(cb);\n-}\n-\n-void radio_setStartFrameCb(radiotimer_capture_cbt cb) {\n+void radio_setStartFrameCb(radio_capture_cbt cb) {\nradio_vars.startFrame_cb = cb;\n}\n-void radio_setEndFrameCb(radiotimer_capture_cbt cb) {\n+void radio_setEndFrameCb(radio_capture_cbt cb) {\nradio_vars.endFrame_cb = cb;\n}\n@@ -92,24 +84,6 @@ void radio_reset() {\nPORT_PIN_RADIO_RESET_LOW();\n}\n-//===== timer\n-\n-void radio_startTimer(PORT_TIMER_WIDTH period) {\n- radiotimer_start(period);\n-}\n-\n-PORT_TIMER_WIDTH radio_getTimerValue() {\n- return radiotimer_getValue();\n-}\n-\n-void radio_setTimerPeriod(PORT_TIMER_WIDTH period) {\n- radiotimer_setPeriod(period);\n-}\n-\n-PORT_TIMER_WIDTH radio_getTimerPeriod() {\n- return radiotimer_getPeriod();\n-}\n-\n//===== RF admin\nvoid radio_setFrequency(uint8_t frequency) {\n@@ -192,7 +166,7 @@ void radio_txNow() {\n// transmitted (I've never seen that).\nif (radio_vars.startFrame_cb!=NULL) {\n// call the callback\n- val=radiotimer_getCapturedTime();\n+ val=sctimer_readCounter();\nradio_vars.startFrame_cb(val);\n}\n}\n@@ -407,7 +381,7 @@ kick_scheduler_t radio_isr() {\nuint8_t irq_status;\n// capture the time\n- capturedTime = radiotimer_getCapturedTime();\n+ capturedTime = sctimer_readCounter();\n// reading IRQ_STATUS causes radio's IRQ pin to go low\nirq_status = radio_spiReadReg(RG_IRQ_STATUS);\n" }, { "change_type": "MODIFY", "old_path": "projects/common/02drv_opentimers2/02drv_opentimers2.c", "new_path": "projects/common/02drv_opentimers2/02drv_opentimers2.c", "diff": "/**\n-\\brief This is a program which shows how to use the \"opentimers2 \"driver module.\n+\\brief This is a program which shows how to use the \"opentimers \"driver module.\nSince the driver modules for different platforms have the same declaration, you\ncan use this project with any platform.\n@@ -20,20 +20,20 @@ radio and sync). When you run the application, you should see the LEDs\n#include \"leds.h\"\n#include \"sctimer.h\"\n// driver modules required\n-#include \"opentimers2.h\"\n+#include \"opentimers.h\"\n//=========================== defines =========================================\n#define APP_DLY_TIMER0_ticks 16384 // half second @ 32kHz\n-#define APP_DLY_TIMER1_ticks 16385 // a little bit more than half second @ 32kHz\n+#define APP_DLY_TIMER1_ticks 16384 // a little bit more than half second @ 32kHz\n#define APP_DLY_TIMER2_ticks 32768 // one second @ 32kHz\n//=========================== variables =======================================\ntypedef struct {\n- opentimers2_id_t timer0;\n- opentimers2_id_t timer1;\n- opentimers2_id_t timer2;\n+ opentimers_id_t timer0;\n+ opentimers_id_t timer1;\n+ opentimers_id_t timer2;\n} app_vars_t;\napp_vars_t app_vars;\n@@ -54,11 +54,11 @@ int mote_main(void) {\nmemset(&app_vars,0,sizeof(app_vars_t));\nboard_init();\n- opentimers2_init();\n+ opentimers_init();\nreference = sctimer_readCounter();\n- app_vars.timer0 = opentimers2_create(0);\n- opentimers2_scheduleAbsolute(\n+ app_vars.timer0 = opentimers_create();\n+ opentimers_scheduleAbsolute(\napp_vars.timer0, // timerId\nAPP_DLY_TIMER0_ticks, // duration\nreference, // reference\n@@ -66,8 +66,8 @@ int mote_main(void) {\ncb_timer0 // callback\n);\n- app_vars.timer1 = opentimers2_create(255);\n- opentimers2_scheduleAbsolute(\n+ app_vars.timer1 = opentimers_create();\n+ opentimers_scheduleAbsolute(\napp_vars.timer1, // timerId\nAPP_DLY_TIMER1_ticks, // duration\nreference, // reference\n@@ -75,8 +75,8 @@ int mote_main(void) {\ncb_timer1 // callback\n);\n- app_vars.timer2 = opentimers2_create(0);\n- opentimers2_scheduleAbsolute(\n+ app_vars.timer2 = opentimers_create();\n+ opentimers_scheduleAbsolute(\napp_vars.timer2, // timerId\nAPP_DLY_TIMER2_ticks, // duration\nreference, // reference\n@@ -94,7 +94,7 @@ int mote_main(void) {\nvoid cb_timer0(void) {\nleds_error_toggle();\n// re-schedule refer to previous scheduled value\n- opentimers2_scheduleRelative(\n+ opentimers_scheduleRelative(\napp_vars.timer0, // timerId\nAPP_DLY_TIMER0_ticks, // duration\nTIME_TICS, // timetype\n@@ -105,7 +105,7 @@ void cb_timer0(void) {\nvoid cb_timer1(void) {\nleds_radio_toggle();\n// re-schedule refer to previous scheduled value\n- opentimers2_scheduleRelative(\n+ opentimers_scheduleRelative(\napp_vars.timer1, // timerId\nAPP_DLY_TIMER1_ticks, // duration\nTIME_TICS, // timetype\n@@ -116,7 +116,7 @@ void cb_timer1(void) {\nvoid cb_timer2(void) {\nleds_sync_toggle();\n// re-schedule refer to previous scheduled value\n- opentimers2_scheduleRelative(\n+ opentimers_scheduleRelative(\napp_vars.timer2, // timerId\nAPP_DLY_TIMER2_ticks, // duration\nTIME_TICS, // timetype\n" }, { "change_type": "MODIFY", "old_path": "projects/openmotestm/03oos_openwsn/03oos_openwsn.ewp", "new_path": "projects/openmotestm/03oos_openwsn/03oos_openwsn.ewp", "diff": "<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmotestm\\board_info.h</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmotestm\\bsp_timer.c</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmotestm\\debugpins.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmotestm\\nvic.h</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmotestm\\radiotimer.c</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmotestm\\rcc.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmotestm\\rcc.h</name>\n</file>\n+ <file>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmotestm\\sctimer.c</name>\n+ </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\openmotestm\\spi.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\board.h</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\bsp_timer.h</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\debugpins.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\radio.h</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\radiotimer.h</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\sctimer.h</name>\n</file>\n<name>02a-MAClow</name>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\adaptive_sync.c</name>\n+ <excluded>\n+ <configuration>Debug</configuration>\n+ </excluded>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\adaptive_sync.h</name>\n+ <excluded>\n+ <configuration>Debug</configuration>\n+ </excluded>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\IEEE802154.c</name>\n" }, { "change_type": "MODIFY", "old_path": "projects/openmotestm/openmotestm.eww", "new_path": "projects/openmotestm/openmotestm.eww", "diff": "<project>\n<path>$WS_DIR$\\02drv_opentimers\\02drv_opentimers.ewp</path>\n</project>\n+ <project>\n+ <path>$WS_DIR$\\02drv_opentimers2\\02drv_opentimers2.ewp</path>\n+ </project>\n<project>\n<path>$WS_DIR$\\03oos_macpong\\03oos_macpong.ewp</path>\n</project>\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. port sctimer on openmotestm.
491,595
03.05.2017 15:54:28
-7,200
db5b4116c6cb8d4a5afb8eab9d0c9d14e54e37c9
update the cc2538 isr function.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/sctimer.c", "new_path": "bsp/boards/openmote-cc2538/sctimer.c", "diff": "@@ -25,8 +25,6 @@ sctimer_vars_t sctimer_vars;\n// ========================== private =========================================\n-static void sctimer_isr(void);\n-\n// ========================== protocol =========================================\n/**\n@@ -81,9 +79,15 @@ void sctimer_disable(void){\n// ========================== private =========================================\n-void sctimer_isr(void) {\n+kick_scheduler_t sctimer_isr(void)\ndebugpins_isr_set();\n+ if (sctimer_vars.sctimer_cb!=NULL) {\nIntPendClear(INT_SMTIM);\nsctimer_vars.sctimer_cb();\ndebugpins_isr_clr();\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ debugpins_isr_clr();\n+ return DO_NOT_KICK_SCHEDULER;\n}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. update the cc2538 isr function.
491,595
03.05.2017 16:01:53
-7,200
63ddd3a612c27f298c8515e0fae82cf9284df759
remove bsp_timer.c and radiotimer.c files.
[ { "change_type": "DELETE", "old_path": "bsp/boards/openmote-cc2538/bsp_timer.c", "new_path": null, "diff": "-/**\n- * Author: Xavier Vilajosana (xvilajosana@eecs.berkeley.edu)\n- * Pere Tuset (peretuset@openmote.com)\n- * Date: July 2013\n- * Description: CC2538-specific definition of the \"bsp_timer\" bsp module.\n- */\n-\n-#include <string.h>\n-\n-#include <headers/hw_ints.h>\n-#include <headers/hw_memmap.h>\n-#include <headers/hw_smwdthrosc.h>\n-\n-#include <source/debug.h>\n-#include <source/interrupt.h>\n-\n-#include \"board.h\"\n-#include \"bsp_timer.h\"\n-#include \"debugpins.h\"\n-#include \"sleepmode.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- bsp_timer_cbt cb;\n- PORT_TIMER_WIDTH last_compare_value;\n- bool initiated;\n- uint32_t tooclose;\n- uint32_t diff;\n-} bsp_timer_vars_t;\n-\n-bsp_timer_vars_t bsp_timer_vars;\n-\n-//=========================== prototypes ======================================\n-void bsp_timer_isr_private(void);\n-//=========================== public ==========================================\n-\n-/**\n- \\brief Initialize this module.\n-\n- This functions starts the timer, i.e. the counter increments, but doesn't set\n- any compare registers, so no interrupt will fire.\n- */\n-void bsp_timer_init() {\n-\n- // clear local variables\n- memset(&bsp_timer_vars, 0, sizeof(bsp_timer_vars_t));\n-\n- // enable peripheral Sleeptimer\n- IntRegister(INT_SMTIM, bsp_timer_isr_private);\n-}\n-\n-/**\n- \\brief Register a callback.\n-\n- \\param cb The function to be called when a compare event happens.\n- */\n-void bsp_timer_set_callback(bsp_timer_cbt cb) {\n- bsp_timer_vars.cb = cb;\n-}\n-\n-/**\n- \\brief Reset the timer.\n-\n- This function does not stop the timer, it rather resets the value of the\n- counter, and cancels a possible pending compare event.\n- */\n-void bsp_timer_reset() {\n- // reset compare\n-\n- // reset timer\n- bsp_timer_vars.initiated=false;\n- // record last timer compare value\n- bsp_timer_vars.last_compare_value = 0;\n-}\n-\n-/**\n- \\brief Schedule the callback to be called in some specified time.\n-\n- The delay is expressed relative to the last compare event. It doesn't matter\n- how long it took to call this function after the last compare, the timer will\n- expire precisely delayTicks after the last one.\n-\n- The only possible problem is that it took so long to call this function that\n- the delay specified is shorter than the time already elapsed since the last\n- compare. In that case, this function triggers the interrupt to fire right away.\n-\n- This means that the interrupt may fire a bit off, but this inaccuracy does not\n- propagate to subsequent timers.\n-\n- \\param delayTicks Number of ticks before the timer expired, relative to the\n- last compare event.\n- */\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks) {\n- PORT_TIMER_WIDTH newCompareValue, current;\n- PORT_TIMER_WIDTH temp_last_compare_value;\n-\n- if (!bsp_timer_vars.initiated){\n- //as the timer runs forever the first time it is turned on has a weired value\n- bsp_timer_vars.last_compare_value=SleepModeTimerCountGet();\n- bsp_timer_vars.initiated=true;\n- }\n-\n- temp_last_compare_value = bsp_timer_vars.last_compare_value;\n-\n- newCompareValue = bsp_timer_vars.last_compare_value + delayTicks + 1;\n- bsp_timer_vars.last_compare_value = newCompareValue;\n-\n- current = SleepModeTimerCountGet();\n-\n- if (delayTicks < current - temp_last_compare_value) {\n-\n- // we're already too late, schedule the ISR right now manually\n- // setting the interrupt flag triggers an interrupt\n- bsp_timer_vars.tooclose++;\n- bsp_timer_vars.diff=(current - temp_last_compare_value);\n- bsp_timer_vars.last_compare_value = current;\n- IntPendSet(INT_SMTIM);\n- } else {\n- // this is the normal case, have timer expire at newCompareValue\n- SleepModeTimerCompareSet(newCompareValue);\n- }\n- //enable interrupt\n- IntEnable(INT_SMTIM);\n-}\n-\n-/**\n- \\brief Cancel a running compare.\n- */\n-void bsp_timer_cancel_schedule() {\n- // Disable the Timer0B interrupt.\n- IntDisable(INT_SMTIM);\n-}\n-\n-/**\n- \\brief Return the current value of the timer's counter.\n-\n- \\returns The current value of the timer's counter.\n- */\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue() {\n- return SleepModeTimerCountGet();\n-}\n-\n-//=========================== private =========================================\n-\n-void bsp_timer_isr_private(void) {\n- debugpins_isr_set();\n- IntPendClear(INT_SMTIM);\n- bsp_timer_isr();\n- debugpins_isr_clr();\n-}\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t bsp_timer_isr() {\n-\n- // call the callback\n- bsp_timer_vars.cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n-}\n-\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/openmote-cc2538/radiotimer.c", "new_path": null, "diff": "-/**\n- * Author: Xavier Vilajosana (xvilajosana@eecs.berkeley.edu)\n- * Pere Tuset (peretuset@openmote.com)\n- * Date: July 2013\n- * Description: CC2538-specific definition of the \"radiotimer\" bsp module.\n- */\n-\n-\n-#include <stdio.h>\n-#include <string.h>\n-\n-#include <headers/hw_ints.h>\n-#include <headers/hw_rfcore_sfr.h>\n-#include <headers/hw_types.h>\n-\n-#include <source/interrupt.h>\n-#include <source/sys_ctrl.h>\n-\n-#include \"debugpins.h\"\n-#include \"radiotimer.h\"\n-\n-//=========================== defines =========================================\n-\n-#define RADIOTIMER_32MHZ_TICS_PER_32KHZ_TIC ( 976 ) // 32 MHz to 32 kHz ratio\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- radiotimer_compare_cbt overflow_cb;\n- radiotimer_compare_cbt compare_cb;\n-} radiotimer_vars_t;\n-\n-radiotimer_vars_t radiotimer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-void radiotimer_isr_private(void);\n-port_INLINE uint16_t get_real_counter(void);\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init() {\n- // clear local variables\n- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t));\n-}\n-\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.overflow_cb = cb;\n-}\n-\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.compare_cb = cb;\n-}\n-\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period) {\n-\n- //set period on the timer to 976 tics\n- HWREG(RFCORE_SFR_MTMSEL) = (0x02 << RFCORE_SFR_MTMSEL_MTMSEL_S) & RFCORE_SFR_MTMSEL_MTMSEL_M;\n-\n- HWREG(RFCORE_SFR_MTM0)=(RADIOTIMER_32MHZ_TICS_PER_32KHZ_TIC << RFCORE_SFR_MTM0_MTM0_S) & RFCORE_SFR_MTM0_MTM0_M;\n- HWREG(RFCORE_SFR_MTM1)=((RADIOTIMER_32MHZ_TICS_PER_32KHZ_TIC>> 8) << RFCORE_SFR_MTM1_MTM1_S)& RFCORE_SFR_MTM1_MTM1_M;\n-\n- //set counter on the timer to 0 tics\n- HWREG(RFCORE_SFR_MTMSEL) = (0x00 << RFCORE_SFR_MTMSEL_MTMSEL_S) & RFCORE_SFR_MTMSEL_MTMSEL_M;\n-\n- HWREG(RFCORE_SFR_MTM0)=(0x00<< RFCORE_SFR_MTM0_MTM0_S) & RFCORE_SFR_MTM0_MTM0_M;\n- HWREG(RFCORE_SFR_MTM1)=(0x00<< RFCORE_SFR_MTM1_MTM1_S) & RFCORE_SFR_MTM1_MTM1_M;\n-\n- //now overflow increments once every 1 32Khz tic.\n-\n- //select period register in the selector so it can be modified -- use OVF so we have 24bit register\n- HWREG(RFCORE_SFR_MTMSEL) = (0x02 << RFCORE_SFR_MTMSEL_MTMOVFSEL_S)& RFCORE_SFR_MTMSEL_MTMOVFSEL_M;\n- //set the period now -- low 8bits\n- HWREG(RFCORE_SFR_MTMOVF0) = (period << RFCORE_SFR_MTMOVF0_MTMOVF0_S)& RFCORE_SFR_MTMOVF0_MTMOVF0_M;\n- //set the period now -- middle 8bits\n- HWREG(RFCORE_SFR_MTMOVF1) = ((period >> 8) << RFCORE_SFR_MTMOVF1_MTMOVF1_S)& RFCORE_SFR_MTMOVF1_MTMOVF1_M;\n- //set the period now -- high 8bits\n- HWREG(RFCORE_SFR_MTMOVF2) = ((period >> 16) << RFCORE_SFR_MTMOVF2_MTMOVF2_S)& RFCORE_SFR_MTMOVF2_MTMOVF2_M;\n-\n- //select counter register in the selector so it can be modified -- use OVF version so we can have 24bit register\n- HWREG(RFCORE_SFR_MTMSEL) = (0x00<< RFCORE_SFR_MTMSEL_MTMOVFSEL_S) & RFCORE_SFR_MTMSEL_MTMOVFSEL_M;\n- //set the period now -- low 8bits\n- HWREG(RFCORE_SFR_MTMOVF0) = (0x00 << RFCORE_SFR_MTMOVF0_MTMOVF0_S) & RFCORE_SFR_MTMOVF0_MTMOVF0_M;\n- //set the period now -- middle 8bits\n- HWREG(RFCORE_SFR_MTMOVF1) = (0x00 << RFCORE_SFR_MTMOVF1_MTMOVF1_S) & RFCORE_SFR_MTMOVF1_MTMOVF1_M;\n- //set the period now -- high 8bits\n- HWREG(RFCORE_SFR_MTMOVF2) = (0x00 << RFCORE_SFR_MTMOVF2_MTMOVF2_S) & RFCORE_SFR_MTMOVF2_MTMOVF2_M;\n-\n- //enable period interrupt - ovf\n- HWREG(RFCORE_SFR_MTIRQM) = RFCORE_SFR_MTIRQM_MACTIMER_OVF_PERM;//RFCORE_SFR_MTIRQM_MACTIMER_OVF_PERM|RFCORE_SFR_MTIRQM_MACTIMER_PERM\n-\n- //register and enable the interrupt at the nvic\n- IntRegister(INT_MACTIMR, radiotimer_isr_private);\n- //clear all interrupts\n-\n- //active sync with 32khz clock and start the timer.\n- HWREG(RFCORE_SFR_MTIRQF)=0x00;\n-\n- //enable,synch with 32khz and dont latch 3bytes on ovf counter so we have 24bit timer on the ovf.\n- HWREG(RFCORE_SFR_MTCTRL)|=RFCORE_SFR_MTCTRL_RUN|RFCORE_SFR_MTCTRL_SYNC;\n-\n- while(!( HWREG(RFCORE_SFR_MTCTRL) & RFCORE_SFR_MTCTRL_STATE));//wait until stable.\n-\n- IntEnable(INT_MACTIMR);\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue() {\n- PORT_RADIOTIMER_WIDTH value=0;\n- //select period register in the selector so it can be read\n- HWREG(RFCORE_SFR_MTMSEL) = (0x00 << RFCORE_SFR_MTMSEL_MTMOVFSEL_S) & RFCORE_SFR_MTMSEL_MTMOVFSEL_M;\n- // compute value by adding m0 and m1 registers\n- value = HWREG(RFCORE_SFR_MTMOVF0);\n- value+=(HWREG(RFCORE_SFR_MTMOVF1)<<8);\n- value+=(HWREG(RFCORE_SFR_MTMOVF2)<<16);\n-\n- return value;\n-}\n-\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) {\n- //select period register in the selector so it can be modified -- use OVF so we have 24bit register\n- HWREG(RFCORE_SFR_MTMSEL) = (0x02 << RFCORE_SFR_MTMSEL_MTMOVFSEL_S)& RFCORE_SFR_MTMSEL_MTMOVFSEL_M;\n- //set the period now -- low 8bits\n- HWREG(RFCORE_SFR_MTMOVF0) = (period << RFCORE_SFR_MTMOVF0_MTMOVF0_S)& RFCORE_SFR_MTMOVF0_MTMOVF0_M;\n- //set the period now -- middle 8bits\n- HWREG(RFCORE_SFR_MTMOVF1) = ((period >> 8) << RFCORE_SFR_MTMOVF1_MTMOVF1_S)& RFCORE_SFR_MTMOVF1_MTMOVF1_M;\n- //set the period now -- high 8bits\n- HWREG(RFCORE_SFR_MTMOVF2) = ((period >> 16) << RFCORE_SFR_MTMOVF2_MTMOVF2_S)& RFCORE_SFR_MTMOVF2_MTMOVF2_M;\n-\n- IntEnable(INT_MACTIMR);\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod() {\n- PORT_RADIOTIMER_WIDTH period=0;\n- //select period register in the selector so it can be read\n- HWREG(RFCORE_SFR_MTMSEL) = (0x02 << RFCORE_SFR_MTMSEL_MTMOVFSEL_S) & RFCORE_SFR_MTMSEL_MTMOVFSEL_M;\n- // compute period by adding m0 and m1 registers\n- period = HWREG(RFCORE_SFR_MTMOVF0);\n- period+=(HWREG(RFCORE_SFR_MTMOVF1)<<8);\n- period+=(HWREG(RFCORE_SFR_MTMOVF2)<<16);\n-\n- return period;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) {\n- //select ovf cmp1 register in the selector so it can be modified\n- HWREG(RFCORE_SFR_MTMSEL) = (0x03 << RFCORE_SFR_MTMSEL_MTMOVFSEL_S) & RFCORE_SFR_MTMSEL_MTMOVFSEL_M;\n- //set value\n- HWREG(RFCORE_SFR_MTMOVF0) = (offset << RFCORE_SFR_MTMOVF0_MTMOVF0_S)& RFCORE_SFR_MTMOVF0_MTMOVF0_M;\n- //set the period now -- middle 8bits\n- HWREG(RFCORE_SFR_MTMOVF1) = ((offset >> 8) << RFCORE_SFR_MTMOVF1_MTMOVF1_S) & RFCORE_SFR_MTMOVF1_MTMOVF1_M;\n- //set the period now -- high 8bits\n- HWREG(RFCORE_SFR_MTMOVF2) = ((offset >> 16) << RFCORE_SFR_MTMOVF2_MTMOVF2_S)& RFCORE_SFR_MTMOVF2_MTMOVF2_M;\n- // enable cmp1 ovf interrupt (this also cancels any pending interrupts)\n- //clear interrupts\n- HWREG(RFCORE_SFR_MTIRQF)=~RFCORE_SFR_MTIRQM_MACTIMER_OVF_COMPARE1M;\n- //enable the timer compare interrupt\n- HWREG(RFCORE_SFR_MTIRQM)|=RFCORE_SFR_MTIRQM_MACTIMER_OVF_COMPARE1M;\n- IntEnable(INT_MACTIMR);\n-}\n-\n-void radiotimer_cancel() {\n- //select ovf cmp1 register in the selector so it can be modified\n- HWREG(RFCORE_SFR_MTMSEL) = (0x03 << RFCORE_SFR_MTMSEL_MTMOVFSEL_S) & RFCORE_SFR_MTMSEL_MTMOVFSEL_M;\n- //set value\n- HWREG(RFCORE_SFR_MTMOVF0) = (0x00 << RFCORE_SFR_MTMOVF0_MTMOVF0_S)& RFCORE_SFR_MTMOVF0_MTMOVF0_M;\n- //set the period now -- middle 8bits\n- HWREG(RFCORE_SFR_MTMOVF1) = (0x00 << RFCORE_SFR_MTMOVF1_MTMOVF1_S) & RFCORE_SFR_MTMOVF1_MTMOVF1_M;\n- //set the period now -- high 8bits\n- HWREG(RFCORE_SFR_MTMOVF2) = (0x00 << RFCORE_SFR_MTMOVF2_MTMOVF2_S)& RFCORE_SFR_MTMOVF2_MTMOVF2_M;\n- // disable cmp1 interrupt\n- HWREG(RFCORE_SFR_MTIRQM)&=~RFCORE_SFR_MTIRQM_MACTIMER_OVF_COMPARE1M;\n- //clear interrupts\n- HWREG(RFCORE_SFR_MTIRQF)=~RFCORE_SFR_MTIRQM_MACTIMER_OVF_COMPARE1M;\n-\n-}\n-\n-//===== capture\n-\n-port_INLINE PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime() {\n- volatile PORT_RADIOTIMER_WIDTH value=0;\n-\n- //select period register in the selector so it can be read\n- HWREG(RFCORE_SFR_MTMSEL) = (0x00 << RFCORE_SFR_MTMSEL_MTMOVFSEL_S) & RFCORE_SFR_MTMSEL_MTMOVFSEL_M;\n- // compute value by adding m0 and m1 registers\n- value = HWREG(RFCORE_SFR_MTMOVF0);\n- value+=(HWREG(RFCORE_SFR_MTMOVF1)<<8);\n- value+=(HWREG(RFCORE_SFR_MTMOVF2)<<16);\n-\n- return value;\n-}\n-\n-//=========================== private =========================================\n-\n-port_INLINE uint16_t get_real_counter(void){\n- uint16_t value=0;\n- //select period register in the selector so it can be read\n- HWREG(RFCORE_SFR_MTMSEL) = (0x00 << RFCORE_SFR_MTMSEL_MTMSEL_S)& RFCORE_SFR_MTMSEL_MTMSEL_M;\n- // compute value by adding m0 and m1 registers\n- value = HWREG(RFCORE_SFR_MTM0) + (HWREG(RFCORE_SFR_MTM1)<<8);\n- return value;\n-}\n-\n-//=========================== interrupt handlers ==============================\n-\n-void radiotimer_isr_private(){\n- debugpins_isr_set();\n- radiotimer_isr();\n- debugpins_isr_clr();\n-}\n-\n-/*\n- * The interrupt flags are given in the RFCORE_SFR_MTIRQF registers. The interrupt flag bits are set only\n-by hardware and are cleared only by writing to the SFR register.\n-Each interrupt source can be masked by its corresponding mask bit in the RFCORE_SFR_MTIRQM\n-register. An interrupt is generated when the corresponding mask bit is set; otherwise, the interrupt is not\n-generated. The interrupt flag bit is set, however, regardless of the state of the interrupt mask bit.\n- *\n- */\n-kick_scheduler_t radiotimer_isr() {\n-\n- uint8_t t2irqm;\n- uint8_t t2irqf;\n-\n- t2irqm = HWREG(RFCORE_SFR_MTIRQM);\n- t2irqf = HWREG(RFCORE_SFR_MTIRQF);\n-\n- IntPendClear(INT_MACTIMR);\n-\n- if ((t2irqf & RFCORE_SFR_MTIRQM_MACTIMER_OVF_COMPARE1M)& t2irqm){ // compare 1\n- debugpins_isr_toggle();\n- //clear interrupt\n- HWREG(RFCORE_SFR_MTIRQF)=~RFCORE_SFR_MTIRQM_MACTIMER_OVF_COMPARE1M;\n-\n- if (radiotimer_vars.compare_cb!=NULL) {\n- // call the callback\n- radiotimer_vars.compare_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- } else if((t2irqf & RFCORE_SFR_MTIRQM_MACTIMER_OVF_PERM) & t2irqm){ // timer overflows\n- debugpins_isr_toggle();\n- //clear interrupt\n- HWREG(RFCORE_SFR_MTIRQF)=~RFCORE_SFR_MTIRQM_MACTIMER_OVF_PERM;\n-\n- if (radiotimer_vars.overflow_cb!=NULL) {\n- // call the callback\n- radiotimer_vars.overflow_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- }\n- return DO_NOT_KICK_SCHEDULER;\n-}\n-\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/openmotestm/bsp_timer.c", "new_path": null, "diff": "-/**\n-\\brief openmoteSTM32 definition of the \"bsp_timer\" bsp module.\n-\n-On openmoteSTM32, we use TIM2 for the bsp_timer module.\n-\n-\\author Chang Tengfei <tengfei.chang@gmail.com>, July 2012.\n-*/\n-#include \"stm32f10x_lib.h\"\n-#include \"string.h\"\n-#include \"bsp_timer.h\"\n-#include \"board.h\"\n-\n-#include \"rcc.h\"\n-#include \"nvic.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- bsp_timer_cbt cb;\n- PORT_TIMER_WIDTH last_compare_value;\n-} bsp_timer_vars_t;\n-\n-bsp_timer_vars_t bsp_timer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-/**\n-\\brief Initialize this module.\n-\n-This functions starts the timer, i.e. the counter increments, but doesn't set\n-any compare registers, so no interrupt will fire.\n-*/\n-void bsp_timer_init() {\n- // clear local variables\n- memset(&bsp_timer_vars,0,sizeof(bsp_timer_vars_t));\n-\n- //Configure TIM2, Clock\n- RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2 , ENABLE);\n-\n- //Configure TIM2: Period = 0xffff, prescaler = 1023(32M/(1023+1) = 32.768KHz), CounterMode = upCounting mode\n- TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure ;\n- TIM_TimeBaseStructure.TIM_Period = 0xFFFF;\n- TIM_TimeBaseStructure.TIM_Prescaler = 1023;;\n- TIM_TimeBaseStructure.TIM_ClockDivision = 0;\n- TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;\n- TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);\n-\n- //Configure TIM2's out compare mode: out compare mode = toggle, out compare value = 0 (useless before enable compare interrupt), enable TIM2_CH1\n- TIM_OCInitTypeDef TIM_OCInitStructure;\n- TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle;\n- TIM_OCInitStructure.TIM_Pulse = 0;\n- TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;\n- TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;\n- TIM_OC1Init(TIM2, &TIM_OCInitStructure);\n-\n- //enable TIM2\n- TIM_Cmd(TIM2, ENABLE);\n-}\n-\n-/**\n-\\brief Register a callback.\n-\n-\\param cb The function to be called when a compare event happens.\n-*/\n-void bsp_timer_set_callback(bsp_timer_cbt cb){\n- bsp_timer_vars.cb = cb;\n- //enable nvic\n- NVIC_bsptimer();\n-}\n-\n-/**\n-\\brief Reset the timer.\n-\n-This function does not stop the timer, it rather resets the value of the\n-counter, and cancels a possible pending compare event.\n-*/\n-void bsp_timer_reset(){\n- // reset compare\n- TIM_SetCompare1(TIM2,0);\n-\n- //enable compare interrupt\n- TIM_ClearFlag(TIM2, TIM_FLAG_CC1);\n- TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE);\n-\n- // reset timer\n- TIM_SetCounter(TIM2,0);\n-\n- // record last timer compare value\n- bsp_timer_vars.last_compare_value = 0;\n-}\n-\n-/**\n-\\brief Schedule the callback to be called in some specified time.\n-\n-The delay is expressed relative to the last compare event. It doesn't matter\n-how long it took to call this function after the last compare, the timer will\n-expire precisely delayTicks after the last one.\n-\n-The only possible problem is that it took so long to call this function that\n-the delay specified is shorter than the time already elapsed since the last\n-compare. In that case, this function triggers the interrupt to fire right away.\n-\n-This means that the interrupt may fire a bit off, but this inaccuracy does not\n-propagate to subsequent timers.\n-\n-\\param delayTicks Number of ticks before the timer expired, relative to the\n- last compare event.\n-*/\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks) {\n- PORT_TIMER_WIDTH newCompareValue;\n- PORT_TIMER_WIDTH temp_last_compare_value;\n- //enable it if not enabled.\n- TIM_Cmd(TIM2, ENABLE);\n-\n- temp_last_compare_value = bsp_timer_vars.last_compare_value;\n-\n- newCompareValue = bsp_timer_vars.last_compare_value+delayTicks;\n- bsp_timer_vars.last_compare_value = newCompareValue;\n-\n- if (delayTicks < (TIM_GetCounter(TIM2)-temp_last_compare_value))\n- {\n- // setting the interrupt flag triggers an interrupt\n-// TIM2->SR |= (u16)TIM_FLAG_CC1; //it can not write one to TIM2 State register.\n- TIM_GenerateEvent(TIM2,TIM_EventSource_CC1);\n- }\n- else\n- {\n- // this is the normal case, have timer expire at newCompareValue\n- TIM_SetCompare1(TIM2,newCompareValue);\n- TIM_ClearFlag(TIM2, TIM_FLAG_CC1);\n- TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE);\n- }\n-}\n-\n-/**\n-\\brief Cancel a running compare.\n-*/\n-void bsp_timer_cancel_schedule() {\n- TIM_SetCompare1(TIM2,0);\n- TIM_ITConfig(TIM2, TIM_IT_CC1, DISABLE);\n-}\n-\n-/**\n-\\brief Return the current value of the timer's counter.\n-\n-\\returns The current value of the timer's counter.\n-*/\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue() {\n- return TIM_GetCounter(TIM2);\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t bsp_timer_isr(){\n- // call the callback\n- bsp_timer_vars.cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n-}\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/openmotestm/radiotimer.c", "new_path": null, "diff": "-/**\n-\\brief openmoteSTM32 definition of the \"radiotimer\" bsp module.\n-\n-On openmoteSTM32, we use RTC for the radiotimer module.\n-\n-\\author Chang Tengfei <tengfei.chang@gmail.com>, July 2012.\n-*/\n-\n-#include \"stdint.h\"\n-\n-#include \"stm32f10x_lib.h\"\n-#include \"leds.h\"\n-#include \"radiotimer.h\"\n-#include \"board.h\"\n-\n-#include \"rcc.h\"\n-#include \"nvic.h\"\n-\n-\n-//=========================== variables =======================================\n-\n-enum radiotimer_irqstatus_enum{\n- RADIOTIMER_NONE = 0x00, //alarm interrupt default status\n- RADIOTIMER_OVERFLOW = 0x01, //alarm interrupt caused by overflow\n- RADIOTIMER_COMPARE = 0x02, //alarm interrupt caused by compare\n-};\n-\n-typedef struct {\n- radiotimer_compare_cbt overflow_cb;\n- radiotimer_compare_cbt compare_cb;\n- uint8_t overflowORcompare;//indicate RTC alarm interrupt status\n- PORT_RADIOTIMER_WIDTH currentSlotPeriod;\n-} radiotimer_vars_t;\n-\n-radiotimer_vars_t radiotimer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init() {\n- // clear local variables\n- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t));\n-}\n-\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.overflow_cb = cb;\n-}\n-\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.compare_cb = cb;\n-}\n-\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period) {\n- //enable BKP and PWR, Clock\n- RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP|RCC_APB1Periph_PWR , ENABLE);\n-\n- // RTC clock source configuration\n- PWR_BackupAccessCmd(ENABLE); //Allow access to BKP Domain\n- RCC_LSEConfig(RCC_LSE_ON); //Enable LSE OSC\n- while(RCC_GetFlagStatus(RCC_FLAG_LSERDY)==RESET); //Wait till LSE is ready\n- RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); //Select the RTC Clock Source\n- RCC_RTCCLKCmd(ENABLE); //enable RTC\n-\n- // RTC configuration\n- // Wait for RTC APB registers synchronisation\n- RTC_WaitForSynchro();\n-\n- RTC_SetPrescaler(1); //use 16KHz clock\n- RTC_WaitForLastTask(); //Wait until last write operation on RTC registers has finished\n-\n- //Set the RTC time counter to 0\n- RTC_SetCounter(0);\n- RTC_WaitForLastTask();\n-\n- radiotimer_vars.currentSlotPeriod = period >> 1;\n-\n- // Set the RTC time alarm(the length of slot)\n- RTC_SetAlarm(radiotimer_vars.currentSlotPeriod);\n- RTC_WaitForLastTask();\n-\n- //interrupt when reach alarm value\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;\n-\n- //Configures EXTI line 17 to generate an interrupt on rising edge(alarm interrupt to wakeup board)\n- EXTI_ClearITPendingBit(EXTI_Line17);\n- EXTI_InitTypeDef EXTI_InitStructure;\n- EXTI_InitStructure.EXTI_Line = EXTI_Line17;\n- EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;\n- EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;\n- EXTI_InitStructure.EXTI_LineCmd = ENABLE;\n- EXTI_Init(&EXTI_InitStructure);\n-\n- //Configure RTC Alarm interrupt:\n- NVIC_radiotimer();\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue() {\n-\n- RTC_WaitForSynchro();\n- uint32_t counter = RTC_GetCounter();\n- counter = counter << 1;\n- return (PORT_RADIOTIMER_WIDTH)counter;\n-}\n-\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) {\n-\n- period = period >> 1;\n-\n- RTC_ITConfig(RTC_IT_ALR, DISABLE);\n- //need to disable radio also in case that a radio interrupt is happening when set Alarm value\n-\n- DISABLE_INTERRUPTS();\n-\n- //Reset RTC Counter to begin a new slot\n- RTC_SetAlarm(period);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- radiotimer_vars.currentSlotPeriod = period;\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod() {\n- RTC_WaitForSynchro();\n- uint32_t period = RTC_GetAlarm();\n- period = period <<1;\n- return (PORT_RADIOTIMER_WIDTH)period;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) {\n-\n- offset = offset >>1;\n-\n- RTC_ITConfig(RTC_IT_ALR, DISABLE);\n- //need to disable radio also in case that a radio interrupt is happening\n-\n- DISABLE_INTERRUPTS();\n-\n- // Set the RTC alarm(RTC timer will alarm at next state of slot)\n- RTC_SetAlarm(offset);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_COMPARE;\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-}\n-\n-void radiotimer_cancel() {\n-\n- RTC_ITConfig(RTC_IT_ALR, DISABLE);\n- //need to disable radio also in case that a radio interrupt is happening\n-\n- DISABLE_INTERRUPTS();\n-\n- // set RTC alarm (slotlength)\n- RTC_SetAlarm(radiotimer_vars.currentSlotPeriod);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-}\n-\n-//===== capture\n-\n-inline PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime() {\n- RTC_WaitForSynchro();\n- uint32_t counter = RTC_GetCounter();\n- counter = counter << 1;\n- return (PORT_RADIOTIMER_WIDTH)counter;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t radiotimer_isr() {\n- uint8_t taiv_temp = radiotimer_vars.overflowORcompare;\n- switch (taiv_temp) {\n- case RADIOTIMER_COMPARE:\n- if (radiotimer_vars.compare_cb!=NULL) {\n-\n- RCC_Wakeup();\n- // call the callback\n- radiotimer_vars.compare_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case RADIOTIMER_OVERFLOW: // timer overflows\n- if (radiotimer_vars.overflow_cb!=NULL) {\n-\n- //Wait until last write operation on RTC registers has finished\n- RTC_WaitForLastTask();\n-\n- DISABLE_INTERRUPTS();\n-\n- //Set the RTC time counter to 0\n- RTC_SetCounter(0x00000000);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- RCC_Wakeup();\n- // call the callback\n- radiotimer_vars.overflow_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case RADIOTIMER_NONE: // this should not happen\n- default:\n- while(1); // this should not happen\n- }\n- return DO_NOT_KICK_SCHEDULER;\n-}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. remove bsp_timer.c and radiotimer.c files.
491,595
03.05.2017 16:02:24
-7,200
a95eda2fa9d4a2bfcbdbb4bc150397250c2270d3
add sctimer.c file for openmotestm.
[ { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/openmotestm/sctimer.c", "diff": "+/**\n+\\brief Iot_Lab_M3 definition of the \"sctimer\" bsp module.\n+\n+On Iot_Lab_M3, we use RTC for the sctimer module.\n+\n+\\author Chang Tengfei <tengfei.chang@gmail.com>, May 2017.\n+*/\n+\n+#include \"stdint.h\"\n+\n+#include \"stm32f10x_conf.h\"\n+#include \"sctimer.h\"\n+#include \"board.h\"\n+#include \"leds.h\"\n+#include \"rcc.h\"\n+#include \"nvic.h\"\n+\n+\n+// ========================== define ==========================================\n+\n+#define TIMERLOOP_THRESHOLD 0xffffff // 511 seconds @ 32768Hz clock\n+#define OVERFLOW_THRESHOLD 0x7fffffff // as openmotestm32 uses 16kHz, the upper timer overflows when timer research to 0x7fffffff\n+\n+// ========================== variable ========================================\n+\n+typedef struct {\n+ sctimer_cbt sctimer_cb;\n+ bool convert;\n+ bool convertUnlock;\n+ uint32_t lastCompareValue;\n+} sctimer_vars_t;\n+\n+sctimer_vars_t sctimer_vars;\n+\n+//=========================== prototypes ======================================\n+\n+//=========================== public ==========================================\n+\n+//===== admin\n+\n+void sctimer_init() {\n+ // clear local variables\n+ memset(&sctimer_vars,0,sizeof(sctimer_vars_t));\n+ //enable BKP and PWR, Clock\n+ RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP|RCC_APB1Periph_PWR , ENABLE);\n+\n+ // RTC clock source configuration\n+ PWR_BackupAccessCmd(ENABLE); //Allow access to BKP Domain\n+ RCC_LSEConfig(RCC_LSE_ON); //Enable LSE OSC\n+ while(RCC_GetFlagStatus(RCC_FLAG_LSERDY)==RESET); //Wait till LSE is ready\n+ RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); //Select the RTC Clock Source\n+ RCC_RTCCLKCmd(ENABLE); //enable RTC\n+\n+ // RTC configuration\n+ // Wait for RTC APB registers synchronisation\n+ RTC_WaitForSynchro();\n+\n+ RTC_SetPrescaler(1); //use 16KHz clock\n+ RTC_WaitForLastTask(); //Wait until last write operation on RTC registers has finished\n+\n+ //Set the RTC time counter to 0\n+ RTC_SetCounter(0);\n+ RTC_WaitForLastTask();\n+\n+ //interrupt when reach alarm value\n+ RTC_ClearFlag(RTC_IT_ALR);\n+ RTC_ITConfig(RTC_IT_ALR, ENABLE);\n+\n+ //Configures EXTI line 17 to generate an interrupt on rising edge(alarm interrupt to wakeup board)\n+ EXTI_ClearITPendingBit(EXTI_Line17);\n+ EXTI_InitTypeDef EXTI_InitStructure;\n+ EXTI_InitStructure.EXTI_Line = EXTI_Line17;\n+ EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;\n+ EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;\n+ EXTI_InitStructure.EXTI_LineCmd = ENABLE;\n+ EXTI_Init(&EXTI_InitStructure);\n+\n+ //Configure RTC Alarm interrupt:\n+ NVIC_sctimer();\n+}\n+\n+void sctimer_set_callback(sctimer_cbt cb){\n+ sctimer_vars.sctimer_cb = cb;\n+}\n+\n+//===== direct access\n+\n+PORT_RADIOTIMER_WIDTH sctimer_readCounter() {\n+ uint32_t counter;\n+ RTC_WaitForSynchro();\n+ counter = RTC_GetCounter();\n+ // upper layer uses 32 bit timer@32kHz, openmotestm is only able to work on\n+ // 16kHz, so manually overflow when rearch 0x7fffffff.\n+ counter = counter & OVERFLOW_THRESHOLD;\n+ counter = counter << 1;\n+ return (PORT_RADIOTIMER_WIDTH)counter;\n+}\n+\n+//===== compare\n+\n+/**\n+\\brief alarm a compare interrupt depending on given compare value.\n+\n+The input parameter val range from 0~2^32. It supposes a timer running @ 32kHz.\n+Since RTC only runs with 16kHz, this range maps to 0~2^31 or 2^31~2^32. the flag\n+convert is used for selecting which range mapping to.\n+ 1) When convert is FALSE, map val to 0~2^31 (val>>1).\n+ 2) When convert is TRUE, map val to 2^31~2^32 ((val>>1)|0x80000000).\n+\n+ when convert is FALSE | when convert is FALSE\n+ compare value is val >>1 | compare value is (val >>1)|0x80000000\n+ |\n+ |----------------------------------------|----------------------------------------|\n+ 0 | 0xffffffff\n+ when convert is TRUE | when convert is TRUE\n+ compare value is (val >>1)|0x80000000 | compare value is val >>1\n+ |\n+ 0x7fffffff-->|<--\"convert\" flag toggles at here once after each overflow\n+\n+\\param[in] val is the compareValue to be alarmed in RTC timer.\n+*/\n+\n+void sctimer_setCompare(PORT_TIMER_WIDTH val) {\n+\n+ // make sure convert flag conly toggle once within one overflow period\n+ if (val > OVERFLOW_THRESHOLD && sctimer_vars.convertUnlock){\n+ // toggle convert\n+ if (sctimer_vars.convert){\n+ sctimer_vars.convert = TRUE;\n+ } else {\n+ sctimer_vars.convert = TRUE;\n+ }\n+ sctimer_vars.convertUnlock = FALSE;\n+ }\n+\n+ // un lock the changes of convert flag\n+ if (val > TIMERLOOP_THRESHOLD && val < 2*TIMERLOOP_THRESHOLD ){\n+ sctimer_vars.convertUnlock = TRUE;\n+ }\n+\n+ // update value to be compared according to timer condition\n+ if (val <= OVERFLOW_THRESHOLD){\n+ if (sctimer_vars.convert){\n+ val = val >>1;\n+ val |= 0x80000000;\n+ } else {\n+ val = val >>1;\n+ }\n+ } else {\n+ if (sctimer_vars.convert){\n+ val = val >>1;\n+ } else {\n+ val = val >>1;\n+ val |= 0x80000000;\n+ }\n+ }\n+\n+ RTC_ITConfig(RTC_IT_ALR, DISABLE);\n+ //need to disable radio also in case that a radio interrupt is happening\n+\n+ DISABLE_INTERRUPTS();\n+ if (RTC_GetCounter() - val < TIMERLOOP_THRESHOLD){\n+ // the timer is already late, schedule the ISR right now manually\n+ EXTI->SWIER |= EXTI_Line17;\n+ } else {\n+ if (val-RTC_GetCounter()<TIMERTHRESHOLD){\n+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ // schedule ISR right now manually\n+ EXTI->SWIER |= EXTI_Line17;\n+ } else {\n+ // schedule the timer at val\n+ RTC_SetAlarm(val);\n+ RTC_WaitForLastTask();\n+ }\n+ }\n+\n+ ENABLE_INTERRUPTS();\n+\n+ //set sctimer irpstatus\n+ RTC_ClearFlag(RTC_IT_ALR);\n+ RTC_ITConfig(RTC_IT_ALR, ENABLE);\n+}\n+\n+void sctimer_enable() {\n+ RTC_ClearFlag(RTC_IT_ALR);\n+ RTC_ITConfig(RTC_IT_ALR, ENABLE);\n+}\n+\n+void sctimer_disable() {\n+ RTC_ITConfig(RTC_IT_ALR, DISABLE);\n+}\n+\n+//=========================== private =========================================\n+\n+//=========================== interrupt handlers ==============================\n+\n+kick_scheduler_t sctimer_isr() {\n+ if (sctimer_vars.sctimer_cb!=NULL) {\n+\n+ RCC_Wakeup();\n+ // call the callback\n+ sctimer_vars.sctimer_cb();\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ return DO_NOT_KICK_SCHEDULER;\n+}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. add sctimer.c file for openmotestm.
491,595
03.05.2017 16:16:30
-7,200
98f3c81fa7895a2463c4cd9af64c650975f96161
format a little bit.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/board_info.h", "new_path": "bsp/boards/openmotestm/board_info.h", "diff": "@@ -68,11 +68,11 @@ to return the board's description.\n//===== adaptive_sync accuracy\n-#define SYNC_ACCURACY 2 // by ticks\n+#define SYNC_ACCURACY 2 // ticks\n//===== opentimers\n-#define TIMERTHRESHOLD 10\n+#define TIMERTHRESHOLD 10 // ticks\n//=========================== typedef ========================================\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/sctimer.c", "new_path": "bsp/boards/openmotestm/sctimer.c", "diff": "@@ -27,7 +27,6 @@ typedef struct {\nsctimer_cbt sctimer_cb;\nbool convert;\nbool convertUnlock;\n- uint32_t lastCompareValue;\n} sctimer_vars_t;\nsctimer_vars_t sctimer_vars;\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. format a little bit.
491,595
03.05.2017 16:17:14
-7,200
23e342b4e4a9af8c8631bac9bc0e117beb0444e9
port sctimer for iot-lab_M3
[ { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_M3/board.c", "new_path": "bsp/boards/iot-lab_M3/board.c", "diff": "\\brief iot-lab_M3 definition of the \"board\" bsp module.\n\\author Alaeddine Weslati <alaeddine.weslati@inria.fr>, January 2014.\n-\\author Tengfei Chang <tengfei.chang@inria.fr>, september 2016.\n+\\author Tengfei Chang <tengfei.chang@inria.fr>, May 2017.\n*/\n#include \"stm32f10x_conf.h\"\n#include \"board.h\"\n#include \"leds.h\"\n#include \"uart.h\"\n#include \"spi.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n#include \"rcc.h\"\n#include \"nvic.h\"\n#include \"debugpins.h\"\n@@ -87,9 +86,8 @@ void board_init()\nleds_init();\nuart_init();\nspi_init();\n- bsp_timer_init();\n+ sctimer_init();\nradio_init();\n- radiotimer_init();\ndebugpins_init();\n//enable nvic for the radio\nNVIC_radio();\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_M3/board_info.h", "new_path": "bsp/boards/iot-lab_M3/board_info.h", "diff": "@@ -29,10 +29,10 @@ to return the board's description.\n//===== timer\n-#define PORT_TIMER_WIDTH uint16_t\n-#define PORT_RADIOTIMER_WIDTH uint16_t\n+#define PORT_TIMER_WIDTH uint32_t\n+#define PORT_RADIOTIMER_WIDTH uint32_t\n-#define PORT_SIGNED_INT_WIDTH int16_t\n+#define PORT_SIGNED_INT_WIDTH int32_t\n#define PORT_TICS_PER_MS 32\n#define SCHEDULER_WAKEUP() EXTI->SWIER |= EXTI_Line1;\n#define SCHEDULER_ENABLE_INTERRUPT() //enable in board use EXTI_Line1\n@@ -65,6 +65,10 @@ to return the board's description.\n#define SYNC_ACCURACY 2 // ticks\n+//===== opentimers\n+\n+#define TIMERTHRESHOLD 10 // ticks\n+\n//=========================== variables =======================================\nstatic const uint8_t rreg_uriquery[] = \"h=ucb\";\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/iot-lab_M3/bsp_timer.c", "new_path": null, "diff": "-/**\n-\\brief openmoteSTM32 definition of the \"bsp_timer\" bsp module.\n-\n-TODO: On openmoteSTM32, we use TIM2 for the bsp_timer module.\n-\n-\\author Chang Tengfei <tengfei.chang@gmail.com>, July 2012.\n-*/\n-#include \"stm32f10x_conf.h\"\n-#include \"string.h\"\n-#include \"bsp_timer.h\"\n-#include \"board.h\"\n-\n-#include \"rcc.h\"\n-#include \"nvic.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- bsp_timer_cbt cb;\n- PORT_TIMER_WIDTH last_compare_value;\n-} bsp_timer_vars_t;\n-\n-volatile bsp_timer_vars_t bsp_timer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-/**\n-\\brief Initialize this module.\n-\n-This functions starts the timer, i.e. the counter increments, but doesn't set\n-any compare registers, so no interrupt will fire.\n-*/\n-void bsp_timer_init()\n-{\n- // clear local variables\n- memset((void*)&bsp_timer_vars,0,sizeof(bsp_timer_vars_t));\n-\n- //Configure TIM2, Clock\n- RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2 , ENABLE);\n-\n- //Configure TIM2: Period = 0xffff, prescaler = 1023(32M/(1023+1) = 32.768KHz), CounterMode = upCounting mode\n- TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure ;\n- TIM_TimeBaseStructure.TIM_Period = 0xFFFF;\n- TIM_TimeBaseStructure.TIM_Prescaler = 1023;\n- TIM_TimeBaseStructure.TIM_ClockDivision = 0;\n- TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;\n- TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);\n-\n- //Configure TIM2's out compare mode: out compare mode = toggle, out compare value = 0 (useless before enable compare interrupt), enable TIM2_CH1\n- TIM_OCInitTypeDef TIM_OCInitStructure;\n- TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle;\n- TIM_OCInitStructure.TIM_Pulse = 0;\n- TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;\n- TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;\n- TIM_OC1Init(TIM2, &TIM_OCInitStructure);\n-\n- //enable TIM2\n- TIM_Cmd(TIM2, ENABLE);\n-}\n-\n-/**\n-\\brief Register a callback.\n-\n-\\param cb The function to be called when a compare event happens.\n-*/\n-void bsp_timer_set_callback(bsp_timer_cbt cb)\n-{\n- bsp_timer_vars.cb = cb;\n- //enable nvic\n- NVIC_bsptimer();\n-}\n-\n-/**\n-\\brief Reset the timer.\n-\n-This function does not stop the timer, it rather resets the value of the\n-counter, and cancels a possible pending compare event.\n-*/\n-void bsp_timer_reset()\n-{\n- // reset compare\n- TIM_SetCompare1(TIM2,0);\n-\n- //enable compare interrupt\n- TIM_ClearFlag(TIM2, TIM_FLAG_CC1);\n- TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE);\n-\n- // reset timer\n- TIM_SetCounter(TIM2,0);\n-\n- // record last timer compare value\n- bsp_timer_vars.last_compare_value = 0;\n-}\n-\n-/**\n-\\brief Schedule the callback to be called in some specified time.\n-\n-The delay is expressed relative to the last compare event. It doesn't matter\n-how long it took to call this function after the last compare, the timer will\n-expire precisely delayTicks after the last one.\n-\n-The only possible problem is that it took so long to call this function that\n-the delay specified is shorter than the time already elapsed since the last\n-compare. In that case, this function triggers the interrupt to fire right away.\n-\n-This means that the interrupt may fire a bit off, but this inaccuracy does not\n-propagate to subsequent timers.\n-\n-\\param delayTicks Number of ticks before the timer expired, relative to the\n- last compare event.\n-*/\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks)\n-{\n- PORT_TIMER_WIDTH newCompareValue;\n- PORT_TIMER_WIDTH temp_last_compare_value;\n- //enable it if not enabled.\n- TIM_Cmd(TIM2, ENABLE);\n-\n- temp_last_compare_value = bsp_timer_vars.last_compare_value;\n-\n- newCompareValue = bsp_timer_vars.last_compare_value+delayTicks;\n- bsp_timer_vars.last_compare_value = newCompareValue;\n-\n- if (delayTicks < (TIM_GetCounter(TIM2)-temp_last_compare_value))\n- {\n- // setting the interrupt flag triggers an interrupt\n- TIM2->SR |= (u16)TIM_FLAG_CC1;\n- }\n- else\n- {\n- // this is the normal case, have timer expire at newCompareValue\n- TIM_SetCompare1(TIM2,newCompareValue);\n- TIM_ClearFlag(TIM2, TIM_FLAG_CC1);\n- TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE);\n- }\n-}\n-\n-/**\n-\\brief Cancel a running compare.\n-*/\n-void bsp_timer_cancel_schedule()\n-{\n- TIM_SetCompare1(TIM2,0);\n- TIM_ITConfig(TIM2, TIM_IT_CC1, DISABLE);\n-}\n-\n-/**\n-\\brief Return the current value of the timer's counter.\n-\n-\\returns The current value of the timer's counter.\n-*/\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue()\n-{\n- return TIM_GetCounter(TIM2);\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t bsp_timer_isr()\n-{\n- // call the callback\n- bsp_timer_vars.cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n-}\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_M3/configure/stm32f10x_it.c", "new_path": "bsp/boards/iot-lab_M3/configure/stm32f10x_it.c", "diff": "/* Includes ------------------------------------------------------------------*/\n#include \"stm32f10x_it.h\"\n#include \"leds.h\"\n-#include \"bsp_timer.h\"\n-#include \"radiotimer.h\"\n+#include \"sctimer.h\"\n#include \"spi.h\"\n#include \"radio.h\"\n-#include \"rtc_timer.h\"\n#include \"uart.h\"\n#include \"debugpins.h\"\n#include \"rcc.h\"\n@@ -474,11 +472,6 @@ void TIM1_CC_IRQHandler(void)\n*******************************************************************************/\nvoid TIM2_IRQHandler(void)\n{\n- if(TIM_GetFlagStatus(TIM2, TIM_FLAG_CC1) != RESET)\n- {\n- TIM_ClearFlag(TIM2, TIM_FLAG_CC1);\n- bsp_timer_isr();\n- }\n}\n/*******************************************************************************\n@@ -642,7 +635,7 @@ void RTCAlarm_IRQHandler(void)\nif(EXTI_GetITStatus(EXTI_Line17) != RESET)\n{\nEXTI_ClearITPendingBit(EXTI_Line17);\n- radiotimer_isr();\n+ sctimer_isr();\n}\n}\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_M3/nvic.c", "new_path": "bsp/boards/iot-lab_M3/nvic.c", "diff": "//=========================== public ==========================================\n-void NVIC_init(void)\n-{\n+void NVIC_init(void){\n#ifdef VECT_TAB_RAM\n/* Set the Vector Table base location at 0x20000000 */\nNVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);\n@@ -24,8 +23,7 @@ void NVIC_init(void)\n}\n//configuration uart interrput\n-void NVIC_uart(void)\n-{\n+void NVIC_uart(void){\n//Configure NVIC: Preemption Priority = 3 and Sub Priority = 3\nNVIC_InitTypeDef NVIC_InitStructure;\nNVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;\n@@ -36,8 +34,7 @@ void NVIC_uart(void)\n}\n//configuration spi interrput\n-void NVIC_spi(void)\n-{\n+void NVIC_spi(void){\n#ifdef SPI_IN_INTERRUPT_MODE\n//Configure NVIC: Preemption Priority = 1 and Sub Priority = 1\nNVIC_InitTypeDef NVIC_InitStructure;\n@@ -49,51 +46,10 @@ void NVIC_spi(void)\n#endif\n}\n-//configuration bsptimer interrput\n-void NVIC_bsptimer(void)\n-{\n- //Configure NVIC: Preemption Priority = 2 and Sub Priority = 1\n- NVIC_InitTypeDef NVIC_InitStructure;\n- NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\n- NVIC_Init(&NVIC_InitStructure);\n-}\n-\n-//configuration rtctimer interrput\n-void NVIC_rtctimer(void)\n-{\n- //Configure RTC global interrupt:\n- //Configure NVIC: Preemption Priority = 1 and Sub Priority = 1\n- NVIC_InitTypeDef NVIC_InitStructure;\n- NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQn;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\n- NVIC_Init(&NVIC_InitStructure);\n-\n- //Configure RTC Alarm interrupt:\n- //Configure NVIC: Preemption Priority = 0 and Sub Priority = 1\n- NVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQn;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;\n- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\n- NVIC_Init(&NVIC_InitStructure);\n-}\n-\n//configuration radiotimer interrput\n-void NVIC_radiotimer(void)\n-{\n- //Configure RTC global interrupt:\n- //Configure NVIC: Preemption Priority = 1 and Sub Priority = 1\n- NVIC_InitTypeDef NVIC_InitStructure;\n- NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQn;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\n- NVIC_Init(&NVIC_InitStructure);\n+void NVIC_sctimer(void) {\n+ NVIC_InitTypeDef NVIC_InitStructure;\n//Configure RTC Alarm interrupt:\n//Configure NVIC: Preemption Priority = 0 and Sub Priority = 1\nNVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQn;\n@@ -104,20 +60,18 @@ void NVIC_radiotimer(void)\n}\n//configuration radio interrput\n-void NVIC_radio(void)\n-{\n+void NVIC_radio(void){\n//Configure NVIC: Preemption Priority = 2 and Sub Priority = 0\nNVIC_InitTypeDef NVIC_InitStructure;\nNVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;\n+ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;\n+ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\nNVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\nNVIC_Init(&NVIC_InitStructure);\n}\n//configuration of interrupt\n-void NVIC_Configuration(void)\n-{\n+void NVIC_Configuration(void){\n//Set the Vector Table base location\nNVIC_init();\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_M3/nvic.h", "new_path": "bsp/boards/iot-lab_M3/nvic.h", "diff": "@@ -22,9 +22,7 @@ void NVIC_Configuration(void);\n//configuration module interrput on openmotestm32\nvoid NVIC_uart(void);\nvoid NVIC_spi(void);\n-void NVIC_bsptimer(void);\n-void NVIC_rtctimer(void);\n-void NVIC_radiotimer(void);\n+void NVIC_sctimer(void);\nvoid NVIC_radio(void);\n#endif\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/iot-lab_M3/radiotimer.c", "new_path": null, "diff": "-/**\n-\\brief openmoteSTM32 definition of the \"radiotimer\" bsp module.\n-\n-On openmoteSTM32, we use RTC for the radiotimer module.\n-\n-\\author Chang Tengfei <tengfei.chang@gmail.com>, July 2012.\n-*/\n-\n-#include \"stdint.h\"\n-\n-#include \"stm32f10x_conf.h\"\n-#include \"leds.h\"\n-#include \"radiotimer.h\"\n-#include \"board.h\"\n-\n-#include \"rcc.h\"\n-#include \"nvic.h\"\n-\n-\n-//=========================== variables =======================================\n-\n-enum radiotimer_irqstatus_enum{\n- RADIOTIMER_NONE = 0x00, //alarm interrupt default status\n- RADIOTIMER_OVERFLOW = 0x01, //alarm interrupt caused by overflow\n- RADIOTIMER_COMPARE = 0x02, //alarm interrupt caused by compare\n-};\n-\n-typedef struct {\n- radiotimer_compare_cbt overflow_cb;\n- radiotimer_compare_cbt compare_cb;\n- uint8_t overflowORcompare;//indicate RTC alarm interrupt status\n- PORT_RADIOTIMER_WIDTH currentSlotPeriod;\n-} radiotimer_vars_t;\n-\n-radiotimer_vars_t radiotimer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init() {\n- // clear local variables\n- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t));\n-}\n-\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.overflow_cb = cb;\n-}\n-\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.compare_cb = cb;\n-}\n-\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period) {\n- //enable BKP and PWR, Clock\n- RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP|RCC_APB1Periph_PWR , ENABLE);\n-\n- // RTC clock source configuration\n- PWR_BackupAccessCmd(ENABLE); //Allow access to BKP Domain\n- RCC_LSEConfig(RCC_LSE_ON); //Enable LSE OSC\n- while(RCC_GetFlagStatus(RCC_FLAG_LSERDY)==RESET); //Wait till LSE is ready\n- RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); //Select the RTC Clock Source\n- RCC_RTCCLKCmd(ENABLE); //enable RTC\n-\n- // RTC configuration\n- // Wait for RTC APB registers synchronisation\n- RTC_WaitForSynchro();\n-\n- RTC_SetPrescaler(1); //use 16KHz clock\n- RTC_WaitForLastTask(); //Wait until last write operation on RTC registers has finished\n-\n- //Set the RTC time counter to 0\n- RTC_SetCounter(0);\n- RTC_WaitForLastTask();\n-\n- radiotimer_vars.currentSlotPeriod = period >> 1;\n-\n- // Set the RTC time alarm(the length of slot)\n- RTC_SetAlarm(radiotimer_vars.currentSlotPeriod);\n- RTC_WaitForLastTask();\n-\n- //interrupt when reach alarm value\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;\n-\n- //Configures EXTI line 17 to generate an interrupt on rising edge(alarm interrupt to wakeup board)\n- EXTI_ClearITPendingBit(EXTI_Line17);\n- EXTI_InitTypeDef EXTI_InitStructure;\n- EXTI_InitStructure.EXTI_Line = EXTI_Line17;\n- EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;\n- EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;\n- EXTI_InitStructure.EXTI_LineCmd = ENABLE;\n- EXTI_Init(&EXTI_InitStructure);\n-\n- //Configure RTC Alarm interrupt:\n- NVIC_radiotimer();\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue() {\n-\n- RTC_WaitForSynchro();\n- uint32_t counter = RTC_GetCounter();\n- counter = counter << 1;\n- return (PORT_RADIOTIMER_WIDTH)counter;\n-}\n-\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) {\n-\n- period = period >> 1;\n-\n- RTC_ITConfig(RTC_IT_ALR, DISABLE);\n- //need to disable radio also in case that a radio interrupt is happening when set Alarm value\n-\n- DISABLE_INTERRUPTS();\n-\n- //Reset RTC Counter to begin a new slot\n- RTC_SetAlarm(period);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- radiotimer_vars.currentSlotPeriod = period;\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod() {\n- RTC_WaitForSynchro();\n- uint16_t tmp = 0;\n- tmp = RTC->ALRL;\n- uint32_t period = (((uint32_t)RTC->ALRH << 16 ) | tmp);\n- period = period <<1;\n- return (PORT_RADIOTIMER_WIDTH)period;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) {\n-\n- offset = offset >>1;\n-\n- RTC_ITConfig(RTC_IT_ALR, DISABLE);\n- //need to disable radio also in case that a radio interrupt is happening\n-\n- DISABLE_INTERRUPTS();\n-\n- // Set the RTC alarm(RTC timer will alarm at next state of slot)\n- RTC_SetAlarm(offset);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_COMPARE;\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-}\n-\n-void radiotimer_cancel() {\n-\n- RTC_ITConfig(RTC_IT_ALR, DISABLE);\n- //need to disable radio also in case that a radio interrupt is happening\n-\n- DISABLE_INTERRUPTS();\n-\n- // set RTC alarm (slotlength)\n- RTC_SetAlarm(radiotimer_vars.currentSlotPeriod);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-}\n-\n-//===== capture\n-\n-inline PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime() {\n- RTC_WaitForSynchro();\n- uint32_t counter = RTC_GetCounter();\n- counter = counter << 1;\n- return (PORT_RADIOTIMER_WIDTH)counter;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t radiotimer_isr() {\n- uint8_t taiv_temp = radiotimer_vars.overflowORcompare;\n- switch (taiv_temp) {\n- case RADIOTIMER_COMPARE:\n- if (radiotimer_vars.compare_cb!=NULL) {\n-\n- RCC_Wakeup();\n- // call the callback\n- radiotimer_vars.compare_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case RADIOTIMER_OVERFLOW: // timer overflows\n- if (radiotimer_vars.overflow_cb!=NULL) {\n-\n- //Wait until last write operation on RTC registers has finished\n- RTC_WaitForLastTask();\n-\n- DISABLE_INTERRUPTS();\n-\n- //Set the RTC time counter to 0\n- RTC_SetCounter(0x00000000);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- RCC_Wakeup();\n- // call the callback\n- radiotimer_vars.overflow_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case RADIOTIMER_NONE: // this should not happen\n- default:\n- while(1); // this should not happen\n- }\n- return DO_NOT_KICK_SCHEDULER;\n-}\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/iot-lab_M3/rtc_timer.c", "new_path": null, "diff": "-/**\n-\\brief openmoteSTM32 definition of the \"rtc_timer\" bsp module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012.\n-\\author Chang Tengfei <tengfei.chang@gmail.com>, July 2012.\n-*/\n-\n-#include \"stm32f10x_conf.h\"\n-#include \"leds.h\"\n-#include \"rtc_timer.h\"\n-\n-#include \"rcc.h\"\n-#include \"nvic.h\"\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- rtc_timer_alarm_cbt alarm_cb;\n-} rtc_timer_vars_t;\n-\n-volatile rtc_timer_vars_t rtc_timer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void rtc_timer_init() {\n- // clear local variables\n- memset(&rtc_timer_vars,0,sizeof(rtc_timer_vars_t));\n-}\n-\n-void rtc_timer_setAlarmCb(rtc_timer_alarm_cbt cb) {\n- rtc_timer_vars.alarm_cb = cb;\n-}\n-\n-void rtc_timer_start(u32 alarmValue)\n-{\n- //enable BKP and PWR, Clock\n- RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP|RCC_APB1Periph_PWR , ENABLE);\n-\n- // RTC clock source configuration\n- PWR_BackupAccessCmd(ENABLE); //Allow access to BKP Domain\n- RCC_LSEConfig(RCC_LSE_ON); //Enable LSE OSC\n- while(RCC_GetFlagStatus(RCC_FLAG_LSERDY)==RESET); //Wait till LSE is ready\n- RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); //Select the RTC Clock Source\n- RCC_RTCCLKCmd(ENABLE); //enable RTC\n-\n- // RTC configuration\n- // Wait for RTC APB registers synchronisation\n- RTC_WaitForSynchro();\n-\n- RTC_SetPrescaler(0); //Set the RTC time base to 30.5us\n- RTC_WaitForLastTask(); //Wait until last write operation on RTC registers has finished\n-\n- //Set the RTC time counter to 0\n- RTC_SetCounter(0);\n- RTC_WaitForLastTask();\n-\n- // Set the RTC time alarm(the length of slot)\n- RTC_SetAlarm(alarmValue);\n- RTC_WaitForLastTask();\n-\n- //interrupt when reach alarm value\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-\n- //Configures EXTI line 17 to generate an interrupt on rising edge(alarm interrupt to wakeup board)\n- EXTI_ClearITPendingBit(EXTI_Line17);\n- EXTI_InitTypeDef EXTI_InitStructure;\n- EXTI_InitStructure.EXTI_Line = EXTI_Line17;\n- EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;\n- EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;\n- EXTI_InitStructure.EXTI_LineCmd = ENABLE;\n- EXTI_Init(&EXTI_InitStructure);\n-\n- //Configure RTC global interrupt:\n- //Configure NVIC: Preemption Priority = 1 and Sub Priority = 1\n- NVIC_InitTypeDef NVIC_InitStructure;\n- NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQn;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;\n- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\n- NVIC_Init(&NVIC_InitStructure);\n-\n- //Configure RTC Alarm interrupt:\n- //Configure NVIC: Preemption Priority = 0 and Sub Priority = 1\n- NVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQn;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\n- NVIC_Init(&NVIC_InitStructure);\n-}\n-\n-//===== direct access\n-\n-uint16_t rtc_timer_getAlarm() {\n- uint32_t alarmValue = RTC_GetAlarm();\n- return (uint16_t)alarmValue;\n-}\n-\n-void rtc_timer_resetCounter() {\n- RTC_SetCounter(0); //Set RTC Counter to begin a new slot\n- RTC_WaitForLastTask(); //Wait until last write operation on RTC registers has finished\n-}\n-\n-//===== capture\n-\n-uint16_t rtc_timer_getCapturedTime()\n-{\n- uint32_t counter = RTC_GetCounter();\n- return (uint16_t)counter;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-\n-uint8_t rtc_timer_isr()\n-{\n- if (rtc_timer_vars.alarm_cb!=NULL)\n- {\n- // call the callback\n- rtc_timer_vars.alarm_cb();\n- // kick the OS\n- return 1;\n- }\n- return 0;\n-}\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/iot-lab_M3/rtc_timer.h", "new_path": null, "diff": "-/**\n-\\brief openmoteSTM32 declaration \"rtctimer\" bsp module.\n-\n-\\author Chang Tengfei <tengfei.chang@gmail.com>, July 2012.\n-*/\n-\n-#ifndef __RTC_TIMER_H\n-#define __RTC_TIMER_H\n-\n-#include \"stdint.h\"\n-#include \"board.h\"\n-\n-//=========================== define ==========================================\n-\n-//=========================== typedef =========================================\n-\n-typedef void (*rtc_timer_alarm_cbt)(void);\n-\n-//=========================== variables =======================================\n-\n-//=========================== prototypes ======================================\n-\n-// admin\n-void rtc_timer_init(void);\n-void rtc_timer_setAlarmCb(rtc_timer_alarm_cbt cb);\n-void rtc_timer_start(u32 alarmValue);\n-// direct access\n-PORT_TIMER_WIDTH rtc_timer_getAlarm(void);\n-void rtc_timer_resetCounter(void);\n-//set alarm\n-\n-// capture\n-PORT_TIMER_WIDTH rtc_timer_getCapturedTime(void);\n-\n-\n-uint8_t rtc_timer_isr(void);\n-\n-#endif\n" }, { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/iot-lab_M3/sctimer.c", "diff": "+/**\n+\\brief Iot_Lab_M3 definition of the \"sctimer\" bsp module.\n+\n+On Iot_Lab_M3, we use RTC for the sctimer module.\n+\n+\\author Chang Tengfei <tengfei.chang@gmail.com>, May 2017.\n+*/\n+\n+#include \"stdint.h\"\n+\n+#include \"stm32f10x_conf.h\"\n+#include \"sctimer.h\"\n+#include \"board.h\"\n+#include \"leds.h\"\n+#include \"rcc.h\"\n+#include \"nvic.h\"\n+\n+\n+// ========================== define ==========================================\n+\n+#define TIMERLOOP_THRESHOLD 0xffffff // 511 seconds @ 32768Hz clock\n+#define OVERFLOW_THRESHOLD 0x7fffffff // as openmotestm32 uses 16kHz, the upper timer overflows when timer research to 0x7fffffff\n+\n+// ========================== variable ========================================\n+\n+typedef struct {\n+ sctimer_cbt sctimer_cb;\n+ bool convert;\n+ bool convertUnlock;\n+} sctimer_vars_t;\n+\n+sctimer_vars_t sctimer_vars;\n+\n+//=========================== prototypes ======================================\n+\n+//=========================== public ==========================================\n+\n+//===== admin\n+\n+void sctimer_init() {\n+ // clear local variables\n+ memset(&sctimer_vars,0,sizeof(sctimer_vars_t));\n+ //enable BKP and PWR, Clock\n+ RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP|RCC_APB1Periph_PWR , ENABLE);\n+\n+ // RTC clock source configuration\n+ PWR_BackupAccessCmd(ENABLE); //Allow access to BKP Domain\n+ RCC_LSEConfig(RCC_LSE_ON); //Enable LSE OSC\n+ while(RCC_GetFlagStatus(RCC_FLAG_LSERDY)==RESET); //Wait till LSE is ready\n+ RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); //Select the RTC Clock Source\n+ RCC_RTCCLKCmd(ENABLE); //enable RTC\n+\n+ // RTC configuration\n+ // Wait for RTC APB registers synchronisation\n+ RTC_WaitForSynchro();\n+\n+ RTC_SetPrescaler(1); //use 16KHz clock\n+ RTC_WaitForLastTask(); //Wait until last write operation on RTC registers has finished\n+\n+ //Set the RTC time counter to 0\n+ RTC_SetCounter(0);\n+ RTC_WaitForLastTask();\n+\n+ //interrupt when reach alarm value\n+ RTC_ClearFlag(RTC_IT_ALR);\n+ RTC_ITConfig(RTC_IT_ALR, ENABLE);\n+\n+ //Configures EXTI line 17 to generate an interrupt on rising edge(alarm interrupt to wakeup board)\n+ EXTI_ClearITPendingBit(EXTI_Line17);\n+ EXTI_InitTypeDef EXTI_InitStructure;\n+ EXTI_InitStructure.EXTI_Line = EXTI_Line17;\n+ EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;\n+ EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;\n+ EXTI_InitStructure.EXTI_LineCmd = ENABLE;\n+ EXTI_Init(&EXTI_InitStructure);\n+\n+ //Configure RTC Alarm interrupt:\n+ NVIC_sctimer();\n+}\n+\n+void sctimer_set_callback(sctimer_cbt cb){\n+ sctimer_vars.sctimer_cb = cb;\n+}\n+\n+//===== direct access\n+\n+PORT_RADIOTIMER_WIDTH sctimer_readCounter() {\n+ uint32_t counter;\n+ RTC_WaitForSynchro();\n+ counter = RTC_GetCounter();\n+ // upper layer uses 32 bit timer@32kHz, openmotestm is only able to work on\n+ // 16kHz, so manually overflow when rearch 0x7fffffff.\n+ counter = counter & OVERFLOW_THRESHOLD;\n+ counter = counter << 1;\n+ return (PORT_RADIOTIMER_WIDTH)counter;\n+}\n+\n+//===== compare\n+\n+\n+/**\n+\\brief alarm a compare interrupt depending on given compare value.\n+\n+The input parameter val range from 0~2^32. It supposes a timer running @ 32kHz.\n+Since RTC only runs with 16kHz, this range maps to 0~2^31 or 2^31~2^32. the flag\n+convert is used for selecting which range mapping to.\n+ 1) When convert is FALSE, map val to 0~2^31 (val>>1).\n+ 2) When convert is TRUE, map val to 2^31~2^32 ((val>>1)|0x80000000).\n+\n+ when convert is FALSE | when convert is FALSE\n+ compare value is val >>1 | compare value is (val >>1)|0x80000000\n+ |\n+ |----------------------------------------|----------------------------------------|\n+ 0 | 0xffffffff\n+ when convert is TRUE | when convert is TRUE\n+ compare value is (val >>1)|0x80000000 | compare value is val >>1\n+ |\n+ 0x7fffffff-->|<--\"convert\" flag toggles at here once after each overflow\n+\n+\\param[in] val is the compareValue to be alarmed in RTC timer.\n+*/\n+\n+void sctimer_setCompare(PORT_TIMER_WIDTH val) {\n+\n+ // make sure convert flag conly toggle once within one overflow period\n+ if (val > OVERFLOW_THRESHOLD && sctimer_vars.convertUnlock){\n+ // toggle convert\n+ if (sctimer_vars.convert){\n+ sctimer_vars.convert = TRUE;\n+ } else {\n+ sctimer_vars.convert = TRUE;\n+ }\n+ sctimer_vars.convertUnlock = FALSE;\n+ }\n+\n+ // un lock the changes of convert flag\n+ if (val > TIMERLOOP_THRESHOLD && val < 2*TIMERLOOP_THRESHOLD ){\n+ sctimer_vars.convertUnlock = TRUE;\n+ }\n+\n+ // update value to be compared according to timer condition\n+ if (val <= OVERFLOW_THRESHOLD){\n+ if (sctimer_vars.convert){\n+ val = val >>1;\n+ val |= 0x80000000;\n+ } else {\n+ val = val >>1;\n+ }\n+ } else {\n+ if (sctimer_vars.convert){\n+ val = val >>1;\n+ } else {\n+ val = val >>1;\n+ val |= 0x80000000;\n+ }\n+ }\n+\n+ RTC_ITConfig(RTC_IT_ALR, DISABLE);\n+ //need to disable radio also in case that a radio interrupt is happening\n+\n+ DISABLE_INTERRUPTS();\n+ if (RTC_GetCounter() - val < TIMERLOOP_THRESHOLD){\n+ // the timer is already late, schedule the ISR right now manually\n+ EXTI->SWIER |= EXTI_Line17;\n+ } else {\n+ if (val-RTC_GetCounter()<TIMERTHRESHOLD){\n+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ // schedule ISR right now manually\n+ EXTI->SWIER |= EXTI_Line17;\n+ } else {\n+ // schedule the timer at val\n+ RTC_SetAlarm(val);\n+ RTC_WaitForLastTask();\n+ }\n+ }\n+\n+ ENABLE_INTERRUPTS();\n+\n+ //set sctimer irpstatus\n+ RTC_ClearFlag(RTC_IT_ALR);\n+ RTC_ITConfig(RTC_IT_ALR, ENABLE);\n+}\n+\n+void sctimer_enable() {\n+ RTC_ClearFlag(RTC_IT_ALR);\n+ RTC_ITConfig(RTC_IT_ALR, ENABLE);\n+}\n+\n+void sctimer_disable() {\n+ RTC_ITConfig(RTC_IT_ALR, DISABLE);\n+}\n+\n+//=========================== private =========================================\n+\n+//=========================== interrupt handlers ==============================\n+\n+kick_scheduler_t sctimer_isr() {\n+ if (sctimer_vars.sctimer_cb!=NULL) {\n+\n+ RCC_Wakeup();\n+ // call the callback\n+ sctimer_vars.sctimer_cb();\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ return DO_NOT_KICK_SCHEDULER;\n+}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. port sctimer for iot-lab_M3
491,595
03.05.2017 16:30:11
-7,200
5d62167156afe2bb33d7de0ed24b2d422cfa9e13
port sctimer for iot-lab_A8_M3.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_A8-M3/board.c", "new_path": "bsp/boards/iot-lab_A8-M3/board.c", "diff": "\\brief iot-lab_A8-M3 definition of the \"board\" bsp module.\n\\author Alaeddine Weslati <alaeddine.weslati@inria.fr>, January 2014.\n-\\author Tengfei Chang <tengfei.chang@inria.fr>, september 2016.\n+\\author Tengfei Chang <tengfei.chang@inria.fr>, May 2017.\n*/\n#include \"stm32f10x_lib.h\"\n#include \"board.h\"\n#include \"leds.h\"\n#include \"uart.h\"\n#include \"spi.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n#include \"rcc.h\"\n#include \"nvic.h\"\n#include \"debugpins.h\"\n@@ -36,11 +35,14 @@ int main() {\n//=========================== public ==========================================\n-void board_init()\n-{\n- RCC_Configuration();//Configure rcc\n- NVIC_Configuration();//configure NVIC and Vector Table\n+void board_init(){\n+ //Configure rcc\n+ RCC_Configuration();\n+ //configure NVIC and Vector Table\n+ NVIC_Configuration();\n+\n+ // configure hardfault exception\nboard_enableHardFaultExceptionHandler();\n//configure ALL GPIO to AIN to get lowest power\n@@ -89,9 +91,8 @@ void board_init()\nleds_init();\nuart_init();\nspi_init();\n- bsp_timer_init();\n+ sctimer_init();\nradio_init();\n- radiotimer_init();\ndebugpins_init();\n//enable nvic for the radio\nNVIC_radio();\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_A8-M3/board_info.h", "new_path": "bsp/boards/iot-lab_A8-M3/board_info.h", "diff": "@@ -5,8 +5,9 @@ This module simply defines some strings describing the board, which CoAP uses\nto return the board's description.\n\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012.\n-\\author Tengfei Chang <tengfei.chang@gmail.com>, July 2012.\n+\n\\author Alaeddine Weslati <alaeddine.weslati@inria.fr>, January 2014.\n+\\author Tengfei Chang <tengfei.chang@inria.fr>, May 2017.\n*/\n#ifndef __BOARD_INFO_H\n@@ -30,10 +31,10 @@ to return the board's description.\n//===== timer\n-#define PORT_TIMER_WIDTH uint16_t\n-#define PORT_RADIOTIMER_WIDTH uint16_t\n+#define PORT_TIMER_WIDTH uint32_t\n+#define PORT_RADIOTIMER_WIDTH uint32_t\n-#define PORT_SIGNED_INT_WIDTH int16_t\n+#define PORT_SIGNED_INT_WIDTH int32_t\n#define PORT_TICS_PER_MS 32\n#define SCHEDULER_WAKEUP() EXTI->SWIER |= EXTI_Line1;\n#define SCHEDULER_ENABLE_INTERRUPT() //enable in board use EXTI_Line1\n@@ -65,10 +66,16 @@ to return the board's description.\n#define SYNC_ACCURACY 2 // ticks\n+//===== opentimers\n+\n+#define TIMERTHRESHOLD 10 // ticks\n+\n+//=========================== typedef ========================================\n+\n//=========================== variables =======================================\nstatic const uint8_t rreg_uriquery[] = \"h=ucb\";\n-static const uint8_t infoBoardname[] = \"IOT-LAB_M3\";\n+static const uint8_t infoBoardname[] = \"IOT-LAB_A8-M3\";\nstatic const uint8_t infouCName[] = \"STM32F103\";\nstatic const uint8_t infoRadioName[] = \"AT86RF231\";\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/iot-lab_A8-M3/bsp_timer.c", "new_path": null, "diff": "-/**\n-\\brief IoT-Lab_A8-M3 definition of the \"bsp_timer\" bsp module.\n-\n-On IoT-Lab_A8-M3, we use TIM2 for the bsp_timer module.\n-\n-\\author Chang Tengfei <tengfei.chang@gmail.com>, July 2012.\n-*/\n-#include \"stm32f10x_lib.h\"\n-#include \"string.h\"\n-#include \"bsp_timer.h\"\n-#include \"board.h\"\n-\n-#include \"rcc.h\"\n-#include \"nvic.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- bsp_timer_cbt cb;\n- PORT_TIMER_WIDTH last_compare_value;\n-} bsp_timer_vars_t;\n-\n-volatile bsp_timer_vars_t bsp_timer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-/**\n-\\brief Initialize this module.\n-\n-This functions starts the timer, i.e. the counter increments, but doesn't set\n-any compare registers, so no interrupt will fire.\n-*/\n-void bsp_timer_init()\n-{\n- // clear local variables\n- memset((void*)&bsp_timer_vars,0,sizeof(bsp_timer_vars_t));\n-\n- //Configure TIM2, Clock\n- RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2 , ENABLE);\n-\n- //Configure TIM2: Period = 0xffff, prescaler = 1023(32M/(1023+1) = 32.768KHz), CounterMode = upCounting mode\n- TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure ;\n- TIM_TimeBaseStructure.TIM_Period = 0xFFFF;\n- TIM_TimeBaseStructure.TIM_Prescaler = 1023;\n- TIM_TimeBaseStructure.TIM_ClockDivision = 0;\n- TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;\n- TIM_TimeBaseInit(TIM2, &TIM_TimeBaseStructure);\n-\n- //Configure TIM2's out compare mode: out compare mode = toggle, out compare value = 0 (useless before enable compare interrupt), enable TIM2_CH1\n- TIM_OCInitTypeDef TIM_OCInitStructure;\n- TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Toggle;\n- TIM_OCInitStructure.TIM_Pulse = 0;\n- TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;\n- TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;\n- TIM_OC1Init(TIM2, &TIM_OCInitStructure);\n-\n- //enable TIM2\n- TIM_Cmd(TIM2, ENABLE);\n-}\n-\n-/**\n-\\brief Register a callback.\n-\n-\\param cb The function to be called when a compare event happens.\n-*/\n-void bsp_timer_set_callback(bsp_timer_cbt cb)\n-{\n- bsp_timer_vars.cb = cb;\n- //enable nvic\n- NVIC_bsptimer();\n-}\n-\n-/**\n-\\brief Reset the timer.\n-\n-This function does not stop the timer, it rather resets the value of the\n-counter, and cancels a possible pending compare event.\n-*/\n-void bsp_timer_reset()\n-{\n- // reset compare\n- TIM_SetCompare1(TIM2,0);\n-\n- //enable compare interrupt\n- TIM_ClearFlag(TIM2, TIM_FLAG_CC1);\n- TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE);\n-\n- // reset timer\n- TIM_SetCounter(TIM2,0);\n-\n- // record last timer compare value\n- bsp_timer_vars.last_compare_value = 0;\n-}\n-\n-/**\n-\\brief Schedule the callback to be called in some specified time.\n-\n-The delay is expressed relative to the last compare event. It doesn't matter\n-how long it took to call this function after the last compare, the timer will\n-expire precisely delayTicks after the last one.\n-\n-The only possible problem is that it took so long to call this function that\n-the delay specified is shorter than the time already elapsed since the last\n-compare. In that case, this function triggers the interrupt to fire right away.\n-\n-This means that the interrupt may fire a bit off, but this inaccuracy does not\n-propagate to subsequent timers.\n-\n-\\param delayTicks Number of ticks before the timer expired, relative to the\n- last compare event.\n-*/\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks)\n-{\n- PORT_TIMER_WIDTH newCompareValue;\n- PORT_TIMER_WIDTH temp_last_compare_value;\n- //enable it if not enabled.\n- TIM_Cmd(TIM2, ENABLE);\n-\n- temp_last_compare_value = bsp_timer_vars.last_compare_value;\n-\n- newCompareValue = bsp_timer_vars.last_compare_value+delayTicks;\n- bsp_timer_vars.last_compare_value = newCompareValue;\n-\n- if (delayTicks < (TIM_GetCounter(TIM2)-temp_last_compare_value))\n- {\n- // setting the interrupt flag triggers an interrupt\n- TIM_GenerateEvent(TIM2,TIM_EventSource_CC1);\n- }\n- else\n- {\n- // this is the normal case, have timer expire at newCompareValue\n- TIM_SetCompare1(TIM2,newCompareValue);\n- TIM_ClearFlag(TIM2, TIM_FLAG_CC1);\n- TIM_ITConfig(TIM2, TIM_IT_CC1, ENABLE);\n- }\n-}\n-\n-/**\n-\\brief Cancel a running compare.\n-*/\n-void bsp_timer_cancel_schedule()\n-{\n- TIM_SetCompare1(TIM2,0);\n- TIM_ITConfig(TIM2, TIM_IT_CC1, DISABLE);\n-}\n-\n-/**\n-\\brief Return the current value of the timer's counter.\n-\n-\\returns The current value of the timer's counter.\n-*/\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue()\n-{\n- return TIM_GetCounter(TIM2);\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t bsp_timer_isr()\n-{\n- // call the callback\n- bsp_timer_vars.cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n-}\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_A8-M3/configure/stm32f10x_it.c", "new_path": "bsp/boards/iot-lab_A8-M3/configure/stm32f10x_it.c", "diff": "/* Includes ------------------------------------------------------------------*/\n#include \"stm32f10x_it.h\"\n#include \"leds.h\"\n-#include \"bsp_timer.h\"\n-#include \"radiotimer.h\"\n+#include \"sctimer.h\"\n#include \"spi.h\"\n#include \"radio.h\"\n#include \"uart.h\"\n@@ -488,14 +487,6 @@ void TIM1_CC_IRQHandler(void)\n*******************************************************************************/\nvoid TIM2_IRQHandler(void)\n{\n- debugpins_isr_set();\n- if(TIM_GetFlagStatus(TIM2,TIM_FLAG_CC1) != RESET)\n- {\n- TIM_ClearFlag(TIM2,TIM_FLAG_CC1);\n- //leds_error_toggle();\n- bsp_timer_isr();\n- }\n- debugpins_isr_clr();\n}\n/*******************************************************************************\n@@ -667,7 +658,7 @@ void RTCAlarm_IRQHandler(void)\nif(EXTI_GetITStatus(EXTI_Line17) != RESET)\n{\nEXTI_ClearITPendingBit(EXTI_Line17);\n- radiotimer_isr();\n+ sctimer_isr();\n}\ndebugpins_isr_clr();\n}\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_A8-M3/nvic.c", "new_path": "bsp/boards/iot-lab_A8-M3/nvic.c", "diff": "/**\n\\brief iot-lab_A8-M3 definition of the \"nvic\" bsp module.\n-\\author Alaeddine Weslati <alaeddine.weslati@inria.fr>, January 2014.\n+\\author Chang Tengfei <tengfei.chang@inria.fr>, May 2017.\n*/\n+\n#include \"stm32f10x_lib.h\"\n//=========================== defines =========================================\n//=========================== public ==========================================\n-void NVIC_init(void)\n-{\n+void NVIC_init(void) {\n+\n// Set the Vector Table base location at 0x08000000\nNVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);\n}\n//configuration uart interrput\n-void NVIC_uart(void)\n-{\n+void NVIC_uart(void) {\n//Configure NVIC: Preemption Priority = 3 and Sub Priority = 3\nNVIC_InitTypeDef NVIC_InitStructure;\n@@ -45,22 +45,8 @@ void NVIC_spi(void)\n#endif\n}\n-//configuration bsptimer interrput\n-void NVIC_bsptimer(void)\n-{\n-\n- //Configure NVIC: Preemption Priority = 2 and Sub Priority = 1\n- NVIC_InitTypeDef NVIC_InitStructure;\n- NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQChannel;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\n- NVIC_Init(&NVIC_InitStructure);\n-}\n-\n//configuration radiotimer interrput\n-void NVIC_radiotimer(void)\n-{\n+void NVIC_sctimer(void) {\nNVIC_InitTypeDef NVIC_InitStructure;\n//Configure RTC Alarm interrupt:\n@@ -84,13 +70,12 @@ void NVIC_radio(void)\nNVIC_Init(&NVIC_InitStructure);\n}\n-//configuration of interrupt\n-void NVIC_Configuration(void)\n-{\n+//configuration of interrupt on openmotestm32\n+void NVIC_Configuration(void){\n+\n//Set the Vector Table base location\nNVIC_init();\n//2 bits for Preemption Priority and 2 bits for Sub Priority\nNVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);\n}\n\\ No newline at end of file\n-\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/iot-lab_A8-M3/nvic.h", "new_path": "bsp/boards/iot-lab_A8-M3/nvic.h", "diff": "/**\n\\brief iot-lab_A8-M3 definition of the NVIC.\n-\\author Chang Tengfei <tengfei.chang@gmail.com>, July 2012.\n+\\author Tengfei Chang <tengfei.chang@inria.fr>, May 2017.\n*/\n#ifndef __NVIC_H\n@@ -22,8 +22,7 @@ void NVIC_Configuration(void);\n//configuration module interrput on openmotestm32\nvoid NVIC_uart(void);\nvoid NVIC_spi(void);\n-void NVIC_bsptimer(void);\n-void NVIC_radiotimer(void);\n+void NVIC_sctimer(void);\nvoid NVIC_radio(void);\n#endif\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/iot-lab_A8-M3/radiotimer.c", "new_path": null, "diff": "-/**\n-\\brief iot-lab_A8-M3 definition of the \"radiotimer\" bsp module.\n-\n-On iot-lab_A8-M3, we use RTC for the radiotimer module.\n-\n-\\author Chang Tengfei <tengfei.chang@gmail.com>, July 2012.\n-*/\n-\n-#include \"stdint.h\"\n-\n-#include \"stm32f10x_lib.h\"\n-#include \"leds.h\"\n-#include \"radiotimer.h\"\n-#include \"board.h\"\n-\n-#include \"rcc.h\"\n-#include \"nvic.h\"\n-\n-\n-//=========================== variables =======================================\n-\n-enum radiotimer_irqstatus_enum{\n- RADIOTIMER_NONE = 0x00, //alarm interrupt default status\n- RADIOTIMER_OVERFLOW = 0x01, //alarm interrupt caused by overflow\n- RADIOTIMER_COMPARE = 0x02, //alarm interrupt caused by compare\n-};\n-\n-typedef struct {\n- radiotimer_compare_cbt overflow_cb;\n- radiotimer_compare_cbt compare_cb;\n- uint8_t overflowORcompare;//indicate RTC alarm interrupt status\n- PORT_RADIOTIMER_WIDTH currentSlotPeriod;\n-} radiotimer_vars_t;\n-\n-radiotimer_vars_t radiotimer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init() {\n- // clear local variables\n- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t));\n-}\n-\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.overflow_cb = cb;\n-}\n-\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.compare_cb = cb;\n-}\n-\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period) {\n- //enable BKP and PWR, Clock\n- RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP|RCC_APB1Periph_PWR , ENABLE);\n-\n- // RTC clock source configuration\n- PWR_BackupAccessCmd(ENABLE); //Allow access to BKP Domain\n- RCC_LSEConfig(RCC_LSE_ON); //Enable LSE OSC\n- while(RCC_GetFlagStatus(RCC_FLAG_LSERDY)==RESET); //Wait till LSE is ready\n- RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); //Select the RTC Clock Source\n- RCC_RTCCLKCmd(ENABLE); //enable RTC\n-\n- // RTC configuration\n- // Wait for RTC APB registers synchronisation\n- RTC_WaitForSynchro();\n-\n- RTC_SetPrescaler(1); //use 16KHz clock\n- RTC_WaitForLastTask(); //Wait until last write operation on RTC registers has finished\n-\n- //Set the RTC time counter to 0\n- RTC_SetCounter(0);\n- RTC_WaitForLastTask();\n-\n- radiotimer_vars.currentSlotPeriod = period >> 1;\n-\n- // Set the RTC time alarm(the length of slot)\n- RTC_SetAlarm(radiotimer_vars.currentSlotPeriod);\n- RTC_WaitForLastTask();\n-\n- //interrupt when reach alarm value\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;\n-\n- //Configures EXTI line 17 to generate an interrupt on rising edge(alarm interrupt to wakeup board)\n- EXTI_ClearITPendingBit(EXTI_Line17);\n- EXTI_InitTypeDef EXTI_InitStructure;\n- EXTI_InitStructure.EXTI_Line = EXTI_Line17;\n- EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;\n- EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;\n- EXTI_InitStructure.EXTI_LineCmd = ENABLE;\n- EXTI_Init(&EXTI_InitStructure);\n-\n- //Configure RTC Alarm interrupt:\n- NVIC_radiotimer();\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue() {\n-\n- RTC_WaitForSynchro();\n- uint32_t counter = RTC_GetCounter();\n- counter = counter << 1;\n- return (PORT_RADIOTIMER_WIDTH)counter;\n-}\n-\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) {\n-\n- period = period >> 1;\n-\n- RTC_ITConfig(RTC_IT_ALR, DISABLE);\n- //need to disable radio also in case that a radio interrupt is happening when set Alarm value\n-\n- DISABLE_INTERRUPTS();\n-\n- //Reset RTC Counter to begin a new slot\n- RTC_SetAlarm(period);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- radiotimer_vars.currentSlotPeriod = period;\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod() {\n- RTC_WaitForSynchro();\n- uint32_t period = RTC_GetAlarm();\n- period = period <<1;\n- return (PORT_RADIOTIMER_WIDTH)period;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) {\n-\n- offset = offset >>1;\n-\n- RTC_ITConfig(RTC_IT_ALR, DISABLE);\n- //need to disable radio also in case that a radio interrupt is happening\n-\n- DISABLE_INTERRUPTS();\n-\n- // Set the RTC alarm(RTC timer will alarm at next state of slot)\n- RTC_SetAlarm(offset);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_COMPARE;\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-}\n-\n-void radiotimer_cancel() {\n-\n- RTC_ITConfig(RTC_IT_ALR, DISABLE);\n- //need to disable radio also in case that a radio interrupt is happening\n-\n- DISABLE_INTERRUPTS();\n-\n- // set RTC alarm (slotlength)\n- RTC_SetAlarm(radiotimer_vars.currentSlotPeriod);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- //set radiotimer irpstatus\n- radiotimer_vars.overflowORcompare = RADIOTIMER_OVERFLOW;\n- RTC_ClearFlag(RTC_IT_ALR);\n- RTC_ITConfig(RTC_IT_ALR, ENABLE);\n-}\n-\n-//===== capture\n-\n-inline PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime() {\n- RTC_WaitForSynchro();\n- uint32_t counter = RTC_GetCounter();\n- counter = counter << 1;\n- return (PORT_RADIOTIMER_WIDTH)counter;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t radiotimer_isr() {\n- uint8_t taiv_temp = radiotimer_vars.overflowORcompare;\n- switch (taiv_temp) {\n- case RADIOTIMER_COMPARE:\n- if (radiotimer_vars.compare_cb!=NULL) {\n-\n- RCC_Wakeup();\n- // call the callback\n- radiotimer_vars.compare_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case RADIOTIMER_OVERFLOW: // timer overflows\n- if (radiotimer_vars.overflow_cb!=NULL) {\n-\n- //Wait until last write operation on RTC registers has finished\n- RTC_WaitForLastTask();\n-\n- DISABLE_INTERRUPTS();\n-\n- //Set the RTC time counter to 0\n- RTC_SetCounter(0x00000000);\n- RTC_WaitForLastTask();\n-\n- ENABLE_INTERRUPTS();\n-\n- RCC_Wakeup();\n- // call the callback\n- radiotimer_vars.overflow_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case RADIOTIMER_NONE: // this should not happen\n- default:\n- while(1); // this should not happen\n- }\n- return DO_NOT_KICK_SCHEDULER;\n-}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. port sctimer for iot-lab_A8_M3.
491,595
03.05.2017 16:30:46
-7,200
4234a9166d39fddccbd71464fcf5ea8122c2451f
add sctimer for A8_M3.
[ { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/iot-lab_A8-M3/sctimer.c", "diff": "+/**\n+\\brief Iot_Lab_A8-M3 definition of the \"sctimer\" bsp module.\n+\n+On Iot_Lab_A8-M3, we use RTC for the sctimer module.\n+\n+\\author Tengfei Chang <tengfei.chang@inria.fr>, May 2017.\n+*/\n+\n+#include \"stdint.h\"\n+\n+#include \"stm32f10x_conf.h\"\n+#include \"sctimer.h\"\n+#include \"board.h\"\n+#include \"leds.h\"\n+#include \"rcc.h\"\n+#include \"nvic.h\"\n+\n+\n+// ========================== define ==========================================\n+\n+#define TIMERLOOP_THRESHOLD 0xffffff // 511 seconds @ 32768Hz clock\n+#define OVERFLOW_THRESHOLD 0x7fffffff // as openmotestm32 uses 16kHz, the upper timer overflows when timer research to 0x7fffffff\n+\n+// ========================== variable ========================================\n+\n+typedef struct {\n+ sctimer_cbt sctimer_cb;\n+ bool convert;\n+ bool convertUnlock;\n+} sctimer_vars_t;\n+\n+sctimer_vars_t sctimer_vars;\n+\n+//=========================== prototypes ======================================\n+\n+//=========================== public ==========================================\n+\n+//===== admin\n+\n+void sctimer_init() {\n+ // clear local variables\n+ memset(&sctimer_vars,0,sizeof(sctimer_vars_t));\n+ //enable BKP and PWR, Clock\n+ RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP|RCC_APB1Periph_PWR , ENABLE);\n+\n+ // RTC clock source configuration\n+ PWR_BackupAccessCmd(ENABLE); //Allow access to BKP Domain\n+ RCC_LSEConfig(RCC_LSE_ON); //Enable LSE OSC\n+ while(RCC_GetFlagStatus(RCC_FLAG_LSERDY)==RESET); //Wait till LSE is ready\n+ RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE); //Select the RTC Clock Source\n+ RCC_RTCCLKCmd(ENABLE); //enable RTC\n+\n+ // RTC configuration\n+ // Wait for RTC APB registers synchronisation\n+ RTC_WaitForSynchro();\n+\n+ RTC_SetPrescaler(1); //use 16KHz clock\n+ RTC_WaitForLastTask(); //Wait until last write operation on RTC registers has finished\n+\n+ //Set the RTC time counter to 0\n+ RTC_SetCounter(0);\n+ RTC_WaitForLastTask();\n+\n+ //interrupt when reach alarm value\n+ RTC_ClearFlag(RTC_IT_ALR);\n+ RTC_ITConfig(RTC_IT_ALR, ENABLE);\n+\n+ //Configures EXTI line 17 to generate an interrupt on rising edge(alarm interrupt to wakeup board)\n+ EXTI_ClearITPendingBit(EXTI_Line17);\n+ EXTI_InitTypeDef EXTI_InitStructure;\n+ EXTI_InitStructure.EXTI_Line = EXTI_Line17;\n+ EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;\n+ EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;\n+ EXTI_InitStructure.EXTI_LineCmd = ENABLE;\n+ EXTI_Init(&EXTI_InitStructure);\n+\n+ //Configure RTC Alarm interrupt:\n+ NVIC_sctimer();\n+}\n+\n+void sctimer_set_callback(sctimer_cbt cb){\n+ sctimer_vars.sctimer_cb = cb;\n+}\n+\n+//===== direct access\n+\n+PORT_RADIOTIMER_WIDTH sctimer_readCounter() {\n+ uint32_t counter;\n+ RTC_WaitForSynchro();\n+ counter = RTC_GetCounter();\n+ // upper layer uses 32 bit timer@32kHz, openmotestm is only able to work on\n+ // 16kHz, so manually overflow when rearch 0x7fffffff.\n+ counter = counter & OVERFLOW_THRESHOLD;\n+ counter = counter << 1;\n+ return (PORT_RADIOTIMER_WIDTH)counter;\n+}\n+\n+//===== compare\n+\n+/**\n+\\brief alarm a compare interrupt depending on given compare value.\n+\n+The input parameter val range from 0~2^32. It supposes a timer running @ 32kHz.\n+Since RTC only runs with 16kHz, this range maps to 0~2^31 or 2^31~2^32. the flag\n+convert is used for selecting which range mapping to.\n+ 1) When convert is FALSE, map val to 0~2^31 (val>>1).\n+ 2) When convert is TRUE, map val to 2^31~2^32 ((val>>1)|0x80000000).\n+\n+ when convert is FALSE | when convert is FALSE\n+ compare value is val >>1 | compare value is (val >>1)|0x80000000\n+ |\n+ |----------------------------------------|----------------------------------------|\n+ 0 | 0xffffffff\n+ when convert is TRUE | when convert is TRUE\n+ compare value is (val >>1)|0x80000000 | compare value is val >>1\n+ |\n+ 0x7fffffff-->|<--\"convert\" flag toggles at here once after each overflow\n+\n+\\param[in] val is the compareValue to be alarmed in RTC timer.\n+*/\n+\n+void sctimer_setCompare(PORT_TIMER_WIDTH val) {\n+\n+ // make sure convert flag conly toggle once within one overflow period\n+ if (val > OVERFLOW_THRESHOLD && sctimer_vars.convertUnlock){\n+ // toggle convert\n+ if (sctimer_vars.convert){\n+ sctimer_vars.convert = TRUE;\n+ } else {\n+ sctimer_vars.convert = TRUE;\n+ }\n+ sctimer_vars.convertUnlock = FALSE;\n+ }\n+\n+ // un lock the changes of convert flag\n+ if (val > TIMERLOOP_THRESHOLD && val < 2*TIMERLOOP_THRESHOLD ){\n+ sctimer_vars.convertUnlock = TRUE;\n+ }\n+\n+ // update value to be compared according to timer condition\n+ if (val <= OVERFLOW_THRESHOLD){\n+ if (sctimer_vars.convert){\n+ val = val >>1;\n+ val |= 0x80000000;\n+ } else {\n+ val = val >>1;\n+ }\n+ } else {\n+ if (sctimer_vars.convert){\n+ val = val >>1;\n+ } else {\n+ val = val >>1;\n+ val |= 0x80000000;\n+ }\n+ }\n+\n+ RTC_ITConfig(RTC_IT_ALR, DISABLE);\n+ //need to disable radio also in case that a radio interrupt is happening\n+\n+ DISABLE_INTERRUPTS();\n+ if (RTC_GetCounter() - val < TIMERLOOP_THRESHOLD){\n+ // the timer is already late, schedule the ISR right now manually\n+ EXTI->SWIER |= EXTI_Line17;\n+ } else {\n+ if (val-RTC_GetCounter()<TIMERTHRESHOLD){\n+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ // schedule ISR right now manually\n+ EXTI->SWIER |= EXTI_Line17;\n+ } else {\n+ // schedule the timer at val\n+ RTC_SetAlarm(val);\n+ RTC_WaitForLastTask();\n+ }\n+ }\n+\n+ ENABLE_INTERRUPTS();\n+\n+ //set sctimer irpstatus\n+ RTC_ClearFlag(RTC_IT_ALR);\n+ RTC_ITConfig(RTC_IT_ALR, ENABLE);\n+}\n+\n+void sctimer_enable() {\n+ RTC_ClearFlag(RTC_IT_ALR);\n+ RTC_ITConfig(RTC_IT_ALR, ENABLE);\n+}\n+\n+void sctimer_disable() {\n+ RTC_ITConfig(RTC_IT_ALR, DISABLE);\n+}\n+\n+//=========================== private =========================================\n+\n+//=========================== interrupt handlers ==============================\n+\n+kick_scheduler_t sctimer_isr() {\n+ if (sctimer_vars.sctimer_cb!=NULL) {\n+\n+ RCC_Wakeup();\n+ // call the callback\n+ sctimer_vars.sctimer_cb();\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ return DO_NOT_KICK_SCHEDULER;\n+}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. add sctimer for A8_M3.
491,595
03.05.2017 18:49:59
-7,200
c93b14201d67e0ea0f0ee6372b183dde7e88e591
update openmotestm interrupt priority.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/nvic.c", "new_path": "bsp/boards/openmotestm/nvic.c", "diff": "@@ -35,10 +35,10 @@ void NVIC_uart(void) {\nvoid NVIC_spi(void) {\n#ifdef SPI_IN_INTERRUPT_MODE\n- //Configure NVIC: Preemption Priority = 1 and Sub Priority = 1\n+ //Configure NVIC: Preemption Priority = 2 and Sub Priority = 2\nNVIC_InitTypeDef NVIC_InitStructure;\nNVIC_InitStructure.NVIC_IRQChannel = SPI1_IRQChannel;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;\n+ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2;\nNVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;\nNVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\nNVIC_Init(&NVIC_InitStructure);\n@@ -50,10 +50,10 @@ void NVIC_sctimer(void) {\nNVIC_InitTypeDef NVIC_InitStructure;\n//Configure RTC Alarm interrupt:\n- //Configure NVIC: Preemption Priority = 0 and Sub Priority = 1\n+ //Configure NVIC: Preemption Priority = 1 and Sub Priority = 1\nNVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQChannel;\nNVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;\n+ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\nNVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\nNVIC_Init(&NVIC_InitStructure);\n}\n@@ -61,11 +61,11 @@ void NVIC_sctimer(void) {\n//configuration radio interrput\nvoid NVIC_radio(void){\n- //Configure NVIC: Preemption Priority = 2 and Sub Priority = 0\n+ //Configure NVIC: Preemption Priority = 0 and Sub Priority = 0\nNVIC_InitTypeDef NVIC_InitStructure;\nNVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQChannel;\n- NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;\n- NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;\n+ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;\n+ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;\nNVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;\nNVIC_Init(&NVIC_InitStructure);\n}\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/sctimer.c", "new_path": "bsp/boards/openmotestm/sctimer.c", "diff": "@@ -121,7 +121,7 @@ convert is used for selecting which range mapping to.\nvoid sctimer_setCompare(PORT_TIMER_WIDTH val) {\n- // make sure convert flag conly toggle once within one overflow period\n+ // make sure convert flag only toggle once within one overflow period\nif (val > OVERFLOW_THRESHOLD && sctimer_vars.convertUnlock){\n// toggle convert\nif (sctimer_vars.convert){\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. update openmotestm interrupt priority.
491,595
03.05.2017 18:51:34
-7,200
ecd115c3f9fc7dbb834ffae8c5392919953844f2
use defined timer width rather than uint32_t
[ { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.c", "new_path": "drivers/common/opentimers.c", "diff": "@@ -75,14 +75,14 @@ can't be called firstly after the timer is created.\n\\param[in] cb indicates when this scheduled timer fired, call this callback function.\n*/\nvoid opentimers_scheduleRelative(opentimers_id_t id,\n- uint32_t duration,\n+ PORT_TIMER_WIDTH duration,\ntime_type_t uint_type,\nopentimers_cbt cb){\nuint8_t i;\nuint8_t idToSchedule;\n- uint32_t durationTicks;\n- uint32_t timerGap;\n- uint32_t tempTimerGap;\n+ PORT_TIMER_WIDTH durationTicks;\n+ PORT_TIMER_WIDTH timerGap;\n+ PORT_TIMER_WIDTH tempTimerGap;\n// 1. make sure the timer exist\nfor (i=0;i<MAX_NUM_TIMERS;i++){\nif (opentimers_vars.timersBuf[i].isUsed && i == id){\n@@ -167,15 +167,15 @@ to lastCompareValue + reference.\n\\param[in] cb indicates when this scheduled timer fired, call this callback function.\n*/\nvoid opentimers_scheduleAbsolute(opentimers_id_t id,\n- uint32_t duration,\n- uint32_t reference ,\n+ PORT_TIMER_WIDTH duration,\n+ PORT_TIMER_WIDTH reference ,\ntime_type_t uint_type,\nopentimers_cbt cb){\nuint8_t i;\nuint8_t idToSchedule;\n- uint32_t durationTicks;\n- uint32_t timerGap;\n- uint32_t tempTimerGap;\n+ PORT_TIMER_WIDTH durationTicks;\n+ PORT_TIMER_WIDTH timerGap;\n+ PORT_TIMER_WIDTH tempTimerGap;\n// 1. make sure the timer exist\nfor (i=0;i<MAX_NUM_TIMERS;i++){\nif (opentimers_vars.timersBuf[i].isUsed && i == id){\n@@ -286,7 +286,7 @@ bool opentimers_destroy(opentimers_id_t id){\n\\returns the current counter value.\n*/\n-uint32_t opentimers_getValue(opentimers_id_t id){\n+PORT_TIMER_WIDTH opentimers_getValue(opentimers_id_t id){\nreturn sctimer_readCounter();\n}\n@@ -295,7 +295,7 @@ uint32_t opentimers_getValue(opentimers_id_t id){\n\\returns currentTimeout.\n*/\n-uint32_t opentimers_getCurrentTimeout(void){\n+PORT_TIMER_WIDTH opentimers_getCurrentTimeout(void){\nreturn opentimers_vars.currentTimeout;\n}\n@@ -337,9 +337,9 @@ void opentimers_timer_callback(void){\nuint8_t j;\nuint8_t idToCallCB;\nuint8_t idToSchedule;\n- uint32_t timerGap;\n- uint32_t tempTimerGap;\n- uint32_t tempLastTimeout = opentimers_vars.currentTimeout;\n+ PORT_TIMER_WIDTH timerGap;\n+ PORT_TIMER_WIDTH tempTimerGap;\n+ PORT_TIMER_WIDTH tempLastTimeout = opentimers_vars.currentTimeout;\n// 1. find the expired timer\nfor (i=0;i<MAX_NUM_TIMERS;i++){\nif (opentimers_vars.timersBuf[i].isrunning==TRUE){\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.h", "new_path": "drivers/common/opentimers.h", "diff": "@@ -35,8 +35,8 @@ typedef enum {\n} time_type_t;\ntypedef struct {\n- uint32_t currentCompareValue;// total number of clock ticks\n- uint32_t lastCompareValue; // the previous compare value\n+ PORT_TIMER_WIDTH currentCompareValue;// total number of clock ticks\n+ PORT_TIMER_WIDTH lastCompareValue; // the previous compare value\nbool isrunning; // is running?\nbool isUsed; // true when this entry is occupied\nbool hasExpired; // in case there are more than one interrupt occur at same time\n@@ -49,8 +49,8 @@ typedef struct {\ntypedef struct {\nopentimers_t timersBuf[MAX_NUM_TIMERS];\nbool running;\n- uint32_t currentTimeout; // current timeout, in ticks\n- uint32_t lastTimeout; // last timeout, in ticks. This is the reference time to calculate the next to be expired timer.\n+ PORT_TIMER_WIDTH currentTimeout; // current timeout, in ticks\n+ PORT_TIMER_WIDTH lastTimeout; // last timeout, in ticks. This is the reference time to calculate the next to be expired timer.\n} opentimers_vars_t;\n//=========================== prototypes ======================================\n@@ -58,19 +58,19 @@ typedef struct {\nvoid opentimers_init(void);\nopentimers_id_t opentimers_create(void);\nvoid opentimers_scheduleRelative(opentimers_id_t id,\n- uint32_t duration,\n+ PORT_TIMER_WIDTH duration,\ntime_type_t uint_type,\nopentimers_cbt cb);\nvoid opentimers_scheduleAbsolute(opentimers_id_t id,\n- uint32_t duration,\n- uint32_t reference ,\n+ PORT_TIMER_WIDTH duration,\n+ PORT_TIMER_WIDTH reference ,\ntime_type_t uint_type,\nopentimers_cbt cb);\nvoid opentimers_cancel(opentimers_id_t id);\nbool opentimers_destroy(opentimers_id_t id);\n-uint32_t opentimers_getValue(opentimers_id_t id);\n-uint32_t opentimers_getCurrentTimeout(void);\n+PORT_TIMER_WIDTH opentimers_getValue(opentimers_id_t id);\n+PORT_TIMER_WIDTH opentimers_getCurrentTimeout(void);\nbool opentimers_isRunning(opentimers_id_t id);\nvoid opentimers_setPriority(opentimers_id_t id, uint8_t priority);\n/**\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. use defined timer width rather than uint32_t
491,595
11.05.2017 10:11:34
-7,200
247bc30f497f872472dc83cd2b8c65f3d6ba5b0d
replace PORT_RADIOTIMER_WIDTH by PORT_TIMER_WIDTH.
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -27,39 +27,39 @@ ieee154e_dbg_t ieee154e_dbg;\n// SYNCHRONIZING\nvoid activity_synchronize_newSlot(void);\n-void activity_synchronize_startOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);\n-void activity_synchronize_endOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);\n+void activity_synchronize_startOfFrame(PORT_TIMER_WIDTH capturedTime);\n+void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime);\n// TX\nvoid activity_ti1ORri1(void);\nvoid activity_ti2(void);\nvoid activity_tie1(void);\nvoid activity_ti3(void);\nvoid activity_tie2(void);\n-void activity_ti4(PORT_RADIOTIMER_WIDTH capturedTime);\n+void activity_ti4(PORT_TIMER_WIDTH capturedTime);\nvoid activity_tie3(void);\n-void activity_ti5(PORT_RADIOTIMER_WIDTH capturedTime);\n+void activity_ti5(PORT_TIMER_WIDTH capturedTime);\nvoid activity_ti6(void);\nvoid activity_tie4(void);\nvoid activity_ti7(void);\nvoid activity_tie5(void);\n-void activity_ti8(PORT_RADIOTIMER_WIDTH capturedTime);\n+void activity_ti8(PORT_TIMER_WIDTH capturedTime);\nvoid activity_tie6(void);\n-void activity_ti9(PORT_RADIOTIMER_WIDTH capturedTime);\n+void activity_ti9(PORT_TIMER_WIDTH capturedTime);\n// RX\nvoid activity_ri2(void);\nvoid activity_rie1(void);\nvoid activity_ri3(void);\nvoid activity_rie2(void);\n-void activity_ri4(PORT_RADIOTIMER_WIDTH capturedTime);\n+void activity_ri4(PORT_TIMER_WIDTH capturedTime);\nvoid activity_rie3(void);\n-void activity_ri5(PORT_RADIOTIMER_WIDTH capturedTime);\n+void activity_ri5(PORT_TIMER_WIDTH capturedTime);\nvoid activity_ri6(void);\nvoid activity_rie4(void);\nvoid activity_ri7(void);\nvoid activity_rie5(void);\n-void activity_ri8(PORT_RADIOTIMER_WIDTH capturedTime);\n+void activity_ri8(PORT_TIMER_WIDTH capturedTime);\nvoid activity_rie6(void);\n-void activity_ri9(PORT_RADIOTIMER_WIDTH capturedTime);\n+void activity_ri9(PORT_TIMER_WIDTH capturedTime);\n// frame validity check\nbool isValidRxFrame(ieee802154_header_iht* ieee802514_header);\n@@ -80,7 +80,7 @@ void timeslotTemplateIDStoreFromEB(uint8_t id);\n// channelhopping template handling\nvoid channelhoppingTemplateIDStoreFromEB(uint8_t id);\n// synchronization\n-void synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived);\n+void synchronizePacket(PORT_TIMER_WIDTH timeReceived);\nvoid synchronizeAck(PORT_SIGNED_INT_WIDTH timeCorrection);\nvoid changeIsSync(bool newIsSync);\n// notifying upper layer\n@@ -166,13 +166,13 @@ void ieee154e_init() {\n\\returns The ASN difference, or 0xffff if more than 65535 different\n*/\n-PORT_RADIOTIMER_WIDTH ieee154e_asnDiff(asn_t* someASN) {\n- PORT_RADIOTIMER_WIDTH diff;\n+PORT_TIMER_WIDTH ieee154e_asnDiff(asn_t* someASN) {\n+ PORT_TIMER_WIDTH diff;\nINTERRUPT_DECLARATION();\nDISABLE_INTERRUPTS();\nif (ieee154e_vars.asn.byte4 != someASN->byte4) {\nENABLE_INTERRUPTS();\n- return (PORT_RADIOTIMER_WIDTH)0xFFFFFFFF;;\n+ return (PORT_TIMER_WIDTH)0xFFFFFFFF;;\n}\ndiff = 0;\n@@ -184,7 +184,7 @@ PORT_RADIOTIMER_WIDTH ieee154e_asnDiff(asn_t* someASN) {\ndiff += 0xffff-someASN->bytes0and1;\ndiff += 1;\n} else {\n- diff = (PORT_RADIOTIMER_WIDTH)0xFFFFFFFF;;\n+ diff = (PORT_TIMER_WIDTH)0xFFFFFFFF;;\n}\nENABLE_INTERRUPTS();\nreturn diff;\n@@ -310,8 +310,8 @@ void isr_ieee154e_timer() {\nThis function executes in ISR mode.\n*/\n-void ieee154e_startOfFrame(PORT_RADIOTIMER_WIDTH capturedTime) {\n- uint32_t referenceTime = capturedTime - ieee154e_vars.startOfSlotReference;\n+void ieee154e_startOfFrame(PORT_TIMER_WIDTH capturedTime) {\n+ PORT_TIMER_WIDTH referenceTime = capturedTime - ieee154e_vars.startOfSlotReference;\nif (ieee154e_vars.isSync==FALSE) {\nactivity_synchronize_startOfFrame(referenceTime);\n} else {\n@@ -359,8 +359,8 @@ void ieee154e_startOfFrame(PORT_RADIOTIMER_WIDTH capturedTime) {\nThis function executes in ISR mode.\n*/\n-void ieee154e_endOfFrame(PORT_RADIOTIMER_WIDTH capturedTime) {\n- uint32_t referenceTime = capturedTime - ieee154e_vars.startOfSlotReference;\n+void ieee154e_endOfFrame(PORT_TIMER_WIDTH capturedTime) {\n+ PORT_TIMER_WIDTH referenceTime = capturedTime - ieee154e_vars.startOfSlotReference;\nif (ieee154e_vars.isSync==FALSE) {\nactivity_synchronize_endOfFrame(referenceTime);\n} else {\n@@ -505,7 +505,7 @@ port_INLINE void activity_synchronize_newSlot() {\n}\n}\n-port_INLINE void activity_synchronize_startOfFrame(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_synchronize_startOfFrame(PORT_TIMER_WIDTH capturedTime) {\n// don't care about packet if I'm not listening\nif (ieee154e_vars.state!=S_SYNCLISTEN) {\n@@ -525,7 +525,7 @@ port_INLINE void activity_synchronize_startOfFrame(PORT_RADIOTIMER_WIDTH capture\nieee154e_vars.syncCapturedTime = capturedTime;\n}\n-port_INLINE void activity_synchronize_endOfFrame(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_synchronize_endOfFrame(PORT_TIMER_WIDTH capturedTime) {\nieee802154_header_iht ieee802514_header;\nuint16_t lenIE;\n@@ -1217,7 +1217,7 @@ port_INLINE void activity_tie2() {\n}\n//start of frame interrupt\n-port_INLINE void activity_ti4(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_ti4(PORT_TIMER_WIDTH capturedTime) {\n// change state\nchangeState(S_TXDATA);\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\n@@ -1262,7 +1262,7 @@ port_INLINE void activity_tie3() {\nendSlot();\n}\n-port_INLINE void activity_ti5(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_ti5(PORT_TIMER_WIDTH capturedTime) {\nbool listenForAck;\n// change state\n@@ -1418,7 +1418,7 @@ port_INLINE void activity_tie5() {\nendSlot();\n}\n-port_INLINE void activity_ti8(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_ti8(PORT_TIMER_WIDTH capturedTime) {\n// change state\nchangeState(S_RXACK);\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\n@@ -1462,7 +1462,7 @@ port_INLINE void activity_tie6() {\nendSlot();\n}\n-port_INLINE void activity_ti9(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_ti9(PORT_TIMER_WIDTH capturedTime) {\nieee802154_header_iht ieee802514_header;\n// change state\n@@ -1671,7 +1671,7 @@ port_INLINE void activity_rie2() {\nendSlot();\n}\n-port_INLINE void activity_ri4(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_ri4(PORT_TIMER_WIDTH capturedTime) {\n// change state\nchangeState(S_RXDATA);\n@@ -1719,7 +1719,7 @@ port_INLINE void activity_rie3() {\nendSlot();\n}\n-port_INLINE void activity_ri5(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_ri5(PORT_TIMER_WIDTH capturedTime) {\nieee802154_header_iht ieee802514_header;\nuint16_t lenIE=0;\n@@ -2080,7 +2080,7 @@ port_INLINE void activity_rie5() {\nendSlot();\n}\n-port_INLINE void activity_ri8(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_ri8(PORT_TIMER_WIDTH capturedTime) {\n// change state\nchangeState(S_TXACK);\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\n@@ -2125,7 +2125,7 @@ port_INLINE void activity_rie6() {\nendSlot();\n}\n-port_INLINE void activity_ri9(PORT_RADIOTIMER_WIDTH capturedTime) {\n+port_INLINE void activity_ri9(PORT_TIMER_WIDTH capturedTime) {\n// change state\nchangeState(S_RXPROC);\n#ifdef SLOT_FSM_IMPLEMENTATION_MULTIPLE_TIMER_INTERRUPT\n@@ -2386,11 +2386,11 @@ port_INLINE void channelhoppingTemplateIDStoreFromEB(uint8_t id){\n}\n//======= synchronization\n-void synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived) {\n+void synchronizePacket(PORT_TIMER_WIDTH timeReceived) {\nPORT_SIGNED_INT_WIDTH timeCorrection;\n- PORT_RADIOTIMER_WIDTH newPeriod;\n- PORT_RADIOTIMER_WIDTH currentPeriod;\n- PORT_RADIOTIMER_WIDTH currentValue;\n+ PORT_TIMER_WIDTH newPeriod;\n+ PORT_TIMER_WIDTH currentPeriod;\n+ PORT_TIMER_WIDTH currentValue;\n// record the current timer value and period\ncurrentValue = opentimers_getValue(ieee154e_vars.timerId)-ieee154e_vars.startOfSlotReference;\n@@ -2407,9 +2407,9 @@ void synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived) {\n// we need the new slot to end after the remaining time which is timeCorrection\n// and in this constellation is guaranteed to be positive.\nif (currentValue < timeReceived) {\n- newPeriod = (PORT_RADIOTIMER_WIDTH)timeCorrection;\n+ newPeriod = (PORT_TIMER_WIDTH)timeCorrection;\n} else {\n- newPeriod = (PORT_RADIOTIMER_WIDTH)((PORT_SIGNED_INT_WIDTH)currentPeriod + timeCorrection);\n+ newPeriod = (PORT_TIMER_WIDTH)((PORT_SIGNED_INT_WIDTH)currentPeriod + timeCorrection);\n}\n// detect whether I'm too close to the edge of the slot, in that case,\n@@ -2460,12 +2460,12 @@ void synchronizePacket(PORT_RADIOTIMER_WIDTH timeReceived) {\n}\nvoid synchronizeAck(PORT_SIGNED_INT_WIDTH timeCorrection) {\n- PORT_RADIOTIMER_WIDTH newPeriod;\n- PORT_RADIOTIMER_WIDTH currentPeriod;\n+ PORT_TIMER_WIDTH newPeriod;\n+ PORT_TIMER_WIDTH currentPeriod;\n// calculate new period\ncurrentPeriod = ieee154e_vars.slotDuration;\n- newPeriod = (PORT_RADIOTIMER_WIDTH)((PORT_SIGNED_INT_WIDTH)currentPeriod+timeCorrection);\n+ newPeriod = (PORT_TIMER_WIDTH)((PORT_SIGNED_INT_WIDTH)currentPeriod+timeCorrection);\n// resynchronize by applying the new period\nopentimers_scheduleAbsolute(\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.h", "new_path": "openstack/02a-MAClow/IEEE802154E.h", "diff": "@@ -220,18 +220,18 @@ typedef struct {\nasn_t asn; // current absolute slot number\nslotOffset_t slotOffset; // current slot offset\nslotOffset_t nextActiveSlotOffset; // next active slot offset\n- PORT_RADIOTIMER_WIDTH deSyncTimeout; // how many slots left before looses sync\n+ PORT_TIMER_WIDTH deSyncTimeout; // how many slots left before looses sync\nbool isSync; // TRUE iff mote is synchronized to network\nOpenQueueEntry_t localCopyForTransmission;// copy of the frame used for current TX\n- PORT_RADIOTIMER_WIDTH numOfSleepSlots; // number of slots to sleep between active slots\n+ PORT_TIMER_WIDTH numOfSleepSlots; // number of slots to sleep between active slots\n// as shown on the chronogram\nieee154e_state_t state; // state of the FSM\nOpenQueueEntry_t* dataToSend; // pointer to the data to send\nOpenQueueEntry_t* dataReceived; // pointer to the data received\nOpenQueueEntry_t* ackToSend; // pointer to the ack to send\nOpenQueueEntry_t* ackReceived; // pointer to the ack received\n- PORT_RADIOTIMER_WIDTH lastCapturedTime; // last captured time\n- PORT_RADIOTIMER_WIDTH syncCapturedTime; // captured time used to sync\n+ PORT_TIMER_WIDTH lastCapturedTime; // last captured time\n+ PORT_TIMER_WIDTH syncCapturedTime; // captured time used to sync\n// channel hopping\nuint8_t freq; // frequency of the current slot\nuint8_t asnOffset; // offset inside the frame\n@@ -242,8 +242,8 @@ typedef struct {\nuint8_t tsTemplateId; // timeslot template id\nuint8_t chTemplateId; // channel hopping tempalte id\n- PORT_RADIOTIMER_WIDTH radioOnInit; // when within the slot the radio turns on\n- PORT_RADIOTIMER_WIDTH radioOnTics; // how many tics within the slot the radio is on\n+ PORT_TIMER_WIDTH radioOnInit; // when within the slot the radio turns on\n+ PORT_TIMER_WIDTH radioOnTics; // how many tics within the slot the radio is on\nbool radioOnThisSlot; // to control if the radio has been turned on in a slot.\n//control\n@@ -270,10 +270,10 @@ typedef struct {\nEND_PACK\ntypedef struct {\n- PORT_RADIOTIMER_WIDTH num_newSlot;\n- PORT_RADIOTIMER_WIDTH num_timer;\n- PORT_RADIOTIMER_WIDTH num_startOfFrame;\n- PORT_RADIOTIMER_WIDTH num_endOfFrame;\n+ PORT_TIMER_WIDTH num_newSlot;\n+ PORT_TIMER_WIDTH num_timer;\n+ PORT_TIMER_WIDTH num_startOfFrame;\n+ PORT_TIMER_WIDTH num_endOfFrame;\n} ieee154e_dbg_t;\n//=========================== prototypes ======================================\n@@ -281,7 +281,7 @@ typedef struct {\n// admin\nvoid ieee154e_init(void);\n// public\n-PORT_RADIOTIMER_WIDTH ieee154e_asnDiff(asn_t* someASN);\n+PORT_TIMER_WIDTH ieee154e_asnDiff(asn_t* someASN);\nbool ieee154e_isSynch(void);\nvoid ieee154e_getAsn(uint8_t* array);\nvoid ieee154e_setIsAckEnabled(bool isEnabled);\n@@ -292,8 +292,8 @@ uint16_t ieee154e_getSlotDuration(void);\nuint16_t ieee154e_getTimeCorrection(void);\n// events\n-void ieee154e_startOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);\n-void ieee154e_endOfFrame(PORT_RADIOTIMER_WIDTH capturedTime);\n+void ieee154e_startOfFrame(PORT_TIMER_WIDTH capturedTime);\n+void ieee154e_endOfFrame(PORT_TIMER_WIDTH capturedTime);\n// misc\nbool debugPrint_asn(void);\nbool debugPrint_isSync(void);\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/adaptive_sync.h", "new_path": "openstack/02a-MAClow/adaptive_sync.h", "diff": "@@ -34,7 +34,7 @@ typedef struct {\ntypedef struct {\nadaptive_sync_state_t clockState;\n- PORT_RADIOTIMER_WIDTH elapsedSlots; // since last synchronizatino, this number of slots have elapsed.\n+ PORT_TIMER_WIDTH elapsedSlots; // since last synchronizatino, this number of slots have elapsed.\nuint16_t compensationTimeout; // decrease one every slot, when it reach zero, adjust currectly slot length by 2 tick(60us).\nuint16_t compensateTicks; // record how many ticks are compensated\nasn_t oldASN; // the asn when synchronized previous time\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. replace PORT_RADIOTIMER_WIDTH by PORT_TIMER_WIDTH.
491,595
11.05.2017 10:22:10
-7,200
eb42b9a7856e375142326943215acafd4a10a769
schedule multiple seconds period timer by scheduling multiple pieces of timer with 1 second duration. This is required for 16bit micro-controller since it's only able to schedule timer within 2 seconds (2s = 65536@32768Hz).
[ { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.h", "new_path": "openstack/02a-MAClow/IEEE802154E.h", "diff": "@@ -28,7 +28,7 @@ static const uint8_t chTemplate_default[] = {\n#define TX_POWER 31 // 1=-25dBm, 31=0dBm (max value)\n#define RESYNCHRONIZATIONGUARD 5 // in 32kHz ticks. min distance to the end of the slot to successfully synchronize\n#define US_PER_TICK 30 // number of us per 32kHz clock tick\n-#define EBPERIOD 2000 // in miliseconds: 2000 -> EB every 2000 miseconds\n+#define EBPERIOD 2 // in seconds: 2 -> EB every 2 seconds\n#define MAXKAPERIOD 2000 // in slots: @15ms per slot -> ~30 seconds. Max value used by adaptive synchronization.\n#define DESYNCTIMEOUT 2333 // in slots: @15ms per slot -> ~35 seconds. A larger DESYNCTIMEOUT is needed if using a larger KATIMEOUT.\n#define LIMITLARGETIMECORRECTION 5 // threshold number of ticks to declare a timeCorrection \"large\"\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/neighbors.c", "new_path": "openstack/02b-MAChigh/neighbors.c", "diff": "@@ -417,7 +417,7 @@ void neighbors_removeOld() {\nbool haveParent;\nuint8_t neighborIndexWithLowestRank[3];\ndagrank_t lowestRank;\n- PORT_RADIOTIMER_WIDTH timeSinceHeard;\n+ PORT_TIMER_WIDTH timeSinceHeard;\n// remove old neighbor\nfor (i=0;i<MAXNUMNEIGHBORS;i++) {\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/schedule.c", "new_path": "openstack/02b-MAChigh/schedule.c", "diff": "@@ -731,7 +731,7 @@ bool schedule_getOkToSend() {\nreturnVal = TRUE;\n} else {\n- // non-shared slot: check backoff before answering\n+ // shared slot: check backoff before answering\n// decrement backoff\nif (schedule_vars.backoff>0) {\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -128,7 +128,7 @@ void sixtop_init() {\nsixtop_vars.ebSendingTimerId = opentimers_create();\nopentimers_scheduleAbsolute(\nsixtop_vars.ebSendingTimerId,\n- (sixtop_vars.ebPeriod-EBPERIOD_RANDOM_RANG+(openrandom_get16b()%(2*EBPERIOD_RANDOM_RANG))),\n+ sixtop_vars.periodMaintenance,\nopentimers_getValue(sixtop_vars.ebSendingTimerId),\nTIME_MS,\nsixtop_sendingEb_timer_cb\n@@ -644,7 +644,7 @@ void sixtop_sendingEb_timer_cb(void){\nscheduler_push_task(timer_sixtop_sendEb_fired,TASKPRIO_SIXTOP);\nopentimers_scheduleRelative(\nsixtop_vars.ebSendingTimerId,\n- (sixtop_vars.ebPeriod-EBPERIOD_RANDOM_RANG+(openrandom_get16b()%(2*EBPERIOD_RANDOM_RANG))),\n+ 872+(openrandom_get16b()&0xff),\nTIME_MS,\nsixtop_sendingEb_timer_cb\n);\n@@ -668,7 +668,15 @@ void sixtop_timeout_timer_cb(void) {\n//======= EB/KA task\nvoid timer_sixtop_sendEb_fired(){\n+ sixtop_vars.ebCounter = (sixtop_vars.ebCounter+1)%EBPERIOD;\n+ switch (sixtop_vars.ebCounter) {\n+ case 0:\n+ // called every EBPERIOD seconds\nsixtop_sendEB();\n+ break;\n+ default:\n+ break;\n+ }\n}\n/**\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.h", "new_path": "openstack/02b-MAChigh/sixtop.h", "diff": "@@ -85,6 +85,7 @@ typedef struct {\nbool busySendingEB; // TRUE when busy sending an enhanced beacon\nuint8_t dsn; // current data sequence number\nuint8_t mgtTaskCounter; // counter to determine what management task to do\n+ uint8_t ebCounter; // counter to determine when to send EB\nopentimers_id_t ebSendingTimerId; // EB sending timer id\nopentimers_id_t maintenanceTimerId;\nopentimers_id_t timeoutTimerId; // TimeOut timer id\n" }, { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/icmpv6rpl.c", "new_path": "openstack/03b-IPv6/icmpv6rpl.c", "diff": "@@ -33,8 +33,6 @@ void sendDAO(void);\n*/\nvoid icmpv6rpl_init() {\nuint8_t dodagid[16];\n- uint32_t dioPeriod;\n- uint32_t daoPeriod;\n// retrieve my prefix and EUI64\nmemcpy(&dodagid[0],idmanager_getMyID(ADDR_PREFIX)->prefix,8); // prefix\n@@ -82,11 +80,10 @@ void icmpv6rpl_init() {\nmemcpy(&icmpv6rpl_vars.dioDestination.addr_128b[0],all_routers_multicast,sizeof(all_routers_multicast));\nicmpv6rpl_vars.dioPeriod = TIMER_DIO_TIMEOUT;\n- dioPeriod = icmpv6rpl_vars.dioPeriod - 0x80 + (openrandom_get16b()&0xff);\nicmpv6rpl_vars.timerIdDIO = opentimers_create();\nopentimers_scheduleAbsolute(\nicmpv6rpl_vars.timerIdDIO,\n- dioPeriod,\n+ 872 +(openrandom_get16b()&0xff),\nopentimers_getValue(icmpv6rpl_vars.timerIdDIO),\nTIME_MS,\nicmpv6rpl_timer_DIO_cb\n@@ -132,11 +129,10 @@ void icmpv6rpl_init() {\nicmpv6rpl_vars.dao_target.prefixLength = 0;\nicmpv6rpl_vars.daoPeriod = TIMER_DAO_TIMEOUT;\n- daoPeriod = icmpv6rpl_vars.daoPeriod - 0x80 + (openrandom_get16b()&0xff);\nicmpv6rpl_vars.timerIdDAO = opentimers_create();\nopentimers_scheduleAbsolute(\nicmpv6rpl_vars.timerIdDAO,\n- daoPeriod,\n+ 872 +(openrandom_get16b()&0xff),\nopentimers_getValue(icmpv6rpl_vars.timerIdDAO),\nTIME_MS,\nicmpv6rpl_timer_DAO_cb\n@@ -523,7 +519,7 @@ void icmpv6rpl_timer_DIO_cb(void) {\n// arm the DIO timer with this new value\nopentimers_scheduleRelative(\nicmpv6rpl_vars.timerIdDIO,\n- icmpv6rpl_vars.dioPeriod - 0x80 + (openrandom_get16b()&0xff),\n+ 872 +(openrandom_get16b()&0xff),\nTIME_MS,\nicmpv6rpl_timer_DIO_cb\n);\n@@ -535,7 +531,15 @@ void icmpv6rpl_timer_DIO_cb(void) {\n\\note This function is executed in task context, called by the scheduler.\n*/\nvoid icmpv6rpl_timer_DIO_task() {\n+ icmpv6rpl_vars.dioTimerCounter = (icmpv6rpl_vars.dioTimerCounter+1)%icmpv6rpl_vars.dioPeriod;\n+ switch (icmpv6rpl_vars.dioTimerCounter) {\n+ case 0:\n+ // called every TIMER_DIO_TIMEOUT seconds\nsendDIO();\n+ break;\n+ default:\n+ break;\n+ }\n}\n/**\n@@ -633,7 +637,7 @@ void icmpv6rpl_timer_DAO_cb(void) {\n// arm the DAO timer with this new value\nopentimers_scheduleRelative(\nicmpv6rpl_vars.timerIdDAO,\n- icmpv6rpl_vars.daoPeriod - 0x80 + (openrandom_get16b()&0xff),\n+ 872 +(openrandom_get16b()&0xff),\nTIME_MS,\nicmpv6rpl_timer_DAO_cb\n);\n@@ -645,7 +649,15 @@ void icmpv6rpl_timer_DAO_cb(void) {\n\\note This function is executed in task context, called by the scheduler.\n*/\nvoid icmpv6rpl_timer_DAO_task() {\n+ icmpv6rpl_vars.daoTimerCounter = (icmpv6rpl_vars.daoTimerCounter+1)%icmpv6rpl_vars.daoPeriod;\n+ switch (icmpv6rpl_vars.dioTimerCounter) {\n+ case 0:\n+ // called every TIMER_DAO_TIMEOUT seconds\nsendDAO();\n+ break;\n+ default:\n+ break;\n+ }\n}\n/**\n@@ -813,29 +825,11 @@ void sendDAO() {\n}\nvoid icmpv6rpl_setDIOPeriod(uint16_t dioPeriod){\n- uint32_t dioPeriodRandom;\n-\nicmpv6rpl_vars.dioPeriod = dioPeriod;\n- dioPeriodRandom = icmpv6rpl_vars.dioPeriod - 0x80 + (openrandom_get16b()&0xff);\n- opentimers_scheduleRelative(\n- icmpv6rpl_vars.timerIdDIO,\n- dioPeriodRandom,\n- TIME_MS,\n- icmpv6rpl_timer_DIO_task\n- );\n}\nvoid icmpv6rpl_setDAOPeriod(uint16_t daoPeriod){\n- uint32_t daoPeriodRandom;\n-\nicmpv6rpl_vars.daoPeriod = daoPeriod;\n- daoPeriodRandom = icmpv6rpl_vars.daoPeriod - 0x80 + (openrandom_get16b()&0xff);\n- opentimers_scheduleRelative(\n- icmpv6rpl_vars.timerIdDAO,\n- daoPeriodRandom,\n- TIME_MS,\n- icmpv6rpl_timer_DAO_task\n- );\n}\n" }, { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/icmpv6rpl.h", "new_path": "openstack/03b-IPv6/icmpv6rpl.h", "diff": "//=========================== define ==========================================\n-#define TIMER_DIO_TIMEOUT 10000\n-#define TIMER_DAO_TIMEOUT 60000\n+#define TIMER_DIO_TIMEOUT 10 // seconds\n+#define TIMER_DAO_TIMEOUT 60 // seconds\n// Non-Storing Mode of Operation (1)\n#define MOP_DIO_A 0<<5\n@@ -144,15 +144,17 @@ typedef struct {\n// DIO-related\nicmpv6rpl_dio_ht dio; ///< pre-populated DIO packet.\nopen_addr_t dioDestination; ///< IPv6 destination address for DIOs.\n- uint32_t dioPeriod; ///< duration, in ms, of a timerIdDIO timeout.\n+ uint16_t dioTimerCounter; ///< counter to determine when to send DIO.\nopentimers_id_t timerIdDIO; ///< ID of the timer used to send DIOs.\n+ uint16_t dioPeriod; ///< dio period in seconds.\nuint8_t delayDIO; ///< number of timerIdDIO events before actually sending a DIO.\n// DAO-related\nicmpv6rpl_dao_ht dao; ///< pre-populated DAO packet.\nicmpv6rpl_dao_transit_ht dao_transit; ///< pre-populated DAO \"Transit Info\" option header.\nicmpv6rpl_dao_target_ht dao_target; ///< pre-populated DAO \"Transit Info\" option header.\nopentimers_id_t timerIdDAO; ///< ID of the timer used to send DAOs.\n- uint32_t daoPeriod; ///< duration, in ms, of a timerIdDAO timeout.\n+ uint16_t daoTimerCounter; ///< counter to determine when to send DAO.\n+ uint16_t daoPeriod; ///< dao period in seconds.\nuint8_t delayDAO; ///< number of timerIdDIO events before actually sending a DAO.\n// routing table\ndagrank_t myDAGrank; ///< rank of this router within DAG.\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. schedule multiple seconds period timer by scheduling multiple pieces of timer with 1 second duration. This is required for 16bit micro-controller since it's only able to schedule timer within 2 seconds (2s = 65536@32768Hz).
491,595
11.05.2017 10:26:50
-7,200
3992e351229ebc990ff79e1b757f0387606a8d3e
only update the currentTimeout when outside of ISR since ISR always updates currentTimeout (Reducing the duration for timer ISR execution.)
[ { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.c", "new_path": "drivers/common/opentimers.c", "diff": "@@ -114,6 +114,9 @@ void opentimers_scheduleRelative(opentimers_id_t id,\nopentimers_vars.timersBuf[id].callback = cb;\n// 3. find the next timer to fire\n+\n+ // only execute update the currenttimeout if I am not inside of ISR or the ISR itself will do this.\n+ if (opentimers_vars.insideISR==FALSE){\ntimerGap = opentimers_vars.timersBuf[0].currentCompareValue-opentimers_vars.lastTimeout;\nidToSchedule = 0;\nfor (i=1;i<MAX_NUM_TIMERS;i++){\n@@ -152,6 +155,7 @@ void opentimers_scheduleRelative(opentimers_id_t id,\n// if I got here, assign the next to be fired timer to given timer\nopentimers_vars.currentTimeout = opentimers_vars.timersBuf[idToSchedule].currentCompareValue;\nsctimer_setCompare(opentimers_vars.currentTimeout);\n+ }\nopentimers_vars.running = TRUE;\n}\n@@ -207,6 +211,9 @@ void opentimers_scheduleAbsolute(opentimers_id_t id,\nopentimers_vars.timersBuf[id].callback = cb;\n// 3. find the next timer to fire\n+\n+ // only execute update the currenttimeout if I am not inside of ISR or the ISR itself will do this.\n+ if (opentimers_vars.insideISR==FALSE){\ntimerGap = opentimers_vars.timersBuf[0].currentCompareValue-opentimers_vars.lastTimeout;\nidToSchedule = 0;\nfor (i=1;i<MAX_NUM_TIMERS;i++){\n@@ -245,6 +252,7 @@ void opentimers_scheduleAbsolute(opentimers_id_t id,\n// if I got here, assign the next to be fired timer to given timer\nopentimers_vars.currentTimeout = opentimers_vars.timersBuf[idToSchedule].currentCompareValue;\nsctimer_setCompare(opentimers_vars.currentTimeout);\n+ }\nopentimers_vars.running = TRUE;\n}\n@@ -360,6 +368,8 @@ void opentimers_timer_callback(void){\nopentimers_vars.lastTimeout = tempLastTimeout;\n// 2. call the callback of expired timers\n+ opentimers_vars.insideISR = TRUE;\n+\nidToCallCB = TOO_MANY_TIMERS_ERROR;\n// find out the timer expired with highest priority\nfor (j=0;j<MAX_NUM_TIMERS;j++){\n@@ -389,6 +399,7 @@ void opentimers_timer_callback(void){\n}\n}\n}\n+ opentimers_vars.insideISR = FALSE;\n// 3. find the next timer to be fired\ntimerGap = opentimers_vars.timersBuf[0].currentCompareValue-opentimers_vars.lastTimeout;\n@@ -428,6 +439,8 @@ void opentimers_timer_callback(void){\n// 4. reschedule the timer\nopentimers_vars.currentTimeout = opentimers_vars.timersBuf[idToSchedule].currentCompareValue;\n+ opentimers_vars.lastCompare[opentimers_vars.index] = opentimers_vars.currentTimeout;\n+ opentimers_vars.index = (opentimers_vars.index+1)&0x0F;\nsctimer_setCompare(opentimers_vars.currentTimeout);\nopentimers_vars.running = TRUE;\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.h", "new_path": "drivers/common/opentimers.h", "diff": "@@ -51,6 +51,9 @@ typedef struct {\nbool running;\nPORT_TIMER_WIDTH currentTimeout; // current timeout, in ticks\nPORT_TIMER_WIDTH lastTimeout; // last timeout, in ticks. This is the reference time to calculate the next to be expired timer.\n+ PORT_TIMER_WIDTH lastCompare[16]; // for debugging purpose\n+ uint8_t index; // index for lastCompare array\n+ bool insideISR; // whether the function of opentimer is called inside of ISR or not\n} opentimers_vars_t;\n//=========================== prototypes ======================================\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. only update the currentTimeout when outside of ISR since ISR always updates currentTimeout (Reducing the duration for timer ISR execution.)
491,595
11.05.2017 11:11:59
-7,200
e81e0a96a189e1795d2025eb44603aaed82956f9
telosb sctimer port.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/sctimer.h", "new_path": "bsp/boards/sctimer.h", "diff": "//=========================== typedef =========================================\ntypedef void (*sctimer_cbt)(void);\n+typedef void (*sctimer_capture_cbt)(PORT_TIMER_WIDTH timestamp);\n//=========================== variables =======================================\n@@ -27,6 +28,8 @@ typedef void (*sctimer_cbt)(void);\nvoid sctimer_init(void);\nvoid sctimer_setCompare(PORT_TIMER_WIDTH val);\nvoid sctimer_set_callback(sctimer_cbt cb);\n+void sctimer_setStartFrameCb(sctimer_capture_cbt cb);\n+void sctimer_setEndFrameCb(sctimer_capture_cbt cb);\nPORT_TIMER_WIDTH sctimer_readCounter(void);\nvoid sctimer_enable(void);\nvoid sctimer_disable(void);\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/telosb/SConscript", "new_path": "bsp/boards/telosb/SConscript", "diff": "@@ -24,11 +24,10 @@ sht11 = localEnv.SConscript(\nsource = [\n'board.c',\n- 'bsp_timer.c',\n+ 'sctimer.c',\n'debugpins.c',\n'eui64.c',\n'leds.c',\n- 'radiotimer.c',\n'spi.c',\n'uart.c',\n'board_crypto_engine.c',\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/telosb/board.c", "new_path": "bsp/boards/telosb/board.c", "diff": "#include \"leds.h\"\n#include \"uart.h\"\n#include \"spi.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n//=========================== variables =======================================\n@@ -56,9 +55,8 @@ void board_init() {\nleds_init();\nuart_init();\nspi_init();\n- bsp_timer_init();\nradio_init();\n- radiotimer_init();\n+ sctimer_init();\n// enable interrupts\n__bis_SR_register(GIE);\n@@ -72,6 +70,19 @@ void board_reset() {\nWDTCTL = (WDTPW+0x1200) + WDTHOLD; // writing a wrong watchdog password to causes handler to reset\n}\n+// during startup process before executing main function,\n+// all variables need to be initialized, which may take long time\n+// and watchdog may be triggered during this period.\n+// Using __low_level_init to disable the watchdog to avoid this situation.\n+int __low_level_init(void)\n+{\n+ // stop WDT\n+ WDTCTL = WDTPW + WDTHOLD;\n+\n+ // Perform data segment initialization\n+ return 1;\n+}\n+\n//=========================== private =========================================\n//=========================== interrupt handlers ==============================\n@@ -100,14 +111,6 @@ ISR(USART1RX) {\n// TIMERA1_VECTOR\n-ISR(TIMERA0) {\n- debugpins_isr_set();\n- if (bsp_timer_isr()==KICK_SCHEDULER) { // timer: 0\n- __bic_SR_register_on_exit(CPUOFF);\n- }\n- debugpins_isr_clr();\n-}\n-\n// ADC12_VECTOR\n// USART0TX_VECTOR\n@@ -130,7 +133,7 @@ ISR(COMPARATORA) {\nISR(TIMERB1) {\ndebugpins_isr_set();\n- if (radiotimer_isr()==KICK_SCHEDULER) { // radiotimer\n+ if (sctimer_isr()==KICK_SCHEDULER) { // sctimer\n__bic_SR_register_on_exit(CPUOFF);\n}\ndebugpins_isr_clr();\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/telosb/board_info.h", "new_path": "bsp/boards/telosb/board_info.h", "diff": "@@ -35,7 +35,6 @@ to this board.\n//===== timer\n#define PORT_TIMER_WIDTH uint16_t\n-#define PORT_RADIOTIMER_WIDTH uint16_t\n#define PORT_SIGNED_INT_WIDTH int16_t\n#define PORT_TICS_PER_MS 33\n@@ -59,13 +58,13 @@ to this board.\n#define PORT_TsSlotDuration 492 // counter counts one extra count, see datasheet\n// execution speed related\n-#define PORT_maxTxDataPrepare 100 // 2899us (measured 2420us)\n+#define PORT_maxTxDataPrepare 100 // 2899us (measured 2516us)\n#define PORT_maxRxAckPrepare 20 // 610us (measured 474us)\n#define PORT_maxRxDataPrepare 33 // 1000us (measured 477us)\n-#define PORT_maxTxAckPrepare 40 // 792us (measured 746us)- cannot be bigger than 28.. is the limit for telosb as actvitiy_rt5 is executed almost there.\n+#define PORT_maxTxAckPrepare 45 // 1372us (measured 1328us)- cannot be bigger than 28.. is the limit for telosb as actvitiy_rt5 is executed almost there.\n// radio speed related\n-#define PORT_delayTx 12 // 366us (measured 352us)\n+#define PORT_delayTx 16 // 488us (measured 473us)\n#define PORT_delayRx 0 // 0us (can not measure)\n//===== adaptive_sync accuracy\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/telosb/bsp_timer.c", "new_path": null, "diff": "-/**\n-\\brief TelosB-specific definition of the \"bsp_timer\" bsp module.\n-\n-On TelosB, we use timerA0 for the bsp_timer module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, March 2012.\n-*/\n-\n-#include \"msp430f1611.h\"\n-#include \"bsp_timer.h\"\n-#include \"board.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- bsp_timer_cbt cb;\n- PORT_TIMER_WIDTH last_compare_value;\n-} bsp_timer_vars_t;\n-\n-bsp_timer_vars_t bsp_timer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-/**\n-\\brief Initialize this module.\n-\n-This functions starts the timer, i.e. the counter increments, but doesn't set\n-any compare registers, so no interrupt will fire.\n-*/\n-void bsp_timer_init() {\n-\n- // clear local variables\n- memset(&bsp_timer_vars,0,sizeof(bsp_timer_vars_t));\n-\n- // set CCRA0 registers\n- TACCR0 = 0;\n- TACCTL0 = 0;\n-\n- //start TimerA\n- TACTL = MC_2+TASSEL_1; // continuous mode, from ACLK\n-}\n-\n-/**\n-\\brief Register a callback.\n-\n-\\param cb The function to be called when a compare event happens.\n-*/\n-void bsp_timer_set_callback(bsp_timer_cbt cb) {\n- bsp_timer_vars.cb = cb;\n-}\n-\n-/**\n-\\brief Reset the timer.\n-\n-This function does not stop the timer, it rather resets the value of the\n-counter, and cancels a possible pending compare event.\n-*/\n-void bsp_timer_reset() {\n- // reset compare\n- TACCR0 = 0;\n- TACCTL0 = 0;\n- // reset timer\n- TAR = 0;\n- // record last timer compare value\n- bsp_timer_vars.last_compare_value = 0;\n-}\n-\n-/**\n-\\brief Schedule the callback to be called in some specified time.\n-\n-The delay is expressed relative to the last compare event. It doesn't matter\n-how long it took to call this function after the last compare, the timer will\n-expire precisely delayTicks after the last one.\n-\n-The only possible problem is that it took so long to call this function that\n-the delay specified is shorter than the time already elapsed since the last\n-compare. In that case, this function triggers the interrupt to fire right away.\n-\n-This means that the interrupt may fire a bit off, but this inaccuracy does not\n-propagate to subsequent timers.\n-\n-\\param delayTicks Number of ticks before the timer expired, relative to the\n- last compare event.\n-*/\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks) {\n- PORT_TIMER_WIDTH newCompareValue;\n- PORT_TIMER_WIDTH temp_last_compare_value;\n-\n- temp_last_compare_value = bsp_timer_vars.last_compare_value;\n-\n- newCompareValue = bsp_timer_vars.last_compare_value+delayTicks;\n- bsp_timer_vars.last_compare_value = newCompareValue;\n-\n- if (delayTicks<TAR-temp_last_compare_value) {\n- // we're already too late, schedule the ISR right now, manually\n-\n- // setting the interrupt flag triggers an interrupt\n- TACCTL0 |= CCIFG;\n- } else {\n- // this is the normal case, have timer expire at newCompareValue\n- TACCR0 = newCompareValue;\n- }\n- // enable interrupts\n- TACCTL0 |= CCIE;\n-}\n-\n-/**\n-\\brief Cancel a running compare.\n-*/\n-void bsp_timer_cancel_schedule() {\n- TACCR0 = 0;\n- TACCTL0 &= ~CCIE;\n-}\n-\n-/**\n-\\brief Return the current value of the timer's counter.\n-\n-\\returns The current value of the timer's counter.\n-*/\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue() {\n- return TBR;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrup handlers ===============================\n-\n-kick_scheduler_t bsp_timer_isr() {\n- // call the callback\n- bsp_timer_vars.cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n-}\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/telosb/radiotimer.c", "new_path": null, "diff": "-/**\n-\\brief TelosB-specific definition of the \"radiotimer\" bsp module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012.\n-*/\n-\n-#include \"msp430f1611.h\"\n-#include \"radiotimer.h\"\n-#include \"leds.h\"\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- radiotimer_compare_cbt overflowCb;\n- radiotimer_compare_cbt compareCb;\n- radiotimer_capture_cbt startFrameCb;\n- radiotimer_capture_cbt endFrameCb;\n- uint8_t f_SFDreceived;\n-} radiotimer_vars_t;\n-\n-radiotimer_vars_t radiotimer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init() {\n- // clear local variables\n- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t));\n-}\n-\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.overflowCb = cb;\n-}\n-\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.compareCb = cb;\n-}\n-\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_vars.startFrameCb = cb;\n-}\n-\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_vars.endFrameCb = cb;\n-}\n-\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period) {\n- // radio's SFD pin connected to P4.1\n- P4DIR &= ~0x02; // input\n- P4SEL |= 0x02; // in CCI1a/B mode\n-\n- // CCR0 contains period of counter\n- // do not interrupt when counter reaches TBCCR0, but when it resets\n- TBCCR0 = period-1;\n-\n- // CCR1 in capture mode\n- TBCCTL1 = CM_3+SCS+CAP+CCIE;\n- TBCCR1 = 0;\n-\n- // CCR2 in compare mode (disabled for now)\n- TBCCTL2 = 0;\n- TBCCR2 = 0;\n-\n- // start counting\n- TBCTL = TBIE+TBCLR; // interrupt when counter resets\n- TBCTL |= MC_1+TBSSEL_1; // up mode, clocked from ACLK\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue() {\n- return TBR;\n-}\n-\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) {\n- TBCCR0 = period;\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod() {\n- return TBCCR0;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) {\n- // offset when to fire\n- TBCCR2 = offset;\n-\n- // enable compare interrupt (this also cancels any pending interrupts)\n- TBCCTL2 = CCIE;\n-}\n-\n-void radiotimer_cancel() {\n- // reset compare value (also resets interrupt flag)\n- TBCCR2 = 0;\n-\n- // disable compare interrupt\n- TBCCTL2 &= ~CCIE;\n-}\n-\n-//===== capture\n-\n-inline PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime() {\n- // this should never happpen!\n-\n- // we can not print from within the BSP. Instead:\n- // blink the error LED\n- leds_error_blink();\n- // reset the board\n- board_reset();\n-\n- return 0;// this line is never reached, but here to satisfy compiler\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-/**\n-\\brief TimerB CCR1-6 interrupt service routine\n-*/\n-kick_scheduler_t radiotimer_isr() {\n- PORT_RADIOTIMER_WIDTH tbiv_local;\n-\n- // reading TBIV returns the value of the highest pending interrupt flag\n- // and automatically resets that flag. We therefore copy its value to the\n- // tbiv_local local variable exactly once. If there is more than one\n- // interrupt pending, we will reenter this function after having just left\n- // it.\n- tbiv_local = TBIV;\n-\n- switch (tbiv_local) {\n- case 0x0002: // CCR1 fires\n- if (TBCCTL1 & CCI) {\n- // SFD pin is high: this was the start of a frame\n- if (radiotimer_vars.startFrameCb!=NULL) {\n- radiotimer_vars.startFrameCb(TBCCR1);\n- radiotimer_vars.f_SFDreceived = 1;\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- } else {\n- // SFD pin is low: this was the end of a frame\n- if (radiotimer_vars.endFrameCb!=NULL) {\n- if (radiotimer_vars.f_SFDreceived == 1) {\n- radiotimer_vars.endFrameCb(TBCCR1);\n- radiotimer_vars.f_SFDreceived = 0;\n- }\n- TBCCTL1 &= ~COV;\n- TBCCTL1 &= ~CCIFG;\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- }\n- break;\n- case 0x0004: // CCR2 fires\n- if (radiotimer_vars.compareCb!=NULL) {\n- radiotimer_vars.compareCb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case 0x0006: // CCR3 fires\n- break;\n- case 0x0008: // CCR4 fires\n- break;\n- case 0x000a: // CCR5 fires\n- break;\n- case 0x000c: // CCR6 fires\n- break;\n- case 0x000e: // timer overflow\n- if (radiotimer_vars.overflowCb!=NULL) {\n- radiotimer_vars.overflowCb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- }\n- return DO_NOT_KICK_SCHEDULER;\n-}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/telosb/sctimer.c", "diff": "+/**\n+\\brief A timer module with only a single compare value.\n+\n+\\author: Tengfei Chang <tengfei.chang@inria.fr> April 2017\n+*/\n+\n+#include \"sctimer.h\"\n+#include \"msp430f1611.h\"\n+#include \"sctimer.h\"\n+#include \"board.h\"\n+#include \"leds.h\"\n+\n+// ========================== define ==========================================\n+\n+#define TIMERLOOP_THRESHOLD 0x4000 // 0.5 seconds @ 32768Hz clock\n+#define MINIMUM_COMPAREVALE_ADVANCE 3\n+\n+// ========================== variable ========================================\n+\n+typedef struct {\n+ sctimer_cbt cb;\n+ sctimer_capture_cbt startFrameCb;\n+ sctimer_capture_cbt endFrameCb;\n+ uint8_t f_SFDreceived;\n+ uint16_t currentTBIV[8];\n+ uint8_t index;\n+ uint8_t triggerWay[8];\n+ uint8_t indexT;\n+} sctimer_vars_t;\n+\n+sctimer_vars_t sctimer_vars;\n+\n+// ========================== private ==========================================\n+\n+// ========================== protocol =========================================\n+\n+/**\n+\\brief Initialization sctimer.\n+*/\n+void sctimer_init(void){\n+ memset(&sctimer_vars, 0, sizeof(sctimer_vars_t));\n+\n+ sctimer_vars.indexT = 0x07;\n+\n+ // radio's SFD pin connected to P4.1\n+ P4DIR &= ~0x02; // input\n+ P4SEL |= 0x02; // in CCI1a/B mode\n+\n+ // CCR1 in capture mode\n+ TBCCTL1 = CM_3+SCS+CAP+CCIE;\n+ TBCCR1 = 0;\n+\n+ // CCR2 in compare mode (disabled for now)\n+ TBCCTL2 = 0;\n+ TBCCR2 = 0;\n+\n+ // start counting\n+ TBCTL = MC_2+TBSSEL_1; // continue mode, clocked from ACLK\n+}\n+\n+void sctimer_set_callback(sctimer_cbt cb){\n+ sctimer_vars.cb = cb;\n+}\n+\n+void sctimer_setStartFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.startFrameCb = cb;\n+}\n+\n+void sctimer_setEndFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.endFrameCb = cb;\n+}\n+\n+/**\n+\\brief set compare interrupt\n+*/\n+void sctimer_setCompare(PORT_TIMER_WIDTH val){\n+ TBCCTL2 = CCIE;\n+ if (TBR - val < TIMERLOOP_THRESHOLD){\n+ // the timer is already late, schedule the ISR right now manually\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ if (val-TBR<MINIMUM_COMPAREVALE_ADVANCE){\n+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ // schedule the timer at val\n+ TBCCR2 = val;\n+ }\n+ }\n+}\n+\n+/**\n+\\brief Return the current value of the timer's counter.\n+\n+ \\returns The current value of the timer's counter.\n+*/\n+PORT_TIMER_WIDTH sctimer_readCounter(void){\n+ return TBR;\n+}\n+\n+void sctimer_enable(void){\n+ TBCCTL2 |= CCIE;\n+}\n+\n+void sctimer_disable(void){\n+ TBCCTL2 &= ~CCIE;\n+}\n+\n+// ========================== private =========================================\n+\n+\n+//=========================== interrupt handlers ==============================\n+\n+/**\n+\\brief TimerB CCR1-6 interrupt service routine\n+*/\n+kick_scheduler_t sctimer_isr() {\n+ PORT_TIMER_WIDTH tbiv_local;\n+\n+ // reading TBIV returns the value of the highest pending interrupt flag\n+ // and automatically resets that flag. We therefore copy its value to the\n+ // tbiv_local local variable exactly once. If there is more than one\n+ // interrupt pending, we will reenter this function after having just left\n+ // it.\n+\n+ tbiv_local = TBIV;\n+\n+ switch (tbiv_local) {\n+ case 0x0002: // CCR1 fires\n+ if (TBCCTL1 & CCI) {\n+ // SFD pin is high: this was the start of a frame\n+ if (sctimer_vars.startFrameCb!=NULL) {\n+ sctimer_vars.startFrameCb(TBCCR1);\n+ sctimer_vars.f_SFDreceived = 1;\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ } else {\n+ // SFD pin is low: this was the end of a frame\n+ if (sctimer_vars.endFrameCb!=NULL) {\n+ if (sctimer_vars.f_SFDreceived == 1) {\n+ sctimer_vars.endFrameCb(TBCCR1);\n+ sctimer_vars.f_SFDreceived = 0;\n+ }\n+ TBCCTL1 &= ~COV;\n+ TBCCTL1 &= ~CCIFG;\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ }\n+ break;\n+ case 0x0004: // CCR2 fires\n+ if (sctimer_vars.cb!=NULL) {\n+ sctimer_vars.cb();\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ break;\n+ case 0x0006: // CCR3 fires\n+ break;\n+ case 0x0008: // CCR4 fires\n+ break;\n+ case 0x000a: // CCR5 fires\n+ break;\n+ case 0x000c: // CCR6 fires\n+ break;\n+ case 0x000e: // timer overflow\n+ break;\n+ }\n+ return DO_NOT_KICK_SCHEDULER;\n+}\n" }, { "change_type": "MODIFY", "old_path": "bsp/chips/cc2420/radio.c", "new_path": "bsp/chips/cc2420/radio.c", "diff": "#include \"spi.h\"\n#include \"debugpins.h\"\n#include \"leds.h\"\n+#include \"sctimer.h\"\n//=========================== defines =========================================\n@@ -39,24 +40,14 @@ void radio_init(void) {\n// change state\nradio_vars.state = RADIOSTATE_RFOFF;\n- // start radiotimer with dummy setting to activate SFD pin interrupt\n- radiotimer_start(0xffff);\n}\n-void radio_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_setOverflowCb(cb);\n+void radio_setStartFrameCb(radio_capture_cbt cb) {\n+ sctimer_setStartFrameCb(cb);\n}\n-void radio_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_setCompareCb(cb);\n-}\n-\n-void radio_setStartFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_setStartFrameCb(cb);\n-}\n-\n-void radio_setEndFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_setEndFrameCb(cb);\n+void radio_setEndFrameCb(radio_capture_cbt cb) {\n+ sctimer_setEndFrameCb(cb);\n}\n//===== reset\n@@ -128,24 +119,6 @@ void radio_reset(void) {\n);\n}\n-//===== timer\n-\n-void radio_startTimer(uint16_t period) {\n- radiotimer_start(period);\n-}\n-\n-uint16_t radio_getTimerValue(void) {\n- return radiotimer_getValue();\n-}\n-\n-void radio_setTimerPeriod(uint16_t period) {\n- radiotimer_setPeriod(period);\n-}\n-\n-uint16_t radio_getTimerPeriod(void) {\n- return radiotimer_getPeriod();\n-}\n-\n//===== RF admin\nvoid radio_setFrequency(uint8_t frequency) {\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. telosb sctimer port.
491,595
11.05.2017 11:13:34
-7,200
1998d98732e222e37db4c3870ca2b6f0ef16e137
update openmote-cc2538 sctimer interface.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/board_info.h", "new_path": "bsp/boards/openmote-cc2538/board_info.h", "diff": "#define NUMSENSORS 7\n-//===== sctimer scheduling\n-// If the timer compared value is to set to TIMERTHRESHOLD ticks (or less) later than\n-// current timer count, the compared interrupt will be missed.\n-// The value for C2538 is 5 as datasheet indicate, in case the interrupt routine takes\n-// long (should avoid this case), set it larger than 5\n-#define TIMERTHRESHOLD 10\n-\n//=========================== typedef ========================================\n//=========================== variables =======================================\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/sctimer.c", "new_path": "bsp/boards/openmote-cc2538/sctimer.c", "diff": "@@ -25,6 +25,8 @@ sctimer_vars_t sctimer_vars;\n// ========================== private =========================================\n+void sctimer_isr_internal(void);\n+\n// ========================== protocol =========================================\n/**\n@@ -32,7 +34,7 @@ sctimer_vars_t sctimer_vars;\n*/\nvoid sctimer_init(void){\nmemset(&sctimer_vars, 0, sizeof(sctimer_vars_t));\n- IntRegister(INT_SMTIM, sctimer_isr);\n+ IntRegister(INT_SMTIM, sctimer_isr_internal);\nIntDisable(INT_SMTIM);\n}\n@@ -79,15 +81,12 @@ void sctimer_disable(void){\n// ========================== private =========================================\n-kick_scheduler_t sctimer_isr(void){\n+void sctimer_isr_internal(void){\ndebugpins_isr_set();\nif (sctimer_vars.sctimer_cb!=NULL) {\nIntPendClear(INT_SMTIM);\nsctimer_vars.sctimer_cb();\ndebugpins_isr_clr();\n- // kick the OS\n- return KICK_SCHEDULER;\n}\ndebugpins_isr_clr();\n- return DO_NOT_KICK_SCHEDULER;\n}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. update openmote-cc2538 sctimer interface.
491,595
11.05.2017 11:14:19
-7,200
6e67812600b9da04694a2efc05137d3e49a626c8
move TIMERTHRESHOLD to opentimers.h
[ { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.h", "new_path": "drivers/common/opentimers.h", "diff": "//=========================== define ==========================================\n+\n+//===== sctimer scheduling\n+// the timer with higher priority can be scheduled in advance even if\n+// there is a timer being scheduled early than the higher priority timer\n+// but within TIMERTHRESHOLD.\n+// E.g if priority of timer0 > priority of timer1: if timer0 schedules timer at\n+// 100 and timer 1 schedules timer at 95 and current timer count is 80,\n+// then timer0 will be scheduled first than timer1.\n+#define TIMERTHRESHOLD 10\n+\n/// Maximum number of timers that can run concurrently\n#define MAX_NUM_TIMERS 10\n#define MAX_TICKS_NUMBER ((PORT_TIMER_WIDTH)0xFFFFFFFF)\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. move TIMERTHRESHOLD to opentimers.h
491,595
11.05.2017 11:15:49
-7,200
aab22436ac0db20ce6f136ec59dd668860632c27
update iar projects
[ { "change_type": "MODIFY", "old_path": "projects/openmote-cc2538/OpenMote-CC2538.eww", "new_path": "projects/openmote-cc2538/OpenMote-CC2538.eww", "diff": "<project>\n<path>$WS_DIR$\\01bsp_sctimer\\01bsp_sctimer.ewp</path>\n</project>\n+ <project>\n+ <path>$WS_DIR$\\01bsp_uart\\01bsp_uart.ewp</path>\n+ </project>\n<project>\n<path>$WS_DIR$\\02drv_opentimers2\\02drv_opentimers2.ewp</path>\n</project>\n" }, { "change_type": "MODIFY", "old_path": "projects/telosb/03oos_openwsn/03oos_openwsn.ewp", "new_path": "projects/telosb/03oos_openwsn/03oos_openwsn.ewp", "diff": "</option>\n<option>\n<name>XList</name>\n- <state>0</state>\n+ <state>1</state>\n</option>\n<option>\n<name>SegmentMap</name>\n</option>\n<option>\n<name>ExtraOutputFile</name>\n- <state>03oos_openwsn.a43</state>\n+ <state>03oos_openwsn.s19</state>\n</option>\n<option>\n<name>ExtraOutputFormat</name>\n<version>11</version>\n- <state>23</state>\n+ <state>37</state>\n</option>\n<option>\n<name>ExtraFormatVariant</name>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\board_info.h</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\bsp_timer.c</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\debugpins.c</name>\n</file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\leds.c</name>\n</file>\n<file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\radiotimer.c</name>\n+ <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\sctimer.c</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\telosb\\sensors.c</name>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\board.h</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\bsp_timer.h</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\crypto_engine.h</name>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\radio.h</name>\n</file>\n- <file>\n- <name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\radiotimer.h</name>\n- </file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\bsp\\boards\\sctimer.h</name>\n</file>\n<name>02a-MAClow</name>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\adaptive_sync.c</name>\n+ <excluded>\n+ <configuration>Debug</configuration>\n+ </excluded>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\adaptive_sync.h</name>\n+ <excluded>\n+ <configuration>Debug</configuration>\n+ </excluded>\n</file>\n<file>\n<name>$PROJ_DIR$\\..\\..\\..\\openstack\\02a-MAClow\\IEEE802154.c</name>\n" }, { "change_type": "MODIFY", "old_path": "projects/telosb/telosb.eww", "new_path": "projects/telosb/telosb.eww", "diff": "<project>\n<path>$WS_DIR$\\00std_eui64\\00std_eui64.ewp</path>\n</project>\n- <project>\n- <path>$WS_DIR$\\00std_eui64_uart\\00std_eui64_uart.ewp</path>\n- </project>\n<project>\n<path>$WS_DIR$\\00std_i2c\\00std_i2c.ewp</path>\n</project>\n<project>\n<path>$WS_DIR$\\02drv_opentimers\\02drv_opentimers.ewp</path>\n</project>\n+ <project>\n+ <path>$WS_DIR$\\02drv_opentimers2\\02drv_opentimers2.ewp</path>\n+ </project>\n<project>\n<path>$WS_DIR$\\03oos_macpong\\03oos_macpong.ewp</path>\n</project>\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. update iar projects
491,595
11.05.2017 13:29:32
-7,200
b3341638f81e50be4f582e5ff13112fbfcaa5020
fix warning of openmotestm compilation.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/board.c", "new_path": "bsp/boards/openmotestm/board.c", "diff": "//Configures the different GPIO ports as Analog Inputs.\nvoid GPIO_Config_ALL_AIN(void);\n// configure the hard fault exception\n-void board_enableHardFaultExceptionHandler();\n+void board_enableHardFaultExceptionHandler(void);\n//=========================== main ============================================\n-extern int mote_main();\n+extern int mote_main(void);\n-int main() {\n+int main(void) {\nreturn mote_main();\n}\n//=========================== public ==========================================\n-void board_init(){\n+void board_init(void){\n//Configure rcc\nRCC_Configuration();\n@@ -97,7 +97,7 @@ void board_init(){\nNVIC_radio();\n}\n-void board_sleep() {\n+void board_sleep(void) {\nDBGMCU_Config(DBGMCU_SLEEP, ENABLE);\n// Enable PWR and BKP clock\nRCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);\n@@ -109,7 +109,7 @@ void board_sleep() {\n-void board_reset(){\n+void board_reset(void){\nNVIC_GenerateSystemReset();\n}\n@@ -146,7 +146,7 @@ void GPIO_Config_ALL_AIN(void){\nGPIO_Init(GPIOD, &GPIO_InitStructure);\n}\n-void board_enableHardFaultExceptionHandler(){\n+void board_enableHardFaultExceptionHandler(void){\n// Configures:\n// bit9. stack alignment on exception entry\n// bit4. enables faulting\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/board_info.h", "new_path": "bsp/boards/openmotestm/board_info.h", "diff": "@@ -70,10 +70,6 @@ to return the board's description.\n#define SYNC_ACCURACY 2 // ticks\n-//===== opentimers\n-\n-#define TIMERTHRESHOLD 10 // ticks\n-\n//=========================== typedef ========================================\n//=========================== variables =======================================\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/flash.c", "new_path": "bsp/boards/openmotestm/flash.c", "diff": "//=========================== public ==========================================\n-void flash_init() {\n+void flash_init(void) {\nFLASH_Unlock();\nFLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP|FLASH_FLAG_PGERR |FLASH_FLAG_WRPRTERR);\n}\n@@ -27,7 +27,7 @@ uint8_t flash_erasePage(uint32_t address) {\nreturn status;\n}\n-uint8_t flash_erase_optByte() {\n+uint8_t flash_erase_optByte(void) {\nuint8_t status;\nstatus = FLASH_EraseOptionBytes();\nreturn status;\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/flash.h", "new_path": "bsp/boards/openmotestm/flash.h", "diff": "//=========================== public ==========================================\n#include \"stdint.h\"\n-void flash_init();\n+void flash_init(void);\nuint8_t flash_erasePage(uint32_t address);\n-uint8_t flash_erase_optByte();\n+uint8_t flash_erase_optByte(void);\nuint8_t flash_write(uint32_t address,uint16_t data);\nuint8_t flash_write_optByte(uint32_t address,uint8_t data);\nuint16_t flash_read(uint32_t address);\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/i2c.c", "new_path": "bsp/boards/openmotestm/i2c.c", "diff": "//=========================== prototypes ======================================\n-void i2c_start();\n-void i2c_stop();\n+void i2c_start(void);\n+void i2c_stop(void);\nvoid i2c_transmit(uint8_t byte);\nvoid i2c_address_direction(uint8_t address, uint8_t direction);\n-uint8_t i2c_receive_ack();\n-uint8_t i2c_receive_nack();\n+uint8_t i2c_receive_ack(void);\n+uint8_t i2c_receive_nack(void);\n//=========================== public ==========================================\n@@ -126,7 +126,7 @@ void isr_i2c_rx(uint8_t bus_num){\n//=========================== private =========================================\n-void i2c_start(){\n+void i2c_start(void){\n// Generate start condition\nI2C_GenerateSTART(I2Cx, ENABLE);\n// Wait for I2C EV5.\n@@ -135,7 +135,7 @@ void i2c_start(){\nwhile (!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_MODE_SELECT));\n}\n-void i2c_stop(){\n+void i2c_stop(void){\n// Generate I2C stop condition\nI2C_GenerateSTOP(I2Cx, ENABLE);\n// Wait until I2C stop condition is finished\n@@ -165,7 +165,7 @@ void i2c_transmit(uint8_t byte){\nwhile (!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_BYTE_TRANSMITTED));\n}\n-uint8_t i2c_receive_ack(){\n+uint8_t i2c_receive_ack(void){\n// Enable ACK of received data\nI2C_AcknowledgeConfig(I2Cx, ENABLE);\n// Wait for I2C EV7\n@@ -175,7 +175,7 @@ uint8_t i2c_receive_ack(){\nreturn I2C_ReceiveData(I2Cx);\n}\n-uint8_t i2c_receive_nack(){\n+uint8_t i2c_receive_nack(void){\n// Disable ACK of received data\nI2C_AcknowledgeConfig(I2Cx, DISABLE);\n// Wait for I2C EV7\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/openmotestm/sctimer.c", "new_path": "bsp/boards/openmotestm/sctimer.c", "diff": "@@ -20,6 +20,7 @@ On Iot_Lab_M3, we use RTC for the sctimer module.\n#define TIMERLOOP_THRESHOLD 0xffffff // 511 seconds @ 32768Hz clock\n#define OVERFLOW_THRESHOLD 0x7fffffff // as openmotestm32 uses 16kHz, the upper timer overflows when timer research to 0x7fffffff\n+#define MINIMUM_COMPAREVALE_ADVANCE 10\n// ========================== variable ========================================\n@@ -162,8 +163,7 @@ void sctimer_setCompare(PORT_TIMER_WIDTH val) {\n// the timer is already late, schedule the ISR right now manually\nEXTI->SWIER |= EXTI_Line17;\n} else {\n- if (val-RTC_GetCounter()<TIMERTHRESHOLD){\n- // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ if (val-RTC_GetCounter()<MINIMUM_COMPAREVALE_ADVANCE){\n// schedule ISR right now manually\nEXTI->SWIER |= EXTI_Line17;\n} else {\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. fix warning of openmotestm compilation.
491,595
11.05.2017 13:38:41
-7,200
da9cba72428878b3963a0439ae2f03a2255a9658
update openmotecc2538 sctimer.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/openmote-cc2538/sctimer.c", "new_path": "bsp/boards/openmote-cc2538/sctimer.c", "diff": "// ========================== define ==========================================\n#define TIMERLOOP_THRESHOLD 0xffffff // 511 seconds @ 32768Hz clock\n+#define MINIMUM_COMPAREVALE_ADVANCE 10\n// ========================== variable ========================================\n@@ -51,7 +52,7 @@ void sctimer_setCompare(uint32_t val){\n// the timer is already late, schedule the ISR right now manually\nIntPendSet(INT_SMTIM);\n} else {\n- if (val-SleepModeTimerCountGet()<TIMERTHRESHOLD){\n+ if (val-SleepModeTimerCountGet()<MINIMUM_COMPAREVALE_ADVANCE){\n// there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n// schedule ISR right now manually\nIntPendSet(INT_SMTIM);\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. update openmotecc2538 sctimer.
491,595
11.05.2017 15:54:10
-7,200
c09a5f904963453a8a70256f3504c0955bf1a42d
gina port for sctimer.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/gina/SConscript", "new_path": "bsp/boards/gina/SConscript", "diff": "@@ -18,11 +18,10 @@ rf231 = localEnv.SConscript(\nsource = [\n'board.c',\n- 'bsp_timer.c',\n'debugpins.c',\n+ 'sctimer.c',\n'eui64.c',\n'leds.c',\n- 'radiotimer.c',\n'spi.c',\n'uart.c',\n'i2c.c',\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/gina/board.c", "new_path": "bsp/boards/gina/board.c", "diff": "#include \"uart.h\"\n#include \"spi.h\"\n#include \"i2c.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n#include \"eui64.h\"\n// sensors\n@@ -76,9 +75,8 @@ void board_init() {\nuart_init();\nspi_init();\ni2c_init();\n- bsp_timer_init();\nradio_init();\n- radiotimer_init();\n+ sctimer_init();\n//ADC_init();\n// enable interrupts\n@@ -218,11 +216,7 @@ ISR(USCIAB0RX) {\nISR(TIMERA1) {\nCAPTURE_TIME();\ndebugpins_isr_set();\n-\n- if (radiotimer_isr()==KICK_SCHEDULER) { // radiotimer\n- __bic_SR_register_on_exit(CPUOFF);\n- }\n- debugpins_isr_clr();\n+ while(1); // should never happen\n}\nISR(TIMERA0) {\n@@ -245,18 +239,17 @@ ISR(COMPARATORA) {\n}\nISR(TIMERB1) {\n- CAPTURE_TIME();\ndebugpins_isr_set();\n- while(1); // should never happen\n+ if (sctimer_isr()==KICK_SCHEDULER) { // sctimer\n+ __bic_SR_register_on_exit(CPUOFF);\n+ }\n+ debugpins_isr_clr();\n}\nISR(TIMERB0) {\nCAPTURE_TIME();\ndebugpins_isr_set();\n- if (bsp_timer_isr()==KICK_SCHEDULER) { // timer: 0\n- __bic_SR_register_on_exit(CPUOFF);\n- }\n- debugpins_isr_clr();\n+ while(1); // should never happen\n}\nISR(NMI) {\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/gina/bsp_timer.c", "new_path": null, "diff": "-/**\n-\\brief GINA-specific definition of the \"bsp_timer\" bsp module.\n-\n-On GINA, we use timerB0 for the bsp_timer module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, March 2012.\n-*/\n-\n-#include \"msp430x26x.h\"\n-#include \"string.h\"\n-#include \"bsp_timer.h\"\n-#include \"board.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- bsp_timer_cbt cb;\n- PORT_TIMER_WIDTH last_compare_value;\n-} bsp_timer_vars_t;\n-\n-bsp_timer_vars_t bsp_timer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-/**\n-\\brief Initialize this module.\n-\n-This functions starts the timer, i.e. the counter increments, but doesn't set\n-any compare registers, so no interrupt will fire.\n-*/\n-void bsp_timer_init() {\n-\n- // clear local variables\n- memset(&bsp_timer_vars,0,sizeof(bsp_timer_vars_t));\n-\n- // source ACLK from 32kHz crystal\n- BCSCTL3 |= LFXT1S_0;\n-\n- //set CCRB0 registers\n- TBCCTL0 = 0;\n- TBCCR0 = 0;\n-\n- //start TimerB\n- TBCTL = MC_2+TBSSEL_1; // continuous mode, from ACLK\n-}\n-\n-/**\n-\\brief Register a callback.\n-\n-\\param cb The function to be called when a compare event happens.\n-*/\n-void bsp_timer_set_callback(bsp_timer_cbt cb) {\n- bsp_timer_vars.cb = cb;\n-}\n-\n-/**\n-\\brief Reset the timer.\n-\n-This function does not stop the timer, it rather resets the value of the\n-counter, and cancels a possible pending compare event.\n-*/\n-void bsp_timer_reset() {\n- // reset compare\n- TBCCR0 = 0;\n- TBCCTL0 = 0;\n- // reset timer\n- TBR = 0;\n- // record last timer compare value\n- bsp_timer_vars.last_compare_value = 0;\n-}\n-\n-/**\n-\\brief Schedule the callback to be called in some specified time.\n-\n-The delay is expressed relative to the last compare event. It doesn't matter\n-how long it took to call this function after the last compare, the timer will\n-expire precisely delayTicks after the last one.\n-\n-The only possible problem is that it took so long to call this function that\n-the delay specified is shorter than the time already elapsed since the last\n-compare. In that case, this function triggers the interrupt to fire right away.\n-\n-This means that the interrupt may fire a bit off, but this inaccuracy does not\n-propagate to subsequent timers.\n-\n-\\param delayTicks Number of ticks before the timer expired, relative to the\n- last compare event.\n-*/\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks) {\n- PORT_TIMER_WIDTH newCompareValue;\n- PORT_TIMER_WIDTH temp_last_compare_value;\n-\n- temp_last_compare_value = bsp_timer_vars.last_compare_value;\n-\n- newCompareValue = bsp_timer_vars.last_compare_value+delayTicks+1;\n- bsp_timer_vars.last_compare_value = newCompareValue;\n-\n- if (delayTicks<TBR-temp_last_compare_value) {\n- // we're already too late, schedule the ISR right now manually\n-\n- // setting the interrupt flag triggers an interrupt\n- TBCCTL0 |= CCIFG;\n- } else {\n- // this is the normal case, have timer expire at newCompareValue\n- TBCCR0 = newCompareValue;\n- TBCCTL0 |= CCIE;\n- }\n-}\n-\n-/**\n-\\brief Cancel a running compare.\n-*/\n-void bsp_timer_cancel_schedule() {\n- TBCCR0 = 0;\n- TBCCTL0 &= ~CCIE;\n-}\n-\n-/**\n-\\brief Return the current value of the timer's counter.\n-\n-\\returns The current value of the timer's counter.\n-*/\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue() {\n- return TBR;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t bsp_timer_isr() {\n- // call the callback\n- bsp_timer_vars.cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n-}\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/gina/radiotimer.c", "new_path": null, "diff": "-/**\n-\\brief GINA-specific definition of the \"radiotimer\" bsp module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012.\n-*/\n-\n-#include \"msp430x26x.h\"\n-#include \"stdio.h\"\n-#include \"string.h\"\n-#include \"radiotimer.h\"\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- radiotimer_compare_cbt overflow_cb;\n- radiotimer_compare_cbt compare_cb;\n-} radiotimer_vars_t;\n-\n-radiotimer_vars_t radiotimer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init() {\n- // clear local variables\n- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t));\n-}\n-\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.overflow_cb = cb;\n-}\n-\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.compare_cb = cb;\n-}\n-\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) {\n- while(1);\n-}\n-\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period) {\n- // source ACLK from 32kHz crystal\n- BCSCTL3 |= LFXT1S_0;\n-\n- // CCR0 contains max value of counter (slot length)\n- // do not interrupt when counter reaches TACCR0!\n- TACCR0 = period;\n-\n- // CCR1 in compare mode (disabled for now)\n- TACCTL1 = 0;\n- TACCR1 = 0;\n-\n- // CCR2 in capture mode\n- TACCTL2 = CAP+SCS+CCIS1+CM_1;\n- TACCR2 = 0;\n-\n- // reset couter\n- TAR = 0;\n-\n- // start counting\n- TACTL = TAIE; // interrupt when counter resets\n- TACTL |= MC_1+TBSSEL_1; // up mode, clocked from ACLK\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue() {\n- return TAR;\n-}\n-\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) {\n- TACCR0 = period;\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod() {\n- return TACCR0;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) {\n- // offset when to fire\n- TACCR1 = offset;\n-\n- // enable CCR1 interrupt (this also cancels any pending interrupts)\n- TACCTL1 = CCIE;\n-}\n-\n-void radiotimer_cancel() {\n- // reset CCR1 value (also resets interrupt flag)\n- TACCR1 = 0;\n-\n- // disable CCR1 interrupt\n- TACCTL1 &= ~CCIE;\n-}\n-\n-//===== capture\n-\n-inline PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime() {\n- return TAR;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t radiotimer_isr() {\n- PORT_RADIOTIMER_WIDTH taiv_temp = TAIV; // read only once because accessing TAIV resets it\n- switch (taiv_temp) {\n- case 0x0002: // capture/compare CCR1\n- if (radiotimer_vars.compare_cb!=NULL) {\n- // call the callback\n- radiotimer_vars.compare_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case 0x000a: // timer overflows\n- if (radiotimer_vars.overflow_cb!=NULL) {\n- // call the callback\n- radiotimer_vars.overflow_cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case 0x0004: // capture/compare CCR2\n- default:\n- while(1); // this should not happen\n- }\n- return DO_NOT_KICK_SCHEDULER;\n-}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. gina port for sctimer.
491,595
11.05.2017 15:55:24
-7,200
c0b96a17746752a702b2956e942c75794517832c
port wsn430v13b for sctimer.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/wsn430v13b/SConscript", "new_path": "bsp/boards/wsn430v13b/SConscript", "diff": "@@ -18,11 +18,10 @@ cc1101 = localEnv.SConscript(\nsource = [\n'board.c',\n- 'bsp_timer.c',\n+ 'sctimer.c',\n'debugpins.c',\n'eui64.c',\n'leds.c',\n- 'radiotimer.c',\n'spi.c',\n'uart.c',\n]\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/wsn430v13b/board.c", "new_path": "bsp/boards/wsn430v13b/board.c", "diff": "#include \"leds.h\"\n#include \"uart.h\"\n#include \"spi.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n//=========================== variables =======================================\n@@ -47,9 +46,8 @@ void board_init() {\nleds_init();\nuart_init();\nspi_init();\n- bsp_timer_init();\nradio_init();\n- radiotimer_init();\n+ sctimer_init();\n// enable interrupts\n__bis_SR_register(GIE);\n@@ -63,6 +61,19 @@ void board_reset() {\nWDTCTL = (WDTPW+0x1200) + WDTHOLD; // writing a wrong watchdog password to causes handler to reset\n}\n+// during startup process before executing main function,\n+// all variables need to be initialized, which may take long time\n+// and watchdog may be triggered during this period.\n+// Using __low_level_init to disable the watchdog to avoid this situation.\n+int __low_level_init(void)\n+{\n+ // stop WDT\n+ WDTCTL = WDTPW + WDTHOLD;\n+\n+ // Perform data segment initialization\n+ return 1;\n+}\n+\n//=========================== private =========================================\n//=========================== interrupt handlers ==============================\n@@ -91,14 +102,6 @@ ISR(USART1RX) {\n// TIMERA1_VECTOR\n-ISR(TIMERA0) {\n- debugpins_isr_set();\n- if (bsp_timer_isr()==KICK_SCHEDULER) { // timer: 0\n- __bic_SR_register_on_exit(CPUOFF);\n- }\n- debugpins_isr_clr();\n-}\n-\n// ADC12_VECTOR\n// USART0TX_VECTOR\n@@ -121,7 +124,7 @@ ISR(COMPARATORA) {\nISR(TIMERB1) {\ndebugpins_isr_set();\n- if (radiotimer_isr()==KICK_SCHEDULER) { // radiotimer\n+ if (sctimer_isr()==KICK_SCHEDULER) { // sctimer\n__bic_SR_register_on_exit(CPUOFF);\n}\ndebugpins_isr_clr();\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/wsn430v13b/bsp_timer.c", "new_path": null, "diff": "-/**\n-\\brief WSN430v13b-specific definition of the \"bsp_timer\" bsp module.\n-\n-On WSN430v13b, we use timerA0 for the bsp_timer module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, March 2012.\n-*/\n-\n-#include \"msp430f1611.h\"\n-#include \"bsp_timer.h\"\n-#include \"board.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- bsp_timer_cbt cb;\n- PORT_TIMER_WIDTH last_compare_value;\n-} bsp_timer_vars_t;\n-\n-bsp_timer_vars_t bsp_timer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-/**\n-\\brief Initialize this module.\n-\n-This functions starts the timer, i.e. the counter increments, but doesn't set\n-any compare registers, so no interrupt will fire.\n-*/\n-void bsp_timer_init() {\n-\n- // clear local variables\n- memset(&bsp_timer_vars,0,sizeof(bsp_timer_vars_t));\n-\n- // set CCRA0 registers\n- TACCR0 = 0;\n- TACCTL0 = 0;\n-\n- //start TimerA\n- TACTL = MC_2+TASSEL_1; // continuous mode, from ACLK\n-}\n-\n-/**\n-\\brief Register a callback.\n-\n-\\param cb The function to be called when a compare event happens.\n-*/\n-void bsp_timer_set_callback(bsp_timer_cbt cb) {\n- bsp_timer_vars.cb = cb;\n-}\n-\n-/**\n-\\brief Reset the timer.\n-\n-This function does not stop the timer, it rather resets the value of the\n-counter, and cancels a possible pending compare event.\n-*/\n-void bsp_timer_reset() {\n- // reset compare\n- TACCR0 = 0;\n- TACCTL0 = 0;\n- // reset timer\n- TAR = 0;\n- // record last timer compare value\n- bsp_timer_vars.last_compare_value = 0;\n-}\n-\n-/**\n-\\brief Schedule the callback to be called in some specified time.\n-\n-The delay is expressed relative to the last compare event. It doesn't matter\n-how long it took to call this function after the last compare, the timer will\n-expire precisely delayTicks after the last one.\n-\n-The only possible problem is that it took so long to call this function that\n-the delay specified is shorter than the time already elapsed since the last\n-compare. In that case, this function triggers the interrupt to fire right away.\n-\n-This means that the interrupt may fire a bit off, but this inaccuracy does not\n-propagate to subsequent timers.\n-\n-\\param delayTicks Number of ticks before the timer expired, relative to the\n- last compare event.\n-*/\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks) {\n- PORT_TIMER_WIDTH newCompareValue;\n- PORT_TIMER_WIDTH temp_last_compare_value;\n-\n- temp_last_compare_value = bsp_timer_vars.last_compare_value;\n-\n- newCompareValue = bsp_timer_vars.last_compare_value+delayTicks;\n- bsp_timer_vars.last_compare_value = newCompareValue;\n-\n- if (delayTicks<TAR-temp_last_compare_value) {\n- // we're already too late, schedule the ISR right now, manually\n-\n- // setting the interrupt flag triggers an interrupt\n- TACCTL0 |= CCIFG;\n- } else {\n- // this is the normal case, have timer expire at newCompareValue\n- TACCR0 = newCompareValue;\n- TACCTL0 |= CCIE;\n- }\n-}\n-\n-/**\n-\\brief Cancel a running compare.\n-*/\n-void bsp_timer_cancel_schedule() {\n- TACCR0 = 0;\n- TACCTL0 &= ~CCIE;\n-}\n-\n-/**\n-\\brief Return the current value of the timer's counter.\n-\n-\\returns The current value of the timer's counter.\n-*/\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue() {\n- return TBR;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrup handlers ===============================\n-\n-kick_scheduler_t bsp_timer_isr() {\n- // call the callback\n- bsp_timer_vars.cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n-}\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/wsn430v13b/radiotimer.c", "new_path": null, "diff": "-/**\n-\\brief WSN430v13b-specific definition of the \"radiotimer\" bsp module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012.\n-*/\n-\n-#include \"msp430f1611.h\"\n-#include \"radiotimer.h\"\n-#include \"leds.h\"\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- radiotimer_compare_cbt overflowCb;\n- radiotimer_compare_cbt compareCb;\n- radiotimer_capture_cbt startFrameCb;\n- radiotimer_capture_cbt endFrameCb;\n-} radiotimer_vars_t;\n-\n-radiotimer_vars_t radiotimer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init() {\n- // clear local variables\n- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t));\n-}\n-\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.overflowCb = cb;\n-}\n-\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.compareCb = cb;\n-}\n-\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_vars.startFrameCb = cb;\n-}\n-\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_vars.endFrameCb = cb;\n-}\n-\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period) {\n- // radio's SFD pin connected to P4.1\n- P4DIR &= ~0x02; // input\n- P4SEL |= 0x02; // in CCI1a/B mode\n-\n- // CCR0 contains period of counter\n- // do not interrupt when counter reaches TBCCR0, but when it resets\n- TBCCR0 = period-1;\n-\n- // CCR1 in capture mode\n- TBCCTL1 = CM_3+SCS+CAP+CCIE;\n- TBCCR1 = 0;\n-\n- // CCR2 in compare mode (disabled for now)\n- TBCCTL2 = 0;\n- TBCCR2 = 0;\n-\n- // start counting\n- TBCTL = TBIE+TBCLR; // interrupt when counter resets\n- TBCTL |= MC_1+TBSSEL_1; // up mode, clocked from ACLK\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue() {\n- return TBR;\n-}\n-\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) {\n- TBCCR0 = period;\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod() {\n- return TBCCR0;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) {\n- // offset when to fire\n- TBCCR2 = offset;\n-\n- // enable compare interrupt (this also cancels any pending interrupts)\n- TBCCTL2 = CCIE;\n-}\n-\n-void radiotimer_cancel() {\n- // reset compare value (also resets interrupt flag)\n- TBCCR2 = 0;\n-\n- // disable compare interrupt\n- TBCCTL2 &= ~CCIE;\n-}\n-\n-//===== capture\n-\n-inline PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime() {\n- // this should never happpen!\n-\n- // we can not print from within the BSP. Instead:\n- // blink the error LED\n- leds_error_blink();\n- // reset the board\n- board_reset();\n-\n- return 0;// this line is never reached, but here to satisfy compiler\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-/**\n-\\brief TimerB CCR1-6 interrupt service routine\n-*/\n-kick_scheduler_t radiotimer_isr() {\n- PORT_RADIOTIMER_WIDTH tbiv_local;\n-\n- // reading TBIV returns the value of the highest pending interrupt flag\n- // and automatically resets that flag. We therefore copy its value to the\n- // tbiv_local local variable exactly once. If there is more than one\n- // interrupt pending, we will reenter this function after having just left\n- // it.\n- tbiv_local = TBIV;\n-\n- switch (tbiv_local) {\n- case 0x0002: // CCR1 fires\n- if (TBCCTL1 & CCI) {\n- // SFD pin is high: this was the start of a frame\n- if (radiotimer_vars.startFrameCb!=NULL) {\n- radiotimer_vars.startFrameCb(TBCCR1);\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- } else {\n- // SFD pin is low: this was the end of a frame\n- if (radiotimer_vars.endFrameCb!=NULL) {\n- radiotimer_vars.endFrameCb(TBCCR1);\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- }\n- break;\n- case 0x0004: // CCR2 fires\n- if (radiotimer_vars.compareCb!=NULL) {\n- radiotimer_vars.compareCb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case 0x0006: // CCR3 fires\n- break;\n- case 0x0008: // CCR4 fires\n- break;\n- case 0x000a: // CCR5 fires\n- break;\n- case 0x000c: // CCR6 fires\n- break;\n- case 0x000e: // timer overflow\n- if (radiotimer_vars.overflowCb!=NULL) {\n- radiotimer_vars.overflowCb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- }\n- return DO_NOT_KICK_SCHEDULER;\n-}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/wsn430v13b/sctimer.c", "diff": "+/**\n+\\brief A timer module with only a single compare value.\n+\n+\\author: Tengfei Chang <tengfei.chang@inria.fr> April 2017\n+*/\n+\n+#include \"sctimer.h\"\n+#include \"msp430f1611.h\"\n+#include \"sctimer.h\"\n+#include \"board.h\"\n+#include \"leds.h\"\n+\n+// ========================== define ==========================================\n+\n+#define TIMERLOOP_THRESHOLD 0x4000 // 0.5 seconds @ 32768Hz clock\n+#define MINIMUM_COMPAREVALE_ADVANCE 3\n+\n+// ========================== variable ========================================\n+\n+typedef struct {\n+ sctimer_cbt cb;\n+ sctimer_capture_cbt startFrameCb;\n+ sctimer_capture_cbt endFrameCb;\n+ uint8_t f_SFDreceived;\n+} sctimer_vars_t;\n+\n+sctimer_vars_t sctimer_vars;\n+\n+// ========================== private ==========================================\n+\n+// ========================== protocol =========================================\n+\n+/**\n+\\brief Initialization sctimer.\n+*/\n+void sctimer_init(void){\n+ memset(&sctimer_vars, 0, sizeof(sctimer_vars_t));\n+\n+ // radio's SFD pin connected to P4.1\n+ P4DIR &= ~0x02; // input\n+ P4SEL |= 0x02; // in CCI1a/B mode\n+\n+ // CCR1 in capture mode\n+ TBCCTL1 = CM_3+SCS+CAP+CCIE;\n+ TBCCR1 = 0;\n+\n+ // CCR2 in compare mode (disabled for now)\n+ TBCCTL2 = 0;\n+ TBCCR2 = 0;\n+\n+ // start counting\n+ TBCTL = MC_2+TBSSEL_1; // continue mode, clocked from ACLK\n+}\n+\n+void sctimer_set_callback(sctimer_cbt cb){\n+ sctimer_vars.cb = cb;\n+}\n+\n+void sctimer_setStartFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.startFrameCb = cb;\n+}\n+\n+void sctimer_setEndFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.endFrameCb = cb;\n+}\n+\n+/**\n+\\brief set compare interrupt\n+*/\n+void sctimer_setCompare(PORT_TIMER_WIDTH val){\n+ TBCCTL2 = CCIE;\n+ if (TBR - val < TIMERLOOP_THRESHOLD){\n+ // the timer is already late, schedule the ISR right now manually\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ if (val-TBR<MINIMUM_COMPAREVALE_ADVANCE){\n+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ // schedule the timer at val\n+ TBCCR2 = val;\n+ }\n+ }\n+}\n+\n+/**\n+\\brief Return the current value of the timer's counter.\n+\n+ \\returns The current value of the timer's counter.\n+*/\n+PORT_TIMER_WIDTH sctimer_readCounter(void){\n+ return TBR;\n+}\n+\n+void sctimer_enable(void){\n+ TBCCTL2 |= CCIE;\n+}\n+\n+void sctimer_disable(void){\n+ TBCCTL2 &= ~CCIE;\n+}\n+\n+// ========================== private =========================================\n+\n+\n+//=========================== interrupt handlers ==============================\n+\n+/**\n+\\brief TimerB CCR1-6 interrupt service routine\n+*/\n+kick_scheduler_t sctimer_isr() {\n+ PORT_TIMER_WIDTH tbiv_local;\n+\n+ // reading TBIV returns the value of the highest pending interrupt flag\n+ // and automatically resets that flag. We therefore copy its value to the\n+ // tbiv_local local variable exactly once. If there is more than one\n+ // interrupt pending, we will reenter this function after having just left\n+ // it.\n+\n+ tbiv_local = TBIV;\n+\n+ switch (tbiv_local) {\n+ case 0x0002: // CCR1 fires\n+ if (TBCCTL1 & CCI) {\n+ // SFD pin is high: this was the start of a frame\n+ if (sctimer_vars.startFrameCb!=NULL) {\n+ sctimer_vars.startFrameCb(TBCCR1);\n+ sctimer_vars.f_SFDreceived = 1;\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ } else {\n+ // SFD pin is low: this was the end of a frame\n+ if (sctimer_vars.endFrameCb!=NULL) {\n+ if (sctimer_vars.f_SFDreceived == 1) {\n+ sctimer_vars.endFrameCb(TBCCR1);\n+ sctimer_vars.f_SFDreceived = 0;\n+ }\n+ TBCCTL1 &= ~COV;\n+ TBCCTL1 &= ~CCIFG;\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ }\n+ break;\n+ case 0x0004: // CCR2 fires\n+ if (sctimer_vars.cb!=NULL) {\n+ sctimer_vars.cb();\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ break;\n+ case 0x0006: // CCR3 fires\n+ break;\n+ case 0x0008: // CCR4 fires\n+ break;\n+ case 0x000a: // CCR5 fires\n+ break;\n+ case 0x000c: // CCR6 fires\n+ break;\n+ case 0x000e: // timer overflow\n+ break;\n+ }\n+ return DO_NOT_KICK_SCHEDULER;\n+}\n" }, { "change_type": "MODIFY", "old_path": "bsp/chips/cc1101/radio.c", "new_path": "bsp/chips/cc1101/radio.c", "diff": "#include \"spi.h\"\n#include \"debugpins.h\"\n#include \"leds.h\"\n+#include \"sctimer.h\"\n//=========================== defines =========================================\n@@ -78,30 +79,16 @@ void radio_init() {\n// change state\nradio_vars.state = RADIOSTATE_RFOFF;\n- // start radiotimer with dummy setting to activate SFD pin interrupt\n- radiotimer_start(0xffff);\n-\n-}\n-\n-\n-void radio_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_setOverflowCb(cb);\n-}\n-\n-void radio_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_setCompareCb(cb);\n}\n-void radio_setStartFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_setStartFrameCb(cb);\n+void radio_setStartFrameCb(radio_capture_cbt cb) {\n+ sctimer_setStartFrameCb(cb);\n}\n-void radio_setEndFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_setEndFrameCb(cb);\n+void radio_setEndFrameCb(radio_capture_cbt cb) {\n+ sctimer_setEndFrameCb(cb);\n}\n-\n-\n//==== reset\nvoid radio_reset() {\n@@ -167,29 +154,6 @@ void radio_reset() {\n}\n-\n-//==== timer\n-\n-\n-\n-void radio_startTimer(uint16_t period) {\n- radiotimer_start(period);\n-}\n-\n-uint16_t radio_getTimerValue() {\n- return radiotimer_getValue();\n-}\n-\n-void radio_setTimerPeriod(uint16_t period) {\n- radiotimer_setPeriod(period);\n-}\n-\n-uint16_t radio_getTimerPeriod() {\n- return radiotimer_getPeriod();\n-}\n-\n-\n-\n//==== RF admin\nvoid radio_setFrequency(uint8_t frequency) {\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. port wsn430v13b for sctimer.
491,595
11.05.2017 16:09:33
-7,200
028773f4bff4c533597764e299601ecb476702bf
port of sctimer on wsn430v14.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/wsn430v14/SConscript", "new_path": "bsp/boards/wsn430v14/SConscript", "diff": "@@ -18,11 +18,10 @@ cc2420 = localEnv.SConscript(\nsource = [\n'board.c',\n- 'bsp_timer.c',\n+ 'sctimer.c',\n'debugpins.c',\n'eui64.c',\n'leds.c',\n- 'radiotimer.c',\n'spi.c',\n'uart.c',\n]\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/wsn430v14/board.c", "new_path": "bsp/boards/wsn430v14/board.c", "diff": "#include \"leds.h\"\n#include \"uart.h\"\n#include \"spi.h\"\n-#include \"bsp_timer.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n+#include \"sctimer.h\"\n//=========================== variables =======================================\n//=========================== prototypes ======================================\n-kick_scheduler_t radiotimer_isr_sfd(void);\n+kick_scheduler_t sctimer_isr_sfd(void);\n//=========================== main ============================================\n@@ -72,9 +71,8 @@ void board_init(void) {\nleds_init();\nuart_init();\nspi_init();\n- bsp_timer_init();\nradio_init();\n- radiotimer_init();\n+ sctimer_init();\n//===== enable interrupts\n@@ -117,7 +115,7 @@ ISR(PORT1) {\ndebugpins_isr_set();\nif (P1IFG & 0x20) {\nP1IFG &= ~0x20;\n- if (radiotimer_isr_sfd()==KICK_SCHEDULER){ // radio: SFD pin [P1.6]\n+ if (sctimer_isr_sfd()==KICK_SCHEDULER){ // radio: SFD pin [P1.6]\n__bic_SR_register_on_exit(CPUOFF);\n}\n} else {\n@@ -128,13 +126,7 @@ ISR(PORT1) {\n// TIMERA0_VECTOR\n-ISR(TIMERA1) {\n- debugpins_isr_set();\n- if (radiotimer_isr()==KICK_SCHEDULER) { // radiotimer\n- __bic_SR_register_on_exit(CPUOFF);\n- }\n- debugpins_isr_clr();\n-}\n+// TIMERA1_VECTOR\n// ADC12_VECTOR\n@@ -158,15 +150,15 @@ ISR(COMPARATORA) {\ndebugpins_isr_clr();\n}\n-ISR(TIMERB0) {\n+// TIMERB0_VECTOR\n+\n+ISR(TIMERB1) {\ndebugpins_isr_set();\n- if (bsp_timer_isr()==KICK_SCHEDULER) { // timer: 0\n+ if (sctimer_isr()==KICK_SCHEDULER) { // sctimer\n__bic_SR_register_on_exit(CPUOFF);\n}\ndebugpins_isr_clr();\n}\n-// TIMERB1_VECTOR\n-\n// NMI_VECTOR\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/wsn430v14/bsp_timer.c", "new_path": null, "diff": "-/**\n-\\brief WSN430v14-specific definition of the \"bsp_timer\" bsp module.\n-\n-On WSN430v14, we use timerB0 for the bsp_timer module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, August 2014.\n-*/\n-\n-#include \"msp430f1611.h\"\n-#include \"bsp_timer.h\"\n-#include \"board.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- bsp_timer_cbt cb;\n- PORT_TIMER_WIDTH last_compare_value;\n-} bsp_timer_vars_t;\n-\n-bsp_timer_vars_t bsp_timer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-/**\n-\\brief Initialize this module.\n-\n-This functions starts the timer, i.e. the counter increments, but doesn't set\n-any compare registers, so no interrupt will fire.\n-*/\n-void bsp_timer_init(void) {\n-\n- // clear local variables\n- memset(&bsp_timer_vars,0,sizeof(bsp_timer_vars_t));\n-\n- // set CCRB0 registers\n- TBCCTL0 = 0;\n- TBCCR0 = 0;\n-\n- // start TimerB\n- TBCTL = MC_2+TBSSEL_1; // continuous mode, from ACLK\n-}\n-\n-/**\n-\\brief Register a callback.\n-\n-\\param cb The function to be called when a compare event happens.\n-*/\n-void bsp_timer_set_callback(bsp_timer_cbt cb) {\n- bsp_timer_vars.cb = cb;\n-}\n-\n-/**\n-\\brief Reset the timer.\n-\n-This function does not stop the timer, it rather resets the value of the\n-counter, and cancels a possible pending compare event.\n-*/\n-void bsp_timer_reset(void) {\n- // reset compare\n- TBCCR0 = 0;\n- TBCCTL0 = 0;\n- // reset timer\n- TBR = 0;\n- // record last timer compare value\n- bsp_timer_vars.last_compare_value = 0;\n-}\n-\n-/**\n-\\brief Schedule the callback to be called in some specified time.\n-\n-The delay is expressed relative to the last compare event. It doesn't matter\n-how long it took to call this function after the last compare, the timer will\n-expire precisely delayTicks after the last one.\n-\n-The only possible problem is that it took so long to call this function that\n-the delay specified is shorter than the time already elapsed since the last\n-compare. In that case, this function triggers the interrupt to fire right away.\n-\n-This means that the interrupt may fire a bit off, but this inaccuracy does not\n-propagate to subsequent timers.\n-\n-\\param delayTicks Number of ticks before the timer expired, relative to the\n- last compare event.\n-*/\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks) {\n- PORT_TIMER_WIDTH newCompareValue;\n- PORT_TIMER_WIDTH temp_last_compare_value;\n-\n- temp_last_compare_value = bsp_timer_vars.last_compare_value;\n-\n- newCompareValue = bsp_timer_vars.last_compare_value+delayTicks;\n- bsp_timer_vars.last_compare_value = newCompareValue;\n-\n- if (delayTicks<TBR-temp_last_compare_value) {\n- // we're already too late, schedule the ISR right now, manually\n-\n- // setting the interrupt flag triggers an interrupt\n- TBCCTL0 |= CCIE+CCIFG;\n- } else {\n- // this is the normal case, have timer expire at newCompareValue\n- TBCCR0 = newCompareValue;\n- TBCCTL0 |= CCIE;\n- }\n-}\n-\n-/**\n-\\brief Cancel a running compare.\n-*/\n-void bsp_timer_cancel_schedule(void) {\n- TBCCR0 = 0;\n- TBCCTL0 &= ~CCIE;\n-}\n-\n-/**\n-\\brief Return the current value of the timer's counter.\n-\n-\\returns The current value of the timer's counter.\n-*/\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue(void) {\n- return TBR;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrup handlers ===============================\n-\n-kick_scheduler_t bsp_timer_isr(void) {\n- // call the callback\n- bsp_timer_vars.cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n-}\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/wsn430v14/radiotimer.c", "new_path": null, "diff": "-/**\n-\\brief WSN430v14-specific definition of the \"radiotimer\" bsp module.\n-\n-\\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012.\n-*/\n-\n-#include \"msp430f1611.h\"\n-#include \"radiotimer.h\"\n-#include \"leds.h\"\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- radiotimer_compare_cbt overflowCb;\n- radiotimer_compare_cbt compareCb;\n- radiotimer_capture_cbt startFrameCb;\n- radiotimer_capture_cbt endFrameCb;\n-} radiotimer_vars_t;\n-\n-radiotimer_vars_t radiotimer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init(void) {\n- // clear local variables\n- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t));\n-}\n-\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.overflowCb = cb;\n-}\n-\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.compareCb = cb;\n-}\n-\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_vars.startFrameCb = cb;\n-}\n-\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_vars.endFrameCb = cb;\n-}\n-\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period) {\n-\n- // CCR0 contains period of counter\n- // do not interrupt when counter reaches TACCR0, but when it resets\n- TACCR0 = period-1;\n-\n- // CCR1 in compare mode (disabled for now)\n- TACCTL1 = 0;\n- TACCR1 = 0;\n-\n- // start counting\n- TACTL = TAIE+TACLR; // interrupt when counter resets\n- TACTL |= MC_1+TASSEL_1; // up mode, clocked from ACLK\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue(void) {\n- return TAR;\n-}\n-\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) {\n- TACCR0 = period;\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod(void) {\n- return TACCR0;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) {\n- // offset when to fire\n- TACCR1 = offset;\n-\n- // enable compare interrupt (this also cancels any pending interrupts)\n- TACCTL1 = CCIE;\n-}\n-\n-void radiotimer_cancel(void) {\n- // reset compare value (also resets interrupt flag)\n- TACCR1 = 0;\n-\n- // disable compare interrupt\n- TACCTL1 &= ~CCIE;\n-}\n-\n-//===== capture\n-\n-inline PORT_RADIOTIMER_WIDTH radiotimer_getCapturedTime(void) {\n- return TAR;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-/**\n-\\brief TimerA CCR1-6 interrupt service routine\n-*/\n-kick_scheduler_t radiotimer_isr(void) {\n- PORT_RADIOTIMER_WIDTH taiv_local;\n-\n- // reading TAIV returns the value of the highest pending interrupt flag\n- // and automatically resets that flag. We therefore copy its value to the\n- // tbiv_local local variable exactly once. If there is more than one\n- // interrupt pending, we will reenter this function after having just left\n- // it.\n- taiv_local = TAIV;\n-\n- switch (taiv_local) {\n- case 0x0002: // CCR1 fires\n- if (radiotimer_vars.compareCb!=NULL) {\n- // call the callback\n- radiotimer_vars.compareCb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case 0x0004: // CCR2 fires\n- break;\n- case 0x000a: // timer overflow\n- if (radiotimer_vars.overflowCb!=NULL) {\n- radiotimer_vars.overflowCb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- }\n- return DO_NOT_KICK_SCHEDULER;\n-}\n-\n-kick_scheduler_t radiotimer_isr_sfd(void) {\n- uint16_t now;\n- now = radiotimer_getCapturedTime();\n- if (P1IES & 0x20) {\n- // high->low just happened\n- if (radiotimer_vars.endFrameCb!=NULL) {\n- radiotimer_vars.endFrameCb(now);\n- }\n- } else {\n- // low->high just happened\n- if (radiotimer_vars.startFrameCb!=NULL) {\n- radiotimer_vars.startFrameCb(now);\n- }\n- }\n- P1IES ^= 0x20; // arm in opposite transition\n- return KICK_SCHEDULER;\n-}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. port of sctimer on wsn430v14.
491,595
11.05.2017 16:10:18
-7,200
fb1fa84c56f9da68a4c1d5711b0dfd01764345e1
add sctimer.c for wsn430v14
[ { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/wsn430v14/sctimer.c", "diff": "+/**\n+\\brief A timer module with only a single compare value.\n+\n+\\author: Tengfei Chang <tengfei.chang@inria.fr> April 2017\n+*/\n+\n+#include \"sctimer.h\"\n+#include \"msp430f1611.h\"\n+#include \"sctimer.h\"\n+#include \"board.h\"\n+#include \"leds.h\"\n+\n+// ========================== define ==========================================\n+\n+#define TIMERLOOP_THRESHOLD 0x4000 // 0.5 seconds @ 32768Hz clock\n+#define MINIMUM_COMPAREVALE_ADVANCE 3\n+\n+// ========================== variable ========================================\n+\n+typedef struct {\n+ sctimer_cbt cb;\n+ sctimer_capture_cbt startFrameCb;\n+ sctimer_capture_cbt endFrameCb;\n+ uint8_t f_SFDreceived;\n+} sctimer_vars_t;\n+\n+sctimer_vars_t sctimer_vars;\n+\n+// ========================== private ==========================================\n+\n+// ========================== protocol =========================================\n+\n+/**\n+\\brief Initialization sctimer.\n+*/\n+void sctimer_init(void){\n+ memset(&sctimer_vars, 0, sizeof(sctimer_vars_t));\n+\n+ // CCR2 in compare mode (disabled for now)\n+ TBCCTL2 = 0;\n+ TBCCR2 = 0;\n+\n+ // start counting\n+ TBCTL = MC_2+TBSSEL_1; // continue mode, clocked from ACLK\n+}\n+\n+void sctimer_set_callback(sctimer_cbt cb){\n+ sctimer_vars.cb = cb;\n+}\n+\n+void sctimer_setStartFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.startFrameCb = cb;\n+}\n+\n+void sctimer_setEndFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.endFrameCb = cb;\n+}\n+\n+/**\n+\\brief set compare interrupt\n+*/\n+void sctimer_setCompare(PORT_TIMER_WIDTH val){\n+ TBCCTL2 = CCIE;\n+ if (TBR - val < TIMERLOOP_THRESHOLD){\n+ // the timer is already late, schedule the ISR right now manually\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ if (val-TBR<MINIMUM_COMPAREVALE_ADVANCE){\n+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ // schedule the timer at val\n+ TBCCR2 = val;\n+ }\n+ }\n+}\n+\n+/**\n+\\brief Return the current value of the timer's counter.\n+\n+ \\returns The current value of the timer's counter.\n+*/\n+PORT_TIMER_WIDTH sctimer_readCounter(void){\n+ return TBR;\n+}\n+\n+void sctimer_enable(void){\n+ TBCCTL2 |= CCIE;\n+}\n+\n+void sctimer_disable(void){\n+ TBCCTL2 &= ~CCIE;\n+}\n+\n+// ========================== private =========================================\n+\n+\n+//=========================== interrupt handlers ==============================\n+\n+/**\n+\\brief TimerB CCR1-6 interrupt service routine\n+*/\n+kick_scheduler_t sctimer_isr() {\n+ PORT_TIMER_WIDTH tbiv_local;\n+\n+ // reading TBIV returns the value of the highest pending interrupt flag\n+ // and automatically resets that flag. We therefore copy its value to the\n+ // tbiv_local local variable exactly once. If there is more than one\n+ // interrupt pending, we will reenter this function after having just left\n+ // it.\n+\n+ tbiv_local = TBIV;\n+\n+ switch (tbiv_local) {\n+ case 0x0002: // CCR1 fires\n+ if (TBCCTL1 & CCI) {\n+ // SFD pin is high: this was the start of a frame\n+ if (sctimer_vars.startFrameCb!=NULL) {\n+ sctimer_vars.startFrameCb(TBCCR1);\n+ sctimer_vars.f_SFDreceived = 1;\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ } else {\n+ // SFD pin is low: this was the end of a frame\n+ if (sctimer_vars.endFrameCb!=NULL) {\n+ if (sctimer_vars.f_SFDreceived == 1) {\n+ sctimer_vars.endFrameCb(TBCCR1);\n+ sctimer_vars.f_SFDreceived = 0;\n+ }\n+ TBCCTL1 &= ~COV;\n+ TBCCTL1 &= ~CCIFG;\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ }\n+ break;\n+ case 0x0004: // CCR2 fires\n+ if (sctimer_vars.cb!=NULL) {\n+ sctimer_vars.cb();\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ break;\n+ case 0x0006: // CCR3 fires\n+ break;\n+ case 0x0008: // CCR4 fires\n+ break;\n+ case 0x000a: // CCR5 fires\n+ break;\n+ case 0x000c: // CCR6 fires\n+ break;\n+ case 0x000e: // timer overflow\n+ break;\n+ }\n+ return DO_NOT_KICK_SCHEDULER;\n+}\n+\n+kick_scheduler_t sctimer_isr_sfd(void) {\n+ uint16_t now;\n+ now = sctimer_readCounter();\n+ if (P1IES & 0x20) {\n+ // high->low just happened\n+ if (sctimer_vars.endFrameCb!=NULL) {\n+ sctimer_vars.endFrameCb(now);\n+ }\n+ } else {\n+ // low->high just happened\n+ if (sctimer_vars.startFrameCb!=NULL) {\n+ sctimer_vars.startFrameCb(now);\n+ }\n+ }\n+ P1IES ^= 0x20; // arm in opposite transition\n+ return KICK_SCHEDULER;\n+}\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. add sctimer.c for wsn430v14
491,595
11.05.2017 16:28:30
-7,200
8e76208cdcd0cc4d517812a8e6b72c159d5b38e0
update oos_sniffer project.
[ { "change_type": "MODIFY", "old_path": "projects/common/03oos_macpong/03oos_macpong.c", "new_path": "projects/common/03oos_macpong/03oos_macpong.c", "diff": "#include \"sixtop.h\"\n#include \"idmanager.h\"\n#include \"neighbors.h\"\n-#include \"sctimer.h\"\n#define LEN_PAYLOAD 100\n@@ -112,7 +111,7 @@ void macpong_send(uint8_t payloadCtr) {\nvoid iphc_init(void) {\nPORT_TIMER_WIDTH reference;\n- reference = sctimer_readCounter();\n+ reference = opentimers_getValue(macpong_vars.timerId);\nmacpong_vars.timerId = opentimers_create();\nopentimers_scheduleAbsolute(\nmacpong_vars.timerId, // timerId\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. update oos_sniffer project.
491,595
11.05.2017 16:32:17
-7,200
1e4bf27f1898848ea912b8cc73f085535a8626a6
opentimers_getValue doesn't require parameters.
[ { "change_type": "MODIFY", "old_path": "drivers/common/openserial.c", "new_path": "drivers/common/openserial.c", "diff": "@@ -177,7 +177,7 @@ owerror_t openserial_printCritical(\n// schedule for the mote to reboot in 10s\nid = opentimers_create();\n- reference = opentimers_getValue(id);\n+ reference = opentimers_getValue();\nopentimers_scheduleAbsolute(\nid, // timerId\n10000, // duration\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.c", "new_path": "drivers/common/opentimers.c", "diff": "@@ -288,13 +288,11 @@ bool opentimers_destroy(opentimers_id_t id){\n}\n/**\n-\\brief get the counter value of given timer.\n-\n-\\param[in] id the timer id\n+\\brief get the current counter value of sctimer.\n\\returns the current counter value.\n*/\n-PORT_TIMER_WIDTH opentimers_getValue(opentimers_id_t id){\n+PORT_TIMER_WIDTH opentimers_getValue(void){\nreturn sctimer_readCounter();\n}\n" }, { "change_type": "MODIFY", "old_path": "drivers/common/opentimers.h", "new_path": "drivers/common/opentimers.h", "diff": "@@ -82,7 +82,7 @@ void opentimers_scheduleAbsolute(opentimers_id_t id,\nvoid opentimers_cancel(opentimers_id_t id);\nbool opentimers_destroy(opentimers_id_t id);\n-PORT_TIMER_WIDTH opentimers_getValue(opentimers_id_t id);\n+PORT_TIMER_WIDTH opentimers_getValue(void);\nPORT_TIMER_WIDTH opentimers_getCurrentTimeout(void);\nbool opentimers_isRunning(opentimers_id_t id);\nvoid opentimers_setPriority(opentimers_id_t id, uint8_t priority);\n" }, { "change_type": "MODIFY", "old_path": "openstack/02a-MAClow/IEEE802154E.c", "new_path": "openstack/02a-MAClow/IEEE802154E.c", "diff": "@@ -2393,7 +2393,7 @@ void synchronizePacket(PORT_TIMER_WIDTH timeReceived) {\nPORT_TIMER_WIDTH currentValue;\n// record the current timer value and period\n- currentValue = opentimers_getValue(ieee154e_vars.timerId)-ieee154e_vars.startOfSlotReference;\n+ currentValue = opentimers_getValue()-ieee154e_vars.startOfSlotReference;\ncurrentPeriod = ieee154e_vars.slotDuration;\n// calculate new period\n" }, { "change_type": "MODIFY", "old_path": "openstack/02b-MAChigh/sixtop.c", "new_path": "openstack/02b-MAChigh/sixtop.c", "diff": "@@ -129,7 +129,7 @@ void sixtop_init() {\nopentimers_scheduleAbsolute(\nsixtop_vars.ebSendingTimerId,\nsixtop_vars.periodMaintenance,\n- opentimers_getValue(sixtop_vars.ebSendingTimerId),\n+ opentimers_getValue(),\nTIME_MS,\nsixtop_sendingEb_timer_cb\n);\n@@ -138,7 +138,7 @@ void sixtop_init() {\nopentimers_scheduleAbsolute(\nsixtop_vars.maintenanceTimerId,\nsixtop_vars.periodMaintenance,\n- opentimers_getValue(sixtop_vars.maintenanceTimerId),\n+ opentimers_getValue(),\nTIME_MS,\nsixtop_maintenance_timer_cb\n);\n@@ -974,7 +974,7 @@ void sixtop_six2six_sendDone(OpenQueueEntry_t* msg, owerror_t error){\nopentimers_scheduleAbsolute(\nsixtop_vars.timeoutTimerId,\nSIX2SIX_TIMEOUT_MS,\n- opentimers_getValue(sixtop_vars.timeoutTimerId),\n+ opentimers_getValue(),\nTIME_MS,\nsixtop_timeout_timer_cb\n);\n" }, { "change_type": "MODIFY", "old_path": "openstack/03b-IPv6/icmpv6rpl.c", "new_path": "openstack/03b-IPv6/icmpv6rpl.c", "diff": "@@ -84,7 +84,7 @@ void icmpv6rpl_init() {\nopentimers_scheduleAbsolute(\nicmpv6rpl_vars.timerIdDIO,\n872 +(openrandom_get16b()&0xff),\n- opentimers_getValue(icmpv6rpl_vars.timerIdDIO),\n+ opentimers_getValue(),\nTIME_MS,\nicmpv6rpl_timer_DIO_cb\n);\n@@ -133,7 +133,7 @@ void icmpv6rpl_init() {\nopentimers_scheduleAbsolute(\nicmpv6rpl_vars.timerIdDAO,\n872 +(openrandom_get16b()&0xff),\n- opentimers_getValue(icmpv6rpl_vars.timerIdDAO),\n+ opentimers_getValue(),\nTIME_MS,\nicmpv6rpl_timer_DAO_cb\n);\n" }, { "change_type": "MODIFY", "old_path": "openstack/04-TRAN/opentcp.c", "new_path": "openstack/04-TRAN/opentcp.c", "diff": "@@ -693,7 +693,7 @@ void tcp_change_state(uint8_t new_tcp_state) {\nopentimers_scheduleAbsolute(\ntcp_vars.timerId,\nTCP_TIMEOUT,\n- opentimers_getValue(tcp_vars.timerId),\n+ opentimers_getValue(),\nTIME_MS,\nopentcp_timer_cb\n);\n" }, { "change_type": "MODIFY", "old_path": "projects/common/01bsp_uart/01bsp_uart.c", "new_path": "projects/common/01bsp_uart/01bsp_uart.c", "diff": "@@ -20,20 +20,90 @@ TeraTerm):\n// bsp modules required\n#include \"board.h\"\n#include \"uart.h\"\n-#include \"bsp_timer.h\"\n#include \"leds.h\"\n+#include \"radio.h\"\n//=========================== defines =========================================\n-#define BSP_TIMER_PERIOD 0xffff // 0xffff@32kHz = 2s\n-uint8_t stringToSend[] = \"Hello, World!\\r\\n\";\n+#define CHANNEL 26\n+\n+#define FRAME_START 0x7E\n+#define FRAME_END 0xE7\n+\n+\n+#define FRAME_LENGTH 13\n+#define PACKAGE_LENGTH 256\n+\n+#define LENGTH_CRC 2\n+#define LENGTH_PACKET 125+LENGTH_CRC ///< maximum length is 127 bytes\n+\n+#define PAYLOAD_SIZE 90\n+\n+static const uint8_t c_readConfig[] = {\n+ 0x7e,0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x09,0xe7\n+};\n+\n+// configure baudrate 115200, ID (not set), packet content 256 bytes\n+static const uint8_t c_configParameter[] = {\n+ 0x7e,0x00,0x08,0x00,0x03,0x05,0xff,0x01,0x00,0x00,0x00,0x10,0xe7\n+};\n+\n+// auto focus once\n+static const uint8_t c_configfocus[] = {\n+ 0x7e,0x00,0x08,0x00,0x09,0x01,0x00,0x00,0x00,0x00,0x00,0x12,0xe7\n+};\n+\n+// picture: 800*600, grey, quality middle\n+static const uint8_t c_takePicture[] = {\n+ 0x7e,0x00,0x08,0x00,0x05,0x03,0x13,0x01,0x00,0x00,0x00,0x24,0xe7\n+};\n+\n+// could be changed\n+uint8_t c_uploadPic[] = {\n+ 0x7e,0x00,0x08,0x00,0x07,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0xe7\n+};\n+\n+static const uint8_t c_admin_restoreFactorySetting[] = {\n+ 0x7e,0x00,0x08,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xe7\n+};\n+\n+static const uint8_t c_admin_reset[] = {\n+ 0x7e,0x00,0x08,0x00,0x10,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0xe7\n+};\n+\n+typedef enum {\n+ S_IDLE = 0,\n+ S_CONFIG = 1,\n+ S_FOCUS = 2,\n+ S_TAKEPIC = 3,\n+ S_UPLOAD = 4,\n+ S_TRANSMIT_1 = 5,\n+ S_TRANSMIT_2 = 6,\n+ S_TRANSMIT_3 = 7,\n+} next_action_t;\n+\n+#define S_MAXACTION 8\n+#define PIC_TO_TAKE 1\n+\n+#define INDEX_PACKET_SEG_1 11\n+#define INDEX_PACKET_SEG_2 11+PAYLOAD_SIZE\n+#define INDEX_PACKET_SEG_3 11+PAYLOAD_SIZE+PAYLOAD_SIZE\n//=========================== variables =======================================\ntypedef struct {\nuint8_t uart_lastTxByteIndex;\n+ uint16_t uart_lastRxByteIndex;\nvolatile uint8_t uartDone;\nvolatile uint8_t uartSendNow;\n+ uint8_t uartReceiveBytes[FRAME_LENGTH];\n+ uint8_t uartReceiveBytesWithPackage[PACKAGE_LENGTH+FRAME_LENGTH];\n+ next_action_t nextAction;\n+ uint8_t packageNumberL;\n+ uint8_t packageNumberH;\n+ uint8_t packet[LENGTH_PACKET];\n+ uint16_t currentPackageSize;\n+ uint16_t currentpackageIndex;\n} app_vars_t;\napp_vars_t app_vars;\n@@ -44,6 +114,13 @@ void cb_compare(void);\nvoid cb_uartTxDone(void);\nvoid cb_uartRxCb(void);\n+void cb_startFrame(PORT_RADIOTIMER_WIDTH timestamp);\n+void cb_endFrame(PORT_RADIOTIMER_WIDTH timestamp);\n+\n+//==== helper ====\n+uint16_t findCharAtEndOfBuffer(uint8_t* buffer,uint16_t length,uint8_t target);\n+uint8_t checksum(uint8_t* buffer, uint8_t length);\n+\n//=========================== main ============================================\n/**\n@@ -51,6 +128,9 @@ void cb_uartRxCb(void);\n*/\nint mote_main(void) {\n+ uint16_t i,j,temp;\n+\n+\n// clear local variable\nmemset(&app_vars,0,sizeof(app_vars_t));\n@@ -63,53 +143,224 @@ int mote_main(void) {\nuart_setCallbacks(cb_uartTxDone,cb_uartRxCb);\nuart_enableInterrupts();\n- // setup BSP timer\n- bsp_timer_set_callback(cb_compare);\n- bsp_timer_scheduleIn(BSP_TIMER_PERIOD);\n+ // set up radio\n+ radio_setStartFrameCb(cb_startFrame);\n+ radio_setEndFrameCb(cb_endFrame);\n+\n+ // prepare radio\n+ radio_rfOn();\n+ radio_setFrequency(CHANNEL);\nwhile(1) {\n// wait for timer to elapse\nwhile (app_vars.uartSendNow==0);\napp_vars.uartSendNow = 0;\n+ leds_sync_off();\n// send string over UART\napp_vars.uartDone = 0;\napp_vars.uart_lastTxByteIndex = 0;\n- uart_writeByte(stringToSend[app_vars.uart_lastTxByteIndex]);\n- while(app_vars.uartDone==0);\n+ if (app_vars.nextAction==S_IDLE){\n+ app_vars.nextAction++;\n}\n+ switch (app_vars.nextAction){\n+ case S_IDLE :\n+ // do nothing\n+ break;\n+ case S_CONFIG :\n+ uart_writeByte(c_configParameter[app_vars.uart_lastTxByteIndex]);\n+ break;\n+ case S_FOCUS :\n+ uart_writeByte(c_configfocus[app_vars.uart_lastTxByteIndex]);\n+ break;\n+ case S_TAKEPIC :\n+ uart_writeByte(c_takePicture[app_vars.uart_lastTxByteIndex]);\n+ break;\n+ case S_UPLOAD :\n+ if (app_vars.currentpackageIndex == app_vars.packageNumberH*256+app_vars.packageNumberL){\n+ // Done!!!\n+ return 0;\n+ } else {\n+ app_vars.currentpackageIndex++;\n}\n+ // upload package 01\n+ c_uploadPic[6] = (uint8_t)((app_vars.currentpackageIndex>>8) & 0xff);\n+ c_uploadPic[7] = (uint8_t)(app_vars.currentpackageIndex & 0xff);\n+ // total number packet\n+ c_uploadPic[8] = app_vars.packageNumberH;\n+ c_uploadPic[9] = app_vars.packageNumberL;\n+ // checksum\n+ c_uploadPic[11] = checksum(&c_uploadPic[1],11);\n+ memset(&app_vars.uartReceiveBytesWithPackage[0],0,PACKAGE_LENGTH+FRAME_LENGTH);\n+ uart_writeByte(c_uploadPic[app_vars.uart_lastTxByteIndex]);\n+ break;\n+ case S_TRANSMIT_1:\n+ // reset radio status\n+ radio_rfOff();\n-//=========================== callbacks =======================================\n+ temp = findCharAtEndOfBuffer(&app_vars.uartReceiveBytesWithPackage[0],PACKAGE_LENGTH+FRAME_LENGTH,FRAME_END);\n+ if (temp > 12 && temp <PACKAGE_LENGTH+FRAME_LENGTH){\n+ app_vars.currentPackageSize = temp - 1 - 11; // checksum+header and parameters\n+ } else {\n+ app_vars.currentPackageSize = 0;\n+ return 0;\n+ }\n-void cb_compare(void) {\n+ // prepare packet\n+ if (app_vars.currentPackageSize/PAYLOAD_SIZE>0){\n+ for (i=0;i<PAYLOAD_SIZE;i++) {\n+ app_vars.packet[i] = app_vars.uartReceiveBytesWithPackage[i+INDEX_PACKET_SEG_1];\n+ }\n+ radio_loadPacket(app_vars.packet,PAYLOAD_SIZE);\n+ } else {\n+ for (i=0;i<app_vars.currentPackageSize;i++) {\n+ app_vars.packet[i] = app_vars.uartReceiveBytesWithPackage[i+INDEX_PACKET_SEG_1];\n+ }\n+ radio_loadPacket(app_vars.packet,app_vars.currentPackageSize);\n+ }\n- // have main \"task\" send over UART\n- app_vars.uartSendNow = 1;\n+ // start transmitting packet\n+ radio_txEnable();\n+ radio_txNow();\n+ break;\n+ case S_TRANSMIT_2:\n+ // reset radio status\n+ radio_rfOff();\n+ if (app_vars.currentPackageSize==0){\n+ return 0;\n+ }\n+\n+ if (app_vars.currentPackageSize/PAYLOAD_SIZE>1){\n+ for (i=0;i<PAYLOAD_SIZE;i++) {\n+ app_vars.packet[i] = app_vars.uartReceiveBytesWithPackage[i+INDEX_PACKET_SEG_2];\n+ }\n+ radio_loadPacket(app_vars.packet,PAYLOAD_SIZE);\n+ } else {\n+ for (i=0;i<app_vars.currentPackageSize-PAYLOAD_SIZE;i++) {\n+ app_vars.packet[i] = app_vars.uartReceiveBytesWithPackage[i+INDEX_PACKET_SEG_2];\n+ }\n+ radio_loadPacket(app_vars.packet,app_vars.currentPackageSize-PAYLOAD_SIZE);\n+ }\n+ // start transmitting packet\n+ radio_txEnable();\n+ radio_txNow();\n+ break;\n+ case S_TRANSMIT_3:\n+ // reset radio status\n+ radio_rfOff();\n+ if (app_vars.currentPackageSize==0){\n+ return 0;\n+ }\n+\n+ if (app_vars.currentPackageSize/PAYLOAD_SIZE>2){\n+ // something wrong\n+ return 0;\n+ } else {\n+ for (i=0;i<app_vars.currentPackageSize-2*PAYLOAD_SIZE;i++) {\n+ app_vars.packet[i] = app_vars.uartReceiveBytesWithPackage[i+INDEX_PACKET_SEG_3];\n+ }\n+ radio_loadPacket(app_vars.packet,app_vars.currentPackageSize-2*PAYLOAD_SIZE);\n+ }\n+ // start transmitting packet\n+ radio_txEnable();\n+ radio_txNow();\n+ break;\n+ }\n+ while(app_vars.uartDone==0);\n+ // a little delay\n+ for (i=0;i<0xfff;i++){\n+ for (j=0;j<0xff;j++);\n+ }\n+ }\n+ return 0;\n+}\n+\n+//=========================== helper ==========================================\n- // schedule again\n- bsp_timer_scheduleIn(BSP_TIMER_PERIOD);\n+uint16_t findCharAtEndOfBuffer(uint8_t* buffer,uint16_t length,uint8_t target){\n+ uint16_t i;\n+ for (i=length-1;i>0;i--){\n+ if (target == buffer[i]){\n+ break;\n+ }\n+ }\n+ return i;\n}\n+uint8_t checksum(uint8_t* buffer, uint8_t length){\n+ uint8_t i;\n+ uint8_t checksum = 0;\n+ for (i=0;i<length;i++){\n+ checksum += buffer[i];\n+ }\n+ return checksum;\n+}\n+\n+//=========================== callbacks =======================================\n+\nvoid cb_uartTxDone(void) {\napp_vars.uart_lastTxByteIndex++;\n- if (app_vars.uart_lastTxByteIndex<sizeof(stringToSend)) {\n- uart_writeByte(stringToSend[app_vars.uart_lastTxByteIndex]);\n+ if (app_vars.uart_lastTxByteIndex<FRAME_LENGTH) {\n+ switch (app_vars.nextAction){\n+ case S_IDLE :\n+ // do nothing\n+ break;\n+ case S_CONFIG :\n+ uart_writeByte(c_configParameter[app_vars.uart_lastTxByteIndex]);\n+ break;\n+ case S_FOCUS :\n+ uart_writeByte(c_configfocus[app_vars.uart_lastTxByteIndex]);\n+ break;\n+ case S_TAKEPIC :\n+ uart_writeByte(c_takePicture[app_vars.uart_lastTxByteIndex]);\n+ break;\n+ case S_UPLOAD :\n+ uart_writeByte(c_uploadPic[app_vars.uart_lastTxByteIndex]);\n+ break;\n+ }\n} else {\napp_vars.uartDone = 1;\n}\n}\nvoid cb_uartRxCb(void) {\n- uint8_t byte;\n-\n+ uint16_t byteLengthToRead = FRAME_LENGTH;\n// toggle LED\nleds_error_toggle();\n// read received byte\n- byte = uart_readByte();\n+ if (app_vars.nextAction==S_UPLOAD){\n+ byteLengthToRead += PACKAGE_LENGTH;\n+ app_vars.uartReceiveBytesWithPackage[app_vars.uart_lastRxByteIndex] = uart_readByte();\n+ } else {\n+ app_vars.uartReceiveBytes[app_vars.uart_lastRxByteIndex] = uart_readByte();\n+ }\n+ app_vars.uart_lastRxByteIndex++;\n// echo that byte over serial\n- uart_writeByte(byte);\n+ if (app_vars.uart_lastRxByteIndex==byteLengthToRead){\n+ leds_sync_on();\n+ app_vars.uart_lastRxByteIndex = 0;\n+ if (app_vars.nextAction==S_TAKEPIC){\n+ app_vars.packageNumberL = app_vars.uartReceiveBytes[10];\n+ app_vars.packageNumberH |= app_vars.uartReceiveBytes[9];\n+ }\n+ app_vars.nextAction = (app_vars.nextAction+1)%S_MAXACTION;\n+ app_vars.uartSendNow = 1;\n+ }\n+}\n+\n+void cb_startFrame(PORT_RADIOTIMER_WIDTH timestamp) {\n+\n+}\n+\n+void cb_endFrame(PORT_RADIOTIMER_WIDTH timestamp) {\n+ if (app_vars.nextAction == S_TRANSMIT_3){\n+ app_vars.nextAction = S_UPLOAD;\n+ } else {\n+ app_vars.nextAction = (app_vars.nextAction+1)%S_MAXACTION;\n+ }\n+ app_vars.uartSendNow = 1;\n+ app_vars.uartDone = 1;\n}\n\\ No newline at end of file\n" }, { "change_type": "MODIFY", "old_path": "projects/common/03oos_macpong/03oos_macpong.c", "new_path": "projects/common/03oos_macpong/03oos_macpong.c", "diff": "@@ -111,7 +111,7 @@ void macpong_send(uint8_t payloadCtr) {\nvoid iphc_init(void) {\nPORT_TIMER_WIDTH reference;\n- reference = opentimers_getValue(macpong_vars.timerId);\n+ reference = opentimers_getValue();\nmacpong_vars.timerId = opentimers_create();\nopentimers_scheduleAbsolute(\nmacpong_vars.timerId, // timerId\n" }, { "change_type": "MODIFY", "old_path": "projects/common/03oos_sniffer/03oos_sniffer.c", "new_path": "projects/common/03oos_sniffer/03oos_sniffer.c", "diff": "#include \"board.h\"\n#include \"radio.h\"\n#include \"leds.h\"\n-#include \"bsp_timer.h\"\n+#include \"opentimers.h\"\n#include \"scheduler.h\"\n#include \"03oos_sniffer.h\"\n#include \"openserial.h\"\n@@ -48,6 +48,7 @@ typedef struct {\nbool rxpk_crc;\nuint8_t channel;\nuint8_t outputOrInput;\n+ opentimers_id_t timerId;\n} app_vars_t;\napp_vars_t app_vars;\n@@ -66,6 +67,7 @@ void task_uploadPacket(void);\n*/\nint mote_main(void) {\n+ PORT_TIMER_WIDTH reference;\n// clear local variables\nmemset(&app_vars,0,sizeof(app_vars_t));\n@@ -80,9 +82,16 @@ int mote_main(void) {\nradio_setStartFrameCb(cb_startFrame);\nradio_setEndFrameCb(cb_endFrame);\n- // start bsp timer\n- bsp_timer_set_callback(cb_timer);\n- bsp_timer_scheduleIn(TIMER_PERIOD);\n+ // start timer\n+ app_vars.timerId = opentimers_create();\n+ reference = opentimers_getValue();\n+ opentimers_scheduleAbsolute(\n+ app_vars.timerId, // timerId\n+ TIMER_PERIOD, // duration\n+ reference, // reference\n+ TIME_TICS, // timetype\n+ cb_timer // callback\n+ );\n// prepare radio\nradio_rfOn();\n@@ -144,6 +153,13 @@ void cb_endFrame(PORT_TIMER_WIDTH timestamp) {\nvoid cb_timer(void) {\n+ // schedule again\n+ opentimers_scheduleRelative(\n+ app_vars.timerId, // timerId\n+ TIMER_PERIOD, // duration\n+ TIME_TICS, // timetype\n+ cb_timer // callback\n+ );\napp_vars.outputOrInput = (app_vars.outputOrInput+1)%2;\nif (app_vars.outputOrInput == 1) {\nopenserial_stop();\n@@ -152,8 +168,6 @@ void cb_timer(void) {\nopenserial_stop();\nopenserial_startInput();\n}\n- // schedule again\n- bsp_timer_scheduleIn(TIMER_PERIOD);\n}\n// ================================ task =======================================\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. opentimers_getValue doesn't require parameters.
491,595
11.05.2017 16:42:15
-7,200
e9a04b54ba2d2d71e28edf3830e7211bd4a83782
port sctimer on z1 board.
[ { "change_type": "MODIFY", "old_path": "bsp/boards/z1/SConscript", "new_path": "bsp/boards/z1/SConscript", "diff": "@@ -18,11 +18,10 @@ cc2420 = localEnv.SConscript(\nsource = [\n'board.c',\n- 'bsp_timer.c',\n+ 'sctimer.c',\n'debugpins.c',\n'eui64.c',\n'leds.c',\n- 'radiotimer.c',\n'spi.c',\n'uart.c',\n'i2c.c',\n" }, { "change_type": "MODIFY", "old_path": "bsp/boards/z1/board.c", "new_path": "bsp/boards/z1/board.c", "diff": "#include \"uart.h\"\n#include \"spi.h\"\n#include \"i2c.h\"\n-#include \"bsp_timer.h\"\n+#include \"sctimer.h\"\n#include \"radio.h\"\n-#include \"radiotimer.h\"\n#include \"eui64.h\"\n//#define ISR_BUTTON 1\n@@ -64,9 +63,8 @@ void board_init() {\nleds_init();\nuart_init();\nspi_init();\n- bsp_timer_init();\nradio_init();\n- radiotimer_init();\n+ sctimer_init();\n// enable interrupts\n__bis_SR_register(GIE);\n@@ -164,7 +162,7 @@ ISR(COMPARATORA){\nISR(TIMERB1){\ndebugpins_isr_set();\n- if (radiotimer_isr()==KICK_SCHEDULER) { // radiotimer\n+ if (sctimer_isr()==KICK_SCHEDULER) { // radiotimer\n__bic_SR_register_on_exit(CPUOFF);\n}\ndebugpins_isr_clr();\n@@ -172,10 +170,7 @@ ISR(TIMERB1){\nISR(TIMERA0){\ndebugpins_isr_set();\n- if (bsp_timer_isr()==KICK_SCHEDULER) { // timer: 0\n- __bic_SR_register_on_exit(CPUOFF);\n- }\n- debugpins_isr_clr();\n+ while(1); // should never happen\n}\nISR(TIMERB0){\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/z1/bsp_timer.c", "new_path": null, "diff": "-/**\n-\\brief Z1-specific definition of the \"bsp_timer\" bsp module.\n-\n-On Z1, we use timerB0 for the bsp_timer module.\n-\n-\\author Xavier Vilajosana <xvilajosana@eecs.berkeley.edu>, May 2013.\n-*/\n-\n-#include \"msp430x26x.h\"\n-#include \"string.h\"\n-#include \"bsp_timer.h\"\n-#include \"board.h\"\n-\n-//=========================== defines =========================================\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- bsp_timer_cbt cb;\n- PORT_TIMER_WIDTH last_compare_value;\n-} bsp_timer_vars_t;\n-\n-bsp_timer_vars_t bsp_timer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-/**\n-\\brief Initialize this module.\n-\n-This functions starts the timer, i.e. the counter increments, but doesn't set\n-any compare registers, so no interrupt will fire.\n-*/\n-void bsp_timer_init() {\n-\n- // clear local variables\n- memset(&bsp_timer_vars,0,sizeof(bsp_timer_vars_t));\n-\n- // source ACLK from 32kHz crystal\n- BCSCTL3 |= LFXT1S_0;\n-\n- //set CCRB0 registers\n- TACCTL0 = 0;\n- TACCR0 = 0;\n-\n- //start TimerB\n- TACTL = MC_2+TASSEL_1; // continuous mode, from ACLK\n-}\n-\n-/**\n-\\brief Register a callback.\n-\n-\\param cb The function to be called when a compare event happens.\n-*/\n-void bsp_timer_set_callback(bsp_timer_cbt cb) {\n- bsp_timer_vars.cb = cb;\n-}\n-\n-/**\n-\\brief Reset the timer.\n-\n-This function does not stop the timer, it rather resets the value of the\n-counter, and cancels a possible pending compare event.\n-*/\n-void bsp_timer_reset() {\n- // reset compare\n- TACCR0 = 0;\n- TACCTL0 = 0;\n- // reset timer\n- TAR = 0;\n- // record last timer compare value\n- bsp_timer_vars.last_compare_value = 0;\n-}\n-\n-/**\n-\\brief Schedule the callback to be called in some specified time.\n-\n-The delay is expressed relative to the last compare event. It doesn't matter\n-how long it took to call this function after the last compare, the timer will\n-expire precisely delayTicks after the last one.\n-\n-The only possible problem is that it took so long to call this function that\n-the delay specified is shorter than the time already elapsed since the last\n-compare. In that case, this function triggers the interrupt to fire right away.\n-\n-This means that the interrupt may fire a bit off, but this inaccuracy does not\n-propagate to subsequent timers.\n-\n-\\param delayTicks Number of ticks before the timer expired, relative to the\n- last compare event.\n-*/\n-void bsp_timer_scheduleIn(PORT_TIMER_WIDTH delayTicks) {\n- PORT_TIMER_WIDTH newCompareValue;\n- PORT_TIMER_WIDTH temp_last_compare_value;\n-\n- temp_last_compare_value = bsp_timer_vars.last_compare_value;\n-\n- newCompareValue = bsp_timer_vars.last_compare_value+delayTicks+1;\n- bsp_timer_vars.last_compare_value = newCompareValue;\n-\n- if (delayTicks<TAR-temp_last_compare_value) {\n- // we're already too late, schedule the ISR right now manually\n-\n- // setting the interrupt flag triggers an interrupt\n- TACCTL0 |= CCIFG;\n- } else {\n- // this is the normal case, have timer expire at newCompareValue\n- TACCR0 = newCompareValue;\n- TACCTL0 |= CCIE;\n- }\n-}\n-\n-/**\n-\\brief Cancel a running compare.\n-*/\n-void bsp_timer_cancel_schedule() {\n- TACCR0 = 0;\n- TACCTL0 &= ~CCIE;\n-}\n-\n-/**\n-\\brief Return the current value of the timer's counter.\n-\n-\\returns The current value of the timer's counter.\n-*/\n-PORT_TIMER_WIDTH bsp_timer_get_currentValue() {\n- return TAR;\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-kick_scheduler_t bsp_timer_isr() {\n- // call the callback\n- bsp_timer_vars.cb();\n- // kick the OS\n- return KICK_SCHEDULER;\n-}\n\\ No newline at end of file\n" }, { "change_type": "DELETE", "old_path": "bsp/boards/z1/radiotimer.c", "new_path": null, "diff": "-/**\n-\\brief Z1-specific definition of the \"radiotimer\" bsp module.\n-\n-\\author Xavier Vilajosana <xvilajosana@eecs.berkeley.edu>, May 2013.\n-*/\n-\n-#include \"msp430x26x.h\"\n-#include \"radiotimer.h\"\n-#include \"leds.h\"\n-\n-//=========================== variables =======================================\n-\n-typedef struct {\n- radiotimer_compare_cbt overflowCb;\n- radiotimer_compare_cbt compareCb;\n- radiotimer_capture_cbt startFrameCb;\n- radiotimer_capture_cbt endFrameCb;\n-} radiotimer_vars_t;\n-\n-radiotimer_vars_t radiotimer_vars;\n-\n-//=========================== prototypes ======================================\n-\n-//=========================== public ==========================================\n-\n-//===== admin\n-\n-void radiotimer_init() {\n- // clear local variables\n- memset(&radiotimer_vars,0,sizeof(radiotimer_vars_t));\n-}\n-\n-void radiotimer_setOverflowCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.overflowCb = cb;\n-}\n-\n-void radiotimer_setCompareCb(radiotimer_compare_cbt cb) {\n- radiotimer_vars.compareCb = cb;\n-}\n-\n-void radiotimer_setStartFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_vars.startFrameCb = cb;\n-}\n-\n-void radiotimer_setEndFrameCb(radiotimer_capture_cbt cb) {\n- radiotimer_vars.endFrameCb = cb;\n-}\n-\n-void radiotimer_start(PORT_RADIOTIMER_WIDTH period) {\n- // radio's SFD pin connected to P4.1\n- P4DIR &= ~0x02; // input\n- P4SEL |= 0x02; // in CCI1a/B mode\n-\n- // CCR0 contains period of counter\n- // do not interrupt when counter reaches TBCCR0, but when it resets\n- TBCCR0 = period-1;\n-\n- // CCR1 in capture mode\n- TBCCTL1 = CM_3+SCS+CAP+CCIE;\n- TBCCR1 = 0;\n-\n- // CCR2 in compare mode (disabled for now)\n- TBCCTL2 = 0;\n- TBCCR2 = 0;\n-\n- // start counting\n- TBCTL = TBIE+TBCLR; // interrupt when counter resets\n- TBCTL |= MC_1+TBSSEL_1; // up mode, clocked from ACLK\n-}\n-\n-//===== direct access\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getValue() {\n- return TBR;\n-}\n-\n-void radiotimer_setPeriod(PORT_RADIOTIMER_WIDTH period) {\n- TBCCR0 = period;\n-}\n-\n-PORT_RADIOTIMER_WIDTH radiotimer_getPeriod() {\n- return TBCCR0;\n-}\n-\n-//===== compare\n-\n-void radiotimer_schedule(PORT_RADIOTIMER_WIDTH offset) {\n- // offset when to fire\n- TBCCR2 = offset;\n-\n- // enable compare interrupt (this also cancels any pending interrupts)\n- TBCCTL2 = CCIE;\n-}\n-\n-void radiotimer_cancel() {\n- // reset compare value (also resets interrupt flag)\n- TBCCR2 = 0;\n-\n- // disable compare interrupt\n- TBCCTL2 &= ~CCIE;\n-}\n-\n-//===== capture\n-\n-inline uint16_t radiotimer_getCapturedTime() {\n- // this should never happpen!\n-\n- // we can not print from within the BSP. Instead:\n- // blink the error LED\n- leds_error_blink();\n- // reset the board\n- board_reset();\n-\n- return 0;// this line is never reached, but here to satisfy compiler\n-}\n-\n-//=========================== private =========================================\n-\n-//=========================== interrupt handlers ==============================\n-\n-/**\n-\\brief TimerB CCR1-6 interrupt service routine\n-*/\n-kick_scheduler_t radiotimer_isr() {\n- uint16_t tbiv_local;\n-\n- // reading TBIV returns the value of the highest pending interrupt flag\n- // and automatically resets that flag. We therefore copy its value to the\n- // tbiv_local local variable exactly once. If there is more than one\n- // interrupt pending, we will reenter this function after having just left\n- // it.\n- tbiv_local = TBIV;\n-\n- switch (tbiv_local) {\n- case 0x0002: // CCR1 fires\n- if (TBCCTL1 & CCI) {\n- // SFD pin is high: this was the start of a frame\n- if (radiotimer_vars.startFrameCb!=NULL) {\n- radiotimer_vars.startFrameCb(TBCCR1);\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- } else {\n- // SFD pin is low: this was the end of a frame\n- if (radiotimer_vars.endFrameCb!=NULL) {\n- radiotimer_vars.endFrameCb(TBCCR1);\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- }\n- break;\n- case 0x0004: // CCR2 fires\n- if (radiotimer_vars.compareCb!=NULL) {\n- radiotimer_vars.compareCb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- case 0x0006: // CCR3 fires\n- break;\n- case 0x0008: // CCR4 fires\n- break;\n- case 0x000a: // CCR5 fires\n- break;\n- case 0x000c: // CCR6 fires\n- break;\n- case 0x000e: // timer overflow\n- if (radiotimer_vars.overflowCb!=NULL) {\n- radiotimer_vars.overflowCb();\n- // kick the OS\n- return KICK_SCHEDULER;\n- }\n- break;\n- }\n- return DO_NOT_KICK_SCHEDULER;\n-}\n" }, { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/z1/sctimer.c", "diff": "+/**\n+\\brief A timer module with only a single compare value.\n+\n+\\author: Tengfei Chang <tengfei.chang@inria.fr> April 2017\n+*/\n+\n+#include \"sctimer.h\"\n+#include \"msp430x26x.h\"\n+#include \"sctimer.h\"\n+#include \"board.h\"\n+#include \"leds.h\"\n+\n+// ========================== define ==========================================\n+\n+#define TIMERLOOP_THRESHOLD 0x4000 // 0.5 seconds @ 32768Hz clock\n+#define MINIMUM_COMPAREVALE_ADVANCE 3\n+\n+// ========================== variable ========================================\n+\n+typedef struct {\n+ sctimer_cbt cb;\n+ sctimer_capture_cbt startFrameCb;\n+ sctimer_capture_cbt endFrameCb;\n+ uint8_t f_SFDreceived;\n+} sctimer_vars_t;\n+\n+sctimer_vars_t sctimer_vars;\n+\n+// ========================== private ==========================================\n+\n+// ========================== protocol =========================================\n+\n+/**\n+\\brief Initialization sctimer.\n+*/\n+void sctimer_init(void){\n+ memset(&sctimer_vars, 0, sizeof(sctimer_vars_t));\n+\n+ // radio's SFD pin connected to P4.1\n+ P4DIR &= ~0x02; // input\n+ P4SEL |= 0x02; // in CCI1a/B mode\n+\n+ // CCR1 in capture mode\n+ TBCCTL1 = CM_3+SCS+CAP+CCIE;\n+ TBCCR1 = 0;\n+\n+ // CCR2 in compare mode (disabled for now)\n+ TBCCTL2 = 0;\n+ TBCCR2 = 0;\n+\n+ // start counting\n+ TBCTL = MC_2+TBSSEL_1; // continue mode, clocked from ACLK\n+}\n+\n+void sctimer_set_callback(sctimer_cbt cb){\n+ sctimer_vars.cb = cb;\n+}\n+\n+void sctimer_setStartFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.startFrameCb = cb;\n+}\n+\n+void sctimer_setEndFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.endFrameCb = cb;\n+}\n+\n+/**\n+\\brief set compare interrupt\n+*/\n+void sctimer_setCompare(PORT_TIMER_WIDTH val){\n+ TBCCTL2 = CCIE;\n+ if (TBR - val < TIMERLOOP_THRESHOLD){\n+ // the timer is already late, schedule the ISR right now manually\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ if (val-TBR<MINIMUM_COMPAREVALE_ADVANCE){\n+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ // schedule the timer at val\n+ TBCCR2 = val;\n+ }\n+ }\n+}\n+\n+/**\n+\\brief Return the current value of the timer's counter.\n+\n+ \\returns The current value of the timer's counter.\n+*/\n+PORT_TIMER_WIDTH sctimer_readCounter(void){\n+ return TBR;\n+}\n+\n+void sctimer_enable(void){\n+ TBCCTL2 |= CCIE;\n+}\n+\n+void sctimer_disable(void){\n+ TBCCTL2 &= ~CCIE;\n+}\n+\n+// ========================== private =========================================\n+\n+\n+//=========================== interrupt handlers ==============================\n+\n+/**\n+\\brief TimerB CCR1-6 interrupt service routine\n+*/\n+kick_scheduler_t sctimer_isr() {\n+ PORT_TIMER_WIDTH tbiv_local;\n+\n+ // reading TBIV returns the value of the highest pending interrupt flag\n+ // and automatically resets that flag. We therefore copy its value to the\n+ // tbiv_local local variable exactly once. If there is more than one\n+ // interrupt pending, we will reenter this function after having just left\n+ // it.\n+\n+ tbiv_local = TBIV;\n+\n+ switch (tbiv_local) {\n+ case 0x0002: // CCR1 fires\n+ if (TBCCTL1 & CCI) {\n+ // SFD pin is high: this was the start of a frame\n+ if (sctimer_vars.startFrameCb!=NULL) {\n+ sctimer_vars.startFrameCb(TBCCR1);\n+ sctimer_vars.f_SFDreceived = 1;\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ } else {\n+ // SFD pin is low: this was the end of a frame\n+ if (sctimer_vars.endFrameCb!=NULL) {\n+ if (sctimer_vars.f_SFDreceived == 1) {\n+ sctimer_vars.endFrameCb(TBCCR1);\n+ sctimer_vars.f_SFDreceived = 0;\n+ }\n+ TBCCTL1 &= ~COV;\n+ TBCCTL1 &= ~CCIFG;\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ }\n+ break;\n+ case 0x0004: // CCR2 fires\n+ if (sctimer_vars.cb!=NULL) {\n+ sctimer_vars.cb();\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ break;\n+ case 0x0006: // CCR3 fires\n+ break;\n+ case 0x0008: // CCR4 fires\n+ break;\n+ case 0x000a: // CCR5 fires\n+ break;\n+ case 0x000c: // CCR6 fires\n+ break;\n+ case 0x000e: // timer overflow\n+ break;\n+ }\n+ return DO_NOT_KICK_SCHEDULER;\n+}\n\\ No newline at end of file\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. port sctimer on z1 board.
491,595
11.05.2017 16:43:22
-7,200
d6f716229d37af7d9512da7ee2f34478f62507bf
add sctimer.c for gina.
[ { "change_type": "ADD", "old_path": null, "new_path": "bsp/boards/gina/sctimer.c", "diff": "+/**\n+\\brief A timer module with only a single compare value.\n+\n+\\author: Tengfei Chang <tengfei.chang@inria.fr> April 2017\n+*/\n+\n+#include \"sctimer.h\"\n+#include \"msp430x26x.h\"\n+#include \"sctimer.h\"\n+#include \"board.h\"\n+#include \"leds.h\"\n+\n+// ========================== define ==========================================\n+\n+#define TIMERLOOP_THRESHOLD 0x4000 // 0.5 seconds @ 32768Hz clock\n+#define MINIMUM_COMPAREVALE_ADVANCE 3\n+\n+// ========================== variable ========================================\n+\n+typedef struct {\n+ sctimer_cbt cb;\n+ sctimer_capture_cbt startFrameCb;\n+ sctimer_capture_cbt endFrameCb;\n+ uint8_t f_SFDreceived;\n+} sctimer_vars_t;\n+\n+sctimer_vars_t sctimer_vars;\n+\n+// ========================== private ==========================================\n+\n+// ========================== protocol =========================================\n+\n+/**\n+\\brief Initialization sctimer.\n+*/\n+void sctimer_init(void){\n+ memset(&sctimer_vars, 0, sizeof(sctimer_vars_t));\n+\n+ // source ACLK from 32kHz crystal\n+ BCSCTL3 |= LFXT1S_0;\n+\n+ // CCR2 in compare mode (disabled for now)\n+ TBCCTL2 = 0;\n+ TBCCR2 = 0;\n+\n+ // start counting\n+ TBCTL = MC_2+TBSSEL_1; // continue mode, clocked from ACLK\n+}\n+\n+void sctimer_set_callback(sctimer_cbt cb){\n+ sctimer_vars.cb = cb;\n+}\n+\n+void sctimer_setStartFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.startFrameCb = cb;\n+}\n+\n+void sctimer_setEndFrameCb(sctimer_capture_cbt cb){\n+ sctimer_vars.endFrameCb = cb;\n+}\n+\n+/**\n+\\brief set compare interrupt\n+*/\n+void sctimer_setCompare(PORT_TIMER_WIDTH val){\n+ TBCCTL2 = CCIE;\n+ if (TBR - val < TIMERLOOP_THRESHOLD){\n+ // the timer is already late, schedule the ISR right now manually\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ if (val-TBR<MINIMUM_COMPAREVALE_ADVANCE){\n+ // there is hardware limitation to schedule the timer within TIMERTHRESHOLD ticks\n+ // setting the interrupt flag triggers an interrupt\n+ TBCCTL2 |= CCIFG;\n+ } else {\n+ // schedule the timer at val\n+ TBCCR2 = val;\n+ }\n+ }\n+}\n+\n+/**\n+\\brief Return the current value of the timer's counter.\n+\n+ \\returns The current value of the timer's counter.\n+*/\n+PORT_TIMER_WIDTH sctimer_readCounter(void){\n+ return TBR;\n+}\n+\n+void sctimer_enable(void){\n+ TBCCTL2 |= CCIE;\n+}\n+\n+void sctimer_disable(void){\n+ TBCCTL2 &= ~CCIE;\n+}\n+\n+// ========================== private =========================================\n+\n+\n+//=========================== interrupt handlers ==============================\n+\n+/**\n+\\brief TimerB CCR1-6 interrupt service routine\n+*/\n+kick_scheduler_t sctimer_isr() {\n+ PORT_TIMER_WIDTH tbiv_local;\n+\n+ // reading TBIV returns the value of the highest pending interrupt flag\n+ // and automatically resets that flag. We therefore copy its value to the\n+ // tbiv_local local variable exactly once. If there is more than one\n+ // interrupt pending, we will reenter this function after having just left\n+ // it.\n+\n+ tbiv_local = TBIV;\n+\n+ switch (tbiv_local) {\n+ case 0x0002: // CCR1 fires\n+ break;\n+ case 0x0004: // CCR2 fires\n+ if (sctimer_vars.cb!=NULL) {\n+ sctimer_vars.cb();\n+ // kick the OS\n+ return KICK_SCHEDULER;\n+ }\n+ break;\n+ case 0x0006: // CCR3 fires\n+ break;\n+ case 0x0008: // CCR4 fires\n+ break;\n+ case 0x000a: // CCR5 fires\n+ break;\n+ case 0x000c: // CCR6 fires\n+ break;\n+ case 0x000e: // timer overflow\n+ break;\n+ }\n+ return DO_NOT_KICK_SCHEDULER;\n+}\n" } ]
C
BSD 3-Clause New or Revised License
openwsn-berkeley/openwsn-fw
FW-635. add sctimer.c for gina.