forked from espressif/esp-idf
Compare commits
565 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e088c3766b | ||
|
|
8d2dbd461f | ||
|
|
5d78511eac | ||
|
|
cd2172935d | ||
|
|
77b74ab091 | ||
|
|
45288496fb | ||
|
|
feecbad7db | ||
|
|
d5396e1d84 | ||
|
|
461db723f1 | ||
|
|
98c39e28c8 | ||
|
|
25876e8f49 | ||
|
|
5d49509969 | ||
|
|
3fd0eff833 | ||
|
|
8f91dfed12 | ||
|
|
951f3300ed | ||
|
|
dced82b949 | ||
|
|
68ac16c010 | ||
|
|
0be661f8bf | ||
|
|
e5199390a3 | ||
|
|
94d129df76 | ||
|
|
aaf04f514f | ||
|
|
6ec52679c3 | ||
|
|
2c196590d3 | ||
|
|
96934613fb | ||
|
|
c97181ad5e | ||
|
|
602d021263 | ||
|
|
d6c18ad4c5 | ||
|
|
a56ea11f91 | ||
|
|
761af9869f | ||
|
|
d73f61ebc9 | ||
|
|
bba48079a2 | ||
|
|
6eb872f7d2 | ||
|
|
827d863865 | ||
|
|
afcf3e261b | ||
|
|
01c6fc6511 | ||
|
|
4cb955461f | ||
|
|
adcc697082 | ||
|
|
ffaef9971a | ||
|
|
727f7cbb3a | ||
|
|
0ba37a2b85 | ||
|
|
12f1c165e3 | ||
|
|
31212f284a | ||
|
|
c2681f00aa | ||
|
|
4fc329fc10 | ||
|
|
a4d64dab30 | ||
|
|
2f9bb7937a | ||
|
|
fbfdd97343 | ||
|
|
5dfbd1eb8d | ||
|
|
58a01eb10b | ||
|
|
c5703cff8d | ||
|
|
dab45c243a | ||
|
|
1acc14bf72 | ||
|
|
bb845e1841 | ||
|
|
45eb0b6271 | ||
|
|
56eef9151f | ||
|
|
59672cee17 | ||
|
|
d83fe16c93 | ||
|
|
d026b92c75 | ||
|
|
b98bcd75aa | ||
|
|
a28ef8df5b | ||
|
|
9fa9621a8f | ||
|
|
a0d882c25e | ||
|
|
c612f36786 | ||
|
|
4cf31c3194 | ||
|
|
6fb014d535 | ||
|
|
5e60fb9924 | ||
|
|
ce1a619252 | ||
|
|
c7654d7c6b | ||
|
|
fcb3ae32cb | ||
|
|
125014d242 | ||
|
|
7a30edc412 | ||
|
|
79b1379662 | ||
|
|
5f6f20ea30 | ||
|
|
e0e4642ff8 | ||
|
|
c64231564a | ||
|
|
c624b0a45e | ||
|
|
99c0715962 | ||
|
|
020eba74c6 | ||
|
|
14819cb409 | ||
|
|
de15b6f819 | ||
|
|
b8bbd90ad4 | ||
|
|
9df77e015a | ||
|
|
2aaa5579f0 | ||
|
|
3298a8a483 | ||
|
|
dbe7c4a78d | ||
|
|
aff298be18 | ||
|
|
3b8853b3c0 | ||
|
|
3187b8b326 | ||
|
|
38d54b4b62 | ||
|
|
c4377e8dcc | ||
|
|
b530d768e6 | ||
|
|
d84e6c3dda | ||
|
|
077cb8d150 | ||
|
|
b21005487d | ||
|
|
d2fb32ed70 | ||
|
|
9158cba846 | ||
|
|
16d849b95e | ||
|
|
34dccf840e | ||
|
|
77f6f72b83 | ||
|
|
f447ee35b8 | ||
|
|
77429e3ef7 | ||
|
|
2d1544b863 | ||
|
|
82fde1e823 | ||
|
|
ec35c2ab60 | ||
|
|
f69ea24d15 | ||
|
|
bba66a1566 | ||
|
|
4f37aeb747 | ||
|
|
895d86621b | ||
|
|
8692da51a0 | ||
|
|
e9a3a3eeea | ||
|
|
fa95b46a0d | ||
|
|
da8b9ad59d | ||
|
|
1296991b2f | ||
|
|
727a8cdb9e | ||
|
|
8abdb33072 | ||
|
|
fabe338a7a | ||
|
|
7ae116e3b2 | ||
|
|
7148d826eb | ||
|
|
5ec30e6fc2 | ||
|
|
6c62d13550 | ||
|
|
ee3452d410 | ||
|
|
78683c7c33 | ||
|
|
a98db6dbd3 | ||
|
|
6a5d4e40d2 | ||
|
|
395ad3edc0 | ||
|
|
cb6946cf00 | ||
|
|
e6ddff69da | ||
|
|
6585c521b3 | ||
|
|
cb29bfa6b4 | ||
|
|
dd0afffde3 | ||
|
|
77c60765ca | ||
|
|
320f8ebe7d | ||
|
|
7d6a86062b | ||
|
|
bf4e212950 | ||
|
|
d7604b580a | ||
|
|
77876e5bea | ||
|
|
d0a2424151 | ||
|
|
aa5b7e0100 | ||
|
|
f195d48764 | ||
|
|
8e25eb1e08 | ||
|
|
aba746cdc2 | ||
|
|
b188085ce8 | ||
|
|
9021fab579 | ||
|
|
d8db9235ff | ||
|
|
ae5f8dc139 | ||
|
|
958ae62197 | ||
|
|
2b1269d4fb | ||
|
|
124cce0de3 | ||
|
|
78e641a4b0 | ||
|
|
04b0929d94 | ||
|
|
f718d26d31 | ||
|
|
cfa70abe0e | ||
|
|
adc2bf1e93 | ||
|
|
d938559efb | ||
|
|
02aa8e1a89 | ||
|
|
34b4936a7d | ||
|
|
62bd3973f6 | ||
|
|
d4bb163e32 | ||
|
|
649541e6e3 | ||
|
|
3fc984690f | ||
|
|
73e380cc3a | ||
|
|
7c4cd75fe7 | ||
|
|
2f56bd8aac | ||
|
|
5cd0b6216a | ||
|
|
2c70cda9b6 | ||
|
|
ef805e64a2 | ||
|
|
00ef8391af | ||
|
|
19d8bdbd10 | ||
|
|
8f7829d94e | ||
|
|
1f0982c0fc | ||
|
|
dc46fe5343 | ||
|
|
a2d8225c9d | ||
|
|
5492f382f9 | ||
|
|
a300e79589 | ||
|
|
9745b7fab0 | ||
|
|
e2e5894bc2 | ||
|
|
bcd5eea0ea | ||
|
|
5ed5b83f70 | ||
|
|
7a455c15f7 | ||
|
|
30c5638ce6 | ||
|
|
73f16d0af2 | ||
|
|
cab8159187 | ||
|
|
51cef99b71 | ||
|
|
6acc155516 | ||
|
|
d21e332281 | ||
|
|
e27b44e661 | ||
|
|
074850e87c | ||
|
|
d8ee45ce08 | ||
|
|
5da5e1801b | ||
|
|
f76f3dc83f | ||
|
|
dd9bcef9ea | ||
|
|
e1a4d33575 | ||
|
|
6c4c0c0c78 | ||
|
|
cadf80e875 | ||
|
|
7f722715b9 | ||
|
|
68910618fc | ||
|
|
eb04ccaf0b | ||
|
|
b422504d10 | ||
|
|
55d30cdf2a | ||
|
|
6b1e3924af | ||
|
|
043893a49f | ||
|
|
aee329de2b | ||
|
|
2ac7558da2 | ||
|
|
b4d951fa6a | ||
|
|
4f537d3b98 | ||
|
|
65bf500d29 | ||
|
|
cc1526c570 | ||
|
|
9fb1b59054 | ||
|
|
3095888aaf | ||
|
|
0c7e2a9d14 | ||
|
|
a0e8f5aa03 | ||
|
|
168c47f896 | ||
|
|
26046c054e | ||
|
|
a09b89b36d | ||
|
|
196fc559b4 | ||
|
|
7d11517a68 | ||
|
|
966312e54f | ||
|
|
788f1def16 | ||
|
|
6b2209c41d | ||
|
|
7f69e29bff | ||
|
|
fa8f99249c | ||
|
|
ba54ce8657 | ||
|
|
174c38ba5c | ||
|
|
819da74d9f | ||
|
|
8e2de1b594 | ||
|
|
3fc633e326 | ||
|
|
7db5541c9f | ||
|
|
6f253e2d37 | ||
|
|
7e3463768f | ||
|
|
3603611af1 | ||
|
|
f002aeae3d | ||
|
|
573755a8d2 | ||
|
|
e5e25c89e7 | ||
|
|
1d158ddd10 | ||
|
|
af5a2fe4fd | ||
|
|
28cdaa58bb | ||
|
|
efc9761ff0 | ||
|
|
ee299b2d53 | ||
|
|
c2b8a1d95c | ||
|
|
d191b0c540 | ||
|
|
60a3e5053e | ||
|
|
7599d07c3f | ||
|
|
6e15f589cc | ||
|
|
8aaa256aa9 | ||
|
|
c15c8664ca | ||
|
|
f44e8a8a8f | ||
|
|
bdc49fbff4 | ||
|
|
91d17e0073 | ||
|
|
c80ee99c6a | ||
|
|
bba902cc46 | ||
|
|
e88adc3401 | ||
|
|
b135270e68 | ||
|
|
181ed29c3a | ||
|
|
bcd99bb58d | ||
|
|
a125e8f7ed | ||
|
|
2c9a2a76f7 | ||
|
|
2abfeb19c8 | ||
|
|
8ef8459c0d | ||
|
|
3b40ce4d9b | ||
|
|
e5e0a0918a | ||
|
|
c39a0cc0b5 | ||
|
|
113366820b | ||
|
|
24486dd069 | ||
|
|
c12d7f5463 | ||
|
|
356fa3ab4b | ||
|
|
62b20b5518 | ||
|
|
2bee46a354 | ||
|
|
244be856b2 | ||
|
|
72cc92578d | ||
|
|
26c0a23598 | ||
|
|
d4dd3dfa2b | ||
|
|
f3924e5aa8 | ||
|
|
bcb9e6b5eb | ||
|
|
e9a8456279 | ||
|
|
87426b8fbd | ||
|
|
37ff7a92bf | ||
|
|
18a8f86ecb | ||
|
|
1dbbd97749 | ||
|
|
0cf0757224 | ||
|
|
6cd4e61149 | ||
|
|
cf517e3e39 | ||
|
|
bdbb717be9 | ||
|
|
a09a503073 | ||
|
|
24011f1e6c | ||
|
|
3eacf08267 | ||
|
|
e21fc0dc50 | ||
|
|
e68d4a7177 | ||
|
|
fed2e21594 | ||
|
|
7bce53cc0d | ||
|
|
d636754e70 | ||
|
|
e29e39f9d6 | ||
|
|
0954babbd6 | ||
|
|
a33541f036 | ||
|
|
e493a99da2 | ||
|
|
acc6d99572 | ||
|
|
4a1c291389 | ||
|
|
3b7dc69e90 | ||
|
|
bd985deee6 | ||
|
|
0930b5ca1e | ||
|
|
c558904661 | ||
|
|
28860655af | ||
|
|
33aff4c5a0 | ||
|
|
59f91c5f37 | ||
|
|
625ebbf829 | ||
|
|
575a433c98 | ||
|
|
cf4c39a225 | ||
|
|
39b8218750 | ||
|
|
7865676159 | ||
|
|
a7b62bbcaf | ||
|
|
027e6ecab9 | ||
|
|
5c11366e01 | ||
|
|
18ffa02b72 | ||
|
|
43604dffbe | ||
|
|
6cb39b4485 | ||
|
|
8592f19a95 | ||
|
|
044baf90e5 | ||
|
|
66f384cad0 | ||
|
|
893967f596 | ||
|
|
64ba835d05 | ||
|
|
a787b927c7 | ||
|
|
a8c9665ae2 | ||
|
|
68654bfd5f | ||
|
|
fc7d4488bf | ||
|
|
730d8e18d8 | ||
|
|
1398605873 | ||
|
|
0359d0df5d | ||
|
|
eea7df273c | ||
|
|
a5f127ec88 | ||
|
|
2b195191b3 | ||
|
|
a357fd17c2 | ||
|
|
6dc7d9b63f | ||
|
|
a7f00f503a | ||
|
|
f142415475 | ||
|
|
faa8c2bc8f | ||
|
|
d2e8dccd40 | ||
|
|
7c6ab05f50 | ||
|
|
022ce314c3 | ||
|
|
bb3bd09b93 | ||
|
|
f1b9af72fd | ||
|
|
d25df894fa | ||
|
|
7b70e2eb34 | ||
|
|
fe05003a8f | ||
|
|
57312e6e3e | ||
|
|
5e3488396a | ||
|
|
16ff61b36e | ||
|
|
71a5663786 | ||
|
|
d682fbeb07 | ||
|
|
425b660583 | ||
|
|
4474b0ac8c | ||
|
|
51ed7ef9f1 | ||
|
|
60163c3b0f | ||
|
|
97b0cb9d14 | ||
|
|
87b960121a | ||
|
|
40f93bcc41 | ||
|
|
aa434942c1 | ||
|
|
9658469de2 | ||
|
|
b8cfb56c43 | ||
|
|
46396d7c16 | ||
|
|
5d05aa9942 | ||
|
|
f3e2681766 | ||
|
|
1e7d3425e5 | ||
|
|
6f673e95c9 | ||
|
|
e90a2d50c4 | ||
|
|
0b7485db02 | ||
|
|
6336a9e2b5 | ||
|
|
a41f5387c1 | ||
|
|
a2a674a107 | ||
|
|
e0b98b75e7 | ||
|
|
deca1e79ba | ||
|
|
bcde9d944e | ||
|
|
4e2acf1af7 | ||
|
|
2cffd23655 | ||
|
|
7c696fcb71 | ||
|
|
9d47a58750 | ||
|
|
8051cb704c | ||
|
|
bd0343c9c3 | ||
|
|
bcef59f33c | ||
|
|
051965af52 | ||
|
|
4b761af41b | ||
|
|
4ea182eaa2 | ||
|
|
b875331c31 | ||
|
|
c6bc222d54 | ||
|
|
c66e4a8a50 | ||
|
|
163f0721dd | ||
|
|
09808b7fb4 | ||
|
|
8cb70f0d12 | ||
|
|
c81bc8c819 | ||
|
|
8f0d41d02b | ||
|
|
1737366af7 | ||
|
|
7b6af86814 | ||
|
|
3ded61323d | ||
|
|
3345092a44 | ||
|
|
40bf1ed65e | ||
|
|
1ed419e23c | ||
|
|
4e1ec90525 | ||
|
|
73639cf0b4 | ||
|
|
d39b4d849e | ||
|
|
9216bdc078 | ||
|
|
94a10372cc | ||
|
|
963fac95d7 | ||
|
|
015555c6fb | ||
|
|
6e9dabe659 | ||
|
|
4bf8f8895c | ||
|
|
50904e9353 | ||
|
|
b5cab579fe | ||
|
|
0e1bcddd70 | ||
|
|
d9426fc255 | ||
|
|
29f52acbfe | ||
|
|
b0717c6852 | ||
|
|
159e80246b | ||
|
|
11d34b143f | ||
|
|
09f2ab841f | ||
|
|
c020194656 | ||
|
|
4ce9023cd4 | ||
|
|
ced0a5747b | ||
|
|
38e2a6fce6 | ||
|
|
56bb50b85e | ||
|
|
207e589917 | ||
|
|
54360507f3 | ||
|
|
f93f08bcd2 | ||
|
|
30a67ed72c | ||
|
|
e72359fc66 | ||
|
|
b2b0940516 | ||
|
|
27a5a6fcae | ||
|
|
4647045388 | ||
|
|
d4bfed373e | ||
|
|
8181da4fee | ||
|
|
e70c174643 | ||
|
|
0e4c071519 | ||
|
|
934bdca370 | ||
|
|
ee91a42a33 | ||
|
|
0f0b77b192 | ||
|
|
1bf26b2def | ||
|
|
0a3fc51ae0 | ||
|
|
7d72773d88 | ||
|
|
bac32e9c43 | ||
|
|
3d181f5346 | ||
|
|
f963c7c009 | ||
|
|
4f0f317d54 | ||
|
|
098e559d46 | ||
|
|
cacb45d450 | ||
|
|
a17bdbd3ef | ||
|
|
fb0cc7189a | ||
|
|
81b03f6d32 | ||
|
|
4a27fde8e4 | ||
|
|
1e3f330130 | ||
|
|
ec8268d863 | ||
|
|
ebb5fb9e88 | ||
|
|
1eb43094c5 | ||
|
|
06c6281add | ||
|
|
c44624c056 | ||
|
|
cd4845e431 | ||
|
|
952998aacd | ||
|
|
32928e630d | ||
|
|
657586e6ba | ||
|
|
423931c2fa | ||
|
|
61524a2675 | ||
|
|
8c5e1c1d49 | ||
|
|
a4bf7dd65c | ||
|
|
cc74be8dbb | ||
|
|
679ac08d77 | ||
|
|
d7986f9b22 | ||
|
|
f34139e379 | ||
|
|
0bf93134f4 | ||
|
|
86eb7862ec | ||
|
|
d93007b44a | ||
|
|
9bf3bfe85c | ||
|
|
633d072d05 | ||
|
|
5d35a45a53 | ||
|
|
d4652daec6 | ||
|
|
df7ab11865 | ||
|
|
c8ea97984f | ||
|
|
b48beba60f | ||
|
|
9ceed8a0c9 | ||
|
|
7985943ec2 | ||
|
|
e0fff7b2cc | ||
|
|
d4efb0e369 | ||
|
|
152055933d | ||
|
|
7687c5200c | ||
|
|
207ac93d43 | ||
|
|
3381782661 | ||
|
|
88289c3fda | ||
|
|
13e546fa20 | ||
|
|
09d8803687 | ||
|
|
c820d8181c | ||
|
|
790b6a2ad8 | ||
|
|
171544ded4 | ||
|
|
58ee786bfd | ||
|
|
0b7e61b95a | ||
|
|
afc889e934 | ||
|
|
2e5a194f62 | ||
|
|
981701755d | ||
|
|
1c12743d44 | ||
|
|
bb6d154f11 | ||
|
|
6d0d2366f7 | ||
|
|
13e74d5573 | ||
|
|
b615fd7f8f | ||
|
|
0e68d6fb29 | ||
|
|
641a07950d | ||
|
|
fc49f10bb4 | ||
|
|
8ed82f11ae | ||
|
|
503de45dd8 | ||
|
|
5d00fd4d60 | ||
|
|
5fa5f7b2fe | ||
|
|
e5899f6a70 | ||
|
|
3a9762ce57 | ||
|
|
a2daceb791 | ||
|
|
fbbc548e7f | ||
|
|
4ba10243f4 | ||
|
|
f0860ac590 | ||
|
|
96a1de0af8 | ||
|
|
ad1605a464 | ||
|
|
b4dcd3bf21 | ||
|
|
db68d45702 | ||
|
|
3758e37024 | ||
|
|
4001888e69 | ||
|
|
0602ed3b4c | ||
|
|
b20922c6d5 | ||
|
|
e707ad166d | ||
|
|
dbb6fddcbc | ||
|
|
96767058df | ||
|
|
2fb7d32cd3 | ||
|
|
3edc3e9b48 | ||
|
|
896b382015 | ||
|
|
8aa7e85e31 | ||
|
|
f0b6e8f37e | ||
|
|
e1f2e656e2 | ||
|
|
18969310e2 | ||
|
|
dbff74bee4 | ||
|
|
ec51060d45 | ||
|
|
ccd4ff2945 | ||
|
|
ef4c0a7753 | ||
|
|
8b18591982 | ||
|
|
ee7554c1c4 | ||
|
|
9538dc203d | ||
|
|
3d7f7c32e3 | ||
|
|
778a045e66 | ||
|
|
7c2743f379 | ||
|
|
8a9f12eaa4 | ||
|
|
1764a0bd28 | ||
|
|
03162bb276 | ||
|
|
0f781c718c | ||
|
|
ae86d26f7e | ||
|
|
7cb730a6e8 | ||
|
|
66c3265a26 | ||
|
|
4866e7c6d0 | ||
|
|
69bcbe97f4 | ||
|
|
f9cf8db97e | ||
|
|
a9d12c0fe9 | ||
|
|
e74a2565e4 | ||
|
|
57e70c0d2c | ||
|
|
50d30f7ff1 | ||
|
|
80f3ad1f1b | ||
|
|
4b20d27caf | ||
|
|
d5fb4ff7c8 | ||
|
|
b845c66748 | ||
|
|
c337759e24 | ||
|
|
888e4339f9 | ||
|
|
997f9dd183 | ||
|
|
3da76d4bd7 | ||
|
|
1a68d8ddd5 | ||
|
|
41047c16c9 | ||
|
|
71f1bc4453 | ||
|
|
aea087b793 | ||
|
|
de4e003256 |
@@ -223,6 +223,14 @@ test_mkuf2:
|
||||
- cd ${IDF_PATH}/tools/test_mkuf2
|
||||
- ./test_mkuf2.py
|
||||
|
||||
test_sbom:
|
||||
extends:
|
||||
- .host_test_template
|
||||
- .rules:patterns:sbom
|
||||
script:
|
||||
- cd ${IDF_PATH}/tools/test_sbom
|
||||
- pytest
|
||||
|
||||
test_autocomplete:
|
||||
extends:
|
||||
- .host_test_template
|
||||
|
||||
@@ -54,6 +54,9 @@
|
||||
- "tools/ci/ci_build_apps.py"
|
||||
- "tools/test_build_system/**/*"
|
||||
|
||||
.patterns-sbom: &patterns-sbom
|
||||
- "tools/test_sbom/*"
|
||||
|
||||
.patterns-custom_test: &patterns-custom_test
|
||||
- "tools/ci/python_packages/gitlab_api.py"
|
||||
- "tools/ci/python_packages/tiny_test_fw/**/*"
|
||||
@@ -425,6 +428,14 @@
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-sonarqube-files
|
||||
|
||||
.rules:patterns:sbom:
|
||||
rules:
|
||||
- <<: *if-protected
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-sbom
|
||||
- <<: *if-dev-push
|
||||
changes: *patterns-submodule
|
||||
|
||||
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
# DO NOT place comments or maintain any code from this line
|
||||
#
|
||||
|
||||
@@ -265,6 +265,14 @@ pytest_examples_esp32_ethernet:
|
||||
- build_pytest_examples_esp32
|
||||
tags: [ esp32, ethernet]
|
||||
|
||||
pytest_examples_esp32_ethernet_httpbin:
|
||||
extends:
|
||||
- .pytest_examples_dir_template
|
||||
- .rules:test:example_test-esp32-ethernet
|
||||
needs:
|
||||
- build_pytest_examples_esp32
|
||||
tags: [ esp32, httpbin]
|
||||
|
||||
pytest_examples_esp32_8mb_flash:
|
||||
extends:
|
||||
- .pytest_examples_dir_template
|
||||
|
||||
53
.gitmodules
vendored
53
.gitmodules
vendored
@@ -2,6 +2,26 @@
|
||||
# All the relative URL paths are intended to be GitHub ones
|
||||
# For Espressif's public projects please use '../../espressif/proj', not a '../proj'
|
||||
#
|
||||
# Submodules SBOM information
|
||||
# ---------------------------
|
||||
# Submodules, which are used directly and not forked into espressif namespace should
|
||||
# contain SBOM information here. Other submodules should have the SBOM manifest file
|
||||
# included in the root of their project's repository.
|
||||
#
|
||||
# The sbom-hash entry records the submodule's checkout SHA as presented in git-tree
|
||||
# commit object. For example spiffs submodule
|
||||
#
|
||||
# $ git ls-tree HEAD components/spiffs/spiffs
|
||||
# 160000 commit 0dbb3f71c5f6fae3747a9d935372773762baf852 components/spiffs/spiffs
|
||||
#
|
||||
# The hash can be also obtained with git submodule command
|
||||
#
|
||||
# $ git submodule status components/spiffs/spiffs
|
||||
# 0dbb3f71c5f6fae3747a9d935372773762baf852 components/spiffs/spiffs (0.2-255-g0dbb3f71c5f6)
|
||||
#
|
||||
# The submodule SHA recorded here has to match with SHA, which is presented in git-tree.
|
||||
# This is checked by CI. Also please don't forget to update the submodule version
|
||||
# if you are changing the sbom-hash. This is important for SBOM generation.
|
||||
|
||||
[submodule "components/bt/controller/lib_esp32"]
|
||||
path = components/bt/controller/lib_esp32
|
||||
@@ -10,14 +30,31 @@
|
||||
[submodule "components/bootloader/subproject/components/micro-ecc/micro-ecc"]
|
||||
path = components/bootloader/subproject/components/micro-ecc/micro-ecc
|
||||
url = ../../kmackay/micro-ecc.git
|
||||
sbom-version = 1.0
|
||||
sbom-cpe = cpe:2.3:a:micro-ecc_project:micro-ecc:{}:*:*:*:*:*:*:*
|
||||
sbom-supplier = Person: Ken MacKay
|
||||
sbom-url = https://github.com/kmackay/micro-ecc
|
||||
sbom-description = A small and fast ECDH and ECDSA implementation for 8-bit, 32-bit, and 64-bit processors
|
||||
sbom-hash = d037ec89546fad14b5c4d5456c2e23a71e554966
|
||||
|
||||
[submodule "components/spiffs/spiffs"]
|
||||
path = components/spiffs/spiffs
|
||||
url = ../../pellepl/spiffs.git
|
||||
sbom-version = 0.2-255-g0dbb3f71c5f6
|
||||
sbom-supplier = Person: Peter Andersson
|
||||
sbom-url = https://github.com/pellepl/spiffs
|
||||
sbom-description = Wear-leveled SPI flash file system for embedded devices
|
||||
sbom-hash = 0dbb3f71c5f6fae3747a9d935372773762baf852
|
||||
|
||||
[submodule "components/json/cJSON"]
|
||||
path = components/json/cJSON
|
||||
url = ../../DaveGamble/cJSON.git
|
||||
sbom-version = 1.7.15
|
||||
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 = d348621ca93571343a56862df7de4ff3bc9b5667
|
||||
|
||||
[submodule "components/mbedtls/mbedtls"]
|
||||
path = components/mbedtls/mbedtls
|
||||
@@ -34,10 +71,21 @@
|
||||
[submodule "components/protobuf-c/protobuf-c"]
|
||||
path = components/protobuf-c/protobuf-c
|
||||
url = ../../protobuf-c/protobuf-c.git
|
||||
sbom-version = 1.4.1
|
||||
sbom-cpe = cpe:2.3:a:protobuf-c_project:protobuf-c:{}:*:*:*:*:*:*:*
|
||||
sbom-supplier = Organization: protobuf-c community <https://groups.google.com/g/protobuf-c>
|
||||
sbom-url = https://github.com/protobuf-c/protobuf-c
|
||||
sbom-description = Protocol Buffers implementation in C
|
||||
sbom-hash = abc67a11c6db271bedbb9f58be85d6f4e2ea8389
|
||||
|
||||
[submodule "components/unity/unity"]
|
||||
path = components/unity/unity
|
||||
url = ../../ThrowTheSwitch/Unity.git
|
||||
sbom-version = v2.4.3-51-g7d2bf62b7e6a
|
||||
sbom-supplier = Organization: ThrowTheSwitch community <http://www.throwtheswitch.org>
|
||||
sbom-url = https://github.com/ThrowTheSwitch/Unity
|
||||
sbom-description = Simple Unit Testing for C
|
||||
sbom-hash = 7d2bf62b7e6afaf38153041a9d53c21aeeca9a25
|
||||
|
||||
[submodule "components/bt/host/nimble/nimble"]
|
||||
path = components/bt/host/nimble/nimble
|
||||
@@ -50,6 +98,11 @@
|
||||
[submodule "components/cmock/CMock"]
|
||||
path = components/cmock/CMock
|
||||
url = ../../ThrowTheSwitch/CMock.git
|
||||
sbom-version = v2.5.2-2-geeecc49ce8af
|
||||
sbom-supplier = Organization: ThrowTheSwitch community <http://www.throwtheswitch.org>
|
||||
sbom-url = https://github.com/ThrowTheSwitch/CMock
|
||||
sbom-description = CMock - Mock/stub generator for C
|
||||
sbom-hash = eeecc49ce8af123cf8ad40efdb9673e37b56230f
|
||||
|
||||
[submodule "components/openthread/openthread"]
|
||||
path = components/openthread/openthread
|
||||
|
||||
@@ -158,7 +158,7 @@ repos:
|
||||
- id: file-contents-sorter
|
||||
files: 'tools\/ci\/(executable-list\.txt|mypy_ignore_list\.txt|check_copyright_ignore\.txt)'
|
||||
- repo: https://github.com/espressif/check-copyright/
|
||||
rev: v1.0.1
|
||||
rev: v1.0.2
|
||||
hooks:
|
||||
- id: check-copyright
|
||||
args: ['--ignore', 'tools/ci/check_copyright_ignore.txt', '--config', 'tools/ci/check_copyright_config.yaml']
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
PROVIDE ( ets_update_cpu_frequency = 0x40008550 ); /* Updates g_ticks_per_us on the current CPU only; not on the other core */
|
||||
PROVIDE ( MD5Final = 0x4005db1c );
|
||||
PROVIDE ( MD5Init = 0x4005da7c );
|
||||
PROVIDE ( MD5Update = 0x4005da9c );
|
||||
|
||||
/* bootloader will use following functions from xtensa hal library */
|
||||
xthal_get_ccount = 0x4000c050;
|
||||
xthal_get_ccompare = 0x4000c078;
|
||||
xthal_set_ccompare = 0x4000c058;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* ESP32S2 ROM address table
|
||||
* Generated for ROM with MD5sum: 0a2c7ec5109c17884606d23b47045796
|
||||
*/
|
||||
PROVIDE (ets_update_cpu_frequency = 0x4000d8a4);
|
||||
|
||||
PROVIDE (MD5Final = 0x4000530c);
|
||||
PROVIDE (MD5Init = 0x4000526c);
|
||||
PROVIDE (MD5Update = 0x4000528c);
|
||||
/* bootloader will use following functions from xtensa hal library */
|
||||
xthal_get_ccount = 0x4001aa90;
|
||||
xthal_get_ccompare = 0x4001aabc;
|
||||
xthal_set_ccompare = 0x4001aa98;
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* ESP32S3 ROM address table
|
||||
* Generated for ROM with MD5sum: d20fb231463ce337432b1fa9cba0b3c9
|
||||
*/
|
||||
|
||||
PROVIDE ( ets_update_cpu_frequency = 0x40043164 );
|
||||
|
||||
@@ -5,7 +5,3 @@ components/bootloader_support/test_apps/rtc_custom_section:
|
||||
- if: IDF_TARGET == "esp32c2"
|
||||
temporary: false
|
||||
reason: esp32c2 does not have RTC memory
|
||||
disable_test:
|
||||
- if: IDF_TARGET == "esp32h2"
|
||||
temporary: true
|
||||
reason: target esp32h2 is not supported yet
|
||||
|
||||
@@ -120,6 +120,7 @@ esp_err_t bootloader_flash_erase_range(uint32_t start_addr, uint32_t size)
|
||||
#include "esp32/rom/cache.h"
|
||||
#endif
|
||||
#include "esp_rom_spiflash.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "hal/mmu_hal.h"
|
||||
#include "hal/mmu_ll.h"
|
||||
#include "hal/cache_hal.h"
|
||||
|
||||
@@ -200,6 +200,12 @@ esp_err_t bootloader_init_spi_flash(void)
|
||||
bootloader_enable_qio_mode();
|
||||
#endif
|
||||
|
||||
// Since the workaround in IDF-6709, the spi_speed value in the bootloader header
|
||||
// is not the real value, overwrite it.
|
||||
#if CONFIG_ESPTOOLPY_FLASHFREQ_80M
|
||||
bootloader_image_hdr.spi_speed = ESP_IMAGE_SPI_SPEED_DIV_1;
|
||||
#endif
|
||||
|
||||
print_flash_info(&bootloader_image_hdr);
|
||||
update_flash_config(&bootloader_image_hdr);
|
||||
//ensure the flash is write-protected
|
||||
|
||||
@@ -19,6 +19,7 @@ typedef enum {
|
||||
ESP_CHIP_ID_ESP32S3 = 0x0009, /*!< chip ID: ESP32-S3 */
|
||||
ESP_CHIP_ID_ESP32C2 = 0x000C, /*!< chip ID: ESP32-C2 */
|
||||
ESP_CHIP_ID_ESP32C6 = 0x000D, /*!< chip ID: ESP32-C6 */
|
||||
ESP_CHIP_ID_ESP32H2 = 0x0010, /*!< chip ID: ESP32-H2 */
|
||||
ESP_CHIP_ID_INVALID = 0xFFFF /*!< Invalid chip ID (we defined it to make sure the esp_chip_id_t is 2 bytes size) */
|
||||
} __attribute__((packed)) esp_chip_id_t;
|
||||
|
||||
|
||||
@@ -121,22 +121,6 @@ int bootloader_common_select_otadata(const esp_ota_select_entry_t *two_otadata,
|
||||
|
||||
#if CONFIG_BOOTLOADER_RESERVE_RTC_MEM
|
||||
|
||||
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_HIGH - sizeof(rtc_retain_mem_t))
|
||||
|
||||
_Static_assert(RTC_RETAIN_MEM_ADDR >= SOC_RTC_DRAM_LOW, "rtc_retain_mem_t structure size is bigger than the RTC memory size. Consider reducing RTC reserved memory size.");
|
||||
|
||||
rtc_retain_mem_t *const rtc_retain_mem = (rtc_retain_mem_t *)RTC_RETAIN_MEM_ADDR;
|
||||
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#include "heap_memory_layout.h"
|
||||
/* The app needs to be told this memory is reserved, important if configured to use RTC memory as heap.
|
||||
|
||||
Note that keeping this macro here only works when other symbols in this file are referenced by the app, as
|
||||
this feature is otherwise 100% part of the bootloader. However this seems to happen in all apps.
|
||||
*/
|
||||
SOC_RESERVE_MEMORY_REGION(RTC_RETAIN_MEM_ADDR, RTC_RETAIN_MEM_ADDR + sizeof(rtc_retain_mem_t), rtc_retain_mem);
|
||||
#endif
|
||||
|
||||
static uint32_t rtc_retain_mem_size(void) {
|
||||
#ifdef CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
|
||||
/* A custom memory has been reserved by the user, do not consider this memory into CRC calculation as it may change without
|
||||
@@ -144,29 +128,31 @@ static uint32_t rtc_retain_mem_size(void) {
|
||||
* minus the size of everything after (including) `custom` */
|
||||
return offsetof(rtc_retain_mem_t, custom);
|
||||
#else
|
||||
return sizeof(rtc_retain_mem_t) - sizeof(rtc_retain_mem->crc);
|
||||
return sizeof(rtc_retain_mem_t) - sizeof(bootloader_common_get_rtc_retain_mem()->crc);
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool is_retain_mem_valid(void)
|
||||
{
|
||||
rtc_retain_mem_t* rtc_retain_mem = bootloader_common_get_rtc_retain_mem();
|
||||
return esp_rom_crc32_le(UINT32_MAX, (uint8_t*)rtc_retain_mem, rtc_retain_mem_size()) == rtc_retain_mem->crc && rtc_retain_mem->crc != UINT32_MAX;
|
||||
}
|
||||
|
||||
static void update_rtc_retain_mem_crc(void)
|
||||
{
|
||||
rtc_retain_mem_t* rtc_retain_mem = bootloader_common_get_rtc_retain_mem();
|
||||
rtc_retain_mem->crc = esp_rom_crc32_le(UINT32_MAX, (uint8_t*)rtc_retain_mem, rtc_retain_mem_size());
|
||||
}
|
||||
|
||||
NOINLINE_ATTR void bootloader_common_reset_rtc_retain_mem(void)
|
||||
{
|
||||
hal_memset(rtc_retain_mem, 0, sizeof(rtc_retain_mem_t));
|
||||
hal_memset(bootloader_common_get_rtc_retain_mem(), 0, sizeof(rtc_retain_mem_t));
|
||||
}
|
||||
|
||||
uint16_t bootloader_common_get_rtc_retain_mem_reboot_counter(void)
|
||||
{
|
||||
if (is_retain_mem_valid()) {
|
||||
return rtc_retain_mem->reboot_counter;
|
||||
return bootloader_common_get_rtc_retain_mem()->reboot_counter;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -176,12 +162,13 @@ void bootloader_common_set_rtc_retain_mem_factory_reset_state(void)
|
||||
if (!is_retain_mem_valid()) {
|
||||
bootloader_common_reset_rtc_retain_mem();
|
||||
}
|
||||
rtc_retain_mem->flags.factory_reset_state = true;
|
||||
bootloader_common_get_rtc_retain_mem()->flags.factory_reset_state = true;
|
||||
update_rtc_retain_mem_crc();
|
||||
}
|
||||
|
||||
bool bootloader_common_get_rtc_retain_mem_factory_reset_state(void)
|
||||
{
|
||||
rtc_retain_mem_t* rtc_retain_mem = bootloader_common_get_rtc_retain_mem();
|
||||
if (is_retain_mem_valid()) {
|
||||
bool factory_reset_state = rtc_retain_mem->flags.factory_reset_state;
|
||||
if (factory_reset_state == true) {
|
||||
@@ -196,13 +183,14 @@ bool bootloader_common_get_rtc_retain_mem_factory_reset_state(void)
|
||||
esp_partition_pos_t* bootloader_common_get_rtc_retain_mem_partition(void)
|
||||
{
|
||||
if (is_retain_mem_valid()) {
|
||||
return &rtc_retain_mem->partition;
|
||||
return &bootloader_common_get_rtc_retain_mem()->partition;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void bootloader_common_update_rtc_retain_mem(esp_partition_pos_t* partition, bool reboot_counter)
|
||||
{
|
||||
rtc_retain_mem_t* rtc_retain_mem = bootloader_common_get_rtc_retain_mem();
|
||||
if (reboot_counter) {
|
||||
if (!is_retain_mem_valid()) {
|
||||
bootloader_common_reset_rtc_retain_mem();
|
||||
@@ -224,7 +212,14 @@ void bootloader_common_update_rtc_retain_mem(esp_partition_pos_t* partition, boo
|
||||
|
||||
rtc_retain_mem_t* bootloader_common_get_rtc_retain_mem(void)
|
||||
{
|
||||
return rtc_retain_mem;
|
||||
#ifdef BOOTLOADER_BUILD
|
||||
#define RTC_RETAIN_MEM_ADDR (SOC_RTC_DRAM_HIGH - sizeof(rtc_retain_mem_t))
|
||||
static rtc_retain_mem_t *const s_bootloader_retain_mem = (rtc_retain_mem_t *)RTC_RETAIN_MEM_ADDR;
|
||||
return s_bootloader_retain_mem;
|
||||
#else
|
||||
static __attribute__((section(".bootloader_data_rtc_mem"))) rtc_retain_mem_t s_bootloader_retain_mem;
|
||||
return &s_bootloader_retain_mem;
|
||||
#endif // !BOOTLOADER_BUILD
|
||||
}
|
||||
|
||||
#endif // CONFIG_BOOTLOADER_RESERVE_RTC_MEM
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "esp_cpu.h"
|
||||
#include "soc/wdev_reg.h"
|
||||
|
||||
#if defined CONFIG_IDF_TARGET_ESP32C6
|
||||
#if SOC_LP_TIMER_SUPPORTED
|
||||
#include "hal/lp_timer_hal.h"
|
||||
#endif
|
||||
|
||||
@@ -34,20 +34,6 @@
|
||||
#define RNG_CPU_WAIT_CYCLE_NUM (80 * 23) /* 45 KHz reading frequency is the maximum we have tested so far on S3 */
|
||||
#endif
|
||||
|
||||
#if defined CONFIG_IDF_TARGET_ESP32H2
|
||||
|
||||
// TODO: temporary definition until IDF-6270 is implemented
|
||||
#include "soc/lp_timer_reg.h"
|
||||
|
||||
static inline uint32_t lp_timer_hal_get_cycle_count(void)
|
||||
{
|
||||
REG_SET_BIT(LP_TIMER_UPDATE_REG, LP_TIMER_MAIN_TIMER_UPDATE);
|
||||
|
||||
uint32_t lo = REG_GET_FIELD(LP_TIMER_MAIN_BUF0_LOW_REG, LP_TIMER_MAIN_TIMER_BUF0_LOW);
|
||||
return lo;
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((weak)) void bootloader_fill_random(void *buffer, size_t length)
|
||||
{
|
||||
uint8_t *buffer_bytes = (uint8_t *)buffer;
|
||||
@@ -57,7 +43,7 @@ static inline uint32_t lp_timer_hal_get_cycle_count(void)
|
||||
assert(buffer != NULL);
|
||||
|
||||
for (size_t i = 0; i < length; i++) {
|
||||
#if (defined CONFIG_IDF_TARGET_ESP32C6 || defined CONFIG_IDF_TARGET_ESP32H2)
|
||||
#if SOC_LP_TIMER_SUPPORTED
|
||||
random = REG_READ(WDEV_RND_REG);
|
||||
start = esp_cpu_get_cycle_count();
|
||||
do {
|
||||
|
||||
@@ -86,7 +86,6 @@ static void bootloader_super_wdt_auto_feed(void)
|
||||
|
||||
static inline void bootloader_hardware_init(void)
|
||||
{
|
||||
// TODO: IDF-6267
|
||||
/* Enable analog i2c master clock */
|
||||
SET_PERI_REG_MASK(MODEM_LPCON_CLK_CONF_REG, MODEM_LPCON_CLK_I2C_MST_EN);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ from pytest_embedded import Dut
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32c3
|
||||
@pytest.mark.esp32c6
|
||||
@pytest.mark.esp32h2
|
||||
@pytest.mark.esp32s2
|
||||
@pytest.mark.esp32s3
|
||||
def test_rtc_reserved_memory(dut: Dut) -> None:
|
||||
|
||||
@@ -528,9 +528,11 @@ if(CONFIG_BT_ENABLED)
|
||||
host/nimble/nimble/nimble/host/services/gap/include
|
||||
host/nimble/nimble/nimble/host/services/gatt/include
|
||||
host/nimble/nimble/nimble/host/services/hr/include
|
||||
host/nimble/nimble/nimble/host/services/htp/include
|
||||
host/nimble/nimble/nimble/host/services/ias/include
|
||||
host/nimble/nimble/nimble/host/services/ipss/include
|
||||
host/nimble/nimble/nimble/host/services/lls/include
|
||||
host/nimble/nimble/nimble/host/services/prox/include
|
||||
host/nimble/nimble/nimble/host/services/tps/include
|
||||
host/nimble/nimble/nimble/host/util/include
|
||||
host/nimble/nimble/nimble/host/store/ram/include
|
||||
@@ -545,10 +547,12 @@ if(CONFIG_BT_ENABLED)
|
||||
"host/nimble/nimble/nimble/host/services/ipss/src/ble_svc_ipss.c"
|
||||
"host/nimble/nimble/nimble/host/services/ans/src/ble_svc_ans.c"
|
||||
"host/nimble/nimble/nimble/host/services/hr/src/ble_svc_hr.c"
|
||||
"host/nimble/nimble/nimble/host/services/htp/src/ble_svc_htp.c"
|
||||
"host/nimble/nimble/nimble/host/services/gap/src/ble_svc_gap.c"
|
||||
"host/nimble/nimble/nimble/host/services/bas/src/ble_svc_bas.c"
|
||||
"host/nimble/nimble/nimble/host/services/dis/src/ble_svc_dis.c"
|
||||
"host/nimble/nimble/nimble/host/services/lls/src/ble_svc_lls.c"
|
||||
"host/nimble/nimble/nimble/host/services/prox/src/ble_svc_prox.c"
|
||||
"host/nimble/nimble/nimble/host/src/ble_hs_conn.c"
|
||||
"host/nimble/nimble/nimble/host/src/ble_store_util.c"
|
||||
"host/nimble/nimble/nimble/host/src/ble_sm.c"
|
||||
|
||||
@@ -864,7 +864,11 @@ static void *malloc_internal_wrapper(size_t size)
|
||||
|
||||
static int32_t IRAM_ATTR read_mac_wrapper(uint8_t mac[6])
|
||||
{
|
||||
return esp_read_mac(mac, ESP_MAC_BT);
|
||||
int ret = esp_read_mac(mac, ESP_MAC_BT);
|
||||
ESP_LOGI(BTDM_LOG_TAG, "Bluetooth MAC: %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void IRAM_ATTR srand_wrapper(unsigned int seed)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -54,6 +54,8 @@
|
||||
|
||||
#include "soc/syscon_reg.h"
|
||||
#include "soc/dport_access.h"
|
||||
|
||||
#include "hal/efuse_ll.h"
|
||||
/* Macro definition
|
||||
************************************************************************
|
||||
*/
|
||||
@@ -993,6 +995,11 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
return (esp_power_level_t)tx_level;
|
||||
}
|
||||
|
||||
uint8_t esp_ble_get_chip_rev_version(void)
|
||||
{
|
||||
return efuse_ll_get_chip_wafer_version_minor();
|
||||
}
|
||||
|
||||
|
||||
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED == true)
|
||||
|
||||
|
||||
@@ -260,6 +260,19 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
help
|
||||
This configures stack size of NimBLE controller task
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_LL_RESOLV_LIST_SIZE
|
||||
int "BLE LL Resolving list size"
|
||||
range 1 5
|
||||
@@ -340,7 +353,7 @@ config BT_LE_LL_SCA
|
||||
config BT_LE_MAX_CONNECTIONS
|
||||
int "Maximum number of concurrent connections"
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
range 1 9
|
||||
range 1 70
|
||||
default 3
|
||||
help
|
||||
Defines maximum number of concurrent BLE connections. For ESP32, user
|
||||
@@ -395,6 +408,26 @@ choice BT_LE_WAKEUP_SOURCE
|
||||
Use BLE rtc timer to wakeup CPU
|
||||
endchoice
|
||||
|
||||
choice BT_LE_LP_CLK_SRC
|
||||
prompt "BLE low power clock source"
|
||||
default BT_LE_LP_CLK_SRC_MAIN_XTAL
|
||||
config BT_LE_LP_CLK_SRC_MAIN_XTAL
|
||||
bool "Use main XTAL as RTC clock source"
|
||||
help
|
||||
User main XTAL as RTC clock source.
|
||||
This option is recommended if external 32.768k XTAL is not available.
|
||||
Using the external 32.768 kHz XTAL will have lower current consumption
|
||||
in light sleep compared to using the main XTAL.
|
||||
|
||||
config BT_LE_LP_CLK_SRC_DEFAULT
|
||||
bool "Use system RTC slow clock source"
|
||||
help
|
||||
Use the same slow clock source as system RTC
|
||||
Using any clock source other than external 32.768 kHz XTAL supports only
|
||||
legacy ADV and SCAN due to low clock accuracy.
|
||||
|
||||
endchoice
|
||||
|
||||
config BT_LE_USE_ESP_TIMER
|
||||
bool "Enable Esp Timer for Callout"
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
@@ -402,3 +435,74 @@ config BT_LE_USE_ESP_TIMER
|
||||
help
|
||||
Set this option to use Esp Timer which has higher priority timer
|
||||
instead of FreeRTOS timer
|
||||
|
||||
config BT_LE_SCAN_DUPL
|
||||
bool "BLE Scan Duplicate Options"
|
||||
default y
|
||||
help
|
||||
This select enables parameters setting of BLE scan duplicate.
|
||||
|
||||
choice BT_LE_SCAN_DUPL_TYPE
|
||||
prompt "Scan Duplicate Type"
|
||||
default BT_LE_SCAN_DUPL_TYPE_DEVICE
|
||||
depends on BT_LE_SCAN_DUPL
|
||||
help
|
||||
Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use
|
||||
advertiser address filtering. The adv packet of the same address is only allowed to be reported once.
|
||||
Another way is "Scan Duplicate By Device Address And Advertising Data". This way is to use advertising
|
||||
data and device address filtering. All different adv packets with the same address are allowed to be
|
||||
reported. The last way is "Scan Duplicate By Advertising Data". This way is to use advertising data
|
||||
filtering. All same advertising data only allow to be reported once even though they are from
|
||||
different devices.
|
||||
|
||||
config BT_LE_SCAN_DUPL_TYPE_DEVICE
|
||||
bool "Scan Duplicate By Device Address"
|
||||
help
|
||||
This way is to use advertiser address filtering. The adv packet of the same address is only
|
||||
allowed to be reported once
|
||||
|
||||
config BT_LE_SCAN_DUPL_TYPE_DATA
|
||||
bool "Scan Duplicate By Advertising Data"
|
||||
help
|
||||
This way is to use advertising data filtering. All same advertising data only allow to be reported
|
||||
once even though they are from different devices.
|
||||
|
||||
config BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE
|
||||
bool "Scan Duplicate By Device Address And Advertising Data"
|
||||
help
|
||||
This way is to use advertising data and device address filtering. All different adv packets with
|
||||
the same address are allowed to be reported.
|
||||
endchoice
|
||||
|
||||
config BT_LE_SCAN_DUPL_TYPE
|
||||
int
|
||||
depends on BT_LE_SCAN_DUPL
|
||||
default 0 if BT_LE_SCAN_DUPL_TYPE_DEVICE
|
||||
default 1 if BT_LE_SCAN_DUPL_TYPE_DATA
|
||||
default 2 if BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE
|
||||
default 0
|
||||
|
||||
config BT_LE_SCAN_DUPL_CACHE_SIZE
|
||||
int "Maximum number of devices in scan duplicate filter"
|
||||
depends on BT_LE_SCAN_DUPL
|
||||
range 10 1000
|
||||
default 100
|
||||
help
|
||||
Maximum number of devices which can be recorded in scan duplicate filter.
|
||||
When the maximum amount of device in the filter is reached, the cache will be refreshed.
|
||||
|
||||
config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD
|
||||
int "Duplicate scan list refresh period (seconds)"
|
||||
depends on BT_LE_SCAN_DUPL
|
||||
range 0 1000
|
||||
default 0
|
||||
help
|
||||
If the period value is non-zero, the controller will periodically clear the device information
|
||||
stored in the scan duuplicate filter. If it is 0, the scan duuplicate filter will not be cleared
|
||||
until the scanning is disabled. Duplicate advertisements for this period should not be sent to the
|
||||
Host in advertising report events.
|
||||
There are two scenarios where the ADV packet will be repeatedly reported:
|
||||
1. The duplicate scan cache is full, the controller will delete the oldest device information and
|
||||
add new device information.
|
||||
2. When the refresh period is up, the controller will clear all device information and start filtering
|
||||
again.
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
#include "hci_uart.h"
|
||||
#include "bt_osi_mem.h"
|
||||
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#include "esp_private/sleep_retention.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#include "hci/hci_hal.h"
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
@@ -50,6 +54,8 @@
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "esp_sleep.h"
|
||||
|
||||
#include "hal/efuse_hal.h"
|
||||
|
||||
/* Macro definition
|
||||
************************************************************************
|
||||
*/
|
||||
@@ -104,12 +110,20 @@ struct ext_funcs_t {
|
||||
uint32_t magic;
|
||||
};
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
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);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create);
|
||||
extern int ble_log_deinit_async(void);
|
||||
extern void ble_log_async_output_dump_all(bool output);
|
||||
#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);
|
||||
@@ -124,7 +138,10 @@ extern uint32_t r_os_cputime_get32(void);
|
||||
extern uint32_t r_os_cputime_ticks_to_usecs(uint32_t ticks);
|
||||
extern void 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 ble_rtc_wake_up_state_clr(void);
|
||||
extern void r_ble_rtc_wake_up_state_clr(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);
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
extern int os_msys_init(void);
|
||||
extern void os_msys_buf_free(void);
|
||||
extern int ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x,
|
||||
@@ -170,6 +187,9 @@ static void esp_reset_rpa_moudle(void);
|
||||
static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv);
|
||||
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
||||
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);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
@@ -177,6 +197,10 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
static DRAM_ATTR esp_bt_controller_status_t ble_controller_status = ESP_BT_CONTROLLER_STATUS_IDLE;
|
||||
|
||||
/* This variable tells if BLE is running */
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
static bool s_ble_backed_up = false;
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
static bool s_ble_active = false;
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock = NULL;
|
||||
@@ -184,11 +208,13 @@ static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock = NULL;
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
#define BLE_RTC_DELAY_US (1100)
|
||||
#define BLE_RTC_DELAY_US_LIGHT_SLEEP (2500)
|
||||
#define BLE_RTC_DELAY_US_MODEM_SLEEP (500)
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
#define BLE_RTC_DELAY_US (0)
|
||||
#define BLE_RTC_DELAY_US_LIGHT_SLEEP (2000)
|
||||
#define BLE_RTC_DELAY_US_MODEM_SLEEP (0)
|
||||
static void ble_sleep_timer_callback(void *arg);
|
||||
static DRAM_ATTR esp_timer_handle_t s_ble_sleep_timer = NULL;
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
@@ -356,6 +382,23 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (!end) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x,", addr[i]);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x,", addr[i]);
|
||||
}
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no)
|
||||
{
|
||||
@@ -427,8 +470,7 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
|
||||
if (!s_ble_active) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
uint32_t delta_tick;
|
||||
uint32_t us_to_sleep;
|
||||
@@ -449,7 +491,7 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
|
||||
esp_err_t err = esp_timer_start_once(s_ble_sleep_timer,
|
||||
us_to_sleep - BTDM_MIN_TIMER_UNCERTAINTY_US);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ESP timer start failed\n");
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ESP timer start failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -458,11 +500,15 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
r_ble_rtc_wake_up_state_clr();
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
sleep_retention_do_extra_retention(true);
|
||||
s_ble_backed_up = true;
|
||||
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
esp_phy_disable();
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
esp_phy_disable();
|
||||
s_ble_active = false;
|
||||
}
|
||||
|
||||
@@ -471,37 +517,58 @@ IRAM_ATTR void controller_wakeup_cb(void *arg)
|
||||
if (s_ble_active) {
|
||||
return;
|
||||
}
|
||||
esp_phy_enable();
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
r_ble_rtc_wake_up_state_clr();
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE && SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
sleep_retention_do_extra_retention(false);
|
||||
s_ble_backed_up = false;
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE && SOC_PM_RETENTION_HAS_CLOCK_BUG */
|
||||
#endif //CONFIG_PM_ENABLE
|
||||
|
||||
esp_phy_enable();
|
||||
s_ble_active = true;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
static void ble_sleep_timer_callback(void * arg)
|
||||
{
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
}
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
|
||||
esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra)
|
||||
{
|
||||
uint8_t size;
|
||||
const sleep_retention_entries_config_t *ble_mac_modem_config = esp_ble_mac_retention_link_get(&size, extra);
|
||||
esp_err_t err = sleep_retention_entries_create(ble_mac_modem_config, size, REGDMA_LINK_PRI_5, SLEEP_RETENTION_MODULE_BLE_MAC);
|
||||
if (err == ESP_OK) {
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Modem BLE MAC retention initialization");
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
static void sleep_modem_ble_mac_modem_state_deinit(void)
|
||||
{
|
||||
sleep_retention_entries_destroy(SLEEP_RETENTION_MODULE_BLE_MAC);
|
||||
}
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
|
||||
esp_err_t controller_sleep_init(void)
|
||||
{
|
||||
esp_err_t rc = 0;
|
||||
|
||||
#ifdef CONFIG_BT_LE_SLEEP_ENABLE
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "BLE modem sleep is enabled\n");
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "BLE modem sleep is enabled");
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
ble_lll_rfmgmt_set_sleep_cb(controller_sleep_cb, controller_wakeup_cb, 0, 0,
|
||||
500 + BLE_RTC_DELAY_US);
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_ON);
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
BLE_RTC_DELAY_US_LIGHT_SLEEP);
|
||||
#else
|
||||
ble_lll_rfmgmt_set_sleep_cb(controller_sleep_cb, controller_wakeup_cb, 0, 0,
|
||||
BLE_RTC_DELAY_US_MODEM_SLEEP);
|
||||
#endif /* FREERTOS_USE_TICKLESS_IDLE */
|
||||
#endif // CONFIG_BT_LE_SLEEP_ENABLE
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
@@ -510,7 +577,7 @@ esp_err_t controller_sleep_init(void)
|
||||
goto error;
|
||||
}
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
esp_timer_create_args_t create_args = {
|
||||
.callback = ble_sleep_timer_callback,
|
||||
@@ -524,20 +591,23 @@ esp_err_t controller_sleep_init(void)
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Enable light sleep, the wake up source is ESP timer");
|
||||
#endif //CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
|
||||
/* Create a new regdma link for BLE related register restoration */
|
||||
rc = sleep_modem_ble_mac_modem_state_init(1);
|
||||
assert(rc == 0);
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
esp_sleep_enable_bt_wakeup();
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Enable light sleep, the wake up source is BLE timer");
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
return rc;
|
||||
|
||||
error:
|
||||
/*lock should release first and then delete*/
|
||||
if (s_pm_lock != NULL) {
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
esp_pm_lock_delete(s_pm_lock);
|
||||
s_pm_lock = NULL;
|
||||
}
|
||||
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
esp_sleep_disable_bt_wakeup();
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
if (s_ble_sleep_timer != NULL) {
|
||||
esp_timer_stop(s_ble_sleep_timer);
|
||||
@@ -545,34 +615,30 @@ error:
|
||||
s_ble_sleep_timer = NULL;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
esp_sleep_disable_bt_wakeup();
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#endif //CONFIG_PM_ENABLE
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
/*lock should release first and then delete*/
|
||||
if (s_pm_lock != NULL) {
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
esp_pm_lock_delete(s_pm_lock);
|
||||
s_pm_lock = NULL;
|
||||
}
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void controller_sleep_deinit(void)
|
||||
{
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
if (s_ble_backed_up) {
|
||||
sleep_retention_module_deinit();
|
||||
s_ble_backed_up = false;
|
||||
}
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
r_ble_rtc_wake_up_state_clr();
|
||||
esp_sleep_disable_bt_wakeup();
|
||||
#endif //CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_AUTO);
|
||||
|
||||
/* lock should be released first */
|
||||
if (s_ble_active) {
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
}
|
||||
|
||||
esp_pm_lock_delete(s_pm_lock);
|
||||
s_pm_lock = NULL;
|
||||
|
||||
sleep_modem_ble_mac_modem_state_deinit();
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
if (s_ble_sleep_timer != NULL) {
|
||||
esp_timer_stop(s_ble_sleep_timer);
|
||||
@@ -580,9 +646,83 @@ void controller_sleep_deinit(void)
|
||||
s_ble_sleep_timer = NULL;
|
||||
}
|
||||
#endif //CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
/* lock should be released first */
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
esp_pm_lock_delete(s_pm_lock);
|
||||
s_pm_lock = NULL;
|
||||
#endif //CONFIG_PM_ENABLE
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
FILTER_DUPLICATE_PDUTYPE = BIT(0),
|
||||
FILTER_DUPLICATE_LENGTH = BIT(1),
|
||||
FILTER_DUPLICATE_ADDRESS = BIT(2),
|
||||
FILTER_DUPLICATE_ADVDATA = BIT(3),
|
||||
FILTER_DUPLICATE_DEFAULT = FILTER_DUPLICATE_PDUTYPE | FILTER_DUPLICATE_ADDRESS,
|
||||
FILTER_DUPLICATE_PDU_ALL = 0xF,
|
||||
FILTER_DUPLICATE_EXCEPTION_FOR_MESH = BIT(4),
|
||||
FILTER_DUPLICATE_AD_TYPE = BIT(5),
|
||||
}disc_duplicate_mode_t;
|
||||
|
||||
|
||||
extern void filter_duplicate_mode_enable(disc_duplicate_mode_t mode);
|
||||
extern void filter_duplicate_mode_disable(disc_duplicate_mode_t mode);
|
||||
extern void filter_duplicate_set_ring_list_max_num(uint32_t max_num);
|
||||
extern void scan_duplicate_cache_refresh_set_time(uint32_t period_time);
|
||||
|
||||
int
|
||||
ble_vhci_disc_duplicate_mode_enable(int mode)
|
||||
{
|
||||
// TODO: use vendor hci to update
|
||||
filter_duplicate_mode_enable(mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
ble_vhci_disc_duplicate_mode_disable(int mode)
|
||||
{
|
||||
// TODO: use vendor hci to update
|
||||
filter_duplicate_mode_disable(mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
int ble_vhci_disc_duplicate_set_max_cache_size(int max_cache_size){
|
||||
// TODO: use vendor hci to update
|
||||
filter_duplicate_set_ring_list_max_num(max_cache_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
int ble_vhci_disc_duplicate_set_period_refresh_time(int refresh_period_time){
|
||||
// TODO: use vendor hci to update
|
||||
scan_duplicate_cache_refresh_set_time(refresh_period_time);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Config scan duplicate option mode from menuconfig (Adapt to the old configuration method.)
|
||||
*/
|
||||
void ble_controller_scan_duplicate_config(void)
|
||||
{
|
||||
uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT;
|
||||
uint32_t cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE;
|
||||
if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 0) {
|
||||
duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_PDUTYPE;
|
||||
} else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 1) {
|
||||
duplicate_mode = FILTER_DUPLICATE_ADVDATA;
|
||||
} else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 2) {
|
||||
duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_ADVDATA;
|
||||
}
|
||||
|
||||
duplicate_mode |= FILTER_DUPLICATE_EXCEPTION_FOR_MESH;
|
||||
|
||||
ble_vhci_disc_duplicate_mode_disable(0xFFFFFFFF);
|
||||
ble_vhci_disc_duplicate_mode_enable(duplicate_mode);
|
||||
ble_vhci_disc_duplicate_set_max_cache_size(cache_size);
|
||||
ble_vhci_disc_duplicate_set_period_refresh_time(CONFIG_BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD);
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
{
|
||||
uint8_t mac[6];
|
||||
@@ -644,10 +784,36 @@ 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_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL, 249);
|
||||
|
||||
/* Select slow clock source for BT momdule */
|
||||
#if CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using main XTAL as clock source");
|
||||
uint32_t chip_version = efuse_hal_chip_revision();
|
||||
if (chip_version == 0) {
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL, (400 - 1));
|
||||
} else{
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL, (5 - 1));
|
||||
}
|
||||
#else
|
||||
#if CONFIG_RTC_CLK_SRC_INT_RC
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using 136 kHz RC as clock source, can only run legacy ADV or SCAN due to low clock accuracy!");
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_RC_SLOW, (5 - 1));
|
||||
#elif CONFIG_RTC_CLK_SRC_EXT_CRYS
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using external 32.768 kHz XTAL as clock source");
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_XTAL32K, (1 - 1));
|
||||
#elif CONFIG_RTC_CLK_SRC_INT_RC32K
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using 32 kHz RC as clock source, can only run legacy ADV or SCAN due to low clock accuracy!");
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_RC32K, (1 - 1));
|
||||
#elif CONFIG_RTC_CLK_SRC_EXT_OSC
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using 32 kHz oscillator as clock source, can only run legacy ADV or SCAN due to low clock accuracy!");
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_EXT32K, (1 - 1));
|
||||
#else
|
||||
ESP_LOGE(NIMBLE_PORT_LOG_TAG, "Unsupported clock source");
|
||||
assert(0);
|
||||
#endif
|
||||
#endif /* CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL */
|
||||
esp_phy_modem_init();
|
||||
esp_phy_enable();
|
||||
esp_btbb_enable();
|
||||
@@ -669,12 +835,27 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
ret = ble_log_init_async(bt_controller_log_interface, false);
|
||||
#else
|
||||
ret = ble_log_init_async(bt_controller_log_interface, true);
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
ret = controller_sleep_init();
|
||||
if (ret != ESP_OK) {
|
||||
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);
|
||||
@@ -687,6 +868,9 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
|
||||
free_controller:
|
||||
controller_sleep_deinit();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
esp_btbb_disable();
|
||||
esp_phy_disable();
|
||||
@@ -725,6 +909,9 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
@@ -1004,6 +1191,13 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
return (esp_power_level_t)tx_level;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
void esp_ble_controller_log_dump_all(bool output)
|
||||
{
|
||||
ble_log_async_output_dump_all(output);
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
|
||||
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED == true)
|
||||
#define BLE_SM_KEY_ERR 0x17
|
||||
|
||||
@@ -260,6 +260,19 @@ config BT_LE_CONTROLLER_TASK_STACK_SIZE
|
||||
help
|
||||
This configures stack size of NimBLE controller task
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_ENABLED
|
||||
bool "Controller log enable"
|
||||
default n
|
||||
help
|
||||
Enable controller log module
|
||||
|
||||
config BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
bool "Controller log dump mode only"
|
||||
depends on BT_LE_CONTROLLER_LOG_ENABLED
|
||||
default y
|
||||
help
|
||||
Only operate in dump mode
|
||||
|
||||
config BT_LE_LL_RESOLV_LIST_SIZE
|
||||
int "BLE LL Resolving list size"
|
||||
range 1 5
|
||||
@@ -340,7 +353,7 @@ config BT_LE_LL_SCA
|
||||
config BT_LE_MAX_CONNECTIONS
|
||||
int "Maximum number of concurrent connections"
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
range 1 9
|
||||
range 1 35
|
||||
default 3
|
||||
help
|
||||
Defines maximum number of concurrent BLE connections. For ESP32, user
|
||||
@@ -395,6 +408,26 @@ choice BT_LE_WAKEUP_SOURCE
|
||||
Use BLE rtc timer to wakeup CPU
|
||||
endchoice
|
||||
|
||||
choice BT_LE_LP_CLK_SRC
|
||||
prompt "BLE low power clock source"
|
||||
default BT_LE_LP_CLK_SRC_MAIN_XTAL
|
||||
config BT_LE_LP_CLK_SRC_MAIN_XTAL
|
||||
bool "Use main XTAL as RTC clock source"
|
||||
help
|
||||
User main XTAL as RTC clock source.
|
||||
This option is recommended if external 32.768k XTAL is not available.
|
||||
Using the external 32.768 kHz XTAL will have lower current consumption
|
||||
in light sleep compared to using the main XTAL.
|
||||
|
||||
config BT_LE_LP_CLK_SRC_DEFAULT
|
||||
bool "Use system RTC slow clock source"
|
||||
help
|
||||
Use the same slow clock source as system RTC
|
||||
Using any clock source other than external 32.768 kHz XTAL supports only
|
||||
legacy ADV and SCAN due to low clock accuracy.
|
||||
|
||||
endchoice
|
||||
|
||||
config BT_LE_USE_ESP_TIMER
|
||||
bool "Enable Esp Timer for Callout"
|
||||
depends on !BT_NIMBLE_ENABLED
|
||||
@@ -402,3 +435,75 @@ config BT_LE_USE_ESP_TIMER
|
||||
help
|
||||
Set this option to use Esp Timer which has higher priority timer
|
||||
instead of FreeRTOS timer
|
||||
|
||||
config BT_LE_SCAN_DUPL
|
||||
bool "BLE Scan Duplicate Options"
|
||||
default y
|
||||
help
|
||||
This select enables parameters setting of BLE scan duplicate.
|
||||
|
||||
choice BT_LE_SCAN_DUPL_TYPE
|
||||
prompt "Scan Duplicate Type"
|
||||
default BT_LE_SCAN_DUPL_TYPE_DEVICE
|
||||
depends on BT_LE_SCAN_DUPL
|
||||
help
|
||||
Scan duplicate have three ways. one is "Scan Duplicate By Device Address", This way is to use
|
||||
advertiser address filtering. The adv packet of the same address is only allowed to be reported once.
|
||||
Another way is "Scan Duplicate By Device Address And Advertising Data". This way is to use advertising
|
||||
data and device address filtering. All different adv packets with the same address are allowed to be
|
||||
reported. The last way is "Scan Duplicate By Advertising Data". This way is to use advertising data
|
||||
filtering. All same advertising data only allow to be reported once even though they are from
|
||||
different devices.
|
||||
|
||||
config BT_LE_SCAN_DUPL_TYPE_DEVICE
|
||||
bool "Scan Duplicate By Device Address"
|
||||
help
|
||||
This way is to use advertiser address filtering. The adv packet of the same address is only
|
||||
allowed to be reported once
|
||||
|
||||
config BT_LE_SCAN_DUPL_TYPE_DATA
|
||||
bool "Scan Duplicate By Advertising Data"
|
||||
help
|
||||
This way is to use advertising data filtering. All same advertising data only allow to be reported
|
||||
once even though they are from different devices.
|
||||
|
||||
config BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE
|
||||
bool "Scan Duplicate By Device Address And Advertising Data"
|
||||
help
|
||||
This way is to use advertising data and device address filtering. All different adv packets with
|
||||
the same address are allowed to be reported.
|
||||
endchoice
|
||||
|
||||
config BT_LE_SCAN_DUPL_TYPE
|
||||
int
|
||||
depends on BT_LE_SCAN_DUPL
|
||||
default 0 if BT_LE_SCAN_DUPL_TYPE_DEVICE
|
||||
default 1 if BT_LE_SCAN_DUPL_TYPE_DATA
|
||||
default 2 if BT_LE_SCAN_DUPL_TYPE_DATA_DEVICE
|
||||
default 0
|
||||
|
||||
|
||||
config BT_LE_SCAN_DUPL_CACHE_SIZE
|
||||
int "Maximum number of devices in scan duplicate filter"
|
||||
depends on BT_LE_SCAN_DUPL
|
||||
range 10 1000
|
||||
default 100
|
||||
help
|
||||
Maximum number of devices which can be recorded in scan duplicate filter.
|
||||
When the maximum amount of device in the filter is reached, the cache will be refreshed.
|
||||
|
||||
config BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD
|
||||
int "Duplicate scan list refresh period (seconds)"
|
||||
depends on BT_LE_SCAN_DUPL
|
||||
range 0 1000
|
||||
default 0
|
||||
help
|
||||
If the period value is non-zero, the controller will periodically clear the device information
|
||||
stored in the scan duuplicate filter. If it is 0, the scan duuplicate filter will not be cleared
|
||||
until the scanning is disabled. Duplicate advertisements for this period should not be sent to the
|
||||
Host in advertising report events.
|
||||
There are two scenarios where the ADV packet will be repeatedly reported:
|
||||
1. The duplicate scan cache is full, the controller will delete the oldest device information and
|
||||
add new device information.
|
||||
2. When the refresh period is up, the controller will clear all device information and start filtering
|
||||
again.
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
#include "hci_uart.h"
|
||||
#include "bt_osi_mem.h"
|
||||
|
||||
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
#include "esp_private/sleep_retention.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BT_BLUEDROID_ENABLED
|
||||
#include "hci/hci_hal.h"
|
||||
#endif // CONFIG_BT_BLUEDROID_ENABLED
|
||||
@@ -49,7 +53,6 @@
|
||||
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "esp_sleep.h"
|
||||
|
||||
/* Macro definition
|
||||
************************************************************************
|
||||
*/
|
||||
@@ -104,12 +107,19 @@ struct ext_funcs_t {
|
||||
uint32_t magic;
|
||||
};
|
||||
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
typedef void (*interface_func_t) (uint32_t len, const uint8_t*addr, bool end);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/* External functions or variables
|
||||
************************************************************************
|
||||
*/
|
||||
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);
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
extern int ble_log_init_async(interface_func_t bt_controller_log_interface, bool task_create);
|
||||
extern int ble_log_deinit_async(void);
|
||||
extern void ble_log_async_output_dump_all(bool output);
|
||||
#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);
|
||||
@@ -122,9 +132,12 @@ extern void npl_freertos_mempool_deinit(void);
|
||||
extern int os_msys_buf_alloc(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);
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
extern void 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 ble_rtc_wake_up_state_clr(void);
|
||||
extern void r_ble_rtc_wake_up_state_clr(void);
|
||||
extern int os_msys_init(void);
|
||||
extern void os_msys_buf_free(void);
|
||||
extern int ble_sm_alg_gen_dhkey(const uint8_t *peer_pub_key_x,
|
||||
@@ -170,6 +183,9 @@ static void esp_reset_rpa_moudle(void);
|
||||
static int esp_ecc_gen_key_pair(uint8_t *pub, uint8_t *priv);
|
||||
static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer_pub_key_y,
|
||||
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);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/* Local variable definition
|
||||
***************************************************************************
|
||||
*/
|
||||
@@ -184,11 +200,13 @@ static DRAM_ATTR esp_pm_lock_handle_t s_pm_lock = NULL;
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
#define BLE_RTC_DELAY_US (1100)
|
||||
#define BLE_RTC_DELAY_US_LIGHT_SLEEP (5100)
|
||||
#define BLE_RTC_DELAY_US_MODEM_SLEEP (1500)
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
#define BLE_RTC_DELAY_US (0)
|
||||
#define BLE_RTC_DELAY_US_LIGHT_SLEEP (2000)
|
||||
#define BLE_RTC_DELAY_US_MODEM_SLEEP (0)
|
||||
static void ble_sleep_timer_callback(void *arg);
|
||||
static DRAM_ATTR esp_timer_handle_t s_ble_sleep_timer = NULL;
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
@@ -356,6 +374,23 @@ static int esp_ecc_gen_dh_key(const uint8_t *peer_pub_key_x, const uint8_t *peer
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
static void esp_bt_controller_log_interface(uint32_t len, const uint8_t *addr, bool end)
|
||||
{
|
||||
if (!end) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x,", addr[i]);
|
||||
}
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < len; i++) {
|
||||
esp_rom_printf("%02x,", addr[i]);
|
||||
}
|
||||
esp_rom_printf("\n");
|
||||
}
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
static void hci_uart_start_tx_wrapper(int uart_no)
|
||||
{
|
||||
@@ -427,8 +462,7 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
|
||||
if (!s_ble_active) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
uint32_t delta_tick;
|
||||
uint32_t us_to_sleep;
|
||||
@@ -458,11 +492,14 @@ IRAM_ATTR void controller_sleep_cb(uint32_t enable_tick, void *arg)
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
r_ble_rtc_wake_up_state_clr();
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#if SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
sleep_retention_do_extra_retention(true);
|
||||
#endif // SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
esp_phy_disable();
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
esp_phy_disable();
|
||||
s_ble_active = false;
|
||||
}
|
||||
|
||||
@@ -471,37 +508,58 @@ IRAM_ATTR void controller_wakeup_cb(void *arg)
|
||||
if (s_ble_active) {
|
||||
return;
|
||||
}
|
||||
esp_phy_enable();
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
r_ble_rtc_wake_up_state_clr();
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE && SOC_PM_RETENTION_HAS_CLOCK_BUG
|
||||
sleep_retention_do_extra_retention(false);
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE && SOC_PM_RETENTION_HAS_CLOCK_BUG */
|
||||
#endif //CONFIG_PM_ENABLE
|
||||
|
||||
esp_phy_enable();
|
||||
s_ble_active = true;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
#ifdef CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
static void ble_sleep_timer_callback(void * arg)
|
||||
{
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
}
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
|
||||
static esp_err_t sleep_modem_ble_mac_modem_state_init(uint8_t extra)
|
||||
{
|
||||
uint8_t size;
|
||||
const sleep_retention_entries_config_t *ble_mac_modem_config = esp_ble_mac_retention_link_get(&size, extra);
|
||||
esp_err_t err = sleep_retention_entries_create(ble_mac_modem_config, size, REGDMA_LINK_PRI_5, SLEEP_RETENTION_MODULE_BLE_MAC);
|
||||
if (err == ESP_OK) {
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Modem BLE MAC retention initialization");
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
static void sleep_modem_ble_mac_modem_state_deinit(void)
|
||||
{
|
||||
sleep_retention_entries_destroy(SLEEP_RETENTION_MODULE_BLE_MAC);
|
||||
}
|
||||
|
||||
#endif // CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
|
||||
esp_err_t controller_sleep_init(void)
|
||||
{
|
||||
esp_err_t rc = 0;
|
||||
|
||||
#ifdef CONFIG_BT_LE_SLEEP_ENABLE
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "BLE modem sleep is enabled\n");
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "BLE modem sleep is enabled");
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
ble_lll_rfmgmt_set_sleep_cb(controller_sleep_cb, controller_wakeup_cb, 0, 0,
|
||||
500 + BLE_RTC_DELAY_US);
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_ON);
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
BLE_RTC_DELAY_US_LIGHT_SLEEP);
|
||||
#else
|
||||
ble_lll_rfmgmt_set_sleep_cb(controller_sleep_cb, controller_wakeup_cb, 0, 0,
|
||||
BLE_RTC_DELAY_US_MODEM_SLEEP);
|
||||
#endif /* FREERTOS_USE_TICKLESS_IDLE */
|
||||
#endif // CONFIG_BT_LE_SLEEP_ENABLE
|
||||
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
@@ -510,7 +568,7 @@ esp_err_t controller_sleep_init(void)
|
||||
goto error;
|
||||
}
|
||||
esp_pm_lock_acquire(s_pm_lock);
|
||||
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
esp_timer_create_args_t create_args = {
|
||||
.callback = ble_sleep_timer_callback,
|
||||
@@ -524,20 +582,23 @@ esp_err_t controller_sleep_init(void)
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Enable light sleep, the wake up source is ESP timer");
|
||||
#endif //CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
|
||||
/* Create a new regdma link for BLE related register restoration */
|
||||
rc = sleep_modem_ble_mac_modem_state_init(1);
|
||||
assert(rc == 0);
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
esp_sleep_enable_bt_wakeup();
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "Enable light sleep, the wake up source is BLE timer");
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
return rc;
|
||||
|
||||
error:
|
||||
/*lock should release first and then delete*/
|
||||
if (s_pm_lock != NULL) {
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
esp_pm_lock_delete(s_pm_lock);
|
||||
s_pm_lock = NULL;
|
||||
}
|
||||
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
esp_sleep_disable_bt_wakeup();
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
if (s_ble_sleep_timer != NULL) {
|
||||
esp_timer_stop(s_ble_sleep_timer);
|
||||
@@ -545,34 +606,26 @@ error:
|
||||
s_ble_sleep_timer = NULL;
|
||||
}
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
esp_sleep_disable_bt_wakeup();
|
||||
#endif // CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
#endif //CONFIG_PM_ENABLE
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
/*lock should release first and then delete*/
|
||||
if (s_pm_lock != NULL) {
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
esp_pm_lock_delete(s_pm_lock);
|
||||
s_pm_lock = NULL;
|
||||
}
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
void controller_sleep_deinit(void)
|
||||
{
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
r_ble_rtc_wake_up_state_clr();
|
||||
esp_sleep_disable_bt_wakeup();
|
||||
#endif //CONFIG_BT_LE_WAKEUP_SOURCE_BLE_RTC_TIMER
|
||||
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_AUTO);
|
||||
|
||||
/* lock should be released first */
|
||||
if (s_ble_active) {
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
}
|
||||
|
||||
esp_pm_lock_delete(s_pm_lock);
|
||||
s_pm_lock = NULL;
|
||||
|
||||
sleep_modem_ble_mac_modem_state_deinit();
|
||||
#ifdef CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
if (s_ble_sleep_timer != NULL) {
|
||||
esp_timer_stop(s_ble_sleep_timer);
|
||||
@@ -580,9 +633,83 @@ void controller_sleep_deinit(void)
|
||||
s_ble_sleep_timer = NULL;
|
||||
}
|
||||
#endif //CONFIG_BT_LE_WAKEUP_SOURCE_CPU_RTC_TIMER
|
||||
#endif /* CONFIG_FREERTOS_USE_TICKLESS_IDLE */
|
||||
#ifdef CONFIG_PM_ENABLE
|
||||
/* lock should be released first */
|
||||
esp_pm_lock_release(s_pm_lock);
|
||||
esp_pm_lock_delete(s_pm_lock);
|
||||
s_pm_lock = NULL;
|
||||
#endif //CONFIG_PM_ENABLE
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
FILTER_DUPLICATE_PDUTYPE = BIT(0),
|
||||
FILTER_DUPLICATE_LENGTH = BIT(1),
|
||||
FILTER_DUPLICATE_ADDRESS = BIT(2),
|
||||
FILTER_DUPLICATE_ADVDATA = BIT(3),
|
||||
FILTER_DUPLICATE_DEFAULT = FILTER_DUPLICATE_PDUTYPE | FILTER_DUPLICATE_ADDRESS,
|
||||
FILTER_DUPLICATE_PDU_ALL = 0xF,
|
||||
FILTER_DUPLICATE_EXCEPTION_FOR_MESH = BIT(4),
|
||||
FILTER_DUPLICATE_AD_TYPE = BIT(5),
|
||||
}disc_duplicate_mode_t;
|
||||
|
||||
|
||||
extern void filter_duplicate_mode_enable(disc_duplicate_mode_t mode);
|
||||
extern void filter_duplicate_mode_disable(disc_duplicate_mode_t mode);
|
||||
extern void filter_duplicate_set_ring_list_max_num(uint32_t max_num);
|
||||
extern void scan_duplicate_cache_refresh_set_time(uint32_t period_time);
|
||||
|
||||
int
|
||||
ble_vhci_disc_duplicate_mode_enable(int mode)
|
||||
{
|
||||
// TODO: use vendor hci to update
|
||||
filter_duplicate_mode_enable(mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
ble_vhci_disc_duplicate_mode_disable(int mode)
|
||||
{
|
||||
// TODO: use vendor hci to update
|
||||
filter_duplicate_mode_disable(mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
int ble_vhci_disc_duplicate_set_max_cache_size(int max_cache_size){
|
||||
// TODO: use vendor hci to update
|
||||
filter_duplicate_set_ring_list_max_num(max_cache_size);
|
||||
return true;
|
||||
}
|
||||
|
||||
int ble_vhci_disc_duplicate_set_period_refresh_time(int refresh_period_time){
|
||||
// TODO: use vendor hci to update
|
||||
scan_duplicate_cache_refresh_set_time(refresh_period_time);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Config scan duplicate option mode from menuconfig (Adapt to the old configuration method.)
|
||||
*/
|
||||
void ble_controller_scan_duplicate_config(void)
|
||||
{
|
||||
uint32_t duplicate_mode = FILTER_DUPLICATE_DEFAULT;
|
||||
uint32_t cache_size = CONFIG_BT_LE_SCAN_DUPL_CACHE_SIZE;
|
||||
if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 0) {
|
||||
duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_PDUTYPE;
|
||||
} else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 1) {
|
||||
duplicate_mode = FILTER_DUPLICATE_ADVDATA;
|
||||
} else if (CONFIG_BT_LE_SCAN_DUPL_TYPE == 2) {
|
||||
duplicate_mode = FILTER_DUPLICATE_ADDRESS | FILTER_DUPLICATE_ADVDATA;
|
||||
}
|
||||
|
||||
duplicate_mode |= FILTER_DUPLICATE_EXCEPTION_FOR_MESH;
|
||||
|
||||
ble_vhci_disc_duplicate_mode_disable(0xFFFFFFFF);
|
||||
ble_vhci_disc_duplicate_mode_enable(duplicate_mode);
|
||||
ble_vhci_disc_duplicate_set_max_cache_size(cache_size);
|
||||
ble_vhci_disc_duplicate_set_period_refresh_time(CONFIG_BT_LE_SCAN_DUPL_CACHE_REFRESH_PERIOD);
|
||||
}
|
||||
|
||||
esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
{
|
||||
uint8_t mac[6];
|
||||
@@ -647,7 +774,27 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
|
||||
/* Enable BT-related clocks */
|
||||
modem_clock_module_enable(PERIPH_BT_MODULE);
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL, 249);
|
||||
#if CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using main XTAL as clock source");
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_MAIN_XTAL, (320 - 1));
|
||||
#else
|
||||
#if CONFIG_RTC_CLK_SRC_INT_RC
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using 136 kHz RC as clock source, can only run legacy ADV or SCAN due to low clock accuracy!");
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_RC_SLOW, (5 - 1));
|
||||
#elif CONFIG_RTC_CLK_SRC_EXT_CRYS
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using external 32.768 kHz XTAL as clock source");
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_XTAL32K, (1 - 1));
|
||||
#elif CONFIG_RTC_CLK_SRC_INT_RC32K
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using 32 kHz RC as clock source, can only run legacy ADV or SCAN due to low clock accuracy!");
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_RC32K, (1 - 1));
|
||||
#elif CONFIG_RTC_CLK_SRC_EXT_OSC
|
||||
ESP_LOGI(NIMBLE_PORT_LOG_TAG, "Using 32 kHz oscillator as clock source, can only run legacy ADV or SCAN due to low clock accuracy!");
|
||||
modem_clock_select_lp_clock_source(PERIPH_BT_MODULE, MODEM_CLOCK_LPCLK_SRC_EXT32K, (1 - 1));
|
||||
#else
|
||||
ESP_LOGE(NIMBLE_PORT_LOG_TAG, "Unsupported clock source");
|
||||
assert(0);
|
||||
#endif
|
||||
#endif /* CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL */
|
||||
esp_phy_enable();
|
||||
esp_btbb_enable();
|
||||
s_ble_active = true;
|
||||
@@ -668,6 +815,22 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto free_controller;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
interface_func_t bt_controller_log_interface;
|
||||
bt_controller_log_interface = esp_bt_controller_log_interface;
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_DUMP_ONLY
|
||||
ret = ble_log_init_async(bt_controller_log_interface, false);
|
||||
#else
|
||||
ret = ble_log_init_async(bt_controller_log_interface, true);
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_DUMP
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "ble_controller_log_init failed %d", ret);
|
||||
goto free_controller;
|
||||
}
|
||||
#endif // CONFIG_BT_CONTROLLER_LOG_ENABLED
|
||||
|
||||
ble_controller_scan_duplicate_config();
|
||||
|
||||
ret = controller_sleep_init();
|
||||
if (ret != ESP_OK) {
|
||||
ESP_LOGW(NIMBLE_PORT_LOG_TAG, "controller_sleep_init failed %d", ret);
|
||||
@@ -686,6 +849,9 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
|
||||
free_controller:
|
||||
controller_sleep_deinit();
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
esp_btbb_disable();
|
||||
esp_phy_disable();
|
||||
@@ -722,6 +888,9 @@ esp_err_t esp_bt_controller_deinit(void)
|
||||
modem_clock_deselect_lp_clock_source(PERIPH_BT_MODULE);
|
||||
modem_clock_module_disable(PERIPH_BT_MODULE);
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_log_deinit_async();
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
ble_controller_deinit();
|
||||
|
||||
#if CONFIG_BT_NIMBLE_ENABLED
|
||||
@@ -1001,6 +1170,13 @@ esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t po
|
||||
return (esp_power_level_t)tx_level;
|
||||
}
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
void esp_ble_controller_log_dump_all(bool output)
|
||||
{
|
||||
ble_log_async_output_dump_all(output);
|
||||
}
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
|
||||
#if (!CONFIG_BT_NIMBLE_ENABLED) && (CONFIG_BT_CONTROLLER_ENABLED == true)
|
||||
#define BLE_SM_KEY_ERR 0x17
|
||||
|
||||
Submodule components/bt/controller/lib_esp32 updated: 26b2361bf7...e1b3a29c58
Submodule components/bt/controller/lib_esp32c2/esp32c2-bt-lib updated: 8cc0fd4f9c...5fcfd0e457
Submodule components/bt/controller/lib_esp32c3_family updated: d7513ebe88...b438f60a29
Submodule components/bt/controller/lib_esp32c6/esp32c6-bt-lib updated: 31146e6b98...d785de0a7c
Submodule components/bt/controller/lib_esp32h2/esp32h2-bt-lib updated: 3bd0211ba3...35bd3cd735
@@ -13,6 +13,8 @@ if BLE_MESH
|
||||
select BTDM_BLE_MESH_SCAN_DUPL_EN if IDF_TARGET_ESP32
|
||||
select BT_CTRL_BLE_SCAN_DUPL if IDF_TARGET_ESP32C3
|
||||
select BT_CTRL_BLE_MESH_SCAN_DUPL_EN if IDF_TARGET_ESP32C3
|
||||
select BT_LE_SCAN_DUPL if IDF_TARGET_ESP32C6
|
||||
select BT_LE_SCAN_DUPL if IDF_TARGET_ESP32H2
|
||||
default y
|
||||
help
|
||||
Enable this option to allow using specific duplicate scan filter
|
||||
|
||||
@@ -197,6 +197,8 @@ static bool prov_bearers_valid(bt_mesh_prov_bearer_t bearers)
|
||||
|
||||
int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
if (bt_mesh_is_provisioned()) {
|
||||
BT_WARN("%s, Already", __func__);
|
||||
return -EALREADY;
|
||||
@@ -232,7 +234,11 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)
|
||||
if (IS_ENABLED(CONFIG_BLE_MESH_PB_ADV) &&
|
||||
(bearers & BLE_MESH_PROV_ADV)) {
|
||||
/* Make sure we're scanning for provisioning invitations */
|
||||
bt_mesh_scan_enable();
|
||||
err = bt_mesh_scan_enable();
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Enable unprovisioned beacon sending */
|
||||
bt_mesh_beacon_enable();
|
||||
}
|
||||
@@ -637,7 +643,10 @@ int bt_mesh_provisioner_enable(bt_mesh_prov_bearer_t bearers)
|
||||
bt_mesh_beacon_enable();
|
||||
}
|
||||
|
||||
bt_mesh_scan_enable();
|
||||
err = bt_mesh_scan_enable();
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3470,7 +3470,7 @@ void bt_mesh_provisioner_unprov_beacon_recv(struct net_buf_simple *buf, int8_t r
|
||||
uint16_t oob_info = 0U;
|
||||
|
||||
if (!(prov_ctx.bearers & BLE_MESH_PROV_ADV)) {
|
||||
BT_WARN("Not support PB-ADV bearer");
|
||||
BT_INFO("Not support PB-ADV bearer");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3506,7 +3506,7 @@ void bt_mesh_provisioner_prov_adv_recv(struct net_buf_simple *buf,
|
||||
uint16_t oob_info = 0U;
|
||||
|
||||
if (!(prov_ctx.bearers & BLE_MESH_PROV_GATT)) {
|
||||
BT_WARN("Not support PB-GATT bearer");
|
||||
BT_INFO("Not support PB-GATT bearer");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -431,8 +431,7 @@ esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_l
|
||||
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (raw_data == NULL
|
||||
|| (raw_data_len <= 0 || raw_data_len > ESP_BLE_ADV_DATA_LEN_MAX)) {
|
||||
if ((raw_data_len != 0 && raw_data == NULL) || raw_data_len > ESP_BLE_ADV_DATA_LEN_MAX) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
@@ -16,6 +16,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/// maximum size of HID Device report descriptor
|
||||
#define BTHH_MAX_DSC_LEN 884
|
||||
|
||||
/**
|
||||
@@ -26,34 +27,33 @@ typedef enum {
|
||||
ESP_HIDH_CONN_STATE_CONNECTING, /*!< connecting state */
|
||||
ESP_HIDH_CONN_STATE_DISCONNECTED, /*!< disconnected state */
|
||||
ESP_HIDH_CONN_STATE_DISCONNECTING, /*!< disconnecting state */
|
||||
ESP_HIDH_CONN_STATE_UNKNOWN /*!< unknown state(initial state) */
|
||||
ESP_HIDH_CONN_STATE_UNKNOWN /*!< unknown state (initial state) */
|
||||
} esp_hidh_connection_state_t;
|
||||
|
||||
/**
|
||||
* @brief HID handshake error code and vendor-defined result code
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_HIDH_OK,
|
||||
ESP_HIDH_HS_HID_NOT_READY, /*!< handshake error : device not ready */
|
||||
ESP_HIDH_HS_INVALID_RPT_ID, /*!< handshake error : invalid report ID */
|
||||
ESP_HIDH_HS_TRANS_NOT_SPT, /*!< handshake error : transaction not spt */
|
||||
ESP_HIDH_HS_INVALID_PARAM, /*!< handshake error : invalid paremeter */
|
||||
ESP_HIDH_HS_ERROR, /*!< handshake error : unspecified HS error */
|
||||
ESP_HIDH_ERR, /*!< general ESP HH error */
|
||||
ESP_HIDH_OK, /*!< successful */
|
||||
ESP_HIDH_HS_HID_NOT_READY, /*!< handshake error: device not ready */
|
||||
ESP_HIDH_HS_INVALID_RPT_ID, /*!< handshake error: invalid report ID */
|
||||
ESP_HIDH_HS_TRANS_NOT_SPT, /*!< handshake error: HID device does not support the request */
|
||||
ESP_HIDH_HS_INVALID_PARAM, /*!< handshake error: parameter value does not meet the expected criteria of called function or API */
|
||||
ESP_HIDH_HS_ERROR, /*!< handshake error: HID device could not identify the error condition */
|
||||
ESP_HIDH_ERR, /*!< general ESP HID Host error */
|
||||
ESP_HIDH_ERR_SDP, /*!< SDP error */
|
||||
ESP_HIDH_ERR_PROTO, /*!< SET_Protocol error,
|
||||
only used in ESP_HIDH_OPEN_EVT callback */
|
||||
|
||||
ESP_HIDH_ERR_DB_FULL, /*!< device database full error, used in
|
||||
ESP_HIDH_OPEN_EVT/ESP_HIDH_ADD_DEV_EVT */
|
||||
ESP_HIDH_ERR_PROTO, /*!< SET_PROTOCOL error, only used in ESP_HIDH_OPEN_EVT callback */
|
||||
ESP_HIDH_ERR_DB_FULL, /*!< device database full, used in ESP_HIDH_OPEN_EVT/ESP_HIDH_ADD_DEV_EVT */
|
||||
ESP_HIDH_ERR_TOD_UNSPT, /*!< type of device not supported */
|
||||
ESP_HIDH_ERR_NO_RES, /*!< out of system resources */
|
||||
ESP_HIDH_ERR_AUTH_FAILED, /*!< authentication fail */
|
||||
ESP_HIDH_ERR_HDL, /*!< connection handle error */
|
||||
ESP_HIDH_ERR_SEC, /*!< encryption error */
|
||||
// self_defined
|
||||
ESP_HIDH_BUSY, /*!< Temporarily can not handle this request. */
|
||||
ESP_HIDH_NO_DATA, /*!< No data. */
|
||||
ESP_HIDH_NEED_INIT, /*!< HIDH module shall init first */
|
||||
ESP_HIDH_NEED_DEINIT, /*!< HIDH module shall deinit first */
|
||||
ESP_HIDH_NO_CONNECTION, /*!< connection may have been closed */
|
||||
ESP_HIDH_BUSY, /*!< vendor-defined: temporarily can not handle this request */
|
||||
ESP_HIDH_NO_DATA, /*!< vendor-defined: no data. */
|
||||
ESP_HIDH_NEED_INIT, /*!< vendor-defined: HIDH module shall initialize first */
|
||||
ESP_HIDH_NEED_DEINIT, /*!< vendor-defined: HIDH module shall de-deinitialize first */
|
||||
ESP_HIDH_NO_CONNECTION, /*!< vendor-defined: connection may have been closed */
|
||||
} esp_hidh_status_t;
|
||||
|
||||
/**
|
||||
@@ -79,35 +79,58 @@ typedef enum {
|
||||
* @brief HID host callback function events
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_HIDH_INIT_EVT = 0, /*!< When HID host is initialized, the event comes */
|
||||
ESP_HIDH_DEINIT_EVT, /*!< When HID host is deinitialized, the event comes */
|
||||
ESP_HIDH_OPEN_EVT, /*!< When HID host connection opened, the event comes */
|
||||
ESP_HIDH_CLOSE_EVT, /*!< When HID host connection closed, the event comes */
|
||||
ESP_HIDH_GET_RPT_EVT, /*!< When Get_Report command is called, the event comes */
|
||||
ESP_HIDH_SET_RPT_EVT, /*!< When Set_Report command is called, the event comes */
|
||||
ESP_HIDH_GET_PROTO_EVT, /*!< When Get_Protocol command is called, the event comes */
|
||||
ESP_HIDH_SET_PROTO_EVT, /*!< When Set_Protocol command is called, the event comes */
|
||||
ESP_HIDH_GET_IDLE_EVT, /*!< When Get_Idle command is called, the event comes */
|
||||
ESP_HIDH_SET_IDLE_EVT, /*!< When Set_Idle command is called, the event comes */
|
||||
ESP_HIDH_GET_DSCP_EVT, /*!< When HIDH is initialized, the event comes */
|
||||
ESP_HIDH_ADD_DEV_EVT, /*!< When a device is added, the event comes */
|
||||
ESP_HIDH_RMV_DEV_EVT, /*!< When a device is removed, the event comes */
|
||||
ESP_HIDH_VC_UNPLUG_EVT, /*!< When virtually unplugged, the event comes */
|
||||
ESP_HIDH_DATA_EVT, /*!< When send data on interrupt channel, the event comes */
|
||||
ESP_HIDH_DATA_IND_EVT, /*!< When receive data on interrupt channel, the event comes */
|
||||
ESP_HIDH_SET_INFO_EVT /*!< When set the HID device descriptor, the event comes */
|
||||
ESP_HIDH_INIT_EVT = 0, /*!< when HID host is initialized, the event comes */
|
||||
ESP_HIDH_DEINIT_EVT, /*!< when HID host is deinitialized, the event comes */
|
||||
ESP_HIDH_OPEN_EVT, /*!< when HID host connection opened, the event comes */
|
||||
ESP_HIDH_CLOSE_EVT, /*!< when HID host connection closed, the event comes */
|
||||
ESP_HIDH_GET_RPT_EVT, /*!< when Get_Report command is called, the event comes */
|
||||
ESP_HIDH_SET_RPT_EVT, /*!< when Set_Report command is called, the event comes */
|
||||
ESP_HIDH_GET_PROTO_EVT, /*!< when Get_Protocol command is called, the event comes */
|
||||
ESP_HIDH_SET_PROTO_EVT, /*!< when Set_Protocol command is called, the event comes */
|
||||
ESP_HIDH_GET_IDLE_EVT, /*!< when Get_Idle command is called, the event comes */
|
||||
ESP_HIDH_SET_IDLE_EVT, /*!< when Set_Idle command is called, the event comes */
|
||||
ESP_HIDH_GET_DSCP_EVT, /*!< when HIDH is initialized, the event comes */
|
||||
ESP_HIDH_ADD_DEV_EVT, /*!< when a device is added, the event comes */
|
||||
ESP_HIDH_RMV_DEV_EVT, /*!< when a device is removed, the event comes */
|
||||
ESP_HIDH_VC_UNPLUG_EVT, /*!< when virtually unplugged, the event comes */
|
||||
ESP_HIDH_DATA_EVT, /*!< when send data on interrupt channel, the event comes */
|
||||
ESP_HIDH_DATA_IND_EVT, /*!< when receive data on interrupt channel, the event comes */
|
||||
ESP_HIDH_SET_INFO_EVT /*!< when set the HID device descriptor, the event comes */
|
||||
} esp_hidh_cb_event_t;
|
||||
|
||||
/**
|
||||
* @brief HID device information from HID Device Service Record and Device ID Service Record
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_HIDH_DEV_ATTR_VIRTUAL_CABLE = 0x0001, /*!< whether Virtual Cables is supported */
|
||||
ESP_HIDH_DEV_ATTR_NORMALLY_CONNECTABLE = 0x0002, /*!< whether device is in Page Scan mode when there is no active connection */
|
||||
ESP_HIDH_DEV_ATTR_RECONNECT_INITIATE = 0x0004, /*!< whether the HID device inititates the reconnection process */
|
||||
} esp_hidh_dev_attr_t;
|
||||
|
||||
/**
|
||||
* @brief application ID(non-zero) for each type of device
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_HIDH_APP_ID_MOUSE = 1, /*!< pointing device */
|
||||
ESP_HIDH_APP_ID_KEYBOARD = 2, /*!< keyboard */
|
||||
ESP_HIDH_APP_ID_REMOTE_CONTROL = 3, /*!< remote control */
|
||||
ESP_HIDH_APP_ID_JOYSTICK = 5, /*!< joystick */
|
||||
ESP_HIDH_APP_ID_GAMEPAD = 6, /*!< gamepad*/
|
||||
} esp_hidh_dev_app_id_t;
|
||||
|
||||
/**
|
||||
* @brief HID device information from HID Device Service Record and Device ID Service Record
|
||||
*/
|
||||
typedef struct {
|
||||
int attr_mask;
|
||||
uint8_t sub_class;
|
||||
uint8_t app_id;
|
||||
int vendor_id;
|
||||
int product_id;
|
||||
int version;
|
||||
uint8_t ctry_code;
|
||||
int dl_len;
|
||||
uint8_t dsc_list[BTHH_MAX_DSC_LEN];
|
||||
int attr_mask; /*!< device attribute bit mask, refer to esp_hidh_dev_attr_t */
|
||||
uint8_t sub_class; /*!< HID device subclass */
|
||||
uint8_t app_id; /*!< application ID, refer to esp_hidh_dev_app_id_t */
|
||||
int vendor_id; /*!< Device ID information: vendor ID */
|
||||
int product_id; /*!< Device ID information: product ID */
|
||||
int version; /*!< Device ID information: version */
|
||||
uint8_t ctry_code; /*!< SDP attrbutes of HID devices: HID country code (https://www.usb.org/sites/default/files/hid1_11.pdf) */
|
||||
int dl_len; /*!< SDP attrbutes of HID devices: HID device descriptor length */
|
||||
uint8_t dsc_list[BTHH_MAX_DSC_LEN]; /*!< SDP attrbutes of HID devices: HID device descriptor definition */
|
||||
} esp_hidh_hid_info_t;
|
||||
|
||||
/**
|
||||
@@ -258,8 +281,8 @@ typedef union {
|
||||
uint16_t vendor_id; /*!< Vendor ID */
|
||||
uint16_t product_id; /*!< Product ID */
|
||||
uint16_t version; /*!< Version */
|
||||
uint16_t ssr_max_latency; /*!< SSR max latency */
|
||||
uint16_t ssr_min_tout; /*!< SSR min timeout */
|
||||
uint16_t ssr_max_latency; /*!< SSR max latency in slots */
|
||||
uint16_t ssr_min_tout; /*!< SSR min timeout in slots */
|
||||
uint8_t ctry_code; /*!< Country Code */
|
||||
uint16_t dl_len; /*!< Device descriptor length */
|
||||
uint8_t *dsc_list; /*!< Device descriptor pointer */
|
||||
@@ -315,7 +338,7 @@ esp_err_t esp_bt_hid_host_init(void);
|
||||
esp_err_t esp_bt_hid_host_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Connect to hid device. When the operation is complete the callback
|
||||
* @brief Connect to HID device. When the operation is complete the callback
|
||||
* function will be called with ESP_HIDH_OPEN_EVT.
|
||||
*
|
||||
* @param[in] bd_addr: Remote device bluetooth device address.
|
||||
@@ -326,7 +349,7 @@ esp_err_t esp_bt_hid_host_deinit(void);
|
||||
esp_err_t esp_bt_hid_host_connect(esp_bd_addr_t bd_addr);
|
||||
|
||||
/**
|
||||
* @brief Disconnect from hid device. When the operation is complete the callback
|
||||
* @brief Disconnect from HID device. When the operation is complete the callback
|
||||
* function will be called with ESP_HIDH_CLOSE_EVT.
|
||||
*
|
||||
* @param[in] bd_addr: Remote device bluetooth device address.
|
||||
|
||||
@@ -232,7 +232,7 @@ void bta_ar_dereg_avct(tBTA_SYS_ID sys_id)
|
||||
**
|
||||
******************************************************************************/
|
||||
void bta_ar_reg_avrc(UINT16 service_uuid, char *service_name, char *provider_name,
|
||||
UINT16 categories, tBTA_SYS_ID sys_id)
|
||||
UINT16 categories, tBTA_SYS_ID sys_id, BOOLEAN browsing_en)
|
||||
{
|
||||
UINT8 mask = bta_ar_id (sys_id);
|
||||
UINT8 temp[8], *p;
|
||||
@@ -245,7 +245,7 @@ void bta_ar_reg_avrc(UINT16 service_uuid, char *service_name, char *provider_nam
|
||||
if (bta_ar_cb.sdp_tg_handle == 0) {
|
||||
bta_ar_cb.tg_registered = mask;
|
||||
bta_ar_cb.sdp_tg_handle = SDP_CreateRecord();
|
||||
AVRC_AddRecord(service_uuid, service_name, provider_name, categories, bta_ar_cb.sdp_tg_handle);
|
||||
AVRC_AddRecord(service_uuid, service_name, provider_name, categories, bta_ar_cb.sdp_tg_handle, browsing_en);
|
||||
bta_sys_add_uuid(service_uuid);
|
||||
}
|
||||
/* only one TG is allowed (first-come, first-served).
|
||||
@@ -255,7 +255,7 @@ void bta_ar_reg_avrc(UINT16 service_uuid, char *service_name, char *provider_nam
|
||||
categories = bta_ar_cb.ct_categories[0] | bta_ar_cb.ct_categories[1];
|
||||
if (bta_ar_cb.sdp_ct_handle == 0) {
|
||||
bta_ar_cb.sdp_ct_handle = SDP_CreateRecord();
|
||||
AVRC_AddRecord(service_uuid, service_name, provider_name, categories, bta_ar_cb.sdp_ct_handle);
|
||||
AVRC_AddRecord(service_uuid, service_name, provider_name, categories, bta_ar_cb.sdp_ct_handle, browsing_en);
|
||||
bta_sys_add_uuid(service_uuid);
|
||||
} else {
|
||||
/* multiple CTs are allowed.
|
||||
|
||||
@@ -1861,8 +1861,8 @@ void bta_av_dereg_comp(tBTA_AV_DATA *p_data)
|
||||
bta_sys_remove_uuid(UUID_SERVCLASS_VIDEO_SOURCE);
|
||||
}
|
||||
|
||||
/* make sure that the timer is not active */
|
||||
bta_sys_stop_timer(&p_scb->timer);
|
||||
/* free the delay timer for AVRC CT */
|
||||
bta_sys_free_timer(&p_scb->timer);
|
||||
list_free(p_scb->a2d_list);
|
||||
p_scb->a2d_list = NULL;
|
||||
utl_freebuf((void **)&p_cb->p_scb[p_scb->hdi]);
|
||||
|
||||
@@ -94,7 +94,8 @@ const tBTA_AV_CFG bta_av_cfg = {
|
||||
6, /* AVDTP audio channel max data queue size */
|
||||
BTA_AV_MAX_VDP_MTU, /* AVDTP video transport channel MTU at L2CAP */
|
||||
600, /* AVDTP video transport channel flush timeout */
|
||||
FALSE, /* TRUE, to accept AVRC 1.3 group nevigation command */
|
||||
FALSE, /* TRUE, to accept AVRC 1.3 group nevigation command */
|
||||
FALSE, /* FALSE, does not support browsing channel */
|
||||
2, /* company id count in p_meta_co_ids */
|
||||
BTA_AV_RC_PASS_RSP_CODE,/* the default response code for pass through commands */
|
||||
bta_av_meta_caps_co_ids,/* the metadata Get Capabilities response for company id */
|
||||
|
||||
@@ -585,10 +585,10 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
(UINT8)(bta_av_cb.sec_mask & (~BTA_SEC_AUTHORIZE)), BTA_ID_AV);
|
||||
if (p_data->api_reg.tsep == AVDT_TSEP_SRC) {
|
||||
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REM_CTRL_TARGET, "AV Remote Control Target\n", NULL,
|
||||
p_bta_av_cfg->avrc_src_tg_cat, BTA_ID_AV);
|
||||
p_bta_av_cfg->avrc_src_tg_cat, BTA_ID_AV, p_bta_av_cfg->avrc_br);
|
||||
} else {
|
||||
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REM_CTRL_TARGET, "AV Remote Control Target\n", NULL,
|
||||
p_bta_av_cfg->avrc_snk_tg_cat, BTA_ID_AV);
|
||||
p_bta_av_cfg->avrc_snk_tg_cat, BTA_ID_AV, p_bta_av_cfg->avrc_br);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -721,10 +721,10 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
/* create an SDP record as AVRC CT. */
|
||||
if (p_data->api_reg.tsep == AVDT_TSEP_SRC) {
|
||||
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REMOTE_CONTROL, "AV Remote Control Controller\n", NULL,
|
||||
p_bta_av_cfg->avrc_src_ct_cat, BTA_ID_AV);
|
||||
p_bta_av_cfg->avrc_src_ct_cat, BTA_ID_AV, p_bta_av_cfg->avrc_br);
|
||||
} else {
|
||||
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REMOTE_CONTROL, "AV Remote Control Controller\n", NULL,
|
||||
p_bta_av_cfg->avrc_snk_ct_cat, BTA_ID_AV);
|
||||
p_bta_av_cfg->avrc_snk_ct_cat, BTA_ID_AV, p_bta_av_cfg->avrc_br);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1251,9 +1251,11 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg)
|
||||
} else {
|
||||
APPL_TRACE_VERBOSE("handle=0x%x\n", p_msg->layer_specific);
|
||||
tBTA_AV_SCB *p_scb = bta_av_hndl_to_scb(p_msg->layer_specific);
|
||||
p_scb->disc_rsn = p_msg->offset;
|
||||
/* stream state machine events */
|
||||
bta_av_ssm_execute(p_scb, p_msg->event, (tBTA_AV_DATA *) p_msg);
|
||||
if (p_scb) {
|
||||
p_scb->disc_rsn = p_msg->offset;
|
||||
/* stream state machine events */
|
||||
bta_av_ssm_execute(p_scb, p_msg->event, (tBTA_AV_DATA *) p_msg);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -982,10 +982,6 @@ static void bta_dm_process_remove_device(BD_ADDR bd_addr, tBT_TRANSPORT transpor
|
||||
|
||||
BTM_SecDeleteDevice(bd_addr, transport);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE)
|
||||
/* remove all cached GATT information */
|
||||
BTA_GATTC_Refresh(bd_addr, false);
|
||||
#endif
|
||||
if (bta_dm_cb.p_sec_cback) {
|
||||
tBTA_DM_SEC sec_event;
|
||||
bdcpy(sec_event.link_down.bd_addr, bd_addr);
|
||||
@@ -1140,8 +1136,6 @@ void bta_dm_close_acl(tBTA_DM_MSG *p_data)
|
||||
#if (BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE)
|
||||
/* need to remove all pending background connection if any */
|
||||
BTA_GATTC_CancelOpen(0, p_remove_acl->bd_addr, FALSE);
|
||||
/* remove all cached GATT information */
|
||||
BTA_GATTC_Refresh(p_remove_acl->bd_addr, false);
|
||||
#endif
|
||||
}
|
||||
/* otherwise, no action needed */
|
||||
@@ -3670,8 +3664,6 @@ void bta_dm_acl_change(tBTA_DM_MSG *p_data)
|
||||
#if (BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE)
|
||||
/* need to remove all pending background connection */
|
||||
BTA_GATTC_CancelOpen(0, p_bda, FALSE);
|
||||
/* remove all cached GATT information */
|
||||
BTA_GATTC_Refresh(p_bda, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3849,8 +3841,6 @@ static BOOLEAN bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr)
|
||||
#if (BLE_INCLUDED == TRUE && GATTC_INCLUDED == TRUE)
|
||||
/* need to remove all pending background connection */
|
||||
BTA_GATTC_CancelOpen(0, remote_bd_addr, FALSE);
|
||||
/* remove all cached GATT information */
|
||||
BTA_GATTC_Refresh(remote_bd_addr, false);
|
||||
#endif
|
||||
}
|
||||
return is_device_deleted;
|
||||
|
||||
@@ -823,8 +823,6 @@ void bta_gattc_close(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
|
||||
bta_sys_conn_close( BTA_ID_GATTC , BTA_ALL_APP_ID, p_clcb->bda);
|
||||
}
|
||||
|
||||
bta_gattc_clcb_dealloc(p_clcb);
|
||||
|
||||
if (p_data->hdr.event == BTA_GATTC_API_CLOSE_EVT) {
|
||||
cb_data.close.status = GATT_Disconnect(p_data->hdr.layer_specific);
|
||||
} else if (p_data->hdr.event == BTA_GATTC_INT_DISCONN_EVT) {
|
||||
|
||||
@@ -322,6 +322,15 @@ void bta_gattc_clcb_dealloc(tBTA_GATTC_CLCB *p_clcb)
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
bta_gattc_clcb_dealloc(p_clcb);
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_gattc_find_srcb
|
||||
@@ -421,6 +430,7 @@ tBTA_GATTC_SERV *bta_gattc_srcb_alloc(BD_ADDR bda)
|
||||
{
|
||||
if (p_tcb->p_srvc_cache != NULL) {
|
||||
list_free(p_tcb->p_srvc_cache);
|
||||
p_tcb->p_srvc_cache = NULL;
|
||||
}
|
||||
osi_free(p_tcb->p_srvc_list);
|
||||
p_tcb->p_srvc_list = NULL;
|
||||
|
||||
@@ -461,11 +461,11 @@ void bta_ag_scb_dealloc(tBTA_AG_SCB *p_scb)
|
||||
|
||||
APPL_TRACE_DEBUG("bta_ag_scb_dealloc %d", bta_ag_scb_to_idx(p_scb));
|
||||
/* stop timers */
|
||||
bta_sys_stop_timer(&p_scb->act_timer);
|
||||
bta_sys_free_timer(&p_scb->act_timer);
|
||||
#if (BTM_WBS_INCLUDED == TRUE)
|
||||
bta_sys_stop_timer(&p_scb->cn_timer);
|
||||
bta_sys_free_timer(&p_scb->cn_timer);
|
||||
#endif
|
||||
bta_sys_stop_timer(&p_scb->colli_timer);
|
||||
bta_sys_free_timer(&p_scb->colli_timer);
|
||||
|
||||
/* initialize control block */
|
||||
memset(p_scb, 0, sizeof(tBTA_AG_SCB));
|
||||
|
||||
@@ -82,15 +82,13 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params[BTA_AG_NUM_CODECS] =
|
||||
{
|
||||
BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */
|
||||
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */
|
||||
10, /* 10 ms (HS/HF can use EV3, 2-EV3, 3-EV3) */
|
||||
10, /* 10 ms (HS/HF can use EV3, 2-EV3) */
|
||||
BTM_VOICE_SETTING_CVSD, /* Inp Linear, Air CVSD, 2s Comp, 16bit */
|
||||
(BTM_SCO_PKT_TYPES_MASK_HV1 + /* Packet Types */
|
||||
BTM_SCO_PKT_TYPES_MASK_HV2 +
|
||||
BTM_SCO_PKT_TYPES_MASK_HV3 +
|
||||
BTM_SCO_PKT_TYPES_MASK_EV3 +
|
||||
BTM_SCO_PKT_TYPES_MASK_EV4 +
|
||||
BTM_SCO_PKT_TYPES_MASK_EV5 +
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 +
|
||||
(BTM_SCO_PKT_TYPES_MASK_HV1 | /* Packet Types */
|
||||
BTM_SCO_PKT_TYPES_MASK_HV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
BTM_ESCO_RETRANS_POWER /* Retransmission effort */
|
||||
},
|
||||
@@ -100,7 +98,7 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params[BTA_AG_NUM_CODECS] =
|
||||
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec), 8000 */
|
||||
8, /* 8 ms */
|
||||
BTM_VOICE_SETTING_TRANS, /* Inp Linear, Transparent, 2s Comp, 16bit */
|
||||
(BTM_SCO_PKT_TYPES_MASK_EV3 | /* Packet Types : EV3 + NO_2_EV3 */
|
||||
(BTM_SCO_PKT_TYPES_MASK_EV3 | /* Packet Types : EV3 */
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5 |
|
||||
@@ -113,8 +111,7 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params[BTA_AG_NUM_CODECS] =
|
||||
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec), 8000 */
|
||||
13, /* 13 ms */
|
||||
BTM_VOICE_SETTING_TRANS, /* Inp Linear, Transparent, 2s Comp, 16bit */
|
||||
(BTM_SCO_PKT_TYPES_MASK_EV3 | /* Packet Types : EV3 + 2-EV3 */
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
(BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 | /* Packet Types : 2-EV3 */
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
BTM_ESCO_RETRANS_QUALITY /* Retransmission effort */
|
||||
@@ -124,11 +121,11 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params[BTA_AG_NUM_CODECS] =
|
||||
{
|
||||
BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */
|
||||
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */
|
||||
12, /* 12 ms (HS/HF can use EV3, 2-EV3) */
|
||||
12, /* 12 ms (HS/HF can use 2-EV3) */
|
||||
BTM_VOICE_SETTING_CVSD, /* Inp Linear, Air CVSD, 2s Comp, 16bit */
|
||||
(BTM_SCO_LINK_ALL_PKT_MASK |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
(BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 | /* Packet Types : 2-EV3 */
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
BTM_ESCO_RETRANS_QUALITY /* Retransmission effort */
|
||||
}
|
||||
};
|
||||
@@ -143,15 +140,13 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params[] =
|
||||
{
|
||||
BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */
|
||||
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */
|
||||
10, /* 10 ms (HS/HF can use EV3, 2-EV3, 3-EV3) */
|
||||
10, /* 10 ms (HS/HF can use EV3, 2-EV3) */
|
||||
BTM_VOICE_SETTING_CVSD, /* Inp Linear, Air CVSD, 2s Comp, 16bit */
|
||||
(BTM_SCO_PKT_TYPES_MASK_HV1 + /* Packet Types */
|
||||
BTM_SCO_PKT_TYPES_MASK_HV2 +
|
||||
BTM_SCO_PKT_TYPES_MASK_HV3 +
|
||||
BTM_SCO_PKT_TYPES_MASK_EV3 +
|
||||
BTM_SCO_PKT_TYPES_MASK_EV4 +
|
||||
BTM_SCO_PKT_TYPES_MASK_EV5 +
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 +
|
||||
(BTM_SCO_PKT_TYPES_MASK_HV1 | /* Packet Types */
|
||||
BTM_SCO_PKT_TYPES_MASK_HV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
BTM_ESCO_RETRANS_POWER /* Retransmission effort */
|
||||
},
|
||||
@@ -160,11 +155,11 @@ static const tBTM_ESCO_PARAMS bta_ag_esco_params[] =
|
||||
{
|
||||
BTM_64KBITS_RATE, /* TX Bandwidth (64 kbits/sec) */
|
||||
BTM_64KBITS_RATE, /* RX Bandwidth (64 kbits/sec) */
|
||||
12, /* 12 ms (HS/HF can use EV3, 2-EV3) */
|
||||
12, /* 12 ms (HS/HF can use 2-EV3) */
|
||||
BTM_VOICE_SETTING_CVSD, /* Inp Linear, Air CVSD, 2s Comp, 16bit */
|
||||
(BTM_SCO_LINK_ALL_PKT_MASK |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
(BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
BTM_ESCO_RETRANS_QUALITY /* Retransmission effort */
|
||||
}
|
||||
};
|
||||
@@ -1659,7 +1654,8 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB *p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA *p_data
|
||||
if (p_data->link_type == BTM_LINK_TYPE_SCO)
|
||||
{
|
||||
resp.retrans_effort = BTM_ESCO_RETRANS_OFF;
|
||||
resp.packet_types = (BTM_SCO_LINK_ONLY_MASK |
|
||||
resp.packet_types = (BTM_SCO_PKT_TYPES_MASK_HV1 |
|
||||
BTM_SCO_PKT_TYPES_MASK_HV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
@@ -1674,8 +1670,9 @@ void bta_ag_sco_conn_rsp(tBTA_AG_SCB *p_scb, tBTM_ESCO_CONN_REQ_EVT_DATA *p_data
|
||||
resp.retrans_effort = BTM_ESCO_RETRANS_QUALITY;
|
||||
}
|
||||
|
||||
resp.packet_types = (BTM_SCO_LINK_ALL_PKT_MASK |
|
||||
resp.packet_types = (BTM_SCO_PKT_TYPES_MASK_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,8 @@ static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
|
||||
.tx_bw = BTM_64KBITS_RATE,
|
||||
.max_latency = 10,
|
||||
.voice_contfmt = BTM_VOICE_SETTING_CVSD,
|
||||
.packet_types = (BTM_SCO_LINK_ONLY_MASK |
|
||||
.packet_types = (BTM_SCO_PKT_TYPES_MASK_HV1 |
|
||||
BTM_SCO_PKT_TYPES_MASK_HV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
@@ -60,9 +61,9 @@ static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
|
||||
.tx_bw = BTM_64KBITS_RATE,
|
||||
.max_latency = 10,
|
||||
.voice_contfmt = BTM_VOICE_SETTING_CVSD,
|
||||
/* Allow controller to use all types available except 5-slot EDR */
|
||||
.packet_types = (BTM_SCO_LINK_ALL_PKT_MASK |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
/* Packet Types : 2-EV3 */
|
||||
.packet_types = (BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
.retrans_effort = BTM_ESCO_RETRANS_POWER,
|
||||
},
|
||||
@@ -72,10 +73,9 @@ static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
|
||||
.tx_bw = BTM_64KBITS_RATE,
|
||||
.max_latency = 13,
|
||||
.voice_contfmt = BTM_VOICE_SETTING_TRANS,
|
||||
/* Packet Types : EV3 + 2-EV3 */
|
||||
.packet_types = (BTM_SCO_PKT_TYPES_MASK_EV3 |
|
||||
/* Packet Types : 2-EV3 */
|
||||
.packet_types = (BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
.retrans_effort = BTM_ESCO_RETRANS_QUALITY,
|
||||
},
|
||||
@@ -86,9 +86,9 @@ static const tBTM_ESCO_PARAMS bta_hf_client_esco_params[] = {
|
||||
.tx_bw = BTM_64KBITS_RATE,
|
||||
.max_latency = 12,
|
||||
.voice_contfmt = BTM_VOICE_SETTING_CVSD,
|
||||
/* Allow controller to use all types available except 5-slot EDR */
|
||||
.packet_types = (BTM_SCO_LINK_ALL_PKT_MASK |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
/* Packet Types : 2-EV3 */
|
||||
.packet_types = (BTM_SCO_PKT_TYPES_MASK_NO_2_EV5 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV3 |
|
||||
BTM_SCO_PKT_TYPES_MASK_NO_3_EV5),
|
||||
.retrans_effort = BTM_ESCO_RETRANS_QUALITY,
|
||||
}
|
||||
|
||||
@@ -120,8 +120,8 @@ extern void bta_ar_dereg_avct(tBTA_SYS_ID sys_id);
|
||||
** Returns void
|
||||
**
|
||||
******************************************************************************/
|
||||
extern void bta_ar_reg_avrc(UINT16 service_uuid, char *p_service_name,
|
||||
char *p_provider_name, UINT16 categories, tBTA_SYS_ID sys_id);
|
||||
extern void bta_ar_reg_avrc(UINT16 service_uuid, char *p_service_name, char *p_provider_name,
|
||||
UINT16 categories, tBTA_SYS_ID sys_id, BOOLEAN browsing_en);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
|
||||
@@ -556,6 +556,7 @@ typedef struct {
|
||||
UINT16 video_mtu; /* AVDTP video transport channel MTU at L2CAP */
|
||||
UINT16 video_flush_to; /* AVDTP video transport channel flush timeout */
|
||||
BOOLEAN avrc_group; /* TRUE, to accept AVRC 1.3 group nevigation command */
|
||||
BOOLEAN avrc_br; /* FALSE, does not support browsing channel */
|
||||
UINT8 num_co_ids; /* company id count in p_meta_co_ids */
|
||||
tBTA_AV_CODE rc_pass_rsp; /* the default response code for pass through commands */
|
||||
const UINT32 *p_meta_co_ids;/* the metadata Get Capabilities response for company id */
|
||||
|
||||
@@ -1543,6 +1543,8 @@ extern void BTA_GATTS_Listen(tBTA_GATTS_IF server_if, BOOLEAN start,
|
||||
BD_ADDR_PTR target_bda);
|
||||
|
||||
|
||||
extern void bta_gattc_clcb_dealloc_by_conn_id(UINT16 conn_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
}
|
||||
|
||||
@@ -922,6 +922,8 @@ void btc_gattc_cb_handler(btc_msg_t *msg)
|
||||
case BTA_GATTC_CLOSE_EVT: {
|
||||
tBTA_GATTC_CLOSE *close = &arg->close;
|
||||
|
||||
// Free gattc clcb in BTC task to avoid race condition
|
||||
bta_gattc_clcb_dealloc_by_conn_id(close->conn_id);
|
||||
gattc_if = close->client_if;
|
||||
param.close.status = close->status;
|
||||
param.close.conn_id = BTC_GATT_GET_CONN_ID(close->conn_id);
|
||||
|
||||
@@ -260,7 +260,8 @@ static int add_raw_sdp(const bluetooth_sdp_record* rec)
|
||||
UINT16 service = 0;
|
||||
UINT16 browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
|
||||
bool status = true;
|
||||
UINT8 temp[4];
|
||||
// Buffer capable to hold 2, 4 and 16-byte UUIDs
|
||||
UINT8 temp[LEN_UUID_128];
|
||||
UINT8* p_temp = temp;
|
||||
UINT32 sdp_handle = 0;
|
||||
|
||||
@@ -274,17 +275,25 @@ static int add_raw_sdp(const bluetooth_sdp_record* rec)
|
||||
|
||||
if (rec->hdr.bt_uuid.len == 16) {
|
||||
memcpy(&service, &rec->hdr.bt_uuid.uuid.uuid128[2], sizeof(service));
|
||||
UINT8_TO_BE_STREAM(p_temp, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
|
||||
ARRAY_TO_BE_STREAM(p_temp, rec->hdr.bt_uuid.uuid.uuid128, LEN_UUID_128);
|
||||
} else if (rec->hdr.bt_uuid.len == 2) {
|
||||
memcpy(&service, &rec->hdr.bt_uuid.uuid.uuid16, sizeof(service));
|
||||
UINT8_TO_BE_STREAM(p_temp, (UUID_DESC_TYPE << 3) | SIZE_TWO_BYTES);
|
||||
UINT16_TO_BE_STREAM(p_temp, rec->hdr.bt_uuid.uuid.uuid16);
|
||||
} else if (rec->hdr.bt_uuid.len == 4) {
|
||||
memcpy(&service, &rec->hdr.bt_uuid.uuid.uuid16, sizeof(service));
|
||||
UINT8_TO_BE_STREAM(p_temp, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES);
|
||||
UINT32_TO_BE_STREAM(p_temp, rec->hdr.bt_uuid.uuid.uuid32);
|
||||
} else {
|
||||
SDP_DeleteRecord(sdp_handle);
|
||||
sdp_handle = 0;
|
||||
return sdp_handle;
|
||||
}
|
||||
/* add service class */
|
||||
status &= SDP_AddServiceClassIdList(sdp_handle, 1, &service);
|
||||
status &= SDP_AddAttribute(sdp_handle, ATTR_ID_SERVICE_CLASS_ID_LIST,
|
||||
DATA_ELE_SEQ_DESC_TYPE, (UINT32) (p_temp - temp), temp);
|
||||
|
||||
memset( protoList, 0 , 2*sizeof(tSDP_PROTOCOL_ELEM) );
|
||||
|
||||
/* add protocol list, including RFCOMM scn */
|
||||
|
||||
@@ -600,6 +600,7 @@ ble_hs_hci_rx_evt(uint8_t *hci_ev, void *arg)
|
||||
}
|
||||
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);
|
||||
@@ -614,6 +615,7 @@ ble_hs_rx_data(struct os_mbuf *om, void *arg)
|
||||
{
|
||||
uint16_t len = om->om_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);
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
#if (defined(AVRC_INCLUDED) && AVRC_INCLUDED == TRUE)
|
||||
|
||||
#ifndef SDP_AVRCP_1_4
|
||||
#define SDP_AVRCP_1_4 TRUE
|
||||
#ifndef SDP_AVRCP_1_5
|
||||
#define SDP_AVRCP_1_5 TRUE
|
||||
#endif
|
||||
|
||||
#ifndef SDP_AVCTP_1_4
|
||||
@@ -52,7 +52,7 @@ const tSDP_PROTOCOL_ELEM avrc_proto_list [] = {
|
||||
#if SDP_AVCTP_1_4 == TRUE
|
||||
{UUID_PROTOCOL_AVCTP, 1, {AVCT_REV_1_4, 0} }
|
||||
#else
|
||||
#if SDP_AVRCP_1_4 == TRUE
|
||||
#if (SDP_AVRCP_1_4 == TRUE || SDP_AVRCP_1_5 == TRUE)
|
||||
{UUID_PROTOCOL_AVCTP, 1, {AVCT_REV_1_3, 0} }
|
||||
#else
|
||||
#if AVRC_METADATA_INCLUDED == TRUE
|
||||
@@ -64,13 +64,17 @@ const tSDP_PROTOCOL_ELEM avrc_proto_list [] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
#if SDP_AVRCP_1_4 == TRUE
|
||||
#if SDP_AVRCP_1_5 == TRUE
|
||||
const tSDP_PROTO_LIST_ELEM avrc_add_proto_list [] = {
|
||||
{
|
||||
AVRC_NUM_PROTO_ELEMS,
|
||||
{
|
||||
{UUID_PROTOCOL_L2CAP, 1, {AVCT_BR_PSM, 0} },
|
||||
#if SDP_AVCTP_1_4 == TRUE
|
||||
{UUID_PROTOCOL_AVCTP, 1, {AVCT_REV_1_4, 0} }
|
||||
#else
|
||||
{UUID_PROTOCOL_AVCTP, 1, {AVCT_REV_1_3, 0} }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -216,6 +220,8 @@ UINT16 AVRC_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
**
|
||||
** sdp_handle: SDP handle returned by SDP_CreateRecord().
|
||||
**
|
||||
** browsing_en: Supported browsing
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
@@ -223,8 +229,8 @@ UINT16 AVRC_FindService(UINT16 service_uuid, BD_ADDR bd_addr,
|
||||
** AVRC_NO_RESOURCES if not enough resources to build the SDP record.
|
||||
**
|
||||
******************************************************************************/
|
||||
UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
char *p_provider_name, UINT16 categories, UINT32 sdp_handle)
|
||||
UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name, char *p_provider_name,
|
||||
UINT16 categories, UINT32 sdp_handle, BOOLEAN browsing_en)
|
||||
{
|
||||
UINT16 browse_list[1];
|
||||
BOOLEAN result = TRUE;
|
||||
@@ -232,9 +238,12 @@ UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
UINT8 *p;
|
||||
UINT16 count = 1;
|
||||
UINT16 class_list[2];
|
||||
UINT16 supported_feature = categories;
|
||||
BOOLEAN media_player_virtual_filesystem_supported = FALSE;
|
||||
BOOLEAN add_additional_protocol_list = FALSE;
|
||||
|
||||
|
||||
AVRC_TRACE_API("AVRC_AddRecord uuid: %x", service_uuid);
|
||||
AVRC_TRACE_API("AVRC_AddRecord uuid: %x, browsing_en:%d", service_uuid, browsing_en);
|
||||
|
||||
if ( service_uuid != UUID_SERVCLASS_AV_REM_CTRL_TARGET && service_uuid != UUID_SERVCLASS_AV_REMOTE_CONTROL ) {
|
||||
return AVRC_BAD_PARAM;
|
||||
@@ -242,18 +251,11 @@ UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
|
||||
/* add service class id list */
|
||||
class_list[0] = service_uuid;
|
||||
#if SDP_AVCTP_1_4 == TRUE
|
||||
#if (SDP_AVCTP_1_4 == TRUE || SDP_AVRCP_1_5 == TRUE)
|
||||
if ( service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL ) {
|
||||
class_list[1] = UUID_SERVCLASS_AV_REM_CTRL_CONTROL;
|
||||
count = 2;
|
||||
}
|
||||
#else
|
||||
#if SDP_AVRCP_1_4 == TRUE
|
||||
if ( service_uuid == UUID_SERVCLASS_AV_REMOTE_CONTROL ) {
|
||||
class_list[1] = UUID_SERVCLASS_AV_REM_CTRL_CONTROL;
|
||||
count = 2;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
result &= SDP_AddServiceClassIdList(sdp_handle, count, class_list);
|
||||
|
||||
@@ -261,11 +263,21 @@ UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
result &= SDP_AddProtocolList(sdp_handle, AVRC_NUM_PROTO_ELEMS, (tSDP_PROTOCOL_ELEM *)avrc_proto_list);
|
||||
|
||||
/* add profile descriptor list */
|
||||
#if SDP_AVRCP_1_4 == TRUE
|
||||
/* additional protocol list to include browsing channel */
|
||||
result &= SDP_AddAdditionProtoLists( sdp_handle, 1, (tSDP_PROTO_LIST_ELEM *)avrc_add_proto_list);
|
||||
#if SDP_AVRCP_1_5 == TRUE
|
||||
if (browsing_en) {
|
||||
add_additional_protocol_list = TRUE;
|
||||
} else if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET &&
|
||||
(categories & (AVRC_SUPF_TG_CAT1 | AVRC_SUPF_TG_CAT3))) {
|
||||
AVRC_TRACE_WARNING("For AVRCP Target Cateory 1 and 3, SDP record shall contain additional protocol list");
|
||||
add_additional_protocol_list = TRUE;
|
||||
}
|
||||
|
||||
result &= SDP_AddProfileDescriptorList(sdp_handle, UUID_SERVCLASS_AV_REMOTE_CONTROL, AVRC_REV_1_4);
|
||||
if (add_additional_protocol_list) {
|
||||
/* additional protocol list to include browsing channel */
|
||||
result &= SDP_AddAdditionProtoLists( sdp_handle, 1, (tSDP_PROTO_LIST_ELEM *)avrc_add_proto_list);
|
||||
}
|
||||
|
||||
result &= SDP_AddProfileDescriptorList(sdp_handle, UUID_SERVCLASS_AV_REMOTE_CONTROL, AVRC_REV_1_5);
|
||||
#else
|
||||
#if AVRC_METADATA_INCLUDED == TRUE
|
||||
result &= SDP_AddProfileDescriptorList(sdp_handle, UUID_SERVCLASS_AV_REMOTE_CONTROL, AVRC_REV_1_3);
|
||||
@@ -274,9 +286,15 @@ UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* add supported categories */
|
||||
/* Check if browsing is supported */
|
||||
if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_CONTROL && browsing_en) {
|
||||
supported_feature |= AVRC_SUPF_CT_BROWSE;
|
||||
} else if (service_uuid == UUID_SERVCLASS_AV_REM_CTRL_TARGET && media_player_virtual_filesystem_supported) {
|
||||
supported_feature |= AVRC_SUPF_TG_BROWSE;
|
||||
}
|
||||
/* add supported feature */
|
||||
p = temp;
|
||||
UINT16_TO_BE_STREAM(p, categories);
|
||||
UINT16_TO_BE_STREAM(p, supported_feature);
|
||||
result &= SDP_AddAttribute(sdp_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
|
||||
(UINT32)2, (UINT8 *)temp);
|
||||
|
||||
|
||||
@@ -195,6 +195,8 @@ extern "C"
|
||||
**
|
||||
** sdp_handle: SDP handle returned by SDP_CreateRecord().
|
||||
**
|
||||
** browsing_en: Supported browsing
|
||||
**
|
||||
** Output Parameters:
|
||||
** None.
|
||||
**
|
||||
@@ -202,8 +204,8 @@ extern "C"
|
||||
** AVRC_NO_RESOURCES if not enough resources to build the SDP record.
|
||||
**
|
||||
******************************************************************************/
|
||||
extern UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name,
|
||||
char *p_provider_name, UINT16 categories, UINT32 sdp_handle);
|
||||
extern UINT16 AVRC_AddRecord(UINT16 service_uuid, char *p_service_name, char *p_provider_name,
|
||||
UINT16 categories, UINT32 sdp_handle, BOOLEAN browsing_en);
|
||||
|
||||
/******************************************************************************
|
||||
**
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define AVRC_REV_1_0 0x0100
|
||||
#define AVRC_REV_1_3 0x0103
|
||||
#define AVRC_REV_1_4 0x0104
|
||||
#define AVRC_REV_1_5 0x0105
|
||||
|
||||
#define AVRC_PACKET_LEN 512 /* Per the spec, you must support 512 byte RC packets */
|
||||
|
||||
|
||||
@@ -1240,6 +1240,7 @@ extern BOOLEAN L2CA_CheckIsCongest(UINT16 fixed_cid, BD_ADDR addr);
|
||||
#define L2CA_DECREASE_BTU_NUM 4
|
||||
#define L2CA_BUFF_INI 5
|
||||
#define L2CA_BUFF_DEINIT 6
|
||||
#define L2CA_BUFF_FREE 7
|
||||
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
|
||||
@@ -2386,6 +2386,12 @@ void l2ble_update_att_acl_pkt_num(UINT8 type, tl2c_buff_param_t *param)
|
||||
buff_semaphore = NULL;
|
||||
break;
|
||||
}
|
||||
case L2CA_BUFF_FREE:{
|
||||
xSemaphoreTake(buff_semaphore, portMAX_DELAY);
|
||||
// Do nothing
|
||||
xSemaphoreGive(buff_semaphore);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -35,11 +35,35 @@
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
|
||||
#if (BLE_50_FEATURE_SUPPORT == TRUE)
|
||||
const tHCI_ExtConnParams ext_conn_params = {
|
||||
#define EXT_CONN_INT_DEF_1M MAX(((MAX_ACL_CONNECTIONS + 1) * 4), 12)
|
||||
#define EXT_CONN_INT_DEF_2M MAX(((MAX_ACL_CONNECTIONS + 1) * 2), 12)
|
||||
#define EXT_CONN_INT_DEF_CODED (320) // 306-> 362Kbps
|
||||
|
||||
const static tHCI_ExtConnParams ext_conn_params_1m_phy = {
|
||||
.scan_interval = 0x40,
|
||||
.scan_window = 0x40,
|
||||
.conn_interval_min = 320, // 306-> 362Kbps
|
||||
.conn_interval_max = 320,
|
||||
.conn_interval_min = EXT_CONN_INT_DEF_1M,
|
||||
.conn_interval_max = EXT_CONN_INT_DEF_1M,
|
||||
.conn_latency = 0,
|
||||
.sup_timeout = 600,
|
||||
.min_ce_len = 0,
|
||||
.max_ce_len = 0,
|
||||
};
|
||||
const static tHCI_ExtConnParams ext_conn_params_2m_phy = {
|
||||
.scan_interval = 0x40,
|
||||
.scan_window = 0x40,
|
||||
.conn_interval_min = EXT_CONN_INT_DEF_2M,
|
||||
.conn_interval_max = EXT_CONN_INT_DEF_2M,
|
||||
.conn_latency = 0,
|
||||
.sup_timeout = 600,
|
||||
.min_ce_len = 0,
|
||||
.max_ce_len = 0,
|
||||
};
|
||||
const static tHCI_ExtConnParams ext_conn_params_coded_phy = {
|
||||
.scan_interval = 0x40,
|
||||
.scan_window = 0x40,
|
||||
.conn_interval_min = EXT_CONN_INT_DEF_CODED,
|
||||
.conn_interval_max = EXT_CONN_INT_DEF_CODED,
|
||||
.conn_latency = 0,
|
||||
.sup_timeout = 600,
|
||||
.min_ce_len = 0,
|
||||
@@ -992,9 +1016,9 @@ BOOLEAN l2cble_init_direct_conn (tL2C_LCB *p_lcb)
|
||||
if (p_dev_rec->ext_conn_params.phy_mask == BLE_PHY_NO_PREF) {
|
||||
L2CAP_TRACE_WARNING("No extend connection parameters set, use default parameters");
|
||||
aux_conn.init_phy_mask = BLE_PHY_PREF_MASK;
|
||||
memcpy(&aux_conn.params[0], &ext_conn_params, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[1], &ext_conn_params, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[2], &ext_conn_params, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[0], &ext_conn_params_1m_phy, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[1], &ext_conn_params_2m_phy, sizeof(tHCI_ExtConnParams));
|
||||
memcpy(&aux_conn.params[2], &ext_conn_params_coded_phy, sizeof(tHCI_ExtConnParams));
|
||||
} else {
|
||||
aux_conn.init_phy_mask = p_dev_rec->ext_conn_params.phy_mask;
|
||||
memcpy(&aux_conn.params[0], &p_dev_rec->ext_conn_params.phy_1m_conn_params, sizeof(tHCI_ExtConnParams));
|
||||
|
||||
@@ -1676,6 +1676,12 @@ void l2cu_release_ccb (tL2C_CCB *p_ccb)
|
||||
if (!p_ccb->in_use) {
|
||||
return;
|
||||
}
|
||||
#if BLE_INCLUDED == TRUE
|
||||
if (p_lcb->transport == BT_TRANSPORT_LE) {
|
||||
/* Take samephore to avoid race condition */
|
||||
l2ble_update_att_acl_pkt_num(L2CA_BUFF_FREE, NULL);
|
||||
}
|
||||
#endif
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
if (p_rcb && (p_rcb->psm != p_rcb->real_psm)) {
|
||||
btm_sec_clr_service_by_psm(p_rcb->psm);
|
||||
|
||||
@@ -65,6 +65,8 @@ config BT_NIMBLE_LOG_LEVEL
|
||||
config BT_NIMBLE_MAX_CONNECTIONS
|
||||
int "Maximum number of concurrent connections"
|
||||
range 1 2 if IDF_TARGET_ESP32C2
|
||||
range 1 70 if IDF_TARGET_ESP32C6
|
||||
range 1 35 if IDF_TARGET_ESP32H2
|
||||
range 1 9
|
||||
default 2 if IDF_TARGET_ESP32C2
|
||||
default 3
|
||||
@@ -267,23 +269,23 @@ menu "Memory Settings"
|
||||
help
|
||||
Dynamic memory size of block 2
|
||||
|
||||
config BT_NIMBLE_ACL_BUF_COUNT
|
||||
config BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT
|
||||
int "ACL Buffer count"
|
||||
depends on BT_NIMBLE_ENABLED
|
||||
default 24
|
||||
help
|
||||
The number of ACL data buffers.
|
||||
The number of ACL data buffers allocated for host.
|
||||
|
||||
config BT_NIMBLE_ACL_BUF_SIZE
|
||||
int "ACL Buffer size"
|
||||
config BT_NIMBLE_TRANSPORT_ACL_SIZE
|
||||
int "Transport ACL Buffer size"
|
||||
depends on BT_NIMBLE_ENABLED
|
||||
default 255
|
||||
help
|
||||
This is the maximum size of the data portion of HCI ACL data packets.
|
||||
It does not include the HCI data header (of 4 bytes)
|
||||
|
||||
config BT_NIMBLE_HCI_EVT_BUF_SIZE
|
||||
int "HCI Event Buffer size"
|
||||
config BT_NIMBLE_TRANSPORT_EVT_SIZE
|
||||
int "Transport Event Buffer size"
|
||||
depends on BT_NIMBLE_ENABLED
|
||||
default 257 if BT_NIMBLE_EXT_ADV
|
||||
default 70
|
||||
@@ -292,8 +294,8 @@ menu "Memory Settings"
|
||||
extended advertising, packets can be fragmented. 257 bytes is the
|
||||
maximum size of a packet.
|
||||
|
||||
config BT_NIMBLE_HCI_EVT_HI_BUF_COUNT
|
||||
int "High Priority HCI Event Buffer count"
|
||||
config BT_NIMBLE_TRANSPORT_EVT_COUNT
|
||||
int "Transport Event Buffer count"
|
||||
depends on BT_NIMBLE_ENABLED
|
||||
default 30
|
||||
help
|
||||
@@ -302,8 +304,8 @@ menu "Memory Settings"
|
||||
are no free high-priority event buffers then host will try to allocate a
|
||||
low-priority buffer instead
|
||||
|
||||
config BT_NIMBLE_HCI_EVT_LO_BUF_COUNT
|
||||
int "Low Priority HCI Event Buffer count"
|
||||
config BT_NIMBLE_TRANSPORT_EVT_DISCARD_COUNT
|
||||
int "Discardable Transport Event Buffer count"
|
||||
depends on BT_NIMBLE_ENABLED
|
||||
default 8
|
||||
help
|
||||
@@ -479,7 +481,7 @@ config BT_NIMBLE_HS_STOP_TIMEOUT_MS
|
||||
config BT_NIMBLE_HOST_BASED_PRIVACY
|
||||
bool "Enable host based privacy for random address."
|
||||
default n
|
||||
depends on BT_NIMBLE_ENABLED && !IDF_TARGET_ESP32
|
||||
depends on BT_NIMBLE_ENABLED && IDF_TARGET_ESP32
|
||||
help
|
||||
Use this option to do host based Random Private Address resolution.
|
||||
If this option is disabled then controller based privacy is used.
|
||||
@@ -661,3 +663,19 @@ config BT_NIMBLE_BLE_GATT_BLOB_TRANSFER
|
||||
help
|
||||
This option is used when data to be sent is more than 512 bytes. For peripheral role,
|
||||
BT_NIMBLE_MSYS_1_BLOCK_COUNT needs to be increased according to the need.
|
||||
|
||||
config BT_NIMBLE_VS_SUPPORT
|
||||
bool "Enable support for VSC and VSE"
|
||||
help
|
||||
This option is used to enable support for sending Vendor Specific HCI commands and handling
|
||||
Vendor Specific HCI Events.
|
||||
|
||||
config BT_NIMBLE_OPTIMIZE_MULTI_CONN
|
||||
bool "Enable the optimization of multi-connection"
|
||||
depends on SOC_BLE_MULTI_CONN_OPTIMIZATION
|
||||
select BT_NIMBLE_VS_SUPPORT
|
||||
default n
|
||||
help
|
||||
This option enables the use of vendor-specific APIs for multi-connections, which can
|
||||
greatly enhance the stability of coexistence between numerous central and peripheral
|
||||
devices. It will prohibit the usage of standard APIs.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -46,6 +46,7 @@ const static char *TAG = "NimBLE";
|
||||
|
||||
int os_msys_buf_alloc(void);
|
||||
void os_msys_buf_free(void);
|
||||
extern uint8_t ble_hs_enabled_state;
|
||||
|
||||
void ble_hci_trans_cfg_hs(ble_hci_trans_rx_cmd_fn *cmd_cb,
|
||||
void *cmd_arg,
|
||||
@@ -184,6 +185,12 @@ static void controller_rcv_pkt_ready(void)
|
||||
*/
|
||||
static int host_rcv_pkt(uint8_t *data, uint16_t len)
|
||||
{
|
||||
if(!ble_hs_enabled_state) {
|
||||
/* If host is not enabled, drop the packet */
|
||||
ESP_LOGE(TAG, "Host not enabled. Dropping the packet!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (data[0] == BLE_HCI_UART_H4_EVT) {
|
||||
uint8_t *evbuf;
|
||||
int totlen;
|
||||
@@ -216,6 +223,7 @@ static int host_rcv_pkt(uint8_t *data, uint16_t len)
|
||||
assert(evbuf != NULL);
|
||||
}
|
||||
|
||||
memset(evbuf, 0, sizeof *evbuf);
|
||||
memcpy(evbuf, &data[1], totlen);
|
||||
|
||||
rc = ble_hci_trans_ll_evt_tx(evbuf);
|
||||
|
||||
Submodule components/bt/host/nimble/nimble updated: 8a8585ac0b...9478bc510f
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -91,6 +91,7 @@
|
||||
#define BLE_50_FEATURE_SUPPORT (CONFIG_BT_NIMBLE_50_FEATURE_SUPPORT)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BT_NIMBLE_EXT_ADV
|
||||
#define MYNEWT_VAL_BLE_EXT_ADV (0)
|
||||
#else
|
||||
@@ -141,25 +142,25 @@
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BT_NIMBLE_ROLE_BROADCASTER
|
||||
#define MYNEWT_VAL_BLE_ROLE_BROADCASTER (1)
|
||||
#define MYNEWT_VAL_BLE_ROLE_BROADCASTER (0)
|
||||
#else
|
||||
#define MYNEWT_VAL_BLE_ROLE_BROADCASTER (CONFIG_BT_NIMBLE_ROLE_BROADCASTER)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BT_NIMBLE_ROLE_CENTRAL
|
||||
#define MYNEWT_VAL_BLE_ROLE_CENTRAL (1)
|
||||
#define MYNEWT_VAL_BLE_ROLE_CENTRAL (0)
|
||||
#else
|
||||
#define MYNEWT_VAL_BLE_ROLE_CENTRAL (CONFIG_BT_NIMBLE_ROLE_CENTRAL)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BT_NIMBLE_ROLE_OBSERVER
|
||||
#define MYNEWT_VAL_BLE_ROLE_OBSERVER (1)
|
||||
#define MYNEWT_VAL_BLE_ROLE_OBSERVER (0)
|
||||
#else
|
||||
#define MYNEWT_VAL_BLE_ROLE_OBSERVER (CONFIG_BT_NIMBLE_ROLE_OBSERVER)
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BT_NIMBLE_ROLE_PERIPHERAL
|
||||
#define MYNEWT_VAL_BLE_ROLE_PERIPHERAL (1)
|
||||
#define MYNEWT_VAL_BLE_ROLE_PERIPHERAL (0)
|
||||
#else
|
||||
#define MYNEWT_VAL_BLE_ROLE_PERIPHERAL (CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
#endif
|
||||
@@ -320,7 +321,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BT_NIMBLE_HCI_UART_PORT
|
||||
#define MYNEWT_VAL_BLE_HCI_UART_PORT (1)
|
||||
#define MYNEWT_VAL_BLE_HCI_UART_PORT (0)
|
||||
#else
|
||||
#define MYNEWT_VAL_BLE_HCI_UART_PORT (CONFIG_BT_NIMBLE_HCI_UART_PORT)
|
||||
#endif
|
||||
@@ -852,20 +853,20 @@
|
||||
|
||||
/* Value copied from BLE_TRANSPORT_ACL_COUNT */
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_ACL_FROM_LL_COUNT
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_ACL_FROM_LL_COUNT CONFIG_BT_NIMBLE_ACL_BUF_COUNT
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_ACL_FROM_LL_COUNT CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_ACL_SIZE
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_ACL_SIZE CONFIG_BT_NIMBLE_ACL_BUF_SIZE
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_ACL_SIZE CONFIG_BT_NIMBLE_TRANSPORT_ACL_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_EVT_COUNT
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_EVT_COUNT CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_EVT_COUNT CONFIG_BT_NIMBLE_TRANSPORT_EVT_COUNT
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_EVT_DISCARDABLE_COUNT
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_EVT_DISCARDABLE_COUNT CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_EVT_DISCARDABLE_COUNT CONFIG_BT_NIMBLE_TRANSPORT_EVT_DISCARD_COUNT
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1611,7 +1612,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_EVT_SIZE
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_EVT_SIZE CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE
|
||||
#define MYNEWT_VAL_BLE_TRANSPORT_EVT_SIZE CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_TRANSPORT_ACL_FROM_HS_COUNT
|
||||
@@ -1680,4 +1681,19 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_BLE_HCI_VS
|
||||
#define MYNEWT_VAL_BLE_HCI_VS CONFIG_BT_NIMBLE_VS_SUPPORT
|
||||
#define MYNEWT_VAL_BLE_HCI_VS_OCF_OFFSET (0)
|
||||
#else
|
||||
#define MYNEWT_VAL_BLE_HCI_VS (0)
|
||||
#endif
|
||||
|
||||
#ifndef MYNEWT_VAL_OPTIMIZE_MULTI_CONN
|
||||
#ifdef CONFIG_BT_NIMBLE_OPTIMIZE_MULTI_CONN
|
||||
#define MYNEWT_VAL_OPTIMIZE_MULTI_CONN CONFIG_BT_NIMBLE_OPTIMIZE_MULTI_CONN
|
||||
#else
|
||||
#define MYNEWT_VAL_OPTIMIZE_MULTI_CONN (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -145,7 +145,14 @@ esp_err_t esp_ble_tx_power_set_enhanced(esp_ble_enhanced_power_type_t power_type
|
||||
*/
|
||||
esp_power_level_t esp_ble_tx_power_get_enhanced(esp_ble_enhanced_power_type_t power_type, uint16_t handle);
|
||||
|
||||
#define CONFIG_VERSION 0x20230113
|
||||
/**
|
||||
* @brief Get version number from chip revision number
|
||||
*
|
||||
* @return uint8_t version_number
|
||||
*/
|
||||
uint8_t esp_ble_get_chip_rev_version(void);
|
||||
|
||||
#define CONFIG_VERSION 0x20230629
|
||||
#define CONFIG_MAGIC 0x5A5AA5A5
|
||||
|
||||
/**
|
||||
@@ -203,11 +210,11 @@ typedef struct {
|
||||
uint8_t cca_drop_mode;
|
||||
int8_t cca_low_tx_pwr;
|
||||
uint8_t main_xtal_freq;
|
||||
uint8_t version_num;
|
||||
uint8_t ignore_wl_for_direct_adv;
|
||||
uint32_t config_magic;
|
||||
} esp_bt_controller_config_t;
|
||||
|
||||
|
||||
#define BT_CONTROLLER_INIT_CONFIG_DEFAULT() { \
|
||||
.config_version = CONFIG_VERSION, \
|
||||
.ble_ll_resolv_list_size = CONFIG_BT_LE_LL_RESOLV_LIST_SIZE, \
|
||||
@@ -255,6 +262,7 @@ typedef struct {
|
||||
.dis_scan_backoff = NIMBLE_DISABLE_SCAN_BACKOFF, \
|
||||
.ble_scan_classify_filter_enable = 0, \
|
||||
.main_xtal_freq = CONFIG_XTAL_FREQ, \
|
||||
.version_num = esp_ble_get_chip_rev_version(), \
|
||||
.ignore_wl_for_direct_adv = 0, \
|
||||
.config_magic = CONFIG_MAGIC, \
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#include "nimble/nimble_npl.h"
|
||||
#include "esp_bt_cfg.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
|
||||
#ifdef CONFIG_BT_LE_HCI_INTERFACE_USE_UART
|
||||
#include "driver/uart.h"
|
||||
@@ -23,7 +24,6 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Bluetooth mode for controller enable/disable
|
||||
*/
|
||||
@@ -76,9 +76,6 @@ typedef enum {
|
||||
* @brief Bluetooth TX power level(index), it's just a index corresponding to power(dbm).
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_PWR_LVL_N24 = 0, /*!< Corresponding to -24dbm */
|
||||
ESP_PWR_LVL_N21 = 1, /*!< Corresponding to -21dbm */
|
||||
ESP_PWR_LVL_N18 = 2, /*!< Corresponding to -18dbm */
|
||||
ESP_PWR_LVL_N15 = 3, /*!< Corresponding to -15dbm */
|
||||
ESP_PWR_LVL_N12 = 4, /*!< Corresponding to -12dbm */
|
||||
ESP_PWR_LVL_N9 = 5, /*!< Corresponding to -9dbm */
|
||||
@@ -91,7 +88,7 @@ typedef enum {
|
||||
ESP_PWR_LVL_P12 = 12, /*!< Corresponding to +12dbm */
|
||||
ESP_PWR_LVL_P15 = 13, /*!< Corresponding to +15dbm */
|
||||
ESP_PWR_LVL_P18 = 14, /*!< Corresponding to +18dbm */
|
||||
ESP_PWR_LVL_P21 = 15, /*!< Corresponding to +21dbm */
|
||||
ESP_PWR_LVL_P20 = 15, /*!< Corresponding to +20dbm */
|
||||
ESP_PWR_LVL_INVALID = 0xFF, /*!< Indicates an invalid value */
|
||||
} esp_power_level_t;
|
||||
|
||||
@@ -256,9 +253,9 @@ typedef struct {
|
||||
.sleep_en = NIMBLE_SLEEP_ENABLE, \
|
||||
.coex_phy_coded_tx_rx_time_limit = DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF, \
|
||||
.dis_scan_backoff = NIMBLE_DISABLE_SCAN_BACKOFF, \
|
||||
.ble_scan_classify_filter_enable = 0, \
|
||||
.ble_scan_classify_filter_enable = 1, \
|
||||
.main_xtal_freq = CONFIG_XTAL_FREQ, \
|
||||
.version_num = 0, \
|
||||
.version_num = efuse_hal_chip_revision(), \
|
||||
.cpu_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ, \
|
||||
.ignore_wl_for_direct_adv = 0, \
|
||||
.enable_pcl = DEFAULT_BT_LE_POWER_CONTROL_ENABLED, \
|
||||
@@ -367,6 +364,14 @@ esp_err_t esp_bt_mem_release(esp_bt_mode_t mode);
|
||||
/* Returns random static address or -1 if not present */
|
||||
extern int esp_ble_hw_get_static_addr(esp_ble_addr_t *addr);
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/** @brief esp_ble_controller_log_dump_all
|
||||
* dump all controller log information cached in buffer
|
||||
* @param output : true for log dump, false will be no effect
|
||||
*/
|
||||
void esp_ble_controller_log_dump_all(bool output);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -196,7 +196,17 @@ extern "C" {
|
||||
|
||||
#define BLE_LL_CONN_DEF_AUTH_PYLD_TMO_N (3000)
|
||||
|
||||
#define RTC_FREQ_N (160000) /* in Hz */
|
||||
#if CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL
|
||||
#define RTC_FREQ_N (100000) /* in Hz */
|
||||
#else
|
||||
#if CONFIG_RTC_CLK_SRC_INT_RC
|
||||
#define RTC_FREQ_N (30000) /* in Hz */
|
||||
#elif CONFIG_RTC_CLK_SRC_EXT_CRYS
|
||||
#define RTC_FREQ_N (32768) /* in Hz */
|
||||
#else
|
||||
#define RTC_FREQ_N (32000) /* in Hz */
|
||||
#endif
|
||||
#endif /* CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL */
|
||||
|
||||
#define BLE_LL_TX_PWR_DBM_N (9)
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ typedef struct {
|
||||
.sleep_en = NIMBLE_SLEEP_ENABLE, \
|
||||
.coex_phy_coded_tx_rx_time_limit = DEFAULT_BT_LE_COEX_PHY_CODED_TX_RX_TLIM_EFF, \
|
||||
.dis_scan_backoff = NIMBLE_DISABLE_SCAN_BACKOFF, \
|
||||
.ble_scan_classify_filter_enable = 0, \
|
||||
.ble_scan_classify_filter_enable = 1, \
|
||||
.main_xtal_freq = CONFIG_XTAL_FREQ, \
|
||||
.cpu_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ, \
|
||||
.ignore_wl_for_direct_adv = 0, \
|
||||
@@ -368,6 +368,14 @@ esp_err_t esp_bt_mem_release(esp_bt_mode_t mode);
|
||||
/* Returns random static address or -1 if not present */
|
||||
extern int esp_ble_hw_get_static_addr(esp_ble_addr_t *addr);
|
||||
|
||||
#if CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
/** @brief esp_ble_controller_log_dump_all
|
||||
* dump all controller log information cached in buffer
|
||||
* @param output : true for log dump, false will be no effect
|
||||
*/
|
||||
void esp_ble_controller_log_dump_all(bool output);
|
||||
#endif // CONFIG_BT_LE_CONTROLLER_LOG_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -196,7 +196,17 @@ extern "C" {
|
||||
|
||||
#define BLE_LL_CONN_DEF_AUTH_PYLD_TMO_N (3000)
|
||||
|
||||
#if CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL
|
||||
#define RTC_FREQ_N (100000) /* in Hz */
|
||||
#else
|
||||
#if CONFIG_RTC_CLK_SRC_INT_RC
|
||||
#define RTC_FREQ_N (30000) /* in Hz */
|
||||
#elif CONFIG_RTC_CLK_SRC_EXT_CRYS
|
||||
#define RTC_FREQ_N (32768) /* in Hz */
|
||||
#else
|
||||
#define RTC_FREQ_N (32000) /* in Hz */
|
||||
#endif
|
||||
#endif /* CONFIG_BT_LE_LP_CLK_SRC_MAIN_XTAL */
|
||||
|
||||
#define BLE_LL_TX_PWR_DBM_N (9)
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BLE_HCI_MAX_DATA_LEN (MYNEWT_VAL(BLE_TRANSPORT_EVT_SIZE) - \
|
||||
sizeof(struct ble_hci_ev))
|
||||
#define BLE_HCI_MAX_DATA_LEN (MYNEWT_VAL(BLE_TRANSPORT_EVT_SIZE) - \
|
||||
sizeof(struct ble_hci_ev))
|
||||
|
||||
/* Generic command header */
|
||||
struct ble_hci_cmd {
|
||||
@@ -490,20 +490,20 @@ struct ble_hci_le_rd_resolv_list_size_rp {
|
||||
} __attribute__((packed));
|
||||
|
||||
#define BLE_HCI_OCF_LE_RD_PEER_RESOLV_ADDR (0x002B)
|
||||
struct ble_hci_le_rd_peer_recolv_addr_cp {
|
||||
struct ble_hci_le_rd_peer_resolv_addr_cp {
|
||||
uint8_t peer_addr_type;
|
||||
uint8_t peer_id_addr[6];
|
||||
} __attribute__((packed));
|
||||
struct ble_hci_le_rd_peer_recolv_addr_rp {
|
||||
struct ble_hci_le_rd_peer_resolv_addr_rp {
|
||||
uint8_t rpa[6];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define BLE_HCI_OCF_LE_RD_LOCAL_RESOLV_ADDR (0x002C)
|
||||
struct ble_hci_le_rd_local_recolv_addr_cp {
|
||||
struct ble_hci_le_rd_local_resolv_addr_cp {
|
||||
uint8_t peer_addr_type;
|
||||
uint8_t peer_id_addr[6];
|
||||
} __attribute__((packed));
|
||||
struct ble_hci_le_rd_local_recolv_addr_rp {
|
||||
struct ble_hci_le_rd_local_resolv_addr_rp {
|
||||
uint8_t rpa[6];
|
||||
} __attribute__((packed));
|
||||
|
||||
@@ -1075,7 +1075,6 @@ struct ble_hci_le_enh_read_transmit_power_level_cp {
|
||||
uint8_t phy;
|
||||
} __attribute__((packed));
|
||||
struct ble_hci_le_enh_read_transmit_power_level_rp {
|
||||
uint8_t status;
|
||||
uint16_t conn_handle;
|
||||
uint8_t phy;
|
||||
uint8_t curr_tx_power_level;
|
||||
@@ -1130,12 +1129,18 @@ struct ble_hci_le_subrate_req_cp {
|
||||
uint16_t supervision_tmo;
|
||||
} __attribute__((packed));
|
||||
|
||||
/* --- Vendor specific commands (OGF 0x00FF) */
|
||||
#define BLE_HCI_OCF_VS_RD_STATIC_ADDR (0x0001)
|
||||
/* --- Vendor specific commands (OGF 0x003F) */
|
||||
/* Read Random Static Address */
|
||||
#define BLE_HCI_OCF_VS_RD_STATIC_ADDR (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0001))
|
||||
struct ble_hci_vs_rd_static_addr_rp {
|
||||
uint8_t addr[6];
|
||||
} __attribute__((packed));
|
||||
|
||||
|
||||
#if SOC_BLE_POWER_CONTROL_SUPPORTED && MYNEWT_VAL(BLE_HCI_VS)
|
||||
#define BLE_HCI_OCF_VS_PCL_SET_RSSI (MYNEWT_VAL(BLE_HCI_VS_OCF_OFFSET) + (0x0111))
|
||||
#endif
|
||||
|
||||
/* Command Specific Definitions */
|
||||
/* --- Set controller to host flow control (OGF 0x03, OCF 0x0031) --- */
|
||||
#define BLE_HCI_CTLR_TO_HOST_FC_OFF (0)
|
||||
@@ -1521,8 +1526,8 @@ struct ble_hci_ev_auth_pyld_tmo {
|
||||
|
||||
#define BLE_HCI_EVCODE_SAM_STATUS_CHG (0x58)
|
||||
|
||||
#define BLE_HCI_EVCODE_VENDOR_DEBUG (0xFF)
|
||||
struct ble_hci_ev_vendor_debug {
|
||||
#define BLE_HCI_EVCODE_VS_DEBUG (0xFF)
|
||||
struct ble_hci_ev_vs_debug {
|
||||
uint8_t id;
|
||||
uint8_t data[0];
|
||||
} __attribute__((packed));
|
||||
@@ -1858,9 +1863,9 @@ struct ble_hci_ev_le_subev_transmit_power_report {
|
||||
uint16_t conn_handle;
|
||||
uint8_t reason;
|
||||
uint8_t phy;
|
||||
uint8_t transmit_power_level;
|
||||
int8_t transmit_power_level;
|
||||
uint8_t transmit_power_level_flag;
|
||||
uint8_t delta;
|
||||
int8_t delta;
|
||||
} __attribute__((packed));
|
||||
|
||||
#define BLE_HCI_LE_SUBEV_BIGINFO_ADV_REPORT (0x22)
|
||||
@@ -1960,7 +1965,9 @@ struct ble_hci_ev_le_subev_subrate_change {
|
||||
#elif MYNEWT_VAL(BLE_VERSION) == 52
|
||||
#define BLE_HCI_VER_BCS BLE_HCI_VER_BCS_5_2
|
||||
#define BLE_LMP_VER_BCS BLE_LMP_VER_BCS_5_2
|
||||
|
||||
#elif MYNEWT_VAL(BLE_VERSION) == 53
|
||||
#define BLE_HCI_VER_BCS BLE_HCI_VER_BCS_5_3
|
||||
#define BLE_LMP_VER_BCS BLE_LMP_VER_BCS_5_3
|
||||
#endif
|
||||
|
||||
#define BLE_HCI_DATA_HDR_SZ 4
|
||||
@@ -1968,7 +1975,8 @@ struct ble_hci_ev_le_subev_subrate_change {
|
||||
#define BLE_HCI_DATA_PB(handle_pb_bc) (((handle_pb_bc) & 0x3000) >> 12)
|
||||
#define BLE_HCI_DATA_BC(handle_pb_bc) (((handle_pb_bc) & 0xc000) >> 14)
|
||||
|
||||
struct hci_data_hdr {
|
||||
struct hci_data_hdr
|
||||
{
|
||||
uint16_t hdh_handle_pb_bc;
|
||||
uint16_t hdh_len;
|
||||
};
|
||||
|
||||
@@ -38,15 +38,6 @@ extern "C" {
|
||||
#define static_assert _Static_assert
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(a, b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#ifndef max
|
||||
#define max(a, b) ((a)>(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
#include "soc/soc_caps.h"
|
||||
#include "nimble/nimble_npl.h"
|
||||
|
||||
#define OS_ALIGN(__n, __a) ( \
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifndef H_OS_ERROR_
|
||||
#define H_OS_ERROR_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "os/os.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#ifndef _OS_MBUF_H
|
||||
#define _OS_MBUF_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "os/os.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -141,11 +140,11 @@ struct os_mqueue {
|
||||
|
||||
/** Get a packet header pointer given an mbuf pointer */
|
||||
#define OS_MBUF_PKTHDR(__om) ((struct os_mbuf_pkthdr *) \
|
||||
((uint8_t *)&(__om)->om_data + sizeof(struct os_mbuf)))
|
||||
(void *)((uint8_t *)&(__om)->om_data + sizeof(struct os_mbuf)))
|
||||
|
||||
/** Given a mbuf packet header pointer, return a pointer to the mbuf */
|
||||
#define OS_MBUF_PKTHDR_TO_MBUF(__hdr) \
|
||||
(struct os_mbuf *)((uint8_t *)(__hdr) - sizeof(struct os_mbuf))
|
||||
(struct os_mbuf *)(void *)((uint8_t *)(__hdr) - sizeof(struct os_mbuf))
|
||||
|
||||
/**
|
||||
* Gets the length of an entire mbuf chain. The specified mbuf must have a
|
||||
|
||||
@@ -148,7 +148,6 @@ struct os_mempool_info {
|
||||
struct os_mempool *os_mempool_info_get_next(struct os_mempool *,
|
||||
struct os_mempool_info *);
|
||||
|
||||
|
||||
#if (OS_ALIGNMENT == 4)
|
||||
typedef uint32_t os_membuf_t;
|
||||
#elif (OS_ALIGNMENT == 8)
|
||||
|
||||
@@ -66,7 +66,7 @@ static struct os_mempool os_msys_init_2_mempool;
|
||||
|
||||
#define OS_MSYS_SANITY_ENABLED \
|
||||
(OS_MSYS_1_SANITY_MIN_COUNT > 0 || \
|
||||
OS_MSYS_1_SANITY_MIN_COUNT > 0)
|
||||
OS_MSYS_2_SANITY_MIN_COUNT > 0)
|
||||
|
||||
#if OS_MSYS_SANITY_ENABLED
|
||||
static struct os_sanity_check os_msys_sc;
|
||||
@@ -91,7 +91,7 @@ IRAM_ATTR os_msys_sanity_min_count(int idx)
|
||||
return OS_MSYS_1_SANITY_MIN_COUNT;
|
||||
|
||||
case 1:
|
||||
return OS_MSYS_1_SANITY_MIN_COUNT;
|
||||
return OS_MSYS_2_SANITY_MIN_COUNT;
|
||||
|
||||
default:
|
||||
BLE_LL_ASSERT(0);
|
||||
|
||||
@@ -40,7 +40,7 @@ static const char *TAG = "Timer";
|
||||
#define BLE_HOST_CO_COUNT (8)
|
||||
#define BLE_HOST_EV_COUNT (11 + BLE_HOST_CO_COUNT)
|
||||
#define BLE_HOST_EVQ_COUNT (3)
|
||||
#define BLE_HOST_SEM_COUNT (1)
|
||||
#define BLE_HOST_SEM_COUNT (10)
|
||||
#define BLE_HOST_MUTEX_COUNT (4)
|
||||
|
||||
struct os_mempool ble_freertos_ev_pool;
|
||||
|
||||
@@ -279,3 +279,8 @@ CONFIG_NIMBLE_MESH_DEVICE_NAME CONFIG_BT_NIMBLE_MES
|
||||
CONFIG_NIMBLE_CRYPTO_STACK_MBEDTLS CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS
|
||||
CONFIG_BT_NIMBLE_TASK_STACK_SIZE CONFIG_BT_NIMBLE_HOST_TASK_STACK_SIZE
|
||||
CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT CONFIG_BT_NIMBLE_MSYS_1_BLOCK_COUNT
|
||||
CONFIG_BT_NIMBLE_ACL_BUF_COUNT CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT
|
||||
CONFIG_BT_NIMBLE_ACL_BUF_SIZE CONFIG_BT_NIMBLE_TRANSPORT_ACL_SIZE
|
||||
CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE
|
||||
CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT CONFIG_BT_NIMBLE_TRANSPORT_EVT_COUNT
|
||||
CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT CONFIG_BT_NIMBLE_TRANSPORT_EVT_DISCARD_COUNT
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "hal/adc_ll.h"
|
||||
#include "hal/i2s_ll.h"
|
||||
#include "hal/i2s_hal.h"
|
||||
#include "hal/i2s_types.h"
|
||||
#include "soc/i2s_periph.h"
|
||||
#include "../dac_priv_dma.h"
|
||||
@@ -97,7 +97,9 @@ static esp_err_t s_dac_dma_periph_set_clock(uint32_t freq_hz, bool is_apll)
|
||||
ESP_LOGD(TAG, "[sclk] %"PRIu32" [mclk] %"PRIu32" [mclk_div] %"PRIu32" [bclk] %"PRIu32" [bclk_div] %"PRIu32, sclk, mclk, mclk_div, bclk, bclk_div);
|
||||
|
||||
i2s_ll_tx_clk_set_src(s_ddp->periph_dev, is_apll ? I2S_CLK_SRC_APLL : I2S_CLK_SRC_DEFAULT);
|
||||
i2s_ll_tx_set_mclk(s_ddp->periph_dev, sclk, mclk, mclk_div);
|
||||
i2s_ll_mclk_div_t mclk_div_coeff = {};
|
||||
i2s_hal_calc_mclk_precise_division(sclk, mclk, &mclk_div_coeff);
|
||||
i2s_ll_tx_set_mclk(s_ddp->periph_dev, &mclk_div_coeff);
|
||||
i2s_ll_tx_set_bck_div_num(s_ddp->periph_dev, bclk_div);
|
||||
|
||||
return ESP_OK;
|
||||
|
||||
@@ -104,7 +104,7 @@ static void adc_dma_intr_handler(void *arg);
|
||||
|
||||
static int8_t adc_digi_get_io_num(adc_unit_t adc_unit, uint8_t adc_channel)
|
||||
{
|
||||
assert(adc_unit <= SOC_ADC_PERIPH_NUM);
|
||||
assert(adc_unit < SOC_ADC_PERIPH_NUM);
|
||||
uint8_t adc_n = (adc_unit == ADC_UNIT_1) ? 0 : 1;
|
||||
return adc_channel_io_map[adc_n][adc_channel];
|
||||
}
|
||||
@@ -207,7 +207,9 @@ esp_err_t adc_digi_initialize(const adc_digi_init_config_t *init_config)
|
||||
}
|
||||
|
||||
//malloc dma descriptor
|
||||
s_adc_digi_ctx->hal.rx_desc = heap_caps_calloc(1, (sizeof(dma_descriptor_t)) * INTERNAL_BUF_NUM, MALLOC_CAP_DMA);
|
||||
uint32_t dma_desc_num_per_frame = (init_config->conv_num_each_intr + DMA_DESCRIPTOR_BUFFER_MAX_SIZE_4B_ALIGNED - 1) / DMA_DESCRIPTOR_BUFFER_MAX_SIZE_4B_ALIGNED;
|
||||
uint32_t dma_desc_max_num = dma_desc_num_per_frame * INTERNAL_BUF_NUM;
|
||||
s_adc_digi_ctx->hal.rx_desc = heap_caps_calloc(1, (sizeof(dma_descriptor_t)) * dma_desc_max_num, MALLOC_CAP_DMA);
|
||||
if (!s_adc_digi_ctx->hal.rx_desc) {
|
||||
ret = ESP_ERR_NO_MEM;
|
||||
goto cleanup;
|
||||
@@ -310,7 +312,8 @@ esp_err_t adc_digi_initialize(const adc_digi_init_config_t *init_config)
|
||||
#elif CONFIG_IDF_TARGET_ESP32
|
||||
.dev = (void *)I2S_LL_GET_HW(s_adc_digi_ctx->i2s_host),
|
||||
#endif
|
||||
.desc_max_num = INTERNAL_BUF_NUM,
|
||||
.eof_desc_num = INTERNAL_BUF_NUM,
|
||||
.eof_step = dma_desc_num_per_frame,
|
||||
.dma_chan = dma_chan,
|
||||
.eof_num = init_config->conv_num_each_intr / SOC_ADC_DIGI_DATA_BYTES_PER_CONV
|
||||
};
|
||||
@@ -367,26 +370,22 @@ static IRAM_ATTR bool s_adc_dma_intr(adc_digi_context_t *adc_digi_ctx)
|
||||
portBASE_TYPE taskAwoken = 0;
|
||||
BaseType_t ret;
|
||||
adc_hal_dma_desc_status_t status = false;
|
||||
dma_descriptor_t *current_desc = NULL;
|
||||
uint8_t *finished_buffer = NULL;
|
||||
uint32_t finished_size = 0;
|
||||
|
||||
while (1) {
|
||||
status = adc_hal_get_reading_result(&adc_digi_ctx->hal, adc_digi_ctx->rx_eof_desc_addr, ¤t_desc);
|
||||
status = adc_hal_get_reading_result(&adc_digi_ctx->hal, adc_digi_ctx->rx_eof_desc_addr, &finished_buffer, &finished_size);
|
||||
if (status != ADC_HAL_DMA_DESC_VALID) {
|
||||
break;
|
||||
}
|
||||
|
||||
ret = xRingbufferSendFromISR(adc_digi_ctx->ringbuf_hdl, current_desc->buffer, current_desc->dw0.length, &taskAwoken);
|
||||
ret = xRingbufferSendFromISR(adc_digi_ctx->ringbuf_hdl, finished_buffer, finished_size, &taskAwoken);
|
||||
if (ret == pdFALSE) {
|
||||
//ringbuffer overflow
|
||||
adc_digi_ctx->ringbuf_overflow_flag = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (status == ADC_HAL_DMA_DESC_NULL) {
|
||||
//start next turns of dma operation
|
||||
adc_hal_digi_start(&adc_digi_ctx->hal, adc_digi_ctx->rx_dma_buf);
|
||||
}
|
||||
|
||||
return (taskAwoken == pdTRUE);
|
||||
}
|
||||
|
||||
@@ -605,6 +604,12 @@ static __attribute__((constructor)) void adc_hw_calibration(void)
|
||||
* update this when bringing up the calibration on that chip
|
||||
*/
|
||||
adc_calc_hw_calibration_code(i, j);
|
||||
#if SOC_ADC_CALIB_CHAN_COMPENS_SUPPORTED
|
||||
/* Load the channel compensation from efuse */
|
||||
for (int k = 0; k < SOC_ADC_CHANNEL_NUM(i); k++) {
|
||||
adc_load_hw_calibration_chan_compens(i, k, j);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -947,6 +947,12 @@ static __attribute__((constructor)) void adc_hw_calibration(void)
|
||||
* update this when bringing up the calibration on that chip
|
||||
*/
|
||||
adc_calc_hw_calibration_code(i, j);
|
||||
#if SOC_ADC_CALIB_CHAN_COMPENS_SUPPORTED
|
||||
/* Load the channel compensation from efuse */
|
||||
for (int k = 0; k < SOC_ADC_CHANNEL_NUM(i); k++) {
|
||||
adc_load_hw_calibration_chan_compens(i, k, j);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -130,9 +130,9 @@ typedef enum {
|
||||
} mcpwm_sync_signal_t;
|
||||
|
||||
// backward compatibility
|
||||
#define MCPWM_SELCT_SYNC0 MCPWM_SELCT_GPIO_SYNC0
|
||||
#define MCPWM_SELCT_SYNC1 MCPWM_SELCT_GPIO_SYNC1
|
||||
#define MCPWM_SELCT_SYNC2 MCPWM_SELCT_GPIO_SYNC2
|
||||
#define MCPWM_SELECT_SYNC0 MCPWM_SELECT_GPIO_SYNC0
|
||||
#define MCPWM_SELECT_SYNC1 MCPWM_SELECT_GPIO_SYNC1
|
||||
#define MCPWM_SELECT_SYNC2 MCPWM_SELECT_GPIO_SYNC2
|
||||
|
||||
/**
|
||||
* @brief MCPWM timer sync event trigger
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "hal/temperature_sensor_ll.h"
|
||||
#include "driver/temp_sensor_types_legacy.h"
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "esp_private/sar_periph_ctrl.h"
|
||||
|
||||
static const char *TAG = "tsens";
|
||||
|
||||
@@ -62,8 +63,8 @@ esp_err_t temp_sensor_set_config(temp_sensor_config_t tsens)
|
||||
err = ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
temperature_sensor_ll_set_clk_div(tsens.clk_div);
|
||||
temp_sensor_sync_tsens_idx(tsens.dac_offset);
|
||||
temperature_sensor_ll_set_range(dac_offset[tsens.dac_offset].reg_val);
|
||||
temperature_sensor_ll_enable(true);
|
||||
ESP_LOGI(TAG, "Config range [%d°C ~ %d°C], error < %d°C",
|
||||
dac_offset[tsens.dac_offset].range_min,
|
||||
dac_offset[tsens.dac_offset].range_max,
|
||||
@@ -95,7 +96,7 @@ esp_err_t temp_sensor_start(void)
|
||||
}
|
||||
regi2c_saradc_enable();
|
||||
periph_module_enable(PERIPH_TEMPSENSOR_MODULE);
|
||||
temperature_sensor_ll_enable(true);
|
||||
temperature_sensor_power_acquire();
|
||||
temperature_sensor_ll_clk_enable(true);
|
||||
temperature_sensor_ll_clk_sel(TEMPERATURE_SENSOR_CLK_SRC_DEFAULT);
|
||||
tsens_hw_state = TSENS_HW_STATE_STARTED;
|
||||
@@ -105,7 +106,7 @@ esp_err_t temp_sensor_start(void)
|
||||
esp_err_t temp_sensor_stop(void)
|
||||
{
|
||||
regi2c_saradc_disable();
|
||||
temperature_sensor_ll_enable(false);
|
||||
temperature_sensor_power_release();
|
||||
tsens_hw_state = TSENS_HW_STATE_CONFIGURED;
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -124,12 +125,12 @@ static esp_err_t read_delta_t_from_efuse(void)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static float parse_temp_sensor_raw_value(uint32_t tsens_raw, const int dac_offset)
|
||||
static float parse_temp_sensor_raw_value(int16_t tsens_raw)
|
||||
{
|
||||
if (isnan(s_deltaT)) { //suggests that the value is not initialized
|
||||
read_delta_t_from_efuse();
|
||||
}
|
||||
float result = (TEMPERATURE_SENSOR_LL_ADC_FACTOR * (float)tsens_raw - TEMPERATURE_SENSOR_LL_DAC_FACTOR * dac_offset - TEMPERATURE_SENSOR_LL_OFFSET_FACTOR) - s_deltaT / 10.0;
|
||||
float result = tsens_raw - s_deltaT / 10.0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -141,16 +142,17 @@ esp_err_t temp_sensor_read_celsius(float *celsius)
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
temp_sensor_config_t tsens;
|
||||
uint32_t tsens_out = 0;
|
||||
temp_sensor_get_config(&tsens);
|
||||
temp_sensor_read_raw(&tsens_out);
|
||||
ESP_LOGV(TAG, "tsens_out %"PRIu32, tsens_out);
|
||||
const tsens_dac_offset_t *dac = &dac_offset[tsens.dac_offset];
|
||||
*celsius = parse_temp_sensor_raw_value(tsens_out, dac->offset);
|
||||
if (*celsius < dac->range_min || *celsius > dac->range_max) {
|
||||
ESP_LOGW(TAG, "Exceeding the temperature range!");
|
||||
bool range_changed;
|
||||
int16_t tsens_out = temp_sensor_get_raw_value(&range_changed);
|
||||
*celsius = parse_temp_sensor_raw_value(tsens_out);
|
||||
if (*celsius < TEMPERATURE_SENSOR_LL_MEASURE_MIN || *celsius > TEMPERATURE_SENSOR_LL_MEASURE_MAX) {
|
||||
ESP_LOGE(TAG, "Exceeding temperature measure range.");
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (range_changed) {
|
||||
temp_sensor_get_config(&tsens);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <esp_types.h>
|
||||
#include "esp_err.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "driver/rtc_io.h"
|
||||
#include "soc/soc.h"
|
||||
@@ -497,7 +498,8 @@ esp_err_t gpio_install_isr_service(int intr_alloc_flags)
|
||||
{
|
||||
GPIO_CHECK(gpio_context.gpio_isr_func == NULL, "GPIO isr service already installed", ESP_ERR_INVALID_STATE);
|
||||
esp_err_t ret = ESP_ERR_NO_MEM;
|
||||
gpio_isr_func_t *isr_func = (gpio_isr_func_t *) calloc(GPIO_NUM_MAX, sizeof(gpio_isr_func_t));
|
||||
const uint32_t alloc_caps = (intr_alloc_flags & ESP_INTR_FLAG_IRAM) ? MALLOC_CAP_INTERNAL : MALLOC_CAP_DEFAULT;
|
||||
gpio_isr_func_t *isr_func = (gpio_isr_func_t *) heap_caps_calloc(GPIO_NUM_MAX, sizeof(gpio_isr_func_t), alloc_caps);
|
||||
if (isr_func) {
|
||||
portENTER_CRITICAL(&gpio_context.gpio_spinlock);
|
||||
if (gpio_context.gpio_isr_func == NULL) {
|
||||
|
||||
@@ -1453,7 +1453,7 @@ static void IRAM_ATTR i2c_master_cmd_begin_static(i2c_port_t i2c_num, portBASE_T
|
||||
}
|
||||
p_i2c->cmd_idx++;
|
||||
p_i2c->cmd_link.head = p_i2c->cmd_link.head->next;
|
||||
if (p_i2c->cmd_link.head == NULL || p_i2c->cmd_idx >= 15) {
|
||||
if (p_i2c->cmd_link.head == NULL || p_i2c->cmd_idx >= (SOC_I2C_CMD_REG_NUM-1)) {
|
||||
p_i2c->cmd_idx = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ static esp_err_t i2s_pdm_tx_set_clock(i2s_chan_handle_t handle, const i2s_pdm_tx
|
||||
#if SOC_I2S_HW_VERSION_2
|
||||
/* Work around for PDM TX clock, overwrite the raw division directly to reduce the noise
|
||||
* This set of coefficients is a special division to reduce the background noise in PDM TX mode */
|
||||
i2s_ll_tx_set_raw_clk_div(handle->controller->hal.dev, 1, 1, 0, 0);
|
||||
i2s_ll_tx_set_raw_clk_div(handle->controller->hal.dev, clk_info.mclk_div, 1, 1, 0, 0);
|
||||
#endif
|
||||
portEXIT_CRITICAL(&g_i2s.spinlock);
|
||||
|
||||
|
||||
@@ -404,9 +404,7 @@ static uint32_t ledc_auto_clk_divisor(ledc_mode_t speed_mode, int freq_hz, uint3
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if !CONFIG_IDF_TARGET_ESP32H2 // TODO: IDF-6267 Remove when H2 light sleep supported
|
||||
extern void esp_sleep_periph_use_8m(bool use_or_not);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Function setting the LEDC timer divisor with the given source clock,
|
||||
@@ -504,9 +502,7 @@ static esp_err_t ledc_set_timer_div(ledc_mode_t speed_mode, ledc_timer_t timer_n
|
||||
ESP_LOGD(LEDC_TAG, "In slow speed mode, global clk set: %d", glb_clk);
|
||||
|
||||
/* keep ESP_PD_DOMAIN_RC_FAST on during light sleep */
|
||||
#if !CONFIG_IDF_TARGET_ESP32H2 // TODO: IDF-6267 Remove when H2 light sleep supported
|
||||
esp_sleep_periph_use_8m(glb_clk == LEDC_SLOW_CLK_RC_FAST);
|
||||
#endif
|
||||
|
||||
portENTER_CRITICAL(&ledc_spinlock);
|
||||
ledc_hal_set_slow_clk_sel(&(p_ledc_obj[speed_mode]->ledc_hal), glb_clk);
|
||||
@@ -781,7 +777,7 @@ uint32_t ledc_get_freq(ledc_mode_t speed_mode, ledc_timer_t timer_num)
|
||||
ESP_LOGW(LEDC_TAG, "LEDC timer not configured, call ledc_timer_config to set timer frequency");
|
||||
return 0;
|
||||
}
|
||||
return ((uint64_t) src_clk_freq << 8) / precision / clock_divider;
|
||||
return (((uint64_t) src_clk_freq << LEDC_LL_FRACTIONAL_BITS) + (uint64_t) precision * clock_divider / 2) / precision / clock_divider;
|
||||
}
|
||||
|
||||
static inline void IRAM_ATTR ledc_calc_fade_end_channel(uint32_t *fade_end_status, uint32_t *channel)
|
||||
|
||||
@@ -725,10 +725,11 @@ static void SPI_MASTER_ISR_ATTR spi_intr(void *arg)
|
||||
// We stay in the ISR to deal with those transactions of desired device, otherwise nothing will be done, check whether we need to resume some other tasks, or just quit the ISR
|
||||
resume_task = spi_bus_lock_bg_check_dev_acq(lock, &desired_dev);
|
||||
}
|
||||
// sanity check
|
||||
assert(desired_dev);
|
||||
|
||||
if (!resume_task) {
|
||||
// sanity check
|
||||
assert(desired_dev);
|
||||
|
||||
bool dev_has_req = spi_bus_lock_bg_check_dev_req(desired_dev);
|
||||
if (dev_has_req) {
|
||||
device_to_send = host->device[spi_bus_lock_get_dev_id(desired_dev)];
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "hal/temperature_sensor_ll.h"
|
||||
#include "soc/temperature_sensor_periph.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "esp_private/sar_periph_ctrl.h"
|
||||
|
||||
static const char *TAG = "temperature_sensor";
|
||||
|
||||
@@ -63,6 +64,7 @@ static esp_err_t temperature_sensor_choose_best_range(temperature_sensor_handle_
|
||||
tsens->tsens_attribute = &s_tsens_attribute_copy[i];
|
||||
break;
|
||||
}
|
||||
temp_sensor_sync_tsens_idx(i);
|
||||
}
|
||||
ESP_RETURN_ON_FALSE(tsens->tsens_attribute != NULL, ESP_ERR_INVALID_ARG, TAG, "Out of testing range");
|
||||
return ESP_OK;
|
||||
@@ -114,7 +116,6 @@ esp_err_t temperature_sensor_install(const temperature_sensor_config_t *tsens_co
|
||||
|
||||
regi2c_saradc_enable();
|
||||
temperature_sensor_ll_set_range(tsens->tsens_attribute->reg_val);
|
||||
temperature_sensor_ll_enable(false); // disable the sensor by default
|
||||
|
||||
tsens->fsm = TEMP_SENSOR_FSM_INIT;
|
||||
*ret_tsens = tsens;
|
||||
@@ -147,6 +148,20 @@ esp_err_t temperature_sensor_uninstall(temperature_sensor_handle_t tsens)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t s_update_tsens_attribute(temperature_sensor_handle_t tsens)
|
||||
{
|
||||
uint32_t dac;
|
||||
ESP_RETURN_ON_FALSE(tsens != NULL, ESP_ERR_INVALID_ARG, TAG, "no tsens specified");
|
||||
dac = temperature_sensor_ll_get_offset();
|
||||
for (int i = 0 ; i < TEMPERATURE_SENSOR_ATTR_RANGE_NUM; i++) {
|
||||
if (dac == s_tsens_attribute_copy[i].reg_val) {
|
||||
tsens->tsens_attribute = &s_tsens_attribute_copy[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t temperature_sensor_enable(temperature_sensor_handle_t tsens)
|
||||
{
|
||||
ESP_RETURN_ON_FALSE((tsens != NULL), ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||
@@ -165,7 +180,7 @@ esp_err_t temperature_sensor_enable(temperature_sensor_handle_t tsens)
|
||||
|
||||
temperature_sensor_ll_clk_enable(true);
|
||||
temperature_sensor_ll_clk_sel(tsens->clk_src);
|
||||
temperature_sensor_ll_enable(true);
|
||||
temperature_sensor_power_acquire();
|
||||
tsens->fsm = TEMP_SENSOR_FSM_ENABLE;
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -175,12 +190,12 @@ esp_err_t temperature_sensor_disable(temperature_sensor_handle_t tsens)
|
||||
ESP_RETURN_ON_FALSE(tsens, ESP_ERR_INVALID_ARG, TAG, "invalid argument");
|
||||
ESP_RETURN_ON_FALSE(tsens->fsm == TEMP_SENSOR_FSM_ENABLE, ESP_ERR_INVALID_STATE, TAG, "tsens not enabled yet");
|
||||
|
||||
temperature_sensor_power_release();
|
||||
#if SOC_TEMPERATURE_SENSOR_INTR_SUPPORT
|
||||
temperature_sensor_ll_wakeup_enable(false);
|
||||
temperature_sensor_ll_sample_enable(false);
|
||||
#endif
|
||||
|
||||
temperature_sensor_ll_enable(false);
|
||||
#if SOC_TEMPERATURE_SENSOR_SUPPORT_FAST_RC
|
||||
if (tsens->clk_src == TEMPERATURE_SENSOR_CLK_SRC_RC_FAST) {
|
||||
periph_rtc_dig_clk8m_disable();
|
||||
@@ -200,12 +215,12 @@ static esp_err_t read_delta_t_from_efuse(void)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static float parse_temp_sensor_raw_value(uint32_t tsens_raw, const int dac_offset)
|
||||
static float parse_temp_sensor_raw_value(int16_t tsens_raw)
|
||||
{
|
||||
if (isnan(s_deltaT)) { //suggests that the value is not initialized
|
||||
read_delta_t_from_efuse();
|
||||
}
|
||||
float result = (TEMPERATURE_SENSOR_LL_ADC_FACTOR * (float)tsens_raw - TEMPERATURE_SENSOR_LL_DAC_FACTOR * dac_offset - TEMPERATURE_SENSOR_LL_OFFSET_FACTOR) - s_deltaT / 10.0;
|
||||
float result = tsens_raw - s_deltaT / 10.0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -214,14 +229,16 @@ esp_err_t temperature_sensor_get_celsius(temperature_sensor_handle_t tsens, floa
|
||||
ESP_RETURN_ON_FALSE((tsens != NULL), ESP_ERR_INVALID_ARG, TAG, "Has not been installed");
|
||||
ESP_RETURN_ON_FALSE(out_celsius != NULL, ESP_ERR_INVALID_ARG, TAG, "Celsius points to nothing");
|
||||
ESP_RETURN_ON_FALSE(tsens->fsm == TEMP_SENSOR_FSM_ENABLE, ESP_ERR_INVALID_STATE, TAG, "tsens not enabled yet");
|
||||
bool range_changed;
|
||||
int16_t tsens_out = temp_sensor_get_raw_value(&range_changed);
|
||||
*out_celsius = parse_temp_sensor_raw_value(tsens_out);
|
||||
|
||||
uint32_t tsens_out = temperature_sensor_ll_get_raw_value();
|
||||
ESP_LOGD(TAG, "tsens_out %"PRIu32, tsens_out);
|
||||
|
||||
*out_celsius = parse_temp_sensor_raw_value(tsens_out, tsens->tsens_attribute->offset);
|
||||
if (*out_celsius < tsens->tsens_attribute->range_min || *out_celsius > tsens->tsens_attribute->range_max) {
|
||||
ESP_LOGW(TAG, "value out of range, probably invalid");
|
||||
return ESP_FAIL;
|
||||
if (*out_celsius < TEMPERATURE_SENSOR_LL_MEASURE_MIN || *out_celsius > TEMPERATURE_SENSOR_LL_MEASURE_MAX) {
|
||||
ESP_LOGE(TAG, "Exceeding temperature measure range.");
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
}
|
||||
if (range_changed) {
|
||||
s_update_tsens_attribute(tsens);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -844,7 +844,6 @@ TEST_CASE("GPIO_USB_DP_pin_pullup_disable_test", "[gpio]")
|
||||
}
|
||||
#endif //SOC_USB_SERIAL_JTAG_SUPPORTED
|
||||
|
||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32H2) // TODO: IDF-6267 Remove when light sleep is supported
|
||||
// Ignored in CI because it needs manually connect TEST_GPIO_INPUT_LEVEL_LOW_PIN to 3.3v to wake up from light sleep
|
||||
TEST_CASE("GPIO_light_sleep_wake_up_test", "[gpio][ignore]")
|
||||
{
|
||||
@@ -861,4 +860,3 @@ TEST_CASE("GPIO_light_sleep_wake_up_test", "[gpio][ignore]")
|
||||
printf("Waked up from light sleep\n");
|
||||
TEST_ASSERT(esp_sleep_get_wakeup_cause() == ESP_SLEEP_WAKEUP_GPIO);
|
||||
}
|
||||
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(...)
|
||||
|
||||
@@ -84,44 +84,44 @@ TEST_CASE("gptimer_wallclock_with_various_clock_sources", "[gptimer]")
|
||||
for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
||||
TEST_ESP_OK(gptimer_start(timers[i]));
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(20)); // 20ms = 20_000 ticks
|
||||
esp_rom_delay_us(20 * 1000); // 20ms = 20_000 ticks
|
||||
uint64_t value = 0;
|
||||
for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
||||
TEST_ESP_OK(gptimer_get_raw_count(timers[i], &value));
|
||||
// convert the raw count to us
|
||||
value = value * 1000000 / timer_resolution_hz[i];
|
||||
TEST_ASSERT_UINT_WITHIN(1100, 20000, value);
|
||||
TEST_ASSERT_UINT_WITHIN(300, 20000, value);
|
||||
}
|
||||
printf("stop timers\r\n");
|
||||
for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
||||
TEST_ESP_OK(gptimer_stop(timers[i]));
|
||||
}
|
||||
printf("check whether timers have stopped\r\n");
|
||||
vTaskDelay(pdMS_TO_TICKS(20));
|
||||
esp_rom_delay_us(20 * 1000);
|
||||
for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
||||
TEST_ESP_OK(gptimer_get_raw_count(timers[i], &value));
|
||||
printf("get raw count of gptimer %d: %llu\r\n", i, value);
|
||||
// convert the raw count to us
|
||||
value = value * 1000000 / timer_resolution_hz[i];
|
||||
TEST_ASSERT_UINT_WITHIN(1000, 20000, value);
|
||||
TEST_ASSERT_UINT_WITHIN(300, 20000, value);
|
||||
}
|
||||
printf("restart timers\r\n");
|
||||
for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
||||
TEST_ESP_OK(gptimer_start(timers[i]));
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(20));
|
||||
esp_rom_delay_us(20 * 1000);
|
||||
printf("stop timers again\r\n");
|
||||
for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
||||
TEST_ESP_OK(gptimer_stop(timers[i]));
|
||||
}
|
||||
printf("check whether timers have stopped\r\n");
|
||||
vTaskDelay(pdMS_TO_TICKS(20));
|
||||
esp_rom_delay_us(20 * 1000);
|
||||
for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
||||
TEST_ESP_OK(gptimer_get_raw_count(timers[i], &value));
|
||||
printf("get raw count of gptimer %d: %llu\r\n", i, value);
|
||||
// convert the raw count to us
|
||||
value = value * 1000000 / timer_resolution_hz[i];
|
||||
TEST_ASSERT_UINT_WITHIN(2500, 40000, value);
|
||||
TEST_ASSERT_UINT_WITHIN(600, 40000, value);
|
||||
}
|
||||
printf("disable timers\r\n");
|
||||
for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
||||
@@ -141,7 +141,7 @@ TEST_CASE("gptimer_wallclock_with_various_clock_sources", "[gptimer]")
|
||||
#if CONFIG_PM_ENABLE
|
||||
#define GPTIMER_STOP_ON_ALARM_COUNT_DELTA 150
|
||||
#else
|
||||
#define GPTIMER_STOP_ON_ALARM_COUNT_DELTA 50
|
||||
#define GPTIMER_STOP_ON_ALARM_COUNT_DELTA 30
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
TEST_ALARM_CALLBACK_ATTR static bool test_gptimer_alarm_stop_callback(gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *user_data)
|
||||
@@ -226,7 +226,7 @@ TEST_CASE("gptimer_stop_on_alarm", "[gptimer]")
|
||||
#if CONFIG_PM_ENABLE
|
||||
#define GPTIMER_AUTO_RELOAD_ON_ALARM_COUNT_DELTA 200
|
||||
#else
|
||||
#define GPTIMER_AUTO_RELOAD_ON_ALARM_COUNT_DELTA 30
|
||||
#define GPTIMER_AUTO_RELOAD_ON_ALARM_COUNT_DELTA 20
|
||||
#endif // CONFIG_PM_ENABLE
|
||||
|
||||
TEST_ALARM_CALLBACK_ATTR static bool test_gptimer_alarm_reload_callback(gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *user_data)
|
||||
|
||||
@@ -553,7 +553,7 @@ static void timer_frequency_test(ledc_channel_t channel, ledc_timer_bit_t timer_
|
||||
uint32_t clk_src_freq = 0;
|
||||
esp_clk_tree_src_get_freq_hz((soc_module_clk_t)TEST_DEFAULT_CLK_CFG, ESP_CLK_TREE_SRC_FREQ_PRECISION_EXACT, &clk_src_freq);
|
||||
if (clk_src_freq == 80 * 1000 * 1000) {
|
||||
theoretical_freq = 8992;
|
||||
theoretical_freq = 8993;
|
||||
} else if (clk_src_freq == 96 * 1000 * 1000) {
|
||||
theoretical_freq = 9009;
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@
|
||||
#define ADC_TEST_HIGH_VAL 3400
|
||||
#define ADC_TEST_HIGH_THRESH 200
|
||||
|
||||
#elif CONFIG_IDF_TARGET_ESP32C6 // TODO: IDF-5312
|
||||
#define ADC_TEST_LOW_VAL 2144
|
||||
#define ADC_TEST_LOW_THRESH 200
|
||||
#elif CONFIG_IDF_TARGET_ESP32C6
|
||||
#define ADC_TEST_LOW_VAL 0
|
||||
#define ADC_TEST_LOW_THRESH 15
|
||||
|
||||
#define ADC_TEST_HIGH_VAL 4081
|
||||
#define ADC_TEST_HIGH_VAL 3350
|
||||
#define ADC_TEST_HIGH_THRESH 200
|
||||
|
||||
#elif CONFIG_IDF_TARGET_ESP32H2 // TODO: IDF-6216
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -23,6 +23,7 @@ TEST_CASE("Temperature_legacy_workflow_test", "[hw_timer]")
|
||||
TEST_ESP_OK(temp_sensor_read_celsius(&tsens_out));
|
||||
printf("Temperature out celsius %f°C\n", tsens_out);
|
||||
TEST_ESP_OK(temp_sensor_stop());
|
||||
#if !CONFIG_IDF_TARGET_ESP32H2 // disable on eps32h2, seems have some issues on esp32h2
|
||||
temp_sensor.dac_offset = TSENS_DAC_L3;
|
||||
TEST_ESP_OK(temp_sensor_set_config(temp_sensor));
|
||||
TEST_ESP_OK(temp_sensor_start());
|
||||
@@ -30,6 +31,7 @@ TEST_CASE("Temperature_legacy_workflow_test", "[hw_timer]")
|
||||
TEST_ESP_OK(temp_sensor_read_celsius(&tsens_out));
|
||||
printf("Temperature out celsius %f°C\n", tsens_out);
|
||||
TEST_ESP_OK(temp_sensor_stop());
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("Temperature legacy double start error cause test", "[temperature_sensor]")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -26,7 +26,8 @@ int esp_efuse_rtc_calib_get_ver(void)
|
||||
|
||||
uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten)
|
||||
{
|
||||
assert(version == ESP_EFUSE_ADC_CALIB_VER);
|
||||
assert((version >= ESP_EFUSE_ADC_CALIB_VER_MIN) &&
|
||||
(version <= ESP_EFUSE_ADC_CALIB_VER_MAX));
|
||||
assert(atten <= ADC_ATTEN_DB_11);
|
||||
(void) adc_unit;
|
||||
|
||||
@@ -64,7 +65,8 @@ uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int a
|
||||
|
||||
esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t *out_digi, uint32_t *out_vol_mv)
|
||||
{
|
||||
assert(version == ESP_EFUSE_ADC_CALIB_VER);
|
||||
assert((version >= ESP_EFUSE_ADC_CALIB_VER_MIN) &&
|
||||
(version <= ESP_EFUSE_ADC_CALIB_VER_MAX));
|
||||
assert(atten <= ADC_ATTEN_DB_11);
|
||||
(void) adc_unit;
|
||||
|
||||
|
||||
@@ -12,7 +12,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
//This is the ADC calibration value version burnt in efuse
|
||||
#define ESP_EFUSE_ADC_CALIB_VER 1
|
||||
#define ESP_EFUSE_ADC_CALIB_VER 1
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MIN ESP_EFUSE_ADC_CALIB_VER
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MAX ESP_EFUSE_ADC_CALIB_VER
|
||||
|
||||
/**
|
||||
* @brief Get the RTC calibration efuse version
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -24,7 +24,8 @@ int esp_efuse_rtc_calib_get_ver(void)
|
||||
|
||||
uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten)
|
||||
{
|
||||
assert(version == ESP_EFUSE_ADC_CALIB_VER);
|
||||
assert((version >= ESP_EFUSE_ADC_CALIB_VER_MIN) &&
|
||||
(version <= ESP_EFUSE_ADC_CALIB_VER_MAX));
|
||||
(void) adc_unit;
|
||||
const esp_efuse_desc_t** init_code_efuse;
|
||||
assert(atten < 4);
|
||||
@@ -51,7 +52,8 @@ esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, in
|
||||
(void)adc_unit; //On esp32c3, V1 we don't have calibration data for ADC2, using the efuse data of ADC1
|
||||
const esp_efuse_desc_t** cal_vol_efuse;
|
||||
uint32_t calib_vol_expected_mv;
|
||||
if (version != ESP_EFUSE_ADC_CALIB_VER) {
|
||||
if ((version < ESP_EFUSE_ADC_CALIB_VER_MIN) ||
|
||||
(version > ESP_EFUSE_ADC_CALIB_VER_MAX)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (atten >= 4) {
|
||||
|
||||
@@ -12,7 +12,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
//This is the ADC calibration value version burnt in efuse
|
||||
#define ESP_EFUSE_ADC_CALIB_VER 1
|
||||
#define ESP_EFUSE_ADC_CALIB_VER 1
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MIN ESP_EFUSE_ADC_CALIB_VER
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MAX ESP_EFUSE_ADC_CALIB_VER
|
||||
|
||||
/**
|
||||
* @brief Get the RTC calibration efuse version
|
||||
|
||||
@@ -7,30 +7,126 @@
|
||||
#include <esp_bit_defs.h>
|
||||
#include "esp_efuse.h"
|
||||
#include "esp_efuse_table.h"
|
||||
#include "esp_efuse_rtc_calib.h"
|
||||
#include "hal/efuse_hal.h"
|
||||
|
||||
/**
|
||||
* @brief Get the signed value by the raw data that read from eFuse
|
||||
* @param data The raw data that read from eFuse
|
||||
* @param sign_bit The index of the sign bit, start from 0
|
||||
*/
|
||||
#define RTC_CALIB_GET_SIGNED_VAL(data, sign_bit) ((data & BIT##sign_bit) ? -(int)(data & ~BIT##sign_bit) : (int)data)
|
||||
|
||||
int esp_efuse_rtc_calib_get_ver(void)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
esp_efuse_read_field_blob(ESP_EFUSE_BLK_VERSION_MAJOR, &result, ESP_EFUSE_BLK_VERSION_MAJOR[0]->bit_count); // IDF-5366
|
||||
return result;
|
||||
uint32_t cali_version = 0;
|
||||
uint32_t blk_ver = efuse_hal_blk_version();
|
||||
if (blk_ver == 1) {
|
||||
cali_version = ESP_EFUSE_ADC_CALIB_VER1;
|
||||
} else if (blk_ver >= 2) {
|
||||
cali_version = ESP_EFUSE_ADC_CALIB_VER2;
|
||||
} else {
|
||||
ESP_LOGW("eFuse", "calibration efuse version does not match, set default version to 0");
|
||||
}
|
||||
|
||||
return cali_version;
|
||||
}
|
||||
|
||||
uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten)
|
||||
{
|
||||
// Currently calibration is not supported on ESP32-C6, IDF-5236
|
||||
(void) version;
|
||||
/* Version validation should be guaranteed in the caller */
|
||||
assert(atten >=0 && atten < 4);
|
||||
(void) adc_unit;
|
||||
(void) atten;
|
||||
return 0;
|
||||
|
||||
const esp_efuse_desc_t** init_code_efuse;
|
||||
if (atten == 0) {
|
||||
init_code_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN0;
|
||||
} else if (atten == 1) {
|
||||
init_code_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN1;
|
||||
} else if (atten == 2) {
|
||||
init_code_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN2;
|
||||
} else {
|
||||
init_code_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN3;
|
||||
}
|
||||
|
||||
int init_code_size = esp_efuse_get_field_size(init_code_efuse);
|
||||
assert(init_code_size == 10);
|
||||
|
||||
uint32_t init_code = 0;
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(init_code_efuse, &init_code, init_code_size));
|
||||
return init_code + 1600; // version 1 logic
|
||||
}
|
||||
|
||||
esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, int atten, uint32_t* out_digi, uint32_t* out_vol_mv)
|
||||
int esp_efuse_rtc_calib_get_chan_compens(int version, uint32_t adc_unit, uint32_t adc_channel, int atten)
|
||||
{
|
||||
// Currently calibration is not supported on ESP32-C6, IDF-5236
|
||||
(void) version;
|
||||
(void) atten;
|
||||
(void) out_digi;
|
||||
(void) out_vol_mv;
|
||||
/* Version validation should be guaranteed in the caller */
|
||||
assert(atten < 4);
|
||||
assert(adc_channel < SOC_ADC_CHANNEL_NUM(adc_unit));
|
||||
|
||||
const esp_efuse_desc_t** chan_diff_efuse = NULL;
|
||||
switch (adc_channel) {
|
||||
case 0:
|
||||
chan_diff_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH0;
|
||||
break;
|
||||
case 1:
|
||||
chan_diff_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH1;
|
||||
break;
|
||||
case 2:
|
||||
chan_diff_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH2;
|
||||
break;
|
||||
case 3:
|
||||
chan_diff_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH3;
|
||||
break;
|
||||
case 4:
|
||||
chan_diff_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH4;
|
||||
break;
|
||||
case 5:
|
||||
chan_diff_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH5;
|
||||
break;
|
||||
default:
|
||||
chan_diff_efuse = ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH6;
|
||||
break;
|
||||
}
|
||||
|
||||
int chan_diff_size = esp_efuse_get_field_size(chan_diff_efuse);
|
||||
assert(chan_diff_size == 4);
|
||||
uint32_t chan_diff = 0;
|
||||
ESP_ERROR_CHECK(esp_efuse_read_field_blob(chan_diff_efuse, &chan_diff, chan_diff_size));
|
||||
return RTC_CALIB_GET_SIGNED_VAL(chan_diff, 3) * (4 - atten);
|
||||
}
|
||||
|
||||
esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv)
|
||||
{
|
||||
(void) adc_unit;
|
||||
const esp_efuse_desc_t** cal_vol_efuse[4] = {
|
||||
ESP_EFUSE_ADC1_CAL_VOL_ATTEN0,
|
||||
ESP_EFUSE_ADC1_CAL_VOL_ATTEN1,
|
||||
ESP_EFUSE_ADC1_CAL_VOL_ATTEN2,
|
||||
ESP_EFUSE_ADC1_CAL_VOL_ATTEN3,
|
||||
};
|
||||
const uint32_t input_vout_mv[2][4] = {
|
||||
{400, 550, 750, 1370}, // Calibration V1 coefficients
|
||||
{750, 1000, 1500, 2800}, // Calibration V2 coefficients
|
||||
};
|
||||
|
||||
if ((version < ESP_EFUSE_ADC_CALIB_VER_MIN) ||
|
||||
(version > ESP_EFUSE_ADC_CALIB_VER_MAX)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (atten >= 4 || atten < 0) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
assert(cal_vol_efuse[atten][0]->bit_count == 10);
|
||||
|
||||
uint32_t cal_vol = 0;
|
||||
esp_err_t ret = esp_efuse_read_field_blob(cal_vol_efuse[atten], &cal_vol, cal_vol_efuse[atten][0]->bit_count);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
uint32_t chk_offset = (version == ESP_EFUSE_ADC_CALIB_VER1) ? 1500 : (atten == 2) ? 2900 : 2850;
|
||||
*out_digi = chk_offset + RTC_CALIB_GET_SIGNED_VAL(cal_vol, 9);
|
||||
*out_vol_mv = input_vout_mv[VER2IDX(version)][atten];
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <assert.h>
|
||||
#include "esp_efuse_table.h"
|
||||
|
||||
// md5_digest_table 344c54cf227f74643e4d13dce1b1d30f
|
||||
// md5_digest_table fd5a35cea89bfad954e834bc92bed385
|
||||
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
|
||||
// If you want to change some fields, you need to change esp_efuse_table.csv file
|
||||
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
|
||||
@@ -227,6 +227,74 @@ static const esp_efuse_desc_t WR_DIS_OPTIONAL_UNIQUE_ID[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of OPTIONAL_UNIQUE_ID,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_TEMP_CALIB[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of TEMP_CALIB,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_OCODE[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of OCODE,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN0[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN1[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN2[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN3[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_CAL_VOL_ATTEN0[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_CAL_VOL_ATTEN0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_CAL_VOL_ATTEN1[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_CAL_VOL_ATTEN1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_CAL_VOL_ATTEN2[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_CAL_VOL_ATTEN2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_CAL_VOL_ATTEN3[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_CAL_VOL_ATTEN3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN0_CH0[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN0_CH1[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN0_CH2[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN0_CH3[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN0_CH4[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH4,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN0_CH5[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH5,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_ADC1_INIT_CODE_ATTEN0_CH6[] = {
|
||||
{EFUSE_BLK0, 21, 1}, // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH6,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t WR_DIS_BLOCK_USR_DATA[] = {
|
||||
{EFUSE_BLK0, 22, 1}, // [WR_DIS.USER_DATA] wr_dis of BLOCK_USR_DATA,
|
||||
};
|
||||
@@ -521,6 +589,74 @@ static const esp_efuse_desc_t OPTIONAL_UNIQUE_ID[] = {
|
||||
{EFUSE_BLK2, 0, 128}, // [] Optional unique 128-bit ID,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t TEMP_CALIB[] = {
|
||||
{EFUSE_BLK2, 128, 9}, // [] Temperature calibration data,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t OCODE[] = {
|
||||
{EFUSE_BLK2, 137, 8}, // [] ADC OCode,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN0[] = {
|
||||
{EFUSE_BLK2, 145, 10}, // [] ADC1 init code at atten0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN1[] = {
|
||||
{EFUSE_BLK2, 155, 10}, // [] ADC1 init code at atten1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN2[] = {
|
||||
{EFUSE_BLK2, 165, 10}, // [] ADC1 init code at atten2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN3[] = {
|
||||
{EFUSE_BLK2, 175, 10}, // [] ADC1 init code at atten3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_CAL_VOL_ATTEN0[] = {
|
||||
{EFUSE_BLK2, 185, 10}, // [] ADC1 calibration voltage at atten0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_CAL_VOL_ATTEN1[] = {
|
||||
{EFUSE_BLK2, 195, 10}, // [] ADC1 calibration voltage at atten1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_CAL_VOL_ATTEN2[] = {
|
||||
{EFUSE_BLK2, 205, 10}, // [] ADC1 calibration voltage at atten2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_CAL_VOL_ATTEN3[] = {
|
||||
{EFUSE_BLK2, 215, 10}, // [] ADC1 calibration voltage at atten3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN0_CH0[] = {
|
||||
{EFUSE_BLK2, 225, 4}, // [] ADC1 init code at atten0 ch0,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN0_CH1[] = {
|
||||
{EFUSE_BLK2, 229, 4}, // [] ADC1 init code at atten0 ch1,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN0_CH2[] = {
|
||||
{EFUSE_BLK2, 233, 4}, // [] ADC1 init code at atten0 ch2,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN0_CH3[] = {
|
||||
{EFUSE_BLK2, 237, 4}, // [] ADC1 init code at atten0 ch3,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN0_CH4[] = {
|
||||
{EFUSE_BLK2, 241, 4}, // [] ADC1 init code at atten0 ch4,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN0_CH5[] = {
|
||||
{EFUSE_BLK2, 245, 4}, // [] ADC1 init code at atten0 ch5,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t ADC1_INIT_CODE_ATTEN0_CH6[] = {
|
||||
{EFUSE_BLK2, 249, 4}, // [] ADC1 init code at atten0 ch6,
|
||||
};
|
||||
|
||||
static const esp_efuse_desc_t USER_DATA[] = {
|
||||
{EFUSE_BLK3, 0, 256}, // [BLOCK_USR_DATA] User data,
|
||||
};
|
||||
@@ -826,6 +962,91 @@ const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_OPTIONAL_UNIQUE_ID[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_TEMP_CALIB[] = {
|
||||
&WR_DIS_TEMP_CALIB[0], // [] wr_dis of TEMP_CALIB
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_OCODE[] = {
|
||||
&WR_DIS_OCODE[0], // [] wr_dis of OCODE
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN0[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN1[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN1[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN2[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN2[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN3[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN3[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN3
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_CAL_VOL_ATTEN0[] = {
|
||||
&WR_DIS_ADC1_CAL_VOL_ATTEN0[0], // [] wr_dis of ADC1_CAL_VOL_ATTEN0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_CAL_VOL_ATTEN1[] = {
|
||||
&WR_DIS_ADC1_CAL_VOL_ATTEN1[0], // [] wr_dis of ADC1_CAL_VOL_ATTEN1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_CAL_VOL_ATTEN2[] = {
|
||||
&WR_DIS_ADC1_CAL_VOL_ATTEN2[0], // [] wr_dis of ADC1_CAL_VOL_ATTEN2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_CAL_VOL_ATTEN3[] = {
|
||||
&WR_DIS_ADC1_CAL_VOL_ATTEN3[0], // [] wr_dis of ADC1_CAL_VOL_ATTEN3
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH0[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN0_CH0[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH1[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN0_CH1[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH2[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN0_CH2[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH3[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN0_CH3[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH3
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH4[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN0_CH4[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH4
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH5[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN0_CH5[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH5
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH6[] = {
|
||||
&WR_DIS_ADC1_INIT_CODE_ATTEN0_CH6[0], // [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH6
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLOCK_USR_DATA[] = {
|
||||
&WR_DIS_BLOCK_USR_DATA[0], // [WR_DIS.USER_DATA] wr_dis of BLOCK_USR_DATA
|
||||
NULL
|
||||
@@ -1192,6 +1413,91 @@ const esp_efuse_desc_t* ESP_EFUSE_OPTIONAL_UNIQUE_ID[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_TEMP_CALIB[] = {
|
||||
&TEMP_CALIB[0], // [] Temperature calibration data
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_OCODE[] = {
|
||||
&OCODE[0], // [] ADC OCode
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0[] = {
|
||||
&ADC1_INIT_CODE_ATTEN0[0], // [] ADC1 init code at atten0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN1[] = {
|
||||
&ADC1_INIT_CODE_ATTEN1[0], // [] ADC1 init code at atten1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN2[] = {
|
||||
&ADC1_INIT_CODE_ATTEN2[0], // [] ADC1 init code at atten2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN3[] = {
|
||||
&ADC1_INIT_CODE_ATTEN3[0], // [] ADC1 init code at atten3
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN0[] = {
|
||||
&ADC1_CAL_VOL_ATTEN0[0], // [] ADC1 calibration voltage at atten0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN1[] = {
|
||||
&ADC1_CAL_VOL_ATTEN1[0], // [] ADC1 calibration voltage at atten1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN2[] = {
|
||||
&ADC1_CAL_VOL_ATTEN2[0], // [] ADC1 calibration voltage at atten2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN3[] = {
|
||||
&ADC1_CAL_VOL_ATTEN3[0], // [] ADC1 calibration voltage at atten3
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH0[] = {
|
||||
&ADC1_INIT_CODE_ATTEN0_CH0[0], // [] ADC1 init code at atten0 ch0
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH1[] = {
|
||||
&ADC1_INIT_CODE_ATTEN0_CH1[0], // [] ADC1 init code at atten0 ch1
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH2[] = {
|
||||
&ADC1_INIT_CODE_ATTEN0_CH2[0], // [] ADC1 init code at atten0 ch2
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH3[] = {
|
||||
&ADC1_INIT_CODE_ATTEN0_CH3[0], // [] ADC1 init code at atten0 ch3
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH4[] = {
|
||||
&ADC1_INIT_CODE_ATTEN0_CH4[0], // [] ADC1 init code at atten0 ch4
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH5[] = {
|
||||
&ADC1_INIT_CODE_ATTEN0_CH5[0], // [] ADC1 init code at atten0 ch5
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH6[] = {
|
||||
&ADC1_INIT_CODE_ATTEN0_CH6[0], // [] ADC1 init code at atten0 ch6
|
||||
NULL
|
||||
};
|
||||
|
||||
const esp_efuse_desc_t* ESP_EFUSE_USER_DATA[] = {
|
||||
&USER_DATA[0], // [BLOCK_USR_DATA] User data
|
||||
NULL
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# this will generate new source files, next rebuild all the sources.
|
||||
# !!!!!!!!!!! #
|
||||
|
||||
# This file was generated by regtools.py based on the efuses.yaml file with the version: 0a6c6206f42d0f0b7aeaceb8cecf1fc2
|
||||
# This file was generated by regtools.py based on the efuses.yaml file with the version: 709e8ea096e8a03a10006d40d5451a49
|
||||
|
||||
WR_DIS, EFUSE_BLK0, 0, 32, [] Disable programming of individual eFuses
|
||||
WR_DIS.RD_DIS, EFUSE_BLK0, 0, 1, [] wr_dis of RD_DIS
|
||||
@@ -64,6 +64,23 @@ WR_DIS.FLASH_TEMP, EFUSE_BLK0, 20, 1, [] wr_dis
|
||||
WR_DIS.FLASH_VENDOR, EFUSE_BLK0, 20, 1, [] wr_dis of FLASH_VENDOR
|
||||
WR_DIS.SYS_DATA_PART1, EFUSE_BLK0, 21, 1, [] wr_dis of BLOCK2
|
||||
WR_DIS.OPTIONAL_UNIQUE_ID, EFUSE_BLK0, 21, 1, [] wr_dis of OPTIONAL_UNIQUE_ID
|
||||
WR_DIS.TEMP_CALIB, EFUSE_BLK0, 21, 1, [] wr_dis of TEMP_CALIB
|
||||
WR_DIS.OCODE, EFUSE_BLK0, 21, 1, [] wr_dis of OCODE
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN1
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN2
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN3
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN0
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN1
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN2
|
||||
WR_DIS.ADC1_CAL_VOL_ATTEN3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_CAL_VOL_ATTEN3
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH0, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH0
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH1, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH1
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH2, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH2
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH3, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH3
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH4, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH4
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH5, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH5
|
||||
WR_DIS.ADC1_INIT_CODE_ATTEN0_CH6, EFUSE_BLK0, 21, 1, [] wr_dis of ADC1_INIT_CODE_ATTEN0_CH6
|
||||
WR_DIS.BLOCK_USR_DATA, EFUSE_BLK0, 22, 1, [WR_DIS.USER_DATA] wr_dis of BLOCK_USR_DATA
|
||||
WR_DIS.CUSTOM_MAC, EFUSE_BLK0, 22, 1, [WR_DIS.MAC_CUSTOM WR_DIS.USER_DATA_MAC_CUSTOM] wr_dis of CUSTOM_MAC
|
||||
WR_DIS.BLOCK_KEY0, EFUSE_BLK0, 23, 1, [WR_DIS.KEY0] wr_dis of BLOCK_KEY0
|
||||
@@ -142,6 +159,23 @@ FLASH_CAP, EFUSE_BLK1, 128, 3, []
|
||||
FLASH_TEMP, EFUSE_BLK1, 131, 2, []
|
||||
FLASH_VENDOR, EFUSE_BLK1, 133, 3, []
|
||||
OPTIONAL_UNIQUE_ID, EFUSE_BLK2, 0, 128, [] Optional unique 128-bit ID
|
||||
TEMP_CALIB, EFUSE_BLK2, 128, 9, [] Temperature calibration data
|
||||
OCODE, EFUSE_BLK2, 137, 8, [] ADC OCode
|
||||
ADC1_INIT_CODE_ATTEN0, EFUSE_BLK2, 145, 10, [] ADC1 init code at atten0
|
||||
ADC1_INIT_CODE_ATTEN1, EFUSE_BLK2, 155, 10, [] ADC1 init code at atten1
|
||||
ADC1_INIT_CODE_ATTEN2, EFUSE_BLK2, 165, 10, [] ADC1 init code at atten2
|
||||
ADC1_INIT_CODE_ATTEN3, EFUSE_BLK2, 175, 10, [] ADC1 init code at atten3
|
||||
ADC1_CAL_VOL_ATTEN0, EFUSE_BLK2, 185, 10, [] ADC1 calibration voltage at atten0
|
||||
ADC1_CAL_VOL_ATTEN1, EFUSE_BLK2, 195, 10, [] ADC1 calibration voltage at atten1
|
||||
ADC1_CAL_VOL_ATTEN2, EFUSE_BLK2, 205, 10, [] ADC1 calibration voltage at atten2
|
||||
ADC1_CAL_VOL_ATTEN3, EFUSE_BLK2, 215, 10, [] ADC1 calibration voltage at atten3
|
||||
ADC1_INIT_CODE_ATTEN0_CH0, EFUSE_BLK2, 225, 4, [] ADC1 init code at atten0 ch0
|
||||
ADC1_INIT_CODE_ATTEN0_CH1, EFUSE_BLK2, 229, 4, [] ADC1 init code at atten0 ch1
|
||||
ADC1_INIT_CODE_ATTEN0_CH2, EFUSE_BLK2, 233, 4, [] ADC1 init code at atten0 ch2
|
||||
ADC1_INIT_CODE_ATTEN0_CH3, EFUSE_BLK2, 237, 4, [] ADC1 init code at atten0 ch3
|
||||
ADC1_INIT_CODE_ATTEN0_CH4, EFUSE_BLK2, 241, 4, [] ADC1 init code at atten0 ch4
|
||||
ADC1_INIT_CODE_ATTEN0_CH5, EFUSE_BLK2, 245, 4, [] ADC1 init code at atten0 ch5
|
||||
ADC1_INIT_CODE_ATTEN0_CH6, EFUSE_BLK2, 249, 4, [] ADC1 init code at atten0 ch6
|
||||
USER_DATA, EFUSE_BLK3, 0, 256, [BLOCK_USR_DATA] User data
|
||||
USER_DATA.MAC_CUSTOM, EFUSE_BLK3, 200, 48, [MAC_CUSTOM CUSTOM_MAC] Custom MAC
|
||||
KEY0, EFUSE_BLK4, 0, 256, [BLOCK_KEY0] Key0 or user data
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 53.
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -12,8 +12,11 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
//This is the ADC calibration value version burnt in efuse
|
||||
#define ESP_EFUSE_ADC_CALIB_VER 1
|
||||
|
||||
#define ESP_EFUSE_ADC_CALIB_VER1 1
|
||||
#define ESP_EFUSE_ADC_CALIB_VER2 2
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MIN ESP_EFUSE_ADC_CALIB_VER1
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MAX ESP_EFUSE_ADC_CALIB_VER2
|
||||
#define VER2IDX(ver) (ver - 1) // Version number to index number of the array
|
||||
/**
|
||||
* @brief Get the RTC calibration efuse version
|
||||
*
|
||||
@@ -31,10 +34,22 @@ int esp_efuse_rtc_calib_get_ver(void);
|
||||
*/
|
||||
uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int atten);
|
||||
|
||||
/**
|
||||
* @brief Get the channel specific calibration compensation
|
||||
*
|
||||
* @param version Version of the stored efuse
|
||||
* @param adc_unit ADC unit. Not used, for compatibility. On esp32c6, for calibration v1, both ADC units use the same init code (calibrated by ADC1)
|
||||
* @param adc_channel ADC channel number
|
||||
* @param atten Attenuation of the init code
|
||||
* @return The channel calibration compensation value
|
||||
*/
|
||||
int esp_efuse_rtc_calib_get_chan_compens(int version, uint32_t adc_unit, uint32_t adc_channel, int atten);
|
||||
|
||||
/**
|
||||
* @brief Get the calibration digits stored in the efuse, and the corresponding voltage.
|
||||
*
|
||||
* @param version Version of the stored efuse
|
||||
* @param adc_unit ADC unit (not used on ESP32C6, for compatibility)
|
||||
* @param atten Attenuation to use
|
||||
* @param out_digi Output buffer of the digits
|
||||
* @param out_vol_mv Output of the voltage, in mV
|
||||
@@ -42,7 +57,7 @@ uint32_t esp_efuse_rtc_calib_get_init_code(int version, uint32_t adc_unit, int a
|
||||
* - ESP_ERR_INVALID_ARG: If efuse version or attenuation is invalid
|
||||
* - ESP_OK: if success
|
||||
*/
|
||||
esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, int atten, uint32_t* out_digi, uint32_t* out_vol_mv);
|
||||
esp_err_t esp_efuse_rtc_calib_get_cal_voltage(int version, uint32_t adc_unit, int atten, uint32_t* out_digi, uint32_t* out_vol_mv);
|
||||
|
||||
/**
|
||||
* @brief Get the temperature sensor calibration number delta_T stored in the efuse.
|
||||
|
||||
@@ -10,7 +10,7 @@ extern "C" {
|
||||
|
||||
#include "esp_efuse.h"
|
||||
|
||||
// md5_digest_table 344c54cf227f74643e4d13dce1b1d30f
|
||||
// md5_digest_table fd5a35cea89bfad954e834bc92bed385
|
||||
// This file was generated from the file esp_efuse_table.csv. DO NOT CHANGE THIS FILE MANUALLY.
|
||||
// If you want to change some fields, you need to change esp_efuse_table.csv file
|
||||
// then run `efuse_common_table` or `efuse_custom_table` command it will generate this file.
|
||||
@@ -80,6 +80,23 @@ extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_FLASH_TEMP[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_FLASH_VENDOR[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_SYS_DATA_PART1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_OPTIONAL_UNIQUE_ID[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_TEMP_CALIB[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_OCODE[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_CAL_VOL_ATTEN0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_CAL_VOL_ATTEN1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_CAL_VOL_ATTEN2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_CAL_VOL_ATTEN3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH4[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH5[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_ADC1_INIT_CODE_ATTEN0_CH6[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_BLOCK_USR_DATA[];
|
||||
#define ESP_EFUSE_WR_DIS_USER_DATA ESP_EFUSE_WR_DIS_BLOCK_USR_DATA
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_WR_DIS_CUSTOM_MAC[];
|
||||
@@ -179,6 +196,23 @@ extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_CAP[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_TEMP[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_FLASH_VENDOR[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_OPTIONAL_UNIQUE_ID[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_TEMP_CALIB[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_OCODE[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_CAL_VOL_ATTEN3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH0[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH1[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH2[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH3[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH4[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH5[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_ADC1_INIT_CODE_ATTEN0_CH6[];
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_USER_DATA[];
|
||||
#define ESP_EFUSE_BLOCK_USR_DATA ESP_EFUSE_USER_DATA
|
||||
extern const esp_efuse_desc_t* ESP_EFUSE_USER_DATA_MAC_CUSTOM[];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -12,7 +12,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
//This is the ADC calibration value version burnt in efuse
|
||||
#define ESP_EFUSE_ADC_CALIB_VER 1
|
||||
#define ESP_EFUSE_ADC_CALIB_VER 1
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MIN ESP_EFUSE_ADC_CALIB_VER
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MAX ESP_EFUSE_ADC_CALIB_VER
|
||||
|
||||
/**
|
||||
* @brief Get the RTC calibration efuse version
|
||||
|
||||
@@ -16,7 +16,9 @@ extern "C" {
|
||||
#include "sdkconfig.h"
|
||||
|
||||
//This is the ADC calibration value version burnt in efuse
|
||||
#define ESP_EFUSE_ADC_CALIB_VER 2
|
||||
#define ESP_EFUSE_ADC_CALIB_VER 2
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MIN ESP_EFUSE_ADC_CALIB_VER
|
||||
#define ESP_EFUSE_ADC_CALIB_VER_MAX ESP_EFUSE_ADC_CALIB_VER
|
||||
|
||||
#define RTCCALIB_ESP32S2_ADCCOUNT 2
|
||||
#define RTCCALIB_ESP32S2_ATTENCOUNT 4
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user