forked from espressif/esp-idf
Compare commits
475 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e70825d1e | ||
|
|
151b6d9bef | ||
|
|
c4308384d6 | ||
|
|
cc07e9d203 | ||
|
|
ab175f8845 | ||
|
|
206a844e4a | ||
|
|
bf568f2eb4 | ||
|
|
36cddd0bae | ||
|
|
13d4ab5afb | ||
|
|
4fb4c01c53 | ||
|
|
237f7eb92a | ||
|
|
5ca8851be8 | ||
|
|
b6c88b683f | ||
|
|
a8763e6517 | ||
|
|
de022501b7 | ||
|
|
0d6dd36af9 | ||
|
|
68dba56ac8 | ||
|
|
9f32f4b405 | ||
|
|
c19a01d100 | ||
|
|
2ae6eedb30 | ||
|
|
e73ad2c391 | ||
|
|
6de264be1e | ||
|
|
766eace598 | ||
|
|
1bd55a9af2 | ||
|
|
6babdfc0b7 | ||
|
|
7013d2d7c5 | ||
|
|
2d7be5c35d | ||
|
|
c9e7a04a9e | ||
|
|
5def4ad7fe | ||
|
|
3cceacc931 | ||
|
|
9df632482c | ||
|
|
46c8f40a83 | ||
|
|
6f9a7264ce | ||
|
|
72fb22ed51 | ||
|
|
cc34d5a5b0 | ||
|
|
1eaccfae4a | ||
|
|
ade22b2ae7 | ||
|
|
0e2c77b185 | ||
|
|
91ad0f9f4a | ||
|
|
70eadc0b05 | ||
|
|
49fc8c86b3 | ||
|
|
04a6ac3cf5 | ||
|
|
9fa5c14d58 | ||
|
|
cc19e1da9b | ||
|
|
96bb4c6e78 | ||
|
|
f3c3605fc2 | ||
|
|
b3d5fe849d | ||
|
|
d0d0c979bc | ||
|
|
12aa90e6a2 | ||
|
|
ccb52dea65 | ||
|
|
c9edf16376 | ||
|
|
919dbdd170 | ||
|
|
3c6f992cf0 | ||
|
|
2548168277 | ||
|
|
4b763f361d | ||
|
|
faf86f72fb | ||
|
|
a3c4b04675 | ||
|
|
a55cd0e7f3 | ||
|
|
7ab0a59bb3 | ||
|
|
bc77899fb2 | ||
|
|
67be0ae585 | ||
|
|
8246bfa8fb | ||
|
|
7d1c44fb7e | ||
|
|
56140d11ce | ||
|
|
93f151f6d4 | ||
|
|
89355c2ec0 | ||
|
|
8737c444d6 | ||
|
|
d386a22f1f | ||
|
|
bc0d116b7a | ||
|
|
e3dadfafb8 | ||
|
|
681dba4afd | ||
|
|
32387506fb | ||
|
|
94255c421d | ||
|
|
b6e9a15e81 | ||
|
|
3359e063a3 | ||
|
|
dcc4943b3d | ||
|
|
53664c80ff | ||
|
|
74b964ed67 | ||
|
|
110620a80c | ||
|
|
e454d4d8e8 | ||
|
|
6241139685 | ||
|
|
4375e60a6e | ||
|
|
26383e95fd | ||
|
|
fe5b7b549c | ||
|
|
12d639e5b2 | ||
|
|
e14c55c3ad | ||
|
|
03b3e5eff2 | ||
|
|
9d0e3501c5 | ||
|
|
c1bf7057d3 | ||
|
|
365092fb57 | ||
|
|
cee1bc9f8e | ||
|
|
18e5d35722 | ||
|
|
013b8ab34c | ||
|
|
fb2d0de8f9 | ||
|
|
a853c84db2 | ||
|
|
3aa0922221 | ||
|
|
e0b29aca15 | ||
|
|
b1a9e364bb | ||
|
|
2dfadc9657 | ||
|
|
5323c159c1 | ||
|
|
09e2a82970 | ||
|
|
2d2ccaacd8 | ||
|
|
a4bbcbcf98 | ||
|
|
7592ec77f5 | ||
|
|
2f1d050133 | ||
|
|
9b1c1f21f9 | ||
|
|
a1e0268f40 | ||
|
|
9c1d75cc5b | ||
|
|
eec53257dc | ||
|
|
a476228c8c | ||
|
|
f8113d89e7 | ||
|
|
6648127362 | ||
|
|
817efe8aa2 | ||
|
|
a0eb61e8a8 | ||
|
|
4f41c77665 | ||
|
|
fdceac415b | ||
|
|
5599d05f87 | ||
|
|
f41e536f06 | ||
|
|
4f0ee78558 | ||
|
|
d12048bcea | ||
|
|
fcc9db267d | ||
|
|
9b67208b14 | ||
|
|
91f0fcc3b3 | ||
|
|
f88a04aa3e | ||
|
|
cf6f1e8246 | ||
|
|
79445f4234 | ||
|
|
bdc586bb52 | ||
|
|
46b1608f44 | ||
|
|
2118af0163 | ||
|
|
0dec21cfda | ||
|
|
2eb4374a5b | ||
|
|
a41443184e | ||
|
|
8c3cefca81 | ||
|
|
ec222a2dff | ||
|
|
72e7978f89 | ||
|
|
e9894d6efc | ||
|
|
8c72cc5749 | ||
|
|
a590348af2 | ||
|
|
79dff0ef12 | ||
|
|
aafe7f73f5 | ||
|
|
fd348b7bd8 | ||
|
|
350f23c9bd | ||
|
|
91b9310714 | ||
|
|
2da1db9726 | ||
|
|
2718fdbd95 | ||
|
|
a03b9c7465 | ||
|
|
f972606763 | ||
|
|
925f93614c | ||
|
|
b19671e0d4 | ||
|
|
c38bf3534e | ||
|
|
46bfd878da | ||
|
|
1de51a2cbe | ||
|
|
f6e1a12b34 | ||
|
|
b81ae0873a | ||
|
|
07387fbd29 | ||
|
|
3386cb5400 | ||
|
|
556f194b94 | ||
|
|
b19d054407 | ||
|
|
f8151b2bfe | ||
|
|
d3cc7c0daf | ||
|
|
552eb63ec4 | ||
|
|
a025eeaf5b | ||
|
|
faf23c095c | ||
|
|
5e9746bffa | ||
|
|
8be372a1fd | ||
|
|
006f2c0b3a | ||
|
|
3ab801e27e | ||
|
|
613ba4c015 | ||
|
|
f4a1a186a6 | ||
|
|
9c3d2b4f70 | ||
|
|
b4383d609f | ||
|
|
30779731ea | ||
|
|
106f165899 | ||
|
|
68791163b2 | ||
|
|
53752db908 | ||
|
|
a8b974f245 | ||
|
|
8b44275fbf | ||
|
|
367c3c09cc | ||
|
|
2b6021cc31 | ||
|
|
5187d64c34 | ||
|
|
927c4afa5b | ||
|
|
a63b5d155f | ||
|
|
da656f0345 | ||
|
|
431080faa1 | ||
|
|
78d7e214d6 | ||
|
|
64df5e111e | ||
|
|
852c79c76d | ||
|
|
92242d5d13 | ||
|
|
e28c5127c2 | ||
|
|
9a44c290f6 | ||
|
|
e284ff818b | ||
|
|
6ace6fbd85 | ||
|
|
c5e37c7073 | ||
|
|
531416d95f | ||
|
|
611c0c3897 | ||
|
|
2befd5c9ee | ||
|
|
99c4aee0ac | ||
|
|
ae94784d4c | ||
|
|
3063679f5a | ||
|
|
f335bfdea7 | ||
|
|
2b44bc47df | ||
|
|
012ff5775b | ||
|
|
b2a1de4d62 | ||
|
|
4712d675f7 | ||
|
|
4cde39ee42 | ||
|
|
36f0728254 | ||
|
|
37aac8314e | ||
|
|
a4f872c181 | ||
|
|
45329c2fdc | ||
|
|
09b8979987 | ||
|
|
9945c2fdcd | ||
|
|
afb8064a29 | ||
|
|
1a657c255c | ||
|
|
c5d79efcc5 | ||
|
|
83184631a4 | ||
|
|
c3571e97cb | ||
|
|
e395d14c59 | ||
|
|
54c1882b99 | ||
|
|
0cf891785e | ||
|
|
1d70441bdc | ||
|
|
2c96976b13 | ||
|
|
a109f7de57 | ||
|
|
db8bcc60f9 | ||
|
|
62f9b975ac | ||
|
|
71b29fac71 | ||
|
|
b764454e52 | ||
|
|
de9fd03b3e | ||
|
|
97dba89daf | ||
|
|
88cf7ed87e | ||
|
|
82f1be5e5a | ||
|
|
ce9ec29737 | ||
|
|
7b73cf613c | ||
|
|
a980a1780a | ||
|
|
762a9fe83f | ||
|
|
d071cd11c8 | ||
|
|
659ccfa999 | ||
|
|
781bd398dc | ||
|
|
876ac4e963 | ||
|
|
6231961683 | ||
|
|
32ec2750e0 | ||
|
|
a0c14f46ba | ||
|
|
9926a12943 | ||
|
|
143d26aa49 | ||
|
|
e1eabe6f6a | ||
|
|
0407ab426e | ||
|
|
bcbc4a9599 | ||
|
|
50737018cc | ||
|
|
19913cec43 | ||
|
|
bf80d8211e | ||
|
|
46a7409965 | ||
|
|
7d26cf16cc | ||
|
|
86c4d8737e | ||
|
|
3ceae811be | ||
|
|
8977e92b4c | ||
|
|
42b2524776 | ||
|
|
8ffe0ff357 | ||
|
|
faf96bd108 | ||
|
|
97b43b4054 | ||
|
|
8225cc75df | ||
|
|
0d6cae963b | ||
|
|
3a94beeb5b | ||
|
|
29f6537faf | ||
|
|
160f435e4d | ||
|
|
51d2d9041c | ||
|
|
5a6ac7f32f | ||
|
|
40d5f61c4d | ||
|
|
b7a9f5e115 | ||
|
|
0f3f7d984a | ||
|
|
efdddbb253 | ||
|
|
ce9c7e4f79 | ||
|
|
66c0699411 | ||
|
|
646c851824 | ||
|
|
51a49a861a | ||
|
|
9b34085053 | ||
|
|
0f7dc2ec02 | ||
|
|
2e341f003a | ||
|
|
c375ddc823 | ||
|
|
92c8fd24bb | ||
|
|
2aa255c875 | ||
|
|
5a3af62f44 | ||
|
|
bc1d87a846 | ||
|
|
d65086d8ab | ||
|
|
71d0d08c4e | ||
|
|
0caa96584c | ||
|
|
5d4cd1269b | ||
|
|
6e1eb21bae | ||
|
|
0d1c490a7c | ||
|
|
dbd2cd2f7a | ||
|
|
34b14ddf5b | ||
|
|
9592346090 | ||
|
|
696d6867b4 | ||
|
|
f52b877199 | ||
|
|
a179125fd3 | ||
|
|
1dd8411e04 | ||
|
|
e6a71fe29c | ||
|
|
efe8490623 | ||
|
|
a29f30b5d3 | ||
|
|
c570e253fe | ||
|
|
7b7f597cb4 | ||
|
|
3a5249aea9 | ||
|
|
28c19e623f | ||
|
|
cabe66195c | ||
|
|
f0855c85ad | ||
|
|
569334267f | ||
|
|
9911823658 | ||
|
|
b90f32bffb | ||
|
|
20db198401 | ||
|
|
bf877941c4 | ||
|
|
f9a51fc784 | ||
|
|
aa09462685 | ||
|
|
365c336a98 | ||
|
|
95c768165f | ||
|
|
12f2ae47c6 | ||
|
|
fc6b44f500 | ||
|
|
0042aaafa1 | ||
|
|
adcf95dc9f | ||
|
|
e5ee10e89f | ||
|
|
c9f1cb2f4c | ||
|
|
a0c8de077b | ||
|
|
9e62340897 | ||
|
|
f451efd1d0 | ||
|
|
f490eda68c | ||
|
|
f2dfb0cf70 | ||
|
|
03aef3c087 | ||
|
|
9a6526554d | ||
|
|
8d4e1c0616 | ||
|
|
4e27cbb89f | ||
|
|
b51f89d827 | ||
|
|
e30c7a9b27 | ||
|
|
622842a983 | ||
|
|
2bcb02795e | ||
|
|
fd22441494 | ||
|
|
8f048ffddc | ||
|
|
3e3ce3da81 | ||
|
|
0a0f2caa1d | ||
|
|
2441858835 | ||
|
|
3545b58986 | ||
|
|
9f10f684d3 | ||
|
|
5d750fb8ce | ||
|
|
6f8f39a2e5 | ||
|
|
6c60d3ef29 | ||
|
|
ecaf8a7a61 | ||
|
|
7ef60d2c2b | ||
|
|
e524b4b1fd | ||
|
|
40cce58a52 | ||
|
|
c50d44e66e | ||
|
|
07a3eca372 | ||
|
|
626684578a | ||
|
|
5ba3b8c587 | ||
|
|
c286416762 | ||
|
|
fd1c127d34 | ||
|
|
b5aa65c136 | ||
|
|
61486620c7 | ||
|
|
396f477972 | ||
|
|
2165154c04 | ||
|
|
46e918cfa1 | ||
|
|
051d2fbdd5 | ||
|
|
41f91d3ef6 | ||
|
|
ffce53449b | ||
|
|
7314f44b13 | ||
|
|
4936110591 | ||
|
|
af9472bb7a | ||
|
|
d190c53ec8 | ||
|
|
26c6583bab | ||
|
|
b3720f80c7 | ||
|
|
8147d48ec8 | ||
|
|
8466b8d6d3 | ||
|
|
6e47143dc5 | ||
|
|
10c882764e | ||
|
|
4559434d5a | ||
|
|
25f837a148 | ||
|
|
53e295a616 | ||
|
|
156ffa412e | ||
|
|
7726102bfb | ||
|
|
8c74a4a989 | ||
|
|
48bd2152d0 | ||
|
|
7db01c954e | ||
|
|
d90868b42e | ||
|
|
7d60a78b31 | ||
|
|
23a8cbb247 | ||
|
|
f3fd849da1 | ||
|
|
7a2bd81870 | ||
|
|
2b6f7697b9 | ||
|
|
610b5579a7 | ||
|
|
15a9d4f4d3 | ||
|
|
65e9af5114 | ||
|
|
579cbd8229 | ||
|
|
2b84f3e6c4 | ||
|
|
10732770d3 | ||
|
|
f2c10cb443 | ||
|
|
c67b02db52 | ||
|
|
dc4c16f475 | ||
|
|
3f2bf11751 | ||
|
|
b1f264be69 | ||
|
|
d14f2c5fca | ||
|
|
35898c704f | ||
|
|
3564d6728c | ||
|
|
c5b1b57b09 | ||
|
|
fbd38ad19a | ||
|
|
2d5ee438fa | ||
|
|
46b12a560a | ||
|
|
f19bc120f1 | ||
|
|
9c87165bc8 | ||
|
|
6514820311 | ||
|
|
0af56e2815 | ||
|
|
a06b88d7f6 | ||
|
|
5e292d50ad | ||
|
|
321ecc94d3 | ||
|
|
f0f30f9d0c | ||
|
|
9ea662a4ba | ||
|
|
285925a43b | ||
|
|
9e51598ee7 | ||
|
|
5e321badd5 | ||
|
|
e943181f72 | ||
|
|
2dc98f3be8 | ||
|
|
3badf6ebd9 | ||
|
|
9a1b11c813 | ||
|
|
b933d851bf | ||
|
|
204b58a34c | ||
|
|
88c9506469 | ||
|
|
202664bac0 | ||
|
|
0500fa2344 | ||
|
|
fefc65f885 | ||
|
|
d7e257d8ba | ||
|
|
ca3df7de7f | ||
|
|
8849d6acfa | ||
|
|
e8e5410cef | ||
|
|
cc68a512d2 | ||
|
|
3a291da164 | ||
|
|
1173b4f51a | ||
|
|
f6d0a913de | ||
|
|
149171f119 | ||
|
|
94091761c4 | ||
|
|
262f3774e8 | ||
|
|
30f93365b5 | ||
|
|
e0748cdaf2 | ||
|
|
6cd6423092 | ||
|
|
38b1c93764 | ||
|
|
9f3f7009c0 | ||
|
|
69d8fab619 | ||
|
|
cc50d88a89 | ||
|
|
4aea2dce15 | ||
|
|
54c7379060 | ||
|
|
b12c2646fa | ||
|
|
39ac9cb44b | ||
|
|
64fbce50c2 | ||
|
|
d1e8b4473d | ||
|
|
38e2d3bec6 | ||
|
|
2192de7111 | ||
|
|
c7f4fb56d8 | ||
|
|
3201333f06 | ||
|
|
85a89db863 | ||
|
|
21a8a9a170 | ||
|
|
0ce9d2662d | ||
|
|
d4e13c011e | ||
|
|
f380d72825 | ||
|
|
3451f3526f | ||
|
|
1aa2f36dec | ||
|
|
cfd7a5b84e | ||
|
|
cf2062f1d7 | ||
|
|
a742bad8f3 | ||
|
|
8fa409a0b5 | ||
|
|
2e9904556f | ||
|
|
8e32eb78a4 | ||
|
|
a3adc6c202 | ||
|
|
7b3bedbc10 | ||
|
|
02068cf328 | ||
|
|
e8a4e70c42 | ||
|
|
b9f2531e8c | ||
|
|
b6e6a4f4b2 | ||
|
|
9420c5398f | ||
|
|
31c8be0738 | ||
|
|
cbc438c807 | ||
|
|
0e022b7db9 | ||
|
|
c763b8089c |
135
.gitlab-ci.yml
135
.gitlab-ci.yml
@@ -53,6 +53,11 @@ variables:
|
||||
.apply_bot_filter: &apply_bot_filter
|
||||
python $APPLY_BOT_FILTER_SCRIPT || exit 0
|
||||
|
||||
.setup_tools_unless_target_test: &setup_tools_unless_target_test |
|
||||
if [[ "$SETUP_TOOLS" == "1" || "$CI_JOB_STAGE" != "target_test" ]]; then
|
||||
tools/idf_tools.py --non-interactive install && eval "$(tools/idf_tools.py --non-interactive export)" || exit 1
|
||||
fi
|
||||
|
||||
before_script:
|
||||
- source tools/ci/setup_python.sh
|
||||
- *git_clean_stale_submodules
|
||||
@@ -65,6 +70,8 @@ before_script:
|
||||
- base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
|
||||
- chmod 600 ~/.ssh/id_rsa
|
||||
- echo -e "Host gitlab.espressif.cn\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
||||
# Download and install tools, if needed
|
||||
- *setup_tools_unless_target_test
|
||||
|
||||
# Set IS_PRIVATE or IS_PUBLIC depending on if our branch is public or not
|
||||
#
|
||||
@@ -122,11 +129,11 @@ build_template_app:
|
||||
# Set the variable for 'esp-idf-template' testing
|
||||
- ESP_IDF_TEMPLATE_GIT=${ESP_IDF_TEMPLATE_GIT:-"https://github.com/espressif/esp-idf-template.git"}
|
||||
- git clone ${ESP_IDF_TEMPLATE_GIT}
|
||||
- cd esp-idf-template
|
||||
# Try to use the same branch name for esp-idf-template that we're
|
||||
# using on esp-idf. If it doesn't exist then just stick to the default
|
||||
# branch
|
||||
- python $CHECKOUT_REF_SCRIPT esp-idf-template
|
||||
- python $CHECKOUT_REF_SCRIPT esp-idf-template esp-idf-template
|
||||
- cd esp-idf-template
|
||||
- make defconfig
|
||||
# Test debug build (default)
|
||||
- make all V=1
|
||||
@@ -166,8 +173,8 @@ build_ssc:
|
||||
- $BOT_LABEL_REGULAR_TEST
|
||||
script:
|
||||
- git clone $SSC_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT SSC SSC
|
||||
- cd SSC
|
||||
- python $CHECKOUT_REF_SCRIPT SSC
|
||||
- MAKEFLAGS= ./ci_build_ssc.sh
|
||||
|
||||
.build_esp_idf_unit_test_template: &build_esp_idf_unit_test_template
|
||||
@@ -176,7 +183,7 @@ build_ssc:
|
||||
paths:
|
||||
- tools/unit-test-app/output
|
||||
- components/idf_test/unit_test/TestCaseAll.yml
|
||||
expire_in: 2 days
|
||||
expire_in: 4 days
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
@@ -230,7 +237,7 @@ build_examples_make:
|
||||
- build_examples/*/*/*/build/download.config
|
||||
- build_examples/*/*/*/build/bootloader/*.bin
|
||||
- $LOG_PATH
|
||||
expire_in: 2 days
|
||||
expire_in: 4 days
|
||||
variables:
|
||||
LOG_PATH: "$CI_PROJECT_DIR/log_examples_make"
|
||||
only:
|
||||
@@ -264,7 +271,7 @@ build_examples_cmake:
|
||||
- build_examples_cmake/*/*/*/build/flasher_args.json
|
||||
- build_examples_cmake/*/*/*/build/bootloader/*.bin
|
||||
- $LOG_PATH
|
||||
expire_in: 2 days
|
||||
expire_in: 4 days
|
||||
variables:
|
||||
LOG_PATH: "$CI_PROJECT_DIR/log_examples_cmake"
|
||||
only:
|
||||
@@ -303,7 +310,7 @@ build_docs:
|
||||
- docs/zh_CN/sphinx-warning-log.txt
|
||||
- docs/zh_CN/sphinx-warning-log-sanitized.txt
|
||||
- docs/zh_CN/_build/html
|
||||
expire_in: 1 day
|
||||
expire_in: 4 days
|
||||
only:
|
||||
variables:
|
||||
- $BOT_TRIGGER_WITH_LABEL == null
|
||||
@@ -341,6 +348,29 @@ verify_cmake_style:
|
||||
script:
|
||||
tools/cmake/run_cmake_lint.sh
|
||||
|
||||
build_docker:
|
||||
stage: build
|
||||
image: espressif/docker-builder:1
|
||||
tags:
|
||||
- build_docker_amd64_brno
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
- /^release\/v/
|
||||
- /^v\d+\.\d+(\.\d+)?($|-)/
|
||||
- schedules
|
||||
variables:
|
||||
DOCKER_TMP_IMAGE_NAME: "idf_tmp_image"
|
||||
before_script: []
|
||||
script:
|
||||
- export DOCKER_BUILD_ARGS="--build-arg IDF_CLONE_URL=${CI_REPOSITORY_URL} --build-arg IDF_CLONE_BRANCH_OR_TAG=${CI_COMMIT_REF_NAME} --build-arg IDF_CHECKOUT_REF=${CI_COMMIT_TAG:-$CI_COMMIT_SHA}"
|
||||
# Build
|
||||
- docker build --tag ${DOCKER_TMP_IMAGE_NAME} ${DOCKER_BUILD_ARGS} tools/docker/
|
||||
# We can't mount $PWD/examples/get-started/blink into the container, see https://gitlab.com/gitlab-org/gitlab-ce/issues/41227.
|
||||
# The workaround mentioned there works, but leaves around directories which need to be cleaned up manually.
|
||||
# Therefore, build a copy of the example located inside the container.
|
||||
- docker run --rm --workdir /opt/esp/idf/examples/get-started/blink ${DOCKER_TMP_IMAGE_NAME} idf.py build
|
||||
|
||||
.host_test_template: &host_test_template
|
||||
stage: host_test
|
||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
|
||||
@@ -589,6 +619,7 @@ deploy_docs:
|
||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
|
||||
tags:
|
||||
- deploy
|
||||
- shiny
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
@@ -779,8 +810,8 @@ assign_test:
|
||||
- python $TEST_FW_PATH/CIAssignUnitTest.py $IDF_PATH/components/idf_test/unit_test/TestCaseAll.yml $IDF_PATH/.gitlab-ci.yml $IDF_PATH/components/idf_test/unit_test/CIConfigs
|
||||
# clone test script to assign tests
|
||||
- git clone $TEST_SCRIPT_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script
|
||||
# assgin integration test cases
|
||||
- python CIAssignTestCases.py -t $IDF_PATH/components/idf_test/integration_test -c $IDF_PATH/.gitlab-ci.yml -b $IDF_PATH/SSC/ssc_bin
|
||||
|
||||
@@ -825,8 +856,7 @@ assign_test:
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
# clone test env configs
|
||||
- git clone $TEST_ENV_CONFIG_REPOSITORY
|
||||
- cd ci-test-runner-configs
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
- cd $TEST_FW_PATH
|
||||
# run test
|
||||
- python Runner.py $TEST_CASE_PATH -c $CONFIG_FILE -e $ENV_FILE
|
||||
@@ -889,12 +919,12 @@ assign_test:
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
# clone local test env configs
|
||||
- git clone $TEST_ENV_CONFIG_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
- cd ci-test-runner-configs
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
|
||||
# clone test bench
|
||||
- git clone $TEST_SCRIPT_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script
|
||||
# run test
|
||||
- python CIRunner.py -l "$LOG_PATH/$JOG_FULL_NAME" -c $CONFIG_FILE -e $LOCAL_ENV_CONFIG_PATH -t $TEST_CASE_FILE_PATH
|
||||
|
||||
@@ -915,12 +945,12 @@ nvs_compatible_test:
|
||||
- test -e $CONFIG_FILE || exit 0
|
||||
# clone local test env configs
|
||||
- git clone $TEST_ENV_CONFIG_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs ci-test-runner-configs
|
||||
- cd ci-test-runner-configs
|
||||
- python $CHECKOUT_REF_SCRIPT ci-test-runner-configs
|
||||
# clone test bench
|
||||
- git clone $TEST_SCRIPT_REPOSITORY
|
||||
- python $CHECKOUT_REF_SCRIPT auto_test_script auto_test_script
|
||||
- cd auto_test_script
|
||||
- git checkout ${CI_COMMIT_REF_NAME} || echo "Using default branch..."
|
||||
# prepare nvs bins
|
||||
- ./Tools/prepare_nvs_bin.sh
|
||||
# run test
|
||||
@@ -928,7 +958,7 @@ nvs_compatible_test:
|
||||
|
||||
example_test_001:
|
||||
<<: *example_test_template
|
||||
parallel: 2
|
||||
parallel: 3
|
||||
tags:
|
||||
- ESP32
|
||||
- Example_WIFI
|
||||
@@ -946,11 +976,17 @@ example_test_002:
|
||||
- ESP32
|
||||
- Example_SDIO
|
||||
|
||||
example_test_004:
|
||||
example_test_004A:
|
||||
<<: *example_test_template
|
||||
tags:
|
||||
- ESP32
|
||||
- Example_CAN
|
||||
- Example_CAN1
|
||||
|
||||
example_test_004B:
|
||||
<<: *example_test_template
|
||||
tags:
|
||||
- ESP32
|
||||
- Example_CAN2
|
||||
|
||||
example_test_005:
|
||||
<<: *example_test_template
|
||||
@@ -1193,6 +1229,71 @@ UT_031:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
|
||||
UT_032:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
- psram
|
||||
|
||||
UT_033:
|
||||
extends: .unit_test_template
|
||||
parallel: 2
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_PSRAMV0
|
||||
- psram
|
||||
|
||||
UT_034:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_no32kXTAL
|
||||
|
||||
UT_035:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_no32kXTAL
|
||||
|
||||
UT_036:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_no32kXTAL
|
||||
|
||||
UT_037:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_no32kXTAL
|
||||
- psram
|
||||
|
||||
UT_038:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_32kXTAL
|
||||
|
||||
UT_039:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_32kXTAL
|
||||
|
||||
UT_040:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_32kXTAL
|
||||
|
||||
UT_041:
|
||||
<<: *unit_test_template
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_32kXTAL
|
||||
- psram
|
||||
|
||||
IT_001:
|
||||
<<: *test_template
|
||||
parallel: 3
|
||||
|
||||
4
.gitmodules
vendored
4
.gitmodules
vendored
@@ -69,3 +69,7 @@
|
||||
[submodule "examples/build_system/cmake/import_lib/main/lib/tinyxml2"]
|
||||
path = examples/build_system/cmake/import_lib/main/lib/tinyxml2
|
||||
url = https://github.com/leethomason/tinyxml2
|
||||
|
||||
[submodule "components/nimble/nimble"]
|
||||
path = components/nimble/nimble
|
||||
url = https://github.com/espressif/esp-nimble.git
|
||||
|
||||
118
CMakeLists.txt
118
CMakeLists.txt
@@ -1,108 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(esp-idf C CXX ASM)
|
||||
|
||||
if(NOT IDF_PATH)
|
||||
set(IDF_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
endif()
|
||||
|
||||
include(tools/cmake/idf_functions.cmake)
|
||||
|
||||
#
|
||||
# Set variables that control the build configuration and the build itself
|
||||
#
|
||||
idf_set_variables()
|
||||
|
||||
kconfig_set_variables()
|
||||
|
||||
#
|
||||
# Generate a component dependencies file, enumerating components to be included in the build
|
||||
# as well as their dependencies.
|
||||
#
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}"
|
||||
-D "COMPONENTS=${IDF_COMPONENTS}"
|
||||
-D "COMPONENT_REQUIRES_COMMON=${IDF_COMPONENT_REQUIRES_COMMON}"
|
||||
-D "EXCLUDE_COMPONENTS=${IDF_EXCLUDE_COMPONENTS}"
|
||||
-D "TEST_COMPONENTS=${IDF_TEST_COMPONENTS}"
|
||||
-D "TEST_EXCLUDE_COMPONENTS=${IDF_TEST_EXCLUDE_COMPONENTS}"
|
||||
-D "BUILD_TESTS=${IDF_BUILD_TESTS}"
|
||||
-D "DEPENDENCIES_FILE=${CMAKE_BINARY_DIR}/component_depends.cmake"
|
||||
-D "COMPONENT_DIRS=${IDF_COMPONENT_DIRS}"
|
||||
-D "BOOTLOADER_BUILD=${BOOTLOADER_BUILD}"
|
||||
-D "IDF_TARGET=${IDF_TARGET}"
|
||||
-D "IDF_PATH=${IDF_PATH}"
|
||||
-D "DEBUG=${DEBUG}"
|
||||
-P "${IDF_PATH}/tools/cmake/scripts/expand_requirements.cmake"
|
||||
WORKING_DIRECTORY "${PROJECT_PATH}"
|
||||
RESULT_VARIABLE expand_requirements_result)
|
||||
|
||||
if(expand_requirements_result)
|
||||
message(FATAL_ERROR "Failed to expand component requirements")
|
||||
endif()
|
||||
|
||||
include("${CMAKE_BINARY_DIR}/component_depends.cmake")
|
||||
|
||||
#
|
||||
# We now have the following component-related variables:
|
||||
#
|
||||
# IDF_COMPONENTS is the list of initial components set by the user
|
||||
# (or empty to include all components in the build).
|
||||
# BUILD_COMPONENTS is the list of components to include in the build.
|
||||
# BUILD_COMPONENT_PATHS is the paths to all of these components, obtained from the component dependencies file.
|
||||
#
|
||||
# Print the list of found components and test components
|
||||
#
|
||||
string(REPLACE ";" " " BUILD_COMPONENTS_SPACES "${BUILD_COMPONENTS}")
|
||||
message(STATUS "Component names: ${BUILD_COMPONENTS_SPACES}")
|
||||
unset(BUILD_COMPONENTS_SPACES)
|
||||
message(STATUS "Component paths: ${BUILD_COMPONENT_PATHS}")
|
||||
|
||||
# Print list of test components
|
||||
if(TESTS_ALL EQUAL 1 OR TEST_COMPONENTS)
|
||||
string(REPLACE ";" " " BUILD_TEST_COMPONENTS_SPACES "${BUILD_TEST_COMPONENTS}")
|
||||
message(STATUS "Test component names: ${BUILD_TEST_COMPONENTS_SPACES}")
|
||||
unset(BUILD_TEST_COMPONENTS_SPACES)
|
||||
message(STATUS "Test component paths: ${BUILD_TEST_COMPONENT_PATHS}")
|
||||
endif()
|
||||
|
||||
# Generate project configuration
|
||||
kconfig_process_config()
|
||||
|
||||
# Include sdkconfig.cmake so rest of the build knows the configuration
|
||||
include(${SDKCONFIG_CMAKE})
|
||||
|
||||
# Verify the environment is configured correctly
|
||||
idf_verify_environment()
|
||||
|
||||
# Check git revision (may trigger reruns of cmake)
|
||||
## sets IDF_VER to IDF git revision
|
||||
idf_get_git_revision()
|
||||
|
||||
# Check that the targets set in cache, sdkconfig, and in environment all match
|
||||
idf_check_config_target()
|
||||
|
||||
## get PROJECT_VER
|
||||
if(NOT BOOTLOADER_BUILD)
|
||||
app_get_revision("${CMAKE_SOURCE_DIR}")
|
||||
endif()
|
||||
|
||||
# Add some idf-wide definitions
|
||||
idf_set_global_compile_options()
|
||||
|
||||
# generate compile_commands.json (needs to come after project)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
||||
|
||||
#
|
||||
# Setup variables for linker script generation
|
||||
#
|
||||
ldgen_set_variables()
|
||||
|
||||
# Include any top-level project_include.cmake files from components
|
||||
foreach(component ${BUILD_COMPONENT_PATHS})
|
||||
set(COMPONENT_PATH "${component}")
|
||||
include_if_exists("${component}/project_include.cmake")
|
||||
unset(COMPONENT_PATH)
|
||||
endforeach()
|
||||
|
||||
#
|
||||
# Add each component to the build as a library
|
||||
#
|
||||
@@ -144,18 +42,4 @@ foreach(component ${BUILD_COMPONENTS})
|
||||
add_component_dependencies(${component_target} ${dep_target} PRIVATE)
|
||||
endforeach()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(IDF_BUILD_ARTIFACTS)
|
||||
# Write project description JSON file
|
||||
make_json_list("${BUILD_COMPONENTS}" build_components_json)
|
||||
make_json_list("${BUILD_COMPONENT_PATHS}" build_component_paths_json)
|
||||
configure_file("${IDF_PATH}/tools/cmake/project_description.json.in"
|
||||
"${IDF_BUILD_ARTIFACTS_DIR}/project_description.json")
|
||||
unset(build_components_json)
|
||||
unset(build_component_paths_json)
|
||||
endif()
|
||||
|
||||
set(BUILD_COMPONENTS ${BUILD_COMPONENTS} PARENT_SCOPE)
|
||||
|
||||
ldgen_add_dependencies()
|
||||
endforeach()
|
||||
4
Kconfig
4
Kconfig
@@ -23,6 +23,10 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
||||
default "IDF_TARGET_NOT_SET" if IDF_TARGET_ENV=""
|
||||
default IDF_TARGET_ENV
|
||||
|
||||
config IDF_FIRMWARE_CHIP_ID
|
||||
hex
|
||||
default 0x0000 if IDF_TARGET="esp32"
|
||||
default 0xFFFF
|
||||
|
||||
menu "SDK tool configuration"
|
||||
config TOOLPREFIX
|
||||
|
||||
66
SUPPORT_POLICY.md
Normal file
66
SUPPORT_POLICY.md
Normal file
@@ -0,0 +1,66 @@
|
||||
The latest support policy for ESP-IDF can be found at [https://github.com/espressif/esp-idf/blob/master/SUPPORT_POLICY.md](https://github.com/espressif/esp-idf/blob/master/SUPPORT_POLICY.md)
|
||||
|
||||
Support Period Policy
|
||||
=====================
|
||||
|
||||
Each ESP-IDF major and minor release (V4.0, V4.1, etc) is supported for
|
||||
18 months after the initial stable release date.
|
||||
|
||||
Supported means that the ESP-IDF team will continue to apply bug fixes,
|
||||
security fixes, etc to the release branch on GitHub, and periodically
|
||||
make new bugfix releases as needed.
|
||||
|
||||
Users are encouraged to upgrade to a newer ESP-IDF release before the
|
||||
support period finishes and the release becomes End of Life (EOL). It is
|
||||
our policy to not continue fixing bugs in End of Life releases.
|
||||
|
||||
Pre-release versions (betas, previews, `-rc` and `-dev` versions, etc)
|
||||
are not covered by any support period. Sometimes a particular feature is
|
||||
marked as \"Preview\" in a release, which means it is also not covered
|
||||
by the support period.
|
||||
|
||||
The ESP-IDF Programming Guide has information about the
|
||||
[different versions of ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/latest/versions.html)
|
||||
(major, minor, bugfix, etc).
|
||||
|
||||
Long Term Support releases
|
||||
--------------------------
|
||||
|
||||
Some releases (starting with ESP-IDF V3.3) are designated Long Term
|
||||
Support (LTS). LTS releases are supported for 30 months (2.5 years)
|
||||
after the initial stable release date.
|
||||
|
||||
A new LTS release will be made at least every 18 months. This means
|
||||
there will always be a period of at least 12 months to upgrade from the
|
||||
previous LTS release to the following LTS release.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
ESP-IDF V3.3 was released in September 2019 and is a Long Term Support
|
||||
(LTS) release, meaning it will be supported for 30 months until February
|
||||
2022.
|
||||
|
||||
- The first V3.3 release was `v3.3` in September 2019.
|
||||
- The ESP-IDF team continues to backport bug fixes, security fixes,
|
||||
etc to the release branch `release/v3.3`.
|
||||
- Periodically stable bugfix releases are created from the release
|
||||
branch. For example `v3.3.1`, `v3.3.2`, etc. Users are encouraged to
|
||||
always update to the latest bugfix release.
|
||||
- V3.3 bugfix releases continue until February 2022, when all V3.3.x
|
||||
releases become End of Life.
|
||||
|
||||
Existing Releases
|
||||
-----------------
|
||||
|
||||
ESP-IDF release V3.3 and all newer releases will follow this support
|
||||
period policy. The support period for each release will be announced
|
||||
when the release is made.
|
||||
|
||||
For releases made before the support period policy was announced,
|
||||
the following support periods apply:
|
||||
|
||||
- ESP-IDF V3.1.x and V3.2.x will both be supported until October 2020.
|
||||
- ESP-IDF V3.0.9 (planned for October 2019) will be the last V3.0
|
||||
bugfix release. ESP-IDF V3.0.x is End of Life from October 2019.
|
||||
- ESP-IDF versions before V3.0 are already End of Life.
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "esp_efuse.h"
|
||||
|
||||
|
||||
#define SUB_TYPE_ID(i) (i & 0x0F)
|
||||
#define SUB_TYPE_ID(i) (i & 0x0F)
|
||||
|
||||
typedef struct ota_ops_entry_ {
|
||||
uint32_t handle;
|
||||
@@ -208,7 +208,7 @@ esp_err_t esp_ota_write(esp_ota_handle_t handle, const void *data, size_t size)
|
||||
// must erase the partition before writing to it
|
||||
assert(it->erased_size > 0 && "must erase the partition before writing to it");
|
||||
if (it->wrote_size == 0 && it->partial_bytes == 0 && size > 0 && data_bytes[0] != ESP_IMAGE_HEADER_MAGIC) {
|
||||
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x", data_bytes[0]);
|
||||
ESP_LOGE(TAG, "OTA image has invalid magic byte (expected 0xE9, saw 0x%02x)", data_bytes[0]);
|
||||
return ESP_ERR_OTA_VALIDATE_FAILED;
|
||||
}
|
||||
|
||||
|
||||
@@ -443,7 +443,7 @@ static void test_flow4(void)
|
||||
// 2 Stage: run factory -> check it -> copy factory to OTA0 -> reboot --//--
|
||||
// 3 Stage: run OTA0 -> check it -> set_pin_factory_reset -> reboot --//--
|
||||
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, sets pin_factory_reset, factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow4, test_flow4, test_flow4);
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, sets pin_factory_reset, factory", "[app_update][timeout=90][ignore][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow4, test_flow4, test_flow4);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOOTLOADER_APP_TEST
|
||||
@@ -486,7 +486,7 @@ static void test_flow5(void)
|
||||
// 2 Stage: run factory -> check it -> copy factory to Test and set pin_test_app -> reboot --//--
|
||||
// 3 Stage: run test -> check it -> reset pin_test_app -> reboot --//--
|
||||
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, test, factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow5, test_flow5, test_flow5);
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, test, factory", "[app_update][timeout=90][ignore][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow5, test_flow5, test_flow5);
|
||||
#endif
|
||||
|
||||
static const esp_partition_t* app_update(void)
|
||||
|
||||
@@ -223,6 +223,7 @@ endmenu # Bootloader
|
||||
|
||||
|
||||
menu "Security features"
|
||||
visible if !IDF_CMAKE
|
||||
|
||||
# These three are the actual options to check in code,
|
||||
# selected by the displayed options
|
||||
@@ -505,4 +506,22 @@ menu "Security features"
|
||||
Only set this option in testing environments.
|
||||
|
||||
endmenu # Potentially Insecure
|
||||
|
||||
config FLASH_ENCRYPTION_DISABLE_PLAINTEXT
|
||||
bool "Disable serial reflashing of plaintext firmware"
|
||||
depends on FLASH_ENCRYPTION_ENABLED
|
||||
default y if SECURE_BOOT_ENABLED
|
||||
default n if !SECURE_BOOT_ENABLED
|
||||
help
|
||||
If this option is enabled, flash encryption is permanently enabled after first boot by write-protecting
|
||||
the FLASH_CRYPT_CNT efuse. This is the recommended configuration for a secure production system.
|
||||
|
||||
If this option is disabled, FLASH_CRYPT_CNT is left writeable and up to 4 plaintext re-flashes are allowed.
|
||||
An attacker with physical access will be able to read out encrypted flash contents until all plaintext
|
||||
re-flashes have been used up.
|
||||
|
||||
If this option is disabled and hardware Secure Boot is enabled, Secure Boot must be configured in
|
||||
Reflashable mode so that a new Secure Boot digest can be flashed at the same time as plaintext firmware.
|
||||
This combination is not secure and should not be used for a production system.
|
||||
|
||||
endmenu # Security features
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "bootloader_common.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_image_format.h"
|
||||
#include "rom/rtc.h"
|
||||
|
||||
static const char* TAG = "boot";
|
||||
|
||||
@@ -74,7 +75,8 @@ static int selected_boot_partition(const bootloader_state_t *bs)
|
||||
int boot_index = bootloader_utility_get_selected_boot_partition(bs);
|
||||
if (boot_index == INVALID_INDEX) {
|
||||
return boot_index; // Unrecoverable failure (not due to corrupt ota data or bad partition contents)
|
||||
} else {
|
||||
}
|
||||
if (rtc_get_reset_reason(0) != DEEPSLEEP_RESET) {
|
||||
// Factory firmware.
|
||||
#ifdef CONFIG_BOOTLOADER_FACTORY_RESET
|
||||
if (bootloader_common_check_long_hold_gpio(CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET, CONFIG_BOOTLOADER_HOLD_TIME_GPIO) == 1) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
set(COMPONENT_SRCS "src/bootloader_clock.c"
|
||||
"src/bootloader_common.c"
|
||||
"src/bootloader_flash.c"
|
||||
"src/bootloader_flash_config.c"
|
||||
"src/bootloader_random.c"
|
||||
"src/bootloader_sha.c"
|
||||
"src/bootloader_utility.c"
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#pragma once
|
||||
#include "esp_flash_data_types.h"
|
||||
#include "esp_image_format.h"
|
||||
#include "esp_image_format.h"
|
||||
|
||||
/// Type of hold a GPIO in low state
|
||||
typedef enum {
|
||||
@@ -23,6 +24,11 @@ typedef enum {
|
||||
GPIO_NOT_HOLD = 0 /*!< If the GPIO input is not low */
|
||||
} esp_comm_gpio_hold_t;
|
||||
|
||||
typedef enum {
|
||||
ESP_IMAGE_BOOTLOADER,
|
||||
ESP_IMAGE_APPLICATION
|
||||
} esp_image_type;
|
||||
|
||||
/**
|
||||
* @brief Calculate crc for the OTA data select.
|
||||
*
|
||||
@@ -125,7 +131,7 @@ int bootloader_common_select_otadata(const esp_ota_select_entry_t *two_otadata,
|
||||
|
||||
/**
|
||||
* @brief Returns esp_app_desc structure for app partition. This structure includes app version.
|
||||
*
|
||||
*
|
||||
* Returns a description for the requested app partition.
|
||||
* @param[in] partition App partition description.
|
||||
* @param[out] app_desc Structure of info about app.
|
||||
@@ -137,15 +143,25 @@ int bootloader_common_select_otadata(const esp_ota_select_entry_t *two_otadata,
|
||||
*/
|
||||
esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t *partition, esp_app_desc_t *app_desc);
|
||||
|
||||
/**
|
||||
* @brief Get chip revision
|
||||
*
|
||||
* @return Chip revision number
|
||||
*/
|
||||
uint8_t bootloader_common_get_chip_revision(void);
|
||||
|
||||
/**
|
||||
* @brief Check if the image (bootloader and application) has valid chip ID and revision
|
||||
*
|
||||
* @param[in] img_hdr: image header
|
||||
* @param[in] type: image type, bootloader or application
|
||||
* @return
|
||||
* - ESP_OK: image and chip are matched well
|
||||
* - ESP_FAIL: image doesn't match to the chip
|
||||
*/
|
||||
esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hdr, esp_image_type type);
|
||||
|
||||
/**
|
||||
* @brief Configure VDDSDIO, call this API to rise VDDSDIO to 1.9V when VDDSDIO regulator is enabled as 1.8V mode.
|
||||
*/
|
||||
void bootloader_common_vddsdio_configure();
|
||||
|
||||
/**
|
||||
* @brief Set the flash CS setup and hold time.
|
||||
*
|
||||
* CS setup time is recomemded to be 1.5T, and CS hold time is recommended to be 2.5T.
|
||||
* cs_setup = 1, cs_setup_time = 0; cs_hold = 1, cs_hold_time = 1
|
||||
*/
|
||||
void bootloader_common_set_flash_cs_timing();
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esp_image_format.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Update the flash id in g_rom_flashchip(global esp_rom_spiflash_chip_t structure).
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
void bootloader_flash_update_id();
|
||||
|
||||
/**
|
||||
* @brief Set the flash CS setup and hold time.
|
||||
*
|
||||
* @note CS setup time is recomemded to be 1.5T, and CS hold time is recommended to be 2.5T.
|
||||
* cs_setup = 1, cs_setup_time = 0; cs_hold = 1, cs_hold_time = 1.
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
void bootloader_flash_cs_timing_config();
|
||||
|
||||
/**
|
||||
* @brief Configure SPI flash clock.
|
||||
*
|
||||
* @note This function only set clock frequency for SPI0.
|
||||
*
|
||||
* @param pfhdr Pointer to App image header, from where to fetch flash settings.
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
void bootloader_flash_clock_config(const esp_image_header_t* pfhdr);
|
||||
|
||||
/**
|
||||
* @brief Configure SPI flash gpio, include the IO matrix and drive strength configuration.
|
||||
*
|
||||
* @param pfhdr Pointer to App image header, from where to fetch flash settings.
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
void bootloader_flash_gpio_config(const esp_image_header_t* pfhdr);
|
||||
|
||||
/**
|
||||
* @brief Configure SPI flash read dummy based on different mode and frequency.
|
||||
*
|
||||
* @param pfhdr Pointer to App image header, from where to fetch flash settings.
|
||||
*
|
||||
* @return None
|
||||
*/
|
||||
void bootloader_flash_dummy_config(const esp_image_header_t* pfhdr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -55,6 +55,19 @@ typedef enum {
|
||||
|
||||
#define ESP_IMAGE_HEADER_MAGIC 0xE9
|
||||
|
||||
/**
|
||||
* @brief ESP chip ID
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
ESP_CHIP_ID_ESP32 = 0x0000, /*!< chip ID: ESP32 */
|
||||
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;
|
||||
|
||||
/** @cond */
|
||||
_Static_assert(sizeof(esp_chip_id_t) == 2, "esp_chip_id_t should be 16 bit");
|
||||
/** @endcond */
|
||||
|
||||
/* Main header of binary image */
|
||||
typedef struct {
|
||||
uint8_t magic;
|
||||
@@ -71,8 +84,9 @@ typedef struct {
|
||||
uint8_t wp_pin;
|
||||
/* Drive settings for the SPI flash pins (read by ROM bootloader) */
|
||||
uint8_t spi_pin_drv[3];
|
||||
/* Reserved bytes in ESP32 additional header space, currently unused */
|
||||
uint8_t reserved[11];
|
||||
esp_chip_id_t chip_id; /*!< Chip identification number */
|
||||
uint8_t min_chip_rev; /*!< Minimum chip revision supported by image */
|
||||
uint8_t reserved[8]; /*!< Reserved bytes in additional header space, currently unused */
|
||||
/* If 1, a SHA256 digest "simple hash" (of the entire image) is appended after the checksum. Included in image length. This digest
|
||||
* is separate to secure boot and only used for detecting corruption. For secure boot signed images, the signature
|
||||
* is appended after this (and the simple hash is included in the signed data). */
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "soc/spi_reg.h"
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "soc/apb_ctrl_reg.h"
|
||||
#include "esp_image_format.h"
|
||||
#include "bootloader_sha.h"
|
||||
#include "sys/param.h"
|
||||
@@ -276,12 +278,50 @@ void bootloader_common_vddsdio_configure()
|
||||
#endif // CONFIG_BOOTLOADER_VDDSDIO_BOOST
|
||||
}
|
||||
|
||||
void bootloader_common_set_flash_cs_timing()
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
uint8_t bootloader_common_get_chip_revision(void)
|
||||
{
|
||||
SET_PERI_REG_MASK(SPI_USER_REG(0), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
|
||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_HOLD_TIME_V, 1, SPI_HOLD_TIME_S);
|
||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
|
||||
SET_PERI_REG_MASK(SPI_USER_REG(1), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
|
||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_HOLD_TIME_V, 1, SPI_HOLD_TIME_S);
|
||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
|
||||
uint8_t eco_bit0, eco_bit1, eco_bit2;
|
||||
eco_bit0 = (REG_READ(EFUSE_BLK0_RDATA3_REG) & 0xF000) >> 15;
|
||||
eco_bit1 = (REG_READ(EFUSE_BLK0_RDATA5_REG) & 0x100000) >> 20;
|
||||
eco_bit2 = (REG_READ(APB_CTRL_DATE_REG) & 0x80000000) >> 31;
|
||||
uint32_t combine_value = (eco_bit2 << 2) | (eco_bit1 << 1) | eco_bit0;
|
||||
uint8_t chip_ver = 0;
|
||||
switch (combine_value) {
|
||||
case 0:
|
||||
chip_ver = 0;
|
||||
break;
|
||||
case 1:
|
||||
chip_ver = 1;
|
||||
break;
|
||||
case 3:
|
||||
chip_ver = 2;
|
||||
break;
|
||||
case 7:
|
||||
chip_ver = 3;
|
||||
break;
|
||||
default:
|
||||
chip_ver = 0;
|
||||
break;
|
||||
}
|
||||
return chip_ver;
|
||||
}
|
||||
#endif
|
||||
|
||||
esp_err_t bootloader_common_check_chip_validity(const esp_image_header_t* img_hdr, esp_image_type type)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
esp_chip_id_t chip_id = CONFIG_IDF_FIRMWARE_CHIP_ID;
|
||||
if (chip_id != img_hdr->chip_id) {
|
||||
ESP_LOGE(TAG, "mismatch chip ID, expected %d, found %d", chip_id, img_hdr->chip_id);
|
||||
err = ESP_FAIL;
|
||||
}
|
||||
uint8_t revision = bootloader_common_get_chip_revision();
|
||||
if (revision < img_hdr->min_chip_rev) {
|
||||
ESP_LOGE(TAG, "can't run on lower chip revision, expected %d, found %d", revision, img_hdr->min_chip_rev);
|
||||
err = ESP_FAIL;
|
||||
} else if (revision != img_hdr->min_chip_rev) {
|
||||
ESP_LOGI(TAG, "chip revision: %d, min. %s chip revision: %d", revision, type == ESP_IMAGE_BOOTLOADER ? "bootloader" : "application", img_hdr->min_chip_rev);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
165
components/bootloader_support/src/bootloader_flash_config.c
Normal file
165
components/bootloader_support/src/bootloader_flash_config.c
Normal file
@@ -0,0 +1,165 @@
|
||||
// Copyright 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include "string.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "rom/gpio.h"
|
||||
#include "rom/spi_flash.h"
|
||||
#include "rom/efuse.h"
|
||||
#include "soc/gpio_periph.h"
|
||||
#include "soc/efuse_reg.h"
|
||||
#include "soc/spi_reg.h"
|
||||
#include "soc/spi_pins.h"
|
||||
#include "flash_qio_mode.h"
|
||||
#include "bootloader_flash_config.h"
|
||||
|
||||
void bootloader_flash_update_id()
|
||||
{
|
||||
g_rom_flashchip.device_id = bootloader_read_flash_id();
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_flash_cs_timing_config()
|
||||
{
|
||||
SET_PERI_REG_MASK(SPI_USER_REG(0), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
|
||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_HOLD_TIME_V, 1, SPI_HOLD_TIME_S);
|
||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(0), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
|
||||
SET_PERI_REG_MASK(SPI_USER_REG(1), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
|
||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_HOLD_TIME_V, 1, SPI_HOLD_TIME_S);
|
||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(1), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_flash_clock_config(const esp_image_header_t* pfhdr)
|
||||
{
|
||||
uint32_t spi_clk_div = 0;
|
||||
switch (pfhdr->spi_speed) {
|
||||
case ESP_IMAGE_SPI_SPEED_80M:
|
||||
spi_clk_div = 1;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_40M:
|
||||
spi_clk_div = 2;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_26M:
|
||||
spi_clk_div = 3;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_20M:
|
||||
spi_clk_div = 4;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
esp_rom_spiflash_config_clk(spi_clk_div, 0);
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_flash_gpio_config(const esp_image_header_t* pfhdr)
|
||||
{
|
||||
uint32_t drv = 2;
|
||||
if (pfhdr->spi_speed == ESP_IMAGE_SPI_SPEED_80M) {
|
||||
drv = 3;
|
||||
}
|
||||
|
||||
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
|
||||
uint32_t pkg_ver = chip_ver & 0x7;
|
||||
|
||||
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) {
|
||||
// For ESP32D2WD the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) {
|
||||
// For ESP32PICOD2 the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
|
||||
// For ESP32PICOD4 the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else {
|
||||
const uint32_t spiconfig = ets_efuse_get_spiconfig();
|
||||
if (spiconfig == EFUSE_SPICONFIG_SPI_DEFAULTS) {
|
||||
gpio_matrix_out(SPI_IOMUX_PIN_NUM_CS, SPICS0_OUT_IDX, 0, 0);
|
||||
gpio_matrix_out(SPI_IOMUX_PIN_NUM_MISO, SPIQ_OUT_IDX, 0, 0);
|
||||
gpio_matrix_in(SPI_IOMUX_PIN_NUM_MISO, SPIQ_IN_IDX, 0);
|
||||
gpio_matrix_out(SPI_IOMUX_PIN_NUM_MOSI, SPID_OUT_IDX, 0, 0);
|
||||
gpio_matrix_in(SPI_IOMUX_PIN_NUM_MOSI, SPID_IN_IDX, 0);
|
||||
gpio_matrix_out(SPI_IOMUX_PIN_NUM_WP, SPIWP_OUT_IDX, 0, 0);
|
||||
gpio_matrix_in(SPI_IOMUX_PIN_NUM_WP, SPIWP_IN_IDX, 0);
|
||||
gpio_matrix_out(SPI_IOMUX_PIN_NUM_HD, SPIHD_OUT_IDX, 0, 0);
|
||||
gpio_matrix_in(SPI_IOMUX_PIN_NUM_HD, SPIHD_IN_IDX, 0);
|
||||
//select pin function gpio
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
|
||||
// flash clock signal should come from IO MUX.
|
||||
// set drive ability for clock
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
|
||||
uint32_t flash_id = g_rom_flashchip.device_id;
|
||||
if (flash_id == FLASH_ID_GD25LQ32C) {
|
||||
// Set drive ability for 1.8v flash in 80Mhz.
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA0_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA1_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA2_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA3_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CMD_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IRAM_ATTR bootloader_flash_dummy_config(const esp_image_header_t* pfhdr)
|
||||
{
|
||||
int spi_cache_dummy = 0;
|
||||
uint32_t modebit = READ_PERI_REG(SPI_CTRL_REG(0));
|
||||
if (modebit & SPI_FASTRD_MODE) {
|
||||
if (modebit & SPI_FREAD_QIO) { //SPI mode is QIO
|
||||
spi_cache_dummy = SPI0_R_QIO_DUMMY_CYCLELEN;
|
||||
} else if (modebit & SPI_FREAD_DIO) { //SPI mode is DIO
|
||||
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN;
|
||||
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_ADDR_BITLEN_V, SPI0_R_DIO_ADDR_BITSLEN, SPI_USR_ADDR_BITLEN_S);
|
||||
} else if(modebit & (SPI_FREAD_QUAD | SPI_FREAD_DUAL)) { //SPI mode is QOUT or DIO
|
||||
spi_cache_dummy = SPI0_R_FAST_DUMMY_CYCLELEN;
|
||||
}
|
||||
}
|
||||
|
||||
extern uint8_t g_rom_spiflash_dummy_len_plus[];
|
||||
switch (pfhdr->spi_speed) {
|
||||
case ESP_IMAGE_SPI_SPEED_80M:
|
||||
g_rom_spiflash_dummy_len_plus[0] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_80M;
|
||||
g_rom_spiflash_dummy_len_plus[1] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_80M;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_40M:
|
||||
g_rom_spiflash_dummy_len_plus[0] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_40M;
|
||||
g_rom_spiflash_dummy_len_plus[1] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_40M;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_26M:
|
||||
case ESP_IMAGE_SPI_SPEED_20M:
|
||||
g_rom_spiflash_dummy_len_plus[0] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_20M;
|
||||
g_rom_spiflash_dummy_len_plus[1] = ESP_ROM_SPIFLASH_DUMMY_LEN_PLUS_20M;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + g_rom_spiflash_dummy_len_plus[0],
|
||||
SPI_USR_DUMMY_CYCLELEN_S);
|
||||
}
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "bootloader_config.h"
|
||||
#include "bootloader_clock.h"
|
||||
#include "bootloader_common.h"
|
||||
#include "bootloader_flash_config.h"
|
||||
|
||||
#include "flash_qio_mode.h"
|
||||
|
||||
@@ -62,7 +63,7 @@ static const char* TAG = "boot";
|
||||
static esp_err_t bootloader_main();
|
||||
static void print_flash_info(const esp_image_header_t* pfhdr);
|
||||
static void update_flash_config(const esp_image_header_t* pfhdr);
|
||||
static void flash_gpio_configure(const esp_image_header_t* pfhdr);
|
||||
static void bootloader_init_flash_configure(const esp_image_header_t* pfhdr);
|
||||
static void uart_console_configure(void);
|
||||
static void wdt_reset_check(void);
|
||||
|
||||
@@ -125,7 +126,15 @@ static esp_err_t bootloader_main()
|
||||
ESP_LOGE(TAG, "failed to load bootloader header!");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
flash_gpio_configure(&fhdr);
|
||||
|
||||
/* Check chip ID and minimum chip revision that supported by this image */
|
||||
uint8_t revision = bootloader_common_get_chip_revision();
|
||||
ESP_LOGI(TAG, "Chip Revision: %d", revision);
|
||||
if (bootloader_common_check_chip_validity(&fhdr, ESP_IMAGE_BOOTLOADER) != ESP_OK) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
bootloader_init_flash_configure(&fhdr);
|
||||
#if (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ == 240)
|
||||
//Check if ESP32 is rated for a CPU frequency of 160MHz only
|
||||
if (REG_GET_BIT(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_CPU_FREQ_RATED) &&
|
||||
@@ -285,121 +294,15 @@ static void print_flash_info(const esp_image_header_t* phdr)
|
||||
#endif
|
||||
}
|
||||
|
||||
#define FLASH_CLK_IO 6
|
||||
#define FLASH_CS_IO 11
|
||||
#define FLASH_SPIQ_IO 7
|
||||
#define FLASH_SPID_IO 8
|
||||
#define FLASH_SPIWP_IO 10
|
||||
#define FLASH_SPIHD_IO 9
|
||||
#define FLASH_IO_MATRIX_DUMMY_40M 1
|
||||
#define FLASH_IO_MATRIX_DUMMY_80M 2
|
||||
#define FLASH_IO_DRIVE_GD_WITH_1V8PSRAM 3
|
||||
|
||||
/*
|
||||
* Bootloader reads SPI configuration from bin header, so that
|
||||
* the burning configuration can be different with compiling configuration.
|
||||
*/
|
||||
static void IRAM_ATTR flash_gpio_configure(const esp_image_header_t* pfhdr)
|
||||
static void IRAM_ATTR bootloader_init_flash_configure(const esp_image_header_t* pfhdr)
|
||||
{
|
||||
int spi_cache_dummy = 0;
|
||||
int drv = 2;
|
||||
switch (pfhdr->spi_mode) {
|
||||
case ESP_IMAGE_SPI_MODE_QIO:
|
||||
spi_cache_dummy = SPI0_R_QIO_DUMMY_CYCLELEN;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_DIO:
|
||||
spi_cache_dummy = SPI0_R_DIO_DUMMY_CYCLELEN;
|
||||
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_ADDR_BITLEN_V, SPI0_R_DIO_ADDR_BITSLEN, SPI_USR_ADDR_BITLEN_S);
|
||||
break;
|
||||
case ESP_IMAGE_SPI_MODE_QOUT:
|
||||
case ESP_IMAGE_SPI_MODE_DOUT:
|
||||
default:
|
||||
spi_cache_dummy = SPI0_R_FAST_DUMMY_CYCLELEN;
|
||||
break;
|
||||
}
|
||||
|
||||
/* dummy_len_plus values defined in ROM for SPI flash configuration */
|
||||
extern uint8_t g_rom_spiflash_dummy_len_plus[];
|
||||
switch (pfhdr->spi_speed) {
|
||||
case ESP_IMAGE_SPI_SPEED_80M:
|
||||
g_rom_spiflash_dummy_len_plus[0] = FLASH_IO_MATRIX_DUMMY_80M;
|
||||
g_rom_spiflash_dummy_len_plus[1] = FLASH_IO_MATRIX_DUMMY_80M;
|
||||
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + FLASH_IO_MATRIX_DUMMY_80M,
|
||||
SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
|
||||
drv = 3;
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_40M:
|
||||
g_rom_spiflash_dummy_len_plus[0] = FLASH_IO_MATRIX_DUMMY_40M;
|
||||
g_rom_spiflash_dummy_len_plus[1] = FLASH_IO_MATRIX_DUMMY_40M;
|
||||
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy + FLASH_IO_MATRIX_DUMMY_40M,
|
||||
SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
|
||||
break;
|
||||
case ESP_IMAGE_SPI_SPEED_26M:
|
||||
case ESP_IMAGE_SPI_SPEED_20M:
|
||||
SET_PERI_REG_BITS(SPI_USER1_REG(0), SPI_USR_DUMMY_CYCLELEN_V, spi_cache_dummy, SPI_USR_DUMMY_CYCLELEN_S); //DUMMY
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
|
||||
uint32_t pkg_ver = chip_ver & 0x7;
|
||||
|
||||
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) {
|
||||
// For ESP32D2WD the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) {
|
||||
// For ESP32PICOD2 the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
|
||||
// For ESP32PICOD4 the SPI pins are already configured
|
||||
// flash clock signal should come from IO MUX.
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
} else {
|
||||
const uint32_t spiconfig = ets_efuse_get_spiconfig();
|
||||
if (spiconfig == EFUSE_SPICONFIG_SPI_DEFAULTS) {
|
||||
gpio_matrix_out(FLASH_CS_IO, SPICS0_OUT_IDX, 0, 0);
|
||||
gpio_matrix_out(FLASH_SPIQ_IO, SPIQ_OUT_IDX, 0, 0);
|
||||
gpio_matrix_in(FLASH_SPIQ_IO, SPIQ_IN_IDX, 0);
|
||||
gpio_matrix_out(FLASH_SPID_IO, SPID_OUT_IDX, 0, 0);
|
||||
gpio_matrix_in(FLASH_SPID_IO, SPID_IN_IDX, 0);
|
||||
gpio_matrix_out(FLASH_SPIWP_IO, SPIWP_OUT_IDX, 0, 0);
|
||||
gpio_matrix_in(FLASH_SPIWP_IO, SPIWP_IN_IDX, 0);
|
||||
gpio_matrix_out(FLASH_SPIHD_IO, SPIHD_OUT_IDX, 0, 0);
|
||||
gpio_matrix_in(FLASH_SPIHD_IO, SPIHD_IN_IDX, 0);
|
||||
//select pin function gpio
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA0_U, PIN_FUNC_GPIO);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA1_U, PIN_FUNC_GPIO);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA2_U, PIN_FUNC_GPIO);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_DATA3_U, PIN_FUNC_GPIO);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CMD_U, PIN_FUNC_GPIO);
|
||||
// flash clock signal should come from IO MUX.
|
||||
// set drive ability for clock
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_SD_CLK_U, FUNC_SD_CLK_SPICLK);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, drv, FUN_DRV_S);
|
||||
|
||||
#if CONFIG_SPIRAM_TYPE_ESPPSRAM32
|
||||
uint32_t flash_id = g_rom_flashchip.device_id;
|
||||
if (flash_id == FLASH_ID_GD25LQ32C) {
|
||||
// Set drive ability for 1.8v flash in 80Mhz.
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA0_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA1_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA2_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_DATA3_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CMD_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
SET_PERI_REG_BITS(PERIPHS_IO_MUX_SD_CLK_U, FUN_DRV, 3, FUN_DRV_S);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// improve the flash cs timing.
|
||||
bootloader_common_set_flash_cs_timing();
|
||||
bootloader_flash_gpio_config(pfhdr);
|
||||
bootloader_flash_dummy_config(pfhdr);
|
||||
bootloader_flash_cs_timing_config();
|
||||
}
|
||||
|
||||
static void uart_console_configure(void)
|
||||
|
||||
@@ -114,17 +114,18 @@ void bootloader_random_enable(void)
|
||||
|
||||
void bootloader_random_disable(void)
|
||||
{
|
||||
/* Disable i2s clock */
|
||||
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN);
|
||||
|
||||
|
||||
/* Reset some i2s configuration (possibly redundant as we reset entire
|
||||
I2S peripheral further down). */
|
||||
CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START);
|
||||
SET_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_RESET);
|
||||
CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_RESET);
|
||||
CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_CAMERA_EN);
|
||||
CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_LCD_EN);
|
||||
CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE_TEST_EN);
|
||||
CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE);
|
||||
CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START);
|
||||
|
||||
/* Disable i2s clock */
|
||||
DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN);
|
||||
|
||||
/* Restore SYSCON mode registers */
|
||||
CLEAR_PERI_REG_MASK(SENS_SAR_READ_CTRL_REG, SENS_SAR1_DIG_FORCE);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <bootloader_random.h>
|
||||
#include <bootloader_sha.h>
|
||||
#include "bootloader_util.h"
|
||||
#include "bootloader_common.h"
|
||||
|
||||
/* Checking signatures as part of verifying images is necessary:
|
||||
- Always if secure boot is enabled
|
||||
@@ -280,6 +281,9 @@ static esp_err_t verify_image_header(uint32_t src_addr, const esp_image_header_t
|
||||
}
|
||||
err = ESP_ERR_IMAGE_INVALID;
|
||||
}
|
||||
if (bootloader_common_check_chip_validity(image, ESP_IMAGE_APPLICATION) != ESP_OK) {
|
||||
err = ESP_ERR_IMAGE_INVALID;
|
||||
}
|
||||
if (!silent) {
|
||||
if (image->spi_mode > ESP_IMAGE_SPI_MODE_SLOW_READ) {
|
||||
ESP_LOGW(TAG, "image at 0x%x has invalid SPI mode %d", src_addr, image->spi_mode);
|
||||
|
||||
@@ -205,6 +205,14 @@ static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_cry
|
||||
uint32_t new_flash_crypt_cnt = flash_crypt_cnt + (1 << (ffs_inv - 1));
|
||||
ESP_LOGD(TAG, "FLASH_CRYPT_CNT 0x%x -> 0x%x", flash_crypt_cnt, new_flash_crypt_cnt);
|
||||
REG_SET_FIELD(EFUSE_BLK0_WDATA0_REG, EFUSE_FLASH_CRYPT_CNT, new_flash_crypt_cnt);
|
||||
|
||||
#ifdef CONFIG_FLASH_ENCRYPTION_DISABLE_PLAINTEXT
|
||||
ESP_LOGI(TAG, "Write protecting FLASH_CRYPT_CNT efuse...");
|
||||
REG_SET_BIT(EFUSE_BLK0_WDATA0_REG, EFUSE_WR_DIS_FLASH_CRYPT_CNT);
|
||||
#else
|
||||
ESP_LOGW(TAG, "Not disabling FLASH_CRYPT_CNT - plaintext flashing is still possible");
|
||||
#endif
|
||||
|
||||
esp_efuse_burn_new_values();
|
||||
|
||||
ESP_LOGI(TAG, "Flash encryption completed");
|
||||
|
||||
@@ -6,6 +6,8 @@ if(CONFIG_BT_ENABLED)
|
||||
if(CONFIG_BLUEDROID_ENABLED)
|
||||
|
||||
list(APPEND COMPONENT_PRIV_INCLUDEDIRS
|
||||
common/btc/include
|
||||
common/include
|
||||
bluedroid/bta/include
|
||||
bluedroid/bta/ar/include
|
||||
bluedroid/bta/av/include
|
||||
@@ -18,7 +20,6 @@ if(CONFIG_BT_ENABLED)
|
||||
bluedroid/bta/sys/include
|
||||
bluedroid/device/include
|
||||
bluedroid/hci/include
|
||||
bluedroid/osi/include
|
||||
bluedroid/external/sbc/decoder/include
|
||||
bluedroid/external/sbc/encoder/include
|
||||
bluedroid/btc/profile/esp/blufi/include
|
||||
@@ -38,11 +39,29 @@ if(CONFIG_BT_ENABLED)
|
||||
bluedroid/stack/a2dp/include
|
||||
bluedroid/stack/rfcomm/include
|
||||
bluedroid/stack/include
|
||||
bluedroid/common/include)
|
||||
bluedroid/common/include
|
||||
common/btc/include
|
||||
common/include)
|
||||
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS bluedroid/api/include/api)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS bluedroid/api/include/api
|
||||
common/osi/include)
|
||||
|
||||
list(APPEND COMPONENT_SRCS "bluedroid/api/esp_a2dp_api.c"
|
||||
list(APPEND COMPONENT_SRCS "common/btc/core/btc_alarm.c"
|
||||
"common/btc/core/btc_manage.c"
|
||||
"common/btc/core/btc_task.c"
|
||||
"common/osi/alarm.c"
|
||||
"common/osi/allocator.c"
|
||||
"common/osi/buffer.c"
|
||||
"common/osi/config.c"
|
||||
"common/osi/fixed_queue.c"
|
||||
"common/osi/future.c"
|
||||
"common/osi/hash_functions.c"
|
||||
"common/osi/hash_map.c"
|
||||
"common/osi/list.c"
|
||||
"common/osi/mutex.c"
|
||||
"common/osi/osi.c"
|
||||
"common/osi/semaphore.c"
|
||||
"bluedroid/api/esp_a2dp_api.c"
|
||||
"bluedroid/api/esp_avrc_api.c"
|
||||
"bluedroid/api/esp_blufi_api.c"
|
||||
"bluedroid/api/esp_bt_device.c"
|
||||
@@ -94,6 +113,14 @@ if(CONFIG_BT_ENABLED)
|
||||
"bluedroid/bta/jv/bta_jv_api.c"
|
||||
"bluedroid/bta/jv/bta_jv_cfg.c"
|
||||
"bluedroid/bta/jv/bta_jv_main.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_act.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_api.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_at.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_cmd.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_main.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_rfc.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_sco.c"
|
||||
"bluedroid/bta/hf_client/bta_hf_client_sdp.c"
|
||||
"bluedroid/bta/sdp/bta_sdp.c"
|
||||
"bluedroid/bta/sdp/bta_sdp_act.c"
|
||||
"bluedroid/bta/sdp/bta_sdp_api.c"
|
||||
@@ -101,18 +128,15 @@ if(CONFIG_BT_ENABLED)
|
||||
"bluedroid/bta/sys/bta_sys_conn.c"
|
||||
"bluedroid/bta/sys/bta_sys_main.c"
|
||||
"bluedroid/bta/sys/utl.c"
|
||||
"bluedroid/btc/core/btc_alarm.c"
|
||||
"bluedroid/btc/core/btc_ble_storage.c"
|
||||
"bluedroid/btc/core/btc_config.c"
|
||||
"bluedroid/btc/core/btc_dev.c"
|
||||
"bluedroid/btc/core/btc_dm.c"
|
||||
"bluedroid/btc/core/btc_main.c"
|
||||
"bluedroid/btc/core/btc_manage.c"
|
||||
"bluedroid/btc/core/btc_profile_queue.c"
|
||||
"bluedroid/btc/core/btc_sec.c"
|
||||
"bluedroid/btc/core/btc_sm.c"
|
||||
"bluedroid/btc/core/btc_storage.c"
|
||||
"bluedroid/btc/core/btc_task.c"
|
||||
"bluedroid/btc/core/btc_util.c"
|
||||
"bluedroid/btc/profile/esp/blufi/blufi_prf.c"
|
||||
"bluedroid/btc/profile/esp/blufi/blufi_protocol.c"
|
||||
@@ -123,6 +147,8 @@ if(CONFIG_BT_ENABLED)
|
||||
"bluedroid/btc/profile/std/a2dp/btc_a2dp_source.c"
|
||||
"bluedroid/btc/profile/std/a2dp/btc_av.c"
|
||||
"bluedroid/btc/profile/std/avrc/btc_avrc.c"
|
||||
"bluedroid/btc/profile/std/hf_client/btc_hf_client.c"
|
||||
"bluedroid/btc/profile/std/hf_client/bta_hf_client_co.c"
|
||||
"bluedroid/btc/profile/std/gap/btc_gap_ble.c"
|
||||
"bluedroid/btc/profile/std/gap/btc_gap_bt.c"
|
||||
"bluedroid/btc/profile/std/gatt/btc_gatt_common.c"
|
||||
@@ -163,18 +189,6 @@ if(CONFIG_BT_ENABLED)
|
||||
"bluedroid/hci/packet_fragmenter.c"
|
||||
"bluedroid/main/bte_init.c"
|
||||
"bluedroid/main/bte_main.c"
|
||||
"bluedroid/osi/alarm.c"
|
||||
"bluedroid/osi/allocator.c"
|
||||
"bluedroid/osi/buffer.c"
|
||||
"bluedroid/osi/config.c"
|
||||
"bluedroid/osi/fixed_queue.c"
|
||||
"bluedroid/osi/future.c"
|
||||
"bluedroid/osi/hash_functions.c"
|
||||
"bluedroid/osi/hash_map.c"
|
||||
"bluedroid/osi/list.c"
|
||||
"bluedroid/osi/mutex.c"
|
||||
"bluedroid/osi/osi.c"
|
||||
"bluedroid/osi/semaphore.c"
|
||||
"bluedroid/stack/a2dp/a2d_api.c"
|
||||
"bluedroid/stack/a2dp/a2d_sbc.c"
|
||||
"bluedroid/stack/avct/avct_api.c"
|
||||
@@ -269,11 +283,121 @@ if(CONFIG_BT_ENABLED)
|
||||
"bluedroid/stack/smp/smp_l2c.c"
|
||||
"bluedroid/stack/smp/smp_main.c"
|
||||
"bluedroid/stack/smp/smp_utils.c")
|
||||
|
||||
if(CONFIG_BLE_MESH)
|
||||
list(APPEND COMPONENT_SRCS "esp_ble_mesh/mesh_core/bluedroid_host/mesh_bearer_adapt.c")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
if(CONFIG_BLE_MESH)
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS
|
||||
"esp_ble_mesh/mesh_common/include"
|
||||
"esp_ble_mesh/mesh_core"
|
||||
"esp_ble_mesh/mesh_core/include"
|
||||
"esp_ble_mesh/mesh_core/storage"
|
||||
"esp_ble_mesh/btc/include"
|
||||
"esp_ble_mesh/mesh_models/common/include"
|
||||
"esp_ble_mesh/mesh_models/client/include"
|
||||
"esp_ble_mesh/mesh_models/server/include"
|
||||
"esp_ble_mesh/api/core/include"
|
||||
"esp_ble_mesh/api/models/include"
|
||||
"esp_ble_mesh/api")
|
||||
|
||||
list(APPEND COMPONENT_SRCS
|
||||
"esp_ble_mesh/api/core/esp_ble_mesh_common_api.c"
|
||||
"esp_ble_mesh/api/core/esp_ble_mesh_local_data_operation_api.c"
|
||||
"esp_ble_mesh/api/core/esp_ble_mesh_low_power_api.c"
|
||||
"esp_ble_mesh/api/core/esp_ble_mesh_networking_api.c"
|
||||
"esp_ble_mesh/api/core/esp_ble_mesh_provisioning_api.c"
|
||||
"esp_ble_mesh/api/core/esp_ble_mesh_proxy_api.c"
|
||||
"esp_ble_mesh/api/models/esp_ble_mesh_config_model_api.c"
|
||||
"esp_ble_mesh/api/models/esp_ble_mesh_generic_model_api.c"
|
||||
"esp_ble_mesh/api/models/esp_ble_mesh_health_model_api.c"
|
||||
"esp_ble_mesh/api/models/esp_ble_mesh_lighting_model_api.c"
|
||||
"esp_ble_mesh/api/models/esp_ble_mesh_sensor_model_api.c"
|
||||
"esp_ble_mesh/api/models/esp_ble_mesh_time_scene_model_api.c"
|
||||
"esp_ble_mesh/btc/btc_ble_mesh_config_model.c"
|
||||
"esp_ble_mesh/btc/btc_ble_mesh_generic_model.c"
|
||||
"esp_ble_mesh/btc/btc_ble_mesh_health_model.c"
|
||||
"esp_ble_mesh/btc/btc_ble_mesh_lighting_model.c"
|
||||
"esp_ble_mesh/btc/btc_ble_mesh_prov.c"
|
||||
"esp_ble_mesh/btc/btc_ble_mesh_sensor_model.c"
|
||||
"esp_ble_mesh/btc/btc_ble_mesh_time_scene_model.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_aes_encrypt.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_atomic.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_buf.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_common.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_kernel.c"
|
||||
"esp_ble_mesh/mesh_common/mesh_util.c"
|
||||
"esp_ble_mesh/mesh_core/storage/settings_nvs.c"
|
||||
"esp_ble_mesh/mesh_core/access.c"
|
||||
"esp_ble_mesh/mesh_core/adv.c"
|
||||
"esp_ble_mesh/mesh_core/beacon.c"
|
||||
"esp_ble_mesh/mesh_core/cfg_cli.c"
|
||||
"esp_ble_mesh/mesh_core/cfg_srv.c"
|
||||
"esp_ble_mesh/mesh_core/crypto.c"
|
||||
"esp_ble_mesh/mesh_core/friend.c"
|
||||
"esp_ble_mesh/mesh_core/health_cli.c"
|
||||
"esp_ble_mesh/mesh_core/health_srv.c"
|
||||
"esp_ble_mesh/mesh_core/lpn.c"
|
||||
"esp_ble_mesh/mesh_core/main.c"
|
||||
"esp_ble_mesh/mesh_core/net.c"
|
||||
"esp_ble_mesh/mesh_core/prov.c"
|
||||
"esp_ble_mesh/mesh_core/provisioner_main.c"
|
||||
"esp_ble_mesh/mesh_core/provisioner_prov.c"
|
||||
"esp_ble_mesh/mesh_core/proxy_client.c"
|
||||
"esp_ble_mesh/mesh_core/proxy_server.c"
|
||||
"esp_ble_mesh/mesh_core/settings.c"
|
||||
"esp_ble_mesh/mesh_core/test.c"
|
||||
"esp_ble_mesh/mesh_core/transport.c"
|
||||
"esp_ble_mesh/mesh_models/client/client_common.c"
|
||||
"esp_ble_mesh/mesh_models/client/generic_client.c"
|
||||
"esp_ble_mesh/mesh_models/client/lighting_client.c"
|
||||
"esp_ble_mesh/mesh_models/client/sensor_client.c"
|
||||
"esp_ble_mesh/mesh_models/client/time_scene_client.c"
|
||||
"esp_ble_mesh/mesh_models/server/device_property.c"
|
||||
"esp_ble_mesh/mesh_models/server/generic_server.c"
|
||||
"esp_ble_mesh/mesh_models/server/lighting_server.c"
|
||||
"esp_ble_mesh/mesh_models/server/sensor_server.c"
|
||||
"esp_ble_mesh/mesh_models/server/server_common.c"
|
||||
"esp_ble_mesh/mesh_models/server/state_binding.c"
|
||||
"esp_ble_mesh/mesh_models/server/state_transition.c"
|
||||
"esp_ble_mesh/mesh_models/server/time_scene_server.c")
|
||||
endif()
|
||||
|
||||
if(CONFIG_NIMBLE_ENABLED)
|
||||
|
||||
if (CONFIG_BLE_MESH)
|
||||
list(APPEND COMPONENT_PRIV_INCLUDEDIRS
|
||||
common/btc/include
|
||||
common/include)
|
||||
|
||||
list(APPEND COMPONENT_ADD_INCLUDEDIRS common/osi/include)
|
||||
|
||||
list(APPEND COMPONENT_SRCS "esp_ble_mesh/mesh_core/nimble_host/mesh_bearer_adapt.c"
|
||||
"common/btc/core/btc_alarm.c"
|
||||
"common/btc/core/btc_manage.c"
|
||||
"common/btc/core/btc_task.c"
|
||||
"common/osi/alarm.c"
|
||||
"common/osi/allocator.c"
|
||||
"common/osi/buffer.c"
|
||||
"common/osi/config.c"
|
||||
"common/osi/fixed_queue.c"
|
||||
"common/osi/future.c"
|
||||
"common/osi/hash_functions.c"
|
||||
"common/osi/hash_map.c"
|
||||
"common/osi/list.c"
|
||||
"common/osi/mutex.c"
|
||||
"common/osi/osi.c"
|
||||
"common/osi/semaphore.c")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# requirements can't depend on config
|
||||
set(COMPONENT_PRIV_REQUIRES nvs_flash)
|
||||
set(COMPONENT_PRIV_REQUIRES nvs_flash nimble)
|
||||
|
||||
register_component()
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,7 @@
|
||||
#include "esp_bt_main.h"
|
||||
#include "esp_gap_bt_api.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc/btc_manage.h"
|
||||
#include "btc_gap_bt.h"
|
||||
#include "btc/btc_storage.h"
|
||||
|
||||
@@ -46,4 +46,13 @@ esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu)
|
||||
arg.set_mtu.mtu = mtu;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_gatt_com_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
extern uint16_t L2CA_GetFreePktBufferNum_LE(void);
|
||||
|
||||
uint16_t esp_ble_get_sendable_packets_num ()
|
||||
{
|
||||
return L2CA_GetFreePktBufferNum_LE();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -95,6 +95,10 @@ esp_err_t esp_spp_connect(esp_spp_sec_t sec_mask,
|
||||
btc_spp_args_t arg;
|
||||
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
|
||||
|
||||
if (sec_mask != ESP_SPP_SEC_NONE && sec_mask != ESP_SPP_SEC_AUTHORIZE && sec_mask != ESP_SPP_SEC_AUTHENTICATE) {
|
||||
LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only\n");
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_SPP;
|
||||
msg.act = BTC_SPP_ACT_CONNECT;
|
||||
@@ -133,6 +137,10 @@ esp_err_t esp_spp_start_srv(esp_spp_sec_t sec_mask,
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (sec_mask != ESP_SPP_SEC_NONE && sec_mask != ESP_SPP_SEC_AUTHORIZE && sec_mask != ESP_SPP_SEC_AUTHENTICATE) {
|
||||
LOG_WARN("Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only\n");
|
||||
}
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_SPP;
|
||||
msg.act = BTC_SPP_ACT_START_SRV;
|
||||
|
||||
@@ -267,14 +267,25 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
ESP_BLE_SM_PASSKEY = 0,
|
||||
/* Authentication requirements of local device */
|
||||
ESP_BLE_SM_AUTHEN_REQ_MODE,
|
||||
/* The IO capability of local device */
|
||||
ESP_BLE_SM_IOCAP_MODE,
|
||||
/* Initiator Key Distribution/Generation */
|
||||
ESP_BLE_SM_SET_INIT_KEY,
|
||||
/* Responder Key Distribution/Generation */
|
||||
ESP_BLE_SM_SET_RSP_KEY,
|
||||
/* Maximum Encryption key size to support */
|
||||
ESP_BLE_SM_MAX_KEY_SIZE,
|
||||
/* Minimum Encryption key size requirement from Peer */
|
||||
ESP_BLE_SM_MIN_KEY_SIZE,
|
||||
/* Set static Passkey */
|
||||
ESP_BLE_SM_SET_STATIC_PASSKEY,
|
||||
/* Reset static Passkey */
|
||||
ESP_BLE_SM_CLEAR_STATIC_PASSKEY,
|
||||
/* Accept only specified SMP Authentication requirement */
|
||||
ESP_BLE_SM_ONLY_ACCEPT_SPECIFIED_SEC_AUTH,
|
||||
/* Enable/Disable OOB support */
|
||||
ESP_BLE_SM_OOB_SUPPORT,
|
||||
ESP_BLE_SM_MAX_PARAM,
|
||||
} esp_ble_sm_param_t;
|
||||
@@ -589,7 +600,7 @@ typedef enum {
|
||||
typedef enum {
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR = 0, /*!< BLE advertising address , device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID, /*!< BLE mesh link ID, it is for BLE mesh, device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE, /*!< BLE mesh beacon AD type, the format is | Len | 0x2B | Beacon Type | Beacon Data | */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE, /*!< BLE mesh beacon AD type, the format is | Len | 0x2B | Beacon Type | Beacon Data | */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV, /*!< BLE mesh provisioning service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1827 | .... |` */
|
||||
ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1828 | .... |` */
|
||||
} esp_ble_duplicate_exceptional_info_type_t;
|
||||
|
||||
@@ -44,6 +44,10 @@ extern "C" {
|
||||
*/
|
||||
extern esp_err_t esp_ble_gatt_set_local_mtu (uint16_t mtu);
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
extern uint16_t esp_ble_get_sendable_packets_num (void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,7 @@ extern "C" {
|
||||
* All "ESP_GATT_UUID_xxx" is attribute types
|
||||
*/
|
||||
#define ESP_GATT_UUID_IMMEDIATE_ALERT_SVC 0x1802 /* Immediate alert Service*/
|
||||
#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803 /* Link Loss Service*/
|
||||
#define ESP_GATT_UUID_LINK_LOSS_SVC 0x1803 /* Link Loss Service*/
|
||||
#define ESP_GATT_UUID_TX_POWER_SVC 0x1804 /* TX Power Service*/
|
||||
#define ESP_GATT_UUID_CURRENT_TIME_SVC 0x1805 /* Current Time Service Service*/
|
||||
#define ESP_GATT_UUID_REF_TIME_UPDATE_SVC 0x1806 /* Reference Time Update Service*/
|
||||
@@ -68,8 +68,14 @@ extern "C" {
|
||||
#define ESP_GATT_UUID_CHAR_PRESENT_FORMAT 0x2904 /* Characteristic Presentation Format*/
|
||||
#define ESP_GATT_UUID_CHAR_AGG_FORMAT 0x2905 /* Characteristic Aggregate Format*/
|
||||
#define ESP_GATT_UUID_CHAR_VALID_RANGE 0x2906 /* Characteristic Valid Range */
|
||||
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907
|
||||
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908
|
||||
#define ESP_GATT_UUID_EXT_RPT_REF_DESCR 0x2907 /* External Report Reference */
|
||||
#define ESP_GATT_UUID_RPT_REF_DESCR 0x2908 /* Report Reference */
|
||||
#define ESP_GATT_UUID_NUM_DIGITALS_DESCR 0x2909 /* Number of Digitals */
|
||||
#define ESP_GATT_UUID_VALUE_TRIGGER_DESCR 0x290A /* Value Trigger Setting */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR 0x290B /* Environmental Sensing Configuration */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR 0x290C /* Environmental Sensing Measurement */
|
||||
#define ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR 0x290D /* Environmental Sensing Trigger Setting */
|
||||
#define ESP_GATT_UUID_TIME_TRIGGER_DESCR 0x290E /* Time Trigger Setting */
|
||||
|
||||
/* GAP Profile Attributes */
|
||||
#define ESP_GATT_UUID_GAP_DEVICE_NAME 0x2A00
|
||||
@@ -299,7 +305,7 @@ typedef enum {
|
||||
* @brief Attribute description (used to create database)
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
{
|
||||
uint16_t uuid_length; /*!< UUID length */
|
||||
uint8_t *uuid_p; /*!< UUID value */
|
||||
uint16_t perm; /*!< Attribute permission */
|
||||
@@ -348,23 +354,23 @@ typedef struct
|
||||
/**
|
||||
* @brief Gatt include service entry element
|
||||
*/
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
uint16_t start_hdl; /*!< Gatt start handle value of included service */
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included service */
|
||||
uint16_t uuid; /*!< Gatt attribute value UUID of included service */
|
||||
uint16_t start_hdl; /*!< Gatt start handle value of included service */
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included service */
|
||||
uint16_t uuid; /*!< Gatt attribute value UUID of included service */
|
||||
} esp_gatts_incl_svc_desc_t; /*!< Gatt include service entry element */
|
||||
|
||||
/**
|
||||
* @brief Gatt include 128 bit service entry element
|
||||
*/
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
|
||||
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */
|
||||
uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */
|
||||
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
|
||||
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */
|
||||
|
||||
/// Gatt attribute value
|
||||
/// Gatt attribute value
|
||||
typedef struct {
|
||||
uint8_t value[ESP_GATT_MAX_ATTR_LEN]; /*!< Gatt attribute value */
|
||||
uint16_t handle; /*!< Gatt attribute handle */
|
||||
@@ -426,8 +432,8 @@ typedef struct {
|
||||
/**
|
||||
* @brief service element
|
||||
*/
|
||||
typedef struct {
|
||||
bool is_primary; /*!< The service flag, true if the service is primary service, else is secondly service */
|
||||
typedef struct {
|
||||
bool is_primary; /*!< The service flag, true if the service is primary service, else is secondary service */
|
||||
uint16_t start_handle; /*!< The start handle of the service */
|
||||
uint16_t end_handle; /*!< The end handle of the service */
|
||||
esp_bt_uuid_t uuid; /*!< The uuid of the service */
|
||||
|
||||
@@ -30,7 +30,7 @@ typedef enum {
|
||||
ESP_SPP_NO_RESOURCE /*!< No more set pm control block */
|
||||
} esp_spp_status_t;
|
||||
|
||||
/* Security Setting Mask */
|
||||
/* Security Setting Mask, Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only.*/
|
||||
#define ESP_SPP_SEC_NONE 0x0000 /*!< No security. relate to BTA_SEC_NONE in bta/bta_api.h */
|
||||
#define ESP_SPP_SEC_AUTHORIZE 0x0001 /*!< Authorization required (only needed for out going connection ) relate to BTA_SEC_AUTHORIZE in bta/bta_api.h*/
|
||||
#define ESP_SPP_SEC_AUTHENTICATE 0x0012 /*!< Authentication required. relate to BTA_SEC_AUTHENTICATE in bta/bta_api.h*/
|
||||
@@ -229,7 +229,7 @@ esp_err_t esp_spp_start_discovery(esp_bd_addr_t bd_addr);
|
||||
* When the connection is established or failed,
|
||||
* the callback is called with ESP_SPP_OPEN_EVT.
|
||||
*
|
||||
* @param[in] sec_mask: Security Setting Mask .
|
||||
* @param[in] sec_mask: Security Setting Mask. Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only.
|
||||
* @param[in] role: Master or slave.
|
||||
* @param[in] remote_scn: Remote device bluetooth device SCN.
|
||||
* @param[in] peer_bd_addr: Remote device bluetooth device address.
|
||||
@@ -260,7 +260,7 @@ esp_err_t esp_spp_disconnect(uint32_t handle);
|
||||
* When the connection is established, the callback is called
|
||||
* with ESP_SPP_SRV_OPEN_EVT.
|
||||
*
|
||||
* @param[in] sec_mask: Security Setting Mask .
|
||||
* @param[in] sec_mask: Security Setting Mask. Security Setting Mask. Suggest to use ESP_SPP_SEC_NONE, ESP_SPP_SEC_AUTHORIZE or ESP_SPP_SEC_AUTHENTICATE only.
|
||||
* @param[in] role: Master or slave.
|
||||
* @param[in] local_scn: The specific channel you want to get.
|
||||
* If channel is 0, means get any channel.
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
|
||||
#include "bta/bta_ar_api.h"
|
||||
#endif
|
||||
#include "bta/bta_api.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants
|
||||
@@ -528,8 +529,21 @@ static void bta_av_proc_stream_evt(UINT8 handle, BD_ADDR bd_addr, UINT8 event, t
|
||||
/* look up application event */
|
||||
if ((p_data == NULL) || (p_data->hdr.err_code == 0)) {
|
||||
p_msg->hdr.event = bta_av_stream_evt_ok[event];
|
||||
if (p_msg->hdr.event == BTA_AV_STR_START_OK_EVT) {
|
||||
BTA_DmCoexEventTrigger(BTA_COEX_EVT_STREAMING_STARTED);
|
||||
} else if (p_msg->hdr.event == BTA_AV_STR_START_FAIL_EVT ||
|
||||
p_msg->hdr.event == BTA_AV_STR_SUSPEND_CFM_EVT ||
|
||||
p_msg->hdr.event == BTA_AV_STR_CLOSE_EVT) {
|
||||
BTA_DmCoexEventTrigger(BTA_COEX_EVT_STREAMING_STOPPED);
|
||||
}
|
||||
} else {
|
||||
p_msg->hdr.event = bta_av_stream_evt_fail[event];
|
||||
if (p_msg->hdr.event == BTA_AV_STR_START_FAIL_EVT ||
|
||||
p_msg->hdr.event == BTA_AV_STR_START_OK_EVT ||
|
||||
p_msg->hdr.event == BTA_AV_STR_SUSPEND_CFM_EVT ||
|
||||
p_msg->hdr.event == BTA_AV_STR_CLOSE_EVT) {
|
||||
BTA_DmCoexEventTrigger(BTA_COEX_EVT_STREAMING_STOPPED);
|
||||
}
|
||||
}
|
||||
|
||||
p_msg->initiator = FALSE;
|
||||
|
||||
@@ -40,8 +40,9 @@ const UINT32 bta_av_meta_caps_co_ids[] = {
|
||||
AVRC_CO_BROADCOM
|
||||
};
|
||||
|
||||
/* AVRCP cupported categories */
|
||||
#define BTA_AV_RC_SUPF_CT (AVRC_SUPF_CT_CAT2)
|
||||
/* AVRCP supported categories */
|
||||
#define BTA_AV_RC_SNK_SUPF_CT (AVRC_SUPF_CT_CAT1)
|
||||
#define BTA_AV_RC_SRC_SUPF_CT (AVRC_SUPF_CT_CAT2)
|
||||
|
||||
/* Added to modify
|
||||
** 1. flush timeout
|
||||
@@ -62,9 +63,11 @@ const UINT16 bta_av_audio_flush_to[] = {
|
||||
/* Note: Android doesnt support AVRC_SUPF_TG_GROUP_NAVI */
|
||||
/* Note: if AVRC_SUPF_TG_GROUP_NAVI is set, bta_av_cfg.avrc_group should be TRUE */
|
||||
#if AVRC_METADATA_INCLUDED == TRUE
|
||||
#define BTA_AV_RC_SUPF_TG (AVRC_SUPF_TG_CAT1) /* TODO: | AVRC_SUPF_TG_APP_SETTINGS) */
|
||||
#define BTA_AV_RC_SNK_SUPF_TG (AVRC_SUPF_TG_CAT2) /* TODO: | AVRC_SUPF_TG_APP_SETTINGS) */
|
||||
#define BTA_AV_RC_SRC_SUPF_TG (AVRC_SUPF_TG_CAT1) /* TODO: | AVRC_SUPF_TG_APP_SETTINGS) */
|
||||
#else
|
||||
#define BTA_AV_RC_SUPF_TG (AVRC_SUPF_TG_CAT1)
|
||||
#define BTA_AV_RC_SNK_SUPF_TG (AVRC_SUPF_TG_CAT2)
|
||||
#define BTA_AV_RC_SRC_SUPF_TG (AVRC_SUPF_TG_CAT1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -95,8 +98,10 @@ const tBTA_AV_CFG bta_av_cfg = {
|
||||
48, /* AVRCP MTU at L2CAP for control channel */
|
||||
#endif
|
||||
BTA_AV_MAX_RC_BR_MTU, /* AVRCP MTU at L2CAP for browsing channel */
|
||||
BTA_AV_RC_SUPF_CT, /* AVRCP controller categories */
|
||||
BTA_AV_RC_SUPF_TG, /* AVRCP target categories */
|
||||
BTA_AV_RC_SNK_SUPF_CT, /* AVRCP controller categories as SNK */
|
||||
BTA_AV_RC_SNK_SUPF_TG, /* AVRCP target categories as SNK */
|
||||
BTA_AV_RC_SRC_SUPF_CT, /* AVRCP controller categories as SRC */
|
||||
BTA_AV_RC_SRC_SUPF_TG, /* AVRCP target categories as SRC */
|
||||
672, /* AVDTP signaling channel MTU at L2CAP */
|
||||
BTA_AV_MAX_A2DP_MTU, /* AVDTP audio transport channel MTU at L2CAP */
|
||||
bta_av_audio_flush_to, /* AVDTP audio transport channel flush timeout */
|
||||
|
||||
@@ -571,9 +571,13 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
bta_ar_reg_avct(p_bta_av_cfg->avrc_mtu, p_bta_av_cfg->avrc_br_mtu,
|
||||
(UINT8)(bta_av_cb.sec_mask & (~BTA_SEC_AUTHORIZE)), BTA_ID_AV);
|
||||
#endif
|
||||
|
||||
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REM_CTRL_TARGET, "AV Remote Control Target\n", NULL,
|
||||
p_bta_av_cfg->avrc_tg_cat, 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);
|
||||
} 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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -707,8 +711,13 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data)
|
||||
}
|
||||
#if( defined BTA_AR_INCLUDED ) && (BTA_AR_INCLUDED == TRUE)
|
||||
/* create an SDP record as AVRC CT. */
|
||||
bta_ar_reg_avrc(UUID_SERVCLASS_AV_REMOTE_CONTROL, NULL, NULL,
|
||||
p_bta_av_cfg->avrc_ct_cat, BTA_ID_AV);
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -693,7 +693,6 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
|
||||
if (p_data->set_visibility.pair_mode != BTA_DM_IGNORE || p_data->set_visibility.conn_paired_only != BTA_DM_IGNORE) {
|
||||
BTM_SetPairableMode((BOOLEAN)(!(bta_dm_cb.disable_pair_mode)), bta_dm_cb.conn_paired_only);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -736,7 +736,7 @@ UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr )
|
||||
**
|
||||
** Description This function adds a DI record to the local SDP database.
|
||||
**
|
||||
** Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
|
||||
** Returns BTA_SUCCESS if record set successfully, otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
|
||||
@@ -1819,7 +1819,7 @@ void BTA_DmBleConfigLocalIcon(uint16_t icon)
|
||||
** p_cback: callback function associated to this adv instance.
|
||||
** p_ref: reference data pointer to this adv instance.
|
||||
**
|
||||
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
|
||||
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
|
||||
@@ -1857,7 +1857,7 @@ void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
|
||||
** Parameters inst_id: Adv instance to update the parameter.
|
||||
** p_params: pointer to the adv parameter structure.
|
||||
**
|
||||
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
|
||||
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_BleUpdateAdvInstParam (UINT8 inst_id, tBTA_BLE_ADV_PARAMS *p_params)
|
||||
@@ -1892,7 +1892,7 @@ void BTA_BleUpdateAdvInstParam (UINT8 inst_id, tBTA_BLE_ADV_PARAMS *p_params)
|
||||
** memory space can not be freed until BTA_BLE_MULTI_ADV_DATA_EVT
|
||||
** is sent to application.
|
||||
**
|
||||
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
|
||||
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
|
||||
@@ -1925,7 +1925,7 @@ void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
|
||||
**
|
||||
** Parameter inst_id: instance ID to disable.
|
||||
**
|
||||
** Returns BTA_SUCCESS if command started sucessfully; otherwise failure.
|
||||
** Returns BTA_SUCCESS if command started successfully; otherwise failure.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_BleDisableAdvInstance (UINT8 inst_id) //this function just used for vendor debug
|
||||
|
||||
@@ -228,9 +228,9 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
|
||||
{{BTA_DM_PM_NO_PREF, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* conn close */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app open */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* app close */
|
||||
{{BTA_DM_PM_SNIFF3, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */
|
||||
{{BTA_DM_PM_SNIFF, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */
|
||||
{{BTA_DM_PM_SNIFF, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff */
|
||||
{{BTA_DM_PM_NO_ACTION, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
|
||||
{{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
|
||||
{{BTA_DM_PM_RETRY, 7000 + BTA_DM_PM_SPEC_TO_OFFSET}, {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ tBTE_APPL_CFG bte_appl_cfg = {
|
||||
BTM_BLE_INITIATOR_KEY_SIZE,
|
||||
BTM_BLE_RESPONDER_KEY_SIZE,
|
||||
BTM_BLE_MAX_KEY_SIZE,
|
||||
BTM_BLE_MIN_KEY_SIZE,
|
||||
BTM_BLE_ONLY_ACCEPT_SPECIFIED_SEC_AUTH_DISABLE,
|
||||
BTM_BLE_OOB_DISABLE,
|
||||
};
|
||||
@@ -407,7 +408,7 @@ void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key)
|
||||
void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size)
|
||||
{
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
if(ble_key_size >= BTM_BLE_MIN_KEY_SIZE && ble_key_size <= BTM_BLE_MAX_KEY_SIZE) {
|
||||
if(ble_key_size >= bte_appl_cfg.ble_min_key_size && ble_key_size <= BTM_BLE_MAX_KEY_SIZE) {
|
||||
bte_appl_cfg.ble_max_key_size = ble_key_size;
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s error:Invalid key size value, key_size =%d",__func__, ble_key_size);
|
||||
@@ -415,6 +416,17 @@ void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size)
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
void bta_dm_co_ble_set_min_key_size(UINT8 ble_key_size)
|
||||
{
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
if(ble_key_size >= BTM_BLE_MIN_KEY_SIZE && ble_key_size <= bte_appl_cfg.ble_max_key_size) {
|
||||
bte_appl_cfg.ble_min_key_size = ble_key_size;
|
||||
} else {
|
||||
APPL_TRACE_ERROR("%s error:Invalid key size value, key_size =%d",__func__, ble_key_size);
|
||||
}
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
}
|
||||
|
||||
void bta_dm_co_ble_set_accept_auth_enable(UINT8 enable)
|
||||
{
|
||||
#if (SMP_INCLUDED == TRUE)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "osi/allocator.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "esp_coexist.h"
|
||||
|
||||
/*****************************************************************************
|
||||
** Constants and types
|
||||
@@ -452,3 +453,27 @@ BOOLEAN bta_dm_search_sm_execute(BT_HDR *p_msg)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void BTA_DmCoexEventTrigger(uint32_t event)
|
||||
{
|
||||
switch(event) {
|
||||
case BTA_COEX_EVT_SCAN_STARTED:
|
||||
case BTA_COEX_EVT_SCAN_STOPPED:
|
||||
case BTA_COEX_EVT_SNIFF_ENTER:
|
||||
case BTA_COEX_EVT_SNIFF_EXIT:
|
||||
case BTA_COEX_EVT_A2DP_PAUSED_ENTER:
|
||||
case BTA_COEX_EVT_A2DP_PAUSED_EXIT:
|
||||
case BTA_COEX_EVT_ACL_CONNECTED:
|
||||
case BTA_COEX_EVT_ACL_DISCONNECTED:
|
||||
break;
|
||||
case BTA_COEX_EVT_STREAMING_STARTED:
|
||||
esp_coex_status_bit_set(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_STREAMING);
|
||||
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_PAUSED);
|
||||
break;
|
||||
case BTA_COEX_EVT_STREAMING_STOPPED:
|
||||
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_STREAMING);
|
||||
esp_coex_status_bit_clear(ESP_COEX_ST_TYPE_BT, ESP_COEX_BT_ST_A2DP_PAUSED);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -745,6 +745,8 @@ void bta_gattc_conncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data)
|
||||
void bta_gattc_disconncback(tBTA_GATTC_RCB *p_rcb, tBTA_GATTC_DATA *p_data)
|
||||
{
|
||||
if (p_rcb) {
|
||||
// Clear up the notification registration information by BD_ADDR
|
||||
bta_gattc_clear_notif_registration_by_bda(p_rcb, p_data->int_conn.remote_bda);
|
||||
bta_gattc_send_disconnect_cback(p_rcb,
|
||||
p_data->int_conn.reason,
|
||||
p_data->int_conn.remote_bda,
|
||||
|
||||
@@ -76,7 +76,7 @@ void BTA_GATTC_Disable(void)
|
||||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTC module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_client_cb - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
@@ -338,13 +338,13 @@ const tBTA_GATTC_DESCRIPTOR* BTA_GATTC_GetDescriptor(UINT16 conn_id, UINT16 hand
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_service_with_uuid(conn_id, svc_uuid, db, count);
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_ALL_CHAR,
|
||||
@@ -359,7 +359,7 @@ void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_ALL_DESCRI,
|
||||
@@ -374,7 +374,7 @@ void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, tBT_UUID char_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_CHAR_BY_UUID,
|
||||
@@ -390,7 +390,7 @@ void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_han
|
||||
|
||||
void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t end_handle,
|
||||
tBT_UUID char_uuid, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_DESCRI_BY_UUID,
|
||||
@@ -405,7 +405,7 @@ void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t en
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_DESCRI_BY_HANDLE,
|
||||
@@ -420,7 +420,7 @@ void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, int *count)
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_with_opration(conn_id,
|
||||
GATT_OP_GET_INCLUDE_SVC,
|
||||
@@ -434,13 +434,13 @@ void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end
|
||||
count);
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count)
|
||||
void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_size_handle(conn_id, start_handle, end_handle, count);
|
||||
}
|
||||
|
||||
void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count)
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_db_size_with_type_handle(conn_id, type, start_handle, end_handle, char_handle, count);
|
||||
}
|
||||
@@ -459,7 +459,7 @@ void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
**
|
||||
*******************************************************************************/
|
||||
void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count)
|
||||
btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
bta_gattc_get_gatt_db(conn_id, start_handle, end_handle, db, count);
|
||||
}
|
||||
|
||||
@@ -1227,7 +1227,7 @@ tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle)
|
||||
|
||||
void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **svc_db,
|
||||
int *count)
|
||||
UINT16 *count)
|
||||
{
|
||||
const list_t* svc = bta_gattc_get_services(conn_id);
|
||||
if(!svc) {
|
||||
@@ -1301,7 +1301,7 @@ void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
||||
tBT_UUID *descr_uuid,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **char_db,
|
||||
int *count)
|
||||
UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
@@ -1666,7 +1666,7 @@ static size_t bta_gattc_get_db_size(list_t *services,
|
||||
return db_size;
|
||||
}
|
||||
|
||||
void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count)
|
||||
void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
@@ -1685,7 +1685,7 @@ void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 en
|
||||
}
|
||||
|
||||
void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count)
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
@@ -1732,7 +1732,7 @@ void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute
|
||||
static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db,
|
||||
int *count)
|
||||
UINT16 *count)
|
||||
{
|
||||
APPL_TRACE_DEBUG("%s: start_handle 0x%04x, end_handle 0x%04x",
|
||||
__func__, start_handle, end_handle);
|
||||
@@ -1880,7 +1880,7 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
|
||||
** Returns None.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count)
|
||||
void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, UINT16 *count)
|
||||
{
|
||||
tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);
|
||||
|
||||
|
||||
@@ -596,6 +596,30 @@ void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id,
|
||||
return;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_gattc_clear_notif_registration_by_bda
|
||||
**
|
||||
** Description Clear up the notification registration information by BD_ADDR.
|
||||
**
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_gattc_clear_notif_registration_by_bda(tBTA_GATTC_RCB *p_clrcb, BD_ADDR remote_bda)
|
||||
{
|
||||
if(p_clrcb == NULL) {
|
||||
return;
|
||||
}
|
||||
for (uint8_t i = 0 ; i < BTA_GATTC_NOTIF_REG_MAX; i ++) {
|
||||
if (p_clrcb->notif_reg[i].in_use &&
|
||||
!bdcmp(p_clrcb->notif_reg[i].remote_bda, remote_bda))
|
||||
{
|
||||
memset(&p_clrcb->notif_reg[i], 0, sizeof(tBTA_GATTC_NOTIF_REG));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function bta_gattc_mark_bg_conn
|
||||
|
||||
@@ -76,7 +76,7 @@ void BTA_GATTS_Disable(void)
|
||||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTS module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_cback - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
@@ -347,7 +347,7 @@ void BTA_GATTS_DeleteService(UINT16 service_id)
|
||||
** Description This function is called to start a service.
|
||||
**
|
||||
** Parameters service_id: the service ID to be started.
|
||||
** sup_transport: supported trasnport.
|
||||
** sup_transport: supported transport.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
|
||||
@@ -498,6 +498,7 @@ extern BOOLEAN bta_gattc_mark_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR_PTR rem
|
||||
extern BOOLEAN bta_gattc_check_bg_conn (tBTA_GATTC_IF client_if, BD_ADDR remote_bda, UINT8 role);
|
||||
extern UINT8 bta_gattc_num_reg_app(void);
|
||||
extern void bta_gattc_clear_notif_registration(tBTA_GATTC_SERV *p_srcb, UINT16 conn_id, UINT16 start_handle, UINT16 end_handle);
|
||||
extern void bta_gattc_clear_notif_registration_by_bda(tBTA_GATTC_RCB *p_clrcb, BD_ADDR remote_bda);
|
||||
extern tBTA_GATTC_SERV * bta_gattc_find_srvr_cache(BD_ADDR bda);
|
||||
|
||||
/* discovery functions */
|
||||
@@ -511,12 +512,12 @@ extern const tBTA_GATTC_SERVICE* bta_gattc_get_service_for_handle(UINT16 conn_id
|
||||
tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(tBTA_GATTC_SERV *p_srcb, UINT16 handle);
|
||||
extern tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic(UINT16 conn_id, UINT16 handle);
|
||||
extern tBTA_GATTC_DESCRIPTOR* bta_gattc_get_descriptor(UINT16 conn_id, UINT16 handle);
|
||||
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
|
||||
extern void bta_gattc_get_db_size_handle(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count);
|
||||
extern void bta_gattc_get_db_size_with_type_handle(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count);
|
||||
extern void bta_gattc_get_service_with_uuid(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **svc_db,
|
||||
int *count);
|
||||
UINT16 *count);
|
||||
|
||||
extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
||||
bt_gatt_get_db_op_t op,
|
||||
@@ -526,9 +527,9 @@ extern void bta_gattc_get_db_with_opration(UINT16 conn_id,
|
||||
tBT_UUID *descr_uuid,
|
||||
UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **char_db,
|
||||
int *count);
|
||||
UINT16 *count);
|
||||
|
||||
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count);
|
||||
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
|
||||
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *attr);
|
||||
|
||||
@@ -75,12 +75,12 @@ typedef struct {
|
||||
/* CIND: storage room for indicators value range and their statuses */
|
||||
static const tBTA_HF_CLIENT_INDICATOR bta_hf_client_indicators[BTA_HF_CLIENT_AT_SUPPORTED_INDICATOR_COUNT] = {
|
||||
/* name | min | max | name length - used by parser */
|
||||
{BTA_HF_CLIENT_INDICATOR_BATTERYCHG, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_BATTERYCHG)},
|
||||
{BTA_HF_CLIENT_INDICATOR_SIGNAL, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_SIGNAL)},
|
||||
{BTA_HF_CLIENT_INDICATOR_SERVICE, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_SERVICE)},
|
||||
{BTA_HF_CLIENT_INDICATOR_CALL, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_CALL)},
|
||||
{BTA_HF_CLIENT_INDICATOR_ROAM, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_ROAM)},
|
||||
{BTA_HF_CLIENT_INDICATOR_CALLSETUP, 0, 3, sizeof(BTA_HF_CLIENT_INDICATOR_CALLSETUP)},
|
||||
{BTA_HF_CLIENT_INDICATOR_SERVICE, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_SERVICE)},
|
||||
{BTA_HF_CLIENT_INDICATOR_SIGNAL, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_SIGNAL)},
|
||||
{BTA_HF_CLIENT_INDICATOR_ROAM, 0, 1, sizeof(BTA_HF_CLIENT_INDICATOR_ROAM)},
|
||||
{BTA_HF_CLIENT_INDICATOR_BATTERYCHG, 0, 5, sizeof(BTA_HF_CLIENT_INDICATOR_BATTERYCHG)},
|
||||
{BTA_HF_CLIENT_INDICATOR_CALLHELD, 0, 2, sizeof(BTA_HF_CLIENT_INDICATOR_CALLHELD)}
|
||||
};
|
||||
|
||||
@@ -94,7 +94,7 @@ UINT32 service_index = 0;
|
||||
BOOLEAN service_availability = TRUE;
|
||||
/* helper functions for handling AT commands queueing */
|
||||
|
||||
static void bta_hf_client_handle_ok();
|
||||
static void bta_hf_client_handle_ok(void);
|
||||
|
||||
static void bta_hf_client_clear_queued_at(void)
|
||||
{
|
||||
@@ -268,7 +268,7 @@ static void bta_hf_client_start_at_hold_timer(void)
|
||||
** No buffer parsing is being done here.
|
||||
*******************************************************************************/
|
||||
|
||||
static void bta_hf_client_handle_ok()
|
||||
static void bta_hf_client_handle_ok(void)
|
||||
{
|
||||
APPL_TRACE_DEBUG("%s", __FUNCTION__);
|
||||
|
||||
@@ -342,7 +342,7 @@ static void bta_hf_client_handle_error(tBTA_HF_CLIENT_AT_RESULT_TYPE type, UINT1
|
||||
bta_hf_client_send_queued_at();
|
||||
}
|
||||
|
||||
static void bta_hf_client_handle_ring()
|
||||
static void bta_hf_client_handle_ring(void)
|
||||
{
|
||||
APPL_TRACE_DEBUG("%s", __FUNCTION__);
|
||||
bta_hf_client_evt_val(BTA_HF_CLIENT_RING_INDICATION, 0);
|
||||
@@ -427,7 +427,7 @@ static void bta_hf_client_handle_ciev(UINT32 index, UINT32 value)
|
||||
|
||||
APPL_TRACE_DEBUG("%s index: %u value: %u", __FUNCTION__, index, value);
|
||||
|
||||
if (index == 0 || index > BTA_HF_CLIENT_AT_INDICATOR_COUNT) {
|
||||
if (index >= BTA_HF_CLIENT_AT_INDICATOR_COUNT) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ static void bta_hf_client_handle_ciev(UINT32 index, UINT32 value)
|
||||
service_availability = value == 0 ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
realind = bta_hf_client_cb.scb.at_cb.indicator_lookup[index - 1];
|
||||
realind = bta_hf_client_cb.scb.at_cb.indicator_lookup[index];
|
||||
|
||||
if (realind >= 0 && realind < BTA_HF_CLIENT_AT_SUPPORTED_INDICATOR_COUNT) {
|
||||
/* get the real in-array index from lookup table by index it comes at */
|
||||
@@ -576,15 +576,17 @@ static void bta_hf_client_handle_btrh( UINT16 code)
|
||||
|
||||
/* Check if prefix match and skip spaces if any */
|
||||
#define AT_CHECK_EVENT(buf, event) \
|
||||
if (strncmp("\r\n"event, buf,sizeof("\r\n"event) - 1) != 0) return buf; \
|
||||
buf += sizeof("\r\n"event) - 1; \
|
||||
while (*buf == ' ') buf++;
|
||||
if (strncmp("\r\n"event,buf,sizeof("\r\n"event) - 1) != 0) \
|
||||
return buf; \
|
||||
buf += sizeof("\r\n"event) - 1; \
|
||||
while (*buf == ' ') buf++;
|
||||
|
||||
/* check for <cr><lf> and forward buffer if match */
|
||||
#define AT_CHECK_RN(buf) \
|
||||
if (strncmp("\r\n", buf, sizeof("\r\n") - 1) != 0) { \
|
||||
APPL_TRACE_DEBUG("%s missing end <cr><lf>", __FUNCTION__); \
|
||||
return NULL;} \
|
||||
APPL_TRACE_ERROR("%s missing end <cr><lf>", __FUNCTION__); \
|
||||
return NULL;\
|
||||
} \
|
||||
buf += sizeof("\r\n") - 1;
|
||||
|
||||
/* skip rest of AT string up to <cr> */
|
||||
@@ -1022,20 +1024,20 @@ static char *bta_hf_client_parse_clcc(char *buffer)
|
||||
static char *bta_hf_client_parse_cnum(char *buffer)
|
||||
{
|
||||
char numstr[33]; /* spec forces 32 chars, plus one for \0*/
|
||||
UINT16 type;
|
||||
UINT16 service = 0; /* 0 in case this optional parameter is not being sent */
|
||||
int type;
|
||||
int service = 0; /* 0 in case this optional parameter is not being sent */
|
||||
int res;
|
||||
int offset;
|
||||
|
||||
AT_CHECK_EVENT(buffer, "+CNUM:");
|
||||
|
||||
res = sscanf(buffer, ",\"%32[^\"]\",%hu,,%hu%n", numstr, &type, &service, &offset);
|
||||
res = sscanf(buffer, ",\"%32[^\"]\",%d%n,,%d%n", numstr, &type, &offset, &service, &offset);
|
||||
if (res < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (res == 0) {
|
||||
res = sscanf(buffer, ",\"\",%hu,,%hu%n", &type, &service, &offset);
|
||||
res = sscanf(buffer, ",\"\",%d%n,,%d%n", &type, &offset, &service, &offset);
|
||||
if (res < 0) {
|
||||
return NULL;
|
||||
}
|
||||
@@ -1045,7 +1047,7 @@ static char *bta_hf_client_parse_cnum(char *buffer)
|
||||
numstr[0] = '\0';
|
||||
}
|
||||
|
||||
if (res < 3) {
|
||||
if (res < 2) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1257,7 +1259,7 @@ static void bta_hf_client_at_parse_start(void)
|
||||
for (i = 0; i < bta_hf_client_psraser_cb_count; i++) {
|
||||
tmp = bta_hf_client_parser_cb[i](buf);
|
||||
if (tmp == NULL) {
|
||||
APPL_TRACE_ERROR("HFPCient: AT event/reply parsing failed, skipping");
|
||||
APPL_TRACE_ERROR("HFPCient: AT event/reply parsing failed, skipping %d", i);
|
||||
tmp = bta_hf_client_skip_unknown(buf);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ void bta_hh_le_register_input_notif(tBTA_HH_DEV_CB *p_dev_cb, UINT8 srvc_inst,
|
||||
**
|
||||
** Function bta_hh_le_open_cmpl
|
||||
**
|
||||
** Description HID over GATT connection sucessfully opened
|
||||
** Description HID over GATT connection successfully opened
|
||||
**
|
||||
*******************************************************************************/
|
||||
void bta_hh_le_open_cmpl(tBTA_HH_DEV_CB *p_cb)
|
||||
@@ -1556,7 +1556,7 @@ void bta_hh_le_srvc_search_cmpl(tBTA_GATTC_SEARCH_CMPL *p_data)
|
||||
/* close the connection and report service discovery complete with error */
|
||||
bta_hh_le_api_disc_act(p_dev_cb);
|
||||
}
|
||||
/* GATT service discovery sucessfully finished */
|
||||
/* GATT service discovery successfully finished */
|
||||
else {
|
||||
if (p_dev_cb->disc_active & BTA_HH_LE_DISC_SCPS) {
|
||||
p_dev_cb->disc_active &= ~BTA_HH_LE_DISC_SCPS;
|
||||
|
||||
@@ -589,10 +589,10 @@ typedef struct {
|
||||
|
||||
typedef union {
|
||||
tBLE_BD_ADDR target_addr;
|
||||
tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */
|
||||
tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */
|
||||
tBTA_DM_BLE_PF_LOCAL_NAME_COND local_name; /* local name filtering */
|
||||
tBTA_DM_BLE_PF_MANU_COND manu_data; /* manufacturer data filtering */
|
||||
tBTA_DM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
|
||||
tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */
|
||||
tBTA_DM_BLE_PF_UUID_COND solicitate_uuid; /* solicited service UUID filtering */
|
||||
tBTA_DM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
|
||||
} tBTA_DM_BLE_PF_COND_PARAM;
|
||||
|
||||
@@ -1204,7 +1204,7 @@ typedef UINT16 tBTA_DM_LP_MASK;
|
||||
#define BTA_DM_PM_ACTIVE 0x40 /* prefers active mode */
|
||||
#define BTA_DM_PM_RETRY 0x80 /* retry power mode based on current settings */
|
||||
#define BTA_DM_PM_SUSPEND 0x04 /* prefers suspend mode */
|
||||
#define BTA_DM_PM_NO_PREF 0x01 /* service has no prefernce on power mode setting. eg. connection to service got closed */
|
||||
#define BTA_DM_PM_NO_PREF 0x01 /* service has no preference on power mode setting. eg. connection to service got closed */
|
||||
|
||||
typedef UINT8 tBTA_DM_PM_ACTION;
|
||||
|
||||
@@ -1375,6 +1375,7 @@ typedef UINT8 tBTA_DM_LINK_TYPE;
|
||||
#define ALLOW_ALL_FILTER 0x00
|
||||
#define LOWEST_RSSI_VALUE 129
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
** External Function Declarations
|
||||
*****************************************************************************/
|
||||
@@ -1732,7 +1733,7 @@ extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
|
||||
**
|
||||
** Description This function adds a DI record to the local SDP database.
|
||||
**
|
||||
** Returns BTA_SUCCESS if record set sucessfully, otherwise error code.
|
||||
** Returns BTA_SUCCESS if record set successfully, otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tBTA_STATUS BTA_DmSetLocalDiRecord( tBTA_DI_RECORD *p_device_info,
|
||||
@@ -2601,6 +2602,21 @@ extern void BTA_VendorInit (void);
|
||||
*******************************************************************************/
|
||||
extern void BTA_VendorCleanup (void);
|
||||
|
||||
enum {
|
||||
BTA_COEX_EVT_SCAN_STARTED = 1,
|
||||
BTA_COEX_EVT_SCAN_STOPPED,
|
||||
BTA_COEX_EVT_ACL_CONNECTED,
|
||||
BTA_COEX_EVT_ACL_DISCONNECTED,
|
||||
BTA_COEX_EVT_STREAMING_STARTED,
|
||||
BTA_COEX_EVT_STREAMING_STOPPED,
|
||||
BTA_COEX_EVT_SNIFF_ENTER,
|
||||
BTA_COEX_EVT_SNIFF_EXIT,
|
||||
BTA_COEX_EVT_A2DP_PAUSED_ENTER,
|
||||
BTA_COEX_EVT_A2DP_PAUSED_EXIT,
|
||||
};
|
||||
|
||||
extern void BTA_DmCoexEventTrigger(uint32_t event);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -509,8 +509,10 @@ typedef struct {
|
||||
UINT32 company_id; /* AVRCP Company ID */
|
||||
UINT16 avrc_mtu; /* AVRCP MTU at L2CAP for control channel */
|
||||
UINT16 avrc_br_mtu; /* AVRCP MTU at L2CAP for browsing channel */
|
||||
UINT16 avrc_ct_cat; /* AVRCP controller categories */
|
||||
UINT16 avrc_tg_cat; /* AVRCP target categories */
|
||||
UINT16 avrc_snk_ct_cat; /* AVRCP controller categories as SNK */
|
||||
UINT16 avrc_snk_tg_cat; /* AVRCP target categories SNK */
|
||||
UINT16 avrc_src_ct_cat; /* AVRCP controller categories as SRC */
|
||||
UINT16 avrc_src_tg_cat; /* AVRCP target categories as SRC */
|
||||
UINT16 sig_mtu; /* AVDTP signaling channel MTU at L2CAP */
|
||||
UINT16 audio_mtu; /* AVDTP audio transport channel MTU at L2CAP */
|
||||
const UINT16 *p_audio_flush_to;/* AVDTP audio transport channel flush timeout */
|
||||
|
||||
@@ -205,6 +205,8 @@ extern void bta_dm_co_ble_set_rsp_key_req(UINT8 rsp_key);
|
||||
|
||||
extern void bta_dm_co_ble_set_max_key_size(UINT8 ble_key_size);
|
||||
|
||||
extern void bta_dm_co_ble_set_min_key_size(UINT8 ble_key_size);
|
||||
|
||||
extern void bta_dm_co_ble_set_accept_auth_enable(UINT8 enable);
|
||||
|
||||
extern UINT8 bta_dm_co_ble_get_accept_auth_enable(void);
|
||||
|
||||
@@ -152,7 +152,7 @@ typedef UINT8 tBTA_GATT_STATUS;
|
||||
#define BTA_GATTC_CLOSE_EVT 5 /* GATTC close request status event */
|
||||
#define BTA_GATTC_SEARCH_CMPL_EVT 6 /* GATT discovery complete event */
|
||||
#define BTA_GATTC_SEARCH_RES_EVT 7 /* GATT discovery result event */
|
||||
#define BTA_GATTC_READ_DESCR_EVT 8 /* GATT read characterisitc descriptor event */
|
||||
#define BTA_GATTC_READ_DESCR_EVT 8 /* GATT read characteristic descriptor event */
|
||||
#define BTA_GATTC_WRITE_DESCR_EVT 9 /* GATT write characteristic descriptor event */
|
||||
#define BTA_GATTC_NOTIF_EVT 10 /* GATT attribute notification event */
|
||||
#define BTA_GATTC_PREP_WRITE_EVT 11 /* GATT prepare write event */
|
||||
@@ -739,7 +739,7 @@ extern void BTA_GATTC_Disable(void);
|
||||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTC module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_client_cb - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
@@ -867,32 +867,32 @@ extern const tBTA_GATTC_CHARACTERISTIC* BTA_GATTC_GetCharacteristic(UINT16 conn_
|
||||
*******************************************************************************/
|
||||
extern const tBTA_GATTC_DESCRIPTOR* BTA_GATTC_GetDescriptor(UINT16 conn_id, UINT16 handle);
|
||||
|
||||
extern void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
extern void BTA_GATTC_GetServiceWithUUID(UINT16 conn_id, tBT_UUID *svc_uuid,
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetAllChar(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetAllDescriptor(UINT16 conn_id, UINT16 char_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetCharByUUID(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, tBT_UUID char_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDescrByUUID(UINT16 conn_id, uint16_t start_handle, uint16_t end_handle,
|
||||
tBT_UUID char_uuid, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDescrByCharHandle(UINT16 conn_id, UINT16 char_handle, tBT_UUID descr_uuid,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetIncludeService(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, int *count);
|
||||
tBT_UUID *incl_uuid, btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, int *count);
|
||||
extern void BTA_GATTC_GetDBSize(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, UINT16 *count);
|
||||
|
||||
extern void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_t type,
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, int *count);
|
||||
UINT16 start_handle, UINT16 end_handle, UINT16 char_handle, UINT16 *count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -907,7 +907,7 @@ extern void BTA_GATTC_GetDBSizeByType(UINT16 conn_id, bt_gatt_db_attribute_type_
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
|
||||
btgatt_db_element_t **db, int *count);
|
||||
btgatt_db_element_t **db, UINT16 *count);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -1202,7 +1202,7 @@ extern void BTA_GATTS_Disable(void);
|
||||
** Description This function is called to register application callbacks
|
||||
** with BTA GATTS module.
|
||||
**
|
||||
** Parameters p_app_uuid - applicaiton UUID
|
||||
** Parameters p_app_uuid - application UUID
|
||||
** p_cback - pointer to the application callback function.
|
||||
**
|
||||
** Returns None
|
||||
@@ -1325,7 +1325,7 @@ extern void BTA_GATTS_DeleteService(UINT16 service_id);
|
||||
** Description This function is called to start a service.
|
||||
**
|
||||
** Parameters service_id: the service ID to be started.
|
||||
** sup_transport: supported trasnport.
|
||||
** sup_transport: supported transport.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
|
||||
@@ -115,15 +115,16 @@ typedef UINT8 tBTA_HF_CLIENT_EVT;
|
||||
|
||||
typedef UINT8 tBTA_HF_CLIENT_STATUS;
|
||||
|
||||
/* indicator type */
|
||||
#define BTA_HF_CLIENT_IND_BATTCH 0 /* Battery charge indicator */
|
||||
#define BTA_HF_CLIENT_IND_SIGNAL 1 /* Signal Strength indicator */
|
||||
#define BTA_HF_CLIENT_IND_SERVICE 2 /* Service availability indicator */
|
||||
#define BTA_HF_CLIENT_IND_CALL 3 /* Standard call status indicator*/
|
||||
#define BTA_HF_CLIENT_IND_ROAM 4 /* Roaming status indicator */
|
||||
#define BTA_HF_CLIENT_IND_CALLSETUP 5 /* Call setup status indicator */
|
||||
#define BTA_HF_CLIENT_IND_CALLHELD 6 /* Call hold status indicator */
|
||||
|
||||
/* indicator constants HFP 1.1 and later */
|
||||
#define BTA_HF_CLIENT_IND_CALL 0 /* position of call indicator */
|
||||
#define BTA_HF_CLIENT_IND_CALLSETUP 1 /* position of callsetup indicator */
|
||||
#define BTA_HF_CLIENT_IND_SERVICE 2 /* position of service indicator */
|
||||
/* indicator constants HFP 1.5 and later */
|
||||
#define BTA_HF_CLIENT_IND_SIGNAL 3 /* position of signal strength indicator */
|
||||
#define BTA_HF_CLIENT_IND_ROAM 4 /* position of roaming indicator */
|
||||
#define BTA_HF_CLIENT_IND_BATTCH 5 /* position of battery charge indicator */
|
||||
#define BTA_HF_CLIENT_IND_CALLHELD 6 /* position of callheld indicator */
|
||||
#define BTA_HF_CLIENT_IND_BEARER 7 /* position of bearer indicator */
|
||||
typedef UINT8 tBTA_HF_CLIENT_IND_TYPE;
|
||||
|
||||
/* AT commands */
|
||||
|
||||
@@ -80,7 +80,7 @@ static void _btc_storage_save(void)
|
||||
//delete device info
|
||||
string_to_bdaddr(need_remove_section, &bd_addr);
|
||||
BTM_SecDeleteDevice(bd_addr.address, BT_TRANSPORT_LE);
|
||||
//delet config info
|
||||
//delete config info
|
||||
if(btc_config_remove_section(need_remove_section)) {
|
||||
BTIF_TRACE_WARNING("exceeded the maximum nubmer of bonded devices, delete the last device info : %s", need_remove_section);
|
||||
}
|
||||
@@ -893,11 +893,12 @@ bt_status_t btc_storage_get_bonded_ble_devices_list(esp_ble_bond_dev_t *bond_dev
|
||||
if (_btc_storage_get_ble_bonding_key(&bd_addr, BTM_LE_KEY_PID, buffer, sizeof(tBTM_LE_PID_KEYS)) == BT_STATUS_SUCCESS) {
|
||||
bond_dev->bond_key.key_mask |= ESP_BLE_ID_KEY_MASK;
|
||||
tBTM_LE_PID_KEYS *pid_key = (tBTM_LE_PID_KEYS *) buffer;
|
||||
memcpy(&bond_dev->bond_key.pid_key.irk, pid_key->irk, BT_OCTET16_LEN);
|
||||
//Note: The memory size of the pid_key.addr_type in bond_key is different from that of (tBTM_LE_PID_KEYS) *pid_key.
|
||||
memcpy(&bond_dev->bond_key.pid_key.irk, pid_key->irk, ESP_BT_OCTET16_LEN);
|
||||
bond_dev->bond_key.pid_key.addr_type = pid_key->addr_type;
|
||||
memcpy(&bond_dev->bond_key.pid_key.static_addr, pid_key->static_addr, sizeof(BD_ADDR));
|
||||
memcpy(&bond_dev->bond_key.pid_key.static_addr, pid_key->static_addr, ESP_BD_ADDR_LEN);
|
||||
}
|
||||
//serch for the next bond device
|
||||
//search for the next bond device
|
||||
bond_dev++;
|
||||
}
|
||||
btc_config_unlock();
|
||||
|
||||
@@ -706,8 +706,12 @@ void btc_dm_sec_cb_handler(btc_msg_t *msg)
|
||||
pairing_cb.ble.is_pid_key_rcvd = TRUE;
|
||||
memcpy(&pairing_cb.ble.pid_key, &p_data->ble_key.p_key_value->pid_key,
|
||||
sizeof(tBTM_LE_PID_KEYS));
|
||||
memcpy(¶m.ble_security.ble_key.p_key_value.pid_key,
|
||||
&p_data->ble_key.p_key_value->pid_key, sizeof(tBTM_LE_PID_KEYS));
|
||||
//Note: The memory size of the addr_type in ble_security.ble_key.p_key_value.pid_key is different from that of p_data->ble_key.p_key_value->pid_key.
|
||||
memcpy(¶m.ble_security.ble_key.p_key_value.pid_key.irk,
|
||||
&p_data->ble_key.p_key_value->pid_key.irk, ESP_BT_OCTET16_LEN);
|
||||
param.ble_security.ble_key.p_key_value.pid_key.addr_type = p_data->ble_key.p_key_value->pid_key.addr_type;
|
||||
memcpy(¶m.ble_security.ble_key.p_key_value.pid_key.static_addr,
|
||||
&p_data->ble_key.p_key_value->pid_key.static_addr, ESP_BD_ADDR_LEN);
|
||||
break;
|
||||
}
|
||||
case BTM_LE_KEY_PCSRK: {
|
||||
|
||||
@@ -147,6 +147,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
|
||||
if (blufi_env.prepare_buf == NULL) {
|
||||
blufi_env.prepare_buf = osi_malloc(BLUFI_PREPAIR_BUF_MAX_SIZE);
|
||||
blufi_env.prepare_len = 0;
|
||||
if (blufi_env.prepare_buf == NULL) {
|
||||
BLUFI_TRACE_ERROR("Blufi prep no mem\n");
|
||||
status = GATT_NO_RESOURCES;
|
||||
@@ -174,6 +175,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
if (blufi_env.prepare_buf) {
|
||||
osi_free(blufi_env.prepare_buf);
|
||||
blufi_env.prepare_buf = NULL;
|
||||
blufi_env.prepare_len = 0;
|
||||
}
|
||||
BLUFI_TRACE_ERROR("write data error , error code 0x%x\n", status);
|
||||
return;
|
||||
@@ -209,6 +211,7 @@ static void blufi_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data)
|
||||
if (blufi_env.prepare_buf) {
|
||||
osi_free(blufi_env.prepare_buf);
|
||||
blufi_env.prepare_buf = NULL;
|
||||
blufi_env.prepare_len = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -585,7 +588,7 @@ static void btc_blufi_wifi_conn_report(uint8_t opmode, uint8_t sta_conn_state, u
|
||||
*p++ = info->softap_max_conn_num;
|
||||
}
|
||||
if (info->softap_channel_set) {
|
||||
*p++ = BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_MAX_CONN_NUM;
|
||||
*p++ = BLUFI_TYPE_DATA_SUBTYPE_SOFTAP_CHANNEL;
|
||||
*p++ = 1;
|
||||
*p++ = info->softap_channel;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
|
||||
APPL_TRACE_DEBUG("BTC MEDIA (A2DP-DATA) EVENT %u", ctrl);
|
||||
|
||||
if (btc_aa_ctrl_cb.a2dp_cmd_pending != ESP_A2D_MEDIA_CTRL_NONE) {
|
||||
APPL_TRACE_DEBUG("un-acked a2dp cmd: %u", btc_aa_ctrl_cb.a2dp_cmd_pending);
|
||||
APPL_TRACE_WARNING("un-acked a2dp cmd: %u", btc_aa_ctrl_cb.a2dp_cmd_pending);
|
||||
a2dp_cmd_acknowledge(ctrl, ESP_A2D_MEDIA_CTRL_ACK_BUSY);
|
||||
return;
|
||||
}
|
||||
@@ -179,6 +179,11 @@ void btc_a2dp_control_media_ctrl(esp_a2d_media_ctrl_t ctrl)
|
||||
/* local suspend */
|
||||
if (btc_av_stream_started_ready()) {
|
||||
btc_dispatch_sm_event(BTC_AV_SUSPEND_STREAM_REQ_EVT, NULL, 0);
|
||||
#if (BTC_AV_SINK_INCLUDED == TRUE)
|
||||
if (btc_av_get_peer_sep() == AVDT_TSEP_SRC && btc_av_get_service_id() == BTA_A2DP_SINK_SERVICE_ID) {
|
||||
btc_a2dp_control_command_ack(ESP_A2D_MEDIA_CTRL_ACK_SUCCESS);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
/* we are not in started state; just ack back ok. This can happen if we are
|
||||
remotely suspended; clear REMOTE SUSPEND Flag */
|
||||
|
||||
@@ -828,6 +828,8 @@ static void btc_a2dp_sink_thread_cleanup(UNUSED_ATTR void *context)
|
||||
|
||||
fixed_queue_free(btc_aa_snk_cb.RxSbcQ, osi_free_func);
|
||||
|
||||
btc_aa_snk_cb.RxSbcQ = NULL;
|
||||
|
||||
future_ready(btc_a2dp_sink_future, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1156,10 +1156,16 @@ static UINT8 btc_get_num_aa_frame(void)
|
||||
|
||||
/* calculate nbr of frames pending for this media tick */
|
||||
result = btc_aa_src_cb.media_feeding_state.pcm.counter / pcm_bytes_per_frame;
|
||||
if (result > MAX_PCM_FRAME_NUM_PER_TICK) {
|
||||
APPL_TRACE_WARNING("%s() - Limiting frames to be sent from %d to %d"
|
||||
, __FUNCTION__, result, MAX_PCM_FRAME_NUM_PER_TICK);
|
||||
result = MAX_PCM_FRAME_NUM_PER_TICK;
|
||||
|
||||
/* limit the frames to be sent */
|
||||
UINT32 frm_nb_threshold = MAX_OUTPUT_A2DP_SRC_FRAME_QUEUE_SZ - fixed_queue_length(btc_aa_src_cb.TxAaQ);
|
||||
if (frm_nb_threshold > MAX_PCM_FRAME_NUM_PER_TICK) {
|
||||
frm_nb_threshold = MAX_PCM_FRAME_NUM_PER_TICK;
|
||||
}
|
||||
|
||||
if (result > frm_nb_threshold) {
|
||||
APPL_TRACE_EVENT("Limit frms to send from %d to %d", result, frm_nb_threshold);
|
||||
result = frm_nb_threshold;
|
||||
}
|
||||
btc_aa_src_cb.media_feeding_state.pcm.counter -= result * pcm_bytes_per_frame;
|
||||
|
||||
@@ -1658,6 +1664,8 @@ static void btc_a2dp_source_thread_cleanup(UNUSED_ATTR void *context)
|
||||
|
||||
fixed_queue_free(btc_aa_src_cb.TxAaQ, osi_free_func);
|
||||
|
||||
btc_aa_src_cb.TxAaQ = NULL;
|
||||
|
||||
future_ready(btc_a2dp_source_future, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ static void handle_rc_attributes_rsp ( tAVRC_MSG_VENDOR *vendor_msg)
|
||||
|
||||
btc_avrc_ct_cb_to_app(ESP_AVRC_CT_METADATA_RSP_EVT, ¶m[i]);
|
||||
|
||||
attr_index += (int) vendor_msg->p_vendor_data[7 + attr_index] + 8;
|
||||
attr_index += attr_length + 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1189,6 +1189,12 @@ void btc_gap_ble_call_handler(btc_msg_t *msg)
|
||||
bta_dm_co_ble_set_max_key_size(key_size);
|
||||
break;
|
||||
}
|
||||
case ESP_BLE_SM_MIN_KEY_SIZE: {
|
||||
uint8_t key_size = 0;
|
||||
STREAM_TO_UINT8(key_size, value);
|
||||
bta_dm_co_ble_set_min_key_size(key_size);
|
||||
break;
|
||||
}
|
||||
case ESP_BLE_SM_SET_STATIC_PASSKEY: {
|
||||
uint32_t passkey = 0;
|
||||
for(uint8_t i = 0; i < arg->set_security_param.len; i++)
|
||||
|
||||
@@ -315,7 +315,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int svc_num = 0;
|
||||
uint16_t svc_num = 0;
|
||||
tBT_UUID *bta_uuid = NULL;
|
||||
if (svc_uuid) {
|
||||
bta_uuid = osi_malloc(sizeof(tBT_UUID));
|
||||
@@ -324,7 +324,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
|
||||
|
||||
BTA_GATTC_GetServiceWithUUID(conn_id, bta_uuid, &db, &svc_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(svc_num, offset)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)svc_num, offset)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
@@ -334,7 +334,7 @@ esp_gatt_status_t btc_ble_gattc_get_service(uint16_t conn_id, esp_bt_uuid_t *svc
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)svc_num, ESP_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, svc_num, ESP_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = svc_num;
|
||||
@@ -356,17 +356,17 @@ esp_gatt_status_t btc_ble_gattc_get_all_char(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int char_num = 0;
|
||||
uint16_t char_num = 0;
|
||||
BTA_GATTC_GetAllChar(conn_id, start_handle, end_handle, &db, &char_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(char_num, offset)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)char_num, offset)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)char_num, ESP_GATT_DB_CHARACTERISTIC, offset, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, char_num, ESP_GATT_DB_CHARACTERISTIC, offset, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = char_num;
|
||||
@@ -384,17 +384,17 @@ esp_gatt_status_t btc_ble_gattc_get_all_descr(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int descr_num = 0;
|
||||
uint16_t descr_num = 0;
|
||||
BTA_GATTC_GetAllDescriptor(conn_id, char_handle, &db, &descr_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(descr_num, offset)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)descr_num, offset)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = descr_num;
|
||||
@@ -414,19 +414,19 @@ esp_gatt_status_t btc_ble_gattc_get_char_by_uuid(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int char_num = 0;
|
||||
uint16_t char_num = 0;
|
||||
tBT_UUID bta_uuid = {0};
|
||||
btc_to_bta_uuid(&bta_uuid, &char_uuid);
|
||||
BTA_GATTC_GetCharByUUID(conn_id, start_handle, end_handle, bta_uuid, &db, &char_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(char_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)char_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)char_num, ESP_GATT_DB_CHARACTERISTIC, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, char_num, ESP_GATT_DB_CHARACTERISTIC, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = char_num;
|
||||
@@ -447,7 +447,7 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_uuid(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int descr_num = 0;
|
||||
uint16_t descr_num = 0;
|
||||
tBT_UUID bta_char_uuid = {0};
|
||||
tBT_UUID bta_descr_uuid = {0};
|
||||
btc_to_bta_uuid(&bta_char_uuid, &char_uuid);
|
||||
@@ -456,14 +456,14 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_uuid(uint16_t conn_id,
|
||||
BTA_GATTC_GetDescrByUUID(conn_id, start_handle, end_handle,
|
||||
bta_char_uuid, bta_descr_uuid, &db, &descr_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)descr_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = descr_num;
|
||||
@@ -482,20 +482,20 @@ esp_gatt_status_t btc_ble_gattc_get_descr_by_char_handle(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int descr_num = 0;
|
||||
uint16_t descr_num = 0;
|
||||
tBT_UUID bta_descr_uuid = {0};
|
||||
btc_to_bta_uuid(&bta_descr_uuid, &descr_uuid);
|
||||
|
||||
BTA_GATTC_GetDescrByCharHandle(conn_id, char_handle, bta_descr_uuid, &db, &descr_num);
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(descr_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)descr_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
} else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, descr_num, ESP_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = descr_num;
|
||||
@@ -516,7 +516,7 @@ esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
|
||||
{
|
||||
esp_gatt_status_t status;
|
||||
btgatt_db_element_t *db = NULL;
|
||||
int incl_num = 0;
|
||||
uint16_t incl_num = 0;
|
||||
tBT_UUID bta_uuid = {0};
|
||||
|
||||
if (incl_uuid != NULL) {
|
||||
@@ -526,14 +526,14 @@ esp_gatt_status_t btc_ble_gattc_get_include_service(uint16_t conn_id,
|
||||
BTA_GATTC_GetIncludeService(conn_id, start_handle, end_handle, NULL, &db, &incl_num);
|
||||
}
|
||||
|
||||
if ((status = btc_gattc_check_valid_param(incl_num, 0)) != ESP_GATT_OK) {
|
||||
if ((status = btc_gattc_check_valid_param((int)incl_num, 0)) != ESP_GATT_OK) {
|
||||
if (db) {
|
||||
osi_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
return status;
|
||||
}else {
|
||||
btc_gattc_fill_gatt_db_conversion(*count, (uint16_t)incl_num, ESP_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
|
||||
btc_gattc_fill_gatt_db_conversion(*count, incl_num, ESP_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
|
||||
}
|
||||
|
||||
*count = incl_num;
|
||||
@@ -552,9 +552,9 @@ esp_gatt_status_t btc_ble_gattc_get_attr_count(uint16_t conn_id,
|
||||
uint16_t *count)
|
||||
{
|
||||
if (type == ESP_GATT_DB_ALL) {
|
||||
BTA_GATTC_GetDBSize(conn_id, start_handle, end_handle, (int *)count);
|
||||
BTA_GATTC_GetDBSize(conn_id, start_handle, end_handle, count);
|
||||
} else {
|
||||
BTA_GATTC_GetDBSizeByType(conn_id, type, start_handle, end_handle, char_handle, (int *)count);
|
||||
BTA_GATTC_GetDBSizeByType(conn_id, type, start_handle, end_handle, char_handle, count);
|
||||
}
|
||||
|
||||
return ESP_GATT_OK;
|
||||
@@ -564,7 +564,7 @@ esp_gatt_status_t btc_ble_gattc_get_db(uint16_t conn_id, uint16_t start_handle,
|
||||
esp_gattc_db_elem_t *db, uint16_t *count)
|
||||
{
|
||||
btgatt_db_element_t *get_db = NULL;
|
||||
int num = 0;
|
||||
uint16_t num = 0;
|
||||
tBT_UUID bta_uuid;
|
||||
uint16_t db_size = 0;
|
||||
BTA_GATTC_GetGattDb(conn_id, start_handle, end_handle, &get_db, &num);
|
||||
|
||||
@@ -389,7 +389,13 @@ static void btc_gatts_act_create_attr_tab(esp_gatts_attr_db_t *gatts_attr_db,
|
||||
case ESP_GATT_UUID_CHAR_AGG_FORMAT:
|
||||
case ESP_GATT_UUID_CHAR_VALID_RANGE:
|
||||
case ESP_GATT_UUID_EXT_RPT_REF_DESCR:
|
||||
case ESP_GATT_UUID_RPT_REF_DESCR:{
|
||||
case ESP_GATT_UUID_RPT_REF_DESCR:
|
||||
case ESP_GATT_UUID_NUM_DIGITALS_DESCR:
|
||||
case ESP_GATT_UUID_VALUE_TRIGGER_DESCR:
|
||||
case ESP_GATT_UUID_ENV_SENSING_CONFIG_DESCR:
|
||||
case ESP_GATT_UUID_ENV_SENSING_MEASUREMENT_DESCR:
|
||||
case ESP_GATT_UUID_ENV_SENSING_TRIGGER_DESCR:
|
||||
case ESP_GATT_UUID_TIME_TRIGGER_DESCR: {
|
||||
uint16_t svc_hal = btc_creat_tab_env.svc_start_hdl;
|
||||
tBT_UUID bta_char_uuid;
|
||||
esp_bt_uuid_t uuid_temp;
|
||||
@@ -449,7 +455,7 @@ static esp_gatt_status_t btc_gatts_check_valid_attr_tab(esp_gatts_attr_db_t *gat
|
||||
case ESP_GATT_UUID_PRI_SERVICE:
|
||||
case ESP_GATT_UUID_SEC_SERVICE:
|
||||
if (++svc_num > 1) {
|
||||
BTC_TRACE_ERROR("Each service table can only created one primary service or secondly service.");
|
||||
BTC_TRACE_ERROR("Each service table can only created one primary service or secondary service.");
|
||||
return ESP_GATT_ERROR;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define __BTC_GAP_BT_H__
|
||||
|
||||
#include "common/bt_target.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gap_bt_api.h"
|
||||
#include "btc/btc_task.h"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include "common/bt_trace.h"
|
||||
#include "bt_common.h"
|
||||
#include "common/bt_target.h"
|
||||
|
||||
#define UNUSED(x) (void)(x)
|
||||
@@ -65,31 +65,6 @@ typedef struct {
|
||||
uint8_t uu[16];
|
||||
} bt_uuid_t;
|
||||
|
||||
/** Bluetooth Error Status */
|
||||
/** We need to build on this */
|
||||
|
||||
/* relate to ESP_BT_STATUS_xxx in esp_bt_defs.h */
|
||||
typedef enum {
|
||||
BT_STATUS_SUCCESS = 0,
|
||||
BT_STATUS_FAIL,
|
||||
BT_STATUS_NOT_READY,
|
||||
BT_STATUS_NOMEM,
|
||||
BT_STATUS_BUSY,
|
||||
BT_STATUS_DONE, /* request already completed */
|
||||
BT_STATUS_UNSUPPORTED,
|
||||
BT_STATUS_PARM_INVALID,
|
||||
BT_STATUS_UNHANDLED,
|
||||
BT_STATUS_AUTH_FAILURE,
|
||||
BT_STATUS_RMT_DEV_DOWN,
|
||||
BT_STATUS_AUTH_REJECTED,
|
||||
BT_STATUS_INVALID_STATIC_RAND_ADDR,
|
||||
BT_STATUS_PENDING,
|
||||
BT_STATUS_UNACCEPT_CONN_INTERVAL,
|
||||
BT_STATUS_PARAM_OUT_OF_RANGE,
|
||||
BT_STATUS_TIMEOUT,
|
||||
BT_STATUS_MEMORY_FULL,
|
||||
} bt_status_t;
|
||||
|
||||
#ifndef CPU_LITTLE_ENDIAN
|
||||
#define CPU_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef BT_TARGET_H
|
||||
#define BT_TARGET_H
|
||||
|
||||
#include "bt_common.h"
|
||||
|
||||
#ifndef BUILDCFG
|
||||
#define BUILDCFG
|
||||
#endif
|
||||
@@ -98,6 +100,10 @@
|
||||
#define CLASSIC_BT_INCLUDED FALSE
|
||||
#endif /* CLASSIC_BT_INCLUDED */
|
||||
|
||||
#ifndef CLASSIC_BT_GATT_INCLUDED
|
||||
#define CLASSIC_BT_GATT_INCLUDED FALSE
|
||||
#endif /* CLASSIC_BT_GATT_INCLUDED */
|
||||
|
||||
#ifndef CONFIG_GATTC_CACHE_NVS_FLASH
|
||||
#define CONFIG_GATTC_CACHE_NVS_FLASH FALSE
|
||||
#endif /* CONFIG_GATTC_CACHE_NVS_FLASH */
|
||||
@@ -151,13 +157,13 @@
|
||||
|
||||
#ifndef CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM
|
||||
#define BLE_ADV_REPORT_FLOW_CONTROL_NUM 100
|
||||
#else
|
||||
#else
|
||||
#define BLE_ADV_REPORT_FLOW_CONTROL_NUM CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM
|
||||
#endif /* CONFIG_BLE_ADV_REPORT_FLOW_CONTROL_NUM */
|
||||
|
||||
#ifndef CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD
|
||||
#define BLE_ADV_REPORT_DISCARD_THRSHOLD 20
|
||||
#else
|
||||
#else
|
||||
#define BLE_ADV_REPORT_DISCARD_THRSHOLD CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD
|
||||
#endif /* CONFIG_BLE_ADV_REPORT_DISCARD_THRSHOLD */
|
||||
|
||||
@@ -345,10 +351,6 @@
|
||||
#define BTA_AV_CO_CP_SCMS_T FALSE//FALSE
|
||||
#endif
|
||||
|
||||
#ifndef QUEUE_CONGEST_SIZE
|
||||
#define QUEUE_CONGEST_SIZE 40
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK
|
||||
#define SCAN_QUEUE_CONGEST_CHECK FALSE
|
||||
#else
|
||||
|
||||
@@ -23,38 +23,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include "stack/bt_types.h"
|
||||
|
||||
#ifndef LOG_LOCAL_LEVEL
|
||||
#ifndef BOOTLOADER_BUILD
|
||||
#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
|
||||
#else
|
||||
#define LOG_LOCAL_LEVEL CONFIG_LOG_BOOTLOADER_LEVEL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
// Mapping between ESP_LOG_LEVEL and BT_TRACE_LEVEL
|
||||
#if (LOG_LOCAL_LEVEL >= 4)
|
||||
#define LOG_LOCAL_LEVEL_MAPPING (LOG_LOCAL_LEVEL+1)
|
||||
#else
|
||||
#define LOG_LOCAL_LEVEL_MAPPING LOG_LOCAL_LEVEL
|
||||
#endif
|
||||
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define BT_LOG_LEVEL_CHECK(LAYER, LEVEL) (MAX(LAYER##_INITIAL_TRACE_LEVEL, LOG_LOCAL_LEVEL_MAPPING) >= BT_TRACE_LEVEL_##LEVEL)
|
||||
|
||||
//#define TAG "BT"
|
||||
|
||||
#define BT_PRINT_E(tag, format, ...) {esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_W(tag, format, ...) {esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_I(tag, format, ...) {esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_D(tag, format, ...) {esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
#define BT_PRINT_V(tag, format, ...) {esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
|
||||
|
||||
#ifndef assert
|
||||
#define assert(x) do { if (!(x)) BT_PRINT_E("bt host error %s %u\n", __FILE__, __LINE__); } while (0)
|
||||
#endif
|
||||
#include "bt_common.h"
|
||||
|
||||
inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
|
||||
{
|
||||
@@ -324,18 +293,6 @@ inline void trc_dump_buffer(const char *prefix, uint8_t *data, uint16_t len)
|
||||
#define BTIF_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BTC_INITIAL_TRACE_LEVEL
|
||||
#define BTC_INITIAL_TRACE_LEVEL CONFIG_BTC_INITIAL_TRACE_LEVEL
|
||||
#else
|
||||
#define BTC_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_OSI_INITIAL_TRACE_LEVEL
|
||||
#define OSI_INITIAL_TRACE_LEVEL CONFIG_OSI_INITIAL_TRACE_LEVEL
|
||||
#else
|
||||
#define OSI_INITIAL_TRACE_LEVEL BT_TRACE_LEVEL_WARNING
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BLUFI_INITIAL_TRACE_LEVEL
|
||||
#define BLUFI_INITIAL_TRACE_LEVEL CONFIG_BLUFI_INITIAL_TRACE_LEVEL
|
||||
#else
|
||||
@@ -497,22 +454,6 @@ extern UINT8 btif_trace_level;
|
||||
#define HCI_TRACE_EVENT(fmt, args...) {if (HCI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(HCI,EVENT)) BT_PRINT_D("BT_HCI", fmt,## args);}
|
||||
#define HCI_TRACE_DEBUG(fmt, args...) {if (HCI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(HCI,DEBUG)) BT_PRINT_D("BT_HCI", fmt,## args);}
|
||||
|
||||
/* define traces for BTC */
|
||||
#define BTC_TRACE_ERROR(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(BTC, ERROR)) BT_PRINT_E("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_WARNING(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(BTC, WARNING)) BT_PRINT_W("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_API(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(BTC,API)) BT_PRINT_I("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_EVENT(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(BTC,EVENT)) BT_PRINT_D("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_DEBUG(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(BTC,DEBUG)) BT_PRINT_D("BT_BTC", fmt, ## args);}
|
||||
#define BTC_TRACE_VERBOSE(fmt, args...) {if (BTC_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_VERBOSE && BT_LOG_LEVEL_CHECK(BTC,VERBOSE)) BT_PRINT_V("BT_BTC", fmt, ## args);}
|
||||
|
||||
/* define traces for OSI */
|
||||
#define OSI_TRACE_ERROR(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(OSI, ERROR)) BT_PRINT_E("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_WARNING(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(OSI, WARNING)) BT_PRINT_W("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_API(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_API && BT_LOG_LEVEL_CHECK(OSI,API)) BT_PRINT_I("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_EVENT(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_EVENT && BT_LOG_LEVEL_CHECK(OSI,EVENT)) BT_PRINT_D("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_DEBUG(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_DEBUG && BT_LOG_LEVEL_CHECK(OSI,DEBUG)) BT_PRINT_D("BT_OSI", fmt, ## args);}
|
||||
#define OSI_TRACE_VERBOSE(fmt, args...) {if (OSI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_VERBOSE && BT_LOG_LEVEL_CHECK(OSI,VERBOSE)) BT_PRINT_V("BT_OSI", fmt, ## args);}
|
||||
|
||||
/* define traces for BLUFI */
|
||||
#define BLUFI_TRACE_ERROR(fmt, args...) {if (BLUFI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_ERROR && BT_LOG_LEVEL_CHECK(BLUFI, ERROR)) BT_PRINT_E("BT_BLUFI", fmt, ## args);}
|
||||
#define BLUFI_TRACE_WARNING(fmt, args...) {if (BLUFI_INITIAL_TRACE_LEVEL >= BT_TRACE_LEVEL_WARNING && BT_LOG_LEVEL_CHECK(BLUFI, WARNING)) BT_PRINT_W("BT_BLUFI", fmt, ## args);}
|
||||
@@ -671,22 +612,6 @@ extern UINT8 btif_trace_level;
|
||||
#define APPL_TRACE_DEBUG(fmt, args...)
|
||||
#define APPL_TRACE_VERBOSE(fmt, args...)
|
||||
|
||||
/* define traces for BTC */
|
||||
#define BTC_TRACE_ERROR(fmt, args...)
|
||||
#define BTC_TRACE_WARNING(fmt, args...)
|
||||
#define BTC_TRACE_API(fmt, args...)
|
||||
#define BTC_TRACE_EVENT(fmt, args...)
|
||||
#define BTC_TRACE_DEBUG(fmt, args...)
|
||||
#define BTC_TRACE_VERBOSE(fmt, args...)
|
||||
|
||||
/* define traces for OSI */
|
||||
#define OSI_TRACE_ERROR(fmt, args...)
|
||||
#define OSI_TRACE_WARNING(fmt, args...)
|
||||
#define OSI_TRACE_API(fmt, args...)
|
||||
#define OSI_TRACE_EVENT(fmt, args...)
|
||||
#define OSI_TRACE_DEBUG(fmt, args...)
|
||||
#define OSI_TRACE_VERBOSE(fmt, args...)
|
||||
|
||||
/* define traces for BLUFI */
|
||||
#define BLUFI_TRACE_ERROR(fmt, args...)
|
||||
#define BLUFI_TRACE_WARNING(fmt, args...)
|
||||
|
||||
@@ -31,6 +31,7 @@ typedef struct {
|
||||
UINT8 ble_init_key;
|
||||
UINT8 ble_resp_key;
|
||||
UINT8 ble_max_key_size;
|
||||
UINT8 ble_min_key_size;
|
||||
UINT8 ble_accept_auth_enable;
|
||||
UINT8 oob_support;
|
||||
#endif
|
||||
@@ -48,4 +49,4 @@ typedef struct {
|
||||
#endif
|
||||
} tBTE_BT_APPL_CFG;
|
||||
|
||||
extern tBTE_BT_APPL_CFG bte_bt_appl_cfg;
|
||||
extern tBTE_BT_APPL_CFG bte_bt_appl_cfg;
|
||||
|
||||
@@ -366,4 +366,9 @@ void BTE_DeinitStack(void)
|
||||
#if (defined(A2D_INCLUDED) && A2D_INCLUDED == TRUE)
|
||||
A2D_Deinit();
|
||||
#endif
|
||||
|
||||
#if (defined(RFCOMM_INCLUDED) && RFCOMM_INCLUDED == TRUE)
|
||||
RFCOMM_Deinit();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ static void avdt_sec_check_complete_term (BD_ADDR bd_addr, tBT_TRANSPORT transpo
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
static void avdt_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
|
||||
static void avdt_sec_check_complete_orig (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
void *p_ref_data, UINT8 res)
|
||||
{
|
||||
tAVDT_CCB *p_ccb = NULL;
|
||||
|
||||
@@ -2069,7 +2069,7 @@ void BTM_BleGetWhiteListSize(uint16_t *length)
|
||||
{
|
||||
tBTM_BLE_CB *p_cb = &btm_cb.ble_ctr_cb;
|
||||
if (p_cb->white_list_avail_size == 0) {
|
||||
BTM_TRACE_DEBUG("%s Whitelist full.", __func__);
|
||||
BTM_TRACE_WARNING("%s Whitelist full.", __func__);
|
||||
}
|
||||
*length = p_cb->white_list_avail_size;
|
||||
return;
|
||||
|
||||
@@ -1931,9 +1931,7 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
|
||||
UINT8 role, status, bda_type;
|
||||
UINT16 handle;
|
||||
BD_ADDR bda;
|
||||
#if (BLE_PRIVACY_SPT == TRUE)
|
||||
BD_ADDR local_rpa, peer_rpa;
|
||||
#endif ///BLE_PRIVACY_SPT == TRUE
|
||||
UINT16 conn_interval, conn_latency, conn_timeout;
|
||||
BOOLEAN match = FALSE;
|
||||
UNUSED(evt_len);
|
||||
@@ -1944,14 +1942,13 @@ void btm_ble_conn_complete(UINT8 *p, UINT16 evt_len, BOOLEAN enhanced)
|
||||
STREAM_TO_BDADDR (bda, p);
|
||||
BTM_TRACE_DEBUG("status = %d, handle = %d, role = %d, bda_type = %d",status,handle,role,bda_type);
|
||||
if (status == 0) {
|
||||
#if (BLE_PRIVACY_SPT == TRUE )
|
||||
peer_addr_type = bda_type;
|
||||
match = btm_identity_addr_to_random_pseudo (bda, &bda_type, TRUE);
|
||||
|
||||
if (enhanced) {
|
||||
STREAM_TO_BDADDR (local_rpa, p);
|
||||
STREAM_TO_BDADDR (peer_rpa, p);
|
||||
}
|
||||
#if (BLE_PRIVACY_SPT == TRUE )
|
||||
peer_addr_type = bda_type;
|
||||
match = btm_identity_addr_to_random_pseudo (bda, &bda_type, TRUE);
|
||||
|
||||
/* possiblly receive connection complete with resolvable random on
|
||||
slave role while the device has been paired */
|
||||
|
||||
@@ -913,7 +913,7 @@ tBTM_STATUS btm_ble_clear_scan_pf_filter(tBTM_BLE_SCAN_COND_OP action,
|
||||
|
||||
/* clear the general filter entry */
|
||||
if (NULL == p_target) {
|
||||
/* clear manufactuer data filter */
|
||||
/* clear manufacturer data filter */
|
||||
st = btm_ble_update_pf_manu_data(BTM_BLE_SCAN_COND_CLEAR, filt_index, NULL,
|
||||
BTM_BLE_PF_MANU_DATA, cb_evt, ref_value);
|
||||
if (BTM_CMD_STARTED == st) {
|
||||
@@ -1205,7 +1205,7 @@ tBTM_STATUS BTM_BleCfgFilterCondition(tBTM_BLE_SCAN_COND_OP action,
|
||||
st = btm_ble_update_addr_filter(action, filt_index, p_cond);
|
||||
break;
|
||||
|
||||
/* filter on service/solicitated UUID */
|
||||
/* filter on service/solicited UUID */
|
||||
case BTM_BLE_PF_SRVC_UUID:
|
||||
case BTM_BLE_PF_SRVC_SOL_UUID:
|
||||
st = btm_ble_update_uuid_filter(action, filt_index, cond_type, p_cond, 0, ref_value);
|
||||
|
||||
@@ -586,7 +586,7 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_s
|
||||
}
|
||||
#endif
|
||||
|
||||
if (start && p_cb->adv_mode == BTM_BLE_ADV_DISABLE) {
|
||||
if (start) {
|
||||
/* update adv params */
|
||||
if (!btsnd_hcic_ble_write_adv_params ((UINT16)(p_cb->adv_interval_min ? p_cb->adv_interval_min :
|
||||
BTM_BLE_GAP_ADV_INT),
|
||||
@@ -606,19 +606,13 @@ tBTM_STATUS BTM_BleBroadcast(BOOLEAN start, tBTM_START_STOP_ADV_CMPL_CBACK *p_s
|
||||
}
|
||||
|
||||
status = btm_ble_start_adv ();
|
||||
} else if (!start && p_cb->adv_mode == BTM_BLE_ADV_ENABLE) {
|
||||
} else {
|
||||
//save the stop adv callback to the BTM env.
|
||||
p_cb->p_stop_adv_cb = p_stop_adv_cback;
|
||||
status = btm_ble_stop_adv();
|
||||
#if BLE_PRIVACY_SPT == TRUE
|
||||
btm_ble_disable_resolving_list(BTM_BLE_RL_ADV, TRUE);
|
||||
#endif
|
||||
} else {
|
||||
/*
|
||||
1. start adv when adv has already started (not used)
|
||||
2. stop adv shen adv has already stoped
|
||||
*/
|
||||
status = BTM_SUCCESS;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@@ -3920,7 +3914,7 @@ tBTM_STATUS btm_ble_stop_adv(void)
|
||||
{
|
||||
tBTM_BLE_INQ_CB *p_cb = &btm_cb.ble_ctr_cb.inq_var;
|
||||
tBTM_STATUS rt = BTM_SUCCESS;
|
||||
if (p_cb->adv_mode == BTM_BLE_ADV_ENABLE) {
|
||||
if (p_cb) {
|
||||
osi_mutex_lock(&adv_enable_lock, OSI_MUTEX_MAX_TIMEOUT);
|
||||
UINT8 temp_adv_mode = p_cb->adv_mode;
|
||||
BOOLEAN temp_fast_adv_on = p_cb->fast_adv_on;
|
||||
|
||||
@@ -292,8 +292,11 @@ void btm_ble_add_resolving_list_entry_complete(UINT8 *p, UINT16 evt_len)
|
||||
}
|
||||
} else if (status == HCI_ERR_MEMORY_FULL) { /* BT_ERROR_CODE_MEMORY_CAPACITY_EXCEEDED */
|
||||
btm_cb.ble_ctr_cb.resolving_list_avail_size = 0;
|
||||
BTM_TRACE_DEBUG("%s Resolving list Full ", __func__);
|
||||
BTM_TRACE_WARNING("%s Resolving list Full ", __func__);
|
||||
} else {
|
||||
BTM_TRACE_ERROR("%s Add resolving list error %d ", __func__, status);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -811,6 +814,8 @@ BOOLEAN btm_ble_resolving_list_load_dev(tBTM_SEC_DEV_REC *p_dev_rec)
|
||||
} else {
|
||||
btm_ble_enable_resolving_list(BTM_BLE_RL_INIT);
|
||||
}
|
||||
} else {
|
||||
BTM_TRACE_WARNING("%s Resolving list full ", __func__);
|
||||
}
|
||||
} else {
|
||||
BTM_TRACE_DEBUG("Device already in Resolving list\n");
|
||||
|
||||
@@ -81,7 +81,7 @@ BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
|
||||
p_dev_rec->sec_flags = BTM_SEC_IN_USE;
|
||||
memcpy (p_dev_rec->bd_addr, bd_addr, BD_ADDR_LEN);
|
||||
p_dev_rec->hci_handle = BTM_GetHCIConnHandle (bd_addr, BT_TRANSPORT_BR_EDR);
|
||||
|
||||
p_dev_rec->ble_hci_handle = BTM_GetHCIConnHandle (bd_addr, BT_TRANSPORT_LE);
|
||||
#if BLE_INCLUDED == TRUE
|
||||
/* use default value for background connection params */
|
||||
/* update conn params, use default value for background connection params */
|
||||
|
||||
@@ -1106,7 +1106,7 @@ void btm_sec_link_key_notification (UINT8 *p_bda, UINT8 *p_link_key, UINT8 key_
|
||||
void btm_sec_link_key_request (UINT8 *p_bda);
|
||||
void btm_sec_pin_code_request (UINT8 *p_bda);
|
||||
void btm_sec_update_clock_offset (UINT16 handle, UINT16 clock_offset);
|
||||
void btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 res, BOOLEAN is_le_trasnport);
|
||||
void btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 res, BOOLEAN is_le_transport);
|
||||
void btm_sec_set_peer_sec_caps (tACL_CONN *p_acl_cb, tBTM_SEC_DEV_REC *p_dev_rec);
|
||||
|
||||
#if BLE_INCLUDED == TRUE
|
||||
|
||||
@@ -240,7 +240,7 @@ UINT16 BTU_BleAclPktSize(void)
|
||||
bool BTU_check_queue_is_congest(void)
|
||||
{
|
||||
UBaseType_t wait_size = uxQueueMessagesWaiting(xBtuQueue);
|
||||
if(wait_size >= QUEUE_CONGEST_SIZE ) {
|
||||
if(wait_size >= BT_QUEUE_CONGEST_SIZE ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -455,7 +455,7 @@ BT_HDR *attp_build_sr_msg(tGATT_TCB *p_tcb, UINT8 op_code, tGATT_SR_MSG *p_msg)
|
||||
** Parameter p_tcb: pointer to the connecton control block.
|
||||
** p_msg: pointer to message parameters structure.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
@@ -526,7 +526,7 @@ tGATT_STATUS attp_cl_send_cmd(tGATT_TCB *p_tcb, UINT16 clcb_idx, UINT8 cmd_code,
|
||||
** op_code: message op code.
|
||||
** p_msg: pointer to message parameters structure.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
@@ -80,7 +80,7 @@ UINT8 GATT_SetTraceLevel (UINT8 new_level)
|
||||
**
|
||||
** Parameter p_hndl_range: pointer to allocated handles information
|
||||
**
|
||||
** Returns TRUE if handle range is added sucessfully; otherwise FALSE.
|
||||
** Returns TRUE if handle range is added successfully; otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
@@ -382,7 +382,7 @@ BOOLEAN GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, UINT16 svc_
|
||||
GATT_TRACE_DEBUG ("GATTS_DeleteService");
|
||||
|
||||
if (p_reg == NULL) {
|
||||
GATT_TRACE_ERROR ("Applicaiton not foud");
|
||||
GATT_TRACE_ERROR ("Application not found");
|
||||
return (FALSE);
|
||||
}
|
||||
p_app_uuid128 = &p_reg->app_uuid128;
|
||||
@@ -434,7 +434,7 @@ BOOLEAN GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, UINT16 svc_
|
||||
** p_cback : application service callback functions.
|
||||
** sup_transport : supported transport(s) for this primary service
|
||||
**
|
||||
** return GATT_SUCCESS if sucessfully started; otherwise error code.
|
||||
** return GATT_SUCCESS if successfully started; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
@@ -443,9 +443,9 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
tGATT_SR_REG *p_sreg;
|
||||
tGATT_HDL_LIST_ELEM *p_list = NULL;
|
||||
UINT8 i_sreg;
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
#if (SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
tBT_UUID *p_uuid;
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
tGATT_REG *p_reg = gatt_get_regcb(gatt_if);
|
||||
|
||||
tGATTS_PENDING_NEW_SRV_START *p_buf;
|
||||
@@ -454,7 +454,7 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
|
||||
if (p_reg == NULL) {
|
||||
/* Not found */
|
||||
GATT_TRACE_ERROR ("Applicaiton not found ");
|
||||
GATT_TRACE_ERROR ("Application not found ");
|
||||
return GATT_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -484,10 +484,10 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
case GATT_TRANSPORT_BR_EDR:
|
||||
case GATT_TRANSPORT_LE_BR_EDR:
|
||||
if (p_sreg->type == GATT_UUID_PRI_SERVICE) {
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
#if (SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
p_uuid = gatts_get_service_uuid (p_sreg->p_db);
|
||||
p_sreg->sdp_handle = gatt_add_sdp_record(p_uuid, p_sreg->s_hdl, p_sreg->e_hdl);
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -539,11 +539,11 @@ void GATTS_StopService (UINT16 service_handle)
|
||||
|
||||
/* Index 0 is reserved for GATT, and is never stopped */
|
||||
if ( (ii > 0) && (ii < GATT_MAX_SR_PROFILES) && (gatt_cb.sr_reg[ii].in_use) ) {
|
||||
#if(SDP_INCLUDED == TRUE)
|
||||
#if(SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
if (gatt_cb.sr_reg[ii].sdp_handle) {
|
||||
SDP_DeleteRecord(gatt_cb.sr_reg[ii].sdp_handle);
|
||||
}
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
gatt_remove_a_srv_from_list(&gatt_cb.srv_list_info, &gatt_cb.srv_list[ii]);
|
||||
gatt_cb.srv_list[ii].in_use = FALSE;
|
||||
memset (&gatt_cb.sr_reg[ii], 0, sizeof(tGATT_SR_REG));
|
||||
@@ -562,7 +562,7 @@ void GATTS_StopService (UINT16 service_handle)
|
||||
** val_len: Length of the indicated attribute value.
|
||||
** p_val: Pointer to the indicated attribute value data.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent or queued; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent or queued; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id, UINT16 attr_handle, UINT16 val_len, UINT8 *p_val)
|
||||
@@ -629,7 +629,7 @@ tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id, UINT16 attr_handle, U
|
||||
** val_len: Length of the indicated attribute value.
|
||||
** p_val: Pointer to the indicated attribute value data.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_handle,
|
||||
@@ -677,7 +677,7 @@ tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_handle,
|
||||
** status: response status
|
||||
** p_msg: pointer to message parameters structure.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_SendRsp (UINT16 conn_id, UINT32 trans_id,
|
||||
@@ -1054,7 +1054,7 @@ tGATT_STATUS GATTC_Write (UINT16 conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE *p_
|
||||
** the server.
|
||||
**
|
||||
** Parameters conn_id: connection identifier.
|
||||
** is_execute - to execute or cancel the prepare write requet(s)
|
||||
** is_execute - to execute or cancel the prepare write request(s)
|
||||
**
|
||||
** Returns GATT_SUCCESS if command started successfully.
|
||||
**
|
||||
@@ -1232,7 +1232,7 @@ tGATT_IF GATT_Register (tBT_UUID *p_app_uuid128, tGATT_CBACK *p_cb_info)
|
||||
**
|
||||
** Description This function deregistered the application from GATT.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface.
|
||||
** Parameters gatt_if: application interface.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
@@ -1309,7 +1309,7 @@ void GATT_Deregister (tGATT_IF gatt_if)
|
||||
** callbacks for registered interface. Function may call back
|
||||
** with connection status and queued notifications
|
||||
**
|
||||
** Parameter gatt_if: applicaiton interface.
|
||||
** Parameter gatt_if: application interface.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
@@ -1342,13 +1342,13 @@ void GATT_StartIf (tGATT_IF gatt_if)
|
||||
**
|
||||
** Function GATT_Connect
|
||||
**
|
||||
** Description This function initiate a connecttion to a remote device on GATT
|
||||
** Description This function initiate a connection to a remote device on GATT
|
||||
** channel.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface
|
||||
** Parameters gatt_if: application interface
|
||||
** bd_addr: peer device address.
|
||||
** bd_addr_type: peer device address type.
|
||||
** is_direct: is a direct conenection or a background auto connection
|
||||
** is_direct: is a direct connection or a background auto connection
|
||||
**
|
||||
** Returns TRUE if connection started; FALSE if connection start failure.
|
||||
**
|
||||
@@ -1532,10 +1532,10 @@ tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr)
|
||||
** interface
|
||||
**
|
||||
** Parameters conn_id: connection id (input)
|
||||
** p_gatt_if: applicaiton interface (output)
|
||||
** p_gatt_if: application interface (output)
|
||||
** bd_addr: peer device address. (output)
|
||||
**
|
||||
** Returns TRUE the ligical link information is found for conn_id
|
||||
** Returns TRUE the logical link information is found for conn_id
|
||||
**
|
||||
*******************************************************************************/
|
||||
BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if, BD_ADDR bd_addr,
|
||||
@@ -1567,7 +1567,7 @@ BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if, BD_ADDR bd_
|
||||
** Description This function find the conn_id if the logical link for BD address
|
||||
** and applciation interface is connected
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface (input)
|
||||
** Parameters gatt_if: application interface (input)
|
||||
** bd_addr: peer device address. (input)
|
||||
** p_conn_id: connection id (output)
|
||||
** transport: transport option
|
||||
@@ -1599,7 +1599,7 @@ BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr, UINT16 *p_c
|
||||
** Description This function start or stop LE advertisement and listen for
|
||||
** connection.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface
|
||||
** Parameters gatt_if: application interface
|
||||
** p_bd_addr: listen for specific address connection, or NULL for
|
||||
** listen to all device connection.
|
||||
** start: start or stop listening.
|
||||
|
||||
@@ -392,7 +392,7 @@ tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb,
|
||||
p_rsp->len += (len + 2);
|
||||
*p_len -= (len + 2);
|
||||
} else {
|
||||
GATT_TRACE_ERROR("format mismatch");
|
||||
GATT_TRACE_WARNING("format mismatch");
|
||||
status = GATT_NO_RESOURCES;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connect
|
||||
UINT16 reason, tBT_TRANSPORT transport);
|
||||
static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf);
|
||||
static void gatt_le_cong_cback(BD_ADDR remote_bda, BOOLEAN congest);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 l2cap_cid,
|
||||
UINT16 psm, UINT8 l2cap_id);
|
||||
static void gatt_l2cif_connect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
|
||||
@@ -56,9 +56,9 @@ static void gatt_l2cif_config_cfm_cback (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cf
|
||||
static void gatt_l2cif_disconnect_ind_cback (UINT16 l2cap_cid, BOOLEAN ack_needed);
|
||||
static void gatt_l2cif_disconnect_cfm_cback (UINT16 l2cap_cid, UINT16 result);
|
||||
static void gatt_l2cif_data_ind_cback (UINT16 l2cap_cid, BT_HDR *p_msg);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
static void gatt_send_conn_cback (tGATT_TCB *p_tcb);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
static void gatt_l2cif_congest_cback (UINT16 cid, BOOLEAN congested);
|
||||
static const tL2CAP_APPL_INFO dyn_info = {
|
||||
gatt_l2cif_connect_ind_cback,
|
||||
@@ -73,7 +73,7 @@ static const tL2CAP_APPL_INFO dyn_info = {
|
||||
gatt_l2cif_congest_cback,
|
||||
NULL
|
||||
} ;
|
||||
#endif ///SMP_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
|
||||
#if GATT_DYNAMIC_MEMORY == FALSE
|
||||
tGATT_CB gatt_cb;
|
||||
@@ -125,12 +125,13 @@ void gatt_init (void)
|
||||
fixed_reg.default_idle_tout = 0xffff; /* 0xffff default idle timeout */
|
||||
|
||||
L2CA_RegisterFixedChannel (L2CAP_ATT_CID, &fixed_reg);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
/* Now, register with L2CAP for ATT PSM over BR/EDR */
|
||||
if (!L2CA_Register (BT_PSM_ATT, (tL2CAP_APPL_INFO *) &dyn_info)) {
|
||||
GATT_TRACE_ERROR ("ATT Dynamic Registration failed");
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
BTM_SetSecurityLevel(TRUE, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
|
||||
BTM_SetSecurityLevel(FALSE, "", BTM_SEC_SERVICE_ATT, BTM_SEC_NONE, BT_PSM_ATT, 0, 0);
|
||||
|
||||
@@ -221,12 +222,12 @@ BOOLEAN gatt_connect (BD_ADDR rem_bda, tBLE_ADDR_TYPE bd_addr_type, tGATT_TCB *p
|
||||
if (transport == BT_TRANSPORT_LE) {
|
||||
p_tcb->att_lcid = L2CAP_ATT_CID;
|
||||
gatt_ret = L2CA_ConnectFixedChnl (L2CAP_ATT_CID, rem_bda, bd_addr_type);
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
} else {
|
||||
if ((p_tcb->att_lcid = L2CA_ConnectReq(BT_PSM_ATT, rem_bda)) != 0) {
|
||||
gatt_ret = TRUE;
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
|
||||
}
|
||||
|
||||
@@ -262,10 +263,10 @@ BOOLEAN gatt_disconnect (tGATT_TCB *p_tcb)
|
||||
gatt_set_ch_state(p_tcb, GATT_CH_CLOSING);
|
||||
ret = L2CA_CancelBleConnectReq (p_tcb->peer_bda);
|
||||
}
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
} else {
|
||||
ret = L2CA_DisconnectReq(p_tcb->att_lcid);
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
}
|
||||
} else {
|
||||
GATT_TRACE_DEBUG ("gatt_disconnect already in closing state");
|
||||
@@ -581,7 +582,7 @@ static void gatt_le_data_ind (UINT16 chan, BD_ADDR bd_addr, BT_HDR *p_buf)
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||
#if (CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
static void gatt_l2cif_connect_ind_cback (BD_ADDR bd_addr, UINT16 lcid, UINT16 psm, UINT8 id)
|
||||
{
|
||||
/* do we already have a control channel for this peer? */
|
||||
@@ -887,7 +888,7 @@ static void gatt_l2cif_congest_cback (UINT16 lcid, BOOLEAN congested)
|
||||
}
|
||||
|
||||
}
|
||||
#endif ///CLASSIC_BT_INCLUDED == TRUE
|
||||
#endif ///CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
@@ -1027,7 +1028,7 @@ void gatt_add_a_bonded_dev_for_srv_chg (BD_ADDR bda)
|
||||
** Description This function is called to send a service changed indication to
|
||||
** the specified bd address
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code
|
||||
**
|
||||
*******************************************************************************/
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
|
||||
@@ -669,7 +669,7 @@ static tGATT_STATUS gatt_build_primary_service_rsp (BT_HDR *p_msg, tGATT_TCB *p_
|
||||
** Description fill the find information response information in the given
|
||||
** buffer.
|
||||
**
|
||||
** Returns TRUE: if data filled sucessfully.
|
||||
** Returns TRUE: if data filled successfully.
|
||||
** FALSE: packet full, or format mismatch.
|
||||
**
|
||||
*******************************************************************************/
|
||||
@@ -962,7 +962,7 @@ static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data)
|
||||
if ((p_buf = attp_build_sr_msg(p_tcb, GATT_RSP_MTU, (tGATT_SR_MSG *) &p_tcb->payload_size)) != NULL) {
|
||||
attp_send_sr_msg (p_tcb, p_buf);
|
||||
|
||||
/* Notify all registered applicaiton with new MTU size. Us a transaction ID */
|
||||
/* Notify all registered application with new MTU size. Us a transaction ID */
|
||||
/* of 0, as no response is allowed from applcations */
|
||||
|
||||
for (i = 0; i < GATT_MAX_APPS; i ++) {
|
||||
|
||||
@@ -94,7 +94,7 @@ void gatt_free_pending_ind(tGATT_TCB *p_tcb)
|
||||
if (p_tcb->pending_ind_q == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* release all queued indications */
|
||||
while (!fixed_queue_is_empty(p_tcb->pending_ind_q)) {
|
||||
osi_free(fixed_queue_try_dequeue(p_tcb->pending_ind_q));
|
||||
@@ -118,7 +118,7 @@ void gatt_free_pending_enc_queue(tGATT_TCB *p_tcb)
|
||||
if (p_tcb->pending_enc_clcb == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* release all queued indications */
|
||||
while (!fixed_queue_is_empty(p_tcb->pending_enc_clcb)) {
|
||||
osi_free(fixed_queue_try_dequeue(p_tcb->pending_enc_clcb));
|
||||
@@ -387,7 +387,7 @@ tGATT_HDL_LIST_ELEM *gatt_find_hdl_buffer_by_attr_handle(UINT16 attr_handle)
|
||||
p_list = p_list_info->p_first;
|
||||
|
||||
while (p_list != NULL) {
|
||||
if (p_list->in_use && (p_list->asgn_range.s_handle <= attr_handle)
|
||||
if (p_list->in_use && (p_list->asgn_range.s_handle <= attr_handle)
|
||||
&& (p_list->asgn_range.e_handle >= attr_handle)) {
|
||||
return (p_list);
|
||||
}
|
||||
@@ -1493,7 +1493,7 @@ tGATT_STATUS gatt_send_error_rsp (tGATT_TCB *p_tcb, UINT8 err_code, UINT8 op_cod
|
||||
return status;
|
||||
}
|
||||
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
#if (SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function gatt_add_sdp_record
|
||||
@@ -1559,7 +1559,7 @@ UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl)
|
||||
|
||||
return (sdp_handle);
|
||||
}
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
|
||||
#if GATT_CONFORMANCE_TESTING == TRUE
|
||||
/*******************************************************************************
|
||||
@@ -1887,7 +1887,7 @@ void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb )
|
||||
**
|
||||
** Function gatt_sr_update_cback_cnt
|
||||
**
|
||||
** Description Update the teh applicaiton callback count
|
||||
** Description Update the teh application callback count
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
@@ -1977,7 +1977,7 @@ BOOLEAN gatt_cancel_open(tGATT_IF gatt_if, BD_ADDR bda)
|
||||
**
|
||||
** Function gatt_find_app_hold_link
|
||||
**
|
||||
** Description find the applicaiton that is holding the specified link
|
||||
** Description find the application that is holding the specified link
|
||||
**
|
||||
** Returns Boolean
|
||||
**
|
||||
@@ -2002,7 +2002,7 @@ BOOLEAN gatt_find_app_hold_link(tGATT_TCB *p_tcb, UINT8 start_idx, UINT8 *p_foun
|
||||
**
|
||||
** Function gatt_find_specific_app_in_hold_link
|
||||
**
|
||||
** Description find the specific applicaiton that is holding the specified link
|
||||
** Description find the specific application that is holding the specified link
|
||||
**
|
||||
** Returns Boolean
|
||||
**
|
||||
|
||||
@@ -507,7 +507,7 @@ typedef struct {
|
||||
UINT16 next_handle; /* next available handle */
|
||||
tGATT_SVC_CHG gattp_attr; /* GATT profile attribute service change */
|
||||
tGATT_IF gatt_if;
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
tGATT_HDL_LIST_INFO hdl_list_info;
|
||||
tGATT_HDL_LIST_ELEM hdl_list[GATT_MAX_SR_PROFILES];
|
||||
tGATT_SRV_LIST_INFO srv_list_info;
|
||||
@@ -601,9 +601,9 @@ extern tGATT_STATUS attp_send_msg_to_l2cap(tGATT_TCB *p_tcb, BT_HDR *p_toL2CAP);
|
||||
|
||||
/* utility functions */
|
||||
extern UINT8 *gatt_dbg_op_name(UINT8 op_code);
|
||||
#if (SDP_INCLUDED == TRUE)
|
||||
#if (SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE)
|
||||
extern UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl);
|
||||
#endif ///SDP_INCLUDED == TRUE
|
||||
#endif ///SDP_INCLUDED == TRUE && CLASSIC_BT_GATT_INCLUDED == TRUE
|
||||
extern BOOLEAN gatt_parse_uuid_from_cmd(tBT_UUID *p_uuid, UINT16 len, UINT8 **p_data);
|
||||
extern UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid);
|
||||
extern BOOLEAN gatt_uuid_compare(tBT_UUID src, tBT_UUID tar);
|
||||
@@ -725,16 +725,16 @@ extern BOOLEAN gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service, B
|
||||
extern UINT16 gatts_add_included_service (tGATT_SVC_DB *p_db, UINT16 s_handle, UINT16 e_handle, tBT_UUID service);
|
||||
extern UINT16 gatts_add_characteristic (tGATT_SVC_DB *p_db, tGATT_PERM perm,
|
||||
tGATT_CHAR_PROP property,
|
||||
tBT_UUID *p_char_uuid, tGATT_ATTR_VAL *attr_val,
|
||||
tBT_UUID *p_char_uuid, tGATT_ATTR_VAL *attr_val,
|
||||
tGATTS_ATTR_CONTROL *control);
|
||||
extern UINT16 gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm,
|
||||
extern UINT16 gatts_add_char_descr (tGATT_SVC_DB *p_db, tGATT_PERM perm,
|
||||
tBT_UUID *p_dscp_uuid, tGATT_ATTR_VAL *attr_val,
|
||||
tGATTS_ATTR_CONTROL *control);
|
||||
|
||||
extern tGATT_STATUS gatts_set_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
extern tGATT_STATUS gatts_set_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
UINT16 length, UINT8 *value);
|
||||
|
||||
extern tGATT_STATUS gatts_get_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
extern tGATT_STATUS gatts_get_attribute_value(tGATT_SVC_DB *p_db, UINT16 attr_handle,
|
||||
UINT16 *length, UINT8 **value);
|
||||
extern BOOLEAN gatts_is_auto_response(UINT16 attr_handle);
|
||||
extern tGATT_STATUS gatts_db_read_attr_value_by_type (tGATT_TCB *p_tcb, tGATT_SVC_DB *p_db, UINT8 op_code, BT_HDR *p_rsp, UINT16 s_handle,
|
||||
|
||||
@@ -21,14 +21,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifndef FALSE
|
||||
# define FALSE false
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
# define TRUE true
|
||||
#endif
|
||||
#include "bt_common.h"
|
||||
|
||||
typedef uint8_t UINT8;
|
||||
typedef uint16_t UINT16;
|
||||
@@ -524,19 +517,6 @@ typedef struct {
|
||||
typedef UINT8 tBT_DEVICE_TYPE;
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
/* Define trace levels */
|
||||
#define BT_TRACE_LEVEL_NONE 0 /* No trace messages to be generated */
|
||||
#define BT_TRACE_LEVEL_ERROR 1 /* Error condition trace messages */
|
||||
#define BT_TRACE_LEVEL_WARNING 2 /* Warning condition trace messages */
|
||||
#define BT_TRACE_LEVEL_API 3 /* API traces */
|
||||
#define BT_TRACE_LEVEL_EVENT 4 /* Debug messages for events */
|
||||
#define BT_TRACE_LEVEL_DEBUG 5 /* Full debug messages */
|
||||
#define BT_TRACE_LEVEL_VERBOSE 6 /* Verbose debug messages */
|
||||
|
||||
#define MAX_TRACE_LEVEL 6
|
||||
|
||||
|
||||
/* Define New Trace Type Definition */
|
||||
/* TRACE_CTRL_TYPE 0x^^000000*/
|
||||
#define TRACE_CTRL_MASK 0xff000000
|
||||
|
||||
@@ -1558,7 +1558,7 @@ typedef void (tBTM_MKEY_CALLBACK) (BD_ADDR bd_addr, UINT8 status, UINT8 key_flag
|
||||
** optional data passed in by BTM_SetEncryption
|
||||
** tBTM_STATUS - result of the operation
|
||||
*/
|
||||
typedef void (tBTM_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
|
||||
typedef void (tBTM_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
void *p_ref_data, tBTM_STATUS result);
|
||||
|
||||
/* Bond Cancel complete. Parameters are
|
||||
|
||||
@@ -105,7 +105,7 @@ typedef UINT8 tBTM_BLE_SFP;
|
||||
#endif
|
||||
|
||||
/* adv parameter boundary values */
|
||||
#define BTM_BLE_ADV_INT_MIN 0x0020
|
||||
#define BTM_BLE_ADV_INT_MIN 0x0010
|
||||
#define BTM_BLE_ADV_INT_MAX 0x4000
|
||||
|
||||
/* Full scan boundary values */
|
||||
@@ -448,7 +448,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
tBTM_BLE_INT_RANGE int_range; /* slave prefered conn interval range */
|
||||
tBTM_BLE_MANU *p_manu; /* manufactuer data */
|
||||
tBTM_BLE_MANU *p_manu; /* manufacturer data */
|
||||
tBTM_BLE_SERVICE *p_services; /* services */
|
||||
tBTM_BLE_128SERVICE *p_services_128b; /* 128 bits service */
|
||||
tBTM_BLE_32SERVICE *p_service_32b; /* 32 bits Service UUID */
|
||||
@@ -732,10 +732,10 @@ typedef struct {
|
||||
|
||||
typedef union {
|
||||
tBLE_BD_ADDR target_addr;
|
||||
tBTM_BLE_PF_LOCAL_NAME_COND local_name; /* lcoal name filtering */
|
||||
tBTM_BLE_PF_MANU_COND manu_data; /* manufactuer data filtering */
|
||||
tBTM_BLE_PF_LOCAL_NAME_COND local_name; /* local name filtering */
|
||||
tBTM_BLE_PF_MANU_COND manu_data; /* manufacturer data filtering */
|
||||
tBTM_BLE_PF_UUID_COND srvc_uuid; /* service UUID filtering */
|
||||
tBTM_BLE_PF_UUID_COND solicitate_uuid; /* solicitated service UUID filtering */
|
||||
tBTM_BLE_PF_UUID_COND solicitate_uuid; /* solicited service UUID filtering */
|
||||
tBTM_BLE_PF_SRVC_PATTERN_COND srvc_data; /* service data pattern */
|
||||
} tBTM_BLE_PF_COND_PARAM;
|
||||
|
||||
@@ -1052,9 +1052,9 @@ void BTM_BleReadAdvParams (UINT16 *adv_int_min, UINT16 *adv_int_max,
|
||||
**
|
||||
** Function BTM_BleObtainVendorCapabilities
|
||||
**
|
||||
** Description This function is called to obatin vendor capabilties
|
||||
** Description This function is called to obtain vendor capabilities
|
||||
**
|
||||
** Parameters p_cmn_vsc_cb - Returns the vednor capabilities
|
||||
** Parameters p_cmn_vsc_cb - Returns the vendor capabilities
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
|
||||
@@ -111,7 +111,7 @@ typedef UINT8 tGATT_STATUS;
|
||||
#define GATT_SIGN_CMD_WRITE 0xD2 /* changed in V4.0 1101-0010 (signed write) see write cmd above*/
|
||||
#define GATT_OP_CODE_MAX GATT_HANDLE_VALUE_CONF + 1 /* 0x1E = 30 + 1 = 31*/
|
||||
|
||||
#define GATT_COMMAND_FLAG 0x40 /* Command Flag: set to one means commond */
|
||||
#define GATT_COMMAND_FLAG 0x40 /* Command Flag: set to one means command */
|
||||
|
||||
#define GATT_HANDLE_IS_VALID(x) ((x) != 0)
|
||||
|
||||
@@ -131,7 +131,7 @@ typedef UINT16 tGATT_DISCONN_REASON;
|
||||
#define GATT_MAX_MTU_SIZE 517
|
||||
#endif
|
||||
|
||||
/* max legth of an attribute value
|
||||
/* max length of an attribute value
|
||||
*/
|
||||
#ifndef GATT_MAX_ATTR_LEN
|
||||
#define GATT_MAX_ATTR_LEN 600
|
||||
@@ -247,7 +247,7 @@ typedef UINT8 tGATT_FORMAT;
|
||||
/* Characteristic Presentation Format Descriptor value
|
||||
*/
|
||||
typedef struct {
|
||||
UINT16 unit; /* as UUIUD defined by SIG */
|
||||
UINT16 unit; /* as UUID defined by SIG */
|
||||
UINT16 descr; /* as UUID as defined by SIG */
|
||||
tGATT_FORMAT format;
|
||||
INT8 exp;
|
||||
@@ -317,7 +317,7 @@ typedef UINT8 tGATT_AUTH_REQ;
|
||||
typedef struct {
|
||||
UINT16 conn_id;
|
||||
UINT16 handle; /* attribute handle */
|
||||
UINT16 offset; /* attribute value offset, if no offfset is needed for the command, ignore it */
|
||||
UINT16 offset; /* attribute value offset, if no offset is needed for the command, ignore it */
|
||||
UINT16 len; /* length of attribute value */
|
||||
tGATT_AUTH_REQ auth_req; /* authentication request */
|
||||
UINT8 value[GATT_MAX_ATTR_LEN]; /* the actual attribute value */
|
||||
@@ -368,7 +368,7 @@ typedef struct {
|
||||
/* write request data */
|
||||
typedef struct {
|
||||
UINT16 handle; /* attribute handle */
|
||||
UINT16 offset; /* attribute value offset, if no offfset is needed for the command, ignore it */
|
||||
UINT16 offset; /* attribute value offset, if no offset is needed for the command, ignore it */
|
||||
UINT16 len; /* length of attribute value */
|
||||
UINT8 value[GATT_MAX_ATTR_LEN]; /* the actual attribute value */
|
||||
BOOLEAN need_rsp; /* need write response */
|
||||
@@ -468,7 +468,7 @@ typedef struct {
|
||||
*/
|
||||
typedef union {
|
||||
tGATT_READ_BY_TYPE service;
|
||||
tGATT_READ_BY_TYPE char_type; /* characterisitc type */
|
||||
tGATT_READ_BY_TYPE char_type; /* characteristic type */
|
||||
tGATT_READ_MULTI read_multiple;
|
||||
tGATT_READ_BY_HANDLE by_handle;
|
||||
tGATT_READ_PARTIAL partial;
|
||||
@@ -505,7 +505,7 @@ typedef UINT8 tGATTC_OPTYPE;
|
||||
/* characteristic declaration
|
||||
*/
|
||||
typedef struct {
|
||||
tGATT_CHAR_PROP char_prop; /* characterisitc properties */
|
||||
tGATT_CHAR_PROP char_prop; /* characteristic properties */
|
||||
UINT16 val_handle; /* characteristic value attribute handle */
|
||||
tBT_UUID char_uuid; /* characteristic UUID type */
|
||||
} tGATT_CHAR_DCLR_VAL;
|
||||
@@ -639,7 +639,7 @@ typedef struct {
|
||||
tGATTS_HNDL_RANGE *p_new_srv_start;
|
||||
} tGATTS_PENDING_NEW_SRV_START;
|
||||
|
||||
/* Attibute server handle ranges NV storage callback functions
|
||||
/* Attribute server handle ranges NV storage callback functions
|
||||
*/
|
||||
typedef void (tGATTS_NV_SAVE_CBACK)(BOOLEAN is_saved, tGATTS_HNDL_RANGE *p_hndl_range);
|
||||
typedef BOOLEAN (tGATTS_NV_SRV_CHG_CBACK)(tGATTS_SRV_CHG_CMD cmd, tGATTS_SRV_CHG_REQ *p_req,
|
||||
@@ -688,7 +688,7 @@ extern UINT8 GATT_SetTraceLevel (UINT8 new_level);
|
||||
**
|
||||
** Parameter p_hndl_range: pointer to allocated handles information
|
||||
**
|
||||
** Returns TRUE if handle range is added sucessfully; otherwise FALSE.
|
||||
** Returns TRUE if handle range is added successfully; otherwise FALSE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
@@ -724,7 +724,7 @@ extern BOOLEAN GATTS_NVRegister (tGATT_APPL_INFO *p_cb_info);
|
||||
** num_handles : number of handles needed by the service.
|
||||
** is_pri : is a primary service or not.
|
||||
**
|
||||
** Returns service handle if sucessful, otherwise 0.
|
||||
** Returns service handle if successful, otherwise 0.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
|
||||
@@ -819,7 +819,7 @@ extern BOOLEAN GATTS_DeleteService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid,
|
||||
** p_cback : application service callback functions.
|
||||
** sup_transport : supported transport(s) for this primary service
|
||||
**
|
||||
** return GATT_SUCCESS if sucessfully started; otherwise error code.
|
||||
** return GATT_SUCCESS if successfully started; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle,
|
||||
@@ -851,7 +851,7 @@ extern void GATTS_StopService (UINT16 service_handle);
|
||||
** val_len: Length of the indicated attribute value.
|
||||
** p_val: Pointer to the indicated attribute value data.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent or queued; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent or queued; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id,
|
||||
@@ -869,7 +869,7 @@ extern tGATT_STATUS GATTS_HandleValueIndication (UINT16 conn_id,
|
||||
** val_len: Length of the indicated attribute value.
|
||||
** p_val: Pointer to the indicated attribute value data.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_handle,
|
||||
@@ -887,7 +887,7 @@ extern tGATT_STATUS GATTS_HandleValueNotification (UINT16 conn_id, UINT16 attr_
|
||||
** status: response status
|
||||
** p_msg: pointer to message parameters structure.
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern tGATT_STATUS GATTS_SendRsp (UINT16 conn_id, UINT32 trans_id,
|
||||
@@ -904,7 +904,7 @@ extern tGATT_STATUS GATTS_SendRsp (UINT16 conn_id, UINT32 trans_id,
|
||||
** length: the attribute length
|
||||
** value: the value to be set to the attribute in the database
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_SetAttributeValue(UINT16 attr_handle, UINT16 length, UINT8 *value);
|
||||
@@ -920,7 +920,7 @@ tGATT_STATUS GATTS_SetAttributeValue(UINT16 attr_handle, UINT16 length, UINT8 *v
|
||||
** length:the attribute value length in the database
|
||||
** value: the attribute value out put
|
||||
**
|
||||
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code.
|
||||
** Returns GATT_SUCCESS if successfully sent; otherwise error code.
|
||||
**
|
||||
*******************************************************************************/
|
||||
tGATT_STATUS GATTS_GetAttributeValue(UINT16 attr_handle, UINT16 *length, UINT8 **value);
|
||||
@@ -1005,7 +1005,7 @@ extern tGATT_STATUS GATTC_Write (UINT16 conn_id, tGATT_WRITE_TYPE type,
|
||||
** the server.
|
||||
**
|
||||
** Parameters conn_id: connection identifier.
|
||||
** is_execute - to execute or cancel the prepare write requet(s)
|
||||
** is_execute - to execute or cancel the prepare write request(s)
|
||||
**
|
||||
** Returns GATT_SUCCESS if command started successfully.
|
||||
**
|
||||
@@ -1037,7 +1037,7 @@ extern tGATT_STATUS GATTC_SendHandleValueConfirm (UINT16 conn_id, UINT16 handle)
|
||||
**
|
||||
** Parameter bd_addr: target device bd address.
|
||||
** idle_tout: timeout value in seconds.
|
||||
** transport: trasnport option.
|
||||
** transport: transport option.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
@@ -1067,7 +1067,7 @@ extern tGATT_IF GATT_Register (tBT_UUID *p_app_uuid128, tGATT_CBACK *p_cb_info)
|
||||
**
|
||||
** Description This function deregistered the application from GATT.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface.
|
||||
** Parameters gatt_if: application interface.
|
||||
**
|
||||
** Returns None.
|
||||
**
|
||||
@@ -1082,7 +1082,7 @@ extern void GATT_Deregister (tGATT_IF gatt_if);
|
||||
** callbacks for registered interface. Function may call back
|
||||
** with connection status and queued notifications
|
||||
**
|
||||
** Parameter gatt_if: applicaiton interface.
|
||||
** Parameter gatt_if: application interface.
|
||||
**
|
||||
** Returns None
|
||||
**
|
||||
@@ -1093,13 +1093,13 @@ extern void GATT_StartIf (tGATT_IF gatt_if);
|
||||
**
|
||||
** Function GATT_Connect
|
||||
**
|
||||
** Description This function initiate a connecttion to a remote device on GATT
|
||||
** Description This function initiate a connection to a remote device on GATT
|
||||
** channel.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface
|
||||
** Parameters gatt_if: application interface
|
||||
** bd_addr: peer device address.
|
||||
** bd_addr_type: peer device address type.
|
||||
** is_direct: is a direct conenection or a background auto connection
|
||||
** is_direct: is a direct connection or a background auto connection
|
||||
** transport : Physical transport for GATT connection (BR/EDR or LE)
|
||||
**
|
||||
** Returns TRUE if connection started; FALSE if connection start failure.
|
||||
@@ -1119,7 +1119,7 @@ extern BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE b
|
||||
** Parameters gatt_if: client interface. If 0 used as unconditionally disconnect,
|
||||
** typically used for direct connection cancellation.
|
||||
** bd_addr: peer device address.
|
||||
** is_direct: is a direct conenection or a background auto connection
|
||||
** is_direct: is a direct connection or a background auto connection
|
||||
**
|
||||
** Returns TRUE if connection started; FALSE if connection start failure.
|
||||
**
|
||||
@@ -1158,15 +1158,15 @@ extern tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr);
|
||||
**
|
||||
** Function GATT_GetConnectionInfor
|
||||
**
|
||||
** Description This function use conn_id to find its associated BD address and applciation
|
||||
** Description This function use conn_id to find its associated BD address and application
|
||||
** interface
|
||||
**
|
||||
** Parameters conn_id: connection id (input)
|
||||
** p_gatt_if: applicaiton interface (output)
|
||||
** p_gatt_if: application interface (output)
|
||||
** bd_addr: peer device address. (output)
|
||||
** transport : physical transport of the GATT connection (BR/EDR or LE)
|
||||
**
|
||||
** Returns TRUE the ligical link information is found for conn_id
|
||||
** Returns TRUE the logical link information is found for conn_id
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if,
|
||||
@@ -1178,14 +1178,14 @@ extern BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if,
|
||||
** Function GATT_GetConnIdIfConnected
|
||||
**
|
||||
** Description This function find the conn_id if the logical link for BD address
|
||||
** and applciation interface is connected
|
||||
** and application interface is connected
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface (input)
|
||||
** Parameters gatt_if: application interface (input)
|
||||
** bd_addr: peer device address. (input)
|
||||
** p_conn_id: connection id (output)
|
||||
** transport : physical transport of the GATT connection (BR/EDR or LE)
|
||||
**
|
||||
** Returns TRUE the ligical link is connected
|
||||
** Returns TRUE the logical link is connected
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr,
|
||||
@@ -1199,10 +1199,10 @@ extern BOOLEAN GATT_GetConnIdIfConnected(tGATT_IF gatt_if, BD_ADDR bd_addr,
|
||||
** Description This function start or stop LE advertisement and listen for
|
||||
** connection.
|
||||
**
|
||||
** Parameters gatt_if: applicaiton interface
|
||||
** Parameters gatt_if: application interface
|
||||
** p_bd_addr: listen for specific address connection, or NULL for
|
||||
** listen to all device connection.
|
||||
** start: is a direct conenection or a background auto connection
|
||||
** start: is a direct connection or a background auto connection
|
||||
**
|
||||
** Returns TRUE if advertisement is started; FALSE if adv start failure.
|
||||
**
|
||||
|
||||
@@ -1521,8 +1521,7 @@ typedef struct {
|
||||
|
||||
#define HCI_FEATURE_SWITCH_MASK 0x20
|
||||
#define HCI_FEATURE_SWITCH_OFF 0
|
||||
// temporarily disable ROLE_SWITCH since there is an issue to be fixed
|
||||
#define HCI_SWITCH_SUPPORTED(x) (0 & ((x)[HCI_FEATURE_SWITCH_OFF] & HCI_FEATURE_SWITCH_MASK))
|
||||
#define HCI_SWITCH_SUPPORTED(x) ((x)[HCI_FEATURE_SWITCH_OFF] & HCI_FEATURE_SWITCH_MASK)
|
||||
|
||||
#define HCI_FEATURE_HOLD_MODE_MASK 0x40
|
||||
#define HCI_FEATURE_HOLD_MODE_OFF 0
|
||||
|
||||
@@ -623,6 +623,17 @@ extern int PORT_Test (UINT16 handle, UINT8 *p_data, UINT16 len);
|
||||
*******************************************************************************/
|
||||
extern void RFCOMM_Init (void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function RFCOMM_Deinit
|
||||
**
|
||||
** Description This function is called to deinitialize the control block
|
||||
** for this layer.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
extern void RFCOMM_Deinit(void);
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
|
||||
@@ -251,7 +251,7 @@ typedef struct {
|
||||
tL2CAP_APPL_INFO api;
|
||||
} tL2C_RCB;
|
||||
|
||||
typedef void (tL2CAP_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT trasnport,
|
||||
typedef void (tL2CAP_SEC_CBACK) (BD_ADDR bd_addr, tBT_TRANSPORT transport,
|
||||
void *p_ref_data, tBTM_STATUS result);
|
||||
|
||||
typedef struct
|
||||
@@ -723,7 +723,7 @@ extern void l2c_link_process_num_completed_blocks (UINT8 controller_id, UINT
|
||||
extern void l2c_link_processs_num_bufs (UINT16 num_lm_acl_bufs);
|
||||
extern UINT8 l2c_link_pkts_rcvd (UINT16 *num_pkts, UINT16 *handles);
|
||||
extern void l2c_link_role_changed (BD_ADDR bd_addr, UINT8 new_role, UINT8 hci_status);
|
||||
extern void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT trasnport, void *p_ref_data, UINT8 status);
|
||||
extern void l2c_link_sec_comp (BD_ADDR p_bda, tBT_TRANSPORT transport, void *p_ref_data, UINT8 status);
|
||||
extern void l2c_link_segments_xmitted (BT_HDR *p_msg);
|
||||
extern void l2c_pin_code_request (BD_ADDR bd_addr);
|
||||
extern void l2c_link_adjust_chnl_allocation (void);
|
||||
|
||||
@@ -1871,6 +1871,14 @@ BOOLEAN L2CA_CheckIsCongest(UINT16 fixed_cid, UINT16 handle)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
UINT16 L2CA_GetFreePktBufferNum_LE(void)
|
||||
{
|
||||
return l2cb.controller_le_xmit_window;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function L2CA_RemoveFixedChnl
|
||||
|
||||
@@ -250,7 +250,7 @@ BOOLEAN l2c_link_hci_conn_comp (UINT8 status, UINT16 handle, BD_ADDR p_bda)
|
||||
l2cu_release_lcb (p_lcb);
|
||||
} else { /* there are any CCBs remaining */
|
||||
if (ci.status == HCI_ERR_CONNECTION_EXISTS) {
|
||||
/* we are in collision situation, wait for connecttion request from controller */
|
||||
/* we are in collision situation, wait for connection request from controller */
|
||||
p_lcb->link_state = LST_CONNECTING;
|
||||
} else {
|
||||
l2cu_create_conn(p_lcb, BT_TRANSPORT_BR_EDR);
|
||||
|
||||
@@ -1729,6 +1729,26 @@ void RFCOMM_Init (void)
|
||||
rfcomm_l2cap_if_init ();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function RFCOMM_Deinit
|
||||
**
|
||||
** Description This function is called to deinitialize the control block
|
||||
** for this layer.
|
||||
**
|
||||
** Returns void
|
||||
**
|
||||
*******************************************************************************/
|
||||
void RFCOMM_Deinit(void)
|
||||
{
|
||||
#if RFC_DYNAMIC_MEMORY == TRUE
|
||||
if (rfc_cb_ptr){
|
||||
osi_free(rfc_cb_ptr);
|
||||
rfc_cb_ptr = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
** Function PORT_SetTraceLevel
|
||||
|
||||
@@ -1715,13 +1715,13 @@ void smp_match_dhkey_checks(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
|
||||
SMP_TRACE_DEBUG("%s\n", __func__);
|
||||
|
||||
if (memcmp(p_data->key.p_data, p_cb->remote_dhkey_check, BT_OCTET16_LEN)) {
|
||||
SMP_TRACE_WARNING ("dhkey chcks do no match\n");
|
||||
SMP_TRACE_WARNING ("dhkey checks do no match\n");
|
||||
p_cb->failure = reason;
|
||||
smp_sm_event(p_cb, SMP_AUTH_CMPL_EVT, &reason);
|
||||
return;
|
||||
}
|
||||
|
||||
SMP_TRACE_EVENT ("dhkey chcks match\n");
|
||||
SMP_TRACE_EVENT ("dhkey checks match\n");
|
||||
|
||||
/* compare the max encryption key size, and save the smaller one for the link */
|
||||
if (p_cb->peer_enc_size < p_cb->loc_enc_size) {
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "smp_int.h"
|
||||
#include "device/controller.h"
|
||||
#include "btm_int.h"
|
||||
#include "common/bte_appl.h"
|
||||
|
||||
#define SMP_PAIRING_REQ_SIZE 7
|
||||
#define SMP_CONFIRM_CMD_SIZE (BT_OCTET16_LEN + 1)
|
||||
@@ -590,7 +591,7 @@ static BT_HDR *smp_build_id_addr_cmd(UINT8 cmd_code, tSMP_CB *p_cb)
|
||||
p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET;
|
||||
|
||||
UINT8_TO_STREAM (p, SMP_OPCODE_ID_ADDR);
|
||||
/* Identity Address Information is used in the Transport Specific Key Distribution phase to distribute
|
||||
/* Identity Address Information is used in the Transport Specific Key Distribution phase to distribute
|
||||
its public device address or static random address. if slave using static random address is encrypted,
|
||||
it should distribute its static random address */
|
||||
if(btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type == BLE_ADDR_RANDOM && memcmp(btm_cb.ble_ctr_cb.addr_mgnt_cb.static_rand_addr, btm_cb.ble_ctr_cb.addr_mgnt_cb.private_addr,6) == 0) {
|
||||
@@ -1119,9 +1120,27 @@ BOOLEAN smp_pairing_request_response_parameters_are_valid(tSMP_CB *p_cb)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((enc_size < SMP_ENCR_KEY_SIZE_MIN) || (enc_size > SMP_ENCR_KEY_SIZE_MAX)) {
|
||||
/* `bte_appl_cfg.ble_min_enc_key_size` will be `SMP_ENCR_KEY_SIZE_MIN` by
|
||||
* default if not set explicitly */
|
||||
#if (BLE_INCLUDED == TRUE)
|
||||
if (enc_size < bte_appl_cfg.ble_min_key_size) {
|
||||
SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with Maximum Encryption \
|
||||
Key value (0x%02x) out of range).\n",
|
||||
Key value (0x%02x) less than minimum required key size).\n",
|
||||
p_cb->rcvd_cmd_code, enc_size);
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
if (enc_size < SMP_ENCR_KEY_SIZE_MIN) {
|
||||
SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with Maximum Encryption \
|
||||
Key value (0x%02x) less than minimum required key size).\n",
|
||||
p_cb->rcvd_cmd_code, enc_size);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (enc_size > SMP_ENCR_KEY_SIZE_MAX) {
|
||||
SMP_TRACE_WARNING("Rcvd from the peer cmd 0x%02x with Maximum Encryption \
|
||||
Key value (0x%02x) greater than supported by stack).\n",
|
||||
p_cb->rcvd_cmd_code, enc_size);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -37,14 +37,15 @@
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_pm.h"
|
||||
#include "esp_ipc.h"
|
||||
#include "driver/periph_ctrl.h"
|
||||
#include "soc/rtc.h"
|
||||
#include "soc/rtc_cntl_reg.h"
|
||||
#include "soc/soc_memory_layout.h"
|
||||
#include "esp_clk.h"
|
||||
#include "esp_coexist_internal.h"
|
||||
|
||||
#if !CONFIG_FREERTOS_UNICORE
|
||||
#include "esp_ipc.h"
|
||||
#endif
|
||||
|
||||
#if CONFIG_BT_ENABLED
|
||||
|
||||
@@ -218,6 +219,7 @@ extern int coex_bt_release_wrapper(uint32_t event);
|
||||
extern int coex_register_bt_cb_wrapper(coex_func_cb_t cb);
|
||||
extern uint32_t coex_bb_reset_lock_wrapper(void);
|
||||
extern void coex_bb_reset_unlock_wrapper(uint32_t restore);
|
||||
extern void coex_ble_adv_priority_high_set(bool high);
|
||||
|
||||
extern char _bss_start_btdm;
|
||||
extern char _bss_end_btdm;
|
||||
@@ -727,7 +729,7 @@ static void task_delete_wrapper(void *task_handle)
|
||||
|
||||
static bool IRAM_ATTR is_in_isr_wrapper(void)
|
||||
{
|
||||
return (bool)xPortInIsrContext();
|
||||
return !xPortCanYield();
|
||||
}
|
||||
|
||||
static void IRAM_ATTR cause_sw_intr(void *arg)
|
||||
@@ -741,18 +743,21 @@ static int IRAM_ATTR cause_sw_intr_to_core_wrapper(int core_id, int intr_no)
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
#if CONFIG_FREERTOS_UNICORE
|
||||
cause_sw_intr((void *)intr_no);
|
||||
#else /* CONFIG_FREERTOS_UNICORE */
|
||||
if (xPortGetCoreID() == core_id) {
|
||||
cause_sw_intr((void *)intr_no);
|
||||
} else {
|
||||
err = esp_ipc_call(core_id, cause_sw_intr, (void *)intr_no);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_FREERTOS_UNICORE */
|
||||
return err;
|
||||
}
|
||||
|
||||
static void *malloc_internal_wrapper(size_t size)
|
||||
{
|
||||
return heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL);
|
||||
return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL);
|
||||
}
|
||||
|
||||
static int32_t IRAM_ATTR read_mac_wrapper(uint8_t mac[6])
|
||||
@@ -1161,6 +1166,12 @@ esp_err_t esp_bt_controller_init(esp_bt_controller_config_t *cfg)
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BTDM_COEX_BLE_ADV_HIGH_PRIORITY
|
||||
coex_ble_adv_priority_high_set(true);
|
||||
#else
|
||||
coex_ble_adv_priority_high_set(false);
|
||||
#endif
|
||||
|
||||
btdm_controller_status = ESP_BT_CONTROLLER_STATUS_INITED;
|
||||
|
||||
return ESP_OK;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "btc/btc_task.h"
|
||||
#include "btc/btc_alarm.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
void btc_alarm_handler(btc_msg_t *msg)
|
||||
{
|
||||
@@ -14,10 +14,7 @@
|
||||
|
||||
|
||||
#include "btc/btc_task.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "osi/thread.h"
|
||||
#include "esp_bt_defs.h"
|
||||
#include "esp_gatt_defs.h"
|
||||
|
||||
static void *btc_profile_cb_tab[BTC_PID_NUM] = {};
|
||||
|
||||
@@ -14,12 +14,14 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "common/bt_target.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "common/bt_trace.h"
|
||||
#include "osi/thread.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "esp_log.h"
|
||||
#include "bt_common.h"
|
||||
#include "osi/allocator.h"
|
||||
#include "btc/btc_alarm.h"
|
||||
#ifdef CONFIG_BLUEDROID_ENABLED
|
||||
#include "common/bt_target.h"
|
||||
#include "btc/btc_main.h"
|
||||
#include "btc/btc_dev.h"
|
||||
#include "btc_gatts.h"
|
||||
@@ -28,7 +30,6 @@
|
||||
#include "btc_gap_ble.h"
|
||||
#include "btc_blufi_prf.h"
|
||||
#include "btc/btc_dm.h"
|
||||
#include "btc/btc_alarm.h"
|
||||
#include "bta/bta_gatt_api.h"
|
||||
#if CONFIG_CLASSIC_BT_ENABLED
|
||||
#include "btc/btc_profile_queue.h"
|
||||
@@ -46,12 +47,23 @@
|
||||
#include "btc_hf_client.h"
|
||||
#endif /* #if BTC_HF_CLIENT_INCLUDED */
|
||||
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
|
||||
#endif
|
||||
|
||||
#if CONFIG_BLE_MESH
|
||||
#include "btc_ble_mesh_prov.h"
|
||||
#include "btc_ble_mesh_health_model.h"
|
||||
#include "btc_ble_mesh_config_model.h"
|
||||
#include "btc_ble_mesh_generic_model.h"
|
||||
#include "btc_ble_mesh_lighting_model.h"
|
||||
#include "btc_ble_mesh_sensor_model.h"
|
||||
#include "btc_ble_mesh_time_scene_model.h"
|
||||
#endif /* #if CONFIG_BLE_MESH */
|
||||
|
||||
static xTaskHandle xBtcTaskHandle = NULL;
|
||||
static xQueueHandle xBtcQueue = 0;
|
||||
|
||||
static btc_func_t profile_tab[BTC_PID_NUM] = {
|
||||
#ifdef CONFIG_BLUEDROID_ENABLED
|
||||
[BTC_PID_MAIN_INIT] = {btc_main_call_handler, NULL },
|
||||
[BTC_PID_DEV] = {btc_dev_call_handler, NULL },
|
||||
#if (GATTS_INCLUDED == TRUE)
|
||||
@@ -70,7 +82,9 @@ static btc_func_t profile_tab[BTC_PID_NUM] = {
|
||||
[BTC_PID_BLUFI] = {btc_blufi_call_handler, btc_blufi_cb_handler },
|
||||
#endif ///GATTS_INCLUDED == TRUE
|
||||
[BTC_PID_DM_SEC] = {NULL, btc_dm_sec_cb_handler },
|
||||
#endif
|
||||
[BTC_PID_ALARM] = {btc_alarm_handler, NULL },
|
||||
#ifdef CONFIG_BLUEDROID_ENABLED
|
||||
#if CONFIG_CLASSIC_BT_ENABLED
|
||||
#if (BTC_GAP_BT_INCLUDED == TRUE)
|
||||
[BTC_PID_GAP_BT] = {btc_gap_bt_call_handler, btc_gap_bt_cb_handler },
|
||||
@@ -87,6 +101,23 @@ static btc_func_t profile_tab[BTC_PID_NUM] = {
|
||||
[BTC_PID_HF_CLIENT] = {btc_hf_client_call_handler, btc_hf_client_cb_handler},
|
||||
#endif /* #if BTC_HF_CLIENT_INCLUDED */
|
||||
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
|
||||
#endif
|
||||
#if CONFIG_BLE_MESH
|
||||
[BTC_PID_PROV] = {btc_ble_mesh_prov_call_handler, btc_ble_mesh_prov_cb_handler },
|
||||
[BTC_PID_MODEL] = {btc_ble_mesh_model_call_handler, btc_ble_mesh_model_cb_handler },
|
||||
[BTC_PID_HEALTH_CLIENT] = {btc_ble_mesh_health_client_call_handler, btc_ble_mesh_health_client_cb_handler },
|
||||
[BTC_PID_HEALTH_SERVER] = {btc_ble_mesh_health_server_call_handler, btc_ble_mesh_health_server_cb_handler },
|
||||
[BTC_PID_CONFIG_CLIENT] = {btc_ble_mesh_config_client_call_handler, btc_ble_mesh_config_client_cb_handler },
|
||||
[BTC_PID_CONFIG_SERVER] = {NULL, btc_ble_mesh_config_server_cb_handler },
|
||||
[BTC_PID_GENERIC_CLIENT] = {btc_ble_mesh_generic_client_call_handler, btc_ble_mesh_generic_client_cb_handler },
|
||||
[BTC_PID_LIGHTING_CLIENT] = {btc_ble_mesh_lighting_client_call_handler, btc_ble_mesh_lighting_client_cb_handler },
|
||||
[BTC_PID_SENSOR_CLIENT] = {btc_ble_mesh_sensor_client_call_handler, btc_ble_mesh_sensor_client_cb_handler },
|
||||
[BTC_PID_TIME_SCENE_CLIENT] = {btc_ble_mesh_time_scene_client_call_handler, btc_ble_mesh_time_scene_client_cb_handler},
|
||||
[BTC_PID_GENERIC_SERVER] = {NULL, btc_ble_mesh_generic_server_cb_handler },
|
||||
[BTC_PID_LIGHTING_SERVER] = {NULL, btc_ble_mesh_lighting_server_cb_handler },
|
||||
[BTC_PID_SENSOR_SERVER] = {NULL, btc_ble_mesh_sensor_server_cb_handler },
|
||||
[BTC_PID_TIME_SCENE_SERVER] = {NULL, btc_ble_mesh_time_scene_server_cb_handler},
|
||||
#endif /* #if CONFIG_BLE_MESH */
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -169,7 +200,10 @@ int btc_init(void)
|
||||
if (xBtcTaskHandle == NULL || xBtcQueue == 0){
|
||||
return BT_STATUS_NOMEM;
|
||||
}
|
||||
#ifdef CONFIG_BLUEDROID_ENABLED
|
||||
btc_gap_callback_init();
|
||||
#endif
|
||||
|
||||
#if SCAN_QUEUE_CONGEST_CHECK
|
||||
btc_adv_list_init();
|
||||
#endif
|
||||
@@ -191,7 +225,7 @@ void btc_deinit(void)
|
||||
bool btc_check_queue_is_congest(void)
|
||||
{
|
||||
UBaseType_t wait_size = uxQueueMessagesWaiting(xBtcQueue);
|
||||
if(wait_size >= QUEUE_CONGEST_SIZE) {
|
||||
if(wait_size >= BT_QUEUE_CONGEST_SIZE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -15,9 +15,7 @@
|
||||
#ifndef __BTC_MANAGE_H__
|
||||
#define __BTC_MANAGE_H__
|
||||
|
||||
#include "bta/bta_api.h"
|
||||
#include "btc/btc_task.h"
|
||||
#include "esp_bt_defs.h"
|
||||
|
||||
/* reset gatt callback table */
|
||||
void esp_profile_cb_reset(void);
|
||||
@@ -16,10 +16,13 @@
|
||||
#define __BTC_TASK_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "common/bt_target.h"
|
||||
#include "common/bt_defs.h"
|
||||
#include "bt_common.h"
|
||||
#include "osi/thread.h"
|
||||
|
||||
#if CONFIG_BLUEDROID_ENABLED
|
||||
#include "common/bt_target.h"
|
||||
#endif
|
||||
|
||||
typedef struct btc_msg {
|
||||
uint8_t sig; //event signal
|
||||
uint8_t aid; //application id
|
||||
@@ -63,6 +66,22 @@ typedef enum {
|
||||
BTC_PID_HF_CLIENT,
|
||||
#endif /* BTC_HF_CLIENT_INCLUDED */
|
||||
#endif /* CONFIG_CLASSIC_BT_ENABLED */
|
||||
#if CONFIG_BLE_MESH
|
||||
BTC_PID_PROV,
|
||||
BTC_PID_MODEL,
|
||||
BTC_PID_HEALTH_CLIENT,
|
||||
BTC_PID_HEALTH_SERVER,
|
||||
BTC_PID_CONFIG_CLIENT,
|
||||
BTC_PID_CONFIG_SERVER,
|
||||
BTC_PID_GENERIC_CLIENT,
|
||||
BTC_PID_LIGHTING_CLIENT,
|
||||
BTC_PID_SENSOR_CLIENT,
|
||||
BTC_PID_TIME_SCENE_CLIENT,
|
||||
BTC_PID_GENERIC_SERVER,
|
||||
BTC_PID_LIGHTING_SERVER,
|
||||
BTC_PID_SENSOR_SERVER,
|
||||
BTC_PID_TIME_SCENE_SERVER,
|
||||
#endif /* CONFIG_BLE_MESH */
|
||||
BTC_PID_NUM,
|
||||
} btc_pid_t; //btc profile id
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user