mirror of
https://github.com/micropython/micropython.git
synced 2025-12-24 13:50:12 +01:00
Compare commits
2476 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1459a8d5c9 | ||
|
|
56bb6f3979 | ||
|
|
2b5a1067c0 | ||
|
|
3096928d5a | ||
|
|
520f35632d | ||
|
|
649b69a1db | ||
|
|
0e5e14fe7c | ||
|
|
a4c8a1ffe8 | ||
|
|
ec7fe92531 | ||
|
|
380561836d | ||
|
|
a22b6ebff1 | ||
|
|
e07ef8f1a2 | ||
|
|
426112ce88 | ||
|
|
d83177b248 | ||
|
|
e965d2b82a | ||
|
|
4cfe3e84b0 | ||
|
|
b8f45166c6 | ||
|
|
dec51e3519 | ||
|
|
686367dcfc | ||
|
|
417dc0c05d | ||
|
|
43241ceaac | ||
|
|
b09cd0e1ec | ||
|
|
737bd9c314 | ||
|
|
ae184cb9de | ||
|
|
c880f91ac0 | ||
|
|
03b0279c6d | ||
|
|
92a9078a6f | ||
|
|
749cbaca7f | ||
|
|
35962eaab0 | ||
|
|
d1b7ba5dc1 | ||
|
|
6a6e0b7e05 | ||
|
|
6907496016 | ||
|
|
f3636a7b46 | ||
|
|
b03df60f32 | ||
|
|
14b7c3e59c | ||
|
|
daa279a3a1 | ||
|
|
56845b6aff | ||
|
|
db80c0ed46 | ||
|
|
b9e3fde21a | ||
|
|
d862a7b811 | ||
|
|
842c2c74c0 | ||
|
|
469c623bb8 | ||
|
|
e098eac195 | ||
|
|
5b8e884573 | ||
|
|
1d5aa9d245 | ||
|
|
8b9ddf4031 | ||
|
|
63d05228a3 | ||
|
|
53562213c8 | ||
|
|
fa2ac93c3a | ||
|
|
757146efe3 | ||
|
|
17886828c8 | ||
|
|
3b0fbfe4e5 | ||
|
|
27241293c4 | ||
|
|
0455755296 | ||
|
|
77e37ff98b | ||
|
|
15e68277c1 | ||
|
|
5b7789d519 | ||
|
|
94238d4ae5 | ||
|
|
1df4168c33 | ||
|
|
c9520c591b | ||
|
|
df95f52583 | ||
|
|
eef4f13a33 | ||
|
|
9b1c1262dc | ||
|
|
5c0fc73f33 | ||
|
|
e90b6ce0b5 | ||
|
|
94d2919b77 | ||
|
|
c567afc5fa | ||
|
|
a1c93a62b1 | ||
|
|
4cec63a9db | ||
|
|
1f54ad2aed | ||
|
|
b7274e91bc | ||
|
|
2e4cdae4fd | ||
|
|
094a0dd11a | ||
|
|
c73cf9d931 | ||
|
|
f443504f86 | ||
|
|
f1dbd2909e | ||
|
|
c2508ac8bd | ||
|
|
3653f5144a | ||
|
|
dbd54e0b5b | ||
|
|
9172c0cb25 | ||
|
|
722cff5fd0 | ||
|
|
f1b6db2218 | ||
|
|
e33806aaff | ||
|
|
7f4658a7ee | ||
|
|
dcc7c5bd89 | ||
|
|
c93d9caa8b | ||
|
|
34fc006f5e | ||
|
|
801d1b3803 | ||
|
|
2dacd604c5 | ||
|
|
707f98f207 | ||
|
|
3eb7a26809 | ||
|
|
a791be936a | ||
|
|
27cc07721b | ||
|
|
330165a2cc | ||
|
|
3545ef8bb4 | ||
|
|
2d5ea38b49 | ||
|
|
ed36632c6c | ||
|
|
f2892bd77d | ||
|
|
ab8a5d5199 | ||
|
|
eb7637ba2e | ||
|
|
047ac2044d | ||
|
|
7ddd85f933 | ||
|
|
873853f1a8 | ||
|
|
4b9046328d | ||
|
|
0fb7a7a7ce | ||
|
|
2f7ebf16de | ||
|
|
d5835261af | ||
|
|
6b088a671a | ||
|
|
119b3dabf7 | ||
|
|
b2641b53e0 | ||
|
|
5071ceea07 | ||
|
|
c7fba524cb | ||
|
|
efee577318 | ||
|
|
e68811dbbf | ||
|
|
41167554e4 | ||
|
|
413c3e10b4 | ||
|
|
ad229477c6 | ||
|
|
3fecbb2462 | ||
|
|
2b6dcdd3e4 | ||
|
|
617e033e2f | ||
|
|
07209f8592 | ||
|
|
080137961d | ||
|
|
e9739e3315 | ||
|
|
cbffd0aadd | ||
|
|
e6e7e0e9c5 | ||
|
|
7c8d76fad3 | ||
|
|
c9598604c6 | ||
|
|
9b43a7d1be | ||
|
|
10e5e10393 | ||
|
|
6f8880d0ab | ||
|
|
70536212d5 | ||
|
|
ecfd8e102d | ||
|
|
df453f0652 | ||
|
|
332545baa3 | ||
|
|
23067a1422 | ||
|
|
d0416ff915 | ||
|
|
1babeb47a4 | ||
|
|
acaa30b604 | ||
|
|
f469c76442 | ||
|
|
b5190f1df3 | ||
|
|
230d5cda05 | ||
|
|
dcb904416a | ||
|
|
cd796f85af | ||
|
|
d402bf299d | ||
|
|
0f5bf1aafe | ||
|
|
422396cece | ||
|
|
a1eab98eaf | ||
|
|
337111ba9e | ||
|
|
06b783cf58 | ||
|
|
8072162170 | ||
|
|
51805e4a3a | ||
|
|
236838a9fc | ||
|
|
9f8b788fe5 | ||
|
|
deaf0712aa | ||
|
|
3131053e1a | ||
|
|
91031b60dc | ||
|
|
f6d01b8b67 | ||
|
|
9de5eb278d | ||
|
|
343b5c1081 | ||
|
|
79b40d1127 | ||
|
|
a0c296f6d5 | ||
|
|
1d3b903eb5 | ||
|
|
0cec4e9bb8 | ||
|
|
f1eb672d88 | ||
|
|
a384a53130 | ||
|
|
585aafc27e | ||
|
|
0d8c22b122 | ||
|
|
8171995ee9 | ||
|
|
e918fc5e37 | ||
|
|
bba77a2d01 | ||
|
|
7d7243f44c | ||
|
|
93968bd6fb | ||
|
|
0a4361ca67 | ||
|
|
0a4cc24b2e | ||
|
|
c8b7628094 | ||
|
|
2c5fc681c8 | ||
|
|
6e2fa5237d | ||
|
|
9b18811951 | ||
|
|
753a965363 | ||
|
|
9487b80666 | ||
|
|
b1533c4366 | ||
|
|
2bf6eb9fe2 | ||
|
|
ee12581a35 | ||
|
|
eb78a5c530 | ||
|
|
c8332a5463 | ||
|
|
0b913bd09f | ||
|
|
822e9ca8f3 | ||
|
|
a1a261d8e8 | ||
|
|
9b39263b11 | ||
|
|
97ce5d1d77 | ||
|
|
7d60a97914 | ||
|
|
3f6ca4b22c | ||
|
|
cafdfb7af3 | ||
|
|
1191ec6a14 | ||
|
|
43c8f545d2 | ||
|
|
ddadbaed06 | ||
|
|
1bc8aa85a4 | ||
|
|
993cc3611a | ||
|
|
d8cc51ea2b | ||
|
|
ed4e5d2583 | ||
|
|
0b9725812e | ||
|
|
e456b2cc94 | ||
|
|
09f764dc04 | ||
|
|
9a1a49ceec | ||
|
|
fdf45a718b | ||
|
|
c4ab8895e8 | ||
|
|
1a05a59116 | ||
|
|
927388e80e | ||
|
|
752e952096 | ||
|
|
4f3fbf09cc | ||
|
|
15eb1ce52d | ||
|
|
33168081f4 | ||
|
|
cff2b7a6e3 | ||
|
|
93a9c2e840 | ||
|
|
4940bee62a | ||
|
|
298c2ae2c7 | ||
|
|
641300dccb | ||
|
|
ee009d713a | ||
|
|
7d4fd8b6db | ||
|
|
225562d915 | ||
|
|
480159ca8b | ||
|
|
2503b59592 | ||
|
|
12401f337e | ||
|
|
f0eea1fdf9 | ||
|
|
ee5e3f6527 | ||
|
|
cac6c9704e | ||
|
|
f12146cbf6 | ||
|
|
602305b211 | ||
|
|
6707fc94ae | ||
|
|
84381fa0fc | ||
|
|
55df14f1a4 | ||
|
|
715ee9d925 | ||
|
|
282d81a40e | ||
|
|
4889b6ff9b | ||
|
|
e66b3042d6 | ||
|
|
6055d411a9 | ||
|
|
cbe544a76d | ||
|
|
2ec0ee082a | ||
|
|
7c004e794c | ||
|
|
751e3b7a82 | ||
|
|
74e6c0337d | ||
|
|
7ebfe09fbd | ||
|
|
45f3416816 | ||
|
|
48a7ef0576 | ||
|
|
4b37e775ea | ||
|
|
a3dc2c6031 | ||
|
|
9a368ae831 | ||
|
|
849eb835f0 | ||
|
|
99b14593a6 | ||
|
|
7e809b4baf | ||
|
|
68e222afdc | ||
|
|
20aa9c8511 | ||
|
|
f5d63bcd23 | ||
|
|
2ea019f3d3 | ||
|
|
37f9761801 | ||
|
|
9d04fec5d9 | ||
|
|
c76acd8c23 | ||
|
|
2b05b60bbc | ||
|
|
4681b86850 | ||
|
|
116eeee6db | ||
|
|
bc2ba6b2e3 | ||
|
|
eaecc4c02e | ||
|
|
ca41dc2750 | ||
|
|
2133924e46 | ||
|
|
202d5acd06 | ||
|
|
3e03d1b87e | ||
|
|
25a42fb6ef | ||
|
|
74fb4e795b | ||
|
|
9b4c013823 | ||
|
|
274952a117 | ||
|
|
3e33aeb0db | ||
|
|
bca4c9e465 | ||
|
|
cb7693bab4 | ||
|
|
9c2217a165 | ||
|
|
9dde6062cc | ||
|
|
6a60fb3cf4 | ||
|
|
53bac8e869 | ||
|
|
1b5abfcaae | ||
|
|
2c573f00b8 | ||
|
|
8a2970e136 | ||
|
|
daa4793578 | ||
|
|
fb742cdc12 | ||
|
|
b580958216 | ||
|
|
5a2a4e9452 | ||
|
|
0ab372585f | ||
|
|
3a29db8e58 | ||
|
|
ccf4e5ab7b | ||
|
|
497660fcda | ||
|
|
f9dc644017 | ||
|
|
3ff16ff52e | ||
|
|
a0a08b4be1 | ||
|
|
6fa60153ea | ||
|
|
7f7c84b10a | ||
|
|
92a342a011 | ||
|
|
418faae8f7 | ||
|
|
1e024de7be | ||
|
|
99b4719357 | ||
|
|
21ec1fd850 | ||
|
|
7327d5f6f7 | ||
|
|
a676a41cb7 | ||
|
|
afce978aca | ||
|
|
ca63c77073 | ||
|
|
7b1bf0c308 | ||
|
|
719f8c044a | ||
|
|
e53fb1bf03 | ||
|
|
2ae6697300 | ||
|
|
772c73fa16 | ||
|
|
ccb00b7724 | ||
|
|
87981fc517 | ||
|
|
5985e41afc | ||
|
|
1e2f829293 | ||
|
|
cc80c4dd59 | ||
|
|
1e388079f9 | ||
|
|
1dc2862a83 | ||
|
|
68a7a92cec | ||
|
|
9a8751b006 | ||
|
|
10503f3534 | ||
|
|
9a92499641 | ||
|
|
a314b842bb | ||
|
|
a896951a9a | ||
|
|
d45e5f8c35 | ||
|
|
47bf6ba61a | ||
|
|
0d6d315ba6 | ||
|
|
0055457b5f | ||
|
|
c9a7430dbe | ||
|
|
bc04dc277e | ||
|
|
3d7f3f00e0 | ||
|
|
80a8d473f6 | ||
|
|
9b4502b7e8 | ||
|
|
ce2d34d74f | ||
|
|
79a38a7a43 | ||
|
|
83a9a723b9 | ||
|
|
7e1f580910 | ||
|
|
4f2ba9fbdc | ||
|
|
5ab98d5c41 | ||
|
|
088127d91c | ||
|
|
e36ff98c80 | ||
|
|
596a3feb8f | ||
|
|
3f56fd64b8 | ||
|
|
d60cb8e180 | ||
|
|
f16bec6bc9 | ||
|
|
b924f649cd | ||
|
|
e89413e9b0 | ||
|
|
6f34e138f1 | ||
|
|
40f0096ee7 | ||
|
|
a1f2245a81 | ||
|
|
6de8dbb488 | ||
|
|
460b086333 | ||
|
|
de5e0ed2e0 | ||
|
|
65402ab1ec | ||
|
|
dc3faea040 | ||
|
|
d59c2e5e45 | ||
|
|
13a1acc7e2 | ||
|
|
c4587e2426 | ||
|
|
87106d025b | ||
|
|
c156e89379 | ||
|
|
9e47c145c7 | ||
|
|
470c429ee1 | ||
|
|
12dd8df375 | ||
|
|
2724bd4a94 | ||
|
|
cea1c621e0 | ||
|
|
bc7ca7ca01 | ||
|
|
13d06a83e1 | ||
|
|
0c86a9471a | ||
|
|
8db61e5b5a | ||
|
|
5ec11f565b | ||
|
|
88153dc56a | ||
|
|
cbbeb786d7 | ||
|
|
df2b1a4758 | ||
|
|
08d3d5d9ab | ||
|
|
770f169e63 | ||
|
|
05d1664981 | ||
|
|
0f846e563c | ||
|
|
7441ba7749 | ||
|
|
adaaf439b0 | ||
|
|
e64032d6fd | ||
|
|
eb54e4d065 | ||
|
|
2c2fc070ec | ||
|
|
56fd33a6dd | ||
|
|
c68c327310 | ||
|
|
1f396c58d9 | ||
|
|
fb5017f9dc | ||
|
|
496a601c3b | ||
|
|
f873a5005a | ||
|
|
5d05993f10 | ||
|
|
8af64bcf2b | ||
|
|
5036b6ad18 | ||
|
|
8e130fcf2b | ||
|
|
8a3e9036eb | ||
|
|
9df6b3a2c2 | ||
|
|
02fd83bcbc | ||
|
|
b539a61490 | ||
|
|
81a99eb388 | ||
|
|
bb6458bf43 | ||
|
|
db99ae00a2 | ||
|
|
06ec96b47b | ||
|
|
cfc94bec9f | ||
|
|
879bc4197a | ||
|
|
5e94f0b43a | ||
|
|
a6cf45864f | ||
|
|
35e63f0007 | ||
|
|
ae845f13de | ||
|
|
c2d885501f | ||
|
|
3944d3511f | ||
|
|
76c81cd5a6 | ||
|
|
2123ced3f4 | ||
|
|
3d830415bc | ||
|
|
7b7c99fec1 | ||
|
|
9215cdc7fd | ||
|
|
b8468d12a1 | ||
|
|
c6923f52f0 | ||
|
|
13d9d50fea | ||
|
|
bd9de5ec90 | ||
|
|
5302c3e8c4 | ||
|
|
a22aa53ef1 | ||
|
|
12144e8fcd | ||
|
|
0f682f1ee1 | ||
|
|
5aa4db0505 | ||
|
|
74c6363b97 | ||
|
|
566d8f1d7e | ||
|
|
c816b89353 | ||
|
|
8c35f3979c | ||
|
|
621c644205 | ||
|
|
9549590fc6 | ||
|
|
ddb9dba2f7 | ||
|
|
70ff7350e7 | ||
|
|
26fd0ac571 | ||
|
|
8ebdbcfb27 | ||
|
|
348caaf940 | ||
|
|
1f0dfe37a1 | ||
|
|
fd283eba64 | ||
|
|
e9b7610748 | ||
|
|
59603a2e89 | ||
|
|
4fb9452bff | ||
|
|
ad2889c141 | ||
|
|
8ad1659f68 | ||
|
|
7781caf8d3 | ||
|
|
c468fe65c5 | ||
|
|
a9ed42b3b4 | ||
|
|
6b6acc5b5d | ||
|
|
d46cd02d95 | ||
|
|
df06e34175 | ||
|
|
83e99f88cb | ||
|
|
613fd0a1ca | ||
|
|
9dd2c92d01 | ||
|
|
c1d1c562f3 | ||
|
|
962d5a987f | ||
|
|
006ffe1561 | ||
|
|
859e4e94f3 | ||
|
|
6ddd9f3e2b | ||
|
|
74f413bc60 | ||
|
|
d86d65f625 | ||
|
|
adae53d522 | ||
|
|
18775d3807 | ||
|
|
f8170db390 | ||
|
|
b0f3ae58e7 | ||
|
|
8811b0af9c | ||
|
|
12c61ddddd | ||
|
|
b3bc2ee1b9 | ||
|
|
473b639845 | ||
|
|
3f3ccef829 | ||
|
|
f41e1f1bb7 | ||
|
|
6514ff6160 | ||
|
|
25d0f7d59d | ||
|
|
22050a3ed0 | ||
|
|
b639ce27c7 | ||
|
|
c10d303e1b | ||
|
|
af554b4ba2 | ||
|
|
31fc81d3b8 | ||
|
|
193c62226c | ||
|
|
8fcfaf6f22 | ||
|
|
978a429aaa | ||
|
|
ba61480df5 | ||
|
|
2534bfdb92 | ||
|
|
348edad888 | ||
|
|
8c3b5526ae | ||
|
|
1f7cec944e | ||
|
|
38358a096d | ||
|
|
37d5aa1377 | ||
|
|
a6aa35af09 | ||
|
|
3c2e40b008 | ||
|
|
0ea2108f1c | ||
|
|
eff85bb1dc | ||
|
|
d54290f6e2 | ||
|
|
0785040593 | ||
|
|
941ddfe559 | ||
|
|
8ed3a9eb9c | ||
|
|
6d8156ae28 | ||
|
|
06deec9d35 | ||
|
|
50ef851bee | ||
|
|
1b45670c69 | ||
|
|
df4e1d1279 | ||
|
|
31300b5144 | ||
|
|
c564169c8f | ||
|
|
dc2c8f0b1a | ||
|
|
556e5dfd35 | ||
|
|
e0f7e001e8 | ||
|
|
648333d2d5 | ||
|
|
480c212009 | ||
|
|
351ec6d4ab | ||
|
|
f3f5e975e4 | ||
|
|
0df2ee0126 | ||
|
|
492bf12499 | ||
|
|
678f3a1e05 | ||
|
|
a119983328 | ||
|
|
88ed518390 | ||
|
|
8b8c32c09b | ||
|
|
6afd651f1e | ||
|
|
6149ce01f8 | ||
|
|
1c6d91d968 | ||
|
|
45ac5a85d5 | ||
|
|
a63542387d | ||
|
|
90b2cfe644 | ||
|
|
51cee4495e | ||
|
|
07615d9f7e | ||
|
|
23df4b08fb | ||
|
|
2bddfd4922 | ||
|
|
237c519ac4 | ||
|
|
650df97c06 | ||
|
|
ef2ffc0e4e | ||
|
|
c888831410 | ||
|
|
29c8c8aecb | ||
|
|
9264d42e2a | ||
|
|
b2b771ca02 | ||
|
|
7a012f4793 | ||
|
|
bababce6de | ||
|
|
6d103b6548 | ||
|
|
104aa26271 | ||
|
|
2b46da234c | ||
|
|
4296a8dc5c | ||
|
|
bd66b09512 | ||
|
|
8db4f363e9 | ||
|
|
7c40b15a3f | ||
|
|
0d10e5310a | ||
|
|
92497bff94 | ||
|
|
955b8526f4 | ||
|
|
71c6f93016 | ||
|
|
bbe5245028 | ||
|
|
3bc9b571bb | ||
|
|
5c8147528e | ||
|
|
d422e56631 | ||
|
|
eb40769613 | ||
|
|
51dca54cd0 | ||
|
|
b372156f74 | ||
|
|
67a6d31955 | ||
|
|
a2d5d84ecc | ||
|
|
624738ca64 | ||
|
|
109990fc32 | ||
|
|
fea40ad468 | ||
|
|
d4f4cb6a24 | ||
|
|
c4e26dd19a | ||
|
|
d46bea9ffa | ||
|
|
7652ab77ef | ||
|
|
495da15611 | ||
|
|
067fb2da14 | ||
|
|
dda1a41205 | ||
|
|
36d328e451 | ||
|
|
fcc9d43c6d | ||
|
|
32d7cf6e44 | ||
|
|
2a51f72ed1 | ||
|
|
f73d78394b | ||
|
|
4fa1731b6e | ||
|
|
cc1ef76f88 | ||
|
|
584406880c | ||
|
|
2494399a42 | ||
|
|
46f0641fba | ||
|
|
1b60a6dc4e | ||
|
|
8dd704b019 | ||
|
|
4494b521ea | ||
|
|
21ab304c41 | ||
|
|
0dc85c9f86 | ||
|
|
098f3e2862 | ||
|
|
270dd29320 | ||
|
|
c618f91e22 | ||
|
|
8aa3cbf153 | ||
|
|
97f88eebb6 | ||
|
|
8dcce92606 | ||
|
|
89e56a80b8 | ||
|
|
3a5a35aaec | ||
|
|
d76ebde85e | ||
|
|
89aa7157d0 | ||
|
|
7e5715a6d5 | ||
|
|
6f3b9933bd | ||
|
|
dde9abad16 | ||
|
|
7d57037906 | ||
|
|
67ece47121 | ||
|
|
50e4fa5e19 | ||
|
|
31480fb91b | ||
|
|
5e247a5192 | ||
|
|
31f5dc065a | ||
|
|
432465b167 | ||
|
|
aed1da913b | ||
|
|
53521152a8 | ||
|
|
8007f84cca | ||
|
|
b830f4c610 | ||
|
|
d49a547064 | ||
|
|
69f26c68c9 | ||
|
|
0b6e28c999 | ||
|
|
e943a407f2 | ||
|
|
d4c3349957 | ||
|
|
f4942db044 | ||
|
|
2ba6677775 | ||
|
|
040373e4c4 | ||
|
|
593ffdd976 | ||
|
|
73ccb3fc5b | ||
|
|
53e3770b15 | ||
|
|
000eae121c | ||
|
|
9a627e8881 | ||
|
|
61b560f63f | ||
|
|
d76c65f599 | ||
|
|
dbbf082786 | ||
|
|
050e645ef2 | ||
|
|
53ac7830cb | ||
|
|
2c883c5ab7 | ||
|
|
00137b8c11 | ||
|
|
5801967496 | ||
|
|
47f9b10b30 | ||
|
|
6c84f1e03a | ||
|
|
f474e956d7 | ||
|
|
b122ed0732 | ||
|
|
c3beb16db3 | ||
|
|
091dcaea2f | ||
|
|
bcd719ea3a | ||
|
|
7d2c685544 | ||
|
|
5c1af60e19 | ||
|
|
d3ab4bc7ca | ||
|
|
4f811d0e4c | ||
|
|
9b0714b24c | ||
|
|
272fad6d9c | ||
|
|
a649d72606 | ||
|
|
2243d68345 | ||
|
|
49bb04ee64 | ||
|
|
0c1de1cdee | ||
|
|
0a400a6333 | ||
|
|
df3b1741b6 | ||
|
|
674bf1bc81 | ||
|
|
d9d408135d | ||
|
|
a9a732af1f | ||
|
|
44ab5c3ef1 | ||
|
|
fef0d9818a | ||
|
|
f30b6f0af5 | ||
|
|
59a4fee516 | ||
|
|
733db525e2 | ||
|
|
f9448ddc2c | ||
|
|
0a2e9650f5 | ||
|
|
0699c6bf9e | ||
|
|
594fa73411 | ||
|
|
ed0c11236f | ||
|
|
6d24dc23b8 | ||
|
|
c2a519bab9 | ||
|
|
7f7e247545 | ||
|
|
6eb17c31a9 | ||
|
|
c33df193bf | ||
|
|
eacbd7aeba | ||
|
|
81ebba7e02 | ||
|
|
959ed931a4 | ||
|
|
19e3c9d53a | ||
|
|
54ea253f56 | ||
|
|
47442d9f52 | ||
|
|
22cbcd55f0 | ||
|
|
3177ef544f | ||
|
|
b67d098841 | ||
|
|
eec8a94f04 | ||
|
|
9314b2df4f | ||
|
|
73bc0c24ab | ||
|
|
e813ea1070 | ||
|
|
a525493e40 | ||
|
|
ac63ca7bc5 | ||
|
|
1a65ff1b72 | ||
|
|
67a327cb9b | ||
|
|
e4f963a351 | ||
|
|
69a1aaf654 | ||
|
|
d083712224 | ||
|
|
53ad681ed1 | ||
|
|
3a37426b29 | ||
|
|
260b839483 | ||
|
|
40f5ecd3a8 | ||
|
|
2f5935269b | ||
|
|
54b89665fc | ||
|
|
7acc252e93 | ||
|
|
6f3fc9bfa1 | ||
|
|
1a327c4fa3 | ||
|
|
f49d63a75c | ||
|
|
9b0a150bd6 | ||
|
|
f8fb4470a0 | ||
|
|
7063210014 | ||
|
|
1cc81ed449 | ||
|
|
c734de490a | ||
|
|
358e5d8bad | ||
|
|
657aef66ff | ||
|
|
6e87aeb841 | ||
|
|
b69f798c92 | ||
|
|
558fd5d228 | ||
|
|
6c3db26ab7 | ||
|
|
d6236e85c2 | ||
|
|
6837dba6b8 | ||
|
|
0c97e4c414 | ||
|
|
a45e280c58 | ||
|
|
f38e8f5217 | ||
|
|
5b1c221785 | ||
|
|
397b705647 | ||
|
|
7e9182f3aa | ||
|
|
b32b0d38fe | ||
|
|
20d9bc2d76 | ||
|
|
05ba2433f6 | ||
|
|
5e919b7ef8 | ||
|
|
9c04299da1 | ||
|
|
5e7fa7c80c | ||
|
|
8a8e775035 | ||
|
|
04d5e644fc | ||
|
|
2c915e1ae6 | ||
|
|
ce8b4e8749 | ||
|
|
2c407bcf20 | ||
|
|
d85439fd19 | ||
|
|
1a0a323ca8 | ||
|
|
4e51a3038c | ||
|
|
96eca22322 | ||
|
|
e6a4d4e23c | ||
|
|
e4cb7c6158 | ||
|
|
2c8356c482 | ||
|
|
f81ea6307c | ||
|
|
de12502d89 | ||
|
|
81fd5685fc | ||
|
|
1b811b946e | ||
|
|
069654f2be | ||
|
|
cee888255b | ||
|
|
28d4b94dce | ||
|
|
69b702276b | ||
|
|
e24674d44e | ||
|
|
69256ac0b1 | ||
|
|
debbaac1bd | ||
|
|
919b70b7ec | ||
|
|
8d2bcaf3cd | ||
|
|
9698a60591 | ||
|
|
fcd6862597 | ||
|
|
ef0c5db2ed | ||
|
|
254a5646c1 | ||
|
|
333a63efaa | ||
|
|
4f2d59e82f | ||
|
|
ec5f8db49d | ||
|
|
c07a03a36d | ||
|
|
aa3fb7b387 | ||
|
|
fd2b71f972 | ||
|
|
a5d07c3aba | ||
|
|
a5d2af7949 | ||
|
|
e5fa163a4c | ||
|
|
a0cb4eda9a | ||
|
|
cef073877b | ||
|
|
cf4b72bf13 | ||
|
|
b475327ffa | ||
|
|
6a051a8e0b | ||
|
|
fb6cc96951 | ||
|
|
fc4c43a72e | ||
|
|
785cf9a61f | ||
|
|
777232c9a5 | ||
|
|
3d4a535208 | ||
|
|
5531437941 | ||
|
|
4b597a1c1a | ||
|
|
98af891610 | ||
|
|
61fa7c8152 | ||
|
|
2e75a17bab | ||
|
|
b1dfdaf6cb | ||
|
|
f50d9477c1 | ||
|
|
d7019d0628 | ||
|
|
9475cc59e6 | ||
|
|
2599672384 | ||
|
|
e1e7657277 | ||
|
|
03b8bb7ec9 | ||
|
|
d88250c06e | ||
|
|
c4506ed869 | ||
|
|
402a743821 | ||
|
|
8fc5e56a6a | ||
|
|
c961889e34 | ||
|
|
6ca17c1922 | ||
|
|
b4070ee8a4 | ||
|
|
2f02302e22 | ||
|
|
193795398d | ||
|
|
71d40f132d | ||
|
|
9edd736ee6 | ||
|
|
e8e116e7fc | ||
|
|
8b08a0d9ed | ||
|
|
61230e007d | ||
|
|
b01a373adb | ||
|
|
cd6194aefc | ||
|
|
374654f2b8 | ||
|
|
fe9bc0c573 | ||
|
|
bbc65d4eda | ||
|
|
fd86bf5917 | ||
|
|
53302f1616 | ||
|
|
651a188299 | ||
|
|
13394a632d | ||
|
|
53ad5edc01 | ||
|
|
87c783b454 | ||
|
|
679fe0abae | ||
|
|
eda8746324 | ||
|
|
935e021250 | ||
|
|
c33a76059f | ||
|
|
3962766be0 | ||
|
|
b62beadae0 | ||
|
|
f71c0699a5 | ||
|
|
9c7e3353e5 | ||
|
|
ba640bde55 | ||
|
|
632d8efa05 | ||
|
|
82b95f625e | ||
|
|
91031a75a1 | ||
|
|
4332d72fd8 | ||
|
|
de0c84ebf1 | ||
|
|
5e75f335e6 | ||
|
|
0cb10b5220 | ||
|
|
159f1aaca8 | ||
|
|
e589cddcd4 | ||
|
|
6e6488530e | ||
|
|
4b5606bc09 | ||
|
|
ee6fcc6f91 | ||
|
|
96a644076d | ||
|
|
8f1854ad2d | ||
|
|
ac671546d1 | ||
|
|
88f60de914 | ||
|
|
2c81b9be28 | ||
|
|
063e6e7d0a | ||
|
|
5d93dfbc2c | ||
|
|
3dbd2ee926 | ||
|
|
4a02a8f74d | ||
|
|
24342dd65e | ||
|
|
d4c8e626f2 | ||
|
|
a5d48b1162 | ||
|
|
78d0dde562 | ||
|
|
0cdbd356fd | ||
|
|
5b9f361824 | ||
|
|
667d64b430 | ||
|
|
dd32f02cc3 | ||
|
|
7059c8c23c | ||
|
|
a1d072df81 | ||
|
|
df1f6783f2 | ||
|
|
494aea3e86 | ||
|
|
5bc9398d9d | ||
|
|
8000d51b68 | ||
|
|
1a0adf49df | ||
|
|
e673714cfe | ||
|
|
58e2ad42ae | ||
|
|
b894551772 | ||
|
|
da161fd9f0 | ||
|
|
12154b1774 | ||
|
|
8d4d6731f5 | ||
|
|
2b302dad51 | ||
|
|
6d5a549067 | ||
|
|
b8133c4c0f | ||
|
|
4a6cac4643 | ||
|
|
99146ea444 | ||
|
|
556a1df6fd | ||
|
|
9d7b871f58 | ||
|
|
2466cb67f8 | ||
|
|
3acaa28b52 | ||
|
|
52e062ef33 | ||
|
|
664f03f466 | ||
|
|
9a58316de2 | ||
|
|
be989be861 | ||
|
|
1ded19d4b3 | ||
|
|
157056ecdf | ||
|
|
ab69ed7dac | ||
|
|
9996adc37d | ||
|
|
cea6cf8a5e | ||
|
|
0d1f8868b6 | ||
|
|
77f85db41e | ||
|
|
06b398489e | ||
|
|
0be6359f39 | ||
|
|
2a1cca20b1 | ||
|
|
e7cd1699df | ||
|
|
dddb98db8b | ||
|
|
99fc0d120a | ||
|
|
00f921ce02 | ||
|
|
031fadd10e | ||
|
|
e5c39a3a9e | ||
|
|
0779409d0d | ||
|
|
ba8f7d5171 | ||
|
|
09ed5bcbbb | ||
|
|
21b74604f9 | ||
|
|
85d3b6165a | ||
|
|
70f32f0f73 | ||
|
|
3d0e3a3d3e | ||
|
|
932f07ccf5 | ||
|
|
4c2cb7e384 | ||
|
|
6e5c31c947 | ||
|
|
a099bfe89c | ||
|
|
e5b047369b | ||
|
|
54fc247f9b | ||
|
|
97375f4576 | ||
|
|
7261f17b9e | ||
|
|
97c2628900 | ||
|
|
9ae51257bd | ||
|
|
5239a8a82b | ||
|
|
a49c16069c | ||
|
|
d5a12a6608 | ||
|
|
1c43a0fbf8 | ||
|
|
7378c50b2f | ||
|
|
9e8396accb | ||
|
|
9b5e05a7c7 | ||
|
|
ad725a6661 | ||
|
|
853fb08d0d | ||
|
|
07554486ee | ||
|
|
6b80ebe32e | ||
|
|
42ef5a1567 | ||
|
|
5b74bba3a3 | ||
|
|
4b6077b3fe | ||
|
|
43d497592f | ||
|
|
fda874e406 | ||
|
|
7379be3673 | ||
|
|
4f64f6bfd3 | ||
|
|
6d2e9e70b3 | ||
|
|
6185dc5f3d | ||
|
|
f1919b7c98 | ||
|
|
c7fb87caff | ||
|
|
f7be80398e | ||
|
|
809fbeefb7 | ||
|
|
dcdf8f2d14 | ||
|
|
bb293e6bcf | ||
|
|
2c72ae5c29 | ||
|
|
f0e2d13fd2 | ||
|
|
ed593780bf | ||
|
|
a0cd118b14 | ||
|
|
f8d42da104 | ||
|
|
3fbbbecec9 | ||
|
|
04a9ac7f38 | ||
|
|
d684f872bd | ||
|
|
05dda0ee9e | ||
|
|
88b0490945 | ||
|
|
4f0080346b | ||
|
|
484a471f9b | ||
|
|
367c084c4b | ||
|
|
0edfb7a115 | ||
|
|
d964873e56 | ||
|
|
ce3beb1672 | ||
|
|
b86c20676e | ||
|
|
db984b73f3 | ||
|
|
1d5d4f49d9 | ||
|
|
419bb26ddc | ||
|
|
d973c1bc12 | ||
|
|
50e0a7b9d4 | ||
|
|
fbb3c190f9 | ||
|
|
14848ffa12 | ||
|
|
52d7685d9a | ||
|
|
d9d4a72679 | ||
|
|
d3a4d39687 | ||
|
|
077448328a | ||
|
|
26f0616e8f | ||
|
|
eb247eacd8 | ||
|
|
342d903a13 | ||
|
|
cdad2b6f4d | ||
|
|
8ab16b6af0 | ||
|
|
c70637bc00 | ||
|
|
98b727c931 | ||
|
|
f22a4f8e0a | ||
|
|
f39bcb304b | ||
|
|
7193086c03 | ||
|
|
4284b3811f | ||
|
|
5d7c408ba8 | ||
|
|
6abafca1aa | ||
|
|
a4c8ef9d16 | ||
|
|
57884996b9 | ||
|
|
b41a14a4b9 | ||
|
|
f70873db23 | ||
|
|
7480ee5892 | ||
|
|
70fb9ee99b | ||
|
|
2382d30318 | ||
|
|
259f1344ca | ||
|
|
ff69a1d27d | ||
|
|
65405247a0 | ||
|
|
3aa0f2eed3 | ||
|
|
453a2a3d7c | ||
|
|
701c4152c1 | ||
|
|
02ea74d8f5 | ||
|
|
1febaf3ac3 | ||
|
|
d083d7d610 | ||
|
|
6f4357c28e | ||
|
|
6d0629bddc | ||
|
|
ecd1272d16 | ||
|
|
3d1d92acfc | ||
|
|
6bb9d3ea3e | ||
|
|
dc320164d8 | ||
|
|
4f72aa86bf | ||
|
|
2740dd85f2 | ||
|
|
e0821830b0 | ||
|
|
09e363316f | ||
|
|
9fb36af9af | ||
|
|
08fed6992f | ||
|
|
6ef65e70af | ||
|
|
eaa96a7610 | ||
|
|
bbe832a0b2 | ||
|
|
6f469209e9 | ||
|
|
57425b648f | ||
|
|
19749db7bf | ||
|
|
9c081b740b | ||
|
|
cd6d189f48 | ||
|
|
8a18084571 | ||
|
|
ac23662550 | ||
|
|
476c15290d | ||
|
|
56f76b873a | ||
|
|
ea23520403 | ||
|
|
57b96a7be2 | ||
|
|
8e1fdf2eb3 | ||
|
|
28adab36c7 | ||
|
|
e9d1a94bf0 | ||
|
|
d6c558c0aa | ||
|
|
add930c4b5 | ||
|
|
12547ce737 | ||
|
|
cc7a4d7db2 | ||
|
|
5148860332 | ||
|
|
495e7cfebc | ||
|
|
f5248a087a | ||
|
|
0d210a0be8 | ||
|
|
fe9620a2bd | ||
|
|
73c9f85b4c | ||
|
|
562bcffd3a | ||
|
|
ed8db2e371 | ||
|
|
53fec1ef48 | ||
|
|
40d8430ee3 | ||
|
|
69d9e7d27d | ||
|
|
dfc35afba1 | ||
|
|
6cee869feb | ||
|
|
ec37239e53 | ||
|
|
4b2938a4b0 | ||
|
|
9598f36a84 | ||
|
|
94e4bd456f | ||
|
|
46fc7a3d75 | ||
|
|
4cd45f48b1 | ||
|
|
46a0ac02c5 | ||
|
|
6b0c88256b | ||
|
|
8cb78e0e53 | ||
|
|
72085a669b | ||
|
|
9fdac9144d | ||
|
|
9d0525182d | ||
|
|
9e0478a902 | ||
|
|
0ee1d0f407 | ||
|
|
e3c66a5a67 | ||
|
|
baf47c84c4 | ||
|
|
1bb15ca427 | ||
|
|
8a43a41b3a | ||
|
|
e9be6a378c | ||
|
|
dc3eb55e6a | ||
|
|
e5cff5b223 | ||
|
|
c38809e26b | ||
|
|
609a9c6b71 | ||
|
|
bf904b238d | ||
|
|
d4315a6caf | ||
|
|
2850e7cd97 | ||
|
|
dc587a3623 | ||
|
|
a2e39a756c | ||
|
|
32b7e93535 | ||
|
|
f791e14750 | ||
|
|
38ac23c942 | ||
|
|
7bb501ef9f | ||
|
|
e372e83b30 | ||
|
|
b33a770596 | ||
|
|
34023eb673 | ||
|
|
0e0ce47e65 | ||
|
|
3770cd2e70 | ||
|
|
f7e5e677df | ||
|
|
3a042fb921 | ||
|
|
a888d5ab91 | ||
|
|
13a4c120ce | ||
|
|
c33ad60a67 | ||
|
|
3846fd56c1 | ||
|
|
5b85a86ce3 | ||
|
|
a2e5e4c3d8 | ||
|
|
3e02b1d19a | ||
|
|
9e78ab4b86 | ||
|
|
814b1ae3a9 | ||
|
|
81407729a5 | ||
|
|
96688de601 | ||
|
|
ab0e36b3da | ||
|
|
350ab0f570 | ||
|
|
103fbaaf27 | ||
|
|
5bf6eba845 | ||
|
|
a63a4761cd | ||
|
|
71206f02c3 | ||
|
|
97a0846af9 | ||
|
|
ff1a96ce2c | ||
|
|
2e2e15cec2 | ||
|
|
5f3e005b67 | ||
|
|
086d98cbde | ||
|
|
87e07ea943 | ||
|
|
e3a29de1dc | ||
|
|
2bd758fe96 | ||
|
|
67e8108345 | ||
|
|
93bb7dffd2 | ||
|
|
9e677114e4 | ||
|
|
331a48195d | ||
|
|
ef5f2669dc | ||
|
|
db573082b5 | ||
|
|
ea040a4f9a | ||
|
|
3cfb15cf4d | ||
|
|
0f87a010e3 | ||
|
|
a8a4b01af6 | ||
|
|
ea89b80ff4 | ||
|
|
d363133917 | ||
|
|
7417ccfb0d | ||
|
|
d3b1f0b627 | ||
|
|
850212203a | ||
|
|
6a804cbaba | ||
|
|
7b05b1b225 | ||
|
|
ac37e0fd1f | ||
|
|
8f54c08691 | ||
|
|
3d42aa07dd | ||
|
|
ac11e89fa3 | ||
|
|
e713222fab | ||
|
|
0ae97f531d | ||
|
|
d22bdad6dd | ||
|
|
a53af6c875 | ||
|
|
f5c42dd9d1 | ||
|
|
ee1656e148 | ||
|
|
df4ce930e3 | ||
|
|
42a6364a31 | ||
|
|
6c8b3a7fee | ||
|
|
cb4fbc8861 | ||
|
|
f22844b4e5 | ||
|
|
a17755ee8b | ||
|
|
ac16cc9a35 | ||
|
|
ea495d6aa6 | ||
|
|
a58a91eb04 | ||
|
|
e7bee6b35e | ||
|
|
31dd312f83 | ||
|
|
55ad083061 | ||
|
|
aeadda4eac | ||
|
|
d8b08cf5fc | ||
|
|
ff133cdb07 | ||
|
|
f8ba2eca80 | ||
|
|
dea585f8ae | ||
|
|
c13b2f2d00 | ||
|
|
22d85ec5be | ||
|
|
8bb4931fec | ||
|
|
efc971e8f9 | ||
|
|
c9845a0685 | ||
|
|
11b97d7ec5 | ||
|
|
5b3f0b7f39 | ||
|
|
4b72b3a133 | ||
|
|
a0c97814df | ||
|
|
66d0c1052a | ||
|
|
8175877ad6 | ||
|
|
fe6756aa2d | ||
|
|
bae052d420 | ||
|
|
3b936a5f4c | ||
|
|
da3dffa79d | ||
|
|
2adf7ec3dd | ||
|
|
b1fa907d56 | ||
|
|
978d2e55ef | ||
|
|
c1c57eafac | ||
|
|
1fa6be5264 | ||
|
|
7dbf74c5b9 | ||
|
|
1404d620c0 | ||
|
|
adfe4ff72a | ||
|
|
54729247e1 | ||
|
|
dd0a0f79d7 | ||
|
|
daa1a455c6 | ||
|
|
2621f8a340 | ||
|
|
ea8be373a9 | ||
|
|
47dc5922ca | ||
|
|
22b2265053 | ||
|
|
d6b31e4578 | ||
|
|
93b3726240 | ||
|
|
67f40fb237 | ||
|
|
1d191fdf03 | ||
|
|
43cab7c283 | ||
|
|
d4df8f4925 | ||
|
|
824f83fd20 | ||
|
|
275a0f25d3 | ||
|
|
ee7b8f32e3 | ||
|
|
3c014a67ea | ||
|
|
7281d95aee | ||
|
|
b50030b1d0 | ||
|
|
26ed00118b | ||
|
|
8212d97317 | ||
|
|
17f324b836 | ||
|
|
1b0aab621b | ||
|
|
3d2daa2d03 | ||
|
|
ae4865efa1 | ||
|
|
09630e48ce | ||
|
|
98f7729848 | ||
|
|
8fa9264430 | ||
|
|
467504da01 | ||
|
|
30b7344eb0 | ||
|
|
00ee84e1e1 | ||
|
|
9bbfd5efd4 | ||
|
|
ddea7cb702 | ||
|
|
0992588811 | ||
|
|
ed584e2ffd | ||
|
|
64ececb72f | ||
|
|
8c936edeb2 | ||
|
|
6dde019d93 | ||
|
|
4bd95f8b44 | ||
|
|
521759ee18 | ||
|
|
fb7b715b7b | ||
|
|
bc25545fbb | ||
|
|
722fb2d251 | ||
|
|
43fecb0acb | ||
|
|
fff2dd2627 | ||
|
|
a63d4a6cc2 | ||
|
|
0dce9a21ce | ||
|
|
1e06e81b3d | ||
|
|
2c1620ce1f | ||
|
|
3ea03a1188 | ||
|
|
fce0036a67 | ||
|
|
1aa4599ddd | ||
|
|
bbe8d51bd9 | ||
|
|
e5ce5e2a43 | ||
|
|
78913211a9 | ||
|
|
84b245f187 | ||
|
|
7203b58e87 | ||
|
|
b4c65c253f | ||
|
|
7ce8860b6b | ||
|
|
8047340d75 | ||
|
|
117158fcd5 | ||
|
|
1c9210bc2b | ||
|
|
e9751d2ac0 | ||
|
|
401af50dc0 | ||
|
|
abd0fcfc86 | ||
|
|
e13d462f77 | ||
|
|
a5aa03acaf | ||
|
|
1b7f622410 | ||
|
|
664bc44f30 | ||
|
|
d50f649cf8 | ||
|
|
ef63ab5724 | ||
|
|
0a4eb4dbf2 | ||
|
|
b61336483b | ||
|
|
d0f31ccf33 | ||
|
|
da199e4407 | ||
|
|
fe03e7bcb7 | ||
|
|
a67651406d | ||
|
|
0e1b5faad5 | ||
|
|
c5f52b845b | ||
|
|
755b01439b | ||
|
|
acaccb37ec | ||
|
|
dd5353a405 | ||
|
|
ab8012bd80 | ||
|
|
a83124361e | ||
|
|
2eb844e0b4 | ||
|
|
2195046365 | ||
|
|
5efd3f0dca | ||
|
|
3c2b377711 | ||
|
|
2fe7e6bef0 | ||
|
|
3db2b23060 | ||
|
|
02fa8dff85 | ||
|
|
831137b807 | ||
|
|
16a6a47a7b | ||
|
|
6e2fb56d40 | ||
|
|
257848587f | ||
|
|
1d899e1783 | ||
|
|
7a30e87d2b | ||
|
|
ab1e36dcf9 | ||
|
|
d977d268e8 | ||
|
|
f7782f8082 | ||
|
|
969e4bbe6a | ||
|
|
3911d5af32 | ||
|
|
67a5bfc6d8 | ||
|
|
0d7de08e06 | ||
|
|
64a909ef51 | ||
|
|
a1528364b3 | ||
|
|
3386477b29 | ||
|
|
be3ae9d13c | ||
|
|
c5d8ffef58 | ||
|
|
130fde8130 | ||
|
|
951fc7e993 | ||
|
|
d874702fe1 | ||
|
|
1a1cceaf6f | ||
|
|
8fb255dc34 | ||
|
|
2d11b17419 | ||
|
|
f925165942 | ||
|
|
f2ed736b29 | ||
|
|
36ccdc952c | ||
|
|
17298af61e | ||
|
|
f7c4f9a640 | ||
|
|
29e9db0c58 | ||
|
|
bb7f5b5501 | ||
|
|
a6eff059b9 | ||
|
|
967ceba5b7 | ||
|
|
c1481bb0ab | ||
|
|
4651c4381e | ||
|
|
de2a2e296b | ||
|
|
bdbe8c9ae2 | ||
|
|
e242b1785f | ||
|
|
1f0aaece3a | ||
|
|
645045a799 | ||
|
|
d288ae8eb9 | ||
|
|
ce936edf62 | ||
|
|
d4a874b81e | ||
|
|
5a4a2b1db3 | ||
|
|
e84325bd1d | ||
|
|
f54a96d6a2 | ||
|
|
3ff259a262 | ||
|
|
1be0fde45c | ||
|
|
0891cf7d2d | ||
|
|
33ac0fd09f | ||
|
|
bbe2e22fcb | ||
|
|
f4fcc14cfb | ||
|
|
946f870e3c | ||
|
|
3a309d93b1 | ||
|
|
9f001b09a8 | ||
|
|
55995869e5 | ||
|
|
f380904bd9 | ||
|
|
36c6d2fa7d | ||
|
|
e23d5a64cf | ||
|
|
c6ee273410 | ||
|
|
354e688d8e | ||
|
|
acc208418b | ||
|
|
2b7236d249 | ||
|
|
519cef813e | ||
|
|
cbc489dff5 | ||
|
|
eed2f36ae2 | ||
|
|
082b12128d | ||
|
|
f2d532c404 | ||
|
|
c03dd3b2f9 | ||
|
|
54a1d9ecb7 | ||
|
|
1a1d11fa32 | ||
|
|
5ae3ddcc9a | ||
|
|
66b96822fb | ||
|
|
9aaf888b42 | ||
|
|
dd7d2e0810 | ||
|
|
f7697ff393 | ||
|
|
f4c17378b3 | ||
|
|
95c9cc8114 | ||
|
|
add6f4556e | ||
|
|
7a99639cff | ||
|
|
b4eccfd02d | ||
|
|
30d0cf4885 | ||
|
|
75feece208 | ||
|
|
0077958ad0 | ||
|
|
d735278c9f | ||
|
|
e9a684d741 | ||
|
|
e042f485ed | ||
|
|
3376875bc8 | ||
|
|
0d9b450701 | ||
|
|
f99491cbf7 | ||
|
|
bd33aa313e | ||
|
|
5d8164167e | ||
|
|
b8cfb0d7b2 | ||
|
|
999cedb90f | ||
|
|
cbf7674025 | ||
|
|
94fe6e523d | ||
|
|
254cfa6c31 | ||
|
|
9f6976b74e | ||
|
|
278f3592d4 | ||
|
|
5d66b427e2 | ||
|
|
c3f64d9799 | ||
|
|
4e7107a572 | ||
|
|
fad7d9317b | ||
|
|
0bb57bf5bf | ||
|
|
9d0d6d3830 | ||
|
|
698a6a9d7d | ||
|
|
19920e25f9 | ||
|
|
0786716c5a | ||
|
|
7a5a4fe271 | ||
|
|
88a9103b3c | ||
|
|
3048433809 | ||
|
|
61e85a8ce0 | ||
|
|
061eb6fa6b | ||
|
|
7dec35d7cc | ||
|
|
364bb61df3 | ||
|
|
8844d031e4 | ||
|
|
f32020ef3d | ||
|
|
f0fbab7ca7 | ||
|
|
3a1bbcc2ef | ||
|
|
c8437f97ae | ||
|
|
90202b4c0d | ||
|
|
ff8c4188f4 | ||
|
|
65888e2006 | ||
|
|
36bd10779c | ||
|
|
e99e6c883d | ||
|
|
3cfb02f166 | ||
|
|
18820471ae | ||
|
|
22bd23114a | ||
|
|
9936aa3f87 | ||
|
|
522d454e34 | ||
|
|
3baf6b5319 | ||
|
|
a58fa27c24 | ||
|
|
bf1570cb25 | ||
|
|
6edffd0df5 | ||
|
|
b677f03407 | ||
|
|
9f5486c7e2 | ||
|
|
056abbcf31 | ||
|
|
86aa16bea6 | ||
|
|
4dea24e105 | ||
|
|
4892e4c5fc | ||
|
|
9a56912ad1 | ||
|
|
0e3f29cc99 | ||
|
|
a8aa1998ce | ||
|
|
44e6e348d6 | ||
|
|
39a8deb95f | ||
|
|
9f10d3fb63 | ||
|
|
4120f32292 | ||
|
|
b3be4710aa | ||
|
|
b56c635d64 | ||
|
|
3d6240ba1b | ||
|
|
3c4c069802 | ||
|
|
b64e0575fd | ||
|
|
9aaccd4735 | ||
|
|
1818da2ef3 | ||
|
|
8ee43e24f3 | ||
|
|
c3280d83e7 | ||
|
|
ede1f547e7 | ||
|
|
295ea12411 | ||
|
|
72bd172b30 | ||
|
|
3ba61656bd | ||
|
|
2ae7ced721 | ||
|
|
acb743da64 | ||
|
|
83229d3ffe | ||
|
|
54df549b5f | ||
|
|
b5b1f2c527 | ||
|
|
f148727b78 | ||
|
|
d4dba88236 | ||
|
|
f5c554dfe3 | ||
|
|
593faf14c4 | ||
|
|
db0a5aed39 | ||
|
|
efc4da4be9 | ||
|
|
426f326d35 | ||
|
|
9142179f81 | ||
|
|
7080e9632c | ||
|
|
00960133c2 | ||
|
|
f3308daa6f | ||
|
|
994ff738c8 | ||
|
|
a24eafacc9 | ||
|
|
2c83894257 | ||
|
|
cbd9ae5256 | ||
|
|
e4404fbef0 | ||
|
|
65971f5160 | ||
|
|
79c4ec1102 | ||
|
|
f8bc3f6964 | ||
|
|
3862ef9a9f | ||
|
|
ec314c951d | ||
|
|
16d42368a6 | ||
|
|
908f5159cf | ||
|
|
5be60d6929 | ||
|
|
863d4cd862 | ||
|
|
0d6116d86b | ||
|
|
0aff87b808 | ||
|
|
27dafa5ed5 | ||
|
|
d8557834c0 | ||
|
|
a01f6c9ae7 | ||
|
|
66fd3e4a7b | ||
|
|
3a6b3d230c | ||
|
|
94f9330d3e | ||
|
|
6d1eabfeaa | ||
|
|
432e8275a9 | ||
|
|
d8c834c95d | ||
|
|
c8e9c0d89a | ||
|
|
713ea1800d | ||
|
|
3a3db4dcf0 | ||
|
|
9b7f583b0c | ||
|
|
f882d53fcd | ||
|
|
772f0b4159 | ||
|
|
3c7e1b80ac | ||
|
|
3551368424 | ||
|
|
73ff0687f2 | ||
|
|
b1dbbd32eb | ||
|
|
1b9d161f94 | ||
|
|
549c79d11e | ||
|
|
746b752b8e | ||
|
|
1f92ffb5b7 | ||
|
|
723d598d32 | ||
|
|
40274fec9c | ||
|
|
50f56227c6 | ||
|
|
c27e5c4b0b | ||
|
|
748509a93c | ||
|
|
34472302d6 | ||
|
|
6e68a68d18 | ||
|
|
57e00ef262 | ||
|
|
7f3c0d1ea8 | ||
|
|
41b688e25f | ||
|
|
89f2ddd2d0 | ||
|
|
b7ca945877 | ||
|
|
e6dccaf18e | ||
|
|
ae58035573 | ||
|
|
8b8d189bc0 | ||
|
|
8f7ff854b0 | ||
|
|
8bfa11b138 | ||
|
|
8cee03b118 | ||
|
|
1673e19cb9 | ||
|
|
af3e45419c | ||
|
|
53ea2b5ce2 | ||
|
|
074d713bfb | ||
|
|
a9f3030371 | ||
|
|
98fb0bf68a | ||
|
|
040f6f6711 | ||
|
|
1bfa6ae6e4 | ||
|
|
dde0c204e7 | ||
|
|
c76fe77f42 | ||
|
|
35e7d9c0f1 | ||
|
|
06f70973f7 | ||
|
|
32b3549cce | ||
|
|
056cb288d9 | ||
|
|
f67d06194f | ||
|
|
d0601b0a1f | ||
|
|
aeadf7607d | ||
|
|
aee704ebe1 | ||
|
|
7cce2f664c | ||
|
|
000a12783c | ||
|
|
4deb4936d5 | ||
|
|
0ec51441de | ||
|
|
731f359292 | ||
|
|
0bd3f3291d | ||
|
|
2b080cf599 | ||
|
|
f705cb5f7a | ||
|
|
24b03561bd | ||
|
|
bd9f850e85 | ||
|
|
d6201fc4b7 | ||
|
|
165734522e | ||
|
|
3833d3846d | ||
|
|
43efb46328 | ||
|
|
c6bc5b69c2 | ||
|
|
3819634469 | ||
|
|
b83d0b35e9 | ||
|
|
823a961ecc | ||
|
|
3510499a9e | ||
|
|
17c649da3d | ||
|
|
6f70283909 | ||
|
|
98b6d35c4f | ||
|
|
9b12bc788f | ||
|
|
19b671c5cd | ||
|
|
f4decdc4a3 | ||
|
|
eb099b9893 | ||
|
|
4a9eac20b9 | ||
|
|
6a09e7d7ae | ||
|
|
04fa999cfe | ||
|
|
ebd9f550e8 | ||
|
|
5699fc9d0e | ||
|
|
a2e0d92eeb | ||
|
|
f3b1a933fc | ||
|
|
a0fb7a76cd | ||
|
|
20f85feecc | ||
|
|
404dae80a9 | ||
|
|
9011815d86 | ||
|
|
858ed6d2f7 | ||
|
|
fa87e90cfa | ||
|
|
76217064ac | ||
|
|
a13d22f921 | ||
|
|
1950295735 | ||
|
|
e0d7740a22 | ||
|
|
f3e46d0c52 | ||
|
|
12fab63928 | ||
|
|
dc93f25bb8 | ||
|
|
393d0c1679 | ||
|
|
79f404a287 | ||
|
|
8e8aac89a5 | ||
|
|
c773053f58 | ||
|
|
a654914de4 | ||
|
|
359a8aa760 | ||
|
|
a3a33db409 | ||
|
|
ca9eb81d0b | ||
|
|
1c55310bcc | ||
|
|
b7ab70c71c | ||
|
|
cf6daa0966 | ||
|
|
4a9c60cdfb | ||
|
|
81a1e17238 | ||
|
|
0dbd928cee | ||
|
|
9a334d41e3 | ||
|
|
805c6534f8 | ||
|
|
22cb7cd953 | ||
|
|
91f2168dd5 | ||
|
|
ee7bebc94f | ||
|
|
4efed58df1 | ||
|
|
0212dc65b7 | ||
|
|
9ebd4dabf2 | ||
|
|
9273cca432 | ||
|
|
126373ac70 | ||
|
|
e954604ae0 | ||
|
|
fe08e3a54f | ||
|
|
8fd8bb36b3 | ||
|
|
3b24e83731 | ||
|
|
bb489066e8 | ||
|
|
109b363ddc | ||
|
|
075ca64521 | ||
|
|
be2879ce89 | ||
|
|
ee0058d174 | ||
|
|
1f2daf4304 | ||
|
|
1c7f9b16f0 | ||
|
|
ceb169008d | ||
|
|
04db848dc7 | ||
|
|
4b630c452d | ||
|
|
719dca2515 | ||
|
|
d67ea6b29f | ||
|
|
7ff585333e | ||
|
|
9a507c67ad | ||
|
|
9d7ef05caf | ||
|
|
e693e52442 | ||
|
|
9d0192de4a | ||
|
|
f09f8097d5 | ||
|
|
d19e4f0ba4 | ||
|
|
f961456b29 | ||
|
|
22521ea9e2 | ||
|
|
04353cc85e | ||
|
|
183edefddd | ||
|
|
aedb859177 | ||
|
|
7e359c648b | ||
|
|
aaef1851a7 | ||
|
|
60401d461a | ||
|
|
b106532b32 | ||
|
|
8e6e9eaea5 | ||
|
|
acea9352a9 | ||
|
|
9058a7031f | ||
|
|
a787467569 | ||
|
|
4078336d38 | ||
|
|
2f96b1982a | ||
|
|
bedab235f9 | ||
|
|
83158e0e7f | ||
|
|
d8066e999d | ||
|
|
504420c51d | ||
|
|
2c040edef8 | ||
|
|
9c72c71c05 | ||
|
|
f4c50f1cfc | ||
|
|
ae70e98ed4 | ||
|
|
8faf2dc75b | ||
|
|
36ae417c9f | ||
|
|
2e0cd20a1d | ||
|
|
65f6324573 | ||
|
|
d8137178bb | ||
|
|
39a380b621 | ||
|
|
e0f5df579b | ||
|
|
8ee153f234 | ||
|
|
fd379db286 | ||
|
|
096d1e4512 | ||
|
|
949c5c9180 | ||
|
|
7799410950 | ||
|
|
2ca7b05552 | ||
|
|
f8e9ef5cd0 | ||
|
|
020386b61c | ||
|
|
c3000b6f69 | ||
|
|
6ec6f51326 | ||
|
|
4542643025 | ||
|
|
fca3308cc3 | ||
|
|
e19dfe1c32 | ||
|
|
affcbe4139 | ||
|
|
6a515b95a8 | ||
|
|
c13be69a8e | ||
|
|
035a0a2b6e | ||
|
|
e813541e3f | ||
|
|
4bf3f2d3c0 | ||
|
|
556c8a9a4f | ||
|
|
4300c7dba2 | ||
|
|
74d0df7324 | ||
|
|
d7e3b36a09 | ||
|
|
fcce1483fa | ||
|
|
2430dfac31 | ||
|
|
fe29cc192d | ||
|
|
41eb705477 | ||
|
|
2ec835f572 | ||
|
|
59a41e8fcd | ||
|
|
d6442407f5 | ||
|
|
b5c43be135 | ||
|
|
b8f9ac5411 | ||
|
|
21f43ba9b0 | ||
|
|
3c9c3687d6 | ||
|
|
408b74d74c | ||
|
|
fdfcee7b1e | ||
|
|
64f2b213bb | ||
|
|
91fc075a33 | ||
|
|
3aa7dd23c9 | ||
|
|
fccbe9aa4d | ||
|
|
0334058fa4 | ||
|
|
6206f431cf | ||
|
|
46a1102852 | ||
|
|
1b586f3a73 | ||
|
|
53ca6ae1f3 | ||
|
|
95b352064e | ||
|
|
24652228af | ||
|
|
845b5a2a58 | ||
|
|
7381b7ac71 | ||
|
|
0e87bc7be6 | ||
|
|
01d64914c5 | ||
|
|
366239b8b9 | ||
|
|
02041bf2e0 | ||
|
|
216b6a494e | ||
|
|
b948de36fb | ||
|
|
4fb5ff86ee | ||
|
|
9f5f156b9d | ||
|
|
7e12a601b8 | ||
|
|
2a8d7ee0f8 | ||
|
|
fd38799049 | ||
|
|
fa391eed9d | ||
|
|
37ab061f4d | ||
|
|
aaa8867d4a | ||
|
|
062bd81814 | ||
|
|
f4d55c91fe | ||
|
|
326ff54649 | ||
|
|
90a36942b4 | ||
|
|
1ea4b77a9a | ||
|
|
0496de26d3 | ||
|
|
f22be4ebd9 | ||
|
|
34f26ea862 | ||
|
|
9e0a3d46b6 | ||
|
|
90b1cc5103 | ||
|
|
58e0f4ac50 | ||
|
|
e5635f4ab3 | ||
|
|
2065373f67 | ||
|
|
a81539db25 | ||
|
|
2f4e8511cd | ||
|
|
4c02e54298 | ||
|
|
5f3c3ec5e6 | ||
|
|
c4489a0543 | ||
|
|
0eba162ab5 | ||
|
|
f3ca8623f7 | ||
|
|
77020281ae | ||
|
|
f1a9923308 | ||
|
|
2a8a564fbd | ||
|
|
0d28a3edb9 | ||
|
|
ff736d6f6f | ||
|
|
d88d3b0b3a | ||
|
|
b6bdb0dbda | ||
|
|
ed6a5b78ad | ||
|
|
d5de1bf853 | ||
|
|
eb9a3ec654 | ||
|
|
6143f63560 | ||
|
|
37a2015cc5 | ||
|
|
958e273336 | ||
|
|
c92e6a45eb | ||
|
|
0a7e4fa5ce | ||
|
|
8192310dad | ||
|
|
ef369249cb | ||
|
|
a7261ae059 | ||
|
|
635ef16432 | ||
|
|
57fa14b5be | ||
|
|
dbdcb58d64 | ||
|
|
81d64ab939 | ||
|
|
c0a79cc919 | ||
|
|
7e18d3b6ff | ||
|
|
9d5e5c08ab | ||
|
|
5572f735b6 | ||
|
|
e632b1fda7 | ||
|
|
941040e9e8 | ||
|
|
dfa915a6af | ||
|
|
fbcaf0ea18 | ||
|
|
e6978a4e26 | ||
|
|
587914169c | ||
|
|
ed22e9ba3e | ||
|
|
dcbe936c50 | ||
|
|
dffa9f6da6 | ||
|
|
660f8613fd | ||
|
|
06d93b36f9 | ||
|
|
b2d880d749 | ||
|
|
6196aa45ed | ||
|
|
15018291b2 | ||
|
|
bfb272b9e0 | ||
|
|
c0035d1694 | ||
|
|
1e9d8e110b | ||
|
|
b0c08c8c17 | ||
|
|
011c7f5718 | ||
|
|
1cb5de2cd5 | ||
|
|
861fad5819 | ||
|
|
22b4c28f85 | ||
|
|
0e52d9860a | ||
|
|
aba75e1233 | ||
|
|
624cdeacc4 | ||
|
|
41f6948545 | ||
|
|
8332044f75 | ||
|
|
d5ec336eef | ||
|
|
f38d16483a | ||
|
|
e77abc261b | ||
|
|
c69642a460 | ||
|
|
3c4b78e166 | ||
|
|
7d6b6f6681 | ||
|
|
4ba9b34012 | ||
|
|
cb6cf5e257 | ||
|
|
661d9d1901 | ||
|
|
aeb62f9ae3 | ||
|
|
d80174d7c3 | ||
|
|
e2bfa471fa | ||
|
|
04fffe6562 | ||
|
|
0d6b2341b8 | ||
|
|
8b4fb4fe14 | ||
|
|
b230a86d33 | ||
|
|
5167332131 | ||
|
|
7a4b10cc4c | ||
|
|
a5deadf082 | ||
|
|
26a9b4d48e | ||
|
|
7731edf2f5 | ||
|
|
229b908d2e | ||
|
|
3ca84026db | ||
|
|
0af73014cc | ||
|
|
4e7bde8c9e | ||
|
|
9d6128acdc | ||
|
|
e79c6b6312 | ||
|
|
f352fe82a5 | ||
|
|
d265df589e | ||
|
|
7c87747db0 | ||
|
|
425958b616 | ||
|
|
4cc0cd6cab | ||
|
|
d936317143 | ||
|
|
359b4e9ed9 | ||
|
|
1d399c3c88 | ||
|
|
4d7fa05b43 | ||
|
|
4054c4eadd | ||
|
|
f8b98d8329 | ||
|
|
88ca6c94d9 | ||
|
|
f91f212d9f | ||
|
|
36821d095a | ||
|
|
d5e256486e | ||
|
|
42054c3cad | ||
|
|
598aad2140 | ||
|
|
475c60eefc | ||
|
|
86854c7071 | ||
|
|
e3f8777ee8 | ||
|
|
ec8589e4c9 | ||
|
|
b864e7afe4 | ||
|
|
75a811a6df | ||
|
|
2b000474d9 | ||
|
|
0be3c70cd8 | ||
|
|
081f9325f5 | ||
|
|
a7ffa972f3 | ||
|
|
558a016e2c | ||
|
|
3a2171e406 | ||
|
|
42cec5c893 | ||
|
|
55b11e6d38 | ||
|
|
0b7a66ab97 | ||
|
|
ea5b59bfe6 | ||
|
|
8d8fdcb4be | ||
|
|
821b7f22fe | ||
|
|
25afc7da0d | ||
|
|
e2aa117798 | ||
|
|
516982242d | ||
|
|
8bf00084b6 | ||
|
|
81794fcd31 | ||
|
|
22602cc37b | ||
|
|
1b693543aa | ||
|
|
ab2594e341 | ||
|
|
2ff2ea5f3b | ||
|
|
21ffa7c4ba | ||
|
|
696eee9475 | ||
|
|
a9058bf294 | ||
|
|
39c91d3624 | ||
|
|
000730ecaa | ||
|
|
c9fa667252 | ||
|
|
c2ec2ad8fb | ||
|
|
6433f71e8f | ||
|
|
a3fe307400 | ||
|
|
1a1b48e51a | ||
|
|
e8ad47a6ca | ||
|
|
b648e98ad0 | ||
|
|
7ef75f9f75 | ||
|
|
51b9a0d0c4 | ||
|
|
1d350b8ac6 | ||
|
|
a488c266c3 | ||
|
|
86e6ad76cb | ||
|
|
58d9b10d70 | ||
|
|
0a8b5d160b | ||
|
|
18c22faf4d | ||
|
|
5cb524673e | ||
|
|
a66a99bfd8 | ||
|
|
a160b70ced | ||
|
|
8b3b2d04a8 | ||
|
|
936e25b164 | ||
|
|
5ab0a4a671 | ||
|
|
aa65e1edb3 | ||
|
|
d007cb8903 | ||
|
|
d292a81e95 | ||
|
|
22ff397fb1 | ||
|
|
7f70b60f4d | ||
|
|
2a6660ba59 | ||
|
|
1abb449dfb | ||
|
|
65dc960e3b | ||
|
|
0e978349a5 | ||
|
|
e9fa7625f4 | ||
|
|
c0c07fb1b6 | ||
|
|
aa8e8acb7d | ||
|
|
f837d166e5 | ||
|
|
9249242119 | ||
|
|
641a3d39e1 | ||
|
|
6ff2d54347 | ||
|
|
11d21081b4 | ||
|
|
34c290b678 | ||
|
|
ea5061e409 | ||
|
|
4c5bfe2d10 | ||
|
|
c6f1d47dcb | ||
|
|
3179d23cee | ||
|
|
bdd78c31b6 | ||
|
|
c39093d801 | ||
|
|
94ef8879cd | ||
|
|
b7d59060e2 | ||
|
|
032b0e9369 | ||
|
|
0d5d16074f | ||
|
|
7027fd5343 | ||
|
|
7da2fdc3cd | ||
|
|
2673374d18 | ||
|
|
651c870d77 | ||
|
|
aa3569cd57 | ||
|
|
8cd9fedf58 | ||
|
|
e23ae63970 | ||
|
|
31f6a6fa70 | ||
|
|
e54a4f1f48 | ||
|
|
d43019163d | ||
|
|
00c4d6562e | ||
|
|
e86b47175f | ||
|
|
20f40c3229 | ||
|
|
dbfba6a20e | ||
|
|
7ede3ec4b1 | ||
|
|
872f9af6ae | ||
|
|
8f59bacb92 | ||
|
|
be66a9ecf6 | ||
|
|
4836bcc957 | ||
|
|
89852d38ef | ||
|
|
526dd54252 | ||
|
|
8a1a5c236d | ||
|
|
5e11d2b349 | ||
|
|
34fe5a30c6 | ||
|
|
26664dd180 | ||
|
|
4434e43fa1 | ||
|
|
7a55c1a884 | ||
|
|
28e51c9eb1 | ||
|
|
af9d885f8c | ||
|
|
9e8eba797e | ||
|
|
8f1eced69d | ||
|
|
751485fe6b | ||
|
|
a632037866 | ||
|
|
c0e39864c6 | ||
|
|
6e552e15fa | ||
|
|
0851751615 | ||
|
|
6f1c00869c | ||
|
|
1934dca6de | ||
|
|
7a26e4f484 | ||
|
|
9a2913ed1c | ||
|
|
c6926c374d | ||
|
|
3a2fb201a5 | ||
|
|
a95b06fc6b | ||
|
|
92d4b51ad5 | ||
|
|
7e7fb0b7a3 | ||
|
|
ea8bf81058 | ||
|
|
f243851ccd | ||
|
|
7c934ae501 | ||
|
|
aa58c7ec74 | ||
|
|
b56634e691 | ||
|
|
fb3f9cff33 | ||
|
|
da33b31c7d | ||
|
|
9a348fc840 | ||
|
|
007878781c | ||
|
|
cfc4c33801 | ||
|
|
28596edf07 | ||
|
|
7ccdf8be77 | ||
|
|
f5d04750db | ||
|
|
92e9a5e0a7 | ||
|
|
84d59c2873 | ||
|
|
d8a7f8bff2 | ||
|
|
3dd0b69e46 | ||
|
|
7d588b0c7c | ||
|
|
cd14188bc8 | ||
|
|
db109ca0fc | ||
|
|
f1236734bb | ||
|
|
9de53bf788 | ||
|
|
3900fed849 | ||
|
|
96f0dd3cbc | ||
|
|
fa7c61dfab | ||
|
|
d241c2a592 | ||
|
|
f17e663493 | ||
|
|
e45c1dbd6f | ||
|
|
7693ef3bd6 | ||
|
|
99a21dc05d | ||
|
|
abc24c1876 | ||
|
|
6f5e0fe955 | ||
|
|
6a388aaa7c | ||
|
|
2af846e711 | ||
|
|
4915c2b871 | ||
|
|
cceff157dd | ||
|
|
32aba40830 | ||
|
|
f576057274 | ||
|
|
0621eca05e | ||
|
|
a39df51d8a | ||
|
|
e4d43401eb | ||
|
|
d136737872 | ||
|
|
75b1d881ec | ||
|
|
c3bd9415cc | ||
|
|
1e8ca3a3cf | ||
|
|
ab14c30493 | ||
|
|
f22b35e4e5 | ||
|
|
a243d6b057 | ||
|
|
f738424403 | ||
|
|
753a8e8bc4 | ||
|
|
e955089da0 | ||
|
|
9309e609cd | ||
|
|
ade9a05236 | ||
|
|
c48740e20b | ||
|
|
b178dccb9c | ||
|
|
3b83aeb403 | ||
|
|
115afdb07d | ||
|
|
cf814b2d34 | ||
|
|
ecb7f9fe58 | ||
|
|
fa47bebfbc | ||
|
|
8eb802a55b | ||
|
|
af33ebb13b | ||
|
|
9220dc466a | ||
|
|
d18ced9cdd | ||
|
|
7463442e58 | ||
|
|
354d17523f | ||
|
|
a0a3de60be | ||
|
|
5685b565c3 | ||
|
|
76e52b5daf | ||
|
|
fa655ce196 | ||
|
|
194c8c761e | ||
|
|
11115e4d23 | ||
|
|
c91727b75a | ||
|
|
9f76dcd682 | ||
|
|
ef7dd8db2d | ||
|
|
6ab8b63bdd | ||
|
|
68e8b595de | ||
|
|
722d4842df | ||
|
|
de575c80b9 | ||
|
|
3a2e9f20f6 | ||
|
|
7e66b859b2 | ||
|
|
aaf7c5b35e | ||
|
|
c030e77861 | ||
|
|
219a74c014 | ||
|
|
7370fd5560 | ||
|
|
e284a95cc3 | ||
|
|
616986a5f3 | ||
|
|
b19d273beb | ||
|
|
31b40eebe8 | ||
|
|
035deae1c6 | ||
|
|
5161239c9f | ||
|
|
9a65fa304c | ||
|
|
7c1c9af5d4 | ||
|
|
4f8eeaedef | ||
|
|
d680e28a11 | ||
|
|
7fd538c1b6 | ||
|
|
f522849a4d | ||
|
|
077812b2ab | ||
|
|
bdf958df30 | ||
|
|
70fc42cb28 | ||
|
|
5ebf39784a | ||
|
|
9780e55274 | ||
|
|
4f5b896a0b | ||
|
|
813b581127 | ||
|
|
778413168b | ||
|
|
0807139c1d | ||
|
|
fa1cdb09fc | ||
|
|
8cc8f280eb | ||
|
|
9896314f5b | ||
|
|
c4045f57e3 | ||
|
|
6557a096d6 | ||
|
|
f44cc517a2 | ||
|
|
abfd4da287 | ||
|
|
59fba2d6ea | ||
|
|
ed570e4b2a | ||
|
|
484adac0bb | ||
|
|
f64e080d9a | ||
|
|
e44c1d3ace | ||
|
|
186b355b28 | ||
|
|
0d3e309ebc | ||
|
|
2110dc5a6d | ||
|
|
aef3846c13 | ||
|
|
4af5424242 | ||
|
|
c5175526dd | ||
|
|
3299f687f5 | ||
|
|
9c7d183a94 | ||
|
|
d02f671737 | ||
|
|
d709622bd2 | ||
|
|
e64afde073 | ||
|
|
2a1090a637 | ||
|
|
228c68a9cd | ||
|
|
6e1dfb0d1a | ||
|
|
de8b585ab7 | ||
|
|
c4b592d379 | ||
|
|
fe99ea9aab | ||
|
|
7f19a39a3b | ||
|
|
a06c38b486 | ||
|
|
63b9e598a3 | ||
|
|
60ccb41fac | ||
|
|
06593fb0f2 | ||
|
|
a193ced7fa | ||
|
|
c8870b7c69 | ||
|
|
b6a08208e1 | ||
|
|
fb4b800820 | ||
|
|
0cba23716d | ||
|
|
b85bf25e97 | ||
|
|
2474c2ae94 | ||
|
|
92d95cc9d3 | ||
|
|
7c61249ae6 | ||
|
|
686516f90a | ||
|
|
ea2cc2b907 | ||
|
|
cdfa11f550 | ||
|
|
e78a8c94b6 | ||
|
|
f6518a7bd5 | ||
|
|
d59ca4efdb | ||
|
|
3ce212e0a6 | ||
|
|
e9ce00d874 | ||
|
|
c5029bcbf3 | ||
|
|
6f49520042 | ||
|
|
05c6fbcae6 | ||
|
|
dd0e24f4b0 | ||
|
|
32eb4b9055 | ||
|
|
ee3fec3167 | ||
|
|
431603ad69 | ||
|
|
a19ba5fea0 | ||
|
|
f28ed55aeb | ||
|
|
0a903be7d0 | ||
|
|
cfcf47c064 | ||
|
|
b630de1103 | ||
|
|
1811c6bccf | ||
|
|
e2dc7ac2a9 | ||
|
|
95cc1ff542 | ||
|
|
330e21c986 | ||
|
|
f960d753e4 | ||
|
|
3319780e96 | ||
|
|
8a6d93aeed | ||
|
|
640d00ea9d | ||
|
|
071d47fa3b | ||
|
|
6148f8b7d2 | ||
|
|
76285469d3 | ||
|
|
3d30d605f5 | ||
|
|
7ed58cb663 | ||
|
|
6e56bb623c | ||
|
|
371f4ba6b3 | ||
|
|
0aa5e75000 | ||
|
|
491c321720 | ||
|
|
b4a41a8f70 | ||
|
|
a3acaa000c | ||
|
|
098f5ae221 | ||
|
|
1406d9ccde | ||
|
|
06e85ecfa6 | ||
|
|
1679696612 | ||
|
|
07408cbd1f | ||
|
|
d7192fe68c | ||
|
|
3eece29807 | ||
|
|
601cfea6a3 | ||
|
|
7ca1bd314b | ||
|
|
031278f661 | ||
|
|
9724a0538b | ||
|
|
87ad80edf9 | ||
|
|
567b349c2b | ||
|
|
4d9cad180d | ||
|
|
a3cf4ea2f6 | ||
|
|
71f85cc330 | ||
|
|
53a8aeb6e7 | ||
|
|
80f638fe19 | ||
|
|
953c23b1bc | ||
|
|
181adc6a4e | ||
|
|
c36635c112 | ||
|
|
f8a39e3bb1 | ||
|
|
0e6c89a5c8 | ||
|
|
cc20482aa9 | ||
|
|
a546acda8c | ||
|
|
a32538bb66 | ||
|
|
2ffb6e1b15 | ||
|
|
32ce72cb9e | ||
|
|
f8bce131c0 | ||
|
|
0df20da4dd | ||
|
|
9456732b86 | ||
|
|
2fc1e64319 | ||
|
|
3ac2d06bd1 | ||
|
|
18fda7b42f | ||
|
|
db52fd8e4d | ||
|
|
0ec8cf8e80 | ||
|
|
4e4772bb5b | ||
|
|
26b512ea1b | ||
|
|
7d8edeff4e | ||
|
|
78ccb44a90 | ||
|
|
278d22ce8f | ||
|
|
9a522dda6e | ||
|
|
100004eeaf | ||
|
|
6a664cb114 | ||
|
|
51726b4d43 | ||
|
|
c02dc8b2c9 | ||
|
|
a8e7c03171 | ||
|
|
f5ae384d4f | ||
|
|
84d11b5e53 | ||
|
|
417205623a | ||
|
|
2f2c0a13fb | ||
|
|
622f241317 | ||
|
|
286ced4c2f | ||
|
|
25a8a42447 | ||
|
|
492fd5cb6b | ||
|
|
a16715ac62 | ||
|
|
9ede4dcfbb | ||
|
|
79474c6b16 | ||
|
|
2cae0f6290 | ||
|
|
78744c4f7a | ||
|
|
2abb58d758 | ||
|
|
1580e331ef | ||
|
|
6d1ff7e966 | ||
|
|
17d9b5006d | ||
|
|
5a57447a8c | ||
|
|
669dbca959 | ||
|
|
70446f46c2 | ||
|
|
0e6f5e08e1 | ||
|
|
1775b65e07 | ||
|
|
9ae3fc6523 | ||
|
|
4a10214be2 | ||
|
|
2acfb7c002 | ||
|
|
c754d8011d | ||
|
|
95104b0fbd | ||
|
|
d07de2d307 | ||
|
|
9414f92fa9 | ||
|
|
8096be089e | ||
|
|
fca3493442 | ||
|
|
5a0c5f8fea | ||
|
|
ec1f0e7551 | ||
|
|
967f3230f5 | ||
|
|
59610c4004 | ||
|
|
fabe79f7af | ||
|
|
124aa000af | ||
|
|
2dd47239de | ||
|
|
6545336206 | ||
|
|
5cd34aca27 | ||
|
|
95f19b4542 | ||
|
|
90d7c4ef3d | ||
|
|
1a97f6721f | ||
|
|
3c4b5d4281 | ||
|
|
968b7dd173 | ||
|
|
3cb804de26 | ||
|
|
9f8c5456be | ||
|
|
0d31bbc7fa | ||
|
|
ed56b0baba | ||
|
|
18030bd85d | ||
|
|
7bd273b818 | ||
|
|
a3a14b9db7 | ||
|
|
6f1cffeb28 | ||
|
|
7506db4ccb | ||
|
|
2fddc68fdf | ||
|
|
0f716aced7 | ||
|
|
a3c96c9252 | ||
|
|
e800db562f | ||
|
|
5e38b48dd6 | ||
|
|
56053c37cf | ||
|
|
514ba15d6a | ||
|
|
afaa66b657 | ||
|
|
3ad94d6072 | ||
|
|
97ce883217 | ||
|
|
861670ba2a | ||
|
|
f5dd6f7f37 | ||
|
|
b5cef5c7ea | ||
|
|
cf5112b26f | ||
|
|
44e7cbf019 | ||
|
|
6f848b6dba | ||
|
|
95a4f61499 | ||
|
|
c27dc38e85 | ||
|
|
cd3f2523f1 | ||
|
|
a379b6ed11 | ||
|
|
fb9e4cf463 | ||
|
|
8e611e8414 | ||
|
|
9466e154b4 | ||
|
|
2b62707051 | ||
|
|
ebf8dc6b03 | ||
|
|
d7b7d5f6ee | ||
|
|
709955b601 | ||
|
|
1db3577bcb | ||
|
|
0bfc57022d | ||
|
|
1511dd4f84 | ||
|
|
1c132c8587 | ||
|
|
40c6d57804 | ||
|
|
a09757f104 | ||
|
|
304a96d7d6 | ||
|
|
4e7dc97bdc | ||
|
|
103d12a877 | ||
|
|
b47931978f | ||
|
|
1db4253886 | ||
|
|
800d5cd16f | ||
|
|
c7df9c6c47 | ||
|
|
f601390ef8 | ||
|
|
7bab32ef89 | ||
|
|
c50772d19f | ||
|
|
c2a4e4effc | ||
|
|
6738c1dded | ||
|
|
d5e629ad0e | ||
|
|
aa9dbb1b03 | ||
|
|
5df81de7af | ||
|
|
a7c02c4538 | ||
|
|
8fbabab1a8 | ||
|
|
4a60cac916 | ||
|
|
717a958256 | ||
|
|
4ed7b7f751 | ||
|
|
a37d13c95d | ||
|
|
c3ae03ff18 | ||
|
|
351424e719 | ||
|
|
d792d9e49e | ||
|
|
d3b32caea4 | ||
|
|
0589c19d52 | ||
|
|
76abb2e623 | ||
|
|
2bdefea9d6 | ||
|
|
4865a22f78 | ||
|
|
ff987ccf11 | ||
|
|
bda7041294 | ||
|
|
d39d96b700 | ||
|
|
2d56df67cd | ||
|
|
57ebe1b27d | ||
|
|
28076f3d4b | ||
|
|
9a42eb541e | ||
|
|
cd87d20f46 | ||
|
|
c097ea5dd2 | ||
|
|
c98c128fe8 | ||
|
|
367d4d1098 | ||
|
|
3d91b1f67f | ||
|
|
82d08dccc6 | ||
|
|
8872abcbc4 | ||
|
|
37c6555b44 | ||
|
|
7667727021 | ||
|
|
e04aa96b4d | ||
|
|
5ab5ac5448 | ||
|
|
3d3ef36e97 | ||
|
|
1829d86ef5 | ||
|
|
9e00ac89d5 | ||
|
|
04ee5983fe | ||
|
|
47b9809d23 | ||
|
|
0116218fa8 | ||
|
|
c4dc1b5c23 | ||
|
|
7e7039b53c | ||
|
|
2378be4e93 | ||
|
|
8c8d7f3c60 | ||
|
|
e4c899a08c | ||
|
|
f54bdecff2 | ||
|
|
71d482df47 | ||
|
|
a9afcb159a | ||
|
|
a62c106974 | ||
|
|
6f218d7472 | ||
|
|
d8713d78f5 | ||
|
|
e282884e54 | ||
|
|
dbb4aef5e3 | ||
|
|
bf4576dc91 | ||
|
|
c3e37a0cde | ||
|
|
f27aa27a0c | ||
|
|
a1a2c411b2 | ||
|
|
b7a4f15b34 | ||
|
|
ad9daadf8a | ||
|
|
95f53461c2 | ||
|
|
d11317bcab | ||
|
|
94792dd88f | ||
|
|
5225e29ce7 | ||
|
|
f81684141e | ||
|
|
6fefd5d330 | ||
|
|
6bbbb1ab41 | ||
|
|
f1ed8c8a2e | ||
|
|
0458833072 | ||
|
|
abea1c38a9 | ||
|
|
9fbc265eb8 | ||
|
|
d34c4784a5 | ||
|
|
fdcb3b7ebb | ||
|
|
9472907ae1 | ||
|
|
ae2c81ff38 | ||
|
|
0f553fe10b | ||
|
|
271d18eb08 | ||
|
|
7c8b4c1a8b | ||
|
|
8b85d14b92 | ||
|
|
cf5b6f6974 | ||
|
|
8c1d23a0e2 | ||
|
|
ede0f3ab3d | ||
|
|
fd787c5e4e | ||
|
|
40d43ea88d | ||
|
|
5e9810396f | ||
|
|
f66ee4dfd7 | ||
|
|
8f6aad2f48 | ||
|
|
eaefc8b9d6 | ||
|
|
1f9e2188a6 | ||
|
|
956d765786 | ||
|
|
c52f1258a8 | ||
|
|
dea853d3a3 | ||
|
|
4735c45c51 | ||
|
|
fa90ab1407 | ||
|
|
d8837cea6f | ||
|
|
c3184aea63 | ||
|
|
5aa311d330 | ||
|
|
23a2b11abf | ||
|
|
43d56f9ba9 | ||
|
|
e521f0eb68 | ||
|
|
c8b60f013b | ||
|
|
2bb5f41611 | ||
|
|
f35b5d28db | ||
|
|
df5d9c77f4 | ||
|
|
d8475092d1 | ||
|
|
5008972fef | ||
|
|
d8cbbcaa9d | ||
|
|
404b68da88 | ||
|
|
b42a5050fb | ||
|
|
3e592531eb | ||
|
|
90e6d0c2ac | ||
|
|
e4b4e5aa31 | ||
|
|
0435e76250 | ||
|
|
03ec6e4d01 | ||
|
|
9253e7bdf7 | ||
|
|
6be0bbb886 | ||
|
|
5a11086d64 | ||
|
|
d15fe5a6b3 | ||
|
|
8892f71dd0 | ||
|
|
73f1a49137 | ||
|
|
c92c7a69fd | ||
|
|
7d6595fd18 | ||
|
|
50ea86fe8b | ||
|
|
2e5704d101 | ||
|
|
8bdbc20e74 | ||
|
|
23008db6e1 | ||
|
|
e3cd154317 | ||
|
|
259eaab9a9 | ||
|
|
2764a8ee8d | ||
|
|
f53a8e712f | ||
|
|
1c9a499135 | ||
|
|
c1a77a0c9f | ||
|
|
2cd247e819 | ||
|
|
dcbf62b43d | ||
|
|
7d5e34287c | ||
|
|
4c45921349 | ||
|
|
feff00e1a5 | ||
|
|
a102e01ce1 | ||
|
|
90aa7595b4 | ||
|
|
2941d5c714 | ||
|
|
a86d40ccd4 | ||
|
|
044c473de2 | ||
|
|
e72cda99fd | ||
|
|
5ae5ec986e | ||
|
|
7f9d1d6ab9 | ||
|
|
56beb01724 | ||
|
|
9a18e21066 | ||
|
|
4c37489f4c | ||
|
|
f7a26472af | ||
|
|
b1f68685ec | ||
|
|
99f7184073 | ||
|
|
c69b4310c8 | ||
|
|
b21786947f | ||
|
|
8b7faa31e1 | ||
|
|
6eb7530083 | ||
|
|
55fe92bb8f | ||
|
|
7a6dbaa89b | ||
|
|
b1bbe966c4 | ||
|
|
d07ccc5a39 | ||
|
|
d278e49475 | ||
|
|
6e25d955f4 | ||
|
|
d35ac956d1 | ||
|
|
91bc32dc16 | ||
|
|
4dea922610 | ||
|
|
df1637c580 | ||
|
|
e50cff69bb | ||
|
|
36cc84a2a9 | ||
|
|
e97dddcdca | ||
|
|
9988618e0e | ||
|
|
18bd51707c | ||
|
|
c7acfc90b9 | ||
|
|
c9aa1883ed | ||
|
|
78772ada0d | ||
|
|
282ca09f8e | ||
|
|
e2d44e30c7 | ||
|
|
96b60ed956 | ||
|
|
2192824ad8 | ||
|
|
3a84c8b58d | ||
|
|
e5c4362a98 | ||
|
|
97abe22963 | ||
|
|
9dd3640464 | ||
|
|
7e758b1cf8 | ||
|
|
b9d850227d | ||
|
|
56606f3475 | ||
|
|
0528c5a22a | ||
|
|
0f6424efda | ||
|
|
40fc01f406 | ||
|
|
2801e6fad8 | ||
|
|
7f59b4b2ca | ||
|
|
acf6aec71c | ||
|
|
620058cc57 | ||
|
|
ac2f7a7f6a | ||
|
|
82f37bf0d1 | ||
|
|
fa5950eb00 | ||
|
|
99957384ea | ||
|
|
4cd9ced8dc | ||
|
|
2cc5473021 | ||
|
|
c0dcf6e878 | ||
|
|
43ea73faa6 | ||
|
|
12ab9eda8d | ||
|
|
3f327cc4c6 | ||
|
|
567184e21e | ||
|
|
12a5e17afb | ||
|
|
dbc0191d5f | ||
|
|
7f1c98177b | ||
|
|
f0a8f21190 | ||
|
|
e6c6fe3275 | ||
|
|
390e92688c | ||
|
|
332a909d44 | ||
|
|
2039757b85 | ||
|
|
f88eec0de2 | ||
|
|
2686f9b3e8 | ||
|
|
d460a30711 | ||
|
|
3f42f32648 | ||
|
|
344057ac50 | ||
|
|
9d2c0c231c | ||
|
|
1bc534247c | ||
|
|
fdaac1dbf8 | ||
|
|
e178ef2520 | ||
|
|
47098efbda | ||
|
|
7b19e99edd |
31
.gitattributes
vendored
Normal file
31
.gitattributes
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# Per default everything gets normalized and gets LF line endings on checkout.
|
||||
* text eol=lf
|
||||
|
||||
# These will always have CRLF line endings on checkout.
|
||||
*.vcxproj text eol=crlf
|
||||
*.props text eol=crlf
|
||||
*.bat text eol=crlf
|
||||
|
||||
# These are binary so should never be modified by git.
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.dxf binary
|
||||
|
||||
# These should also not be modified by git.
|
||||
tests/basics/string_cr_conversion.py -text
|
||||
tests/basics/string_crlf_conversion.py -text
|
||||
stmhal/startup_stm32f40xx.s -text
|
||||
stmhal/pybcdc.inf_template -text
|
||||
stmhal/usbd_* -text
|
||||
stmhal/boards/*/stm32f4xx_hal_conf.h -text
|
||||
stmhal/cmsis/** -text
|
||||
stmhal/hal/** -text
|
||||
stmhal/usbdev/** -text
|
||||
stmhal/usbhost/** -text
|
||||
cc3200/hal/aes.c -text
|
||||
cc3200/hal/aes.h -text
|
||||
cc3200/hal/des.c -text
|
||||
cc3200/hal/i2s.c -text
|
||||
cc3200/hal/i2s.h -text
|
||||
cc3200/version.h -text
|
||||
lib/fatfs/** -text
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -33,5 +33,7 @@ tests/*.out
|
||||
######################
|
||||
__pycache__/
|
||||
|
||||
# Customized Makefile overrides
|
||||
# Customized Makefile/project overrides
|
||||
######################
|
||||
GNUmakefile
|
||||
user.props
|
||||
|
||||
13
.gitmodules
vendored
Normal file
13
.gitmodules
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
[submodule "lib/axtls"]
|
||||
path = lib/axtls
|
||||
url = https://github.com/pfalcon/axtls
|
||||
branch = micropython
|
||||
[submodule "lib/libffi"]
|
||||
path = lib/libffi
|
||||
url = https://github.com/atgreen/libffi
|
||||
[submodule "lib/lwip"]
|
||||
path = lib/lwip
|
||||
url = http://git.savannah.gnu.org/r/lwip.git
|
||||
[submodule "lib/berkeley-db-1.xx"]
|
||||
path = lib/berkeley-db-1.xx
|
||||
url = https://github.com/pfalcon/berkeley-db-1.xx
|
||||
27
.travis.yml
27
.travis.yml
@@ -1,22 +1,32 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
language: c
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
before_script:
|
||||
- sudo add-apt-repository -y ppa:fkrull/deadsnakes
|
||||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
# Extra CPython versions
|
||||
# - sudo add-apt-repository -y ppa:fkrull/deadsnakes
|
||||
# Extra gcc versions
|
||||
# - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
- sudo add-apt-repository -y ppa:terry.guo/gcc-arm-embedded
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -y python3.4 python3 gcc-4.7 gcc-multilib gcc-arm-none-eabi qemu-system mingw32
|
||||
- sudo dpkg --add-architecture i386
|
||||
- sudo apt-get update -qq || true
|
||||
- sudo apt-get install -y python3 gcc-multilib pkg-config libffi-dev libffi-dev:i386 qemu-system mingw32
|
||||
- sudo apt-get install -y --force-yes gcc-arm-none-eabi
|
||||
# For teensy build
|
||||
- sudo apt-get install realpath
|
||||
# For coverage testing
|
||||
- sudo pip install cpp-coveralls
|
||||
- gcc --version
|
||||
- arm-none-eabi-gcc --version
|
||||
- python3 --version
|
||||
|
||||
script:
|
||||
- make -C minimal test
|
||||
- make -C unix CC=gcc-4.7
|
||||
- make -C unix-cpy CC=gcc-4.7
|
||||
- make -C unix deplibs
|
||||
- make -C unix
|
||||
- make -C unix nanbox
|
||||
- make -C bare-arm
|
||||
- make -C qemu-arm test
|
||||
- make -C stmhal
|
||||
@@ -32,12 +42,13 @@ script:
|
||||
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native)
|
||||
|
||||
# run tests with coverage info
|
||||
- make -C unix CC=gcc-4.7 coverage
|
||||
- make -C unix coverage
|
||||
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests)
|
||||
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests -d thread)
|
||||
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --emit native)
|
||||
|
||||
after_success:
|
||||
- (cd unix && coveralls --root .. --build-root . --gcov $(which gcov-4.7) --gcov-options '\-o build-coverage/' --include py --include extmod)
|
||||
- (cd unix && coveralls --root .. --build-root . --gcov $(which gcov) --gcov-options '\-o build-coverage/' --include py --include extmod)
|
||||
|
||||
after_failure:
|
||||
- (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done)
|
||||
|
||||
860
ACKNOWLEDGEMENTS
860
ACKNOWLEDGEMENTS
@@ -1,4 +1,4 @@
|
||||
The Micro Python project was proudly and successfully crowdfunded
|
||||
The MicroPython project was proudly and successfully crowdfunded
|
||||
via a Kickstarter campaign which ended on 13th December 2013. The
|
||||
project was supported by 1923 very generous backers, who pledged
|
||||
for a total of 2320 pyboards.
|
||||
@@ -261,6 +261,7 @@ today. The names appear in order of pledging.
|
||||
503 skakz
|
||||
504 Chad Cooper
|
||||
505 Makhan Virdi, mlvirdi.com, InfinityXLabs.com, USA
|
||||
506 Glenn Ruben Bakke, Norway
|
||||
507 Alasdair Allan
|
||||
509 dlbrandon
|
||||
511 Dr J Garcia, Sweden
|
||||
@@ -339,6 +340,7 @@ today. The names appear in order of pledging.
|
||||
668 pmst - Italy
|
||||
671 Sergio Conde Gómez (skgsergio)
|
||||
672 Micromint, www.micromint.com
|
||||
673 Xie Yanbo, China
|
||||
675 Thank you
|
||||
677 Kacem Ben Dhiab
|
||||
679 CornishSteve
|
||||
@@ -375,6 +377,7 @@ today. The names appear in order of pledging.
|
||||
759 Padraic D. Hallinan
|
||||
760 Rob Fairbairn
|
||||
763 Zac Luzader
|
||||
768 Sam Shams
|
||||
773 terje nagel, dk
|
||||
775 Luc LEGER
|
||||
782 Luis M. Morales S.
|
||||
@@ -417,6 +420,7 @@ today. The names appear in order of pledging.
|
||||
868 Stephan Schulte, Germany
|
||||
869 Kenneth Henderick
|
||||
872 DaveP (www.davepeake.com)
|
||||
873 Markus Schuss, Austria
|
||||
876 Kyle Gordon, http://lodge.glasgownet.com
|
||||
877 Joseph Gerard Campbell
|
||||
881 Thanks for the board. Good luck to you. --Jason Doege
|
||||
@@ -477,6 +481,7 @@ today. The names appear in order of pledging.
|
||||
1007 Charles V Bock - Charles at CharlesBock dot com
|
||||
1010 Remember June 4th, 1989
|
||||
1012 Stuart Marsden
|
||||
1013 Herbert Graef, Stuttgart
|
||||
1014 Arthur P, USA
|
||||
1015 John Hall & Jeremy Armijo
|
||||
1017 Luciano Ramalho, Python.pro.br
|
||||
@@ -690,6 +695,7 @@ today. The names appear in order of pledging.
|
||||
1499 Ronald Eddy
|
||||
1500 SynShop Las Vegas
|
||||
1503 This is really cool. - Jack Conway
|
||||
1505 Victor Suarez, Argentina
|
||||
1507 Renesas Electronics America
|
||||
1509 Team
|
||||
1513 A. Lamborn KD0ZFY
|
||||
@@ -889,6 +895,7 @@ today. The names appear in order of pledging.
|
||||
1922 Nicci Tofts
|
||||
1925 Joshua Coxwell
|
||||
1926 Franklin Hamilton
|
||||
1928 Peter Korcz
|
||||
1929 Leroy Douglas
|
||||
1930 A ナルと fan from Nigeria who likes smileys, here's one for good measure :)
|
||||
1931 Kimmo Lahtinen, Finland
|
||||
@@ -905,3 +912,854 @@ today. The names appear in order of pledging.
|
||||
1955 Pieter Röhling
|
||||
1957 uomorando, Italy
|
||||
1959 Acacio Cruz
|
||||
|
||||
The MicroPython project raised further funds through a second
|
||||
Kickstarter campaign that was primarily targeted at porting the
|
||||
code to the ESP8266 WiFi chip. The campaign ended on 2nd March
|
||||
2016 and gained the support of 1384 fantastic backers who believed
|
||||
in the project and the principles of Open Source code. Those
|
||||
backers who asked to be named are listed below, with an asterisk
|
||||
indicating that they also supported the first campaign.
|
||||
|
||||
* 1 Gabriel, Seattle
|
||||
* 2 @robberwick
|
||||
* 6 Dave Hylands
|
||||
7 Les, UK
|
||||
8 Ryanteck LTD., UK
|
||||
10 karlsruhe, HU
|
||||
* 11 Turbinenreiter
|
||||
13 Ben Nuttall, UK
|
||||
* 14 Bryan Morrissey, MA, USA
|
||||
* 15 Jogy, Qatar
|
||||
* 16 BOB63,IT
|
||||
19 ReaBoyd
|
||||
* 20 Andrew, MK
|
||||
* 21 chrisq, NO
|
||||
22 Pascal RENOU, France
|
||||
23 Javier G, ES
|
||||
25 Forrest, US
|
||||
26 Filip Korling, Sweden
|
||||
27 roberthh - Rhineland
|
||||
* 28 Herbert Graef, Stuttgart, thanking the MicroPython Team for this great project
|
||||
* 29 johnsonfamily38, UK
|
||||
30 CympleCy
|
||||
31 OJ, PK
|
||||
32 Daniel, SVK
|
||||
33 Shabaz Mohammad
|
||||
* 35 Kenneth Henderick, BE
|
||||
* 37 Daniel Mouritzen, DK
|
||||
39 Torntrousers, UK
|
||||
* 44 Scanner
|
||||
45 Radomir Dopieralski
|
||||
46 Nick, UK
|
||||
* 47 Jon Hylands, Canada
|
||||
* 48 Ben Barwise Clacktronics
|
||||
50 Rob Kent, UK
|
||||
52 Carlos Pereira Atencio
|
||||
54 Andy, UK
|
||||
* 55 WMinarik, Canada
|
||||
57 Hauffe, Germany
|
||||
58 HyperTaz, IT
|
||||
* 61 Michael Kovacs, AT
|
||||
62 Erick Navarro, PE
|
||||
69 Karan,US
|
||||
* 71 Nick B, UK
|
||||
* 72 Anthony Lister, NZ
|
||||
* 73 Bryan Lyon
|
||||
76 Miguel Angel Ajo, ES
|
||||
* 78 Sebastian, Regensburg (GER)
|
||||
* 80 iv3unm
|
||||
81 Thierry BÉNET, FR
|
||||
84 Jannis, Germany
|
||||
86 Nathan Jeffrey
|
||||
88 Cory Benfield, UK
|
||||
90 Carlo, IT
|
||||
* 91 Wojciech Bederski (@wuub)
|
||||
92 Steve Holden, UK
|
||||
93 Tristan Roddis, UK
|
||||
94 Balder, Sweden
|
||||
* 95 Rhys, UK
|
||||
96 Rowan, UK
|
||||
* 97 Gary Martin, Edinburgh
|
||||
* 100 Mikael Eiman
|
||||
* 101 torwag
|
||||
* 102 Craig Barnes, UK
|
||||
103 Andrea Grandi, UK
|
||||
105 Piers, UK
|
||||
* 109 Wayne Keenan
|
||||
110 makuk66
|
||||
111 Hamine,DZ
|
||||
112 Arahavica,JP
|
||||
* 113 Bill Eubanks, USA
|
||||
114 Jonathan, UK
|
||||
115 ghickman
|
||||
* 117 Christian Lange, Germany
|
||||
119 Jonty Wareing
|
||||
121 TheHetman
|
||||
123 Víctor R. Ruiz, Spain
|
||||
* 124 Laurynas Paukste, Norway
|
||||
* 125 Taki
|
||||
126 André Milette, Canada
|
||||
* 127 Ron Cromberge,NL
|
||||
128 IJ, Thailand
|
||||
* 130 IGOR VIZIR
|
||||
132 Bill Saturno
|
||||
134 scibi
|
||||
136 Timbo, AU
|
||||
137 Raphael Vogel, DE
|
||||
* 139 jasonkirk, US
|
||||
141 Linköping, Sweden
|
||||
* 142 Dugres
|
||||
144 DarioS, UK
|
||||
146 NelisW
|
||||
* 148 _Mark_
|
||||
* 149 Folke Berglund, Sweden
|
||||
150 Deniz Dag/Belgium
|
||||
152 Jacques Thomas
|
||||
153 Dag Henrik, Norway
|
||||
* 154 Alexander Steppke
|
||||
158 stavros.io
|
||||
* 161 Seong-Woo Kim, KR
|
||||
162 Aaron H, Seattle
|
||||
164 Iwan, CZ
|
||||
165 Jenning, DE
|
||||
167 Oliver Z, Germany
|
||||
* 168 Chris Mason, Australia
|
||||
169 Fabio P. Italy
|
||||
171 Jonathan, Ireland
|
||||
173 Philipp B., DE
|
||||
174 Mancho, IT
|
||||
175 Mikkel Sørensen, DK
|
||||
176 Raphael Lullis
|
||||
* 177 Tim, China
|
||||
179 JasperS, NL
|
||||
180 Scott, AU
|
||||
181 Roland Kay, UK
|
||||
182 Adam Baxter
|
||||
184 Hugo Herter
|
||||
185 Simon AM, Malta
|
||||
186 Leif Denby
|
||||
190 Maxious
|
||||
* 192 Guido, GER
|
||||
* 193 Pierre Rousseau, Canada
|
||||
195 Pete Hinch
|
||||
* 198 KoalaBear,USA. TRUMPED 2016!
|
||||
* 200 Pimoroni, UK
|
||||
201 jpwsutton, UK
|
||||
203 Felix, Sweden
|
||||
204 Dmitri Don, Tallinn Estonia
|
||||
205 PeteDemiSwede, UK
|
||||
* 207 Serge GUILLAUME
|
||||
208 Gurtubay, ES
|
||||
209 Geir-Olav, NO
|
||||
210 RayDeo, Germany
|
||||
215 DIYAbility
|
||||
216 Josef Dunbar, USA
|
||||
* 217 Enrico, BE/IT
|
||||
219 Damian Moore, UK
|
||||
220 Wayne and Layne, LLC
|
||||
221 The Old Crow, USA
|
||||
224 Hackscribble, UK
|
||||
* 225 Alex March, UK
|
||||
226 @rdslw
|
||||
227 Mike, Canada
|
||||
* 228 Adrian Smith
|
||||
229 Dinu Gherman, Germany
|
||||
230 Tinamous.com
|
||||
* 231 Nikesh, US
|
||||
* 232 chrisallick.com
|
||||
234 Daniel Von Fange
|
||||
* 235 Michal Muhlpachr, CZ
|
||||
* 236 Petr Viktorin
|
||||
237 Ryan Aldredge
|
||||
238 Patrik Wallström, SE
|
||||
* 239 MobiusNexus
|
||||
240 Stray, US
|
||||
* 241 BOFG, no
|
||||
244 Issac Kelly
|
||||
* 247 David Prime
|
||||
249 James Marsh, UK
|
||||
* 250 BezouwenR
|
||||
252 Avinash Magdum, India
|
||||
253 Greg Abbas, Menlo Park CA
|
||||
254 Jorge, ES
|
||||
256 JohanP, swe
|
||||
* 258 Ben Doan
|
||||
259 Jan van Haarst, NL
|
||||
* 263 JoshT, Los Angeles
|
||||
264 cstuder, Switzerland
|
||||
266 Jon Armani
|
||||
* 270 Liam Welsh
|
||||
271 Jason Peacock
|
||||
272 Alejandro Lopez
|
||||
275 Dan O'Donovan, UK
|
||||
276 N1TWC
|
||||
277 Roland Tanglao, Vancouver
|
||||
278 Twpsyn
|
||||
280 Robert, ME-US
|
||||
* 282 Thomas, UK
|
||||
283 Jeff Schroeder, USA
|
||||
284 Paulus Schoutsen
|
||||
* 287 Neon22, NZ
|
||||
290 kbmeister
|
||||
291 Gary Hahn
|
||||
292 Dave Matsumoto, USA
|
||||
296 Sam Lee, SG
|
||||
304 Poul Borg, Denmark
|
||||
307 MightyPork
|
||||
308 Dale
|
||||
* 312 Anton Kraft, Germany
|
||||
315 Kism3t, UK
|
||||
317 NateM
|
||||
* 318 N&T, Calvijn Meerpaal, NL
|
||||
322 Andreas Monitzer
|
||||
323 Rikard, SE
|
||||
328 Olaf, DE
|
||||
* 329 John Boudreaux
|
||||
330 DOCE, Germany
|
||||
331 feilipu
|
||||
332 Stefan Schwetschke
|
||||
333 Wayneji, NZ
|
||||
337 Alain de Lamirande, Canada
|
||||
338 Hori, TW
|
||||
340 Azmodie, UK
|
||||
341 Lygon, UK
|
||||
* 342 JRM in STL, USA
|
||||
344 R Colistete-Jr., BR
|
||||
* 345 ChristianG, DE
|
||||
347 Nis Sarup, DK.
|
||||
350 Nickedynick
|
||||
351 Dazza, Oz
|
||||
352 lispmeister, NL
|
||||
355 Tomas Lubkowitz, SE
|
||||
357 Mark, UK
|
||||
* 358 Team ME
|
||||
363 Papahabla
|
||||
364 Greg Chevalley
|
||||
365 Maic Striepe, Germany
|
||||
369 Ian McMahon
|
||||
371 A. DARGA, Fr
|
||||
372 Ernesto Maranesi, BR
|
||||
373 Steve Lyon
|
||||
374 James Cloos
|
||||
375 Bas Zeppenfeldt, The Netherlands
|
||||
378 Pycom Ltd
|
||||
380 Wade Christensen, USA
|
||||
382 Justin Wing Chung Hui, UK
|
||||
383 C Paulson
|
||||
384 Ian Tickle
|
||||
386 Danny, Seattle
|
||||
388 Erik Moe, Chicago, IL
|
||||
* 389 Eric B. Wertz, USA
|
||||
390 Michael. CH
|
||||
391 Christopher Baughman
|
||||
392 James Churchill
|
||||
393 Rob, DC
|
||||
395 Whee Min, Singapore
|
||||
* 396 Jason Doege, TX
|
||||
401 MrFish
|
||||
403 Thejesh GN
|
||||
404 Markus, Sweden
|
||||
405 AMR, Spain
|
||||
407 Svet, ES
|
||||
* 408 Thoralt, Germany
|
||||
409 Emil, Sweden
|
||||
410 David Moloney, ireland
|
||||
411 Marco S, DE
|
||||
415 Peter W., Austria
|
||||
417 emendo A/S
|
||||
* 419 Kalestis, Switzerland
|
||||
421 Ondra, CZ
|
||||
422 Elheffe
|
||||
423 thinkl33t, UK
|
||||
424 TonyF
|
||||
425 Herr Robert Linder, PA, USA
|
||||
* 426 Anders Astrom S(E|G)
|
||||
* 428 Jussi Ylanen, CT, USA
|
||||
431 Neil H., USA
|
||||
434 Rod Perez, MX
|
||||
435 Carol, US
|
||||
436 Gina Haeussge, DE
|
||||
438 Weilinger, GER
|
||||
* 439 Ron Ward, Australia
|
||||
441 Rex, UT, USA
|
||||
* 444 Slush, CZ
|
||||
445 Bruce, Florida
|
||||
* 448 Patrick Di Justo
|
||||
449 ScubaBearLA
|
||||
450 Mike Causer, Sydney AU
|
||||
451 Joel Fries, USA
|
||||
* 452 Andrew Bernstein, US
|
||||
454 EAS, Seattle, WA, USA
|
||||
* 456 Christopher J. Morrone, USA
|
||||
* 457 Anthony Gilley, Sweden
|
||||
458 Andre Breiler, DE
|
||||
* 460 Fuffkin, UK
|
||||
* 461 adent, CZ
|
||||
462 Samuel Pickard
|
||||
463 Mirko, Germany
|
||||
* 464 Ramin/US
|
||||
465 Mike, Grenoble
|
||||
466 Rolf, DE
|
||||
* 467 Dave Haynes
|
||||
* 469 Mac Ha, Vietnam
|
||||
* 470 Enno, DE
|
||||
* 473 Smudo, DE
|
||||
* 474 Duncan, Scotland
|
||||
475 Chris, UK
|
||||
476 Peter Groen, NL
|
||||
478 Gertjan Geerling, Nijmegen
|
||||
* 479 Benjamin Eberle
|
||||
* 480 Mechanical Men Sweden
|
||||
* 482 Rémi de Chazelles, FR
|
||||
483 mager, Bremen
|
||||
484 jurekh, NL
|
||||
* 485 Craig Burkhead
|
||||
487 JohanHartman, SouthAfrica
|
||||
* 489 Viktor, NL
|
||||
491 Jean-Denis Carre
|
||||
492 Jesse, Canada
|
||||
493 Alex C. MacDonald, USA
|
||||
* 494 GustavoV, MX
|
||||
495 Sebastian, Berlin
|
||||
497 Bernard, Feluy
|
||||
* 500 Ron H, USA
|
||||
501 Gregg "Cabe" Bond, UK
|
||||
502 Colin, NI
|
||||
504 Robin, USA
|
||||
* 507 pkropf
|
||||
* 510 6LhasaCo Canada
|
||||
511 Tom Sepe, USA
|
||||
513 Andrew McKenna
|
||||
515 tom46037
|
||||
516 G2, USA
|
||||
* 517 Pauline Middelink, NL
|
||||
* 518 Brush Technology, Ltd
|
||||
520 Pierre Meyitang, USA
|
||||
521 Stephanie Maks, Canada
|
||||
526 John McClain
|
||||
* 527 Sigadore, US
|
||||
528 Richard Hudspeth, US
|
||||
530 Martin, Austria
|
||||
531 Stephen Eaton, Australia
|
||||
* 533 RJCE, UK
|
||||
535 Teiste, Finland
|
||||
536 Pio, UK
|
||||
537 DirtyHarry, DE
|
||||
* 540 Dom G. UK
|
||||
* 541 Nial, UK
|
||||
543 Andreas, AUT
|
||||
545 WisdomWolf
|
||||
* 549 MrMx,ES
|
||||
552 Daniel Soto, Landscape.
|
||||
554 Claus Fischer, DK
|
||||
557 Aleksi Määttä
|
||||
560 Justin Wilcott, USA
|
||||
562 LoneTone, UK
|
||||
567 Cameron, US
|
||||
568 Dirck, Germany
|
||||
569 Michael Keirnan
|
||||
571 Harry, CN
|
||||
* 572 Ward Wouts
|
||||
573 Dan Anaya, USA
|
||||
574 Ben Bennett
|
||||
575 nirvana2165, US
|
||||
576 PDG, BZH
|
||||
* 581 Visit, Thailand
|
||||
582 John Carr, UK
|
||||
* 583 Klankschap
|
||||
587 jacky,FR
|
||||
588 JD Marsters
|
||||
591 Ryan Jarvis, US
|
||||
595 Claudio Hediger, CH
|
||||
* 597 Bambam, Sweden
|
||||
598 Timothé, FR
|
||||
* 599 Luís Manuel, Portugal
|
||||
601 Eric, DE
|
||||
602 Olaf, Cambridge, UK
|
||||
* 603 Tim, Dubai
|
||||
604 Tyndell, US
|
||||
606 Ciellt AB, SE
|
||||
607 Ömer Boratav
|
||||
609 Guy Molinari, US
|
||||
614 Freek Dijkstra
|
||||
615 Carlos Camargo CO
|
||||
616 Michael Nemecky, Norway
|
||||
618 Ovidiu G.
|
||||
619 arobg, USA
|
||||
* 621 Geoff Shilling, US
|
||||
623 EliotB, NZ
|
||||
624 slos UK
|
||||
625 Montreal, CA
|
||||
* 626 Peter Korcz
|
||||
627 Kodi
|
||||
628 Jim, Valdosta, USA
|
||||
629 Sander Boele, NL
|
||||
630 Max Lupo
|
||||
631 Daniel.B, Newcastle Australia
|
||||
632 Andrés Suárez García, Vigo (Spain)
|
||||
633 Rens, NL
|
||||
634 Max Petrich, DE
|
||||
635 Fabian Affolter, CH
|
||||
636 Cadair
|
||||
* 637 Mike Karliner
|
||||
638 Daniel T, UK
|
||||
639 Mark Campbell, UK
|
||||
640 James S, Australia
|
||||
641 PBTX!
|
||||
* 642 amaza,SP
|
||||
644 se4mus
|
||||
* 645 Alexander Steffen
|
||||
* 647 Jim Richards Maine, USA
|
||||
649 Doug D, US
|
||||
650 Keaton Walker
|
||||
* 651 Scott Winder, USA
|
||||
653 Jeff Fischer, USA
|
||||
654 Andrej Mosat
|
||||
655 Mohd Faizal Mansor, Malaysia
|
||||
657 Mike "Cutter" Shievitz, US
|
||||
* 658 Daniel Andersson, SE
|
||||
659 Alexander, NL
|
||||
660 François, CH
|
||||
* 661 AndrewS, UK
|
||||
662 Denisae, PT
|
||||
663 KC8KZN
|
||||
664 Angelo, Wales
|
||||
665 BlueberryE, Germany
|
||||
667 fvlmurat
|
||||
668 Adam Wilson
|
||||
675 Ulrich Norbisrath (http://ulno.net)
|
||||
676 Daniel, Portland OR
|
||||
* 677 Andreas Lindquist, SE
|
||||
680 Jason, NL
|
||||
682 lapawa, GER
|
||||
683 John Batty, UK
|
||||
685 Addy, Netherlands
|
||||
686 Marc, CA
|
||||
690 APapantonatos
|
||||
691 gmorell, US
|
||||
* 692 Jamie Mackenzie, Adelaide, SA
|
||||
* 693 Dave Dean, US
|
||||
697 woojay, US
|
||||
698 Webabot, NY
|
||||
* 699 Jason Fehr, Canada
|
||||
700 Hadi (AU)
|
||||
* 701 Abraham Arce
|
||||
* 703 Must Be Art
|
||||
712 Thanks for the great work!/datax-holding/Stuttgart
|
||||
* 714 Thomas Pr., BE
|
||||
715 Black Country Atelier BCA
|
||||
718 Don W, Arlington VA
|
||||
721 Xavier C. (EU)
|
||||
722 Chad P. Lung, U.S.A
|
||||
726 Alexander Lash (@lexlash)
|
||||
727 Sven, MX
|
||||
728 Terence, PL
|
||||
* 730 Mauro De Giorgi, USA
|
||||
735 Jay Ward, Canada
|
||||
736 Fabian Topfstedt, AT
|
||||
739 sjoerdDOTcom
|
||||
740 David, Australia
|
||||
743 Michael Niewiera, Germany
|
||||
745 cbenhagen
|
||||
746 berserck, CH
|
||||
748 Lars Hansson, Sweden
|
||||
750 Landrash
|
||||
751 Richard B., CT USA
|
||||
752 Neil Chandler, UK
|
||||
* 753 John Griessen US
|
||||
* 755 Caminiti, Mexico
|
||||
757 Mikael Trieb, Sweden
|
||||
760 S1GM9, MX
|
||||
761 Dave C, US
|
||||
* 763 Su Zhou, China
|
||||
765 Caitlyn - USA
|
||||
769 Will, NZ
|
||||
770 CJB,UK
|
||||
771 Victor Claessen, NL
|
||||
772 Antal, CH
|
||||
773 Tokyo, Japan
|
||||
* 774 Join Business & Technology AB, Sweden
|
||||
777 Overspeed Innovation
|
||||
* 778 Bruce, Chanute KS
|
||||
779 TOPALIS, RO
|
||||
780 klaas2
|
||||
781 Matthias Schmitz, Berlin
|
||||
783 Jan Studený wishes "Python everywhere"
|
||||
788 Ian, USA
|
||||
789 Mark K, UK
|
||||
791 DerFlob, Germany
|
||||
792 Staffan Johansson, Sweden
|
||||
793 Stefan W., DE
|
||||
795 Mark S. Harris, Small Dog Electronics
|
||||
796 Kittikun, TH
|
||||
* 798 aerialist, Japan
|
||||
799 Sweta
|
||||
* 800 Mark Shuttleworth
|
||||
802 Kim Thostrup
|
||||
803 Andy Fundinger
|
||||
810 Matt Vallevand, Detroit MI
|
||||
813 Jim McDonald
|
||||
816 Rob Dobson
|
||||
817 Rafał Zieliński, PL
|
||||
* 818 Shaun Walker, AUS
|
||||
819 Timothy R, Belgium
|
||||
820 clem
|
||||
825 JuanB, ES
|
||||
826 Randall Gaz, Colorado USA
|
||||
827 Dick van Ginkel, The Netherlands
|
||||
829 Jan-Pieter Van Impe
|
||||
831 David Kirkpatrick, AU
|
||||
832 Ravi Teja, India
|
||||
833 AkosLukacs, HU
|
||||
834 Dave Desson, CAN
|
||||
837 LWQ.CZ, CZ
|
||||
838 Robert W., Issaquah, WA
|
||||
839 Daniel Hrynczenko
|
||||
840 Martin Filtenborg, DK
|
||||
841 InnHuchen, Ger
|
||||
845 Raju Pillai,India
|
||||
847 cfus/DE
|
||||
* 851 Juli H.
|
||||
853 David Monterroso Cabello , SP
|
||||
857 24x8, LLC, US
|
||||
860 Sebastian, DE
|
||||
861 pajusmar
|
||||
864 Ronnie, UK
|
||||
* 867 Travis Travelstead, USA
|
||||
* 870 Woodat, US/UK
|
||||
872 Gary Bake, UK
|
||||
873 Ernesto Martinez
|
||||
* 874 Scottt, USA
|
||||
876 Ronnie Kizzle, LA
|
||||
880 Harish, Singapore
|
||||
882 Wacht, Pittsburgh
|
||||
883 PatrickF, US
|
||||
886 Paolo, IT
|
||||
888 Defragster
|
||||
889 Rachel Rayns, UK
|
||||
* 890 Peak Data LLC
|
||||
891 Mindwarp, AU
|
||||
892 Vincent Smedley, UK
|
||||
* 894 Bailey & Brayden
|
||||
898 Jacek Artymiak, UK
|
||||
900 John Hudson, USA
|
||||
* 901 ReneS, NL
|
||||
* 902 B Stevens
|
||||
903 Cptnslick, US
|
||||
904 janlj@me.com
|
||||
905 São Caetano do Sul, SP, Brazil
|
||||
906 Lenz Hirsch
|
||||
907 SerSher, RU
|
||||
908 Florian, DE
|
||||
909 Mathias Svendsen, DK
|
||||
* 910 Jeremiah Dey-Oh
|
||||
911 Allan Joseph Medwick
|
||||
913 Matt, Australia
|
||||
914 Christian Pedersen
|
||||
* 915 SPIN
|
||||
916 Denis M., Russia
|
||||
917 Ahmed Alboori, Saudi Arabia
|
||||
918 Luciano, Italy
|
||||
919 Ragdehl
|
||||
* 921 Artur, HU
|
||||
922 Greg, NC - USA
|
||||
924 Gurzixo
|
||||
* 927 Gregg, Oregon
|
||||
928 cwschroeder, BY
|
||||
929 W. Bush - NY, USA.
|
||||
932 ddparker
|
||||
933 Enkion
|
||||
* 934 Eric G. Barron
|
||||
936 thomasDOTwtf
|
||||
940 mifous, cucurbitae.eu
|
||||
942 VFL68, FR
|
||||
943 Casey, Hong Kong
|
||||
* 945 Kean Electronics
|
||||
946 Nima, UK
|
||||
947 Klosinski, USA
|
||||
948 PieWiE, NL
|
||||
* 949 Rui Carmo, PT
|
||||
* 950 basbrun.com
|
||||
951 Aashu, UK
|
||||
* 952 vk2nq - Brian
|
||||
954 gojimmypi
|
||||
955 Jack, USA
|
||||
* 957 @SteveBattle
|
||||
* 958 Beshr, Sweden
|
||||
962 PeterR, UK
|
||||
964 Russell Calbert
|
||||
965 LAurent_B, Fr
|
||||
967 Qazi, USA
|
||||
971 Jonas, FR
|
||||
973 PK Shiu
|
||||
* 974 sea_kev
|
||||
976 Radhika, USA
|
||||
977 Chris Gibson, US
|
||||
* 978 Mike, AU
|
||||
* 979 Geeky Pete
|
||||
981 Timmy the wonderdog
|
||||
983 An Ostler it IT
|
||||
984 Frank Ray Robles
|
||||
985 Kurtsik
|
||||
987 Johan, SE
|
||||
988 NJBerland, Norway
|
||||
992 Leon Noel - @leonnoel
|
||||
994 Kjell, SE
|
||||
995 boriskourt
|
||||
997 Bartek B., CANADA
|
||||
999 Thomas Wiradikusuma, Indonesia
|
||||
1000 Trey, NOLA
|
||||
1002 Jori, FI
|
||||
1005 nmmarkin
|
||||
1006 Mattias Fornander
|
||||
1007 Panayot Daskalov, Bulgaria
|
||||
*1009 AndyP, UK
|
||||
1011 TSD
|
||||
1013 Chris, Berlin
|
||||
1017 Gareth Edwards, UK
|
||||
1018 Trixam,DE
|
||||
1019 César from Makespace Madrid, Spain
|
||||
1020 Prajwal, Australia
|
||||
*1024 Fred Dart - FTDI
|
||||
1025 bsx
|
||||
*1026 Regis, FR
|
||||
1027 Adrian Hill
|
||||
1029 Alice, UK
|
||||
1030 Erkan Shakir, BG
|
||||
1031 Alexander, EE
|
||||
1033 Patric, Luxembourg
|
||||
1034 For my beloved mother, Colleen Clancy.
|
||||
1035 NigelB
|
||||
1037 François, Aus/Fr
|
||||
*1039 Thanura Siribaddana, Australia
|
||||
1041 Harald, USA
|
||||
1042 Jeremy Utting, NZ
|
||||
1043 bejuryu, KR
|
||||
*1044 Daniel Wood, UK
|
||||
1046 C. J. Blocker
|
||||
*1047 Rodrigo Benenson, Germany
|
||||
1048 Håvard Gulldahl
|
||||
1049 SeB, Belgium
|
||||
1054 Ryan Miller, Austin TX
|
||||
1055 Gianluca Cancelmi
|
||||
1057 Francesco, IT
|
||||
1058 RockTractor!
|
||||
1060 Bill G., Atlanta GA USA
|
||||
1061 joenotjoe
|
||||
1064 ATrivedi, USA
|
||||
1067 Jim Chandler, UK
|
||||
1068 Aria Sabeti
|
||||
1069 Noah Rosamilia, USA
|
||||
1070 GAKgDavid, CA
|
||||
1072 Markus, Austria
|
||||
*1073 Tarwin, MUC
|
||||
*1077 Balazs Kinszler, HU
|
||||
*1080 pfh
|
||||
*1082 Ovidiu Hossu, SG
|
||||
*1083 mmhanif, NJ
|
||||
*1084 Wincent Balin, DE
|
||||
*1086 Anatoly Verkhovsky
|
||||
*1087 Greg, Plano
|
||||
*1089 Angelo Compagnucci
|
||||
1090 Ryan Shaw (ryannathans), AU
|
||||
1092 Dries007, BE
|
||||
*1093 Dave Snowdon, UK
|
||||
*1094 halfpress
|
||||
*1096 DeuxVis, FR
|
||||
*1097 Your Creative Solutions
|
||||
1099 Emanuele Goldoni, IT
|
||||
*1100 Tendayi Mawushe
|
||||
1101 Rob, Tikitere
|
||||
*1102 SolidStateSoul
|
||||
*1103 Michael, GER
|
||||
*1106 Paul, San Francisco
|
||||
*1107 Oddvar Lovaas
|
||||
*1108 Doc Savage, Man of Bronze
|
||||
1109 Stijn Debrouwere
|
||||
1111 Ark Nieckarz, USA
|
||||
*1112 ECS87.com, USA
|
||||
*1114 Gary P. Wolfe, USA
|
||||
1117 Tom Hodson
|
||||
*1118 @arikb (twitter)
|
||||
1123 Piotr Gryko UK
|
||||
*1125 Cantalaweb, Spain
|
||||
1126 Edward of Clovis
|
||||
1127 Jim G
|
||||
*1128 billbr, Loveland, CO, USA
|
||||
1129 dalanmiller
|
||||
*1130 StephenH, UK
|
||||
*1132 Thomas Sarlandie - @sarfata
|
||||
1133 Doug Rohm, US
|
||||
*1134 Eric Floehr, Ohio, USA
|
||||
*1135 Sven Haiges
|
||||
1136 relix42
|
||||
*1137 Ralf Nyren
|
||||
*1138 nickgb
|
||||
1139 zwack, DE
|
||||
1140 Michal B., PL
|
||||
1141 Matt, Australia
|
||||
1143 slv, Mi2
|
||||
1144 Pawel, CH
|
||||
*1145 James Saffery
|
||||
*1147 nekomatic
|
||||
*1149 @nt1, Earth
|
||||
*1150 Alister Galpin, NZ
|
||||
1151 Jayemel, UK
|
||||
1152 Koalabs
|
||||
1153 James Myatt, UK
|
||||
*1154 DanS, Norway
|
||||
1155 Sandeep, US
|
||||
*1156 Anil Kavipurapu
|
||||
*1158 Frederik Werner, DE
|
||||
1160 Erik J, Canada
|
||||
1164 bluezebra, Ireland
|
||||
1168 Birk, DE
|
||||
1169 Gabi, FR
|
||||
*1173 mliberty, USA
|
||||
1174 Jamie Smith, Scotland
|
||||
1175 Sebastian, Germany
|
||||
*1176 John Cooper, UK
|
||||
1177 Moritz, DE
|
||||
1178 Kevin, DE
|
||||
*1179 Ming Leung, Canada
|
||||
1180 Laird Popkin
|
||||
1181 tasmaniac, GA
|
||||
*1183 RichardW, UK
|
||||
*1187 Thomas Quinlan, London, UK
|
||||
1188 LGnap, BE
|
||||
*1189 bloater, Edinburgh UK
|
||||
1192 pakt, SE
|
||||
1194 Sandsmark, NO
|
||||
*1195 Gert Menke
|
||||
1197 Emsi88, SK
|
||||
1199 GTtronics HK Ltd.
|
||||
1200 Jo, Bergen
|
||||
*1202 MarkS, Australia
|
||||
1203 Igor, HR
|
||||
1204 Lord Nightmare
|
||||
1205 Great Uncle Bulgaria, UK
|
||||
*1206 salomonderossi
|
||||
1208 Master_Ipse, DE
|
||||
1209 Luis G.F, ES
|
||||
1211 Harald, FO
|
||||
*1212 Kimmo, Finland
|
||||
*1213 P. Perreijn, Netherlands
|
||||
1214 jcea, Spain
|
||||
1215 simon holmes à court
|
||||
1217 Bill M, Newcastle
|
||||
*1218 snowball
|
||||
*1221 Georges, CDN
|
||||
1222 JPLa
|
||||
1225 Erik Gullberg, Sweden
|
||||
1226 Matthias Fuchs, IN, Germany
|
||||
1229 Majed, CA
|
||||
1230 Michiel, Reeuwijk
|
||||
1231 Clive, Essex UK
|
||||
1232 Jan Kalina, CZ
|
||||
1234 MBBest, Australia
|
||||
*1235 Reinoud de Lange, NL
|
||||
1237 Jeffrey Park, South Korea
|
||||
1238 David Olson
|
||||
1239 Nathan Battan
|
||||
1240 Marcus, TW
|
||||
1241 randyrrt, USA
|
||||
1242 Holger, Germany
|
||||
1243 Dmitri Chapkine, FRANCE
|
||||
1244 Ceyhun Kapucu, TR
|
||||
1245 Hong Kong
|
||||
*1246 gPozo, US
|
||||
1247 Peter M, Sweden
|
||||
*1249 Duncan, Cambridge
|
||||
*1251 Schaeferling, DE
|
||||
1252 Christian Prior, DE
|
||||
*1256 ovig
|
||||
1257 Kerry Channing, UK
|
||||
1258 Exception42, GER
|
||||
*1259 nchalikias
|
||||
1261 Kittie, US
|
||||
1263 Alex, Norway
|
||||
1264 wats0n, TW
|
||||
*1265 Henner
|
||||
*1266 Mike M, AZ, USA
|
||||
1268 Bobby Ly, USA
|
||||
*1269 Espen STO, Norway
|
||||
1270 arduware.cc
|
||||
1274 Christopher Flynn, NH USA
|
||||
*1275 Bruce Boyes, USA
|
||||
1276 DCH
|
||||
1278 McGinkel, Netherlands
|
||||
1279 Dieter, Wien
|
||||
1280 R. Tummers, NL
|
||||
1283 Pranav Maddula, USA
|
||||
1286 Dusan, SLovakia
|
||||
1290 Stephen Youndt
|
||||
*1291 Lertsenem, FR
|
||||
1292 NuclearTide, London
|
||||
1293 Ben Gift, USA
|
||||
1294 rmg
|
||||
1295 jmaybe, USA
|
||||
1296 Allan G, Georgia
|
||||
1297 Duncan Brassington, UK
|
||||
1300 Hans, NL
|
||||
1301 Valerio "valdez" Paolini, IT
|
||||
1303 Neotreat, DE
|
||||
1306 tomtoump
|
||||
1307 Edward B Cox, England
|
||||
1310 Oliver Steele
|
||||
1311 merps, AUS
|
||||
1313 n8henrie, USA
|
||||
*1314 YGA-KSD n7/ULB, FR-BE
|
||||
1317 Adrian, Romania
|
||||
*1318 Luca "Loop", ITA
|
||||
*1319 Michael Twomey, Ireland
|
||||
1321 Trey Aughenbaugh
|
||||
1322 Marcel Hecko, SK
|
||||
1323 Hugo Neira, CL
|
||||
1326 JH, US
|
||||
*1330 Luthander, SE
|
||||
1331 Rickard Dahlstrand, Sweden
|
||||
1333 Olivier M., France
|
||||
1334 DWVL, UK
|
||||
1335 MRZANE, Sweden
|
||||
1336 Benedikt, DE
|
||||
*1338 Tiegeng, US
|
||||
*1339 arthoo Eindhoven Nederland
|
||||
1340 Magnus Gustavsson, Sweden
|
||||
1341 Jan Bednařík
|
||||
1344 Mike McGary: US
|
||||
1346 mp3tobi
|
||||
*1350 Cyberhippy
|
||||
1351 Sandro, PT
|
||||
1355 Kwabena W. Agyeman
|
||||
1357 Ryan Young
|
||||
*1358 Chiang Mai, Thailand
|
||||
1359 AKLitman, USA
|
||||
1360 JASK Enterprises, Ltd-John
|
||||
*1361 Tom Gidden, UK
|
||||
1362 AdamT, USA
|
||||
1363 Jose de la Campa, BOL
|
||||
1365 Steve Laguna, U.S.A
|
||||
*1368 Walrusklasse, NL
|
||||
1370 Timofei Korostelev, Belarus
|
||||
1374 Janos,HU
|
||||
*1375 Paul Cunnane
|
||||
1377 IanE, UK
|
||||
1378 Hans, NL
|
||||
1379 Jose Angel Jimenez Vadillo, Spain
|
||||
*1380 PaulT, Lancs
|
||||
1383 Lutz; DE
|
||||
1385 AnRkey
|
||||
1387 Fredrik, FIN
|
||||
1388 Matt W (funkyHat)
|
||||
1389 Zeev Rotshtein, Israel
|
||||
1391 joostd, NL
|
||||
1392 Lukasz Blaszczyk, USA
|
||||
*1397 Wei-Ning Huang, TW
|
||||
1398 myu
|
||||
*1399 Thorsten, Germany
|
||||
1401 sm0ihr
|
||||
1403 Xiaotian, Seattle US
|
||||
*1406 -gt-, Czech Republic
|
||||
1407 Mike Y. Diallo, US
|
||||
1409 ubii, US
|
||||
|
||||
@@ -1,3 +1,31 @@
|
||||
Git commit conventions
|
||||
======================
|
||||
|
||||
Each commit message should start with a directory or full file path
|
||||
prefix, so it was clear which part of codebase a commit affects. If
|
||||
a change affects one file, it's better to use path to a file. If it
|
||||
affects few files in a subdirectory, using subdirectory as a prefix
|
||||
is ok. For longish paths, it's acceptable to drop intermediate
|
||||
components, which still should provide good context of a change.
|
||||
It's also ok to drop file extensions.
|
||||
|
||||
Besides prefix, first line of a commit message should describe a
|
||||
change clearly and to the point, and be a grammatical sentence with
|
||||
final full stop. First line should fit within 78 characters. Examples
|
||||
of good first line of commit messages:
|
||||
|
||||
py/objstr: Add splitlines() method.
|
||||
py: Rename FOO to BAR.
|
||||
docs/machine: Fix typo in reset() description.
|
||||
ports: Switch to use lib/foo instead of duplicated code.
|
||||
|
||||
After the first line, add an empty line and in following lines describe
|
||||
a change in a detail, if needed. Any change beyond 5 lines would likely
|
||||
require such detailed description.
|
||||
|
||||
To get good practical examples of good commits and their messages, browse
|
||||
thry the `git log` of the project.
|
||||
|
||||
Python code conventions
|
||||
=======================
|
||||
|
||||
@@ -33,37 +61,50 @@ Braces:
|
||||
closing brace.
|
||||
|
||||
Header files:
|
||||
- Try to stick to the Plan 9 header style, where header files do not
|
||||
include other header files.
|
||||
- Don't protect a header file from multiple inclusion with #if directives.
|
||||
- Header files should be protected from multiple inclusion with #if
|
||||
directives. See an existing header for naming convention.
|
||||
|
||||
Type names and declarations:
|
||||
- When defining a type, put '_t' after it.
|
||||
Names:
|
||||
- Use underscore_case, not camelCase for all names.
|
||||
- Use CAPS_WITH_UNDERSCORE for enums and macros.
|
||||
- When defining a type use underscore_case and put '_t' after it.
|
||||
|
||||
Integer types: Micro Python runs on 32 and 64 bit machines (and one day
|
||||
maybe 16 bit), so it's important to use the correctly-sized (and signed)
|
||||
integer types. The general guidelines are:
|
||||
Integer types: MicroPython runs on 16, 32, and 64 bit machines, so it's
|
||||
important to use the correctly-sized (and signed) integer types. The
|
||||
general guidelines are:
|
||||
- For most cases use mp_int_t for signed and mp_uint_t for unsigned
|
||||
integer values. These are guaranteed to be machine-word sized and
|
||||
therefore big enough to hold the value from a Micro Python small-int
|
||||
therefore big enough to hold the value from a MicroPython small-int
|
||||
object.
|
||||
- Use size_t for things that count bytes / sizes of objects.
|
||||
- You can use int/uint, but remember that they may be 16-bits wide.
|
||||
- If in doubt, use mp_int_t/mp_uint_t.
|
||||
|
||||
Comments:
|
||||
- Be concise and only write comments for things that are not obvious.
|
||||
- Use `// ` prefix, NOT `/* ... */`. No extra fluff.
|
||||
|
||||
Memory allocation:
|
||||
- Use m_new, m_renew, m_del (and friends) to allocate and free heap memory.
|
||||
These macros are defined in py/misc.h.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
Braces and spaces:
|
||||
Braces, spaces, names and comments:
|
||||
|
||||
int foo(int x, int y) {
|
||||
if (x < y) {
|
||||
foo(y, x);
|
||||
#define TO_ADD (123)
|
||||
|
||||
// This function will always recurse indefinitely and is only used to show
|
||||
// coding style
|
||||
int foo_function(int x, int some_value) {
|
||||
if (x < some_value) {
|
||||
foo(some_value, x);
|
||||
} else {
|
||||
foo(x + 1, y - 1);
|
||||
foo(x + TO_ADD, some_value - 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < x; i++) {
|
||||
for (int my_counter = 0; my_counter < x; my_counter++) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
8
CONTRIBUTING.md
Normal file
8
CONTRIBUTING.md
Normal file
@@ -0,0 +1,8 @@
|
||||
When reporting an issue and especially submitting a pull request, please
|
||||
make sure that you are acquainted with Contributor Guidelines:
|
||||
|
||||
https://github.com/micropython/micropython/wiki/ContributorGuidelines
|
||||
|
||||
and Code Conventions:
|
||||
|
||||
https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md
|
||||
120
README.md
120
README.md
@@ -8,24 +8,26 @@
|
||||
[istats-issue-img]: http://issuestats.com/github/micropython/micropython/badge/issue
|
||||
[istats-issue-repo]: http://issuestats.com/github/micropython/micropython
|
||||
|
||||
The Micro Python project
|
||||
========================
|
||||
The MicroPython project
|
||||
=======================
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/micropython/micropython/master/logo/upython-with-micro.jpg" alt="MicroPython Logo"/>
|
||||
</p>
|
||||
|
||||
This is the Micro Python project, which aims to put an implementation
|
||||
This is the MicroPython project, which aims to put an implementation
|
||||
of Python 3.x on microcontrollers and small embedded systems.
|
||||
You can find the official website at [micropython.org](http://www.micropython.org).
|
||||
|
||||
WARNING: this project is in beta stage and is subject to changes of the
|
||||
code-base, including project-wide name changes and API changes.
|
||||
|
||||
Micro Python implements the entire Python 3.4 syntax (including exceptions,
|
||||
"with", "yield from", etc.). The following core datatypes are provided:
|
||||
str (including basic Unicode support), bytes, bytearray, tuple, list, dict,
|
||||
set, frozenset, array.array, collections.namedtuple, classes and instances.
|
||||
Builtin modules include sys, time, and struct. Note that only subset of
|
||||
Python 3.4 functionality implemented for the data types and modules.
|
||||
MicroPython implements the entire Python 3.4 syntax (including exceptions,
|
||||
"with", "yield from", etc., and additionally "async" keyword from Python 3.5).
|
||||
The following core datatypes are provided: str (including basic Unicode
|
||||
support), bytes, bytearray, tuple, list, dict, set, frozenset, array.array,
|
||||
collections.namedtuple, classes and instances. Builtin modules include sys,
|
||||
time, and struct. Note that only subset of Python 3.4 functionality
|
||||
implemented for the data types and modules.
|
||||
|
||||
See the repository www.github.com/micropython/pyboard for the Micro
|
||||
Python board, the officially supported reference electronic circuit board.
|
||||
@@ -33,22 +35,26 @@ Python board, the officially supported reference electronic circuit board.
|
||||
Major components in this repository:
|
||||
- py/ -- the core Python implementation, including compiler, runtime, and
|
||||
core library.
|
||||
- unix/ -- a version of Micro Python that runs on Unix.
|
||||
- stmhal/ -- a version of Micro Python that runs on the Micro Python board
|
||||
- unix/ -- a version of MicroPython that runs on Unix.
|
||||
- stmhal/ -- a version of MicroPython that runs on the MicroPython board
|
||||
with an STM32F405RG (using ST's Cube HAL drivers).
|
||||
- minimal/ -- a minimal Micro Python port. Start with this if you want
|
||||
to port Micro Python to another microcontroller.
|
||||
- minimal/ -- a minimal MicroPython port. Start with this if you want
|
||||
to port MicroPython to another microcontroller.
|
||||
- tests/ -- test framework and test scripts.
|
||||
- docs/ -- user documentation in Sphinx reStructuredText format.
|
||||
|
||||
Additional components:
|
||||
- bare-arm/ -- a bare minimum version of Micro Python for ARM MCUs. Used
|
||||
- bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used
|
||||
mostly to control code size.
|
||||
- teensy/ -- a version of Micro Python that runs on the Teensy 3.1
|
||||
- teensy/ -- a version of MicroPython that runs on the Teensy 3.1
|
||||
(preliminary but functional).
|
||||
- unix-cpy/ -- a version of Micro Python that outputs bytecode (for testing).
|
||||
- tests/ -- test framework and test scripts.
|
||||
- pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
|
||||
- cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
|
||||
- esp8266/ -- an experimental port for ESP8266 WiFi modules.
|
||||
- tools/ -- various tools, including the pyboard.py module.
|
||||
- examples/ -- a few example Python scripts.
|
||||
- docs/ -- official documentation in RST format.
|
||||
|
||||
The subdirectories above may include READMEs with additional info.
|
||||
|
||||
"make" is used to build the components, or "gmake" on BSD-based systems.
|
||||
You will also need bash and Python (at least 2.7 or 3.3).
|
||||
@@ -62,9 +68,10 @@ as ARM and MIPS. Making full-featured port to another architecture requires
|
||||
writing some assembly code for the exception handling and garbage collection.
|
||||
Alternatively, fallback implementation based on setjmp/longjmp can be used.
|
||||
|
||||
To build:
|
||||
To build (see section below for required dependencies):
|
||||
|
||||
$ cd unix
|
||||
$ make axtls
|
||||
$ make
|
||||
|
||||
Then to give it a try:
|
||||
@@ -72,21 +79,62 @@ Then to give it a try:
|
||||
$ ./micropython
|
||||
>>> list(5 * x + y for x in range(10) for y in [4, 2, 1])
|
||||
|
||||
Use `CTRL-D` (i.e. EOF) to exit the shell.
|
||||
Learn about command-line options (in particular, how to increase heap size
|
||||
which may be needed for larger applications):
|
||||
|
||||
$ ./micropython --help
|
||||
|
||||
Run complete testsuite:
|
||||
|
||||
$ make test
|
||||
|
||||
Debian/Ubuntu/Mint derivative Linux distros will require build-essentials and
|
||||
libreadline-dev packages installed. To build FFI (Foreign Function Interface)
|
||||
module, libffi-dev and pkg-config packages are required. If you have problems
|
||||
with some dependencies, they can be disabled in unix/mpconfigport.mk .
|
||||
Unix version comes with a builtin package manager called upip, e.g.:
|
||||
|
||||
$ ./micropython -m upip install micropython-pystone
|
||||
$ ./micropython -m pystone
|
||||
|
||||
Browse available modules on
|
||||
[PyPI](https://pypi.python.org/pypi?%3Aaction=search&term=micropython).
|
||||
Standard library modules come from
|
||||
[micropython-lib](https://github.com/micropython/micropython-lib) project.
|
||||
|
||||
External dependencies
|
||||
---------------------
|
||||
|
||||
Building Unix version requires some dependencies installed. For
|
||||
Debian/Ubuntu/Mint derivative Linux distros, install `build-essential`
|
||||
(includes toolchain and make), `libffi-dev`, and `pkg-config` packages.
|
||||
|
||||
Other dependencies can be built together with MicroPython. Oftentimes,
|
||||
you need to do this to enable extra features or capabilities. To build
|
||||
these additional dependencies, first fetch git submodules for them:
|
||||
|
||||
$ git submodule update --init
|
||||
|
||||
Use this same command to get the latest versions of dependencies, as
|
||||
they are updated from time to time. After that, in `unix/` dir, execute:
|
||||
|
||||
$ make deplibs
|
||||
|
||||
This will build all available dependencies (regardless whether they
|
||||
are used or not). If you intend to build MicroPython with additional
|
||||
options (like cross-compiling), the same set of options should be passed
|
||||
to `make deplibs`. To actually enabled use of dependencies, edit
|
||||
`unix/mpconfigport.mk` file, which has inline descriptions of the options.
|
||||
For example, to build SSL module (required for `upip` tool described above),
|
||||
set `MICROPY_PY_USSL` to 1.
|
||||
|
||||
In `unix/mpconfigport.mk`, you can also disable some dependencies enabled
|
||||
by default, like FFI support, which requires libffi development files to
|
||||
be installed.
|
||||
|
||||
The STM version
|
||||
---------------
|
||||
|
||||
The "stmhal" port requires an ARM compiler, arm-none-eabi-gcc, and associated
|
||||
bin-utils. For those using Arch Linux, you need arm-none-eabi-binutils and
|
||||
arm-none-eabi-gcc packages from the AUR. Otherwise, try here:
|
||||
arm-none-eabi-gcc packages. Otherwise, try here:
|
||||
https://launchpad.net/gcc-arm-embedded
|
||||
|
||||
To build:
|
||||
@@ -102,23 +150,7 @@ Then to flash the code via USB DFU to your device:
|
||||
|
||||
$ make deploy
|
||||
|
||||
You will need the dfu-util program, on Arch Linux it's dfu-util-git in the
|
||||
AUR. If the above does not work it may be because you don't have the
|
||||
correct permissions. Try then:
|
||||
|
||||
$ sudo dfu-util -a 0 -d 0483:df11 -D build-PYBV10/firmware.dfu
|
||||
|
||||
Building the documentation locally
|
||||
----------------------------------
|
||||
|
||||
Install Sphinx, and optionally (for the RTD-styling), sphinx_rtd_theme,
|
||||
preferably in a virtualenv:
|
||||
|
||||
pip install sphinx
|
||||
pip install sphinx_rtd_theme
|
||||
|
||||
In `micropython/docs`, build the docs:
|
||||
|
||||
make html
|
||||
|
||||
You'll find the index page at `micropython/docs/build/html/index.html`.
|
||||
This will use the included `tools/pydfu.py` script. If flashing the firmware
|
||||
does not work it may be because you don't have the correct permissions, and
|
||||
need to use `sudo make deploy`.
|
||||
See the README.md file in the stmhal/ directory for further details.
|
||||
|
||||
@@ -8,7 +8,7 @@ include ../py/py.mk
|
||||
|
||||
CROSS_COMPILE = arm-none-eabi-
|
||||
|
||||
INC = -I.
|
||||
INC += -I.
|
||||
INC += -I..
|
||||
INC += -I$(BUILD)
|
||||
|
||||
@@ -42,7 +42,7 @@ all: $(BUILD)/firmware.elf
|
||||
|
||||
$(BUILD)/firmware.elf: $(OBJ)
|
||||
$(ECHO) "LINK $@"
|
||||
$(Q)$(LD) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
|
||||
$(Q)$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
$(Q)$(SIZE) $@
|
||||
|
||||
include ../py/mkrules.mk
|
||||
|
||||
@@ -6,9 +6,8 @@
|
||||
#include "py/compile.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/repl.h"
|
||||
#include "py/pfenv.h"
|
||||
|
||||
void do_str(const char *src) {
|
||||
void do_str(const char *src, mp_parse_input_kind_t input_kind) {
|
||||
mp_lexer_t *lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, src, strlen(src), 0);
|
||||
if (lex == NULL) {
|
||||
return;
|
||||
@@ -17,26 +16,24 @@ void do_str(const char *src) {
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
qstr source_name = lex->source_name;
|
||||
mp_parse_node_t pn = mp_parse(lex, MP_PARSE_SINGLE_INPUT);
|
||||
mp_obj_t module_fun = mp_compile(pn, source_name, MP_EMIT_OPT_NONE, true);
|
||||
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
|
||||
mp_obj_t module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, true);
|
||||
mp_call_function_0(module_fun);
|
||||
nlr_pop();
|
||||
} else {
|
||||
// uncaught exception
|
||||
mp_obj_print_exception(printf_wrapper, NULL, (mp_obj_t)nlr.ret_val);
|
||||
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
mp_init();
|
||||
do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\n')");
|
||||
do_str("print('hello world!', list(x+1 for x in range(10)), end='eol\\n')", MP_PARSE_SINGLE_INPUT);
|
||||
do_str("for i in range(10):\n print(i)", MP_PARSE_FILE_INPUT);
|
||||
mp_deinit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gc_collect(void) {
|
||||
}
|
||||
|
||||
mp_lexer_t *mp_lexer_new_from_file(const char *filename) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -45,7 +42,7 @@ mp_import_stat_t mp_import_stat(const char *path) {
|
||||
return MP_IMPORT_STAT_NO_EXIST;
|
||||
}
|
||||
|
||||
mp_obj_t mp_builtin_open(uint n_args, const mp_obj_t *args, mp_map_t *kwargs) {
|
||||
mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs) {
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
// options to control how Micro Python is built
|
||||
|
||||
#define MICROPY_QSTR_BYTES_IN_HASH (1)
|
||||
#define MICROPY_ALLOC_PATH_MAX (512)
|
||||
#define MICROPY_EMIT_X64 (0)
|
||||
#define MICROPY_EMIT_THUMB (0)
|
||||
@@ -18,15 +19,20 @@
|
||||
#define MICROPY_ENABLE_SOURCE_LINE (0)
|
||||
#define MICROPY_ENABLE_DOC_STRING (0)
|
||||
#define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE)
|
||||
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0)
|
||||
#define MICROPY_PY_ASYNC_AWAIT (0)
|
||||
#define MICROPY_PY_BUILTINS_BYTEARRAY (0)
|
||||
#define MICROPY_PY_BUILTINS_MEMORYVIEW (0)
|
||||
#define MICROPY_PY_BUILTINS_ENUMERATE (0)
|
||||
#define MICROPY_PY_BUILTINS_FROZENSET (0)
|
||||
#define MICROPY_PY_BUILTINS_REVERSED (0)
|
||||
#define MICROPY_PY_BUILTINS_SET (0)
|
||||
#define MICROPY_PY_BUILTINS_SLICE (0)
|
||||
#define MICROPY_PY_BUILTINS_PROPERTY (0)
|
||||
#define MICROPY_PY___FILE__ (0)
|
||||
#define MICROPY_PY_GC (0)
|
||||
#define MICROPY_PY_ARRAY (0)
|
||||
#define MICROPY_PY_ATTRTUPLE (0)
|
||||
#define MICROPY_PY_COLLECTIONS (0)
|
||||
#define MICROPY_PY_MATH (0)
|
||||
#define MICROPY_PY_CMATH (0)
|
||||
@@ -52,6 +58,9 @@ typedef void *machine_ptr_t; // must be of pointer size
|
||||
typedef const void *machine_const_ptr_t; // must be of pointer size
|
||||
typedef long mp_off_t;
|
||||
|
||||
// dummy print
|
||||
#define MP_PLAT_PRINT_STRN(str, len) (void)0
|
||||
|
||||
// extra built in names to add to the global namespace
|
||||
extern const struct _mp_obj_fun_builtin_t mp_builtin_open_obj;
|
||||
#define MICROPY_PORT_BUILTINS \
|
||||
|
||||
1
bare-arm/mphalport.h
Normal file
1
bare-arm/mphalport.h
Normal file
@@ -0,0 +1 @@
|
||||
// empty file
|
||||
@@ -84,7 +84,13 @@
|
||||
#define configCPU_CLOCK_HZ ( ( unsigned long ) 80000000 )
|
||||
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 72 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 16384 ) )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( \
|
||||
16384 /* 16kbytes for FreeRTOS data structures and heap */ \
|
||||
- sizeof(StaticTask_t) - configMINIMAL_STACK_SIZE * sizeof(StackType_t) /* TCB+stack for idle task */ \
|
||||
- sizeof(StaticTask_t) - 1024 /* TCB+stack for servers task */ \
|
||||
- sizeof(StaticTask_t) - 6656 /* TCB+stack for main MicroPython task */ \
|
||||
- sizeof(StaticTask_t) - 896 /* TCB+stack for simplelink spawn task */ \
|
||||
) )
|
||||
#define configMAX_TASK_NAME_LEN ( 8 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
@@ -151,4 +157,17 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
version. */
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
|
||||
/* We provide a definition of ucHeap so it can go in a special segment. */
|
||||
#define configAPPLICATION_ALLOCATED_HEAP 1
|
||||
|
||||
/* We use static versions of functions (like xTaskCreateStatic) */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
|
||||
/* For threading */
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 1
|
||||
#undef configUSE_MUTEXES
|
||||
#define configUSE_MUTEXES 1
|
||||
#undef INCLUDE_vTaskDelete
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
||||
|
||||
@@ -1,54 +1,59 @@
|
||||
The FreeRTOS source code is licensed by a *modified* GNU General Public
|
||||
License (GPL). The modification is provided in the form of an exception.
|
||||
|
||||
NOTE: The modification to the GPL is included to allow you to distribute a
|
||||
combined work that includes FreeRTOS without being obliged to provide the source
|
||||
code for proprietary components outside of the FreeRTOS kernel.
|
||||
|
||||
|
||||
The FreeRTOS open source license covers the FreeRTOS source files,
|
||||
which are located in the /FreeRTOS/Source directory of the official FreeRTOS
|
||||
download. It also covers most of the source files in the demo application
|
||||
projects, which are located in the /FreeRTOS/Demo directory of the official
|
||||
FreeRTOS download. The demo projects may also include third party software that
|
||||
is not part of FreeRTOS and is licensed separately to FreeRTOS. Examples of
|
||||
third party software includes header files provided by chip or tools vendors,
|
||||
linker scripts, peripheral drivers, etc. All the software in subdirectories of
|
||||
the /FreeRTOS directory is either open source or distributed with permission,
|
||||
and is free for use. For the avoidance of doubt, refer to the comments at the
|
||||
top of each source file.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
The FreeRTOS GPL Exception Text:
|
||||
NOTE: The modification to the GPL is included to allow you to distribute a
|
||||
combined work that includes FreeRTOS without being obliged to provide the source
|
||||
code for proprietary components.
|
||||
|
||||
Any FreeRTOS source code, whether modified or in it's original release form,
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Applying to FreeRTOS V8.2.3 up to the latest version, the FreeRTOS GPL Exception
|
||||
Text follows:
|
||||
|
||||
Any FreeRTOS *source code*, whether modified or in it's original release form,
|
||||
or whether in whole or in part, can only be distributed by you under the terms
|
||||
of the GNU General Public License plus this exception. An independent module is
|
||||
of the GNU General Public License plus this exception. An independent module is
|
||||
a module which is not derived from or based on FreeRTOS.
|
||||
|
||||
Clause 1:
|
||||
|
||||
Linking FreeRTOS statically or dynamically with other modules is making a
|
||||
combined work based on FreeRTOS. Thus, the terms and conditions of the GNU
|
||||
General Public License cover the whole combination.
|
||||
Linking FreeRTOS with other modules is making a combined work based on FreeRTOS.
|
||||
Thus, the terms and conditions of the GNU General Public License V2 cover the
|
||||
whole combination.
|
||||
|
||||
As a special exception, the copyright holder of FreeRTOS gives you permission
|
||||
to link FreeRTOS with independent modules that communicate with FreeRTOS
|
||||
solely through the FreeRTOS API interface, regardless of the license terms of
|
||||
these independent modules, and to copy and distribute the resulting combined
|
||||
work under terms of your choice, provided that
|
||||
|
||||
+ Every copy of the combined work is accompanied by a written statement that
|
||||
details to the recipient the version of FreeRTOS used and an offer by yourself
|
||||
to provide the FreeRTOS source code (including any modifications you may have
|
||||
made) should the recipient request it.
|
||||
|
||||
+ The combined work is not itself an RTOS, scheduler, kernel or related product.
|
||||
|
||||
+ The independent modules add significant and primary functionality to FreeRTOS
|
||||
and do not merely extend the existing functionality already present in FreeRTOS.
|
||||
As a special exception, the copyright holders of FreeRTOS give you permission to
|
||||
link FreeRTOS with independent modules to produce a statically linked
|
||||
executable, regardless of the license terms of these independent modules, and to
|
||||
copy and distribute the resulting executable under terms of your choice,
|
||||
provided that you also meet, for each linked independent module, the terms and
|
||||
conditions of the license of that module. An independent module is a module
|
||||
which is not derived from or based on FreeRTOS.
|
||||
|
||||
Clause 2:
|
||||
|
||||
FreeRTOS may not be used for any competitive or comparative purpose, including the
|
||||
publication of any form of run time or compile time metric, without the express
|
||||
permission of Real Time Engineers Ltd. (this is the norm within the industry and
|
||||
is intended to ensure information accuracy).
|
||||
FreeRTOS may not be used for any competitive or comparative purpose, including
|
||||
the publication of any form of run time or compile time metric, without the
|
||||
express permission of Real Time Engineers Ltd. (this is the norm within the
|
||||
industry and is intended to ensure information accuracy).
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
The standard GPL exception text:
|
||||
|
||||
|
||||
The standard GPL V2 text:
|
||||
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -67,6 +71,9 @@
|
||||
#include "task.h"
|
||||
#include "croutine.h"
|
||||
|
||||
/* Remove the whole file is co-routines are not being used. */
|
||||
#if( configUSE_CO_ROUTINES != 0 )
|
||||
|
||||
/*
|
||||
* Some kernel aware debuggers require data to be viewed to be global, rather
|
||||
* than file scope.
|
||||
@@ -384,3 +391,5 @@ BaseType_t xReturn;
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* configUSE_CO_ROUTINES == 0 */
|
||||
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -83,14 +87,6 @@ header files above, but not in this file, in order to generate the correct
|
||||
privileged Vs unprivileged linkage and placement. */
|
||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */
|
||||
|
||||
#if ( INCLUDE_xEventGroupSetBitFromISR == 1 ) && ( configUSE_TIMERS == 0 )
|
||||
#error configUSE_TIMERS must be set to 1 to make the xEventGroupSetBitFromISR() function available.
|
||||
#endif
|
||||
|
||||
#if ( INCLUDE_xEventGroupSetBitFromISR == 1 ) && ( INCLUDE_xTimerPendFunctionCall == 0 )
|
||||
#error INCLUDE_xTimerPendFunctionCall must also be set to one to make the xEventGroupSetBitFromISR() function available.
|
||||
#endif
|
||||
|
||||
/* The following bit fields convey control information in a task's event list
|
||||
item value. It is important they don't clash with the
|
||||
taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
|
||||
@@ -115,6 +111,9 @@ typedef struct xEventGroupDefinition
|
||||
UBaseType_t uxEventGroupNumber;
|
||||
#endif
|
||||
|
||||
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||
uint8_t ucStaticallyAllocated; /*< Set to pdTRUE if the event group is statically allocated to ensure no attempt is made to free the memory. */
|
||||
#endif
|
||||
} EventGroup_t;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
@@ -127,28 +126,83 @@ typedef struct xEventGroupDefinition
|
||||
* wait condition is met if any of the bits set in uxBitsToWait for are also set
|
||||
* in uxCurrentEventBits.
|
||||
*/
|
||||
static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, const EventBits_t uxBitsToWaitFor, const BaseType_t xWaitForAllBits );
|
||||
static BaseType_t prvTestWaitCondition( const EventBits_t uxCurrentEventBits, const EventBits_t uxBitsToWaitFor, const BaseType_t xWaitForAllBits ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
EventGroupHandle_t xEventGroupCreate( void )
|
||||
{
|
||||
EventGroup_t *pxEventBits;
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
|
||||
pxEventBits = pvPortMalloc( sizeof( EventGroup_t ) );
|
||||
if( pxEventBits != NULL )
|
||||
EventGroupHandle_t xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer )
|
||||
{
|
||||
pxEventBits->uxEventBits = 0;
|
||||
vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );
|
||||
traceEVENT_GROUP_CREATE( pxEventBits );
|
||||
}
|
||||
else
|
||||
{
|
||||
traceEVENT_GROUP_CREATE_FAILED();
|
||||
EventGroup_t *pxEventBits;
|
||||
|
||||
/* A StaticEventGroup_t object must be provided. */
|
||||
configASSERT( pxEventGroupBuffer );
|
||||
|
||||
/* The user has provided a statically allocated event group - use it. */
|
||||
pxEventBits = ( EventGroup_t * ) pxEventGroupBuffer; /*lint !e740 EventGroup_t and StaticEventGroup_t are guaranteed to have the same size and alignment requirement - checked by configASSERT(). */
|
||||
|
||||
if( pxEventBits != NULL )
|
||||
{
|
||||
pxEventBits->uxEventBits = 0;
|
||||
vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );
|
||||
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
{
|
||||
/* Both static and dynamic allocation can be used, so note that
|
||||
this event group was created statically in case the event group
|
||||
is later deleted. */
|
||||
pxEventBits->ucStaticallyAllocated = pdTRUE;
|
||||
}
|
||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
|
||||
traceEVENT_GROUP_CREATE( pxEventBits );
|
||||
}
|
||||
else
|
||||
{
|
||||
traceEVENT_GROUP_CREATE_FAILED();
|
||||
}
|
||||
|
||||
return ( EventGroupHandle_t ) pxEventBits;
|
||||
}
|
||||
|
||||
return ( EventGroupHandle_t ) pxEventBits;
|
||||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
|
||||
EventGroupHandle_t xEventGroupCreate( void )
|
||||
{
|
||||
EventGroup_t *pxEventBits;
|
||||
|
||||
/* Allocate the event group. */
|
||||
pxEventBits = ( EventGroup_t * ) pvPortMalloc( sizeof( EventGroup_t ) );
|
||||
|
||||
if( pxEventBits != NULL )
|
||||
{
|
||||
pxEventBits->uxEventBits = 0;
|
||||
vListInitialise( &( pxEventBits->xTasksWaitingForBits ) );
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
{
|
||||
/* Both static and dynamic allocation can be used, so note this
|
||||
event group was allocated statically in case the event group is
|
||||
later deleted. */
|
||||
pxEventBits->ucStaticallyAllocated = pdFALSE;
|
||||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
traceEVENT_GROUP_CREATE( pxEventBits );
|
||||
}
|
||||
else
|
||||
{
|
||||
traceEVENT_GROUP_CREATE_FAILED();
|
||||
}
|
||||
|
||||
return ( EventGroupHandle_t ) pxEventBits;
|
||||
}
|
||||
|
||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait )
|
||||
@@ -276,6 +330,7 @@ BaseType_t xTimeoutOccurred = pdFALSE;
|
||||
|
||||
/* Check the user is not attempting to wait on the bits used by the kernel
|
||||
itself, and that at least one bit is being requested. */
|
||||
configASSERT( xEventGroup );
|
||||
configASSERT( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
||||
configASSERT( uxBitsToWaitFor != 0 );
|
||||
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
|
||||
@@ -421,6 +476,7 @@ EventBits_t uxReturn;
|
||||
|
||||
/* Check the user is not attempting to clear the bits used by the kernel
|
||||
itself. */
|
||||
configASSERT( xEventGroup );
|
||||
configASSERT( ( uxBitsToClear & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
@@ -482,6 +538,7 @@ BaseType_t xMatchFound = pdFALSE;
|
||||
|
||||
/* Check the user is not attempting to set the bits used by the kernel
|
||||
itself. */
|
||||
configASSERT( xEventGroup );
|
||||
configASSERT( ( uxBitsToSet & eventEVENT_BITS_CONTROL_BYTES ) == 0 );
|
||||
|
||||
pxList = &( pxEventBits->xTasksWaitingForBits );
|
||||
@@ -581,7 +638,26 @@ const List_t *pxTasksWaitingForBits = &( pxEventBits->xTasksWaitingForBits );
|
||||
( void ) xTaskRemoveFromUnorderedEventList( pxTasksWaitingForBits->xListEnd.pxNext, eventUNBLOCKED_DUE_TO_BIT_SET );
|
||||
}
|
||||
|
||||
vPortFree( pxEventBits );
|
||||
#if( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 0 ) )
|
||||
{
|
||||
/* The event group can only have been allocated dynamically - free
|
||||
it again. */
|
||||
vPortFree( pxEventBits );
|
||||
}
|
||||
#elif( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
|
||||
{
|
||||
/* The event group could have been allocated statically or
|
||||
dynamically, so check before attempting to free the memory. */
|
||||
if( pxEventBits->ucStaticallyAllocated == ( uint8_t ) pdFALSE )
|
||||
{
|
||||
vPortFree( pxEventBits );
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
}
|
||||
( void ) xTaskResumeAll();
|
||||
}
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -99,6 +103,15 @@ extern "C" {
|
||||
/* Definitions specific to the port being used. */
|
||||
#include "portable.h"
|
||||
|
||||
/* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
|
||||
#ifndef configUSE_NEWLIB_REENTRANT
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#endif
|
||||
|
||||
/* Required if struct _reent is used. */
|
||||
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||
#include <reent.h>
|
||||
#endif
|
||||
/*
|
||||
* Check all the required application specific macros have been defined.
|
||||
* These macros are application specific and (as downloaded) are defined
|
||||
@@ -125,54 +138,48 @@ extern "C" {
|
||||
#error Missing definition: configUSE_TICK_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_CO_ROUTINES
|
||||
#error Missing definition: configUSE_CO_ROUTINES must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskPrioritySet
|
||||
#error Missing definition: INCLUDE_vTaskPrioritySet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_uxTaskPriorityGet
|
||||
#error Missing definition: INCLUDE_uxTaskPriorityGet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskDelete
|
||||
#error Missing definition: INCLUDE_vTaskDelete must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskSuspend
|
||||
#error Missing definition: INCLUDE_vTaskSuspend must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskDelayUntil
|
||||
#error Missing definition: INCLUDE_vTaskDelayUntil must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskDelay
|
||||
#error Missing definition: INCLUDE_vTaskDelay must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_16_BIT_TICKS
|
||||
#error Missing definition: configUSE_16_BIT_TICKS must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
|
||||
#endif
|
||||
|
||||
#if configUSE_CO_ROUTINES != 0
|
||||
#ifndef configMAX_CO_ROUTINE_PRIORITIES
|
||||
#error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef configMAX_PRIORITIES
|
||||
#error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_CO_ROUTINES
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskPrioritySet
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_uxTaskPriorityGet
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskDelete
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskSuspend
|
||||
#define INCLUDE_vTaskSuspend 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskDelayUntil
|
||||
#define INCLUDE_vTaskDelayUntil 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_vTaskDelay
|
||||
#define INCLUDE_vTaskDelay 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTaskGetIdleTaskHandle
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTimerGetTimerDaemonTaskHandle
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#ifndef INCLUDE_xTaskAbortDelay
|
||||
#define INCLUDE_xTaskAbortDelay 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xQueueGetMutexHolder
|
||||
@@ -183,12 +190,8 @@ extern "C" {
|
||||
#define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_pcTaskGetTaskName
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_APPLICATION_TASK_TAG
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#ifndef INCLUDE_xTaskGetHandle
|
||||
#define INCLUDE_xTaskGetHandle 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_uxTaskGetStackHighWaterMark
|
||||
@@ -199,6 +202,40 @@ extern "C" {
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTaskResumeFromISR
|
||||
#define INCLUDE_xTaskResumeFromISR 1
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTimerPendFunctionCall
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTaskGetSchedulerState
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTaskGetCurrentTaskHandle
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#endif
|
||||
|
||||
#if configUSE_CO_ROUTINES != 0
|
||||
#ifndef configMAX_CO_ROUTINE_PRIORITIES
|
||||
#error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
|
||||
#define configUSE_DAEMON_TASK_STARTUP_HOOK 0
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_APPLICATION_TASK_TAG
|
||||
#define configUSE_APPLICATION_TASK_TAG 0
|
||||
#endif
|
||||
|
||||
#ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
|
||||
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_RECURSIVE_MUTEXES
|
||||
#define configUSE_RECURSIVE_MUTEXES 0
|
||||
#endif
|
||||
@@ -235,18 +272,6 @@ extern "C" {
|
||||
#error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTaskResumeFromISR
|
||||
#define INCLUDE_xTaskResumeFromISR 1
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xEventGroupSetBitFromISR
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTimerPendFunctionCall
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
#endif
|
||||
|
||||
#ifndef configASSERT
|
||||
#define configASSERT( x )
|
||||
#define configASSERT_DEFINED 0
|
||||
@@ -271,15 +296,6 @@ extern "C" {
|
||||
|
||||
#endif /* configUSE_TIMERS */
|
||||
|
||||
#ifndef INCLUDE_xTaskGetSchedulerState
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDE_xTaskGetCurrentTaskHandle
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef portSET_INTERRUPT_MASK_FROM_ISR
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() 0
|
||||
#endif
|
||||
@@ -307,6 +323,7 @@ extern "C" {
|
||||
#if ( configQUEUE_REGISTRY_SIZE < 1 )
|
||||
#define vQueueAddToRegistry( xQueue, pcName )
|
||||
#define vQueueUnregisterQueue( xQueue )
|
||||
#define pcQueueGetName( xQueue )
|
||||
#endif
|
||||
|
||||
#ifndef portPOINTER_SIZE_TYPE
|
||||
@@ -397,6 +414,10 @@ extern "C" {
|
||||
#define traceMOVED_TASK_TO_READY_STATE( pxTCB )
|
||||
#endif
|
||||
|
||||
#ifndef tracePOST_MOVED_TASK_TO_READY_STATE
|
||||
#define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
|
||||
#endif
|
||||
|
||||
#ifndef traceQUEUE_CREATE
|
||||
#define traceQUEUE_CREATE( pxNewQueue )
|
||||
#endif
|
||||
@@ -498,7 +519,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef traceTASK_DELAY_UNTIL
|
||||
#define traceTASK_DELAY_UNTIL()
|
||||
#define traceTASK_DELAY_UNTIL( x )
|
||||
#endif
|
||||
|
||||
#ifndef traceTASK_DELAY
|
||||
@@ -609,6 +630,34 @@ extern "C" {
|
||||
#define traceQUEUE_REGISTRY_ADD(xQueue, pcQueueName)
|
||||
#endif
|
||||
|
||||
#ifndef traceTASK_NOTIFY_TAKE_BLOCK
|
||||
#define traceTASK_NOTIFY_TAKE_BLOCK()
|
||||
#endif
|
||||
|
||||
#ifndef traceTASK_NOTIFY_TAKE
|
||||
#define traceTASK_NOTIFY_TAKE()
|
||||
#endif
|
||||
|
||||
#ifndef traceTASK_NOTIFY_WAIT_BLOCK
|
||||
#define traceTASK_NOTIFY_WAIT_BLOCK()
|
||||
#endif
|
||||
|
||||
#ifndef traceTASK_NOTIFY_WAIT
|
||||
#define traceTASK_NOTIFY_WAIT()
|
||||
#endif
|
||||
|
||||
#ifndef traceTASK_NOTIFY
|
||||
#define traceTASK_NOTIFY()
|
||||
#endif
|
||||
|
||||
#ifndef traceTASK_NOTIFY_FROM_ISR
|
||||
#define traceTASK_NOTIFY_FROM_ISR()
|
||||
#endif
|
||||
|
||||
#ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
|
||||
#define traceTASK_NOTIFY_GIVE_FROM_ISR()
|
||||
#endif
|
||||
|
||||
#ifndef configGENERATE_RUN_TIME_STATS
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#endif
|
||||
@@ -643,14 +692,6 @@ extern "C" {
|
||||
#define portYIELD_WITHIN_API portYIELD
|
||||
#endif
|
||||
|
||||
#ifndef pvPortMallocAligned
|
||||
#define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )
|
||||
#endif
|
||||
|
||||
#ifndef vPortFreeAligned
|
||||
#define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
|
||||
#endif
|
||||
|
||||
#ifndef portSUPPRESS_TICKS_AND_SLEEP
|
||||
#define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
|
||||
#endif
|
||||
@@ -691,10 +732,6 @@ extern "C" {
|
||||
#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_NEWLIB_REENTRANT
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_STATS_FORMATTING_FUNCTIONS
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
#endif
|
||||
@@ -711,6 +748,10 @@ extern "C" {
|
||||
#define mtCOVERAGE_TEST_MARKER()
|
||||
#endif
|
||||
|
||||
#ifndef mtCOVERAGE_TEST_DELAY
|
||||
#define mtCOVERAGE_TEST_DELAY()
|
||||
#endif
|
||||
|
||||
#ifndef portASSERT_IF_IN_ISR
|
||||
#define portASSERT_IF_IN_ISR()
|
||||
#endif
|
||||
@@ -719,6 +760,60 @@ extern "C" {
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#endif
|
||||
|
||||
#ifndef configAPPLICATION_ALLOCATED_HEAP
|
||||
#define configAPPLICATION_ALLOCATED_HEAP 0
|
||||
#endif
|
||||
|
||||
#ifndef configUSE_TASK_NOTIFICATIONS
|
||||
#define configUSE_TASK_NOTIFICATIONS 1
|
||||
#endif
|
||||
|
||||
#ifndef portTICK_TYPE_IS_ATOMIC
|
||||
#define portTICK_TYPE_IS_ATOMIC 0
|
||||
#endif
|
||||
|
||||
#ifndef configSUPPORT_STATIC_ALLOCATION
|
||||
/* Defaults to 0 for backward compatibility. */
|
||||
#define configSUPPORT_STATIC_ALLOCATION 0
|
||||
#endif
|
||||
|
||||
#ifndef configSUPPORT_DYNAMIC_ALLOCATION
|
||||
/* Defaults to 1 for backward compatibility. */
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 1
|
||||
#endif
|
||||
|
||||
/* Sanity check the configuration. */
|
||||
#if( configUSE_TICKLESS_IDLE != 0 )
|
||||
#if( INCLUDE_vTaskSuspend != 1 )
|
||||
#error INCLUDE_vTaskSuspend must be set to 1 if configUSE_TICKLESS_IDLE is not set to 0
|
||||
#endif /* INCLUDE_vTaskSuspend */
|
||||
#endif /* configUSE_TICKLESS_IDLE */
|
||||
|
||||
#if( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
|
||||
#error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
|
||||
#endif
|
||||
|
||||
#if( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
|
||||
#error configUSE_MUTEXES must be set to 1 to use recursive mutexes
|
||||
#endif
|
||||
|
||||
#if( portTICK_TYPE_IS_ATOMIC == 0 )
|
||||
/* Either variables of tick type cannot be read atomically, or
|
||||
portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
|
||||
the tick count is returned to the standard critical section macros. */
|
||||
#define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
|
||||
#define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
|
||||
#define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
|
||||
#define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
|
||||
#else
|
||||
/* The tick type can be read atomically, so critical sections used when the
|
||||
tick count is returned can be defined away. */
|
||||
#define portTICK_TYPE_ENTER_CRITICAL()
|
||||
#define portTICK_TYPE_EXIT_CRITICAL()
|
||||
#define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
|
||||
#define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) x
|
||||
#endif
|
||||
|
||||
/* Definitions to allow backward compatibility with FreeRTOS versions prior to
|
||||
V8 if desired. */
|
||||
#ifndef configENABLE_BACKWARD_COMPATIBILITY
|
||||
@@ -741,6 +836,10 @@ V8 if desired. */
|
||||
#define xCoRoutineHandle CoRoutineHandle_t
|
||||
#define pdTASK_HOOK_CODE TaskHookFunction_t
|
||||
#define portTICK_RATE_MS portTICK_PERIOD_MS
|
||||
#define pcTaskGetTaskName pcTaskGetName
|
||||
#define pcTimerGetTimerName pcTimerGetName
|
||||
#define pcQueueGetQueueName pcQueueGetName
|
||||
#define vTaskGetTaskInfo vTaskGetInfo
|
||||
|
||||
/* Backward compatibility within the scheduler code only - these definitions
|
||||
are not really required but are included for completeness. */
|
||||
@@ -750,6 +849,212 @@ V8 if desired. */
|
||||
#define xList List_t
|
||||
#endif /* configENABLE_BACKWARD_COMPATIBILITY */
|
||||
|
||||
#if( configUSE_ALTERNATIVE_API != 0 )
|
||||
#error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
|
||||
#endif
|
||||
|
||||
/* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
|
||||
if floating point hardware is otherwise supported by the FreeRTOS port in use.
|
||||
This constant is not supported by all FreeRTOS ports that include floating
|
||||
point support. */
|
||||
#ifndef configUSE_TASK_FPU_SUPPORT
|
||||
#define configUSE_TASK_FPU_SUPPORT 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* In line with software engineering best practice, FreeRTOS implements a strict
|
||||
* data hiding policy, so the real structures used by FreeRTOS to maintain the
|
||||
* state of tasks, queues, semaphores, etc. are not accessible to the application
|
||||
* code. However, if the application writer wants to statically allocate such
|
||||
* an object then the size of the object needs to be know. Dummy structures
|
||||
* that are guaranteed to have the same size and alignment requirements of the
|
||||
* real objects are used for this purpose. The dummy list and list item
|
||||
* structures below are used for inclusion in such a dummy structure.
|
||||
*/
|
||||
struct xSTATIC_LIST_ITEM
|
||||
{
|
||||
TickType_t xDummy1;
|
||||
void *pvDummy2[ 4 ];
|
||||
};
|
||||
typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
|
||||
|
||||
/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
|
||||
struct xSTATIC_MINI_LIST_ITEM
|
||||
{
|
||||
TickType_t xDummy1;
|
||||
void *pvDummy2[ 2 ];
|
||||
};
|
||||
typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
|
||||
|
||||
/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
|
||||
typedef struct xSTATIC_LIST
|
||||
{
|
||||
UBaseType_t uxDummy1;
|
||||
void *pvDummy2;
|
||||
StaticMiniListItem_t xDummy3;
|
||||
} StaticList_t;
|
||||
|
||||
/*
|
||||
* In line with software engineering best practice, especially when supplying a
|
||||
* library that is likely to change in future versions, FreeRTOS implements a
|
||||
* strict data hiding policy. This means the Task structure used internally by
|
||||
* FreeRTOS is not accessible to application code. However, if the application
|
||||
* writer wants to statically allocate the memory required to create a task then
|
||||
* the size of the task object needs to be know. The StaticTask_t structure
|
||||
* below is provided for this purpose. Its sizes and alignment requirements are
|
||||
* guaranteed to match those of the genuine structure, no matter which
|
||||
* architecture is being used, and no matter how the values in FreeRTOSConfig.h
|
||||
* are set. Its contents are somewhat obfuscated in the hope users will
|
||||
* recognise that it would be unwise to make direct use of the structure members.
|
||||
*/
|
||||
typedef struct xSTATIC_TCB
|
||||
{
|
||||
void *pxDummy1;
|
||||
#if ( portUSING_MPU_WRAPPERS == 1 )
|
||||
xMPU_SETTINGS xDummy2;
|
||||
#endif
|
||||
StaticListItem_t xDummy3[ 2 ];
|
||||
UBaseType_t uxDummy5;
|
||||
void *pxDummy6;
|
||||
uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
|
||||
#if ( portSTACK_GROWTH > 0 )
|
||||
void *pxDummy8;
|
||||
#endif
|
||||
#if ( portCRITICAL_NESTING_IN_TCB == 1 )
|
||||
UBaseType_t uxDummy9;
|
||||
#endif
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxDummy10[ 2 ];
|
||||
#endif
|
||||
#if ( configUSE_MUTEXES == 1 )
|
||||
UBaseType_t uxDummy12[ 2 ];
|
||||
#endif
|
||||
#if ( configUSE_APPLICATION_TASK_TAG == 1 )
|
||||
void *pxDummy14;
|
||||
#endif
|
||||
#if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
|
||||
void *pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
|
||||
#endif
|
||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||
uint32_t ulDummy16;
|
||||
#endif
|
||||
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||
struct _reent xDummy17;
|
||||
#endif
|
||||
#if ( configUSE_TASK_NOTIFICATIONS == 1 )
|
||||
uint32_t ulDummy18;
|
||||
uint8_t ucDummy19;
|
||||
#endif
|
||||
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||
uint8_t uxDummy20;
|
||||
#endif
|
||||
|
||||
} StaticTask_t;
|
||||
|
||||
/*
|
||||
* In line with software engineering best practice, especially when supplying a
|
||||
* library that is likely to change in future versions, FreeRTOS implements a
|
||||
* strict data hiding policy. This means the Queue structure used internally by
|
||||
* FreeRTOS is not accessible to application code. However, if the application
|
||||
* writer wants to statically allocate the memory required to create a queue
|
||||
* then the size of the queue object needs to be know. The StaticQueue_t
|
||||
* structure below is provided for this purpose. Its sizes and alignment
|
||||
* requirements are guaranteed to match those of the genuine structure, no
|
||||
* matter which architecture is being used, and no matter how the values in
|
||||
* FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
|
||||
* users will recognise that it would be unwise to make direct use of the
|
||||
* structure members.
|
||||
*/
|
||||
typedef struct xSTATIC_QUEUE
|
||||
{
|
||||
void *pvDummy1[ 3 ];
|
||||
|
||||
union
|
||||
{
|
||||
void *pvDummy2;
|
||||
UBaseType_t uxDummy2;
|
||||
} u;
|
||||
|
||||
StaticList_t xDummy3[ 2 ];
|
||||
UBaseType_t uxDummy4[ 3 ];
|
||||
uint8_t ucDummy5[ 2 ];
|
||||
|
||||
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||
uint8_t ucDummy6;
|
||||
#endif
|
||||
|
||||
#if ( configUSE_QUEUE_SETS == 1 )
|
||||
void *pvDummy7;
|
||||
#endif
|
||||
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxDummy8;
|
||||
uint8_t ucDummy9;
|
||||
#endif
|
||||
|
||||
} StaticQueue_t;
|
||||
typedef StaticQueue_t StaticSemaphore_t;
|
||||
|
||||
/*
|
||||
* In line with software engineering best practice, especially when supplying a
|
||||
* library that is likely to change in future versions, FreeRTOS implements a
|
||||
* strict data hiding policy. This means the event group structure used
|
||||
* internally by FreeRTOS is not accessible to application code. However, if
|
||||
* the application writer wants to statically allocate the memory required to
|
||||
* create an event group then the size of the event group object needs to be
|
||||
* know. The StaticEventGroup_t structure below is provided for this purpose.
|
||||
* Its sizes and alignment requirements are guaranteed to match those of the
|
||||
* genuine structure, no matter which architecture is being used, and no matter
|
||||
* how the values in FreeRTOSConfig.h are set. Its contents are somewhat
|
||||
* obfuscated in the hope users will recognise that it would be unwise to make
|
||||
* direct use of the structure members.
|
||||
*/
|
||||
typedef struct xSTATIC_EVENT_GROUP
|
||||
{
|
||||
TickType_t xDummy1;
|
||||
StaticList_t xDummy2;
|
||||
|
||||
#if( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxDummy3;
|
||||
#endif
|
||||
|
||||
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||
uint8_t ucDummy4;
|
||||
#endif
|
||||
|
||||
} StaticEventGroup_t;
|
||||
|
||||
/*
|
||||
* In line with software engineering best practice, especially when supplying a
|
||||
* library that is likely to change in future versions, FreeRTOS implements a
|
||||
* strict data hiding policy. This means the software timer structure used
|
||||
* internally by FreeRTOS is not accessible to application code. However, if
|
||||
* the application writer wants to statically allocate the memory required to
|
||||
* create a software timer then the size of the queue object needs to be know.
|
||||
* The StaticTimer_t structure below is provided for this purpose. Its sizes
|
||||
* and alignment requirements are guaranteed to match those of the genuine
|
||||
* structure, no matter which architecture is being used, and no matter how the
|
||||
* values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
|
||||
* the hope users will recognise that it would be unwise to make direct use of
|
||||
* the structure members.
|
||||
*/
|
||||
typedef struct xSTATIC_TIMER
|
||||
{
|
||||
void *pvDummy1;
|
||||
StaticListItem_t xDummy2;
|
||||
TickType_t xDummy3;
|
||||
UBaseType_t uxDummy4;
|
||||
void *pvDummy5[ 2 ];
|
||||
#if( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxDummy6;
|
||||
#endif
|
||||
|
||||
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||
uint8_t ucDummy7;
|
||||
#endif
|
||||
|
||||
} StaticTimer_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -82,28 +86,10 @@
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configCHECK_FOR_STACK_OVERFLOW == 0 )
|
||||
|
||||
/* FreeRTOSConfig.h is not set to check for stack overflows. */
|
||||
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW()
|
||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
|
||||
|
||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 0 */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configCHECK_FOR_STACK_OVERFLOW == 1 )
|
||||
|
||||
/* FreeRTOSConfig.h is only set to use the first method of
|
||||
overflow checking. */
|
||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW()
|
||||
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH < 0 ) )
|
||||
#if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH < 0 ) )
|
||||
|
||||
/* Only the current stack state is to be checked. */
|
||||
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
|
||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||
if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack ) \
|
||||
@@ -112,13 +98,13 @@
|
||||
} \
|
||||
}
|
||||
|
||||
#endif /* configCHECK_FOR_STACK_OVERFLOW > 0 */
|
||||
#endif /* configCHECK_FOR_STACK_OVERFLOW == 1 */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( ( configCHECK_FOR_STACK_OVERFLOW > 0 ) && ( portSTACK_GROWTH > 0 ) )
|
||||
#if( ( configCHECK_FOR_STACK_OVERFLOW == 1 ) && ( portSTACK_GROWTH > 0 ) )
|
||||
|
||||
/* Only the current stack state is to be checked. */
|
||||
#define taskFIRST_CHECK_FOR_STACK_OVERFLOW() \
|
||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
\
|
||||
/* Is the currently saved stack pointer within the stack limit? */ \
|
||||
@@ -133,20 +119,18 @@
|
||||
|
||||
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )
|
||||
|
||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||
tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE }; \
|
||||
\
|
||||
\
|
||||
/* Has the extremity of the task stack ever been written over? */ \
|
||||
if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 ) \
|
||||
{ \
|
||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
} \
|
||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
const uint32_t * const pulStack = ( uint32_t * ) pxCurrentTCB->pxStack; \
|
||||
const uint32_t ulCheckValue = ( uint32_t ) 0xa5a5a5a5; \
|
||||
\
|
||||
if( ( pulStack[ 0 ] != ulCheckValue ) || \
|
||||
( pulStack[ 1 ] != ulCheckValue ) || \
|
||||
( pulStack[ 2 ] != ulCheckValue ) || \
|
||||
( pulStack[ 3 ] != ulCheckValue ) ) \
|
||||
{ \
|
||||
vApplicationStackOverflowHook( ( TaskHandle_t ) pxCurrentTCB, pxCurrentTCB->pcTaskName ); \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||
@@ -154,7 +138,7 @@
|
||||
|
||||
#if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH > 0 ) )
|
||||
|
||||
#define taskSECOND_CHECK_FOR_STACK_OVERFLOW() \
|
||||
#define taskCHECK_FOR_STACK_OVERFLOW() \
|
||||
{ \
|
||||
int8_t *pcEndOfStack = ( int8_t * ) pxCurrentTCB->pxEndOfStack; \
|
||||
static const uint8_t ucExpectedStackBytes[] = { tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, \
|
||||
@@ -176,5 +160,12 @@
|
||||
#endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Remove stack overflow macro if not being used. */
|
||||
#ifndef taskCHECK_FOR_STACK_OVERFLOW
|
||||
#define taskCHECK_FOR_STACK_OVERFLOW()
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* STACK_MACROS_H */
|
||||
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
|
||||
321
cc3200/FreeRTOS/Source/include/deprecated_definitions.h
Normal file
321
cc3200/FreeRTOS/Source/include/deprecated_definitions.h
Normal file
@@ -0,0 +1,321 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
#ifndef DEPRECATED_DEFINITIONS_H
|
||||
#define DEPRECATED_DEFINITIONS_H
|
||||
|
||||
|
||||
/* Each FreeRTOS port has a unique portmacro.h header file. Originally a
|
||||
pre-processor definition was used to ensure the pre-processor found the correct
|
||||
portmacro.h file for the port being used. That scheme was deprecated in favour
|
||||
of setting the compiler's include path such that it found the correct
|
||||
portmacro.h file - removing the need for the constant and allowing the
|
||||
portmacro.h file to be located anywhere in relation to the port being used. The
|
||||
definitions below remain in the code for backward compatibility only. New
|
||||
projects should not use them. */
|
||||
|
||||
#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
|
||||
#include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
|
||||
typedef void ( __interrupt __far *pxISR )();
|
||||
#endif
|
||||
|
||||
#ifdef OPEN_WATCOM_FLASH_LITE_186_PORT
|
||||
#include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"
|
||||
typedef void ( __interrupt __far *pxISR )();
|
||||
#endif
|
||||
|
||||
#ifdef GCC_MEGA_AVR
|
||||
#include "../portable/GCC/ATMega323/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_MEGA_AVR
|
||||
#include "../portable/IAR/ATMega323/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_PIC24_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_DSPIC_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_PIC18F_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC18F/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_PIC32MX_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef _FEDPICC
|
||||
#include "libFreeRTOS/Include/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SDCC_CYGNAL
|
||||
#include "../../Source/portable/SDCC/Cygnal/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARM7
|
||||
#include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARM7_ECLIPSE
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ROWLEY_LPC23xx
|
||||
#include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_MSP430
|
||||
#include "..\..\Source\portable\IAR\MSP430\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_MSP430
|
||||
#include "../../Source/portable/GCC/MSP430F449/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ROWLEY_MSP430
|
||||
#include "../../Source/portable/Rowley/MSP430F449/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ARM7_LPC21xx_KEIL_RVDS
|
||||
#include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SAM7_GCC
|
||||
#include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SAM7_IAR
|
||||
#include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SAM9XE_IAR
|
||||
#include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef LPC2000_IAR
|
||||
#include "..\..\Source\portable\IAR\LPC2000\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR71X_IAR
|
||||
#include "..\..\Source\portable\IAR\STR71x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR75X_IAR
|
||||
#include "..\..\Source\portable\IAR\STR75x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR75X_GCC
|
||||
#include "..\..\Source\portable\GCC\STR75x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR91X_IAR
|
||||
#include "..\..\Source\portable\IAR\STR91x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_H8S
|
||||
#include "../../Source/portable/GCC/H8S2329/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_AT91FR40008
|
||||
#include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef RVDS_ARMCM3_LM3S102
|
||||
#include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARMCM3_LM3S102
|
||||
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARMCM3
|
||||
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_ARM_CM3
|
||||
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_ARMCM3_LM
|
||||
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef HCS12_CODE_WARRIOR
|
||||
#include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROBLAZE_GCC
|
||||
#include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef TERN_EE
|
||||
#include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_HCS12
|
||||
#include "../../Source/portable/GCC/HCS12/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_MCF5235
|
||||
#include "../../Source/portable/GCC/MCF5235/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef COLDFIRE_V2_GCC
|
||||
#include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef COLDFIRE_V2_CODEWARRIOR
|
||||
#include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_PPC405
|
||||
#include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_PPC440
|
||||
#include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef _16FX_SOFTUNE
|
||||
#include "..\..\Source\portable\Softune\MB96340\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef BCC_INDUSTRIAL_PC_PORT
|
||||
/* A short file name has to be used in place of the normal
|
||||
FreeRTOSConfig.h when using the Borland compiler. */
|
||||
#include "frconfig.h"
|
||||
#include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
|
||||
typedef void ( __interrupt __far *pxISR )();
|
||||
#endif
|
||||
|
||||
#ifdef BCC_FLASH_LITE_186_PORT
|
||||
/* A short file name has to be used in place of the normal
|
||||
FreeRTOSConfig.h when using the Borland compiler. */
|
||||
#include "frconfig.h"
|
||||
#include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
|
||||
typedef void ( __interrupt __far *pxISR )();
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef __AVR32_AVR32A__
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __ICCAVR32__
|
||||
#ifdef __CORE__
|
||||
#if __CORE__ == __AVR32A__
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __91467D
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __96340
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __IAR_V850ES_Fx3__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Jx3__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Jx3_L__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Jx2__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Hx2__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_78K0R_Kx3__
|
||||
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_78K0R_Kx3L__
|
||||
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||
#endif
|
||||
|
||||
#endif /* DEPRECATED_DEFINITIONS_H */
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -70,6 +74,7 @@
|
||||
#error "include FreeRTOS.h" must appear in source files before "include event_groups.h"
|
||||
#endif
|
||||
|
||||
/* FreeRTOS includes. */
|
||||
#include "timers.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -117,10 +122,10 @@ extern "C" {
|
||||
*/
|
||||
typedef void * EventGroupHandle_t;
|
||||
|
||||
/*
|
||||
/*
|
||||
* The type that holds event bits always matches TickType_t - therefore the
|
||||
* number of bits it holds is set by configUSE_16_BIT_TICKS (16 bits if set to 1,
|
||||
* 32 bits if set to 0.
|
||||
* 32 bits if set to 0.
|
||||
*
|
||||
* \defgroup EventBits_t EventBits_t
|
||||
* \ingroup EventGroup
|
||||
@@ -133,7 +138,17 @@ typedef TickType_t EventBits_t;
|
||||
EventGroupHandle_t xEventGroupCreate( void );
|
||||
</pre>
|
||||
*
|
||||
* Create a new event group. This function cannot be called from an interrupt.
|
||||
* Create a new event group.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, event groups use a [small]
|
||||
* block of memory, in which the event group's structure is stored. If an event
|
||||
* groups is created using xEventGropuCreate() then the required memory is
|
||||
* automatically dynamically allocated inside the xEventGroupCreate() function.
|
||||
* (see http://www.freertos.org/a00111.html). If an event group is created
|
||||
* using xEventGropuCreateStatic() then the application writer must instead
|
||||
* provide the memory that will get used by the event group.
|
||||
* xEventGroupCreateStatic() therefore allows an event group to be created
|
||||
* without using any dynamic memory allocation.
|
||||
*
|
||||
* Although event groups are not related to ticks, for internal implementation
|
||||
* reasons the number of bits available for use in an event group is dependent
|
||||
@@ -169,7 +184,62 @@ typedef TickType_t EventBits_t;
|
||||
* \defgroup xEventGroupCreate xEventGroupCreate
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
EventGroupHandle_t xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
EventGroupHandle_t xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* event_groups.h
|
||||
*<pre>
|
||||
EventGroupHandle_t xEventGroupCreateStatic( EventGroupHandle_t * pxEventGroupBuffer );
|
||||
</pre>
|
||||
*
|
||||
* Create a new event group.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, event groups use a [small]
|
||||
* block of memory, in which the event group's structure is stored. If an event
|
||||
* groups is created using xEventGropuCreate() then the required memory is
|
||||
* automatically dynamically allocated inside the xEventGroupCreate() function.
|
||||
* (see http://www.freertos.org/a00111.html). If an event group is created
|
||||
* using xEventGropuCreateStatic() then the application writer must instead
|
||||
* provide the memory that will get used by the event group.
|
||||
* xEventGroupCreateStatic() therefore allows an event group to be created
|
||||
* without using any dynamic memory allocation.
|
||||
*
|
||||
* Although event groups are not related to ticks, for internal implementation
|
||||
* reasons the number of bits available for use in an event group is dependent
|
||||
* on the configUSE_16_BIT_TICKS setting in FreeRTOSConfig.h. If
|
||||
* configUSE_16_BIT_TICKS is 1 then each event group contains 8 usable bits (bit
|
||||
* 0 to bit 7). If configUSE_16_BIT_TICKS is set to 0 then each event group has
|
||||
* 24 usable bits (bit 0 to bit 23). The EventBits_t type is used to store
|
||||
* event bits within an event group.
|
||||
*
|
||||
* @param pxEventGroupBuffer pxEventGroupBuffer must point to a variable of type
|
||||
* StaticEventGroup_t, which will be then be used to hold the event group's data
|
||||
* structures, removing the need for the memory to be allocated dynamically.
|
||||
*
|
||||
* @return If the event group was created then a handle to the event group is
|
||||
* returned. If pxEventGroupBuffer was NULL then NULL is returned.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
// StaticEventGroup_t is a publicly accessible structure that has the same
|
||||
// size and alignment requirements as the real event group structure. It is
|
||||
// provided as a mechanism for applications to know the size of the event
|
||||
// group (which is dependent on the architecture and configuration file
|
||||
// settings) without breaking the strict data hiding policy by exposing the
|
||||
// real event group internals. This StaticEventGroup_t variable is passed
|
||||
// into the xSemaphoreCreateEventGroupStatic() function and is used to store
|
||||
// the event group's data structures
|
||||
StaticEventGroup_t xEventGroupBuffer;
|
||||
|
||||
// Create the event group without dynamically allocating any memory.
|
||||
xEventGroup = xEventGroupCreateStatic( &xEventGroupBuffer );
|
||||
</pre>
|
||||
*/
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
EventGroupHandle_t xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* event_groups.h
|
||||
@@ -336,8 +406,8 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBit
|
||||
* while interrupts are disabled, so protects event groups that are accessed
|
||||
* from tasks by suspending the scheduler rather than disabling interrupts. As
|
||||
* a result event groups cannot be accessed directly from an interrupt service
|
||||
* routine. Therefore xEventGroupClearBitsFromISR() sends a message to the
|
||||
* timer task to have the clear operation performed in the context of the timer
|
||||
* routine. Therefore xEventGroupClearBitsFromISR() sends a message to the
|
||||
* timer task to have the clear operation performed in the context of the timer
|
||||
* task.
|
||||
*
|
||||
* @param xEventGroup The event group in which the bits are to be cleared.
|
||||
@@ -346,8 +416,8 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBit
|
||||
* For example, to clear bit 3 only, set uxBitsToClear to 0x08. To clear bit 3
|
||||
* and bit 0 set uxBitsToClear to 0x09.
|
||||
*
|
||||
* @return If the request to execute the function was posted successfully then
|
||||
* pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned
|
||||
* @return If the request to execute the function was posted successfully then
|
||||
* pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned
|
||||
* if the timer service queue was full.
|
||||
*
|
||||
* Example usage:
|
||||
@@ -372,11 +442,11 @@ EventBits_t xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBit
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
* \defgroup xEventGroupSetBitsFromISR xEventGroupSetBitsFromISR
|
||||
* \defgroup xEventGroupClearBitsFromISR xEventGroupClearBitsFromISR
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
#if( configUSE_TRACE_FACILITY == 1 )
|
||||
BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
||||
BaseType_t xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet ) PRIVILEGED_FUNCTION;
|
||||
#else
|
||||
#define xEventGroupClearBitsFromISR( xEventGroup, uxBitsToClear ) xTimerPendFunctionCallFromISR( vEventGroupClearBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToClear, NULL )
|
||||
#endif
|
||||
@@ -466,7 +536,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_
|
||||
* Setting bits in an event group is not a deterministic operation because there
|
||||
* are an unknown number of tasks that may be waiting for the bit or bits being
|
||||
* set. FreeRTOS does not allow nondeterministic operations to be performed in
|
||||
* interrupts or from critical sections. Therefore xEventGroupSetBitFromISR()
|
||||
* interrupts or from critical sections. Therefore xEventGroupSetBitsFromISR()
|
||||
* sends a message to the timer task to have the set operation performed in the
|
||||
* context of the timer task - where a scheduler lock is used in place of a
|
||||
* critical section.
|
||||
@@ -487,8 +557,8 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_
|
||||
* *pxHigherPriorityTaskWoken must be initialised to pdFALSE. See the
|
||||
* example code below.
|
||||
*
|
||||
* @return If the request to execute the function was posted successfully then
|
||||
* pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned
|
||||
* @return If the request to execute the function was posted successfully then
|
||||
* pdPASS is returned, otherwise pdFALSE is returned. pdFALSE will be returned
|
||||
* if the timer service queue was full.
|
||||
*
|
||||
* Example usage:
|
||||
@@ -517,8 +587,8 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_
|
||||
if( xResult == pdPASS )
|
||||
{
|
||||
// If xHigherPriorityTaskWoken is now set to pdTRUE then a context
|
||||
// switch should be requested. The macro used is port specific and
|
||||
// will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() -
|
||||
// switch should be requested. The macro used is port specific and
|
||||
// will be either portYIELD_FROM_ISR() or portEND_SWITCHING_ISR() -
|
||||
// refer to the documentation page for the port being used.
|
||||
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
|
||||
}
|
||||
@@ -528,7 +598,7 @@ EventBits_t xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
#if( configUSE_TRACE_FACILITY == 1 )
|
||||
BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken );
|
||||
BaseType_t xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||
#else
|
||||
#define xEventGroupSetBitsFromISR( xEventGroup, uxBitsToSet, pxHigherPriorityTaskWoken ) xTimerPendFunctionCallFromISR( vEventGroupSetBitsCallback, ( void * ) xEventGroup, ( uint32_t ) uxBitsToSet, pxHigherPriorityTaskWoken )
|
||||
#endif
|
||||
@@ -693,7 +763,7 @@ EventBits_t xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t u
|
||||
* \defgroup xEventGroupGetBitsFromISR xEventGroupGetBitsFromISR
|
||||
* \ingroup EventGroup
|
||||
*/
|
||||
EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup );
|
||||
EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* event_groups.h
|
||||
@@ -707,14 +777,15 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup );
|
||||
*
|
||||
* @param xEventGroup The event group being deleted.
|
||||
*/
|
||||
void vEventGroupDelete( EventGroupHandle_t xEventGroup );
|
||||
void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/* For internal use only. */
|
||||
void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet );
|
||||
void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear );
|
||||
void vEventGroupSetBitsCallback( void *pvEventGroup, const uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION;
|
||||
void vEventGroupClearBitsCallback( void *pvEventGroup, const uint32_t ulBitsToClear ) PRIVILEGED_FUNCTION;
|
||||
|
||||
|
||||
#if (configUSE_TRACE_FACILITY == 1)
|
||||
UBaseType_t uxEventGroupGetNumber( void* xEventGroup );
|
||||
UBaseType_t uxEventGroupGetNumber( void* xEventGroup ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -91,6 +95,9 @@
|
||||
* \ingroup FreeRTOSIntro
|
||||
*/
|
||||
|
||||
#ifndef INC_FREERTOS_H
|
||||
#error FreeRTOS.h must be included before list.h
|
||||
#endif
|
||||
|
||||
#ifndef LIST_H
|
||||
#define LIST_H
|
||||
@@ -130,21 +137,62 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Macros that can be used to place known values within the list structures,
|
||||
then check that the known values do not get corrupted during the execution of
|
||||
the application. These may catch the list data structures being overwritten in
|
||||
memory. They will not catch data errors caused by incorrect configuration or
|
||||
use of FreeRTOS.*/
|
||||
#if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 )
|
||||
/* Define the macros to do nothing. */
|
||||
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE
|
||||
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE
|
||||
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE
|
||||
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE
|
||||
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )
|
||||
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem )
|
||||
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )
|
||||
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )
|
||||
#define listTEST_LIST_ITEM_INTEGRITY( pxItem )
|
||||
#define listTEST_LIST_INTEGRITY( pxList )
|
||||
#else
|
||||
/* Define macros that add new members into the list structures. */
|
||||
#define listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue1;
|
||||
#define listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE TickType_t xListItemIntegrityValue2;
|
||||
#define listFIRST_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue1;
|
||||
#define listSECOND_LIST_INTEGRITY_CHECK_VALUE TickType_t xListIntegrityValue2;
|
||||
|
||||
/* Define macros that set the new structure members to known values. */
|
||||
#define listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
||||
#define listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
||||
#define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ) ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
|
||||
#define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ) ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
|
||||
|
||||
/* Define macros that will assert if one of the structure members does not
|
||||
contain its expected value. */
|
||||
#define listTEST_LIST_ITEM_INTEGRITY( pxItem ) configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
|
||||
#define listTEST_LIST_INTEGRITY( pxList ) configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
|
||||
#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */
|
||||
|
||||
|
||||
/*
|
||||
* Definition of the only type of object that a list can contain.
|
||||
*/
|
||||
struct xLIST_ITEM
|
||||
{
|
||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
|
||||
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
|
||||
void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
|
||||
listSECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
};
|
||||
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
|
||||
|
||||
struct xMINI_LIST_ITEM
|
||||
{
|
||||
listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
configLIST_VOLATILE TickType_t xItemValue;
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
|
||||
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
|
||||
@@ -156,9 +204,11 @@ typedef struct xMINI_LIST_ITEM MiniListItem_t;
|
||||
*/
|
||||
typedef struct xLIST
|
||||
{
|
||||
listFIRST_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
configLIST_VOLATILE UBaseType_t uxNumberOfItems;
|
||||
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
|
||||
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
|
||||
listSECOND_LIST_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
} List_t;
|
||||
|
||||
/*
|
||||
@@ -333,7 +383,7 @@ List_t * const pxConstList = ( pxList ); \
|
||||
* \page vListInitialise vListInitialise
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInitialise( List_t * const pxList );
|
||||
void vListInitialise( List_t * const pxList ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Must be called before a list item is used. This sets the list container to
|
||||
@@ -344,7 +394,7 @@ void vListInitialise( List_t * const pxList );
|
||||
* \page vListInitialiseItem vListInitialiseItem
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInitialiseItem( ListItem_t * const pxItem );
|
||||
void vListInitialiseItem( ListItem_t * const pxItem ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Insert a list item into a list. The item will be inserted into the list in
|
||||
@@ -357,19 +407,19 @@ void vListInitialiseItem( ListItem_t * const pxItem );
|
||||
* \page vListInsert vListInsert
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem );
|
||||
void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Insert a list item into a list. The item will be inserted in a position
|
||||
* such that it will be the last item within the list returned by multiple
|
||||
* calls to listGET_OWNER_OF_NEXT_ENTRY.
|
||||
*
|
||||
* The list member pvIndex is used to walk through a list. Calling
|
||||
* listGET_OWNER_OF_NEXT_ENTRY increments pvIndex to the next item in the list.
|
||||
* The list member pxIndex is used to walk through a list. Calling
|
||||
* listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list.
|
||||
* Placing an item in a list using vListInsertEnd effectively places the item
|
||||
* in the list position pointed to by pvIndex. This means that every other
|
||||
* in the list position pointed to by pxIndex. This means that every other
|
||||
* item within the list will be returned by listGET_OWNER_OF_NEXT_ENTRY before
|
||||
* the pvIndex parameter again points to the item being inserted.
|
||||
* the pxIndex parameter again points to the item being inserted.
|
||||
*
|
||||
* @param pxList The list into which the item is to be inserted.
|
||||
*
|
||||
@@ -378,7 +428,7 @@ void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem );
|
||||
* \page vListInsertEnd vListInsertEnd
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem );
|
||||
void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Remove an item from a list. The list item has a pointer to the list that
|
||||
@@ -393,7 +443,7 @@ void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem );
|
||||
* \page uxListRemove uxListRemove
|
||||
* \ingroup LinkedList
|
||||
*/
|
||||
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove );
|
||||
UBaseType_t uxListRemove( ListItem_t * const pxItemToRemove ) PRIVILEGED_FUNCTION;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
177
cc3200/FreeRTOS/Source/include/mpu_prototypes.h
Normal file
177
cc3200/FreeRTOS/Source/include/mpu_prototypes.h
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
mission critical applications that require provable dependability.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
/*
|
||||
* When the MPU is used the standard (non MPU) API functions are mapped to
|
||||
* equivalents that start "MPU_", the prototypes for which are defined in this
|
||||
* header files. This will cause the application code to call the MPU_ version
|
||||
* which wraps the non-MPU version with privilege promoting then demoting code,
|
||||
* so the kernel code always runs will full privileges.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MPU_PROTOTYPES_H
|
||||
#define MPU_PROTOTYPES_H
|
||||
|
||||
/* MPU versions of tasks.h API function. */
|
||||
BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask );
|
||||
TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer );
|
||||
BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask );
|
||||
void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions );
|
||||
void MPU_vTaskDelete( TaskHandle_t xTaskToDelete );
|
||||
void MPU_vTaskDelay( const TickType_t xTicksToDelay );
|
||||
void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement );
|
||||
BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask );
|
||||
UBaseType_t MPU_uxTaskPriorityGet( TaskHandle_t xTask );
|
||||
eTaskState MPU_eTaskGetState( TaskHandle_t xTask );
|
||||
void MPU_vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState );
|
||||
void MPU_vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority );
|
||||
void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend );
|
||||
void MPU_vTaskResume( TaskHandle_t xTaskToResume );
|
||||
void MPU_vTaskStartScheduler( void );
|
||||
void MPU_vTaskSuspendAll( void );
|
||||
BaseType_t MPU_xTaskResumeAll( void );
|
||||
TickType_t MPU_xTaskGetTickCount( void );
|
||||
UBaseType_t MPU_uxTaskGetNumberOfTasks( void );
|
||||
char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery );
|
||||
TaskHandle_t MPU_xTaskGetHandle( const char *pcNameToQuery );
|
||||
UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask );
|
||||
void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxHookFunction );
|
||||
TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask );
|
||||
void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue );
|
||||
void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex );
|
||||
BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );
|
||||
TaskHandle_t MPU_xTaskGetIdleTaskHandle( void );
|
||||
UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime );
|
||||
void MPU_vTaskList( char * pcWriteBuffer );
|
||||
void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer );
|
||||
BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue );
|
||||
BaseType_t MPU_xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait );
|
||||
uint32_t MPU_ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait );
|
||||
BaseType_t MPU_xTaskNotifyStateClear( TaskHandle_t xTask );
|
||||
BaseType_t MPU_xTaskIncrementTick( void );
|
||||
TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void );
|
||||
void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut );
|
||||
BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait );
|
||||
void MPU_vTaskMissedYield( void );
|
||||
BaseType_t MPU_xTaskGetSchedulerState( void );
|
||||
|
||||
/* MPU versions of queue.h API function. */
|
||||
BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, const BaseType_t xCopyPosition );
|
||||
BaseType_t MPU_xQueueGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, const BaseType_t xJustPeek );
|
||||
UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue );
|
||||
UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue );
|
||||
void MPU_vQueueDelete( QueueHandle_t xQueue );
|
||||
QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType );
|
||||
QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue );
|
||||
QueueHandle_t MPU_xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount );
|
||||
QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue );
|
||||
void* MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore );
|
||||
BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait );
|
||||
BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex );
|
||||
void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcName );
|
||||
void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue );
|
||||
const char * MPU_pcQueueGetName( QueueHandle_t xQueue );
|
||||
QueueHandle_t MPU_xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType );
|
||||
QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType );
|
||||
QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength );
|
||||
BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet );
|
||||
BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet );
|
||||
QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, const TickType_t xTicksToWait );
|
||||
BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue );
|
||||
void MPU_vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber );
|
||||
UBaseType_t MPU_uxQueueGetQueueNumber( QueueHandle_t xQueue );
|
||||
uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue );
|
||||
|
||||
/* MPU versions of timers.h API function. */
|
||||
TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction );
|
||||
TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxTimerBuffer );
|
||||
void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer );
|
||||
void MPU_vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID );
|
||||
BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer );
|
||||
TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void );
|
||||
BaseType_t MPU_xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait );
|
||||
const char * MPU_pcTimerGetName( TimerHandle_t xTimer );
|
||||
TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer );
|
||||
TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer );
|
||||
BaseType_t MPU_xTimerCreateTimerTask( void );
|
||||
BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait );
|
||||
|
||||
/* MPU versions of event_group.h API function. */
|
||||
EventGroupHandle_t MPU_xEventGroupCreate( void );
|
||||
EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer );
|
||||
EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait );
|
||||
EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear );
|
||||
EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet );
|
||||
EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait );
|
||||
void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup );
|
||||
UBaseType_t MPU_uxEventGroupGetNumber( void* xEventGroup );
|
||||
|
||||
#endif /* MPU_PROTOTYPES_H */
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -75,60 +79,104 @@ only for ports that are using the MPU. */
|
||||
those files. */
|
||||
#ifndef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||
|
||||
#define xTaskGenericCreate MPU_xTaskGenericCreate
|
||||
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
||||
#define vTaskDelete MPU_vTaskDelete
|
||||
#define vTaskDelayUntil MPU_vTaskDelayUntil
|
||||
#define vTaskDelay MPU_vTaskDelay
|
||||
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
||||
#define vTaskPrioritySet MPU_vTaskPrioritySet
|
||||
#define eTaskGetState MPU_eTaskGetState
|
||||
#define vTaskSuspend MPU_vTaskSuspend
|
||||
#define vTaskResume MPU_vTaskResume
|
||||
#define vTaskSuspendAll MPU_vTaskSuspendAll
|
||||
#define xTaskResumeAll MPU_xTaskResumeAll
|
||||
#define xTaskGetTickCount MPU_xTaskGetTickCount
|
||||
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
||||
#define vTaskList MPU_vTaskList
|
||||
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
|
||||
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
||||
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
|
||||
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
||||
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
||||
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
|
||||
#define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
|
||||
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
|
||||
#define uxTaskGetSystemState MPU_uxTaskGetSystemState
|
||||
/*
|
||||
* Map standard (non MPU) API functions to equivalents that start
|
||||
* "MPU_". This will cause the application code to call the MPU_
|
||||
* version, which wraps the non-MPU version with privilege promoting
|
||||
* then demoting code, so the kernel code always runs will full
|
||||
* privileges.
|
||||
*/
|
||||
|
||||
#define xQueueGenericCreate MPU_xQueueGenericCreate
|
||||
#define xQueueCreateMutex MPU_xQueueCreateMutex
|
||||
#define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
|
||||
#define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
|
||||
#define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
|
||||
#define xQueueGenericSend MPU_xQueueGenericSend
|
||||
#define xQueueAltGenericSend MPU_xQueueAltGenericSend
|
||||
#define xQueueAltGenericReceive MPU_xQueueAltGenericReceive
|
||||
#define xQueueGenericReceive MPU_xQueueGenericReceive
|
||||
#define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
|
||||
#define vQueueDelete MPU_vQueueDelete
|
||||
#define xQueueGenericReset MPU_xQueueGenericReset
|
||||
#define xQueueCreateSet MPU_xQueueCreateSet
|
||||
#define xQueueSelectFromSet MPU_xQueueSelectFromSet
|
||||
#define xQueueAddToSet MPU_xQueueAddToSet
|
||||
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
||||
#define xQueuePeekFromISR MPU_xQueuePeekFromISR
|
||||
#define xQueueGetMutexHolder MPU_xQueueGetMutexHolder
|
||||
/* Map standard tasks.h API functions to the MPU equivalents. */
|
||||
#define xTaskCreate MPU_xTaskCreate
|
||||
#define xTaskCreateStatic MPU_xTaskCreateStatic
|
||||
#define xTaskCreateRestricted MPU_xTaskCreateRestricted
|
||||
#define vTaskAllocateMPURegions MPU_vTaskAllocateMPURegions
|
||||
#define vTaskDelete MPU_vTaskDelete
|
||||
#define vTaskDelay MPU_vTaskDelay
|
||||
#define vTaskDelayUntil MPU_vTaskDelayUntil
|
||||
#define xTaskAbortDelay MPU_xTaskAbortDelay
|
||||
#define uxTaskPriorityGet MPU_uxTaskPriorityGet
|
||||
#define eTaskGetState MPU_eTaskGetState
|
||||
#define vTaskGetInfo MPU_vTaskGetInfo
|
||||
#define vTaskPrioritySet MPU_vTaskPrioritySet
|
||||
#define vTaskSuspend MPU_vTaskSuspend
|
||||
#define vTaskResume MPU_vTaskResume
|
||||
#define vTaskSuspendAll MPU_vTaskSuspendAll
|
||||
#define xTaskResumeAll MPU_xTaskResumeAll
|
||||
#define xTaskGetTickCount MPU_xTaskGetTickCount
|
||||
#define uxTaskGetNumberOfTasks MPU_uxTaskGetNumberOfTasks
|
||||
#define pcTaskGetName MPU_pcTaskGetName
|
||||
#define xTaskGetHandle MPU_xTaskGetHandle
|
||||
#define uxTaskGetStackHighWaterMark MPU_uxTaskGetStackHighWaterMark
|
||||
#define vTaskSetApplicationTaskTag MPU_vTaskSetApplicationTaskTag
|
||||
#define xTaskGetApplicationTaskTag MPU_xTaskGetApplicationTaskTag
|
||||
#define vTaskSetThreadLocalStoragePointer MPU_vTaskSetThreadLocalStoragePointer
|
||||
#define pvTaskGetThreadLocalStoragePointer MPU_pvTaskGetThreadLocalStoragePointer
|
||||
#define xTaskCallApplicationTaskHook MPU_xTaskCallApplicationTaskHook
|
||||
#define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle
|
||||
#define uxTaskGetSystemState MPU_uxTaskGetSystemState
|
||||
#define vTaskList MPU_vTaskList
|
||||
#define vTaskGetRunTimeStats MPU_vTaskGetRunTimeStats
|
||||
#define xTaskGenericNotify MPU_xTaskGenericNotify
|
||||
#define xTaskNotifyWait MPU_xTaskNotifyWait
|
||||
#define ulTaskNotifyTake MPU_ulTaskNotifyTake
|
||||
#define xTaskNotifyStateClear MPU_xTaskNotifyStateClear
|
||||
|
||||
#define pvPortMalloc MPU_pvPortMalloc
|
||||
#define vPortFree MPU_vPortFree
|
||||
#define xPortGetFreeHeapSize MPU_xPortGetFreeHeapSize
|
||||
#define vPortInitialiseBlocks MPU_vPortInitialiseBlocks
|
||||
#define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle
|
||||
#define vTaskSetTimeOutState MPU_vTaskSetTimeOutState
|
||||
#define xTaskCheckForTimeOut MPU_xTaskCheckForTimeOut
|
||||
#define xTaskGetSchedulerState MPU_xTaskGetSchedulerState
|
||||
|
||||
#if configQUEUE_REGISTRY_SIZE > 0
|
||||
#define vQueueAddToRegistry MPU_vQueueAddToRegistry
|
||||
#define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
|
||||
/* Map standard queue.h API functions to the MPU equivalents. */
|
||||
#define xQueueGenericSend MPU_xQueueGenericSend
|
||||
#define xQueueGenericReceive MPU_xQueueGenericReceive
|
||||
#define uxQueueMessagesWaiting MPU_uxQueueMessagesWaiting
|
||||
#define uxQueueSpacesAvailable MPU_uxQueueSpacesAvailable
|
||||
#define vQueueDelete MPU_vQueueDelete
|
||||
#define xQueueCreateMutex MPU_xQueueCreateMutex
|
||||
#define xQueueCreateMutexStatic MPU_xQueueCreateMutexStatic
|
||||
#define xQueueCreateCountingSemaphore MPU_xQueueCreateCountingSemaphore
|
||||
#define xQueueCreateCountingSemaphoreStatic MPU_xQueueCreateCountingSemaphoreStatic
|
||||
#define xQueueGetMutexHolder MPU_xQueueGetMutexHolder
|
||||
#define xQueueTakeMutexRecursive MPU_xQueueTakeMutexRecursive
|
||||
#define xQueueGiveMutexRecursive MPU_xQueueGiveMutexRecursive
|
||||
#define xQueueGenericCreate MPU_xQueueGenericCreate
|
||||
#define xQueueGenericCreateStatic MPU_xQueueGenericCreateStatic
|
||||
#define xQueueCreateSet MPU_xQueueCreateSet
|
||||
#define xQueueAddToSet MPU_xQueueAddToSet
|
||||
#define xQueueRemoveFromSet MPU_xQueueRemoveFromSet
|
||||
#define xQueueSelectFromSet MPU_xQueueSelectFromSet
|
||||
#define xQueueGenericReset MPU_xQueueGenericReset
|
||||
|
||||
#if( configQUEUE_REGISTRY_SIZE > 0 )
|
||||
#define vQueueAddToRegistry MPU_vQueueAddToRegistry
|
||||
#define vQueueUnregisterQueue MPU_vQueueUnregisterQueue
|
||||
#define pcQueueGetName MPU_pcQueueGetName
|
||||
#endif
|
||||
|
||||
/* Map standard timer.h API functions to the MPU equivalents. */
|
||||
#define xTimerCreate MPU_xTimerCreate
|
||||
#define xTimerCreateStatic MPU_xTimerCreateStatic
|
||||
#define pvTimerGetTimerID MPU_pvTimerGetTimerID
|
||||
#define vTimerSetTimerID MPU_vTimerSetTimerID
|
||||
#define xTimerIsTimerActive MPU_xTimerIsTimerActive
|
||||
#define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
|
||||
#define xTimerPendFunctionCall MPU_xTimerPendFunctionCall
|
||||
#define pcTimerGetName MPU_pcTimerGetName
|
||||
#define xTimerGetPeriod MPU_xTimerGetPeriod
|
||||
#define xTimerGetExpiryTime MPU_xTimerGetExpiryTime
|
||||
#define xTimerGenericCommand MPU_xTimerGenericCommand
|
||||
|
||||
/* Map standard event_group.h API functions to the MPU equivalents. */
|
||||
#define xEventGroupCreate MPU_xEventGroupCreate
|
||||
#define xEventGroupCreateStatic MPU_xEventGroupCreateStatic
|
||||
#define xEventGroupWaitBits MPU_xEventGroupWaitBits
|
||||
#define xEventGroupClearBits MPU_xEventGroupClearBits
|
||||
#define xEventGroupSetBits MPU_xEventGroupSetBits
|
||||
#define xEventGroupSync MPU_xEventGroupSync
|
||||
#define vEventGroupDelete MPU_vEventGroupDelete
|
||||
|
||||
/* Remove the privileged function macro. */
|
||||
#define PRIVILEGED_FUNCTION
|
||||
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -70,259 +74,36 @@
|
||||
#ifndef PORTABLE_H
|
||||
#define PORTABLE_H
|
||||
|
||||
/* Include the macro file relevant to the port being used.
|
||||
NOTE: The following definitions are *DEPRECATED* as it is preferred to instead
|
||||
just add the path to the correct portmacro.h header file to the compiler's
|
||||
include path. */
|
||||
#ifdef OPEN_WATCOM_INDUSTRIAL_PC_PORT
|
||||
#include "..\..\Source\portable\owatcom\16bitdos\pc\portmacro.h"
|
||||
typedef void ( __interrupt __far *pxISR )();
|
||||
#endif
|
||||
/* Each FreeRTOS port has a unique portmacro.h header file. Originally a
|
||||
pre-processor definition was used to ensure the pre-processor found the correct
|
||||
portmacro.h file for the port being used. That scheme was deprecated in favour
|
||||
of setting the compiler's include path such that it found the correct
|
||||
portmacro.h file - removing the need for the constant and allowing the
|
||||
portmacro.h file to be located anywhere in relation to the port being used.
|
||||
Purely for reasons of backward compatibility the old method is still valid, but
|
||||
to make it clear that new projects should not use it, support for the port
|
||||
specific constants has been moved into the deprecated_definitions.h header
|
||||
file. */
|
||||
#include "deprecated_definitions.h"
|
||||
|
||||
#ifdef OPEN_WATCOM_FLASH_LITE_186_PORT
|
||||
#include "..\..\Source\portable\owatcom\16bitdos\flsh186\portmacro.h"
|
||||
typedef void ( __interrupt __far *pxISR )();
|
||||
#endif
|
||||
|
||||
#ifdef GCC_MEGA_AVR
|
||||
#include "../portable/GCC/ATMega323/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_MEGA_AVR
|
||||
#include "../portable/IAR/ATMega323/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_PIC24_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_DSPIC_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC24_dsPIC/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_PIC18F_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC18F/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MPLAB_PIC32MX_PORT
|
||||
#include "../../Source/portable/MPLAB/PIC32MX/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef _FEDPICC
|
||||
#include "libFreeRTOS/Include/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SDCC_CYGNAL
|
||||
#include "../../Source/portable/SDCC/Cygnal/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARM7
|
||||
#include "../../Source/portable/GCC/ARM7_LPC2000/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARM7_ECLIPSE
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ROWLEY_LPC23xx
|
||||
#include "../../Source/portable/GCC/ARM7_LPC23xx/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_MSP430
|
||||
#include "..\..\Source\portable\IAR\MSP430\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_MSP430
|
||||
#include "../../Source/portable/GCC/MSP430F449/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ROWLEY_MSP430
|
||||
#include "../../Source/portable/Rowley/MSP430F449/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef ARM7_LPC21xx_KEIL_RVDS
|
||||
#include "..\..\Source\portable\RVDS\ARM7_LPC21xx\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SAM7_GCC
|
||||
#include "../../Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SAM7_IAR
|
||||
#include "..\..\Source\portable\IAR\AtmelSAM7S64\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef SAM9XE_IAR
|
||||
#include "..\..\Source\portable\IAR\AtmelSAM9XE\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef LPC2000_IAR
|
||||
#include "..\..\Source\portable\IAR\LPC2000\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR71X_IAR
|
||||
#include "..\..\Source\portable\IAR\STR71x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR75X_IAR
|
||||
#include "..\..\Source\portable\IAR\STR75x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR75X_GCC
|
||||
#include "..\..\Source\portable\GCC\STR75x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef STR91X_IAR
|
||||
#include "..\..\Source\portable\IAR\STR91x\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_H8S
|
||||
#include "../../Source/portable/GCC/H8S2329/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_AT91FR40008
|
||||
#include "../../Source/portable/GCC/ARM7_AT91FR40008/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef RVDS_ARMCM3_LM3S102
|
||||
#include "../../Source/portable/RVDS/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARMCM3_LM3S102
|
||||
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_ARMCM3
|
||||
#include "../../Source/portable/GCC/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_ARM_CM3
|
||||
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef IAR_ARMCM3_LM
|
||||
#include "../../Source/portable/IAR/ARM_CM3/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef HCS12_CODE_WARRIOR
|
||||
#include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef MICROBLAZE_GCC
|
||||
#include "../../Source/portable/GCC/MicroBlaze/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef TERN_EE
|
||||
#include "..\..\Source\portable\Paradigm\Tern_EE\small\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_HCS12
|
||||
#include "../../Source/portable/GCC/HCS12/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_MCF5235
|
||||
#include "../../Source/portable/GCC/MCF5235/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef COLDFIRE_V2_GCC
|
||||
#include "../../../Source/portable/GCC/ColdFire_V2/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef COLDFIRE_V2_CODEWARRIOR
|
||||
#include "../../Source/portable/CodeWarrior/ColdFire_V2/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_PPC405
|
||||
#include "../../Source/portable/GCC/PPC405_Xilinx/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef GCC_PPC440
|
||||
#include "../../Source/portable/GCC/PPC440_Xilinx/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef _16FX_SOFTUNE
|
||||
#include "..\..\Source\portable\Softune\MB96340\portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef BCC_INDUSTRIAL_PC_PORT
|
||||
/* A short file name has to be used in place of the normal
|
||||
FreeRTOSConfig.h when using the Borland compiler. */
|
||||
#include "frconfig.h"
|
||||
#include "..\portable\BCC\16BitDOS\PC\prtmacro.h"
|
||||
typedef void ( __interrupt __far *pxISR )();
|
||||
#endif
|
||||
|
||||
#ifdef BCC_FLASH_LITE_186_PORT
|
||||
/* A short file name has to be used in place of the normal
|
||||
FreeRTOSConfig.h when using the Borland compiler. */
|
||||
#include "frconfig.h"
|
||||
#include "..\portable\BCC\16BitDOS\flsh186\prtmacro.h"
|
||||
typedef void ( __interrupt __far *pxISR )();
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef __AVR32_AVR32A__
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __ICCAVR32__
|
||||
#ifdef __CORE__
|
||||
#if __CORE__ == __AVR32A__
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __91467D
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __96340
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __IAR_V850ES_Fx3__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Jx3__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Jx3_L__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Jx2__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_V850ES_Hx2__
|
||||
#include "../../Source/portable/IAR/V850ES/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_78K0R_Kx3__
|
||||
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||
#endif
|
||||
|
||||
#ifdef __IAR_78K0R_Kx3L__
|
||||
#include "../../Source/portable/IAR/78K0R/portmacro.h"
|
||||
#endif
|
||||
|
||||
/* Catch all to ensure portmacro.h is included in the build. Newer demos
|
||||
have the path as part of the project options, rather than as relative from
|
||||
the project location. If portENTER_CRITICAL() has not been defined then
|
||||
portmacro.h has not yet been included - as every portmacro.h provides a
|
||||
portENTER_CRITICAL() definition. Check the demo application for your demo
|
||||
to find the path to the correct portmacro.h file. */
|
||||
/* If portENTER_CRITICAL is not defined then including deprecated_definitions.h
|
||||
did not result in a portmacro.h header file being included - and it should be
|
||||
included here. In this case the path to the correct portmacro.h header file
|
||||
must be set in the compiler's include path. */
|
||||
#ifndef portENTER_CRITICAL
|
||||
#include "portmacro.h"
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 32
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x001f )
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 16
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x000f )
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 8
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x0007U )
|
||||
#define portBYTE_ALIGNMENT_MASK ( 0x0007 )
|
||||
#endif
|
||||
|
||||
#if portBYTE_ALIGNMENT == 4
|
||||
@@ -370,18 +151,18 @@ typedef struct HeapRegion
|
||||
size_t xSizeInBytes;
|
||||
} HeapRegion_t;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Used to define multiple heap regions for use by heap_5.c. This function
|
||||
* must be called before any calls to pvPortMalloc() - not creating a task,
|
||||
* queue, semaphore, mutex, software timer, event group, etc. will result in
|
||||
* pvPortMalloc being called.
|
||||
*
|
||||
* pxHeapRegions passes in an array of HeapRegion_t structures - each of which
|
||||
* defines a region of memory that can be used as the heap. The array is
|
||||
* terminated by a HeapRegions_t structure that has a size of 0. The region
|
||||
* defines a region of memory that can be used as the heap. The array is
|
||||
* terminated by a HeapRegions_t structure that has a size of 0. The region
|
||||
* with the lowest start address must appear first in the array.
|
||||
*/
|
||||
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions );
|
||||
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions ) PRIVILEGED_FUNCTION;
|
||||
|
||||
|
||||
/*
|
||||
@@ -415,7 +196,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
|
||||
*/
|
||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||
struct xMEMORY_REGION;
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint16_t usStackDepth ) PRIVILEGED_FUNCTION;
|
||||
void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, StackType_t *pxBottomOfStack, uint32_t ulStackDepth ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -72,8 +76,12 @@
|
||||
*/
|
||||
typedef void (*TaskFunction_t)( void * );
|
||||
|
||||
/* Converts a time in milliseconds to a time in ticks. */
|
||||
#define pdMS_TO_TICKS( xTimeInMs ) ( ( ( TickType_t ) ( xTimeInMs ) * configTICK_RATE_HZ ) / ( TickType_t ) 1000 )
|
||||
/* Converts a time in milliseconds to a time in ticks. This macro can be
|
||||
overridden by a macro of the same name defined in FreeRTOSConfig.h in case the
|
||||
definition here is not suitable for your application. */
|
||||
#ifndef pdMS_TO_TICKS
|
||||
#define pdMS_TO_TICKS( xTimeInMs ) ( ( TickType_t ) ( ( ( TickType_t ) ( xTimeInMs ) * ( TickType_t ) configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) )
|
||||
#endif
|
||||
|
||||
#define pdFALSE ( ( BaseType_t ) 0 )
|
||||
#define pdTRUE ( ( BaseType_t ) 1 )
|
||||
@@ -83,11 +91,70 @@ typedef void (*TaskFunction_t)( void * );
|
||||
#define errQUEUE_EMPTY ( ( BaseType_t ) 0 )
|
||||
#define errQUEUE_FULL ( ( BaseType_t ) 0 )
|
||||
|
||||
/* Error definitions. */
|
||||
/* FreeRTOS error definitions. */
|
||||
#define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 )
|
||||
#define errQUEUE_BLOCKED ( -4 )
|
||||
#define errQUEUE_YIELD ( -5 )
|
||||
|
||||
/* Macros used for basic data corruption checks. */
|
||||
#ifndef configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES
|
||||
#define configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES 0
|
||||
#endif
|
||||
|
||||
#if( configUSE_16_BIT_TICKS == 1 )
|
||||
#define pdINTEGRITY_CHECK_VALUE 0x5a5a
|
||||
#else
|
||||
#define pdINTEGRITY_CHECK_VALUE 0x5a5a5a5aUL
|
||||
#endif
|
||||
|
||||
/* The following errno values are used by FreeRTOS+ components, not FreeRTOS
|
||||
itself. */
|
||||
#define pdFREERTOS_ERRNO_NONE 0 /* No errors */
|
||||
#define pdFREERTOS_ERRNO_ENOENT 2 /* No such file or directory */
|
||||
#define pdFREERTOS_ERRNO_EINTR 4 /* Interrupted system call */
|
||||
#define pdFREERTOS_ERRNO_EIO 5 /* I/O error */
|
||||
#define pdFREERTOS_ERRNO_ENXIO 6 /* No such device or address */
|
||||
#define pdFREERTOS_ERRNO_EBADF 9 /* Bad file number */
|
||||
#define pdFREERTOS_ERRNO_EAGAIN 11 /* No more processes */
|
||||
#define pdFREERTOS_ERRNO_EWOULDBLOCK 11 /* Operation would block */
|
||||
#define pdFREERTOS_ERRNO_ENOMEM 12 /* Not enough memory */
|
||||
#define pdFREERTOS_ERRNO_EACCES 13 /* Permission denied */
|
||||
#define pdFREERTOS_ERRNO_EFAULT 14 /* Bad address */
|
||||
#define pdFREERTOS_ERRNO_EBUSY 16 /* Mount device busy */
|
||||
#define pdFREERTOS_ERRNO_EEXIST 17 /* File exists */
|
||||
#define pdFREERTOS_ERRNO_EXDEV 18 /* Cross-device link */
|
||||
#define pdFREERTOS_ERRNO_ENODEV 19 /* No such device */
|
||||
#define pdFREERTOS_ERRNO_ENOTDIR 20 /* Not a directory */
|
||||
#define pdFREERTOS_ERRNO_EISDIR 21 /* Is a directory */
|
||||
#define pdFREERTOS_ERRNO_EINVAL 22 /* Invalid argument */
|
||||
#define pdFREERTOS_ERRNO_ENOSPC 28 /* No space left on device */
|
||||
#define pdFREERTOS_ERRNO_ESPIPE 29 /* Illegal seek */
|
||||
#define pdFREERTOS_ERRNO_EROFS 30 /* Read only file system */
|
||||
#define pdFREERTOS_ERRNO_EUNATCH 42 /* Protocol driver not attached */
|
||||
#define pdFREERTOS_ERRNO_EBADE 50 /* Invalid exchange */
|
||||
#define pdFREERTOS_ERRNO_EFTYPE 79 /* Inappropriate file type or format */
|
||||
#define pdFREERTOS_ERRNO_ENMFILE 89 /* No more files */
|
||||
#define pdFREERTOS_ERRNO_ENOTEMPTY 90 /* Directory not empty */
|
||||
#define pdFREERTOS_ERRNO_ENAMETOOLONG 91 /* File or path name too long */
|
||||
#define pdFREERTOS_ERRNO_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
|
||||
#define pdFREERTOS_ERRNO_ENOBUFS 105 /* No buffer space available */
|
||||
#define pdFREERTOS_ERRNO_ENOPROTOOPT 109 /* Protocol not available */
|
||||
#define pdFREERTOS_ERRNO_EADDRINUSE 112 /* Address already in use */
|
||||
#define pdFREERTOS_ERRNO_ETIMEDOUT 116 /* Connection timed out */
|
||||
#define pdFREERTOS_ERRNO_EINPROGRESS 119 /* Connection already in progress */
|
||||
#define pdFREERTOS_ERRNO_EALREADY 120 /* Socket already connected */
|
||||
#define pdFREERTOS_ERRNO_EADDRNOTAVAIL 125 /* Address not available */
|
||||
#define pdFREERTOS_ERRNO_EISCONN 127 /* Socket is already connected */
|
||||
#define pdFREERTOS_ERRNO_ENOTCONN 128 /* Socket is not connected */
|
||||
#define pdFREERTOS_ERRNO_ENOMEDIUM 135 /* No medium inserted */
|
||||
#define pdFREERTOS_ERRNO_EILSEQ 138 /* An invalid UTF-16 sequence was encountered. */
|
||||
#define pdFREERTOS_ERRNO_ECANCELED 140 /* Operation canceled. */
|
||||
|
||||
/* The following endian values are used by FreeRTOS+ components, not FreeRTOS
|
||||
itself. */
|
||||
#define pdFREERTOS_LITTLE_ENDIAN 0
|
||||
#define pdFREERTOS_BIG_ENDIAN 1
|
||||
|
||||
#endif /* PROJDEFS_H */
|
||||
|
||||
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -119,8 +123,20 @@ typedef void * QueueSetMemberHandle_t;
|
||||
);
|
||||
* </pre>
|
||||
*
|
||||
* Creates a new queue instance. This allocates the storage required by the
|
||||
* new queue and returns a handle for the queue.
|
||||
* Creates a new queue instance, and returns a handle by which the new queue
|
||||
* can be referenced.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, queues use two blocks of
|
||||
* memory. The first block is used to hold the queue's data structures. The
|
||||
* second block is used to hold items placed into the queue. If a queue is
|
||||
* created using xQueueCreate() then both blocks of memory are automatically
|
||||
* dynamically allocated inside the xQueueCreate() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a queue is created using
|
||||
* xQueueCreateStatic() then the application writer must provide the memory that
|
||||
* will get used by the queue. xQueueCreateStatic() therefore allows a queue to
|
||||
* be created without using any dynamic memory allocation.
|
||||
*
|
||||
* http://www.FreeRTOS.org/Embedded-RTOS-Queues.html
|
||||
*
|
||||
* @param uxQueueLength The maximum number of items that the queue can contain.
|
||||
*
|
||||
@@ -166,7 +182,95 @@ typedef void * QueueSetMemberHandle_t;
|
||||
* \defgroup xQueueCreate xQueueCreate
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
#define xQueueCreate( uxQueueLength, uxItemSize ) xQueueGenericCreate( uxQueueLength, uxItemSize, queueQUEUE_TYPE_BASE )
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
#define xQueueCreate( uxQueueLength, uxItemSize ) xQueueGenericCreate( ( uxQueueLength ), ( uxItemSize ), ( queueQUEUE_TYPE_BASE ) )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
* <pre>
|
||||
QueueHandle_t xQueueCreateStatic(
|
||||
UBaseType_t uxQueueLength,
|
||||
UBaseType_t uxItemSize,
|
||||
uint8_t *pucQueueStorageBuffer,
|
||||
StaticQueue_t *pxQueueBuffer
|
||||
);
|
||||
* </pre>
|
||||
*
|
||||
* Creates a new queue instance, and returns a handle by which the new queue
|
||||
* can be referenced.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, queues use two blocks of
|
||||
* memory. The first block is used to hold the queue's data structures. The
|
||||
* second block is used to hold items placed into the queue. If a queue is
|
||||
* created using xQueueCreate() then both blocks of memory are automatically
|
||||
* dynamically allocated inside the xQueueCreate() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a queue is created using
|
||||
* xQueueCreateStatic() then the application writer must provide the memory that
|
||||
* will get used by the queue. xQueueCreateStatic() therefore allows a queue to
|
||||
* be created without using any dynamic memory allocation.
|
||||
*
|
||||
* http://www.FreeRTOS.org/Embedded-RTOS-Queues.html
|
||||
*
|
||||
* @param uxQueueLength The maximum number of items that the queue can contain.
|
||||
*
|
||||
* @param uxItemSize The number of bytes each item in the queue will require.
|
||||
* Items are queued by copy, not by reference, so this is the number of bytes
|
||||
* that will be copied for each posted item. Each item on the queue must be
|
||||
* the same size.
|
||||
*
|
||||
* @param pucQueueStorageBuffer If uxItemSize is not zero then
|
||||
* pucQueueStorageBuffer must point to a uint8_t array that is at least large
|
||||
* enough to hold the maximum number of items that can be in the queue at any
|
||||
* one time - which is ( uxQueueLength * uxItemsSize ) bytes. If uxItemSize is
|
||||
* zero then pucQueueStorageBuffer can be NULL.
|
||||
*
|
||||
* @param pxQueueBuffer Must point to a variable of type StaticQueue_t, which
|
||||
* will be used to hold the queue's data structure.
|
||||
*
|
||||
* @return If the queue is created then a handle to the created queue is
|
||||
* returned. If pxQueueBuffer is NULL then NULL is returned.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
struct AMessage
|
||||
{
|
||||
char ucMessageID;
|
||||
char ucData[ 20 ];
|
||||
};
|
||||
|
||||
#define QUEUE_LENGTH 10
|
||||
#define ITEM_SIZE sizeof( uint32_t )
|
||||
|
||||
// xQueueBuffer will hold the queue structure.
|
||||
StaticQueue_t xQueueBuffer;
|
||||
|
||||
// ucQueueStorage will hold the items posted to the queue. Must be at least
|
||||
// [(queue length) * ( queue item size)] bytes long.
|
||||
uint8_t ucQueueStorage[ QUEUE_LENGTH * ITEM_SIZE ];
|
||||
|
||||
void vATask( void *pvParameters )
|
||||
{
|
||||
QueueHandle_t xQueue1;
|
||||
|
||||
// Create a queue capable of containing 10 uint32_t values.
|
||||
xQueue1 = xQueueCreate( QUEUE_LENGTH, // The number of items the queue can hold.
|
||||
ITEM_SIZE // The size of each item in the queue
|
||||
&( ucQueueStorage[ 0 ] ), // The buffer that will hold the items in the queue.
|
||||
&xQueueBuffer ); // The buffer that will hold the queue structure.
|
||||
|
||||
// The queue is guaranteed to be created successfully as no dynamic memory
|
||||
// allocation is used. Therefore xQueue1 is now a handle to a valid queue.
|
||||
|
||||
// ... Rest of task code.
|
||||
}
|
||||
</pre>
|
||||
* \defgroup xQueueCreateStatic xQueueCreateStatic
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
#define xQueueCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxQueueBuffer ) xQueueGenericCreateStatic( ( uxQueueLength ), ( uxItemSize ), ( pucQueueStorage ), ( pxQueueBuffer ), ( queueQUEUE_TYPE_BASE ) )
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
@@ -1269,7 +1373,8 @@ uint32_t ulVarToSend, ulValReceived;
|
||||
*
|
||||
* It is preferred that the macros xQueueSendFromISR(),
|
||||
* xQueueSendToFrontFromISR() and xQueueSendToBackFromISR() be used in place
|
||||
* of calling this function directly.
|
||||
* of calling this function directly. xQueueGiveFromISR() is an
|
||||
* equivalent for use by semaphores that don't actually copy any data.
|
||||
*
|
||||
* Post an item on a queue. It is safe to use this function from within an
|
||||
* interrupt service routine.
|
||||
@@ -1333,6 +1438,7 @@ uint32_t ulVarToSend, ulValReceived;
|
||||
* \ingroup QueueManagement
|
||||
*/
|
||||
BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue, const void * const pvItemToQueue, BaseType_t * const pxHigherPriorityTaskWoken, const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* queue. h
|
||||
@@ -1431,28 +1537,6 @@ BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FU
|
||||
BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
|
||||
|
||||
/*
|
||||
* xQueueAltGenericSend() is an alternative version of xQueueGenericSend().
|
||||
* Likewise xQueueAltGenericReceive() is an alternative version of
|
||||
* xQueueGenericReceive().
|
||||
*
|
||||
* The source code that implements the alternative (Alt) API is much
|
||||
* simpler because it executes everything from within a critical section.
|
||||
* This is the approach taken by many other RTOSes, but FreeRTOS.org has the
|
||||
* preferred fully featured API too. The fully featured API has more
|
||||
* complex code that takes longer to execute, but makes much less use of
|
||||
* critical sections. Therefore the alternative API sacrifices interrupt
|
||||
* responsiveness to gain execution speed, whereas the fully featured API
|
||||
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||
*/
|
||||
BaseType_t xQueueAltGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition );
|
||||
BaseType_t xQueueAltGenericReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait, BaseType_t xJustPeeking );
|
||||
#define xQueueAltSendToFront( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_FRONT )
|
||||
#define xQueueAltSendToBack( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK )
|
||||
#define xQueueAltReceive( xQueue, pvBuffer, xTicksToWait ) xQueueAltGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), pdFALSE )
|
||||
#define xQueueAltPeek( xQueue, pvBuffer, xTicksToWait ) xQueueAltGenericReceive( ( xQueue ), ( pvBuffer ), ( xTicksToWait ), pdTRUE )
|
||||
|
||||
/*
|
||||
* The functions defined above are for passing data to and from tasks. The
|
||||
* functions below are the equivalents for passing data to and from
|
||||
@@ -1473,7 +1557,9 @@ BaseType_t xQueueCRReceive( QueueHandle_t xQueue, void *pvBuffer, TickType_t xTi
|
||||
* these functions directly.
|
||||
*/
|
||||
QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
||||
QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue ) PRIVILEGED_FUNCTION;
|
||||
QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;
|
||||
QueueHandle_t xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue ) PRIVILEGED_FUNCTION;
|
||||
void* xQueueGetMutexHolder( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
@@ -1484,10 +1570,8 @@ BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWa
|
||||
BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Reset a queue back to its original empty state. pdPASS is returned if the
|
||||
* queue is successfully reset. pdFAIL is returned if the queue could not be
|
||||
* reset because there are tasks blocked on the queue waiting to either
|
||||
* receive from the queue or send to the queue.
|
||||
* Reset a queue back to its original empty state. The return value is now
|
||||
* obsolete and is always set to pdPASS.
|
||||
*/
|
||||
#define xQueueReset( xQueue ) xQueueGenericReset( xQueue, pdFALSE )
|
||||
|
||||
@@ -1513,7 +1597,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION
|
||||
* stores a pointer to the string - so the string must be persistent (global or
|
||||
* preferably in ROM/Flash), not on the stack.
|
||||
*/
|
||||
#if configQUEUE_REGISTRY_SIZE > 0
|
||||
#if( configQUEUE_REGISTRY_SIZE > 0 )
|
||||
void vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#endif
|
||||
|
||||
@@ -1527,15 +1611,42 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION
|
||||
*
|
||||
* @param xQueue The handle of the queue being removed from the registry.
|
||||
*/
|
||||
#if configQUEUE_REGISTRY_SIZE > 0
|
||||
#if( configQUEUE_REGISTRY_SIZE > 0 )
|
||||
void vQueueUnregisterQueue( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Generic version of the queue creation function, which is in turn called by
|
||||
* any queue, semaphore or mutex creation function or macro.
|
||||
* The queue registry is provided as a means for kernel aware debuggers to
|
||||
* locate queues, semaphores and mutexes. Call pcQueueGetName() to look
|
||||
* up and return the name of a queue in the queue registry from the queue's
|
||||
* handle.
|
||||
*
|
||||
* @param xQueue The handle of the queue the name of which will be returned.
|
||||
* @return If the queue is in the registry then a pointer to the name of the
|
||||
* queue is returned. If the queue is not in the registry then NULL is
|
||||
* returned.
|
||||
*/
|
||||
QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
||||
#if( configQUEUE_REGISTRY_SIZE > 0 )
|
||||
const char *pcQueueGetName( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Generic version of the function used to creaet a queue using dynamic memory
|
||||
* allocation. This is called by other functions and macros that create other
|
||||
* RTOS objects that use the queue structure as their base.
|
||||
*/
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Generic version of the function used to creaet a queue using dynamic memory
|
||||
* allocation. This is called by other functions and macros that create other
|
||||
* RTOS objects that use the queue structure as their base.
|
||||
*/
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
QueueHandle_t xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Queue sets provide a mechanism to allow a task to block (pend) on a read
|
||||
@@ -1672,7 +1783,7 @@ QueueSetMemberHandle_t xQueueSelectFromSet( QueueSetHandle_t xQueueSet, const Ti
|
||||
QueueSetMemberHandle_t xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/* Not public API functions. */
|
||||
void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
|
||||
void vQueueSetQueueNumber( QueueHandle_t xQueue, UBaseType_t uxQueueNumber ) PRIVILEGED_FUNCTION;
|
||||
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -83,6 +87,10 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* semphr. h
|
||||
* <pre>vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore )</pre>
|
||||
*
|
||||
* In many usage scenarios it is faster and more memory efficient to use a
|
||||
* direct to task notification in place of a binary semaphore!
|
||||
* http://www.freertos.org/RTOS-task-notifications.html
|
||||
*
|
||||
* This old vSemaphoreCreateBinary() macro is now deprecated in favour of the
|
||||
* xSemaphoreCreateBinary() function. Note that binary semaphores created using
|
||||
* the vSemaphoreCreateBinary() macro are created in a state such that the
|
||||
@@ -124,19 +132,37 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define vSemaphoreCreateBinary( xSemaphore ) \
|
||||
{ \
|
||||
( xSemaphore ) = xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE ); \
|
||||
if( ( xSemaphore ) != NULL ) \
|
||||
{ \
|
||||
( void ) xSemaphoreGive( ( xSemaphore ) ); \
|
||||
} \
|
||||
}
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
#define vSemaphoreCreateBinary( xSemaphore ) \
|
||||
{ \
|
||||
( xSemaphore ) = xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE ); \
|
||||
if( ( xSemaphore ) != NULL ) \
|
||||
{ \
|
||||
( void ) xSemaphoreGive( ( xSemaphore ) ); \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateBinary( void )</pre>
|
||||
*
|
||||
* Creates a new binary semaphore instance, and returns a handle by which the
|
||||
* new semaphore can be referenced.
|
||||
*
|
||||
* In many usage scenarios it is faster and more memory efficient to use a
|
||||
* direct to task notification in place of a binary semaphore!
|
||||
* http://www.freertos.org/RTOS-task-notifications.html
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, binary semaphores use a block
|
||||
* of memory, in which the semaphore structure is stored. If a binary semaphore
|
||||
* is created using xSemaphoreCreateBinary() then the required memory is
|
||||
* automatically dynamically allocated inside the xSemaphoreCreateBinary()
|
||||
* function. (see http://www.freertos.org/a00111.html). If a binary semaphore
|
||||
* is created using xSemaphoreCreateBinaryStatic() then the application writer
|
||||
* must provide the memory. xSemaphoreCreateBinaryStatic() therefore allows a
|
||||
* binary semaphore to be created without using any dynamic memory allocation.
|
||||
*
|
||||
* The old vSemaphoreCreateBinary() macro is now deprecated in favour of this
|
||||
* xSemaphoreCreateBinary() function. Note that binary semaphores created using
|
||||
* the vSemaphoreCreateBinary() macro are created in a state such that the
|
||||
@@ -144,11 +170,6 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* created using xSemaphoreCreateBinary() are created in a state such that the
|
||||
* the semaphore must first be 'given' before it can be 'taken'.
|
||||
*
|
||||
* Function that creates a semaphore by using the existing queue mechanism.
|
||||
* The queue length is 1 as this is a binary semaphore. The data size is 0
|
||||
* as nothing is actually stored - all that is important is whether the queue is
|
||||
* empty or full (the binary semaphore is available or not).
|
||||
*
|
||||
* This type of semaphore can be used for pure synchronisation between tasks or
|
||||
* between an interrupt and a task. The semaphore need not be given back once
|
||||
* obtained, so one task/interrupt can continuously 'give' the semaphore while
|
||||
@@ -156,7 +177,8 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* semaphore does not use a priority inheritance mechanism. For an alternative
|
||||
* that does use priority inheritance see xSemaphoreCreateMutex().
|
||||
*
|
||||
* @return Handle to the created semaphore.
|
||||
* @return Handle to the created semaphore, or NULL if the memory required to
|
||||
* hold the semaphore's data structures could not be allocated.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
@@ -164,7 +186,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
// Semaphore cannot be used before a call to vSemaphoreCreateBinary ().
|
||||
// Semaphore cannot be used before a call to xSemaphoreCreateBinary().
|
||||
// This is a macro so pass the variable in directly.
|
||||
xSemaphore = xSemaphoreCreateBinary();
|
||||
|
||||
@@ -175,10 +197,71 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
|
||||
* \defgroup xSemaphoreCreateBinary xSemaphoreCreateBinary
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreCreateBinary() xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
#define xSemaphoreCreateBinary() xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateBinaryStatic( StaticSemaphore_t *pxSemaphoreBuffer )</pre>
|
||||
*
|
||||
* Creates a new binary semaphore instance, and returns a handle by which the
|
||||
* new semaphore can be referenced.
|
||||
*
|
||||
* NOTE: In many usage scenarios it is faster and more memory efficient to use a
|
||||
* direct to task notification in place of a binary semaphore!
|
||||
* http://www.freertos.org/RTOS-task-notifications.html
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, binary semaphores use a block
|
||||
* of memory, in which the semaphore structure is stored. If a binary semaphore
|
||||
* is created using xSemaphoreCreateBinary() then the required memory is
|
||||
* automatically dynamically allocated inside the xSemaphoreCreateBinary()
|
||||
* function. (see http://www.freertos.org/a00111.html). If a binary semaphore
|
||||
* is created using xSemaphoreCreateBinaryStatic() then the application writer
|
||||
* must provide the memory. xSemaphoreCreateBinaryStatic() therefore allows a
|
||||
* binary semaphore to be created without using any dynamic memory allocation.
|
||||
*
|
||||
* This type of semaphore can be used for pure synchronisation between tasks or
|
||||
* between an interrupt and a task. The semaphore need not be given back once
|
||||
* obtained, so one task/interrupt can continuously 'give' the semaphore while
|
||||
* another continuously 'takes' the semaphore. For this reason this type of
|
||||
* semaphore does not use a priority inheritance mechanism. For an alternative
|
||||
* that does use priority inheritance see xSemaphoreCreateMutex().
|
||||
*
|
||||
* @param pxSemaphoreBuffer Must point to a variable of type StaticSemaphore_t,
|
||||
* which will then be used to hold the semaphore's data structure, removing the
|
||||
* need for the memory to be allocated dynamically.
|
||||
*
|
||||
* @return If the semaphore is created then a handle to the created semaphore is
|
||||
* returned. If pxSemaphoreBuffer is NULL then NULL is returned.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
SemaphoreHandle_t xSemaphore = NULL;
|
||||
StaticSemaphore_t xSemaphoreBuffer;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
// Semaphore cannot be used before a call to xSemaphoreCreateBinary().
|
||||
// The semaphore's data structures will be placed in the xSemaphoreBuffer
|
||||
// variable, the address of which is passed into the function. The
|
||||
// function's parameter is not NULL, so the function will not attempt any
|
||||
// dynamic memory allocation, and therefore the function will not return
|
||||
// return NULL.
|
||||
xSemaphore = xSemaphoreCreateBinary( &xSemaphoreBuffer );
|
||||
|
||||
// Rest of task code goes here.
|
||||
}
|
||||
</pre>
|
||||
* \defgroup xSemaphoreCreateBinaryStatic xSemaphoreCreateBinaryStatic
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
#define xSemaphoreCreateBinaryStatic( pxStaticSemaphore ) xQueueGenericCreateStatic( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, NULL, pxStaticSemaphore, queueQUEUE_TYPE_BINARY_SEMAPHORE )
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
@@ -188,7 +271,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* )</pre>
|
||||
*
|
||||
* <i>Macro</i> to obtain a semaphore. The semaphore must have previously been
|
||||
* created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
|
||||
* created with a call to xSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
|
||||
* xSemaphoreCreateCounting().
|
||||
*
|
||||
* @param xSemaphore A handle to the semaphore being taken - obtained when
|
||||
@@ -211,7 +294,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
// Create the semaphore to guard a shared resource.
|
||||
vSemaphoreCreateBinary( xSemaphore );
|
||||
xSemaphore = xSemaphoreCreateBinary();
|
||||
}
|
||||
|
||||
// A task that uses the semaphore.
|
||||
@@ -338,29 +421,16 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreTakeRecursive( xMutex, xBlockTime ) xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )
|
||||
|
||||
|
||||
/*
|
||||
* xSemaphoreAltTake() is an alternative version of xSemaphoreTake().
|
||||
*
|
||||
* The source code that implements the alternative (Alt) API is much
|
||||
* simpler because it executes everything from within a critical section.
|
||||
* This is the approach taken by many other RTOSes, but FreeRTOS.org has the
|
||||
* preferred fully featured API too. The fully featured API has more
|
||||
* complex code that takes longer to execute, but makes much less use of
|
||||
* critical sections. Therefore the alternative API sacrifices interrupt
|
||||
* responsiveness to gain execution speed, whereas the fully featured API
|
||||
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||
*/
|
||||
#define xSemaphoreAltTake( xSemaphore, xBlockTime ) xQueueAltGenericReceive( ( QueueHandle_t ) ( xSemaphore ), NULL, ( xBlockTime ), pdFALSE )
|
||||
#if( configUSE_RECURSIVE_MUTEXES == 1 )
|
||||
#define xSemaphoreTakeRecursive( xMutex, xBlockTime ) xQueueTakeMutexRecursive( ( xMutex ), ( xBlockTime ) )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>xSemaphoreGive( SemaphoreHandle_t xSemaphore )</pre>
|
||||
*
|
||||
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
|
||||
* created with a call to vSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
|
||||
* created with a call to xSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
|
||||
* xSemaphoreCreateCounting(). and obtained using sSemaphoreTake().
|
||||
*
|
||||
* This macro must not be used from an ISR. See xSemaphoreGiveFromISR () for
|
||||
@@ -384,7 +454,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
// Create the semaphore to guard a shared resource.
|
||||
vSemaphoreCreateBinary( xSemaphore );
|
||||
xSemaphore = vSemaphoreCreateBinary();
|
||||
|
||||
if( xSemaphore != NULL )
|
||||
{
|
||||
@@ -500,21 +570,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreGiveRecursive( xMutex ) xQueueGiveMutexRecursive( ( xMutex ) )
|
||||
|
||||
/*
|
||||
* xSemaphoreAltGive() is an alternative version of xSemaphoreGive().
|
||||
*
|
||||
* The source code that implements the alternative (Alt) API is much
|
||||
* simpler because it executes everything from within a critical section.
|
||||
* This is the approach taken by many other RTOSes, but FreeRTOS.org has the
|
||||
* preferred fully featured API too. The fully featured API has more
|
||||
* complex code that takes longer to execute, but makes much less use of
|
||||
* critical sections. Therefore the alternative API sacrifices interrupt
|
||||
* responsiveness to gain execution speed, whereas the fully featured API
|
||||
* sacrifices execution speed to ensure better interrupt responsiveness.
|
||||
*/
|
||||
#define xSemaphoreAltGive( xSemaphore ) xQueueAltGenericSend( ( QueueHandle_t ) ( xSemaphore ), NULL, semGIVE_BLOCK_TIME, queueSEND_TO_BACK )
|
||||
#if( configUSE_RECURSIVE_MUTEXES == 1 )
|
||||
#define xSemaphoreGiveRecursive( xMutex ) xQueueGiveMutexRecursive( ( xMutex ) )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
@@ -525,7 +583,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
)</pre>
|
||||
*
|
||||
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
|
||||
* created with a call to vSemaphoreCreateBinary() or xSemaphoreCreateCounting().
|
||||
* created with a call to xSemaphoreCreateBinary() or xSemaphoreCreateCounting().
|
||||
*
|
||||
* Mutex type semaphores (those created using a call to xSemaphoreCreateMutex())
|
||||
* must not be used with this macro.
|
||||
@@ -605,7 +663,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( ( QueueHandle_t ) ( xSemaphore ), NULL, ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
|
||||
#define xSemaphoreGiveFromISR( xSemaphore, pxHigherPriorityTaskWoken ) xQueueGiveFromISR( ( QueueHandle_t ) ( xSemaphore ), ( pxHigherPriorityTaskWoken ) )
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
@@ -616,7 +674,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
)</pre>
|
||||
*
|
||||
* <i>Macro</i> to take a semaphore from an ISR. The semaphore must have
|
||||
* previously been created with a call to vSemaphoreCreateBinary() or
|
||||
* previously been created with a call to xSemaphoreCreateBinary() or
|
||||
* xSemaphoreCreateCounting().
|
||||
*
|
||||
* Mutex type semaphores (those created using a call to xSemaphoreCreateMutex())
|
||||
@@ -645,12 +703,21 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* semphr. h
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateMutex( void )</pre>
|
||||
*
|
||||
* <i>Macro</i> that implements a mutex semaphore by using the existing queue
|
||||
* mechanism.
|
||||
* Creates a new mutex type semaphore instance, and returns a handle by which
|
||||
* the new mutex can be referenced.
|
||||
*
|
||||
* Mutexes created using this macro can be accessed using the xSemaphoreTake()
|
||||
* Internally, within the FreeRTOS implementation, mutex semaphores use a block
|
||||
* of memory, in which the mutex structure is stored. If a mutex is created
|
||||
* using xSemaphoreCreateMutex() then the required memory is automatically
|
||||
* dynamically allocated inside the xSemaphoreCreateMutex() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a mutex is created using
|
||||
* xSemaphoreCreateMutexStatic() then the application writer must provided the
|
||||
* memory. xSemaphoreCreateMutexStatic() therefore allows a mutex to be created
|
||||
* without using any dynamic memory allocation.
|
||||
*
|
||||
* Mutexes created using this function can be accessed using the xSemaphoreTake()
|
||||
* and xSemaphoreGive() macros. The xSemaphoreTakeRecursive() and
|
||||
* xSemaphoreGiveRecursive() macros should not be used.
|
||||
* xSemaphoreGiveRecursive() macros must not be used.
|
||||
*
|
||||
* This type of semaphore uses a priority inheritance mechanism so a task
|
||||
* 'taking' a semaphore MUST ALWAYS 'give' the semaphore back once the
|
||||
@@ -658,13 +725,14 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
*
|
||||
* Mutex type semaphores cannot be used from within interrupt service routines.
|
||||
*
|
||||
* See vSemaphoreCreateBinary() for an alternative implementation that can be
|
||||
* See xSemaphoreCreateBinary() for an alternative implementation that can be
|
||||
* used for pure synchronisation (where one task or interrupt always 'gives' the
|
||||
* semaphore and another always 'takes' the semaphore) and from within interrupt
|
||||
* service routines.
|
||||
*
|
||||
* @return xSemaphore Handle to the created mutex semaphore. Should be of type
|
||||
* SemaphoreHandle_t.
|
||||
* @return If the mutex was successfully created then a handle to the created
|
||||
* semaphore is returned. If there was not enough heap to allocate the mutex
|
||||
* data structures then NULL is returned.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
@@ -683,22 +751,96 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
* \defgroup vSemaphoreCreateMutex vSemaphoreCreateMutex
|
||||
* \defgroup xSemaphoreCreateMutex xSemaphoreCreateMutex
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
#define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateMutexStatic( StaticSemaphore_t *pxMutexBuffer )</pre>
|
||||
*
|
||||
* Creates a new mutex type semaphore instance, and returns a handle by which
|
||||
* the new mutex can be referenced.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, mutex semaphores use a block
|
||||
* of memory, in which the mutex structure is stored. If a mutex is created
|
||||
* using xSemaphoreCreateMutex() then the required memory is automatically
|
||||
* dynamically allocated inside the xSemaphoreCreateMutex() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a mutex is created using
|
||||
* xSemaphoreCreateMutexStatic() then the application writer must provided the
|
||||
* memory. xSemaphoreCreateMutexStatic() therefore allows a mutex to be created
|
||||
* without using any dynamic memory allocation.
|
||||
*
|
||||
* Mutexes created using this function can be accessed using the xSemaphoreTake()
|
||||
* and xSemaphoreGive() macros. The xSemaphoreTakeRecursive() and
|
||||
* xSemaphoreGiveRecursive() macros must not be used.
|
||||
*
|
||||
* This type of semaphore uses a priority inheritance mechanism so a task
|
||||
* 'taking' a semaphore MUST ALWAYS 'give' the semaphore back once the
|
||||
* semaphore it is no longer required.
|
||||
*
|
||||
* Mutex type semaphores cannot be used from within interrupt service routines.
|
||||
*
|
||||
* See xSemaphoreCreateBinary() for an alternative implementation that can be
|
||||
* used for pure synchronisation (where one task or interrupt always 'gives' the
|
||||
* semaphore and another always 'takes' the semaphore) and from within interrupt
|
||||
* service routines.
|
||||
*
|
||||
* @param pxMutexBuffer Must point to a variable of type StaticSemaphore_t,
|
||||
* which will be used to hold the mutex's data structure, removing the need for
|
||||
* the memory to be allocated dynamically.
|
||||
*
|
||||
* @return If the mutex was successfully created then a handle to the created
|
||||
* mutex is returned. If pxMutexBuffer was NULL then NULL is returned.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
StaticSemaphore_t xMutexBuffer;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
// A mutex cannot be used before it has been created. xMutexBuffer is
|
||||
// into xSemaphoreCreateMutexStatic() so no dynamic memory allocation is
|
||||
// attempted.
|
||||
xSemaphore = xSemaphoreCreateMutexStatic( &xMutexBuffer );
|
||||
|
||||
// As no dynamic memory allocation was performed, xSemaphore cannot be NULL,
|
||||
// so there is no need to check it.
|
||||
}
|
||||
</pre>
|
||||
* \defgroup xSemaphoreCreateMutexStatic xSemaphoreCreateMutexStatic
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
#define xSemaphoreCreateMutexStatic( pxMutexBuffer ) xQueueCreateMutexStatic( queueQUEUE_TYPE_MUTEX, ( pxMutexBuffer ) )
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void )</pre>
|
||||
*
|
||||
* <i>Macro</i> that implements a recursive mutex by using the existing queue
|
||||
* mechanism.
|
||||
* Creates a new recursive mutex type semaphore instance, and returns a handle
|
||||
* by which the new recursive mutex can be referenced.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, recursive mutexs use a block
|
||||
* of memory, in which the mutex structure is stored. If a recursive mutex is
|
||||
* created using xSemaphoreCreateRecursiveMutex() then the required memory is
|
||||
* automatically dynamically allocated inside the
|
||||
* xSemaphoreCreateRecursiveMutex() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a recursive mutex is created using
|
||||
* xSemaphoreCreateRecursiveMutexStatic() then the application writer must
|
||||
* provide the memory that will get used by the mutex.
|
||||
* xSemaphoreCreateRecursiveMutexStatic() therefore allows a recursive mutex to
|
||||
* be created without using any dynamic memory allocation.
|
||||
*
|
||||
* Mutexes created using this macro can be accessed using the
|
||||
* xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() macros. The
|
||||
* xSemaphoreTake() and xSemaphoreGive() macros should not be used.
|
||||
* xSemaphoreTake() and xSemaphoreGive() macros must not be used.
|
||||
*
|
||||
* A mutex used recursively can be 'taken' repeatedly by the owner. The mutex
|
||||
* doesn't become available again until the owner has called
|
||||
@@ -713,13 +855,13 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
*
|
||||
* Mutex type semaphores cannot be used from within interrupt service routines.
|
||||
*
|
||||
* See vSemaphoreCreateBinary() for an alternative implementation that can be
|
||||
* See xSemaphoreCreateBinary() for an alternative implementation that can be
|
||||
* used for pure synchronisation (where one task or interrupt always 'gives' the
|
||||
* semaphore and another always 'takes' the semaphore) and from within interrupt
|
||||
* service routines.
|
||||
*
|
||||
* @return xSemaphore Handle to the created mutex semaphore. Should be of type
|
||||
* SemaphoreHandle_t.
|
||||
* SemaphoreHandle_t.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
@@ -738,17 +880,107 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
* \defgroup vSemaphoreCreateMutex vSemaphoreCreateMutex
|
||||
* \defgroup xSemaphoreCreateRecursiveMutex xSemaphoreCreateRecursiveMutex
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreCreateRecursiveMutex() xQueueCreateMutex( queueQUEUE_TYPE_RECURSIVE_MUTEX )
|
||||
#if( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) )
|
||||
#define xSemaphoreCreateRecursiveMutex() xQueueCreateMutex( queueQUEUE_TYPE_RECURSIVE_MUTEX )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateRecursiveMutexStatic( StaticSemaphore_t *pxMutexBuffer )</pre>
|
||||
*
|
||||
* Creates a new recursive mutex type semaphore instance, and returns a handle
|
||||
* by which the new recursive mutex can be referenced.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, recursive mutexs use a block
|
||||
* of memory, in which the mutex structure is stored. If a recursive mutex is
|
||||
* created using xSemaphoreCreateRecursiveMutex() then the required memory is
|
||||
* automatically dynamically allocated inside the
|
||||
* xSemaphoreCreateRecursiveMutex() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a recursive mutex is created using
|
||||
* xSemaphoreCreateRecursiveMutexStatic() then the application writer must
|
||||
* provide the memory that will get used by the mutex.
|
||||
* xSemaphoreCreateRecursiveMutexStatic() therefore allows a recursive mutex to
|
||||
* be created without using any dynamic memory allocation.
|
||||
*
|
||||
* Mutexes created using this macro can be accessed using the
|
||||
* xSemaphoreTakeRecursive() and xSemaphoreGiveRecursive() macros. The
|
||||
* xSemaphoreTake() and xSemaphoreGive() macros must not be used.
|
||||
*
|
||||
* A mutex used recursively can be 'taken' repeatedly by the owner. The mutex
|
||||
* doesn't become available again until the owner has called
|
||||
* xSemaphoreGiveRecursive() for each successful 'take' request. For example,
|
||||
* if a task successfully 'takes' the same mutex 5 times then the mutex will
|
||||
* not be available to any other task until it has also 'given' the mutex back
|
||||
* exactly five times.
|
||||
*
|
||||
* This type of semaphore uses a priority inheritance mechanism so a task
|
||||
* 'taking' a semaphore MUST ALWAYS 'give' the semaphore back once the
|
||||
* semaphore it is no longer required.
|
||||
*
|
||||
* Mutex type semaphores cannot be used from within interrupt service routines.
|
||||
*
|
||||
* See xSemaphoreCreateBinary() for an alternative implementation that can be
|
||||
* used for pure synchronisation (where one task or interrupt always 'gives' the
|
||||
* semaphore and another always 'takes' the semaphore) and from within interrupt
|
||||
* service routines.
|
||||
*
|
||||
* @param pxMutexBuffer Must point to a variable of type StaticSemaphore_t,
|
||||
* which will then be used to hold the recursive mutex's data structure,
|
||||
* removing the need for the memory to be allocated dynamically.
|
||||
*
|
||||
* @return If the recursive mutex was successfully created then a handle to the
|
||||
* created recursive mutex is returned. If pxMutexBuffer was NULL then NULL is
|
||||
* returned.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
StaticSemaphore_t xMutexBuffer;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
// A recursive semaphore cannot be used before it is created. Here a
|
||||
// recursive mutex is created using xSemaphoreCreateRecursiveMutexStatic().
|
||||
// The address of xMutexBuffer is passed into the function, and will hold
|
||||
// the mutexes data structures - so no dynamic memory allocation will be
|
||||
// attempted.
|
||||
xSemaphore = xSemaphoreCreateRecursiveMutexStatic( &xMutexBuffer );
|
||||
|
||||
// As no dynamic memory allocation was performed, xSemaphore cannot be NULL,
|
||||
// so there is no need to check it.
|
||||
}
|
||||
</pre>
|
||||
* \defgroup xSemaphoreCreateRecursiveMutexStatic xSemaphoreCreateRecursiveMutexStatic
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) )
|
||||
#define xSemaphoreCreateRecursiveMutexStatic( pxStaticSemaphore ) xQueueCreateMutexStatic( queueQUEUE_TYPE_RECURSIVE_MUTEX, pxStaticSemaphore )
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount )</pre>
|
||||
*
|
||||
* <i>Macro</i> that creates a counting semaphore by using the existing
|
||||
* queue mechanism.
|
||||
* Creates a new counting semaphore instance, and returns a handle by which the
|
||||
* new counting semaphore can be referenced.
|
||||
*
|
||||
* In many usage scenarios it is faster and more memory efficient to use a
|
||||
* direct to task notification in place of a counting semaphore!
|
||||
* http://www.freertos.org/RTOS-task-notifications.html
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, counting semaphores use a
|
||||
* block of memory, in which the counting semaphore structure is stored. If a
|
||||
* counting semaphore is created using xSemaphoreCreateCounting() then the
|
||||
* required memory is automatically dynamically allocated inside the
|
||||
* xSemaphoreCreateCounting() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a counting semaphore is created
|
||||
* using xSemaphoreCreateCountingStatic() then the application writer can
|
||||
* instead optionally provide the memory that will get used by the counting
|
||||
* semaphore. xSemaphoreCreateCountingStatic() therefore allows a counting
|
||||
* semaphore to be created without using any dynamic memory allocation.
|
||||
*
|
||||
* Counting semaphores are typically used for two things:
|
||||
*
|
||||
@@ -804,7 +1036,94 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
* \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#define xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ) xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
#define xSemaphoreCreateCounting( uxMaxCount, uxInitialCount ) xQueueCreateCountingSemaphore( ( uxMaxCount ), ( uxInitialCount ) )
|
||||
#endif
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
* <pre>SemaphoreHandle_t xSemaphoreCreateCountingStatic( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount, StaticSemaphore_t *pxSemaphoreBuffer )</pre>
|
||||
*
|
||||
* Creates a new counting semaphore instance, and returns a handle by which the
|
||||
* new counting semaphore can be referenced.
|
||||
*
|
||||
* In many usage scenarios it is faster and more memory efficient to use a
|
||||
* direct to task notification in place of a counting semaphore!
|
||||
* http://www.freertos.org/RTOS-task-notifications.html
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, counting semaphores use a
|
||||
* block of memory, in which the counting semaphore structure is stored. If a
|
||||
* counting semaphore is created using xSemaphoreCreateCounting() then the
|
||||
* required memory is automatically dynamically allocated inside the
|
||||
* xSemaphoreCreateCounting() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a counting semaphore is created
|
||||
* using xSemaphoreCreateCountingStatic() then the application writer must
|
||||
* provide the memory. xSemaphoreCreateCountingStatic() therefore allows a
|
||||
* counting semaphore to be created without using any dynamic memory allocation.
|
||||
*
|
||||
* Counting semaphores are typically used for two things:
|
||||
*
|
||||
* 1) Counting events.
|
||||
*
|
||||
* In this usage scenario an event handler will 'give' a semaphore each time
|
||||
* an event occurs (incrementing the semaphore count value), and a handler
|
||||
* task will 'take' a semaphore each time it processes an event
|
||||
* (decrementing the semaphore count value). The count value is therefore
|
||||
* the difference between the number of events that have occurred and the
|
||||
* number that have been processed. In this case it is desirable for the
|
||||
* initial count value to be zero.
|
||||
*
|
||||
* 2) Resource management.
|
||||
*
|
||||
* In this usage scenario the count value indicates the number of resources
|
||||
* available. To obtain control of a resource a task must first obtain a
|
||||
* semaphore - decrementing the semaphore count value. When the count value
|
||||
* reaches zero there are no free resources. When a task finishes with the
|
||||
* resource it 'gives' the semaphore back - incrementing the semaphore count
|
||||
* value. In this case it is desirable for the initial count value to be
|
||||
* equal to the maximum count value, indicating that all resources are free.
|
||||
*
|
||||
* @param uxMaxCount The maximum count value that can be reached. When the
|
||||
* semaphore reaches this value it can no longer be 'given'.
|
||||
*
|
||||
* @param uxInitialCount The count value assigned to the semaphore when it is
|
||||
* created.
|
||||
*
|
||||
* @param pxSemaphoreBuffer Must point to a variable of type StaticSemaphore_t,
|
||||
* which will then be used to hold the semaphore's data structure, removing the
|
||||
* need for the memory to be allocated dynamically.
|
||||
*
|
||||
* @return If the counting semaphore was successfully created then a handle to
|
||||
* the created counting semaphore is returned. If pxSemaphoreBuffer was NULL
|
||||
* then NULL is returned.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
SemaphoreHandle_t xSemaphore;
|
||||
StaticSemaphore_t xSemaphoreBuffer;
|
||||
|
||||
void vATask( void * pvParameters )
|
||||
{
|
||||
SemaphoreHandle_t xSemaphore = NULL;
|
||||
|
||||
// Counting semaphore cannot be used before they have been created. Create
|
||||
// a counting semaphore using xSemaphoreCreateCountingStatic(). The max
|
||||
// value to which the semaphore can count is 10, and the initial value
|
||||
// assigned to the count will be 0. The address of xSemaphoreBuffer is
|
||||
// passed in and will be used to hold the semaphore structure, so no dynamic
|
||||
// memory allocation will be used.
|
||||
xSemaphore = xSemaphoreCreateCounting( 10, 0, &xSemaphoreBuffer );
|
||||
|
||||
// No memory allocation was attempted so xSemaphore cannot be NULL, so there
|
||||
// is no need to check its value.
|
||||
}
|
||||
</pre>
|
||||
* \defgroup xSemaphoreCreateCountingStatic xSemaphoreCreateCountingStatic
|
||||
* \ingroup Semaphores
|
||||
*/
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
#define xSemaphoreCreateCountingStatic( uxMaxCount, uxInitialCount, pxSemaphoreBuffer ) xQueueCreateCountingSemaphoreStatic( ( uxMaxCount ), ( uxInitialCount ), ( pxSemaphoreBuffer ) )
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
/**
|
||||
* semphr. h
|
||||
@@ -835,6 +1154,18 @@ typedef QueueHandle_t SemaphoreHandle_t;
|
||||
*/
|
||||
#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )
|
||||
|
||||
/**
|
||||
* semphr.h
|
||||
* <pre>UBaseType_t uxSemaphoreGetCount( SemaphoreHandle_t xSemaphore );</pre>
|
||||
*
|
||||
* If the semaphore is a counting semaphore then uxSemaphoreGetCount() returns
|
||||
* its current count value. If the semaphore is a binary semaphore then
|
||||
* uxSemaphoreGetCount() returns 1 if the semaphore is available, and 0 if the
|
||||
* semaphore is not available.
|
||||
*
|
||||
*/
|
||||
#define uxSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( ( QueueHandle_t ) ( xSemaphore ) )
|
||||
|
||||
#endif /* SEMAPHORE_H */
|
||||
|
||||
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -81,10 +85,10 @@ extern "C" {
|
||||
* MACROS AND DEFINITIONS
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define tskKERNEL_VERSION_NUMBER "V8.1.2"
|
||||
#define tskKERNEL_VERSION_MAJOR 8
|
||||
#define tskKERNEL_VERSION_MINOR 1
|
||||
#define tskKERNEL_VERSION_BUILD 2
|
||||
#define tskKERNEL_VERSION_NUMBER "V9.0.0"
|
||||
#define tskKERNEL_VERSION_MAJOR 9
|
||||
#define tskKERNEL_VERSION_MINOR 0
|
||||
#define tskKERNEL_VERSION_BUILD 0
|
||||
|
||||
/**
|
||||
* task. h
|
||||
@@ -111,16 +115,27 @@ typedef enum
|
||||
eReady, /* The task being queried is in a read or pending ready list. */
|
||||
eBlocked, /* The task being queried is in the Blocked state. */
|
||||
eSuspended, /* The task being queried is in the Suspended state, or is in the Blocked state with an infinite time out. */
|
||||
eDeleted /* The task being queried has been deleted, but its TCB has not yet been freed. */
|
||||
eDeleted, /* The task being queried has been deleted, but its TCB has not yet been freed. */
|
||||
eInvalid /* Used as an 'invalid state' value. */
|
||||
} eTaskState;
|
||||
|
||||
/* Actions that can be performed when vTaskNotify() is called. */
|
||||
typedef enum
|
||||
{
|
||||
eNoAction = 0, /* Notify the task without updating its notify value. */
|
||||
eSetBits, /* Set bits in the task's notification value. */
|
||||
eIncrement, /* Increment the task's notification value. */
|
||||
eSetValueWithOverwrite, /* Set the task's notification value to a specific value even if the previous value has not yet been read by the task. */
|
||||
eSetValueWithoutOverwrite /* Set the task's notification value if the previous value has been read by the task. */
|
||||
} eNotifyAction;
|
||||
|
||||
/*
|
||||
* Used internally only.
|
||||
*/
|
||||
typedef struct xTIME_OUT
|
||||
{
|
||||
BaseType_t xOverflowCount;
|
||||
TickType_t xTimeOnEntering;
|
||||
TickType_t xTimeOnEntering;
|
||||
} TimeOut_t;
|
||||
|
||||
/*
|
||||
@@ -158,6 +173,7 @@ typedef struct xTASK_STATUS
|
||||
UBaseType_t uxCurrentPriority; /* The priority at which the task was running (may be inherited) when the structure was populated. */
|
||||
UBaseType_t uxBasePriority; /* The priority to which the task will return if the task's current priority has been inherited to avoid unbounded priority inversion when obtaining a mutex. Only valid if configUSE_MUTEXES is defined as 1 in FreeRTOSConfig.h. */
|
||||
uint32_t ulRunTimeCounter; /* The total run time allocated to the task so far, as defined by the run time stats clock. See http://www.freertos.org/rtos-run-time-stats.html. Only valid when configGENERATE_RUN_TIME_STATS is defined as 1 in FreeRTOSConfig.h. */
|
||||
StackType_t *pxStackBase; /* Points to the lowest address of the task's stack area. */
|
||||
uint16_t usStackHighWaterMark; /* The minimum amount of stack space that has remained for the task since the task was created. The closer this value is to zero the closer the task has come to overflowing its stack. */
|
||||
} TaskStatus_t;
|
||||
|
||||
@@ -169,7 +185,6 @@ typedef enum
|
||||
eNoTasksWaitingTimeout /* No tasks are waiting for a timeout so it is safe to enter a sleep mode that can only be exited by an external interrupt. */
|
||||
} eSleepModeStatus;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the priority used by the idle task. This must not be modified.
|
||||
*
|
||||
@@ -200,6 +215,7 @@ typedef enum
|
||||
* \ingroup SchedulerControl
|
||||
*/
|
||||
#define taskENTER_CRITICAL() portENTER_CRITICAL()
|
||||
#define taskENTER_CRITICAL_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
|
||||
|
||||
/**
|
||||
* task. h
|
||||
@@ -214,7 +230,7 @@ typedef enum
|
||||
* \ingroup SchedulerControl
|
||||
*/
|
||||
#define taskEXIT_CRITICAL() portEXIT_CRITICAL()
|
||||
|
||||
#define taskEXIT_CRITICAL_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( x )
|
||||
/**
|
||||
* task. h
|
||||
*
|
||||
@@ -261,6 +277,19 @@ is used in assert() statements. */
|
||||
*
|
||||
* Create a new task and add it to the list of tasks that are ready to run.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, tasks use two blocks of
|
||||
* memory. The first block is used to hold the task's data structures. The
|
||||
* second block is used by the task as its stack. If a task is created using
|
||||
* xTaskCreate() then both blocks of memory are automatically dynamically
|
||||
* allocated inside the xTaskCreate() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a task is created using
|
||||
* xTaskCreateStatic() then the application writer must provide the required
|
||||
* memory. xTaskCreateStatic() therefore allows a task to be created without
|
||||
* using any dynamic memory allocation.
|
||||
*
|
||||
* See xTaskCreateStatic() for a version that does not use any dynamic memory
|
||||
* allocation.
|
||||
*
|
||||
* xTaskCreate() can only be used to create a task that has unrestricted
|
||||
* access to the entire microcontroller memory map. Systems that include MPU
|
||||
* support can alternatively create an MPU constrained task using
|
||||
@@ -327,7 +356,131 @@ is used in assert() statements. */
|
||||
* \defgroup xTaskCreate xTaskCreate
|
||||
* \ingroup Tasks
|
||||
*/
|
||||
#define xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask ) xTaskGenericCreate( ( pvTaskCode ), ( pcName ), ( usStackDepth ), ( pvParameters ), ( uxPriority ), ( pxCreatedTask ), ( NULL ), ( NULL ) )
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
|
||||
const char * const pcName,
|
||||
const uint16_t usStackDepth,
|
||||
void * const pvParameters,
|
||||
UBaseType_t uxPriority,
|
||||
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* task. h
|
||||
*<pre>
|
||||
TaskHandle_t xTaskCreateStatic( TaskFunction_t pvTaskCode,
|
||||
const char * const pcName,
|
||||
uint32_t ulStackDepth,
|
||||
void *pvParameters,
|
||||
UBaseType_t uxPriority,
|
||||
StackType_t *pxStackBuffer,
|
||||
StaticTask_t *pxTaskBuffer );</pre>
|
||||
*
|
||||
* Create a new task and add it to the list of tasks that are ready to run.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, tasks use two blocks of
|
||||
* memory. The first block is used to hold the task's data structures. The
|
||||
* second block is used by the task as its stack. If a task is created using
|
||||
* xTaskCreate() then both blocks of memory are automatically dynamically
|
||||
* allocated inside the xTaskCreate() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a task is created using
|
||||
* xTaskCreateStatic() then the application writer must provide the required
|
||||
* memory. xTaskCreateStatic() therefore allows a task to be created without
|
||||
* using any dynamic memory allocation.
|
||||
*
|
||||
* @param pvTaskCode Pointer to the task entry function. Tasks
|
||||
* must be implemented to never return (i.e. continuous loop).
|
||||
*
|
||||
* @param pcName A descriptive name for the task. This is mainly used to
|
||||
* facilitate debugging. The maximum length of the string is defined by
|
||||
* configMAX_TASK_NAME_LEN in FreeRTOSConfig.h.
|
||||
*
|
||||
* @param ulStackDepth The size of the task stack specified as the number of
|
||||
* variables the stack can hold - not the number of bytes. For example, if
|
||||
* the stack is 32-bits wide and ulStackDepth is defined as 100 then 400 bytes
|
||||
* will be allocated for stack storage.
|
||||
*
|
||||
* @param pvParameters Pointer that will be used as the parameter for the task
|
||||
* being created.
|
||||
*
|
||||
* @param uxPriority The priority at which the task will run.
|
||||
*
|
||||
* @param pxStackBuffer Must point to a StackType_t array that has at least
|
||||
* ulStackDepth indexes - the array will then be used as the task's stack,
|
||||
* removing the need for the stack to be allocated dynamically.
|
||||
*
|
||||
* @param pxTaskBuffer Must point to a variable of type StaticTask_t, which will
|
||||
* then be used to hold the task's data structures, removing the need for the
|
||||
* memory to be allocated dynamically.
|
||||
*
|
||||
* @return If neither pxStackBuffer or pxTaskBuffer are NULL, then the task will
|
||||
* be created and pdPASS is returned. If either pxStackBuffer or pxTaskBuffer
|
||||
* are NULL then the task will not be created and
|
||||
* errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY is returned.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
|
||||
// Dimensions the buffer that the task being created will use as its stack.
|
||||
// NOTE: This is the number of words the stack will hold, not the number of
|
||||
// bytes. For example, if each stack item is 32-bits, and this is set to 100,
|
||||
// then 400 bytes (100 * 32-bits) will be allocated.
|
||||
#define STACK_SIZE 200
|
||||
|
||||
// Structure that will hold the TCB of the task being created.
|
||||
StaticTask_t xTaskBuffer;
|
||||
|
||||
// Buffer that the task being created will use as its stack. Note this is
|
||||
// an array of StackType_t variables. The size of StackType_t is dependent on
|
||||
// the RTOS port.
|
||||
StackType_t xStack[ STACK_SIZE ];
|
||||
|
||||
// Function that implements the task being created.
|
||||
void vTaskCode( void * pvParameters )
|
||||
{
|
||||
// The parameter value is expected to be 1 as 1 is passed in the
|
||||
// pvParameters value in the call to xTaskCreateStatic().
|
||||
configASSERT( ( uint32_t ) pvParameters == 1UL );
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
// Task code goes here.
|
||||
}
|
||||
}
|
||||
|
||||
// Function that creates a task.
|
||||
void vOtherFunction( void )
|
||||
{
|
||||
TaskHandle_t xHandle = NULL;
|
||||
|
||||
// Create the task without using any dynamic memory allocation.
|
||||
xHandle = xTaskCreateStatic(
|
||||
vTaskCode, // Function that implements the task.
|
||||
"NAME", // Text name for the task.
|
||||
STACK_SIZE, // Stack size in words, not bytes.
|
||||
( void * ) 1, // Parameter passed into the task.
|
||||
tskIDLE_PRIORITY,// Priority at which the task is created.
|
||||
xStack, // Array to use as the task's stack.
|
||||
&xTaskBuffer ); // Variable to hold the task's data structure.
|
||||
|
||||
// puxStackBuffer and pxTaskBuffer were not NULL, so the task will have
|
||||
// been created, and xHandle will be the task's handle. Use the handle
|
||||
// to suspend the task.
|
||||
vTaskSuspend( xHandle );
|
||||
}
|
||||
</pre>
|
||||
* \defgroup xTaskCreateStatic xTaskCreateStatic
|
||||
* \ingroup Tasks
|
||||
*/
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
|
||||
const char * const pcName,
|
||||
const uint32_t ulStackDepth,
|
||||
void * const pvParameters,
|
||||
UBaseType_t uxPriority,
|
||||
StackType_t * const puxStackBuffer,
|
||||
StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
/**
|
||||
* task. h
|
||||
@@ -396,7 +549,9 @@ TaskHandle_t xHandle;
|
||||
* \defgroup xTaskCreateRestricted xTaskCreateRestricted
|
||||
* \ingroup Tasks
|
||||
*/
|
||||
#define xTaskCreateRestricted( x, pxCreatedTask ) xTaskGenericCreate( ((x)->pvTaskCode), ((x)->pcName), ((x)->usStackDepth), ((x)->pvParameters), ((x)->uxPriority), (pxCreatedTask), ((x)->puxStackBuffer), ((x)->xRegions) )
|
||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||
BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* task. h
|
||||
@@ -598,6 +753,31 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
|
||||
*/
|
||||
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>BaseType_t xTaskAbortDelay( TaskHandle_t xTask );</pre>
|
||||
*
|
||||
* INCLUDE_xTaskAbortDelay must be defined as 1 in FreeRTOSConfig.h for this
|
||||
* function to be available.
|
||||
*
|
||||
* A task will enter the Blocked state when it is waiting for an event. The
|
||||
* event it is waiting for can be a temporal event (waiting for a time), such
|
||||
* as when vTaskDelay() is called, or an event on an object, such as when
|
||||
* xQueueReceive() or ulTaskNotifyTake() is called. If the handle of a task
|
||||
* that is in the Blocked state is used in a call to xTaskAbortDelay() then the
|
||||
* task will leave the Blocked state, and return from whichever function call
|
||||
* placed the task into the Blocked state.
|
||||
*
|
||||
* @param xTask The handle of the task to remove from the Blocked state.
|
||||
*
|
||||
* @return If the task referenced by xTask was not in the Blocked state then
|
||||
* pdFAIL is returned. Otherwise pdPASS is returned.
|
||||
*
|
||||
* \defgroup xTaskAbortDelay xTaskAbortDelay
|
||||
* \ingroup TaskCtrl
|
||||
*/
|
||||
BaseType_t xTaskAbortDelay( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask );</pre>
|
||||
@@ -645,6 +825,14 @@ void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xT
|
||||
*/
|
||||
UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>UBaseType_t uxTaskPriorityGetFromISR( TaskHandle_t xTask );</pre>
|
||||
*
|
||||
* A version of uxTaskPriorityGet() that can be used from an ISR.
|
||||
*/
|
||||
UBaseType_t uxTaskPriorityGetFromISR( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>eTaskState eTaskGetState( TaskHandle_t xTask );</pre>
|
||||
@@ -663,6 +851,62 @@ UBaseType_t uxTaskPriorityGet( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
*/
|
||||
eTaskState eTaskGetState( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>void vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState );</pre>
|
||||
*
|
||||
* configUSE_TRACE_FACILITY must be defined as 1 for this function to be
|
||||
* available. See the configuration section for more information.
|
||||
*
|
||||
* Populates a TaskStatus_t structure with information about a task.
|
||||
*
|
||||
* @param xTask Handle of the task being queried. If xTask is NULL then
|
||||
* information will be returned about the calling task.
|
||||
*
|
||||
* @param pxTaskStatus A pointer to the TaskStatus_t structure that will be
|
||||
* filled with information about the task referenced by the handle passed using
|
||||
* the xTask parameter.
|
||||
*
|
||||
* @xGetFreeStackSpace The TaskStatus_t structure contains a member to report
|
||||
* the stack high water mark of the task being queried. Calculating the stack
|
||||
* high water mark takes a relatively long time, and can make the system
|
||||
* temporarily unresponsive - so the xGetFreeStackSpace parameter is provided to
|
||||
* allow the high water mark checking to be skipped. The high watermark value
|
||||
* will only be written to the TaskStatus_t structure if xGetFreeStackSpace is
|
||||
* not set to pdFALSE;
|
||||
*
|
||||
* @param eState The TaskStatus_t structure contains a member to report the
|
||||
* state of the task being queried. Obtaining the task state is not as fast as
|
||||
* a simple assignment - so the eState parameter is provided to allow the state
|
||||
* information to be omitted from the TaskStatus_t structure. To obtain state
|
||||
* information then set eState to eInvalid - otherwise the value passed in
|
||||
* eState will be reported as the task state in the TaskStatus_t structure.
|
||||
*
|
||||
* Example usage:
|
||||
<pre>
|
||||
void vAFunction( void )
|
||||
{
|
||||
TaskHandle_t xHandle;
|
||||
TaskStatus_t xTaskDetails;
|
||||
|
||||
// Obtain the handle of a task from its name.
|
||||
xHandle = xTaskGetHandle( "Task_Name" );
|
||||
|
||||
// Check the handle is not NULL.
|
||||
configASSERT( xHandle );
|
||||
|
||||
// Use the handle to obtain further information about the task.
|
||||
vTaskGetInfo( xHandle,
|
||||
&xTaskDetails,
|
||||
pdTRUE, // Include the high water mark in xTaskDetails.
|
||||
eInvalid ); // Include the task state in xTaskDetails.
|
||||
}
|
||||
</pre>
|
||||
* \defgroup vTaskGetInfo vTaskGetInfo
|
||||
* \ingroup TaskCtrl
|
||||
*/
|
||||
void vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <pre>void vTaskPrioritySet( TaskHandle_t xTask, UBaseType_t uxNewPriority );</pre>
|
||||
@@ -1075,17 +1319,32 @@ UBaseType_t uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery );</PRE>
|
||||
* <PRE>char *pcTaskGetName( TaskHandle_t xTaskToQuery );</PRE>
|
||||
*
|
||||
* @return The text (human readable) name of the task referenced by the handle
|
||||
* xTaskToQuery. A task can query its own name by either passing in its own
|
||||
* handle, or by setting xTaskToQuery to NULL. INCLUDE_pcTaskGetTaskName must be
|
||||
* set to 1 in FreeRTOSConfig.h for pcTaskGetTaskName() to be available.
|
||||
* handle, or by setting xTaskToQuery to NULL.
|
||||
*
|
||||
* \defgroup pcTaskGetTaskName pcTaskGetTaskName
|
||||
* \defgroup pcTaskGetName pcTaskGetName
|
||||
* \ingroup TaskUtils
|
||||
*/
|
||||
char *pcTaskGetTaskName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
char *pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>TaskHandle_t xTaskGetHandle( const char *pcNameToQuery );</PRE>
|
||||
*
|
||||
* NOTE: This function takes a relatively long time to complete and should be
|
||||
* used sparingly.
|
||||
*
|
||||
* @return The handle of the task that has the human readable name pcNameToQuery.
|
||||
* NULL is returned if no matching name is found. INCLUDE_xTaskGetHandle
|
||||
* must be set to 1 in FreeRTOSConfig.h for pcTaskGetHandle() to be available.
|
||||
*
|
||||
* \defgroup pcTaskGetHandle pcTaskGetHandle
|
||||
* \ingroup TaskUtils
|
||||
*/
|
||||
TaskHandle_t xTaskGetHandle( const char *pcNameToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
/**
|
||||
* task.h
|
||||
@@ -1136,6 +1395,18 @@ constant. */
|
||||
#endif /* configUSE_APPLICATION_TASK_TAG ==1 */
|
||||
#endif /* ifdef configUSE_APPLICATION_TASK_TAG */
|
||||
|
||||
#if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
|
||||
|
||||
/* Each task contains an array of pointers that is dimensioned by the
|
||||
configNUM_THREAD_LOCAL_STORAGE_POINTERS setting in FreeRTOSConfig.h. The
|
||||
kernel does not use the pointers itself, so the application writer can use
|
||||
the pointers for any purpose they wish. The following two functions are
|
||||
used to set and query a pointer respectively. */
|
||||
void vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue ) PRIVILEGED_FUNCTION;
|
||||
void *pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex ) PRIVILEGED_FUNCTION;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* task.h
|
||||
* <pre>BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter );</pre>
|
||||
@@ -1156,7 +1427,7 @@ BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter )
|
||||
* Simply returns the handle of the idle task. It is not valid to call
|
||||
* xTaskGetIdleTaskHandle() before the scheduler has been started.
|
||||
*/
|
||||
TaskHandle_t xTaskGetIdleTaskHandle( void );
|
||||
TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for
|
||||
@@ -1255,7 +1526,7 @@ TaskHandle_t xTaskGetIdleTaskHandle( void );
|
||||
}
|
||||
</pre>
|
||||
*/
|
||||
UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime );
|
||||
UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray, const UBaseType_t uxArraySize, uint32_t * const pulTotalRunTime ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
@@ -1358,6 +1629,441 @@ void vTaskList( char * pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unquali
|
||||
*/
|
||||
void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>BaseType_t xTaskNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction );</PRE>
|
||||
*
|
||||
* configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this
|
||||
* function to be available.
|
||||
*
|
||||
* When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private
|
||||
* "notification value", which is a 32-bit unsigned integer (uint32_t).
|
||||
*
|
||||
* Events can be sent to a task using an intermediary object. Examples of such
|
||||
* objects are queues, semaphores, mutexes and event groups. Task notifications
|
||||
* are a method of sending an event directly to a task without the need for such
|
||||
* an intermediary object.
|
||||
*
|
||||
* A notification sent to a task can optionally perform an action, such as
|
||||
* update, overwrite or increment the task's notification value. In that way
|
||||
* task notifications can be used to send data to a task, or be used as light
|
||||
* weight and fast binary or counting semaphores.
|
||||
*
|
||||
* A notification sent to a task will remain pending until it is cleared by the
|
||||
* task calling xTaskNotifyWait() or ulTaskNotifyTake(). If the task was
|
||||
* already in the Blocked state to wait for a notification when the notification
|
||||
* arrives then the task will automatically be removed from the Blocked state
|
||||
* (unblocked) and the notification cleared.
|
||||
*
|
||||
* A task can use xTaskNotifyWait() to [optionally] block to wait for a
|
||||
* notification to be pending, or ulTaskNotifyTake() to [optionally] block
|
||||
* to wait for its notification value to have a non-zero value. The task does
|
||||
* not consume any CPU time while it is in the Blocked state.
|
||||
*
|
||||
* See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.
|
||||
*
|
||||
* @param xTaskToNotify The handle of the task being notified. The handle to a
|
||||
* task can be returned from the xTaskCreate() API function used to create the
|
||||
* task, and the handle of the currently running task can be obtained by calling
|
||||
* xTaskGetCurrentTaskHandle().
|
||||
*
|
||||
* @param ulValue Data that can be sent with the notification. How the data is
|
||||
* used depends on the value of the eAction parameter.
|
||||
*
|
||||
* @param eAction Specifies how the notification updates the task's notification
|
||||
* value, if at all. Valid values for eAction are as follows:
|
||||
*
|
||||
* eSetBits -
|
||||
* The task's notification value is bitwise ORed with ulValue. xTaskNofify()
|
||||
* always returns pdPASS in this case.
|
||||
*
|
||||
* eIncrement -
|
||||
* The task's notification value is incremented. ulValue is not used and
|
||||
* xTaskNotify() always returns pdPASS in this case.
|
||||
*
|
||||
* eSetValueWithOverwrite -
|
||||
* The task's notification value is set to the value of ulValue, even if the
|
||||
* task being notified had not yet processed the previous notification (the
|
||||
* task already had a notification pending). xTaskNotify() always returns
|
||||
* pdPASS in this case.
|
||||
*
|
||||
* eSetValueWithoutOverwrite -
|
||||
* If the task being notified did not already have a notification pending then
|
||||
* the task's notification value is set to ulValue and xTaskNotify() will
|
||||
* return pdPASS. If the task being notified already had a notification
|
||||
* pending then no action is performed and pdFAIL is returned.
|
||||
*
|
||||
* eNoAction -
|
||||
* The task receives a notification without its notification value being
|
||||
* updated. ulValue is not used and xTaskNotify() always returns pdPASS in
|
||||
* this case.
|
||||
*
|
||||
* pulPreviousNotificationValue -
|
||||
* Can be used to pass out the subject task's notification value before any
|
||||
* bits are modified by the notify function.
|
||||
*
|
||||
* @return Dependent on the value of eAction. See the description of the
|
||||
* eAction parameter.
|
||||
*
|
||||
* \defgroup xTaskNotify xTaskNotify
|
||||
* \ingroup TaskNotifications
|
||||
*/
|
||||
BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue ) PRIVILEGED_FUNCTION;
|
||||
#define xTaskNotify( xTaskToNotify, ulValue, eAction ) xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL )
|
||||
#define xTaskNotifyAndQuery( xTaskToNotify, ulValue, eAction, pulPreviousNotifyValue ) xTaskGenericNotify( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotifyValue ) )
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken );</PRE>
|
||||
*
|
||||
* configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this
|
||||
* function to be available.
|
||||
*
|
||||
* When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private
|
||||
* "notification value", which is a 32-bit unsigned integer (uint32_t).
|
||||
*
|
||||
* A version of xTaskNotify() that can be used from an interrupt service routine
|
||||
* (ISR).
|
||||
*
|
||||
* Events can be sent to a task using an intermediary object. Examples of such
|
||||
* objects are queues, semaphores, mutexes and event groups. Task notifications
|
||||
* are a method of sending an event directly to a task without the need for such
|
||||
* an intermediary object.
|
||||
*
|
||||
* A notification sent to a task can optionally perform an action, such as
|
||||
* update, overwrite or increment the task's notification value. In that way
|
||||
* task notifications can be used to send data to a task, or be used as light
|
||||
* weight and fast binary or counting semaphores.
|
||||
*
|
||||
* A notification sent to a task will remain pending until it is cleared by the
|
||||
* task calling xTaskNotifyWait() or ulTaskNotifyTake(). If the task was
|
||||
* already in the Blocked state to wait for a notification when the notification
|
||||
* arrives then the task will automatically be removed from the Blocked state
|
||||
* (unblocked) and the notification cleared.
|
||||
*
|
||||
* A task can use xTaskNotifyWait() to [optionally] block to wait for a
|
||||
* notification to be pending, or ulTaskNotifyTake() to [optionally] block
|
||||
* to wait for its notification value to have a non-zero value. The task does
|
||||
* not consume any CPU time while it is in the Blocked state.
|
||||
*
|
||||
* See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.
|
||||
*
|
||||
* @param xTaskToNotify The handle of the task being notified. The handle to a
|
||||
* task can be returned from the xTaskCreate() API function used to create the
|
||||
* task, and the handle of the currently running task can be obtained by calling
|
||||
* xTaskGetCurrentTaskHandle().
|
||||
*
|
||||
* @param ulValue Data that can be sent with the notification. How the data is
|
||||
* used depends on the value of the eAction parameter.
|
||||
*
|
||||
* @param eAction Specifies how the notification updates the task's notification
|
||||
* value, if at all. Valid values for eAction are as follows:
|
||||
*
|
||||
* eSetBits -
|
||||
* The task's notification value is bitwise ORed with ulValue. xTaskNofify()
|
||||
* always returns pdPASS in this case.
|
||||
*
|
||||
* eIncrement -
|
||||
* The task's notification value is incremented. ulValue is not used and
|
||||
* xTaskNotify() always returns pdPASS in this case.
|
||||
*
|
||||
* eSetValueWithOverwrite -
|
||||
* The task's notification value is set to the value of ulValue, even if the
|
||||
* task being notified had not yet processed the previous notification (the
|
||||
* task already had a notification pending). xTaskNotify() always returns
|
||||
* pdPASS in this case.
|
||||
*
|
||||
* eSetValueWithoutOverwrite -
|
||||
* If the task being notified did not already have a notification pending then
|
||||
* the task's notification value is set to ulValue and xTaskNotify() will
|
||||
* return pdPASS. If the task being notified already had a notification
|
||||
* pending then no action is performed and pdFAIL is returned.
|
||||
*
|
||||
* eNoAction -
|
||||
* The task receives a notification without its notification value being
|
||||
* updated. ulValue is not used and xTaskNotify() always returns pdPASS in
|
||||
* this case.
|
||||
*
|
||||
* @param pxHigherPriorityTaskWoken xTaskNotifyFromISR() will set
|
||||
* *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the
|
||||
* task to which the notification was sent to leave the Blocked state, and the
|
||||
* unblocked task has a priority higher than the currently running task. If
|
||||
* xTaskNotifyFromISR() sets this value to pdTRUE then a context switch should
|
||||
* be requested before the interrupt is exited. How a context switch is
|
||||
* requested from an ISR is dependent on the port - see the documentation page
|
||||
* for the port in use.
|
||||
*
|
||||
* @return Dependent on the value of eAction. See the description of the
|
||||
* eAction parameter.
|
||||
*
|
||||
* \defgroup xTaskNotify xTaskNotify
|
||||
* \ingroup TaskNotifications
|
||||
*/
|
||||
BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||
#define xTaskNotifyFromISR( xTaskToNotify, ulValue, eAction, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) )
|
||||
#define xTaskNotifyAndQueryFromISR( xTaskToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) )
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait );</pre>
|
||||
*
|
||||
* configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this
|
||||
* function to be available.
|
||||
*
|
||||
* When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private
|
||||
* "notification value", which is a 32-bit unsigned integer (uint32_t).
|
||||
*
|
||||
* Events can be sent to a task using an intermediary object. Examples of such
|
||||
* objects are queues, semaphores, mutexes and event groups. Task notifications
|
||||
* are a method of sending an event directly to a task without the need for such
|
||||
* an intermediary object.
|
||||
*
|
||||
* A notification sent to a task can optionally perform an action, such as
|
||||
* update, overwrite or increment the task's notification value. In that way
|
||||
* task notifications can be used to send data to a task, or be used as light
|
||||
* weight and fast binary or counting semaphores.
|
||||
*
|
||||
* A notification sent to a task will remain pending until it is cleared by the
|
||||
* task calling xTaskNotifyWait() or ulTaskNotifyTake(). If the task was
|
||||
* already in the Blocked state to wait for a notification when the notification
|
||||
* arrives then the task will automatically be removed from the Blocked state
|
||||
* (unblocked) and the notification cleared.
|
||||
*
|
||||
* A task can use xTaskNotifyWait() to [optionally] block to wait for a
|
||||
* notification to be pending, or ulTaskNotifyTake() to [optionally] block
|
||||
* to wait for its notification value to have a non-zero value. The task does
|
||||
* not consume any CPU time while it is in the Blocked state.
|
||||
*
|
||||
* See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.
|
||||
*
|
||||
* @param ulBitsToClearOnEntry Bits that are set in ulBitsToClearOnEntry value
|
||||
* will be cleared in the calling task's notification value before the task
|
||||
* checks to see if any notifications are pending, and optionally blocks if no
|
||||
* notifications are pending. Setting ulBitsToClearOnEntry to ULONG_MAX (if
|
||||
* limits.h is included) or 0xffffffffUL (if limits.h is not included) will have
|
||||
* the effect of resetting the task's notification value to 0. Setting
|
||||
* ulBitsToClearOnEntry to 0 will leave the task's notification value unchanged.
|
||||
*
|
||||
* @param ulBitsToClearOnExit If a notification is pending or received before
|
||||
* the calling task exits the xTaskNotifyWait() function then the task's
|
||||
* notification value (see the xTaskNotify() API function) is passed out using
|
||||
* the pulNotificationValue parameter. Then any bits that are set in
|
||||
* ulBitsToClearOnExit will be cleared in the task's notification value (note
|
||||
* *pulNotificationValue is set before any bits are cleared). Setting
|
||||
* ulBitsToClearOnExit to ULONG_MAX (if limits.h is included) or 0xffffffffUL
|
||||
* (if limits.h is not included) will have the effect of resetting the task's
|
||||
* notification value to 0 before the function exits. Setting
|
||||
* ulBitsToClearOnExit to 0 will leave the task's notification value unchanged
|
||||
* when the function exits (in which case the value passed out in
|
||||
* pulNotificationValue will match the task's notification value).
|
||||
*
|
||||
* @param pulNotificationValue Used to pass the task's notification value out
|
||||
* of the function. Note the value passed out will not be effected by the
|
||||
* clearing of any bits caused by ulBitsToClearOnExit being non-zero.
|
||||
*
|
||||
* @param xTicksToWait The maximum amount of time that the task should wait in
|
||||
* the Blocked state for a notification to be received, should a notification
|
||||
* not already be pending when xTaskNotifyWait() was called. The task
|
||||
* will not consume any processing time while it is in the Blocked state. This
|
||||
* is specified in kernel ticks, the macro pdMS_TO_TICSK( value_in_ms ) can be
|
||||
* used to convert a time specified in milliseconds to a time specified in
|
||||
* ticks.
|
||||
*
|
||||
* @return If a notification was received (including notifications that were
|
||||
* already pending when xTaskNotifyWait was called) then pdPASS is
|
||||
* returned. Otherwise pdFAIL is returned.
|
||||
*
|
||||
* \defgroup xTaskNotifyWait xTaskNotifyWait
|
||||
* \ingroup TaskNotifications
|
||||
*/
|
||||
BaseType_t xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>BaseType_t xTaskNotifyGive( TaskHandle_t xTaskToNotify );</PRE>
|
||||
*
|
||||
* configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this macro
|
||||
* to be available.
|
||||
*
|
||||
* When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private
|
||||
* "notification value", which is a 32-bit unsigned integer (uint32_t).
|
||||
*
|
||||
* Events can be sent to a task using an intermediary object. Examples of such
|
||||
* objects are queues, semaphores, mutexes and event groups. Task notifications
|
||||
* are a method of sending an event directly to a task without the need for such
|
||||
* an intermediary object.
|
||||
*
|
||||
* A notification sent to a task can optionally perform an action, such as
|
||||
* update, overwrite or increment the task's notification value. In that way
|
||||
* task notifications can be used to send data to a task, or be used as light
|
||||
* weight and fast binary or counting semaphores.
|
||||
*
|
||||
* xTaskNotifyGive() is a helper macro intended for use when task notifications
|
||||
* are used as light weight and faster binary or counting semaphore equivalents.
|
||||
* Actual FreeRTOS semaphores are given using the xSemaphoreGive() API function,
|
||||
* the equivalent action that instead uses a task notification is
|
||||
* xTaskNotifyGive().
|
||||
*
|
||||
* When task notifications are being used as a binary or counting semaphore
|
||||
* equivalent then the task being notified should wait for the notification
|
||||
* using the ulTaskNotificationTake() API function rather than the
|
||||
* xTaskNotifyWait() API function.
|
||||
*
|
||||
* See http://www.FreeRTOS.org/RTOS-task-notifications.html for more details.
|
||||
*
|
||||
* @param xTaskToNotify The handle of the task being notified. The handle to a
|
||||
* task can be returned from the xTaskCreate() API function used to create the
|
||||
* task, and the handle of the currently running task can be obtained by calling
|
||||
* xTaskGetCurrentTaskHandle().
|
||||
*
|
||||
* @return xTaskNotifyGive() is a macro that calls xTaskNotify() with the
|
||||
* eAction parameter set to eIncrement - so pdPASS is always returned.
|
||||
*
|
||||
* \defgroup xTaskNotifyGive xTaskNotifyGive
|
||||
* \ingroup TaskNotifications
|
||||
*/
|
||||
#define xTaskNotifyGive( xTaskToNotify ) xTaskGenericNotify( ( xTaskToNotify ), ( 0 ), eIncrement, NULL )
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>void vTaskNotifyGiveFromISR( TaskHandle_t xTaskHandle, BaseType_t *pxHigherPriorityTaskWoken );
|
||||
*
|
||||
* configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this macro
|
||||
* to be available.
|
||||
*
|
||||
* When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private
|
||||
* "notification value", which is a 32-bit unsigned integer (uint32_t).
|
||||
*
|
||||
* A version of xTaskNotifyGive() that can be called from an interrupt service
|
||||
* routine (ISR).
|
||||
*
|
||||
* Events can be sent to a task using an intermediary object. Examples of such
|
||||
* objects are queues, semaphores, mutexes and event groups. Task notifications
|
||||
* are a method of sending an event directly to a task without the need for such
|
||||
* an intermediary object.
|
||||
*
|
||||
* A notification sent to a task can optionally perform an action, such as
|
||||
* update, overwrite or increment the task's notification value. In that way
|
||||
* task notifications can be used to send data to a task, or be used as light
|
||||
* weight and fast binary or counting semaphores.
|
||||
*
|
||||
* vTaskNotifyGiveFromISR() is intended for use when task notifications are
|
||||
* used as light weight and faster binary or counting semaphore equivalents.
|
||||
* Actual FreeRTOS semaphores are given from an ISR using the
|
||||
* xSemaphoreGiveFromISR() API function, the equivalent action that instead uses
|
||||
* a task notification is vTaskNotifyGiveFromISR().
|
||||
*
|
||||
* When task notifications are being used as a binary or counting semaphore
|
||||
* equivalent then the task being notified should wait for the notification
|
||||
* using the ulTaskNotificationTake() API function rather than the
|
||||
* xTaskNotifyWait() API function.
|
||||
*
|
||||
* See http://www.FreeRTOS.org/RTOS-task-notifications.html for more details.
|
||||
*
|
||||
* @param xTaskToNotify The handle of the task being notified. The handle to a
|
||||
* task can be returned from the xTaskCreate() API function used to create the
|
||||
* task, and the handle of the currently running task can be obtained by calling
|
||||
* xTaskGetCurrentTaskHandle().
|
||||
*
|
||||
* @param pxHigherPriorityTaskWoken vTaskNotifyGiveFromISR() will set
|
||||
* *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the
|
||||
* task to which the notification was sent to leave the Blocked state, and the
|
||||
* unblocked task has a priority higher than the currently running task. If
|
||||
* vTaskNotifyGiveFromISR() sets this value to pdTRUE then a context switch
|
||||
* should be requested before the interrupt is exited. How a context switch is
|
||||
* requested from an ISR is dependent on the port - see the documentation page
|
||||
* for the port in use.
|
||||
*
|
||||
* \defgroup xTaskNotifyWait xTaskNotifyWait
|
||||
* \ingroup TaskNotifications
|
||||
*/
|
||||
void vTaskNotifyGiveFromISR( TaskHandle_t xTaskToNotify, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait );</pre>
|
||||
*
|
||||
* configUSE_TASK_NOTIFICATIONS must be undefined or defined as 1 for this
|
||||
* function to be available.
|
||||
*
|
||||
* When configUSE_TASK_NOTIFICATIONS is set to one each task has its own private
|
||||
* "notification value", which is a 32-bit unsigned integer (uint32_t).
|
||||
*
|
||||
* Events can be sent to a task using an intermediary object. Examples of such
|
||||
* objects are queues, semaphores, mutexes and event groups. Task notifications
|
||||
* are a method of sending an event directly to a task without the need for such
|
||||
* an intermediary object.
|
||||
*
|
||||
* A notification sent to a task can optionally perform an action, such as
|
||||
* update, overwrite or increment the task's notification value. In that way
|
||||
* task notifications can be used to send data to a task, or be used as light
|
||||
* weight and fast binary or counting semaphores.
|
||||
*
|
||||
* ulTaskNotifyTake() is intended for use when a task notification is used as a
|
||||
* faster and lighter weight binary or counting semaphore alternative. Actual
|
||||
* FreeRTOS semaphores are taken using the xSemaphoreTake() API function, the
|
||||
* equivalent action that instead uses a task notification is
|
||||
* ulTaskNotifyTake().
|
||||
*
|
||||
* When a task is using its notification value as a binary or counting semaphore
|
||||
* other tasks should send notifications to it using the xTaskNotifyGive()
|
||||
* macro, or xTaskNotify() function with the eAction parameter set to
|
||||
* eIncrement.
|
||||
*
|
||||
* ulTaskNotifyTake() can either clear the task's notification value to
|
||||
* zero on exit, in which case the notification value acts like a binary
|
||||
* semaphore, or decrement the task's notification value on exit, in which case
|
||||
* the notification value acts like a counting semaphore.
|
||||
*
|
||||
* A task can use ulTaskNotifyTake() to [optionally] block to wait for a
|
||||
* the task's notification value to be non-zero. The task does not consume any
|
||||
* CPU time while it is in the Blocked state.
|
||||
*
|
||||
* Where as xTaskNotifyWait() will return when a notification is pending,
|
||||
* ulTaskNotifyTake() will return when the task's notification value is
|
||||
* not zero.
|
||||
*
|
||||
* See http://www.FreeRTOS.org/RTOS-task-notifications.html for details.
|
||||
*
|
||||
* @param xClearCountOnExit if xClearCountOnExit is pdFALSE then the task's
|
||||
* notification value is decremented when the function exits. In this way the
|
||||
* notification value acts like a counting semaphore. If xClearCountOnExit is
|
||||
* not pdFALSE then the task's notification value is cleared to zero when the
|
||||
* function exits. In this way the notification value acts like a binary
|
||||
* semaphore.
|
||||
*
|
||||
* @param xTicksToWait The maximum amount of time that the task should wait in
|
||||
* the Blocked state for the task's notification value to be greater than zero,
|
||||
* should the count not already be greater than zero when
|
||||
* ulTaskNotifyTake() was called. The task will not consume any processing
|
||||
* time while it is in the Blocked state. This is specified in kernel ticks,
|
||||
* the macro pdMS_TO_TICSK( value_in_ms ) can be used to convert a time
|
||||
* specified in milliseconds to a time specified in ticks.
|
||||
*
|
||||
* @return The task's notification count before it is either cleared to zero or
|
||||
* decremented (see the xClearCountOnExit parameter).
|
||||
*
|
||||
* \defgroup ulTaskNotifyTake ulTaskNotifyTake
|
||||
* \ingroup TaskNotifications
|
||||
*/
|
||||
uint32_t ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* task. h
|
||||
* <PRE>BaseType_t xTaskNotifyStateClear( TaskHandle_t xTask );</pre>
|
||||
*
|
||||
* If the notification state of the task referenced by the handle xTask is
|
||||
* eNotified, then set the task's notification state to eNotWaitingNotification.
|
||||
* The task's notification value is not altered. Set xTask to NULL to clear the
|
||||
* notification state of the calling task.
|
||||
*
|
||||
* @return pdTRUE if the task's notification state was set to
|
||||
* eNotWaitingNotification, otherwise pdFALSE.
|
||||
* \defgroup xTaskNotifyStateClear xTaskNotifyStateClear
|
||||
* \ingroup TaskNotifications
|
||||
*/
|
||||
BaseType_t xTaskNotifyStateClear( TaskHandle_t xTask );
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* SCHEDULER INTERNALS AVAILABLE FOR PORTING PURPOSES
|
||||
*----------------------------------------------------------*/
|
||||
@@ -1424,7 +2130,7 @@ void vTaskPlaceOnUnorderedEventList( List_t * pxEventList, const TickType_t xIte
|
||||
* indefinitely, whereas vTaskPlaceOnEventList() does.
|
||||
*
|
||||
*/
|
||||
void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
void vTaskPlaceOnEventListRestricted( List_t * const pxEventList, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE. IT IS AN
|
||||
@@ -1509,12 +2215,6 @@ void vTaskPriorityInherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTIO
|
||||
*/
|
||||
BaseType_t xTaskPriorityDisinherit( TaskHandle_t const pxMutexHolder ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Generic version of the task creation function which is in turn called by the
|
||||
* xTaskCreate() and xTaskCreateRestricted() macros.
|
||||
*/
|
||||
BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcName, const uint16_t usStackDepth, void * const pvParameters, UBaseType_t uxPriority, TaskHandle_t * const pxCreatedTask, StackType_t * const puxStackBuffer, const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
/*
|
||||
* Get the uxTCBNumber assigned to the task referenced by the xTask parameter.
|
||||
*/
|
||||
@@ -1556,7 +2256,7 @@ eSleepModeStatus eTaskConfirmSleepModeStatus( void ) PRIVILEGED_FUNCTION;
|
||||
* For internal use only. Increment the mutex held count when a mutex is
|
||||
* taken and return the handle of the task that has taken the mutex.
|
||||
*/
|
||||
void *pvTaskIncrementMutexHeldCount( void );
|
||||
void *pvTaskIncrementMutexHeldCount( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -74,7 +78,7 @@
|
||||
/*lint -e537 This headers are only multiply included if the application code
|
||||
happens to also be including task.h. */
|
||||
#include "task.h"
|
||||
/*lint +e956 */
|
||||
/*lint +e537 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -131,9 +135,17 @@ typedef void (*PendedFunction_t)( void *, uint32_t );
|
||||
* void * pvTimerID,
|
||||
* TimerCallbackFunction_t pxCallbackFunction );
|
||||
*
|
||||
* Creates a new software timer instance. This allocates the storage required
|
||||
* by the new timer, initialises the new timers internal state, and returns a
|
||||
* handle by which the new timer can be referenced.
|
||||
* Creates a new software timer instance, and returns a handle by which the
|
||||
* created software timer can be referenced.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, software timers use a block
|
||||
* of memory, in which the timer data structure is stored. If a software timer
|
||||
* is created using xTimerCreate() then the required memory is automatically
|
||||
* dynamically allocated inside the xTimerCreate() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a software timer is created using
|
||||
* xTimerCreateStatic() then the application writer must provide the memory that
|
||||
* will get used by the software timer. xTimerCreateStatic() therefore allows a
|
||||
* software timer to be created without using any dynamic memory allocation.
|
||||
*
|
||||
* Timers are created in the dormant state. The xTimerStart(), xTimerReset(),
|
||||
* xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and
|
||||
@@ -246,14 +258,151 @@ typedef void (*PendedFunction_t)( void *, uint32_t );
|
||||
*
|
||||
* // Starting the scheduler will start the timers running as they have already
|
||||
* // been set into the active state.
|
||||
* xTaskStartScheduler();
|
||||
* vTaskStartScheduler();
|
||||
*
|
||||
* // Should not reach here.
|
||||
* for( ;; );
|
||||
* }
|
||||
* @endverbatim
|
||||
*/
|
||||
TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
TimerHandle_t xTimerCreate( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const UBaseType_t uxAutoReload,
|
||||
void * const pvTimerID,
|
||||
TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TimerHandle_t xTimerCreateStatic(const char * const pcTimerName,
|
||||
* TickType_t xTimerPeriodInTicks,
|
||||
* UBaseType_t uxAutoReload,
|
||||
* void * pvTimerID,
|
||||
* TimerCallbackFunction_t pxCallbackFunction,
|
||||
* StaticTimer_t *pxTimerBuffer );
|
||||
*
|
||||
* Creates a new software timer instance, and returns a handle by which the
|
||||
* created software timer can be referenced.
|
||||
*
|
||||
* Internally, within the FreeRTOS implementation, software timers use a block
|
||||
* of memory, in which the timer data structure is stored. If a software timer
|
||||
* is created using xTimerCreate() then the required memory is automatically
|
||||
* dynamically allocated inside the xTimerCreate() function. (see
|
||||
* http://www.freertos.org/a00111.html). If a software timer is created using
|
||||
* xTimerCreateStatic() then the application writer must provide the memory that
|
||||
* will get used by the software timer. xTimerCreateStatic() therefore allows a
|
||||
* software timer to be created without using any dynamic memory allocation.
|
||||
*
|
||||
* Timers are created in the dormant state. The xTimerStart(), xTimerReset(),
|
||||
* xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and
|
||||
* xTimerChangePeriodFromISR() API functions can all be used to transition a
|
||||
* timer into the active state.
|
||||
*
|
||||
* @param pcTimerName A text name that is assigned to the timer. This is done
|
||||
* purely to assist debugging. The kernel itself only ever references a timer
|
||||
* by its handle, and never by its name.
|
||||
*
|
||||
* @param xTimerPeriodInTicks The timer period. The time is defined in tick
|
||||
* periods so the constant portTICK_PERIOD_MS can be used to convert a time that
|
||||
* has been specified in milliseconds. For example, if the timer must expire
|
||||
* after 100 ticks, then xTimerPeriodInTicks should be set to 100.
|
||||
* Alternatively, if the timer must expire after 500ms, then xPeriod can be set
|
||||
* to ( 500 / portTICK_PERIOD_MS ) provided configTICK_RATE_HZ is less than or
|
||||
* equal to 1000.
|
||||
*
|
||||
* @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will
|
||||
* expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter.
|
||||
* If uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and
|
||||
* enter the dormant state after it expires.
|
||||
*
|
||||
* @param pvTimerID An identifier that is assigned to the timer being created.
|
||||
* Typically this would be used in the timer callback function to identify which
|
||||
* timer expired when the same callback function is assigned to more than one
|
||||
* timer.
|
||||
*
|
||||
* @param pxCallbackFunction The function to call when the timer expires.
|
||||
* Callback functions must have the prototype defined by TimerCallbackFunction_t,
|
||||
* which is "void vCallbackFunction( TimerHandle_t xTimer );".
|
||||
*
|
||||
* @param pxTimerBuffer Must point to a variable of type StaticTimer_t, which
|
||||
* will be then be used to hold the software timer's data structures, removing
|
||||
* the need for the memory to be allocated dynamically.
|
||||
*
|
||||
* @return If the timer is created then a handle to the created timer is
|
||||
* returned. If pxTimerBuffer was NULL then NULL is returned.
|
||||
*
|
||||
* Example usage:
|
||||
* @verbatim
|
||||
*
|
||||
* // The buffer used to hold the software timer's data structure.
|
||||
* static StaticTimer_t xTimerBuffer;
|
||||
*
|
||||
* // A variable that will be incremented by the software timer's callback
|
||||
* // function.
|
||||
* UBaseType_t uxVariableToIncrement = 0;
|
||||
*
|
||||
* // A software timer callback function that increments a variable passed to
|
||||
* // it when the software timer was created. After the 5th increment the
|
||||
* // callback function stops the software timer.
|
||||
* static void prvTimerCallback( TimerHandle_t xExpiredTimer )
|
||||
* {
|
||||
* UBaseType_t *puxVariableToIncrement;
|
||||
* BaseType_t xReturned;
|
||||
*
|
||||
* // Obtain the address of the variable to increment from the timer ID.
|
||||
* puxVariableToIncrement = ( UBaseType_t * ) pvTimerGetTimerID( xExpiredTimer );
|
||||
*
|
||||
* // Increment the variable to show the timer callback has executed.
|
||||
* ( *puxVariableToIncrement )++;
|
||||
*
|
||||
* // If this callback has executed the required number of times, stop the
|
||||
* // timer.
|
||||
* if( *puxVariableToIncrement == 5 )
|
||||
* {
|
||||
* // This is called from a timer callback so must not block.
|
||||
* xTimerStop( xExpiredTimer, staticDONT_BLOCK );
|
||||
* }
|
||||
* }
|
||||
*
|
||||
*
|
||||
* void main( void )
|
||||
* {
|
||||
* // Create the software time. xTimerCreateStatic() has an extra parameter
|
||||
* // than the normal xTimerCreate() API function. The parameter is a pointer
|
||||
* // to the StaticTimer_t structure that will hold the software timer
|
||||
* // structure. If the parameter is passed as NULL then the structure will be
|
||||
* // allocated dynamically, just as if xTimerCreate() had been called.
|
||||
* xTimer = xTimerCreateStatic( "T1", // Text name for the task. Helps debugging only. Not used by FreeRTOS.
|
||||
* xTimerPeriod, // The period of the timer in ticks.
|
||||
* pdTRUE, // This is an auto-reload timer.
|
||||
* ( void * ) &uxVariableToIncrement, // A variable incremented by the software timer's callback function
|
||||
* prvTimerCallback, // The function to execute when the timer expires.
|
||||
* &xTimerBuffer ); // The buffer that will hold the software timer structure.
|
||||
*
|
||||
* // The scheduler has not started yet so a block time is not used.
|
||||
* xReturned = xTimerStart( xTimer, 0 );
|
||||
*
|
||||
* // ...
|
||||
* // Create tasks here.
|
||||
* // ...
|
||||
*
|
||||
* // Starting the scheduler will start the timers running as they have already
|
||||
* // been set into the active state.
|
||||
* vTaskStartScheduler();
|
||||
*
|
||||
* // Should not reach here.
|
||||
* for( ;; );
|
||||
* }
|
||||
* @endverbatim
|
||||
*/
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
TimerHandle_t xTimerCreateStatic( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const UBaseType_t uxAutoReload,
|
||||
void * const pvTimerID,
|
||||
TimerCallbackFunction_t pxCallbackFunction,
|
||||
StaticTimer_t *pxTimerBuffer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
|
||||
/**
|
||||
* void *pvTimerGetTimerID( TimerHandle_t xTimer );
|
||||
@@ -261,11 +410,11 @@ TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTi
|
||||
* Returns the ID assigned to the timer.
|
||||
*
|
||||
* IDs are assigned to timers using the pvTimerID parameter of the call to
|
||||
* xTimerCreated() that was used to create the timer.
|
||||
* xTimerCreated() that was used to create the timer, and by calling the
|
||||
* vTimerSetTimerID() API function.
|
||||
*
|
||||
* If the same callback function is assigned to multiple timers then the timer
|
||||
* ID can be used within the callback function to identify which timer actually
|
||||
* expired.
|
||||
* ID can be used as time specific (timer local) storage.
|
||||
*
|
||||
* @param xTimer The timer being queried.
|
||||
*
|
||||
@@ -275,7 +424,28 @@ TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTi
|
||||
*
|
||||
* See the xTimerCreate() API function example usage scenario.
|
||||
*/
|
||||
void *pvTimerGetTimerID( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||
void *pvTimerGetTimerID( const TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID );
|
||||
*
|
||||
* Sets the ID assigned to the timer.
|
||||
*
|
||||
* IDs are assigned to timers using the pvTimerID parameter of the call to
|
||||
* xTimerCreated() that was used to create the timer.
|
||||
*
|
||||
* If the same callback function is assigned to multiple timers then the timer
|
||||
* ID can be used as time specific (timer local) storage.
|
||||
*
|
||||
* @param xTimer The timer being updated.
|
||||
*
|
||||
* @param pvNewID The ID to assign to the timer.
|
||||
*
|
||||
* Example usage:
|
||||
*
|
||||
* See the xTimerCreate() API function example usage scenario.
|
||||
*/
|
||||
void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer );
|
||||
@@ -317,13 +487,10 @@ BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||
/**
|
||||
* TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
|
||||
*
|
||||
* xTimerGetTimerDaemonTaskHandle() is only available if
|
||||
* INCLUDE_xTimerGetTimerDaemonTaskHandle is set to 1 in FreeRTOSConfig.h.
|
||||
*
|
||||
* Simply returns the handle of the timer service/daemon task. It it not valid
|
||||
* to call xTimerGetTimerDaemonTaskHandle() before the scheduler has been started.
|
||||
*/
|
||||
TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
|
||||
TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* BaseType_t xTimerStart( TimerHandle_t xTimer, TickType_t xTicksToWait );
|
||||
@@ -652,7 +819,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
|
||||
*
|
||||
* // Starting the scheduler will start the timer running as it has already
|
||||
* // been set into the active state.
|
||||
* xTaskStartScheduler();
|
||||
* vTaskStartScheduler();
|
||||
*
|
||||
* // Should not reach here.
|
||||
* for( ;; );
|
||||
@@ -1058,7 +1225,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
|
||||
* }
|
||||
* @endverbatim
|
||||
*/
|
||||
BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken );
|
||||
BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
|
||||
@@ -1092,10 +1259,10 @@ BaseType_t xTimerPendFunctionCallFromISR( PendedFunction_t xFunctionToPend, void
|
||||
* timer daemon task, otherwise pdFALSE is returned.
|
||||
*
|
||||
*/
|
||||
BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait );
|
||||
BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* const char * const pcTimerGetTimerName( TimerHandle_t xTimer );
|
||||
* const char * const pcTimerGetName( TimerHandle_t xTimer );
|
||||
*
|
||||
* Returns the name that was assigned to a timer when the timer was created.
|
||||
*
|
||||
@@ -1103,7 +1270,33 @@ BaseType_t xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvPar
|
||||
*
|
||||
* @return The name assigned to the timer specified by the xTimer parameter.
|
||||
*/
|
||||
const char * pcTimerGetTimerName( TimerHandle_t xTimer ); /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
const char * pcTimerGetName( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
|
||||
/**
|
||||
* TickType_t xTimerGetPeriod( TimerHandle_t xTimer );
|
||||
*
|
||||
* Returns the period of a timer.
|
||||
*
|
||||
* @param xTimer The handle of the timer being queried.
|
||||
*
|
||||
* @return The period of the timer in ticks.
|
||||
*/
|
||||
TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/**
|
||||
* TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer );
|
||||
*
|
||||
* Returns the time in ticks at which the timer will expire. If this is less
|
||||
* than the current tick count then the expiry time has overflowed from the
|
||||
* current time.
|
||||
*
|
||||
* @param xTimer The handle of the timer being queried.
|
||||
*
|
||||
* @return If the timer is running then the time in ticks at which the timer
|
||||
* will next expire is returned. If the timer is not running then the return
|
||||
* value is undefined.
|
||||
*/
|
||||
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Functions beyond this part are not part of the public API and are intended
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -89,6 +93,11 @@ void vListInitialise( List_t * const pxList )
|
||||
pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||
|
||||
pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
|
||||
|
||||
/* Write known values into the list if
|
||||
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );
|
||||
listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -96,6 +105,11 @@ void vListInitialiseItem( ListItem_t * const pxItem )
|
||||
{
|
||||
/* Make sure the list item is not recorded as being on a list. */
|
||||
pxItem->pvContainer = NULL;
|
||||
|
||||
/* Write known values into the list item if
|
||||
configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
|
||||
listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
|
||||
listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( pxItem );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -103,11 +117,21 @@ void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||
{
|
||||
ListItem_t * const pxIndex = pxList->pxIndex;
|
||||
|
||||
/* Only effective when configASSERT() is also defined, these tests may catch
|
||||
the list data structures being overwritten in memory. They will not catch
|
||||
data errors caused by incorrect configuration or use of FreeRTOS. */
|
||||
listTEST_LIST_INTEGRITY( pxList );
|
||||
listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
|
||||
|
||||
/* Insert a new list item into pxList, but rather than sort the list,
|
||||
makes the new list item the last item to be removed by a call to
|
||||
listGET_OWNER_OF_NEXT_ENTRY(). */
|
||||
pxNewListItem->pxNext = pxIndex;
|
||||
pxNewListItem->pxPrevious = pxIndex->pxPrevious;
|
||||
|
||||
/* Only used during decision coverage testing. */
|
||||
mtCOVERAGE_TEST_DELAY();
|
||||
|
||||
pxIndex->pxPrevious->pxNext = pxNewListItem;
|
||||
pxIndex->pxPrevious = pxNewListItem;
|
||||
|
||||
@@ -123,15 +147,20 @@ void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )
|
||||
ListItem_t *pxIterator;
|
||||
const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
||||
|
||||
/* Only effective when configASSERT() is also defined, these tests may catch
|
||||
the list data structures being overwritten in memory. They will not catch
|
||||
data errors caused by incorrect configuration or use of FreeRTOS. */
|
||||
listTEST_LIST_INTEGRITY( pxList );
|
||||
listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );
|
||||
|
||||
/* Insert the new list item into the list, sorted in xItemValue order.
|
||||
|
||||
If the list already contains a list item with the same item value then
|
||||
the new list item should be placed after it. This ensures that TCB's which
|
||||
are stored in ready lists (all of which have the same xItemValue value)
|
||||
get an equal share of the CPU. However, if the xItemValue is the same as
|
||||
the back marker the iteration loop below will not end. This means we need
|
||||
to guard against this by checking the value first and modifying the
|
||||
algorithm slightly if necessary. */
|
||||
If the list already contains a list item with the same item value then the
|
||||
new list item should be placed after it. This ensures that TCB's which are
|
||||
stored in ready lists (all of which have the same xItemValue value) get a
|
||||
share of the CPU. However, if the xItemValue is the same as the back marker
|
||||
the iteration loop below will not end. Therefore the value is checked
|
||||
first, and the algorithm slightly modified if necessary. */
|
||||
if( xValueOfInsertion == portMAX_DELAY )
|
||||
{
|
||||
pxIterator = pxList->xListEnd.pxPrevious;
|
||||
@@ -139,27 +168,31 @@ const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;
|
||||
else
|
||||
{
|
||||
/* *** NOTE ***********************************************************
|
||||
If you find your application is crashing here then likely causes are:
|
||||
If you find your application is crashing here then likely causes are
|
||||
listed below. In addition see http://www.freertos.org/FAQHelp.html for
|
||||
more tips, and ensure configASSERT() is defined!
|
||||
http://www.freertos.org/a00110.html#configASSERT
|
||||
|
||||
1) Stack overflow -
|
||||
see http://www.freertos.org/Stacks-and-stack-overflow-checking.html
|
||||
2) Incorrect interrupt priority assignment, especially on Cortex-M3
|
||||
2) Incorrect interrupt priority assignment, especially on Cortex-M
|
||||
parts where numerically high priority values denote low actual
|
||||
interrupt priorities, which can seem counter intuitive. See
|
||||
configMAX_SYSCALL_INTERRUPT_PRIORITY on http://www.freertos.org/a00110.html
|
||||
http://www.freertos.org/RTOS-Cortex-M3-M4.html and the definition
|
||||
of configMAX_SYSCALL_INTERRUPT_PRIORITY on
|
||||
http://www.freertos.org/a00110.html
|
||||
3) Calling an API function from within a critical section or when
|
||||
the scheduler is suspended, or calling an API function that does
|
||||
not end in "FromISR" from an interrupt.
|
||||
4) Using a queue or semaphore before it has been initialised or
|
||||
before the scheduler has been started (are interrupts firing
|
||||
before vTaskStartScheduler() has been called?).
|
||||
See http://www.freertos.org/FAQHelp.html for more tips, and ensure
|
||||
configASSERT() is defined! http://www.freertos.org/a00110.html#configASSERT
|
||||
**********************************************************************/
|
||||
|
||||
for( pxIterator = ( ListItem_t * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM. This is checked and valid. */
|
||||
{
|
||||
/* There is nothing to do here, we are just iterating to the
|
||||
wanted insertion position. */
|
||||
/* There is nothing to do here, just iterating to the wanted
|
||||
insertion position. */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,6 +218,9 @@ List_t * const pxList = ( List_t * ) pxItemToRemove->pvContainer;
|
||||
pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious;
|
||||
pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext;
|
||||
|
||||
/* Only used during decision coverage testing. */
|
||||
mtCOVERAGE_TEST_DELAY();
|
||||
|
||||
/* Make sure the index is left pointing to a valid item. */
|
||||
if( pxList->pxIndex == pxItemToRemove )
|
||||
{
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -113,6 +117,9 @@ FreeRTOS.org versions prior to V4.4.0 did not include this definition. */
|
||||
#define portPRIORITY_GROUP_MASK ( 0x07UL << 8UL )
|
||||
#define portPRIGROUP_SHIFT ( 8UL )
|
||||
|
||||
/* Masks off all bits but the VECTACTIVE bits in the ICSR register. */
|
||||
#define portVECTACTIVE_MASK ( 0xFFUL )
|
||||
|
||||
/* Constants required to set up the initial stack. */
|
||||
#define portINITIAL_XPSR ( 0x01000000UL )
|
||||
|
||||
@@ -124,8 +131,12 @@ occurred while the SysTick counter is stopped during tickless idle
|
||||
calculations. */
|
||||
#define portMISSED_COUNTS_FACTOR ( 45UL )
|
||||
|
||||
/* For strict compliance with the Cortex-M spec the task start address should
|
||||
have bit-0 clear, as it is loaded into the PC on exit from an ISR. */
|
||||
#define portSTART_ADDRESS_MASK ( ( StackType_t ) 0xfffffffeUL )
|
||||
|
||||
/* Let the user override the pre-loading of the initial LR with the address of
|
||||
prvTaskExitError() in case is messes up unwinding of the stack in the
|
||||
prvTaskExitError() in case it messes up unwinding of the stack in the
|
||||
debugger. */
|
||||
#ifdef configTASK_RETURN_ADDRESS
|
||||
#define portTASK_RETURN_ADDRESS configTASK_RETURN_ADDRESS
|
||||
@@ -202,7 +213,6 @@ static void prvTaskExitError( void );
|
||||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
__attribute__ ((section (".boot")))
|
||||
StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters )
|
||||
{
|
||||
/* Simulate the stack frame as it would be created by a context switch
|
||||
@@ -210,7 +220,7 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
|
||||
pxTopOfStack--; /* Offset added to account for the way the MCU uses the stack on entry/exit of interrupts. */
|
||||
*pxTopOfStack = portINITIAL_XPSR; /* xPSR */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) pxCode; /* PC */
|
||||
*pxTopOfStack = ( ( StackType_t ) pxCode ) & portSTART_ADDRESS_MASK; /* PC */
|
||||
pxTopOfStack--;
|
||||
*pxTopOfStack = ( StackType_t ) portTASK_RETURN_ADDRESS; /* LR */
|
||||
pxTopOfStack -= 5; /* R12, R3, R2 and R1. */
|
||||
@@ -221,7 +231,6 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
__attribute__ ((section (".boot")))
|
||||
static void prvTaskExitError( void )
|
||||
{
|
||||
/* A function that implements a task must not exit or attempt to return to
|
||||
@@ -250,13 +259,12 @@ void vPortSVCHandler( void )
|
||||
" orr r14, #0xd \n"
|
||||
" bx r14 \n"
|
||||
" \n"
|
||||
" .align 2 \n"
|
||||
" .align 4 \n"
|
||||
"pxCurrentTCBConst2: .word pxCurrentTCB \n"
|
||||
);
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
__attribute__ ((section (".boot")))
|
||||
static void prvPortStartFirstTask( void )
|
||||
{
|
||||
__asm volatile(
|
||||
@@ -277,7 +285,6 @@ static void prvPortStartFirstTask( void )
|
||||
/*
|
||||
* See header file for description.
|
||||
*/
|
||||
__attribute__ ((section (".boot")))
|
||||
BaseType_t xPortStartScheduler( void )
|
||||
{
|
||||
/* configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to 0.
|
||||
@@ -361,27 +368,13 @@ void vPortEndScheduler( void )
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortYield( void )
|
||||
{
|
||||
/* Set a PendSV to request a context switch. */
|
||||
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
|
||||
|
||||
/* Barriers are normally not required but do ensure the code is completely
|
||||
within the specified behaviour for the architecture. */
|
||||
__asm volatile( "dsb" );
|
||||
__asm volatile( "isb" );
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vPortEnterCritical( void )
|
||||
{
|
||||
portDISABLE_INTERRUPTS();
|
||||
uxCriticalNesting++;
|
||||
__asm volatile( "dsb" );
|
||||
__asm volatile( "isb" );
|
||||
|
||||
|
||||
/* This is not the interrupt safe version of the enter critical function so
|
||||
assert() if it is being called from an interrupt context. Only API
|
||||
assert() if it is being called from an interrupt context. Only API
|
||||
functions that end in "FromISR" can be used in an interrupt. Only assert if
|
||||
the critical nesting count is 1 to protect against recursive calls if the
|
||||
assert function also uses a critical section. */
|
||||
@@ -403,37 +396,6 @@ void vPortExitCritical( void )
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
__attribute__(( naked )) uint32_t ulPortSetInterruptMask( void )
|
||||
{
|
||||
__asm volatile \
|
||||
( \
|
||||
" mrs r0, basepri \n" \
|
||||
" mov r1, %0 \n" \
|
||||
" msr basepri, r1 \n" \
|
||||
" bx lr \n" \
|
||||
:: "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY ) : "r0", "r1" \
|
||||
);
|
||||
|
||||
/* This return will not be reached but is necessary to prevent compiler
|
||||
warnings. */
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
__attribute__(( naked )) void vPortClearInterruptMask( uint32_t ulNewMaskValue )
|
||||
{
|
||||
__asm volatile \
|
||||
( \
|
||||
" msr basepri, r0 \n" \
|
||||
" bx lr \n" \
|
||||
:::"r0" \
|
||||
);
|
||||
|
||||
/* Just to avoid compiler warnings. */
|
||||
( void ) ulNewMaskValue;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void xPortPendSVHandler( void )
|
||||
{
|
||||
/* This is a naked function. */
|
||||
@@ -464,7 +426,7 @@ void xPortPendSVHandler( void )
|
||||
" isb \n"
|
||||
" bx r14 \n"
|
||||
" \n"
|
||||
" .align 2 \n"
|
||||
" .align 4 \n"
|
||||
"pxCurrentTCBConst: .word pxCurrentTCB \n"
|
||||
::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY)
|
||||
);
|
||||
@@ -477,7 +439,7 @@ void xPortSysTickHandler( void )
|
||||
executes all interrupts must be unmasked. There is therefore no need to
|
||||
save and then restore the interrupt mask value as its value is already
|
||||
known. */
|
||||
( void ) portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
portDISABLE_INTERRUPTS();
|
||||
{
|
||||
/* Increment the RTOS tick. */
|
||||
if( xTaskIncrementTick() != pdFALSE )
|
||||
@@ -487,7 +449,7 @@ void xPortSysTickHandler( void )
|
||||
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
|
||||
}
|
||||
}
|
||||
portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
|
||||
portENABLE_INTERRUPTS();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -522,6 +484,8 @@ void xPortSysTickHandler( void )
|
||||
/* Enter a critical section but don't use the taskENTER_CRITICAL()
|
||||
method as that will mask interrupts that should exit sleep mode. */
|
||||
__asm volatile( "cpsid i" );
|
||||
__asm volatile( "dsb" );
|
||||
__asm volatile( "isb" );
|
||||
|
||||
/* If a context switch is pending or a task is waiting for the scheduler
|
||||
to be unsuspended then abandon the low power entry. */
|
||||
@@ -621,7 +585,7 @@ void xPortSysTickHandler( void )
|
||||
|
||||
/* The reload value is set to whatever fraction of a single tick
|
||||
period remains. */
|
||||
portNVIC_SYSTICK_LOAD_REG = ( ( ulCompleteTickPeriods + 1 ) * ulTimerCountsForOneTick ) - ulCompletedSysTickDecrements;
|
||||
portNVIC_SYSTICK_LOAD_REG = ( ( ulCompleteTickPeriods + 1UL ) * ulTimerCountsForOneTick ) - ulCompletedSysTickDecrements;
|
||||
}
|
||||
|
||||
/* Restart SysTick so it runs from portNVIC_SYSTICK_LOAD_REG
|
||||
@@ -647,7 +611,6 @@ void xPortSysTickHandler( void )
|
||||
* Setup the systick timer to generate the tick interrupts at the required
|
||||
* frequency.
|
||||
*/
|
||||
__attribute__ ((section (".boot")))
|
||||
__attribute__(( weak )) void vPortSetupTimerInterrupt( void )
|
||||
{
|
||||
/* Calculate the constants required to configure the tick interrupt. */
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -100,6 +104,10 @@ typedef unsigned long UBaseType_t;
|
||||
#else
|
||||
typedef uint32_t TickType_t;
|
||||
#define portMAX_DELAY ( TickType_t ) 0xffffffffUL
|
||||
|
||||
/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do
|
||||
not need to be guarded with a critical section. */
|
||||
#define portTICK_TYPE_IS_ATOMIC 1
|
||||
#endif
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -109,29 +117,34 @@ typedef unsigned long UBaseType_t;
|
||||
#define portBYTE_ALIGNMENT 8
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Scheduler utilities. */
|
||||
extern void vPortYield( void );
|
||||
#define portYIELD() \
|
||||
{ \
|
||||
/* Set a PendSV to request a context switch. */ \
|
||||
portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT; \
|
||||
\
|
||||
/* Barriers are normally not required but do ensure the code is completely \
|
||||
within the specified behaviour for the architecture. */ \
|
||||
__asm volatile( "dsb" ); \
|
||||
__asm volatile( "isb" ); \
|
||||
}
|
||||
|
||||
#define portNVIC_INT_CTRL_REG ( * ( ( volatile uint32_t * ) 0xe000ed04 ) )
|
||||
/* Masks off all bits but the VECTACTIVE bits in the ICSR register. */
|
||||
#define portVECTACTIVE_MASK ( 0x1FUL )
|
||||
#define portNVIC_PENDSVSET_BIT ( 1UL << 28UL )
|
||||
#define portYIELD() vPortYield()
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT
|
||||
#define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired != pdFALSE ) portYIELD()
|
||||
#define portYIELD_FROM_ISR( x ) portEND_SWITCHING_ISR( x )
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Critical section management. */
|
||||
extern void vPortEnterCritical( void );
|
||||
extern void vPortExitCritical( void );
|
||||
extern uint32_t ulPortSetInterruptMask( void );
|
||||
extern void vPortClearInterruptMask( uint32_t ulNewMaskValue );
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x)
|
||||
#define portDISABLE_INTERRUPTS() ulPortSetInterruptMask()
|
||||
#define portENABLE_INTERRUPTS() vPortClearInterruptMask(0)
|
||||
#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortRaiseBASEPRI()
|
||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortSetBASEPRI(x)
|
||||
#define portDISABLE_INTERRUPTS() vPortRaiseBASEPRI()
|
||||
#define portENABLE_INTERRUPTS() vPortSetBASEPRI(0)
|
||||
#define portENTER_CRITICAL() vPortEnterCritical()
|
||||
#define portEXIT_CRITICAL() vPortExitCritical()
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/* Task function macros as described on the FreeRTOS.org WEB site. These are
|
||||
@@ -175,7 +188,7 @@ not necessary for to use this port. They are defined so the common demo files
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31 - ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
|
||||
#define portGET_HIGHEST_PRIORITY( uxTopPriority, uxReadyPriorities ) uxTopPriority = ( 31UL - ( uint32_t ) ucPortCountLeadingZeros( ( uxReadyPriorities ) ) )
|
||||
|
||||
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
|
||||
|
||||
@@ -189,6 +202,80 @@ not necessary for to use this port. They are defined so the common demo files
|
||||
/* portNOP() is not required by this port. */
|
||||
#define portNOP()
|
||||
|
||||
#define portINLINE __inline
|
||||
|
||||
#ifndef portFORCE_INLINE
|
||||
#define portFORCE_INLINE inline __attribute__(( always_inline))
|
||||
#endif
|
||||
|
||||
portFORCE_INLINE static BaseType_t xPortIsInsideInterrupt( void )
|
||||
{
|
||||
uint32_t ulCurrentInterrupt;
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* Obtain the number of the currently executing interrupt. */
|
||||
__asm volatile( "mrs %0, ipsr" : "=r"( ulCurrentInterrupt ) );
|
||||
|
||||
if( ulCurrentInterrupt == 0 )
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdTRUE;
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portFORCE_INLINE static void vPortRaiseBASEPRI( void )
|
||||
{
|
||||
uint32_t ulNewBASEPRI;
|
||||
|
||||
__asm volatile
|
||||
(
|
||||
" mov %0, %1 \n" \
|
||||
" msr basepri, %0 \n" \
|
||||
" isb \n" \
|
||||
" dsb \n" \
|
||||
:"=r" (ulNewBASEPRI) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portFORCE_INLINE static uint32_t ulPortRaiseBASEPRI( void )
|
||||
{
|
||||
uint32_t ulOriginalBASEPRI, ulNewBASEPRI;
|
||||
|
||||
__asm volatile
|
||||
(
|
||||
" mrs %0, basepri \n" \
|
||||
" mov %1, %2 \n" \
|
||||
" msr basepri, %1 \n" \
|
||||
" isb \n" \
|
||||
" dsb \n" \
|
||||
:"=r" (ulOriginalBASEPRI), "=r" (ulNewBASEPRI) : "i" ( configMAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
);
|
||||
|
||||
/* This return will not be reached but is necessary to prevent compiler
|
||||
warnings. */
|
||||
return ulOriginalBASEPRI;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
portFORCE_INLINE static void vPortSetBASEPRI( uint32_t ulNewMaskValue )
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
" msr basepri, %0 " :: "r" ( ulNewMaskValue )
|
||||
);
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -83,15 +87,24 @@ task.h is included from an application file. */
|
||||
|
||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 0 )
|
||||
#error This file must not be used if configSUPPORT_DYNAMIC_ALLOCATION is 0
|
||||
#endif
|
||||
|
||||
/* Block sizes must not get too small. */
|
||||
#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( xHeapStructSize * 2 ) )
|
||||
#define heapMINIMUM_BLOCK_SIZE ( ( size_t ) ( xHeapStructSize << 1 ) )
|
||||
|
||||
/* Assumes 8bit bytes! */
|
||||
#define heapBITS_PER_BYTE ( ( size_t ) 8 )
|
||||
|
||||
/* Allocate the memory for the heap. */
|
||||
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__ ((section (".rtos_heap")))
|
||||
__attribute__((aligned (8)));
|
||||
#if( configAPPLICATION_ALLOCATED_HEAP == 1 )
|
||||
/* The application writer has already defined the array used for the RTOS
|
||||
heap - probably so it can be placed in a special segment or address. */
|
||||
extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||
#else
|
||||
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||
#endif /* configAPPLICATION_ALLOCATED_HEAP */
|
||||
|
||||
/* Define the linked list structure. This is used to link free blocks in order
|
||||
of their memory address. */
|
||||
@@ -121,7 +134,7 @@ static void prvHeapInit( void );
|
||||
|
||||
/* The size of the structure placed at the beginning of each allocated memory
|
||||
block must by correctly byte aligned. */
|
||||
static const size_t xHeapStructSize = ( ( sizeof( BlockLink_t ) + ( portBYTE_ALIGNMENT - 1 ) ) & ~portBYTE_ALIGNMENT_MASK );
|
||||
static const size_t xHeapStructSize = ( sizeof( BlockLink_t ) + ( ( size_t ) ( portBYTE_ALIGNMENT - 1 ) ) ) & ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
|
||||
|
||||
/* Create a couple of list links to mark the start and end of the list. */
|
||||
static BlockLink_t xStart, *pxEnd = NULL;
|
||||
@@ -220,7 +233,7 @@ void *pvReturn = NULL;
|
||||
cast is used to prevent byte alignment warnings from the
|
||||
compiler. */
|
||||
pxNewBlockLink = ( void * ) ( ( ( uint8_t * ) pxBlock ) + xWantedSize );
|
||||
configASSERT( ( ( ( uint32_t ) pxNewBlockLink ) & portBYTE_ALIGNMENT_MASK ) == 0 );
|
||||
configASSERT( ( ( ( size_t ) pxNewBlockLink ) & portBYTE_ALIGNMENT_MASK ) == 0 );
|
||||
|
||||
/* Calculate the sizes of two blocks split from the
|
||||
single block. */
|
||||
@@ -228,7 +241,7 @@ void *pvReturn = NULL;
|
||||
pxBlock->xBlockSize = xWantedSize;
|
||||
|
||||
/* Insert the new block into the list of free blocks. */
|
||||
prvInsertBlockIntoFreeList( ( pxNewBlockLink ) );
|
||||
prvInsertBlockIntoFreeList( pxNewBlockLink );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -284,7 +297,7 @@ void *pvReturn = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
configASSERT( ( ( ( uint32_t ) pvReturn ) & portBYTE_ALIGNMENT_MASK ) == 0 );
|
||||
configASSERT( ( ( ( size_t ) pvReturn ) & ( size_t ) portBYTE_ALIGNMENT_MASK ) == 0 );
|
||||
return pvReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
@@ -359,20 +372,20 @@ static void prvHeapInit( void )
|
||||
{
|
||||
BlockLink_t *pxFirstFreeBlock;
|
||||
uint8_t *pucAlignedHeap;
|
||||
uint32_t ulAddress;
|
||||
size_t uxAddress;
|
||||
size_t xTotalHeapSize = configTOTAL_HEAP_SIZE;
|
||||
|
||||
/* Ensure the heap starts on a correctly aligned boundary. */
|
||||
ulAddress = ( uint32_t ) ucHeap;
|
||||
uxAddress = ( size_t ) ucHeap;
|
||||
|
||||
if( ( ulAddress & portBYTE_ALIGNMENT_MASK ) != 0 )
|
||||
if( ( uxAddress & portBYTE_ALIGNMENT_MASK ) != 0 )
|
||||
{
|
||||
ulAddress += ( portBYTE_ALIGNMENT - 1 );
|
||||
ulAddress &= ~portBYTE_ALIGNMENT_MASK;
|
||||
xTotalHeapSize -= ulAddress - ( uint32_t ) ucHeap;
|
||||
uxAddress += ( portBYTE_ALIGNMENT - 1 );
|
||||
uxAddress &= ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
|
||||
xTotalHeapSize -= uxAddress - ( size_t ) ucHeap;
|
||||
}
|
||||
|
||||
pucAlignedHeap = ( uint8_t * ) ulAddress;
|
||||
pucAlignedHeap = ( uint8_t * ) uxAddress;
|
||||
|
||||
/* xStart is used to hold a pointer to the first item in the list of free
|
||||
blocks. The void cast is used to prevent compiler warnings. */
|
||||
@@ -381,17 +394,17 @@ size_t xTotalHeapSize = configTOTAL_HEAP_SIZE;
|
||||
|
||||
/* pxEnd is used to mark the end of the list of free blocks and is inserted
|
||||
at the end of the heap space. */
|
||||
ulAddress = ( ( uint32_t ) pucAlignedHeap ) + xTotalHeapSize;
|
||||
ulAddress -= xHeapStructSize;
|
||||
ulAddress &= ~portBYTE_ALIGNMENT_MASK;
|
||||
pxEnd = ( void * ) ulAddress;
|
||||
uxAddress = ( ( size_t ) pucAlignedHeap ) + xTotalHeapSize;
|
||||
uxAddress -= xHeapStructSize;
|
||||
uxAddress &= ~( ( size_t ) portBYTE_ALIGNMENT_MASK );
|
||||
pxEnd = ( void * ) uxAddress;
|
||||
pxEnd->xBlockSize = 0;
|
||||
pxEnd->pxNextFreeBlock = NULL;
|
||||
|
||||
/* To start with there is a single free block that is sized to take up the
|
||||
entire heap space, minus the space taken by pxEnd. */
|
||||
pxFirstFreeBlock = ( void * ) pucAlignedHeap;
|
||||
pxFirstFreeBlock->xBlockSize = ulAddress - ( uint32_t ) pxFirstFreeBlock;
|
||||
pxFirstFreeBlock->xBlockSize = uxAddress - ( size_t ) pxFirstFreeBlock;
|
||||
pxFirstFreeBlock->pxNextFreeBlock = pxEnd;
|
||||
|
||||
/* Only one block exists - and it covers the entire usable heap space. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,60 +1,64 @@
|
||||
/*
|
||||
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
|
||||
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
|
||||
All rights reserved
|
||||
|
||||
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that has become a de facto standard. *
|
||||
* *
|
||||
* Help yourself get started quickly and support the FreeRTOS *
|
||||
* project by purchasing a FreeRTOS tutorial book, reference *
|
||||
* manual, or both from: http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
* Thank you! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
|
||||
Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
|
||||
|
||||
***************************************************************************
|
||||
>>! NOTE: The modification to the GPL is included to allow you to !<<
|
||||
>>! distribute a combined work that includes FreeRTOS without being !<<
|
||||
>>! obliged to provide the source code for proprietary components !<<
|
||||
>>! outside of the FreeRTOS kernel. !<<
|
||||
***************************************************************************
|
||||
|
||||
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available from the following
|
||||
FOR A PARTICULAR PURPOSE. Full license text is available on the following
|
||||
link: http://www.freertos.org/a00114.html
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* FreeRTOS provides completely free yet professionally developed, *
|
||||
* robust, strictly quality controlled, supported, and cross *
|
||||
* platform software that is more than just the market leader, it *
|
||||
* is the industry's de facto standard. *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* Help yourself get started quickly while simultaneously helping *
|
||||
* to support the FreeRTOS project by purchasing a FreeRTOS *
|
||||
* tutorial book, reference manual, or both: *
|
||||
* http://www.FreeRTOS.org/Documentation *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
|
||||
license and Real Time Engineers Ltd. contact details.
|
||||
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
|
||||
the FAQ page "My application does not run, what could be wrong?". Have you
|
||||
defined configASSERT()?
|
||||
|
||||
http://www.FreeRTOS.org/support - In return for receiving this top quality
|
||||
embedded software for free we request you assist our global community by
|
||||
participating in the support forum.
|
||||
|
||||
http://www.FreeRTOS.org/training - Investing in training allows your team to
|
||||
be as productive as possible as early as possible. Now you can receive
|
||||
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
|
||||
Ltd, and the world's leading authority on the world's leading RTOS.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
|
||||
compatible FAT file system, and our tiny thread aware UDP/IP stack.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
|
||||
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and middleware.
|
||||
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
|
||||
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
|
||||
|
||||
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
|
||||
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
|
||||
licenses offer ticketed support, indemnification and commercial middleware.
|
||||
|
||||
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
|
||||
engineered and independently SIL3 certified version for use in safety and
|
||||
@@ -108,6 +112,10 @@ typedef struct tmrTimerControl
|
||||
#if( configUSE_TRACE_FACILITY == 1 )
|
||||
UBaseType_t uxTimerNumber; /*<< An ID assigned by trace tools such as FreeRTOS+Trace */
|
||||
#endif
|
||||
|
||||
#if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
||||
uint8_t ucStaticallyAllocated; /*<< Set to pdTRUE if the timer was created statically so no attempt is made to free the memory again if the timer is later deleted. */
|
||||
#endif
|
||||
} xTIMER;
|
||||
|
||||
/* The old xTIMER name is maintained above then typedefed to the new Timer_t
|
||||
@@ -163,17 +171,22 @@ PRIVILEGED_DATA static List_t *pxOverflowTimerList;
|
||||
|
||||
/* A queue that is used to send commands to the timer service task. */
|
||||
PRIVILEGED_DATA static QueueHandle_t xTimerQueue = NULL;
|
||||
|
||||
#if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 )
|
||||
|
||||
PRIVILEGED_DATA static TaskHandle_t xTimerTaskHandle = NULL;
|
||||
|
||||
#endif
|
||||
PRIVILEGED_DATA static TaskHandle_t xTimerTaskHandle = NULL;
|
||||
|
||||
/*lint +e956 */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
|
||||
/* If static allocation is supported then the application must provide the
|
||||
following callback function - which enables the application to optionally
|
||||
provide the memory that will be used by the timer task as the task's stack
|
||||
and TCB. */
|
||||
extern void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize );
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialise the infrastructure used by the timer service task if it has not
|
||||
* been initialised already.
|
||||
@@ -191,7 +204,7 @@ static void prvTimerTask( void *pvParameters ) PRIVILEGED_FUNCTION;
|
||||
* Called by the timer service task to interpret and process a command it
|
||||
* received on the timer queue.
|
||||
*/
|
||||
static void prvProcessReceivedCommands( void ) PRIVILEGED_FUNCTION;
|
||||
static void prvProcessReceivedCommands( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Insert the timer into either xActiveTimerList1, or xActiveTimerList2,
|
||||
@@ -229,8 +242,18 @@ static TickType_t prvGetNextExpireTime( BaseType_t * const pxListWasEmpty ) PRIV
|
||||
* If a timer has expired, process it. Otherwise, block the timer service task
|
||||
* until either a timer does expire or a command is received.
|
||||
*/
|
||||
static void prvProcessTimerOrBlockTask( const TickType_t xNextExpireTime, const BaseType_t xListWasEmpty ) PRIVILEGED_FUNCTION;
|
||||
static void prvProcessTimerOrBlockTask( const TickType_t xNextExpireTime, BaseType_t xListWasEmpty ) PRIVILEGED_FUNCTION;
|
||||
|
||||
/*
|
||||
* Called after a Timer_t structure has been allocated either statically or
|
||||
* dynamically to fill in the structure's members.
|
||||
*/
|
||||
static void prvInitialiseNewTimer( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const UBaseType_t uxAutoReload,
|
||||
void * const pvTimerID,
|
||||
TimerCallbackFunction_t pxCallbackFunction,
|
||||
Timer_t *pxNewTimer ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
BaseType_t xTimerCreateTimerTask( void )
|
||||
@@ -245,18 +268,36 @@ BaseType_t xReturn = pdFAIL;
|
||||
|
||||
if( xTimerQueue != NULL )
|
||||
{
|
||||
#if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 )
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
{
|
||||
/* Create the timer task, storing its handle in xTimerTaskHandle so
|
||||
it can be returned by the xTimerGetTimerDaemonTaskHandle() function. */
|
||||
xReturn = xTaskCreate( prvTimerTask, "Tmr Svc", ( uint16_t ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle );
|
||||
StaticTask_t *pxTimerTaskTCBBuffer = NULL;
|
||||
StackType_t *pxTimerTaskStackBuffer = NULL;
|
||||
uint32_t ulTimerTaskStackSize;
|
||||
|
||||
vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &ulTimerTaskStackSize );
|
||||
xTimerTaskHandle = xTaskCreateStatic( prvTimerTask,
|
||||
"Tmr Svc",
|
||||
ulTimerTaskStackSize,
|
||||
NULL,
|
||||
( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT,
|
||||
pxTimerTaskStackBuffer,
|
||||
pxTimerTaskTCBBuffer );
|
||||
|
||||
if( xTimerTaskHandle != NULL )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* Create the timer task without storing its handle. */
|
||||
xReturn = xTaskCreate( prvTimerTask, "Tmr Svc", ( uint16_t ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, NULL);
|
||||
xReturn = xTaskCreate( prvTimerTask,
|
||||
"Tmr Svc",
|
||||
configTIMER_TASK_STACK_DEPTH,
|
||||
NULL,
|
||||
( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT,
|
||||
&xTimerTaskHandle );
|
||||
}
|
||||
#endif
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -268,44 +309,108 @@ BaseType_t xReturn = pdFAIL;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
TimerHandle_t xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
{
|
||||
Timer_t *pxNewTimer;
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
|
||||
/* Allocate the timer structure. */
|
||||
if( xTimerPeriodInTicks == ( TickType_t ) 0U )
|
||||
{
|
||||
pxNewTimer = NULL;
|
||||
}
|
||||
else
|
||||
TimerHandle_t xTimerCreate( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const UBaseType_t uxAutoReload,
|
||||
void * const pvTimerID,
|
||||
TimerCallbackFunction_t pxCallbackFunction ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
{
|
||||
Timer_t *pxNewTimer;
|
||||
|
||||
pxNewTimer = ( Timer_t * ) pvPortMalloc( sizeof( Timer_t ) );
|
||||
|
||||
if( pxNewTimer != NULL )
|
||||
{
|
||||
/* Ensure the infrastructure used by the timer service task has been
|
||||
created/initialised. */
|
||||
prvCheckForValidListAndQueue();
|
||||
prvInitialiseNewTimer( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxNewTimer );
|
||||
|
||||
/* Initialise the timer structure members using the function parameters. */
|
||||
pxNewTimer->pcTimerName = pcTimerName;
|
||||
pxNewTimer->xTimerPeriodInTicks = xTimerPeriodInTicks;
|
||||
pxNewTimer->uxAutoReload = uxAutoReload;
|
||||
pxNewTimer->pvTimerID = pvTimerID;
|
||||
pxNewTimer->pxCallbackFunction = pxCallbackFunction;
|
||||
vListInitialiseItem( &( pxNewTimer->xTimerListItem ) );
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
{
|
||||
/* Timers can be created statically or dynamically, so note this
|
||||
timer was created dynamically in case the timer is later
|
||||
deleted. */
|
||||
pxNewTimer->ucStaticallyAllocated = pdFALSE;
|
||||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
}
|
||||
|
||||
traceTIMER_CREATE( pxNewTimer );
|
||||
}
|
||||
else
|
||||
{
|
||||
traceTIMER_CREATE_FAILED();
|
||||
}
|
||||
return pxNewTimer;
|
||||
}
|
||||
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
|
||||
TimerHandle_t xTimerCreateStatic( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const UBaseType_t uxAutoReload,
|
||||
void * const pvTimerID,
|
||||
TimerCallbackFunction_t pxCallbackFunction,
|
||||
StaticTimer_t *pxTimerBuffer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
{
|
||||
Timer_t *pxNewTimer;
|
||||
|
||||
#if( configASSERT_DEFINED == 1 )
|
||||
{
|
||||
/* Sanity check that the size of the structure used to declare a
|
||||
variable of type StaticTimer_t equals the size of the real timer
|
||||
structures. */
|
||||
volatile size_t xSize = sizeof( StaticTimer_t );
|
||||
configASSERT( xSize == sizeof( Timer_t ) );
|
||||
}
|
||||
#endif /* configASSERT_DEFINED */
|
||||
|
||||
/* A pointer to a StaticTimer_t structure MUST be provided, use it. */
|
||||
configASSERT( pxTimerBuffer );
|
||||
pxNewTimer = ( Timer_t * ) pxTimerBuffer; /*lint !e740 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */
|
||||
|
||||
if( pxNewTimer != NULL )
|
||||
{
|
||||
prvInitialiseNewTimer( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxNewTimer );
|
||||
|
||||
#if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
{
|
||||
/* Timers can be created statically or dynamically so note this
|
||||
timer was created statically in case it is later deleted. */
|
||||
pxNewTimer->ucStaticallyAllocated = pdTRUE;
|
||||
}
|
||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
}
|
||||
|
||||
return pxNewTimer;
|
||||
}
|
||||
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvInitialiseNewTimer( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const UBaseType_t uxAutoReload,
|
||||
void * const pvTimerID,
|
||||
TimerCallbackFunction_t pxCallbackFunction,
|
||||
Timer_t *pxNewTimer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
{
|
||||
/* 0 is not a valid value for xTimerPeriodInTicks. */
|
||||
configASSERT( ( xTimerPeriodInTicks > 0 ) );
|
||||
|
||||
return ( TimerHandle_t ) pxNewTimer;
|
||||
if( pxNewTimer != NULL )
|
||||
{
|
||||
/* Ensure the infrastructure used by the timer service task has been
|
||||
created/initialised. */
|
||||
prvCheckForValidListAndQueue();
|
||||
|
||||
/* Initialise the timer structure members using the function
|
||||
parameters. */
|
||||
pxNewTimer->pcTimerName = pcTimerName;
|
||||
pxNewTimer->xTimerPeriodInTicks = xTimerPeriodInTicks;
|
||||
pxNewTimer->uxAutoReload = uxAutoReload;
|
||||
pxNewTimer->pvTimerID = pvTimerID;
|
||||
pxNewTimer->pxCallbackFunction = pxCallbackFunction;
|
||||
vListInitialiseItem( &( pxNewTimer->xTimerListItem ) );
|
||||
traceTIMER_CREATE( pxNewTimer );
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -314,6 +419,8 @@ BaseType_t xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommand
|
||||
BaseType_t xReturn = pdFAIL;
|
||||
DaemonTaskMessage_t xMessage;
|
||||
|
||||
configASSERT( xTimer );
|
||||
|
||||
/* Send a message to the timer service task to perform a particular action
|
||||
on a particular timer definition. */
|
||||
if( xTimerQueue != NULL )
|
||||
@@ -350,23 +457,40 @@ DaemonTaskMessage_t xMessage;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( INCLUDE_xTimerGetTimerDaemonTaskHandle == 1 )
|
||||
|
||||
TaskHandle_t xTimerGetTimerDaemonTaskHandle( void )
|
||||
{
|
||||
/* If xTimerGetTimerDaemonTaskHandle() is called before the scheduler has been
|
||||
started, then xTimerTaskHandle will be NULL. */
|
||||
configASSERT( ( xTimerTaskHandle != NULL ) );
|
||||
return xTimerTaskHandle;
|
||||
}
|
||||
|
||||
#endif
|
||||
TaskHandle_t xTimerGetTimerDaemonTaskHandle( void )
|
||||
{
|
||||
/* If xTimerGetTimerDaemonTaskHandle() is called before the scheduler has been
|
||||
started, then xTimerTaskHandle will be NULL. */
|
||||
configASSERT( ( xTimerTaskHandle != NULL ) );
|
||||
return xTimerTaskHandle;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
const char * pcTimerGetTimerName( TimerHandle_t xTimer )
|
||||
TickType_t xTimerGetPeriod( TimerHandle_t xTimer )
|
||||
{
|
||||
Timer_t *pxTimer = ( Timer_t * ) xTimer;
|
||||
|
||||
configASSERT( xTimer );
|
||||
return pxTimer->xTimerPeriodInTicks;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer )
|
||||
{
|
||||
Timer_t * pxTimer = ( Timer_t * ) xTimer;
|
||||
TickType_t xReturn;
|
||||
|
||||
configASSERT( xTimer );
|
||||
xReturn = listGET_LIST_ITEM_VALUE( &( pxTimer->xTimerListItem ) );
|
||||
return xReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
const char * pcTimerGetName( TimerHandle_t xTimer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
{
|
||||
Timer_t *pxTimer = ( Timer_t * ) xTimer;
|
||||
|
||||
configASSERT( xTimer );
|
||||
return pxTimer->pcTimerName;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
@@ -388,7 +512,7 @@ Timer_t * const pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTi
|
||||
/* The timer is inserted into a list using a time relative to anything
|
||||
other than the current time. It will therefore be inserted into the
|
||||
correct list relative to the time this task thinks it is now. */
|
||||
if( prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime ) == pdTRUE )
|
||||
if( prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime ) != pdFALSE )
|
||||
{
|
||||
/* The timer expired before it was added to the active timer
|
||||
list. Reload it now. */
|
||||
@@ -419,6 +543,18 @@ BaseType_t xListWasEmpty;
|
||||
/* Just to avoid compiler warnings. */
|
||||
( void ) pvParameters;
|
||||
|
||||
#if( configUSE_DAEMON_TASK_STARTUP_HOOK == 1 )
|
||||
{
|
||||
extern void vApplicationDaemonTaskStartupHook( void );
|
||||
|
||||
/* Allow the application writer to execute some code in the context of
|
||||
this task at the point the task starts executing. This is useful if the
|
||||
application includes initialisation code that would benefit from
|
||||
executing after the scheduler has been started. */
|
||||
vApplicationDaemonTaskStartupHook();
|
||||
}
|
||||
#endif /* configUSE_DAEMON_TASK_STARTUP_HOOK */
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
/* Query the timers list to see if it contains any timers, and if so,
|
||||
@@ -435,7 +571,7 @@ BaseType_t xListWasEmpty;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvProcessTimerOrBlockTask( const TickType_t xNextExpireTime, const BaseType_t xListWasEmpty )
|
||||
static void prvProcessTimerOrBlockTask( const TickType_t xNextExpireTime, BaseType_t xListWasEmpty )
|
||||
{
|
||||
TickType_t xTimeNow;
|
||||
BaseType_t xTimerListsWereSwitched;
|
||||
@@ -464,14 +600,21 @@ BaseType_t xTimerListsWereSwitched;
|
||||
received - whichever comes first. The following line cannot
|
||||
be reached unless xNextExpireTime > xTimeNow, except in the
|
||||
case when the current timer list is empty. */
|
||||
vQueueWaitForMessageRestricted( xTimerQueue, ( xNextExpireTime - xTimeNow ) );
|
||||
if( xListWasEmpty != pdFALSE )
|
||||
{
|
||||
/* The current timer list is empty - is the overflow list
|
||||
also empty? */
|
||||
xListWasEmpty = listLIST_IS_EMPTY( pxOverflowTimerList );
|
||||
}
|
||||
|
||||
vQueueWaitForMessageRestricted( xTimerQueue, ( xNextExpireTime - xTimeNow ), xListWasEmpty );
|
||||
|
||||
if( xTaskResumeAll() == pdFALSE )
|
||||
{
|
||||
/* Yield to wait for either a command to arrive, or the block time
|
||||
to expire. If a command arrived between the critical section being
|
||||
exited and this yield then the yield will not cause the task
|
||||
to block. */
|
||||
/* Yield to wait for either a command to arrive, or the
|
||||
block time to expire. If a command arrived between the
|
||||
critical section being exited and this yield then the yield
|
||||
will not cause the task to block. */
|
||||
portYIELD_WITHIN_API();
|
||||
}
|
||||
else
|
||||
@@ -548,7 +691,7 @@ BaseType_t xProcessTimerNow = pdFALSE;
|
||||
{
|
||||
/* Has the expiry time elapsed between the command to start/reset a
|
||||
timer was issued, and the time the command was processed? */
|
||||
if( ( xTimeNow - xCommandTime ) >= pxTimer->xTimerPeriodInTicks )
|
||||
if( ( ( TickType_t ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks ) /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||
{
|
||||
/* The time between a command being issued and the command being
|
||||
processed actually exceeds the timers period. */
|
||||
@@ -645,7 +788,7 @@ TickType_t xTimeNow;
|
||||
case tmrCOMMAND_RESET_FROM_ISR :
|
||||
case tmrCOMMAND_START_DONT_TRACE :
|
||||
/* Start or restart a timer. */
|
||||
if( prvInsertTimerInActiveList( pxTimer, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, xTimeNow, xMessage.u.xTimerParameters.xMessageValue ) == pdTRUE )
|
||||
if( prvInsertTimerInActiveList( pxTimer, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, xTimeNow, xMessage.u.xTimerParameters.xMessageValue ) != pdFALSE )
|
||||
{
|
||||
/* The timer expired before it was added to the active
|
||||
timer list. Process it now. */
|
||||
@@ -680,19 +823,40 @@ TickType_t xTimeNow;
|
||||
pxTimer->xTimerPeriodInTicks = xMessage.u.xTimerParameters.xMessageValue;
|
||||
configASSERT( ( pxTimer->xTimerPeriodInTicks > 0 ) );
|
||||
|
||||
/* The new period does not really have a reference, and can be
|
||||
longer or shorter than the old one. The command time is
|
||||
therefore set to the current time, and as the period cannot be
|
||||
zero the next expiry time can only be in the future, meaning
|
||||
(unlike for the xTimerStart() case above) there is no fail case
|
||||
that needs to be handled here. */
|
||||
/* The new period does not really have a reference, and can
|
||||
be longer or shorter than the old one. The command time is
|
||||
therefore set to the current time, and as the period cannot
|
||||
be zero the next expiry time can only be in the future,
|
||||
meaning (unlike for the xTimerStart() case above) there is
|
||||
no fail case that needs to be handled here. */
|
||||
( void ) prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );
|
||||
break;
|
||||
|
||||
case tmrCOMMAND_DELETE :
|
||||
/* The timer has already been removed from the active list,
|
||||
just free up the memory. */
|
||||
vPortFree( pxTimer );
|
||||
just free up the memory if the memory was dynamically
|
||||
allocated. */
|
||||
#if( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 0 ) )
|
||||
{
|
||||
/* The timer can only have been allocated dynamically -
|
||||
free it again. */
|
||||
vPortFree( pxTimer );
|
||||
}
|
||||
#elif( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
|
||||
{
|
||||
/* The timer could have been allocated statically or
|
||||
dynamically, so check before attempting to free the
|
||||
memory. */
|
||||
if( pxTimer->ucStaticallyAllocated == ( uint8_t ) pdFALSE )
|
||||
{
|
||||
vPortFree( pxTimer );
|
||||
}
|
||||
else
|
||||
{
|
||||
mtCOVERAGE_TEST_MARKER();
|
||||
}
|
||||
}
|
||||
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
||||
break;
|
||||
|
||||
default :
|
||||
@@ -776,8 +940,21 @@ static void prvCheckForValidListAndQueue( void )
|
||||
vListInitialise( &xActiveTimerList2 );
|
||||
pxCurrentTimerList = &xActiveTimerList1;
|
||||
pxOverflowTimerList = &xActiveTimerList2;
|
||||
xTimerQueue = xQueueCreate( ( UBaseType_t ) configTIMER_QUEUE_LENGTH, sizeof( DaemonTaskMessage_t ) );
|
||||
configASSERT( xTimerQueue );
|
||||
|
||||
#if( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
{
|
||||
/* The timer queue is allocated statically in case
|
||||
configSUPPORT_DYNAMIC_ALLOCATION is 0. */
|
||||
static StaticQueue_t xStaticTimerQueue;
|
||||
static uint8_t ucStaticTimerQueueStorage[ configTIMER_QUEUE_LENGTH * sizeof( DaemonTaskMessage_t ) ];
|
||||
|
||||
xTimerQueue = xQueueCreateStatic( ( UBaseType_t ) configTIMER_QUEUE_LENGTH, sizeof( DaemonTaskMessage_t ), &( ucStaticTimerQueueStorage[ 0 ] ), &xStaticTimerQueue );
|
||||
}
|
||||
#else
|
||||
{
|
||||
xTimerQueue = xQueueCreate( ( UBaseType_t ) configTIMER_QUEUE_LENGTH, sizeof( DaemonTaskMessage_t ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ( configQUEUE_REGISTRY_SIZE > 0 )
|
||||
{
|
||||
@@ -806,6 +983,8 @@ BaseType_t xTimerIsTimerActive( TimerHandle_t xTimer )
|
||||
BaseType_t xTimerIsInActiveList;
|
||||
Timer_t *pxTimer = ( Timer_t * ) xTimer;
|
||||
|
||||
configASSERT( xTimer );
|
||||
|
||||
/* Is the timer in the list of active timers? */
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
@@ -823,8 +1002,31 @@ Timer_t *pxTimer = ( Timer_t * ) xTimer;
|
||||
void *pvTimerGetTimerID( const TimerHandle_t xTimer )
|
||||
{
|
||||
Timer_t * const pxTimer = ( Timer_t * ) xTimer;
|
||||
void *pvReturn;
|
||||
|
||||
return pxTimer->pvTimerID;
|
||||
configASSERT( xTimer );
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
pvReturn = pxTimer->pvTimerID;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
|
||||
return pvReturn;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID )
|
||||
{
|
||||
Timer_t * const pxTimer = ( Timer_t * ) xTimer;
|
||||
|
||||
configASSERT( xTimer );
|
||||
|
||||
taskENTER_CRITICAL();
|
||||
{
|
||||
pxTimer->pvTimerID = pvNewID;
|
||||
}
|
||||
taskEXIT_CRITICAL();
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
@@ -843,7 +1045,7 @@ Timer_t * const pxTimer = ( Timer_t * ) xTimer;
|
||||
xMessage.u.xCallbackParameters.ulParameter2 = ulParameter2;
|
||||
|
||||
xReturn = xQueueSendFromISR( xTimerQueue, &xMessage, pxHigherPriorityTaskWoken );
|
||||
|
||||
|
||||
tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, xReturn );
|
||||
|
||||
return xReturn;
|
||||
@@ -859,6 +1061,11 @@ Timer_t * const pxTimer = ( Timer_t * ) xTimer;
|
||||
DaemonTaskMessage_t xMessage;
|
||||
BaseType_t xReturn;
|
||||
|
||||
/* This function can only be called after a timer has been created or
|
||||
after the scheduler has been started because, until then, the timer
|
||||
queue does not exist. */
|
||||
configASSERT( xTimerQueue );
|
||||
|
||||
/* Complete the message with the function parameters and post it to the
|
||||
daemon task. */
|
||||
xMessage.xMessageID = tmrCOMMAND_EXECUTE_CALLBACK;
|
||||
@@ -869,7 +1076,7 @@ Timer_t * const pxTimer = ( Timer_t * ) xTimer;
|
||||
xReturn = xQueueSendToBack( xTimerQueue, &xMessage, xTicksToWait );
|
||||
|
||||
tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, xReturn );
|
||||
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# Select the board to build for: if not given on the command line,
|
||||
# then default to LAUNCHXL
|
||||
BOARD ?= LAUNCHXL
|
||||
# then default to WIPY
|
||||
BOARD ?= WIPY
|
||||
ifeq ($(wildcard boards/$(BOARD)/.),)
|
||||
$(error Invalid BOARD specified)
|
||||
endif
|
||||
|
||||
# Make 'release' the default build type
|
||||
BTYPE ?= release
|
||||
|
||||
# If the build directory is not given, make it reflect the board name.
|
||||
@@ -16,11 +17,11 @@ include ../py/mkenv.mk
|
||||
CROSS_COMPILE ?= arm-none-eabi-
|
||||
|
||||
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -march=armv7e-m -mabi=aapcs -mcpu=cortex-m4 -msoft-float -mfloat-abi=soft -fsingle-precision-constant -Wdouble-promotion
|
||||
CFLAGS = -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib $(CFLAGS_CORTEX_M4)
|
||||
CFLAGS = -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib $(CFLAGS_CORTEX_M4) -Os
|
||||
CFLAGS += -g -ffunction-sections -fdata-sections -fno-common -fsigned-char -mno-unaligned-access
|
||||
CFLAGS += -Iboards/$(BOARD)
|
||||
|
||||
LDFLAGS = -Wl,-nostdlib -Wl,--gc-sections -Wl,-Map=$@.map --specs=nano.specs
|
||||
LDFLAGS = -Wl,-nostdlib -Wl,--gc-sections -Wl,-Map=$@.map
|
||||
|
||||
ifeq ($(BTARGET), application)
|
||||
# qstr definitions (must come before including py.mk)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Build Instructions for the CC3200
|
||||
|
||||
Currently the CC3200 port of Micro Python builds under Linux and OSX and not under Windows.
|
||||
Currently the CC3200 port of MicroPython builds under Linux and OSX **but not under Windows**.
|
||||
|
||||
The tool chain required for the build can be found at <https://launchpad.net/gcc-arm-embedded>.
|
||||
|
||||
@@ -13,45 +13,55 @@ In order to debug the port specific code, optimizations need to be disabled on t
|
||||
port file (check the Makefile for specific details). You can use CCS from TI.
|
||||
Use the CC3200.ccxml file supplied with this distribution for the debuuger configuration.
|
||||
```bash
|
||||
make BTARGET=application BTYPE=debug
|
||||
make BTARGET=application BTYPE=debug BOARD=LAUNCHXL
|
||||
```
|
||||
## To build an image suitable to be flashed to the device:
|
||||
```bash
|
||||
make BTARGET=application BTYPE=release
|
||||
make BTARGET=application BTYPE=release BOARD=LAUNCHXL
|
||||
```
|
||||
## Building the bootloader
|
||||
```bash
|
||||
make BTARGET=bootloader BTYPE=release
|
||||
make BTARGET=bootloader BTYPE=release BOARD=LAUNCHXL
|
||||
```
|
||||
|
||||
## Regarding old revisions of the CC3200-LAUNCHXL
|
||||
First silicon (pre-release) revisions of the CC3200 had issues with the ram blocks, and MicroPython cannot run
|
||||
there. Make sure to use a **v4.1 (or higer) LAUNCHXL board** when trying this port, otherwise it won't work.
|
||||
|
||||
## Flashing the CC3200
|
||||
- Make sure that you have built both the *bootloader* and the *application* in **release** mode.
|
||||
- Make sure the SOP2 jumper is in position.
|
||||
- Open CCS_Uniflash and connect to the board (by default on port 22).
|
||||
- Format the serial flash (select 1MB size in case of the CC3200-LAUNCHXL, leave the rest unchecked).
|
||||
- Mark the following files for erasing: `/cert/ca.pem`, `/cert/client.pm`, `/cert/private.key` and `/tmp/pac.bin`.
|
||||
- Format the serial flash (select 1MB size in case of the CC3200-LAUNCHXL, 2MB in case of the WiPy, leave the rest unchecked).
|
||||
- Mark the following files for erasing: `/cert/ca.pem`, `/cert/client.pem`, `/cert/private.key` and `/tmp/pac.bin`.
|
||||
- Add a new file with the name of /sys/mcuimg.bin, and select the URL to point to cc3200\bootmgr\build\<BOARD_NAME>\bootloader.bin.
|
||||
- Add another file with the name of /sys/factimg.bin, and select the URL to point to cc3200\build\<BOARD_NAME>\MCUIMG.BIN.
|
||||
- Add another file with the name of /sys/factimg.bin, and select the URL to point to cc3200\build\<BOARD_NAME>\mcuimg.bin.
|
||||
- Click "Program" to apply all changes.
|
||||
- Flash the latest service pack (servicepack_1.0.0.1.2.bin) using the "Service Pack Update" button.
|
||||
- Flash the latest service pack (servicepack_1.0.0.10.0.bin) using the "Service Pack Update" button.
|
||||
- Close CCS_Uniflash, remove the SOP2 jumper and reset the board.
|
||||
|
||||
## Updating the board to with new software version
|
||||
- Make sure the board is running and connected to the same network as the computer.
|
||||
|
||||
```bash
|
||||
make BTARGET=application BTYPE=release BOARD=LAUNCHXL WIPY_IP=192.168.1.1 WIPY_USER=micro WIPY_PWD=python deploy
|
||||
```
|
||||
|
||||
If `WIPY_IP`, `WIPY_USER` or `WIPY_PWD` are omitted the default values (the ones shown above) will be used.
|
||||
|
||||
## Playing with MicroPython and the CC3200:
|
||||
|
||||
Once the software is running, you have two options to access the MicroPython REPL:
|
||||
|
||||
- Through the UART.
|
||||
**Connect to PORT 22, baud rate = 115200, parity = none, stop bits = 1**
|
||||
- Through telnet.
|
||||
* Connect to the network created by the board (as boots up in AP mode), **ssid = "micropy-wlan", key = "micropython"**
|
||||
* Connect to the network created by the board (as boots up in AP mode), **ssid = "wipy-wlan", key = "www.wipy.io"**.
|
||||
* You can also reinitialize the WLAN in station mode and connect to another AP, or in AP mode but with a
|
||||
different ssid and/or key.
|
||||
* Use your favourite telnet client with the following settings: **host = 192.168.1.1, port = 23.**
|
||||
* Log in with **user = "micro" and password = "python"**
|
||||
|
||||
The board has a small file system of 64K located in the serial flash connected to the CC3200. SD cards are also supported, but
|
||||
since the CC3200 LaunchXL doesn't come with an SD card socket installed, you will need to add one yourself. Any SD card breakout
|
||||
board will do, as long as you connect it as described here: <http://processors.wiki.ti.com/index.php/CC32xx_SDHost_FatFS>
|
||||
The board has a small file system of 192K (WiPy) or 64K (Launchpad) located in the serial flash connected to the CC3200.
|
||||
SD cards are also supported, you can connect any SD card and configure the pinout using the SD class API.
|
||||
|
||||
## Uploading scripts:
|
||||
|
||||
@@ -63,15 +73,15 @@ not 100% sure of it.
|
||||
|
||||
## Upgrading the firmware Over The Air:
|
||||
|
||||
OTA software updates can be performed through the FTP server. After building a new MCUIMG.BIN in release mode, upload it to:
|
||||
`/SFLASH/SYS/MCUIMG.BIN` it will take around 8s (The TI simplelink file system is quite slow because every file is mirrored for
|
||||
safety). You won't see the file being stored inside `/SFLASH/SYS/` because it's actually saved bypassing FatFS, but rest assured that
|
||||
OTA software updates can be performed through the FTP server. After building a new **mcuimg.bin** in release mode, upload it to:
|
||||
`/flash/sys/mcuimg.bin` it will take around 6s (The TI simplelink file system is quite slow because every file is mirrored for
|
||||
safety). You won't see the file being stored inside `/flash/sys/` because it's actually saved bypassing FatFS, but rest assured that
|
||||
the file was successfully transferred, and it has been signed with a MD5 checksum to verify its integrity.
|
||||
Now, reset the MCU by pressing the switch on the board, or by typing:
|
||||
|
||||
```python
|
||||
import pyb
|
||||
pyb.hard_reset()
|
||||
import machine
|
||||
machine.reset()
|
||||
```
|
||||
|
||||
### Note regarding FileZilla:
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
__stack_size__ = 2K; /* interrupts are handled within this stack */
|
||||
__min_heap_size__ = 8K;
|
||||
__rtos_heap_size = 16K;
|
||||
|
||||
MEMORY
|
||||
{
|
||||
|
||||
@@ -20,6 +20,8 @@ APP_INC += -I$(BUILD)
|
||||
APP_INC += -I$(BUILD)/genhdr
|
||||
APP_INC += -I../lib/fatfs
|
||||
APP_INC += -I../lib/mp-readline
|
||||
APP_INC += -I../lib/netutils
|
||||
APP_INC += -I../lib/timeutils
|
||||
APP_INC += -I../stmhal
|
||||
|
||||
APP_CPPDEFINES = -Dgcc -DTARGET_IS_CC3200 -DSL_FULL -DUSE_FREERTOS
|
||||
@@ -73,22 +75,24 @@ APP_HAL_SRC_C = $(addprefix hal/,\
|
||||
)
|
||||
|
||||
APP_MISC_SRC_C = $(addprefix misc/,\
|
||||
antenna.c \
|
||||
FreeRTOSHooks.c \
|
||||
pin_named_pins.c \
|
||||
help.c \
|
||||
mpcallback.c \
|
||||
mpirq.c \
|
||||
mperror.c \
|
||||
mpexception.c \
|
||||
mpsystick.c \
|
||||
pin_defs_cc3200.c \
|
||||
)
|
||||
|
||||
APP_MODS_SRC_C = $(addprefix mods/,\
|
||||
modmachine.c \
|
||||
modnetwork.c \
|
||||
modpyb.c \
|
||||
modubinascii.c \
|
||||
moduos.c \
|
||||
modusocket.c \
|
||||
modussl.c \
|
||||
modutime.c \
|
||||
modwipy.c \
|
||||
modwlan.c \
|
||||
pybadc.c \
|
||||
pybpin.c \
|
||||
@@ -97,6 +101,7 @@ APP_MODS_SRC_C = $(addprefix mods/,\
|
||||
pybsd.c \
|
||||
pybsleep.c \
|
||||
pybspi.c \
|
||||
pybtimer.c \
|
||||
pybuart.c \
|
||||
pybwdt.c \
|
||||
)
|
||||
@@ -122,6 +127,7 @@ APP_TELNET_SRC_C = $(addprefix telnet/,\
|
||||
)
|
||||
|
||||
APP_UTIL_SRC_C = $(addprefix util/,\
|
||||
cryptohash.c \
|
||||
fifo.c \
|
||||
gccollect.c \
|
||||
random.c \
|
||||
@@ -136,25 +142,30 @@ APP_UTIL_SRC_S = $(addprefix util/,\
|
||||
APP_MAIN_SRC_C = \
|
||||
main.c \
|
||||
mptask.c \
|
||||
mpthreadport.c \
|
||||
serverstask.c
|
||||
|
||||
APP_LIB_SRC_C = $(addprefix lib/,\
|
||||
fatfs/ff.c \
|
||||
fatfs/option/ccsbcs.c \
|
||||
libc/string0.c \
|
||||
mp-readline/readline.c \
|
||||
netutils/netutils.c \
|
||||
timeutils/timeutils.c \
|
||||
utils/pyexec.c \
|
||||
utils/pyhelp.c \
|
||||
utils/printf.c \
|
||||
)
|
||||
|
||||
APP_STM_SRC_C = $(addprefix stmhal/,\
|
||||
bufhelper.c \
|
||||
file.c \
|
||||
builtin_open.c \
|
||||
import.c \
|
||||
input.c \
|
||||
irq.c \
|
||||
lexerfatfs.c \
|
||||
moduselect.c \
|
||||
printf.c \
|
||||
pyexec.c \
|
||||
pybstdio.c \
|
||||
string0.c \
|
||||
)
|
||||
|
||||
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(APP_FATFS_SRC_C:.c=.o) $(APP_RTOS_SRC_C:.c=.o) $(APP_FTP_SRC_C:.c=.o) $(APP_HAL_SRC_C:.c=.o) $(APP_MISC_SRC_C:.c=.o))
|
||||
@@ -162,6 +173,12 @@ OBJ += $(addprefix $(BUILD)/, $(APP_MODS_SRC_C:.c=.o) $(APP_CC3100_SRC_C:.c=.o)
|
||||
OBJ += $(addprefix $(BUILD)/, $(APP_MAIN_SRC_C:.c=.o) $(APP_LIB_SRC_C:.c=.o) $(APP_STM_SRC_C:.c=.o))
|
||||
OBJ += $(BUILD)/pins.o
|
||||
|
||||
# List of sources for qstr extraction
|
||||
SRC_QSTR += $(APP_MODS_SRC_C) $(APP_MISC_SRC_C) $(APP_STM_SRC_C)
|
||||
# Append any auto-generated sources that are needed by sources listed in
|
||||
# SRC_QSTR
|
||||
SRC_QSTR_AUTO_DEPS +=
|
||||
|
||||
# Add the linker script
|
||||
LINKER_SCRIPT = application.lds
|
||||
LDFLAGS += -T $(LINKER_SCRIPT)
|
||||
@@ -174,30 +191,10 @@ $(BUILD)/drivers/cc3100/src/driver.o: CFLAGS += -fno-strict-aliasing
|
||||
|
||||
# Check if we would like to debug the port code
|
||||
ifeq ($(BTYPE), release)
|
||||
# Optimize everything and define the NDEBUG flag
|
||||
CFLAGS += -Os -DNDEBUG
|
||||
CFLAGS += -DNDEBUG
|
||||
else
|
||||
ifeq ($(BTYPE), debug)
|
||||
# Define the DEBUG flag
|
||||
CFLAGS += -DDEBUG=DEBUG
|
||||
# Optimize the stable sources only
|
||||
$(BUILD)/extmod/%.o: CFLAGS += -Os
|
||||
$(BUILD)/lib/%.o: CFLAGS += -Os
|
||||
$(BUILD)/fatfs/src/%.o: CFLAGS += -Os
|
||||
$(BUILD)/FreeRTOS/Source/%.o: CFLAGS += -Os
|
||||
$(BUILD)/ftp/%.o: CFLAGS += -Os
|
||||
$(BUILD)/hal/%.o: CFLAGS += -Os
|
||||
$(BUILD)/misc/%.o: CFLAGS += -Os
|
||||
$(BUILD)/py/%.o: CFLAGS += -Os
|
||||
$(BUILD)/simplelink/%.o: CFLAGS += -Os
|
||||
$(BUILD)/drivers/cc3100/%.o: CFLAGS += -Os
|
||||
$(BUILD)/stmhal/%.o: CFLAGS += -Os
|
||||
$(BUILD)/telnet/%.o: CFLAGS += -Os
|
||||
$(BUILD)/util/%.o: CFLAGS += -Os
|
||||
$(BUILD)/pins.o: CFLAGS += -Os
|
||||
$(BUILD)/main.o: CFLAGS += -Os
|
||||
$(BUILD)/mptask.o: CFLAGS += -Os
|
||||
$(BUILD)/servertask.o: CFLAGS += -Os
|
||||
CFLAGS += -DNDEBUG
|
||||
else
|
||||
$(error Invalid BTYPE specified)
|
||||
endif
|
||||
@@ -205,8 +202,18 @@ endif
|
||||
|
||||
SHELL = bash
|
||||
APP_SIGN = appsign.sh
|
||||
UPDATE_WIPY ?= tools/update-wipy.py
|
||||
WIPY_IP ?= '192.168.1.1'
|
||||
WIPY_USER ?= 'micro'
|
||||
WIPY_PWD ?= 'python'
|
||||
|
||||
all: $(BUILD)/MCUIMG.BIN
|
||||
all: $(BUILD)/mcuimg.bin
|
||||
|
||||
.PHONY: deploy
|
||||
|
||||
deploy: $(BUILD)/mcuimg.bin
|
||||
$(ECHO) "Writing $< to the board"
|
||||
$(Q)$(PYTHON) $(UPDATE_WIPY) --verify --ip $(WIPY_IP) --user $(WIPY_USER) --password $(WIPY_PWD) --file $<
|
||||
|
||||
$(BUILD)/application.axf: $(OBJ) $(LINKER_SCRIPT)
|
||||
$(ECHO) "LINK $@"
|
||||
@@ -217,9 +224,9 @@ $(BUILD)/application.bin: $(BUILD)/application.axf
|
||||
$(ECHO) "Create $@"
|
||||
$(Q)$(OBJCOPY) -O binary $< $@
|
||||
|
||||
$(BUILD)/MCUIMG.BIN: $(BUILD)/application.bin
|
||||
$(BUILD)/mcuimg.bin: $(BUILD)/application.bin
|
||||
$(ECHO) "Create $@"
|
||||
$(Q)$(SHELL) $(APP_SIGN) $(BOARD) $(BTYPE)
|
||||
$(Q)$(SHELL) $(APP_SIGN) $(BUILD)
|
||||
|
||||
MAKE_PINS = boards/make-pins.py
|
||||
BOARD_PINS = boards/$(BOARD)/pins.csv
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: appsign.sh *board type* *build type*"
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: appsign.sh *build dir*"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BOARD=$1
|
||||
BTYPE=$2
|
||||
|
||||
# Build location
|
||||
# Based on build type and board type
|
||||
BUILD=build/${BOARD}/${BTYPE}
|
||||
BUILD=$1
|
||||
|
||||
# Generate the MD5 hash
|
||||
# md5 on Darwin, md5sum on Unix
|
||||
if [ `uname -s` = "Darwin" ]; then
|
||||
echo -n `md5 -q $BUILD/application.bin` > __md5hash.bin
|
||||
else
|
||||
echo -n `md5sum --binary $BUILD/application.bin | awk '{ print $1 }'` > __md5hash.bin
|
||||
fi
|
||||
|
||||
# Concatenate it with the application binary
|
||||
cat $BUILD/application.bin __md5hash.bin > $BUILD/MCUIMG.BIN
|
||||
cat $BUILD/application.bin __md5hash.bin > $BUILD/mcuimg.bin
|
||||
RET=$?
|
||||
|
||||
# Remove the tmp files
|
||||
rm -f __md5hash.bin
|
||||
|
||||
# Remove hte unsigned binary
|
||||
# Remove the unsigned binary
|
||||
rm -f $BUILD/application.bin
|
||||
|
||||
exit $RET
|
||||
|
||||
@@ -30,21 +30,18 @@
|
||||
#define MICROPY_HW_BOARD_NAME "LaunchPad"
|
||||
#define MICROPY_HW_MCU_NAME "CC3200"
|
||||
|
||||
#define MICROPY_HW_HAS_SDCARD (0)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
#define MICROPY_HW_ANTENNA_DIVERSITY (0)
|
||||
|
||||
#define MICROPY_STDIO_UART PYB_UART_0
|
||||
#define MICROPY_STDIO_UART 0
|
||||
#define MICROPY_STDIO_UART_BAUD 115200
|
||||
#define MICROPY_STDIO_UART_RX_BUF_SIZE 128
|
||||
|
||||
#define MICROPY_SYS_LED_PRCM PRCM_GPIOA1
|
||||
#define MICROPY_SAFE_BOOT_PRCM PRCM_GPIOA2
|
||||
#define MICROPY_SYS_LED_PORT GPIOA1_BASE
|
||||
#define MICROPY_SAFE_BOOT_PORT GPIOA2_BASE
|
||||
#define MICROPY_SYS_LED_GPIO pin_GPIO9
|
||||
#define MICROPY_SYS_LED_PIN_NUM PIN_64 // GPIO9
|
||||
#define MICROPY_SAFE_BOOT_PIN_NUM PIN_15 // GPIO22
|
||||
#define MICROPY_SYS_LED_GPIO pin_GP9
|
||||
#define MICROPY_SYS_LED_PIN_NUM PIN_64 // GP9
|
||||
#define MICROPY_SAFE_BOOT_PIN_NUM PIN_15 // GP22
|
||||
#define MICROPY_SYS_LED_PORT_PIN GPIO_PIN_1
|
||||
#define MICROPY_SAFE_BOOT_PORT_PIN GPIO_PIN_6
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define LAUNCHXL
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "WiPy-SD"
|
||||
#define MICROPY_HW_MCU_NAME "CC3200"
|
||||
|
||||
#define MICROPY_HW_HAS_SDCARD (1)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
|
||||
#define MICROPY_STDIO_UART PYB_UART_0
|
||||
#define MICROPY_STDIO_UART_BAUD 115200
|
||||
#define MICROPY_STDIO_UART_RX_BUF_SIZE 128
|
||||
|
||||
#define MICROPY_SYS_LED_PRCM PRCM_GPIOA3
|
||||
#define MICROPY_SAFE_BOOT_PRCM PRCM_GPIOA3
|
||||
#define MICROPY_SYS_LED_PORT GPIOA3_BASE
|
||||
#define MICROPY_SAFE_BOOT_PORT GPIOA3_BASE
|
||||
#define MICROPY_SYS_LED_GPIO pin_GPIO25
|
||||
#define MICROPY_SYS_LED_PIN_NUM PIN_21 // GPIO25 (SOP2)
|
||||
#define MICROPY_SAFE_BOOT_PIN_NUM PIN_18 // GPIO28
|
||||
#define MICROPY_SYS_LED_PORT_PIN GPIO_PIN_1
|
||||
#define MICROPY_SAFE_BOOT_PORT_PIN GPIO_PIN_4
|
||||
|
||||
#define MICROPY_PORT_SFLASH_BLOCK_COUNT 96
|
||||
@@ -1,25 +0,0 @@
|
||||
L2,GPIO2
|
||||
L3,GPIO1
|
||||
L4,GPIO23
|
||||
L5,GPIO24
|
||||
L6,GPIO11
|
||||
L7,GPIO12
|
||||
L8,GPIO13
|
||||
L9,GPIO14
|
||||
L10,GPIO15
|
||||
L11,GPIO16
|
||||
L12,GPIO17
|
||||
L13,GPIO22
|
||||
L14,GPIO28
|
||||
R4,GPIO10
|
||||
R5,GPIO9
|
||||
R6,GPIO8
|
||||
R7,GPIO7
|
||||
R8,GPIO6
|
||||
R9,GPIO30
|
||||
R10,GPIO31
|
||||
R11,GPIO3
|
||||
R12,GPIO0
|
||||
R13,GPIO4
|
||||
R14,GPIO5
|
||||
HBL,GPIO25
|
||||
|
@@ -25,26 +25,20 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define LAUNCHXL
|
||||
#define WIPY
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "WiPy"
|
||||
#define MICROPY_HW_MCU_NAME "CC3200"
|
||||
|
||||
#define MICROPY_HW_HAS_SDCARD (0)
|
||||
#define MICROPY_HW_ENABLE_RNG (1)
|
||||
#define MICROPY_HW_ENABLE_RTC (1)
|
||||
|
||||
#define MICROPY_STDIO_UART PYB_UART_0
|
||||
#define MICROPY_STDIO_UART_BAUD 115200
|
||||
#define MICROPY_STDIO_UART_RX_BUF_SIZE 128
|
||||
#define MICROPY_HW_ANTENNA_DIVERSITY (1)
|
||||
|
||||
#define MICROPY_SYS_LED_PRCM PRCM_GPIOA3
|
||||
#define MICROPY_SAFE_BOOT_PRCM PRCM_GPIOA3
|
||||
#define MICROPY_SYS_LED_PORT GPIOA3_BASE
|
||||
#define MICROPY_SAFE_BOOT_PORT GPIOA3_BASE
|
||||
#define MICROPY_SYS_LED_GPIO pin_GPIO25
|
||||
#define MICROPY_SYS_LED_PIN_NUM PIN_21 // GPIO25 (SOP2)
|
||||
#define MICROPY_SAFE_BOOT_PIN_NUM PIN_18 // GPIO28
|
||||
#define MICROPY_SYS_LED_GPIO pin_GP25
|
||||
#define MICROPY_SYS_LED_PIN_NUM PIN_21 // GP25 (SOP2)
|
||||
#define MICROPY_SAFE_BOOT_PIN_NUM PIN_18 // GP28
|
||||
#define MICROPY_SYS_LED_PORT_PIN GPIO_PIN_1
|
||||
#define MICROPY_SAFE_BOOT_PORT_PIN GPIO_PIN_4
|
||||
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
L2,GPIO2
|
||||
L3,GPIO1
|
||||
L4,GPIO23
|
||||
L5,GPIO24
|
||||
L6,GPIO11
|
||||
L7,GPIO12
|
||||
L8,GPIO13
|
||||
L9,GPIO14
|
||||
L10,GPIO15
|
||||
L11,GPIO16
|
||||
L12,GPIO17
|
||||
L13,GPIO22
|
||||
L14,GPIO28
|
||||
R4,GPIO10
|
||||
R5,GPIO9
|
||||
R6,GPIO8
|
||||
R7,GPIO7
|
||||
R8,GPIO6
|
||||
R9,GPIO30
|
||||
R10,GPIO31
|
||||
R11,GPIO3
|
||||
R12,GPIO0
|
||||
R13,GPIO4
|
||||
R14,GPIO5
|
||||
HBL,GPIO25
|
||||
L2,GP2
|
||||
L3,GP1
|
||||
L4,GP23
|
||||
L5,GP24
|
||||
L6,GP11
|
||||
L7,GP12
|
||||
L8,GP13
|
||||
L9,GP14
|
||||
L10,GP15
|
||||
L11,GP16
|
||||
L12,GP17
|
||||
L13,GP22
|
||||
L14,GP28
|
||||
R4,GP10
|
||||
R5,GP9
|
||||
R6,GP8
|
||||
R7,GP7
|
||||
R8,GP6
|
||||
R9,GP30
|
||||
R10,GP31
|
||||
R11,GP3
|
||||
R12,GP0
|
||||
R13,GP4
|
||||
R14,GP5
|
||||
HBL,GP25
|
||||
|
||||
|
@@ -1,25 +1,25 @@
|
||||
Pin,Name,Default,AF0,AF1,AF2,AF3,AF4,AF5,AF6,AF7,AF8,AF9,AF10,AF11,AF12,AF13,AF14,AF15,ADC
|
||||
1,GPIO10,GPIO10,GPIO10,I2C_SCL,,GT_PWM06,,,SDCARD_CLK,UART1_TX,,,,,GT_CCP01,,,,
|
||||
2,GPIO11,GPIO11,GPIO11,I2C_SDA,,GT_PWM07,pXCLK(XVCLK),,SDCARD_CMD,UART1_RX,,,,,GT_CCP02,McAFSX,,,
|
||||
3,GPIO12,GPIO12,GPIO12,,,McACLK,pVS(VSYNC),I2C_SCL,,UART0_TX,,,,,GT_CCP03,,,,
|
||||
4,GPIO13,GPIO13,GPIO13,,,,pHS(HSYNC),I2C_SDA,,UART0_RX,,,,,GT_CCP04,,,,
|
||||
5,GPIO14,GPIO14,GPIO14,,,,pDATA8(CAM_D4),2C_SCL,,GSPI_CLK,,,,,GT_CCP05,,,,
|
||||
6,GPIO15,GPIO15,GPIO15,,,,pDATA9(CAM_D5),I2C_SDA,,GSPI_MISO,,,,,,GT_CCP06,,,
|
||||
7,GPIO16,GPIO16,GPIO16,,,,pDATA10(CAM_D6),UART1_TX,,GSPI_MOSI,,,,,,GT_CCP07,,,
|
||||
8,GPIO17,GPIO17,GPIO17,,,,pDATA11(CAM_D7),UART1_RX,,GSPI_CS,,,,,,,,,
|
||||
1,GP10,GP10,GP10,I2C0_SCL,,TIM3_PWM,,,SD0_CLK,UART1_TX,,,,,TIM0_CC,,,,
|
||||
2,GP11,GP11,GP11,I2C0_SDA,,TIM3_PWM,pXCLK(XVCLK),,SD0_CMD,UART1_RX,,,,,TIM1_CC,I2S0_FS,,,
|
||||
3,GP12,GP12,GP12,,,I2S0_CLK,pVS(VSYNC),I2C0_SCL,,UART0_TX,,,,,TIM1_CC,,,,
|
||||
4,GP13,GP13,GP13,,,,pHS(HSYNC),I2C0_SDA,,UART0_RX,,,,,TIM2_CC,,,,
|
||||
5,GP14,GP14,GP14,,,,pDATA8(CAM_D4),I2C0_SCL,,SPI0_CLK,,,,,TIM2_CC,,,,
|
||||
6,GP15,GP15,GP15,,,,pDATA9(CAM_D5),I2C0_SDA,,SPI0_MISO,SD0_DAT0,,,,,TIM3_CC,,,
|
||||
7,GP16,GP16,GP16,,,,pDATA10(CAM_D6),UART1_TX,,SPI0_MOSI,SD0_CLK,,,,,TIM3_CC,,,
|
||||
8,GP17,GP17,GP17,,,,pDATA11(CAM_D7),UART1_RX,,SPI0_CS0,SD0_CMD,,,,,,,,
|
||||
9,VDD_DIG1,VDD_DIG1,VDD_DIG1,,,,,,,,,,,,,,,,
|
||||
10,VIN_IO1,VIN_IO1,VIN_IO1,,,,,,,,,,,,,,,,
|
||||
11,FLASH_SPI_CLK,FLASH_SPI_CLK,FLASH_SPI_CLK,,,,,,,,,,,,,,,,
|
||||
12,FLASH_SPI_DOUT,FLASH_SPI_DOUT,FLASH_SPI_DOUT,,,,,,,,,,,,,,,,
|
||||
13,FLASH_SPI_DIN,FLASH_SPI_DIN,FLASH_SPI_DIN,,,,,,,,,,,,,,,,
|
||||
14,FLASH_SPI_CS,FLASH_SPI_CS,FLASH_SPI_CS,,,,,,,,,,,,,,,,
|
||||
15,GPIO22,GPIO22,GPIO22,,,,,GT_CCP04,,McAFSX,,,,,,,,,
|
||||
16,GPIO23,TDI,GPIO23,TDI,UART1_TX,,,,,,,2C_SCL,,,,,,,
|
||||
17,GPIO24,TDO,GPIO24,TDO,UART1_RX,,GT_CCP06,PWM0,McAFSX,,,I2C_SDA,,,,,,,
|
||||
18,GPIO28,GPIO28,GPIO28,,,,,,,,,,,,,,,,
|
||||
19,TCK,TCK,,TCK,,,,,,,GT_PWM03,,,,,,,,
|
||||
20,GPIO29,TMS,GPIO29,TMS,,,,,,,,,,,,,,,
|
||||
21,GPIO25,SOP2,GPIO25,,McAFSX,,,,,,,GT_PWM02,,,,,,,
|
||||
15,GP22,GP22,GP22,,,,,TIM2_CC,,I2S0_FS,,,,,,,,,
|
||||
16,GP23,TDI,GP23,TDI,UART1_TX,,,,,,,I2C0_SCL,,,,,,,
|
||||
17,GP24,TDO,GP24,TDO,UART1_RX,,TIM3_CC,TIM0_PWM,I2S0_FS,,,I2C0_SDA,,,,,,,
|
||||
18,GP28,GP28,GP28,,,,,,,,,,,,,,,,
|
||||
19,TCK,TCK,,TCK,,,,,,,TIM1_PWM,,,,,,,,
|
||||
20,GP29,TMS,GP29,TMS,,,,,,,,,,,,,,,
|
||||
21,GP25,SOP2,GP25,,I2S0_FS,,,,,,,TIM1_PWM,,,,,,,
|
||||
22,WLAN_XTAL_N,WLAN_XTAL_N,WLAN_XTAL_N,,,,,,,,,,,,,,,,
|
||||
23,WLAN_XTAL_P,WLAN_XTAL_P,WLAN_XTAL_P,,,,,,,,,,,,,,,,
|
||||
24,VDD_PLL,VDD_PLL,VDD_PLL,,,,,,,,,,,,,,,,
|
||||
@@ -43,24 +43,24 @@ Pin,Name,Default,AF0,AF1,AF2,AF3,AF4,AF5,AF6,AF7,AF8,AF9,AF10,AF11,AF12,AF13,AF1
|
||||
42,DCDC_PA_OUT,DCDC_PA_O UT,DCDC_PA_O UT,,,,,,,,,,,,,,,,
|
||||
43,DCDC_DIG_SW,DCDC_DIG_ SW,DCDC_DIG_ SW,,,,,,,,,,,,,,,,
|
||||
44,VIN_DCDC_DIG,VIN_DCDC_ DIG,VIN_DCDC_ DIG,,,,,,,,,,,,,,,,
|
||||
45,GPIO31,DCDC_ANA2_SW_P,GPIO31,,UART1_RX,,,,McAXR0,GSPI_CLK,,UART0_RX,,,McAFSX,,,,
|
||||
45,GP31,DCDC_ANA2_SW_P,GP31,,UART1_RX,,,,I2S0_DAT0,SPI0_CLK,,UART0_RX,,,I2S0_FS,,,,
|
||||
46,DCDC_ANA2_SW_N,DCDC_ANA2_SW_N,DCDC_ANA2_SW_N,,,,,,,,,,,,,,,,
|
||||
47,VDD_ANA2,VDD_ANA2,VDD_ANA2,,,,,,,,,,,,,,,,
|
||||
48,VDD_ANA1,VDD_ANA1,VDD_ANA1,,,,,,,,,,,,,,,,
|
||||
49,VDD_RAM,VDD_RAM,VDD_RAM,,,,,,,,,,,,,,,,
|
||||
50,GPIO0,GPIO0,GPIO0,,,UART0_RTS,McAXR0,,McAXR1,GT_CCP00,,GSPI_CS,UART1_RTS,,UART0_CTS,,,,
|
||||
50,GP0,GP0,GP0,,,UART0_RTS,I2S0_DAT0,,I2S0_DAT1,TIM0_CC,,SPI0_CS0,UART1_RTS,,UART0_CTS,,,,
|
||||
51,RTC_XTAL_P,RTC_XTAL_P,RTC_XTAL_P,,,,,,,,,,,,,,,,
|
||||
52,RTC_XTAL_N,RTC_XTAL_N,GPIO32,,McACLK,,McAXR0,,UART0_RTS,,GSPI_MOSI,,,,,,,,
|
||||
53,GPIO30,GPIO30,GPIO30,,McACLK,McAFSX,GT_CCP05,,,GSPI_MISO,,UART0_TX,,,,,,,
|
||||
52,RTC_XTAL_N,RTC_XTAL_N,GP32,,I2S0_CLK,,I2S0_DAT0,,UART0_RTS,,SPI0_MOSI,,,,,,,,
|
||||
53,GP30,GP30,GP30,,I2S0_CLK,I2S0_FS,TIM2_CC,,,SPI0_MISO,,UART0_TX,,,,,,,
|
||||
54,VIN_IO2,VIN_IO2,VIN_IO2,,,,,,,,,,,,,,,,
|
||||
55,GPIO1,GPIO1,GPIO1,,,GSPI_MISO,pCLK (PIXCLK),,UART1_TX,GT_CCP01,,,,,,,,,
|
||||
55,GP1,GP1,GP1,,,UART0_TX,pCLK (PIXCLK),,UART1_TX,TIM0_CC,,,,,,,,,
|
||||
56,VDD_DIG2,VDD_DIG2,VDD_DIG2,,,,,,,,,,,,,,,,
|
||||
57,GPIO2,GPIO2,GPIO2,,,UART0_RX,,,UART1_RX,GT_CCP02,,,,,,,,,ADC_CH0
|
||||
58,GPIO3,GPIO3,GPIO3,,,,pDATA7(CAM_D3),,UART1_TX,,,,,,,,,,ADC_CH1
|
||||
59,GPIO4,GPIO4,GPIO4,,,,pDATA6(CAM_D2),,UART1_RX,,,,,,,,,,ADC_CH2
|
||||
60,GPIO5,GPIO5,GPIO5,,,,pDATA5(CAM_D1),,McAXR1,GT_CCP05,,,,,,,,,ADC_CH3
|
||||
61,GPIO6,GPIO6,GPIO6,,,UART1_CTS,pDATA4(CAM_D0),UART0_RTS,UART0_CTS,GT_CCP06,,,,,,,,,
|
||||
62,GPIO7,GPIO7,GPIO7,,,UART1_RTS,,,,,,,UART0_RTS,UART0_TX,,McACLKX,,,
|
||||
63,GPIO8,GPIO8,GPIO8,,,,,,SDCARD_IRQ,McAFSX,,,,,GT_CCP06,,,,
|
||||
64,GPIO9,GPIO9,GPIO9,,,GT_PWM05,,,SDCARD_DATA,McAXR0,,,,,GT_CCP00,,,,
|
||||
57,GP2,GP2,GP2,,,UART0_RX,,,UART1_RX,TIM1_CC,,,,,,,,,ADC0_CH0
|
||||
58,GP3,GP3,GP3,,,,pDATA7(CAM_D3),,UART1_TX,,,,,,,,,,ADC0_CH1
|
||||
59,GP4,GP4,GP4,,,,pDATA6(CAM_D2),,UART1_RX,,,,,,,,,,ADC0_CH2
|
||||
60,GP5,GP5,GP5,,,,pDATA5(CAM_D1),,I2S0_DAT1,TIM2_CC,,,,,,,,,ADC0_CH3
|
||||
61,GP6,GP6,GP6,,,UART1_CTS,pDATA4(CAM_D0),UART0_RTS,UART0_CTS,TIM3_CC,,,,,,,,,
|
||||
62,GP7,GP7,GP7,,,UART1_RTS,,,,,,,UART0_RTS,UART0_TX,,I2S0_CLK,,,
|
||||
63,GP8,GP8,GP8,,,,,,SD0_IRQ,I2S0_FS,,,,,TIM3_CC,,,,
|
||||
64,GP9,GP9,GP9,,,TIM2_PWM,,,SD0_DAT0,I2S0_DAT0,,,,,TIM0_CC,,,,
|
||||
65,GND_TAB,GND_TAB,GND_TAB,,,,,,,,,,,,,,,,
|
||||
|
||||
|
@@ -39,16 +39,31 @@
|
||||
#include "pybpin.h"
|
||||
|
||||
|
||||
#define PIN(p_pin_name, p_port, p_bit, p_pin_num) \
|
||||
#define AF(af_name, af_idx, af_fn, af_unit, af_type) \
|
||||
{ \
|
||||
.name = MP_QSTR_ ## af_name, \
|
||||
.idx = (af_idx), \
|
||||
.fn = PIN_FN_ ## af_fn, \
|
||||
.unit = (af_unit), \
|
||||
.type = PIN_TYPE_ ## af_fn ## _ ## af_type, \
|
||||
}
|
||||
|
||||
|
||||
#define PIN(p_pin_name, p_port, p_bit, p_pin_num, p_af_list, p_num_afs) \
|
||||
{ \
|
||||
{ &pin_type }, \
|
||||
.name = MP_QSTR_ ## p_pin_name, \
|
||||
.port = PORT_A ## p_port, \
|
||||
.type = PIN_TYPE_STD, \
|
||||
.bit = (p_bit), \
|
||||
.pin_num = (p_pin_num), \
|
||||
.af = PIN_MODE_0, \
|
||||
.strength = PIN_STRENGTH_4MA, \
|
||||
.mode = GPIO_DIR_MODE_IN, \
|
||||
.isused = false, \
|
||||
.name = MP_QSTR_ ## p_pin_name, \
|
||||
.port = PORT_A ## p_port, \
|
||||
.af_list = (p_af_list), \
|
||||
.pull = PIN_TYPE_STD, \
|
||||
.bit = (p_bit), \
|
||||
.pin_num = (p_pin_num), \
|
||||
.af = PIN_MODE_0, \
|
||||
.strength = PIN_STRENGTH_4MA, \
|
||||
.mode = GPIO_DIR_MODE_IN, \
|
||||
.num_afs = (p_num_afs), \
|
||||
.value = 0, \
|
||||
.used = false, \
|
||||
.irq_trigger = 0, \
|
||||
.irq_flags = 0, \
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
"""Generates the pins files for the CC3200."""
|
||||
"""Generates the pins file for the CC3200."""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
@@ -8,20 +8,44 @@ import sys
|
||||
import csv
|
||||
|
||||
|
||||
SUPPORTED_AFS = { 'UART': ('TX', 'RX', 'RTS', 'CTS'),
|
||||
'SPI': ('CLK', 'MOSI', 'MISO', 'CS0'),
|
||||
#'I2S': ('CLK', 'FS', 'DAT0', 'DAT1'),
|
||||
'I2C': ('SDA', 'SCL'),
|
||||
'TIM': ('PWM'),
|
||||
'SD': ('CLK', 'CMD', 'DAT0'),
|
||||
'ADC': ('CH0', 'CH1', 'CH2', 'CH3')
|
||||
}
|
||||
|
||||
def parse_port_pin(name_str):
|
||||
"""Parses a string and returns a (port, gpio_bit) tuple."""
|
||||
if len(name_str) < 5:
|
||||
raise ValueError("Expecting pin name to be at least 5 characters")
|
||||
if name_str[:4] != 'GPIO':
|
||||
raise ValueError("Expecting pin name to start with GPIO")
|
||||
if not name_str[4:].isdigit():
|
||||
if len(name_str) < 3:
|
||||
raise ValueError("Expecting pin name to be at least 3 characters")
|
||||
if name_str[:2] != 'GP':
|
||||
raise ValueError("Expecting pin name to start with GP")
|
||||
if not name_str[2:].isdigit():
|
||||
raise ValueError("Expecting numeric GPIO number")
|
||||
port = int(int(name_str[4:]) / 8)
|
||||
gpio_bit = 1 << int(int(name_str[4:]) % 8)
|
||||
port = int(int(name_str[2:]) / 8)
|
||||
gpio_bit = 1 << int(int(name_str[2:]) % 8)
|
||||
return (port, gpio_bit)
|
||||
|
||||
|
||||
class Pin(object):
|
||||
class AF:
|
||||
"""Holds the description of an alternate function"""
|
||||
def __init__(self, name, idx, fn, unit, type):
|
||||
self.name = name
|
||||
self.idx = idx
|
||||
if self.idx > 15:
|
||||
self.idx = -1
|
||||
self.fn = fn
|
||||
self.unit = unit
|
||||
self.type = type
|
||||
|
||||
def print(self):
|
||||
print (' AF({:16s}, {:4d}, {:8s}, {:4d}, {:8s}), // {}'.format(self.name, self.idx, self.fn, self.unit, self.type, self.name))
|
||||
|
||||
|
||||
class Pin:
|
||||
"""Holds the information associated with a pin."""
|
||||
def __init__(self, name, port, gpio_bit, pin_num):
|
||||
self.name = name
|
||||
@@ -29,45 +53,48 @@ class Pin(object):
|
||||
self.gpio_bit = gpio_bit
|
||||
self.pin_num = pin_num
|
||||
self.board_pin = False
|
||||
self.afs = []
|
||||
|
||||
def cpu_pin_name(self):
|
||||
return self.name
|
||||
|
||||
def is_board_pin(self):
|
||||
return self.board_pin
|
||||
|
||||
def set_is_board_pin(self):
|
||||
self.board_pin = True
|
||||
def add_af(self, af):
|
||||
self.afs.append(af)
|
||||
|
||||
def print(self):
|
||||
print('pin_obj_t pin_{:6s} = PIN({:6s}, {:1d}, {:3d}, {:2d});'.format(
|
||||
self.name, self.name, self.port, self.gpio_bit, self.pin_num))
|
||||
print('// {}'.format(self.name))
|
||||
if len(self.afs):
|
||||
print('const pin_af_t pin_{}_af[] = {{'.format(self.name))
|
||||
for af in self.afs:
|
||||
af.print()
|
||||
print('};')
|
||||
print('pin_obj_t pin_{:4s} = PIN({:6s}, {:1d}, {:3d}, {:2d}, pin_{}_af, {});\n'.format(
|
||||
self.name, self.name, self.port, self.gpio_bit, self.pin_num, self.name, len(self.afs)))
|
||||
else:
|
||||
print('pin_obj_t pin_{:4s} = PIN({:6s}, {:1d}, {:3d}, {:2d}, NULL, 0);\n'.format(
|
||||
self.name, self.name, self.port, self.gpio_bit, self.pin_num))
|
||||
|
||||
def print_header(self, hdr_file):
|
||||
hdr_file.write('extern pin_obj_t pin_{:s};\n'.format(self.name))
|
||||
|
||||
|
||||
class Pins(object):
|
||||
|
||||
class Pins:
|
||||
def __init__(self):
|
||||
self.cpu_pins = [] # list of pin objects
|
||||
self.board_pins = [] # list of pin objects
|
||||
|
||||
def find_pin(self, port, gpio_bit):
|
||||
for pin in self.cpu_pins:
|
||||
for pin in self.board_pins:
|
||||
if pin.port == port and pin.gpio_bit == gpio_bit:
|
||||
return pin
|
||||
|
||||
def find_pin_by_num(self, pin_num):
|
||||
for pin in self.cpu_pins:
|
||||
for pin in self.board_pins:
|
||||
if pin.pin_num == pin_num:
|
||||
return pin
|
||||
|
||||
def find_pin_by_name(self, name):
|
||||
for pin in self.cpu_pins:
|
||||
for pin in self.board_pins:
|
||||
if pin.name == name:
|
||||
return pin
|
||||
|
||||
def parse_af_file(self, filename, pin_col, pinname_col):
|
||||
def parse_af_file(self, filename, pin_col, pinname_col, af_start_col):
|
||||
with open(filename, 'r') as csvfile:
|
||||
rows = csv.reader(csvfile)
|
||||
for row in rows:
|
||||
@@ -76,11 +103,21 @@ class Pins(object):
|
||||
except:
|
||||
continue
|
||||
if not row[pin_col].isdigit():
|
||||
raise ValueError("Invalid pin number: {:s} in row {:s}".format(row[pin_col]), row)
|
||||
raise ValueError("Invalid pin number {:s} in row {:s}".format(row[pin_col]), row)
|
||||
# Pin numbers must start from 0 when used with the TI API
|
||||
pin_num = int(row[pin_col]) - 1;
|
||||
pin = Pin(row[pinname_col], port_num, gpio_bit, pin_num)
|
||||
self.cpu_pins.append(pin)
|
||||
self.board_pins.append(pin)
|
||||
af_idx = 0
|
||||
for af in row[af_start_col:]:
|
||||
af_splitted = af.split('_')
|
||||
fn_name = af_splitted[0].rstrip('0123456789')
|
||||
if fn_name in SUPPORTED_AFS:
|
||||
type_name = af_splitted[1]
|
||||
if type_name in SUPPORTED_AFS[fn_name]:
|
||||
unit_idx = af_splitted[0][-1]
|
||||
pin.add_af(AF(af, af_idx, fn_name, int(unit_idx), type_name))
|
||||
af_idx += 1
|
||||
|
||||
def parse_board_file(self, filename, cpu_pin_col):
|
||||
with open(filename, 'r') as csvfile:
|
||||
@@ -92,37 +129,44 @@ class Pins(object):
|
||||
else:
|
||||
pin = self.find_pin_by_name(row[cpu_pin_col])
|
||||
if pin:
|
||||
pin.set_is_board_pin()
|
||||
pin.board_pin = True
|
||||
|
||||
def print_named(self, label, pins):
|
||||
print('')
|
||||
print('STATIC const mp_map_elem_t pin_{:s}_pins_locals_dict_table[] = {{'.format(label))
|
||||
for pin in pins:
|
||||
if pin.is_board_pin():
|
||||
print(' {{ MP_OBJ_NEW_QSTR(MP_QSTR_{:6s}), (mp_obj_t)&pin_{:6s} }},'.format(pin.cpu_pin_name(), pin.cpu_pin_name()))
|
||||
if pin.board_pin:
|
||||
print(' {{ MP_OBJ_NEW_QSTR(MP_QSTR_{:6s}), (mp_obj_t)&pin_{:6s} }},'.format(pin.name, pin.name))
|
||||
print('};')
|
||||
print('MP_DEFINE_CONST_DICT(pin_{:s}_pins_locals_dict, pin_{:s}_pins_locals_dict_table);'.format(label, label));
|
||||
|
||||
def print(self):
|
||||
for pin in self.cpu_pins:
|
||||
if pin.is_board_pin():
|
||||
for pin in self.board_pins:
|
||||
if pin.board_pin:
|
||||
pin.print()
|
||||
self.print_named('cpu', self.cpu_pins)
|
||||
self.print_named('board', self.board_pins)
|
||||
print('')
|
||||
|
||||
def print_header(self, hdr_filename):
|
||||
with open(hdr_filename, 'wt') as hdr_file:
|
||||
for pin in self.cpu_pins:
|
||||
if pin.is_board_pin():
|
||||
for pin in self.board_pins:
|
||||
if pin.board_pin:
|
||||
pin.print_header(hdr_file)
|
||||
|
||||
def print_qstr(self, qstr_filename):
|
||||
with open(qstr_filename, 'wt') as qstr_file:
|
||||
qstr_set = set([])
|
||||
for pin in self.cpu_pins:
|
||||
if pin.is_board_pin():
|
||||
qstr_set |= set([pin.cpu_pin_name()])
|
||||
for qstr in sorted(qstr_set):
|
||||
pin_qstr_set = set([])
|
||||
af_qstr_set = set([])
|
||||
for pin in self.board_pins:
|
||||
if pin.board_pin:
|
||||
pin_qstr_set |= set([pin.name])
|
||||
for af in pin.afs:
|
||||
af_qstr_set |= set([af.name])
|
||||
print('// Board pins', file=qstr_file)
|
||||
for qstr in sorted(pin_qstr_set):
|
||||
print('Q({})'.format(qstr), file=qstr_file)
|
||||
print('\n// Pin AFs', file=qstr_file)
|
||||
for qstr in sorted(af_qstr_set):
|
||||
print('Q({})'.format(qstr), file=qstr_file)
|
||||
|
||||
|
||||
@@ -169,12 +213,12 @@ def main():
|
||||
print('//')
|
||||
if args.af_filename:
|
||||
print('// --af {:s}'.format(args.af_filename))
|
||||
pins.parse_af_file(args.af_filename, 0, 1)
|
||||
pins.parse_af_file(args.af_filename, 0, 1, 3)
|
||||
|
||||
if args.board_filename:
|
||||
print('// --board {:s}'.format(args.board_filename))
|
||||
pins.parse_board_file(args.board_filename, 1)
|
||||
|
||||
pins.parse_board_file(args.board_filename, 1)
|
||||
|
||||
if args.prefix_filename:
|
||||
print('// --prefix {:s}'.format(args.prefix_filename))
|
||||
print('')
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: bootgen.sh *board type* *build type*"
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: bootgen.sh *build dir*"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BOARD=$1
|
||||
BTYPE=$2
|
||||
BUILD=$1
|
||||
|
||||
# Re-locator Path
|
||||
RELOCATOR=bootmgr/relocator
|
||||
|
||||
# Boot Manager Path
|
||||
# First parameter passed is the board type
|
||||
BOOTMGR=bootmgr/build/${BOARD}/${BTYPE}
|
||||
# Build location
|
||||
BOOTMGR=${BUILD}
|
||||
|
||||
# Check for re-locator binary
|
||||
if [ ! -f $RELOCATOR/relocator.bin ]; then
|
||||
|
||||
@@ -19,6 +19,7 @@ BOOT_CPPDEFINES = -Dgcc -DBOOTLOADER -DTARGET_IS_CC3200 -DSL_TINY
|
||||
BOOT_HAL_SRC_C = $(addprefix hal/,\
|
||||
cpu.c \
|
||||
interrupt.c \
|
||||
gpio.c \
|
||||
pin.c \
|
||||
prcm.c \
|
||||
shamd5.c \
|
||||
@@ -42,6 +43,7 @@ BOOT_CC3100_SRC_C = $(addprefix drivers/cc3100/,\
|
||||
)
|
||||
|
||||
BOOT_MISC_SRC_C = $(addprefix misc/,\
|
||||
antenna.c \
|
||||
mperror.c \
|
||||
)
|
||||
|
||||
@@ -50,7 +52,7 @@ BOOT_SL_SRC_C = $(addprefix simplelink/,\
|
||||
)
|
||||
|
||||
BOOT_UTIL_SRC_C = $(addprefix util/,\
|
||||
hash.c \
|
||||
cryptohash.c \
|
||||
)
|
||||
|
||||
BOOT_MAIN_SRC_C = \
|
||||
@@ -60,17 +62,17 @@ BOOT_MAIN_SRC_S = \
|
||||
bootmgr/runapp.s
|
||||
|
||||
BOOT_PY_SRC_C = $(addprefix py/,\
|
||||
pfenv.c \
|
||||
pfenv_printf.c \
|
||||
mpprint.c \
|
||||
)
|
||||
|
||||
BOOT_STM_SRC_C = $(addprefix stmhal/,\
|
||||
printf.c \
|
||||
string0.c \
|
||||
BOOT_LIB_SRC_C = $(addprefix lib/,\
|
||||
libc/string0.c \
|
||||
utils/printf.c \
|
||||
)
|
||||
|
||||
|
||||
OBJ = $(addprefix $(BUILD)/, $(BOOT_HAL_SRC_C:.c=.o) $(BOOT_SL_SRC_C:.c=.o) $(BOOT_CC3100_SRC_C:.c=.o) $(BOOT_UTIL_SRC_C:.c=.o) $(BOOT_MISC_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(BOOT_MAIN_SRC_C:.c=.o) $(BOOT_MAIN_SRC_S:.s=.o) $(BOOT_PY_SRC_C:.c=.o) $(BOOT_STM_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(BOOT_MAIN_SRC_C:.c=.o) $(BOOT_MAIN_SRC_S:.s=.o) $(BOOT_PY_SRC_C:.c=.o))
|
||||
OBJ += $(addprefix $(BUILD)/, $(BOOT_LIB_SRC_C:.c=.o))
|
||||
|
||||
# Add the linker script
|
||||
LINKER_SCRIPT = bootmgr/bootmgr.lds
|
||||
@@ -119,12 +121,12 @@ $(BUILD)/bootmgr.bin: $(BUILD)/bootmgr.axf
|
||||
|
||||
$(BUILD)/bootloader.bin: $(BUILD)/bootmgr.bin
|
||||
$(ECHO) "Create $@"
|
||||
$(Q)$(SHELL) $(BOOT_GEN) $(BOARD) $(BTYPE)
|
||||
$(Q)$(SHELL) $(BOOT_GEN) $(BUILD)
|
||||
|
||||
# Create an empty "qstrdefs.generated.h" needed by py/mkrules.mk
|
||||
$(HEADER_BUILD)/qstrdefs.generated.h: | $(HEADER_BUILD)
|
||||
touch $@
|
||||
|
||||
# Create an empty "py-version.h" needed by py/mkrules.mk
|
||||
$(HEADER_BUILD)/py-version.h: | $(HEADER_BUILD)
|
||||
# Create an empty "mpversion.h" needed by py/mkrules.mk
|
||||
$(HEADER_BUILD)/mpversion.h: | $(HEADER_BUILD)
|
||||
touch $@
|
||||
|
||||
@@ -39,6 +39,7 @@ SECTIONS
|
||||
{
|
||||
_text = .;
|
||||
KEEP(*(.intvecs))
|
||||
*(.boot*)
|
||||
*(.text*)
|
||||
*(.rodata*)
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
|
||||
@@ -43,23 +43,31 @@ extern "C"
|
||||
*******************************************************************************/
|
||||
#define IMG_BOOT_INFO "/sys/bootinfo.bin"
|
||||
#define IMG_FACTORY "/sys/factimg.bin"
|
||||
#define IMG_UPDATE "/sys/updtimg.bin"
|
||||
#define IMG_UPDATE1 "/sys/updtimg1.bin"
|
||||
#define IMG_UPDATE2 "/sys/updtimg2.bin"
|
||||
#define IMG_PREFIX "/sys/updtimg"
|
||||
|
||||
#define IMG_SRVPACK "/sys/servicepack.ucf"
|
||||
#define SRVPACK_SIGN "/sys/servicepack.sig"
|
||||
|
||||
#define CA_FILE "/cert/ca.pem"
|
||||
#define CERT_FILE "/cert/cert.pem"
|
||||
#define KEY_FILE "/cert/private.key"
|
||||
|
||||
/******************************************************************************
|
||||
Image file sizes
|
||||
Special file sizes
|
||||
*******************************************************************************/
|
||||
#define IMG_SIZE (232 * 1024) /* 16KB are reserved for the bootloader and at least 8KB for the heap*/
|
||||
#define IMG_SIZE (192 * 1024) /* 16KB are reserved for the bootloader and at least 48KB for the heap*/
|
||||
#define SRVPACK_SIZE (16 * 1024)
|
||||
#define SIGN_SIZE (2 * 1024)
|
||||
#define CA_KEY_SIZE (4 * 1024)
|
||||
|
||||
/******************************************************************************
|
||||
Active Image
|
||||
*******************************************************************************/
|
||||
#define IMG_ACT_FACTORY 0
|
||||
#define IMG_ACT_UPDATE 1
|
||||
#define IMG_ACT_UPDATE1 1
|
||||
#define IMG_ACT_UPDATE2 2
|
||||
|
||||
#define IMG_STATUS_CHECK 0
|
||||
#define IMG_STATUS_READY 1
|
||||
@@ -67,13 +75,13 @@ extern "C"
|
||||
/******************************************************************************
|
||||
Boot Info structure
|
||||
*******************************************************************************/
|
||||
typedef struct sBootInfo
|
||||
typedef struct _sBootInfo_t
|
||||
{
|
||||
_u8 ActiveImg;
|
||||
_u8 Status;
|
||||
_u8 PrevImg;
|
||||
_u8 : 8;
|
||||
_u8 : 8;
|
||||
}sBootInfo_t;
|
||||
} sBootInfo_t;
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <std.h>
|
||||
|
||||
#include "std.h"
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "hw_ints.h"
|
||||
#include "hw_types.h"
|
||||
#include "hw_gpio.h"
|
||||
@@ -38,7 +38,6 @@
|
||||
#include "hw_common_reg.h"
|
||||
#include "pin.h"
|
||||
#include "gpio.h"
|
||||
#include "rom.h"
|
||||
#include "rom_map.h"
|
||||
#include "prcm.h"
|
||||
#include "simplelink.h"
|
||||
@@ -47,11 +46,12 @@
|
||||
#include "flc.h"
|
||||
#include "bootmgr.h"
|
||||
#include "shamd5.h"
|
||||
#include "hash.h"
|
||||
#include "cryptohash.h"
|
||||
#include "utils.h"
|
||||
#include "cc3200_hal.h"
|
||||
#include "debug.h"
|
||||
#include "mperror.h"
|
||||
#include "antenna.h"
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
@@ -62,11 +62,16 @@
|
||||
#define BOOTMGR_HASH_SIZE 32
|
||||
#define BOOTMGR_BUFF_SIZE 512
|
||||
|
||||
#define BOOTMGR_WAIT_SAFE_MODE_MS 1600
|
||||
#define BOOTMGR_WAIT_SAFE_MODE_TOOGLE_MS 200
|
||||
#define BOOTMGR_WAIT_SAFE_MODE_0_MS 500
|
||||
|
||||
#define BOOTMGR_SAFE_MODE_ENTER_MS 800
|
||||
#define BOOTMGR_SAFE_MODE_ENTER_TOOGLE_MS 80
|
||||
#define BOOTMGR_WAIT_SAFE_MODE_1_MS 3000
|
||||
#define BOOTMGR_WAIT_SAFE_MODE_1_BLINK_MS 500
|
||||
|
||||
#define BOOTMGR_WAIT_SAFE_MODE_2_MS 3000
|
||||
#define BOOTMGR_WAIT_SAFE_MODE_2_BLINK_MS 250
|
||||
|
||||
#define BOOTMGR_WAIT_SAFE_MODE_3_MS 1500
|
||||
#define BOOTMGR_WAIT_SAFE_MODE_3_BLINK_MS 100
|
||||
|
||||
//*****************************************************************************
|
||||
// Exported functions declarations
|
||||
@@ -77,9 +82,11 @@ extern void bootmgr_run_app (_u32 base);
|
||||
// Local functions declarations
|
||||
//*****************************************************************************
|
||||
static void bootmgr_board_init (void);
|
||||
static bool bootmgr_verify (void);
|
||||
static bool bootmgr_verify (_u8 *image);
|
||||
static void bootmgr_load_and_execute (_u8 *image);
|
||||
static bool safe_mode_boot (void);
|
||||
static bool wait_while_blinking (uint32_t wait_time, uint32_t period, bool force_wait);
|
||||
static bool safe_boot_request_start (uint32_t wait_time);
|
||||
static void wait_for_safe_boot (sBootInfo_t *psBootInfo);
|
||||
static void bootmgr_image_loader (sBootInfo_t *psBootInfo);
|
||||
|
||||
//*****************************************************************************
|
||||
@@ -138,44 +145,52 @@ void SimpleLinkSockEventHandler(SlSockEvent_t *pSock)
|
||||
//! Board Initialization & Configuration
|
||||
//*****************************************************************************
|
||||
static void bootmgr_board_init(void) {
|
||||
// Set vector table base
|
||||
// set the vector table base
|
||||
MAP_IntVTableBaseSet((unsigned long)&g_pfnVectors[0]);
|
||||
|
||||
// Enable Processor Interrupts
|
||||
// enable processor interrupts
|
||||
MAP_IntMasterEnable();
|
||||
MAP_IntEnable(FAULT_SYSTICK);
|
||||
|
||||
// Mandatory MCU Initialization
|
||||
// mandatory MCU initialization
|
||||
PRCMCC3200MCUInit();
|
||||
|
||||
// clear all the special bits, since we can't trust their content after reset
|
||||
// except for the WDT reset one!!
|
||||
PRCMClearSpecialBit(PRCM_SAFE_BOOT_BIT);
|
||||
PRCMClearSpecialBit(PRCM_FIRST_BOOT_BIT);
|
||||
|
||||
// check the reset after clearing the special bits
|
||||
mperror_bootloader_check_reset_cause();
|
||||
|
||||
// Enable the Data Hashing Engine
|
||||
HASH_Init();
|
||||
#if MICROPY_HW_ANTENNA_DIVERSITY
|
||||
// configure the antenna selection pins
|
||||
antenna_init0();
|
||||
#endif
|
||||
|
||||
// Init the system led and the system switch
|
||||
// enable the data hashing engine
|
||||
CRYPTOHASH_Init();
|
||||
|
||||
// init the system led and the system switch
|
||||
mperror_init0();
|
||||
|
||||
// clear the safe boot flag, since we can't trust its content after reset
|
||||
PRCMClearSafeBootRequest();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Verifies the integrity of the new application binary
|
||||
//*****************************************************************************
|
||||
static bool bootmgr_verify (void) {
|
||||
static bool bootmgr_verify (_u8 *image) {
|
||||
SlFsFileInfo_t FsFileInfo;
|
||||
_u32 reqlen, offset = 0;
|
||||
_i32 fHandle;
|
||||
|
||||
// open the file for reading
|
||||
if (0 == sl_FsOpen((_u8 *)IMG_UPDATE, FS_MODE_OPEN_READ, NULL, &fHandle)) {
|
||||
if (0 == sl_FsOpen(image, FS_MODE_OPEN_READ, NULL, &fHandle)) {
|
||||
// get the file size
|
||||
sl_FsGetInfo((_u8 *)IMG_UPDATE, 0, &FsFileInfo);
|
||||
sl_FsGetInfo(image, 0, &FsFileInfo);
|
||||
|
||||
if (FsFileInfo.FileLen > BOOTMGR_HASH_SIZE) {
|
||||
FsFileInfo.FileLen -= BOOTMGR_HASH_SIZE;
|
||||
HASH_SHAMD5Start(BOOTMGR_HASH_ALGO, FsFileInfo.FileLen);
|
||||
CRYPTOHASH_SHAMD5Start(BOOTMGR_HASH_ALGO, FsFileInfo.FileLen);
|
||||
do {
|
||||
if ((FsFileInfo.FileLen - offset) > BOOTMGR_BUFF_SIZE) {
|
||||
reqlen = BOOTMGR_BUFF_SIZE;
|
||||
@@ -185,10 +200,10 @@ static bool bootmgr_verify (void) {
|
||||
}
|
||||
|
||||
offset += sl_FsRead(fHandle, offset, bootmgr_file_buf, reqlen);
|
||||
HASH_SHAMD5Update(bootmgr_file_buf, reqlen);
|
||||
CRYPTOHASH_SHAMD5Update(bootmgr_file_buf, reqlen);
|
||||
} while (offset < FsFileInfo.FileLen);
|
||||
|
||||
HASH_SHAMD5Read (bootmgr_file_buf);
|
||||
CRYPTOHASH_SHAMD5Read (bootmgr_file_buf);
|
||||
|
||||
// convert the resulting hash to hex
|
||||
for (_u32 i = 0; i < (BOOTMGR_HASH_SIZE / 2); i++) {
|
||||
@@ -196,7 +211,7 @@ static bool bootmgr_verify (void) {
|
||||
}
|
||||
|
||||
// read the hash from the file and close it
|
||||
ASSERT (BOOTMGR_HASH_SIZE == sl_FsRead(fHandle, offset, bootmgr_file_buf, BOOTMGR_HASH_SIZE));
|
||||
sl_FsRead(fHandle, offset, bootmgr_file_buf, BOOTMGR_HASH_SIZE);
|
||||
sl_FsClose (fHandle, NULL, NULL, 0);
|
||||
bootmgr_file_buf[BOOTMGR_HASH_SIZE] = '\0';
|
||||
// compare both hashes
|
||||
@@ -235,47 +250,81 @@ static void bootmgr_load_and_execute (_u8 *image) {
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Check for the safe mode pin
|
||||
//! Wait while the safe mode pin is being held high and blink the system led
|
||||
//! with the specified period
|
||||
//*****************************************************************************
|
||||
static bool safe_mode_boot (void) {
|
||||
_u32 count = 0;
|
||||
while (MAP_GPIOPinRead(MICROPY_SAFE_BOOT_PORT, MICROPY_SAFE_BOOT_PORT_PIN) &&
|
||||
((BOOTMGR_WAIT_SAFE_MODE_TOOGLE_MS * count++) < BOOTMGR_WAIT_SAFE_MODE_MS)) {
|
||||
static bool wait_while_blinking (uint32_t wait_time, uint32_t period, bool force_wait) {
|
||||
_u32 count;
|
||||
for (count = 0; (force_wait || MAP_GPIOPinRead(MICROPY_SAFE_BOOT_PORT, MICROPY_SAFE_BOOT_PORT_PIN)) &&
|
||||
((period * count) < wait_time); count++) {
|
||||
// toogle the led
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, ~MAP_GPIOPinRead(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN));
|
||||
UtilsDelay(UTILS_DELAY_US_TO_COUNT(BOOTMGR_WAIT_SAFE_MODE_TOOGLE_MS * 1000));
|
||||
UtilsDelay(UTILS_DELAY_US_TO_COUNT(period * 1000));
|
||||
}
|
||||
return MAP_GPIOPinRead(MICROPY_SAFE_BOOT_PORT, MICROPY_SAFE_BOOT_PORT_PIN) ? true : false;
|
||||
}
|
||||
|
||||
static bool safe_boot_request_start (uint32_t wait_time) {
|
||||
if (MAP_GPIOPinRead(MICROPY_SAFE_BOOT_PORT, MICROPY_SAFE_BOOT_PORT_PIN)) {
|
||||
UtilsDelay(UTILS_DELAY_US_TO_COUNT(wait_time * 1000));
|
||||
}
|
||||
mperror_deinit_sfe_pin();
|
||||
return MAP_GPIOPinRead(MICROPY_SAFE_BOOT_PORT, MICROPY_SAFE_BOOT_PORT_PIN) ? true : false;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Load the proper image based on information from boot info and executes it.
|
||||
//! Check for the safe mode pin
|
||||
//*****************************************************************************
|
||||
static void wait_for_safe_boot (sBootInfo_t *psBootInfo) {
|
||||
if (safe_boot_request_start(BOOTMGR_WAIT_SAFE_MODE_0_MS)) {
|
||||
if (wait_while_blinking(BOOTMGR_WAIT_SAFE_MODE_1_MS, BOOTMGR_WAIT_SAFE_MODE_1_BLINK_MS, false)) {
|
||||
// go back one step in time
|
||||
psBootInfo->ActiveImg = psBootInfo->PrevImg;
|
||||
if (wait_while_blinking(BOOTMGR_WAIT_SAFE_MODE_2_MS, BOOTMGR_WAIT_SAFE_MODE_2_BLINK_MS, false)) {
|
||||
// go back directly to the factory image
|
||||
psBootInfo->ActiveImg = IMG_ACT_FACTORY;
|
||||
wait_while_blinking(BOOTMGR_WAIT_SAFE_MODE_3_MS, BOOTMGR_WAIT_SAFE_MODE_3_BLINK_MS, true);
|
||||
}
|
||||
}
|
||||
// turn off the system led
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, 0);
|
||||
// request a safe boot to the application
|
||||
PRCMSetSpecialBit(PRCM_SAFE_BOOT_BIT);
|
||||
}
|
||||
// deinit the safe boot pin
|
||||
mperror_deinit_sfe_pin();
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Load the proper image based on the information from the boot info
|
||||
//! and launch it.
|
||||
//*****************************************************************************
|
||||
static void bootmgr_image_loader(sBootInfo_t *psBootInfo) {
|
||||
_i32 fhandle;
|
||||
if (safe_mode_boot()) {
|
||||
_u32 count = 0;
|
||||
while ((BOOTMGR_SAFE_MODE_ENTER_TOOGLE_MS * count++) < BOOTMGR_SAFE_MODE_ENTER_MS) {
|
||||
// toogle the led
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, ~MAP_GPIOPinRead(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN));
|
||||
UtilsDelay(UTILS_DELAY_US_TO_COUNT(BOOTMGR_SAFE_MODE_ENTER_TOOGLE_MS * 1000));
|
||||
}
|
||||
psBootInfo->ActiveImg = IMG_ACT_FACTORY;
|
||||
// turn the led off
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, 0);
|
||||
// request a safe boot to the application
|
||||
PRCMRequestSafeBoot();
|
||||
_u8 *image;
|
||||
|
||||
// search for the active image
|
||||
switch (psBootInfo->ActiveImg) {
|
||||
case IMG_ACT_UPDATE1:
|
||||
image = (unsigned char *)IMG_UPDATE1;
|
||||
break;
|
||||
case IMG_ACT_UPDATE2:
|
||||
image = (unsigned char *)IMG_UPDATE2;
|
||||
break;
|
||||
default:
|
||||
image = (unsigned char *)IMG_FACTORY;
|
||||
break;
|
||||
}
|
||||
// do we have a new update image that needs to be verified?
|
||||
else if ((psBootInfo->ActiveImg == IMG_ACT_UPDATE) && (psBootInfo->Status == IMG_STATUS_CHECK)) {
|
||||
if (!bootmgr_verify()) {
|
||||
// delete the corrupted file
|
||||
sl_FsDel((_u8 *)IMG_UPDATE, 0);
|
||||
// switch to the factory image
|
||||
psBootInfo->ActiveImg = IMG_ACT_FACTORY;
|
||||
|
||||
// do we have a new image that needs to be verified?
|
||||
if ((psBootInfo->ActiveImg != IMG_ACT_FACTORY) && (psBootInfo->Status == IMG_STATUS_CHECK)) {
|
||||
if (!bootmgr_verify(image)) {
|
||||
// verification failed, delete the broken file
|
||||
sl_FsDel(image, 0);
|
||||
// switch to the previous image
|
||||
psBootInfo->ActiveImg = psBootInfo->PrevImg;
|
||||
psBootInfo->PrevImg = IMG_ACT_FACTORY;
|
||||
}
|
||||
// in any case, set the status as "READY"
|
||||
// in any case, change the status to "READY"
|
||||
psBootInfo->Status = IMG_STATUS_READY;
|
||||
// write the new boot info
|
||||
if (!sl_FsOpen((unsigned char *)IMG_BOOT_INFO, FS_MODE_OPEN_WRITE, NULL, &fhandle)) {
|
||||
@@ -285,24 +334,34 @@ static void bootmgr_image_loader(sBootInfo_t *psBootInfo) {
|
||||
}
|
||||
}
|
||||
|
||||
// now boot the active image
|
||||
if (IMG_ACT_UPDATE == psBootInfo->ActiveImg) {
|
||||
bootmgr_load_and_execute((unsigned char *)IMG_UPDATE);
|
||||
}
|
||||
else {
|
||||
bootmgr_load_and_execute((unsigned char *)IMG_FACTORY);
|
||||
// this one might modify the boot info hence it MUST be called after
|
||||
// bootmgr_verify! (so that the changes are not saved to flash)
|
||||
wait_for_safe_boot(psBootInfo);
|
||||
|
||||
// select the active image again, since it might have changed
|
||||
switch (psBootInfo->ActiveImg) {
|
||||
case IMG_ACT_UPDATE1:
|
||||
image = (unsigned char *)IMG_UPDATE1;
|
||||
break;
|
||||
case IMG_ACT_UPDATE2:
|
||||
image = (unsigned char *)IMG_UPDATE2;
|
||||
break;
|
||||
default:
|
||||
image = (unsigned char *)IMG_FACTORY;
|
||||
break;
|
||||
}
|
||||
bootmgr_load_and_execute(image);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! Main function
|
||||
//*****************************************************************************
|
||||
int main (void) {
|
||||
sBootInfo_t sBootInfo = { .ActiveImg = IMG_ACT_FACTORY, .Status = IMG_STATUS_READY };
|
||||
sBootInfo_t sBootInfo = { .ActiveImg = IMG_ACT_FACTORY, .Status = IMG_STATUS_READY, .PrevImg = IMG_ACT_FACTORY };
|
||||
bool bootapp = false;
|
||||
_i32 fhandle;
|
||||
|
||||
// Board Initialization
|
||||
// board setup
|
||||
bootmgr_board_init();
|
||||
|
||||
// start simplelink since we need it to access the sflash
|
||||
@@ -315,17 +374,20 @@ int main (void) {
|
||||
}
|
||||
sl_FsClose(fhandle, 0, 0, 0);
|
||||
}
|
||||
// boot info file not present, it means that this is the first boot after being programmed
|
||||
if (!bootapp) {
|
||||
// create a new boot info file
|
||||
_u32 BootInfoCreateFlag = _FS_FILE_OPEN_FLAG_COMMIT | _FS_FILE_PUBLIC_WRITE | _FS_FILE_PUBLIC_READ;
|
||||
if (!sl_FsOpen ((unsigned char *)IMG_BOOT_INFO, FS_MODE_OPEN_CREATE((2 * sizeof(sBootInfo_t)),
|
||||
BootInfoCreateFlag), NULL, &fhandle)) {
|
||||
// Write the default boot info.
|
||||
// write the default boot info.
|
||||
if (sizeof(sBootInfo_t) == sl_FsWrite(fhandle, 0, (unsigned char *)&sBootInfo, sizeof(sBootInfo_t))) {
|
||||
bootapp = true;
|
||||
}
|
||||
sl_FsClose(fhandle, 0, 0, 0);
|
||||
}
|
||||
// signal the first boot to the application
|
||||
PRCMSetSpecialBit(PRCM_FIRST_BOOT_BIT);
|
||||
}
|
||||
|
||||
if (bootapp) {
|
||||
@@ -336,14 +398,23 @@ int main (void) {
|
||||
// stop simplelink
|
||||
sl_Stop(SL_STOP_TIMEOUT);
|
||||
|
||||
// if we've reached this point, then it means a fatal error occurred and the application
|
||||
// could not be loaded, so, loop forever and signal the crash to the user
|
||||
// if we've reached this point, then it means that a fatal error has occurred and the
|
||||
// application could not be loaded, so, loop forever and signal the crash to the user
|
||||
while (true) {
|
||||
// keep the bld on
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, MICROPY_SYS_LED_PORT_PIN);
|
||||
__asm volatile(" dsb \n"
|
||||
" isb \n"
|
||||
" wfi \n");
|
||||
__asm volatile(" dsb \n"
|
||||
" isb \n"
|
||||
" wfi \n");
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//! The following stub function is needed to link mp_vprintf
|
||||
//*****************************************************************************
|
||||
#include "py/qstr.h"
|
||||
|
||||
const byte *qstr_data(qstr q, size_t *len) {
|
||||
*len = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -10,21 +10,21 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "diskio.h" /* FatFs lower layer API */
|
||||
#include "py/runtime.h"
|
||||
#include "py/obj.h"
|
||||
#include "lib/fatfs/ff.h"
|
||||
#include "lib/fatfs/diskio.h" /* FatFs lower layer API */
|
||||
#include "sflash_diskio.h" /* Serial flash disk IO API */
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
#include "sd_diskio.h" /* SDCARD disk IO API */
|
||||
#endif
|
||||
#include "modutime.h"
|
||||
#include "sd_diskio.h" /* SDCARD disk IO API */
|
||||
#include "inc/hw_types.h"
|
||||
#include "inc/hw_ints.h"
|
||||
#include "inc/hw_memmap.h"
|
||||
#include "rom_map.h"
|
||||
#include "prcm.h"
|
||||
|
||||
/* Definitions of physical drive number for each drive */
|
||||
#define SFLASH 0 /* Map SFLASH drive to drive number 0 */
|
||||
#define SDCARD 1 /* Map SD card to drive number 1 */
|
||||
#include "pybrtc.h"
|
||||
#include "timeutils.h"
|
||||
#include "pybsd.h"
|
||||
#include "moduos.h"
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
@@ -35,21 +35,20 @@ DSTATUS disk_status (
|
||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||
)
|
||||
{
|
||||
switch (pdrv) {
|
||||
case SFLASH :
|
||||
return sflash_disk_status();
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
case SDCARD :
|
||||
return sd_disk_status();
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return STA_NODISK;
|
||||
if (pdrv == PD_FLASH) {
|
||||
return sflash_disk_status();
|
||||
} else {
|
||||
os_fs_mount_t *mount_obj;
|
||||
if ((mount_obj = osmount_find_by_volume(pdrv))) {
|
||||
if (mount_obj->writeblocks[0] == MP_OBJ_NULL) {
|
||||
return STA_PROTECT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return STA_NODISK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Inidialize a Drive */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
@@ -58,29 +57,22 @@ DSTATUS disk_initialize (
|
||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||
)
|
||||
{
|
||||
DSTATUS stat = 0;
|
||||
|
||||
switch (pdrv) {
|
||||
case SFLASH :
|
||||
if (RES_OK != sflash_disk_init()) {
|
||||
stat = STA_NOINIT;
|
||||
}
|
||||
return stat;
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
case SDCARD :
|
||||
if (RES_OK != sd_disk_init()) {
|
||||
stat = STA_NOINIT;
|
||||
if (pdrv == PD_FLASH) {
|
||||
if (RES_OK != sflash_disk_init()) {
|
||||
return STA_NOINIT;
|
||||
}
|
||||
return stat;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return STA_NOINIT;
|
||||
} else {
|
||||
os_fs_mount_t *mount_obj;
|
||||
if ((mount_obj = osmount_find_by_volume(pdrv))) {
|
||||
if (mount_obj->writeblocks[0] == MP_OBJ_NULL) {
|
||||
return STA_PROTECT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return STA_NODISK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Read Sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
@@ -92,22 +84,25 @@ DRESULT disk_read (
|
||||
UINT count /* Number of sectors to read */
|
||||
)
|
||||
{
|
||||
switch (pdrv) {
|
||||
case SFLASH :
|
||||
return sflash_disk_read(buff, sector, count);
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
case SDCARD :
|
||||
return sd_disk_read(buff, sector, count);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return RES_PARERR;
|
||||
if (pdrv == PD_FLASH) {
|
||||
return sflash_disk_read(buff, sector, count);
|
||||
} else {
|
||||
os_fs_mount_t *mount_obj;
|
||||
if ((mount_obj = osmount_find_by_volume(pdrv))) {
|
||||
// optimization for the built-in sd card device
|
||||
if (mount_obj->device == (mp_obj_t)&pybsd_obj) {
|
||||
return sd_disk_read(buff, sector, count);
|
||||
}
|
||||
mount_obj->readblocks[2] = MP_OBJ_NEW_SMALL_INT(sector);
|
||||
mount_obj->readblocks[3] = mp_obj_new_bytearray_by_ref(count * 512, buff);
|
||||
return mp_obj_get_int(mp_call_method_n_kw(2, 0, mount_obj->readblocks));
|
||||
}
|
||||
// nothing mounted
|
||||
return RES_ERROR;
|
||||
}
|
||||
return RES_PARERR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Write Sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
@@ -120,18 +115,23 @@ DRESULT disk_write (
|
||||
UINT count /* Number of sectors to write */
|
||||
)
|
||||
{
|
||||
switch (pdrv) {
|
||||
case SFLASH :
|
||||
return sflash_disk_write(buff, sector, count);
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
case SDCARD :
|
||||
return sd_disk_write(buff, sector, count);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return RES_PARERR;
|
||||
if (pdrv == PD_FLASH) {
|
||||
return sflash_disk_write(buff, sector, count);
|
||||
} else {
|
||||
os_fs_mount_t *mount_obj;
|
||||
if ((mount_obj = osmount_find_by_volume(pdrv))) {
|
||||
// optimization for the built-in sd card device
|
||||
if (mount_obj->device == (mp_obj_t)&pybsd_obj) {
|
||||
return sd_disk_write(buff, sector, count);
|
||||
}
|
||||
mount_obj->writeblocks[2] = MP_OBJ_NEW_SMALL_INT(sector);
|
||||
mount_obj->writeblocks[3] = mp_obj_new_bytearray_by_ref(count * 512, (void *)buff);
|
||||
return mp_obj_get_int(mp_call_method_n_kw(2, 0, mount_obj->writeblocks));
|
||||
}
|
||||
// nothing mounted
|
||||
return RES_ERROR;
|
||||
}
|
||||
return RES_PARERR;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -147,41 +147,47 @@ DRESULT disk_ioctl (
|
||||
void *buff /* Buffer to send/receive control data */
|
||||
)
|
||||
{
|
||||
switch (pdrv) {
|
||||
case SFLASH:
|
||||
if (pdrv == PD_FLASH) {
|
||||
switch (cmd) {
|
||||
case CTRL_SYNC:
|
||||
return sflash_disk_flush();
|
||||
case GET_SECTOR_COUNT:
|
||||
*((DWORD*)buff) = SFLASH_SECTOR_COUNT;
|
||||
return RES_OK;
|
||||
break;
|
||||
case GET_SECTOR_SIZE:
|
||||
*((WORD*)buff) = SFLASH_SECTOR_SIZE;
|
||||
*((DWORD*)buff) = SFLASH_SECTOR_SIZE;
|
||||
return RES_OK;
|
||||
break;
|
||||
case GET_BLOCK_SIZE:
|
||||
*((DWORD*)buff) = 1; // high-level sector erase size in units of the block size
|
||||
return RES_OK;
|
||||
}
|
||||
break;
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
case SDCARD:
|
||||
switch (cmd) {
|
||||
case CTRL_SYNC:
|
||||
return RES_OK;
|
||||
case GET_SECTOR_COUNT:
|
||||
*(WORD*)buff = sd_disk_info.ulNofBlock;
|
||||
break;
|
||||
case GET_SECTOR_SIZE :
|
||||
*(WORD*)buff = SD_SECTOR_SIZE;
|
||||
break;
|
||||
case GET_BLOCK_SIZE:
|
||||
*((DWORD*)buff) = 1; // high-level sector erase size in units of the block size
|
||||
return RES_OK;
|
||||
} else {
|
||||
os_fs_mount_t *mount_obj;
|
||||
if ((mount_obj = osmount_find_by_volume(pdrv))) {
|
||||
switch (cmd) {
|
||||
case CTRL_SYNC:
|
||||
if (mount_obj->sync[0] != MP_OBJ_NULL) {
|
||||
mp_call_method_n_kw(0, 0, mount_obj->sync);
|
||||
}
|
||||
return RES_OK;
|
||||
case GET_SECTOR_COUNT:
|
||||
// optimization for the built-in sd card device
|
||||
if (mount_obj->device == (mp_obj_t)&pybsd_obj) {
|
||||
*((DWORD*)buff) = sd_disk_info.ulNofBlock * (sd_disk_info.ulBlockSize / 512);
|
||||
} else {
|
||||
*((DWORD*)buff) = mp_obj_get_int(mp_call_method_n_kw(0, 0, mount_obj->count));
|
||||
}
|
||||
return RES_OK;
|
||||
case GET_SECTOR_SIZE:
|
||||
*((DWORD*)buff) = SD_SECTOR_SIZE; // Sector size is fixed to 512 bytes, as with SD cards
|
||||
return RES_OK;
|
||||
case GET_BLOCK_SIZE:
|
||||
*((DWORD*)buff) = 1; // high-level sector erase size in units of the block size
|
||||
return RES_OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
// nothing mounted
|
||||
return RES_ERROR;
|
||||
}
|
||||
return RES_PARERR;
|
||||
}
|
||||
@@ -192,13 +198,8 @@ DWORD get_fattime (
|
||||
void
|
||||
)
|
||||
{
|
||||
mod_struct_time tm;
|
||||
uint32_t seconds;
|
||||
uint16_t mseconds;
|
||||
|
||||
// Get the time from the on-chip RTC and convert it to struct_time
|
||||
MAP_PRCMRTCGet(&seconds, &mseconds);
|
||||
mod_time_seconds_since_2000_to_struct_time(seconds, &tm);
|
||||
timeutils_struct_time_t tm;
|
||||
timeutils_seconds_since_2000_to_struct_time(pyb_rtc_get_seconds(), &tm);
|
||||
|
||||
return ((tm.tm_year - 1980) << 25) | ((tm.tm_mon) << 21) |
|
||||
((tm.tm_mday) << 16) | ((tm.tm_hour) << 11) |
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
/*-----------------------------------------------------------------------/
|
||||
/ Low level disk interface modlue include file (C)ChaN, 2014 /
|
||||
/-----------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _DISKIO_DEFINED
|
||||
#define _DISKIO_DEFINED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _USE_WRITE 1 /* 1: Enable disk_write function */
|
||||
#define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */
|
||||
|
||||
#include "integer.h"
|
||||
|
||||
|
||||
/* Status of Disk Functions */
|
||||
typedef BYTE DSTATUS;
|
||||
|
||||
/* Results of Disk Functions */
|
||||
typedef enum {
|
||||
RES_OK = 0, /* 0: Successful */
|
||||
RES_ERROR, /* 1: R/W Error */
|
||||
RES_WRPRT, /* 2: Write Protected */
|
||||
RES_NOTRDY, /* 3: Not Ready */
|
||||
RES_PARERR /* 4: Invalid Parameter */
|
||||
} DRESULT;
|
||||
|
||||
|
||||
/*---------------------------------------*/
|
||||
/* Prototypes for disk control functions */
|
||||
|
||||
|
||||
DSTATUS disk_initialize (BYTE pdrv);
|
||||
DSTATUS disk_status (BYTE pdrv);
|
||||
DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
|
||||
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
|
||||
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
|
||||
|
||||
/* Disk Status Bits (DSTATUS) */
|
||||
|
||||
#define STA_NOINIT 0x01 /* Drive not initialized */
|
||||
#define STA_NODISK 0x02 /* No medium in the drive */
|
||||
#define STA_PROTECT 0x04 /* Write protected */
|
||||
|
||||
|
||||
/* Command code for disk_ioctrl fucntion */
|
||||
|
||||
/* Generic command (Used by FatFs) */
|
||||
#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
|
||||
#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
|
||||
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
|
||||
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
|
||||
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -38,11 +38,10 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/mphal.h"
|
||||
#include "hw_types.h"
|
||||
#include "hw_memmap.h"
|
||||
#include "hw_ints.h"
|
||||
#include "rom.h"
|
||||
#include "rom_map.h"
|
||||
#include "diskio.h"
|
||||
#include "sd_diskio.h"
|
||||
@@ -187,7 +186,7 @@ static unsigned int CardSelect (DiskInfo_t *sDiskInfo) {
|
||||
}
|
||||
|
||||
// Delay 250ms for the card to become ready
|
||||
HAL_Delay (250);
|
||||
mp_hal_delay_ms(250);
|
||||
|
||||
return ulRet;
|
||||
}
|
||||
@@ -279,8 +278,6 @@ DSTATUS sd_disk_init (void) {
|
||||
sd_disk_info.bStatus = 0;
|
||||
}
|
||||
}
|
||||
// Set card rd/wr block len
|
||||
MAP_SDHostBlockSizeSet(SDHOST_BASE, SD_SECTOR_SIZE);
|
||||
}
|
||||
|
||||
return sd_disk_info.bStatus;
|
||||
@@ -302,28 +299,6 @@ void sd_disk_deinit (void) {
|
||||
sd_disk_info.usRCA = 0;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the disk status.
|
||||
//!
|
||||
//! This function gets the current status of the drive.
|
||||
//!
|
||||
//! \return Returns the current status of the specified drive
|
||||
//
|
||||
//*****************************************************************************
|
||||
DSTATUS sd_disk_status (void) {
|
||||
return sd_disk_info.bStatus;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Returns wether the sd card is ready to be accessed or not
|
||||
//
|
||||
//*****************************************************************************
|
||||
bool sd_disk_ready (void) {
|
||||
return (!sd_disk_info.bStatus);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Reads sector(s) from the disk drive.
|
||||
@@ -376,6 +351,7 @@ DRESULT sd_disk_read (BYTE* pBuffer, DWORD ulSectorNumber, UINT SectorCount) {
|
||||
pBuffer += 4;
|
||||
}
|
||||
CardSendCmd(CMD_STOP_TRANS, 0);
|
||||
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
|
||||
Res = RES_OK;
|
||||
}
|
||||
}
|
||||
@@ -395,61 +371,62 @@ DRESULT sd_disk_read (BYTE* pBuffer, DWORD ulSectorNumber, UINT SectorCount) {
|
||||
//
|
||||
//*****************************************************************************
|
||||
DRESULT sd_disk_write (const BYTE* pBuffer, DWORD ulSectorNumber, UINT SectorCount) {
|
||||
DRESULT Res = RES_ERROR;
|
||||
unsigned long ulSize;
|
||||
DRESULT Res = RES_ERROR;
|
||||
unsigned long ulSize;
|
||||
|
||||
if (SectorCount > 0) {
|
||||
// Return if disk not initialized
|
||||
if (sd_disk_info.bStatus & STA_NOINIT) {
|
||||
return RES_NOTRDY;
|
||||
}
|
||||
if (SectorCount > 0) {
|
||||
// Return if disk not initialized
|
||||
if (sd_disk_info.bStatus & STA_NOINIT) {
|
||||
return RES_NOTRDY;
|
||||
}
|
||||
|
||||
// SDSC uses linear address, SDHC uses block address
|
||||
if (sd_disk_info.ulCapClass == CARD_CAP_CLASS_SDSC) {
|
||||
ulSectorNumber = ulSectorNumber * SD_SECTOR_SIZE;
|
||||
}
|
||||
// SDSC uses linear address, SDHC uses block address
|
||||
if (sd_disk_info.ulCapClass == CARD_CAP_CLASS_SDSC) {
|
||||
ulSectorNumber = ulSectorNumber * SD_SECTOR_SIZE;
|
||||
}
|
||||
|
||||
// Set the block count
|
||||
MAP_SDHostBlockCountSet(SDHOST_BASE, SectorCount);
|
||||
// Set the block count
|
||||
MAP_SDHostBlockCountSet(SDHOST_BASE, SectorCount);
|
||||
|
||||
// Compute the number of words
|
||||
ulSize = (SD_SECTOR_SIZE * SectorCount) / 4;
|
||||
// Compute the number of words
|
||||
ulSize = (SD_SECTOR_SIZE * SectorCount) / 4;
|
||||
|
||||
// Check if 1 block or multi block transfer
|
||||
if (SectorCount == 1) {
|
||||
// Send single block write command
|
||||
if (CardSendCmd(CMD_WRITE_SINGLE_BLK, ulSectorNumber) == 0) {
|
||||
// Write the data
|
||||
while (ulSize--) {
|
||||
MAP_SDHostDataWrite (SDHOST_BASE, (*(unsigned long *)pBuffer));
|
||||
pBuffer += 4;
|
||||
}
|
||||
// Wait for data transfer complete
|
||||
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
|
||||
Res = RES_OK;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Set the card write block count
|
||||
if (sd_disk_info.ucCardType == CARD_TYPE_SDCARD) {
|
||||
CardSendCmd(CMD_APP_CMD,sd_disk_info.usRCA << 16);
|
||||
CardSendCmd(CMD_SET_BLK_CNT, SectorCount);
|
||||
}
|
||||
// Check if 1 block or multi block transfer
|
||||
if (SectorCount == 1) {
|
||||
// Send single block write command
|
||||
if (CardSendCmd(CMD_WRITE_SINGLE_BLK, ulSectorNumber) == 0) {
|
||||
// Write the data
|
||||
while (ulSize--) {
|
||||
MAP_SDHostDataWrite (SDHOST_BASE, (*(unsigned long *)pBuffer));
|
||||
pBuffer += 4;
|
||||
}
|
||||
// Wait for data transfer complete
|
||||
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
|
||||
Res = RES_OK;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Set the card write block count
|
||||
if (sd_disk_info.ucCardType == CARD_TYPE_SDCARD) {
|
||||
CardSendCmd(CMD_APP_CMD,sd_disk_info.usRCA << 16);
|
||||
CardSendCmd(CMD_SET_BLK_CNT, SectorCount);
|
||||
}
|
||||
|
||||
// Send multi block write command
|
||||
if (CardSendCmd(CMD_WRITE_MULTI_BLK, ulSectorNumber) == 0) {
|
||||
// Write the data buffer
|
||||
while (ulSize--) {
|
||||
MAP_SDHostDataWrite(SDHOST_BASE, (*(unsigned long *)pBuffer));
|
||||
pBuffer += 4;
|
||||
}
|
||||
// Wait for transfer complete
|
||||
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
|
||||
CardSendCmd(CMD_STOP_TRANS, 0);
|
||||
Res = RES_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Send multi block write command
|
||||
if (CardSendCmd(CMD_WRITE_MULTI_BLK, ulSectorNumber) == 0) {
|
||||
// Write the data buffer
|
||||
while (ulSize--) {
|
||||
MAP_SDHostDataWrite(SDHOST_BASE, (*(unsigned long *)pBuffer));
|
||||
pBuffer += 4;
|
||||
}
|
||||
// Wait for transfer complete
|
||||
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
|
||||
CardSendCmd(CMD_STOP_TRANS, 0);
|
||||
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
|
||||
Res = RES_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Res;
|
||||
return Res;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,6 @@ extern DiskInfo_t sd_disk_info;
|
||||
|
||||
DSTATUS sd_disk_init (void);
|
||||
void sd_disk_deinit (void);
|
||||
DSTATUS sd_disk_status (void);
|
||||
bool sd_disk_ready (void);
|
||||
DRESULT sd_disk_read (BYTE* pBuffer, DWORD ulSectorNumber, UINT bSectorCount);
|
||||
DRESULT sd_disk_write (const BYTE* pBuffer, DWORD ulSectorNumber, UINT bSectorCount);
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
#include "std.h"
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/obj.h"
|
||||
#include "simplelink.h"
|
||||
#include "diskio.h"
|
||||
#include "sflash_diskio.h"
|
||||
#include "debug.h"
|
||||
#include "modnetwork.h"
|
||||
#include "modwlan.h"
|
||||
|
||||
#define SFLASH_TIMEOUT_MAX_MS 5500
|
||||
@@ -52,13 +53,25 @@ DRESULT sflash_disk_init (void) {
|
||||
// Allocate space for the block cache
|
||||
ASSERT ((sflash_block_cache = mem_Malloc(SFLASH_BLOCK_SIZE)) != NULL);
|
||||
sflash_init_done = true;
|
||||
sflash_prblock = UINT32_MAX;
|
||||
sflash_cache_is_dirty = false;
|
||||
|
||||
// Proceed to format the memory if not done yet
|
||||
// In order too speed up booting, check the last block, if exists, then
|
||||
// it means that the file system has been already created
|
||||
print_block_name (SFLASH_BLOCK_COUNT - 1);
|
||||
sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
|
||||
if (!sl_FsGetInfo(sflash_block_name, 0, &FsFileInfo)) {
|
||||
sl_LockObjUnlock (&wlan_LockObj);
|
||||
return RES_OK;
|
||||
}
|
||||
sl_LockObjUnlock (&wlan_LockObj);
|
||||
|
||||
// Proceed to format the memory
|
||||
for (int i = 0; i < SFLASH_BLOCK_COUNT; i++) {
|
||||
print_block_name (i);
|
||||
sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
|
||||
// Create the block file if it doesn't exist
|
||||
if (sl_FsGetInfo(sflash_block_name, 0, &FsFileInfo) < 0) {
|
||||
if (sl_FsGetInfo(sflash_block_name, 0, &FsFileInfo) != 0) {
|
||||
if (!sl_FsOpen(sflash_block_name, FS_MODE_OPEN_CREATE(SFLASH_BLOCK_SIZE, 0), NULL, &fileHandle)) {
|
||||
sl_FsClose(fileHandle, NULL, NULL, 0);
|
||||
sl_LockObjUnlock (&wlan_LockObj);
|
||||
@@ -75,8 +88,6 @@ DRESULT sflash_disk_init (void) {
|
||||
}
|
||||
sl_LockObjUnlock (&wlan_LockObj);
|
||||
}
|
||||
sflash_prblock = UINT32_MAX;
|
||||
sflash_cache_is_dirty = false;
|
||||
}
|
||||
return RES_OK;
|
||||
}
|
||||
@@ -85,7 +96,7 @@ DRESULT sflash_disk_status(void) {
|
||||
if (!sflash_init_done) {
|
||||
return STA_NOINIT;
|
||||
}
|
||||
return 0;
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
DRESULT sflash_disk_read(BYTE *buff, DWORD sector, UINT count) {
|
||||
@@ -115,7 +126,7 @@ DRESULT sflash_disk_read(BYTE *buff, DWORD sector, UINT count) {
|
||||
}
|
||||
// Copy the requested sector from the block cache
|
||||
memcpy (buff, &sflash_block_cache[(secindex * SFLASH_SECTOR_SIZE)], SFLASH_SECTOR_SIZE);
|
||||
buff += SFLASH_BLOCK_SIZE;
|
||||
buff += SFLASH_SECTOR_SIZE;
|
||||
}
|
||||
return RES_OK;
|
||||
}
|
||||
@@ -150,7 +161,7 @@ DRESULT sflash_disk_write(const BYTE *buff, DWORD sector, UINT count) {
|
||||
}
|
||||
// Copy the input sector to the block cache
|
||||
memcpy (&sflash_block_cache[(secindex * SFLASH_SECTOR_SIZE)], buff, SFLASH_SECTOR_SIZE);
|
||||
buff += SFLASH_BLOCK_SIZE;
|
||||
buff += SFLASH_SECTOR_SIZE;
|
||||
sflash_cache_is_dirty = true;
|
||||
} while (++index < count);
|
||||
|
||||
|
||||
@@ -25,20 +25,18 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <std.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/misc.h"
|
||||
#include "ff.h"
|
||||
#include "ffconf.h"
|
||||
#include "diskio.h"
|
||||
#include "py/mpstate.h"
|
||||
#include "lib/fatfs/ff.h"
|
||||
#include "lib/fatfs/ffconf.h"
|
||||
#include "lib/fatfs/diskio.h"
|
||||
#include "moduos.h"
|
||||
|
||||
#if _FS_RPATH
|
||||
extern BYTE ff_CurrVol;
|
||||
#endif
|
||||
|
||||
STATIC bool check_path(const TCHAR **path, const char *mount_point_str, mp_uint_t mount_point_len) {
|
||||
stoupper ((char *)(*path));
|
||||
if (strncmp(*path, mount_point_str, mount_point_len) == 0) {
|
||||
if ((*path)[mount_point_len] == '/') {
|
||||
*path += mount_point_len;
|
||||
@@ -66,32 +64,30 @@ int ff_get_ldnumber (const TCHAR **path) {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (check_path(path, "/SFLASH", 7)) {
|
||||
return 0;
|
||||
if (check_path(path, "/flash", 6)) {
|
||||
return PD_FLASH;
|
||||
}
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
else if (check_path(path, "/SD", 3)) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
return -1;
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mount_obj_list).len; i++) {
|
||||
os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[i]));
|
||||
if (check_path(path, mount_obj->path, mount_obj->pathlen)) {
|
||||
return mount_obj->vol;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ff_get_volname(BYTE vol, TCHAR **dest) {
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
if (vol == 0)
|
||||
#endif
|
||||
{
|
||||
memcpy(*dest, "/SFLASH", 7);
|
||||
*dest += 7;
|
||||
if (vol == PD_FLASH) {
|
||||
memcpy(*dest, "/flash", 6);
|
||||
*dest += 6;
|
||||
} else {
|
||||
os_fs_mount_t *mount_obj;
|
||||
if ((mount_obj = osmount_find_by_volume(vol))) {
|
||||
memcpy(*dest, mount_obj->path, mount_obj->pathlen);
|
||||
*dest += mount_obj->pathlen;
|
||||
}
|
||||
}
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
else
|
||||
{
|
||||
memcpy(*dest, "/SD", 3);
|
||||
*dest += 3;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,276 +0,0 @@
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ FatFs - FAT file system module configuration file R0.10c (C)ChaN, 2014
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "py/mpconfig.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
|
||||
#define _FFCONF 80376 /* Revision ID */
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Functions and Buffer Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _FS_TINY 1
|
||||
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
|
||||
/ At the tiny configuration, size of the file object (FIL) is reduced _MAX_SS
|
||||
/ bytes. Instead of private sector buffer eliminated from the file object,
|
||||
/ common sector buffer in the file system object (FATFS) is used for the file
|
||||
/ data transfer. */
|
||||
|
||||
|
||||
#define _FS_READONLY 0
|
||||
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
||||
/ Read-only configuration removes basic writing API functions, f_write(),
|
||||
/ f_sync(), f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(),
|
||||
/ f_getfree() and optional writing functions as well. */
|
||||
|
||||
|
||||
#define _FS_MINIMIZE 0
|
||||
/* This option defines minimization level to remove some API functions.
|
||||
/
|
||||
/ 0: All basic functions are enabled.
|
||||
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_chmod(), f_utime(),
|
||||
/ f_truncate() and f_rename() function are removed.
|
||||
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
|
||||
/ 3: f_lseek() function is removed in addition to 2. */
|
||||
|
||||
|
||||
#define _USE_STRFUNC 0
|
||||
/* This option switches string functions, f_gets(), f_putc(), f_puts() and
|
||||
/ f_printf().
|
||||
/
|
||||
/ 0: Disable string functions.
|
||||
/ 1: Enable without LF-CRLF conversion.
|
||||
/ 2: Enable with LF-CRLF conversion. */
|
||||
|
||||
|
||||
#define _USE_MKFS 1
|
||||
/* This option switches f_mkfs() function. (0:Disable or 1:Enable)
|
||||
/ To enable it, also _FS_READONLY need to be set to 0. */
|
||||
|
||||
|
||||
#define _USE_FASTSEEK 0
|
||||
/* This option switches fast seek feature. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define _USE_LABEL 0
|
||||
/* This option switches volume label functions, f_getlabel() and f_setlabel().
|
||||
/ (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define _USE_FORWARD 0
|
||||
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
|
||||
/* To enable it, also _FS_TINY need to be set to 1. */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Locale and Namespace Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _CODE_PAGE (MICROPY_LFN_CODE_PAGE)
|
||||
/* This option specifies the OEM code page to be used on the target system.
|
||||
/ Incorrect setting of the code page can cause a file open failure.
|
||||
/
|
||||
/ 932 - Japanese Shift_JIS (DBCS, OEM, Windows)
|
||||
/ 936 - Simplified Chinese GBK (DBCS, OEM, Windows)
|
||||
/ 949 - Korean (DBCS, OEM, Windows)
|
||||
/ 950 - Traditional Chinese Big5 (DBCS, OEM, Windows)
|
||||
/ 1250 - Central Europe (Windows)
|
||||
/ 1251 - Cyrillic (Windows)
|
||||
/ 1252 - Latin 1 (Windows)
|
||||
/ 1253 - Greek (Windows)
|
||||
/ 1254 - Turkish (Windows)
|
||||
/ 1255 - Hebrew (Windows)
|
||||
/ 1256 - Arabic (Windows)
|
||||
/ 1257 - Baltic (Windows)
|
||||
/ 1258 - Vietnam (OEM, Windows)
|
||||
/ 437 - U.S. (OEM)
|
||||
/ 720 - Arabic (OEM)
|
||||
/ 737 - Greek (OEM)
|
||||
/ 775 - Baltic (OEM)
|
||||
/ 850 - Multilingual Latin 1 (OEM)
|
||||
/ 858 - Multilingual Latin 1 + Euro (OEM)
|
||||
/ 852 - Latin 2 (OEM)
|
||||
/ 855 - Cyrillic (OEM)
|
||||
/ 866 - Russian (OEM)
|
||||
/ 857 - Turkish (OEM)
|
||||
/ 862 - Hebrew (OEM)
|
||||
/ 874 - Thai (OEM, Windows)
|
||||
/ 1 - ASCII (No extended character. Valid for only non-LFN configuration.) */
|
||||
|
||||
|
||||
#define _USE_LFN (MICROPY_ENABLE_LFN)
|
||||
#define _MAX_LFN (MICROPY_ALLOC_PATH_MAX)
|
||||
/* The _USE_LFN option switches the LFN feature.
|
||||
/
|
||||
/ 0: Disable LFN feature. _MAX_LFN has no effect.
|
||||
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
|
||||
/ 2: Enable LFN with dynamic working buffer on the STACK.
|
||||
/ 3: Enable LFN with dynamic working buffer on the HEAP.
|
||||
/
|
||||
/ When enable the LFN feature, Unicode handling functions (option/unicode.c) must
|
||||
/ be added to the project. The LFN working buffer occupies (_MAX_LFN + 1) * 2 bytes.
|
||||
/ When use stack for the working buffer, take care on stack overflow. When use heap
|
||||
/ memory for the working buffer, memory management functions, ff_memalloc() and
|
||||
/ ff_memfree(), must be added to the project. */
|
||||
|
||||
|
||||
#define _LFN_UNICODE 0
|
||||
/* This option switches character encoding on the API. (0:ANSI/OEM or 1:Unicode)
|
||||
/ To use Unicode string for the path name, enable LFN feature and set _LFN_UNICODE
|
||||
/ to 1. This option also affects behavior of string I/O functions. */
|
||||
|
||||
|
||||
#define _STRF_ENCODE 3
|
||||
/* When _LFN_UNICODE is 1, this option selects the character encoding on the file to
|
||||
/ be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf().
|
||||
/
|
||||
/ 0: ANSI/OEM
|
||||
/ 1: UTF-16LE
|
||||
/ 2: UTF-16BE
|
||||
/ 3: UTF-8
|
||||
/
|
||||
/ When _LFN_UNICODE is 0, this option has no effect. */
|
||||
|
||||
|
||||
#define _FS_RPATH 2
|
||||
/* This option configures relative path feature.
|
||||
/
|
||||
/ 0: Disable relative path feature and remove related functions.
|
||||
/ 1: Enable relative path feature. f_chdir() and f_chdrive() are available.
|
||||
/ 2: f_getcwd() function is available in addition to 1.
|
||||
/
|
||||
/ Note that directory items read via f_readdir() are affected by this option. */
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Drive/Volume Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _VOLUMES 2
|
||||
/* Number of volumes (logical drives) to be used. */
|
||||
|
||||
|
||||
#define _STR_VOLUME_ID 0
|
||||
#define _VOLUME_STRS "RAM","NAND","CF","SD1","SD2","USB1","USB2","USB3"
|
||||
/* _STR_VOLUME_ID option switches string volume ID feature.
|
||||
/ When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
|
||||
/ number in the path name. _VOLUME_STRS defines the drive ID strings for each
|
||||
/ logical drives. Number of items must be equal to _VOLUMES. Valid characters for
|
||||
/ the drive ID strings are: A-Z and 0-9. */
|
||||
|
||||
|
||||
#define _MULTI_PARTITION 0
|
||||
/* This option switches multi-partition feature. By default (0), each logical drive
|
||||
/ number is bound to the same physical drive number and only an FAT volume found on
|
||||
/ the physical drive will be mounted. When multi-partition feature is enabled (1),
|
||||
/ each logical drive number is bound to arbitrary physical drive and partition
|
||||
/ listed in the VolToPart[]. Also f_fdisk() funciton will be enabled. */
|
||||
|
||||
|
||||
#define _MIN_SS 512
|
||||
#define _MAX_SS 512
|
||||
/* These options configure the range of sector size to be supported. (512, 1024,
|
||||
/ 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
|
||||
/ harddisk. But a larger value may be required for on-board flash memory and some
|
||||
/ type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured
|
||||
/ to variable sector size and GET_SECTOR_SIZE command must be implemented to the
|
||||
/ disk_ioctl() function. */
|
||||
|
||||
|
||||
#define _USE_TRIM 0
|
||||
/* This option switches ATA-TRIM feature. (0:Disable or 1:Enable)
|
||||
/ To enable Trim feature, also CTRL_TRIM command should be implemented to the
|
||||
/ disk_ioctl() function. */
|
||||
|
||||
|
||||
#define _FS_NOFSINFO 0
|
||||
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
||||
/ option, and f_getfree() function at first time after volume mount will force
|
||||
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
||||
/
|
||||
/ bit0=0: Use free cluster count in the FSINFO if available.
|
||||
/ bit0=1: Do not trust free cluster count in the FSINFO.
|
||||
/ bit1=0: Use last allocated cluster number in the FSINFO if available.
|
||||
/ bit1=1: Do not trust last allocated cluster number in the FSINFO.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ System Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define _FS_NORTC 0
|
||||
#define _NORTC_MON 11
|
||||
#define _NORTC_MDAY 9
|
||||
#define _NORTC_YEAR 2014
|
||||
/* The _FS_NORTC option switches timestamp feature. If the system does not have
|
||||
/ an RTC function or valid timestamp is not needed, set _FS_NORTC to 1 to disable
|
||||
/ the timestamp feature. All objects modified by FatFs will have a fixed timestamp
|
||||
/ defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR.
|
||||
/ When timestamp feature is enabled (_FS_NORTC == 0), get_fattime() function need
|
||||
/ to be added to the project to read current time form RTC. _NORTC_MON,
|
||||
/ _NORTC_MDAY and _NORTC_YEAR have no effect.
|
||||
/ These options have no effect at read-only configuration (_FS_READONLY == 1). */
|
||||
|
||||
|
||||
#define _FS_LOCK 2
|
||||
/* The _FS_LOCK option switches file lock feature to control duplicated file open
|
||||
/ and illegal operation to open objects. This option must be 0 when _FS_READONLY
|
||||
/ is 1.
|
||||
/
|
||||
/ 0: Disable file lock feature. To avoid volume corruption, application program
|
||||
/ should avoid illegal open, remove and rename to the open objects.
|
||||
/ >0: Enable file lock feature. The value defines how many files/sub-directories
|
||||
/ can be opened simultaneously under file lock control. Note that the file
|
||||
/ lock feature is independent of re-entrancy. */
|
||||
|
||||
|
||||
#define _FS_REENTRANT 1
|
||||
#define _FS_TIMEOUT 2500 // milliseconds
|
||||
#define _SYNC_t SemaphoreHandle_t
|
||||
/* The _FS_REENTRANT option switches the re-entrancy (thread safe) of the FatFs
|
||||
/ module itself. Note that regardless of this option, file access to different
|
||||
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
||||
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
|
||||
/ to the same volume is under control of this feature.
|
||||
/
|
||||
/ 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect.
|
||||
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
|
||||
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
|
||||
/ function, must be added to the project. Samples are available in
|
||||
/ option/syscall.c.
|
||||
/
|
||||
/ The _FS_TIMEOUT defines timeout period in unit of time tick.
|
||||
/ The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
|
||||
/ SemaphoreHandle_t and etc.. */
|
||||
|
||||
|
||||
#define _WORD_ACCESS 0
|
||||
/* The _WORD_ACCESS option is an only platform dependent option. It defines
|
||||
/ which access method is used to the word data on the FAT volume.
|
||||
/
|
||||
/ 0: Byte-by-byte access. Always compatible with all platforms.
|
||||
/ 1: Word access. Do not choose this unless under both the following conditions.
|
||||
/
|
||||
/ * Address misaligned memory access is always allowed to ALL instructions.
|
||||
/ * Byte order on the memory is little-endian.
|
||||
/
|
||||
/ If it is the case, _WORD_ACCESS can also be set to 1 to reduce code size.
|
||||
/ Following table shows allowable settings of some processor types.
|
||||
/
|
||||
/ ARM7TDMI 0 ColdFire 0 V850E 0
|
||||
/ Cortex-M3 0 Z80 0/1 V850ES 0/1
|
||||
/ Cortex-M0 0 x86 0/1 TLCS-870 0/1
|
||||
/ AVR 0/1 RX600(LE) 0/1 TLCS-900 0/1
|
||||
/ AVR32 0 RL78 0 R32C 0
|
||||
/ PIC18 0/1 SH-2 0 M16C 0/1
|
||||
/ PIC24 0 H8S 0 MSP430 0
|
||||
/ PIC32 0 H8/300H 0 8051 0/1
|
||||
*/
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
/* (C)ChaN, 2014 */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "ff.h"
|
||||
|
||||
|
||||
@@ -134,7 +132,7 @@ void* ff_memalloc ( /* Returns pointer to the allocated memory block */
|
||||
UINT msize /* Number of bytes to allocate */
|
||||
)
|
||||
{
|
||||
return malloc(msize); /* Allocate a new memory block with POSIX API */
|
||||
return pvPortMalloc(msize); /* Allocate a new memory block with POSIX API */
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +144,7 @@ void ff_memfree (
|
||||
void* mblock /* Pointer to the memory block to free */
|
||||
)
|
||||
{
|
||||
free(mblock); /* Discard the memory block with POSIX API */
|
||||
vPortFree(mblock); /* Discard the memory block with POSIX API */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
294
cc3200/ftp/ftp.c
294
cc3200/ftp/ftp.c
@@ -26,10 +26,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ctype.h>
|
||||
#include <std.h>
|
||||
#include "std.h"
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/mpstate.h"
|
||||
#include "py/obj.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "inc/hw_ints.h"
|
||||
@@ -39,17 +38,17 @@
|
||||
#include "pybrtc.h"
|
||||
#include "ftp.h"
|
||||
#include "simplelink.h"
|
||||
#include "modnetwork.h"
|
||||
#include "modwlan.h"
|
||||
#include "modutime.h"
|
||||
#include "modusocket.h"
|
||||
#include "debug.h"
|
||||
#include "serverstask.h"
|
||||
#include "ff.h"
|
||||
#include "fifo.h"
|
||||
#include "socketfifo.h"
|
||||
#include "diskio.h"
|
||||
#include "sd_diskio.h"
|
||||
#include "updater.h"
|
||||
|
||||
#include "timeutils.h"
|
||||
#include "moduos.h"
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE CONSTANTS
|
||||
@@ -67,7 +66,6 @@
|
||||
#define FTP_UNIX_TIME_20150101 1420070400
|
||||
#define FTP_UNIX_SECONDS_180_DAYS 15552000
|
||||
#define FTP_DATA_TIMEOUT_MS 5000 // 5 seconds
|
||||
#define FTP_CMD_TIMEOUT_MS 120000 // 2 minutes
|
||||
#define FTP_SOCKETFIFO_ELEMENTS_MAX 4
|
||||
#define FTP_CYCLE_TIME_MS (SERVERS_CYCLE_TIME_MS * 2)
|
||||
|
||||
@@ -94,16 +92,12 @@ typedef enum {
|
||||
E_FTP_STE_SUB_DISCONNECTED = 0,
|
||||
E_FTP_STE_SUB_LISTEN_FOR_DATA,
|
||||
E_FTP_STE_SUB_DATA_CONNECTED
|
||||
} ftp_data_substate_t;
|
||||
|
||||
typedef union {
|
||||
ftp_data_substate_t data;
|
||||
} ftp_substate_t;
|
||||
|
||||
typedef struct {
|
||||
bool uservalid : 1;
|
||||
bool passvalid : 1;
|
||||
}ftp_loggin_t;
|
||||
} ftp_loggin_t;
|
||||
|
||||
typedef enum {
|
||||
E_FTP_NOTHING_OPEN = 0,
|
||||
@@ -129,25 +123,26 @@ typedef struct {
|
||||
int16_t c_sd;
|
||||
int16_t d_sd;
|
||||
int16_t dtimeout;
|
||||
ftp_state_t state;
|
||||
ftp_substate_t substate;
|
||||
uint16_t volcount;
|
||||
uint8_t state;
|
||||
uint8_t substate;
|
||||
uint8_t txRetries;
|
||||
uint8_t logginRetries;
|
||||
ftp_loggin_t loggin;
|
||||
uint8_t e_open;
|
||||
bool closechild;
|
||||
bool enabled;
|
||||
bool swupdating;
|
||||
|
||||
bool special_file;
|
||||
bool listroot;
|
||||
} ftp_data_t;
|
||||
|
||||
typedef struct {
|
||||
char * cmd;
|
||||
}ftp_cmd_t;
|
||||
} ftp_cmd_t;
|
||||
|
||||
typedef struct {
|
||||
char * month;
|
||||
}ftp_month_t;
|
||||
} ftp_month_t;
|
||||
|
||||
typedef enum {
|
||||
E_FTP_CMD_NOT_SUPPORTED = -1,
|
||||
@@ -174,7 +169,7 @@ typedef enum {
|
||||
E_FTP_CMD_NOOP,
|
||||
E_FTP_CMD_QUIT,
|
||||
E_FTP_NUM_FTP_CMDS
|
||||
}ftp_cmd_index_t;
|
||||
} ftp_cmd_index_t;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE DATA
|
||||
@@ -194,7 +189,7 @@ static const ftp_month_t ftp_month[] = { { "Jan" }, { "Feb" }, { "Mar" }, { "Apr
|
||||
{ "May" }, { "Jun" }, { "Jul" }, { "Ago" },
|
||||
{ "Sep" }, { "Oct" }, { "Nov" }, { "Dec" } };
|
||||
|
||||
static SocketFifoElement_t *ftp_fifoelements;
|
||||
static SocketFifoElement_t ftp_fifoelements[FTP_SOCKETFIFO_ELEMENTS_MAX];
|
||||
static FIFO_t ftp_socketfifo;
|
||||
|
||||
/******************************************************************************
|
||||
@@ -219,12 +214,11 @@ static int ftp_print_eplf_drive (char *dest, uint32_t destsize, char *name);
|
||||
static bool ftp_open_file (const char *path, int mode);
|
||||
static ftp_result_t ftp_read_file (char *filebuf, uint32_t desiredsize, uint32_t *actualsize);
|
||||
static ftp_result_t ftp_write_file (char *filebuf, uint32_t size);
|
||||
static ftp_result_t ftp_open_dir_for_listing (const char *path, char *list, uint32_t maxlistsize, uint32_t *listsize);
|
||||
static ftp_result_t ftp_open_dir_for_listing (const char *path);
|
||||
static ftp_result_t ftp_list_dir (char *list, uint32_t maxlistsize, uint32_t *listsize);
|
||||
static void ftp_open_child (char *pwd, char *dir);
|
||||
static void ftp_close_child (char *pwd);
|
||||
static void ftp_return_to_previous_path (char *pwd, char *dir);
|
||||
static void ftp_reset (void);
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
@@ -235,7 +229,6 @@ void ftp_init (void) {
|
||||
ASSERT ((ftp_path = mem_Malloc(FTP_MAX_PARAM_SIZE)) != NULL);
|
||||
ASSERT ((ftp_scratch_buffer = mem_Malloc(FTP_MAX_PARAM_SIZE)) != NULL);
|
||||
ASSERT ((ftp_cmd_buffer = mem_Malloc(FTP_MAX_PARAM_SIZE + FTP_CMD_SIZE_MAX)) != NULL);
|
||||
ASSERT ((ftp_fifoelements = mem_Malloc(FTP_SOCKETFIFO_ELEMENTS_MAX * sizeof(SocketFifoElement_t))) != NULL);
|
||||
SOCKETFIFO_Init (&ftp_socketfifo, (void *)ftp_fifoelements, FTP_SOCKETFIFO_ELEMENTS_MAX);
|
||||
ftp_data.c_sd = -1;
|
||||
ftp_data.d_sd = -1;
|
||||
@@ -243,8 +236,9 @@ void ftp_init (void) {
|
||||
ftp_data.ld_sd = -1;
|
||||
ftp_data.e_open = E_FTP_NOTHING_OPEN;
|
||||
ftp_data.state = E_FTP_STE_DISABLED;
|
||||
ftp_data.substate.data = E_FTP_STE_SUB_DISCONNECTED;
|
||||
ftp_data.swupdating = false;
|
||||
ftp_data.substate = E_FTP_STE_SUB_DISCONNECTED;
|
||||
ftp_data.special_file = false;
|
||||
ftp_data.volcount = 0;
|
||||
}
|
||||
|
||||
void ftp_run (void) {
|
||||
@@ -253,12 +247,12 @@ void ftp_run (void) {
|
||||
ftp_wait_for_enabled();
|
||||
break;
|
||||
case E_FTP_STE_START:
|
||||
if (ftp_create_listening_socket(&ftp_data.lc_sd, FTP_CMD_PORT, FTP_CMD_CLIENTS_MAX )) {
|
||||
if (wlan_is_connected() && ftp_create_listening_socket(&ftp_data.lc_sd, FTP_CMD_PORT, FTP_CMD_CLIENTS_MAX - 1)) {
|
||||
ftp_data.state = E_FTP_STE_READY;
|
||||
}
|
||||
break;
|
||||
case E_FTP_STE_READY:
|
||||
if (ftp_data.c_sd < 0 && ftp_data.substate.data == E_FTP_STE_SUB_DISCONNECTED) {
|
||||
if (ftp_data.c_sd < 0 && ftp_data.substate == E_FTP_STE_SUB_DISCONNECTED) {
|
||||
if (E_FTP_RESULT_OK == ftp_wait_for_connection(ftp_data.lc_sd, &ftp_data.c_sd)) {
|
||||
ftp_data.txRetries = 0;
|
||||
ftp_data.logginRetries = 0;
|
||||
@@ -271,7 +265,7 @@ void ftp_run (void) {
|
||||
}
|
||||
}
|
||||
if (SOCKETFIFO_IsEmpty()) {
|
||||
if (ftp_data.c_sd > 0 && ftp_data.substate.data != E_FTP_STE_SUB_LISTEN_FOR_DATA) {
|
||||
if (ftp_data.c_sd > 0 && ftp_data.substate != E_FTP_STE_SUB_LISTEN_FOR_DATA) {
|
||||
ftp_process_cmd();
|
||||
if (ftp_data.state != E_FTP_STE_READY) {
|
||||
break;
|
||||
@@ -288,8 +282,7 @@ void ftp_run (void) {
|
||||
ftp_list_dir((char *)ftp_data.dBuffer, FTP_BUFFER_SIZE, &listsize);
|
||||
if (listsize > 0) {
|
||||
ftp_send_data(listsize);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ftp_send_reply(226, NULL);
|
||||
ftp_data.state = E_FTP_STE_END_TRANSFER;
|
||||
}
|
||||
@@ -301,19 +294,21 @@ void ftp_run (void) {
|
||||
if (SOCKETFIFO_IsEmpty()) {
|
||||
uint32_t readsize;
|
||||
ftp_result_t result;
|
||||
ftp_data.ctimeout = 0;
|
||||
result = ftp_read_file ((char *)ftp_data.dBuffer, FTP_BUFFER_SIZE, &readsize);
|
||||
if (readsize > 0 && result != E_FTP_RESULT_FAILED) {
|
||||
ftp_send_data(readsize);
|
||||
ftp_data.ctimeout = 0;
|
||||
if (result == E_FTP_RESULT_FAILED) {
|
||||
ftp_send_reply(451, NULL);
|
||||
ftp_data.state = E_FTP_STE_END_TRANSFER;
|
||||
}
|
||||
else {
|
||||
if (readsize > 0) {
|
||||
ftp_send_data(readsize);
|
||||
}
|
||||
if (result == E_FTP_RESULT_OK) {
|
||||
ftp_send_reply(226, NULL);
|
||||
ftp_data.state = E_FTP_STE_END_TRANSFER;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ftp_send_reply(451, NULL);
|
||||
ftp_data.state = E_FTP_STE_END_TRANSFER;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case E_FTP_STE_CONTINUE_FILE_RX:
|
||||
@@ -324,7 +319,7 @@ void ftp_run (void) {
|
||||
ftp_data.dtimeout = 0;
|
||||
ftp_data.ctimeout = 0;
|
||||
// its a software update
|
||||
if (ftp_data.swupdating) {
|
||||
if (ftp_data.special_file) {
|
||||
if (updater_write(ftp_data.dBuffer, len)) {
|
||||
break;
|
||||
}
|
||||
@@ -344,8 +339,8 @@ void ftp_run (void) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (ftp_data.swupdating) {
|
||||
ftp_data.swupdating = false;
|
||||
if (ftp_data.special_file) {
|
||||
ftp_data.special_file = false;
|
||||
updater_finnish();
|
||||
}
|
||||
ftp_close_files();
|
||||
@@ -358,19 +353,19 @@ void ftp_run (void) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch (ftp_data.substate.data) {
|
||||
switch (ftp_data.substate) {
|
||||
case E_FTP_STE_SUB_DISCONNECTED:
|
||||
break;
|
||||
case E_FTP_STE_SUB_LISTEN_FOR_DATA:
|
||||
if (E_FTP_RESULT_OK == ftp_wait_for_connection(ftp_data.ld_sd, &ftp_data.d_sd)) {
|
||||
ftp_data.dtimeout = 0;
|
||||
ftp_data.substate.data = E_FTP_STE_SUB_DATA_CONNECTED;
|
||||
ftp_data.substate = E_FTP_STE_SUB_DATA_CONNECTED;
|
||||
}
|
||||
else if (ftp_data.dtimeout++ > FTP_DATA_TIMEOUT_MS / FTP_CYCLE_TIME_MS) {
|
||||
ftp_data.dtimeout = 0;
|
||||
// close the listening socket
|
||||
servers_close_socket(&ftp_data.ld_sd);
|
||||
ftp_data.substate.data = E_FTP_STE_SUB_DISCONNECTED;
|
||||
ftp_data.substate = E_FTP_STE_SUB_DISCONNECTED;
|
||||
}
|
||||
break;
|
||||
case E_FTP_STE_SUB_DATA_CONNECTED:
|
||||
@@ -379,7 +374,7 @@ void ftp_run (void) {
|
||||
servers_close_socket(&ftp_data.ld_sd);
|
||||
servers_close_socket(&ftp_data.d_sd);
|
||||
ftp_close_filesystem_on_error ();
|
||||
ftp_data.substate.data = E_FTP_STE_SUB_DISCONNECTED;
|
||||
ftp_data.substate = E_FTP_STE_SUB_DISCONNECTED;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -391,7 +386,7 @@ void ftp_run (void) {
|
||||
|
||||
// check the state of the data sockets
|
||||
if (ftp_data.d_sd < 0 && (ftp_data.state > E_FTP_STE_READY)) {
|
||||
ftp_data.substate.data = E_FTP_STE_SUB_DISCONNECTED;
|
||||
ftp_data.substate = E_FTP_STE_SUB_DISCONNECTED;
|
||||
ftp_data.state = E_FTP_STE_READY;
|
||||
}
|
||||
}
|
||||
@@ -406,6 +401,17 @@ void ftp_disable (void) {
|
||||
ftp_data.state = E_FTP_STE_DISABLED;
|
||||
}
|
||||
|
||||
void ftp_reset (void) {
|
||||
// close all connections and start all over again
|
||||
servers_close_socket(&ftp_data.lc_sd);
|
||||
servers_close_socket(&ftp_data.ld_sd);
|
||||
ftp_close_cmd_data();
|
||||
ftp_data.state = E_FTP_STE_START;
|
||||
ftp_data.substate = E_FTP_STE_SUB_DISCONNECTED;
|
||||
ftp_data.volcount = 0;
|
||||
SOCKETFIFO_Flush();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE FUNCTIONS
|
||||
******************************************************************************/
|
||||
@@ -427,21 +433,27 @@ static bool ftp_create_listening_socket (_i16 *sd, _u16 port, _u8 backlog) {
|
||||
_sd = *sd;
|
||||
|
||||
if (_sd > 0) {
|
||||
// add the new socket to the network administration
|
||||
modusocket_socket_add(_sd, false);
|
||||
|
||||
// Enable non-blocking mode
|
||||
nonBlockingOption.NonblockingEnabled = 1;
|
||||
ASSERT (sl_SetSockOpt(_sd, SOL_SOCKET, SL_SO_NONBLOCKING, &nonBlockingOption, sizeof(nonBlockingOption)) == SL_SOC_OK);
|
||||
ASSERT ((result = sl_SetSockOpt(_sd, SOL_SOCKET, SL_SO_NONBLOCKING, &nonBlockingOption, sizeof(nonBlockingOption))) == SL_SOC_OK);
|
||||
|
||||
// Bind the socket to a port number
|
||||
sServerAddress.sin_family = AF_INET;
|
||||
sServerAddress.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
sServerAddress.sin_addr.s_addr = INADDR_ANY;
|
||||
sServerAddress.sin_port = htons(port);
|
||||
|
||||
ASSERT (sl_Bind(_sd, (const SlSockAddr_t *)&sServerAddress, sizeof(sServerAddress)) == SL_SOC_OK);
|
||||
ASSERT ((result |= sl_Bind(_sd, (const SlSockAddr_t *)&sServerAddress, sizeof(sServerAddress))) == SL_SOC_OK);
|
||||
|
||||
// Start listening
|
||||
ASSERT ((result = sl_Listen (_sd, backlog)) == SL_SOC_OK);
|
||||
ASSERT ((result |= sl_Listen (_sd, backlog)) == SL_SOC_OK);
|
||||
|
||||
return (result == SL_SOC_OK) ? true : false;
|
||||
if (result == SL_SOC_OK) {
|
||||
return true;
|
||||
}
|
||||
servers_close_socket(sd);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -462,6 +474,9 @@ static ftp_result_t ftp_wait_for_connection (_i16 l_sd, _i16 *n_sd) {
|
||||
return E_FTP_RESULT_FAILED;
|
||||
}
|
||||
|
||||
// add the new socket to the network administration
|
||||
modusocket_socket_add(_sd, false);
|
||||
|
||||
// client connected, so go on
|
||||
return E_FTP_RESULT_OK;
|
||||
}
|
||||
@@ -537,7 +552,7 @@ static void ftp_send_from_fifo (void) {
|
||||
servers_close_socket(&ftp_data.ld_sd);
|
||||
// this one is the command socket
|
||||
servers_close_socket(fifoelement.sd);
|
||||
ftp_data.substate.data = E_FTP_STE_SUB_DISCONNECTED;
|
||||
ftp_data.substate = E_FTP_STE_SUB_DISCONNECTED;
|
||||
}
|
||||
ftp_close_filesystem_on_error();
|
||||
}
|
||||
@@ -558,8 +573,8 @@ static void ftp_send_from_fifo (void) {
|
||||
// close the listening and the data sockets
|
||||
servers_close_socket(&ftp_data.ld_sd);
|
||||
servers_close_socket(&ftp_data.d_sd);
|
||||
if (ftp_data.swupdating) {
|
||||
ftp_data.swupdating = false;
|
||||
if (ftp_data.special_file) {
|
||||
ftp_data.special_file = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -587,13 +602,16 @@ static void ftp_process_cmd (void) {
|
||||
_i32 len;
|
||||
char *bufptr = (char *)ftp_cmd_buffer;
|
||||
ftp_result_t result;
|
||||
uint32_t listsize;
|
||||
FILINFO fno;
|
||||
FRESULT fres;
|
||||
FILINFO fno;
|
||||
#if _USE_LFN
|
||||
fno.lfname = NULL;
|
||||
fno.lfsize = 0;
|
||||
#endif
|
||||
|
||||
ftp_data.closechild = false;
|
||||
// also use the reply buffer to receive new commands
|
||||
if (E_FTP_RESULT_OK == (result = ftp_recv_non_blocking(ftp_data.c_sd, ftp_cmd_buffer, FTP_BUFFER_SIZE, &len))) {
|
||||
if (E_FTP_RESULT_OK == (result = ftp_recv_non_blocking(ftp_data.c_sd, ftp_cmd_buffer, FTP_MAX_PARAM_SIZE + FTP_CMD_SIZE_MAX, &len))) {
|
||||
// bufptr is moved as commands are being popped
|
||||
ftp_cmd_index_t cmd = ftp_pop_command(&bufptr);
|
||||
if (!ftp_data.loggin.passvalid && (cmd != E_FTP_CMD_USER && cmd != E_FTP_CMD_PASS && cmd != E_FTP_CMD_QUIT)) {
|
||||
@@ -665,7 +683,7 @@ static void ftp_process_cmd (void) {
|
||||
case E_FTP_CMD_USER:
|
||||
ftp_pop_param (&bufptr, ftp_scratch_buffer);
|
||||
if (!memcmp(ftp_scratch_buffer, servers_user, MAX(strlen(ftp_scratch_buffer), strlen(servers_user)))) {
|
||||
ftp_data.loggin.uservalid = true;
|
||||
ftp_data.loggin.uservalid = true && (strlen(servers_user) == strlen(ftp_scratch_buffer));
|
||||
}
|
||||
ftp_send_reply(331, NULL);
|
||||
break;
|
||||
@@ -673,21 +691,22 @@ static void ftp_process_cmd (void) {
|
||||
ftp_pop_param (&bufptr, ftp_scratch_buffer);
|
||||
if (!memcmp(ftp_scratch_buffer, servers_pass, MAX(strlen(ftp_scratch_buffer), strlen(servers_pass))) &&
|
||||
ftp_data.loggin.uservalid) {
|
||||
ftp_data.loggin.passvalid = true;
|
||||
ftp_send_reply(230, NULL);
|
||||
}
|
||||
else {
|
||||
ftp_send_reply(530, NULL);
|
||||
ftp_data.loggin.passvalid = true && (strlen(servers_pass) == strlen(ftp_scratch_buffer));
|
||||
if (ftp_data.loggin.passvalid) {
|
||||
ftp_send_reply(230, NULL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ftp_send_reply(530, NULL);
|
||||
break;
|
||||
case E_FTP_CMD_PASV:
|
||||
{
|
||||
// some servers (e.g. google chrome) send PASV several times very quickly
|
||||
servers_close_socket(&ftp_data.d_sd);
|
||||
ftp_data.substate.data = E_FTP_STE_SUB_DISCONNECTED;
|
||||
ftp_data.substate = E_FTP_STE_SUB_DISCONNECTED;
|
||||
bool socketcreated = true;
|
||||
if (ftp_data.ld_sd < 0) {
|
||||
socketcreated = ftp_create_listening_socket(&ftp_data.ld_sd, FTP_PASIVE_DATA_PORT, FTP_DATA_CLIENTS_MAX);
|
||||
socketcreated = ftp_create_listening_socket(&ftp_data.ld_sd, FTP_PASIVE_DATA_PORT, FTP_DATA_CLIENTS_MAX - 1);
|
||||
}
|
||||
if (socketcreated) {
|
||||
uint32_t ip;
|
||||
@@ -695,8 +714,8 @@ static void ftp_process_cmd (void) {
|
||||
ftp_data.dtimeout = 0;
|
||||
wlan_get_ip(&ip);
|
||||
snprintf((char *)ftp_data.dBuffer, FTP_BUFFER_SIZE, "(%u,%u,%u,%u,%u,%u)",
|
||||
pip[0], pip[1], pip[2], pip[3], (FTP_PASIVE_DATA_PORT >> 8), (FTP_PASIVE_DATA_PORT & 0xFF));
|
||||
ftp_data.substate.data = E_FTP_STE_SUB_LISTEN_FOR_DATA;
|
||||
pip[3], pip[2], pip[1], pip[0], (FTP_PASIVE_DATA_PORT >> 8), (FTP_PASIVE_DATA_PORT & 0xFF));
|
||||
ftp_data.substate = E_FTP_STE_SUB_LISTEN_FOR_DATA;
|
||||
ftp_send_reply(227, (char *)ftp_data.dBuffer);
|
||||
}
|
||||
else {
|
||||
@@ -705,13 +724,7 @@ static void ftp_process_cmd (void) {
|
||||
}
|
||||
break;
|
||||
case E_FTP_CMD_LIST:
|
||||
if ((result = ftp_open_dir_for_listing(ftp_path, (char *)ftp_data.dBuffer, FTP_BUFFER_SIZE, &listsize)) == E_FTP_RESULT_OK) {
|
||||
ftp_data.state = E_FTP_STE_END_TRANSFER;
|
||||
ftp_send_reply(150, NULL);
|
||||
ftp_send_data(listsize);
|
||||
ftp_send_reply(226, NULL);
|
||||
}
|
||||
else if (result == E_FTP_RESULT_CONTINUE) {
|
||||
if (ftp_open_dir_for_listing(ftp_path) == E_FTP_RESULT_CONTINUE) {
|
||||
ftp_data.state = E_FTP_STE_CONTINUE_LISTING;
|
||||
ftp_send_reply(150, NULL);
|
||||
}
|
||||
@@ -734,15 +747,14 @@ static void ftp_process_cmd (void) {
|
||||
ftp_get_param_and_open_child (&bufptr);
|
||||
// first check if a software update is being requested
|
||||
if (updater_check_path (ftp_path)) {
|
||||
// start by erasing the previous status file
|
||||
// must be done before starting the updater
|
||||
f_unlink(ftp_path);
|
||||
if (updater_start()) {
|
||||
ftp_data.swupdating = true;
|
||||
ftp_data.special_file = true;
|
||||
ftp_data.state = E_FTP_STE_CONTINUE_FILE_RX;
|
||||
ftp_send_reply(150, NULL);
|
||||
}
|
||||
else {
|
||||
// to unlock the updater
|
||||
updater_finnish();
|
||||
ftp_data.state = E_FTP_STE_END_TRANSFER;
|
||||
ftp_send_reply(550, NULL);
|
||||
}
|
||||
@@ -815,7 +827,7 @@ static void ftp_process_cmd (void) {
|
||||
}
|
||||
}
|
||||
else if (result == E_FTP_RESULT_CONTINUE) {
|
||||
if (ftp_data.ctimeout++ > (FTP_CMD_TIMEOUT_MS / FTP_CYCLE_TIME_MS)) {
|
||||
if (ftp_data.ctimeout++ > (servers_get_timeout() / FTP_CYCLE_TIME_MS)) {
|
||||
ftp_send_reply(221, NULL);
|
||||
}
|
||||
}
|
||||
@@ -836,9 +848,9 @@ static void ftp_close_files (void) {
|
||||
|
||||
static void ftp_close_filesystem_on_error (void) {
|
||||
ftp_close_files();
|
||||
if (ftp_data.swupdating) {
|
||||
if (ftp_data.special_file) {
|
||||
updater_finnish ();
|
||||
ftp_data.swupdating = false;
|
||||
ftp_data.special_file = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -874,37 +886,43 @@ static int ftp_print_eplf_item (char *dest, uint32_t destsize, FILINFO *fno) {
|
||||
|
||||
char *type = (fno->fattrib & AM_DIR) ? "d" : "-";
|
||||
uint32_t tseconds;
|
||||
uint16_t mseconds;
|
||||
uint mindex = (((fno->fdate >> 5) & 0x0f) > 0) ? (((fno->fdate >> 5) & 0x0f) - 1) : 0;
|
||||
uint day = ((fno->fdate & 0x1f) > 0) ? (fno->fdate & 0x1f) : 1;
|
||||
uint fseconds = mod_time_seconds_since_2000(1980 + ((fno->fdate >> 9) & 0x7f),
|
||||
uint fseconds = timeutils_seconds_since_2000(1980 + ((fno->fdate >> 9) & 0x7f),
|
||||
(fno->fdate >> 5) & 0x0f,
|
||||
fno->fdate & 0x1f,
|
||||
(fno->ftime >> 11) & 0x1f,
|
||||
(fno->ftime >> 5) & 0x3f,
|
||||
2 * (fno->ftime & 0x1f));
|
||||
MAP_PRCMRTCGet(&tseconds, &mseconds);
|
||||
tseconds = pyb_rtc_get_seconds();
|
||||
if (FTP_UNIX_SECONDS_180_DAYS < tseconds - fseconds) {
|
||||
return snprintf(dest, destsize, "%srw-rw-r-- 1 root root %9u %s %2u %5u %s\r\n",
|
||||
type, (_u32)fno->fsize, ftp_month[mindex].month, day,
|
||||
#if _USE_LFN
|
||||
1980 + ((fno->fdate >> 9) & 0x7f), *fno->lfname ? fno->lfname : fno->fname);
|
||||
#else
|
||||
1980 + ((fno->fdate >> 9) & 0x7f), fno->fname);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
return snprintf(dest, destsize, "%srw-rw-r-- 1 root root %9u %s %2u %02u:%02u %s\r\n",
|
||||
type, (_u32)fno->fsize, ftp_month[mindex].month, day,
|
||||
#if _USE_LFN
|
||||
(fno->ftime >> 11) & 0x1f, (fno->ftime >> 5) & 0x3f, *fno->lfname ? fno->lfname : fno->fname);
|
||||
#else
|
||||
(fno->ftime >> 11) & 0x1f, (fno->ftime >> 5) & 0x3f, fno->fname);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static int ftp_print_eplf_drive (char *dest, uint32_t destsize, char *name) {
|
||||
mod_struct_time tm;
|
||||
timeutils_struct_time_t tm;
|
||||
uint32_t tseconds;
|
||||
uint16_t mseconds;
|
||||
char *type = "d";
|
||||
|
||||
mod_time_seconds_since_2000_to_struct_time((FTP_UNIX_TIME_20150101 - FTP_UNIX_TIME_20000101), &tm);
|
||||
timeutils_seconds_since_2000_to_struct_time((FTP_UNIX_TIME_20150101 - FTP_UNIX_TIME_20000101), &tm);
|
||||
|
||||
MAP_PRCMRTCGet(&tseconds, &mseconds);
|
||||
tseconds = pyb_rtc_get_seconds();
|
||||
if (FTP_UNIX_SECONDS_180_DAYS < tseconds - (FTP_UNIX_TIME_20150101 - FTP_UNIX_TIME_20000101)) {
|
||||
return snprintf(dest, destsize, "%srw-rw-r-- 1 root root %9u %s %2u %5u %s\r\n",
|
||||
type, 0, ftp_month[(tm.tm_mon - 1)].month, tm.tm_mday, tm.tm_year, name);
|
||||
@@ -952,61 +970,82 @@ static ftp_result_t ftp_write_file (char *filebuf, uint32_t size) {
|
||||
return result;
|
||||
}
|
||||
|
||||
static ftp_result_t ftp_open_dir_for_listing (const char *path, char *list, uint32_t maxlistsize, uint32_t *listsize) {
|
||||
uint next = 0;
|
||||
// "hack" to list root directory
|
||||
static ftp_result_t ftp_open_dir_for_listing (const char *path) {
|
||||
// "hack" to detect the root directory
|
||||
if (path[0] == '/' && path[1] == '\0') {
|
||||
next += ftp_print_eplf_drive((list + next), (maxlistsize - next), "SFLASH");
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
if (sd_disk_ready()) {
|
||||
next += ftp_print_eplf_drive((list + next), (maxlistsize - next), "SD");
|
||||
ftp_data.listroot = true;
|
||||
} else {
|
||||
FRESULT res;
|
||||
res = f_opendir(&ftp_data.dp, path); /* Open the directory */
|
||||
if (res != FR_OK) {
|
||||
return E_FTP_RESULT_FAILED;
|
||||
}
|
||||
#endif
|
||||
*listsize = next;
|
||||
return E_FTP_RESULT_OK;
|
||||
ftp_data.e_open = E_FTP_DIR_OPEN;
|
||||
ftp_data.listroot = false;
|
||||
}
|
||||
|
||||
FRESULT res;
|
||||
res = f_opendir(&ftp_data.dp, path); /* Open the directory */
|
||||
if (res != FR_OK) {
|
||||
return E_FTP_RESULT_FAILED;
|
||||
}
|
||||
ftp_data.e_open = E_FTP_DIR_OPEN;
|
||||
return E_FTP_RESULT_CONTINUE;
|
||||
}
|
||||
|
||||
static ftp_result_t ftp_list_dir (char *list, uint32_t maxlistsize, uint32_t *listsize) {
|
||||
uint next = 0;
|
||||
uint count = 0;
|
||||
uint listcount = 0;
|
||||
FRESULT res;
|
||||
FILINFO fno;
|
||||
ftp_result_t result = E_FTP_RESULT_CONTINUE;
|
||||
FILINFO fno;
|
||||
#if _USE_LFN
|
||||
fno.lfname = mem_Malloc(_MAX_LFN);
|
||||
fno.lfsize = _MAX_LFN;
|
||||
|
||||
/* read up to 4 directory items */
|
||||
while (count++ < 4) {
|
||||
res = f_readdir(&ftp_data.dp, &fno); /* Read a directory item */
|
||||
if (res != FR_OK || fno.fname[0] == 0) {
|
||||
result = E_FTP_RESULT_OK;
|
||||
break; /* Break on error or end of dp */
|
||||
// read up to 2 directory items
|
||||
while (listcount < 2) {
|
||||
#else
|
||||
// read up to 4 directory items
|
||||
while (listcount < 4) {
|
||||
#endif
|
||||
if (ftp_data.listroot) {
|
||||
// root directory "hack"
|
||||
if (0 == ftp_data.volcount) {
|
||||
next += ftp_print_eplf_drive((list + next), (maxlistsize - next), "flash");
|
||||
} else if (ftp_data.volcount <= MP_STATE_PORT(mount_obj_list).len) {
|
||||
os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[(ftp_data.volcount - 1)]));
|
||||
next += ftp_print_eplf_drive((list + next), (maxlistsize - next), (char *)&mount_obj->path[1]);
|
||||
} else {
|
||||
if (!next) {
|
||||
// no volume found this time, we are done
|
||||
ftp_data.volcount = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
ftp_data.volcount++;
|
||||
} else {
|
||||
// a "normal" directory
|
||||
res = f_readdir(&ftp_data.dp, &fno); /* Read a directory item */
|
||||
if (res != FR_OK || fno.fname[0] == 0) {
|
||||
result = E_FTP_RESULT_OK;
|
||||
break; /* Break on error or end of dp */
|
||||
}
|
||||
if (fno.fname[0] == '.' && fno.fname[1] == 0) continue; /* Ignore . entry */
|
||||
if (fno.fname[0] == '.' && fno.fname[1] == '.' && fno.fname[2] == 0) continue; /* Ignore .. entry */
|
||||
|
||||
// add the entry to the list
|
||||
next += ftp_print_eplf_item((list + next), (maxlistsize - next), &fno);
|
||||
}
|
||||
if (fno.fname[0] == '.' && fno.fname[1] == 0) continue; /* Ignore . entry */
|
||||
if (fno.fname[0] == '.' && fno.fname[1] == '.' && fno.fname[2] == 0) continue; /* Ignore .. entry */
|
||||
|
||||
// Add the entry to the list
|
||||
next += ftp_print_eplf_item((list + next), (maxlistsize - next), &fno);
|
||||
listcount++;
|
||||
}
|
||||
if (result == E_FTP_RESULT_OK) {
|
||||
ftp_close_files();
|
||||
}
|
||||
*listsize = next;
|
||||
#if _USE_LFN
|
||||
mem_Free(fno.lfname);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
static void ftp_open_child (char *pwd, char *dir) {
|
||||
if (dir[0] == '/') {
|
||||
strcpy (pwd, dir);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (strlen(pwd) > 1) {
|
||||
strcat (pwd, "/");
|
||||
}
|
||||
@@ -1026,8 +1065,7 @@ static void ftp_close_child (char *pwd) {
|
||||
}
|
||||
if (len == 0) {
|
||||
strcpy (pwd, "/");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pwd[len] = '\0';
|
||||
}
|
||||
}
|
||||
@@ -1040,19 +1078,9 @@ static void ftp_return_to_previous_path (char *pwd, char *dir) {
|
||||
else {
|
||||
if (newlen == 0) {
|
||||
strcpy (pwd, "/");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pwd[newlen] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ftp_reset (void) {
|
||||
// close all connections and start all over again
|
||||
servers_close_socket(&ftp_data.lc_sd);
|
||||
servers_close_socket(&ftp_data.ld_sd);
|
||||
ftp_close_cmd_data();
|
||||
ftp_data.state = E_FTP_STE_START;
|
||||
ftp_data.substate.data = E_FTP_STE_SUB_DISCONNECTED;
|
||||
SOCKETFIFO_Flush();
|
||||
}
|
||||
|
||||
@@ -34,5 +34,6 @@ extern void ftp_init (void);
|
||||
extern void ftp_run (void);
|
||||
extern void ftp_enable (void);
|
||||
extern void ftp_disable (void);
|
||||
extern void ftp_reset (void);
|
||||
|
||||
#endif /* FTP_H_ */
|
||||
|
||||
@@ -1,22 +1,52 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "std.h"
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/obj.h"
|
||||
#include "simplelink.h"
|
||||
#include "flc.h"
|
||||
#include "updater.h"
|
||||
#include "shamd5.h"
|
||||
#include "modnetwork.h"
|
||||
#include "modwlan.h"
|
||||
#include "debug.h"
|
||||
#include "osi.h"
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE CONSTANTS
|
||||
******************************************************************************/
|
||||
#define UPDATER_IMG_PATH "/SFLASH/SYS/MCUIMG.BIN"
|
||||
#define UPDATER_SRVPACK_PATH "/SFLASH/SYS/SRVPCK.UCF"
|
||||
#define UPDATER_SIGN_PATH "/SFLASH/SYS/SRVPCK.SIG"
|
||||
#define UPDATER_IMG_PATH "/flash/sys/mcuimg.bin"
|
||||
#define UPDATER_SRVPACK_PATH "/flash/sys/servicepack.ucf"
|
||||
#define UPDATER_SIGN_PATH "/flash/sys/servicepack.sig"
|
||||
#define UPDATER_CA_PATH "/flash/cert/ca.pem"
|
||||
#define UPDATER_CERT_PATH "/flash/cert/cert.pem"
|
||||
#define UPDATER_KEY_PATH "/flash/cert/private.key"
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE TYPES
|
||||
@@ -31,35 +61,65 @@ typedef struct {
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE DATA
|
||||
******************************************************************************/
|
||||
static updater_data_t updater_data;
|
||||
static updater_data_t updater_data = { .path = NULL, .fhandle = -1, .fsize = 0, .foffset = 0 };
|
||||
static OsiLockObj_t updater_LockObj;
|
||||
static sBootInfo_t sBootInfo;
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
__attribute__ ((section (".boot")))
|
||||
void updater_pre_init (void) {
|
||||
// create the updater lock
|
||||
ASSERT(OSI_OK == sl_LockObjCreate(&updater_LockObj, "UpdaterLock"));
|
||||
}
|
||||
|
||||
bool updater_check_path (void *path) {
|
||||
// conert the path supplied to upper case
|
||||
stoupper (path);
|
||||
sl_LockObjLock (&updater_LockObj, SL_OS_WAIT_FOREVER);
|
||||
if (!strcmp(UPDATER_IMG_PATH, path)) {
|
||||
updater_data.path = IMG_UPDATE;
|
||||
updater_data.fsize = IMG_SIZE;
|
||||
return true;
|
||||
}
|
||||
else if (!strcmp(UPDATER_SRVPACK_PATH, path)) {
|
||||
updater_data.path = IMG_UPDATE1;
|
||||
// the launchxl doesn't have enough flash space for 2 user update images
|
||||
#ifdef WIPY
|
||||
// check which one should be the next active image
|
||||
_i32 fhandle;
|
||||
if (!sl_FsOpen((unsigned char *)IMG_BOOT_INFO, FS_MODE_OPEN_READ, NULL, &fhandle)) {
|
||||
ASSERT (sizeof(sBootInfo_t) == sl_FsRead(fhandle, 0, (unsigned char *)&sBootInfo, sizeof(sBootInfo_t)));
|
||||
sl_FsClose(fhandle, 0, 0, 0);
|
||||
// if we still have an image pending for verification, keep overwriting it
|
||||
if ((sBootInfo.Status == IMG_STATUS_CHECK && sBootInfo.ActiveImg == IMG_ACT_UPDATE2) ||
|
||||
(sBootInfo.ActiveImg == IMG_ACT_UPDATE1 && sBootInfo.Status != IMG_STATUS_CHECK)) {
|
||||
updater_data.path = IMG_UPDATE2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if (!strcmp(UPDATER_SRVPACK_PATH, path)) {
|
||||
updater_data.path = IMG_SRVPACK;
|
||||
updater_data.fsize = SRVPACK_SIZE;
|
||||
return true;
|
||||
}
|
||||
else if (!strcmp(UPDATER_SIGN_PATH, path)) {
|
||||
} else if (!strcmp(UPDATER_SIGN_PATH, path)) {
|
||||
updater_data.path = SRVPACK_SIGN;
|
||||
updater_data.fsize = SIGN_SIZE;
|
||||
return true;
|
||||
} else if (!strcmp(UPDATER_CA_PATH, path)) {
|
||||
updater_data.path = CA_FILE;
|
||||
updater_data.fsize = CA_KEY_SIZE;
|
||||
} else if (!strcmp(UPDATER_CERT_PATH, path)) {
|
||||
updater_data.path = CERT_FILE;
|
||||
updater_data.fsize = CA_KEY_SIZE;
|
||||
} else if (!strcmp(UPDATER_KEY_PATH, path)) {
|
||||
updater_data.path = KEY_FILE;
|
||||
updater_data.fsize = CA_KEY_SIZE;
|
||||
} else {
|
||||
sl_LockObjUnlock (&updater_LockObj);
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool updater_start (void) {
|
||||
_u32 AccessModeAndMaxSize = FS_MODE_OPEN_WRITE;
|
||||
SlFsFileInfo_t FsFileInfo;
|
||||
bool result = false;
|
||||
|
||||
sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
|
||||
if (0 != sl_FsGetInfo((_u8 *)updater_data.path, 0, &FsFileInfo)) {
|
||||
// file doesn't exist, create it
|
||||
@@ -67,49 +127,76 @@ bool updater_start (void) {
|
||||
}
|
||||
if (!sl_FsOpen((_u8 *)updater_data.path, AccessModeAndMaxSize, NULL, &updater_data.fhandle)) {
|
||||
updater_data.foffset = 0;
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
sl_LockObjUnlock (&wlan_LockObj);
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
bool updater_write (uint8_t *buf, uint32_t len) {
|
||||
bool result = false;
|
||||
|
||||
sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
|
||||
if (len == sl_FsWrite(updater_data.fhandle, updater_data.foffset, buf, len)) {
|
||||
updater_data.foffset += len;
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
return false;
|
||||
sl_LockObjUnlock (&wlan_LockObj);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void updater_finnish (void) {
|
||||
sBootInfo_t sBootInfo;
|
||||
_i32 fhandle;
|
||||
|
||||
if (updater_data.fhandle > 0) {
|
||||
sl_LockObjLock (&wlan_LockObj, SL_OS_WAIT_FOREVER);
|
||||
// close the file being updated
|
||||
sl_FsClose(updater_data.fhandle, NULL, NULL, 0);
|
||||
|
||||
if (!strcmp (IMG_UPDATE, updater_data.path)) {
|
||||
// open the boot info file for reading
|
||||
#ifdef WIPY
|
||||
// if we still have an image pending for verification, leave the boot info as it is
|
||||
if (!strncmp(IMG_PREFIX, updater_data.path, strlen(IMG_PREFIX)) && sBootInfo.Status != IMG_STATUS_CHECK) {
|
||||
#else
|
||||
if (!strncmp(IMG_PREFIX, updater_data.path, strlen(IMG_PREFIX))) {
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
if (!sl_FsOpen((unsigned char *)IMG_BOOT_INFO, FS_MODE_OPEN_READ, NULL, &fhandle)) {
|
||||
|
||||
ASSERT (sizeof(sBootInfo_t) == sl_FsRead(fhandle, 0, (unsigned char *)&sBootInfo, sizeof(sBootInfo_t)));
|
||||
sl_FsClose(fhandle, 0, 0, 0);
|
||||
// open the file for writing
|
||||
#endif
|
||||
// open the boot info file for writing
|
||||
ASSERT (sl_FsOpen((unsigned char *)IMG_BOOT_INFO, FS_MODE_OPEN_WRITE, NULL, &fhandle) == 0);
|
||||
#ifdef DEBUG
|
||||
}
|
||||
else {
|
||||
// the boot info file doesn't exist yet
|
||||
_u32 BootInfoCreateFlag = _FS_FILE_OPEN_FLAG_COMMIT | _FS_FILE_PUBLIC_WRITE | _FS_FILE_PUBLIC_READ;
|
||||
ASSERT (sl_FsOpen ((unsigned char *)IMG_BOOT_INFO, FS_MODE_OPEN_CREATE((2 * sizeof(sBootInfo_t)),
|
||||
BootInfoCreateFlag), NULL, &fhandle) == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
// write the new boot info
|
||||
sBootInfo.ActiveImg = IMG_ACT_UPDATE;
|
||||
// save the new boot info
|
||||
#ifdef WIPY
|
||||
sBootInfo.PrevImg = sBootInfo.ActiveImg;
|
||||
if (sBootInfo.ActiveImg == IMG_ACT_UPDATE1) {
|
||||
sBootInfo.ActiveImg = IMG_ACT_UPDATE2;
|
||||
} else {
|
||||
sBootInfo.ActiveImg = IMG_ACT_UPDATE1;
|
||||
}
|
||||
// the launchxl doesn't have enough flash space for 2 user updates
|
||||
#else
|
||||
sBootInfo.PrevImg = IMG_ACT_FACTORY;
|
||||
sBootInfo.ActiveImg = IMG_ACT_UPDATE1;
|
||||
#endif
|
||||
sBootInfo.Status = IMG_STATUS_CHECK;
|
||||
ASSERT (sizeof(sBootInfo_t) == sl_FsWrite(fhandle, 0, (unsigned char *)&sBootInfo, sizeof(sBootInfo_t)));
|
||||
sl_FsClose(fhandle, 0, 0, 0);
|
||||
}
|
||||
sl_LockObjUnlock (&wlan_LockObj);
|
||||
updater_data.fhandle = -1;
|
||||
}
|
||||
updater_data.fhandle = -1;
|
||||
sl_LockObjUnlock (&wlan_LockObj);
|
||||
sl_LockObjUnlock (&updater_LockObj);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,38 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef UPDATER_H_
|
||||
#define UPDATER_H_
|
||||
|
||||
bool updater_check_path (void *path);
|
||||
bool updater_start (void);
|
||||
bool updater_write (uint8_t *buf, uint32_t len);
|
||||
void updater_finnish (void);
|
||||
bool updater_verify (uint8_t *rbuff, uint8_t *hasbuff);
|
||||
extern void updater_pre_init (void);
|
||||
extern bool updater_check_path (void *path);
|
||||
extern bool updater_start (void);
|
||||
extern bool updater_write (uint8_t *buf, uint32_t len);
|
||||
extern void updater_finnish (void);
|
||||
extern bool updater_verify (uint8_t *rbuff, uint8_t *hasbuff);
|
||||
|
||||
#endif /* UPDATER_H_ */
|
||||
|
||||
@@ -67,6 +67,18 @@ static inline void __set_PRIMASK(uint32_t priMask) {
|
||||
__asm volatile ("msr primask, %0" : : "r" (priMask) : "memory");
|
||||
}
|
||||
|
||||
__attribute__(( always_inline ))
|
||||
static inline uint32_t __get_BASEPRI(void) {
|
||||
uint32_t result;
|
||||
__asm volatile ("mrs %0, basepri" : "=r" (result));
|
||||
return(result);
|
||||
}
|
||||
|
||||
__attribute__(( always_inline ))
|
||||
static inline void __set_BASEPRI(uint32_t value) {
|
||||
__asm volatile ("msr basepri, %0" : : "r" (value) : "memory");
|
||||
}
|
||||
|
||||
__attribute__(( always_inline ))
|
||||
static inline void enable_irq(mp_uint_t state) {
|
||||
__set_PRIMASK(state);
|
||||
|
||||
@@ -31,12 +31,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "py/mpstate.h"
|
||||
#include "py/mphal.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/objstr.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "inc/hw_ints.h"
|
||||
#include "inc/hw_nvic.h"
|
||||
#include "hw_memmap.h"
|
||||
#include "py/mpstate.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "rom_map.h"
|
||||
#include "interrupt.h"
|
||||
#include "systick.h"
|
||||
@@ -45,6 +49,9 @@
|
||||
#include "mpexception.h"
|
||||
#include "telnet.h"
|
||||
#include "pybuart.h"
|
||||
#include "utils.h"
|
||||
#include "irq.h"
|
||||
#include "moduos.h"
|
||||
|
||||
#ifdef USE_FREERTOS
|
||||
#include "FreeRTOS.h"
|
||||
@@ -65,11 +72,6 @@ static void hal_TickInit (void);
|
||||
******************************************************************************/
|
||||
static volatile uint32_t HAL_tickCount;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PUBLIC DATA
|
||||
******************************************************************************/
|
||||
struct _pyb_uart_obj_t *pyb_stdio_uart;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE IMPORTED DATA
|
||||
******************************************************************************/
|
||||
@@ -102,21 +104,34 @@ void HAL_IncrementTick(void) {
|
||||
HAL_tickCount++;
|
||||
}
|
||||
|
||||
uint32_t HAL_GetTick(void) {
|
||||
mp_uint_t mp_hal_ticks_ms(void) {
|
||||
return HAL_tickCount;
|
||||
}
|
||||
|
||||
void HAL_Delay(uint32_t delay) {
|
||||
#ifdef USE_FREERTOS
|
||||
vTaskDelay (delay / portTICK_PERIOD_MS);
|
||||
#else
|
||||
uint32_t start = HAL_tickCount;
|
||||
// Wraparound of tick is taken care of by 2's complement arithmetic.
|
||||
while (HAL_tickCount - start < delay) {
|
||||
// Enter sleep mode, waiting for (at least) the SysTick interrupt.
|
||||
__WFI();
|
||||
void mp_hal_delay_ms(mp_uint_t delay) {
|
||||
// only if we are not within interrupt context and interrupts are enabled
|
||||
if ((HAL_NVIC_INT_CTRL_REG & HAL_VECTACTIVE_MASK) == 0 && query_irq() == IRQ_STATE_ENABLED) {
|
||||
MP_THREAD_GIL_EXIT();
|
||||
#ifdef USE_FREERTOS
|
||||
vTaskDelay (delay / portTICK_PERIOD_MS);
|
||||
#else
|
||||
uint32_t start = HAL_tickCount;
|
||||
// wraparound of tick is taken care of by 2's complement arithmetic.
|
||||
while (HAL_tickCount - start < delay) {
|
||||
// enter sleep mode, waiting for (at least) the SysTick interrupt.
|
||||
__WFI();
|
||||
}
|
||||
#endif
|
||||
MP_THREAD_GIL_ENTER();
|
||||
} else {
|
||||
for (int ms = 0; ms < delay; ms++) {
|
||||
UtilsDelay(UTILS_DELAY_US_TO_COUNT(1000));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
NORETURN void mp_hal_raise(int errno) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, mp_obj_new_int(errno)));
|
||||
}
|
||||
|
||||
void mp_hal_set_interrupt_char (int c) {
|
||||
@@ -127,37 +142,60 @@ void mp_hal_stdout_tx_str(const char *str) {
|
||||
mp_hal_stdout_tx_strn(str, strlen(str));
|
||||
}
|
||||
|
||||
void mp_hal_stdout_tx_strn(const char *str, uint32_t len) {
|
||||
// send stdout to UART
|
||||
if (pyb_stdio_uart != NULL) {
|
||||
uart_tx_strn(pyb_stdio_uart, str, len);
|
||||
void mp_hal_stdout_tx_strn(const char *str, size_t len) {
|
||||
if (MP_STATE_PORT(os_term_dup_obj)) {
|
||||
if (MP_OBJ_IS_TYPE(MP_STATE_PORT(os_term_dup_obj)->stream_o, &pyb_uart_type)) {
|
||||
uart_tx_strn(MP_STATE_PORT(os_term_dup_obj)->stream_o, str, len);
|
||||
} else {
|
||||
MP_STATE_PORT(os_term_dup_obj)->write[2] = mp_obj_new_str_of_type(&mp_type_str, (const byte *)str, len);
|
||||
mp_call_method_n_kw(1, 0, MP_STATE_PORT(os_term_dup_obj)->write);
|
||||
}
|
||||
}
|
||||
// and also to telnet
|
||||
if (telnet_is_active()) {
|
||||
telnet_tx_strn(str, len);
|
||||
}
|
||||
telnet_tx_strn(str, len);
|
||||
}
|
||||
|
||||
void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len) {
|
||||
// send stdout to UART
|
||||
if (pyb_stdio_uart != NULL) {
|
||||
uart_tx_strn_cooked(pyb_stdio_uart, str, len);
|
||||
void mp_hal_stdout_tx_strn_cooked (const char *str, size_t len) {
|
||||
int32_t nslen = 0;
|
||||
const char *_str = str;
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (str[i] == '\n') {
|
||||
mp_hal_stdout_tx_strn(_str, nslen);
|
||||
mp_hal_stdout_tx_strn("\r\n", 2);
|
||||
_str += nslen + 1;
|
||||
nslen = 0;
|
||||
} else {
|
||||
nslen++;
|
||||
}
|
||||
}
|
||||
// and also to telnet
|
||||
if (telnet_is_active()) {
|
||||
telnet_tx_strn_cooked(str, len);
|
||||
if (_str < str + len) {
|
||||
mp_hal_stdout_tx_strn(_str, nslen);
|
||||
}
|
||||
}
|
||||
|
||||
int mp_hal_stdin_rx_chr(void) {
|
||||
for ( ;; ) {
|
||||
// read telnet first
|
||||
if (telnet_rx_any()) {
|
||||
return telnet_rx_char();
|
||||
} else if (MP_STATE_PORT(os_term_dup_obj)) { // then the stdio_dup
|
||||
if (MP_OBJ_IS_TYPE(MP_STATE_PORT(os_term_dup_obj)->stream_o, &pyb_uart_type)) {
|
||||
if (uart_rx_any(MP_STATE_PORT(os_term_dup_obj)->stream_o)) {
|
||||
return uart_rx_char(MP_STATE_PORT(os_term_dup_obj)->stream_o);
|
||||
}
|
||||
} else {
|
||||
MP_STATE_PORT(os_term_dup_obj)->read[2] = mp_obj_new_int(1);
|
||||
mp_obj_t data = mp_call_method_n_kw(1, 0, MP_STATE_PORT(os_term_dup_obj)->read);
|
||||
// data len is > 0
|
||||
if (mp_obj_is_true(data)) {
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
|
||||
return ((int *)(bufinfo.buf))[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pyb_stdio_uart != NULL && uart_rx_any(pyb_stdio_uart)) {
|
||||
return uart_rx_char(pyb_stdio_uart);
|
||||
}
|
||||
HAL_Delay(1);
|
||||
mp_hal_delay_ms(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#define HAL_FCPU_MHZ 80U
|
||||
#define HAL_FCPU_HZ (1000000U * HAL_FCPU_MHZ)
|
||||
#define HAL_SYSTICK_PERIOD_US 1000U
|
||||
#define UTILS_DELAY_US_TO_COUNT(us) (((us) * HAL_FCPU_MHZ) / 3)
|
||||
#define UTILS_DELAY_US_TO_COUNT(us) (((us) * HAL_FCPU_MHZ) / 6)
|
||||
|
||||
#define HAL_NVIC_INT_CTRL_REG (*((volatile uint32_t *) 0xE000ED04 ) )
|
||||
#define HAL_VECTACTIVE_MASK (0x1FUL)
|
||||
@@ -55,11 +55,6 @@
|
||||
" isb \n"); \
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PUBLIC DATA
|
||||
******************************************************************************/
|
||||
extern struct _pyb_uart_obj_t *pyb_stdio_uart;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
@@ -67,13 +62,7 @@ extern struct _pyb_uart_obj_t *pyb_stdio_uart;
|
||||
extern void HAL_SystemInit (void);
|
||||
extern void HAL_SystemDeInit (void);
|
||||
extern void HAL_IncrementTick(void);
|
||||
extern uint32_t HAL_GetTick(void);
|
||||
extern void HAL_Delay(uint32_t delay);
|
||||
extern NORETURN void mp_hal_raise(int errno);
|
||||
extern void mp_hal_set_interrupt_char (int c);
|
||||
|
||||
int mp_hal_stdin_rx_chr(void);
|
||||
void mp_hal_stdout_tx_str(const char *str);
|
||||
void mp_hal_stdout_tx_strn(const char *str, uint32_t len);
|
||||
void mp_hal_stdout_tx_strn_cooked(const char *str, uint32_t len);
|
||||
|
||||
#endif /* CC3200_LAUNCHXL_HAL_CC3200_HAL_H_ */
|
||||
|
||||
@@ -49,15 +49,6 @@
|
||||
#include "inc/hw_ocp_shared.h"
|
||||
#include "pin.h"
|
||||
|
||||
//*****************************************************************************
|
||||
// Macros
|
||||
//*****************************************************************************
|
||||
#define PAD_MODE_MASK 0x0000000F
|
||||
#define PAD_STRENGTH_MASK 0x000000E0
|
||||
#define PAD_TYPE_MASK 0x00000310
|
||||
#define PAD_CONFIG_BASE ((OCP_SHARED_BASE + \
|
||||
OCP_SHARED_O_GPIO_PAD_CONFIG_0))
|
||||
|
||||
//*****************************************************************************
|
||||
// PIN to PAD matrix
|
||||
//*****************************************************************************
|
||||
|
||||
@@ -143,6 +143,13 @@ extern "C"
|
||||
#define PIN_TYPE_OD_PD 0x00000210
|
||||
#define PIN_TYPE_ANALOG 0x10000000
|
||||
|
||||
//*****************************************************************************
|
||||
// Macros for mode and type
|
||||
//*****************************************************************************
|
||||
#define PAD_MODE_MASK 0x0000000F
|
||||
#define PAD_STRENGTH_MASK 0x000000E0
|
||||
#define PAD_TYPE_MASK 0x00000310
|
||||
#define PAD_CONFIG_BASE ((OCP_SHARED_BASE + OCP_SHARED_O_GPIO_PAD_CONFIG_0))
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
|
||||
@@ -112,28 +112,29 @@
|
||||
// following wrapper can be used to convert the value from cycles to
|
||||
// millisecond:
|
||||
//
|
||||
// CYCLES_U16MS(cycles) ((cycles *1000)/ 1024),
|
||||
// CYCLES_U16MS(cycles) ((cycles * 1000) / 1024),
|
||||
//
|
||||
// Similarly, before setting the value, it must be first converted (from ms to
|
||||
// cycles).
|
||||
//
|
||||
// U16MS_CYCLES(msec) ((msec *1024)/1000)
|
||||
// U16MS_CYCLES(msec) ((msec * 1024) / 1000)
|
||||
//
|
||||
// Note: There is a precision loss of 1 ms with the above scheme.
|
||||
//
|
||||
//
|
||||
#define SCC_U64MSEC_GET() (MAP_PRCMSlowClkCtrGet() >> 5)
|
||||
#define SCC_U64MSEC_GET() (RTCFastDomainCounterGet() >> 5)
|
||||
#define SCC_U64MSEC_MATCH_SET(u64Msec) (MAP_PRCMSlowClkCtrMatchSet(u64Msec << 5))
|
||||
#define SCC_U64MSEC_MATCH_GET() (MAP_PRCMSlowClkCtrMatchGet() >> 5)
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Bit: 31 is used to indicate use of RTC. If set as '1', RTC feature is used.
|
||||
// Bit: 30 is used to indicate that a safe boot should be performed
|
||||
// bit: 29 is used to indicate that the last reset was caused by the WDT
|
||||
// Bits: 28 to 26 are unused
|
||||
// Bit: 30 is used to indicate that a safe boot should be performed.
|
||||
// bit: 29 is used to indicate that the last reset was caused by the WDT.
|
||||
// bit: 28 is used to indicate that the board is booting for the first time after being programmed in factory.
|
||||
// Bits: 27 and 26 are unused.
|
||||
// Bits: 25 to 16 are used to save millisecond part of RTC reference.
|
||||
// Bits: 15 to 0 are being used for HW Changes / ECO
|
||||
// Bits: 15 to 0 are being used for HW Changes / ECO.
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
@@ -207,6 +208,39 @@ static void RTCU32SecRegWrite(unsigned long u32Msec)
|
||||
MAP_PRCMHIBRegWrite(RTC_SECS_U32_REG_ADDR, u32Msec);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Fast function to get the most accurate RTC counter value
|
||||
//*****************************************************************************
|
||||
static unsigned long long RTCFastDomainCounterGet (void) {
|
||||
|
||||
#define BRK_IF_RTC_CTRS_ALIGN(c2, c1) if (c2 - c1 <= 1) { \
|
||||
itr++; \
|
||||
break; \
|
||||
}
|
||||
|
||||
unsigned long long rtc_count1, rtc_count2, rtc_count3;
|
||||
unsigned int itr;
|
||||
|
||||
do {
|
||||
rtc_count1 = PRCMSlowClkCtrFastGet();
|
||||
rtc_count2 = PRCMSlowClkCtrFastGet();
|
||||
rtc_count3 = PRCMSlowClkCtrFastGet();
|
||||
itr = 0;
|
||||
|
||||
BRK_IF_RTC_CTRS_ALIGN(rtc_count2, rtc_count1);
|
||||
BRK_IF_RTC_CTRS_ALIGN(rtc_count3, rtc_count2);
|
||||
BRK_IF_RTC_CTRS_ALIGN(rtc_count3, rtc_count1);
|
||||
|
||||
// Consistent values in two consecutive reads implies a correct
|
||||
// value of the counter. Do note, the counter does not give the
|
||||
// calendar time but a hardware that ticks upwards continuously.
|
||||
// The 48-bit counter operates at 32,768 HZ.
|
||||
|
||||
} while (true);
|
||||
|
||||
return (1 == itr) ? rtc_count2 : rtc_count3;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// Macros
|
||||
//*****************************************************************************
|
||||
@@ -254,94 +288,49 @@ static const PRCM_PeriphRegs_t PRCM_PeriphRegsList[] =
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Requests a safe boot
|
||||
//! Set a special bit
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void PRCMRequestSafeBoot(void)
|
||||
void PRCMSetSpecialBit(unsigned char bit)
|
||||
{
|
||||
unsigned int uiRegValue;
|
||||
|
||||
uiRegValue = MAP_PRCMHIBRegRead(RTC_MSEC_U32_REG_ADDR) | (1 << 30);
|
||||
uiRegValue = MAP_PRCMHIBRegRead(RTC_MSEC_U32_REG_ADDR) | (1 << bit);
|
||||
|
||||
PRCMHIBRegWrite(RTC_MSEC_U32_REG_ADDR, uiRegValue);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Clear the safe boot request
|
||||
//! Clear a special bit
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void PRCMClearSafeBootRequest(void)
|
||||
void PRCMClearSpecialBit(unsigned char bit)
|
||||
{
|
||||
unsigned int uiRegValue;
|
||||
|
||||
uiRegValue = MAP_PRCMHIBRegRead(RTC_MSEC_U32_REG_ADDR) & (~(1 << 30));
|
||||
uiRegValue = MAP_PRCMHIBRegRead(RTC_MSEC_U32_REG_ADDR) & (~(1 << bit));
|
||||
|
||||
PRCMHIBRegWrite(RTC_MSEC_U32_REG_ADDR, uiRegValue);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Read the safe boot request bit. This bit is cleared after reading.
|
||||
//! Read a special bit
|
||||
//!
|
||||
//! \return Value of the safe boot bit
|
||||
//! \return Value of the bit
|
||||
//
|
||||
//*****************************************************************************
|
||||
tBoolean PRCMIsSafeBootRequested(void)
|
||||
tBoolean PRCMGetSpecialBit(unsigned char bit)
|
||||
{
|
||||
tBoolean safeboot = (MAP_PRCMHIBRegRead(RTC_MSEC_U32_REG_ADDR) & (1 << 30)) ? true : false;
|
||||
|
||||
PRCMClearSafeBootRequest();
|
||||
|
||||
return safeboot;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Signals that a WDT reset has occurred
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void PRCMSignalWDTReset(void)
|
||||
{
|
||||
unsigned int uiRegValue;
|
||||
|
||||
uiRegValue = MAP_PRCMHIBRegRead(RTC_MSEC_U32_REG_ADDR) | (1 << 29);
|
||||
|
||||
PRCMHIBRegWrite(RTC_MSEC_U32_REG_ADDR, uiRegValue);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Clear the WDT reset signal
|
||||
//!
|
||||
//! \return None.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void PRCMClearWDTResetSignal(void)
|
||||
{
|
||||
unsigned int uiRegValue;
|
||||
|
||||
uiRegValue = MAP_PRCMHIBRegRead(RTC_MSEC_U32_REG_ADDR) & (~(1 << 29));
|
||||
|
||||
PRCMHIBRegWrite(RTC_MSEC_U32_REG_ADDR, uiRegValue);
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Read the WDT reset signal bit
|
||||
//!
|
||||
//! \return Value of the WDT reset signal bit
|
||||
//
|
||||
//*****************************************************************************
|
||||
tBoolean PRCMWasResetBecauseOfWDT(void)
|
||||
{
|
||||
return (MAP_PRCMHIBRegRead(RTC_MSEC_U32_REG_ADDR) & (1 << 29)) ? true : false;
|
||||
tBoolean value = (MAP_PRCMHIBRegRead(RTC_MSEC_U32_REG_ADDR) & (1 << bit)) ? true : false;
|
||||
// special bits must be cleared immediatelly after reading
|
||||
PRCMClearSpecialBit(bit);
|
||||
return value;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
@@ -1289,6 +1278,35 @@ unsigned long long PRCMSlowClkCtrGet(void)
|
||||
return ullRTCVal;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! Gets the current value of the internal slow clock counter
|
||||
//!
|
||||
//! This function is similar to \sa PRCMSlowClkCtrGet() but reads the counter
|
||||
//! value from a relatively faster interface using an auto-latch mechainsm.
|
||||
//!
|
||||
//! \note Due to the nature of implemetation of auto latching, when using this
|
||||
//! API, the recommendation is to read the value thrice and identify the right
|
||||
//! value (as 2 out the 3 read values will always be correct and with a max. of
|
||||
//! 1 LSB change)
|
||||
//!
|
||||
//! \return 64-bit current counter vlaue.
|
||||
//
|
||||
//*****************************************************************************
|
||||
unsigned long long PRCMSlowClkCtrFastGet(void)
|
||||
{
|
||||
unsigned long long ullRTCVal;
|
||||
|
||||
//
|
||||
// Read as 2 32-bit values
|
||||
//
|
||||
ullRTCVal = HWREG(HIB1P2_BASE + HIB1P2_O_HIB_RTC_TIMER_MSW_1P2);
|
||||
ullRTCVal = ullRTCVal << 32;
|
||||
ullRTCVal |= HWREG(HIB1P2_BASE + HIB1P2_O_HIB_RTC_TIMER_LSW_1P2);
|
||||
|
||||
return ullRTCVal;
|
||||
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
|
||||
@@ -192,17 +192,21 @@ unsigned char ulRstReg;
|
||||
// PRCM_ADC should never be used in any user code.
|
||||
#define PRCM_ADC 0x000000FF
|
||||
|
||||
//*****************************************************************************
|
||||
// User bits in the PRCM persistent registers
|
||||
//*****************************************************************************
|
||||
#define PRCM_SAFE_BOOT_BIT 30
|
||||
#define PRCM_WDT_RESET_BIT 29
|
||||
#define PRCM_FIRST_BOOT_BIT 28
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// API Function prototypes
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void PRCMRequestSafeBoot(void);
|
||||
extern void PRCMClearSafeBootRequest(void);
|
||||
extern tBoolean PRCMIsSafeBootRequested(void);
|
||||
extern void PRCMSignalWDTReset(void);
|
||||
extern void PRCMClearWDTResetSignal(void);
|
||||
extern tBoolean PRCMWasResetBecauseOfWDT(void);
|
||||
extern void PRCMSetSpecialBit(unsigned char bit);
|
||||
extern void PRCMClearSpecialBit(unsigned char bit);
|
||||
extern tBoolean PRCMGetSpecialBit(unsigned char bit);
|
||||
extern void PRCMSOCReset(void);
|
||||
extern void PRCMMCUReset(tBoolean bIncludeSubsystem);
|
||||
extern unsigned long PRCMSysResetCauseGet(void);
|
||||
@@ -243,6 +247,7 @@ extern void PRCMHibernateWakeupSourceDisable(unsigned long ulHIBWakupSrc);
|
||||
extern void PRCMHibernateIntervalSet(unsigned long long ullTicks);
|
||||
|
||||
extern unsigned long long PRCMSlowClkCtrGet(void);
|
||||
extern unsigned long long PRCMSlowClkCtrFastGet(void);
|
||||
extern void PRCMSlowClkCtrMatchSet(unsigned long long ullTicks);
|
||||
extern unsigned long long PRCMSlowClkCtrMatchGet(void);
|
||||
|
||||
|
||||
@@ -782,15 +782,9 @@ SPIConfigSetExpClk(unsigned long ulBase,unsigned long ulSPIClk,
|
||||
}
|
||||
|
||||
//
|
||||
// Mask the configurations and set clock divider granularity
|
||||
// to 1 cycle
|
||||
// set clock divider granularity to 1 cycle
|
||||
//
|
||||
ulRegData = (ulRegData & (~(MCSPI_CH0CONF_WL_M |
|
||||
MCSPI_CH0CONF_EPOL |
|
||||
MCSPI_CH0CONF_POL |
|
||||
MCSPI_CH0CONF_PHA |
|
||||
MCSPI_CH0CONF_TURBO ) |
|
||||
MCSPI_CH0CONF_CLKG));
|
||||
ulRegData |= MCSPI_CH0CONF_CLKG;
|
||||
|
||||
//
|
||||
// Get the divider value
|
||||
@@ -798,7 +792,7 @@ SPIConfigSetExpClk(unsigned long ulBase,unsigned long ulSPIClk,
|
||||
ulDivider = ((ulSPIClk/ulBitRate) - 1);
|
||||
|
||||
//
|
||||
// The least significant four bits of the divider is used fo configure
|
||||
// The least significant four bits of the divider is used to configure
|
||||
// CLKD in MCSPI_CHCONF next eight least significant bits are used to
|
||||
// configure the EXTCLK in MCSPI_CHCTRL
|
||||
//
|
||||
|
||||
@@ -29,12 +29,14 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/mphal.h"
|
||||
#include "mptask.h"
|
||||
#include "simplelink.h"
|
||||
#include "pybwdt.h"
|
||||
#include "debug.h"
|
||||
#include "antenna.h"
|
||||
#include "mperror.h"
|
||||
#include "task.h"
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE CONSTANTS
|
||||
@@ -48,6 +50,10 @@
|
||||
DECLARE PRIVATE DATA
|
||||
******************************************************************************/
|
||||
|
||||
// This is the static memory (TCB and stack) for the idle task
|
||||
static StaticTask_t xIdleTaskTCB __attribute__ ((section (".rtos_heap")));
|
||||
static StackType_t uxIdleTaskStack[configMINIMAL_STACK_SIZE] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8)));
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PUBLIC DATA
|
||||
******************************************************************************/
|
||||
@@ -55,6 +61,13 @@
|
||||
OsiTaskHandle mpTaskHandle;
|
||||
#endif
|
||||
|
||||
// This is the FreeRTOS heap, defined here so we can put it in a special segment
|
||||
uint8_t ucHeap[ configTOTAL_HEAP_SIZE ] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8)));
|
||||
|
||||
// This is the static memory (TCB and stack) for the main MicroPython task
|
||||
StaticTask_t mpTaskTCB __attribute__ ((section (".rtos_heap")));
|
||||
StackType_t mpTaskStack[MICROPY_TASK_STACK_LEN] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8)));
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
@@ -65,18 +78,20 @@ int main (void) {
|
||||
// Initialize the clocks and the interrupt system
|
||||
HAL_SystemInit();
|
||||
|
||||
#if MICROPY_HW_ANTENNA_DIVERSITY
|
||||
// configure the antenna selection pins
|
||||
antenna_init0();
|
||||
#endif
|
||||
|
||||
// Init the watchdog
|
||||
pybwdt_init0();
|
||||
|
||||
#ifdef DEBUG
|
||||
ASSERT (OSI_OK == osi_TaskCreate(TASK_Micropython,
|
||||
(const signed char *)"MicroPy",
|
||||
MICROPY_TASK_STACK_SIZE, NULL, MICROPY_TASK_PRIORITY, &mpTaskHandle));
|
||||
#else
|
||||
ASSERT (OSI_OK == osi_TaskCreate(TASK_Micropython,
|
||||
(const signed char *)"MicroPy",
|
||||
MICROPY_TASK_STACK_SIZE, NULL, MICROPY_TASK_PRIORITY, NULL));
|
||||
#ifndef DEBUG
|
||||
OsiTaskHandle mpTaskHandle;
|
||||
#endif
|
||||
mpTaskHandle = xTaskCreateStatic(TASK_Micropython, "MicroPy",
|
||||
MICROPY_TASK_STACK_LEN, NULL, MICROPY_TASK_PRIORITY, mpTaskStack, &mpTaskTCB);
|
||||
ASSERT(mpTaskHandle != NULL);
|
||||
|
||||
osi_start();
|
||||
|
||||
@@ -89,3 +104,12 @@ void stoupper (char *str) {
|
||||
str++;
|
||||
}
|
||||
}
|
||||
|
||||
// We need this when configSUPPORT_STATIC_ALLOCATION is enabled
|
||||
void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer,
|
||||
StackType_t **ppxIdleTaskStackBuffer,
|
||||
uint32_t *pulIdleTaskStackSize ) {
|
||||
*ppxIdleTaskTCBBuffer = &xIdleTaskTCB;
|
||||
*ppxIdleTaskStackBuffer = uxIdleTaskStack;
|
||||
*pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
|
||||
}
|
||||
|
||||
@@ -29,12 +29,11 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/mphal.h"
|
||||
#include "py/obj.h"
|
||||
#include "inc/hw_memmap.h"
|
||||
#include "pybuart.h"
|
||||
#include "osi.h"
|
||||
#include "pybwdt.h"
|
||||
#include "mperror.h"
|
||||
|
||||
|
||||
@@ -49,8 +48,6 @@
|
||||
//*****************************************************************************
|
||||
void vApplicationIdleHook (void)
|
||||
{
|
||||
// kick the watchdog
|
||||
pybwdt_kick();
|
||||
// signal that we are alive and kicking
|
||||
mperror_heartbeat_signal();
|
||||
// gate the processor's clock to save power
|
||||
@@ -73,10 +70,7 @@ void vApplicationMallocFailedHook (void)
|
||||
__asm volatile ("bkpt #0 \n");
|
||||
#endif
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
__fatal_error("FreeRTOS malloc failed!");
|
||||
}
|
||||
__fatal_error("FreeRTOS malloc failed!");
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
@@ -95,10 +89,7 @@ void vApplicationStackOverflowHook (OsiTaskHandle *pxTask, signed char *pcTaskNa
|
||||
__asm volatile ("bkpt #0 \n");
|
||||
#endif
|
||||
|
||||
for ( ; ; )
|
||||
{
|
||||
__fatal_error("Stack overflow!");
|
||||
}
|
||||
__fatal_error("Stack overflow!");
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
|
||||
97
cc3200/misc/antenna.c
Normal file
97
cc3200/misc/antenna.c
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mpconfigboard.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "inc/hw_gpio.h"
|
||||
#include "inc/hw_ints.h"
|
||||
#include "inc/hw_memmap.h"
|
||||
#include "rom_map.h"
|
||||
#include "pin.h"
|
||||
#include "prcm.h"
|
||||
#include "gpio.h"
|
||||
#include "antenna.h"
|
||||
|
||||
|
||||
#if MICROPY_HW_ANTENNA_DIVERSITY
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE CONSTANTS
|
||||
******************************************************************************/
|
||||
#define REG_PAD_CONFIG_26 (0x4402E108)
|
||||
#define REG_PAD_CONFIG_27 (0x4402E10C)
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE DATA
|
||||
******************************************************************************/
|
||||
static antenna_type_t antenna_type_selected = ANTENNA_TYPE_INTERNAL;
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
void antenna_init0(void) {
|
||||
// enable the peripheral clock and set the gpio direction for
|
||||
// both antenna 1 and antenna 2 pins
|
||||
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA3, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
|
||||
MAP_GPIODirModeSet(GPIOA3_BASE, 0x0C, GPIO_DIR_MODE_OUT);
|
||||
|
||||
// configure antenna 1 pin type and strength
|
||||
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~(PAD_STRENGTH_MASK | PAD_TYPE_MASK)) | (0x00000020 | 0x00000000));
|
||||
// set the mode
|
||||
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~PAD_MODE_MASK) | 0x00000000) & ~(3 << 10);
|
||||
// set the direction
|
||||
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~0xC00) | 0x00000800);
|
||||
|
||||
// configure antenna 2 pin type and strength
|
||||
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~(PAD_STRENGTH_MASK | PAD_TYPE_MASK)) | (0x00000020 | 0x00000000));
|
||||
// set the mode
|
||||
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~PAD_MODE_MASK) | 0x00000000) & ~(3 << 10);
|
||||
// set the direction
|
||||
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~0xC00) | 0x00000800);
|
||||
|
||||
// select the currently active antenna
|
||||
antenna_select(antenna_type_selected);
|
||||
}
|
||||
|
||||
void antenna_select (antenna_type_t _antenna) {
|
||||
if (_antenna == ANTENNA_TYPE_INTERNAL) {
|
||||
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x04);
|
||||
// also configure the pull-up and pull-down accordingly
|
||||
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~PAD_TYPE_MASK)) | PIN_TYPE_STD_PU;
|
||||
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~PAD_TYPE_MASK)) | PIN_TYPE_STD_PD;
|
||||
} else {
|
||||
MAP_GPIOPinWrite(GPIOA3_BASE, 0x0C, 0x08);
|
||||
// also configure the pull-up and pull-down accordingly
|
||||
HWREG(REG_PAD_CONFIG_26) = ((HWREG(REG_PAD_CONFIG_26) & ~PAD_TYPE_MASK)) | PIN_TYPE_STD_PD;
|
||||
HWREG(REG_PAD_CONFIG_27) = ((HWREG(REG_PAD_CONFIG_27) & ~PAD_TYPE_MASK)) | PIN_TYPE_STD_PU;
|
||||
}
|
||||
antenna_type_selected = _antenna;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 Damien P. George
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -24,16 +24,15 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
typedef struct _fs_user_mount_t {
|
||||
const char *str;
|
||||
mp_uint_t len;
|
||||
mp_obj_t readblocks[4];
|
||||
mp_obj_t writeblocks[4];
|
||||
mp_obj_t sync[2];
|
||||
mp_obj_t count[2];
|
||||
FATFS fatfs;
|
||||
} fs_user_mount_t;
|
||||
#ifndef _ANTENNA_H_
|
||||
#define _ANTENNA_H_
|
||||
|
||||
extern fs_user_mount_t *fs_user_mount;
|
||||
typedef enum {
|
||||
ANTENNA_TYPE_INTERNAL = 0,
|
||||
ANTENNA_TYPE_EXTERNAL
|
||||
} antenna_type_t;
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_mount_obj);
|
||||
extern void antenna_init0 (void);
|
||||
extern void antenna_select (antenna_type_t antenna_type);
|
||||
|
||||
#endif /* _ANTENNA_H_ */
|
||||
@@ -27,21 +27,12 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/obj.h"
|
||||
#include "lib/utils/pyhelp.h"
|
||||
|
||||
STATIC const char help_text[] = "Welcome to Micro Python!\n"
|
||||
STATIC const char help_text[] = "Welcome to MicroPython!\n"
|
||||
"For online help please visit http://micropython.org/help/.\n"
|
||||
"For further help on a specific object, type help(obj)\n";
|
||||
|
||||
STATIC void pyb_help_print_info_about_object(mp_obj_t name_o, mp_obj_t value) {
|
||||
printf(" ");
|
||||
mp_obj_print(name_o, PRINT_STR);
|
||||
printf(" -- ");
|
||||
mp_obj_print(value, PRINT_STR);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) {
|
||||
if (n_args == 0) {
|
||||
// print a general help message
|
||||
@@ -49,31 +40,7 @@ STATIC mp_obj_t pyb_help(uint n_args, const mp_obj_t *args) {
|
||||
}
|
||||
else {
|
||||
// try to print something sensible about the given object
|
||||
printf("object ");
|
||||
mp_obj_print(args[0], PRINT_STR);
|
||||
printf(" is of type %s\n", mp_obj_get_type_str(args[0]));
|
||||
|
||||
mp_map_t *map = NULL;
|
||||
if (MP_OBJ_IS_TYPE(args[0], &mp_type_module)) {
|
||||
map = mp_obj_dict_get_map(mp_obj_module_get_globals(args[0]));
|
||||
} else {
|
||||
mp_obj_type_t *type;
|
||||
if (MP_OBJ_IS_TYPE(args[0], &mp_type_type)) {
|
||||
type = args[0];
|
||||
} else {
|
||||
type = mp_obj_get_type(args[0]);
|
||||
}
|
||||
if (type->locals_dict != MP_OBJ_NULL && MP_OBJ_IS_TYPE(type->locals_dict, &mp_type_dict)) {
|
||||
map = mp_obj_dict_get_map(type->locals_dict);
|
||||
}
|
||||
}
|
||||
if (map != NULL) {
|
||||
for (uint i = 0; i < map->alloc; i++) {
|
||||
if (map->table[i].key != MP_OBJ_NULL) {
|
||||
pyb_help_print_info_about_object(map->table[i].key, map->table[i].value);
|
||||
}
|
||||
}
|
||||
}
|
||||
pyhelp_print_obj(args[0]);
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
@@ -1,210 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/gc.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "interrupt.h"
|
||||
#include "pybsleep.h"
|
||||
#include "mpcallback.h"
|
||||
#include "mpexception.h"
|
||||
#include "mperror.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC DATA
|
||||
******************************************************************************/
|
||||
const mp_arg_t mpcallback_init_args[] = {
|
||||
{ MP_QSTR_intmode, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_handler, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_priority, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
|
||||
{ MP_QSTR_value, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
|
||||
{ MP_QSTR_wakes, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = PYB_PWR_MODE_ACTIVE} },
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
void mpcallback_init0 (void) {
|
||||
// initialize the callback objects list
|
||||
mp_obj_list_init(&MP_STATE_PORT(mpcallback_obj_list), 0);
|
||||
}
|
||||
|
||||
mp_obj_t mpcallback_new (mp_obj_t parent, mp_obj_t handler, const mp_cb_methods_t *methods) {
|
||||
mpcallback_obj_t *self = m_new_obj(mpcallback_obj_t);
|
||||
self->base.type = &pyb_callback_type;
|
||||
self->handler = handler;
|
||||
self->parent = parent;
|
||||
self->methods = (mp_cb_methods_t *)methods;
|
||||
self->isenabled = true;
|
||||
// remove any old callback if present
|
||||
mpcallback_remove(self->parent);
|
||||
mp_obj_list_append(&MP_STATE_PORT(mpcallback_obj_list), self);
|
||||
return self;
|
||||
}
|
||||
|
||||
mpcallback_obj_t *mpcallback_find (mp_obj_t parent) {
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mpcallback_obj_list).len; i++) {
|
||||
// search for the object and then remove it
|
||||
mpcallback_obj_t *callback_obj = ((mpcallback_obj_t *)(MP_STATE_PORT(mpcallback_obj_list).items[i]));
|
||||
if (callback_obj->parent == parent) {
|
||||
return callback_obj;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void mpcallback_wake_all (void) {
|
||||
// re-enable all active callback objects one by one
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mpcallback_obj_list).len; i++) {
|
||||
mpcallback_obj_t *callback_obj = ((mpcallback_obj_t *)(MP_STATE_PORT(mpcallback_obj_list).items[i]));
|
||||
if (callback_obj->isenabled) {
|
||||
callback_obj->methods->enable(callback_obj->parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mpcallback_remove (const mp_obj_t parent) {
|
||||
mpcallback_obj_t *callback_obj;
|
||||
if ((callback_obj = mpcallback_find(parent))) {
|
||||
mp_obj_list_remove(&MP_STATE_PORT(mpcallback_obj_list), callback_obj);
|
||||
}
|
||||
}
|
||||
|
||||
uint mpcallback_translate_priority (uint priority) {
|
||||
if (priority < 1 || priority > 7) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
|
||||
}
|
||||
|
||||
switch (priority) {
|
||||
case 1:
|
||||
return INT_PRIORITY_LVL_7;
|
||||
case 2:
|
||||
return INT_PRIORITY_LVL_6;
|
||||
case 3:
|
||||
return INT_PRIORITY_LVL_5;
|
||||
case 4:
|
||||
return INT_PRIORITY_LVL_4;
|
||||
case 5:
|
||||
return INT_PRIORITY_LVL_3;
|
||||
case 6:
|
||||
return INT_PRIORITY_LVL_2;
|
||||
case 7:
|
||||
return INT_PRIORITY_LVL_1;
|
||||
default:
|
||||
return INT_PRIORITY_LVL_7;
|
||||
}
|
||||
}
|
||||
|
||||
void mpcallback_handler (mp_obj_t self_in) {
|
||||
mpcallback_obj_t *self = self_in;
|
||||
if (self && self->handler != mp_const_none) {
|
||||
// disable interrupts to avoid nesting
|
||||
uint primsk = disable_irq();
|
||||
// when executing code within a handler we must lock the GC to prevent
|
||||
// any memory allocations. We must also catch any exceptions.
|
||||
gc_lock();
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
mp_call_function_1(self->handler, self->parent);
|
||||
nlr_pop();
|
||||
}
|
||||
else {
|
||||
// uncaught exception; disable the callback so that it doesn't run again
|
||||
self->methods->disable (self->parent);
|
||||
self->handler = mp_const_none;
|
||||
// printing an exception here will cause a stack overflow that will end up in
|
||||
// a hard fault, so is better to signal the uncaught (probably non-recoverable)
|
||||
// exception by blinking the system led instead.
|
||||
mperror_signal_error();
|
||||
}
|
||||
gc_unlock();
|
||||
enable_irq(primsk);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
// Micro Python bindings
|
||||
|
||||
/// \method init()
|
||||
/// Initializes the interrupt callback. With no parameters passed, everything will default
|
||||
/// to the values assigned to mpcallback_init_args[].
|
||||
STATIC mp_obj_t callback_init(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
mpcallback_obj_t *self = pos_args[0];
|
||||
// this is a bit of a hack, but it let us reuse the callback_create method from our parent
|
||||
((mp_obj_t *)pos_args)[0] = self->parent;
|
||||
self->methods->init (n_args, pos_args, kw_args);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(callback_init_obj, 1, callback_init);
|
||||
|
||||
/// \method enable()
|
||||
/// Enables the interrupt callback
|
||||
STATIC mp_obj_t callback_enable (mp_obj_t self_in) {
|
||||
mpcallback_obj_t *self = self_in;
|
||||
self->methods->enable(self->parent);
|
||||
self->isenabled = true;
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(callback_enable_obj, callback_enable);
|
||||
|
||||
/// \method disable()
|
||||
/// Disables the interrupt callback
|
||||
STATIC mp_obj_t callback_disable (mp_obj_t self_in) {
|
||||
mpcallback_obj_t *self = self_in;
|
||||
self->methods->disable(self->parent);
|
||||
self->isenabled = false;
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(callback_disable_obj, callback_disable);
|
||||
|
||||
/// \method \call()
|
||||
/// Triggers the interrupt callback
|
||||
STATIC mp_obj_t callback_call(mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 0, false);
|
||||
mpcallback_handler (self_in);
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
STATIC const mp_map_elem_t callback_locals_dict_table[] = {
|
||||
// instance methods
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&callback_init_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_enable), (mp_obj_t)&callback_enable_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_disable), (mp_obj_t)&callback_disable_obj },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(callback_locals_dict, callback_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t pyb_callback_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_callback,
|
||||
.call = callback_call,
|
||||
.locals_dict = (mp_obj_t)&callback_locals_dict,
|
||||
};
|
||||
|
||||
@@ -25,13 +25,14 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <std.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/mphal.h"
|
||||
#include "hw_ints.h"
|
||||
#include "hw_types.h"
|
||||
#include "hw_gpio.h"
|
||||
@@ -44,7 +45,6 @@
|
||||
#include "pybpin.h"
|
||||
#include "pins.h"
|
||||
#endif
|
||||
#include "rom.h"
|
||||
#include "rom_map.h"
|
||||
#include "prcm.h"
|
||||
#include "pybuart.h"
|
||||
@@ -55,10 +55,10 @@
|
||||
/******************************************************************************
|
||||
DEFINE CONSTANTS
|
||||
******************************************************************************/
|
||||
#define MPERROR_TOOGLE_MS (40)
|
||||
#define MPERROR_SIGNAL_ERROR_MS (1000)
|
||||
#define MPERROR_TOOGLE_MS (50)
|
||||
#define MPERROR_SIGNAL_ERROR_MS (1200)
|
||||
#define MPERROR_HEARTBEAT_ON_MS (80)
|
||||
#define MPERROR_HEARTBEAT_OFF_MS (4920)
|
||||
#define MPERROR_HEARTBEAT_OFF_MS (3920)
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE DATA
|
||||
@@ -68,7 +68,8 @@ struct mperror_heart_beat {
|
||||
uint32_t on_time;
|
||||
bool beating;
|
||||
bool enabled;
|
||||
} mperror_heart_beat = {.off_time = 0, .on_time = 0, .beating = false, .enabled = false};
|
||||
bool do_disable;
|
||||
} mperror_heart_beat = {.off_time = 0, .on_time = 0, .beating = false, .enabled = false, .do_disable = false};
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
@@ -88,8 +89,9 @@ void mperror_init0 (void) {
|
||||
MAP_GPIODirModeSet(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, GPIO_DIR_MODE_OUT);
|
||||
#else
|
||||
// configure the system led
|
||||
pin_config ((pin_obj_t *)&MICROPY_SYS_LED_GPIO, PIN_MODE_0, GPIO_DIR_MODE_OUT, PIN_TYPE_STD, PIN_STRENGTH_6MA);
|
||||
pin_config ((pin_obj_t *)&MICROPY_SYS_LED_GPIO, PIN_MODE_0, GPIO_DIR_MODE_OUT, PIN_TYPE_STD, 0, PIN_STRENGTH_6MA);
|
||||
#endif
|
||||
mperror_heart_beat.enabled = true;
|
||||
mperror_heartbeat_switch_off();
|
||||
}
|
||||
|
||||
@@ -108,7 +110,7 @@ void mperror_bootloader_check_reset_cause (void) {
|
||||
|
||||
// since the reset cause will be changed, we must store the right reason
|
||||
// so that the application knows it when booting for the next time
|
||||
PRCMSignalWDTReset();
|
||||
PRCMSetSpecialBit(PRCM_WDT_RESET_BIT);
|
||||
|
||||
MAP_PRCMHibernateWakeupSourceEnable(PRCM_HIB_SLOW_CLK_CTR);
|
||||
// set the sleep interval to 10ms
|
||||
@@ -131,31 +133,25 @@ void mperror_signal_error (void) {
|
||||
}
|
||||
}
|
||||
|
||||
void mperror_enable_heartbeat (void) {
|
||||
mperror_heart_beat.enabled = true;
|
||||
}
|
||||
|
||||
void mperror_heartbeat_switch_off (void) {
|
||||
mperror_heart_beat.on_time = 0;
|
||||
mperror_heart_beat.off_time = 0;
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, 0);
|
||||
}
|
||||
|
||||
void mperror_disable_heartbeat (void) {
|
||||
mperror_heart_beat.enabled = false;
|
||||
mperror_heartbeat_switch_off();
|
||||
if (mperror_heart_beat.enabled) {
|
||||
mperror_heart_beat.on_time = 0;
|
||||
mperror_heart_beat.off_time = 0;
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void mperror_heartbeat_signal (void) {
|
||||
if (mperror_heart_beat.enabled) {
|
||||
if (mperror_heart_beat.do_disable) {
|
||||
mperror_heart_beat.do_disable = false;
|
||||
} else if (mperror_heart_beat.enabled) {
|
||||
if (!mperror_heart_beat.beating) {
|
||||
if ((mperror_heart_beat.on_time = HAL_GetTick()) - mperror_heart_beat.off_time > MPERROR_HEARTBEAT_OFF_MS) {
|
||||
if ((mperror_heart_beat.on_time = mp_hal_ticks_ms()) - mperror_heart_beat.off_time > MPERROR_HEARTBEAT_OFF_MS) {
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, MICROPY_SYS_LED_PORT_PIN);
|
||||
mperror_heart_beat.beating = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((mperror_heart_beat.off_time = HAL_GetTick()) - mperror_heart_beat.on_time > MPERROR_HEARTBEAT_ON_MS) {
|
||||
} else {
|
||||
if ((mperror_heart_beat.off_time = mp_hal_ticks_ms()) - mperror_heart_beat.on_time > MPERROR_HEARTBEAT_ON_MS) {
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, 0);
|
||||
mperror_heart_beat.beating = false;
|
||||
}
|
||||
@@ -194,37 +190,21 @@ void nlr_jump_fail(void *val) {
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
/******************************************************************************/
|
||||
// Micro Python bindings
|
||||
|
||||
/// \function enable()
|
||||
/// Enables the heartbeat signal
|
||||
STATIC mp_obj_t pyb_enable_heartbeat(mp_obj_t self) {
|
||||
mperror_enable_heartbeat ();
|
||||
return mp_const_none;
|
||||
void mperror_enable_heartbeat (bool enable) {
|
||||
if (enable) {
|
||||
#ifndef BOOTLOADER
|
||||
// configure the led again
|
||||
pin_config ((pin_obj_t *)&MICROPY_SYS_LED_GPIO, PIN_MODE_0, GPIO_DIR_MODE_OUT, PIN_TYPE_STD, 0, PIN_STRENGTH_6MA);
|
||||
#endif
|
||||
mperror_heart_beat.enabled = true;
|
||||
mperror_heart_beat.do_disable = false;
|
||||
mperror_heartbeat_switch_off();
|
||||
} else {
|
||||
mperror_heart_beat.do_disable = true;
|
||||
mperror_heart_beat.enabled = false;
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_enable_heartbeat_obj, pyb_enable_heartbeat);
|
||||
|
||||
/// \function disable()
|
||||
/// Disables the heartbeat signal
|
||||
STATIC mp_obj_t pyb_disable_heartbeat(mp_obj_t self) {
|
||||
mperror_disable_heartbeat ();
|
||||
return mp_const_none;
|
||||
bool mperror_is_heartbeat_enabled (void) {
|
||||
return mperror_heart_beat.enabled;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_disable_heartbeat_obj, pyb_disable_heartbeat);
|
||||
|
||||
STATIC const mp_map_elem_t pyb_heartbeat_locals_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_enable), (mp_obj_t)&pyb_enable_heartbeat_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_disable), (mp_obj_t)&pyb_disable_heartbeat_obj },
|
||||
};
|
||||
STATIC MP_DEFINE_CONST_DICT(pyb_heartbeat_locals_dict, pyb_heartbeat_locals_dict_table);
|
||||
|
||||
static const mp_obj_type_t pyb_heartbeat_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_HeartBeat,
|
||||
.locals_dict = (mp_obj_t)&pyb_heartbeat_locals_dict,
|
||||
};
|
||||
|
||||
const mp_obj_base_t pyb_heartbeat_obj = {&pyb_heartbeat_type};
|
||||
#endif
|
||||
|
||||
@@ -28,19 +28,15 @@
|
||||
#ifndef MPERROR_H_
|
||||
#define MPERROR_H_
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
extern const mp_obj_base_t pyb_heartbeat_obj;
|
||||
#endif
|
||||
|
||||
extern void NORETURN __fatal_error(const char *msg);
|
||||
|
||||
void mperror_init0 (void);
|
||||
void mperror_bootloader_check_reset_cause (void);
|
||||
void mperror_deinit_sfe_pin (void);
|
||||
void mperror_signal_error (void);
|
||||
void mperror_enable_heartbeat (void);
|
||||
void mperror_heartbeat_switch_off (void);
|
||||
void mperror_disable_heartbeat (void);
|
||||
void mperror_heartbeat_signal (void);
|
||||
void mperror_enable_heartbeat (bool enable);
|
||||
bool mperror_is_heartbeat_enabled (void);
|
||||
|
||||
#endif // MPERROR_H_
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <std.h>
|
||||
|
||||
#include "py/mpstate.h"
|
||||
#include "mpexception.h"
|
||||
|
||||
201
cc3200/misc/mpirq.c
Normal file
201
cc3200/misc/mpirq.c
Normal file
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "std.h"
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/gc.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "interrupt.h"
|
||||
#include "pybsleep.h"
|
||||
#include "mpexception.h"
|
||||
#include "mperror.h"
|
||||
#include "mpirq.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PUBLIC DATA
|
||||
******************************************************************************/
|
||||
const mp_arg_t mp_irq_init_args[] = {
|
||||
{ MP_QSTR_trigger, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_priority, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, // the lowest priority
|
||||
{ MP_QSTR_handler, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_wake, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE DATA
|
||||
******************************************************************************/
|
||||
STATIC uint8_t mp_irq_priorities[] = { INT_PRIORITY_LVL_7, INT_PRIORITY_LVL_6, INT_PRIORITY_LVL_5, INT_PRIORITY_LVL_4,
|
||||
INT_PRIORITY_LVL_3, INT_PRIORITY_LVL_2, INT_PRIORITY_LVL_1 };
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
void mp_irq_init0 (void) {
|
||||
// initialize the callback objects list
|
||||
mp_obj_list_init(&MP_STATE_PORT(mp_irq_obj_list), 0);
|
||||
}
|
||||
|
||||
mp_obj_t mp_irq_new (mp_obj_t parent, mp_obj_t handler, const mp_irq_methods_t *methods) {
|
||||
mp_irq_obj_t *self = m_new_obj(mp_irq_obj_t);
|
||||
self->base.type = &mp_irq_type;
|
||||
self->handler = handler;
|
||||
self->parent = parent;
|
||||
self->methods = (mp_irq_methods_t *)methods;
|
||||
self->isenabled = true;
|
||||
// remove it in case it was already registered
|
||||
mp_irq_remove(parent);
|
||||
mp_obj_list_append(&MP_STATE_PORT(mp_irq_obj_list), self);
|
||||
return self;
|
||||
}
|
||||
|
||||
mp_irq_obj_t *mp_irq_find (mp_obj_t parent) {
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mp_irq_obj_list).len; i++) {
|
||||
mp_irq_obj_t *callback_obj = ((mp_irq_obj_t *)(MP_STATE_PORT(mp_irq_obj_list).items[i]));
|
||||
if (callback_obj->parent == parent) {
|
||||
return callback_obj;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void mp_irq_wake_all (void) {
|
||||
// re-enable all active callback objects one by one
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mp_irq_obj_list).len; i++) {
|
||||
mp_irq_obj_t *callback_obj = ((mp_irq_obj_t *)(MP_STATE_PORT(mp_irq_obj_list).items[i]));
|
||||
if (callback_obj->isenabled) {
|
||||
callback_obj->methods->enable(callback_obj->parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mp_irq_disable_all (void) {
|
||||
// re-enable all active callback objects one by one
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mp_irq_obj_list).len; i++) {
|
||||
mp_irq_obj_t *callback_obj = ((mp_irq_obj_t *)(MP_STATE_PORT(mp_irq_obj_list).items[i]));
|
||||
callback_obj->methods->disable(callback_obj->parent);
|
||||
}
|
||||
}
|
||||
|
||||
void mp_irq_remove (const mp_obj_t parent) {
|
||||
mp_irq_obj_t *callback_obj;
|
||||
if ((callback_obj = mp_irq_find(parent))) {
|
||||
mp_obj_list_remove(&MP_STATE_PORT(mp_irq_obj_list), callback_obj);
|
||||
}
|
||||
}
|
||||
|
||||
uint mp_irq_translate_priority (uint priority) {
|
||||
if (priority < 1 || priority > MP_ARRAY_SIZE(mp_irq_priorities)) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
|
||||
}
|
||||
return mp_irq_priorities[priority - 1];
|
||||
}
|
||||
|
||||
void mp_irq_handler (mp_obj_t self_in) {
|
||||
mp_irq_obj_t *self = self_in;
|
||||
if (self && self->handler != mp_const_none) {
|
||||
// when executing code within a handler we must lock the GC to prevent
|
||||
// any memory allocations.
|
||||
gc_lock();
|
||||
nlr_buf_t nlr;
|
||||
if (nlr_push(&nlr) == 0) {
|
||||
mp_call_function_1(self->handler, self->parent);
|
||||
nlr_pop();
|
||||
}
|
||||
else {
|
||||
// uncaught exception; disable the callback so that it doesn't run again
|
||||
self->methods->disable (self->parent);
|
||||
self->handler = mp_const_none;
|
||||
// signal the error using the heart beat led and
|
||||
// by printing a message
|
||||
printf("Uncaught exception in callback handler\n");
|
||||
mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
|
||||
mperror_signal_error();
|
||||
}
|
||||
gc_unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
// Micro Python bindings
|
||||
|
||||
STATIC mp_obj_t mp_irq_init (mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
mp_irq_obj_t *self = pos_args[0];
|
||||
// this is a bit of a hack, but it let us reuse the callback_create method from our parent
|
||||
((mp_obj_t *)pos_args)[0] = self->parent;
|
||||
self->methods->init (n_args, pos_args, kw_args);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(mp_irq_init_obj, 1, mp_irq_init);
|
||||
|
||||
STATIC mp_obj_t mp_irq_enable (mp_obj_t self_in) {
|
||||
mp_irq_obj_t *self = self_in;
|
||||
self->methods->enable(self->parent);
|
||||
self->isenabled = true;
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_enable_obj, mp_irq_enable);
|
||||
|
||||
STATIC mp_obj_t mp_irq_disable (mp_obj_t self_in) {
|
||||
mp_irq_obj_t *self = self_in;
|
||||
self->methods->disable(self->parent);
|
||||
self->isenabled = false;
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_disable_obj, mp_irq_disable);
|
||||
|
||||
STATIC mp_obj_t mp_irq_flags (mp_obj_t self_in) {
|
||||
mp_irq_obj_t *self = self_in;
|
||||
return mp_obj_new_int(self->methods->flags(self->parent));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_irq_flags_obj, mp_irq_flags);
|
||||
|
||||
STATIC mp_obj_t mp_irq_call (mp_obj_t self_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 0, false);
|
||||
mp_irq_handler (self_in);
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
STATIC const mp_map_elem_t mp_irq_locals_dict_table[] = {
|
||||
// instance methods
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&mp_irq_init_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_enable), (mp_obj_t)&mp_irq_enable_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_disable), (mp_obj_t)&mp_irq_disable_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_flags), (mp_obj_t)&mp_irq_flags_obj },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_irq_locals_dict, mp_irq_locals_dict_table);
|
||||
|
||||
const mp_obj_type_t mp_irq_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_irq,
|
||||
.call = mp_irq_call,
|
||||
.locals_dict = (mp_obj_t)&mp_irq_locals_dict,
|
||||
};
|
||||
|
||||
@@ -24,50 +24,52 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MPCALLBACK_H_
|
||||
#define MPCALLBACK_H_
|
||||
#ifndef MPIRQ_H_
|
||||
#define MPIRQ_H_
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE CONSTANTS
|
||||
******************************************************************************/
|
||||
#define mpcallback_INIT_NUM_ARGS 5
|
||||
#define mp_irq_INIT_NUM_ARGS 4
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE TYPES
|
||||
******************************************************************************/
|
||||
typedef void (*mp_cb_method_t) (mp_obj_t self);
|
||||
typedef mp_obj_t (*mp_cb_init_t) (mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
typedef mp_obj_t (*mp_irq_init_t) (mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
|
||||
typedef void (*mp_irq_void_method_t) (mp_obj_t self);
|
||||
typedef int (*mp_irq_int_method_t) (mp_obj_t self);
|
||||
|
||||
typedef struct {
|
||||
mp_cb_init_t init;
|
||||
mp_cb_method_t enable;
|
||||
mp_cb_method_t disable;
|
||||
} mp_cb_methods_t;
|
||||
mp_irq_init_t init;
|
||||
mp_irq_void_method_t enable;
|
||||
mp_irq_void_method_t disable;
|
||||
mp_irq_int_method_t flags;
|
||||
} mp_irq_methods_t;
|
||||
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
mp_obj_t parent;
|
||||
mp_obj_t handler;
|
||||
mp_cb_methods_t *methods;
|
||||
mp_irq_methods_t *methods;
|
||||
bool isenabled;
|
||||
} mpcallback_obj_t;
|
||||
} mp_irq_obj_t;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE EXPORTED DATA
|
||||
******************************************************************************/
|
||||
extern const mp_arg_t mpcallback_init_args[];
|
||||
extern const mp_obj_type_t pyb_callback_type;
|
||||
extern const mp_arg_t mp_irq_init_args[];
|
||||
extern const mp_obj_type_t mp_irq_type;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
void mpcallback_init0 (void);
|
||||
mp_obj_t mpcallback_new (mp_obj_t parent, mp_obj_t handler, const mp_cb_methods_t *methods);
|
||||
mpcallback_obj_t *mpcallback_find (mp_obj_t parent);
|
||||
void mpcallback_wake_all (void);
|
||||
void mpcallback_remove (const mp_obj_t parent);
|
||||
void mpcallback_handler (mp_obj_t self_in);
|
||||
uint mpcallback_translate_priority (uint priority);
|
||||
mp_obj_t mpcallback_new (mp_obj_t parent, mp_obj_t handler, const mp_cb_methods_t *methods);
|
||||
void mp_irq_init0 (void);
|
||||
mp_obj_t mp_irq_new (mp_obj_t parent, mp_obj_t handler, const mp_irq_methods_t *methods);
|
||||
mp_irq_obj_t *mp_irq_find (mp_obj_t parent);
|
||||
void mp_irq_wake_all (void);
|
||||
void mp_irq_disable_all (void);
|
||||
void mp_irq_remove (const mp_obj_t parent);
|
||||
void mp_irq_handler (mp_obj_t self_in);
|
||||
uint mp_irq_translate_priority (uint priority);
|
||||
|
||||
#endif /* MPCALLBACK_H_ */
|
||||
#endif /* MPIRQ_H_ */
|
||||
@@ -26,9 +26,8 @@
|
||||
*/
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/obj.h"
|
||||
#include "irq.h"
|
||||
#include "py/mphal.h"
|
||||
#include "mpsystick.h"
|
||||
#include "systick.h"
|
||||
#include "inc/hw_types.h"
|
||||
@@ -41,12 +40,12 @@
|
||||
|
||||
|
||||
bool sys_tick_has_passed(uint32_t start_tick, uint32_t delay_ms) {
|
||||
return HAL_GetTick() - start_tick >= delay_ms;
|
||||
return mp_hal_ticks_ms() - start_tick >= delay_ms;
|
||||
}
|
||||
|
||||
// waits until at least delay_ms milliseconds have passed from the sampling of
|
||||
// startTick. Handles overflow properly. Assumes stc was taken from
|
||||
// HAL_GetTick() some time before calling this function.
|
||||
// mp_hal_ticks_ms() some time before calling this function.
|
||||
void sys_tick_wait_at_least(uint32_t start_tick, uint32_t delay_ms) {
|
||||
#ifdef USE_FREERTOS
|
||||
vTaskDelay (delay_ms / portTICK_PERIOD_MS);
|
||||
@@ -59,32 +58,14 @@ void sys_tick_wait_at_least(uint32_t start_tick, uint32_t delay_ms) {
|
||||
|
||||
// The SysTick timer counts down at HAL_FCPU_HZ, so we can use that knowledge
|
||||
// to grab a microsecond counter.
|
||||
//
|
||||
// We assume that HAL_GetTick returns milliseconds.
|
||||
// We assume that mp_hal_ticks_ms returns milliseconds.
|
||||
uint32_t sys_tick_get_microseconds(void) {
|
||||
mp_uint_t irq_state = disable_irq();
|
||||
uint32_t counter = SysTickValueGet();
|
||||
uint32_t milliseconds = HAL_GetTick();
|
||||
uint32_t status = (HWREG(NVIC_ST_CTRL));
|
||||
uint32_t milliseconds = mp_hal_ticks_ms();
|
||||
enable_irq(irq_state);
|
||||
|
||||
// It's still possible for the countflag bit to get set if the counter was
|
||||
// reloaded between reading VAL and reading CTRL. With interrupts disabled
|
||||
// it definitely takes less than 50 HCLK cycles between reading VAL and
|
||||
// reading CTRL, so the test (counter > 50) is to cover the case where VAL
|
||||
// is +ve and very close to zero, and the COUNTFLAG bit is also set.
|
||||
if ((status & NVIC_ST_CTRL_COUNT) && counter > 50) {
|
||||
// This means that the HW reloaded VAL between the time we read VAL and the
|
||||
// time we read CTRL, which implies that there is an interrupt pending
|
||||
// to increment the tick counter.
|
||||
milliseconds++;
|
||||
}
|
||||
uint32_t load = (HWREG(NVIC_ST_RELOAD));
|
||||
uint32_t load = SysTickPeriodGet();
|
||||
counter = load - counter; // Convert from decrementing to incrementing
|
||||
|
||||
// ((load + 1) / 1000) is the number of counts per microsecond.
|
||||
//
|
||||
// counter / ((load + 1) / 1000) scales from the systick clock to microseconds
|
||||
// and is the same thing as (counter * 1000) / (load + 1)
|
||||
return milliseconds * 1000 + (counter * 1000) / (load + 1);
|
||||
return (milliseconds * 1000) + ((counter * 1000) / load);
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/obj.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "inc/hw_ints.h"
|
||||
#include "inc/hw_memmap.h"
|
||||
#include "pybpin.h"
|
||||
#include MICROPY_HAL_H
|
||||
|
||||
STATIC void pin_named_pins_obj_print(void (*print)(void *env, const char *fmt, ...), void *env, mp_obj_t self_in, mp_print_kind_t kind) {
|
||||
pin_named_pins_obj_t *self = self_in;
|
||||
print(env, "<Pin.%s>", qstr_str(self->name));
|
||||
}
|
||||
|
||||
const mp_obj_type_t pin_cpu_pins_obj_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_cpu,
|
||||
.print = pin_named_pins_obj_print,
|
||||
.locals_dict = (mp_obj_t)&pin_cpu_pins_locals_dict,
|
||||
};
|
||||
|
||||
pin_obj_t *pin_find_named_pin(const mp_obj_dict_t *named_pins, mp_obj_t name) {
|
||||
mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)named_pins);
|
||||
mp_map_elem_t *named_elem = mp_map_lookup(named_map, name, MP_MAP_LOOKUP);
|
||||
if (named_elem != NULL && named_elem->value != NULL) {
|
||||
return named_elem->value;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pin_obj_t *pin_find_pin(const mp_obj_dict_t *named_pins, uint pin_num) {
|
||||
mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)named_pins);
|
||||
for (uint i = 0; i < named_map->used; i++) {
|
||||
if (((pin_obj_t *)named_map->table[i].value)->pin_num == pin_num) {
|
||||
return named_map->table[i].value;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pin_obj_t *pin_find_pin_by_port_bit (const mp_obj_dict_t *named_pins, uint port, uint bit) {
|
||||
mp_map_t *named_map = mp_obj_dict_get_map((mp_obj_t)named_pins);
|
||||
for (uint i = 0; i < named_map->used; i++) {
|
||||
if ((((pin_obj_t *)named_map->table[i].value)->port == port) &&
|
||||
(((pin_obj_t *)named_map->table[i].value)->bit == bit)) {
|
||||
return named_map->table[i].value;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
217
cc3200/mods/modmachine.c
Normal file
217
cc3200/mods/modmachine.c
Normal file
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "std.h"
|
||||
|
||||
#include "py/mpstate.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/mphal.h"
|
||||
#include "irq.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "inc/hw_gpio.h"
|
||||
#include "inc/hw_ints.h"
|
||||
#include "inc/hw_memmap.h"
|
||||
#include "inc/hw_uart.h"
|
||||
#include "rom_map.h"
|
||||
#include "prcm.h"
|
||||
#include "pybuart.h"
|
||||
#include "pybpin.h"
|
||||
#include "pybrtc.h"
|
||||
#include "simplelink.h"
|
||||
#include "modnetwork.h"
|
||||
#include "modwlan.h"
|
||||
#include "moduos.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "portable.h"
|
||||
#include "task.h"
|
||||
#include "mpexception.h"
|
||||
#include "random.h"
|
||||
#include "pybadc.h"
|
||||
#include "pybi2c.h"
|
||||
#include "pybsd.h"
|
||||
#include "pybwdt.h"
|
||||
#include "pybsleep.h"
|
||||
#include "pybspi.h"
|
||||
#include "pybtimer.h"
|
||||
#include "utils.h"
|
||||
#include "gccollect.h"
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
extern OsiTaskHandle mpTaskHandle;
|
||||
extern OsiTaskHandle svTaskHandle;
|
||||
extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
|
||||
#endif
|
||||
|
||||
|
||||
/// \module machine - functions related to the SoC
|
||||
///
|
||||
|
||||
/******************************************************************************/
|
||||
// Micro Python bindings;
|
||||
|
||||
STATIC mp_obj_t machine_reset(void) {
|
||||
// disable wlan
|
||||
wlan_stop(SL_STOP_TIMEOUT_LONG);
|
||||
// reset the cpu and it's peripherals
|
||||
MAP_PRCMMCUReset(true);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
|
||||
|
||||
#ifdef DEBUG
|
||||
STATIC mp_obj_t machine_info(uint n_args, const mp_obj_t *args) {
|
||||
// FreeRTOS info
|
||||
{
|
||||
printf("---------------------------------------------\n");
|
||||
printf("FreeRTOS\n");
|
||||
printf("---------------------------------------------\n");
|
||||
printf("Total heap: %u\n", configTOTAL_HEAP_SIZE);
|
||||
printf("Free heap: %u\n", xPortGetFreeHeapSize());
|
||||
printf("MpTask min free stack: %u\n", (unsigned int)uxTaskGetStackHighWaterMark((TaskHandle_t)mpTaskHandle));
|
||||
printf("ServersTask min free stack: %u\n", (unsigned int)uxTaskGetStackHighWaterMark((TaskHandle_t)svTaskHandle));
|
||||
printf("SlTask min free stack: %u\n", (unsigned int)uxTaskGetStackHighWaterMark(xSimpleLinkSpawnTaskHndl));
|
||||
printf("IdleTask min free stack: %u\n", (unsigned int)uxTaskGetStackHighWaterMark(xTaskGetIdleTaskHandle()));
|
||||
|
||||
uint32_t *pstack = (uint32_t *)&_stack;
|
||||
while (*pstack == 0x55555555) {
|
||||
pstack++;
|
||||
}
|
||||
printf("MAIN min free stack: %u\n", pstack - ((uint32_t *)&_stack));
|
||||
printf("---------------------------------------------\n");
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_info_obj, 0, 1, machine_info);
|
||||
#endif
|
||||
|
||||
STATIC mp_obj_t machine_freq(void) {
|
||||
mp_obj_t tuple[1] = {
|
||||
mp_obj_new_int(HAL_FCPU_HZ),
|
||||
};
|
||||
return mp_obj_new_tuple(1, tuple);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_freq_obj, machine_freq);
|
||||
|
||||
STATIC mp_obj_t machine_unique_id(void) {
|
||||
uint8_t mac[SL_BSSID_LENGTH];
|
||||
wlan_get_mac (mac);
|
||||
return mp_obj_new_bytes(mac, SL_BSSID_LENGTH);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_unique_id_obj, machine_unique_id);
|
||||
|
||||
STATIC mp_obj_t machine_main(mp_obj_t main) {
|
||||
if (MP_OBJ_IS_STR(main)) {
|
||||
MP_STATE_PORT(machine_config_main) = main;
|
||||
} else {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(machine_main_obj, machine_main);
|
||||
|
||||
STATIC mp_obj_t machine_idle(void) {
|
||||
__WFI();
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);
|
||||
|
||||
STATIC mp_obj_t machine_sleep (void) {
|
||||
pyb_sleep_sleep();
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_sleep_obj, machine_sleep);
|
||||
|
||||
STATIC mp_obj_t machine_deepsleep (void) {
|
||||
pyb_sleep_deepsleep();
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_deepsleep_obj, machine_deepsleep);
|
||||
|
||||
STATIC mp_obj_t machine_reset_cause (void) {
|
||||
return mp_obj_new_int(pyb_sleep_get_reset_cause());
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);
|
||||
|
||||
STATIC mp_obj_t machine_wake_reason (void) {
|
||||
return mp_obj_new_int(pyb_sleep_get_wake_reason());
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_wake_reason_obj, machine_wake_reason);
|
||||
|
||||
STATIC const mp_map_elem_t machine_module_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_umachine) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&machine_reset_obj },
|
||||
#ifdef DEBUG
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&machine_info_obj },
|
||||
#endif
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_freq), (mp_obj_t)&machine_freq_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_unique_id), (mp_obj_t)&machine_unique_id_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_main), (mp_obj_t)&machine_main_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_rng), (mp_obj_t)&machine_rng_get_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_idle), (mp_obj_t)&machine_idle_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sleep), (mp_obj_t)&machine_sleep_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_deepsleep), (mp_obj_t)&machine_deepsleep_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset_cause), (mp_obj_t)&machine_reset_cause_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_wake_reason), (mp_obj_t)&machine_wake_reason_obj },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_disable_irq), (mp_obj_t)&pyb_disable_irq_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_enable_irq), (mp_obj_t)&pyb_enable_irq_obj },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_RTC), (mp_obj_t)&pyb_rtc_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_Pin), (mp_obj_t)&pin_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ADC), (mp_obj_t)&pyb_adc_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_I2C), (mp_obj_t)&pyb_i2c_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SPI), (mp_obj_t)&pyb_spi_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_UART), (mp_obj_t)&pyb_uart_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_Timer), (mp_obj_t)&pyb_timer_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_WDT), (mp_obj_t)&pyb_wdt_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SD), (mp_obj_t)&pyb_sd_type },
|
||||
|
||||
// class constants
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_IDLE), MP_OBJ_NEW_SMALL_INT(PYB_PWR_MODE_ACTIVE) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SLEEP), MP_OBJ_NEW_SMALL_INT(PYB_PWR_MODE_LPDS) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_DEEPSLEEP), MP_OBJ_NEW_SMALL_INT(PYB_PWR_MODE_HIBERNATE) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_POWER_ON), MP_OBJ_NEW_SMALL_INT(PYB_SLP_PWRON_RESET) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_HARD_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_HARD_RESET) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_WDT_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_WDT_RESET) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_DEEPSLEEP_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_HIB_RESET) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SOFT_RESET), MP_OBJ_NEW_SMALL_INT(PYB_SLP_SOFT_RESET) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_WLAN_WAKE), MP_OBJ_NEW_SMALL_INT(PYB_SLP_WAKED_BY_WLAN) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_PIN_WAKE), MP_OBJ_NEW_SMALL_INT(PYB_SLP_WAKED_BY_GPIO) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_RTC_WAKE), MP_OBJ_NEW_SMALL_INT(PYB_SLP_WAKED_BY_RTC) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table);
|
||||
|
||||
const mp_obj_module_t machine_module = {
|
||||
.base = { &mp_type_module },
|
||||
.name = MP_QSTR_umachine,
|
||||
.globals = (mp_obj_dict_t*)&machine_module_globals,
|
||||
};
|
||||
@@ -26,86 +26,134 @@
|
||||
*/
|
||||
|
||||
#include <std.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "py/mpstate.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/obj.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/mphal.h"
|
||||
#include "modnetwork.h"
|
||||
#include "mpexception.h"
|
||||
#include "serverstask.h"
|
||||
#include "simplelink.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE TYPES
|
||||
******************************************************************************/
|
||||
typedef struct {
|
||||
mp_obj_base_t base;
|
||||
} network_server_obj_t;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE DATA
|
||||
******************************************************************************/
|
||||
STATIC network_server_obj_t network_server_obj;
|
||||
STATIC const mp_obj_type_t network_server_type;
|
||||
|
||||
/// \module network - network configuration
|
||||
///
|
||||
/// This module provides network drivers and routing configuration.
|
||||
/// This module provides network drivers and server configuration.
|
||||
|
||||
void mod_network_init0(void) {
|
||||
mp_obj_list_init(&MP_STATE_PORT(mod_network_nic_list), 0);
|
||||
}
|
||||
|
||||
void mod_network_register_nic(mp_obj_t nic) {
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) {
|
||||
if (MP_STATE_PORT(mod_network_nic_list).items[i] == nic) {
|
||||
// nic already registered
|
||||
return;
|
||||
}
|
||||
}
|
||||
// nic not registered so add to list
|
||||
mp_obj_list_append(&MP_STATE_PORT(mod_network_nic_list), nic);
|
||||
}
|
||||
|
||||
mp_obj_t mod_network_find_nic(const uint8_t *ip) {
|
||||
// find a NIC that is suited to given IP address
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) {
|
||||
mp_obj_t nic = MP_STATE_PORT(mod_network_nic_list).items[i];
|
||||
return nic;
|
||||
}
|
||||
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_resource_not_avaliable));
|
||||
}
|
||||
|
||||
STATIC mp_obj_t network_route(void) {
|
||||
return &MP_STATE_PORT(mod_network_nic_list);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(network_route_obj, network_route);
|
||||
|
||||
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
|
||||
STATIC mp_obj_t network_server_start(void) {
|
||||
STATIC mp_obj_t network_server_init_helper(mp_obj_t self, const mp_arg_val_t *args) {
|
||||
const char *user = SERVERS_DEF_USER;
|
||||
const char *pass = SERVERS_DEF_PASS;
|
||||
if (args[0].u_obj != MP_OBJ_NULL) {
|
||||
mp_obj_t *login;
|
||||
mp_obj_get_array_fixed_n(args[0].u_obj, 2, &login);
|
||||
user = mp_obj_str_get_str(login[0]);
|
||||
pass = mp_obj_str_get_str(login[1]);
|
||||
}
|
||||
|
||||
uint32_t timeout = SERVERS_DEF_TIMEOUT_MS / 1000;
|
||||
if (args[1].u_obj != MP_OBJ_NULL) {
|
||||
timeout = mp_obj_get_int(args[1].u_obj);
|
||||
}
|
||||
|
||||
// configure the new login
|
||||
servers_set_login ((char *)user, (char *)pass);
|
||||
|
||||
// configure the timeout
|
||||
servers_set_timeout(timeout * 1000);
|
||||
|
||||
// start the servers
|
||||
servers_start();
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(network_server_start_obj, network_server_start);
|
||||
|
||||
STATIC mp_obj_t network_server_stop(void) {
|
||||
STATIC const mp_arg_t network_server_args[] = {
|
||||
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_login, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
|
||||
};
|
||||
STATIC mp_obj_t network_server_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *all_args) {
|
||||
// parse args
|
||||
mp_map_t kw_args;
|
||||
mp_map_init_fixed_table(&kw_args, n_kw, all_args + n_args);
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(network_server_args)];
|
||||
mp_arg_parse_all(n_args, all_args, &kw_args, MP_ARRAY_SIZE(args), network_server_args, args);
|
||||
|
||||
// check the server id
|
||||
if (args[0].u_obj != MP_OBJ_NULL) {
|
||||
if (mp_obj_get_int(args[0].u_obj) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_resource_not_avaliable));
|
||||
}
|
||||
}
|
||||
|
||||
// setup the object and initialize it
|
||||
network_server_obj_t *self = &network_server_obj;
|
||||
self->base.type = &network_server_type;
|
||||
network_server_init_helper(self, &args[1]);
|
||||
|
||||
return (mp_obj_t)self;
|
||||
}
|
||||
|
||||
STATIC mp_obj_t network_server_init(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
// parse args
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(network_server_args) - 1];
|
||||
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(args), &network_server_args[1], args);
|
||||
return network_server_init_helper(pos_args[0], args);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(network_server_init_obj, 1, network_server_init);
|
||||
|
||||
// timeout value given in seconds
|
||||
STATIC mp_obj_t network_server_timeout(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
if (n_args > 1) {
|
||||
uint32_t timeout = mp_obj_get_int(args[1]);
|
||||
servers_set_timeout(timeout * 1000);
|
||||
return mp_const_none;
|
||||
} else {
|
||||
// get
|
||||
return mp_obj_new_int(servers_get_timeout() / 1000);
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_server_timeout_obj, 1, 2, network_server_timeout);
|
||||
|
||||
STATIC mp_obj_t network_server_running(mp_obj_t self_in) {
|
||||
// get
|
||||
return mp_obj_new_bool(servers_are_enabled());
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_server_running_obj, network_server_running);
|
||||
|
||||
STATIC mp_obj_t network_server_deinit(mp_obj_t self_in) {
|
||||
// simply stop the servers
|
||||
servers_stop();
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(network_server_stop_obj, network_server_stop);
|
||||
|
||||
STATIC mp_obj_t network_server_enabled(void) {
|
||||
return MP_BOOL(servers_are_enabled());
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(network_server_enabled_obj, network_server_enabled);
|
||||
|
||||
STATIC mp_obj_t network_server_login(mp_obj_t user, mp_obj_t pass) {
|
||||
const char *_user = mp_obj_str_get_str(user);
|
||||
const char *_pass = mp_obj_str_get_str(pass);
|
||||
servers_set_login ((char *)_user, (char *)_pass);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(network_server_login_obj, network_server_login);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(network_server_deinit_obj, network_server_deinit);
|
||||
#endif
|
||||
|
||||
STATIC const mp_map_elem_t mp_module_network_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_network) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_WLAN), (mp_obj_t)&mod_network_nic_type_wlan },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_route), (mp_obj_t)&network_route_obj },
|
||||
|
||||
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_start_server), (mp_obj_t)&network_server_start_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_stop_server), (mp_obj_t)&network_server_stop_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_server_enabled), (mp_obj_t)&network_server_enabled_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_server_login), (mp_obj_t)&network_server_login_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_Server), (mp_obj_t)&network_server_type },
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -117,64 +165,20 @@ const mp_obj_module_t mp_module_network = {
|
||||
.globals = (mp_obj_dict_t*)&mp_module_network_globals,
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
// Miscellaneous helpers
|
||||
#if (MICROPY_PORT_HAS_TELNET || MICROPY_PORT_HAS_FTP)
|
||||
STATIC const mp_map_elem_t network_server_locals_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_init), (mp_obj_t)&network_server_init_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_deinit), (mp_obj_t)&network_server_deinit_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_timeout), (mp_obj_t)&network_server_timeout_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_isrunning), (mp_obj_t)&network_server_running_obj },
|
||||
};
|
||||
|
||||
void mod_network_convert_ipv4_endianness(uint8_t *ip) {
|
||||
uint8_t ip0 = ip[0]; ip[0] = ip[3]; ip[3] = ip0;
|
||||
uint8_t ip1 = ip[1]; ip[1] = ip[2]; ip[2] = ip1;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_DICT(network_server_locals_dict, network_server_locals_dict_table);
|
||||
|
||||
// Takes an address of the form '192.168.0.1' and converts it to network format
|
||||
// in out_ip (big endian, so the 192 is the first byte).
|
||||
void mod_network_parse_ipv4_addr(mp_obj_t addr_in, uint8_t *out_ip) {
|
||||
mp_uint_t addr_len;
|
||||
const char *addr_str = mp_obj_str_get_data(addr_in, &addr_len);
|
||||
if (addr_len == 0) {
|
||||
// special case of no address given
|
||||
memset(out_ip, 0, MOD_NETWORK_IPV4ADDR_BUF_SIZE);
|
||||
return;
|
||||
}
|
||||
const char *s = addr_str;
|
||||
const char *s_top = addr_str + addr_len;
|
||||
for (mp_uint_t i = 0;; i++) {
|
||||
mp_uint_t val = 0;
|
||||
for (; s < s_top && *s != '.'; s++) {
|
||||
val = val * 10 + *s - '0';
|
||||
}
|
||||
out_ip[i] = val;
|
||||
if (i == 3 && s == s_top) {
|
||||
return;
|
||||
} else if (i < 3 && s < s_top && *s == '.') {
|
||||
s++;
|
||||
} else {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Takes an address of the form ('192.168.0.1', 8080), returns the port and
|
||||
// puts IP in out_ip (which must take at least IPADDR_BUF_SIZE bytes).
|
||||
mp_uint_t mod_network_parse_inet_addr(mp_obj_t addr_in, uint8_t *out_ip) {
|
||||
mp_obj_t *addr_items;
|
||||
mp_obj_get_array_fixed_n(addr_in, 2, &addr_items);
|
||||
mod_network_parse_ipv4_addr(addr_items[0], out_ip);
|
||||
return mp_obj_get_int(addr_items[1]);
|
||||
}
|
||||
|
||||
// Takes an array with a raw IPv4 address and returns something like '192.168.0.1'.
|
||||
mp_obj_t mod_network_format_ipv4_addr(uint8_t *ip) {
|
||||
char ip_str[16];
|
||||
mp_uint_t ip_len = snprintf(ip_str, 16, "%u.%u.%u.%u", ip[0], ip[1], ip[2], ip[3]);
|
||||
return mp_obj_new_str(ip_str, ip_len, false);
|
||||
}
|
||||
|
||||
// Takes an array with a raw IP address, and a port, and returns a net-address
|
||||
// tuple such as ('192.168.0.1', 8080).
|
||||
mp_obj_t mod_network_format_inet_addr(uint8_t *ip, mp_uint_t port) {
|
||||
mp_obj_t tuple[2] = {
|
||||
tuple[0] = mod_network_format_ipv4_addr(ip),
|
||||
tuple[1] = mp_obj_new_int(port),
|
||||
};
|
||||
return mp_obj_new_tuple(2, tuple);
|
||||
}
|
||||
STATIC const mp_obj_type_t network_server_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_Server,
|
||||
.make_new = network_server_make_new,
|
||||
.locals_dict = (mp_obj_t)&network_server_locals_dict,
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -25,57 +25,50 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MODNETWORK_H_
|
||||
#define MODNETWORK_H_
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE CONSTANTS
|
||||
******************************************************************************/
|
||||
#define MOD_NETWORK_IPV4ADDR_BUF_SIZE (4)
|
||||
|
||||
// Forward declaration
|
||||
struct _mod_network_socket_obj_t;
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE TYPES
|
||||
******************************************************************************/
|
||||
typedef struct _mod_network_nic_type_t {
|
||||
mp_obj_type_t base;
|
||||
|
||||
// API for non-socket operations
|
||||
int (*gethostbyname)(mp_obj_t nic, const char *name, mp_uint_t len, uint8_t *ip_out, uint8_t family);
|
||||
|
||||
// API for socket operations; return -1 on error
|
||||
int (*socket)(struct _mod_network_socket_obj_t *s, int *_errno);
|
||||
void (*close)(struct _mod_network_socket_obj_t *socket);
|
||||
int (*bind)(struct _mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno);
|
||||
int (*listen)(struct _mod_network_socket_obj_t *s, mp_int_t backlog, int *_errno);
|
||||
int (*accept)(struct _mod_network_socket_obj_t *s, struct _mod_network_socket_obj_t *s2, byte *ip, mp_uint_t *port, int *_errno);
|
||||
int (*connect)(struct _mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno);
|
||||
int (*send)(struct _mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, int *_errno);
|
||||
int (*recv)(struct _mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, int *_errno);
|
||||
int (*sendto)(struct _mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno);
|
||||
int (*recvfrom)(struct _mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno);
|
||||
int (*setsockopt)(struct _mod_network_socket_obj_t *s, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno);
|
||||
int (*settimeout)(struct _mod_network_socket_obj_t *s, mp_uint_t timeout_ms, int *_errno);
|
||||
int (*ioctl)(struct _mod_network_socket_obj_t *s, mp_uint_t request, mp_uint_t arg, int *_errno);
|
||||
} mod_network_nic_type_t;
|
||||
|
||||
typedef struct _mod_network_socket_obj_t {
|
||||
mp_obj_base_t base;
|
||||
mp_obj_t nic;
|
||||
mod_network_nic_type_t *nic_type;
|
||||
typedef struct _mod_network_socket_base_t {
|
||||
union {
|
||||
struct {
|
||||
// this order is important so that fileno gets > 0 once
|
||||
// the socket descriptor is assigned after being created.
|
||||
uint8_t domain;
|
||||
int8_t fileno;
|
||||
uint8_t type;
|
||||
uint8_t proto;
|
||||
int8_t fileno;
|
||||
} u_param;
|
||||
int16_t sd;
|
||||
};
|
||||
bool closed;
|
||||
bool has_timeout;
|
||||
bool cert_req;
|
||||
} mod_network_socket_base_t;
|
||||
|
||||
typedef struct _mod_network_socket_obj_t {
|
||||
mp_obj_base_t base;
|
||||
mod_network_socket_base_t sock_base;
|
||||
} mod_network_socket_obj_t;
|
||||
|
||||
/******************************************************************************
|
||||
EXPORTED DATA
|
||||
******************************************************************************/
|
||||
extern const mod_network_nic_type_t mod_network_nic_type_wlan;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE FUNCTIONS
|
||||
******************************************************************************/
|
||||
void mod_network_init0(void);
|
||||
void mod_network_register_nic(mp_obj_t nic);
|
||||
mp_obj_t mod_network_find_nic(const uint8_t *ip);
|
||||
|
||||
void mod_network_convert_ipv4_endianness(uint8_t *ip);
|
||||
void mod_network_parse_ipv4_addr(mp_obj_t addr_in, uint8_t *out_ip);
|
||||
mp_uint_t mod_network_parse_inet_addr(mp_obj_t addr_in, uint8_t *out_ip);
|
||||
mp_obj_t mod_network_format_ipv4_addr(uint8_t *ip);
|
||||
mp_obj_t mod_network_format_inet_addr(uint8_t *ip, mp_uint_t port);
|
||||
#endif // MODNETWORK_H_
|
||||
|
||||
@@ -1,302 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2013, 2014 Damien P. George
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <std.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "py/mpstate.h"
|
||||
#include "py/runtime.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "irq.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "inc/hw_gpio.h"
|
||||
#include "inc/hw_ints.h"
|
||||
#include "inc/hw_memmap.h"
|
||||
#include "inc/hw_uart.h"
|
||||
#include "prcm.h"
|
||||
#include "pyexec.h"
|
||||
#include "pybuart.h"
|
||||
#include "pybpin.h"
|
||||
#include "pybrtc.h"
|
||||
#include "mpsystick.h"
|
||||
#include "simplelink.h"
|
||||
#include "modwlan.h"
|
||||
#include "moduos.h"
|
||||
#include "telnet.h"
|
||||
#include "ff.h"
|
||||
#include "diskio.h"
|
||||
#include "sflash_diskio.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "portable.h"
|
||||
#include "task.h"
|
||||
#include "mpexception.h"
|
||||
#include "mpcallback.h"
|
||||
#include "random.h"
|
||||
#include "pybadc.h"
|
||||
#include "pybi2c.h"
|
||||
#include "pybsd.h"
|
||||
#include "pybwdt.h"
|
||||
#include "pybsleep.h"
|
||||
#include "pybspi.h"
|
||||
#include "utils.h"
|
||||
#include "gccollect.h"
|
||||
#include "mperror.h"
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
extern OsiTaskHandle mpTaskHandle;
|
||||
extern OsiTaskHandle svTaskHandle;
|
||||
extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
|
||||
#endif
|
||||
|
||||
|
||||
/// \module pyb - functions related to the pyboard
|
||||
///
|
||||
/// The `pyb` module contains specific functions related to the pyboard.
|
||||
|
||||
/// \function hard_reset()
|
||||
/// Resets the pyboard in a manner similar to pushing the external RESET
|
||||
/// button.
|
||||
STATIC mp_obj_t pyb_hard_reset(void) {
|
||||
// disable wlan
|
||||
wlan_stop(SL_STOP_TIMEOUT_LONG);
|
||||
// perform a SoC reset
|
||||
PRCMSOCReset();
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_hard_reset_obj, pyb_hard_reset);
|
||||
|
||||
#ifdef DEBUG
|
||||
/// \function info([dump_alloc_table])
|
||||
/// Print out some run time info which is helpful duirng development.
|
||||
STATIC mp_obj_t pyb_info(uint n_args, const mp_obj_t *args) {
|
||||
// FreeRTOS info
|
||||
{
|
||||
printf("---------------------------------------------\n");
|
||||
printf("FreeRTOS\n");
|
||||
printf("---------------------------------------------\n");
|
||||
printf("Total heap: %u\n", configTOTAL_HEAP_SIZE);
|
||||
printf("Free heap: %u\n", xPortGetFreeHeapSize());
|
||||
printf("MpTask min free stack: %u\n", (unsigned int)uxTaskGetStackHighWaterMark((TaskHandle_t)mpTaskHandle));
|
||||
printf("ServersTask min free stack: %u\n", (unsigned int)uxTaskGetStackHighWaterMark((TaskHandle_t)svTaskHandle));
|
||||
printf("SlTask min free stack: %u\n", (unsigned int)uxTaskGetStackHighWaterMark(xSimpleLinkSpawnTaskHndl));
|
||||
printf("IdleTask min free stack: %u\n", (unsigned int)uxTaskGetStackHighWaterMark(xTaskGetIdleTaskHandle()));
|
||||
|
||||
uint32_t *pstack = (uint32_t *)&_stack;
|
||||
while (*pstack == 0x55555555) {
|
||||
pstack++;
|
||||
}
|
||||
printf("MAIN min free stack: %u\n", pstack - ((uint32_t *)&_stack));
|
||||
printf("---------------------------------------------\n");
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj, 0, 1, pyb_info);
|
||||
#endif
|
||||
|
||||
/// \function freq()
|
||||
/// Returns the CPU frequency: (F_CPU).
|
||||
STATIC mp_obj_t pyb_freq(void) {
|
||||
return mp_obj_new_int(HAL_FCPU_HZ);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_freq_obj, pyb_freq);
|
||||
|
||||
/// \function millis()
|
||||
/// Returns the number of milliseconds since the board was last reset.
|
||||
///
|
||||
/// The result is always a micropython smallint (31-bit signed number), so
|
||||
/// after 2^30 milliseconds (about 12.4 days) this will start to return
|
||||
/// negative numbers.
|
||||
STATIC mp_obj_t pyb_millis(void) {
|
||||
// We want to "cast" the 32 bit unsigned into a small-int. This means
|
||||
// copying the MSB down 1 bit (extending the sign down), which is
|
||||
// equivalent to just using the MP_OBJ_NEW_SMALL_INT macro.
|
||||
return MP_OBJ_NEW_SMALL_INT(HAL_GetTick());
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_millis_obj, pyb_millis);
|
||||
|
||||
/// \function elapsed_millis(start)
|
||||
/// Returns the number of milliseconds which have elapsed since `start`.
|
||||
///
|
||||
/// This function takes care of counter wrap, and always returns a positive
|
||||
/// number. This means it can be used to measure periods upto about 12.4 days.
|
||||
///
|
||||
/// Example:
|
||||
/// start = pyb.millis()
|
||||
/// while pyb.elapsed_millis(start) < 1000:
|
||||
/// # Perform some operation
|
||||
STATIC mp_obj_t pyb_elapsed_millis(mp_obj_t start) {
|
||||
uint32_t startMillis = mp_obj_get_int(start);
|
||||
uint32_t currMillis = HAL_GetTick();
|
||||
return MP_OBJ_NEW_SMALL_INT((currMillis - startMillis) & 0x3fffffff);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_millis_obj, pyb_elapsed_millis);
|
||||
|
||||
/// \function micros()
|
||||
/// Returns the number of microseconds since the board was last reset.
|
||||
///
|
||||
/// The result is always a micropython smallint (31-bit signed number), so
|
||||
/// after 2^30 microseconds (about 17.8 minutes) this will start to return
|
||||
/// negative numbers.
|
||||
STATIC mp_obj_t pyb_micros(void) {
|
||||
// We want to "cast" the 32 bit unsigned into a small-int. This means
|
||||
// copying the MSB down 1 bit (extending the sign down), which is
|
||||
// equivalent to just using the MP_OBJ_NEW_SMALL_INT macro.
|
||||
return MP_OBJ_NEW_SMALL_INT(sys_tick_get_microseconds());
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(pyb_micros_obj, pyb_micros);
|
||||
|
||||
/// \function elapsed_micros(start)
|
||||
/// Returns the number of microseconds which have elapsed since `start`.
|
||||
///
|
||||
/// This function takes care of counter wrap, and always returns a positive
|
||||
/// number. This means it can be used to measure periods upto about 17.8 minutes.
|
||||
///
|
||||
/// Example:
|
||||
/// start = pyb.micros()
|
||||
/// while pyb.elapsed_micros(start) < 1000:
|
||||
/// # Perform some operation
|
||||
STATIC mp_obj_t pyb_elapsed_micros(mp_obj_t start) {
|
||||
uint32_t startMicros = mp_obj_get_int(start);
|
||||
uint32_t currMicros = sys_tick_get_microseconds();
|
||||
return MP_OBJ_NEW_SMALL_INT((currMicros - startMicros) & 0x3fffffff);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_elapsed_micros_obj, pyb_elapsed_micros);
|
||||
|
||||
/// \function delay(ms)
|
||||
/// Delay for the given number of milliseconds.
|
||||
STATIC mp_obj_t pyb_delay(mp_obj_t ms_in) {
|
||||
mp_int_t ms = mp_obj_get_int(ms_in);
|
||||
if (ms > 0) {
|
||||
HAL_Delay(ms);
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_delay_obj, pyb_delay);
|
||||
|
||||
/// \function udelay(us)
|
||||
/// Delay for the given number of microseconds.
|
||||
STATIC mp_obj_t pyb_udelay(mp_obj_t usec_in) {
|
||||
mp_int_t usec = mp_obj_get_int(usec_in);
|
||||
if (usec > 0) {
|
||||
UtilsDelay(UTILS_DELAY_US_TO_COUNT(usec));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_udelay_obj, pyb_udelay);
|
||||
|
||||
/// \function repl_uart(uart)
|
||||
/// Get or set the UART object that the REPL is repeated on.
|
||||
STATIC mp_obj_t pyb_repl_uart(uint n_args, const mp_obj_t *args) {
|
||||
if (n_args == 0) {
|
||||
if (pyb_stdio_uart == NULL) {
|
||||
return mp_const_none;
|
||||
} else {
|
||||
return pyb_stdio_uart;
|
||||
}
|
||||
} else {
|
||||
if (args[0] == mp_const_none) {
|
||||
pyb_stdio_uart = NULL;
|
||||
} else if (mp_obj_get_type(args[0]) == &pyb_uart_type) {
|
||||
pyb_stdio_uart = args[0];
|
||||
} else {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, mpexception_num_type_invalid_arguments));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_repl_uart_obj, 0, 1, pyb_repl_uart);
|
||||
|
||||
/// \function mkdisk('path')
|
||||
/// Formats the selected drive, useful when the filesystem has been damaged beyond repair
|
||||
STATIC mp_obj_t pyb_mkdisk(mp_obj_t path_o) {
|
||||
const char *path = mp_obj_str_get_str(path_o);
|
||||
if (FR_OK != f_mkfs(path, 1, 0)) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_operation_failed));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_mkdisk_obj, pyb_mkdisk);
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_main_obj); // defined in main.c
|
||||
|
||||
STATIC const mp_map_elem_t pyb_module_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_pyb) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&pyb_hard_reset_obj },
|
||||
#ifdef DEBUG
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&pyb_info_obj },
|
||||
#endif
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_freq), (mp_obj_t)&pyb_freq_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_repl_info), (mp_obj_t)&pyb_set_repl_info_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_repl_uart), (mp_obj_t)&pyb_repl_uart_obj },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_disable_irq), (mp_obj_t)&pyb_disable_irq_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_enable_irq), (mp_obj_t)&pyb_enable_irq_obj },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_main), (mp_obj_t)&pyb_main_obj },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_millis), (mp_obj_t)&pyb_millis_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_elapsed_millis), (mp_obj_t)&pyb_elapsed_millis_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_micros), (mp_obj_t)&pyb_micros_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_elapsed_micros), (mp_obj_t)&pyb_elapsed_micros_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_delay), (mp_obj_t)&pyb_delay_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_udelay), (mp_obj_t)&pyb_udelay_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&os_sync_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_mkdisk), (mp_obj_t)&pyb_mkdisk_obj },
|
||||
|
||||
#if MICROPY_HW_ENABLE_RNG
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_rng), (mp_obj_t)&pyb_rng_get_obj },
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_ENABLE_RTC
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_RTC), (mp_obj_t)&pyb_rtc_obj },
|
||||
#endif
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_Pin), (mp_obj_t)&pin_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ADC), (mp_obj_t)&pyb_adc_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_I2C), (mp_obj_t)&pyb_i2c_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SPI), (mp_obj_t)&pyb_spi_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_UART), (mp_obj_t)&pyb_uart_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_WDT), (mp_obj_t)&pyb_wdt_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_Sleep), (mp_obj_t)&pyb_sleep_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_HeartBeat), (mp_obj_t)&pyb_heartbeat_obj },
|
||||
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SD), (mp_obj_t)&pyb_sd_type },
|
||||
#endif
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(pyb_module_globals, pyb_module_globals_table);
|
||||
|
||||
const mp_obj_module_t pyb_module = {
|
||||
.base = { &mp_type_module },
|
||||
.name = MP_QSTR_pyb,
|
||||
.globals = (mp_obj_dict_t*)&pyb_module_globals,
|
||||
};
|
||||
63
cc3200/mods/modubinascii.c
Normal file
63
cc3200/mods/modubinascii.c
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 Paul Sokolovsky
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/binary.h"
|
||||
#include "extmod/modubinascii.h"
|
||||
#include "modubinascii.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "inc/hw_ints.h"
|
||||
#include "inc/hw_nvic.h"
|
||||
#include "inc/hw_dthe.h"
|
||||
#include "hw_memmap.h"
|
||||
#include "rom_map.h"
|
||||
#include "prcm.h"
|
||||
#include "crc.h"
|
||||
#include "cryptohash.h"
|
||||
#include "mpexception.h"
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
// Micro Python bindings
|
||||
|
||||
STATIC const mp_map_elem_t mp_module_binascii_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_ubinascii) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_hexlify), (mp_obj_t)&mod_binascii_hexlify_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_unhexlify), (mp_obj_t)&mod_binascii_unhexlify_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_a2b_base64), (mp_obj_t)&mod_binascii_a2b_base64_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_b2a_base64), (mp_obj_t)&mod_binascii_b2a_base64_obj },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_module_binascii_globals, mp_module_binascii_globals_table);
|
||||
|
||||
const mp_obj_module_t mp_module_ubinascii = {
|
||||
.base = { &mp_type_module },
|
||||
.name = MP_QSTR_ubinascii,
|
||||
.globals = (mp_obj_dict_t*)&mp_module_binascii_globals,
|
||||
};
|
||||
31
cc3200/mods/modubinascii.h
Normal file
31
cc3200/mods/modubinascii.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 Paul Sokolovsky
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MODUBINASCII_H_
|
||||
#define MODUBINASCII_H_
|
||||
|
||||
|
||||
#endif /* MODUBINASCII_H_ */
|
||||
210
cc3200/mods/moduhashlib.c
Normal file
210
cc3200/mods/moduhashlib.c
Normal file
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014 Paul Sokolovsky
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/nlr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "inc/hw_types.h"
|
||||
#include "inc/hw_ints.h"
|
||||
#include "inc/hw_nvic.h"
|
||||
#include "inc/hw_shamd5.h"
|
||||
#include "inc/hw_dthe.h"
|
||||
#include "hw_memmap.h"
|
||||
#include "rom_map.h"
|
||||
#include "prcm.h"
|
||||
#include "shamd5.h"
|
||||
#include "cryptohash.h"
|
||||
#include "mpexception.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE TYPES
|
||||
******************************************************************************/
|
||||
typedef struct _mp_obj_hash_t {
|
||||
mp_obj_base_t base;
|
||||
uint8_t *buffer;
|
||||
uint32_t b_size;
|
||||
uint32_t c_size;
|
||||
uint8_t algo;
|
||||
uint8_t h_size;
|
||||
bool fixedlen;
|
||||
bool digested;
|
||||
uint8_t hash[32];
|
||||
} mp_obj_hash_t;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE FUNCTIONS
|
||||
******************************************************************************/
|
||||
STATIC void hash_update_internal(mp_obj_t self_in, mp_obj_t data, bool digest);
|
||||
STATIC mp_obj_t hash_read (mp_obj_t self_in);
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE FUNCTIONS
|
||||
******************************************************************************/
|
||||
STATIC void hash_update_internal(mp_obj_t self_in, mp_obj_t data, bool digest) {
|
||||
mp_obj_hash_t *self = self_in;
|
||||
mp_buffer_info_t bufinfo;
|
||||
|
||||
if (data) {
|
||||
mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ);
|
||||
}
|
||||
|
||||
if (digest) {
|
||||
CRYPTOHASH_SHAMD5Start (self->algo, self->b_size);
|
||||
}
|
||||
|
||||
if (self->c_size < self->b_size || !data || !self->fixedlen) {
|
||||
if (digest || self->fixedlen) {
|
||||
// no data means we want to process our internal buffer
|
||||
CRYPTOHASH_SHAMD5Update (data ? bufinfo.buf : self->buffer, data ? bufinfo.len : self->b_size);
|
||||
self->c_size += data ? bufinfo.len : 0;
|
||||
} else {
|
||||
self->buffer = m_renew(byte, self->buffer, self->b_size, self->b_size + bufinfo.len);
|
||||
mp_seq_copy((byte*)self->buffer + self->b_size, bufinfo.buf, bufinfo.len, byte);
|
||||
self->b_size += bufinfo.len;
|
||||
self->digested = false;
|
||||
}
|
||||
} else {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_request_not_possible));
|
||||
}
|
||||
}
|
||||
|
||||
STATIC mp_obj_t hash_read (mp_obj_t self_in) {
|
||||
mp_obj_hash_t *self = self_in;
|
||||
|
||||
if (!self->fixedlen) {
|
||||
if (!self->digested) {
|
||||
hash_update_internal(self, MP_OBJ_NULL, true);
|
||||
}
|
||||
} else if (self->c_size < self->b_size) {
|
||||
// it's a fixed len block which is still incomplete
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_request_not_possible));
|
||||
}
|
||||
|
||||
if (!self->digested) {
|
||||
CRYPTOHASH_SHAMD5Read ((uint8_t *)self->hash);
|
||||
self->digested = true;
|
||||
}
|
||||
return mp_obj_new_bytes(self->hash, self->h_size);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
// Micro Python bindings
|
||||
|
||||
/// \classmethod \constructor([data[, block_size]])
|
||||
/// initial data must be given if block_size wants to be passed
|
||||
STATIC mp_obj_t hash_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 2, false);
|
||||
mp_obj_hash_t *self = m_new0(mp_obj_hash_t, 1);
|
||||
self->base.type = type_in;
|
||||
if (self->base.type->name == MP_QSTR_sha1) {
|
||||
self->algo = SHAMD5_ALGO_SHA1;
|
||||
self->h_size = 20;
|
||||
} else /* if (self->base.type->name == MP_QSTR_sha256) */ {
|
||||
self->algo = SHAMD5_ALGO_SHA256;
|
||||
self->h_size = 32;
|
||||
} /* else {
|
||||
self->algo = SHAMD5_ALGO_MD5;
|
||||
self->h_size = 32;
|
||||
} */
|
||||
|
||||
if (n_args) {
|
||||
// CPython extension to avoid buffering the data before digesting it
|
||||
// Note: care must be taken to provide all intermediate blocks as multiple
|
||||
// of four bytes, otherwise the resulting hash will be incorrect.
|
||||
// the final block can be of any length
|
||||
if (n_args > 1) {
|
||||
// block size given, we will feed the data directly into the hash engine
|
||||
self->fixedlen = true;
|
||||
self->b_size = mp_obj_get_int(args[1]);
|
||||
hash_update_internal(self, args[0], true);
|
||||
} else {
|
||||
hash_update_internal(self, args[0], false);
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
STATIC mp_obj_t hash_update(mp_obj_t self_in, mp_obj_t arg) {
|
||||
mp_obj_hash_t *self = self_in;
|
||||
hash_update_internal(self, arg, false);
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_2(hash_update_obj, hash_update);
|
||||
|
||||
STATIC mp_obj_t hash_digest(mp_obj_t self_in) {
|
||||
return hash_read(self_in);
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_1(hash_digest_obj, hash_digest);
|
||||
|
||||
STATIC const mp_map_elem_t hash_locals_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_update), (mp_obj_t) &hash_update_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_digest), (mp_obj_t) &hash_digest_obj },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(hash_locals_dict, hash_locals_dict_table);
|
||||
|
||||
//STATIC const mp_obj_type_t md5_type = {
|
||||
// { &mp_type_type },
|
||||
// .name = MP_QSTR_md5,
|
||||
// .make_new = hash_make_new,
|
||||
// .locals_dict = (mp_obj_t)&hash_locals_dict,
|
||||
//};
|
||||
|
||||
STATIC const mp_obj_type_t sha1_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_sha1,
|
||||
.make_new = hash_make_new,
|
||||
.locals_dict = (mp_obj_t)&hash_locals_dict,
|
||||
};
|
||||
|
||||
STATIC const mp_obj_type_t sha256_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_sha256,
|
||||
.make_new = hash_make_new,
|
||||
.locals_dict = (mp_obj_t)&hash_locals_dict,
|
||||
};
|
||||
|
||||
STATIC const mp_map_elem_t mp_module_hashlib_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_uhashlib) },
|
||||
// { MP_OBJ_NEW_QSTR(MP_QSTR_md5), (mp_obj_t)&md5_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sha1), (mp_obj_t)&sha1_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sha256), (mp_obj_t)&sha256_type },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_module_hashlib_globals, mp_module_hashlib_globals_table);
|
||||
|
||||
const mp_obj_module_t mp_module_uhashlib = {
|
||||
.base = { &mp_type_module },
|
||||
.name = MP_QSTR_uhashlib,
|
||||
.globals = (mp_obj_dict_t*)&mp_module_hashlib_globals,
|
||||
};
|
||||
|
||||
@@ -27,19 +27,23 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "std.h"
|
||||
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/mpstate.h"
|
||||
#include "py/nlr.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/objtuple.h"
|
||||
#include "ff.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "genhdr/mpversion.h"
|
||||
#include "moduos.h"
|
||||
#include "diskio.h"
|
||||
#include "sflash_diskio.h"
|
||||
#include "file.h"
|
||||
#include "modutime.h"
|
||||
#include "extmod/vfs_fat_file.h"
|
||||
#include "random.h"
|
||||
#include "sd_diskio.h"
|
||||
#include "mpexception.h"
|
||||
#include "version.h"
|
||||
#include "timeutils.h"
|
||||
#include "pybsd.h"
|
||||
#include "pybuart.h"
|
||||
|
||||
/// \module os - basic "operating system" services
|
||||
///
|
||||
@@ -48,163 +52,74 @@
|
||||
/// The filesystem has `/` as the root directory, and the available physical
|
||||
/// drives are accessible from here. They are currently:
|
||||
///
|
||||
/// /SFLASH -- the serial flash filesystem
|
||||
/// /SD -- the SD card (if it exists)
|
||||
/// /flash -- the serial flash filesystem
|
||||
///
|
||||
/// On boot up, the current directory is `/SFLASH` if no SD card is inserted,
|
||||
/// otherwise it is `/SD`.
|
||||
/// On boot up, the current directory is `/flash`.
|
||||
|
||||
STATIC bool sd_in_root(void) {
|
||||
#if MICROPY_HW_HAS_SDCARD
|
||||
return sd_disk_ready();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE DATA
|
||||
******************************************************************************/
|
||||
STATIC uint32_t os_num_mounted_devices;
|
||||
STATIC os_term_dup_obj_t os_term_dup_obj;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE FUNCTIONS
|
||||
******************************************************************************/
|
||||
STATIC void unmount (os_fs_mount_t *mount_obj);
|
||||
STATIC bool path_equal(const char *path, const char *path_canonical);
|
||||
STATIC void append_dir_item (mp_obj_t dirlist, const char *item, bool string);
|
||||
STATIC void mount (mp_obj_t device, const char *path, uint pathlen, bool readonly);
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
|
||||
void moduos_init0 (void) {
|
||||
// initialize the mount objects list
|
||||
mp_obj_list_init(&MP_STATE_PORT(mount_obj_list), 0);
|
||||
os_num_mounted_devices = 0;
|
||||
}
|
||||
|
||||
/// \function chdir(path)
|
||||
/// Change current directory.
|
||||
STATIC mp_obj_t os_chdir(mp_obj_t path_in) {
|
||||
const char *path;
|
||||
path = mp_obj_str_get_str(path_in);
|
||||
|
||||
FRESULT res = f_chdrive(path);
|
||||
|
||||
if (res == FR_OK) {
|
||||
res = f_chdir(path);
|
||||
}
|
||||
// TODO: Warn if too many open files...
|
||||
if (res != FR_OK) {
|
||||
// TODO should be mp_type_FileNotFoundError
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "No such file or directory: '%s'", path));
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir);
|
||||
|
||||
/// \function getcwd()
|
||||
/// Get the current directory.
|
||||
STATIC mp_obj_t os_getcwd(void) {
|
||||
char buf[MICROPY_ALLOC_PATH_MAX + 1];
|
||||
FRESULT res = f_getcwd(buf, sizeof buf);
|
||||
|
||||
if (res != FR_OK) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res])));
|
||||
}
|
||||
|
||||
return mp_obj_new_str(buf, strlen(buf), false);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd);
|
||||
|
||||
/// \function listdir([dir])
|
||||
/// With no argument, list the current directory. Otherwise list the given directory.
|
||||
STATIC mp_obj_t os_listdir(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
bool is_str_type = true;
|
||||
const char *path;
|
||||
if (n_args == 1) {
|
||||
if (mp_obj_get_type(args[0]) == &mp_type_bytes) {
|
||||
is_str_type = false;
|
||||
os_fs_mount_t *osmount_find_by_path (const char *path) {
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mount_obj_list).len; i++) {
|
||||
os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[i]));
|
||||
if (!strcmp(path, mount_obj->path)) {
|
||||
return mount_obj;
|
||||
}
|
||||
path = mp_obj_str_get_str(args[0]);
|
||||
} else {
|
||||
path = "";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// "hack" to list root directory
|
||||
if (path[0] == '/' && path[1] == '\0') {
|
||||
mp_obj_t dir_list = mp_obj_new_list(0, NULL);
|
||||
mp_obj_list_append(dir_list, MP_OBJ_NEW_QSTR(MP_QSTR_SFLASH));
|
||||
if (sd_in_root()) {
|
||||
mp_obj_list_append(dir_list, MP_OBJ_NEW_QSTR(MP_QSTR_SD));
|
||||
os_fs_mount_t *osmount_find_by_volume (uint8_t vol) {
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mount_obj_list).len; i++) {
|
||||
os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[i]));
|
||||
if (vol == mount_obj->vol) {
|
||||
return mount_obj;
|
||||
}
|
||||
return dir_list;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FRESULT res;
|
||||
FILINFO fno;
|
||||
DIR dir;
|
||||
|
||||
res = f_opendir(&dir, path); /* Open the directory */
|
||||
if (res != FR_OK) {
|
||||
// TODO should be mp_type_FileNotFoundError
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "No such file or directory: '%s'", path));
|
||||
}
|
||||
|
||||
mp_obj_t dir_list = mp_obj_new_list(0, NULL);
|
||||
|
||||
for (;;) {
|
||||
res = f_readdir(&dir, &fno); /* Read a directory item */
|
||||
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
|
||||
if (fno.fname[0] == '.' && fno.fname[1] == 0) continue; /* Ignore . entry */
|
||||
if (fno.fname[0] == '.' && fno.fname[1] == '.' && fno.fname[2] == 0) continue; /* Ignore .. entry */
|
||||
|
||||
char *fn = fno.fname;
|
||||
|
||||
// make a string object for this entry
|
||||
mp_obj_t entry_o;
|
||||
if (is_str_type) {
|
||||
entry_o = mp_obj_new_str(fn, strlen(fn), false);
|
||||
} else {
|
||||
entry_o = mp_obj_new_bytes((const byte*)fn, strlen(fn));
|
||||
os_fs_mount_t *osmount_find_by_device (mp_obj_t device) {
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mount_obj_list).len; i++) {
|
||||
os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[i]));
|
||||
if (device == mount_obj->device) {
|
||||
return mount_obj;
|
||||
}
|
||||
|
||||
// add the entry to the list
|
||||
mp_obj_list_append(dir_list, entry_o);
|
||||
}
|
||||
|
||||
f_closedir(&dir);
|
||||
|
||||
return dir_list;
|
||||
return NULL;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir);
|
||||
|
||||
/// \function mkdir(path)
|
||||
/// Create a new directory.
|
||||
STATIC mp_obj_t os_mkdir(mp_obj_t path_o) {
|
||||
const char *path = mp_obj_str_get_str(path_o);
|
||||
FRESULT res = f_mkdir(path);
|
||||
switch (res) {
|
||||
case FR_OK:
|
||||
return mp_const_none;
|
||||
case FR_EXIST:
|
||||
// TODO should be FileExistsError
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "File exists: '%s'", path));
|
||||
default:
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Error creating directory '%s'", path));
|
||||
void osmount_unmount_all (void) {
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mount_obj_list).len; i++) {
|
||||
os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[i]));
|
||||
unmount(mount_obj);
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir);
|
||||
|
||||
/// \function remove(path)
|
||||
/// Remove a file.
|
||||
STATIC mp_obj_t os_remove(mp_obj_t path_o) {
|
||||
const char *path = mp_obj_str_get_str(path_o);
|
||||
// TODO check that path is actually a file before trying to unlink it
|
||||
FRESULT res = f_unlink(path);
|
||||
switch (res) {
|
||||
case FR_OK:
|
||||
return mp_const_none;
|
||||
default:
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Error removing file '%s'", path));
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove);
|
||||
|
||||
/// \function rmdir(path)
|
||||
/// Remove a directory.
|
||||
STATIC mp_obj_t os_rmdir(mp_obj_t path_o) {
|
||||
const char *path = mp_obj_str_get_str(path_o);
|
||||
// TODO check that path is actually a directory before trying to unlink it
|
||||
FRESULT res = f_unlink(path);
|
||||
switch (res) {
|
||||
case FR_OK:
|
||||
return mp_const_none;
|
||||
default:
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, "Error removing directory '%s'", path));
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir);
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE FUNCTIONS
|
||||
******************************************************************************/
|
||||
|
||||
// Checks for path equality, ignoring trailing slashes:
|
||||
// path_equal(/, /) -> true
|
||||
@@ -221,30 +136,265 @@ STATIC bool path_equal(const char *path, const char *path_canonical) {
|
||||
return *path == '\0';
|
||||
}
|
||||
|
||||
/// \function stat(path)
|
||||
/// Get the status of a file or directory.
|
||||
STATIC void append_dir_item (mp_obj_t dirlist, const char *item, bool string) {
|
||||
// make a string object for this entry
|
||||
mp_obj_t entry_o;
|
||||
if (string) {
|
||||
entry_o = mp_obj_new_str(item, strlen(item), false);
|
||||
} else {
|
||||
entry_o = mp_obj_new_bytes((const byte*)item, strlen(item));
|
||||
}
|
||||
|
||||
// add the entry to the list
|
||||
mp_obj_list_append(dirlist, entry_o);
|
||||
}
|
||||
|
||||
STATIC void mount (mp_obj_t device, const char *path, uint pathlen, bool readonly) {
|
||||
// is the mount point already in use?
|
||||
FILINFO fno;
|
||||
#if _USE_LFN
|
||||
fno.lfname = NULL;
|
||||
fno.lfsize = 0;
|
||||
#endif
|
||||
// cannot mount twice or on existing paths
|
||||
if (f_stat(path, &fno) == FR_OK || osmount_find_by_device(device)) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_request_not_possible));
|
||||
}
|
||||
|
||||
// create a new object
|
||||
os_fs_mount_t *self = m_new_obj(os_fs_mount_t);
|
||||
self->device = device;
|
||||
self->path = path;
|
||||
self->pathlen = pathlen;
|
||||
self->vol = os_num_mounted_devices + 1; // '/flash' is volume 0
|
||||
|
||||
if (device == (mp_obj_t)&pybsd_obj) {
|
||||
// need to make it different to NULL, otherwise it's read only by default
|
||||
self->writeblocks[0] = mp_const_none;
|
||||
self->sync[0] = MP_OBJ_NULL; // no need to sync the SD card
|
||||
self->count[0] = MP_OBJ_NULL;
|
||||
} else {
|
||||
// load block protocol methods
|
||||
mp_load_method(device, MP_QSTR_readblocks, self->readblocks);
|
||||
mp_load_method_maybe(device, MP_QSTR_writeblocks, self->writeblocks);
|
||||
mp_load_method_maybe(device, MP_QSTR_sync, self->sync);
|
||||
mp_load_method(device, MP_QSTR_count, self->count);
|
||||
}
|
||||
|
||||
// Read-only device indicated by writeblocks[0] == MP_OBJ_NULL.
|
||||
// User can specify read-only device by:
|
||||
// 1. readonly=True keyword argument
|
||||
// 2. nonexistent writeblocks method (then writeblocks[0] == MP_OBJ_NULL already)
|
||||
if (readonly) {
|
||||
self->writeblocks[0] = MP_OBJ_NULL;
|
||||
}
|
||||
|
||||
// we need to add it before doing the actual mount, so that the volume can be found
|
||||
mp_obj_list_append(&MP_STATE_PORT(mount_obj_list), self);
|
||||
|
||||
// actually mount it
|
||||
if (f_mount(&self->fatfs, self->path, 1) != FR_OK) {
|
||||
// remove it and raise
|
||||
mp_obj_list_remove(&MP_STATE_PORT(mount_obj_list), self);
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_operation_failed));
|
||||
}
|
||||
|
||||
// mount succeeded, increment the count
|
||||
os_num_mounted_devices++;
|
||||
}
|
||||
|
||||
STATIC void unmount (os_fs_mount_t *mount_obj) {
|
||||
// remove it from the list and then call FatFs
|
||||
f_mount (NULL, mount_obj->path, 1);
|
||||
mp_obj_list_remove(&MP_STATE_PORT(mount_obj_list), mount_obj);
|
||||
os_num_mounted_devices--;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
// Micro Python bindings
|
||||
//
|
||||
|
||||
STATIC const qstr os_uname_info_fields[] = {
|
||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
||||
};
|
||||
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM);
|
||||
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM);
|
||||
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, WIPY_SW_VERSION_NUMBER);
|
||||
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
||||
STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
||||
STATIC MP_DEFINE_ATTRTUPLE(
|
||||
os_uname_info_obj,
|
||||
os_uname_info_fields,
|
||||
5,
|
||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
||||
(mp_obj_t)&os_uname_info_release_obj,
|
||||
(mp_obj_t)&os_uname_info_version_obj,
|
||||
(mp_obj_t)&os_uname_info_machine_obj
|
||||
);
|
||||
|
||||
STATIC mp_obj_t os_uname(void) {
|
||||
return (mp_obj_t)&os_uname_info_obj;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
|
||||
|
||||
/// \function chdir(path)
|
||||
/// Change current directory.
|
||||
STATIC mp_obj_t os_chdir(mp_obj_t path_in) {
|
||||
const char *path;
|
||||
path = mp_obj_str_get_str(path_in);
|
||||
|
||||
FRESULT res = f_chdrive(path);
|
||||
|
||||
if (res == FR_OK) {
|
||||
res = f_chdir(path);
|
||||
}
|
||||
|
||||
if (res != FR_OK) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_operation_failed));
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_chdir_obj, os_chdir);
|
||||
|
||||
STATIC mp_obj_t os_getcwd(void) {
|
||||
char buf[MICROPY_ALLOC_PATH_MAX + 1];
|
||||
FRESULT res = f_getcwd(buf, sizeof buf);
|
||||
if (res != FR_OK) {
|
||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res])));
|
||||
}
|
||||
return mp_obj_new_str(buf, strlen(buf), false);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd);
|
||||
|
||||
STATIC mp_obj_t os_listdir(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
bool is_str_type = true;
|
||||
const char *path;
|
||||
mp_obj_t dir_list = mp_obj_new_list(0, NULL);
|
||||
|
||||
if (n_args == 1) {
|
||||
if (mp_obj_get_type(args[0]) == &mp_type_bytes) {
|
||||
is_str_type = false;
|
||||
}
|
||||
path = mp_obj_str_get_str(args[0]);
|
||||
} else {
|
||||
path = "";
|
||||
}
|
||||
|
||||
// "hack" to list the root directory
|
||||
if (path[0] == '/' && path[1] == '\0') {
|
||||
// add 'flash' to the list
|
||||
append_dir_item (dir_list, "flash", is_str_type);
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mount_obj_list).len; i++) {
|
||||
os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[i]));
|
||||
append_dir_item (dir_list, &mount_obj->path[1], is_str_type);
|
||||
}
|
||||
} else {
|
||||
FRESULT res;
|
||||
DIR dir;
|
||||
FILINFO fno;
|
||||
#if _USE_LFN
|
||||
char lfn_buf[_MAX_LFN + 1];
|
||||
fno.lfname = lfn_buf;
|
||||
fno.lfsize = sizeof(lfn_buf);
|
||||
#endif
|
||||
|
||||
res = f_opendir(&dir, path); /* Open the directory */
|
||||
if (res != FR_OK) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_operation_failed));
|
||||
}
|
||||
|
||||
for ( ; ; ) {
|
||||
res = f_readdir(&dir, &fno); /* Read a directory item */
|
||||
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
|
||||
if (fno.fname[0] == '.' && fno.fname[1] == 0) continue; /* Ignore . entry */
|
||||
if (fno.fname[0] == '.' && fno.fname[1] == '.' && fno.fname[2] == 0) continue; /* Ignore .. entry */
|
||||
|
||||
#if _USE_LFN
|
||||
char *fn = *fno.lfname ? fno.lfname : fno.fname;
|
||||
#else
|
||||
char *fn = fno.fname;
|
||||
#endif
|
||||
|
||||
// add the entry to the list
|
||||
append_dir_item (dir_list, fn, is_str_type);
|
||||
}
|
||||
f_closedir(&dir);
|
||||
}
|
||||
|
||||
return dir_list;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_listdir_obj, 0, 1, os_listdir);
|
||||
|
||||
STATIC mp_obj_t os_mkdir(mp_obj_t path_o) {
|
||||
const char *path = mp_obj_str_get_str(path_o);
|
||||
FRESULT res = f_mkdir(path);
|
||||
switch (res) {
|
||||
case FR_OK:
|
||||
return mp_const_none;
|
||||
case FR_EXIST:
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_request_not_possible));
|
||||
break;
|
||||
default:
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_operation_failed));
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_mkdir_obj, os_mkdir);
|
||||
|
||||
STATIC mp_obj_t os_rename(mp_obj_t path_in, mp_obj_t path_out) {
|
||||
const char *old_path = mp_obj_str_get_str(path_in);
|
||||
const char *new_path = mp_obj_str_get_str(path_out);
|
||||
FRESULT res = f_rename(old_path, new_path);
|
||||
switch (res) {
|
||||
case FR_OK:
|
||||
return mp_const_none;
|
||||
default:
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_operation_failed));
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(os_rename_obj, os_rename);
|
||||
|
||||
STATIC mp_obj_t os_remove(mp_obj_t path_o) {
|
||||
const char *path = mp_obj_str_get_str(path_o);
|
||||
FRESULT res = f_unlink(path);
|
||||
switch (res) {
|
||||
case FR_OK:
|
||||
return mp_const_none;
|
||||
default:
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_operation_failed));
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_remove_obj, os_remove);
|
||||
|
||||
STATIC mp_obj_t os_stat(mp_obj_t path_in) {
|
||||
const char *path = mp_obj_str_get_str(path_in);
|
||||
stoupper((char *)path);
|
||||
|
||||
bool isbuilt_in = false;
|
||||
FILINFO fno;
|
||||
FRESULT res;
|
||||
if (path_equal(path, "/") || path_equal(path, "/SFLASH") || path_equal(path, "/SD")) {
|
||||
#if _USE_LFN
|
||||
fno.lfname = NULL;
|
||||
fno.lfsize = 0;
|
||||
#endif
|
||||
|
||||
// check on the user mounted devices
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mount_obj_list).len; i++) {
|
||||
os_fs_mount_t *mount_obj = ((os_fs_mount_t *)(MP_STATE_PORT(mount_obj_list).items[i]));
|
||||
if (path_equal(path, mount_obj->path)) {
|
||||
isbuilt_in = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (path_equal(path, "/") || path_equal(path, "/flash") || isbuilt_in) {
|
||||
// stat built-in directory
|
||||
if (path[1] == 'S' && !sd_in_root()) {
|
||||
// no /SD directory
|
||||
res = FR_NO_PATH;
|
||||
goto error;
|
||||
}
|
||||
fno.fsize = 0;
|
||||
fno.fdate = 0;
|
||||
fno.ftime = 0;
|
||||
fno.fattrib = AM_DIR;
|
||||
} else {
|
||||
res = f_stat(path, &fno);
|
||||
if (res != FR_OK) {
|
||||
goto error;
|
||||
}
|
||||
fno.fsize = 0;
|
||||
fno.fdate = 0;
|
||||
fno.ftime = 0;
|
||||
fno.fattrib = AM_DIR;
|
||||
} else if ((res = f_stat(path, &fno)) != FR_OK) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res])));
|
||||
}
|
||||
|
||||
mp_obj_tuple_t *t = mp_obj_new_tuple(10, NULL);
|
||||
@@ -254,7 +404,7 @@ STATIC mp_obj_t os_stat(mp_obj_t path_in) {
|
||||
} else {
|
||||
mode |= 0x8000; // stat.S_IFREG
|
||||
}
|
||||
mp_int_t seconds = mod_time_seconds_since_2000(
|
||||
mp_int_t seconds = timeutils_seconds_since_2000(
|
||||
1980 + ((fno.fdate >> 9) & 0x7f),
|
||||
(fno.fdate >> 5) & 0x0f,
|
||||
fno.fdate & 0x1f,
|
||||
@@ -272,26 +422,16 @@ STATIC mp_obj_t os_stat(mp_obj_t path_in) {
|
||||
t->items[7] = mp_obj_new_int(seconds); // st_atime
|
||||
t->items[8] = t->items[7]; // st_mtime
|
||||
t->items[9] = t->items[7]; // st_ctime
|
||||
|
||||
return t;
|
||||
|
||||
error:
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(fresult_to_errno_table[res])));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_stat_obj, os_stat);
|
||||
|
||||
/// \function sync()
|
||||
/// Sync all filesystems.
|
||||
mp_obj_t os_sync(void) {
|
||||
STATIC mp_obj_t os_sync(void) {
|
||||
sflash_disk_flush();
|
||||
return mp_const_none;
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_sync_obj, os_sync);
|
||||
|
||||
#if MICROPY_HW_ENABLE_RNG
|
||||
/// \function urandom(n)
|
||||
/// Return a bytes object with n random bytes, generated by the hardware
|
||||
/// random number generator.
|
||||
STATIC mp_obj_t os_urandom(mp_obj_t num) {
|
||||
mp_int_t n = mp_obj_get_int(num);
|
||||
vstr_t vstr;
|
||||
@@ -302,28 +442,160 @@ STATIC mp_obj_t os_urandom(mp_obj_t num) {
|
||||
return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_urandom_obj, os_urandom);
|
||||
#endif
|
||||
|
||||
STATIC mp_obj_t os_mount(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
static const mp_arg_t mount_args[] = {
|
||||
{ MP_QSTR_readonly, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
|
||||
};
|
||||
|
||||
// parse args
|
||||
mp_obj_t device = pos_args[0];
|
||||
mp_obj_t mount_point = pos_args[1];
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(mount_args)];
|
||||
mp_arg_parse_all(n_args - 2, pos_args + 2, kw_args, MP_ARRAY_SIZE(mount_args), mount_args, args);
|
||||
|
||||
// get the mount point
|
||||
mp_uint_t pathlen;
|
||||
const char *path_in = mp_obj_str_get_data(mount_point, &pathlen);
|
||||
if (pathlen == 0) {
|
||||
goto invalid_args;
|
||||
}
|
||||
|
||||
char *path = m_new(char, pathlen + 1);
|
||||
memcpy(path, path_in, pathlen);
|
||||
path[pathlen] = '\0';
|
||||
|
||||
// "remove" any extra slahes at the end
|
||||
while (path[(pathlen - 1)] == '/') {
|
||||
path[--pathlen] = '\0';
|
||||
}
|
||||
|
||||
// is the mount point valid?
|
||||
if (pathlen < 2 || path[0] !='/' || strchr(&path[1], '/')) {
|
||||
goto invalid_args;
|
||||
}
|
||||
|
||||
// now mount it
|
||||
mount(device, path, pathlen, args[0].u_bool);
|
||||
|
||||
return mp_const_none;
|
||||
|
||||
invalid_args:
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_value_invalid_arguments));
|
||||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(os_mount_obj, 2, os_mount);
|
||||
|
||||
STATIC mp_obj_t os_unmount(mp_obj_t path_o) {
|
||||
const char *path = mp_obj_str_get_str(path_o);
|
||||
|
||||
// '/flash' cannot be unmounted, also not the current working directory
|
||||
if (path_equal(path, "/flash")) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_request_not_possible));
|
||||
}
|
||||
|
||||
// now unmount it
|
||||
os_fs_mount_t *mount_obj;
|
||||
if ((mount_obj = osmount_find_by_path(path))) {
|
||||
unmount (mount_obj);
|
||||
} else {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_unmount_obj, os_unmount);
|
||||
|
||||
STATIC mp_obj_t os_mkfs(mp_obj_t device) {
|
||||
const char *path = "/__mkfs__mnt__";
|
||||
os_fs_mount_t *mount_obj = NULL;
|
||||
bool unmt = false;
|
||||
FRESULT res;
|
||||
|
||||
if (MP_OBJ_IS_STR_OR_BYTES(device)) {
|
||||
path = mp_obj_str_get_str(device);
|
||||
// otherwise the relative path check will pass...
|
||||
if (path[0] != '/') {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_value_invalid_arguments));
|
||||
}
|
||||
} else {
|
||||
// mount it briefly
|
||||
mount(device, path, strlen(path), false);
|
||||
unmt = true;
|
||||
}
|
||||
|
||||
byte sfd = 0;
|
||||
if (!memcmp(path, "/flash", strlen("/flash"))) {
|
||||
sfd = 1;
|
||||
} else if ((mount_obj = osmount_find_by_path(path))) {
|
||||
if (mount_obj->device != (mp_obj_t)&pybsd_obj &&
|
||||
mp_obj_get_int(mp_call_method_n_kw(0, 0, mount_obj->count)) < 2048) {
|
||||
sfd = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// now format the device
|
||||
res = f_mkfs(path, sfd, 0);
|
||||
|
||||
if (unmt && mount_obj) {
|
||||
unmount (mount_obj);
|
||||
}
|
||||
|
||||
if (res != FR_OK) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_operation_failed));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_mkfs_obj, os_mkfs);
|
||||
|
||||
STATIC mp_obj_t os_dupterm(uint n_args, const mp_obj_t *args) {
|
||||
if (n_args == 0) {
|
||||
if (MP_STATE_PORT(os_term_dup_obj) == MP_OBJ_NULL) {
|
||||
return mp_const_none;
|
||||
} else {
|
||||
return MP_STATE_PORT(os_term_dup_obj)->stream_o;
|
||||
}
|
||||
} else {
|
||||
mp_obj_t stream_o = args[0];
|
||||
if (stream_o == mp_const_none) {
|
||||
MP_STATE_PORT(os_term_dup_obj) = MP_OBJ_NULL;
|
||||
} else {
|
||||
if (!MP_OBJ_IS_TYPE(stream_o, &pyb_uart_type)) {
|
||||
// must be a stream-like object providing at least read and write methods
|
||||
mp_load_method(stream_o, MP_QSTR_read, os_term_dup_obj.read);
|
||||
mp_load_method(stream_o, MP_QSTR_write, os_term_dup_obj.write);
|
||||
}
|
||||
os_term_dup_obj.stream_o = stream_o;
|
||||
MP_STATE_PORT(os_term_dup_obj) = &os_term_dup_obj;
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_dupterm_obj, 0, 1, os_dupterm);
|
||||
|
||||
STATIC const mp_map_elem_t os_module_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_uos) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_uos) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_chdir), (mp_obj_t)&os_chdir_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_getcwd), (mp_obj_t)&os_getcwd_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_listdir), (mp_obj_t)&os_listdir_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_mkdir), (mp_obj_t)&os_mkdir_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_remove), (mp_obj_t)&os_remove_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_rmdir), (mp_obj_t)&os_rmdir_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_stat), (mp_obj_t)&os_stat_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_unlink), (mp_obj_t)&os_remove_obj }, // unlink aliases to remove
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_uname), (mp_obj_t)&os_uname_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_chdir), (mp_obj_t)&os_chdir_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_getcwd), (mp_obj_t)&os_getcwd_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_listdir), (mp_obj_t)&os_listdir_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_mkdir), (mp_obj_t)&os_mkdir_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_rename), (mp_obj_t)&os_rename_obj},
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_remove), (mp_obj_t)&os_remove_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_rmdir), (mp_obj_t)&os_remove_obj }, // rmdir aliases to remove
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_stat), (mp_obj_t)&os_stat_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_unlink), (mp_obj_t)&os_remove_obj }, // unlink aliases to remove
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&os_sync_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_urandom), (mp_obj_t)&os_urandom_obj },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sync), (mp_obj_t)&os_sync_obj },
|
||||
// MicroPython additions
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_mount), (mp_obj_t)&os_mount_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_unmount), (mp_obj_t)&os_unmount_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_mkfs), (mp_obj_t)&os_mkfs_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_dupterm), (mp_obj_t)&os_dupterm_obj },
|
||||
|
||||
/// \constant sep - separation character used in paths
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sep), MP_OBJ_NEW_QSTR(MP_QSTR__slash_) },
|
||||
|
||||
#if MICROPY_HW_ENABLE_RNG
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_urandom), (mp_obj_t)&os_urandom_obj },
|
||||
#endif
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sep), MP_OBJ_NEW_QSTR(MP_QSTR__slash_) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table);
|
||||
|
||||
@@ -25,9 +25,38 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MODUTIME_H_
|
||||
#define MODUTIME_H_
|
||||
#ifndef MODUOS_H_
|
||||
#define MODUOS_H_
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(os_sync_obj);
|
||||
#include "ff.h"
|
||||
|
||||
#endif // MODUTIME_H_
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC TYPES
|
||||
******************************************************************************/
|
||||
typedef struct _os_fs_mount_t {
|
||||
mp_obj_t device;
|
||||
const char *path;
|
||||
mp_uint_t pathlen;
|
||||
mp_obj_t readblocks[4];
|
||||
mp_obj_t writeblocks[4];
|
||||
mp_obj_t sync[2];
|
||||
mp_obj_t count[2];
|
||||
FATFS fatfs;
|
||||
uint8_t vol;
|
||||
} os_fs_mount_t;
|
||||
|
||||
typedef struct _os_term_dup_obj_t {
|
||||
mp_obj_t stream_o;
|
||||
mp_obj_t read[3];
|
||||
mp_obj_t write[3];
|
||||
} os_term_dup_obj_t;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
void moduos_init0 (void);
|
||||
os_fs_mount_t *osmount_find_by_path (const char *path);
|
||||
os_fs_mount_t *osmount_find_by_volume (uint8_t vol);
|
||||
void osmount_unmount_all (void);
|
||||
|
||||
#endif // MODUOS_H_
|
||||
|
||||
@@ -25,69 +25,148 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <std.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "simplelink.h"
|
||||
#include "py/mpstate.h"
|
||||
#include MICROPY_HAL_H
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "py/stream.h"
|
||||
#include "netutils.h"
|
||||
#include "modnetwork.h"
|
||||
#include "modwlan.h"
|
||||
#include "modusocket.h"
|
||||
#include "mpexception.h"
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE CONSTANTS
|
||||
******************************************************************************/
|
||||
#define MOD_NETWORK_MAX_SOCKETS 10
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE TYPES
|
||||
******************************************************************************/
|
||||
typedef struct {
|
||||
int16_t sd;
|
||||
bool user;
|
||||
} modusocket_sock_t;
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE DATA
|
||||
******************************************************************************/
|
||||
STATIC const mp_obj_type_t socket_type;
|
||||
STATIC OsiLockObj_t modusocket_LockObj;
|
||||
STATIC modusocket_sock_t modusocket_sockets[MOD_NETWORK_MAX_SOCKETS] = {{.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1},
|
||||
{.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1}, {.sd = -1}};
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
__attribute__ ((section (".boot")))
|
||||
void modusocket_pre_init (void) {
|
||||
// create the wlan lock
|
||||
ASSERT(OSI_OK == sl_LockObjCreate(&modusocket_LockObj, "SockLock"));
|
||||
sl_LockObjUnlock (&modusocket_LockObj);
|
||||
}
|
||||
|
||||
void modusocket_socket_add (int16_t sd, bool user) {
|
||||
sl_LockObjLock (&modusocket_LockObj, SL_OS_WAIT_FOREVER);
|
||||
for (int i = 0; i < MOD_NETWORK_MAX_SOCKETS; i++) {
|
||||
if (modusocket_sockets[i].sd < 0) {
|
||||
modusocket_sockets[i].sd = sd;
|
||||
modusocket_sockets[i].user = user;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sl_LockObjUnlock (&modusocket_LockObj);
|
||||
}
|
||||
|
||||
void modusocket_socket_delete (int16_t sd) {
|
||||
sl_LockObjLock (&modusocket_LockObj, SL_OS_WAIT_FOREVER);
|
||||
for (int i = 0; i < MOD_NETWORK_MAX_SOCKETS; i++) {
|
||||
if (modusocket_sockets[i].sd == sd) {
|
||||
modusocket_sockets[i].sd = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sl_LockObjUnlock (&modusocket_LockObj);
|
||||
}
|
||||
|
||||
void modusocket_enter_sleep (void) {
|
||||
fd_set socketset;
|
||||
int16_t maxfd = 0;
|
||||
|
||||
for (int i = 0; i < MOD_NETWORK_MAX_SOCKETS; i++) {
|
||||
int16_t sd;
|
||||
if ((sd = modusocket_sockets[i].sd) >= 0) {
|
||||
FD_SET(sd, &socketset);
|
||||
maxfd = (maxfd > sd) ? maxfd : sd;
|
||||
}
|
||||
}
|
||||
|
||||
if (maxfd > 0) {
|
||||
// wait for any of the sockets to become ready...
|
||||
sl_Select(maxfd + 1, &socketset, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void modusocket_close_all_user_sockets (void) {
|
||||
sl_LockObjLock (&modusocket_LockObj, SL_OS_WAIT_FOREVER);
|
||||
for (int i = 0; i < MOD_NETWORK_MAX_SOCKETS; i++) {
|
||||
if (modusocket_sockets[i].sd >= 0 && modusocket_sockets[i].user) {
|
||||
sl_Close(modusocket_sockets[i].sd);
|
||||
modusocket_sockets[i].sd = -1;
|
||||
}
|
||||
}
|
||||
sl_LockObjUnlock (&modusocket_LockObj);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
// socket class
|
||||
|
||||
STATIC const mp_obj_type_t socket_type;
|
||||
|
||||
// constructor socket(family=AF_INET, type=SOCK_STREAM, proto=IPPROTO_TCP, fileno=None)
|
||||
STATIC mp_obj_t socket_make_new(mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
|
||||
STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp_uint_t n_kw, const mp_obj_t *args) {
|
||||
mp_arg_check_num(n_args, n_kw, 0, 4, false);
|
||||
|
||||
// create socket object (not bound to any NIC yet)
|
||||
// create socket object
|
||||
mod_network_socket_obj_t *s = m_new_obj_with_finaliser(mod_network_socket_obj_t);
|
||||
s->base.type = (mp_obj_t)&socket_type;
|
||||
s->nic = MP_OBJ_NULL;
|
||||
s->nic_type = NULL;
|
||||
s->u_param.domain = AF_INET;
|
||||
s->u_param.type = SOCK_STREAM;
|
||||
s->u_param.proto = IPPROTO_TCP;
|
||||
s->u_param.fileno = -1;
|
||||
if (n_args >= 1) {
|
||||
s->u_param.domain = mp_obj_get_int(args[0]);
|
||||
if (n_args >= 2) {
|
||||
s->u_param.type = mp_obj_get_int(args[1]);
|
||||
if (n_args >= 3) {
|
||||
s->u_param.proto = mp_obj_get_int(args[2]);
|
||||
if (n_args == 4) {
|
||||
s->u_param.fileno = mp_obj_get_int(args[3]);
|
||||
s->sock_base.u_param.domain = AF_INET;
|
||||
s->sock_base.u_param.type = SOCK_STREAM;
|
||||
s->sock_base.u_param.proto = IPPROTO_TCP;
|
||||
s->sock_base.u_param.fileno = -1;
|
||||
s->sock_base.has_timeout = false;
|
||||
s->sock_base.cert_req = false;
|
||||
|
||||
if (n_args > 0) {
|
||||
s->sock_base.u_param.domain = mp_obj_get_int(args[0]);
|
||||
if (n_args > 1) {
|
||||
s->sock_base.u_param.type = mp_obj_get_int(args[1]);
|
||||
if (n_args > 2) {
|
||||
s->sock_base.u_param.proto = mp_obj_get_int(args[2]);
|
||||
if (n_args > 3) {
|
||||
s->sock_base.u_param.fileno = mp_obj_get_int(args[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create the socket
|
||||
int _errno;
|
||||
if (wlan_socket_socket(s, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
// add the socket to the list
|
||||
modusocket_socket_add(s->sock_base.sd, true);
|
||||
return s;
|
||||
}
|
||||
|
||||
STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) {
|
||||
if (self->nic == MP_OBJ_NULL) {
|
||||
// select NIC based on IP
|
||||
self->nic = mod_network_find_nic(ip);
|
||||
self->nic_type = (mod_network_nic_type_t*)mp_obj_get_type(self->nic);
|
||||
|
||||
// call the NIC to open the socket
|
||||
int _errno;
|
||||
if (self->nic_type->socket(self, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
}
|
||||
}
|
||||
}
|
||||
// method socket.close()
|
||||
STATIC mp_obj_t socket_close(mp_obj_t self_in) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
if (self->nic != MP_OBJ_NULL) {
|
||||
self->nic_type->close(self);
|
||||
}
|
||||
wlan_socket_close(self);
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_close_obj, socket_close);
|
||||
@@ -98,67 +177,59 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
|
||||
|
||||
// get address
|
||||
uint8_t ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
|
||||
mp_uint_t port = mod_network_parse_inet_addr(addr_in, ip);
|
||||
|
||||
// check if we need to select a NIC
|
||||
socket_select_nic(self, ip);
|
||||
mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_LITTLE);
|
||||
|
||||
// call the NIC to bind the socket
|
||||
int _errno;
|
||||
if (self->nic_type->bind(self, ip, port, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
if (wlan_socket_bind(self, ip, port, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
|
||||
|
||||
// method socket.listen(backlog)
|
||||
STATIC mp_obj_t socket_listen(mp_obj_t self_in, mp_obj_t backlog) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
// method socket.listen([backlog])
|
||||
STATIC mp_obj_t socket_listen(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
mod_network_socket_obj_t *self = args[0];
|
||||
|
||||
if (self->nic == MP_OBJ_NULL) {
|
||||
// not connected
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOTCONN)));
|
||||
int32_t backlog = 0;
|
||||
if (n_args > 1) {
|
||||
backlog = mp_obj_get_int(args[1]);
|
||||
backlog = (backlog < 0) ? 0 : backlog;
|
||||
}
|
||||
|
||||
int _errno;
|
||||
if (self->nic_type->listen(self, mp_obj_get_int(backlog), &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
if (wlan_socket_listen(self, backlog, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_listen_obj, socket_listen);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_listen_obj, 1, 2, socket_listen);
|
||||
|
||||
// method socket.accept()
|
||||
STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
|
||||
// create new socket object
|
||||
// starts with empty NIC so that finaliser doesn't run close() method if accept() fails
|
||||
mod_network_socket_obj_t *socket2 = m_new_obj_with_finaliser(mod_network_socket_obj_t);
|
||||
socket2->base.type = (mp_obj_t)&socket_type;
|
||||
socket2->nic = MP_OBJ_NULL;
|
||||
socket2->nic_type = NULL;
|
||||
// the new socket inherits all properties from its parent
|
||||
memcpy (socket2, self, sizeof(mod_network_socket_obj_t));
|
||||
|
||||
// accept incoming connection
|
||||
// accept the incoming connection
|
||||
uint8_t ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
|
||||
mp_uint_t port;
|
||||
int _errno;
|
||||
if (self->nic_type->accept(self, socket2, ip, &port, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
if (wlan_socket_accept(self, socket2, ip, &port, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
|
||||
// new socket has valid state, so set the NIC to the same as parent
|
||||
socket2->nic = self->nic;
|
||||
socket2->nic_type = self->nic_type;
|
||||
// add the socket to the list
|
||||
modusocket_socket_add(socket2->sock_base.sd, true);
|
||||
|
||||
// make the return value
|
||||
mp_obj_tuple_t *client = mp_obj_new_tuple(2, NULL);
|
||||
client->items[0] = socket2;
|
||||
client->items[1] = mod_network_format_inet_addr(ip, port);
|
||||
|
||||
client->items[1] = netutils_format_inet_addr(ip, port, NETUTILS_LITTLE);
|
||||
return client;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
|
||||
@@ -169,17 +240,16 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
|
||||
|
||||
// get address
|
||||
uint8_t ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
|
||||
mp_uint_t port = mod_network_parse_inet_addr(addr_in, ip);
|
||||
mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_LITTLE);
|
||||
|
||||
// check if we need to select a NIC
|
||||
socket_select_nic(self, ip);
|
||||
|
||||
// call the NIC to connect the socket
|
||||
// connect the socket
|
||||
int _errno;
|
||||
if (self->nic_type->connect(self, ip, port, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
if (wlan_socket_connect(self, ip, port, &_errno) != 0) {
|
||||
if (!self->sock_base.cert_req && _errno == SL_ESECSNOVERIFY) {
|
||||
return mp_const_none;
|
||||
}
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
|
||||
@@ -187,16 +257,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
|
||||
// method socket.send(bytes)
|
||||
STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
if (self->nic == MP_OBJ_NULL) {
|
||||
// not connected
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(EBADF)));
|
||||
}
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ);
|
||||
int _errno;
|
||||
mp_uint_t ret = self->nic_type->send(self, bufinfo.buf, bufinfo.len, &_errno);
|
||||
if (ret == -1) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
mp_int_t ret = wlan_socket_send(self, bufinfo.buf, bufinfo.len, &_errno);
|
||||
if (ret < 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
return mp_obj_new_int_from_uint(ret);
|
||||
}
|
||||
@@ -205,17 +271,16 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_send_obj, socket_send);
|
||||
// method socket.recv(bufsize)
|
||||
STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
if (self->nic == MP_OBJ_NULL) {
|
||||
// not connected
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOTCONN)));
|
||||
}
|
||||
mp_int_t len = mp_obj_get_int(len_in);
|
||||
vstr_t vstr;
|
||||
vstr_init_len(&vstr, len);
|
||||
int _errno;
|
||||
mp_uint_t ret = self->nic_type->recv(self, (byte*)vstr.buf, len, &_errno);
|
||||
if (ret == -1) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
mp_int_t ret = wlan_socket_recv(self, (byte*)vstr.buf, len, &_errno);
|
||||
if (ret < 0) {
|
||||
if (_errno == EAGAIN && self->sock_base.has_timeout) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_TimeoutError, "timed out"));
|
||||
}
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
if (ret == 0) {
|
||||
return mp_const_empty_bytes;
|
||||
@@ -236,18 +301,14 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
|
||||
|
||||
// get address
|
||||
uint8_t ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
|
||||
mp_uint_t port = mod_network_parse_inet_addr(addr_in, ip);
|
||||
mp_uint_t port = netutils_parse_inet_addr(addr_in, ip, NETUTILS_LITTLE);
|
||||
|
||||
// check if we need to select a NIC
|
||||
socket_select_nic(self, ip);
|
||||
|
||||
// call the NIC to sendto
|
||||
// call the nic to sendto
|
||||
int _errno;
|
||||
mp_int_t ret = self->nic_type->sendto(self, bufinfo.buf, bufinfo.len, ip, port, &_errno);
|
||||
if (ret == -1) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
mp_int_t ret = wlan_socket_sendto(self, bufinfo.buf, bufinfo.len, ip, port, &_errno);
|
||||
if (ret < 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
|
||||
return mp_obj_new_int(ret);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
|
||||
@@ -255,18 +316,17 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
|
||||
// method socket.recvfrom(bufsize)
|
||||
STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
if (self->nic == MP_OBJ_NULL) {
|
||||
// not connected
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOTCONN)));
|
||||
}
|
||||
vstr_t vstr;
|
||||
vstr_init_len(&vstr, mp_obj_get_int(len_in));
|
||||
byte ip[4];
|
||||
mp_uint_t port;
|
||||
int _errno;
|
||||
mp_int_t ret = self->nic_type->recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
|
||||
if (ret == -1) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
mp_int_t ret = wlan_socket_recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
|
||||
if (ret < 0) {
|
||||
if (_errno == EAGAIN && self->sock_base.has_timeout) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_TimeoutError, "timed out"));
|
||||
}
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
mp_obj_t tuple[2];
|
||||
if (ret == 0) {
|
||||
@@ -276,7 +336,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
|
||||
vstr.buf[vstr.len] = '\0';
|
||||
tuple[0] = mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
|
||||
}
|
||||
tuple[1] = mod_network_format_inet_addr(ip, port);
|
||||
tuple[1] = netutils_format_inet_addr(ip, port, NETUTILS_LITTLE);
|
||||
return mp_obj_new_tuple(2, tuple);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
|
||||
@@ -292,7 +352,7 @@ STATIC mp_obj_t socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
mp_uint_t optlen;
|
||||
mp_int_t val;
|
||||
if (mp_obj_is_integer(args[3])) {
|
||||
val = mp_obj_int_get_truncated(args[3]);
|
||||
val = mp_obj_get_int_truncated(args[3]);
|
||||
optval = &val;
|
||||
optlen = sizeof(val);
|
||||
} else {
|
||||
@@ -303,10 +363,9 @@ STATIC mp_obj_t socket_setsockopt(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
}
|
||||
|
||||
int _errno;
|
||||
if (self->nic_type->setsockopt(self, level, opt, optval, optlen, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
if (wlan_socket_setsockopt(self, level, opt, optval, optlen, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
|
||||
@@ -317,19 +376,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_s
|
||||
// otherwise, timeout is in seconds
|
||||
STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
if (self->nic == MP_OBJ_NULL) {
|
||||
// not connected
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(ENOTCONN)));
|
||||
}
|
||||
mp_uint_t timeout;
|
||||
if (timeout_in == mp_const_none) {
|
||||
timeout = -1;
|
||||
} else {
|
||||
timeout = 1000 * mp_obj_get_int(timeout_in);
|
||||
timeout = mp_obj_get_int(timeout_in);
|
||||
}
|
||||
int _errno;
|
||||
if (self->nic_type->settimeout(self, timeout, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
if (wlan_socket_settimeout(self, timeout, &_errno) != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-_errno)));
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
@@ -345,30 +400,84 @@ STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
|
||||
|
||||
STATIC mp_obj_t socket_makefile(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
// TODO: CPython explicitly says that closing the returned object doesn't
|
||||
// close the original socket (Python2 at all says that fd is dup()ed). But
|
||||
// we save on the bloat.
|
||||
mod_network_socket_obj_t *self = args[0];
|
||||
if (n_args > 1) {
|
||||
const char *mode = mp_obj_str_get_str(args[1]);
|
||||
if (strcmp(mode, "rb") && strcmp(mode, "wb")) {
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 6, socket_makefile);
|
||||
|
||||
STATIC const mp_map_elem_t socket_locals_dict_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___del__), (mp_obj_t)&socket_close_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_close), (mp_obj_t)&socket_close_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_bind), (mp_obj_t)&socket_bind_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_listen), (mp_obj_t)&socket_listen_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_accept), (mp_obj_t)&socket_accept_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)&socket_connect_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_send), (mp_obj_t)&socket_send_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_recv), (mp_obj_t)&socket_recv_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sendto), (mp_obj_t)&socket_sendto_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_recvfrom), (mp_obj_t)&socket_recvfrom_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_setsockopt), (mp_obj_t)&socket_setsockopt_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_settimeout), (mp_obj_t)&socket_settimeout_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_setblocking), (mp_obj_t)&socket_setblocking_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___del__), (mp_obj_t)&socket_close_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_close), (mp_obj_t)&socket_close_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_bind), (mp_obj_t)&socket_bind_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_listen), (mp_obj_t)&socket_listen_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_accept), (mp_obj_t)&socket_accept_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)&socket_connect_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_send), (mp_obj_t)&socket_send_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sendall), (mp_obj_t)&socket_send_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_recv), (mp_obj_t)&socket_recv_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_sendto), (mp_obj_t)&socket_sendto_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_recvfrom), (mp_obj_t)&socket_recvfrom_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_setsockopt), (mp_obj_t)&socket_setsockopt_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_settimeout), (mp_obj_t)&socket_settimeout_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_setblocking), (mp_obj_t)&socket_setblocking_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_makefile), (mp_obj_t)&socket_makefile_obj },
|
||||
|
||||
// stream methods
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&mp_stream_read_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_readall), (mp_obj_t)&mp_stream_readall_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_readinto), (mp_obj_t)&mp_stream_readinto_obj },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_readline), (mp_obj_t)&mp_stream_unbuffered_readline_obj},
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&mp_stream_write_obj },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
|
||||
MP_DEFINE_CONST_DICT(socket_locals_dict, socket_locals_dict_table);
|
||||
|
||||
mp_uint_t socket_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
|
||||
STATIC mp_uint_t socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
return self->nic_type->ioctl(self, request, arg, errcode);
|
||||
mp_int_t ret = wlan_socket_recv(self, buf, size, errcode);
|
||||
if (ret < 0) {
|
||||
// we need to ignore the socket closed error here because a readall() or read() without params
|
||||
// only returns when the socket is closed by the other end
|
||||
if (*errcode != SL_ESECCLOSED) {
|
||||
ret = MP_STREAM_ERROR;
|
||||
// needed to convert simplelink's negative error codes to POSIX
|
||||
(*errcode) *= -1;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
STATIC const mp_stream_p_t socket_stream_p = {
|
||||
STATIC mp_uint_t socket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
mp_int_t ret = wlan_socket_send(self, buf, size, errcode);
|
||||
if (ret < 0) {
|
||||
ret = MP_STREAM_ERROR;
|
||||
// needed to convert simplelink's negative error codes to POSIX
|
||||
(*errcode) *= -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
STATIC mp_uint_t socket_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t arg, int *errcode) {
|
||||
mod_network_socket_obj_t *self = self_in;
|
||||
return wlan_socket_ioctl(self, request, arg, errcode);
|
||||
}
|
||||
|
||||
const mp_stream_p_t socket_stream_p = {
|
||||
.read = socket_read,
|
||||
.write = socket_write,
|
||||
.ioctl = socket_ioctl,
|
||||
.is_text = false,
|
||||
};
|
||||
@@ -377,7 +486,7 @@ STATIC const mp_obj_type_t socket_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_socket,
|
||||
.make_new = socket_make_new,
|
||||
.stream_p = &socket_stream_p,
|
||||
.protocol = &socket_stream_p,
|
||||
.locals_dict = (mp_obj_t)&socket_locals_dict,
|
||||
};
|
||||
|
||||
@@ -391,28 +500,19 @@ STATIC mp_obj_t mod_usocket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) {
|
||||
const char *host = mp_obj_str_get_data(host_in, &hlen);
|
||||
mp_int_t port = mp_obj_get_int(port_in);
|
||||
|
||||
// find a NIC that can do a name lookup
|
||||
for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) {
|
||||
mp_obj_t nic = MP_STATE_PORT(mod_network_nic_list).items[i];
|
||||
mod_network_nic_type_t *nic_type = (mod_network_nic_type_t*)mp_obj_get_type(nic);
|
||||
if (nic_type->gethostbyname != NULL) {
|
||||
// Only IPv4 is supported
|
||||
uint8_t out_ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
|
||||
int32_t result = nic_type->gethostbyname(nic, host, hlen, out_ip, AF_INET);
|
||||
if (result != 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(result)));
|
||||
}
|
||||
mp_obj_tuple_t *tuple = mp_obj_new_tuple(5, NULL);
|
||||
tuple->items[0] = MP_OBJ_NEW_SMALL_INT(AF_INET);
|
||||
tuple->items[1] = MP_OBJ_NEW_SMALL_INT(SOCK_STREAM);
|
||||
tuple->items[2] = MP_OBJ_NEW_SMALL_INT(0);
|
||||
tuple->items[3] = MP_OBJ_NEW_QSTR(MP_QSTR_);
|
||||
tuple->items[4] = mod_network_format_inet_addr(out_ip, port);
|
||||
return mp_obj_new_list(1, (mp_obj_t*)&tuple);
|
||||
}
|
||||
// ipv4 only
|
||||
uint8_t out_ip[MOD_NETWORK_IPV4ADDR_BUF_SIZE];
|
||||
int32_t result = wlan_gethostbyname(host, hlen, out_ip, AF_INET);
|
||||
if (result < 0) {
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(-result)));
|
||||
}
|
||||
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, mpexception_os_resource_not_avaliable));
|
||||
mp_obj_tuple_t *tuple = mp_obj_new_tuple(5, NULL);
|
||||
tuple->items[0] = MP_OBJ_NEW_SMALL_INT(AF_INET);
|
||||
tuple->items[1] = MP_OBJ_NEW_SMALL_INT(SOCK_STREAM);
|
||||
tuple->items[2] = MP_OBJ_NEW_SMALL_INT(0);
|
||||
tuple->items[3] = MP_OBJ_NEW_QSTR(MP_QSTR_);
|
||||
tuple->items[4] = netutils_format_inet_addr(out_ip, port, NETUTILS_LITTLE);
|
||||
return mp_obj_new_list(1, (mp_obj_t*)&tuple);
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_usocket_getaddrinfo_obj, mod_usocket_getaddrinfo);
|
||||
|
||||
@@ -422,17 +522,19 @@ STATIC const mp_map_elem_t mp_module_usocket_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_socket), (mp_obj_t)&socket_type },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_getaddrinfo), (mp_obj_t)&mod_usocket_getaddrinfo_obj },
|
||||
|
||||
// class exceptions
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_error), (mp_obj_t)&mp_type_OSError },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_timeout), (mp_obj_t)&mp_type_TimeoutError },
|
||||
|
||||
// class constants
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_AF_INET), MP_OBJ_NEW_SMALL_INT(AF_INET) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_AF_INET6), MP_OBJ_NEW_SMALL_INT(AF_INET6) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SOCK_STREAM), MP_OBJ_NEW_SMALL_INT(SOCK_STREAM) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SOCK_DGRAM), MP_OBJ_NEW_SMALL_INT(SOCK_DGRAM) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SOCK_RAW), MP_OBJ_NEW_SMALL_INT(SOCK_RAW) },
|
||||
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_IPPROTO_SEC), MP_OBJ_NEW_SMALL_INT(SL_SEC_SOCKET) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_IPPROTO_TCP), MP_OBJ_NEW_SMALL_INT(IPPROTO_TCP) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_IPPROTO_UDP), MP_OBJ_NEW_SMALL_INT(IPPROTO_UDP) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_IPPROTO_RAW), MP_OBJ_NEW_SMALL_INT(IPPROTO_RAW) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_module_usocket_globals, mp_module_usocket_globals_table);
|
||||
|
||||
39
cc3200/mods/modusocket.h
Normal file
39
cc3200/mods/modusocket.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MODUSOCKET_H_
|
||||
#define MODUSOCKET_H_
|
||||
|
||||
extern const mp_obj_dict_t socket_locals_dict;
|
||||
extern const mp_stream_p_t socket_stream_p;
|
||||
|
||||
extern void modusocket_pre_init (void);
|
||||
extern void modusocket_socket_add (int16_t sd, bool user);
|
||||
extern void modusocket_socket_delete (int16_t sd);
|
||||
extern void modusocket_enter_sleep (void);
|
||||
extern void modusocket_close_all_user_sockets (void);
|
||||
|
||||
#endif /* MODUSOCKET_H_ */
|
||||
158
cc3200/mods/modussl.c
Normal file
158
cc3200/mods/modussl.c
Normal file
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* This file is part of the Micro Python project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 Daniel Campora
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <std.h>
|
||||
|
||||
#include "simplelink.h"
|
||||
#include "py/mpconfig.h"
|
||||
#include "py/obj.h"
|
||||
#include "py/objstr.h"
|
||||
#include "py/runtime.h"
|
||||
#include "modnetwork.h"
|
||||
#include "modusocket.h"
|
||||
#include "mpexception.h"
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE CONSTANTS
|
||||
******************************************************************************/
|
||||
#define SSL_CERT_NONE (0)
|
||||
#define SSL_CERT_OPTIONAL (1)
|
||||
#define SSL_CERT_REQUIRED (2)
|
||||
|
||||
/******************************************************************************
|
||||
DEFINE TYPES
|
||||
******************************************************************************/
|
||||
typedef struct _mp_obj_ssl_socket_t {
|
||||
mp_obj_base_t base;
|
||||
mod_network_socket_base_t sock_base;
|
||||
mp_obj_t o_sock;
|
||||
} mp_obj_ssl_socket_t;
|
||||
|
||||
/******************************************************************************
|
||||
DECLARE PRIVATE DATA
|
||||
******************************************************************************/
|
||||
STATIC const mp_obj_type_t ssl_socket_type;
|
||||
|
||||
/******************************************************************************/
|
||||
// Micro Python bindings; SSL class
|
||||
|
||||
// ssl sockets inherit from normal socket, so we take its
|
||||
// locals and stream methods
|
||||
STATIC const mp_obj_type_t ssl_socket_type = {
|
||||
{ &mp_type_type },
|
||||
.name = MP_QSTR_ussl,
|
||||
.getiter = NULL,
|
||||
.iternext = NULL,
|
||||
.protocol = &socket_stream_p,
|
||||
.locals_dict = (mp_obj_t)&socket_locals_dict,
|
||||
};
|
||||
|
||||
STATIC mp_obj_t mod_ssl_wrap_socket(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
STATIC const mp_arg_t allowed_args[] = {
|
||||
{ MP_QSTR_sock, MP_ARG_REQUIRED | MP_ARG_OBJ, },
|
||||
{ MP_QSTR_keyfile, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_certfile, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
{ MP_QSTR_server_side, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
|
||||
{ MP_QSTR_cert_reqs, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = SSL_CERT_NONE} },
|
||||
{ MP_QSTR_ca_certs, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
|
||||
};
|
||||
|
||||
// parse arguments
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
// chech if ca validation is required
|
||||
if (args[4].u_int != SSL_CERT_NONE && args[5].u_obj == mp_const_none) {
|
||||
goto arg_error;
|
||||
}
|
||||
|
||||
// retrieve the file paths (with an 6 byte offset in order to strip it from the '/flash' prefix)
|
||||
const char *keyfile = (args[1].u_obj == mp_const_none) ? NULL : &(mp_obj_str_get_str(args[1].u_obj)[6]);
|
||||
const char *certfile = (args[2].u_obj == mp_const_none) ? NULL : &(mp_obj_str_get_str(args[2].u_obj)[6]);
|
||||
const char *cafile = (args[5].u_obj == mp_const_none || args[4].u_int != SSL_CERT_REQUIRED) ?
|
||||
NULL : &(mp_obj_str_get_str(args[5].u_obj)[6]);
|
||||
|
||||
// server side requires both certfile and keyfile
|
||||
if (args[3].u_bool && (!keyfile || !certfile)) {
|
||||
goto arg_error;
|
||||
}
|
||||
|
||||
_i16 sd = ((mod_network_socket_obj_t *)args[0].u_obj)->sock_base.sd;
|
||||
_i16 _errno;
|
||||
_u8 method = SL_SO_SEC_METHOD_TLSV1;
|
||||
if ((_errno = sl_SetSockOpt(sd, SL_SOL_SOCKET, SL_SO_SECMETHOD, &method, sizeof(method))) < 0) {
|
||||
goto socket_error;
|
||||
}
|
||||
if (keyfile && (_errno = sl_SetSockOpt(sd, SL_SOL_SOCKET, SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME, keyfile, strlen(keyfile))) < 0) {
|
||||
goto socket_error;
|
||||
}
|
||||
if (certfile && (_errno = sl_SetSockOpt(sd, SL_SOL_SOCKET, SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME, certfile, strlen(certfile))) < 0) {
|
||||
goto socket_error;
|
||||
}
|
||||
if (cafile && (_errno = sl_SetSockOpt(sd, SL_SOL_SOCKET, SL_SO_SECURE_FILES_CA_FILE_NAME, cafile, strlen(cafile))) < 0) {
|
||||
goto socket_error;
|
||||
}
|
||||
|
||||
// create the ssl socket
|
||||
mp_obj_ssl_socket_t *ssl_sock = m_new_obj(mp_obj_ssl_socket_t);
|
||||
// ssl sockets inherit all properties from the original socket
|
||||
memcpy (&ssl_sock->sock_base, &((mod_network_socket_obj_t *)args[0].u_obj)->sock_base, sizeof(mod_network_socket_base_t));
|
||||
ssl_sock->base.type = &ssl_socket_type;
|
||||
ssl_sock->sock_base.cert_req = (args[4].u_int == SSL_CERT_REQUIRED) ? true : false;
|
||||
ssl_sock->o_sock = args[0].u_obj;
|
||||
|
||||
return ssl_sock;
|
||||
|
||||
socket_error:
|
||||
nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(_errno)));
|
||||
|
||||
arg_error:
|
||||
nlr_raise(mp_obj_new_exception_msg(&mp_type_ValueError, mpexception_value_invalid_arguments));
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_ssl_wrap_socket_obj, 0, mod_ssl_wrap_socket);
|
||||
|
||||
STATIC const mp_map_elem_t mp_module_ussl_globals_table[] = {
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_ussl) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_wrap_socket), (mp_obj_t)&mod_ssl_wrap_socket_obj },
|
||||
|
||||
// class exceptions
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SSLError), (mp_obj_t)&mp_type_OSError },
|
||||
|
||||
// class constants
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_CERT_NONE), MP_OBJ_NEW_SMALL_INT(SSL_CERT_NONE) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_CERT_OPTIONAL), MP_OBJ_NEW_SMALL_INT(SSL_CERT_OPTIONAL) },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_CERT_REQUIRED), MP_OBJ_NEW_SMALL_INT(SSL_CERT_REQUIRED) },
|
||||
};
|
||||
|
||||
STATIC MP_DEFINE_CONST_DICT(mp_module_ussl_globals, mp_module_ussl_globals_table);
|
||||
|
||||
const mp_obj_module_t mp_module_ussl = {
|
||||
.base = { &mp_type_module },
|
||||
.name = MP_QSTR_ussl,
|
||||
.globals = (mp_obj_dict_t*)&mp_module_ussl_globals,
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user