forked from espressif/esp-idf
Compare commits
872 Commits
Author | SHA1 | Date | |
---|---|---|---|
c8fc5f643b | |||
87c9fb8d40 | |||
aa754d40b8 | |||
2c46030bbf | |||
475825c436 | |||
0bbd728196 | |||
13326df918 | |||
5703d60420 | |||
808950a25a | |||
aad4a5591f | |||
6c507056f3 | |||
0526c35ec3 | |||
1f37d126c6 | |||
24c6528d29 | |||
b1c9475b71 | |||
aa2290a0ae | |||
466a392a76 | |||
4c53b937b6 | |||
be5feaff6d | |||
8679f14d1d | |||
bbe0750ca0 | |||
eca7b3b1f1 | |||
fe48cfd6e5 | |||
3eec62f823 | |||
e94d1f275c | |||
4a7985ab4a | |||
1f06765630 | |||
12a2e89ac6 | |||
73cdd20168 | |||
6568f8c553 | |||
55069a785e | |||
0c03c2008e | |||
21147cd7f5 | |||
da816521d3 | |||
18a8fcd510 | |||
c4d4bfd646 | |||
5b8da6f327 | |||
9ed45e4055 | |||
70bc919e80 | |||
0cca45334e | |||
7ccfd7d673 | |||
f81cece9d4 | |||
01f0fd4158 | |||
9a44ced672 | |||
883ee8b0a0 | |||
530f10f261 | |||
a1ddeeca3e | |||
5177bcc0a4 | |||
adb5d60ec9 | |||
4c90790cd2 | |||
cab1a2ab4a | |||
fc847a0e9f | |||
14bdeaede5 | |||
f5e6f7276e | |||
de1050b810 | |||
948c178a96 | |||
fc177553b2 | |||
f7ac13a566 | |||
90bb23f2f0 | |||
7a538b96a6 | |||
ba3a106fed | |||
39148025fc | |||
b82594e589 | |||
f7a3808374 | |||
86484c14e6 | |||
611beb2c7b | |||
e3182df661 | |||
660de3d5af | |||
1df847e2a0 | |||
e4962dccf3 | |||
c658ae6679 | |||
ae8c5f5e1c | |||
d61531a8e5 | |||
04220bda1b | |||
9e0a13e4d7 | |||
46892c32ec | |||
68bdc86b65 | |||
9775832c8c | |||
7be0bf12af | |||
0df2bb24e7 | |||
4b665425a2 | |||
124778fbcb | |||
b5ddc10ed1 | |||
1dff957597 | |||
b124b1d682 | |||
e566ffffcb | |||
4cc7eecf4f | |||
fe810983c4 | |||
5dac537f6b | |||
df5bf8c365 | |||
e1f066e3b3 | |||
21e23c16c4 | |||
59666823e4 | |||
753fe53fab | |||
8b8bb72ad4 | |||
5509cda7ca | |||
8d22f1c609 | |||
cada05a0df | |||
dccd6b0259 | |||
cf36c11b81 | |||
7e93518073 | |||
144b731f3a | |||
cd6b3ab9fb | |||
05305871b2 | |||
9a481d8f23 | |||
474a92697c | |||
bbda124fce | |||
dc7fb34fca | |||
3fc2c00dab | |||
3e4fcf66ef | |||
ec130b0a64 | |||
6b83cc254d | |||
e034358983 | |||
aa95bb1e9a | |||
c4d3716f76 | |||
5b4b867a9c | |||
9e38f78ea2 | |||
acb201e5b2 | |||
4168fa28f4 | |||
ae0a230843 | |||
ca967c9f96 | |||
3f82f6e93b | |||
18a4191adf | |||
fa7fb662c1 | |||
da2fb9de49 | |||
951bdd70a2 | |||
6cbb5af66e | |||
1adbfa6822 | |||
6fffc3b017 | |||
23e2b6a130 | |||
0ac440afcc | |||
1a6f1e67c6 | |||
0d7d3b5dbb | |||
179622046d | |||
0e2b19b11b | |||
613ad211c6 | |||
5fc18ffc04 | |||
873ae74e0b | |||
ac4c6dfd86 | |||
c782e57a0f | |||
0019a9fb8d | |||
b9b3479a20 | |||
a156e2871e | |||
bdd2233180 | |||
85955903e9 | |||
ee423b186a | |||
6e11307d16 | |||
ba97f7d755 | |||
29d8e723b8 | |||
30ff46717f | |||
565053406b | |||
777e58f80e | |||
03447f5827 | |||
a0dbe28c9f | |||
10d68e943a | |||
0417d48a9d | |||
e8660cd99d | |||
21b861e9df | |||
39a3d54619 | |||
917bcc2cd8 | |||
3469d50a8b | |||
d43458790d | |||
d2e4722f5b | |||
2e512fb8ee | |||
7f1b752631 | |||
ab8e19710f | |||
f15a63efd7 | |||
01086e0307 | |||
9f7f1f3bf2 | |||
dce5170cdb | |||
8795e7a12d | |||
509bd0ec9e | |||
81cdaa3ace | |||
e9ca15c173 | |||
24de52e110 | |||
b58fa75121 | |||
d390c6f48a | |||
b81f35157b | |||
2ea1eff316 | |||
1fa25ff842 | |||
4a4d20f085 | |||
25ff0fb054 | |||
3c3c501967 | |||
67b0e9bd09 | |||
c2d5712563 | |||
e3e5b3452d | |||
d431971fed | |||
2c84e2e40b | |||
86bcea64b9 | |||
371ae9577c | |||
34a7bc558e | |||
35e9a119da | |||
1316c4bdfb | |||
c9e769a5f4 | |||
8e210e56ac | |||
5e24acf877 | |||
9722f4d044 | |||
5325cac7e6 | |||
3e826dd883 | |||
50288969c2 | |||
97888426ab | |||
758567a7b7 | |||
4bfb21de98 | |||
8957785f4d | |||
a2056b0aa7 | |||
2233244c86 | |||
313f7be30b | |||
ed0cc11750 | |||
bec7b260c6 | |||
e5c1a03e52 | |||
e78cd20095 | |||
14135f9def | |||
ab6203d819 | |||
53fd6cb516 | |||
d4ac5470ce | |||
638577b0bf | |||
d0eccc2de2 | |||
9c507c76f1 | |||
cd05dfede7 | |||
300750b8c6 | |||
6df549d6b0 | |||
efbc3bbbf5 | |||
4aaad560b3 | |||
d0a5c72c75 | |||
f0cb44a69c | |||
2f9af2ce02 | |||
dcece3822e | |||
294c17e08b | |||
2a3b3ab6f9 | |||
d600d97c04 | |||
56f8419f5f | |||
73509ce16b | |||
c20cc2d9b2 | |||
0efdd4ac01 | |||
9fb47d0ee4 | |||
4acc83d7b0 | |||
86b9fb7db0 | |||
ad0cfa57e7 | |||
f0ba6eb94c | |||
99467a17e9 | |||
98578d456f | |||
e841a69498 | |||
5f96f87715 | |||
a6edff26c6 | |||
b131527d13 | |||
e296941d36 | |||
35961c945a | |||
94bc5d953f | |||
9c874ee95d | |||
cf3047a87f | |||
ab5b9a0c29 | |||
0903bcca1b | |||
ea05ae73a5 | |||
8f0584c5be | |||
02fb7add3c | |||
dd77b0b822 | |||
6c52686649 | |||
a2d2f30816 | |||
ddc482f11f | |||
fd6e699728 | |||
e438c6973a | |||
93578b5b15 | |||
5a1f4f389c | |||
0ae2bf5b4a | |||
bed5aa5429 | |||
ee788924eb | |||
215e1391ce | |||
6a9e8278a1 | |||
a2666d6f2c | |||
7db459d85f | |||
a602befe1b | |||
df6c6f93fa | |||
3358f3ec46 | |||
8aa9a42f2b | |||
c14eae95cd | |||
d8798c4bd5 | |||
40b3f88dfb | |||
715516eea5 | |||
2c4812092d | |||
9db556c20e | |||
b072ccac62 | |||
240d300d64 | |||
ecde808af9 | |||
6bb959e7ee | |||
1191a9e1c5 | |||
9e0064ba20 | |||
20932eceaf | |||
2130416e2e | |||
436b31be6e | |||
d1b3845aaa | |||
6fa12ecdf8 | |||
436bf0b1ee | |||
99b1e56500 | |||
7f0be0c06c | |||
2c9aaf738d | |||
249e7e9282 | |||
8d15c0417f | |||
c3fc7cffda | |||
a23ae5b4bf | |||
25f78b3715 | |||
3a1cc2be50 | |||
5c39705bac | |||
e497c29efe | |||
a2df884e64 | |||
d5df6dd78b | |||
5a545d6885 | |||
52c9d724bc | |||
09f4644629 | |||
9117932c6d | |||
e761c1de8f | |||
1390711c27 | |||
6089f84653 | |||
580b6fbd3c | |||
04e543949e | |||
5a6b9fc1b2 | |||
de7b7bc880 | |||
e0991facf5 | |||
c2cf3d7a0b | |||
51a102a467 | |||
603ad059a3 | |||
074035aac5 | |||
4c2b86f5fe | |||
02e19c4f9a | |||
28c124d210 | |||
5c180bf3b6 | |||
2a24cc206e | |||
c85dc30b45 | |||
0b5db82e5e | |||
aacfe19a4e | |||
22f1d28533 | |||
9e34963397 | |||
2c7958735d | |||
2ee7f0e133 | |||
a775317091 | |||
96e370f9bb | |||
e6103c521a | |||
82cba6e3ff | |||
8a6f25738c | |||
8a18ae60e0 | |||
5f6ddad456 | |||
f8bbf3f32d | |||
172784733c | |||
2475e6cd5d | |||
821f4a181f | |||
8a0a093cd1 | |||
8cac15e95b | |||
5deaedfab1 | |||
64ace5b6d8 | |||
edf14a1de1 | |||
f6974ab183 | |||
ed7dd46687 | |||
432aa793c4 | |||
f66ff91e4f | |||
108123d50c | |||
c3af6db044 | |||
095a0dd85f | |||
d6162c4a78 | |||
418ddda7ef | |||
1c5bcc4a5d | |||
1506144d3a | |||
44f58ecb51 | |||
4e0d5c923d | |||
42cf452da3 | |||
33c3d327c5 | |||
083db8a169 | |||
d9e4ec6c0a | |||
a83b39f96c | |||
9b6b8ac41b | |||
cd627d6453 | |||
ffe0de9607 | |||
32334c7a25 | |||
a56a4b8980 | |||
90149f6ffd | |||
c60e627bba | |||
9d60b907d5 | |||
901158540e | |||
1c95a38ed1 | |||
f910f13de9 | |||
9417e857a8 | |||
f3a5160e2c | |||
0291269573 | |||
6e1d598703 | |||
eb45491d00 | |||
fdb0dd23ca | |||
6b1a173030 | |||
429eb0952c | |||
350d4c03da | |||
2543313f80 | |||
d617f8d5b0 | |||
2845990aff | |||
14b64bfede | |||
73ef188a8c | |||
1b36724897 | |||
ad31f4f029 | |||
dc9f9bf957 | |||
91aab8e6fd | |||
8cabe4380b | |||
4cfea9e864 | |||
3e3e1c77ba | |||
b52b99a756 | |||
d054c4bcb6 | |||
e7b6fb75d4 | |||
d83e4bcfbe | |||
92c239d9b0 | |||
e722672fcc | |||
2d397782d8 | |||
4a919356ba | |||
6c01ce3ae2 | |||
397b1e51a5 | |||
6c7c212f98 | |||
c56b21bbd5 | |||
52a5fbf3f9 | |||
8f9467dc2b | |||
3105644642 | |||
872319ac5e | |||
34e5669b7b | |||
11d946582c | |||
0a1dc07248 | |||
ae4013c1a6 | |||
1ae89b72cb | |||
7e1bdbd683 | |||
18470061ab | |||
31439dfd77 | |||
561146f52b | |||
32c12e57da | |||
d6eedc04bf | |||
69ab9d7a17 | |||
33e6eaaabf | |||
04429c9042 | |||
6eae7bc996 | |||
dd5a5f1cf2 | |||
79c48b4707 | |||
ce7393f67b | |||
fd6720c2e4 | |||
fe2b23b93a | |||
8d8d8cbf18 | |||
8562e3be12 | |||
4189c54abb | |||
b0fcdccd5b | |||
4b3e014076 | |||
8c225c0200 | |||
4b08ddb0f3 | |||
f7baa7feb2 | |||
a21f65cb5b | |||
430d65225e | |||
064fa71277 | |||
9fbec0a819 | |||
cabf41c1c6 | |||
357e0f9bf1 | |||
1b8bae3e15 | |||
5d480b9e89 | |||
9e95b9b29c | |||
14d93dea75 | |||
7e5ab45fbb | |||
1056a02ba9 | |||
8bcedab874 | |||
786b68743b | |||
dbe5a59412 | |||
fbd6c9737e | |||
8a668d6c03 | |||
81b43829a2 | |||
f3ebebb1dd | |||
ceb6ec92b3 | |||
8887599119 | |||
04cf7d1230 | |||
32c6ee8532 | |||
2ac0fc1f6a | |||
79b7e2cd97 | |||
f7faae7c2d | |||
5869850af2 | |||
7d47aecaa8 | |||
e2c042da21 | |||
ce145a2c92 | |||
a3a9624ca2 | |||
e6230e49cb | |||
9ddf01407f | |||
f1989b0dc1 | |||
edc2bd8aab | |||
a70355be55 | |||
02b60f59db | |||
aaf371027d | |||
171e0a21a1 | |||
f6348050e4 | |||
2ab144dc3a | |||
1854036f92 | |||
26cb10acbf | |||
a27aa02fa3 | |||
a641428941 | |||
d917f0fa1b | |||
8093516420 | |||
3785506ec1 | |||
ea142bb6d1 | |||
e282468502 | |||
3db95e4f0e | |||
ca36dff148 | |||
fea0f0cf26 | |||
c8264eb519 | |||
7ac551b870 | |||
c48f84e0ac | |||
4641392375 | |||
7f0248f39a | |||
3ccffd46f1 | |||
c4bda59c31 | |||
c3a47bf365 | |||
687a40df4e | |||
3b0e048f0e | |||
bbf0d76ac3 | |||
cb8670e2bc | |||
d83e7ea505 | |||
f750f4c6f7 | |||
10f8cc42fb | |||
321f51d416 | |||
e819b8c0b9 | |||
679df9ec6f | |||
a326f15120 | |||
cfc5da167d | |||
e63d6582cc | |||
3f5037866b | |||
cf123b3626 | |||
7f0673f634 | |||
54f30cc94b | |||
fd7c809282 | |||
ddbf9936d6 | |||
bbc44b486e | |||
b4dc51b873 | |||
46677555ed | |||
6e2950dde2 | |||
c349247236 | |||
367b0c16f1 | |||
de0990e58c | |||
f1df3eb99b | |||
7c62ad5434 | |||
8ae12473b5 | |||
f215c2fd41 | |||
07d53ad11a | |||
8377fe746a | |||
e38e1a0389 | |||
0ef2599e3c | |||
98e99e712f | |||
943dd72da0 | |||
39d0f4b650 | |||
5c618745fe | |||
dbf8726b47 | |||
32a2ddceaa | |||
8445486303 | |||
e207b08e28 | |||
4f11dd7e21 | |||
1c6a8b4521 | |||
ffbb1aba5e | |||
3ffea37812 | |||
0868604664 | |||
0b8952dc2e | |||
1de232fb98 | |||
15512f4170 | |||
fd0ea43496 | |||
5887426bad | |||
3860cc8dac | |||
3efe49f26a | |||
01e02aec6c | |||
d6a3ed0637 | |||
784abd1ae0 | |||
b8122ec6b3 | |||
b6bc597903 | |||
33ac88cd31 | |||
dafc3b3cd5 | |||
bee6044a24 | |||
84660a822a | |||
bde502ed27 | |||
5634a3260e | |||
cd4c71e20f | |||
ab81888705 | |||
67f0bfa8bc | |||
421c94ded5 | |||
a31806d076 | |||
da43ec0425 | |||
832337bdee | |||
9230a25140 | |||
f20f0ae8d1 | |||
726ed08ee2 | |||
5feffad9a1 | |||
eac00e82d1 | |||
dbccfbb2e7 | |||
be9c4ebf44 | |||
de1d006ba3 | |||
f58b63d31e | |||
9713bd63a4 | |||
05f44bddf0 | |||
65d9300b5c | |||
0a3d59a4fa | |||
45c7eb4d4b | |||
a71f265d25 | |||
b2dcc24335 | |||
88c0ea49e3 | |||
cc869c6ab5 | |||
c23dbefd45 | |||
87fd8b41d8 | |||
fccc309499 | |||
9aea2d3395 | |||
6192507987 | |||
7f61f74aa0 | |||
7474a450c2 | |||
41515a9086 | |||
4787e928a2 | |||
c9f8fc0405 | |||
12d480423b | |||
e148263565 | |||
5d844e57ed | |||
b2ff20d94c | |||
e8852d5c38 | |||
2f0c9b3584 | |||
09cbbaaf7c | |||
dab7fdd6f0 | |||
d6b3b8feeb | |||
f6420436eb | |||
23cfe0826b | |||
30ea848335 | |||
6a86351373 | |||
e5429b256a | |||
4daaa9c587 | |||
091da3d631 | |||
c8474d48f8 | |||
6e7a9de65e | |||
6cd960928a | |||
b07a1470c5 | |||
737b5edd5b | |||
d9f9f79270 | |||
a6c2c4149d | |||
fe32b34b20 | |||
ae876915ec | |||
1542b768fd | |||
e10c977834 | |||
9ab7f325cc | |||
bbe96641b1 | |||
e22c101034 | |||
63f019565b | |||
3a5ba85419 | |||
a168f4cc9b | |||
df4195062d | |||
8800e9d0e5 | |||
2f1b81cd14 | |||
87d4172ee5 | |||
7f9b5deae1 | |||
3d959421b1 | |||
52a922f953 | |||
baf6028974 | |||
60c2068fef | |||
10f89fe52e | |||
b1b182f258 | |||
1129f0834e | |||
58ebdb7ae3 | |||
48e06fafea | |||
6bb35c551c | |||
0be44b6ccc | |||
bf604e91a6 | |||
dcc7cf9379 | |||
5a7a9c0638 | |||
91cedfe89d | |||
0d94b1cd89 | |||
1b1005a1d8 | |||
096db7521b | |||
cc48efc6ec | |||
88b300d064 | |||
f9b58b0c73 | |||
3a7aafe7d6 | |||
e23d24a65d | |||
687064b2f8 | |||
168ff6e268 | |||
8e66d38959 | |||
5890c7450d | |||
2c96e097c9 | |||
f3b7e0502a | |||
2f10ca582b | |||
0928ff027b | |||
6eba7a536a | |||
75faae29a8 | |||
0f96e51146 | |||
52b36a60f4 | |||
617f5a7052 | |||
0c3a0d6c9a | |||
9f04d1ac36 | |||
b8d9da5c03 | |||
52b9c5d666 | |||
3f632df143 | |||
5ec2be4ba3 | |||
1d3d63c438 | |||
e7ba614a04 | |||
dbf757118a | |||
0c2c962b19 | |||
1f0d27a2c6 | |||
1aaae85ad2 | |||
85048f35e3 | |||
1a7c782905 | |||
cf4cf23741 | |||
236556d1ea | |||
07669b8012 | |||
e13bb3d734 | |||
bb4ba96545 | |||
1bf9c822f9 | |||
bb466097e5 | |||
8b369072f9 | |||
d91dfe3510 | |||
2396dc5ff7 | |||
ce7ceb8d9d | |||
5ec85c0bfd | |||
7c49b1da55 | |||
8805685f72 | |||
a3d77114b6 | |||
021dc8747c | |||
c7f146b671 | |||
86a49de1eb | |||
89218b35e4 | |||
51b6d16b43 | |||
9e74564ba5 | |||
9ebc8f02a9 | |||
7b10c2421f | |||
0c5bce6918 | |||
bef1fba3bc | |||
64c062047f | |||
157c5b52e3 | |||
c97ab134ef | |||
5899701b68 | |||
4ec0065d74 | |||
fe92d9ee60 | |||
4c6cf06838 | |||
464f4c9cc6 | |||
eb8dad2fa6 | |||
856a299ba8 | |||
be9c7145f9 | |||
d638267741 | |||
f3a73cbce3 | |||
41ff5a2f43 | |||
95cfd3987b | |||
520beb865c | |||
e53ca8e018 | |||
68be49d2cf | |||
686878497e | |||
c046d87561 | |||
fdb4197d02 | |||
e11f030427 | |||
beebbada64 | |||
6da7a46bfa | |||
d2551d6e4b | |||
4cf29dfcef | |||
3dbba47d8c | |||
02c2356cb1 | |||
8639f69ed7 | |||
19ab395364 | |||
a7266400be | |||
1847e53909 | |||
285ba1fcf2 | |||
5c9392d177 | |||
6a92c1485a | |||
c91bdda9f3 | |||
f63e544dc3 | |||
0680af1269 | |||
2decfbc007 | |||
3640c1ecba | |||
cbb43bb4c4 | |||
0dc29caf4a | |||
5f07f64802 | |||
e4f1c01197 | |||
2ed780b686 | |||
a9383cb433 | |||
5e817df25f | |||
bd8d7ea76a | |||
352ee6fc26 | |||
7403b8d68d | |||
f27e117b5b | |||
a621402e1f | |||
a08558a853 | |||
2cad39aee5 | |||
173bb82f45 | |||
8472467721 | |||
2f6fb59b6b | |||
f324e75c64 | |||
1a1a708699 | |||
24e5e3aef1 | |||
d8bc05c5d0 | |||
bfa95cdd75 | |||
199dc389cc | |||
b400a8cd72 | |||
4dc565b7d0 | |||
cbcd346171 | |||
f1d1dfd1ef | |||
dd20d1f2b5 | |||
4e850f158e | |||
ea010f84ef | |||
68a9c09c49 | |||
53c4c08283 | |||
89a612aea0 | |||
a9dcc3964d | |||
8503709d85 | |||
4eacfd6ee1 | |||
9eb61ef5a7 | |||
7165a3bdbb | |||
1b331d24b3 | |||
fe4b401ab2 | |||
ebc9d02146 | |||
ec50cd7d7e | |||
0cf4889f22 | |||
b9f15ba3ab | |||
d22f9a97aa | |||
90188040fb | |||
ea1a10da17 | |||
7c54373146 | |||
209fbfc18b | |||
8545eeb4ef | |||
a22d0df155 | |||
c706096f45 | |||
b8ed93eec0 | |||
840ec6579f | |||
7aed3eb3bc | |||
fe628d5951 | |||
855d1eb170 | |||
8ed42582fe | |||
5428555092 | |||
8f091de9c2 | |||
ae0eabec53 | |||
6b0a815b78 | |||
a04f786380 | |||
a6d8251366 | |||
9fd92e8bf4 | |||
d42e894a74 | |||
bf415f580f | |||
55a8a18fb7 | |||
a61a367bc4 | |||
c19e762c89 | |||
6fea6aae8c | |||
027193ca07 | |||
8bd2287233 | |||
aa1c3af4c4 | |||
577a50b02a | |||
b11014a7c6 | |||
901f937698 | |||
39771b6c81 | |||
b026a7c915 | |||
f82fea4c1b | |||
60ab9631d7 | |||
91c4a94f61 | |||
df211933ff | |||
e486f3b944 | |||
ccca8b74eb | |||
7d7d9d7090 | |||
0ee7d4d17a | |||
a246aa2973 | |||
2508d3f23b | |||
b494330381 | |||
ddc357fcca | |||
6a5ab20489 | |||
30fce03e35 | |||
212f316f24 | |||
0fcc940bc1 | |||
b43fc4d63a | |||
7fb317655d | |||
49aaac0013 | |||
d910ca7fa8 | |||
935da554c9 | |||
5b3996885c | |||
7c57624b66 | |||
e56f92aab4 | |||
3386c594b4 | |||
0440d582dc | |||
4fb58d56b4 | |||
665883229e | |||
a85d1e1eca | |||
14315bb751 | |||
fa866b49ca | |||
ebe1141b25 | |||
cb5bc35f2e | |||
55658d4c36 | |||
f1b9b357e4 | |||
3af63dcf4a |
@ -1,4 +1,4 @@
|
||||
[codespell]
|
||||
skip = build,*.yuv,components/fatfs/src/*,alice.txt,*.rgb,components/wpa_supplicant/*,components/esp_wifi/*
|
||||
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart
|
||||
ignore-words-list = ser,dout,rsource,fram,inout,shs,ans,aci,unstall,unstalling,hart,wheight,ot
|
||||
write-changes = true
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -96,6 +96,8 @@ dependencies.lock
|
||||
managed_components
|
||||
|
||||
# pytest log
|
||||
pytest-embedded/
|
||||
# legacy one
|
||||
pytest_embedded_log/
|
||||
list_job*.txt
|
||||
size_info*.txt
|
||||
|
@ -2,239 +2,5 @@
|
||||
#
|
||||
# https://docs.gitlab.com/ee/user/project/code_owners.html#the-syntax-of-code-owners-files
|
||||
#
|
||||
# If more than one rule matches a given file, the latest rule is used.
|
||||
# The file should be generally kept sorted, except when it is necessary
|
||||
# to use a different order due to the fact above. In that case, use
|
||||
# '# sort-order-reset' comment line to reset the sort order.
|
||||
#
|
||||
# Recipes for a few common cases:
|
||||
#
|
||||
# 1. Specific directory with all its contents:
|
||||
#
|
||||
# /components/app_trace/
|
||||
#
|
||||
# Note the trailing slash!
|
||||
#
|
||||
# 2. File with certain extension in any subdirectory of a certain directory:
|
||||
#
|
||||
# /examples/**/*.py
|
||||
#
|
||||
# This includes an *.py files in /examples/ directory as well.
|
||||
#
|
||||
# 3. Contents of a directory with a certain name, anywhere in the tree:
|
||||
#
|
||||
# test_*_host/
|
||||
#
|
||||
# Will match everything under components/efuse/test_efuse_host/,
|
||||
# components/heap/test_multi_heap_host/, components/lwip/test_afl_host/, etc.
|
||||
#
|
||||
# 4. Same as above, except limited to a specific place in the tree:
|
||||
#
|
||||
# /components/esp32*/
|
||||
#
|
||||
# Matches everything under /components/esp32, /components/esp32s2, etc.
|
||||
# Doesn't match /tools/some-test/components/esp32s5.
|
||||
#
|
||||
# 5. Specific file:
|
||||
#
|
||||
# /tools/tools.json
|
||||
#
|
||||
# 6. File with a certain name anywhere in the tree
|
||||
#
|
||||
# .gitignore
|
||||
#
|
||||
|
||||
* @esp-idf-codeowners/other
|
||||
|
||||
/.* @esp-idf-codeowners/tools
|
||||
/.codespellrc @esp-idf-codeowners/ci
|
||||
/.github/workflows/ @esp-idf-codeowners/ci
|
||||
/.gitlab-ci.yml @esp-idf-codeowners/ci
|
||||
/.gitlab/ci/ @esp-idf-codeowners/ci
|
||||
/.pre-commit-config.yaml @esp-idf-codeowners/ci
|
||||
/.readthedocs.yml @esp-idf-codeowners/docs
|
||||
/.vale.ini @esp-idf-codeowners/docs
|
||||
/CMakeLists.txt @esp-idf-codeowners/build-config
|
||||
/COMPATIBILITY*.md @esp-idf-codeowners/peripherals
|
||||
/CONTRIBUTING.md @esp-idf-codeowners/docs
|
||||
/Kconfig @esp-idf-codeowners/build-config
|
||||
/README*.md @esp-idf-codeowners/docs
|
||||
/SUPPORT_POLICY*.md @esp-idf-codeowners/docs
|
||||
/add_path.sh @esp-idf-codeowners/tools
|
||||
/conftest.py @esp-idf-codeowners/ci
|
||||
/export.* @esp-idf-codeowners/tools
|
||||
/install.* @esp-idf-codeowners/tools
|
||||
/pytest.ini @esp-idf-codeowners/ci
|
||||
/sdkconfig.rename @esp-idf-codeowners/build-config
|
||||
/sonar-project.properties @esp-idf-codeowners/ci
|
||||
|
||||
# sort-order-reset
|
||||
|
||||
/components/app_trace/ @esp-idf-codeowners/debugging
|
||||
/components/app_update/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
|
||||
/components/bootloader*/ @esp-idf-codeowners/system @esp-idf-codeowners/security
|
||||
/components/bootloader_support/bootloader_flash/ @esp-idf-codeowners/peripherals
|
||||
/components/bt/ @esp-idf-codeowners/bluetooth
|
||||
/components/cmock/ @esp-idf-codeowners/system
|
||||
/components/console/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities/console
|
||||
/components/cxx/ @esp-idf-codeowners/system
|
||||
/components/driver/ @esp-idf-codeowners/peripherals
|
||||
/components/efuse/ @esp-idf-codeowners/system
|
||||
/components/esp_adc/ @esp-idf-codeowners/peripherals
|
||||
/components/esp_app_format/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
|
||||
/components/esp_bootloader_format/ @esp-idf-codeowners/system @esp-idf-codeowners/app-utilities
|
||||
/components/esp_coex/ @esp-idf-codeowners/wifi @esp-idf-codeowners/bluetooth @esp-idf-codeowners/ieee802154
|
||||
/components/esp_common/ @esp-idf-codeowners/system
|
||||
/components/esp_driver_*/ @esp-idf-codeowners/peripherals
|
||||
/components/esp_driver_sdmmc/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/storage
|
||||
/components/esp_eth/ @esp-idf-codeowners/network
|
||||
/components/esp_event/ @esp-idf-codeowners/system
|
||||
/components/esp_gdbstub/ @esp-idf-codeowners/debugging
|
||||
/components/esp_hid/ @esp-idf-codeowners/bluetooth
|
||||
/components/esp_http_client/ @esp-idf-codeowners/app-utilities
|
||||
/components/esp_http_server/ @esp-idf-codeowners/app-utilities
|
||||
/components/esp_https_ota/ @esp-idf-codeowners/app-utilities
|
||||
/components/esp_https_server/ @esp-idf-codeowners/app-utilities
|
||||
/components/esp_hw_support/ @esp-idf-codeowners/system @esp-idf-codeowners/peripherals
|
||||
/components/esp_hw_support/lowpower/ @esp-idf-codeowners/power-management
|
||||
/components/esp_lcd/ @esp-idf-codeowners/peripherals
|
||||
/components/esp_local_ctrl/ @esp-idf-codeowners/app-utilities
|
||||
/components/esp_mm/ @esp-idf-codeowners/peripherals
|
||||
/components/esp_netif/ @esp-idf-codeowners/network
|
||||
/components/esp_netif_stack/ @esp-idf-codeowners/network
|
||||
/components/esp_partition/ @esp-idf-codeowners/storage
|
||||
/components/esp_phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
|
||||
/components/esp_pm/ @esp-idf-codeowners/power-management @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/system
|
||||
/components/esp_psram/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system
|
||||
/components/esp_ringbuf/ @esp-idf-codeowners/system
|
||||
/components/esp_rom/ @esp-idf-codeowners/system @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi
|
||||
/components/esp_system/ @esp-idf-codeowners/system
|
||||
/components/esp_timer/ @esp-idf-codeowners/system
|
||||
/components/esp-tls/ @esp-idf-codeowners/app-utilities
|
||||
/components/esp_vfs_*/ @esp-idf-codeowners/storage
|
||||
/components/esp_vfs_console/ @esp-idf-codeowners/storage @esp-idf-codeowners/system
|
||||
/components/esp_wifi/ @esp-idf-codeowners/wifi
|
||||
/components/espcoredump/ @esp-idf-codeowners/debugging
|
||||
/components/esptool_py/ @esp-idf-codeowners/tools
|
||||
/components/fatfs/ @esp-idf-codeowners/storage
|
||||
/components/freertos/ @esp-idf-codeowners/system
|
||||
/components/hal/ @esp-idf-codeowners/peripherals
|
||||
/components/heap/ @esp-idf-codeowners/system
|
||||
/components/http_parser/ @esp-idf-codeowners/app-utilities
|
||||
/components/idf_test/ @esp-idf-codeowners/ci
|
||||
/components/ieee802154/ @esp-idf-codeowners/ieee802154
|
||||
/components/json/ @esp-idf-codeowners/app-utilities
|
||||
/components/linux/ @esp-idf-codeowners/system
|
||||
/components/log/ @esp-idf-codeowners/system
|
||||
/components/lwip/ @esp-idf-codeowners/lwip
|
||||
/components/mbedtls/ @esp-idf-codeowners/app-utilities/mbedtls @esp-idf-codeowners/security
|
||||
/components/mqtt/ @esp-idf-codeowners/network
|
||||
/components/newlib/ @esp-idf-codeowners/system @esp-idf-codeowners/toolchain
|
||||
/components/nvs_flash/ @esp-idf-codeowners/storage
|
||||
/components/nvs_sec_provider/ @esp-idf-codeowners/storage @esp-idf-codeowners/security
|
||||
/components/openthread/ @esp-idf-codeowners/ieee802154
|
||||
/components/partition_table/ @esp-idf-codeowners/system
|
||||
/components/perfmon/ @esp-idf-codeowners/debugging
|
||||
/components/protobuf-c/ @esp-idf-codeowners/app-utilities
|
||||
/components/protocomm/ @esp-idf-codeowners/app-utilities/provisioning
|
||||
/components/pthread/ @esp-idf-codeowners/system
|
||||
/components/riscv/ @esp-idf-codeowners/system
|
||||
/components/sdmmc/ @esp-idf-codeowners/storage
|
||||
/components/soc/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/system
|
||||
/components/spi_flash/ @esp-idf-codeowners/peripherals
|
||||
/components/spiffs/ @esp-idf-codeowners/storage
|
||||
/components/tcp_transport/ @esp-idf-codeowners/network
|
||||
/components/touch_element/ @esp-idf-codeowners/peripherals
|
||||
/components/ulp/ @esp-idf-codeowners/system
|
||||
/components/unity/ @esp-idf-codeowners/ci
|
||||
/components/usb/ @esp-idf-codeowners/peripherals/usb
|
||||
/components/vfs/ @esp-idf-codeowners/storage
|
||||
/components/wear_levelling/ @esp-idf-codeowners/storage
|
||||
/components/wifi_provisioning/ @esp-idf-codeowners/app-utilities/provisioning
|
||||
/components/wpa_supplicant/ @esp-idf-codeowners/wifi @esp-idf-codeowners/app-utilities/mbedtls
|
||||
/components/xtensa/ @esp-idf-codeowners/system
|
||||
|
||||
/docs/ @esp-idf-codeowners/docs
|
||||
/docs/**/api-guides/tools/ @esp-idf-codeowners/tools
|
||||
/docs/en/api-guides/core_dump.rst @esp-idf-codeowners/debugging
|
||||
/docs/en/api-guides/jtag-debugging/ @esp-idf-codeowners/debugging
|
||||
/docs/**/api-reference/bluetooth/ @esp-idf-codeowners/bluetooth
|
||||
/docs/**/api-reference/network/ @esp-idf-codeowners/network @esp-idf-codeowners/wifi
|
||||
/docs/**/api-reference/peripherals/ @esp-idf-codeowners/peripherals
|
||||
/docs/**/api-reference/peripherals/usb* @esp-idf-codeowners/peripherals @esp-idf-codeowners/peripherals/usb
|
||||
/docs/**/api-reference/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
|
||||
/docs/**/api-reference/provisioning/ @esp-idf-codeowners/app-utilities/provisioning
|
||||
/docs/**/api-reference/storage/ @esp-idf-codeowners/storage
|
||||
/docs/**/api-reference/system/ @esp-idf-codeowners/system
|
||||
/docs/**/security/ @esp-idf-codeowners/security
|
||||
/docs/**/migration-guides/ @esp-idf-codeowners/docs @esp-idf-codeowners/all-maintainers
|
||||
|
||||
/examples/README.md @esp-idf-codeowners/docs @esp-idf-codeowners/ci
|
||||
/examples/**/*.py @esp-idf-codeowners/ci @esp-idf-codeowners/tools
|
||||
/examples/bluetooth/ @esp-idf-codeowners/bluetooth
|
||||
/examples/build_system/ @esp-idf-codeowners/build-config
|
||||
/examples/common_components/ @esp-idf-codeowners/system @esp-idf-codeowners/wifi @esp-idf-codeowners/lwip @esp-idf-codeowners/network
|
||||
/examples/custom_bootloader/ @esp-idf-codeowners/system
|
||||
/examples/cxx/ @esp-idf-codeowners/system
|
||||
/examples/ethernet/ @esp-idf-codeowners/network
|
||||
/examples/get-started/ @esp-idf-codeowners/system
|
||||
/examples/ieee802154/ @esp-idf-codeowners/ieee802154
|
||||
/examples/mesh/ @esp-idf-codeowners/wifi
|
||||
/examples/network/ @esp-idf-codeowners/network @esp-idf-codeowners/wifi
|
||||
/examples/openthread/ @esp-idf-codeowners/ieee802154
|
||||
/examples/peripherals/ @esp-idf-codeowners/peripherals
|
||||
/examples/peripherals/usb/ @esp-idf-codeowners/peripherals @esp-idf-codeowners/peripherals/usb
|
||||
/examples/phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
|
||||
/examples/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
|
||||
/examples/provisioning/ @esp-idf-codeowners/app-utilities/provisioning
|
||||
/examples/security/ @esp-idf-codeowners/security
|
||||
/examples/storage/ @esp-idf-codeowners/storage
|
||||
/examples/system/ @esp-idf-codeowners/system
|
||||
/examples/system/ota/ @esp-idf-codeowners/app-utilities
|
||||
/examples/wifi/ @esp-idf-codeowners/wifi
|
||||
/examples/zigbee/ @esp-idf-codeowners/ieee802154
|
||||
|
||||
/tools/ @esp-idf-codeowners/tools
|
||||
/tools/ble/ @esp-idf-codeowners/app-utilities
|
||||
/tools/catch/ @esp-idf-codeowners/ci
|
||||
/tools/ci/ @esp-idf-codeowners/ci
|
||||
/tools/cmake/ @esp-idf-codeowners/build-config
|
||||
/tools/cmake/toolchain-*.cmake @esp-idf-codeowners/toolchain
|
||||
/tools/esp_app_trace/ @esp-idf-codeowners/debugging
|
||||
/tools/esp_prov/ @esp-idf-codeowners/app-utilities
|
||||
/tools/gdb_panic_server.py @esp-idf-codeowners/debugging
|
||||
/tools/kconfig*/ @esp-idf-codeowners/build-config
|
||||
/tools/ldgen/ @esp-idf-codeowners/build-config
|
||||
/tools/mass_mfg/ @esp-idf-codeowners/app-utilities
|
||||
/tools/mocks/ @esp-idf-codeowners/system
|
||||
|
||||
/tools/test_apps/ @esp-idf-codeowners/ci
|
||||
/tools/test_apps/README.md @esp-idf-codeowners/docs @esp-idf-codeowners/ci
|
||||
|
||||
## Note: owners here should be the same as the owners for the same example subdir, above
|
||||
/tools/test_apps/build_system/ @esp-idf-codeowners/build-config
|
||||
/tools/test_apps/configs/ @esp-idf-codeowners/system
|
||||
/tools/test_apps/linux_compatible/ @esp-idf-codeowners/system
|
||||
/tools/test_apps/peripherals/ @esp-idf-codeowners/peripherals
|
||||
/tools/test_apps/phy/ @esp-idf-codeowners/bluetooth @esp-idf-codeowners/wifi @esp-idf-codeowners/ieee802154
|
||||
/tools/test_apps/protocols/ @esp-idf-codeowners/network @esp-idf-codeowners/app-utilities
|
||||
/tools/test_apps/security/ @esp-idf-codeowners/security
|
||||
/tools/test_apps/storage/ @esp-idf-codeowners/storage
|
||||
/tools/test_apps/system/ @esp-idf-codeowners/system
|
||||
|
||||
/tools/test_apps/**/*.py @esp-idf-codeowners/ci @esp-idf-codeowners/tools
|
||||
|
||||
/tools/test_build_system/ @esp-idf-codeowners/tools @esp-idf-codeowners/build-config
|
||||
|
||||
/tools/tools.json @esp-idf-codeowners/tools @esp-idf-codeowners/toolchain @esp-idf-codeowners/debugging
|
||||
|
||||
/tools/unit-test-app/ @esp-idf-codeowners/system @esp-idf-codeowners/tools
|
||||
|
||||
# sort-order-reset
|
||||
|
||||
/components/**/test_apps/**/*.py @esp-idf-codeowners/ci @esp-idf-codeowners/tools
|
||||
|
||||
# ignore lists
|
||||
/tools/ci/check_copyright_config.yaml @esp-idf-codeowners/all-maintainers
|
||||
/tools/ci/check_copyright_ignore.txt @esp-idf-codeowners/all-maintainers
|
||||
/tools/ci/mypy_ignore_list.txt @esp-idf-codeowners/tools
|
||||
* @esp-idf-codeowners/all-maintainers
|
||||
|
@ -39,7 +39,7 @@ variables:
|
||||
GIT_FETCH_EXTRA_FLAGS: "--no-recurse-submodules --prune --prune-tags"
|
||||
# we're using .cache folder for caches
|
||||
GIT_CLEAN_FLAGS: -ffdx -e .cache/
|
||||
LATEST_GIT_TAG: v5.3-dev
|
||||
LATEST_GIT_TAG: v5.3.1
|
||||
|
||||
SUBMODULE_FETCH_TOOL: "tools/ci/ci_fetch_submodule.py"
|
||||
# by default we will fetch all submodules
|
||||
@ -84,7 +84,7 @@ variables:
|
||||
CI_PYTHON_TOOL_BRANCH: ""
|
||||
|
||||
# Set this variable to specify the file name for the known failure cases.
|
||||
KNOWN_FAILURE_CASES_FILE_NAME: "master.txt"
|
||||
KNOWN_FAILURE_CASES_FILE_NAME: "5.3.txt"
|
||||
|
||||
IDF_CI_BUILD: 1
|
||||
|
||||
|
@ -133,7 +133,7 @@ test_cli_installer:
|
||||
script:
|
||||
# Tools must be downloaded for testing
|
||||
# We could use "idf_tools.py download all", but we don't want to install clang because of its huge size
|
||||
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa
|
||||
- python3 ${IDF_PATH}/tools/idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
|
||||
- cd ${IDF_PATH}/tools/test_idf_tools
|
||||
- python3 -m pip install jsonschema
|
||||
- python3 ./test_idf_tools.py -v
|
||||
@ -228,6 +228,8 @@ test_tools:
|
||||
- pytest --noconftest test_idf_qemu.py --junitxml=${IDF_PATH}/XUNIT_IDF_PY_QEMU.xml || stat=1
|
||||
- cd ${IDF_PATH}/tools/test_mkdfu
|
||||
- pytest --noconftest test_mkdfu.py --junitxml=${IDF_PATH}/XUNIT_MKDFU.xml || stat=1
|
||||
- cd ${IDF_PATH}/tools/test_idf_size
|
||||
- pytest --noconftest test_idf_size.py --junitxml=${IDF_PATH}/XUNIT_IDF_SIZE.xml || stat=1
|
||||
- cd ${IDF_PATH}
|
||||
- shellcheck -s sh tools/detect_python.sh || stat=1
|
||||
- shellcheck -s bash tools/detect_python.sh || stat=1
|
||||
@ -296,7 +298,7 @@ test_pytest_qemu:
|
||||
artifacts:
|
||||
paths:
|
||||
- XUNIT_RESULT.xml
|
||||
- pytest_embedded_log/
|
||||
- pytest-embedded/
|
||||
reports:
|
||||
junit: XUNIT_RESULT.xml
|
||||
allow_failure: true # IDFCI-1752
|
||||
@ -330,7 +332,7 @@ test_pytest_linux:
|
||||
artifacts:
|
||||
paths:
|
||||
- XUNIT_RESULT.xml
|
||||
- pytest_embedded_log/
|
||||
- pytest-embedded/
|
||||
- "**/build*/build_log.txt"
|
||||
reports:
|
||||
junit: XUNIT_RESULT.xml
|
||||
|
@ -86,6 +86,7 @@
|
||||
- "tools/test_idf_py/**/*"
|
||||
|
||||
- "tools/idf_size.py"
|
||||
- "tools/test_idf_size/**/*"
|
||||
|
||||
- "tools/tools.json"
|
||||
- "tools/tools_schema.json"
|
||||
|
@ -31,7 +31,7 @@ test_cli_installer_win:
|
||||
IDF_PATH: "$CI_PROJECT_DIR"
|
||||
script:
|
||||
# Tools must be downloaded for testing
|
||||
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa
|
||||
- python ${IDF_PATH}\tools\idf_tools.py download required qemu-riscv32 qemu-xtensa cmake
|
||||
- cd ${IDF_PATH}\tools\test_idf_tools
|
||||
- python -m pip install jsonschema
|
||||
- python .\test_idf_tools.py
|
||||
|
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -49,12 +49,13 @@
|
||||
[submodule "components/json/cJSON"]
|
||||
path = components/json/cJSON
|
||||
url = ../../DaveGamble/cJSON.git
|
||||
sbom-version = 1.7.17
|
||||
sbom-version = 1.7.18
|
||||
sbom-cpe = cpe:2.3:a:cjson_project:cjson:{}:*:*:*:*:*:*:*
|
||||
sbom-supplier = Person: Dave Gamble
|
||||
sbom-url = https://github.com/DaveGamble/cJSON
|
||||
sbom-description = Ultralightweight JSON parser in ANSI C
|
||||
sbom-hash = 87d8f0961a01bf09bef98ff89bae9fdec42181ee
|
||||
sbom-hash = acc76239bee01d8e9c858ae2cab296704e52d916
|
||||
sbom-cve-exclude-list = CVE-2024-31755 Resolved in v1.7.18
|
||||
|
||||
[submodule "components/mbedtls/mbedtls"]
|
||||
path = components/mbedtls/mbedtls
|
||||
|
@ -103,10 +103,10 @@ repos:
|
||||
name: Check type annotations in python files
|
||||
entry: tools/ci/check_type_comments.py
|
||||
additional_dependencies:
|
||||
- 'mypy==0.940'
|
||||
- 'mypy-extensions==0.4.3'
|
||||
- 'types-setuptools==57.4.14'
|
||||
- 'types-PyYAML==0.1.9'
|
||||
- 'mypy'
|
||||
- 'mypy-extensions'
|
||||
- 'types-setuptools'
|
||||
- 'types-PyYAML'
|
||||
- 'types-requests'
|
||||
exclude: >
|
||||
(?x)^(
|
||||
|
25
Kconfig
25
Kconfig
@ -75,10 +75,6 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
string
|
||||
default "$IDF_INIT_VERSION"
|
||||
|
||||
config IDF_TARGET_LINUX
|
||||
bool
|
||||
default "y" if IDF_TARGET="linux"
|
||||
|
||||
config IDF_TARGET_ESP32
|
||||
bool
|
||||
default "y" if IDF_TARGET="esp32"
|
||||
@ -607,6 +603,27 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
default "gcc" if COMPILER_RT_LIB_GCCLIB
|
||||
default "" if COMPILER_RT_LIB_HOST
|
||||
|
||||
choice COMPILER_ORPHAN_SECTIONS
|
||||
prompt "Orphan sections handling"
|
||||
default COMPILER_ORPHAN_SECTIONS_PLACE
|
||||
depends on !IDF_TARGET_LINUX
|
||||
help
|
||||
If the linker finds orphan sections, it attempts to place orphan sections after sections of the same
|
||||
attribute such as code vs data, loadable vs non-loadable, etc.
|
||||
That means that orphan sections could placed between sections defined in IDF linker scripts.
|
||||
This could lead to corruption of the binary image. Configure the linker action here.
|
||||
|
||||
config COMPILER_ORPHAN_SECTIONS_WARNING
|
||||
bool "Place with warning"
|
||||
help
|
||||
Places orphan sections without a warning message.
|
||||
|
||||
config COMPILER_ORPHAN_SECTIONS_PLACE
|
||||
bool "Place silently"
|
||||
help
|
||||
Places orphan sections without a warning/error message.
|
||||
endchoice
|
||||
|
||||
endmenu # Compiler Options
|
||||
|
||||
menu "Component config"
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "esp_image_format.h"
|
||||
#include "esp_secure_boot.h"
|
||||
#include "esp_flash_encrypt.h"
|
||||
#include "spi_flash_mmap.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#include "esp_ota_ops.h"
|
||||
|
@ -2,6 +2,6 @@
|
||||
|
||||
components/app_update/test_apps:
|
||||
disable:
|
||||
- if: IDF_TARGET in ["esp32c6", "esp32h2", "esp32p4", "esp32c5"]
|
||||
- if: IDF_TARGET in ["esp32c6", "esp32h2", "esp32c5"]
|
||||
temporary: true
|
||||
reason: target esp32c6, esp32h2, esp32p4, esp32c5 is not supported yet # TODO: IDF-8068, [ESP32C5] IDF-8638
|
||||
reason: target esp32c6, esp32h2 esp32c5 is not supported yet # TODO: [ESP32C5] IDF-8638
|
||||
|
@ -1,2 +1,2 @@
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
@ -19,7 +19,7 @@ def run_multiple_stages(dut: Dut, test_case_num: int, stages: int) -> None:
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32c6', 'esp32h2', 'esp32p4'], reason='c6/h2/p4 support TBD') # TODO: IDF-8959
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32c6', 'esp32h2'], reason='c6/h2 support TBD')
|
||||
@pytest.mark.generic
|
||||
def test_app_update(dut: Dut) -> None:
|
||||
extra_data = dut.parse_test_menu()
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -119,6 +119,7 @@ SECTIONS
|
||||
|
||||
.dram0.data : ALIGN(0x10)
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -144,6 +145,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -208,12 +210,55 @@ SECTIONS
|
||||
*/
|
||||
.xt.prop 0 :
|
||||
{
|
||||
KEEP (*(.xt.prop .gnu.linkonce.prop.*))
|
||||
KEEP (*(.xt.prop .xt.prop.* .gnu.linkonce.prop.*))
|
||||
}
|
||||
|
||||
.xt.lit 0 :
|
||||
{
|
||||
KEEP (*(.xt.lit .gnu.linkonce.p.*))
|
||||
KEEP (*(.xt.lit .xt.lit.* .gnu.linkonce.p.*))
|
||||
}
|
||||
|
||||
.xtensa.info 0: { *(.xtensa.info) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -140,6 +140,7 @@ SECTIONS
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -165,6 +166,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -218,6 +220,57 @@ SECTIONS
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -140,6 +140,7 @@ SECTIONS
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -165,6 +166,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -218,6 +220,58 @@ SECTIONS
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -139,6 +139,7 @@ SECTIONS
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -164,6 +165,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -217,6 +219,58 @@ SECTIONS
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,6 +138,7 @@ SECTIONS
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -163,6 +164,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -216,6 +218,58 @@ SECTIONS
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -138,6 +138,7 @@ SECTIONS
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -163,6 +164,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -216,6 +218,58 @@ SECTIONS
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,6 +138,7 @@ SECTIONS
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -163,6 +164,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -216,6 +218,58 @@ SECTIONS
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -138,7 +138,7 @@ SECTIONS
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -164,6 +164,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -217,6 +218,58 @@ SECTIONS
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -131,9 +131,15 @@ SECTIONS
|
||||
_bss_end = ABSOLUTE(.);
|
||||
} > dram_seg
|
||||
|
||||
.dram0.data :
|
||||
.dram0.bootdesc : ALIGN(0x10)
|
||||
{
|
||||
_data_start = ABSOLUTE(.);
|
||||
*(.data_bootloader_desc .data_bootloader_desc.*) /* Should be the first. Bootloader version info. DO NOT PUT ANYTHING BEFORE IT! */
|
||||
} > dram_seg
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -159,6 +165,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -212,6 +219,58 @@ SECTIONS
|
||||
_etext = .;
|
||||
} > iram_seg
|
||||
|
||||
.riscv.attributes 0: { *(.riscv.attributes) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
/**
|
||||
* Discarding .rela.* sections results in the following mapping:
|
||||
* .rela.text.* -> .text.*
|
||||
* .rela.data.* -> .data.*
|
||||
* And so forth...
|
||||
*/
|
||||
/DISCARD/ : { *(.rela.*) }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -108,6 +108,7 @@ SECTIONS
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -133,6 +134,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -205,4 +207,48 @@ SECTIONS
|
||||
KEEP (*(.xt.lit .gnu.linkonce.p.*))
|
||||
}
|
||||
|
||||
.xtensa.info 0: { *(.xtensa.info) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -142,6 +142,7 @@ SECTIONS
|
||||
|
||||
.dram0.data :
|
||||
{
|
||||
*(.dram1 .dram1.*) /* catch stray DRAM_ATTR */
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
@ -167,6 +168,7 @@ SECTIONS
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.e.*)
|
||||
*(.gnu.version_r)
|
||||
*(.eh_frame_hdr)
|
||||
*(.eh_frame)
|
||||
. = (. + 3) & ~ 3;
|
||||
/* C++ constructor and destructor tables, properly ordered: */
|
||||
@ -239,6 +241,50 @@ SECTIONS
|
||||
KEEP (*(.xt.lit .gnu.linkonce.p.*))
|
||||
}
|
||||
|
||||
.xtensa.info 0: { *(.xtensa.info) }
|
||||
|
||||
/* DWARF 1 */
|
||||
.debug 0 : { *(.debug) }
|
||||
.line 0 : { *(.line) }
|
||||
/* GNU DWARF 1 extensions */
|
||||
.debug_srcinfo 0 : { *(.debug_srcinfo) }
|
||||
.debug_sfnames 0 : { *(.debug_sfnames) }
|
||||
/* DWARF 1.1 and DWARF 2 */
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
/* DWARF 2 */
|
||||
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_frame 0 : { *(.debug_frame) }
|
||||
.debug_str 0 : { *(.debug_str) }
|
||||
.debug_loc 0 : { *(.debug_loc) }
|
||||
.debug_macinfo 0 : { *(.debug_macinfo) }
|
||||
.debug_pubtypes 0 : { *(.debug_pubtypes) }
|
||||
/* DWARF 3 */
|
||||
.debug_ranges 0 : { *(.debug_ranges) }
|
||||
/* SGI/MIPS DWARF 2 extensions */
|
||||
.debug_weaknames 0 : { *(.debug_weaknames) }
|
||||
.debug_funcnames 0 : { *(.debug_funcnames) }
|
||||
.debug_typenames 0 : { *(.debug_typenames) }
|
||||
.debug_varnames 0 : { *(.debug_varnames) }
|
||||
/* GNU DWARF 2 extensions */
|
||||
.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }
|
||||
.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }
|
||||
/* DWARF 4 */
|
||||
.debug_types 0 : { *(.debug_types) }
|
||||
/* DWARF 5 */
|
||||
.debug_addr 0 : { *(.debug_addr) }
|
||||
.debug_line_str 0 : { *(.debug_line_str) }
|
||||
.debug_loclists 0 : { *(.debug_loclists) }
|
||||
.debug_macro 0 : { *(.debug_macro) }
|
||||
.debug_names 0 : { *(.debug_names) }
|
||||
.debug_rnglists 0 : { *(.debug_rnglists) }
|
||||
.debug_str_offsets 0 : { *(.debug_str_offsets) }
|
||||
|
||||
.comment 0 : { *(.comment) }
|
||||
.note.GNU-stack 0: { *(.note.GNU-stack) }
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -13,6 +13,9 @@
|
||||
#include "hal/efuse_ll.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#include "spi_flash_mmap.h"
|
||||
#endif
|
||||
#include "hal/spi_flash_ll.h"
|
||||
#include "rom/spi_flash.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "hal/cache_hal.h"
|
||||
#include "hal/cache_ll.h"
|
||||
|
||||
void bootloader_flash_update_id()
|
||||
void IRAM_ATTR bootloader_flash_update_id()
|
||||
{
|
||||
esp_rom_spiflash_chip_t *chip = &rom_spiflash_legacy_data->chip;
|
||||
chip->device_id = bootloader_read_flash_id();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2010-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2010-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -10,6 +10,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "soc/soc.h"
|
||||
#include "soc/ext_mem_defs.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_attr.h"
|
||||
@ -179,6 +180,31 @@ inline static bool esp_ptr_in_tcm(const void *p) {
|
||||
#endif //#if SOC_MEM_TCM_SUPPORTED
|
||||
|
||||
/** End of the common section that has to be in sync with esp_memory_utils.h **/
|
||||
|
||||
/**
|
||||
* @brief Check if the pointer is in PSRAM vaddr space
|
||||
*
|
||||
* @note This function is only used when in bootloader, where the PSRAM isn't initialised.
|
||||
* This function simply check if the pointer is the in the PSRAM vaddr space.
|
||||
* The PSRAM vaddr space is not always the same as the actual PSRAM vaddr range used in APP
|
||||
*
|
||||
* @param p pointer
|
||||
*
|
||||
* @return true: is in PSRAM; false: not in PSRAM
|
||||
*/
|
||||
__attribute__((always_inline))
|
||||
inline static bool esp_ptr_in_extram(const void *p) {
|
||||
bool valid = false;
|
||||
#if SOC_IRAM_PSRAM_ADDRESS_LOW
|
||||
valid |= ((intptr_t)p >= SOC_IRAM_PSRAM_ADDRESS_LOW && (intptr_t)p < SOC_IRAM_PSRAM_ADDRESS_HIGH);
|
||||
#endif
|
||||
|
||||
#if SOC_DRAM_PSRAM_ADDRESS_LOW
|
||||
valid |= ((intptr_t)p >= SOC_DRAM_PSRAM_ADDRESS_LOW && (intptr_t)p < SOC_DRAM_PSRAM_ADDRESS_HIGH);
|
||||
#endif
|
||||
return valid;
|
||||
}
|
||||
|
||||
/** Don't add new functions below **/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -9,9 +9,6 @@
|
||||
#include "esp_attr.h"
|
||||
#include "esp_err.h"
|
||||
#include "soc/soc_caps.h"
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#include "spi_flash_mmap.h"
|
||||
#endif
|
||||
#include "hal/efuse_ll.h"
|
||||
#include "sdkconfig.h"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -37,8 +37,8 @@ esp_comm_gpio_hold_t bootloader_common_check_long_hold_gpio(uint32_t num_pin, ui
|
||||
esp_comm_gpio_hold_t bootloader_common_check_long_hold_gpio_level(uint32_t num_pin, uint32_t delay_sec, bool level)
|
||||
{
|
||||
esp_rom_gpio_pad_select_gpio(num_pin);
|
||||
if (GPIO_PIN_MUX_REG[num_pin]) {
|
||||
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[num_pin]);
|
||||
if (((1ULL << num_pin) & SOC_GPIO_VALID_GPIO_MASK) != 0) {
|
||||
gpio_ll_input_enable(&GPIO, num_pin);
|
||||
}
|
||||
esp_rom_gpio_pad_pullup_only(num_pin);
|
||||
uint32_t tm_start = esp_log_early_timestamp();
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "soc/gpio_periph.h"
|
||||
#include "soc/gpio_sig_map.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "hal/gpio_hal.h"
|
||||
#include "hal/gpio_ll.h"
|
||||
#if CONFIG_IDF_TARGET_ESP32S2
|
||||
#include "esp32s2/rom/usb/cdc_acm.h"
|
||||
#include "esp32s2/rom/usb/usb_common.h"
|
||||
@ -63,17 +63,17 @@ void bootloader_console_init(void)
|
||||
uart_tx_gpio != UART_NUM_0_TXD_DIRECT_GPIO_NUM ||
|
||||
uart_rx_gpio != UART_NUM_0_RXD_DIRECT_GPIO_NUM) {
|
||||
// Change default UART pins back to GPIOs
|
||||
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[UART_NUM_0_RXD_DIRECT_GPIO_NUM], PIN_FUNC_GPIO);
|
||||
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[UART_NUM_0_TXD_DIRECT_GPIO_NUM], PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, UART_NUM_0_RXD_DIRECT_GPIO_NUM, PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, UART_NUM_0_TXD_DIRECT_GPIO_NUM, PIN_FUNC_GPIO);
|
||||
// Route GPIO signals to/from pins
|
||||
const uint32_t tx_idx = UART_PERIPH_SIGNAL(uart_num, SOC_UART_TX_PIN_IDX);
|
||||
const uint32_t rx_idx = UART_PERIPH_SIGNAL(uart_num, SOC_UART_RX_PIN_IDX);
|
||||
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[uart_rx_gpio], PIN_FUNC_GPIO);
|
||||
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[uart_rx_gpio]);
|
||||
gpio_ll_func_sel(&GPIO, uart_rx_gpio, PIN_FUNC_GPIO);
|
||||
gpio_ll_input_enable(&GPIO, uart_rx_gpio);
|
||||
esp_rom_gpio_pad_pullup_only(uart_rx_gpio);
|
||||
esp_rom_gpio_connect_out_signal(uart_tx_gpio, tx_idx, 0, 0);
|
||||
esp_rom_gpio_connect_in_signal(uart_rx_gpio, rx_idx, 0);
|
||||
gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[uart_tx_gpio], PIN_FUNC_GPIO);
|
||||
gpio_ll_func_sel(&GPIO, uart_tx_gpio, PIN_FUNC_GPIO);
|
||||
// Enable the peripheral
|
||||
uart_ll_enable_bus_clock(uart_num, true);
|
||||
uart_ll_reset_register(uart_num);
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "bootloader_random.h"
|
||||
#include "bootloader_clock.h"
|
||||
#include "bootloader_common.h"
|
||||
#include "esp_flash_encrypt.h"
|
||||
#include "esp_cpu.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "hal/wdt_hal.h"
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "hal/apm_hal.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32C5_BETA3_VERSION // TODO: IDF-8615 Remove the workaround when APM supported on C5!
|
||||
#if CONFIG_IDF_TARGET_ESP32C5 // TODO: IDF-8615 Remove the workaround when APM supported on C5!
|
||||
#include "soc/hp_apm_reg.h"
|
||||
#include "soc/lp_apm_reg.h"
|
||||
#include "soc/lp_apm0_reg.h"
|
||||
@ -33,10 +33,12 @@ void bootloader_init_mem(void)
|
||||
* So, at boot disabling these filters. They will enable as per the
|
||||
* use case by TEE initialization code.
|
||||
*/
|
||||
#ifdef SOC_APM_CTRL_FILTER_SUPPORTED
|
||||
apm_hal_apm_ctrl_filter_enable_all(false);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32C5_BETA3_VERSION // TODO: IDF-8615 Remove the workaround when APM supported on C5!
|
||||
#if CONFIG_IDF_TARGET_ESP32C5 // TODO: IDF-8615 Remove the workaround when APM supported on C5!
|
||||
// disable apm filter
|
||||
REG_WRITE(LP_APM_FUNC_CTRL_REG, 0);
|
||||
REG_WRITE(LP_APM0_FUNC_CTRL_REG, 0);
|
||||
|
@ -53,7 +53,7 @@ void bootloader_random_enable(void)
|
||||
|
||||
// create patterns and set them in pattern table
|
||||
uint32_t pattern_one = (SAR2_CHANNEL << 2) | SAR2_ATTEN; // we want channel 9 with max attenuation
|
||||
uint32_t pattern_two = SAR1_ATTEN; // we want channel 0 with max attenuation, channel doesn't really matter here
|
||||
uint32_t pattern_two = (SAR2_CHANNEL << 2) | SAR1_ATTEN; // we want channel 9 with max attenuation
|
||||
uint32_t pattern_table = 0 | (pattern_two << 3 * PATTERN_BIT_WIDTH) | pattern_one << 2 * PATTERN_BIT_WIDTH;
|
||||
REG_WRITE(APB_SARADC_SAR_PATT_TAB1_REG, pattern_table);
|
||||
|
||||
@ -88,9 +88,6 @@ void bootloader_random_disable(void)
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC1_ENCAL_REF_ADDR, 0);
|
||||
REGI2C_WRITE_MASK(I2C_SAR_ADC, ADC_SARADC2_ENCAL_REF_ADDR, 0);
|
||||
|
||||
// Revert PMU_RF_PWC_REG to it's initial value
|
||||
CLEAR_PERI_REG_MASK(PMU_RF_PWC_REG, PMU_PERIF_I2C_RSTB);
|
||||
|
||||
// disable ADC_CTRL_CLK (SAR ADC function clock)
|
||||
REG_WRITE(PCR_SARADC_CLKM_CONF_REG, 0x00404000);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "soc/pmu_reg.h"
|
||||
#include "soc/regi2c_saradc.h"
|
||||
#include "soc/hp_sys_clkrst_reg.h"
|
||||
#include "soc/rtcadc_reg.h"
|
||||
#include "soc/lp_adc_reg.h"
|
||||
#include "esp_private/regi2c_ctrl.h"
|
||||
#include "esp_rom_regi2c.h"
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "soc/rtc_periph.h"
|
||||
#include "soc/timer_periph.h"
|
||||
#include "hal/mmu_hal.h"
|
||||
#include "hal/mmu_ll.h"
|
||||
#include "hal/cache_types.h"
|
||||
#include "hal/cache_ll.h"
|
||||
#include "hal/cache_hal.h"
|
||||
@ -34,6 +35,9 @@
|
||||
#include "esp_app_desc.h"
|
||||
#include "esp_secure_boot.h"
|
||||
#include "esp_flash_encrypt.h"
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#include "spi_flash_mmap.h"
|
||||
#endif
|
||||
#include "esp_flash_partitions.h"
|
||||
#include "bootloader_flash_priv.h"
|
||||
#include "bootloader_random.h"
|
||||
@ -43,6 +47,7 @@
|
||||
#include "bootloader_sha.h"
|
||||
#include "bootloader_console.h"
|
||||
#include "bootloader_soc.h"
|
||||
#include "bootloader_memory_utils.h"
|
||||
#include "esp_efuse.h"
|
||||
#include "esp_fault.h"
|
||||
|
||||
@ -715,10 +720,20 @@ static void unpack_load_app(const esp_image_metadata_t *data)
|
||||
// Find DROM & IROM addresses, to configure MMU mappings
|
||||
for (int i = 0; i < data->image.segment_count; i++) {
|
||||
const esp_image_segment_header_t *header = &data->segments[i];
|
||||
bool text_or_rodata = false;
|
||||
|
||||
//`SOC_DROM_LOW` and `SOC_DROM_HIGH` are the same as `SOC_IROM_LOW` and `SOC_IROM_HIGH`, reasons are in above `note`
|
||||
if (header->load_addr >= SOC_DROM_LOW && header->load_addr < SOC_DROM_HIGH) {
|
||||
text_or_rodata = true;
|
||||
}
|
||||
#if SOC_MMU_PER_EXT_MEM_TARGET
|
||||
if (header->load_addr >= SOC_EXTRAM_LOW && header->load_addr < SOC_EXTRAM_HIGH) {
|
||||
text_or_rodata = true;
|
||||
}
|
||||
#endif
|
||||
if (text_or_rodata) {
|
||||
/**
|
||||
* D/I are shared, but there should not be a third segment on flash
|
||||
* D/I are shared, but there should not be a third segment on flash/psram
|
||||
*/
|
||||
assert(rom_index < 2);
|
||||
rom_addr[rom_index] = data->segment_data[i];
|
||||
@ -785,6 +800,20 @@ static void unpack_load_app(const esp_image_metadata_t *data)
|
||||
}
|
||||
#endif //#if SOC_MMU_DI_VADDR_SHARED
|
||||
|
||||
//unused for esp32
|
||||
__attribute__((unused))
|
||||
static bool s_flash_seg_needs_map(uint32_t vaddr)
|
||||
{
|
||||
#if SOC_MMU_PER_EXT_MEM_TARGET
|
||||
//For these chips, segments on PSRAM will be mapped in app
|
||||
bool is_psram = esp_ptr_in_extram((void *)vaddr);
|
||||
return !is_psram;
|
||||
#else
|
||||
//For these chips, segments on Flash always need to be mapped
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void set_cache_and_start_app(
|
||||
uint32_t drom_addr,
|
||||
uint32_t drom_load_addr,
|
||||
@ -822,8 +851,13 @@ static void set_cache_and_start_app(
|
||||
ESP_EARLY_LOGV(TAG, "after mapping rodata, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", drom_addr_aligned, drom_load_addr_aligned, drom_page_count * SPI_FLASH_MMU_PAGE_SIZE);
|
||||
#else
|
||||
uint32_t actual_mapped_len = 0;
|
||||
mmu_hal_map_region(0, MMU_TARGET_FLASH0, drom_load_addr_aligned, drom_addr_aligned, drom_size, &actual_mapped_len);
|
||||
ESP_EARLY_LOGV(TAG, "after mapping rodata, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", drom_addr_aligned, drom_load_addr_aligned, actual_mapped_len);
|
||||
if (s_flash_seg_needs_map(drom_load_addr_aligned)) {
|
||||
mmu_hal_map_region(0, MMU_TARGET_FLASH0, drom_load_addr_aligned, drom_addr_aligned, drom_size, &actual_mapped_len);
|
||||
ESP_EARLY_LOGV(TAG, "after mapping rodata, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", drom_addr_aligned, drom_load_addr_aligned, actual_mapped_len);
|
||||
}
|
||||
//we use the MMU_LL_END_DROM_ENTRY_ID mmu entry as a map page for app to find the boot partition
|
||||
mmu_hal_map_region(0, MMU_TARGET_FLASH0, MMU_LL_END_DROM_ENTRY_VADDR, drom_addr_aligned, CONFIG_MMU_PAGE_SIZE, &actual_mapped_len);
|
||||
ESP_EARLY_LOGV(TAG, "mapped one page of the rodata, from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", drom_addr_aligned, drom_load_addr_aligned, actual_mapped_len);
|
||||
#endif
|
||||
|
||||
//-----------------------MAP IROM--------------------------
|
||||
@ -840,8 +874,10 @@ static void set_cache_and_start_app(
|
||||
ESP_LOGV(TAG, "rc=%d", rc);
|
||||
ESP_EARLY_LOGV(TAG, "after mapping text, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", irom_addr_aligned, irom_load_addr_aligned, irom_page_count * SPI_FLASH_MMU_PAGE_SIZE);
|
||||
#else
|
||||
mmu_hal_map_region(0, MMU_TARGET_FLASH0, irom_load_addr_aligned, irom_addr_aligned, irom_size, &actual_mapped_len);
|
||||
ESP_EARLY_LOGV(TAG, "after mapping text, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", irom_addr_aligned, irom_load_addr_aligned, actual_mapped_len);
|
||||
if (s_flash_seg_needs_map(irom_load_addr_aligned)) {
|
||||
mmu_hal_map_region(0, MMU_TARGET_FLASH0, irom_load_addr_aligned, irom_addr_aligned, irom_size, &actual_mapped_len);
|
||||
ESP_EARLY_LOGV(TAG, "after mapping text, starting from paddr=0x%08" PRIx32 " and vaddr=0x%08" PRIx32 ", 0x%" PRIx32 " bytes are mapped", irom_addr_aligned, irom_load_addr_aligned, actual_mapped_len);
|
||||
}
|
||||
#endif
|
||||
|
||||
//----------------------Enable corresponding buses----------------
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -29,6 +29,7 @@
|
||||
#include "bootloader_flash_config.h"
|
||||
#include "bootloader_mem.h"
|
||||
#include "esp_private/regi2c_ctrl.h"
|
||||
#include "soc/chip_revision.h"
|
||||
#include "soc/regi2c_lp_bias.h"
|
||||
#include "soc/regi2c_bias.h"
|
||||
#include "bootloader_console.h"
|
||||
@ -90,14 +91,14 @@ static void bootloader_super_wdt_auto_feed(void)
|
||||
static inline void bootloader_hardware_init(void)
|
||||
{
|
||||
// regi2c is enabled by default on ESP32P4, do nothing
|
||||
|
||||
// On ESP32P4 ECO0, the default (power on reset) CPLL and SPLL frequencies are very high, lower them to avoid bias may not be enough in bootloader
|
||||
// And we are fixing SPLL to be 480MHz at all runtime
|
||||
// Suppose to fix the issue on ECO1, will check when chip comes back
|
||||
// TODO: IDF-8939
|
||||
REGI2C_WRITE_MASK(I2C_CPLL, I2C_CPLL_OC_DIV_7_0, 6); // lower default cpu_pll freq to 400M
|
||||
REGI2C_WRITE_MASK(I2C_SYSPLL, I2C_SYSPLL_OC_DIV_7_0, 8); // lower default sys_pll freq to 480M
|
||||
esp_rom_delay_us(100);
|
||||
unsigned chip_version = efuse_hal_chip_revision();
|
||||
if (!ESP_CHIP_REV_ABOVE(chip_version, 1)) {
|
||||
// On ESP32P4 ECO0, the default (power on reset) CPLL and SPLL frequencies are very high, lower them to avoid bias may not be enough in bootloader
|
||||
// And we are fixing SPLL to be 480MHz after app is up
|
||||
REGI2C_WRITE_MASK(I2C_CPLL, I2C_CPLL_OC_DIV_7_0, 6); // lower default cpu_pll freq to 400M
|
||||
REGI2C_WRITE_MASK(I2C_SYSPLL, I2C_SYSPLL_OC_DIV_7_0, 8); // lower default sys_pll freq to 480M
|
||||
esp_rom_delay_us(100);
|
||||
}
|
||||
REGI2C_WRITE_MASK(I2C_BIAS, I2C_BIAS_DREG_1P1, 10);
|
||||
REGI2C_WRITE_MASK(I2C_BIAS, I2C_BIAS_DREG_1P1_PVT, 10);
|
||||
}
|
||||
@ -170,7 +171,7 @@ esp_err_t bootloader_init(void)
|
||||
}
|
||||
#endif // !CONFIG_APP_BUILD_TYPE_RAM
|
||||
|
||||
// check whether a WDT reset happend
|
||||
// check whether a WDT reset happened
|
||||
bootloader_check_wdt_reset();
|
||||
// config WDT
|
||||
bootloader_config_wdt();
|
||||
|
@ -1,9 +1,12 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include "soc/lp_analog_peri_reg.h"
|
||||
#include "soc/soc.h"
|
||||
#include "hal/brownout_ll.h"
|
||||
|
||||
void bootloader_ana_super_wdt_reset_config(bool enable)
|
||||
{
|
||||
@ -12,7 +15,9 @@ void bootloader_ana_super_wdt_reset_config(bool enable)
|
||||
|
||||
void bootloader_ana_bod_reset_config(bool enable)
|
||||
{
|
||||
//TODO: IDF-7514
|
||||
REG_CLR_BIT(LP_ANALOG_PERI_FIB_ENABLE_REG, LP_ANALOG_PERI_LP_ANA_FIB_BOD_RST);
|
||||
|
||||
brownout_ll_ana_reset_enable(enable);
|
||||
}
|
||||
|
||||
void bootloader_ana_clock_glitch_reset_config(bool enable)
|
||||
|
@ -771,8 +771,14 @@ static esp_err_t verify_segment_header(int index, const esp_image_segment_header
|
||||
|
||||
static bool should_map(uint32_t load_addr)
|
||||
{
|
||||
return (load_addr >= SOC_IROM_LOW && load_addr < SOC_IROM_HIGH)
|
||||
|| (load_addr >= SOC_DROM_LOW && load_addr < SOC_DROM_HIGH);
|
||||
bool is_irom = (load_addr >= SOC_IROM_LOW) && (load_addr < SOC_IROM_HIGH);
|
||||
bool is_drom = (load_addr >= SOC_DROM_LOW) && (load_addr < SOC_DROM_HIGH);
|
||||
bool is_psram = false;
|
||||
#if SOC_MMU_PER_EXT_MEM_TARGET
|
||||
is_psram = (load_addr >= SOC_EXTRAM_LOW) && (load_addr < SOC_EXTRAM_HIGH);
|
||||
#endif
|
||||
|
||||
return (is_irom || is_drom || is_psram);
|
||||
}
|
||||
|
||||
static bool should_load(uint32_t load_addr)
|
||||
@ -857,7 +863,7 @@ static esp_err_t process_appended_hash_and_sig(esp_image_metadata_t *data, uint3
|
||||
|
||||
// Case I: Bootloader part
|
||||
if (part_offset == ESP_BOOTLOADER_OFFSET) {
|
||||
// For bootloader with secure boot v1, signature stays in an independant flash
|
||||
// For bootloader with secure boot v1, signature stays in an independent flash
|
||||
// sector (offset 0x0) and does not get appended to the image.
|
||||
#if CONFIG_SECURE_BOOT_V2_ENABLED
|
||||
// Sanity check - secure boot v2 signature block starts on 4K boundary
|
||||
|
@ -16,10 +16,15 @@
|
||||
#include "esp_log.h"
|
||||
#include "hal/wdt_hal.h"
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#include "hal/key_mgr_hal.h"
|
||||
#if SOC_KEY_MANAGER_FE_KEY_DEPLOY || CONFIG_IDF_TARGET_ESP32C5
|
||||
#if CONFIG_IDF_TARGET_ESP32C5
|
||||
#include "soc/keymng_reg.h"
|
||||
#endif
|
||||
#include "soc/pcr_reg.h"
|
||||
#else /* CONFIG_IDF_TARGET_ESP32C5 */
|
||||
#include "hal/key_mgr_ll.h"
|
||||
#include "hal/mspi_timing_tuning_ll.h"
|
||||
#endif /* !CONFIG_IDF_TARGET_ESP32C5 */
|
||||
#endif /* SOC_KEY_MANAGER_FE_KEY_DEPLOY */
|
||||
|
||||
#ifdef CONFIG_SOC_EFUSE_CONSISTS_OF_ONE_KEY_BLOCK
|
||||
#include "soc/sensitive_reg.h"
|
||||
@ -216,11 +221,25 @@ static esp_err_t check_and_generate_encryption_keys(void)
|
||||
ESP_LOGI(TAG, "Using pre-loaded flash encryption key in efuse");
|
||||
}
|
||||
|
||||
#if SOC_KEY_MANAGER_SUPPORTED
|
||||
#if SOC_KEY_MANAGER_FE_KEY_DEPLOY || CONFIG_IDF_TARGET_ESP32C5
|
||||
#if CONFIG_IDF_TARGET_ESP32C5
|
||||
REG_SET_FIELD(KEYMNG_STATIC_REG, KEYMNG_USE_EFUSE_KEY, 2);
|
||||
REG_SET_BIT(PCR_MSPI_CLK_CONF_REG, PCR_MSPI_AXI_RST_EN);
|
||||
REG_CLR_BIT(PCR_MSPI_CLK_CONF_REG, PCR_MSPI_AXI_RST_EN);
|
||||
#else /* CONFIG_IDF_TARGET_ESP32C5 */
|
||||
// Enable and reset key manager
|
||||
// To suppress build errors about spinlock's __DECLARE_RCC_ATOMIC_ENV
|
||||
int __DECLARE_RCC_ATOMIC_ENV __attribute__ ((unused));
|
||||
key_mgr_ll_enable_bus_clock(true);
|
||||
key_mgr_ll_enable_peripheral_clock(true);
|
||||
key_mgr_ll_reset_register();
|
||||
while (key_mgr_ll_get_state() != ESP_KEY_MGR_STATE_IDLE) {
|
||||
};
|
||||
// Force Key Manager to use eFuse key for XTS-AES operation
|
||||
key_mgr_hal_set_key_usage(ESP_KEY_MGR_XTS_AES_128_KEY, ESP_KEY_MGR_USE_EFUSE_KEY);
|
||||
#endif
|
||||
|
||||
key_mgr_ll_set_key_usage(ESP_KEY_MGR_XTS_AES_128_KEY, ESP_KEY_MGR_USE_EFUSE_KEY);
|
||||
_mspi_timing_ll_reset_mspi();
|
||||
#endif /* !CONFIG_IDF_TARGET_ESP32C5 */
|
||||
#endif /* SOC_KEY_MANAGER_FE_KEY_DEPLOY */
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@ -263,13 +282,6 @@ esp_err_t esp_flash_encrypt_contents(void)
|
||||
esp_partition_info_t partition_table[ESP_PARTITION_TABLE_MAX_ENTRIES];
|
||||
int num_partitions;
|
||||
|
||||
#if CONFIG_IDF_TARGET_ESP32C5 && SOC_KEY_MANAGER_SUPPORTED
|
||||
// TODO: [ESP32C5] IDF-8622 find a more proper place for these codes
|
||||
REG_SET_BIT(KEYMNG_STATIC_REG, KEYMNG_USE_EFUSE_KEY_FLASH);
|
||||
REG_SET_BIT(PCR_MSPI_CLK_CONF_REG, PCR_MSPI_AXI_RST_EN);
|
||||
REG_CLR_BIT(PCR_MSPI_CLK_CONF_REG, PCR_MSPI_AXI_RST_EN);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SOC_EFUSE_CONSISTS_OF_ONE_KEY_BLOCK
|
||||
REG_WRITE(SENSITIVE_XTS_AES_KEY_UPDATE_REG, 1);
|
||||
#endif
|
||||
@ -421,7 +433,7 @@ static esp_err_t encrypt_partition(int index, const esp_partition_info_t *partit
|
||||
&partition->pos,
|
||||
&image_data);
|
||||
should_encrypt = (err == ESP_OK);
|
||||
#ifdef SECURE_FLASH_ENCRYPT_ONLY_IMAGE_LEN_IN_APP_PART
|
||||
#ifdef CONFIG_SECURE_FLASH_ENCRYPT_ONLY_IMAGE_LEN_IN_APP_PART
|
||||
if (should_encrypt) {
|
||||
// Encrypt only the app image instead of encrypting the whole partition
|
||||
size = image_data.image_len;
|
||||
|
@ -1,2 +1,2 @@
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
@ -117,6 +117,7 @@ if(CONFIG_BT_ENABLED)
|
||||
common/btc/include
|
||||
common/include
|
||||
porting/mem/
|
||||
porting/include
|
||||
)
|
||||
list(APPEND include_dirs ${common_include_dirs})
|
||||
|
||||
@ -573,31 +574,52 @@ if(CONFIG_BT_ENABLED)
|
||||
|
||||
|
||||
if(CONFIG_BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT)
|
||||
list(APPEND srcs
|
||||
"porting/npl/freertos/src/npl_os_freertos.c"
|
||||
"porting/mem/os_msys_init.c"
|
||||
"porting/transport/src/hci_transport.c"
|
||||
)
|
||||
|
||||
if(CONFIG_BT_CONTROLLER_DISABLED)
|
||||
list(APPEND srcs
|
||||
"porting/npl/freertos/src/npl_os_freertos.c"
|
||||
"porting/nimble/src/os_msys_init.c"
|
||||
"host/nimble/nimble/porting/nimble/src/hal_uart.c"
|
||||
)
|
||||
|
||||
if(CONFIG_BT_CONTROLLER_DISABLED)
|
||||
elseif(CONFIG_BT_LE_HCI_INTERFACE_USE_RAM)
|
||||
if(CONFIG_BT_NIMBLE_ENABLED)
|
||||
list(APPEND srcs
|
||||
"host/nimble/nimble/porting/nimble/src/hal_uart.c"
|
||||
)
|
||||
endif()
|
||||
list(APPEND include_dirs
|
||||
porting/include
|
||||
porting/nimble/include
|
||||
porting/npl/freertos/include
|
||||
porting/transport/include
|
||||
)
|
||||
|
||||
if(CONFIG_BT_LE_HCI_INTERFACE_USE_UART)
|
||||
"porting/transport/driver/vhci/hci_driver_nimble.c"
|
||||
"host/nimble/nimble/nimble/transport/esp_ipc/src/hci_esp_ipc.c"
|
||||
)
|
||||
else()
|
||||
list(APPEND srcs
|
||||
"porting/transport/uart/hci_uart.c"
|
||||
)
|
||||
"porting/transport/driver/vhci/hci_driver_standard.c"
|
||||
)
|
||||
endif()
|
||||
elseif(CONFIG_BT_LE_HCI_INTERFACE_USE_UART)
|
||||
list(APPEND srcs
|
||||
"porting/transport/driver/common/hci_driver_util.c"
|
||||
"porting/transport/driver/common/hci_driver_h4.c"
|
||||
"porting/transport/driver/common/hci_driver_mem.c"
|
||||
"porting/transport/driver/uart/hci_driver_uart_config.c"
|
||||
)
|
||||
if(CONFIG_BT_LE_UART_HCI_DMA_MODE)
|
||||
list(APPEND srcs
|
||||
"porting/transport/driver/uart/hci_driver_uart_dma.c"
|
||||
)
|
||||
else()
|
||||
list(APPEND srcs
|
||||
"porting/transport/driver/uart/hci_driver_uart.c"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
list(APPEND include_dirs
|
||||
porting/include
|
||||
porting/npl/freertos/include
|
||||
porting/transport/include
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT (CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS OR CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS))
|
||||
list(APPEND include_dirs
|
||||
porting/ext/tinycrypt/include
|
||||
@ -622,7 +644,6 @@ if(CONFIG_BT_ENABLED)
|
||||
if(CONFIG_BT_NIMBLE_ENABLED)
|
||||
|
||||
list(APPEND include_dirs
|
||||
|
||||
host/nimble/nimble/nimble/host/include
|
||||
host/nimble/nimble/nimble/include
|
||||
host/nimble/nimble/nimble/host/services/ans/include
|
||||
@ -726,11 +747,12 @@ if(CONFIG_BT_ENABLED)
|
||||
"host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c"
|
||||
"host/nimble/port/src/nvs_port.c"
|
||||
)
|
||||
|
||||
list(APPEND include_dirs
|
||||
porting/include
|
||||
host/nimble/nimble/porting/nimble/include
|
||||
host/nimble/port/include
|
||||
host/nimble/nimble/nimble/transport/include
|
||||
host/nimble/nimble/nimble/include
|
||||
)
|
||||
|
||||
if(CONFIG_BT_CONTROLLER_DISABLED)
|
||||
@ -756,15 +778,15 @@ if(CONFIG_BT_ENABLED)
|
||||
endif()
|
||||
|
||||
list(APPEND include_dirs
|
||||
porting/include
|
||||
host/nimble/nimble/porting/npl/freertos/include
|
||||
host/nimble/nimble/porting/nimble/include
|
||||
host/nimble/nimble/nimble/include
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CONFIG_BT_NIMBLE_LEGACY_VHCI_ENABLE AND CONFIG_BT_CONTROLLER_ENABLED)
|
||||
list(APPEND srcs
|
||||
"host/nimble/esp-hci/src/esp_nimble_hci.c"
|
||||
"host/nimble/nimble/nimble/transport/esp_ipc_legacy/src/hci_esp_ipc_legacy.c"
|
||||
)
|
||||
list(APPEND include_dirs ${nimble_hci_include_dirs})
|
||||
endif()
|
||||
|
@ -31,8 +31,8 @@ static const char s_hex_to_char_mapping[16] = {
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
||||
};
|
||||
|
||||
bt_hci_log_t g_bt_hci_log_data_ctl = {0};
|
||||
bt_hci_log_t g_bt_hci_log_adv_ctl = {0};
|
||||
static bt_hci_log_t g_bt_hci_log_data_ctl = {0};
|
||||
static bt_hci_log_t g_bt_hci_log_adv_ctl = {0};
|
||||
|
||||
esp_err_t bt_hci_log_init(void)
|
||||
{
|
||||
@ -98,35 +98,35 @@ static char IRAM_ATTR *bt_data_type_to_str(uint8_t data_type)
|
||||
{
|
||||
case HCI_LOG_DATA_TYPE_COMMAND:
|
||||
// hci cmd data
|
||||
tag = "CMD";
|
||||
tag = "C";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_H2C_ACL:
|
||||
// host to controller hci acl data
|
||||
tag = "HAL";
|
||||
tag = "H";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_SCO:
|
||||
// hci sco data
|
||||
tag = "SCO";
|
||||
tag = "S";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_EVENT:
|
||||
// hci event
|
||||
tag = "EVT";
|
||||
tag = "E";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_ADV:
|
||||
// controller adv report data
|
||||
tag = "ADV";
|
||||
tag = NULL;
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_C2H_ACL:
|
||||
// controller to host hci acl data
|
||||
tag = "CAL";
|
||||
tag = "D";
|
||||
break;
|
||||
case HCI_LOG_DATA_TYPE_SELF_DEFINE:
|
||||
// self-defining data
|
||||
tag = "ST";
|
||||
tag = "S";
|
||||
break;
|
||||
default:
|
||||
// unknown data type
|
||||
tag = "UK";
|
||||
tag = "U";
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2,15 +2,15 @@
|
||||
menu "HCI Config"
|
||||
|
||||
choice BT_LE_HCI_INTERFACE
|
||||
prompt "Select HCI interface"
|
||||
prompt "HCI mode"
|
||||
default BT_LE_HCI_INTERFACE_USE_RAM
|
||||
|
||||
config BT_LE_HCI_INTERFACE_USE_RAM
|
||||
bool "ram"
|
||||
bool "VHCI"
|
||||
help
|
||||
Use RAM as HCI interface
|
||||
config BT_LE_HCI_INTERFACE_USE_UART
|
||||
bool "uart"
|
||||
bool "UART(H4)"
|
||||
help
|
||||
Use UART as HCI interface
|
||||
endchoice
|
||||
@ -73,12 +73,26 @@ menu "HCI Config"
|
||||
UART_PARITY_ODD
|
||||
endchoice
|
||||
|
||||
config BT_LE_HCI_UART_TASK_STACK_SIZE
|
||||
int "HCI uart task stack size"
|
||||
depends on BT_LE_HCI_INTERFACE_USE_UART
|
||||
default 1000
|
||||
config BT_LE_HCI_UART_RX_BUFFER_SIZE
|
||||
int "The size of rx ring buffer memory"
|
||||
depends on !BT_LE_HCI_INTERFACE_USE_RAM
|
||||
default 512
|
||||
help
|
||||
Set the size of uart task stack
|
||||
The size of rx ring buffer memory
|
||||
|
||||
config BT_LE_HCI_UART_TX_BUFFER_SIZE
|
||||
int "The size of tx ring buffer memory"
|
||||
depends on !BT_LE_HCI_INTERFACE_USE_RAM
|
||||
default 256
|
||||
help
|
||||
The size of tx ring buffer memory
|
||||
|
||||
config BT_LE_HCI_TRANS_TASK_STACK_SIZE
|
||||
int "HCI transport task stack size"
|
||||
depends on !BT_LE_HCI_INTERFACE_USE_RAM
|
||||
default 1024
|
||||
help
|
||||
This configures stack size of hci transport task
|
||||
endmenu
|
||||
|
||||
config BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
|
||||
@ -280,6 +294,24 @@ config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Store ble controller logs to flash memory.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
The size of ble controller log partition shall be a multiples of 4K.
|
||||
The name of log partition shall be "bt_ctrl_log".
|
||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -349,7 +381,6 @@ config BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
bool "Override TinyCrypt with mbedTLS for crypto computations"
|
||||
default y
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
select MBEDTLS_ECP_RESTARTABLE
|
||||
select MBEDTLS_CMAC_C
|
||||
help
|
||||
Enable this option to choose mbedTLS instead of TinyCrypt for crypto
|
||||
@ -527,3 +558,62 @@ config BT_LE_ROLE_OBSERVER_ENABLE
|
||||
default y
|
||||
help
|
||||
Enable observer role function.
|
||||
|
||||
choice BT_LE_DFT_TX_POWER_LEVEL_DBM
|
||||
prompt "BLE default Tx power level(dBm)"
|
||||
default BT_LE_DFT_TX_POWER_LEVEL_P9
|
||||
help
|
||||
Specify default Tx power level(dBm).
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N24
|
||||
bool "-24dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N21
|
||||
bool "-21dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N18
|
||||
bool "-18dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N15
|
||||
bool "-15dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N12
|
||||
bool "-12dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N9
|
||||
bool "-9dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N6
|
||||
bool "-6dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N3
|
||||
bool "-3dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N0
|
||||
bool "0dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P3
|
||||
bool "+3dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P6
|
||||
bool "+6dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P9
|
||||
bool "+9dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P12
|
||||
bool "+12dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P15
|
||||
bool "+15dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P18
|
||||
bool "+18dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P20
|
||||
bool "+20dBm"
|
||||
endchoice
|
||||
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF
|
||||
int
|
||||
default -24 if BT_LE_DFT_TX_POWER_LEVEL_N24
|
||||
default -21 if BT_LE_DFT_TX_POWER_LEVEL_N21
|
||||
default -18 if BT_LE_DFT_TX_POWER_LEVEL_N18
|
||||
default -15 if BT_LE_DFT_TX_POWER_LEVEL_N15
|
||||
default -12 if BT_LE_DFT_TX_POWER_LEVEL_N12
|
||||
default -9 if BT_LE_DFT_TX_POWER_LEVEL_N9
|
||||
default -6 if BT_LE_DFT_TX_POWER_LEVEL_N6
|
||||
default -3 if BT_LE_DFT_TX_POWER_LEVEL_N3
|
||||
default 0 if BT_LE_DFT_TX_POWER_LEVEL_N0
|
||||
default 3 if BT_LE_DFT_TX_POWER_LEVEL_P3
|
||||
default 6 if BT_LE_DFT_TX_POWER_LEVEL_P6
|
||||
default 9 if BT_LE_DFT_TX_POWER_LEVEL_P9
|
||||
default 12 if BT_LE_DFT_TX_POWER_LEVEL_P12
|
||||
default 15 if BT_LE_DFT_TX_POWER_LEVEL_P15
|
||||
default 18 if BT_LE_DFT_TX_POWER_LEVEL_P18
|
||||
default 20 if BT_LE_DFT_TX_POWER_LEVEL_P20
|
||||
default 0
|
||||
|
@ -16,7 +16,10 @@
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
#include "nimble/nimble_port.h"
|
||||
#endif // CONFIG_BT_NIMBLE_ENABLED
|
||||
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
@ -28,7 +31,7 @@
|
||||
#endif
|
||||
|
||||
#include "nimble/nimble_npl_os.h"
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "esp_hci_transport.h"
|
||||
#include "os/endian.h"
|
||||
|
||||
#include "esp_bt.h"
|
||||
@ -41,13 +44,8 @@
|
||||
#include "soc/syscon_reg.h"
|
||||
#include "soc/modem_clkrst_reg.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "hci_uart.h"
|
||||
#include "bt_osi_mem.h"
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#include "hci/hci_hal.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#include "esp_private/sleep_modem.h"
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
@ -64,6 +62,7 @@
|
||||
|
||||
#include "hal/efuse_ll.h"
|
||||
#include "soc/rtc.h"
|
||||
|
||||
/* Macro definition
|
||||
************************************************************************
|
||||
*/
|
||||
@ -76,12 +75,6 @@
|
||||
#define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5
|
||||
|
||||
#define BT_ASSERT_PRINT ets_printf
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
/* ACL_DATA_MBUF_LEADINGSPCAE: The leadingspace in user info header for ACL data */
|
||||
#define ACL_DATA_MBUF_LEADINGSPCAE 4
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
typedef enum ble_rtc_slow_clk_src {
|
||||
BT_SLOW_CLK_SRC_MAIN_XTAL,
|
||||
BT_SLOW_CLK_SRC_32K_XTAL_ON_PIN0,
|
||||
@ -105,12 +98,12 @@ struct ext_funcs_t {
|
||||
int (*_esp_intr_free)(void **ret_handle);
|
||||
void *(* _malloc)(size_t size);
|
||||
void (*_free)(void *p);
|
||||
void (*_hal_uart_start_tx)(int);
|
||||
int (*_hal_uart_init_cbs)(int, hci_uart_tx_char, hci_uart_tx_done, hci_uart_rx_char, void *);
|
||||
int (*_hal_uart_config)(int, int32_t, uint8_t, uint8_t, uart_parity_t, uart_hw_flowcontrol_t);
|
||||
int (*_hal_uart_close)(int);
|
||||
void (*_hal_uart_blocking_tx)(int, uint8_t);
|
||||
int (*_hal_uart_init)(int, void *);
|
||||
void (*_rsv1)(int);
|
||||
int (*_rsv2)(int, int (*)(void *arg), int (*)(void *arg, uint8_t byte), int (*)(void *arg, uint8_t byte), void *);
|
||||
int (*_rsv3)(int, int32_t, uint8_t, uint8_t, int, int);
|
||||
int (*_rsv4)(int);
|
||||
void (*_rsv5)(int, uint8_t);
|
||||
int (*_rsv6)(int, void *);
|
||||
int (* _task_create)(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id);
|
||||
void (* _task_delete)(void *task_handle);
|
||||
void (*_osi_assert)(const uint32_t ln, const char *fn, uint32_t param1, uint32_t param2);
|
||||
@ -188,16 +181,6 @@ static void coex_schm_status_bit_set_wrapper(uint32_t type, uint32_t status);
|
||||
static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status);
|
||||
static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id);
|
||||
static void task_delete_wrapper(void *task_handle);
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no);
|
||||
static int hci_uart_init_cbs_wrapper(int uart_no, hci_uart_tx_char tx_func,
|
||||
hci_uart_tx_done tx_done, hci_uart_rx_char rx_func, void *arg);
|
||||
static int hci_uart_config_wrapper(int uart_no, int32_t speed, uint8_t databits, uint8_t stopbits,
|
||||
uart_parity_t parity, uart_hw_flowcontrol_t flow_ctl);
|
||||
static int hci_uart_close_wrapper(int uart_no);
|
||||
static void hci_uart_blocking_tx_wrapper(int port, uint8_t data);
|
||||
static int hci_uart_init_wrapper(int uart_no, void *cfg);
|
||||
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
|
||||
void *arg, void **ret_handle_in);
|
||||
static int esp_intr_free_wrapper(void **ret_handle);
|
||||
@ -209,15 +192,248 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||
#endif // #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
/* Static variable declare */
|
||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
||||
enum log_out_mode {
|
||||
LOG_DUMP_MEMORY,
|
||||
LOG_ASYNC_OUT,
|
||||
LOG_STORAGE_TO_FLASH,
|
||||
};
|
||||
|
||||
bool log_is_inited = false;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
uint8_t log_output_mode = LOG_DUMP_MEMORY;
|
||||
#else
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
uint8_t log_output_mode = LOG_STORAGE_TO_FLASH;
|
||||
#else
|
||||
uint8_t log_output_mode = LOG_ASYNC_OUT;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
|
||||
void esp_bt_log_output_mode_set(uint8_t output_mode)
|
||||
{
|
||||
log_output_mode = output_mode;
|
||||
}
|
||||
|
||||
uint8_t esp_bt_log_output_mode_get(void)
|
||||
{
|
||||
return log_output_mode;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
bool task_create;
|
||||
uint8_t buffers = 0;
|
||||
|
||||
if (log_is_inited) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_HCI;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
|
||||
switch (log_output_mode) {
|
||||
case LOG_DUMP_MEMORY:
|
||||
task_create = false;
|
||||
break;
|
||||
case LOG_ASYNC_OUT:
|
||||
case LOG_STORAGE_TO_FLASH:
|
||||
task_create = true;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
esp_bt_ctrl_log_partition_get_and_erase_first_block();
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
ret = ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
|
||||
if (ret == ESP_OK) {
|
||||
log_is_inited = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void esp_bt_ontroller_log_deinit(void)
|
||||
{
|
||||
ble_log_deinit_async();
|
||||
log_is_inited = false;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#include "esp_partition.h"
|
||||
#include "hal/wdt_hal.h"
|
||||
|
||||
#define MAX_STORAGE_SIZE (CONFIG_BT_LE_CONTROLLER_LOG_PARTITION_SIZE)
|
||||
#define BLOCK_SIZE (4096)
|
||||
#define THRESHOLD (3072)
|
||||
#define PARTITION_NAME "bt_ctrl_log"
|
||||
|
||||
static const esp_partition_t *log_partition;
|
||||
static uint32_t write_index = 0;
|
||||
static uint32_t next_erase_index = BLOCK_SIZE;
|
||||
static bool block_erased = false;
|
||||
static bool stop_write = false;
|
||||
static bool is_filled = false;
|
||||
|
||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void)
|
||||
{
|
||||
log_partition = NULL;
|
||||
assert(MAX_STORAGE_SIZE % BLOCK_SIZE == 0);
|
||||
// Find the partition map in the partition table
|
||||
log_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, PARTITION_NAME);
|
||||
assert(log_partition != NULL);
|
||||
// Prepare data to be read later using the mapped address
|
||||
ESP_ERROR_CHECK(esp_partition_erase_range(log_partition, 0, BLOCK_SIZE));
|
||||
write_index = 0;
|
||||
next_erase_index = BLOCK_SIZE;
|
||||
block_erased = false;
|
||||
is_filled = false;
|
||||
stop_write = false;
|
||||
}
|
||||
|
||||
static int esp_bt_controller_log_storage(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (len > MAX_STORAGE_SIZE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stop_write) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(log_partition != NULL);
|
||||
if (((write_index) % BLOCK_SIZE) >= THRESHOLD && !block_erased) {
|
||||
// esp_rom_printf("Ers nxt: %d,%d\n", next_erase_index, write_index);
|
||||
esp_partition_erase_range(log_partition, next_erase_index, BLOCK_SIZE);
|
||||
next_erase_index = (next_erase_index + BLOCK_SIZE) % MAX_STORAGE_SIZE;
|
||||
block_erased = true;
|
||||
}
|
||||
|
||||
if (((write_index + len) / BLOCK_SIZE) > (write_index / BLOCK_SIZE)) {
|
||||
block_erased = false;
|
||||
}
|
||||
|
||||
if (write_index + len <= MAX_STORAGE_SIZE) {
|
||||
esp_partition_write(log_partition, write_index, addr, len);
|
||||
write_index = (write_index + len) % MAX_STORAGE_SIZE;
|
||||
} else {
|
||||
uint32_t first_part_len = MAX_STORAGE_SIZE - write_index;
|
||||
esp_partition_write(log_partition, write_index, addr, first_part_len);
|
||||
esp_partition_write(log_partition, 0, addr + first_part_len, len - first_part_len);
|
||||
write_index = len - first_part_len;
|
||||
is_filled = true;
|
||||
// esp_rom_printf("old idx: %d,%d\n",next_erase_index, write_index);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
{
|
||||
esp_partition_mmap_handle_t mmap_handle;
|
||||
uint32_t read_index;
|
||||
const void *mapped_ptr;
|
||||
const uint8_t *buffer;
|
||||
uint32_t print_len;
|
||||
uint32_t max_print_len;
|
||||
esp_err_t err;
|
||||
|
||||
print_len = 0;
|
||||
max_print_len = 4096;
|
||||
err = esp_partition_mmap(log_partition, 0, MAX_STORAGE_SIZE, ESP_PARTITION_MMAP_DATA, &mapped_ptr, &mmap_handle);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE("FLASH", "Mmap failed: %s", esp_err_to_name(err));
|
||||
return;
|
||||
}
|
||||
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
ble_log_async_output_dump_all(true);
|
||||
stop_write = true;
|
||||
esp_bt_ontroller_log_deinit();
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
|
||||
buffer = (const uint8_t *)mapped_ptr;
|
||||
if (is_filled) {
|
||||
read_index = next_erase_index;
|
||||
} else {
|
||||
read_index = 0;
|
||||
}
|
||||
|
||||
esp_rom_printf("\r\nREAD_CHECK:%ld,%ld,%d\r\n",read_index, write_index, is_filled);
|
||||
esp_rom_printf("\r\n[DUMP_START:");
|
||||
while (read_index != write_index) {
|
||||
esp_rom_printf("%02x ", buffer[read_index]);
|
||||
if (print_len > max_print_len) {
|
||||
vTaskDelay(2);
|
||||
print_len = 0;
|
||||
}
|
||||
|
||||
print_len++;
|
||||
read_index = (read_index + 1) % MAX_STORAGE_SIZE;
|
||||
}
|
||||
esp_rom_printf(":DUMP_END]\r\n");
|
||||
esp_partition_munmap(mmap_handle);
|
||||
err = esp_bt_controller_log_init(log_output_mode);
|
||||
assert(err == ESP_OK);
|
||||
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
esp_bt_controller_log_storage(len, addr, end);
|
||||
#endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
} else {
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
|
||||
if (end) {
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void esp_ble_controller_log_dump_all(bool output)
|
||||
{
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
esp_bt_read_ctrl_log_from_flash(output);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
BT_ASSERT_PRINT("\r\n[DUMP_START:");
|
||||
ble_log_async_output_dump_all(output);
|
||||
BT_ASSERT_PRINT(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
/* This variable tells if BLE is running */
|
||||
@ -229,7 +445,6 @@ static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock = NULL;
|
||||
|
||||
#define BLE_RTC_DELAY_US (1800)
|
||||
|
||||
|
||||
static const struct osi_coex_funcs_t s_osi_coex_funcs_ro = {
|
||||
._magic = OSI_COEX_MAGIC_VALUE,
|
||||
._version = OSI_COEX_VERSION,
|
||||
@ -245,14 +460,6 @@ struct ext_funcs_t ext_funcs_ro = {
|
||||
._esp_intr_free = esp_intr_free_wrapper,
|
||||
._malloc = bt_osi_mem_malloc_internal,
|
||||
._free = bt_osi_mem_free,
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
._hal_uart_start_tx = hci_uart_start_tx_wrapper,
|
||||
._hal_uart_init_cbs = hci_uart_init_cbs_wrapper,
|
||||
._hal_uart_config = hci_uart_config_wrapper,
|
||||
._hal_uart_close = hci_uart_close_wrapper,
|
||||
._hal_uart_blocking_tx = hci_uart_blocking_tx_wrapper,
|
||||
._hal_uart_init = hci_uart_init_wrapper,
|
||||
#endif //CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
._task_create = task_create_wrapper,
|
||||
._task_delete = task_delete_wrapper,
|
||||
._osi_assert = osi_assert_wrapper,
|
||||
@ -299,83 +506,6 @@ static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status)
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
bool esp_vhci_host_check_send_available(void)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates an mbuf for use by the nimble host.
|
||||
*/
|
||||
static struct os_mbuf *ble_hs_mbuf_gen_pkt(uint16_t leading_space)
|
||||
{
|
||||
struct os_mbuf *om;
|
||||
int rc;
|
||||
|
||||
om = os_msys_get_pkthdr(0, 0);
|
||||
if (om == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (om->om_omp->omp_databuf_len < leading_space) {
|
||||
rc = os_mbuf_free_chain(om);
|
||||
assert(rc == 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
om->om_data += leading_space;
|
||||
|
||||
return om;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates an mbuf suitable for an HCI ACL data packet.
|
||||
*
|
||||
* @return An empty mbuf on success; null on memory
|
||||
* exhaustion.
|
||||
*/
|
||||
struct os_mbuf *ble_hs_mbuf_acl_pkt(void)
|
||||
{
|
||||
return ble_hs_mbuf_gen_pkt(4 + 1);
|
||||
}
|
||||
|
||||
void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (*(data) == DATA_TYPE_COMMAND) {
|
||||
struct ble_hci_cmd *cmd = NULL;
|
||||
cmd = (struct ble_hci_cmd *) ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_CMD);
|
||||
assert(cmd);
|
||||
memcpy((uint8_t *)cmd, data + 1, len - 1);
|
||||
ble_hci_trans_hs_cmd_tx((uint8_t *)cmd);
|
||||
}
|
||||
|
||||
if (*(data) == DATA_TYPE_ACL) {
|
||||
struct os_mbuf *om = os_msys_get_pkthdr(len, ACL_DATA_MBUF_LEADINGSPCAE);
|
||||
assert(om);
|
||||
assert(os_mbuf_append(om, &data[1], len - 1) == 0);
|
||||
ble_hci_trans_hs_acl_tx(om);
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth, void *param, uint32_t prio, void *task_handle, uint32_t core_id)
|
||||
{
|
||||
return (uint32_t)xTaskCreatePinnedToCore(task_func, name, stack_depth, param, prio, task_handle, (core_id < CONFIG_FREERTOS_NUMBER_OF_CORES ? core_id : tskNO_AFFINITY));
|
||||
@ -405,56 +535,6 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no)
|
||||
{
|
||||
hci_uart_start_tx(uart_no);
|
||||
}
|
||||
|
||||
static int hci_uart_init_cbs_wrapper(int uart_no, hci_uart_tx_char tx_func,
|
||||
hci_uart_tx_done tx_done, hci_uart_rx_char rx_func, void *arg)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_init_cbs(uart_no, tx_func, tx_done, rx_func, arg);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int hci_uart_config_wrapper(int port_num, int32_t baud_rate, uint8_t data_bits,
|
||||
uint8_t stop_bits,uart_parity_t parity,
|
||||
uart_hw_flowcontrol_t flow_ctl)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_config(port_num, baud_rate, data_bits, stop_bits, parity, flow_ctl);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int hci_uart_close_wrapper(int uart_no)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_close(uart_no);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void hci_uart_blocking_tx_wrapper(int port, uint8_t data)
|
||||
{
|
||||
//This function is nowhere to use.
|
||||
}
|
||||
|
||||
static int hci_uart_init_wrapper(int uart_no, void *cfg)
|
||||
{
|
||||
//This function is nowhere to use.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
|
||||
static int ble_hci_unregistered_hook(void*, void*)
|
||||
{
|
||||
ESP_LOGD(NIMBLE_PORT_LOG_TAG,"%s ble hci rx_evt is not registered.",__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler, void *arg, void **ret_handle_in)
|
||||
{
|
||||
int rc = esp_intr_alloc(source, flags | ESP_INTR_FLAG_IRAM, handler, arg, (intr_handle_t *)ret_handle_in);
|
||||
@ -632,6 +712,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
esp_err_t ret = ESP_OK;
|
||||
ble_npl_count_info_t npl_info;
|
||||
ble_rtc_slow_clk_src_t rtc_clk_src;
|
||||
uint8_t hci_transport_mode;
|
||||
|
||||
memset(&npl_info, 0, sizeof(ble_npl_count_info_t));
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
|
||||
@ -719,20 +800,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble rom commit:[%s]", r_ble_controller_get_rom_compile_version());
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
uint8_t buffers = 0;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_HCI;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
ret = ble_log_init_async(bt_controller_log_interface, false, buffers, (uint32_t *)log_bufs_size);
|
||||
#else
|
||||
ret = ble_log_init_async(bt_controller_log_interface, true, buffers, (uint32_t *)log_bufs_size);
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP
|
||||
ret = esp_bt_controller_log_init(log_output_mode);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
|
||||
goto controller_init_err;
|
||||
@ -754,14 +822,23 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
|
||||
ble_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
|
||||
|
||||
ble_hci_trans_cfg_hs((ble_hci_trans_rx_cmd_fn *)ble_hci_unregistered_hook,NULL,
|
||||
(ble_hci_trans_rx_acl_fn *)ble_hci_unregistered_hook,NULL);
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
|
||||
hci_transport_mode = HCI_TRANSPORT_VHCI;
|
||||
#elif CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
hci_transport_mode = HCI_TRANSPORT_UART_NO_DMA;
|
||||
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
|
||||
ret = hci_transport_init(hci_transport_mode);
|
||||
if (ret) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "hci transport init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
return ESP_OK;
|
||||
free_controller:
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
controller_init_err:
|
||||
ble_log_deinit_async();
|
||||
esp_bt_ontroller_log_deinit();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
modem_deint:
|
||||
@ -786,10 +863,11 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_log_deinit_async();
|
||||
esp_bt_ontroller_log_deinit();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
|
||||
@ -1139,30 +1217,6 @@ uint8_t esp_ble_get_chip_rev_version(void)
|
||||
return efuse_ll_get_chip_wafer_version_minor();
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
if (end) {
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void esp_ble_controller_log_dump_all(bool output)
|
||||
{
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
BT_ASSERT_PRINT("\r\n[DUMP_START:");
|
||||
ble_log_async_output_dump_all(output);
|
||||
BT_ASSERT_PRINT(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED)
|
||||
#if CONFIG_BT_LE_SM_LEGACY || CONFIG_BT_LE_SM_SC
|
||||
#define BLE_SM_KEY_ERR 0x17
|
||||
|
@ -28,7 +28,6 @@ extern "C" {
|
||||
#else
|
||||
#define BLE_LL_SCAN_PHY_NUMBER_N (1)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_BT_LE_MAX_PERIODIC_ADVERTISER_LIST MYNEWT_VAL(BLE_MAX_PERIODIC_ADVERTISER_LIST)
|
||||
#define DEFAULT_BT_LE_MAX_PERIODIC_SYNCS MYNEWT_VAL(BLE_MAX_PERIODIC_SYNCS)
|
||||
#define DEFAULT_BT_LE_MAX_CONNECTIONS MYNEWT_VAL(BLE_MAX_CONNECTIONS)
|
||||
@ -152,6 +151,20 @@ extern "C" {
|
||||
#else
|
||||
#define DEFAULT_BT_LE_ROLE_OBSERVER (0)
|
||||
#endif
|
||||
#if defined (CONFIG_BT_LE_HCI_UART_FLOWCTRL)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (CONFIG_BT_LE_HCI_UART_FLOWCTRL)
|
||||
#if DEFAULT_BT_LE_HCI_UART_FLOW_CTRL
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (CONFIG_BT_LE_HCI_UART_CTS_PIN)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (CONFIG_BT_LE_HCI_UART_RTS_PIN)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (-1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
|
||||
#endif
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (-1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF
|
||||
@ -192,8 +205,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_UART_DATA_BITS (UART_DATA_8_BITS)
|
||||
#define DEFAULT_BT_LE_HCI_UART_STOP_BITS (UART_STOP_BITS_1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_PARITY (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_TASK_STACK_SIZE (CONFIG_BT_LE_HCI_UART_TASK_STACK_SIZE)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_TX_PIN (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RX_PIN (0)
|
||||
@ -202,8 +213,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_UART_DATA_BITS (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_STOP_BITS (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_PARITY (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_TASK_STACK_SIZE (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#endif
|
||||
|
||||
/* Unchanged configuration */
|
||||
@ -232,7 +241,7 @@ extern "C" {
|
||||
#define RTC_FREQ_N (32000) /* in Hz */
|
||||
#endif // CONFIG_XTAL_FREQ_26
|
||||
|
||||
#define BLE_LL_TX_PWR_DBM_N (9)
|
||||
#define BLE_LL_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF)
|
||||
|
||||
|
||||
#define RUN_BQB_TEST (0)
|
||||
|
@ -115,7 +115,7 @@ do{\
|
||||
} while(0)
|
||||
|
||||
#define OSI_FUNCS_TIME_BLOCKING 0xffffffff
|
||||
#define OSI_VERSION 0x00010008
|
||||
#define OSI_VERSION 0x00010009
|
||||
#define OSI_MAGIC_VALUE 0xFADEBEAD
|
||||
|
||||
/* Types definition
|
||||
@ -142,15 +142,24 @@ typedef struct {
|
||||
|
||||
typedef void (* osi_intr_handler)(void);
|
||||
|
||||
typedef struct {
|
||||
int source; /*!< ISR source */
|
||||
int flags; /*!< ISR alloc flag */
|
||||
void (*fn)(void *); /*!< ISR function */
|
||||
void *arg; /*!< ISR function args*/
|
||||
intr_handle_t *handle; /*!< ISR handle */
|
||||
esp_err_t ret;
|
||||
} btdm_isr_alloc_t;
|
||||
|
||||
/* OSI function */
|
||||
struct osi_funcs_t {
|
||||
uint32_t _magic;
|
||||
uint32_t _version;
|
||||
void (*_interrupt_set)(int cpu_no, int intr_source, int interrupt_no, int interrpt_prio);
|
||||
void (*_interrupt_clear)(int interrupt_source, int interrupt_no);
|
||||
void (*_interrupt_handler_set)(int interrupt_no, intr_handler_t fn, void *arg);
|
||||
void (*_interrupt_disable)(void);
|
||||
void (*_interrupt_restore)(void);
|
||||
int (* _interrupt_alloc)(int cpu_id, int source, intr_handler_t handler, void *arg, void **ret_handle);
|
||||
int (* _interrupt_free)(void *handle);
|
||||
void (*_interrupt_handler_set_rsv)(int interrupt_no, intr_handler_t fn, void *arg);
|
||||
void (*_global_intr_disable)(void);
|
||||
void (*_global_intr_restore)(void);
|
||||
void (*_task_yield)(void);
|
||||
void (*_task_yield_from_isr)(void);
|
||||
void *(*_semphr_create)(uint32_t max, uint32_t init);
|
||||
@ -195,8 +204,8 @@ struct osi_funcs_t {
|
||||
uint32_t (* _coex_schm_interval_get)(void);
|
||||
uint8_t (* _coex_schm_curr_period_get)(void);
|
||||
void *(* _coex_schm_curr_phase_get)(void);
|
||||
void (* _interrupt_on)(int intr_num);
|
||||
void (* _interrupt_off)(int intr_num);
|
||||
int (* _interrupt_enable)(void *handle);
|
||||
int (* _interrupt_disable)(void *handle);
|
||||
void (* _esp_hw_power_down)(void);
|
||||
void (* _esp_hw_power_up)(void);
|
||||
void (* _ets_backup_dma_copy)(uint32_t reg, uint32_t mem_addr, uint32_t num, bool to_rem);
|
||||
@ -277,11 +286,10 @@ extern uint32_t _bt_controller_data_end;
|
||||
/* Local Function Declare
|
||||
*********************************************************************
|
||||
*/
|
||||
static void interrupt_set_wrapper(int cpu_no, int intr_source, int intr_num, int intr_prio);
|
||||
static void interrupt_clear_wrapper(int intr_source, int intr_num);
|
||||
static void interrupt_handler_set_wrapper(int n, intr_handler_t fn, void *arg);
|
||||
static void interrupt_disable(void);
|
||||
static void interrupt_restore(void);
|
||||
static int interrupt_alloc_wrapper(int cpu_id, int source, intr_handler_t handler, void *arg, void **ret_handle);
|
||||
static int interrupt_free_wrapper(void *handle);
|
||||
static void global_interrupt_disable(void);
|
||||
static void global_interrupt_restore(void);
|
||||
static void task_yield_from_isr(void);
|
||||
static void *semphr_create_wrapper(uint32_t max, uint32_t init);
|
||||
static void semphr_delete_wrapper(void *semphr);
|
||||
@ -319,8 +327,8 @@ static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status);
|
||||
static uint32_t coex_schm_interval_get_wrapper(void);
|
||||
static uint8_t coex_schm_curr_period_get_wrapper(void);
|
||||
static void * coex_schm_curr_phase_get_wrapper(void);
|
||||
static void interrupt_on_wrapper(int intr_num);
|
||||
static void interrupt_off_wrapper(int intr_num);
|
||||
static int interrupt_enable_wrapper(void *handle);
|
||||
static int interrupt_disable_wrapper(void *handle);
|
||||
static void btdm_hw_mac_power_up_wrapper(void);
|
||||
static void btdm_hw_mac_power_down_wrapper(void);
|
||||
static void btdm_backup_dma_copy_wrapper(uint32_t reg, uint32_t mem_addr, uint32_t num, bool to_mem);
|
||||
@ -341,11 +349,11 @@ static void bt_controller_deinit_internal(void);
|
||||
static const struct osi_funcs_t osi_funcs_ro = {
|
||||
._magic = OSI_MAGIC_VALUE,
|
||||
._version = OSI_VERSION,
|
||||
._interrupt_set = interrupt_set_wrapper,
|
||||
._interrupt_clear = interrupt_clear_wrapper,
|
||||
._interrupt_handler_set = interrupt_handler_set_wrapper,
|
||||
._interrupt_disable = interrupt_disable,
|
||||
._interrupt_restore = interrupt_restore,
|
||||
._interrupt_alloc = interrupt_alloc_wrapper,
|
||||
._interrupt_free = interrupt_free_wrapper,
|
||||
._interrupt_handler_set_rsv = NULL,
|
||||
._global_intr_disable = global_interrupt_disable,
|
||||
._global_intr_restore = global_interrupt_restore,
|
||||
._task_yield = vPortYield,
|
||||
._task_yield_from_isr = task_yield_from_isr,
|
||||
._semphr_create = semphr_create_wrapper,
|
||||
@ -390,8 +398,8 @@ static const struct osi_funcs_t osi_funcs_ro = {
|
||||
._coex_schm_interval_get = coex_schm_interval_get_wrapper,
|
||||
._coex_schm_curr_period_get = coex_schm_curr_period_get_wrapper,
|
||||
._coex_schm_curr_phase_get = coex_schm_curr_phase_get_wrapper,
|
||||
._interrupt_on = interrupt_on_wrapper,
|
||||
._interrupt_off = interrupt_off_wrapper,
|
||||
._interrupt_enable = interrupt_enable_wrapper,
|
||||
._interrupt_disable = interrupt_disable_wrapper,
|
||||
._esp_hw_power_down = btdm_hw_mac_power_down_wrapper,
|
||||
._esp_hw_power_up = btdm_hw_mac_power_up_wrapper,
|
||||
._ets_backup_dma_copy = btdm_backup_dma_copy_wrapper,
|
||||
@ -478,35 +486,44 @@ static inline void esp_bt_power_domain_off(void)
|
||||
esp_wifi_bt_power_domain_off();
|
||||
}
|
||||
|
||||
static void interrupt_set_wrapper(int cpu_no, int intr_source, int intr_num, int intr_prio)
|
||||
static void btdm_intr_alloc(void *arg)
|
||||
{
|
||||
esp_rom_route_intr_matrix(cpu_no, intr_source, intr_num);
|
||||
#if __riscv
|
||||
esprv_int_set_priority(intr_num, intr_prio);
|
||||
esprv_int_set_type(intr_num, 0);
|
||||
btdm_isr_alloc_t *p = arg;
|
||||
p->ret = esp_intr_alloc(p->source, p->flags, p->fn, p->arg, p->handle);
|
||||
}
|
||||
|
||||
static int interrupt_alloc_wrapper(int cpu_id, int source, intr_handler_t handler, void *arg, void **ret_handle)
|
||||
{
|
||||
btdm_isr_alloc_t p;
|
||||
p.source = source;
|
||||
p.flags = ESP_INTR_FLAG_LEVEL3 | ESP_INTR_FLAG_IRAM;
|
||||
p.fn = handler;
|
||||
p.arg = arg;
|
||||
p.handle = (intr_handle_t *)ret_handle;
|
||||
#if CONFIG_FREERTOS_UNICORE
|
||||
btdm_intr_alloc(&p);
|
||||
#else
|
||||
esp_ipc_call_blocking(cpu_id, btdm_intr_alloc, &p);
|
||||
#endif
|
||||
return p.ret;
|
||||
}
|
||||
|
||||
static void interrupt_clear_wrapper(int intr_source, int intr_num)
|
||||
static int interrupt_free_wrapper(void *handle)
|
||||
{
|
||||
return esp_intr_free((intr_handle_t)handle);
|
||||
}
|
||||
|
||||
static void interrupt_handler_set_wrapper(int n, intr_handler_t fn, void *arg)
|
||||
static int interrupt_enable_wrapper(void *handle)
|
||||
{
|
||||
esp_cpu_intr_set_handler(n, fn, arg);
|
||||
return esp_intr_enable((intr_handle_t)handle);
|
||||
}
|
||||
|
||||
static void interrupt_on_wrapper(int intr_num)
|
||||
static int interrupt_disable_wrapper(void *handle)
|
||||
{
|
||||
esp_cpu_intr_enable(1 << intr_num);
|
||||
return esp_intr_disable((intr_handle_t)handle);
|
||||
}
|
||||
|
||||
static void interrupt_off_wrapper(int intr_num)
|
||||
{
|
||||
esp_cpu_intr_disable(1<<intr_num);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR interrupt_disable(void)
|
||||
static void IRAM_ATTR global_interrupt_disable(void)
|
||||
{
|
||||
if (xPortInIsrContext()) {
|
||||
portENTER_CRITICAL_ISR(&global_int_mux);
|
||||
@ -515,7 +532,7 @@ static void IRAM_ATTR interrupt_disable(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void IRAM_ATTR interrupt_restore(void)
|
||||
static void IRAM_ATTR global_interrupt_restore(void)
|
||||
{
|
||||
if (xPortInIsrContext()) {
|
||||
portEXIT_CRITICAL_ISR(&global_int_mux);
|
||||
|
@ -2,15 +2,15 @@
|
||||
menu "HCI Config"
|
||||
|
||||
choice BT_LE_HCI_INTERFACE
|
||||
prompt "Select HCI interface"
|
||||
prompt "HCI mode"
|
||||
default BT_LE_HCI_INTERFACE_USE_RAM
|
||||
|
||||
config BT_LE_HCI_INTERFACE_USE_RAM
|
||||
bool "ram"
|
||||
bool "VHCI"
|
||||
help
|
||||
Use RAM as HCI interface
|
||||
config BT_LE_HCI_INTERFACE_USE_UART
|
||||
bool "uart"
|
||||
bool "UART(H4)"
|
||||
help
|
||||
Use UART as HCI interface
|
||||
endchoice
|
||||
@ -73,12 +73,26 @@ menu "HCI Config"
|
||||
UART_PARITY_ODD
|
||||
endchoice
|
||||
|
||||
config BT_LE_HCI_UART_TASK_STACK_SIZE
|
||||
int "HCI uart task stack size"
|
||||
depends on BT_LE_HCI_INTERFACE_USE_UART
|
||||
default 1000
|
||||
config BT_LE_HCI_UART_RX_BUFFER_SIZE
|
||||
int "The size of rx ring buffer memory"
|
||||
depends on !BT_LE_HCI_INTERFACE_USE_RAM
|
||||
default 512
|
||||
help
|
||||
Set the size of uart task stack
|
||||
The size of rx ring buffer memory
|
||||
|
||||
config BT_LE_HCI_UART_TX_BUFFER_SIZE
|
||||
int "The size of tx ring buffer memory"
|
||||
depends on !BT_LE_HCI_INTERFACE_USE_RAM
|
||||
default 256
|
||||
help
|
||||
The size of tx ring buffer memory
|
||||
|
||||
config BT_LE_HCI_TRANS_TASK_STACK_SIZE
|
||||
int "HCI transport task stack size"
|
||||
depends on !BT_LE_HCI_INTERFACE_USE_RAM
|
||||
default 1024
|
||||
help
|
||||
This configures stack size of hci transport task
|
||||
endmenu
|
||||
|
||||
config BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
|
||||
@ -365,7 +379,6 @@ config BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
bool "Override TinyCrypt with mbedTLS for crypto computations"
|
||||
default y
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
select MBEDTLS_ECP_RESTARTABLE
|
||||
select MBEDTLS_CMAC_C
|
||||
help
|
||||
Enable this option to choose mbedTLS instead of TinyCrypt for crypto
|
||||
|
@ -15,7 +15,9 @@
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
#include "nimble/nimble_port.h"
|
||||
#endif // CONFIG_BT_NIMBLE_ENABLED
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
#include "esp_private/esp_modem_clock.h"
|
||||
|
||||
@ -28,7 +30,7 @@
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
|
||||
#include "nimble/nimble_npl_os.h"
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "esp_hci_transport.h"
|
||||
#include "os/endian.h"
|
||||
|
||||
#include "esp_bt.h"
|
||||
@ -37,7 +39,6 @@
|
||||
#include "esp_pm.h"
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "hci_uart.h"
|
||||
#include "bt_osi_mem.h"
|
||||
|
||||
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
@ -48,10 +49,6 @@
|
||||
#include "esp_private/sleep_modem.h"
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#include "hci/hci_hal.h"
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
@ -67,16 +64,11 @@
|
||||
#define OSI_COEX_VERSION 0x00010006
|
||||
#define OSI_COEX_MAGIC_VALUE 0xFADEBEAD
|
||||
|
||||
#define EXT_FUNC_VERSION 0x20221122
|
||||
#define EXT_FUNC_VERSION 0x20240422
|
||||
#define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5
|
||||
|
||||
#define BT_ASSERT_PRINT ets_printf
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
/* ACL_DATA_MBUF_LEADINGSPCAE: The leadingspace in user info header for ACL data */
|
||||
#define ACL_DATA_MBUF_LEADINGSPCAE 4
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
/* Types definition
|
||||
************************************************************************
|
||||
*/
|
||||
@ -95,12 +87,6 @@ struct ext_funcs_t {
|
||||
int (*_esp_intr_free)(void **ret_handle);
|
||||
void *(* _malloc)(size_t size);
|
||||
void (*_free)(void *p);
|
||||
void (*_hal_uart_start_tx)(int);
|
||||
int (*_hal_uart_init_cbs)(int, hci_uart_tx_char, hci_uart_tx_done, hci_uart_rx_char, void *);
|
||||
int (*_hal_uart_config)(int, int32_t, uint8_t, uint8_t, uart_parity_t, uart_hw_flowcontrol_t);
|
||||
int (*_hal_uart_close)(int);
|
||||
void (*_hal_uart_blocking_tx)(int, uint8_t);
|
||||
int (*_hal_uart_init)(int, void *);
|
||||
int (* _task_create)(void *task_func, const char *name, uint32_t stack_depth, void *param,
|
||||
uint32_t prio, void *task_handle, uint32_t core_id);
|
||||
void (* _task_delete)(void *task_handle);
|
||||
@ -121,7 +107,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
************************************************************************
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int r_ble_log_deinit_async(void);
|
||||
@ -129,12 +115,12 @@ extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
|
||||
extern void r_ble_log_async_output_dump_all(bool output);
|
||||
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_controller_deinit(void);
|
||||
extern int ble_controller_enable(uint8_t mode);
|
||||
extern int ble_controller_disable(void);
|
||||
extern int r_ble_controller_deinit(void);
|
||||
extern int r_ble_controller_enable(uint8_t mode);
|
||||
extern int r_ble_controller_disable(void);
|
||||
extern int esp_register_ext_funcs (struct ext_funcs_t *);
|
||||
extern void esp_unregister_ext_funcs (void);
|
||||
extern int esp_ble_ll_set_public_addr(const uint8_t *addr);
|
||||
extern int r_esp_ble_ll_set_public_addr(const uint8_t *addr);
|
||||
extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
|
||||
extern void esp_unregister_npl_funcs (void);
|
||||
extern void npl_freertos_mempool_deinit(void);
|
||||
@ -149,15 +135,17 @@ extern void os_msys_deinit(void);
|
||||
extern const sleep_retention_entries_config_t *esp_ble_mac_retention_link_get(uint8_t *size, uint8_t extra);
|
||||
extern void esp_ble_set_wakeup_overhead(uint32_t overhead);
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
extern void esp_ble_change_rtc_freq(uint32_t freq);
|
||||
extern void r_esp_ble_change_rtc_freq(uint32_t freq);
|
||||
extern int ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x,
|
||||
const uint8_t *peer_pub_key_y,
|
||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||
extern int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv);
|
||||
extern int ble_txpwr_set(esp_ble_enhanced_power_type_t power_type, uint16_t handle, int power_level);
|
||||
extern int ble_txpwr_get(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
|
||||
extern int ble_get_npl_element_info(esp_bt_controller_config_t *cfg, ble_npl_count_info_t * npl_info);
|
||||
extern int r_ble_txpwr_set(esp_ble_enhanced_power_type_t power_type, uint16_t handle, int power_level);
|
||||
extern int r_ble_txpwr_get(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
|
||||
extern int r_ble_get_npl_element_info(esp_bt_controller_config_t *cfg, ble_npl_count_info_t * npl_info);
|
||||
extern char *ble_controller_get_compile_version(void);
|
||||
extern int esp_ble_register_bb_funcs(void);
|
||||
extern void esp_ble_unregister_bb_funcs(void);
|
||||
extern uint32_t _bt_bss_start;
|
||||
extern uint32_t _bt_bss_end;
|
||||
extern uint32_t _bt_controller_bss_start;
|
||||
@ -175,16 +163,6 @@ static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status);
|
||||
static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth,
|
||||
void *param, uint32_t prio, void *task_handle, uint32_t core_id);
|
||||
static void task_delete_wrapper(void *task_handle);
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no);
|
||||
static int hci_uart_init_cbs_wrapper(int uart_no, hci_uart_tx_char tx_func,
|
||||
hci_uart_tx_done tx_done, hci_uart_rx_char rx_func, void *arg);
|
||||
static int hci_uart_config_wrapper(int uart_no, int32_t speed, uint8_t databits, uint8_t stopbits,
|
||||
uart_parity_t parity, uart_hw_flowcontrol_t flow_ctl);
|
||||
static int hci_uart_close_wrapper(int uart_no);
|
||||
static void hci_uart_blocking_tx_wrapper(int port, uint8_t data);
|
||||
static int hci_uart_init_wrapper(int uart_no, void *cfg);
|
||||
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
|
||||
void *arg, void **ret_handle_in);
|
||||
static int esp_intr_free_wrapper(void **ret_handle);
|
||||
@ -202,7 +180,6 @@ static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, b
|
||||
*/
|
||||
/* Static variable declare */
|
||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -232,14 +209,6 @@ struct ext_funcs_t ext_funcs_ro = {
|
||||
._esp_intr_free = esp_intr_free_wrapper,
|
||||
._malloc = bt_osi_mem_malloc_internal,
|
||||
._free = bt_osi_mem_free,
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
._hal_uart_start_tx = hci_uart_start_tx_wrapper,
|
||||
._hal_uart_init_cbs = hci_uart_init_cbs_wrapper,
|
||||
._hal_uart_config = hci_uart_config_wrapper,
|
||||
._hal_uart_close = hci_uart_close_wrapper,
|
||||
._hal_uart_blocking_tx = hci_uart_blocking_tx_wrapper,
|
||||
._hal_uart_init = hci_uart_init_wrapper,
|
||||
#endif //CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
._task_create = task_create_wrapper,
|
||||
._task_delete = task_delete_wrapper,
|
||||
._osi_assert = osi_assert_wrapper,
|
||||
@ -284,75 +253,6 @@ static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status)
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
bool esp_vhci_host_check_send_available(void)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct os_mbuf *ble_hs_mbuf_gen_pkt(uint16_t leading_space)
|
||||
{
|
||||
struct os_mbuf *om;
|
||||
int rc;
|
||||
|
||||
om = os_msys_get_pkthdr(0, 0);
|
||||
if (om == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (om->om_omp->omp_databuf_len < leading_space) {
|
||||
rc = os_mbuf_free_chain(om);
|
||||
assert(rc == 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
om->om_data += leading_space;
|
||||
|
||||
return om;
|
||||
}
|
||||
|
||||
struct os_mbuf *ble_hs_mbuf_acl_pkt(void)
|
||||
{
|
||||
return ble_hs_mbuf_gen_pkt(4 + 1);
|
||||
}
|
||||
|
||||
void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (*(data) == DATA_TYPE_COMMAND) {
|
||||
struct ble_hci_cmd *cmd = NULL;
|
||||
cmd = (struct ble_hci_cmd *) ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_CMD);
|
||||
assert(cmd);
|
||||
memcpy((uint8_t *)cmd, data + 1, len - 1);
|
||||
ble_hci_trans_hs_cmd_tx((uint8_t *)cmd);
|
||||
}
|
||||
|
||||
if (*(data) == DATA_TYPE_ACL) {
|
||||
struct os_mbuf *om = os_msys_get_pkthdr(len, ACL_DATA_MBUF_LEADINGSPCAE);
|
||||
assert(om);
|
||||
assert(os_mbuf_append(om, &data[1], len - 1) == 0);
|
||||
ble_hci_trans_hs_acl_tx(om);
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth,
|
||||
void *param, uint32_t prio, void *task_handle, uint32_t core_id)
|
||||
{
|
||||
@ -384,56 +284,6 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no)
|
||||
{
|
||||
hci_uart_start_tx(uart_no);
|
||||
}
|
||||
|
||||
static int hci_uart_init_cbs_wrapper(int uart_no, hci_uart_tx_char tx_func,
|
||||
hci_uart_tx_done tx_done, hci_uart_rx_char rx_func, void *arg)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_init_cbs(uart_no, tx_func, tx_done, rx_func, arg);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int hci_uart_config_wrapper(int port_num, int32_t baud_rate, uint8_t data_bits,
|
||||
uint8_t stop_bits, uart_parity_t parity,
|
||||
uart_hw_flowcontrol_t flow_ctl)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_config(port_num, baud_rate, data_bits, stop_bits, parity, flow_ctl);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int hci_uart_close_wrapper(int uart_no)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_close(uart_no);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void hci_uart_blocking_tx_wrapper(int port, uint8_t data)
|
||||
{
|
||||
//This function is nowhere to use.
|
||||
}
|
||||
|
||||
static int hci_uart_init_wrapper(int uart_no, void *cfg)
|
||||
{
|
||||
//This function is nowhere to use.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
|
||||
static int ble_hci_unregistered_hook(void*, void*)
|
||||
{
|
||||
ESP_LOGD(NIMBLE_PORT_LOG_TAG,"%s ble hci rx_evt is not registered.",__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
|
||||
void *arg, void **ret_handle_in)
|
||||
{
|
||||
@ -690,6 +540,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
esp_err_t ret = ESP_OK;
|
||||
ble_npl_count_info_t npl_info;
|
||||
uint32_t slow_clk_freq = 0;
|
||||
uint8_t hci_transport_mode;
|
||||
|
||||
memset(&npl_info, 0, sizeof(ble_npl_count_info_t));
|
||||
|
||||
@ -723,7 +574,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_mem;
|
||||
}
|
||||
|
||||
ble_get_npl_element_info(cfg, &npl_info);
|
||||
r_ble_get_npl_element_info(cfg, &npl_info);
|
||||
npl_freertos_set_controller_npl_info(&npl_info);
|
||||
if (npl_freertos_mempool_init() != 0) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl mempool init failed");
|
||||
@ -780,13 +631,6 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
coex_init();
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
|
||||
ret = ble_controller_init(cfg);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
@ -804,11 +648,23 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
|
||||
goto controller_init_err;
|
||||
goto modem_deint;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
|
||||
ret = esp_ble_register_bb_funcs();
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "esp_ble_register_bb_funcs failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
esp_ble_change_rtc_freq(slow_clk_freq);
|
||||
ret = r_ble_controller_init(cfg);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
r_esp_ble_change_rtc_freq(slow_clk_freq);
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
@ -825,23 +681,32 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
}
|
||||
ESP_ERROR_CHECK(esp_read_mac((uint8_t *)mac, ESP_MAC_BT));
|
||||
swap_in_place(mac, 6);
|
||||
esp_ble_ll_set_public_addr(mac);
|
||||
r_esp_ble_ll_set_public_addr(mac);
|
||||
|
||||
ble_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
|
||||
|
||||
ble_hci_trans_cfg_hs((ble_hci_trans_rx_cmd_fn *)ble_hci_unregistered_hook,NULL,
|
||||
(ble_hci_trans_rx_acl_fn *)ble_hci_unregistered_hook,NULL);
|
||||
return ESP_OK;
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
|
||||
hci_transport_mode = HCI_TRANSPORT_VHCI;
|
||||
#elif CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
hci_transport_mode = HCI_TRANSPORT_UART_NO_DMA;
|
||||
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
|
||||
ret = hci_transport_init(hci_transport_mode);
|
||||
if (ret) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "hci transport init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
free_controller:
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
os_msys_deinit();
|
||||
r_ble_controller_deinit();
|
||||
modem_deint:
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
controller_init_err:
|
||||
r_ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
os_msys_deinit();
|
||||
ble_controller_deinit();
|
||||
modem_deint:
|
||||
esp_phy_modem_deinit();
|
||||
// modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
@ -864,6 +729,7 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
|
||||
os_msys_deinit();
|
||||
@ -872,10 +738,11 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
// modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
r_ble_controller_deinit();
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
r_ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
/* De-initialize default event queue */
|
||||
@ -920,7 +787,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
coex_enable();
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
|
||||
if (ble_controller_enable(mode) != 0) {
|
||||
if (r_ble_controller_enable(mode) != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
}
|
||||
@ -948,7 +815,7 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "invalid controller state");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
if (ble_controller_disable() != 0) {
|
||||
if (r_ble_controller_disable() != 0) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
@ -1082,7 +949,7 @@ esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_
|
||||
case ESP_BLE_PWR_TYPE_DEFAULT:
|
||||
case ESP_BLE_PWR_TYPE_ADV:
|
||||
case ESP_BLE_PWR_TYPE_SCAN:
|
||||
if (ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
@ -1095,7 +962,7 @@ esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL6:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL7:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL8:
|
||||
if (ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
@ -1115,13 +982,13 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_SCAN:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_INIT:
|
||||
if (ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_ADV:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_CONN:
|
||||
if (ble_txpwr_set(power_type, handle, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(power_type, handle, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
@ -1141,7 +1008,7 @@ esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type)
|
||||
case ESP_BLE_PWR_TYPE_ADV:
|
||||
case ESP_BLE_PWR_TYPE_SCAN:
|
||||
case ESP_BLE_PWR_TYPE_DEFAULT:
|
||||
tx_level = ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
tx_level = r_ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
break;
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL0:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL1:
|
||||
@ -1152,7 +1019,7 @@ esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type)
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL6:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL7:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL8:
|
||||
tx_level = ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type);
|
||||
tx_level = r_ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type);
|
||||
break;
|
||||
default:
|
||||
return ESP_PWR_LVL_INVALID;
|
||||
@ -1174,11 +1041,11 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_SCAN:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_INIT:
|
||||
tx_level = ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
tx_level = r_ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
break;
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_ADV:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_CONN:
|
||||
tx_level = ble_txpwr_get(power_type, handle);
|
||||
tx_level = r_ble_txpwr_get(power_type, handle);
|
||||
break;
|
||||
default:
|
||||
return ESP_PWR_LVL_INVALID;
|
||||
|
@ -129,6 +129,21 @@ extern "C" {
|
||||
#else
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0)
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_BT_LE_HCI_UART_FLOWCTRL)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (CONFIG_BT_LE_HCI_UART_FLOWCTRL)
|
||||
#if DEFAULT_BT_LE_HCI_UART_FLOW_CTRL
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (CONFIG_BT_LE_HCI_UART_CTS_PIN)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (CONFIG_BT_LE_HCI_UART_RTS_PIN)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (-1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
|
||||
#endif
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (-1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF
|
||||
@ -169,8 +184,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_UART_DATA_BITS (UART_DATA_8_BITS)
|
||||
#define DEFAULT_BT_LE_HCI_UART_STOP_BITS (UART_STOP_BITS_1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_PARITY (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_TASK_STACK_SIZE (CONFIG_BT_LE_HCI_UART_TASK_STACK_SIZE)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_TX_PIN (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RX_PIN (0)
|
||||
@ -179,8 +192,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_UART_DATA_BITS (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_STOP_BITS (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_PARITY (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_TASK_STACK_SIZE (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#endif
|
||||
|
||||
/* Unchanged configuration */
|
||||
|
@ -2,19 +2,37 @@
|
||||
menu "HCI Config"
|
||||
|
||||
choice BT_LE_HCI_INTERFACE
|
||||
prompt "Select HCI interface"
|
||||
prompt "HCI mode"
|
||||
default BT_LE_HCI_INTERFACE_USE_RAM
|
||||
|
||||
config BT_LE_HCI_INTERFACE_USE_RAM
|
||||
bool "ram"
|
||||
bool "VHCI"
|
||||
help
|
||||
Use RAM as HCI interface
|
||||
config BT_LE_HCI_INTERFACE_USE_UART
|
||||
bool "uart"
|
||||
bool "UART(H4)"
|
||||
help
|
||||
Use UART as HCI interface
|
||||
endchoice
|
||||
|
||||
choice BT_LE_UART_HCI_MODE_CHOICE
|
||||
prompt "UART HCI mode"
|
||||
depends on BT_LE_HCI_INTERFACE_USE_UART
|
||||
default BT_LE_UART_HCI_NO_DMA_MODE
|
||||
help
|
||||
Specify UART HCI mode: DMA or No DMA
|
||||
|
||||
config BT_LE_UART_HCI_DMA_MODE
|
||||
bool "UHCI(UART with DMA)(EXPERIMENTAL)"
|
||||
help
|
||||
UART HCI Mode with DMA functionality.
|
||||
|
||||
config BT_LE_UART_HCI_NO_DMA_MODE
|
||||
bool "UART(NO DMA)"
|
||||
help
|
||||
UART HCI Mode without DMA functionality.
|
||||
endchoice
|
||||
|
||||
config BT_LE_HCI_UART_PORT
|
||||
int "HCI UART port"
|
||||
depends on BT_LE_HCI_INTERFACE_USE_UART
|
||||
@ -73,12 +91,40 @@ menu "HCI Config"
|
||||
UART_PARITY_ODD
|
||||
endchoice
|
||||
|
||||
config BT_LE_HCI_UART_TASK_STACK_SIZE
|
||||
int "HCI uart task stack size"
|
||||
depends on BT_LE_HCI_INTERFACE_USE_UART
|
||||
default 1000
|
||||
config BT_LE_HCI_UART_RX_BUFFER_SIZE
|
||||
int "The size of rx ring buffer memory"
|
||||
depends on BT_LE_UART_HCI_NO_DMA_MODE
|
||||
default 512
|
||||
help
|
||||
Set the size of uart task stack
|
||||
The size of rx ring buffer memory
|
||||
|
||||
config BT_LE_HCI_UART_TX_BUFFER_SIZE
|
||||
int "The size of tx ring buffer memory"
|
||||
depends on BT_LE_UART_HCI_NO_DMA_MODE
|
||||
default 256
|
||||
help
|
||||
The size of tx ring buffer memory
|
||||
|
||||
config BT_LE_HCI_TRANS_TASK_STACK_SIZE
|
||||
int "HCI transport task stack size"
|
||||
depends on !BT_LE_HCI_INTERFACE_USE_RAM
|
||||
default 1024
|
||||
help
|
||||
This configures stack size of hci transport task
|
||||
|
||||
config BT_LE_HCI_TRANS_RX_MEM_NUM
|
||||
int "The amount of rx memory received at the same time"
|
||||
depends on BT_LE_UART_HCI_DMA_MODE
|
||||
default 3
|
||||
help
|
||||
The amount of rx memory received at the same time
|
||||
|
||||
config BT_LE_HCI_LLDESCS_POOL_NUM
|
||||
int "The amount of lldecs memory for driver dma mode"
|
||||
depends on BT_LE_UART_HCI_DMA_MODE
|
||||
default 20
|
||||
help
|
||||
The amount of lldecs memory for driver dma mode
|
||||
endmenu
|
||||
|
||||
config BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
|
||||
@ -296,6 +342,24 @@ config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Store ble controller logs to flash memory.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
The size of ble controller log partition shall be a multiples of 4K.
|
||||
The name of log partition shall be "bt_ctrl_log".
|
||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -365,7 +429,6 @@ config BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
bool "Override TinyCrypt with mbedTLS for crypto computations"
|
||||
default y
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
select MBEDTLS_ECP_RESTARTABLE
|
||||
select MBEDTLS_CMAC_C
|
||||
help
|
||||
Enable this option to choose mbedTLS instead of TinyCrypt for crypto
|
||||
@ -576,3 +639,53 @@ config BT_LE_CCA_RSSI_THRESH
|
||||
default 20
|
||||
help
|
||||
Power threshold of CCA in unit of -1 dBm.
|
||||
|
||||
choice BT_LE_DFT_TX_POWER_LEVEL_DBM
|
||||
prompt "BLE default Tx power level(dBm)"
|
||||
default BT_LE_DFT_TX_POWER_LEVEL_P9
|
||||
help
|
||||
Specify default Tx power level(dBm).
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N15
|
||||
bool "-15dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N12
|
||||
bool "-12dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N9
|
||||
bool "-9dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N6
|
||||
bool "-6dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N3
|
||||
bool "-3dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N0
|
||||
bool "0dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P3
|
||||
bool "+3dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P6
|
||||
bool "+6dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P9
|
||||
bool "+9dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P12
|
||||
bool "+12dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P15
|
||||
bool "+15dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P18
|
||||
bool "+18dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P20
|
||||
bool "+20dBm"
|
||||
endchoice
|
||||
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF
|
||||
int
|
||||
default -15 if BT_LE_DFT_TX_POWER_LEVEL_N15
|
||||
default -12 if BT_LE_DFT_TX_POWER_LEVEL_N12
|
||||
default -9 if BT_LE_DFT_TX_POWER_LEVEL_N9
|
||||
default -6 if BT_LE_DFT_TX_POWER_LEVEL_N6
|
||||
default -3 if BT_LE_DFT_TX_POWER_LEVEL_N3
|
||||
default 0 if BT_LE_DFT_TX_POWER_LEVEL_N0
|
||||
default 3 if BT_LE_DFT_TX_POWER_LEVEL_P3
|
||||
default 6 if BT_LE_DFT_TX_POWER_LEVEL_P6
|
||||
default 9 if BT_LE_DFT_TX_POWER_LEVEL_P9
|
||||
default 12 if BT_LE_DFT_TX_POWER_LEVEL_P12
|
||||
default 15 if BT_LE_DFT_TX_POWER_LEVEL_P15
|
||||
default 18 if BT_LE_DFT_TX_POWER_LEVEL_P18
|
||||
default 20 if BT_LE_DFT_TX_POWER_LEVEL_P20
|
||||
default 0
|
||||
|
@ -15,7 +15,9 @@
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
#include "nimble/nimble_port.h"
|
||||
#endif // CONFIG_BT_NIMBLE_ENABLED
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
#include "esp_private/esp_modem_clock.h"
|
||||
|
||||
@ -28,7 +30,7 @@
|
||||
#endif // CONFIG_ESP_COEX_ENABLED
|
||||
|
||||
#include "nimble/nimble_npl_os.h"
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "esp_hci_transport.h"
|
||||
#include "os/endian.h"
|
||||
|
||||
#include "esp_bt.h"
|
||||
@ -39,7 +41,6 @@
|
||||
#include "esp_phy_init.h"
|
||||
#endif
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "hci_uart.h"
|
||||
#include "bt_osi_mem.h"
|
||||
|
||||
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
@ -50,10 +51,6 @@
|
||||
#include "esp_private/sleep_modem.h"
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#include "hci/hci_hal.h"
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
@ -69,16 +66,11 @@
|
||||
#define OSI_COEX_VERSION 0x00010006
|
||||
#define OSI_COEX_MAGIC_VALUE 0xFADEBEAD
|
||||
|
||||
#define EXT_FUNC_VERSION 0x20221122
|
||||
#define EXT_FUNC_VERSION 0x20240422
|
||||
#define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5
|
||||
|
||||
#define BT_ASSERT_PRINT ets_printf
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
/* ACL_DATA_MBUF_LEADINGSPCAE: The leadingspace in user info header for ACL data */
|
||||
#define ACL_DATA_MBUF_LEADINGSPCAE 4
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
/* Types definition
|
||||
************************************************************************
|
||||
*/
|
||||
@ -97,12 +89,6 @@ struct ext_funcs_t {
|
||||
int (*_esp_intr_free)(void **ret_handle);
|
||||
void *(* _malloc)(size_t size);
|
||||
void (*_free)(void *p);
|
||||
void (*_hal_uart_start_tx)(int);
|
||||
int (*_hal_uart_init_cbs)(int, hci_uart_tx_char, hci_uart_tx_done, hci_uart_rx_char, void *);
|
||||
int (*_hal_uart_config)(int, int32_t, uint8_t, uint8_t, uart_parity_t, uart_hw_flowcontrol_t);
|
||||
int (*_hal_uart_close)(int);
|
||||
void (*_hal_uart_blocking_tx)(int, uint8_t);
|
||||
int (*_hal_uart_init)(int, void *);
|
||||
int (* _task_create)(void *task_func, const char *name, uint32_t stack_depth, void *param,
|
||||
uint32_t prio, void *task_handle, uint32_t core_id);
|
||||
void (* _task_delete)(void *task_handle);
|
||||
@ -123,7 +109,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
************************************************************************
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int r_ble_log_deinit_async(void);
|
||||
@ -131,12 +117,12 @@ extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
|
||||
extern void r_ble_log_async_output_dump_all(bool output);
|
||||
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_controller_deinit(void);
|
||||
extern int ble_controller_enable(uint8_t mode);
|
||||
extern int ble_controller_disable(void);
|
||||
extern int r_ble_controller_deinit(void);
|
||||
extern int r_ble_controller_enable(uint8_t mode);
|
||||
extern int r_ble_controller_disable(void);
|
||||
extern int esp_register_ext_funcs (struct ext_funcs_t *);
|
||||
extern void esp_unregister_ext_funcs (void);
|
||||
extern int esp_ble_ll_set_public_addr(const uint8_t *addr);
|
||||
extern int r_esp_ble_ll_set_public_addr(const uint8_t *addr);
|
||||
extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
|
||||
extern void esp_unregister_npl_funcs (void);
|
||||
extern void npl_freertos_mempool_deinit(void);
|
||||
@ -149,17 +135,19 @@ extern int os_msys_init(void);
|
||||
extern void os_msys_deinit(void);
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
extern const sleep_retention_entries_config_t *esp_ble_mac_retention_link_get(uint8_t *size, uint8_t extra);
|
||||
extern void esp_ble_set_wakeup_overhead(uint32_t overhead);
|
||||
extern void r_esp_ble_set_wakeup_overhead(uint32_t overhead);
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
extern void esp_ble_change_rtc_freq(uint32_t freq);
|
||||
extern void r_esp_ble_change_rtc_freq(uint32_t freq);
|
||||
extern int ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x,
|
||||
const uint8_t *peer_pub_key_y,
|
||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||
extern int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv);
|
||||
extern int ble_txpwr_set(esp_ble_enhanced_power_type_t power_type, uint16_t handle, int power_level);
|
||||
extern int ble_txpwr_get(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
|
||||
extern int ble_get_npl_element_info(esp_bt_controller_config_t *cfg, ble_npl_count_info_t * npl_info);
|
||||
extern int r_ble_txpwr_set(esp_ble_enhanced_power_type_t power_type, uint16_t handle, int power_level);
|
||||
extern int r_ble_txpwr_get(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
|
||||
extern int r_ble_get_npl_element_info(esp_bt_controller_config_t *cfg, ble_npl_count_info_t * npl_info);
|
||||
extern char *ble_controller_get_compile_version(void);
|
||||
extern int esp_ble_register_bb_funcs(void);
|
||||
extern void esp_ble_unregister_bb_funcs(void);
|
||||
extern uint32_t _bt_bss_start;
|
||||
extern uint32_t _bt_bss_end;
|
||||
extern uint32_t _bt_controller_bss_start;
|
||||
@ -177,16 +165,6 @@ static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status);
|
||||
static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth,
|
||||
void *param, uint32_t prio, void *task_handle, uint32_t core_id);
|
||||
static void task_delete_wrapper(void *task_handle);
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no);
|
||||
static int hci_uart_init_cbs_wrapper(int uart_no, hci_uart_tx_char tx_func,
|
||||
hci_uart_tx_done tx_done, hci_uart_rx_char rx_func, void *arg);
|
||||
static int hci_uart_config_wrapper(int uart_no, int32_t speed, uint8_t databits, uint8_t stopbits,
|
||||
uart_parity_t parity, uart_hw_flowcontrol_t flow_ctl);
|
||||
static int hci_uart_close_wrapper(int uart_no);
|
||||
static void hci_uart_blocking_tx_wrapper(int port, uint8_t data);
|
||||
static int hci_uart_init_wrapper(int uart_no, void *cfg);
|
||||
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
|
||||
void *arg, void **ret_handle_in);
|
||||
static int esp_intr_free_wrapper(void **ret_handle);
|
||||
@ -198,15 +176,215 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||
#endif // #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
/* Static variable declare */
|
||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
||||
enum log_out_mode {
|
||||
LOG_DUMP_MEMORY,
|
||||
LOG_ASYNC_OUT,
|
||||
LOG_STORAGE_TO_FLASH,
|
||||
};
|
||||
|
||||
bool log_is_inited = false;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
uint8_t log_output_mode = LOG_DUMP_MEMORY;
|
||||
#else
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
uint8_t log_output_mode = LOG_STORAGE_TO_FLASH;
|
||||
#else
|
||||
uint8_t log_output_mode = LOG_ASYNC_OUT;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
|
||||
void esp_bt_log_output_mode_set(uint8_t output_mode)
|
||||
{
|
||||
log_output_mode = output_mode;
|
||||
}
|
||||
|
||||
uint8_t esp_bt_log_output_mode_get(void)
|
||||
{
|
||||
return log_output_mode;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
bool task_create;
|
||||
uint8_t buffers = 0;
|
||||
|
||||
if (log_is_inited) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_HCI;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
|
||||
switch (log_output_mode) {
|
||||
case LOG_DUMP_MEMORY:
|
||||
task_create = false;
|
||||
break;
|
||||
case LOG_ASYNC_OUT:
|
||||
case LOG_STORAGE_TO_FLASH:
|
||||
task_create = true;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
esp_bt_ctrl_log_partition_get_and_erase_first_block();
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
|
||||
if (ret == ESP_OK) {
|
||||
log_is_inited = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void esp_bt_ontroller_log_deinit(void)
|
||||
{
|
||||
r_ble_log_deinit_async();
|
||||
log_is_inited = false;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#include "esp_partition.h"
|
||||
#include "hal/wdt_hal.h"
|
||||
|
||||
#define MAX_STORAGE_SIZE (CONFIG_BT_LE_CONTROLLER_LOG_PARTITION_SIZE)
|
||||
#define BLOCK_SIZE (4096)
|
||||
#define THRESHOLD (3072)
|
||||
#define PARTITION_NAME "bt_ctrl_log"
|
||||
|
||||
static const esp_partition_t *log_partition;
|
||||
static uint32_t write_index = 0;
|
||||
static uint32_t next_erase_index = BLOCK_SIZE;
|
||||
static bool block_erased = false;
|
||||
static bool stop_write = false;
|
||||
static bool is_filled = false;
|
||||
|
||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void)
|
||||
{
|
||||
log_partition = NULL;
|
||||
assert(MAX_STORAGE_SIZE % BLOCK_SIZE == 0);
|
||||
// Find the partition map in the partition table
|
||||
log_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, PARTITION_NAME);
|
||||
assert(log_partition != NULL);
|
||||
// Prepare data to be read later using the mapped address
|
||||
ESP_ERROR_CHECK(esp_partition_erase_range(log_partition, 0, BLOCK_SIZE));
|
||||
write_index = 0;
|
||||
next_erase_index = BLOCK_SIZE;
|
||||
block_erased = false;
|
||||
is_filled = false;
|
||||
stop_write = false;
|
||||
}
|
||||
|
||||
static int esp_bt_controller_log_storage(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (len > MAX_STORAGE_SIZE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stop_write) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((write_index) % BLOCK_SIZE) >= THRESHOLD && !block_erased) {
|
||||
// esp_rom_printf("Ers nxt: %d,%d\n", next_erase_index, write_index);
|
||||
esp_partition_erase_range(log_partition, next_erase_index, BLOCK_SIZE);
|
||||
next_erase_index = (next_erase_index + BLOCK_SIZE) % MAX_STORAGE_SIZE;
|
||||
block_erased = true;
|
||||
}
|
||||
|
||||
if (((write_index + len) / BLOCK_SIZE) > (write_index / BLOCK_SIZE)) {
|
||||
block_erased = false;
|
||||
}
|
||||
|
||||
if (write_index + len <= MAX_STORAGE_SIZE) {
|
||||
esp_partition_write(log_partition, write_index, addr, len);
|
||||
write_index = (write_index + len) % MAX_STORAGE_SIZE;
|
||||
} else {
|
||||
uint32_t first_part_len = MAX_STORAGE_SIZE - write_index;
|
||||
esp_partition_write(log_partition, write_index, addr, first_part_len);
|
||||
esp_partition_write(log_partition, 0, addr + first_part_len, len - first_part_len);
|
||||
write_index = len - first_part_len;
|
||||
is_filled = true;
|
||||
// esp_rom_printf("old idx: %d,%d\n",next_erase_index, write_index);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
{
|
||||
esp_partition_mmap_handle_t mmap_handle;
|
||||
uint32_t read_index;
|
||||
const void *mapped_ptr;
|
||||
const uint8_t *buffer;
|
||||
uint32_t print_len;
|
||||
uint32_t max_print_len;
|
||||
esp_err_t err;
|
||||
|
||||
print_len = 0;
|
||||
max_print_len = 4096;
|
||||
err = esp_partition_mmap(log_partition, 0, MAX_STORAGE_SIZE, ESP_PARTITION_MMAP_DATA, &mapped_ptr, &mmap_handle);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE("FLASH", "Mmap failed: %s", esp_err_to_name(err));
|
||||
return;
|
||||
}
|
||||
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
r_ble_log_async_output_dump_all(true);
|
||||
esp_bt_ontroller_log_deinit();
|
||||
stop_write = true;
|
||||
|
||||
buffer = (const uint8_t *)mapped_ptr;
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
if (is_filled) {
|
||||
read_index = next_erase_index;
|
||||
} else {
|
||||
read_index = 0;
|
||||
}
|
||||
|
||||
esp_rom_printf("\r\nREAD_CHECK:%ld,%ld,%d\r\n",read_index, write_index, is_filled);
|
||||
esp_rom_printf("\r\n[DUMP_START:");
|
||||
while (read_index != write_index) {
|
||||
esp_rom_printf("%02x ", buffer[read_index]);
|
||||
if (print_len > max_print_len) {
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
print_len = 0;
|
||||
}
|
||||
|
||||
print_len++;
|
||||
read_index = (read_index + 1) % MAX_STORAGE_SIZE;
|
||||
}
|
||||
|
||||
esp_rom_printf(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
esp_partition_munmap(mmap_handle);
|
||||
err = esp_bt_controller_log_init(log_output_mode);
|
||||
assert(err == ESP_OK);
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
/* This variable tells if BLE is running */
|
||||
@ -234,14 +412,6 @@ struct ext_funcs_t ext_funcs_ro = {
|
||||
._esp_intr_free = esp_intr_free_wrapper,
|
||||
._malloc = bt_osi_mem_malloc_internal,
|
||||
._free = bt_osi_mem_free,
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
._hal_uart_start_tx = hci_uart_start_tx_wrapper,
|
||||
._hal_uart_init_cbs = hci_uart_init_cbs_wrapper,
|
||||
._hal_uart_config = hci_uart_config_wrapper,
|
||||
._hal_uart_close = hci_uart_close_wrapper,
|
||||
._hal_uart_blocking_tx = hci_uart_blocking_tx_wrapper,
|
||||
._hal_uart_init = hci_uart_init_wrapper,
|
||||
#endif //CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
._task_create = task_create_wrapper,
|
||||
._task_delete = task_delete_wrapper,
|
||||
._osi_assert = osi_assert_wrapper,
|
||||
@ -286,75 +456,6 @@ static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status)
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
bool esp_vhci_host_check_send_available(void)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct os_mbuf *ble_hs_mbuf_gen_pkt(uint16_t leading_space)
|
||||
{
|
||||
struct os_mbuf *om;
|
||||
int rc;
|
||||
|
||||
om = os_msys_get_pkthdr(0, 0);
|
||||
if (om == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (om->om_omp->omp_databuf_len < leading_space) {
|
||||
rc = os_mbuf_free_chain(om);
|
||||
assert(rc == 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
om->om_data += leading_space;
|
||||
|
||||
return om;
|
||||
}
|
||||
|
||||
struct os_mbuf *ble_hs_mbuf_acl_pkt(void)
|
||||
{
|
||||
return ble_hs_mbuf_gen_pkt(4 + 1);
|
||||
}
|
||||
|
||||
void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (*(data) == DATA_TYPE_COMMAND) {
|
||||
struct ble_hci_cmd *cmd = NULL;
|
||||
cmd = (struct ble_hci_cmd *) ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_CMD);
|
||||
assert(cmd);
|
||||
memcpy((uint8_t *)cmd, data + 1, len - 1);
|
||||
ble_hci_trans_hs_cmd_tx((uint8_t *)cmd);
|
||||
}
|
||||
|
||||
if (*(data) == DATA_TYPE_ACL) {
|
||||
struct os_mbuf *om = os_msys_get_pkthdr(len, ACL_DATA_MBUF_LEADINGSPCAE);
|
||||
assert(om);
|
||||
assert(os_mbuf_append(om, &data[1], len - 1) == 0);
|
||||
ble_hci_trans_hs_acl_tx(om);
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth,
|
||||
void *param, uint32_t prio, void *task_handle, uint32_t core_id)
|
||||
{
|
||||
@ -386,56 +487,6 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no)
|
||||
{
|
||||
hci_uart_start_tx(uart_no);
|
||||
}
|
||||
|
||||
static int hci_uart_init_cbs_wrapper(int uart_no, hci_uart_tx_char tx_func,
|
||||
hci_uart_tx_done tx_done, hci_uart_rx_char rx_func, void *arg)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_init_cbs(uart_no, tx_func, tx_done, rx_func, arg);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int hci_uart_config_wrapper(int port_num, int32_t baud_rate, uint8_t data_bits,
|
||||
uint8_t stop_bits, uart_parity_t parity,
|
||||
uart_hw_flowcontrol_t flow_ctl)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_config(port_num, baud_rate, data_bits, stop_bits, parity, flow_ctl);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int hci_uart_close_wrapper(int uart_no)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_close(uart_no);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void hci_uart_blocking_tx_wrapper(int port, uint8_t data)
|
||||
{
|
||||
//This function is nowhere to use.
|
||||
}
|
||||
|
||||
static int hci_uart_init_wrapper(int uart_no, void *cfg)
|
||||
{
|
||||
//This function is nowhere to use.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
|
||||
static int ble_hci_unregistered_hook(void*, void*)
|
||||
{
|
||||
ESP_LOGD(NIMBLE_PORT_LOG_TAG,"%s ble hci rx_evt is not registered.",__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
|
||||
void *arg, void **ret_handle_in)
|
||||
{
|
||||
@ -551,7 +602,7 @@ static void sleep_modem_ble_mac_modem_state_deinit(void)
|
||||
|
||||
void sleep_modem_light_sleep_overhead_set(uint32_t overhead)
|
||||
{
|
||||
esp_ble_set_wakeup_overhead(overhead);
|
||||
r_esp_ble_set_wakeup_overhead(overhead);
|
||||
}
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
|
||||
@ -577,6 +628,9 @@ esp_err_t controller_sleep_init(void)
|
||||
goto error;
|
||||
}
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#if CONFIG_BT_LE_SLEEP_ENABLE && !CONFIG_MAC_BB_PD
|
||||
#error "CONFIG_MAC_BB_PD required for BLE light sleep to run properly"
|
||||
#endif // CONFIG_BT_LE_SLEEP_ENABLE && !CONFIG_MAC_BB_PD
|
||||
/* Create a new regdma link for BLE related register restoration */
|
||||
rc = sleep_modem_ble_mac_modem_state_init(1);
|
||||
assert(rc == 0);
|
||||
@ -711,9 +765,9 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
esp_err_t ret = ESP_OK;
|
||||
ble_npl_count_info_t npl_info;
|
||||
uint32_t slow_clk_freq = 0;
|
||||
uint8_t hci_transport_mode;
|
||||
|
||||
memset(&npl_info, 0, sizeof(ble_npl_count_info_t));
|
||||
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "invalid controller state");
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
@ -744,7 +798,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_mem;
|
||||
}
|
||||
|
||||
ble_get_npl_element_info(cfg, &npl_info);
|
||||
r_ble_get_npl_element_info(cfg, &npl_info);
|
||||
npl_freertos_set_controller_npl_info(&npl_info);
|
||||
if (npl_freertos_mempool_init() != 0) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl mempool init failed");
|
||||
@ -802,33 +856,26 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
uint8_t buffers = 0;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_HCI;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
ret = r_ble_log_init_async(bt_controller_log_interface, false, buffers, (uint32_t *)log_bufs_size);
|
||||
#else
|
||||
ret = r_ble_log_init_async(bt_controller_log_interface, true, buffers, (uint32_t *)log_bufs_size);
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP
|
||||
ret = esp_bt_controller_log_init(log_output_mode);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
|
||||
ret = ble_controller_init(cfg);
|
||||
ret = esp_ble_register_bb_funcs();
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", ret);
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "esp_ble_register_bb_funcs failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ret = r_ble_controller_init(cfg);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
esp_ble_change_rtc_freq(slow_clk_freq);
|
||||
r_esp_ble_change_rtc_freq(slow_clk_freq);
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
@ -843,23 +890,37 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "controller_sleep_init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
ESP_ERROR_CHECK(esp_read_mac((uint8_t *)mac, ESP_MAC_BT));
|
||||
swap_in_place(mac, 6);
|
||||
esp_ble_ll_set_public_addr(mac);
|
||||
r_esp_ble_ll_set_public_addr(mac);
|
||||
|
||||
ble_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
|
||||
|
||||
ble_hci_trans_cfg_hs((ble_hci_trans_rx_cmd_fn *)ble_hci_unregistered_hook,NULL,
|
||||
(ble_hci_trans_rx_acl_fn *)ble_hci_unregistered_hook,NULL);
|
||||
return ESP_OK;
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
|
||||
hci_transport_mode = HCI_TRANSPORT_VHCI;
|
||||
#elif CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
hci_transport_mode = HCI_TRANSPORT_UART_NO_DMA;
|
||||
#if CONFIG_BT_LE_UART_HCI_DMA_MODE
|
||||
hci_transport_mode = HCI_TRANSPORT_UART_UHCI;
|
||||
#endif // CONFIG_BT_LE_UART_HCI_DMA_MODE
|
||||
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
|
||||
ret = hci_transport_init(hci_transport_mode);
|
||||
if (ret) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "hci transport init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
free_controller:
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
os_msys_deinit();
|
||||
ble_controller_deinit();
|
||||
r_ble_controller_deinit();
|
||||
modem_deint:
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
r_ble_log_deinit_async();
|
||||
esp_bt_ontroller_log_deinit();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
esp_phy_modem_deinit();
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
@ -883,6 +944,7 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
|
||||
os_msys_deinit();
|
||||
@ -891,9 +953,10 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
ble_controller_deinit();
|
||||
r_ble_controller_deinit();
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
r_ble_log_deinit_async();
|
||||
esp_bt_ontroller_log_deinit();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
@ -939,7 +1002,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
coex_enable();
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
|
||||
if (ble_controller_enable(mode) != 0) {
|
||||
if (r_ble_controller_enable(mode) != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
}
|
||||
@ -967,7 +1030,7 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "invalid controller state");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
if (ble_controller_disable() != 0) {
|
||||
if (r_ble_controller_disable() != 0) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
@ -1101,7 +1164,7 @@ esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_
|
||||
case ESP_BLE_PWR_TYPE_DEFAULT:
|
||||
case ESP_BLE_PWR_TYPE_ADV:
|
||||
case ESP_BLE_PWR_TYPE_SCAN:
|
||||
if (ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
@ -1114,7 +1177,7 @@ esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL6:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL7:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL8:
|
||||
if (ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
@ -1134,13 +1197,13 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_SCAN:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_INIT:
|
||||
if (ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_ADV:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_CONN:
|
||||
if (ble_txpwr_set(power_type, handle, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(power_type, handle, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
@ -1160,7 +1223,7 @@ esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type)
|
||||
case ESP_BLE_PWR_TYPE_ADV:
|
||||
case ESP_BLE_PWR_TYPE_SCAN:
|
||||
case ESP_BLE_PWR_TYPE_DEFAULT:
|
||||
tx_level = ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
tx_level = r_ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
break;
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL0:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL1:
|
||||
@ -1171,7 +1234,7 @@ esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type)
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL6:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL7:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL8:
|
||||
tx_level = ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type);
|
||||
tx_level = r_ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type);
|
||||
break;
|
||||
default:
|
||||
return ESP_PWR_LVL_INVALID;
|
||||
@ -1193,11 +1256,11 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_SCAN:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_INIT:
|
||||
tx_level = ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
tx_level = r_ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
break;
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_ADV:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_CONN:
|
||||
tx_level = ble_txpwr_get(power_type, handle);
|
||||
tx_level = r_ble_txpwr_get(power_type, handle);
|
||||
break;
|
||||
default:
|
||||
return ESP_PWR_LVL_INVALID;
|
||||
@ -1213,24 +1276,40 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
if (end) {
|
||||
esp_rom_printf("\n");
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
esp_bt_controller_log_storage(len, addr, end);
|
||||
#endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(1000);
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
|
||||
if (end) {
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
}
|
||||
}
|
||||
|
||||
void esp_ble_controller_log_dump_all(bool output)
|
||||
{
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
BT_ASSERT_PRINT("\r\n[DUMP_START:");
|
||||
r_ble_log_async_output_dump_all(output);
|
||||
BT_ASSERT_PRINT(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
esp_bt_read_ctrl_log_from_flash(output);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
BT_ASSERT_PRINT("\r\n[DUMP_START:");
|
||||
r_ble_log_async_output_dump_all(output);
|
||||
BT_ASSERT_PRINT(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -129,6 +129,21 @@ extern "C" {
|
||||
#else
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0)
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_BT_LE_HCI_UART_FLOWCTRL)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (CONFIG_BT_LE_HCI_UART_FLOWCTRL)
|
||||
#if DEFAULT_BT_LE_HCI_UART_FLOW_CTRL
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (CONFIG_BT_LE_HCI_UART_CTS_PIN)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (CONFIG_BT_LE_HCI_UART_RTS_PIN)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (-1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
|
||||
#endif
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (-1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF
|
||||
@ -169,8 +184,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_UART_DATA_BITS (UART_DATA_8_BITS)
|
||||
#define DEFAULT_BT_LE_HCI_UART_STOP_BITS (UART_STOP_BITS_1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_PARITY (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_TASK_STACK_SIZE (CONFIG_BT_LE_HCI_UART_TASK_STACK_SIZE)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_TX_PIN (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RX_PIN (0)
|
||||
@ -179,8 +192,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_UART_DATA_BITS (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_STOP_BITS (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_PARITY (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_TASK_STACK_SIZE (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#endif
|
||||
|
||||
/* Unchanged configuration */
|
||||
@ -205,7 +216,7 @@ extern "C" {
|
||||
|
||||
#define RTC_FREQ_N (32768) /* in Hz */
|
||||
|
||||
#define BLE_LL_TX_PWR_DBM_N (9)
|
||||
#define BLE_LL_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF)
|
||||
|
||||
|
||||
#define RUN_BQB_TEST (0)
|
||||
|
@ -2,19 +2,37 @@
|
||||
menu "HCI Config"
|
||||
|
||||
choice BT_LE_HCI_INTERFACE
|
||||
prompt "Select HCI interface"
|
||||
prompt "HCI mode"
|
||||
default BT_LE_HCI_INTERFACE_USE_RAM
|
||||
|
||||
config BT_LE_HCI_INTERFACE_USE_RAM
|
||||
bool "ram"
|
||||
bool "VHCI"
|
||||
help
|
||||
Use RAM as HCI interface
|
||||
config BT_LE_HCI_INTERFACE_USE_UART
|
||||
bool "uart"
|
||||
bool "UART(H4)"
|
||||
help
|
||||
Use UART as HCI interface
|
||||
endchoice
|
||||
|
||||
choice BT_LE_UART_HCI_MODE_CHOICE
|
||||
prompt "UART HCI mode"
|
||||
depends on BT_LE_HCI_INTERFACE_USE_UART
|
||||
default BT_LE_UART_HCI_NO_DMA_MODE
|
||||
help
|
||||
Specify UART HCI mode: DMA or No DMA
|
||||
|
||||
config BT_LE_UART_HCI_DMA_MODE
|
||||
bool "UHCI(UART with DMA)(EXPERIMENTAL)"
|
||||
help
|
||||
UART HCI Mode with DMA functionality.
|
||||
|
||||
config BT_LE_UART_HCI_NO_DMA_MODE
|
||||
bool "UART(NO DMA)"
|
||||
help
|
||||
UART HCI Mode without DMA functionality.
|
||||
endchoice
|
||||
|
||||
config BT_LE_HCI_UART_PORT
|
||||
int "HCI UART port"
|
||||
depends on BT_LE_HCI_INTERFACE_USE_UART
|
||||
@ -73,12 +91,40 @@ menu "HCI Config"
|
||||
UART_PARITY_ODD
|
||||
endchoice
|
||||
|
||||
config BT_LE_HCI_UART_TASK_STACK_SIZE
|
||||
int "HCI uart task stack size"
|
||||
depends on BT_LE_HCI_INTERFACE_USE_UART
|
||||
default 1000
|
||||
config BT_LE_HCI_UART_RX_BUFFER_SIZE
|
||||
int "The size of rx ring buffer memory"
|
||||
depends on BT_LE_UART_HCI_NO_DMA_MODE
|
||||
default 512
|
||||
help
|
||||
Set the size of uart task stack
|
||||
The size of rx ring buffer memory
|
||||
|
||||
config BT_LE_HCI_UART_TX_BUFFER_SIZE
|
||||
int "The size of tx ring buffer memory"
|
||||
depends on BT_LE_UART_HCI_NO_DMA_MODE
|
||||
default 256
|
||||
help
|
||||
The size of tx ring buffer memory
|
||||
|
||||
config BT_LE_HCI_TRANS_TASK_STACK_SIZE
|
||||
int "HCI transport task stack size"
|
||||
depends on !BT_LE_HCI_INTERFACE_USE_RAM
|
||||
default 1024
|
||||
help
|
||||
This configures stack size of hci transport task
|
||||
|
||||
config BT_LE_HCI_TRANS_RX_MEM_NUM
|
||||
int "The amount of rx memory received at the same time"
|
||||
depends on BT_LE_UART_HCI_DMA_MODE
|
||||
default 3
|
||||
help
|
||||
The amount of rx memory received at the same time
|
||||
|
||||
config BT_LE_HCI_LLDESCS_POOL_NUM
|
||||
int "The amount of lldecs memory for driver dma mode"
|
||||
depends on BT_LE_UART_HCI_DMA_MODE
|
||||
default 20
|
||||
help
|
||||
The amount of lldecs memory for driver dma mode
|
||||
endmenu
|
||||
|
||||
config BT_LE_CONTROLLER_NPL_OS_PORTING_SUPPORT
|
||||
@ -287,6 +333,24 @@ config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
bool "Store ble controller logs to flash(Experimental)"
|
||||
depends on !BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default n
|
||||
help
|
||||
Store ble controller logs to flash memory.
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_PARTITION_SIZE
|
||||
int "size of ble controller log partition(Multiples of 4K)"
|
||||
depends on BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
default 65536
|
||||
help
|
||||
The size of ble controller log partition shall be a multiples of 4K.
|
||||
The name of log partition shall be "bt_ctrl_log".
|
||||
The partition type shall be ESP_PARTITION_TYPE_DATA.
|
||||
The partition sub_type shall be ESP_PARTITION_SUBTYPE_ANY.
|
||||
|
||||
config BT_LE_LOG_CTRL_BUF1_SIZE
|
||||
int "size of the first BLE controller LOG buffer"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
@ -356,7 +420,6 @@ config BT_LE_CRYPTO_STACK_MBEDTLS
|
||||
bool "Override TinyCrypt with mbedTLS for crypto computations"
|
||||
default y
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
select MBEDTLS_ECP_RESTARTABLE
|
||||
select MBEDTLS_CMAC_C
|
||||
help
|
||||
Enable this option to choose mbedTLS instead of TinyCrypt for crypto
|
||||
@ -568,3 +631,62 @@ config BT_LE_CCA_RSSI_THRESH
|
||||
default 20
|
||||
help
|
||||
Power threshold of CCA in unit of -1 dBm.
|
||||
|
||||
choice BT_LE_DFT_TX_POWER_LEVEL_DBM
|
||||
prompt "BLE default Tx power level(dBm)"
|
||||
default BT_LE_DFT_TX_POWER_LEVEL_P9
|
||||
help
|
||||
Specify default Tx power level(dBm).
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N24
|
||||
bool "-24dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N21
|
||||
bool "-21dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N18
|
||||
bool "-18dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N15
|
||||
bool "-15dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N12
|
||||
bool "-12dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N9
|
||||
bool "-9dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N6
|
||||
bool "-6dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N3
|
||||
bool "-3dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_N0
|
||||
bool "0dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P3
|
||||
bool "+3dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P6
|
||||
bool "+6dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P9
|
||||
bool "+9dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P12
|
||||
bool "+12dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P15
|
||||
bool "+15dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P18
|
||||
bool "+18dBm"
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_P20
|
||||
bool "+20dBm"
|
||||
endchoice
|
||||
|
||||
config BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF
|
||||
int
|
||||
default -24 if BT_LE_DFT_TX_POWER_LEVEL_N24
|
||||
default -21 if BT_LE_DFT_TX_POWER_LEVEL_N21
|
||||
default -18 if BT_LE_DFT_TX_POWER_LEVEL_N18
|
||||
default -15 if BT_LE_DFT_TX_POWER_LEVEL_N15
|
||||
default -12 if BT_LE_DFT_TX_POWER_LEVEL_N12
|
||||
default -9 if BT_LE_DFT_TX_POWER_LEVEL_N9
|
||||
default -6 if BT_LE_DFT_TX_POWER_LEVEL_N6
|
||||
default -3 if BT_LE_DFT_TX_POWER_LEVEL_N3
|
||||
default 0 if BT_LE_DFT_TX_POWER_LEVEL_N0
|
||||
default 3 if BT_LE_DFT_TX_POWER_LEVEL_P3
|
||||
default 6 if BT_LE_DFT_TX_POWER_LEVEL_P6
|
||||
default 9 if BT_LE_DFT_TX_POWER_LEVEL_P9
|
||||
default 12 if BT_LE_DFT_TX_POWER_LEVEL_P12
|
||||
default 15 if BT_LE_DFT_TX_POWER_LEVEL_P15
|
||||
default 18 if BT_LE_DFT_TX_POWER_LEVEL_P18
|
||||
default 20 if BT_LE_DFT_TX_POWER_LEVEL_P20
|
||||
default 0
|
||||
|
@ -15,7 +15,9 @@
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
#include "nimble/nimble_port.h"
|
||||
#endif // CONFIG_BT_NIMBLE_ENABLED
|
||||
#include "nimble/nimble_port_freertos.h"
|
||||
#include "esp_private/esp_modem_clock.h"
|
||||
|
||||
@ -28,7 +30,7 @@
|
||||
#endif // CONFIG_ESP_COEX_ENABLED
|
||||
|
||||
#include "nimble/nimble_npl_os.h"
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#include "esp_hci_transport.h"
|
||||
#include "os/endian.h"
|
||||
|
||||
#include "esp_bt.h"
|
||||
@ -37,7 +39,6 @@
|
||||
#include "esp_pm.h"
|
||||
#include "esp_phy_init.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "hci_uart.h"
|
||||
#include "bt_osi_mem.h"
|
||||
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
@ -45,10 +46,6 @@
|
||||
#include "esp_private/sleep_retention.h"
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#include "hci/hci_hal.h"
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
@ -59,19 +56,14 @@
|
||||
************************************************************************
|
||||
*/
|
||||
#define NIMBLE_PORT_LOG_TAG "BLE_INIT"
|
||||
#define OSI_COEX_VERSION 0x00010006
|
||||
#define OSI_COEX_MAGIC_VALUE 0xFADEBEAD
|
||||
#define OSI_COEX_VERSION 0x00010006
|
||||
#define OSI_COEX_MAGIC_VALUE 0xFADEBEAD
|
||||
|
||||
#define EXT_FUNC_VERSION 0x20221122
|
||||
#define EXT_FUNC_VERSION 0x20240422
|
||||
#define EXT_FUNC_MAGIC_VALUE 0xA5A5A5A5
|
||||
|
||||
#define BT_ASSERT_PRINT ets_printf
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
/* ACL_DATA_MBUF_LEADINGSPCAE: The leadingspace in user info header for ACL data */
|
||||
#define ACL_DATA_MBUF_LEADINGSPCAE 4
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
/* Types definition
|
||||
************************************************************************
|
||||
*/
|
||||
@ -90,12 +82,6 @@ struct ext_funcs_t {
|
||||
int (*_esp_intr_free)(void **ret_handle);
|
||||
void *(* _malloc)(size_t size);
|
||||
void (*_free)(void *p);
|
||||
void (*_hal_uart_start_tx)(int);
|
||||
int (*_hal_uart_init_cbs)(int, hci_uart_tx_char, hci_uart_tx_done, hci_uart_rx_char, void *);
|
||||
int (*_hal_uart_config)(int, int32_t, uint8_t, uint8_t, uart_parity_t, uart_hw_flowcontrol_t);
|
||||
int (*_hal_uart_close)(int);
|
||||
void (*_hal_uart_blocking_tx)(int, uint8_t);
|
||||
int (*_hal_uart_init)(int, void *);
|
||||
int (* _task_create)(void *task_func, const char *name, uint32_t stack_depth, void *param,
|
||||
uint32_t prio, void *task_handle, uint32_t core_id);
|
||||
void (* _task_delete)(void *task_handle);
|
||||
@ -115,7 +101,7 @@ typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
************************************************************************
|
||||
*/
|
||||
extern int ble_osi_coex_funcs_register(struct osi_coex_funcs_t *coex_funcs);
|
||||
extern int ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
extern int r_ble_controller_init(esp_bt_controller_config_t *cfg);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int r_ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create, uint8_t buffers, uint32_t *bufs_size);
|
||||
extern int r_ble_log_deinit_async(void);
|
||||
@ -123,35 +109,37 @@ extern void r_ble_log_async_select_dump_buffers(uint8_t buffers);
|
||||
extern void r_ble_log_async_output_dump_all(bool output);
|
||||
extern void esp_panic_handler_reconfigure_wdts(uint32_t timeout_ms);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_controller_deinit(void);
|
||||
extern int ble_controller_enable(uint8_t mode);
|
||||
extern int ble_controller_disable(void);
|
||||
extern int r_ble_controller_deinit(void);
|
||||
extern int r_ble_controller_enable(uint8_t mode);
|
||||
extern int r_ble_controller_disable(void);
|
||||
extern int esp_register_ext_funcs (struct ext_funcs_t *);
|
||||
extern void esp_unregister_ext_funcs (void);
|
||||
extern int esp_ble_ll_set_public_addr(const uint8_t *addr);
|
||||
extern int r_esp_ble_ll_set_public_addr(const uint8_t *addr);
|
||||
extern int esp_register_npl_funcs (struct npl_funcs_t *p_npl_func);
|
||||
extern void esp_unregister_npl_funcs (void);
|
||||
extern void npl_freertos_mempool_deinit(void);
|
||||
extern uint32_t r_os_cputime_get32(void);
|
||||
extern uint32_t r_os_cputime_ticks_to_usecs(uint32_t ticks);
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
extern const sleep_retention_entries_config_t *esp_ble_mac_retention_link_get(uint8_t *size, uint8_t extra);
|
||||
extern void esp_ble_set_wakeup_overhead(uint32_t overhead);
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
extern void esp_ble_change_rtc_freq(uint32_t freq);
|
||||
extern void r_ble_lll_rfmgmt_set_sleep_cb(void *s_cb, void *w_cb, void *s_arg,
|
||||
void *w_arg, uint32_t us_to_enabled);
|
||||
extern void r_ble_rtc_wake_up_state_clr(void);
|
||||
extern int os_msys_init(void);
|
||||
extern void os_msys_deinit(void);
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
extern const sleep_retention_entries_config_t *esp_ble_mac_retention_link_get(uint8_t *size, uint8_t extra);
|
||||
extern void r_esp_ble_set_wakeup_overhead(uint32_t overhead);
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
extern void r_esp_ble_change_rtc_freq(uint32_t freq);
|
||||
extern int ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x,
|
||||
const uint8_t *peer_pub_key_y,
|
||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||
extern int ble_sm_alg_gen_key_pair(uint8_t *pub, uint8_t *priv);
|
||||
extern int ble_txpwr_set(esp_ble_enhanced_power_type_t power_type, uint16_t handle, int power_level);
|
||||
extern int ble_txpwr_get(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
|
||||
extern int ble_get_npl_element_info(esp_bt_controller_config_t *cfg, ble_npl_count_info_t * npl_info);
|
||||
extern int r_ble_txpwr_set(esp_ble_enhanced_power_type_t power_type, uint16_t handle, int power_level);
|
||||
extern int r_ble_txpwr_get(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
|
||||
extern int r_ble_get_npl_element_info(esp_bt_controller_config_t *cfg, ble_npl_count_info_t * npl_info);
|
||||
extern char *ble_controller_get_compile_version(void);
|
||||
extern int esp_ble_register_bb_funcs(void);
|
||||
extern void esp_ble_unregister_bb_funcs(void);
|
||||
extern uint32_t _bt_bss_start;
|
||||
extern uint32_t _bt_bss_end;
|
||||
extern uint32_t _bt_controller_bss_start;
|
||||
@ -169,16 +157,6 @@ static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status);
|
||||
static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth,
|
||||
void *param, uint32_t prio, void *task_handle, uint32_t core_id);
|
||||
static void task_delete_wrapper(void *task_handle);
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no);
|
||||
static int hci_uart_init_cbs_wrapper(int uart_no, hci_uart_tx_char tx_func,
|
||||
hci_uart_tx_done tx_done, hci_uart_rx_char rx_func, void *arg);
|
||||
static int hci_uart_config_wrapper(int uart_no, int32_t speed, uint8_t databits, uint8_t stopbits,
|
||||
uart_parity_t parity, uart_hw_flowcontrol_t flow_ctl);
|
||||
static int hci_uart_close_wrapper(int uart_no);
|
||||
static void hci_uart_blocking_tx_wrapper(int port, uint8_t data);
|
||||
static int hci_uart_init_wrapper(int uart_no, void *cfg);
|
||||
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
|
||||
void *arg, void **ret_handle_in);
|
||||
static int esp_intr_free_wrapper(void **ret_handle);
|
||||
@ -190,15 +168,214 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
const uint8_t *our_priv_key, uint8_t *out_dhkey);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void);
|
||||
#endif // #if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
/* Static variable declare */
|
||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
const static uint32_t log_bufs_size[] = {CONFIG_BT_LE_LOG_CTRL_BUF1_SIZE, CONFIG_BT_LE_LOG_HCI_BUF_SIZE, CONFIG_BT_LE_LOG_CTRL_BUF2_SIZE};
|
||||
enum log_out_mode {
|
||||
LOG_DUMP_MEMORY,
|
||||
LOG_ASYNC_OUT,
|
||||
LOG_STORAGE_TO_FLASH,
|
||||
};
|
||||
|
||||
bool log_is_inited = false;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
uint8_t log_output_mode = LOG_DUMP_MEMORY;
|
||||
#else
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
uint8_t log_output_mode = LOG_STORAGE_TO_FLASH;
|
||||
#else
|
||||
uint8_t log_output_mode = LOG_ASYNC_OUT;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
|
||||
void esp_bt_log_output_mode_set(uint8_t output_mode)
|
||||
{
|
||||
log_output_mode = output_mode;
|
||||
}
|
||||
|
||||
uint8_t esp_bt_log_output_mode_get(void)
|
||||
{
|
||||
return log_output_mode;
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_controller_log_init(uint8_t log_output_mode)
|
||||
{
|
||||
esp_err_t ret = ESP_OK;
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
bool task_create;
|
||||
uint8_t buffers = 0;
|
||||
|
||||
if (log_is_inited) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_HCI;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
|
||||
switch (log_output_mode) {
|
||||
case LOG_DUMP_MEMORY:
|
||||
task_create = false;
|
||||
break;
|
||||
case LOG_ASYNC_OUT:
|
||||
case LOG_STORAGE_TO_FLASH:
|
||||
task_create = true;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
esp_bt_ctrl_log_partition_get_and_erase_first_block();
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
ret = r_ble_log_init_async(bt_controller_log_interface, task_create, buffers, (uint32_t *)log_bufs_size);
|
||||
if (ret == ESP_OK) {
|
||||
log_is_inited = true;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void esp_bt_ontroller_log_deinit(void)
|
||||
{
|
||||
r_ble_log_deinit_async();
|
||||
log_is_inited = false;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#include "esp_partition.h"
|
||||
#include "hal/wdt_hal.h"
|
||||
|
||||
#define MAX_STORAGE_SIZE (CONFIG_BT_LE_CONTROLLER_LOG_PARTITION_SIZE)
|
||||
#define BLOCK_SIZE (4096)
|
||||
#define THRESHOLD (3072)
|
||||
#define PARTITION_NAME "bt_ctrl_log"
|
||||
|
||||
static const esp_partition_t *log_partition;
|
||||
static uint32_t write_index = 0;
|
||||
static uint32_t next_erase_index = BLOCK_SIZE;
|
||||
static bool block_erased = false;
|
||||
static bool stop_write = false;
|
||||
static bool is_filled = false;
|
||||
|
||||
static void esp_bt_ctrl_log_partition_get_and_erase_first_block(void)
|
||||
{
|
||||
log_partition = NULL;
|
||||
assert(MAX_STORAGE_SIZE % BLOCK_SIZE == 0);
|
||||
// Find the partition map in the partition table
|
||||
log_partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, PARTITION_NAME);
|
||||
assert(log_partition != NULL);
|
||||
// Prepare data to be read later using the mapped address
|
||||
ESP_ERROR_CHECK(esp_partition_erase_range(log_partition, 0, BLOCK_SIZE));
|
||||
write_index = 0;
|
||||
next_erase_index = BLOCK_SIZE;
|
||||
block_erased = false;
|
||||
is_filled = false;
|
||||
stop_write = false;
|
||||
}
|
||||
|
||||
static int esp_bt_controller_log_storage(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (len > MAX_STORAGE_SIZE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stop_write) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((write_index) % BLOCK_SIZE) >= THRESHOLD && !block_erased) {
|
||||
// esp_rom_printf("Ers nxt: %d,%d\n", next_erase_index, write_index);
|
||||
esp_partition_erase_range(log_partition, next_erase_index, BLOCK_SIZE);
|
||||
next_erase_index = (next_erase_index + BLOCK_SIZE) % MAX_STORAGE_SIZE;
|
||||
block_erased = true;
|
||||
}
|
||||
|
||||
if (((write_index + len) / BLOCK_SIZE) > (write_index / BLOCK_SIZE)) {
|
||||
block_erased = false;
|
||||
}
|
||||
|
||||
if (write_index + len <= MAX_STORAGE_SIZE) {
|
||||
esp_partition_write(log_partition, write_index, addr, len);
|
||||
write_index = (write_index + len) % MAX_STORAGE_SIZE;
|
||||
} else {
|
||||
uint32_t first_part_len = MAX_STORAGE_SIZE - write_index;
|
||||
esp_partition_write(log_partition, write_index, addr, first_part_len);
|
||||
esp_partition_write(log_partition, 0, addr + first_part_len, len - first_part_len);
|
||||
write_index = len - first_part_len;
|
||||
is_filled = true;
|
||||
// esp_rom_printf("old idx: %d,%d\n",next_erase_index, write_index);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void esp_bt_read_ctrl_log_from_flash(bool output)
|
||||
{
|
||||
esp_partition_mmap_handle_t mmap_handle;
|
||||
uint32_t read_index;
|
||||
const void *mapped_ptr;
|
||||
const uint8_t *buffer;
|
||||
uint32_t print_len;
|
||||
uint32_t max_print_len;
|
||||
esp_err_t err;
|
||||
|
||||
print_len = 0;
|
||||
max_print_len = 4096;
|
||||
err = esp_partition_mmap(log_partition, 0, MAX_STORAGE_SIZE, ESP_PARTITION_MMAP_DATA, &mapped_ptr, &mmap_handle);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE("FLASH", "Mmap failed: %s", esp_err_to_name(err));
|
||||
return;
|
||||
}
|
||||
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
r_ble_log_async_output_dump_all(true);
|
||||
esp_bt_ontroller_log_deinit();
|
||||
stop_write = true;
|
||||
|
||||
buffer = (const uint8_t *)mapped_ptr;
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
if (is_filled) {
|
||||
read_index = next_erase_index;
|
||||
} else {
|
||||
read_index = 0;
|
||||
}
|
||||
|
||||
esp_rom_printf("\r\nREAD_CHECK:%ld,%ld,%d\r\n",read_index, write_index, is_filled);
|
||||
esp_rom_printf("\r\n[DUMP_START:");
|
||||
while (read_index != write_index) {
|
||||
esp_rom_printf("%02x ", buffer[read_index]);
|
||||
if (print_len > max_print_len) {
|
||||
esp_panic_handler_reconfigure_wdts(5000);
|
||||
print_len = 0;
|
||||
}
|
||||
|
||||
print_len++;
|
||||
read_index = (read_index + 1) % MAX_STORAGE_SIZE;
|
||||
}
|
||||
|
||||
esp_rom_printf(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
esp_partition_munmap(mmap_handle);
|
||||
err = esp_bt_controller_log_init(log_output_mode);
|
||||
assert(err == ESP_OK);
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
/* This variable tells if BLE is running */
|
||||
@ -226,14 +403,6 @@ struct ext_funcs_t ext_funcs_ro = {
|
||||
._esp_intr_free = esp_intr_free_wrapper,
|
||||
._malloc = bt_osi_mem_malloc_internal,
|
||||
._free = bt_osi_mem_free,
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
._hal_uart_start_tx = hci_uart_start_tx_wrapper,
|
||||
._hal_uart_init_cbs = hci_uart_init_cbs_wrapper,
|
||||
._hal_uart_config = hci_uart_config_wrapper,
|
||||
._hal_uart_close = hci_uart_close_wrapper,
|
||||
._hal_uart_blocking_tx = hci_uart_blocking_tx_wrapper,
|
||||
._hal_uart_init = hci_uart_init_wrapper,
|
||||
#endif //CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
._task_create = task_create_wrapper,
|
||||
._task_delete = task_delete_wrapper,
|
||||
._osi_assert = osi_assert_wrapper,
|
||||
@ -278,75 +447,6 @@ static void coex_schm_status_bit_clear_wrapper(uint32_t type, uint32_t status)
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
bool esp_vhci_host_check_send_available(void)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct os_mbuf *ble_hs_mbuf_gen_pkt(uint16_t leading_space)
|
||||
{
|
||||
struct os_mbuf *om;
|
||||
int rc;
|
||||
|
||||
om = os_msys_get_pkthdr(0, 0);
|
||||
if (om == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (om->om_omp->omp_databuf_len < leading_space) {
|
||||
rc = os_mbuf_free_chain(om);
|
||||
assert(rc == 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
om->om_data += leading_space;
|
||||
|
||||
return om;
|
||||
}
|
||||
|
||||
struct os_mbuf *ble_hs_mbuf_acl_pkt(void)
|
||||
{
|
||||
return ble_hs_mbuf_gen_pkt(4 + 1);
|
||||
}
|
||||
|
||||
void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (*(data) == DATA_TYPE_COMMAND) {
|
||||
struct ble_hci_cmd *cmd = NULL;
|
||||
cmd = (struct ble_hci_cmd *) ble_hci_trans_buf_alloc(BLE_HCI_TRANS_BUF_CMD);
|
||||
assert(cmd);
|
||||
memcpy((uint8_t *)cmd, data + 1, len - 1);
|
||||
ble_hci_trans_hs_cmd_tx((uint8_t *)cmd);
|
||||
}
|
||||
|
||||
if (*(data) == DATA_TYPE_ACL) {
|
||||
struct os_mbuf *om = os_msys_get_pkthdr(len, ACL_DATA_MBUF_LEADINGSPCAE);
|
||||
assert(om);
|
||||
assert(os_mbuf_append(om, &data[1], len - 1) == 0);
|
||||
ble_hci_trans_hs_acl_tx(om);
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback)
|
||||
{
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_ENABLED) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
ble_hci_trans_cfg_hs(ble_hs_hci_rx_evt, NULL, ble_hs_rx_data, NULL);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
|
||||
static int task_create_wrapper(void *task_func, const char *name, uint32_t stack_depth,
|
||||
void *param, uint32_t prio, void *task_handle, uint32_t core_id)
|
||||
{
|
||||
@ -378,56 +478,6 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no)
|
||||
{
|
||||
hci_uart_start_tx(uart_no);
|
||||
}
|
||||
|
||||
static int hci_uart_init_cbs_wrapper(int uart_no, hci_uart_tx_char tx_func,
|
||||
hci_uart_tx_done tx_done, hci_uart_rx_char rx_func, void *arg)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_init_cbs(uart_no, tx_func, tx_done, rx_func, arg);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
static int hci_uart_config_wrapper(int port_num, int32_t baud_rate, uint8_t data_bits,
|
||||
uint8_t stop_bits, uart_parity_t parity,
|
||||
uart_hw_flowcontrol_t flow_ctl)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_config(port_num, baud_rate, data_bits, stop_bits, parity, flow_ctl);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int hci_uart_close_wrapper(int uart_no)
|
||||
{
|
||||
int rc = -1;
|
||||
rc = hci_uart_close(uart_no);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void hci_uart_blocking_tx_wrapper(int port, uint8_t data)
|
||||
{
|
||||
//This function is nowhere to use.
|
||||
}
|
||||
|
||||
static int hci_uart_init_wrapper(int uart_no, void *cfg)
|
||||
{
|
||||
//This function is nowhere to use.
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif //CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
|
||||
static int ble_hci_unregistered_hook(void*, void*)
|
||||
{
|
||||
ESP_LOGD(NIMBLE_PORT_LOG_TAG,"%s ble hci rx_evt is not registered.",__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int esp_intr_alloc_wrapper(int source, int flags, intr_handler_t handler,
|
||||
void *arg, void **ret_handle_in)
|
||||
{
|
||||
@ -538,9 +588,10 @@ static void sleep_modem_ble_mac_modem_state_deinit(void)
|
||||
|
||||
void sleep_modem_light_sleep_overhead_set(uint32_t overhead)
|
||||
{
|
||||
esp_ble_set_wakeup_overhead(overhead);
|
||||
r_esp_ble_set_wakeup_overhead(overhead);
|
||||
}
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
|
||||
|
||||
esp_err_t controller_sleep_init(void)
|
||||
{
|
||||
@ -684,6 +735,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
esp_err_t ret = ESP_OK;
|
||||
ble_npl_count_info_t npl_info;
|
||||
uint32_t slow_clk_freq = 0;
|
||||
uint8_t hci_transport_mode;
|
||||
|
||||
memset(&npl_info, 0, sizeof(ble_npl_count_info_t));
|
||||
if (ble_controller_status != ESP_BT_CONTROLLER_STATUS_IDLE) {
|
||||
@ -716,7 +768,7 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_mem;
|
||||
}
|
||||
|
||||
ble_get_npl_element_info(cfg, &npl_info);
|
||||
r_ble_get_npl_element_info(cfg, &npl_info);
|
||||
npl_freertos_set_controller_npl_info(&npl_info);
|
||||
if (npl_freertos_mempool_init() != 0) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "npl mempool init failed");
|
||||
@ -730,10 +782,10 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
*/
|
||||
ble_npl_eventq_init(nimble_port_get_dflt_eventq());
|
||||
#endif // CONFIG_BT_NIMBLE_ENABLED
|
||||
|
||||
/* Enable BT-related clocks */
|
||||
modem_clock_module_enable(PERIPH_BT_MODULE);
|
||||
modem_clock_module_mac_reset(PERIPH_BT_MODULE);
|
||||
/* Select slow clock source for BT momdule */
|
||||
#if CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL
|
||||
esp_bt_rtc_slow_clk_select(MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL);
|
||||
slow_clk_freq = 100000;
|
||||
@ -771,36 +823,28 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
coex_init();
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
uint8_t buffers = 0;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_CONTROLLER;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_CTRL_ENABLED
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
buffers |= ESP_BLE_LOG_BUF_HCI;
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_HCI_ENABLED
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
ret = r_ble_log_init_async(bt_controller_log_interface, false, buffers, (uint32_t *)log_bufs_size);
|
||||
#else
|
||||
ret = r_ble_log_init_async(bt_controller_log_interface, true, buffers, (uint32_t *)log_bufs_size);
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP
|
||||
ret = esp_bt_controller_log_init(log_output_mode);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
|
||||
|
||||
ret = ble_controller_init(cfg);
|
||||
ret = esp_ble_register_bb_funcs();
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_init failed %d", ret);
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "esp_ble_register_bb_funcs failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ret = r_ble_controller_init(cfg);
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "r_ble_controller_init failed %d", ret);
|
||||
goto modem_deint;
|
||||
}
|
||||
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "ble controller commit:[%s]", ble_controller_get_compile_version());
|
||||
|
||||
esp_ble_change_rtc_freq(slow_clk_freq);
|
||||
r_esp_ble_change_rtc_freq(slow_clk_freq);
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
@ -815,24 +859,36 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "controller_sleep_init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
ESP_ERROR_CHECK(esp_read_mac((uint8_t *)mac, ESP_MAC_BT));
|
||||
swap_in_place(mac, 6);
|
||||
esp_ble_ll_set_public_addr(mac);
|
||||
r_esp_ble_ll_set_public_addr(mac);
|
||||
|
||||
ble_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
|
||||
|
||||
ble_hci_trans_cfg_hs((ble_hci_trans_rx_cmd_fn *)ble_hci_unregistered_hook,NULL,
|
||||
(ble_hci_trans_rx_acl_fn *)ble_hci_unregistered_hook,NULL);
|
||||
return ESP_OK;
|
||||
#if CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
|
||||
hci_transport_mode = HCI_TRANSPORT_VHCI;
|
||||
#elif CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
hci_transport_mode = HCI_TRANSPORT_UART_NO_DMA;
|
||||
#if CONFIG_BT_LE_UART_HCI_DMA_MODE
|
||||
hci_transport_mode = HCI_TRANSPORT_UART_UHCI;
|
||||
#endif // CONFIG_BT_LE_UART_HCI_DMA_MODE
|
||||
#endif // CONFIG_BT_LE_HCI_INTERFACE_USE_RAM
|
||||
ret = hci_transport_init(hci_transport_mode);
|
||||
if (ret) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "hci transport init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
free_controller:
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
os_msys_deinit();
|
||||
ble_controller_deinit();
|
||||
r_ble_controller_deinit();
|
||||
modem_deint:
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
r_ble_log_deinit_async();
|
||||
esp_bt_ontroller_log_deinit();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
@ -855,6 +911,7 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
hci_transport_deinit();
|
||||
controller_sleep_deinit();
|
||||
|
||||
os_msys_deinit();
|
||||
@ -862,9 +919,10 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
ble_controller_deinit();
|
||||
r_ble_controller_deinit();
|
||||
esp_ble_unregister_bb_funcs();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
r_ble_log_deinit_async();
|
||||
esp_bt_ontroller_log_deinit();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
@ -910,7 +968,7 @@ esp_err_t esp_bt_controller_enable(esp_bt_mode_t mode)
|
||||
coex_enable();
|
||||
#endif // CONFIG_SW_COEXIST_ENABLE
|
||||
|
||||
if (ble_controller_enable(mode) != 0) {
|
||||
if (r_ble_controller_enable(mode) != 0) {
|
||||
ret = ESP_FAIL;
|
||||
goto error;
|
||||
}
|
||||
@ -938,7 +996,7 @@ esp_err_t esp_bt_controller_disable(void)
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "invalid controller state");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
if (ble_controller_disable() != 0) {
|
||||
if (r_ble_controller_disable() != 0) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#if CONFIG_SW_COEXIST_ENABLE
|
||||
@ -1072,7 +1130,7 @@ esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_
|
||||
case ESP_BLE_PWR_TYPE_DEFAULT:
|
||||
case ESP_BLE_PWR_TYPE_ADV:
|
||||
case ESP_BLE_PWR_TYPE_SCAN:
|
||||
if (ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
@ -1085,7 +1143,7 @@ esp_err_t esp_ble_tx_power_set(esp_ble_power_type_t power_type, esp_power_level_
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL6:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL7:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL8:
|
||||
if (ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
@ -1105,13 +1163,13 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_SCAN:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_INIT:
|
||||
if (ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_ADV:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_CONN:
|
||||
if (ble_txpwr_set(power_type, handle, power_level) == 0) {
|
||||
if (r_ble_txpwr_set(power_type, handle, power_level) == 0) {
|
||||
stat = ESP_OK;
|
||||
}
|
||||
break;
|
||||
@ -1131,7 +1189,7 @@ esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type)
|
||||
case ESP_BLE_PWR_TYPE_ADV:
|
||||
case ESP_BLE_PWR_TYPE_SCAN:
|
||||
case ESP_BLE_PWR_TYPE_DEFAULT:
|
||||
tx_level = ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
tx_level = r_ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
break;
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL0:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL1:
|
||||
@ -1142,7 +1200,7 @@ esp_power_level_t esp_ble_tx_power_get(esp_ble_power_type_t power_type)
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL6:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL7:
|
||||
case ESP_BLE_PWR_TYPE_CONN_HDL8:
|
||||
tx_level = ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type);
|
||||
tx_level = r_ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_CONN, power_type);
|
||||
break;
|
||||
default:
|
||||
return ESP_PWR_LVL_INVALID;
|
||||
@ -1164,11 +1222,11 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_SCAN:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_INIT:
|
||||
tx_level = ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
tx_level = r_ble_txpwr_get(ESP_BLE_ENHANCED_PWR_TYPE_DEFAULT, 0);
|
||||
break;
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_ADV:
|
||||
case ESP_BLE_ENHANCED_PWR_TYPE_CONN:
|
||||
tx_level = ble_txpwr_get(power_type, handle);
|
||||
tx_level = r_ble_txpwr_get(power_type, handle);
|
||||
break;
|
||||
default:
|
||||
return ESP_PWR_LVL_INVALID;
|
||||
@ -1184,16 +1242,30 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
if (end) {
|
||||
esp_rom_printf("\n");
|
||||
if (log_output_mode == LOG_STORAGE_TO_FLASH) {
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
esp_bt_controller_log_storage(len, addr, end);
|
||||
#endif //CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
} else {
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
esp_panic_handler_reconfigure_wdts(1000);
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x ", addr[i]);
|
||||
}
|
||||
|
||||
if (end) {
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
}
|
||||
}
|
||||
|
||||
void esp_ble_controller_log_dump_all(bool output)
|
||||
{
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
esp_bt_read_ctrl_log_from_flash(output);
|
||||
#else
|
||||
portMUX_TYPE spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
portENTER_CRITICAL_SAFE(&spinlock);
|
||||
@ -1202,6 +1274,7 @@ void esp_ble_controller_log_dump_all(bool output)
|
||||
r_ble_log_async_output_dump_all(output);
|
||||
BT_ASSERT_PRINT(":DUMP_END]\r\n");
|
||||
portEXIT_CRITICAL_SAFE(&spinlock);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_STORAGE_ENABLE
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -124,12 +124,26 @@ extern "C" {
|
||||
#else
|
||||
#define DEFAULT_BT_LE_POWER_CONTROL_ENABLED (0)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_LE_50_FEATURE_SUPPORT)
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (1)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_50_FEATURE_SUPPORT (0)
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_BT_LE_HCI_UART_FLOWCTRL)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (CONFIG_BT_LE_HCI_UART_FLOWCTRL)
|
||||
#if DEFAULT_BT_LE_HCI_UART_FLOW_CTRL
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (CONFIG_BT_LE_HCI_UART_CTS_PIN)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (CONFIG_BT_LE_HCI_UART_RTS_PIN)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (-1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
|
||||
#endif
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_CTS_PIN (-1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RTS_PIN (-1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF CONFIG_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF
|
||||
@ -170,8 +184,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_UART_DATA_BITS (UART_DATA_8_BITS)
|
||||
#define DEFAULT_BT_LE_HCI_UART_STOP_BITS (UART_STOP_BITS_1)
|
||||
#define DEFAULT_BT_LE_HCI_UART_PARITY (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_TASK_STACK_SIZE (CONFIG_BT_LE_HCI_UART_TASK_STACK_SIZE)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#else
|
||||
#define DEFAULT_BT_LE_HCI_UART_TX_PIN (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_RX_PIN (0)
|
||||
@ -180,8 +192,6 @@ extern "C" {
|
||||
#define DEFAULT_BT_LE_HCI_UART_DATA_BITS (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_STOP_BITS (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_PARITY (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_TASK_STACK_SIZE (0)
|
||||
#define DEFAULT_BT_LE_HCI_UART_FLOW_CTRL (0)
|
||||
#endif
|
||||
|
||||
/* Unchanged configuration */
|
||||
@ -206,8 +216,7 @@ extern "C" {
|
||||
|
||||
#define RTC_FREQ_N (32768) /* in Hz */
|
||||
|
||||
#define BLE_LL_TX_PWR_DBM_N (9)
|
||||
|
||||
#define BLE_LL_TX_PWR_DBM_N (CONFIG_BT_LE_DFT_TX_POWER_LEVEL_DBM_EFF)
|
||||
|
||||
#define RUN_BQB_TEST (0)
|
||||
#define RUN_QA_TEST (0)
|
||||
|
Submodule components/bt/controller/lib_esp32 updated: 44341b15e5...3bb36a79cd
Submodule components/bt/controller/lib_esp32c2/esp32c2-bt-lib updated: b9a902c355...db84a7e453
Submodule components/bt/controller/lib_esp32c3_family updated: 76ed4114ee...bfdfe8f851
Submodule components/bt/controller/lib_esp32c5/esp32c5-bt-lib updated: 45dda7a690...77c67a4d06
Submodule components/bt/controller/lib_esp32c6/esp32c6-bt-lib updated: 0af472c6f9...3396205d48
Submodule components/bt/controller/lib_esp32h2/esp32h2-bt-lib updated: 70612d08d1...85174c19ce
@ -96,7 +96,7 @@ esp_err_t esp_ble_mesh_deinit(esp_ble_mesh_deinit_param_t *param)
|
||||
}
|
||||
|
||||
/* Take the Semaphore, wait BLE Mesh de-initialization to finish. */
|
||||
xSemaphoreTake(semaphore, portMAX_DELAY);
|
||||
__ASSERT(xSemaphoreTake(semaphore, 3000 / portTICK_PERIOD_MS) == pdTRUE, "BLE Mesh deinit take semaphore failed");
|
||||
/* Don't forget to delete the semaphore at the end. */
|
||||
vSemaphoreDelete(semaphore);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -33,7 +33,10 @@ esp_err_t esp_ble_mesh_init(esp_ble_mesh_prov_t *prov, esp_ble_mesh_comp_t *comp
|
||||
/**
|
||||
* @brief De-initialize BLE Mesh module.
|
||||
*
|
||||
* @note This function shall be invoked after esp_ble_mesh_client_model_deinit().
|
||||
* @note
|
||||
* 1. This function shall be invoked after esp_ble_mesh_client_model_deinit().
|
||||
* 2. This function is strictly forbidden to run in any BTC Task Context
|
||||
* (e.g. registered Mesh Event Callback).
|
||||
*
|
||||
* @param[in] param: Pointer to the structure of BLE Mesh deinit parameters.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -71,6 +71,29 @@
|
||||
#include "esp_ble_mesh_provisioning_api.h"
|
||||
#include "esp_ble_mesh_networking_api.h"
|
||||
|
||||
#if CONFIG_BLE_MESH_DEINIT
|
||||
static SemaphoreHandle_t deinit_comp_semaphore;
|
||||
#endif
|
||||
|
||||
static inline void btc_ble_mesh_prov_cb_to_app_reprocess(esp_ble_mesh_prov_cb_event_t event,
|
||||
esp_ble_mesh_prov_cb_param_t *param)
|
||||
{
|
||||
switch (event) {
|
||||
#if CONFIG_BLE_MESH_DEINIT
|
||||
case ESP_BLE_MESH_DEINIT_MESH_COMP_EVT:
|
||||
assert(deinit_comp_semaphore);
|
||||
/* Give the semaphore when BLE Mesh de-initialization is finished.
|
||||
* @note: At nimble host, once this lock is released, it will cause
|
||||
* the btc task to be deleted.
|
||||
*/
|
||||
xSemaphoreGive(deinit_comp_semaphore);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void btc_ble_mesh_prov_cb_to_app(esp_ble_mesh_prov_cb_event_t event,
|
||||
esp_ble_mesh_prov_cb_param_t *param)
|
||||
{
|
||||
@ -79,6 +102,8 @@ static inline void btc_ble_mesh_prov_cb_to_app(esp_ble_mesh_prov_cb_event_t even
|
||||
if (btc_ble_mesh_cb) {
|
||||
btc_ble_mesh_cb(event, param);
|
||||
}
|
||||
|
||||
btc_ble_mesh_prov_cb_to_app_reprocess(event, param);
|
||||
}
|
||||
|
||||
static inline void btc_ble_mesh_model_cb_to_app(esp_ble_mesh_model_cb_event_t event,
|
||||
@ -2825,8 +2850,8 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
|
||||
case BTC_BLE_MESH_ACT_DEINIT_MESH:
|
||||
act = ESP_BLE_MESH_DEINIT_MESH_COMP_EVT;
|
||||
param.deinit_mesh_comp.err_code = bt_mesh_deinit((struct bt_mesh_deinit_param *)&arg->mesh_deinit.param);
|
||||
/* Give the semaphore when BLE Mesh de-initialization is finished. */
|
||||
xSemaphoreGive(arg->mesh_deinit.semaphore);
|
||||
/* Temporarily save the deinit semaphore and release it after the mesh deinit complete event is handled in the app layer */
|
||||
deinit_comp_semaphore = arg->mesh_deinit.semaphore;
|
||||
break;
|
||||
#endif /* CONFIG_BLE_MESH_DEINIT */
|
||||
default:
|
||||
|
@ -13,7 +13,7 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2016 Intel Corporation
|
||||
* SPDX-FileCopyrightText: 2011-2014 Wind River Systems, Inc.
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -170,4 +170,18 @@ bt_mesh_atomic_val_t bt_mesh_atomic_inc(bt_mesh_atomic_t *target)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool bt_mesh_atomic_cas(bt_mesh_atomic_t *target, bt_mesh_atomic_val_t excepted, bt_mesh_atomic_val_t new_val)
|
||||
{
|
||||
bt_mesh_atomic_lock();
|
||||
|
||||
if (*target == excepted) {
|
||||
*target = new_val;
|
||||
bt_mesh_atomic_unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
bt_mesh_atomic_unlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* #ifndef CONFIG_ATOMIC_OPERATIONS_BUILTIN */
|
||||
|
@ -147,6 +147,33 @@ static inline bt_mesh_atomic_val_t bt_mesh_atomic_and(bt_mesh_atomic_t *target,
|
||||
extern bt_mesh_atomic_val_t bt_mesh_atomic_and(bt_mesh_atomic_t *target, bt_mesh_atomic_val_t value);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Atomic CAS operation.
|
||||
*
|
||||
* This compares the contents of @a *target
|
||||
* with the contents of @a excepted. If equal,
|
||||
* the operation is a read-modify-write operation
|
||||
* that writes @a new_val into @a *target and return true.
|
||||
* If they are not equal, the operation is a read
|
||||
* and return false.
|
||||
*
|
||||
* @param target Address of atomic variable.
|
||||
* @param excepted Value of excepted.
|
||||
* @param new_val Write if target value is equal to expected one.
|
||||
*
|
||||
* @return
|
||||
* - true: Target value updated.
|
||||
* - false: Target value not updated.
|
||||
*/
|
||||
#ifdef CONFIG_ATOMIC_OPERATIONS_BUILTIN
|
||||
static inline bool bt_mesh_atomic_cas(bt_mesh_atomic_t *target, bt_mesh_atomic_val_t excepted, bt_mesh_atomic_val_t new_val)
|
||||
{
|
||||
return __atomic_compare_exchange_n(target, &excepted, &new_val, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
#else
|
||||
extern bool bt_mesh_atomic_cas(bt_mesh_atomic_t *target, bt_mesh_atomic_val_t excepted, bt_mesh_atomic_val_t new_val);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @cond INTERNAL_HIDDEN
|
||||
*/
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -335,8 +335,7 @@ static void adv_thread(void *p)
|
||||
}
|
||||
|
||||
/* busy == 0 means this was canceled */
|
||||
if (BLE_MESH_ADV(*buf)->busy) {
|
||||
BLE_MESH_ADV(*buf)->busy = 0U;
|
||||
if (bt_mesh_atomic_cas(&BLE_MESH_ADV_BUSY(*buf), 1, 0)) {
|
||||
#if !CONFIG_BLE_MESH_RELAY_ADV_BUF
|
||||
if (adv_send(*buf)) {
|
||||
BT_WARN("Failed to send adv packet");
|
||||
@ -449,7 +448,7 @@ static void bt_mesh_unref_buf(bt_mesh_msg_t *msg)
|
||||
|
||||
if (msg->arg) {
|
||||
buf = (struct net_buf *)msg->arg;
|
||||
BLE_MESH_ADV(buf)->busy = 0U;
|
||||
bt_mesh_atomic_set(&BLE_MESH_ADV_BUSY(buf), 0);
|
||||
if (buf->ref > 1U) {
|
||||
buf->ref = 1U;
|
||||
}
|
||||
@ -490,7 +489,7 @@ void bt_mesh_adv_send(struct net_buf *buf, uint8_t xmit,
|
||||
|
||||
BLE_MESH_ADV(buf)->cb = cb;
|
||||
BLE_MESH_ADV(buf)->cb_data = cb_data;
|
||||
BLE_MESH_ADV(buf)->busy = 1U;
|
||||
bt_mesh_atomic_set(&BLE_MESH_ADV_BUSY(buf), 1);
|
||||
BLE_MESH_ADV(buf)->xmit = xmit;
|
||||
|
||||
bt_mesh_adv_buf_ref_debug(__func__, buf, 3U, BLE_MESH_BUF_REF_SMALL);
|
||||
@ -589,7 +588,7 @@ void bt_mesh_relay_adv_send(struct net_buf *buf, uint8_t xmit,
|
||||
|
||||
BLE_MESH_ADV(buf)->cb = cb;
|
||||
BLE_MESH_ADV(buf)->cb_data = cb_data;
|
||||
BLE_MESH_ADV(buf)->busy = 1U;
|
||||
bt_mesh_atomic_set(&BLE_MESH_ADV_BUSY(buf), 1);
|
||||
BLE_MESH_ADV(buf)->xmit = xmit;
|
||||
|
||||
msg.arg = (void *)net_buf_ref(buf);
|
||||
@ -753,7 +752,7 @@ static void bt_mesh_ble_adv_send(struct net_buf *buf, const struct bt_mesh_send_
|
||||
|
||||
BLE_MESH_ADV(buf)->cb = cb;
|
||||
BLE_MESH_ADV(buf)->cb_data = cb_data;
|
||||
BLE_MESH_ADV(buf)->busy = 1U;
|
||||
bt_mesh_atomic_set(&BLE_MESH_ADV_BUSY(buf), 1);
|
||||
|
||||
bt_mesh_adv_buf_ref_debug(__func__, buf, 3U, BLE_MESH_BUF_REF_SMALL);
|
||||
|
||||
@ -772,7 +771,7 @@ static void ble_adv_tx_reset(struct ble_adv_tx *tx, bool unref)
|
||||
}
|
||||
bt_mesh_atomic_set(tx->flags, 0);
|
||||
memset(&tx->param, 0, sizeof(tx->param));
|
||||
BLE_MESH_ADV(tx->buf)->busy = 0U;
|
||||
bt_mesh_atomic_set(&BLE_MESH_ADV_BUSY(tx->buf), 0);
|
||||
if (unref) {
|
||||
net_buf_unref(tx->buf);
|
||||
}
|
||||
@ -961,7 +960,8 @@ int bt_mesh_stop_ble_advertising(uint8_t index)
|
||||
/* busy 1, ref 1; busy 1, ref 2;
|
||||
* busy 0, ref 0; busy 0, ref 1;
|
||||
*/
|
||||
if (BLE_MESH_ADV(tx->buf)->busy == 1U &&
|
||||
|
||||
if (bt_mesh_atomic_get(&BLE_MESH_ADV_BUSY(tx->buf)) &&
|
||||
tx->buf->ref == 1U) {
|
||||
unref = false;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#ifndef _ADV_H_
|
||||
#define _ADV_H_
|
||||
|
||||
#include "mesh/atomic.h"
|
||||
#include "mesh/access.h"
|
||||
#include "mesh/adapter.h"
|
||||
|
||||
@ -24,6 +25,7 @@ extern "C" {
|
||||
#define BLE_MESH_ADV_USER_DATA_SIZE 4
|
||||
|
||||
#define BLE_MESH_ADV(buf) (*(struct bt_mesh_adv **)net_buf_user_data(buf))
|
||||
#define BLE_MESH_ADV_BUSY(buf) (BLE_MESH_ADV(buf)->busy)
|
||||
|
||||
uint16_t bt_mesh_pdu_duration(uint8_t xmit);
|
||||
|
||||
@ -48,8 +50,10 @@ struct bt_mesh_adv {
|
||||
const struct bt_mesh_send_cb *cb;
|
||||
void *cb_data;
|
||||
|
||||
uint8_t type:3,
|
||||
busy:1;
|
||||
uint8_t type:3;
|
||||
|
||||
bt_mesh_atomic_t busy;
|
||||
|
||||
uint8_t xmit;
|
||||
};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Nordic Semiconductor ASA
|
||||
* SPDX-FileCopyrightText: 2015-2016 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -74,7 +74,7 @@ static struct bt_mesh_conn_cb *bt_mesh_gatts_conn_cb;
|
||||
static tBTA_GATTS_IF bt_mesh_gatts_if;
|
||||
static uint8_t bt_mesh_gatts_addr[BLE_MESH_ADDR_LEN];
|
||||
static uint16_t svc_handle, char_handle;
|
||||
static future_t *future_mesh;
|
||||
static future_t *gatts_future_mesh;
|
||||
|
||||
/* Static Functions */
|
||||
static struct bt_mesh_gatt_attr *bt_mesh_gatts_find_attr_by_handle(uint16_t handle);
|
||||
@ -561,6 +561,9 @@ static void bt_mesh_bta_gatts_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
case BTA_GATTS_REG_EVT:
|
||||
if (p_data->reg_oper.status == BTA_GATT_OK) {
|
||||
bt_mesh_gatts_if = p_data->reg_oper.server_if;
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
} else {
|
||||
future_ready(gatts_future_mesh, FUTURE_FAIL);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_READ_EVT: {
|
||||
@ -618,27 +621,27 @@ static void bt_mesh_bta_gatts_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
break;
|
||||
case BTA_GATTS_CREATE_EVT:
|
||||
svc_handle = p_data->create.service_id;
|
||||
BT_DBG("svc_handle %d, future_mesh %p", svc_handle, future_mesh);
|
||||
if (future_mesh != NULL) {
|
||||
future_ready(future_mesh, FUTURE_SUCCESS);
|
||||
BT_DBG("svc_handle %d, gatts_future_mesh %p", svc_handle, gatts_future_mesh);
|
||||
if (gatts_future_mesh != NULL) {
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_ADD_INCL_SRVC_EVT:
|
||||
svc_handle = p_data->add_result.attr_id;
|
||||
if (future_mesh != NULL) {
|
||||
future_ready(future_mesh, FUTURE_SUCCESS);
|
||||
if (gatts_future_mesh != NULL) {
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_ADD_CHAR_EVT:
|
||||
char_handle = p_data->add_result.attr_id;
|
||||
if (future_mesh != NULL) {
|
||||
future_ready(future_mesh, FUTURE_SUCCESS);
|
||||
if (gatts_future_mesh != NULL) {
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_ADD_CHAR_DESCR_EVT:
|
||||
char_handle = p_data->add_result.attr_id;
|
||||
if (future_mesh != NULL) {
|
||||
future_ready(future_mesh, FUTURE_SUCCESS);
|
||||
if (gatts_future_mesh != NULL) {
|
||||
future_ready(gatts_future_mesh, FUTURE_SUCCESS);
|
||||
}
|
||||
break;
|
||||
case BTA_GATTS_DELELTE_EVT:
|
||||
@ -962,11 +965,11 @@ int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc)
|
||||
if (svc->attrs[i].uuid->type == BLE_MESH_UUID_TYPE_16) {
|
||||
switch (BLE_MESH_UUID_16(svc->attrs[i].uuid)->val) {
|
||||
case BLE_MESH_UUID_GATT_PRIMARY_VAL: {
|
||||
future_mesh = future_new();
|
||||
gatts_future_mesh = future_new();
|
||||
bta_uuid_to_bt_mesh_uuid(&bta_uuid, (struct bt_mesh_uuid *)svc->attrs[i].user_data);
|
||||
BTA_GATTS_CreateService(bt_mesh_gatts_if,
|
||||
&bta_uuid, 0, svc->attr_count, true);
|
||||
if (future_await(future_mesh) == FUTURE_FAIL) {
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Failed to add primary service");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@ -976,11 +979,11 @@ int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc)
|
||||
break;
|
||||
}
|
||||
case BLE_MESH_UUID_GATT_SECONDARY_VAL: {
|
||||
future_mesh = future_new();
|
||||
gatts_future_mesh = future_new();
|
||||
bta_uuid_to_bt_mesh_uuid(&bta_uuid, (struct bt_mesh_uuid *)svc->attrs[i].user_data);
|
||||
BTA_GATTS_CreateService(bt_mesh_gatts_if,
|
||||
&bta_uuid, 0, svc->attr_count, false);
|
||||
if (future_await(future_mesh) == FUTURE_FAIL) {
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Failed to add secondary service");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@ -993,11 +996,11 @@ int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc)
|
||||
break;
|
||||
}
|
||||
case BLE_MESH_UUID_GATT_CHRC_VAL: {
|
||||
future_mesh = future_new();
|
||||
gatts_future_mesh = future_new();
|
||||
struct bt_mesh_gatt_char *gatts_chrc = (struct bt_mesh_gatt_char *)svc->attrs[i].user_data;
|
||||
bta_uuid_to_bt_mesh_uuid(&bta_uuid, gatts_chrc->uuid);
|
||||
BTA_GATTS_AddCharacteristic(svc_handle, &bta_uuid, bt_mesh_perm_to_bta_perm(svc->attrs[i + 1].perm), gatts_chrc->properties, NULL, NULL);
|
||||
if (future_await(future_mesh) == FUTURE_FAIL) {
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Failed to add characteristic");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@ -1019,10 +1022,10 @@ int bt_mesh_gatts_service_register(struct bt_mesh_gatt_service *svc)
|
||||
case BLE_MESH_UUID_ES_CONFIGURATION_VAL:
|
||||
case BLE_MESH_UUID_ES_MEASUREMENT_VAL:
|
||||
case BLE_MESH_UUID_ES_TRIGGER_SETTING_VAL: {
|
||||
future_mesh = future_new();
|
||||
gatts_future_mesh = future_new();
|
||||
bta_uuid_to_bt_mesh_uuid(&bta_uuid, svc->attrs[i].uuid);
|
||||
BTA_GATTS_AddCharDescriptor(svc_handle, bt_mesh_perm_to_bta_perm(svc->attrs[i].perm), &bta_uuid, NULL, NULL);
|
||||
if (future_await(future_mesh) == FUTURE_FAIL) {
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Failed to add descriptor");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@ -1768,7 +1771,19 @@ void bt_mesh_gatt_init(void)
|
||||
CONFIG_BLE_MESH_GATT_PROXY_SERVER
|
||||
tBT_UUID gatts_app_uuid = {LEN_UUID_128, {0}};
|
||||
memset(&gatts_app_uuid.uu.uuid128, BLE_MESH_GATTS_APP_UUID_BYTE, LEN_UUID_128);
|
||||
|
||||
gatts_future_mesh = future_new();
|
||||
if (!gatts_future_mesh) {
|
||||
BT_ERR("Mesh gatts sync lock alloc failed");
|
||||
return;
|
||||
}
|
||||
|
||||
BTA_GATTS_AppRegister(&gatts_app_uuid, bt_mesh_bta_gatts_cb);
|
||||
|
||||
if (future_await(gatts_future_mesh) == FUTURE_FAIL) {
|
||||
BT_ERR("Mesh gatts app register failed");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
|
||||
|
@ -183,7 +183,7 @@ static void friend_clear(struct bt_mesh_friend *frnd, uint8_t reason)
|
||||
/* Cancel the sending if necessary */
|
||||
if (frnd->pending_buf) {
|
||||
bt_mesh_adv_buf_ref_debug(__func__, frnd->last, 2U, BLE_MESH_BUF_REF_EQUAL);
|
||||
BLE_MESH_ADV(frnd->last)->busy = 0U;
|
||||
bt_mesh_atomic_set(&BLE_MESH_ADV_BUSY(frnd->last), 0);
|
||||
} else {
|
||||
bt_mesh_adv_buf_ref_debug(__func__, frnd->last, 1U, BLE_MESH_BUF_REF_EQUAL);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -1129,23 +1129,34 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
|
||||
if (((IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned()) ||
|
||||
(IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) && bt_mesh_is_provisioner_en())) &&
|
||||
(bt_mesh_fixed_group_match(tx->ctx->addr) || bt_mesh_elem_find(tx->ctx->addr))) {
|
||||
if (cb && cb->start) {
|
||||
cb->start(0, 0, cb_data);
|
||||
/**
|
||||
* If the target address isn't a unicast address, then the callback function
|
||||
* will be called by `adv task` in place of here, to avoid the callback function
|
||||
* being called twice.
|
||||
* See BLEMESH24-76 for more details.
|
||||
*/
|
||||
if (BLE_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) {
|
||||
if (cb && cb->start) {
|
||||
cb->start(0, 0, cb_data);
|
||||
}
|
||||
|
||||
net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf));
|
||||
|
||||
if (cb && cb->end) {
|
||||
cb->end(0, cb_data);
|
||||
}
|
||||
|
||||
bt_mesh_net_local();
|
||||
|
||||
err = 0;
|
||||
|
||||
goto done;
|
||||
} else {
|
||||
net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf));
|
||||
bt_mesh_net_local();
|
||||
}
|
||||
|
||||
net_buf_slist_put(&bt_mesh.local_queue, net_buf_ref(buf));
|
||||
|
||||
if (cb && cb->end) {
|
||||
cb->end(0, cb_data);
|
||||
}
|
||||
|
||||
bt_mesh_net_local();
|
||||
|
||||
err = 0;
|
||||
/* If it is a group address, it still needs to be relayed */
|
||||
if (BLE_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if ((bearer & BLE_MESH_ADV_BEARER) &&
|
||||
|
@ -359,7 +359,7 @@ static void free_segments(struct bt_mesh_prov_link *link)
|
||||
link->tx.buf[i] = NULL;
|
||||
bt_mesh_adv_buf_ref_debug(__func__, buf, 3U, BLE_MESH_BUF_REF_SMALL);
|
||||
/* Mark as canceled */
|
||||
BLE_MESH_ADV(buf)->busy = 0U;
|
||||
bt_mesh_atomic_set(&BLE_MESH_ADV_BUSY(buf), 0);
|
||||
net_buf_unref(buf);
|
||||
}
|
||||
}
|
||||
@ -474,7 +474,7 @@ static void prov_retransmit(struct k_work *work)
|
||||
break;
|
||||
}
|
||||
|
||||
if (BLE_MESH_ADV(buf)->busy) {
|
||||
if (bt_mesh_atomic_get(&BLE_MESH_ADV_BUSY(buf))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -310,7 +310,15 @@ static void seg_tx_done(struct seg_tx *tx, uint8_t seg_idx)
|
||||
{
|
||||
bt_mesh_adv_buf_ref_debug(__func__, tx->seg[seg_idx], 3U, BLE_MESH_BUF_REF_SMALL);
|
||||
|
||||
BLE_MESH_ADV(tx->seg[seg_idx])->busy = 0U;
|
||||
/**
|
||||
* When cancelling a segment that is still in the adv sending queue, `tx->seg_pending`
|
||||
* must else be decremented by one. More detailed information
|
||||
* can be found in BLEMESH24-26.
|
||||
*/
|
||||
if (bt_mesh_atomic_cas(&BLE_MESH_ADV_BUSY(tx->seg[seg_idx]), 1, 0)) {
|
||||
tx->seg_pending--;
|
||||
}
|
||||
|
||||
net_buf_unref(tx->seg[seg_idx]);
|
||||
tx->seg[seg_idx] = NULL;
|
||||
tx->nack_count--;
|
||||
@ -443,7 +451,7 @@ static void seg_tx_send_unacked(struct seg_tx *tx)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (BLE_MESH_ADV(seg)->busy) {
|
||||
if (bt_mesh_atomic_get(&BLE_MESH_ADV_BUSY(seg))) {
|
||||
BT_DBG("Skipping segment that's still advertising");
|
||||
continue;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -121,22 +121,22 @@ static bt_mesh_mutex_t seg_rx_lock;
|
||||
|
||||
static inline void bt_mesh_seg_tx_lock(void)
|
||||
{
|
||||
bt_mesh_mutex_lock(&seg_tx_lock);
|
||||
bt_mesh_r_mutex_lock(&seg_tx_lock);
|
||||
}
|
||||
|
||||
static inline void bt_mesh_seg_tx_unlock(void)
|
||||
{
|
||||
bt_mesh_mutex_unlock(&seg_tx_lock);
|
||||
bt_mesh_r_mutex_unlock(&seg_tx_lock);
|
||||
}
|
||||
|
||||
static inline void bt_mesh_seg_rx_lock(void)
|
||||
{
|
||||
bt_mesh_mutex_lock(&seg_rx_lock);
|
||||
bt_mesh_r_mutex_lock(&seg_rx_lock);
|
||||
}
|
||||
|
||||
static inline void bt_mesh_seg_rx_unlock(void)
|
||||
{
|
||||
bt_mesh_mutex_unlock(&seg_rx_lock);
|
||||
bt_mesh_r_mutex_unlock(&seg_rx_lock);
|
||||
}
|
||||
|
||||
uint8_t bt_mesh_seg_send_interval(void)
|
||||
@ -350,7 +350,7 @@ static void seg_tx_done(struct seg_tx *tx, uint8_t seg_idx)
|
||||
*/
|
||||
bt_mesh_adv_buf_ref_debug(__func__, tx->seg[seg_idx], 4U, BLE_MESH_BUF_REF_SMALL);
|
||||
|
||||
BLE_MESH_ADV(tx->seg[seg_idx])->busy = 0U;
|
||||
bt_mesh_atomic_set(&BLE_MESH_ADV_BUSY(tx->seg[seg_idx]), 0);
|
||||
net_buf_unref(tx->seg[seg_idx]);
|
||||
|
||||
tx->seg[seg_idx] = NULL;
|
||||
@ -498,7 +498,7 @@ static bool send_next_segment(struct seg_tx *tx, int *result)
|
||||
/* The segment may have already been transmitted, for example, the
|
||||
* Segment Retransmission timer is expired earlier.
|
||||
*/
|
||||
if (BLE_MESH_ADV(seg)->busy) {
|
||||
if (bt_mesh_atomic_get(&BLE_MESH_ADV_BUSY(seg))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -517,6 +517,12 @@ static bool send_next_segment(struct seg_tx *tx, int *result)
|
||||
|
||||
net_tx.ctx->net_idx = tx->sub->net_idx;
|
||||
|
||||
/**
|
||||
* Add one to the ref count only if the segment can be further
|
||||
* processed by the network.
|
||||
*/
|
||||
seg = net_buf_ref(seg);
|
||||
|
||||
err = bt_mesh_net_send(&net_tx, seg, &seg_sent_cb, tx);
|
||||
if (err) {
|
||||
BT_ERR("Send seg %u failed (err %d)", tx->last_seg_n, err);
|
||||
@ -762,7 +768,7 @@ static bool resend_unacked_seg(struct seg_tx *tx, int *result)
|
||||
* A is still going to be retransmitted, but at this moment we could
|
||||
* find that the "busy" flag of Segment A is 1.
|
||||
*/
|
||||
if (BLE_MESH_ADV(seg)->busy) {
|
||||
if (bt_mesh_atomic_get(&BLE_MESH_ADV_BUSY(seg))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -966,7 +972,18 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
|
||||
}
|
||||
}
|
||||
|
||||
tx->seg[seg_o] = net_buf_ref(seg);
|
||||
/**
|
||||
* If the net buffer allocation of the subsequent
|
||||
* segments of this segment message fails, it will
|
||||
* cause the ref count of the previously allocated
|
||||
* successful segments to not be unref, which will
|
||||
* cause the net buffer leakage to occur, so it is
|
||||
* necessary to wait until all the segments have been
|
||||
* allocated, and then when the segment is confirmed
|
||||
* that it will be network layer for further processing,
|
||||
* then ref of the net buffer should be plus one.
|
||||
*/
|
||||
tx->seg[seg_o] = seg;
|
||||
|
||||
BT_DBG("Seg %u/%u prepared", seg_o, tx->seg_n);
|
||||
}
|
||||
@ -975,6 +992,11 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct net_buf_simple *sdu,
|
||||
* tx->seg[0] will be NULL here.
|
||||
*/
|
||||
if (tx->seg[0]) {
|
||||
/**
|
||||
* Add one to the ref count only if the segment can be further
|
||||
* processed by the network.
|
||||
*/
|
||||
tx->seg[0] = net_buf_ref(tx->seg[0]);
|
||||
err = bt_mesh_net_send(net_tx, tx->seg[0], &seg_sent_cb, tx);
|
||||
if (err) {
|
||||
BT_ERR("Send 1st seg failed (err %d)", err);
|
||||
@ -2327,8 +2349,8 @@ void bt_mesh_trans_init(void)
|
||||
seg_rx[i].buf.data = seg_rx[i].buf.__buf;
|
||||
}
|
||||
|
||||
bt_mesh_mutex_create(&seg_tx_lock);
|
||||
bt_mesh_mutex_create(&seg_rx_lock);
|
||||
bt_mesh_r_mutex_create(&seg_tx_lock);
|
||||
bt_mesh_r_mutex_create(&seg_rx_lock);
|
||||
}
|
||||
|
||||
#if CONFIG_BLE_MESH_DEINIT
|
||||
@ -2338,7 +2360,7 @@ void bt_mesh_trans_deinit(bool erase)
|
||||
bt_mesh_tx_reset();
|
||||
bt_mesh_rpl_reset(erase);
|
||||
|
||||
bt_mesh_mutex_free(&seg_tx_lock);
|
||||
bt_mesh_mutex_free(&seg_rx_lock);
|
||||
bt_mesh_r_mutex_free(&seg_tx_lock);
|
||||
bt_mesh_r_mutex_free(&seg_rx_lock);
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_DEINIT */
|
||||
|
@ -85,7 +85,7 @@ config BT_A2DP_ENABLE
|
||||
depends on BT_CLASSIC_ENABLED
|
||||
default n
|
||||
help
|
||||
Advanced Audio Distrubution Profile
|
||||
Advanced Audio Distribution Profile
|
||||
|
||||
config BT_SPP_ENABLED
|
||||
bool "SPP"
|
||||
@ -140,7 +140,7 @@ config BT_HFP_WBS_ENABLE
|
||||
default y
|
||||
help
|
||||
This enables Wide Band Speech. Should disable it when SCO data path is PCM.
|
||||
Otherwise there will be no data transmited via GPIOs.
|
||||
Otherwise there will be no data transmitted via GPIOs.
|
||||
|
||||
|
||||
menuconfig BT_HID_ENABLED
|
||||
@ -312,6 +312,17 @@ config BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE
|
||||
In order to reduce the pairing time, slave actively initiates connection parameters
|
||||
update during pairing.
|
||||
|
||||
config BT_BLE_SMP_ID_RESET_ENABLE
|
||||
bool "Reset device identity when all bonding records are deleted"
|
||||
depends on BT_BLE_SMP_ENABLE
|
||||
default n
|
||||
help
|
||||
There are tracking risks associated with using a fixed or static IRK.
|
||||
If enabled this option, Bluedroid will assign a new randomly-generated IRK
|
||||
when all pairing and bonding records are deleted. This would decrease the ability
|
||||
of a previously paired peer to be used to determine whether a device
|
||||
with which it previously shared an IRK is within range.
|
||||
|
||||
config BT_STACK_NO_LOG
|
||||
bool "Disable BT debug logs (minimize bin size)"
|
||||
depends on BT_BLUEDROID_ENABLED
|
||||
|
@ -61,7 +61,7 @@ bool hci_host_check_send_available(void)
|
||||
void hci_host_send_packet(uint8_t *data, uint16_t len)
|
||||
{
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
bt_hci_log_record_hci_data(data[0], data, len);
|
||||
bt_hci_log_record_hci_data(data[0], &data[1], len - 1);
|
||||
#endif
|
||||
#if (BT_CONTROLLER_INCLUDED == TRUE)
|
||||
esp_vhci_host_send_packet(data, len);
|
||||
|
@ -1014,6 +1014,25 @@ esp_err_t esp_ble_dtm_stop(void)
|
||||
return (btc_transfer_context(&msg, NULL, 0, NULL, NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_addr_t addr, esp_ble_privacy_mode_t mode)
|
||||
{
|
||||
btc_msg_t msg;
|
||||
btc_ble_gap_args_t arg;
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = BTC_GAP_BLE_SET_PRIVACY_MODE;
|
||||
|
||||
arg.set_privacy_mode.addr_type = addr_type;
|
||||
memcpy(arg.set_privacy_mode.addr, addr, sizeof(esp_bd_addr_t));
|
||||
arg.set_privacy_mode.privacy_mode = mode;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gap_args_t), NULL, NULL)
|
||||
== BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
esp_err_t esp_ble_gap_read_phy(esp_bd_addr_t bd_addr)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -55,7 +55,10 @@ esp_bluedroid_status_t esp_bluedroid_get_status(void);
|
||||
esp_err_t esp_bluedroid_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Disable bluetooth, must prior to esp_bluedroid_deinit().
|
||||
* @brief Disable Bluetooth, must be called prior to esp_bluedroid_deinit().
|
||||
*
|
||||
* @note Before calling this API, ensure that all activities related to
|
||||
* the application, such as connections, scans, etc., are properly closed.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : Succeed
|
||||
|
@ -228,6 +228,7 @@ typedef enum {
|
||||
ESP_GAP_BLE_SET_RPA_TIMEOUT_COMPLETE_EVT, /*!< When set the Resolvable Private Address (RPA) timeout completes, the event comes */
|
||||
ESP_GAP_BLE_ADD_DEV_TO_RESOLVING_LIST_COMPLETE_EVT, /*!< when add a device to the resolving list completes, the event comes*/
|
||||
ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT, /*!< When vendor hci command complete, the event comes */
|
||||
ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT, /*!< When set privacy mode complete, the event comes */
|
||||
ESP_GAP_BLE_EVT_MAX, /*!< when maximum advertising event complete, the event comes */
|
||||
} esp_gap_ble_cb_event_t;
|
||||
|
||||
@ -660,21 +661,55 @@ typedef struct {
|
||||
esp_bt_octet16_t oob_r; /*!< the 128 bits of randomizer value */
|
||||
} esp_ble_local_oob_data_t;
|
||||
|
||||
/**
|
||||
* @brief Definition of the authentication failed reason
|
||||
*/
|
||||
typedef enum {
|
||||
// Failure reason defined in Bluetooth Core Spec 5.0 Vol3, Part H, 3.5.5
|
||||
ESP_AUTH_SMP_PASSKEY_FAIL = 78, /*!< The user input of passkey failed */
|
||||
ESP_AUTH_SMP_OOB_FAIL, /*!< The OOB data is not available */
|
||||
ESP_AUTH_SMP_PAIR_AUTH_FAIL, /*!< The authentication requirements cannot be met */
|
||||
ESP_AUTH_SMP_CONFIRM_VALUE_FAIL, /*!< The confirm value does not match the calculated comparison value */
|
||||
ESP_AUTH_SMP_PAIR_NOT_SUPPORT, /*!< Pairing is not supported by the device */
|
||||
ESP_AUTH_SMP_ENC_KEY_SIZE, /*!< The resultant encryption key size is not long enough */
|
||||
ESP_AUTH_SMP_INVALID_CMD, /*!< The SMP command received is not supported by this device */
|
||||
ESP_AUTH_SMP_UNKNOWN_ERR, /*!< Pairing failed due to an unspecified reason */
|
||||
ESP_AUTH_SMP_REPEATED_ATTEMPT, /*!< Pairing or authentication procedure is disallowed */
|
||||
ESP_AUTH_SMP_INVALID_PARAMETERS, /*!< The command length is invalid or that a parameter is outside the specified range */
|
||||
ESP_AUTH_SMP_DHKEY_CHK_FAIL, /*!< The DHKey Check value received doesn’t match the one calculated by the local device */
|
||||
ESP_AUTH_SMP_NUM_COMP_FAIL, /*!< The confirm values in the numeric comparison protocol do not match */
|
||||
ESP_AUTH_SMP_BR_PARING_IN_PROGR, /*!< Pairing Request sent over the BR/EDR transport is in progress */
|
||||
ESP_AUTH_SMP_XTRANS_DERIVE_NOT_ALLOW, /*!< The BR/EDR Link Key or BLE LTK cannot be used to derive */
|
||||
|
||||
// Failure reason defined in Bluedroid Host
|
||||
ESP_AUTH_SMP_INTERNAL_ERR, /*!< Internal error in pairing procedure */
|
||||
ESP_AUTH_SMP_UNKNOWN_IO, /*!< Unknown IO capability, unable to decide association model */
|
||||
ESP_AUTH_SMP_INIT_FAIL, /*!< SMP pairing initiation failed */
|
||||
ESP_AUTH_SMP_CONFIRM_FAIL, /*!< The confirm value does not match */
|
||||
ESP_AUTH_SMP_BUSY, /*!< Pending security request on going */
|
||||
ESP_AUTH_SMP_ENC_FAIL, /*!< The Controller failed to start encryption */
|
||||
ESP_AUTH_SMP_STARTED, /*!< SMP pairing process started */
|
||||
ESP_AUTH_SMP_RSP_TIMEOUT, /*!< Security Manager timeout due to no SMP command being received */
|
||||
ESP_AUTH_SMP_DIV_NOT_AVAIL, /*!< Encrypted Diversifier value not available */
|
||||
ESP_AUTH_SMP_UNSPEC_ERR, /*!< Unspecified failed reason */
|
||||
ESP_AUTH_SMP_CONN_TOUT, /*!< Pairing process failed due to connection timeout */
|
||||
} esp_ble_auth_fail_rsn_t;
|
||||
|
||||
/**
|
||||
* @brief Structure associated with ESP_AUTH_CMPL_EVT
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
esp_bd_addr_t bd_addr; /*!< BD address peer device. */
|
||||
bool key_present; /*!< Valid link key value in key element */
|
||||
esp_link_key key; /*!< Link key associated with peer device. */
|
||||
uint8_t key_type; /*!< The type of Link Key */
|
||||
bool success; /*!< TRUE of authentication succeeded, FALSE if failed. */
|
||||
uint8_t fail_reason; /*!< The HCI reason/error code for when success=FALSE */
|
||||
esp_ble_addr_type_t addr_type; /*!< Peer device address type */
|
||||
esp_bt_dev_type_t dev_type; /*!< Device type */
|
||||
esp_ble_auth_req_t auth_mode; /*!< authentication mode */
|
||||
} esp_ble_auth_cmpl_t; /*!< The ble authentication complete cb type */
|
||||
esp_bd_addr_t bd_addr; /*!< BD address of peer device */
|
||||
bool key_present; /*!< True if the link key value is valid; false otherwise */
|
||||
esp_link_key key; /*!< Link key associated with peer device */
|
||||
uint8_t key_type; /*!< The type of link key */
|
||||
bool success; /*!< True if authentication succeeded; false otherwise */
|
||||
esp_ble_auth_fail_rsn_t fail_reason; /*!< The HCI reason/error code for failure when success is false */
|
||||
esp_ble_addr_type_t addr_type; /*!< Peer device address type */
|
||||
esp_bt_dev_type_t dev_type; /*!< Device type */
|
||||
esp_ble_auth_req_t auth_mode; /*!< Authentication mode */
|
||||
} esp_ble_auth_cmpl_t; /*!< The ble authentication complete cb type */
|
||||
|
||||
/**
|
||||
* @brief union associated with ble security
|
||||
@ -845,6 +880,10 @@ typedef uint8_t esp_ble_gap_adv_type_t;
|
||||
/// Extend advertising tx power, range: [-127, +126] dBm
|
||||
#define EXT_ADV_TX_PWR_NO_PREFERENCE (127) /*!< host has no preference for tx power */
|
||||
|
||||
|
||||
/// max number of advertising sets to enable or disable
|
||||
#define EXT_ADV_NUM_SETS_MAX (10) /*!< max evt instance num */
|
||||
|
||||
/**
|
||||
* @brief ext adv parameters
|
||||
*/
|
||||
@ -1030,6 +1069,11 @@ typedef struct {
|
||||
} esp_ble_gap_past_params_t;
|
||||
#endif // #if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
|
||||
|
||||
typedef enum{
|
||||
ESP_BLE_NETWORK_PRIVACY_MODE = 0X00, /*!< Network Privacy Mode for peer device (default) */
|
||||
ESP_BLE_DEVICE_PRIVACY_MODE = 0X01, /*!< Device Privacy Mode for peer device */
|
||||
} esp_ble_privacy_mode_t;
|
||||
|
||||
/**
|
||||
* @brief Gap callback parameters union
|
||||
*/
|
||||
@ -1250,72 +1294,86 @@ typedef union {
|
||||
*/
|
||||
struct ble_ext_adv_set_rand_addr_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate extend advertising random address set status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} ext_adv_set_rand_addr; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_ext_adv_set_params_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate extend advertising parameters set status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} ext_adv_set_params; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_ext_adv_data_set_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate extend advertising data set status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} ext_adv_data_set; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_ext_adv_scan_rsp_set_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate extend advertising scan response data set status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} scan_rsp_set; /*!< Event parameter of ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_ext_adv_start_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate advertising start operation success status */
|
||||
uint8_t instance_num; /*!< extend advertising handle numble*/
|
||||
uint8_t instance[EXT_ADV_NUM_SETS_MAX]; /*!< extend advertising handle list*/
|
||||
} ext_adv_start; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_ext_adv_stop_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate advertising stop operation success status */
|
||||
uint8_t instance_num; /*!< extend advertising handle numble*/
|
||||
uint8_t instance[EXT_ADV_NUM_SETS_MAX]; /*!< extend advertising handle list*/
|
||||
} ext_adv_stop; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_EXT_ADV_SET_REMOVE_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_ext_adv_set_remove_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate advertising stop operation success status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} ext_adv_remove; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_SET_REMOVE_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_EXT_ADV_SET_CLEAR_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_ext_adv_set_clear_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate advertising stop operation success status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} ext_adv_clear; /*!< Event parameter of ESP_GAP_BLE_EXT_ADV_SET_CLEAR_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_periodic_adv_set_params_cmpl_param {
|
||||
esp_bt_status_t status; /*!< Indicate periodic advertisingparameters set status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} peroid_adv_set_params; /*!< Event parameter of ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_periodic_adv_data_set_cmpl_param {
|
||||
esp_bt_status_t status; /*!< Indicate periodic advertising data set status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} period_adv_data_set; /*!< Event parameter of ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_periodic_adv_start_cmpl_param {
|
||||
esp_bt_status_t status; /*!< Indicate periodic advertising start status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} period_adv_start; /*!< Event parameter of ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_PERIODIC_ADV_STOP_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_periodic_adv_stop_cmpl_param {
|
||||
esp_bt_status_t status; /*!< Indicate periodic advertising stop status */
|
||||
uint8_t instance; /*!< extend advertising handle */
|
||||
} period_adv_stop; /*!< Event parameter of ESP_GAP_BLE_PERIODIC_ADV_STOP_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT
|
||||
@ -1507,6 +1565,12 @@ typedef union {
|
||||
uint16_t param_len; /*!< The length of parameter buffer */
|
||||
uint8_t *p_param_buf; /*!< The point of parameter buffer */
|
||||
} vendor_cmd_cmpl; /*!< Event parameter of ESP_GAP_BLE_VENDOR_CMD_COMPLETE_EVT */
|
||||
/**
|
||||
* @brief ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT
|
||||
*/
|
||||
struct ble_set_privacy_mode_cmpl_evt_param {
|
||||
esp_bt_status_t status; /*!< Indicate privacy mode set operation success status */
|
||||
} set_privacy_mode_cmpl; /*!< Event parameter of ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT */
|
||||
} esp_ble_gap_cb_param_t;
|
||||
|
||||
/**
|
||||
@ -2640,6 +2704,21 @@ esp_err_t esp_ble_gap_clear_advertising(void);
|
||||
*/
|
||||
esp_err_t esp_ble_gap_vendor_command_send(esp_ble_vendor_cmd_params_t *vendor_cmd_param);
|
||||
|
||||
/**
|
||||
* @brief This function set the privacy mode of the device in resolving list.
|
||||
*
|
||||
* @note This feature is not supported on ESP32.
|
||||
*
|
||||
* @param[in] addr_type: The address type of the peer identity address (BLE_ADDR_TYPE_PUBLIC or BLE_ADDR_TYPE_RANDOM).
|
||||
* @param[in] addr: The peer identity address of the device.
|
||||
* @param[in] mode: The privacy mode of the device.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK : success
|
||||
* - other : failed
|
||||
*/
|
||||
esp_err_t esp_ble_gap_set_privacy_mode(esp_ble_addr_type_t addr_type, esp_bd_addr_t addr, esp_ble_privacy_mode_t mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -299,10 +299,14 @@ esp_err_t esp_ble_gattc_app_register(uint16_t app_id);
|
||||
|
||||
/**
|
||||
* @brief This function is called to unregister an application
|
||||
* from GATTC module.
|
||||
* from the GATTC module.
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
*
|
||||
* @note Before calling this API, ensure that all activities
|
||||
* related to the application, such as connections, scans, ADV,
|
||||
* are properly closed.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK: success
|
||||
* - other: failed
|
||||
@ -608,7 +612,7 @@ esp_gatt_status_t esp_ble_gattc_get_db(esp_gatt_if_t gattc_if, uint16_t conn_id,
|
||||
*
|
||||
* @param[in] gattc_if: Gatt client access interface.
|
||||
* @param[in] conn_id : connection ID.
|
||||
* @param[in] handle : characteritic handle to read.
|
||||
* @param[in] handle : characteristic handle to read.
|
||||
* @param[in] auth_req : authenticate request type
|
||||
*
|
||||
* @return
|
||||
|
@ -5419,6 +5419,10 @@ void bta_dm_ble_scan (tBTA_DM_MSG *p_data)
|
||||
status = (status == BTM_CMD_STARTED ? BTA_SUCCESS : BTA_FAILURE);
|
||||
p_data->ble_scan.p_stop_scan_cback(status);
|
||||
}
|
||||
|
||||
// reset BLE scan link state when stop scan
|
||||
btm_ble_clear_topology_mask(BTM_BLE_STATE_ACTIVE_SCAN_BIT);
|
||||
btm_ble_clear_topology_mask(BTM_BLE_STATE_PASSIVE_SCAN_BIT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5838,6 +5842,13 @@ void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data)
|
||||
p_data->add_dev_to_resolving_list.p_add_dev_to_resolving_list_callback);
|
||||
}
|
||||
|
||||
void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
APPL_TRACE_API("%s, privacy_mode = %d", __func__, p_data->ble_set_privacy_mode.privacy_mode);
|
||||
BTM_BleSetPrivacyMode(p_data->ble_set_privacy_mode.addr_type, p_data->ble_set_privacy_mode.addr,
|
||||
p_data->ble_set_privacy_mode.privacy_mode, p_data->ble_set_privacy_mode.p_cback);
|
||||
}
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data)
|
||||
{
|
||||
|
@ -2679,6 +2679,21 @@ void BTA_DmBleDtmStop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
}
|
||||
}
|
||||
|
||||
void BTA_DmBleSetPrivacyMode(uint8_t addr_type, BD_ADDR addr, uint8_t privacy_mode, tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback)
|
||||
{
|
||||
tBTA_DM_API_SET_PRIVACY_MODE *p_msg;
|
||||
|
||||
if ((p_msg = (tBTA_DM_API_SET_PRIVACY_MODE *)osi_malloc(sizeof(tBTA_DM_API_SET_PRIVACY_MODE)))
|
||||
!= NULL) {
|
||||
p_msg->hdr.event = BTA_DM_API_SET_PRIVACY_MODE_EVT;
|
||||
p_msg->addr_type = addr_type;
|
||||
memcpy(p_msg->addr, addr, sizeof(BD_ADDR));
|
||||
p_msg->privacy_mode = privacy_mode;
|
||||
p_msg->p_cback = p_cback;
|
||||
bta_sys_sendmsg(p_msg);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -52,6 +52,18 @@ tBTE_APPL_CFG bte_appl_cfg = {
|
||||
BTM_BLE_ONLY_ACCEPT_SPECIFIED_SEC_AUTH_DISABLE,
|
||||
BTM_BLE_OOB_DISABLE,
|
||||
};
|
||||
|
||||
void bta_dm_co_security_param_init(void)
|
||||
{
|
||||
bte_appl_cfg.ble_auth_req = BTA_LE_AUTH_REQ_SC_MITM_BOND;
|
||||
bte_appl_cfg.ble_io_cap = BTM_LOCAL_IO_CAPS_BLE;
|
||||
bte_appl_cfg.ble_init_key = BTM_BLE_INITIATOR_KEY_SIZE;
|
||||
bte_appl_cfg.ble_resp_key = BTM_BLE_RESPONDER_KEY_SIZE;
|
||||
bte_appl_cfg.ble_max_key_size = BTM_BLE_MAX_KEY_SIZE;
|
||||
bte_appl_cfg.ble_min_key_size = BTM_BLE_MIN_KEY_SIZE;
|
||||
bte_appl_cfg.ble_accept_auth_enable = BTM_BLE_ONLY_ACCEPT_SPECIFIED_SEC_AUTH_DISABLE;
|
||||
bte_appl_cfg.oob_support = BTM_BLE_OOB_DISABLE;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if (defined CLASSIC_BT_INCLUDED && CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
@ -234,6 +234,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
||||
bta_dm_ble_gap_clear_adv, /* BTA_DM_API_BLE_CLEAR_ADV_EVT */
|
||||
bta_dm_ble_gap_set_rpa_timeout, /* BTA_DM_API_SET_RPA_TIMEOUT_EVT */
|
||||
bta_dm_ble_gap_add_dev_to_resolving_list, /* BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT */
|
||||
bta_dm_ble_gap_set_privacy_mode, /* BTA_DM_API_SET_PRIVACY_MODE_EVT */
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -225,6 +225,7 @@ enum {
|
||||
BTA_DM_API_BLE_CLEAR_ADV_EVT,
|
||||
BTA_DM_API_SET_RPA_TIMEOUT_EVT,
|
||||
BTA_DM_API_ADD_DEV_TO_RESOLVING_LIST_EVT,
|
||||
BTA_DM_API_SET_PRIVACY_MODE_EVT,
|
||||
#endif
|
||||
BTA_DM_MAX_EVT
|
||||
};
|
||||
@ -950,6 +951,14 @@ typedef struct {
|
||||
tBTA_CLEAR_ADV_CMPL_CBACK *p_clear_adv_cback;
|
||||
} tBTA_DM_API_CLEAR_ADV;
|
||||
|
||||
typedef struct {
|
||||
BT_HDR hdr;
|
||||
tBLE_ADDR_TYPE addr_type;
|
||||
BD_ADDR addr;
|
||||
UINT8 privacy_mode;
|
||||
tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback;
|
||||
} tBTA_DM_API_SET_PRIVACY_MODE;
|
||||
|
||||
#endif /* BLE_INCLUDED */
|
||||
|
||||
/* data type for BTA_DM_API_REMOVE_ACL_EVT */
|
||||
@ -1355,6 +1364,7 @@ typedef union {
|
||||
tBTA_DM_API_BLE_DTM_RX_START dtm_rx_start;
|
||||
tBTA_DM_API_BLE_DTM_STOP dtm_stop;
|
||||
tBTA_DM_API_CLEAR_ADV ble_clear_adv;
|
||||
tBTA_DM_API_SET_PRIVACY_MODE ble_set_privacy_mode;
|
||||
#endif
|
||||
|
||||
tBTA_DM_API_REMOVE_ACL remove_acl;
|
||||
@ -1787,6 +1797,9 @@ extern void bta_dm_ble_set_scan_rsp_raw (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data);
|
||||
#if SMP_INCLUDED == TRUE
|
||||
extern void bta_dm_co_security_param_init(void);
|
||||
#endif
|
||||
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
|
||||
extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data);
|
||||
@ -1802,6 +1815,7 @@ extern void bta_dm_ble_gap_dtm_stop(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_clear_adv(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_set_rpa_timeout(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_add_dev_to_resolving_list(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_set_privacy_mode(tBTA_DM_MSG *p_data);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
extern void bta_dm_ble_gap_dtm_enhance_tx_start(tBTA_DM_MSG *p_data);
|
||||
extern void bta_dm_ble_gap_dtm_enhance_rx_start(tBTA_DM_MSG *p_data);
|
||||
|
@ -63,7 +63,7 @@ static void bta_gattc_cmpl_sendmsg(UINT16 conn_id, tGATTC_OPTYPE op,
|
||||
tGATT_CL_COMPLETE *p_data);
|
||||
static void bta_gattc_pop_command_to_send(tBTA_GATTC_CLCB *p_clcb);
|
||||
|
||||
static void bta_gattc_deregister_cmpl(tBTA_GATTC_RCB *p_clreg);
|
||||
void bta_gattc_deregister_cmpl(tBTA_GATTC_RCB *p_clreg);
|
||||
static void bta_gattc_enc_cmpl_cback(tGATT_IF gattc_if, BD_ADDR bda);
|
||||
static void bta_gattc_cong_cback (UINT16 conn_id, BOOLEAN congested);
|
||||
static void bta_gattc_req_cback (UINT16 conn_id, UINT32 trans_id, tGATTS_REQ_TYPE type, tGATTS_DATA *p_data);
|
||||
@ -154,7 +154,7 @@ void bta_gattc_disable(tBTA_GATTC_CB *p_cb)
|
||||
APPL_TRACE_DEBUG("bta_gattc_disable");
|
||||
|
||||
if (p_cb->state != BTA_GATTC_STATE_ENABLED) {
|
||||
APPL_TRACE_ERROR("not enabled or disable in pogress");
|
||||
APPL_TRACE_ERROR("not enabled or disable in progress");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ void bta_gattc_register(tBTA_GATTC_CB *p_cb, tBTA_GATTC_DATA *p_data)
|
||||
if ((p_buf = (tBTA_GATTC_INT_START_IF *) osi_malloc(sizeof(tBTA_GATTC_INT_START_IF))) != NULL) {
|
||||
p_buf->hdr.event = BTA_GATTC_INT_START_IF_EVT;
|
||||
p_buf->client_if = p_cb->cl_rcb[i].client_if;
|
||||
APPL_TRACE_DEBUG("GATTC getbuf sucess.\n");
|
||||
APPL_TRACE_DEBUG("GATTC getbuf success.\n");
|
||||
bta_sys_sendmsg(p_buf);
|
||||
status = BTA_GATT_OK;
|
||||
} else {
|
||||
@ -841,6 +841,9 @@ void bta_gattc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
(* p_cback)(BTA_GATTC_CLOSE_EVT, (tBTA_GATTC *)&cb_data);
|
||||
}
|
||||
|
||||
// Please note that BTA_GATTC_CLOSE_EVT will run in the BTC task.
|
||||
// because bta_gattc_deregister_cmpl did not execute as expected(this is a known issue),
|
||||
// we will run it again in bta_gattc_clcb_dealloc_by_conn_id.
|
||||
if (p_clreg->num_clcb == 0 && p_clreg->dereg_pending) {
|
||||
bta_gattc_deregister_cmpl(p_clreg);
|
||||
}
|
||||
@ -1672,7 +1675,7 @@ void bta_gattc_fail(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
static void bta_gattc_deregister_cmpl(tBTA_GATTC_RCB *p_clreg)
|
||||
void bta_gattc_deregister_cmpl(tBTA_GATTC_RCB *p_clreg)
|
||||
{
|
||||
tBTA_GATTC_CB *p_cb = &bta_gattc_cb;
|
||||
tBTA_GATTC_IF client_if = p_clreg->client_if;
|
||||
@ -2118,7 +2121,7 @@ void bta_gattc_process_indicate(UINT16 conn_id, tGATTC_OPTYPE op, tGATT_CL_COMPL
|
||||
bta_gattc_proc_other_indication(p_clcb, op, p_data, ¬ify);
|
||||
}
|
||||
} else if (op == GATTC_OPTYPE_INDICATION) {
|
||||
/* no one intersted and need ack? */
|
||||
/* no one interested and need ack? */
|
||||
APPL_TRACE_DEBUG("%s no one interested, ack now", __func__);
|
||||
GATTC_SendHandleValueConfirm(conn_id, handle);
|
||||
}
|
||||
@ -2235,7 +2238,7 @@ static void bta_gattc_req_cback (UINT16 conn_id, UINT32 trans_id, tGATTS_REQ_TYP
|
||||
**
|
||||
** Function bta_gattc_init_clcb_conn
|
||||
**
|
||||
** Description Initaite a BTA CLCB connection
|
||||
** Description Initiate a BTA CLCB connection
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@ -2252,7 +2255,7 @@ void bta_gattc_init_clcb_conn(UINT8 cif, BD_ADDR remote_bda)
|
||||
return;
|
||||
}
|
||||
|
||||
/* initaite a new connection here */
|
||||
/* initiate a new connection here */
|
||||
if ((p_clcb = bta_gattc_clcb_alloc(cif, remote_bda, BTA_GATT_TRANSPORT_LE)) != NULL) {
|
||||
gattc_data.hdr.layer_specific = p_clcb->bta_conn_id = conn_id;
|
||||
|
||||
|
@ -160,7 +160,7 @@ UINT8 bta_gattc_num_reg_app(void)
|
||||
**
|
||||
** Function bta_gattc_find_clcb_by_cif
|
||||
**
|
||||
** Description get clcb by client interface and remote bd adddress
|
||||
** Description get clcb by client interface and remote bd address
|
||||
**
|
||||
** Returns pointer to the clcb
|
||||
**
|
||||
@ -322,12 +322,18 @@ void bta_gattc_clcb_dealloc(tBTA_GATTC_CLCB *p_clcb)
|
||||
}
|
||||
}
|
||||
|
||||
extern void bta_gattc_deregister_cmpl(tBTA_GATTC_RCB *p_clreg);
|
||||
void bta_gattc_clcb_dealloc_by_conn_id(UINT16 conn_id)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
if (p_clcb) {
|
||||
tBTA_GATTC_RCB *p_clreg = p_clcb->p_rcb;
|
||||
bta_gattc_clcb_dealloc(p_clcb);
|
||||
// there is a workaround: if there is no connect, we will reset it.
|
||||
if (p_clreg && p_clreg->num_clcb == 0 && p_clreg->dereg_pending) {
|
||||
bta_gattc_deregister_cmpl(p_clreg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,7 +523,7 @@ BOOLEAN bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
cmd_data->api_write.p_value = (UINT8 *)(cmd_data + 1);
|
||||
memcpy(cmd_data->api_write.p_value, p_data->api_write.p_value, len);
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s(), line = %d, alloc fail, no memery.", __func__, __LINE__);
|
||||
APPL_TRACE_ERROR("%s(), line = %d, alloc fail, no memory.", __func__, __LINE__);
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
@ -525,7 +531,7 @@ BOOLEAN bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
memset(cmd_data, 0, sizeof(tBTA_GATTC_DATA));
|
||||
memcpy(cmd_data, p_data, sizeof(tBTA_GATTC_DATA));
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s(), line = %d, alloc fail, no memery.", __func__, __LINE__);
|
||||
APPL_TRACE_ERROR("%s(), line = %d, alloc fail, no memory.", __func__, __LINE__);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -919,7 +925,7 @@ BOOLEAN bta_gattc_conn_dealloc(BD_ADDR remote_bda)
|
||||
**
|
||||
** Function bta_gattc_find_int_conn_clcb
|
||||
**
|
||||
** Description try to locate a clcb when an internal connecion event arrives.
|
||||
** Description try to locate a clcb when an internal connection event arrives.
|
||||
**
|
||||
** Returns pointer to the clcb
|
||||
**
|
||||
|
@ -722,6 +722,26 @@ extern void bta_hd_exit_suspend_act(tBTA_HD_DATA *p_data)
|
||||
bta_sys_idle(BTA_ID_HD, 1, p_cback->addr);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Function bta_hd_open_failure
|
||||
*
|
||||
* Description
|
||||
*
|
||||
* Returns void
|
||||
*
|
||||
******************************************************************************/
|
||||
extern void bta_hd_open_failure(tBTA_HD_DATA *p_data)
|
||||
{
|
||||
tBTA_HD_CBACK_DATA *p_cback = (tBTA_HD_CBACK_DATA *)p_data;
|
||||
tBTA_HD cback_data = {0};
|
||||
|
||||
bdcpy(cback_data.conn.bda, p_cback->addr);
|
||||
cback_data.conn.status = BTA_HD_ERROR;
|
||||
cback_data.conn.conn_status = BTA_HD_CONN_STATE_DISCONNECTED;
|
||||
bta_hd_cb.p_cback(BTA_HD_OPEN_EVT, &cback_data);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Function bta_hd_cback
|
||||
|
@ -62,6 +62,7 @@ enum {
|
||||
BTA_HD_VC_UNPLUG_DONE_ACT,
|
||||
BTA_HD_SUSPEND_ACT,
|
||||
BTA_HD_EXIT_SUSPEND_ACT,
|
||||
BTA_HD_OPEN_FAILURE,
|
||||
BTA_HD_NUM_ACTIONS
|
||||
};
|
||||
|
||||
@ -74,7 +75,7 @@ const tBTA_HD_ACTION bta_hd_action[] = {
|
||||
bta_hd_disconnect_act, bta_hd_add_device_act, bta_hd_remove_device_act, bta_hd_send_report_act,
|
||||
bta_hd_report_error_act, bta_hd_vc_unplug_act, bta_hd_open_act, bta_hd_close_act,
|
||||
bta_hd_intr_data_act, bta_hd_get_report_act, bta_hd_set_report_act, bta_hd_set_protocol_act,
|
||||
bta_hd_vc_unplug_done_act, bta_hd_suspend_act, bta_hd_exit_suspend_act,
|
||||
bta_hd_vc_unplug_done_act, bta_hd_suspend_act, bta_hd_exit_suspend_act, bta_hd_open_failure
|
||||
};
|
||||
|
||||
/* state table information */
|
||||
@ -118,7 +119,7 @@ const uint8_t bta_hd_st_idle[][BTA_HD_NUM_COLS] = {
|
||||
/* BTA_HD_API_REPORT_ERROR_EVT */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
|
||||
/* BTA_HD_API_VC_UNPLUG_EVT */ {BTA_HD_VC_UNPLUG_ACT, BTA_HD_IDLE_ST},
|
||||
/* BTA_HD_INT_OPEN_EVT */ {BTA_HD_OPEN_ACT, BTA_HD_CONN_ST},
|
||||
/* BTA_HD_INT_CLOSE_EVT */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
|
||||
/* BTA_HD_INT_CLOSE_EVT */ {BTA_HD_OPEN_FAILURE, BTA_HD_IDLE_ST},
|
||||
/* BTA_HD_INT_INTR_DATA_EVT */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
|
||||
/* BTA_HD_INT_GET_REPORT_EVT */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
|
||||
/* BTA_HD_INT_SET_REPORT_EVT */ {BTA_HD_IGNORE, BTA_HD_IDLE_ST},
|
||||
|
@ -164,5 +164,6 @@ extern void bta_hd_set_protocol_act(tBTA_HD_DATA *p_data);
|
||||
extern void bta_hd_vc_unplug_done_act(tBTA_HD_DATA *p_data);
|
||||
extern void bta_hd_suspend_act(tBTA_HD_DATA *p_data);
|
||||
extern void bta_hd_exit_suspend_act(tBTA_HD_DATA *p_data);
|
||||
extern void bta_hd_open_failure(tBTA_HD_DATA *p_data);
|
||||
|
||||
#endif
|
||||
|
@ -437,6 +437,8 @@ typedef tBTM_SET_RPA_TIMEOUT_CMPL_CBACK tBTA_SET_RPA_TIMEOUT_CMPL_CBACK;
|
||||
|
||||
typedef tBTM_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK tBTA_ADD_DEV_TO_RESOLVING_LIST_CMPL_CBACK;
|
||||
|
||||
typedef tBTM_SET_PRIVACY_MODE_CMPL_CBACK tBTA_SET_PRIVACY_MODE_CMPL_CBACK;
|
||||
|
||||
typedef tBTM_CMPL_CB tBTA_CMPL_CB;
|
||||
|
||||
typedef tBTM_VSC_CMPL tBTA_VSC_CMPL;
|
||||
@ -2893,6 +2895,8 @@ extern void BTA_DmBleDtmTxStart(uint8_t tx_channel, uint8_t len_of_data, uint8_t
|
||||
extern void BTA_DmBleDtmRxStart(uint8_t rx_channel, tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback);
|
||||
extern void BTA_DmBleDtmStop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback);
|
||||
|
||||
extern void BTA_DmBleSetPrivacyMode(uint8_t addr_type, BD_ADDR addr, uint8_t privacy_mode, tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function BTA_DmBleSetStorageParams
|
||||
|
@ -60,6 +60,7 @@ static void btc_init_bluetooth(void)
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
//load the ble local key which has been stored in the flash
|
||||
btc_dm_load_ble_local_keys();
|
||||
bta_dm_co_security_param_init();
|
||||
#endif ///BLE_INCLUDED == TRUE
|
||||
#endif /* #if (SMP_INCLUDED) */
|
||||
#if BTA_DYNAMIC_MEMORY
|
||||
|
@ -989,34 +989,48 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
|
||||
case BTA_DM_BLE_5_GAP_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT:
|
||||
msg.act = ESP_GAP_BLE_EXT_ADV_SET_RAND_ADDR_COMPLETE_EVT;
|
||||
param.ext_adv_set_rand_addr.status = btc_btm_status_to_esp_status(params->set_ext_rand_addr.status);
|
||||
param.ext_adv_set_rand_addr.instance = params->set_ext_rand_addr.instance;
|
||||
break;
|
||||
case BTA_DM_BLE_5_GAP_EXT_ADV_SET_PARAMS_COMPLETE_EVT: {
|
||||
msg.act = ESP_GAP_BLE_EXT_ADV_SET_PARAMS_COMPLETE_EVT;
|
||||
param.ext_adv_set_rand_addr.status = btc_btm_status_to_esp_status(params->set_params.status);
|
||||
param.ext_adv_set_params.status = btc_btm_status_to_esp_status(params->set_params.status);
|
||||
param.ext_adv_set_params.instance = params->set_params.instance;
|
||||
break;
|
||||
}
|
||||
case BTA_DM_BLE_5_GAP_EXT_ADV_DATA_SET_COMPLETE_EVT: {
|
||||
msg.act = ESP_GAP_BLE_EXT_ADV_DATA_SET_COMPLETE_EVT;
|
||||
param.ext_adv_data_set.status = btc_btm_status_to_esp_status(params->adv_data_set.status);
|
||||
param.ext_adv_data_set.instance = params->adv_data_set.instance;
|
||||
break;
|
||||
}
|
||||
case BTA_DM_BLE_5_GAP_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT: {
|
||||
msg.act = ESP_GAP_BLE_EXT_SCAN_RSP_DATA_SET_COMPLETE_EVT;
|
||||
param.scan_rsp_set.status = btc_btm_status_to_esp_status(params->scan_rsp_data_set.status);
|
||||
param.scan_rsp_set.instance = params->scan_rsp_data_set.instance;
|
||||
break;
|
||||
}
|
||||
case BTA_DM_BLE_5_GAP_EXT_ADV_START_COMPLETE_EVT: {
|
||||
msg.act = ESP_GAP_BLE_EXT_ADV_START_COMPLETE_EVT;
|
||||
param.ext_adv_start.status = btc_btm_status_to_esp_status(params->adv_start.status);
|
||||
for (UINT8 i = 0; i < params->adv_start.instance_num; i++) {
|
||||
param.ext_adv_start.instance[i] = params->adv_start.instance[i];
|
||||
}
|
||||
|
||||
param.ext_adv_start.instance_num = params->adv_start.instance_num;
|
||||
break;
|
||||
}
|
||||
case BTA_DM_BLE_5_GAP_EXT_ADV_STOP_COMPLETE_EVT:
|
||||
msg.act = ESP_GAP_BLE_EXT_ADV_STOP_COMPLETE_EVT;
|
||||
param.ext_adv_stop.status = btc_btm_status_to_esp_status(params->adv_start.status);
|
||||
for (UINT8 i = 0; i < params->adv_start.instance_num; i++) {
|
||||
param.ext_adv_stop.instance[i] = params->adv_start.instance[i];
|
||||
}
|
||||
param.ext_adv_stop.instance_num = params->adv_start.instance_num;
|
||||
break;
|
||||
case BTA_DM_BLE_5_GAP_EXT_ADV_SET_REMOVE_COMPLETE_EVT:
|
||||
msg.act = ESP_GAP_BLE_EXT_ADV_SET_REMOVE_COMPLETE_EVT;
|
||||
param.ext_adv_remove.status = btc_btm_status_to_esp_status(params->adv_start.status);
|
||||
param.ext_adv_remove.instance = params->adv_start.instance[0];
|
||||
break;
|
||||
case BTA_DM_BLE_5_GAP_EXT_ADV_SET_CLEAR_COMPLETE_EVT:
|
||||
msg.act = ESP_GAP_BLE_EXT_ADV_SET_CLEAR_COMPLETE_EVT;
|
||||
@ -1025,21 +1039,25 @@ static void btc_ble_5_gap_callback(tBTA_DM_BLE_5_GAP_EVENT event,
|
||||
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT: {
|
||||
msg.act = ESP_GAP_BLE_PERIODIC_ADV_SET_PARAMS_COMPLETE_EVT;
|
||||
param.peroid_adv_set_params.status = btc_btm_status_to_esp_status(params->per_adv_set_params.status);
|
||||
param.peroid_adv_set_params.instance = params->per_adv_set_params.instance;
|
||||
break;
|
||||
}
|
||||
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_DATA_SET_COMPLETE_EVT: {
|
||||
msg.act = ESP_GAP_BLE_PERIODIC_ADV_DATA_SET_COMPLETE_EVT;
|
||||
param.period_adv_data_set.status = btc_btm_status_to_esp_status(params->per_adv_data_set.status);
|
||||
param.period_adv_data_set.instance = params->per_adv_data_set.instance;
|
||||
break;
|
||||
}
|
||||
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_START_COMPLETE_EVT: {
|
||||
msg.act = ESP_GAP_BLE_PERIODIC_ADV_START_COMPLETE_EVT;
|
||||
param.period_adv_start.status = btc_btm_status_to_esp_status(params->per_adv_start.status);
|
||||
param.period_adv_start.instance = params->per_adv_start.instance;
|
||||
break;
|
||||
}
|
||||
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_STOP_COMPLETE_EVT: {
|
||||
msg.act = ESP_GAP_BLE_PERIODIC_ADV_STOP_COMPLETE_EVT;
|
||||
param.period_adv_stop.status = btc_btm_status_to_esp_status(params->per_adv_stop.status);
|
||||
param.period_adv_stop.instance = params->per_adv_stop.instance;
|
||||
break;
|
||||
}
|
||||
case BTA_DM_BLE_5_GAP_PERIODIC_ADV_CREATE_SYNC_COMPLETE_EVT: {
|
||||
@ -1326,6 +1344,25 @@ static void btc_ble_vendor_hci_cmd_complete_callback(tBTA_VSC_CMPL *p_param)
|
||||
}
|
||||
}
|
||||
|
||||
static void btc_ble_set_privacy_mode_callback(UINT8 status)
|
||||
{
|
||||
esp_ble_gap_cb_param_t param;
|
||||
bt_status_t ret;
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
msg.sig = BTC_SIG_API_CB;
|
||||
msg.pid = BTC_PID_GAP_BLE;
|
||||
msg.act = ESP_GAP_BLE_SET_PRIVACY_MODE_COMPLETE_EVT;
|
||||
|
||||
param.set_privacy_mode_cmpl.status = btc_btm_status_to_esp_status(status);
|
||||
|
||||
ret = btc_transfer_context(&msg, ¶m, sizeof(esp_ble_gap_cb_param_t), NULL, NULL);
|
||||
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
void btc_get_whitelist_size(uint16_t *length)
|
||||
{
|
||||
BTM_BleGetWhiteListSize(length);
|
||||
@ -1504,6 +1541,13 @@ static void btc_ble_dtm_stop(tBTA_DTM_CMD_CMPL_CBACK *p_dtm_cmpl_cback)
|
||||
BTA_DmBleDtmStop(p_dtm_cmpl_cback);
|
||||
}
|
||||
|
||||
static void btc_ble_set_privacy_mode(uint8_t addr_type,
|
||||
BD_ADDR addr,
|
||||
uint8_t privacy_mode,
|
||||
tBTA_SET_PRIVACY_MODE_CMPL_CBACK *p_cback)
|
||||
{
|
||||
BTA_DmBleSetPrivacyMode(addr_type, addr, privacy_mode, p_cback);
|
||||
}
|
||||
|
||||
void btc_gap_ble_cb_handler(btc_msg_t *msg)
|
||||
{
|
||||
@ -2354,6 +2398,10 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
arg->vendor_cmd_send.p_param_buf,
|
||||
btc_ble_vendor_hci_cmd_complete_callback);
|
||||
break;
|
||||
case BTC_GAP_BLE_SET_PRIVACY_MODE:
|
||||
btc_ble_set_privacy_mode(arg->set_privacy_mode.addr_type, arg->set_privacy_mode.addr,
|
||||
arg->set_privacy_mode.privacy_mode, btc_ble_set_privacy_mode_callback);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -2364,6 +2412,7 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
//register connection parameter update callback
|
||||
void btc_gap_callback_init(void)
|
||||
{
|
||||
BTM_BleRegiseterPktLengthChangeCallback(btc_set_pkt_length_callback);
|
||||
BTM_BleRegiseterConnParamCallback(btc_update_conn_param_callback);
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
BTM_BleGapRegisterCallback(btc_ble_5_gap_callback);
|
||||
|
@ -261,7 +261,7 @@ static void btc_hd_deinit(void)
|
||||
}
|
||||
|
||||
btc_hd_cb.service_dereg_active = FALSE;
|
||||
// unresgister app will also relase the connection
|
||||
// unregister app will also release the connection
|
||||
// and disable after receiving unregister event from lower layer
|
||||
if (is_hidd_app_register()) {
|
||||
btc_hd_unregister_app(true);
|
||||
@ -844,6 +844,8 @@ void btc_hd_cb_handler(btc_msg_t *msg)
|
||||
// }
|
||||
// btc_storage_set_hidd((bt_bdaddr_t *)&p_data->conn.bda);
|
||||
btc_hd_cb.status = BTC_HD_CONNECTED;
|
||||
} else if (p_data->conn.conn_status == BTA_HD_CONN_STATE_DISCONNECTED) {
|
||||
btc_hd_cb.status = BTC_HD_DISCONNECTED;
|
||||
}
|
||||
param.open.status = p_data->conn.status;
|
||||
param.open.conn_status = p_data->conn.conn_status;
|
||||
|
@ -105,6 +105,7 @@ typedef enum {
|
||||
BTC_GAP_BLE_ACT_SET_RESOLVABLE_PRIVATE_ADDRESS_TIMEOUT,
|
||||
BTC_GAP_BLE_ACT_ADD_DEVICE_TO_RESOLVING_LIST,
|
||||
BTC_GAP_BLE_ACT_VENDOR_HCI_CMD_EVT,
|
||||
BTC_GAP_BLE_SET_PRIVACY_MODE,
|
||||
} btc_gap_ble_act_t;
|
||||
|
||||
/* btc_ble_gap_args_t */
|
||||
@ -267,9 +268,15 @@ typedef union {
|
||||
uint8_t param_len;
|
||||
uint8_t *p_param_buf;
|
||||
} vendor_cmd_send;
|
||||
// BTC_GAP_BLE_SET_PRIVACY_MODE
|
||||
struct set_privacy_mode {
|
||||
esp_ble_addr_type_t addr_type;
|
||||
esp_bd_addr_t addr;
|
||||
uint8_t privacy_mode;
|
||||
} set_privacy_mode;
|
||||
} btc_ble_gap_args_t;
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
typedef union {
|
||||
struct read_phy_args {
|
||||
esp_bd_addr_t bd_addr;
|
||||
|
@ -906,7 +906,6 @@ void btc_l2cap_cb_handler(btc_msg_t *msg)
|
||||
fixed_queue_enqueue(slot->rx.queue, p_data_buf, FIXED_QUEUE_MAX_TIMEOUT);
|
||||
} else {
|
||||
osi_free(p_data_buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
osi_mutex_unlock(&l2cap_local_param.l2cap_slot_mutex);
|
||||
@ -945,12 +944,11 @@ void btc_l2cap_cb_handler(btc_msg_t *msg)
|
||||
break; // to do disconnect
|
||||
}
|
||||
memset(p_data_buf, 0, count + sizeof(BT_HDR));
|
||||
p_data_buf->len = BTA_JvL2capRead(p_data->data_ind.handle, slot->id, p_data_buf->data, count);
|
||||
p_data_buf->len = BTA_JvL2capRead(p_data->l2c_read.handle, slot->id, p_data_buf->data, count);
|
||||
if (p_data_buf->len > 0) {
|
||||
fixed_queue_enqueue(slot->rx.queue, p_data_buf, FIXED_QUEUE_MAX_TIMEOUT);
|
||||
} else {
|
||||
osi_free(p_data_buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
osi_mutex_unlock(&l2cap_local_param.l2cap_slot_mutex);
|
||||
@ -1060,7 +1058,7 @@ static ssize_t l2cap_vfs_write(int fd, const void * data, size_t size)
|
||||
if (!enqueue_status) {
|
||||
BTC_TRACE_DEBUG("%s tx_len:%d, fd:%d\n", __func__, fixed_queue_length(slot->tx.queue), fd);
|
||||
osi_mutex_unlock(&l2cap_local_param.l2cap_slot_mutex);
|
||||
//block untill under water level, be closed or time out
|
||||
//block until under water level, be closed or time out
|
||||
tx_event_group_val =
|
||||
xEventGroupWaitBits(l2cap_local_param.tx_event_group, SLOT_WRITE_BIT(serial) | SLOT_CLOSE_BIT(serial), pdTRUE,
|
||||
pdFALSE, VFS_WRITE_TIMEOUT / portTICK_PERIOD_MS);
|
||||
|
@ -218,7 +218,13 @@
|
||||
#define UC_BT_SMP_MAX_BONDS 8
|
||||
#endif
|
||||
|
||||
//Device Nane Maximum Length
|
||||
#ifdef CONFIG_BT_BLE_SMP_ID_RESET_ENABLE
|
||||
#define UC_BT_BLE_SMP_ID_RESET_ENABLE CONFIG_BT_BLE_SMP_ID_RESET_ENABLE
|
||||
#else
|
||||
#define UC_BT_BLE_SMP_ID_RESET_ENABLE FALSE
|
||||
#endif
|
||||
|
||||
//Device Name Maximum Length
|
||||
#ifdef CONFIG_BT_MAX_DEVICE_NAME_LEN
|
||||
#define UC_MAX_LOC_BD_NAME_LEN CONFIG_BT_MAX_DEVICE_NAME_LEN
|
||||
#else
|
||||
|
@ -290,6 +290,12 @@
|
||||
#define SMP_SLAVE_CON_PARAMS_UPD_ENABLE FALSE
|
||||
#endif /* UC_BT_SMP_SLAVE_CON_PARAMS_UPD_ENABLE */
|
||||
|
||||
#if (UC_BT_BLE_SMP_ID_RESET_ENABLE)
|
||||
#define BLE_SMP_ID_RESET_ENABLE TRUE
|
||||
#else
|
||||
#define BLE_SMP_ID_RESET_ENABLE FALSE
|
||||
#endif
|
||||
|
||||
#ifdef UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP
|
||||
#define BLE_ADV_REPORT_FLOW_CONTROL (UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP && BLE_INCLUDED)
|
||||
#endif /* UC_BTDM_BLE_ADV_REPORT_FLOW_CTRL_SUPP */
|
||||
@ -569,7 +575,7 @@
|
||||
#define BT_CLASSIC_BQB_INCLUDED FALSE
|
||||
#endif
|
||||
|
||||
/* This feature is used to eanble interleaved scan*/
|
||||
/* This feature is used to enable interleaved scan*/
|
||||
#ifndef BTA_HOST_INTERLEAVE_SEARCH
|
||||
#define BTA_HOST_INTERLEAVE_SEARCH FALSE
|
||||
#endif
|
||||
@ -1385,7 +1391,7 @@
|
||||
#define GATT_CONFORMANCE_TESTING FALSE
|
||||
#endif
|
||||
|
||||
/* number of background connection device allowence, ideally to be the same as WL size
|
||||
/* number of background connection device allowance, ideally to be the same as WL size
|
||||
*/
|
||||
#ifndef GATT_MAX_BG_CONN_DEV
|
||||
#define GATT_MAX_BG_CONN_DEV 8 /*MAX is 32*/
|
||||
|
@ -35,10 +35,6 @@
|
||||
#include "esp_bluedroid_hci.h"
|
||||
#include "stack/hcimsgs.h"
|
||||
|
||||
#if ((BT_CONTROLLER_INCLUDED == TRUE) && SOC_ESP_NIMBLE_CONTROLLER)
|
||||
#include "nimble/ble_hci_trans.h"
|
||||
#endif
|
||||
|
||||
#if (C2H_FLOW_CONTROL_INCLUDED == TRUE)
|
||||
#include "l2c_int.h"
|
||||
#endif ///C2H_FLOW_CONTROL_INCLUDED == TRUE
|
||||
@ -541,6 +537,26 @@ static void host_send_pkt_available_cb(void)
|
||||
hci_downstream_data_post(OSI_THREAD_MAX_TIMEOUT);
|
||||
}
|
||||
|
||||
|
||||
void bt_record_hci_data(uint8_t *data, uint16_t len)
|
||||
{
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
if ((data[0] == DATA_TYPE_EVENT) && (data[1] == HCI_BLE_EVENT) && ((data[3] == HCI_BLE_ADV_PKT_RPT_EVT) || (data[3] == HCI_BLE_DIRECT_ADV_EVT)
|
||||
#if (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
|| (data[3] == HCI_BLE_ADV_DISCARD_REPORT_EVT)
|
||||
#endif // (BLE_ADV_REPORT_FLOW_CONTROL == TRUE)
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
|| (data[3] == HCI_BLE_EXT_ADV_REPORT_EVT) || (data[3] == HCI_BLE_PERIOD_ADV_REPORT_EVT)
|
||||
#endif // (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
)) {
|
||||
bt_hci_log_record_hci_adv(HCI_LOG_DATA_TYPE_ADV, &data[2], len - 2);
|
||||
} else {
|
||||
uint8_t data_type = ((data[0] == 2) ? HCI_LOG_DATA_TYPE_C2H_ACL : data[0]);
|
||||
bt_hci_log_record_hci_data(data_type, &data[1], len - 1);
|
||||
}
|
||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
}
|
||||
|
||||
static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
{
|
||||
//Target has packet to host, malloc new buffer for packet
|
||||
@ -552,13 +568,11 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bt_record_hci_data(data, len);
|
||||
|
||||
bool is_adv_rpt = host_recv_adv_packet(data);
|
||||
|
||||
if (!is_adv_rpt) {
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
uint8_t data_type = ((data[0] == 2) ? HCI_LOG_DATA_TYPE_C2H_ACL : data[0]);
|
||||
bt_hci_log_record_hci_data(data_type, data, len);
|
||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
pkt_size = BT_HDR_SIZE + len;
|
||||
pkt = (BT_HDR *) osi_calloc(pkt_size);
|
||||
if (!pkt) {
|
||||
@ -572,10 +586,6 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
memcpy(pkt->data, data, len);
|
||||
fixed_queue_enqueue(hci_hal_env.rx_q, pkt, FIXED_QUEUE_MAX_TIMEOUT);
|
||||
} else {
|
||||
#if (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
// data type is adv report
|
||||
bt_hci_log_record_hci_adv(HCI_LOG_DATA_TYPE_ADV, data, len);
|
||||
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
|
||||
#if !BLE_ADV_REPORT_FLOW_CONTROL
|
||||
// drop the packets if pkt_queue length goes beyond upper limit
|
||||
if (pkt_queue_length(hci_hal_env.adv_rpt_q) > HCI_HAL_BLE_ADV_RPT_QUEUE_LEN_MAX) {
|
||||
@ -608,42 +618,7 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#if ((BT_CONTROLLER_INCLUDED == TRUE) && SOC_ESP_NIMBLE_CONTROLLER)
|
||||
|
||||
int
|
||||
ble_hs_hci_rx_evt(uint8_t *hci_ev, void *arg)
|
||||
{
|
||||
if(esp_bluedroid_get_status() == ESP_BLUEDROID_STATUS_UNINITIALIZED) {
|
||||
ble_hci_trans_buf_free(hci_ev);
|
||||
return 0;
|
||||
}
|
||||
uint16_t len = hci_ev[1] + 3;
|
||||
uint8_t *data = (uint8_t *)malloc(len);
|
||||
assert(data != NULL);
|
||||
data[0] = 0x04;
|
||||
memcpy(&data[1], hci_ev, len - 1);
|
||||
ble_hci_trans_buf_free(hci_ev);
|
||||
host_recv_pkt_cb(data, len);
|
||||
free(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ble_hs_rx_data(struct os_mbuf *om, void *arg)
|
||||
{
|
||||
uint16_t len = OS_MBUF_PKTHDR(om)->omp_len + 1;
|
||||
uint8_t *data = (uint8_t *)malloc(len);
|
||||
assert(data != NULL);
|
||||
data[0] = 0x02;
|
||||
os_mbuf_copydata(om, 0, len - 1, &data[1]);
|
||||
host_recv_pkt_cb(data, len);
|
||||
free(data);
|
||||
os_mbuf_free_chain(om);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
static const esp_bluedroid_hci_driver_callbacks_t hci_host_cb = {
|
||||
.notify_host_send_available = host_send_pkt_available_cb,
|
||||
.notify_host_recv = host_recv_pkt_cb,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user