Compare commits

...

107 Commits

Author SHA1 Message Date
Angus Gratton
70794a0776 Merge branch 'feature/ver-4.1' into 'master'
global: bump version to 4.1

See merge request espressif/esp-idf!5771
2019-08-14 09:01:48 +08:00
Ivan Grokhotkov
0a74227cfa bump version to 4.1 2019-08-13 10:09:52 +02:00
Angus Gratton
80a4a11808 Merge branch 'bugfix/fix_mbedtls_net_sockets_error_handling' into 'master'
mbedtls: use `errno` instead of `SO_ERROR` for getting socket errors

See merge request espressif/esp-idf!5727
2019-08-13 14:38:28 +08:00
Angus Gratton
0c00aae906 Merge branch 'feature/migrate_gh_action_to_yaml' into 'master'
gh_action: converted main.workflow to Actions V2 yml files

See merge request espressif/esp-idf!5758
2019-08-13 14:10:54 +08:00
Angus Gratton
aa2a972261 Merge branch 'bugfix/fix_encrypted_project_flash_arg_file_gen' into 'master'
CMake: fix encrypted project flash arg file generation

See merge request espressif/esp-idf!5741
2019-08-13 13:45:57 +08:00
Angus Gratton
e887190895 Merge branch 'feature/dport_eco_revision2' into 'master'
make dport workaround depend on chip revision

Closes IDF-809 and IDF-813

See merge request espressif/esp-idf!5606
2019-08-13 12:13:22 +08:00
Angus Gratton
f03a398512 Merge branch 'bugfix/doc_pip_requirements' into 'master'
Add -r flag to pip install command from file

Closes IDFGH-1670 and IDFGH-1622

See merge request espressif/esp-idf!5760
2019-08-13 11:42:35 +08:00
suda-morris
f86e82cb63 efuse: update the scheme of getting chip revision 2019-08-13 10:59:02 +08:00
Angus Gratton
5e39718c22 Merge branch 'bugfix/component_set_properties' into 'master'
CMake: Set component properties

See merge request espressif/esp-idf!5738
2019-08-13 10:23:30 +08:00
Jiang Jiang Jian
65b9032dba Merge branch 'bugfix/reuse_pmk_without_set_config' into 'master'
wifi: Avoid recalculating PMK when esp_wifi_set_config is not called

Closes IDFGH-1520

See merge request espressif/esp-idf!5745
2019-08-12 23:33:45 +08:00
Luke Bayes
0addc0aef1 Added -r flag to pip install command from file
Closes https://github.com/espressif/esp-idf/pull/3874
Closes https://github.com/espressif/esp-idf/issues/3915
2019-08-12 16:03:28 +02:00
suda-morris
b64551718c gh_action: converted main.workflow to Actions V2 yml files 2019-08-12 19:45:48 +08:00
Angus Gratton
212e7be28c Merge branch 'bugfix/core_id_arg' into 'master'
doc: Add clarifications Xtensa Core ID and "Core ID" used in FreeRTOS are different

Closes IDFGH-407

See merge request espressif/esp-idf!5661
2019-08-12 15:16:51 +08:00
Angus Gratton
9af30c4ff9 Merge branch 'ci/disable_nimble_tests' into 'master'
ci: Temporarily disable NimBLE tests in CI

See merge request espressif/esp-idf!5749
2019-08-12 15:14:23 +08:00
Angus Gratton
e8bdfe07ae Merge branch 'feature/tls_psk_authentication' into 'master'
esp_tls: add psk verification mode

Closes IDFGH-992

See merge request espressif/esp-idf!5095
2019-08-12 12:45:34 +08:00
Angus Gratton
b0ef3cdc9f Merge branch 'bugfix/check_include_dirs' into 'master'
CMake: Check if component include dirs are directories

See merge request espressif/esp-idf!5701
2019-08-12 12:45:11 +08:00
Angus Gratton
4fe74b8f64 freertos: Rename CORE_ID_PRO/CORE_ID_APP macros to CORE_ID_REGVAL_xxx
Old values remain for compatibility.

As suggested in https://github.com/espressif/esp-idf/issues/2567
2019-08-12 11:12:34 +10:00
Angus Gratton
a40e164988 doc: Add clarifications Xtensa Core ID and "Core ID" used in FreeRTOS are different
Closes https://github.com/espressif/esp-idf/issues/2567
2019-08-12 11:11:28 +10:00
Angus Gratton
8658b1633c ci: Temporarily disable NimBLE tests in CI 2019-08-12 09:38:44 +10:00
Angus Gratton
dedf346ccb Merge branch 'bugfix/hwcrypt_fault_inj' into 'master'
hwcrypto: Add more AES & SHA fault injection checks

Closes IDF-786

See merge request espressif/esp-idf!5050
2019-08-11 15:02:25 +08:00
Angus Gratton
aa3c988c17 sha: Add fault injection checks reading hash digest state
Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
2019-08-11 11:16:33 +10:00
Angus Gratton
caea2889c8 aes: Add fault injection checks when writing key to hardware
Vulnerability reported by LimitedResults under Espressif Bug Bounty Program.
2019-08-11 11:16:33 +10:00
Renz Christian Bagaporo
87ebdaa74e cmake: set component properties 2019-08-09 20:51:20 +08:00
Sagar Bijwe
b1f657fc65 wifi: Avoid recalculating PMK when esp_wifi_set_config is not called
Scenarios where this fix is applicable.
1) Every time the system is powered-on/restarted without calling
   esp_wifi_set_config.
2) esp_wifi_init()/connect()/stop()/deinit() is called multiple
   times without esp_wifi_set_config.

Closes IDFGH-1520
2019-08-09 16:28:33 +05:30
Renz Christian Bagaporo
e3c236d2fe cmake: fix encrypted project flash arg file generation 2019-08-09 16:35:31 +08:00
Jiang Jiang Jian
2b71eff25f Merge branch 'bugfix/efuse_write_config' into 'master'
efuse: set timing configuration before writing

See merge request espressif/esp-idf!4750
2019-08-09 14:25:45 +08:00
Angus Gratton
01f7e7cc16 Merge branch 'bugfix/confgen_sdkconfig_renames' into 'master'
tools: Support sdkconfig.rename files from outside IDF in confgen.py

Closes IDF-659

See merge request espressif/esp-idf!5551
2019-08-09 14:21:19 +08:00
Angus Gratton
d6b641949c Merge branch 'bugfix/httpd_sess_close' into 'master'
httpd_sess_close: Check for session validity before closing

See merge request espressif/esp-idf!5705
2019-08-09 14:20:51 +08:00
Angus Gratton
cb0f724e39 Merge branch 'feature/repl_suppl_crypto_by_mbedtls' into 'master'
wpa_supplicant: Port more crypto functions to use mbedtls

Closes WIFI-1590

See merge request espressif/esp-idf!5684
2019-08-09 12:52:03 +08:00
Angus Gratton
d6422229cf Merge branch 'bugfix/docs/white-space' into 'master'
🐛 Fix the white space bug in docs

Closes IDFGH-809

See merge request espressif/esp-idf!5693
2019-08-09 10:07:22 +08:00
Soumesh Banerjee
d47288d9db 🐛 Fix the white space bug in docs
Fix only the visual rendering the issue for selection of text still remains and have to be solved by updating the html generator
Closes #3208
2019-08-09 10:07:22 +08:00
Renz Christian Bagaporo
4dd2b9edb1 components: fix incorrect include dir args 2019-08-09 08:40:17 +08:00
Renz Christian Bagaporo
08de39c226 cmake: check include directories 2019-08-09 08:40:17 +08:00
Mahavir Jain
ab6ad844b1 mbedtls: use errno instead of SO_ERROR for getting socket errors
As per upgrade notes of lwIP v2.1.0:
socket API: according to the standard, SO_ERROR now only returns asynchronous errors.
All other/normal/synchronous errors are (and always were) available via 'errno'.
LWIP_SOCKET_SET_ERRNO has been removed - 'errno' is always set - and required!

Refer: https://www.nongnu.org/lwip/2_1_x/upgrading.html

Fixes https://github.com/espressif/esp-azure/issues/51
2019-08-08 12:17:32 +00:00
Angus Gratton
77bd32a503 Merge branch 'bugfix/libsodium_test_timeouts' into 'master'
test: Set timeout of libsodium ed25519_convert test to 60s

See merge request espressif/esp-idf!5552
2019-08-08 15:02:51 +08:00
Angus Gratton
c1e3e1cd9a Merge branch 'bugfix/fix_ledc_clock_select_bug' into 'master'
driver(ledc): fixed ledc clock selection bug

See merge request espressif/esp-idf!3612
2019-08-08 13:56:21 +08:00
Angus Gratton
cbb45b4559 Merge branch 'bugfix/config_panic_gdbstub_build_issue' into 'master'
esp32_gdbstub: fix build error with esp32-2019r1 toolchain

See merge request espressif/esp-idf!5709
2019-08-08 13:53:40 +08:00
Angus Gratton
14b8ea3b87 Merge branch 'feat/sdio_slave_efuse_default_3v3' into 'master'
sdio_slave: updates the document about DAT2 pin, also the version value read from CCCR registers

See merge request espressif/esp-idf!4733
2019-08-08 10:41:14 +08:00
Jiang Jiang Jian
562218d4db Merge branch 'feature/lwip_prefer_allocate_memory_in_psram' into 'master'
Try to allocate some memories in SPIRAM first. If failed, try to allocate in internal RAM then

See merge request espressif/esp-idf!5695
2019-08-07 21:00:14 +08:00
Michael (XIAO Xufeng)
3fd896fe64 sdio_slave: update version read from CCCR to 2.0 2019-08-07 17:10:34 +08:00
Michael (XIAO Xufeng)
07166a6b18 sdio_slave: rewrite the doc and highlight efuse-burning as the default option for 3.3V modules 2019-08-07 17:10:34 +08:00
Sagar Bijwe
80a5bd8e54 wpa_supplicant: Port more crypto functions to use mbedtls
Use mbedtls PBKDF2 and SHA1 for faster calculations during four-way
handshake.

Closes WIFI-1590
2019-08-07 07:23:28 +00:00
Mahavir Jain
5203a15439 esp32_gdbstub: fix build error with esp32-2019r1 toolchain
Fixes https://github.com/espressif/esp-idf/issues/3866
2019-08-07 11:56:13 +05:30
Angus Gratton
51d811a71c Merge branch 'bugfix/idf_tool_default_encoding' into 'master'
idf_tool: fix UnicodeDecodeError

Closes IDFGH-1584

See merge request espressif/esp-idf!5323
2019-08-07 13:24:54 +08:00
David Cermak
f3d6a34e7d esp_tls: enable psk verification mode, added mqtt example using psk authentication 2019-08-07 14:27:40 +10:00
Piyush Shah
c93cab858e httpd_sess_close: Check for session validity before closing
If httpd_sess_trigger_close() gets called twice for the same socket,
the first httpd_sess_close() cb closes the correct socket, but the second
invocation closes the wrong socket which was just accepted and added to
the socket db. Checking for the lru counter will help identify this as the
counter is set only for requests actually served.
2019-08-06 19:31:57 +05:30
kooho
2e8c85d8ff driver(ledc): fixed ledc clock selection bug. 2019-08-06 16:11:18 +08:00
Mahavir Jain
d260ee6955 Merge branch 'feature/coap_mbedtls_support' into 'master'
Add DTLS support to libcoap using MbedTLS

See merge request espressif/esp-idf!5560
2019-08-06 14:23:54 +08:00
Mahavir Jain
a8bfe59bd1 coap: refactor examples, stylistic cleanups, move certs to independent dir 2019-08-06 10:37:41 +05:30
Mahavir Jain
10c3b42f71 coap: kconfig cleanup, have component specific configuration for common options 2019-08-06 10:37:40 +05:30
Mahavir Jain
852c176a40 coap: add mbedtls in depedency list for CMake build 2019-08-06 10:37:40 +05:30
Jon Shallow
1aaec808da Add DTLS support to libcoap using MbedTLS
This update supports DTLS, TLS is a future TODO

components/coap/CMakeLists.txt:
components/coap/component.mk:

Add in the new files that have to be built
Replace libcoap/src/coap_notls.c with libcoap/src/coap_mbedtls.c

components/coap/libcoap:

Update the version to include the current version for supporting MbedTLS

components/coap/port/coap_debug.c:
components/coap/port/coap_mbedtls.c:
components/coap/port/include/coap/coap_dtls.h:

New port files for DTLS

components/coap/port/include/coap_config_posix.h:

Include building with MbedTLS

examples/protocols/coap_client/README.md:
examples/protocols/coap_client/main/CMakeLists.txt:
examples/protocols/coap_client/main/Kconfig.projbuild:
examples/protocols/coap_client/main/coap_client_example_main.c:
examples/protocols/coap_client/main/component.mk:

Update CoAP client to support DTLS

examples/protocols/coap_client/main/coap_ca.pem
examples/protocols/coap_client/main/coap_client.crt
examples/protocols/coap_client/main/coap_client.key

New PKI Certs for CoAP client (copied from wpa2_enterprise example)

examples/protocols/coap_server/README.md:
examples/protocols/coap_server/main/CMakeLists.txt:
examples/protocols/coap_server/main/Kconfig.projbuild:
examples/protocols/coap_server/main/coap_server_example_main.c:
examples/protocols/coap_server/main/component.mk:

Update CoAP server to support DTLS
Change "no data" to "Hello World!" to prevent confusion

examples/protocols/coap_server/main/coap_ca.pem
examples/protocols/coap_server/main/coap_server.crt
examples/protocols/coap_server/main/coap_server.key

New PKI Certs for CoAP server (copied from wpa2_enterprise example)

Closes https://github.com/espressif/esp-idf/pull/3345
Closes https://github.com/espressif/esp-idf/issues/1379
2019-08-06 10:37:40 +05:30
Angus Gratton
39f090a4f1 Merge branch 'deprecate/spi_common_claim_macros' into 'master'
spi_common: remove deprecated spi_common_periph_claim macros

See merge request espressif/esp-idf!5677
2019-08-06 11:16:17 +08:00
suda-morris
3753283ef3 idf_tool: fix unicode decode error
Closes https://github.com/espressif/esp-idf/issues/3841
2019-08-06 10:31:34 +08:00
xueyunfei
40e808c63b Try to allocate some LWIP memories in SPIRAM first. If failed, try to allocate in internal RAM then 2019-08-06 10:23:27 +08:00
Krzysztof Budzynski
6517c5033a Merge branch 'bugfix/docs_broken_links' into 'master'
Fix broken links in 'Getting Started' gudes

See merge request espressif/esp-idf!5685
2019-08-05 21:28:50 +08:00
Krzysztof Budzynski
06fb6213c5 Merge branch 'doc/add_Chinese_translation_for_modules-and-boards_in_hw-reference' into 'master'
Add Chinese translation for modules-and-boards.rst in hw-reference folder.

See merge request espressif/esp-idf!5520
2019-08-05 21:25:15 +08:00
Wang Fang
8d8ea6f698 Add Chinese translation for modules-and-boards.rst in hw-reference folder.
Note: Also modify the table in en version
2019-08-05 21:25:15 +08:00
Jiang Jiang Jian
2d36e42b5f Merge branch 'bugfix/fix_wifi_bugs_for_authmode_and_multi_ssid' into 'master'
wifi: fix wifi bugs for authmode and multi ssid

Closes WIFI-558, WIFI-560, WIFI-449, WIFI-567, and WIFI-597

See merge request espressif/esp-idf!5387
2019-08-05 21:18:27 +08:00
Michael (XIAO Xufeng)
26fc858ea4 spi_common: remove deprecated spi_common_periph_claim macros 2019-08-05 09:26:47 +00:00
Angus Gratton
ac5508efd5 Merge branch 'feature/idf_monitor_key_piority' into 'master'
idf_monitor: improve the responding of console commands

See merge request espressif/esp-idf!5585
2019-08-05 09:55:45 +08:00
Angus Gratton
7ef5fa8a0a Merge branch 'feature/transport_support_der_certs' into 'master'
tcp transport ssl DER-support

See merge request espressif/esp-idf!5627
2019-08-05 09:52:08 +08:00
Angus Gratton
b23718995a Merge branch 'bugfix/strict_prototypes' into 'master'
Enable strict prototypes checks

Closes IDFGH-757

See merge request espressif/esp-idf!4546
2019-08-05 09:38:39 +08:00
Angus Gratton
faeca72e24 Merge branch 'bugfix/update_example_docs_build_instructions_to_cmake' into 'master'
examples: change default build instructions in docs to CMake

See merge request espressif/esp-idf!5681
2019-08-05 08:08:53 +08:00
Jiang Jiang Jian
05094a9474 Merge branch 'bugfix/btdm_sleep_twice' into 'master'
bugfix btdm sleep twice after wakeup request

See merge request espressif/esp-idf!5637
2019-08-04 15:51:04 +08:00
Tian Hao
a9dfae66ea bugfix btdm sleep twice after wakeup request
This problem may cause HCI send command timeout.

When host call VHCI api to do btdm_wakeup_request, then controller
wakeup process will be handled in ISR and controller task context.
As host task priority is lower than controller task and ISR,
it will cause an incorrect behavior that before VHCI take the
rx_flow_on_semaphore, controller sleep again, then VHCI cannot take
the semaphore and has to wait the automatic wakeup.
2019-08-04 07:17:13 +00:00
Mahavir Jain
66440e5975 Merge branch 'feature/file_length_validation' into 'master'
esp_http_client: Add support to check the binary length of the recieved stream...

See merge request espressif/esp-idf!5635
2019-08-02 19:18:44 +08:00
Hrudaynath Dhabe
d4091f7cda esp_http_client: Add support to check the binary length of the recieved stream and compare it with the size mentioned in the header.
While downloading OTA firmware, if their is a Origin Respnse Timeout or the binary is only partially downloaded, OTA failure is observed. Checking binary size can also be helpful for simple http client applications.

Closes https://github.com/espressif/esp-idf/issues/3004
2019-08-02 19:18:44 +08:00
Mahavir Jain
e7dba7d7bc examples: change default build instructions in docs to CMake 2019-08-02 16:32:46 +05:30
Mahavir Jain
90a6855d01 Merge branch 'move/ble_example' into 'master'
examples/bluetooth: Move the demos to the appropriate locations

See merge request espressif/esp-idf!5667
2019-08-02 18:01:58 +08:00
Hrishikesh Dhayagude
146f120f79 examples/bluetooth: Move the demos to the appropriate locations 2019-08-02 18:01:58 +08:00
Krzysztof
164fd5ad29 More link corrections 2019-08-02 17:58:08 +08:00
Ivan Grokhotkov
90e1b7616c Merge branch 'bugfix/example_ext_flash_dio' into 'master'
examples: ext_flash_fatfs: use DIO mode by default

See merge request espressif/esp-idf!5645
2019-08-02 17:53:54 +08:00
Krzysztof
d163b9e615 Fix broken links in 'Getting Started' gudes 2019-08-02 17:09:33 +08:00
Angus Gratton
74ab6375cd Merge branch 'bugfix/gitignore_cmake_files' into 'master'
CMake: Added git ignore for cache files generated by cmake (PR)

See merge request espressif/esp-idf!5675
2019-08-02 15:52:06 +08:00
David Cermak
25dd5e39af esp-tls: Naming variables refering to certificates and keys in a neutral way to suggest that both PEM and DER format could be used, added comments descibing important details about using these formats 2019-08-02 09:25:16 +02:00
Henning Fleddermann
546b625433 add _der variants for esp_transport_ssl_set_(client_cert|client_key|cert_data)
Signed-off-by: David Cermak <cermak@espressif.com>

Merges https://github.com/espressif/esp-idf/pull/3783
2019-08-02 09:25:16 +02:00
Henning Fleddermann
73624e8560 modify comments on esp_tls_cfg, to clarify that other formats besides PEM (such as DER) might be used as well depending on mbedtls-support
Signed-off-by: David Cermak <cermak@espressif.com>
2019-08-02 09:25:16 +02:00
zhangyanjiao
02e5266778 modify WIFI_CONN_0101 case for wrong authmode of AP 2019-08-02 10:22:46 +08:00
zhangyanjiao
9f9d876799 wifi: fix wifi bugs for authmode and multi ssid 2019-08-02 10:22:20 +08:00
Jiang Jiang Jian
096b741a23 Merge branch 'bugfix/fix_the_wrong_comment_in_esp_wifi_types.h' into 'master'
fix the wrong comment in esp_wifi_types.h

See merge request espressif/esp-idf!5676
2019-08-01 21:15:52 +08:00
zhangyanjiao
017a60a69d fix the wrong comment in esp_wifi_types.h 2019-08-01 12:24:08 +00:00
RevoluPowered
e639d5cb84 CMake: Added git ignore for cache files generated by cmake
Merges https://github.com/espressif/esp-idf/pull/3639
2019-08-01 17:59:54 +08:00
Anton Maklakov
ec94ee80f7 Fix a build issue with replacing init_spi_flash() in the host tests 2019-08-01 16:28:56 +07:00
Anton Maklakov
12403e39b4 tools: Fix the build examples script to run locally 2019-08-01 16:28:56 +07:00
Anton Maklakov
75c0066f93 Fix remaining -Wstrict-prototypes warnings 2019-08-01 16:28:56 +07:00
Anton Maklakov
1beb0869e1 NimBLE: Update submodule to fix -Wstrict-prototypes warnings 2019-08-01 16:28:56 +07:00
Michael Zimmermann
c2764f6fe8 mdns: mdns_service_remove_all doesn't take an argument
Merges https://github.com/espressif/esp-idf/pull/2937
2019-08-01 16:28:56 +07:00
Michael Zimmermann
d4c098f5a9 brownout: fix rtc_brownout_isr_handler signature
Merges https://github.com/espressif/esp-idf/pull/2937
2019-08-01 16:28:56 +07:00
Ivan Grokhotkov
e8191912c8 Add -Wstrict-prototypes check in CI 2019-08-01 16:28:56 +07:00
Michael Zimmermann
74a459dd3d make code conform to Wstrict-prototypes
Merges https://github.com/espressif/esp-idf/pull/2937
2019-08-01 16:28:56 +07:00
Anton Maklakov
afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
Anton Maklakov
50629eec27 tools: Add a script to fix up empty prototypes 2019-08-01 16:28:55 +07:00
Angus Gratton
4d97dacf56 Merge branch 'bugfix/fix_i2s_channels_swapped_issue' into 'master'
Bugfix(i2s): fixed i2s left/right channels swapped issue

Closes IDFGH-1447

See merge request espressif/esp-idf!5669
2019-08-01 16:53:37 +08:00
Angus Gratton
54eecde90a Merge branch 'bugfix/minor_cleanup_lwip_duplicate_files' into 'master'
lw_ip: remove duplicate (and stale) changelog and version files

See merge request espressif/esp-idf!5657
2019-08-01 12:13:55 +08:00
Michael (XIAO Xufeng)
a2155ff52d idf_monitor: improve the responding of console commands 2019-08-01 11:55:42 +08:00
redchenjs
ff325e84b6 Bugfix(i2s): fixed i2s left/right channels swapped issue.
The right channel data is in the high position, so the I2S_TX_MSB_RIGHT & I2S_RX_MSB_RIGHT bits should be set.

Merges https://github.com/espressif/esp-idf/pull/3717

closes https://github.com/espressif/esp-idf/issues/3399
2019-07-31 17:58:23 +08:00
Angus Gratton
df4926b723 Merge branch 'bugfix/bt_example_typos' into 'master'
Minor: Fix some typos in Bluetooth examples

See merge request espressif/esp-idf!5662
2019-07-31 15:33:03 +08:00
Hrishikesh Dhayagude
c0491fc6f1 Minor: Fix some typos in Bluetooth examples 2019-07-31 15:33:03 +08:00
Mahavir Jain
15e0a32786 lwip: remove duplicate (and stale) changelog and version files 2019-07-30 16:49:53 +05:30
Angus Gratton
3b42e173e9 Merge branch 'maint/update_tool_openocd-v0.10.0-esp32-20190708' into 'master'
tools: Update recommended OpenOCD version to v0.10.0-esp32-20190708

See merge request espressif/esp-idf!5565
2019-07-30 12:51:05 +08:00
Ivan Grokhotkov
8d35744a33 examples: ext_flash_fatfs: use DIO mode by default
DIO works with the same connections as Fast Read, so use it by
default. Also correct the note in README.md which says that DIO
requires additional pins.
2019-07-28 10:14:04 +02:00
Angus Gratton
e1ef0faccd esptool: Bump to v2.7
https://github.com/espressif/esptool/releases/tag/v2.7
2019-07-18 15:09:17 +10:00
Ivan Grokhotkov
8cd04c80f6 efuse: set timing configuration before writing 2019-07-18 15:08:56 +10:00
Alexey Gerenkov
e9faf132b4 tools: Update recommended OpenOCD version to v0.10.0-esp32-20190708 2019-07-17 13:11:24 +00:00
Angus Gratton
4a0733c33c test: Set timeout of libsodium ed25519_convert test to 60s
Test takes 28s-29s to run in some configs, can fail in CI.
2019-07-17 12:24:29 +10:00
Roland Dobai
bd21960955 tools: Support sdkconfig.rename files from outside IDF in confgen.py 2019-07-16 20:18:19 +02:00
704 changed files with 7801 additions and 7724 deletions

22
.github/main.workflow vendored
View File

@@ -1,22 +0,0 @@
workflow "Sync issues to JIRA" {
on = "issues"
resolves = ["Sync to JIRA"]
}
workflow "Sync issue and PR comments to JIRA" {
on = "issue_comment"
resolves = ["Sync to JIRA"]
}
workflow "Sync PRs to JIRA" {
on = "pull_request"
resolves = ["Sync to JIRA"]
}
action "Sync to JIRA" {
uses = "espressif/github-actions/sync_issues_to_jira@master"
secrets = ["GITHUB_TOKEN", "JIRA_URL", "JIRA_USER", "JIRA_PASS"]
env = {
JIRA_PROJECT = "IDFGH"
}
}

16
.github/workflows/issue_comment.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
on: issue_comment
name: Sync issue and PR comments to JIRA
jobs:
syncToJIRA:
name: Sync to JIRA
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Sync to JIRA
uses: espressif/github-actions/sync_issues_to_jira@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_PASS: ${{ secrets.JIRA_PASS }}
JIRA_PROJECT: IDFGH
JIRA_URL: ${{ secrets.JIRA_URL }}
JIRA_USER: ${{ secrets.JIRA_USER }}

16
.github/workflows/issues.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
on: issues
name: Sync issues to JIRA
jobs:
syncToJIRA:
name: Sync to JIRA
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Sync to JIRA
uses: espressif/github-actions/sync_issues_to_jira@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_PASS: ${{ secrets.JIRA_PASS }}
JIRA_PROJECT: IDFGH
JIRA_URL: ${{ secrets.JIRA_URL }}
JIRA_USER: ${{ secrets.JIRA_USER }}

16
.github/workflows/pull_request.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
on: pull_request
name: Sync PRs to JIRA
jobs:
syncToJIRA:
name: Sync to JIRA
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Sync to JIRA
uses: espressif/github-actions/sync_issues_to_jira@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_PASS: ${{ secrets.JIRA_PASS }}
JIRA_PROJECT: IDFGH
JIRA_URL: ${{ secrets.JIRA_URL }}
JIRA_USER: ${{ secrets.JIRA_USER }}

6
.gitignore vendored
View File

@@ -63,8 +63,12 @@ test_multi_heap_host
# VS Code Settings
.vscode/
# Clion IDE CMake build & config
.idea/
cmake-build-*/
# Results for the checking of the Python coding style
flake8_output.txt
# ESP-IDF library
# ESP-IDF default build directory name
build

View File

@@ -39,7 +39,7 @@ See the Getting Started guide links above for a detailed setup guide. This is a
* Install host build dependencies mentioned in Getting Started guide.
* Add `tools/` directory to the PATH
* Run `python -m pip install requirements.txt` to install Python dependencies
* Run `python -m pip install -r requirements.txt` to install Python dependencies
## Configuring the Project

View File

@@ -360,7 +360,7 @@ static esp_apptrace_hw_t s_trace_hw[ESP_APPTRACE_HW_MAX] = {
}
};
static inline int esp_apptrace_log_lock()
static inline int esp_apptrace_log_lock(void)
{
#if ESP_APPTRACE_PRINT_LOCK
esp_apptrace_tmo_t tmo;
@@ -372,22 +372,22 @@ static inline int esp_apptrace_log_lock()
#endif
}
static inline void esp_apptrace_log_unlock()
static inline void esp_apptrace_log_unlock(void)
{
#if ESP_APPTRACE_PRINT_LOCK
esp_apptrace_lock_give(&s_log_lock);
#endif
}
static inline esp_err_t esp_apptrace_lock_initialize()
static inline esp_err_t esp_apptrace_lock_initialize(esp_apptrace_lock_t *lock)
{
#if CONFIG_ESP32_APPTRACE_LOCK_ENABLE
esp_apptrace_lock_init(&s_trace_buf.lock);
esp_apptrace_lock_init(lock);
#endif
return ESP_OK;
}
static inline esp_err_t esp_apptrace_lock_cleanup()
static inline esp_err_t esp_apptrace_lock_cleanup(void)
{
return ESP_OK;
}
@@ -403,7 +403,7 @@ esp_err_t esp_apptrace_lock(esp_apptrace_tmo_t *tmo)
return ESP_OK;
}
esp_err_t esp_apptrace_unlock()
esp_err_t esp_apptrace_unlock(void)
{
esp_err_t ret = ESP_OK;
#if CONFIG_ESP32_APPTRACE_LOCK_ENABLE
@@ -413,7 +413,7 @@ esp_err_t esp_apptrace_unlock()
}
#if CONFIG_ESP32_APPTRACE_DEST_TRAX
static void esp_apptrace_trax_init()
static void esp_apptrace_trax_init(void)
{
// Stop trace, if any (on the current CPU)
eri_write(ERI_TRAX_TRAXCTRL, TRAXCTRL_TRSTP);
@@ -449,7 +449,7 @@ static void esp_apptrace_trax_pend_chunk_sz_update(uint16_t size)
}
}
static uint16_t esp_apptrace_trax_pend_chunk_sz_get()
static uint16_t esp_apptrace_trax_pend_chunk_sz_get(void)
{
uint16_t ch_sz;
ESP_APPTRACE_LOGD("Get chunk enter %d w-r-s %d-%d-%d", s_trace_buf.trax.cur_pending_chunk_sz,
@@ -467,7 +467,7 @@ static uint16_t esp_apptrace_trax_pend_chunk_sz_get()
#endif
// assumed to be protected by caller from multi-core/thread access
static esp_err_t esp_apptrace_trax_block_switch()
static esp_err_t esp_apptrace_trax_block_switch(void)
{
int prev_block_num = s_trace_buf.trax.state.in_block % 2;
int new_block_num = prev_block_num ? (0) : (1);
@@ -845,7 +845,7 @@ static esp_err_t esp_apptrace_trax_status_reg_get(uint32_t *val)
return ESP_OK;
}
static esp_err_t esp_apptrace_trax_dest_init()
static esp_err_t esp_apptrace_trax_dest_init(void)
{
for (int i = 0; i < ESP_APPTRACE_TRAX_BLOCKS_NUM; i++) {
s_trace_buf.trax.blocks[i].start = (uint8_t *)s_trax_blocks[i];
@@ -874,7 +874,7 @@ static esp_err_t esp_apptrace_trax_dest_init()
}
#endif
esp_err_t esp_apptrace_init()
esp_err_t esp_apptrace_init(void)
{
int res;

View File

@@ -114,7 +114,7 @@ static int esp_dbg_stub_gcov_entry(void)
#endif
}
void esp_gcov_dump()
void esp_gcov_dump(void)
{
// disable IRQs on this CPU, other CPU is halted by OpenOCD
unsigned irq_state = portENTER_CRITICAL_NESTED();

View File

@@ -32,7 +32,7 @@
static bool s_tracing;
esp_err_t heap_trace_init_tohost()
esp_err_t heap_trace_init_tohost(void)
{
if (s_tracing) {
return ESP_ERR_INVALID_STATE;

View File

@@ -33,7 +33,7 @@ typedef enum {
*
* @return ESP_OK on success, otherwise see esp_err_t
*/
esp_err_t esp_apptrace_init();
esp_err_t esp_apptrace_init(void);
/**
* @brief Configures down buffer.

View File

@@ -285,12 +285,12 @@ Revision: $Rev: 5626 $
* RTT lock configuration fallback
*/
#ifndef SEGGER_RTT_LOCK
void SEGGER_SYSVIEW_X_RTT_Lock();
void SEGGER_SYSVIEW_X_RTT_Lock(void);
#define SEGGER_RTT_LOCK() SEGGER_SYSVIEW_X_RTT_Lock() // Lock RTT (nestable) (i.e. disable interrupts)
#endif
#ifndef SEGGER_RTT_UNLOCK
void SEGGER_SYSVIEW_X_RTT_Unlock();
void SEGGER_SYSVIEW_X_RTT_Unlock(void);
#define SEGGER_RTT_UNLOCK() SEGGER_SYSVIEW_X_RTT_Unlock() // Unlock RTT (nestable) (i.e. enable previous interrupt lock state)
#endif

View File

@@ -166,7 +166,7 @@ Revision: $Rev: 5927 $
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId() // Get the currently active interrupt Id from the user-provided function.
#endif
unsigned SEGGER_SYSVIEW_X_SysView_Lock();
unsigned SEGGER_SYSVIEW_X_SysView_Lock(void);
void SEGGER_SYSVIEW_X_SysView_Unlock(unsigned int_state);
// to be recursive save IRQ status on the stack of the caller
#define SEGGER_SYSVIEW_LOCK() unsigned _SYSVIEW_int_state = SEGGER_SYSVIEW_X_SysView_Lock()

View File

@@ -244,7 +244,7 @@ static void _cbSendSystemDesc(void) {
*
**********************************************************************
*/
static void SEGGER_SYSVIEW_TS_Init()
static void SEGGER_SYSVIEW_TS_Init(void)
{
/* We only need to initialize something if we use Timer Group.
* esp_timer and ccount can be used as is.
@@ -316,7 +316,7 @@ void SEGGER_SYSVIEW_Conf(void) {
SEGGER_SYSVIEW_DisableEvents(disable_evts);
}
U32 SEGGER_SYSVIEW_X_GetTimestamp()
U32 SEGGER_SYSVIEW_X_GetTimestamp(void)
{
#if TS_USE_TIMERGROUP
uint64_t ts = 0;
@@ -329,15 +329,15 @@ U32 SEGGER_SYSVIEW_X_GetTimestamp()
#endif
}
void SEGGER_SYSVIEW_X_RTT_Lock()
void SEGGER_SYSVIEW_X_RTT_Lock(void)
{
}
void SEGGER_SYSVIEW_X_RTT_Unlock()
void SEGGER_SYSVIEW_X_RTT_Unlock(void)
{
}
unsigned SEGGER_SYSVIEW_X_SysView_Lock()
unsigned SEGGER_SYSVIEW_X_SysView_Lock(void)
{
esp_apptrace_tmo_t tmo;
esp_apptrace_tmo_init(&tmo, SEGGER_LOCK_WAIT_TMO);

View File

@@ -125,7 +125,7 @@ typedef struct {
static SemaphoreHandle_t s_print_lock;
#endif
static uint64_t esp_apptrace_test_ts_get();
static uint64_t esp_apptrace_test_ts_get(void);
static void esp_apptrace_test_timer_isr(void *arg)
{
@@ -383,7 +383,7 @@ static void esp_apptrace_test_task_crash(void *p)
static int s_ts_timer_group, s_ts_timer_idx;
static uint64_t esp_apptrace_test_ts_get()
static uint64_t esp_apptrace_test_ts_get(void)
{
uint64_t ts = 0;
timer_get_counter_value(s_ts_timer_group, s_ts_timer_idx, &ts);
@@ -413,7 +413,7 @@ static void esp_apptrace_test_ts_init(int timer_group, int timer_idx)
timer_start(timer_group, timer_idx);
}
static void esp_apptrace_test_ts_cleanup()
static void esp_apptrace_test_ts_cleanup(void)
{
timer_config_t config;

View File

@@ -687,12 +687,12 @@ static esp_err_t esp_ota_current_ota_is_workable(bool valid)
return ESP_OK;
}
esp_err_t esp_ota_mark_app_valid_cancel_rollback()
esp_err_t esp_ota_mark_app_valid_cancel_rollback(void)
{
return esp_ota_current_ota_is_workable(true);
}
esp_err_t esp_ota_mark_app_invalid_rollback_and_reboot()
esp_err_t esp_ota_mark_app_invalid_rollback_and_reboot(void)
{
return esp_ota_current_ota_is_workable(false);
}
@@ -715,7 +715,7 @@ static int get_last_invalid_otadata(const esp_ota_select_entry_t *two_otadata)
return num_invalid_otadata;
}
const esp_partition_t* esp_ota_get_last_invalid_partition()
const esp_partition_t* esp_ota_get_last_invalid_partition(void)
{
esp_ota_select_entry_t otadata[2];
if (read_otadata(otadata) == NULL) {

View File

@@ -221,7 +221,7 @@ esp_err_t esp_ota_get_partition_description(const esp_partition_t *partition, es
* @return
* - ESP_OK: if successful.
*/
esp_err_t esp_ota_mark_app_valid_cancel_rollback();
esp_err_t esp_ota_mark_app_valid_cancel_rollback(void);
/**
* @brief This function is called to roll back to the previously workable app with reboot.
@@ -233,14 +233,14 @@ esp_err_t esp_ota_mark_app_valid_cancel_rollback();
* - ESP_FAIL: if not successful.
* - ESP_ERR_OTA_ROLLBACK_FAILED: The rollback is not possible due to flash does not have any apps.
*/
esp_err_t esp_ota_mark_app_invalid_rollback_and_reboot();
esp_err_t esp_ota_mark_app_invalid_rollback_and_reboot(void);
/**
* @brief Returns last partition with invalid state (ESP_OTA_IMG_INVALID or ESP_OTA_IMG_ABORTED).
*
* @return partition.
*/
const esp_partition_t* esp_ota_get_last_invalid_partition();
const esp_partition_t* esp_ota_get_last_invalid_partition(void);
/**
* @brief Returns state for given partition.

View File

@@ -118,7 +118,7 @@ static void reboot_as_deep_sleep(void)
/* @brief Copies a current app to next partition (OTA0-15), after that ESP is rebooting and run this (the next) OTAx.
*/
static void copy_current_app_to_next_part_and_reboot()
static void copy_current_app_to_next_part_and_reboot(void)
{
const esp_partition_t *cur_app = esp_ota_get_running_partition();
copy_current_app_to_next_part(cur_app, get_next_update_partition());
@@ -264,19 +264,19 @@ static void test_flow1(void)
case 2:
ESP_LOGI(TAG, "Factory");
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_FACTORY, cur_app->subtype);
copy_current_app_to_next_part_and_reboot(cur_app);
copy_current_app_to_next_part_and_reboot();
break;
case 3:
ESP_LOGI(TAG, "OTA0");
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_0, cur_app->subtype);
mark_app_valid();
copy_current_app_to_next_part_and_reboot(cur_app);
copy_current_app_to_next_part_and_reboot();
break;
case 4:
ESP_LOGI(TAG, "OTA1");
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_1, cur_app->subtype);
mark_app_valid();
copy_current_app_to_next_part_and_reboot(cur_app);
copy_current_app_to_next_part_and_reboot();
break;
case 5:
ESP_LOGI(TAG, "OTA0");
@@ -307,7 +307,7 @@ static void test_flow2(void)
case 2:
ESP_LOGI(TAG, "Factory");
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_FACTORY, cur_app->subtype);
copy_current_app_to_next_part_and_reboot(cur_app);
copy_current_app_to_next_part_and_reboot();
break;
case 3:
ESP_LOGI(TAG, "OTA0");
@@ -344,13 +344,13 @@ static void test_flow3(void)
case 2:
ESP_LOGI(TAG, "Factory");
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_FACTORY, cur_app->subtype);
copy_current_app_to_next_part_and_reboot(cur_app);
copy_current_app_to_next_part_and_reboot();
break;
case 3:
ESP_LOGI(TAG, "OTA0");
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_0, cur_app->subtype);
mark_app_valid();
copy_current_app_to_next_part_and_reboot(cur_app);
copy_current_app_to_next_part_and_reboot();
break;
case 4:
ESP_LOGI(TAG, "OTA1");
@@ -402,7 +402,7 @@ static void test_flow4(void)
nvs_close(handle);
nvs_flash_deinit();
copy_current_app_to_next_part_and_reboot(cur_app);
copy_current_app_to_next_part_and_reboot();
break;
case 3:
ESP_LOGI(TAG, "OTA0");

View File

@@ -34,7 +34,7 @@ static int selected_boot_partition(const bootloader_state_t *bs);
* The hardware is mostly uninitialized, flash cache is down and the app CPU is in reset.
* We do have a stack, so we can do the initialization in C.
*/
void __attribute__((noreturn)) call_start_cpu0()
void __attribute__((noreturn)) call_start_cpu0(void)
{
// 1. Hardware initialization
if (bootloader_init() != ESP_OK) {
@@ -113,7 +113,7 @@ static int selected_boot_partition(const bootloader_state_t *bs)
}
// Return global reent struct if any newlib functions are linked to bootloader
struct _reent* __getreent() {
struct _reent* __getreent(void) {
return _GLOBAL_REENT;
}

View File

@@ -144,7 +144,7 @@ esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t
/**
* @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();
void bootloader_common_vddsdio_configure(void);
#ifdef __cplusplus
}

View File

@@ -25,7 +25,7 @@ extern "C" {
*
* @return None
*/
void bootloader_flash_update_id();
void bootloader_flash_update_id(void);
/**
* @brief Set the flash CS setup and hold time.
@@ -35,7 +35,7 @@ void bootloader_flash_update_id();
*
* @return None
*/
void bootloader_flash_cs_timing_config();
void bootloader_flash_cs_timing_config(void);
/**
* @brief Configure SPI flash clock.

View File

@@ -122,7 +122,7 @@ esp_err_t esp_flash_encrypt_region(uint32_t src_addr, size_t data_length);
* serial re-flashing of an unauthorised code in absence of secure boot.
*
*/
void esp_flash_write_protect_crypt_cnt();
void esp_flash_write_protect_crypt_cnt(void);
/** @brief Return the flash encryption mode
*
@@ -131,7 +131,7 @@ void esp_flash_write_protect_crypt_cnt();
*
* @return
*/
esp_flash_enc_mode_t esp_get_flash_encryption_mode();
esp_flash_enc_mode_t esp_get_flash_encryption_mode(void);
#ifdef __cplusplus
}

View File

@@ -35,7 +35,7 @@
*
* @return Number of free pages
*/
uint32_t bootloader_mmap_get_free_pages();
uint32_t bootloader_mmap_get_free_pages(void);
/**
* @brief Map a region of flash to data memory

View File

@@ -25,4 +25,4 @@
* @return ESP_OK - If the setting is successful.
* ESP_FAIL - If the setting is not successful.
*/
esp_err_t bootloader_init();
esp_err_t bootloader_init(void);

View File

@@ -26,7 +26,7 @@
typedef void *bootloader_sha256_handle_t;
bootloader_sha256_handle_t bootloader_sha256_start();
bootloader_sha256_handle_t bootloader_sha256_start(void);
void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len);

View File

@@ -30,7 +30,7 @@ void bootloader_enable_qio_mode(void);
* mfg_id = (ID >> 16) & 0xFF;
flash_id = ID & 0xffff;
*/
uint32_t bootloader_read_flash_id();
uint32_t bootloader_read_flash_id(void);
#ifdef __cplusplus
}

View File

@@ -18,7 +18,7 @@
#include "soc/dport_reg.h"
#include "soc/efuse_periph.h"
void bootloader_clock_configure()
void bootloader_clock_configure(void)
{
// ROM bootloader may have put a lot of text into UART0 FIFO.
// Wait for it to be printed.

View File

@@ -256,7 +256,7 @@ esp_err_t bootloader_common_get_partition_description(const esp_partition_pos_t
return ESP_OK;
}
void bootloader_common_vddsdio_configure()
void bootloader_common_vddsdio_configure(void)
{
#if CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V
rtc_vddsdio_config_t cfg = rtc_vddsdio_get_config();

View File

@@ -25,7 +25,7 @@ static const char *TAG = "bootloader_mmap";
static spi_flash_mmap_handle_t map;
uint32_t bootloader_mmap_get_free_pages()
uint32_t bootloader_mmap_get_free_pages(void)
{
return spi_flash_mmap_get_free_pages(SPI_FLASH_MMAP_DATA);
}
@@ -103,7 +103,7 @@ static bool mapped;
// Current bootloader mapping (ab)used for bootloader_read()
static uint32_t current_read_mapping = UINT32_MAX;
uint32_t bootloader_mmap_get_free_pages()
uint32_t bootloader_mmap_get_free_pages(void)
{
/**
* Allow mapping up to 50 of the 51 available MMU blocks (last one used for reads)

View File

@@ -27,12 +27,12 @@
#include "flash_qio_mode.h"
#include "bootloader_flash_config.h"
void bootloader_flash_update_id()
void bootloader_flash_update_id(void)
{
g_rom_flashchip.device_id = bootloader_read_flash_id();
}
void IRAM_ATTR bootloader_flash_cs_timing_config()
void IRAM_ATTR bootloader_flash_cs_timing_config(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);

View File

@@ -61,7 +61,7 @@ extern int _data_end;
static const char* TAG = "boot";
static esp_err_t bootloader_main();
static esp_err_t bootloader_main(void);
static void print_flash_info(const esp_image_header_t* pfhdr);
static void update_flash_config(const esp_image_header_t* pfhdr);
static void bootloader_init_flash_configure(const esp_image_header_t* pfhdr);
@@ -69,7 +69,7 @@ static void uart_console_configure(void);
static void wdt_reset_check(void);
esp_err_t bootloader_init()
esp_err_t bootloader_init(void)
{
cpu_configure_region_protection();
cpu_init_memctl();
@@ -117,7 +117,7 @@ esp_err_t bootloader_init()
return ESP_OK;
}
static esp_err_t bootloader_main()
static esp_err_t bootloader_main(void)
{
bootloader_common_vddsdio_configure();
/* Read and keep flash ID, for further use. */
@@ -434,7 +434,7 @@ void __assert_func(const char *file, int line, const char *func, const char *exp
while(1) {}
}
void abort()
void abort(void)
{
#if !CONFIG_ESP32_PANIC_SILENT_REBOOT
ets_printf("abort() was called at PC 0x%08x\r\n", (intptr_t)__builtin_return_address(0) - 3);

View File

@@ -27,7 +27,7 @@ static const size_t BLOCK_WORDS = (64 / sizeof(uint32_t));
// Words in final SHA256 digest
static const size_t DIGEST_WORDS = (32 / sizeof(uint32_t));
bootloader_sha256_handle_t bootloader_sha256_start()
bootloader_sha256_handle_t bootloader_sha256_start(void)
{
// Enable SHA hardware
ets_sha_enable();

View File

@@ -38,7 +38,7 @@ static const char *TAG = "flash_encrypt";
/* Static functions for stages of flash encryption */
static esp_err_t initialise_flash_encryption(void);
static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_crypt_wr_dis);
static esp_err_t encrypt_bootloader();
static esp_err_t encrypt_bootloader(void);
static esp_err_t encrypt_and_load_partition_table(esp_partition_info_t *partition_table, int *num_partitions);
static esp_err_t encrypt_partition(int index, const esp_partition_info_t *partition);
@@ -223,7 +223,7 @@ static esp_err_t encrypt_flash_contents(uint32_t flash_crypt_cnt, bool flash_cry
return ESP_OK;
}
static esp_err_t encrypt_bootloader()
static esp_err_t encrypt_bootloader(void)
{
esp_err_t err;
uint32_t image_length;

View File

@@ -95,7 +95,7 @@ static bool secure_boot_generate(uint32_t image_len){
}
/* Burn values written to the efuse write registers */
static inline void burn_efuses()
static inline void burn_efuses(void)
{
esp_efuse_burn_new_values();
}

View File

@@ -17,7 +17,7 @@
#include "esp_efuse_table.h"
#include "esp_flash_encrypt.h"
void esp_flash_write_protect_crypt_cnt()
void esp_flash_write_protect_crypt_cnt(void)
{
uint8_t flash_crypt_cnt_wr_dis = 0;
esp_efuse_read_field_blob(ESP_EFUSE_WR_DIS_FLASH_CRYPT_CNT, &flash_crypt_cnt_wr_dis, 1);
@@ -26,7 +26,7 @@ void esp_flash_write_protect_crypt_cnt()
}
}
esp_flash_enc_mode_t esp_get_flash_encryption_mode()
esp_flash_enc_mode_t esp_get_flash_encryption_mode(void)
{
uint8_t efuse_flash_crypt_cnt_wr_protected = 0;
uint8_t dis_dl_enc = 0, dis_dl_dec = 0, dis_dl_cache = 0;

View File

@@ -39,7 +39,7 @@
static const char *TAG = "qio_mode";
typedef unsigned (*read_status_fn_t)();
typedef unsigned (*read_status_fn_t)(void);
typedef void (*write_status_fn_t)(unsigned);
typedef struct __attribute__((packed)) {
@@ -53,11 +53,11 @@ typedef struct __attribute__((packed)) {
} qio_info_t;
/* Read 8 bit status using RDSR command */
static unsigned read_status_8b_rdsr();
static unsigned read_status_8b_rdsr(void);
/* Read 8 bit status (second byte) using RDSR2 command */
static unsigned read_status_8b_rdsr2();
static unsigned read_status_8b_rdsr2(void);
/* read 16 bit status using RDSR & RDSR2 (low and high bytes) */
static unsigned read_status_16b_rdsr_rdsr2();
static unsigned read_status_16b_rdsr_rdsr2(void);
/* Write 8 bit status using WRSR */
static void write_status_8b_wrsr(unsigned new_status);
@@ -67,7 +67,7 @@ static void write_status_8b_wrsr2(unsigned new_status);
static void write_status_16b_wrsr(unsigned new_status);
/* Read 8 bit status of XM25QU64A */
static unsigned read_status_8b_xmc25qu64a();
static unsigned read_status_8b_xmc25qu64a(void);
/* Write 8 bit status of XM25QU64A */
static void write_status_8b_xmc25qu64a(unsigned new_status);
@@ -121,7 +121,7 @@ static uint32_t execute_flash_command(uint8_t command, uint32_t mosi_data, uint8
/* dummy_len_plus values defined in ROM for SPI flash configuration */
extern uint8_t g_rom_spiflash_dummy_len_plus[];
uint32_t bootloader_read_flash_id()
uint32_t bootloader_read_flash_id(void)
{
uint32_t id = execute_flash_command(CMD_RDID, 0, 0, 24);
id = ((id & 0xff) << 16) | ((id >> 16) & 0xff) | (id & 0xff00);
@@ -223,17 +223,17 @@ static esp_err_t enable_qio_mode(read_status_fn_t read_status_fn,
return ESP_OK;
}
static unsigned read_status_8b_rdsr()
static unsigned read_status_8b_rdsr(void)
{
return execute_flash_command(CMD_RDSR, 0, 0, 8);
}
static unsigned read_status_8b_rdsr2()
static unsigned read_status_8b_rdsr2(void)
{
return execute_flash_command(CMD_RDSR2, 0, 0, 8);
}
static unsigned read_status_16b_rdsr_rdsr2()
static unsigned read_status_16b_rdsr_rdsr2(void)
{
return execute_flash_command(CMD_RDSR, 0, 0, 8) | (execute_flash_command(CMD_RDSR2, 0, 0, 8) << 8);
}
@@ -253,7 +253,7 @@ static void write_status_16b_wrsr(unsigned new_status)
execute_flash_command(CMD_WRSR, new_status, 16, 0);
}
static unsigned read_status_8b_xmc25qu64a()
static unsigned read_status_8b_xmc25qu64a(void)
{
execute_flash_command(CMD_OTPEN, 0, 0, 0); /* Enter OTP mode */
esp_rom_spiflash_wait_idle(&g_rom_flashchip);

View File

@@ -18,7 +18,7 @@
#include <sys/param.h>
#include <mbedtls/sha256.h>
bootloader_sha256_handle_t bootloader_sha256_start()
bootloader_sha256_handle_t bootloader_sha256_start(void)
{
mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)malloc(sizeof(mbedtls_sha256_context));
if (!ctx) {

View File

@@ -203,7 +203,8 @@ extern void btdm_controller_enable_sleep(bool enable);
extern void btdm_controller_set_sleep_mode(uint8_t mode);
extern uint8_t btdm_controller_get_sleep_mode(void);
extern bool btdm_power_state_active(void);
extern void btdm_wakeup_request(void);
extern void btdm_wakeup_request(bool request_lock);
extern void btdm_wakeup_request_end(void);
/* Low Power Clock */
extern bool btdm_lpclk_select_src(uint32_t sel);
extern bool btdm_lpclk_set_div(uint32_t div);
@@ -893,6 +894,8 @@ bool esp_vhci_host_check_send_available(void)
void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
{
bool do_wakeup_request = false;
if (!btdm_power_state_active()) {
#if CONFIG_PM_ENABLE
if (semphr_take_wrapper(s_pm_lock_sem, 0)) {
@@ -900,9 +903,15 @@ void esp_vhci_host_send_packet(uint8_t *data, uint16_t len)
}
esp_timer_stop(s_btdm_slp_tmr);
#endif
btdm_wakeup_request();
do_wakeup_request = true;
btdm_wakeup_request(true);
}
API_vhci_host_send_packet(data, len);
if (do_wakeup_request) {
btdm_wakeup_request_end();
}
}
esp_err_t esp_vhci_host_register_callback(const esp_vhci_host_callback_t *callback)
@@ -1328,7 +1337,7 @@ esp_err_t esp_bt_controller_disable(void)
if (btdm_controller_get_sleep_mode() == BTDM_MODEM_SLEEP_MODE_ORIG) {
btdm_controller_enable_sleep(false);
if (!btdm_power_state_active()) {
btdm_wakeup_request();
btdm_wakeup_request(false);
}
while (!btdm_power_state_active()) {
ets_delay_us(1000);
@@ -1466,7 +1475,7 @@ void esp_bt_controller_wakeup_request(void)
return;
}
btdm_wakeup_request();
btdm_wakeup_request(false);
}
esp_err_t esp_bredr_sco_datapath_set(esp_sco_data_path_t data_path)

View File

@@ -54,7 +54,7 @@ esp_err_t esp_spp_init(esp_spp_mode_t mode)
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_spp_deinit()
esp_err_t esp_spp_deinit(void)
{
btc_msg_t msg;
btc_spp_args_t arg;
@@ -164,7 +164,7 @@ esp_err_t esp_spp_write(uint32_t handle, int len, uint8_t *p_data)
return (btc_transfer_context(&msg, &arg, sizeof(btc_spp_args_t), btc_spp_arg_deep_copy) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
}
esp_err_t esp_spp_vfs_register()
esp_err_t esp_spp_vfs_register(void)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);

View File

@@ -205,7 +205,7 @@ esp_err_t esp_spp_init(esp_spp_mode_t mode);
* - ESP_OK: success
* - other: failed
*/
esp_err_t esp_spp_deinit();
esp_err_t esp_spp_deinit(void);
/**

View File

@@ -360,7 +360,7 @@ const tBTA_DM_ST_TBL bta_dm_search_st_tbl[] = {
** Returns void
**
*******************************************************************************/
void bta_dm_sm_disable( )
void bta_dm_sm_disable(void)
{
bta_sys_deregister( BTA_ID_DM );
}
@@ -412,7 +412,7 @@ BOOLEAN bta_dm_sm_execute(BT_HDR *p_msg)
** Returns void
**
*******************************************************************************/
void bta_dm_search_sm_disable( )
void bta_dm_search_sm_disable(void)
{
bta_sys_deregister( BTA_ID_DM_SEARCH );

View File

@@ -46,7 +46,7 @@ static void bta_dm_pm_timer_cback(void *p_tle);
static void bta_dm_pm_btm_cback(BD_ADDR bd_addr, tBTM_PM_STATUS status, UINT16 value, UINT8 hci_status);
static BOOLEAN bta_dm_pm_park(BD_ADDR peer_addr);
static BOOLEAN bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE *p_peer_dev, UINT8 index);
static BOOLEAN bta_dm_pm_is_sco_active ();
static BOOLEAN bta_dm_pm_is_sco_active (void);
static void bta_dm_pm_hid_check(BOOLEAN bScoActive);
static void bta_dm_pm_set_sniff_policy(tBTA_DM_PEER_DEVICE *p_dev, BOOLEAN bDisable);
static void bta_dm_pm_stop_timer_by_index(tBTA_PM_TIMER *p_timer,
@@ -1001,7 +1001,7 @@ void bta_dm_pm_timer(tBTA_DM_MSG *p_data)
** Returns BOOLEAN. TRUE if SCO active, else FALSE
**
*******************************************************************************/
static BOOLEAN bta_dm_pm_is_sco_active ()
static BOOLEAN bta_dm_pm_is_sco_active (void)
{
int j;
BOOLEAN bScoActive = FALSE;

View File

@@ -48,7 +48,7 @@ static void getFilename(char *buffer, BD_ADDR bda)
, bda[0], bda[1], bda[2], bda[3], bda[4], bda[5]);
}
static void cacheClose()
static void cacheClose(void)
{
if (sCacheFD != 0) {
fclose(sCacheFD);

View File

@@ -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);

View File

@@ -212,7 +212,7 @@ extern void bta_hf_client_sm_execute(UINT16 event,
extern void bta_hf_client_slc_seq(BOOLEAN error);
extern void bta_hf_client_collision_cback (tBTA_SYS_CONN_STATUS status, UINT8 id,
UINT8 app_id, BD_ADDR peer_addr);
extern void bta_hf_client_resume_open ();
extern void bta_hf_client_resume_open (void);
/* SDP functions */
extern BOOLEAN bta_hf_client_add_record(char *p_service_name,

View File

@@ -1205,7 +1205,7 @@ extern void BTA_GATTC_ConfigureMTU (UINT16 conn_id);
** Returns None
**
*******************************************************************************/
extern void BTA_GATTS_Init();
extern void BTA_GATTS_Init(void);
/*******************************************************************************
**

View File

@@ -683,7 +683,7 @@ void bta_jv_disable (tBTA_JV_MSG *p_data)
* list.
* If no free PSMs exist, 0 will be returned.
*/
static UINT16 bta_jv_get_free_psm()
static UINT16 bta_jv_get_free_psm(void)
{
const int cnt = sizeof(bta_jv_cb.free_psm_list) / sizeof(bta_jv_cb.free_psm_list[0]);
for (int i = 0; i < cnt; i++) {

View File

@@ -60,7 +60,7 @@ static void queue_int_add(connect_node_t *p_param)
list_append(connect_queue, p_node);
}
static void queue_int_advance()
static void queue_int_advance(void)
{
if (connect_queue && !list_is_empty(connect_queue)) {
list_remove(connect_queue, list_front(connect_queue));

View File

@@ -424,7 +424,7 @@ static void btc_a2dp_source_data_post(void)
osi_thread_post(a2dp_source_local_param.btc_aa_src_task_hdl, btc_a2dp_source_handle_timer, NULL, 2, OSI_THREAD_MAX_TIMEOUT);
}
static UINT64 time_now_us()
static UINT64 time_now_us(void)
{
#if _POSIX_TIMERS
struct timespec ts_now;

View File

@@ -79,7 +79,7 @@ void app_ble_sec_gen_ltk(UINT8 key_size)
** Returns NULL
**
*******************************************************************************/
void app_ble_sec_init()
void app_ble_sec_init(void)
{
// Reset Security Environment
memset(&app_sec_env, 0, sizeof(app_sec_env));

View File

@@ -837,7 +837,7 @@ static ssize_t spp_vfs_read(int fd, void * dst, size_t size)
return item_size;
}
esp_err_t btc_spp_vfs_register()
esp_err_t btc_spp_vfs_register(void)
{
esp_vfs_t vfs = {
.flags = ESP_VFS_FLAG_DEFAULT,

View File

@@ -544,7 +544,7 @@ static const controller_t interface = {
#endif /* (BTM_SCO_HCI_INCLUDED == TRUE) */
};
const controller_t *controller_get_interface()
const controller_t *controller_get_interface(void)
{
static bool loaded = false;
if (!loaded) {

View File

@@ -86,6 +86,6 @@ typedef struct controller_t {
#endif /* #if (BTM_SCO_HCI_INCLUDED == TRUE) */
} controller_t;
const controller_t *controller_get_interface();
const controller_t *controller_get_interface(void);
#endif /*_CONTROLLER_H_*/

View File

@@ -121,7 +121,7 @@ static bool hal_open(const hci_hal_callbacks_t *upper_callbacks, void *task_thre
return true;
}
static void hal_close()
static void hal_close(void)
{
hci_hal_env_deinit();
@@ -367,7 +367,7 @@ static const hci_hal_t interface = {
transmit_data,
};
const hci_hal_t *hci_hal_h4_get_interface()
const hci_hal_t *hci_hal_h4_get_interface(void)
{
return &interface;
}

View File

@@ -535,7 +535,7 @@ static waiting_command_t *get_waiting_command(command_opcode_t opcode)
return NULL;
}
static void init_layer_interface()
static void init_layer_interface(void)
{
if (!interface_created) {
interface.transmit_command = transmit_command;
@@ -555,7 +555,7 @@ static const packet_fragmenter_callbacks_t packet_fragmenter_callbacks = {
fragmenter_transmit_finished
};
const hci_t *hci_layer_get_interface()
const hci_t *hci_layer_get_interface(void)
{
hal = hci_hal_h4_get_interface();
packet_fragmenter = packet_fragmenter_get_interface();

View File

@@ -273,7 +273,7 @@ static const hci_packet_factory_t interface = {
make_write_default_erroneous_data_report,
};
const hci_packet_factory_t *hci_packet_factory_get_interface()
const hci_packet_factory_t *hci_packet_factory_get_interface(void)
{
return &interface;
}

View File

@@ -250,7 +250,7 @@ static const hci_packet_parser_t interface = {
parse_ble_read_suggested_default_data_length_response
};
const hci_packet_parser_t *hci_packet_parser_get_interface()
const hci_packet_parser_t *hci_packet_parser_get_interface(void)
{
return &interface;
}

View File

@@ -92,7 +92,7 @@ typedef struct hci_t {
void (*transmit_downward)(uint16_t type, void *data);
} hci_t;
const hci_t *hci_layer_get_interface();
const hci_t *hci_layer_get_interface(void);
int hci_start_up(void);
void hci_shut_down(void);

View File

@@ -48,6 +48,6 @@ typedef struct {
BT_HDR *(*make_write_default_erroneous_data_report)(uint8_t enable);
} hci_packet_factory_t;
const hci_packet_factory_t *hci_packet_factory_get_interface();
const hci_packet_factory_t *hci_packet_factory_get_interface(void);
#endif /*_HCI_PACKET_FACTORY_H_*/

View File

@@ -97,6 +97,6 @@ typedef struct {
);
} hci_packet_parser_t;
const hci_packet_parser_t *hci_packet_parser_get_interface();
const hci_packet_parser_t *hci_packet_parser_get_interface(void);
#endif /*_HCI_PACKET_PARSER_H_*/

View File

@@ -57,6 +57,6 @@ typedef struct packet_fragmenter_t {
void (*reassemble_and_dispatch)(BT_HDR *packet);
} packet_fragmenter_t;
const packet_fragmenter_t *packet_fragmenter_get_interface();
const packet_fragmenter_t *packet_fragmenter_get_interface(void);
#endif /* _PACKET_FRAGMENTER_H_ */

View File

@@ -55,14 +55,14 @@ static void init(const packet_fragmenter_callbacks_t *result_callbacks)
partial_packets = hash_map_new(NUMBER_OF_BUCKETS, hash_function_naive, NULL, NULL, NULL);
}
static void cleanup()
static void cleanup(void)
{
if (partial_packets) {
hash_map_free(partial_packets);
}
}
static BT_HDR *fragment_get_current_packet()
static BT_HDR *fragment_get_current_packet(void)
{
return current_fragment_packet;
}
@@ -224,7 +224,7 @@ static const packet_fragmenter_t interface = {
reassemble_and_dispatch
};
const packet_fragmenter_t *packet_fragmenter_get_interface()
const packet_fragmenter_t *packet_fragmenter_get_interface(void)
{
controller = controller_get_interface();
return &interface;

View File

@@ -195,7 +195,7 @@ void bte_main_enable_lpm(BOOLEAN enable)
** Returns None
**
******************************************************************************/
void bte_main_lpm_allow_bt_device_sleep()
void bte_main_lpm_allow_bt_device_sleep(void)
{
/**/
//hci->send_low_power_command(LPM_WAKE_DEASSERT);
@@ -210,7 +210,7 @@ void bte_main_lpm_allow_bt_device_sleep()
** Returns None
**
******************************************************************************/
void bte_main_lpm_wake_bt_device()
void bte_main_lpm_wake_bt_device(void)
{
//hci->send_low_power_command(LPM_WAKE_ASSERT);
}

View File

@@ -171,7 +171,7 @@ void AVDT_Deregister(void)
** Returns void.
**
*******************************************************************************/
void AVDT_SINK_Activate()
void AVDT_SINK_Activate(void)
{
tAVDT_SCB *p_scb = &avdt_cb.scb[0];
int i;
@@ -200,7 +200,7 @@ void AVDT_SINK_Activate()
** Returns void.
**
*******************************************************************************/
void AVDT_SINK_Deactivate()
void AVDT_SINK_Deactivate(void)
{
tAVDT_SCB *p_scb = &avdt_cb.scb[0];
int i;

View File

@@ -90,7 +90,7 @@ static UINT8 btm_ble_cs_update_pf_counter(tBTM_BLE_SCAN_COND_OP action,
** Returns status
**
*******************************************************************************/
tBTM_STATUS btm_ble_obtain_vsc_details()
tBTM_STATUS btm_ble_obtain_vsc_details(void)
{
tBTM_STATUS st = BTM_SUCCESS;

View File

@@ -60,7 +60,7 @@ static bool bdaddr_equality_fn(const void *x, const void *y)
return bdaddr_equals((bt_bdaddr_t *)x, (bt_bdaddr_t *)y);
}
static void background_connections_lazy_init()
static void background_connections_lazy_init(void)
{
if (!background_connections) {
background_connections = hash_map_new(background_connection_buckets,
@@ -91,7 +91,7 @@ static BOOLEAN background_connection_remove(bt_bdaddr_t *address)
return FALSE;
}
static void background_connections_clear()
static void background_connections_clear(void)
{
if (background_connections) {
hash_map_clear(background_connections);
@@ -110,7 +110,7 @@ static bool background_connections_pending_cb(hash_map_entry_t *hash_entry, void
return true;
}
static bool background_connections_pending()
static bool background_connections_pending(void)
{
bool pending_connections = false;
if (background_connections) {

View File

@@ -2017,7 +2017,7 @@ UINT8 *BTM_CheckAdvData( UINT8 *p_adv, UINT8 type, UINT8 *p_length)
** BTM_BLE_GENRAL_DISCOVERABLE
**
*******************************************************************************/
UINT16 BTM_BleReadDiscoverability()
UINT16 BTM_BleReadDiscoverability(void)
{
BTM_TRACE_API("%s\n", __FUNCTION__);
@@ -2034,7 +2034,7 @@ UINT16 BTM_BleReadDiscoverability()
** Returns BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE
**
*******************************************************************************/
UINT16 BTM_BleReadConnectability()
UINT16 BTM_BleReadConnectability(void)
{
BTM_TRACE_API ("%s\n", __FUNCTION__);

View File

@@ -769,7 +769,7 @@ void btm_ble_multi_adv_vse_cback(UINT8 len, UINT8 *p)
** Returns void
**
*******************************************************************************/
void btm_ble_multi_adv_init()
void btm_ble_multi_adv_init(void)
{
#if BTM_DYNAMIC_MEMORY == TRUE
btm_multi_adv_cb_ptr = (tBTM_BLE_MULTI_ADV_CB *)osi_malloc(sizeof(tBTM_BLE_MULTI_ADV_CB));

View File

@@ -1626,7 +1626,7 @@ BOOLEAN BTM_BleGetCurrentAddress(BD_ADDR addr, uint8_t *addr_type);
** BTM_BLE_GENRAL_DISCOVERABLE
**
*******************************************************************************/
UINT16 BTM_BleReadDiscoverability();
UINT16 BTM_BleReadDiscoverability(void);
/*******************************************************************************
**
@@ -1639,7 +1639,7 @@ UINT16 BTM_BleReadDiscoverability();
**
*******************************************************************************/
//extern
UINT16 BTM_BleReadConnectability ();
UINT16 BTM_BleReadConnectability (void);
void BTM_Recovery_Pre_State(void);
@@ -1755,7 +1755,7 @@ void BTM_BleEnableMixedPrivacyMode(BOOLEAN mixed_on);
**
*******************************************************************************/
//extern
UINT8 BTM_BleMaxMultiAdvInstanceCount();
UINT8 BTM_BleMaxMultiAdvInstanceCount(void);
/*******************************************************************************
**

View File

@@ -8,7 +8,7 @@ set(srcs
"libcoap/src/coap_hashkey.c"
"libcoap/src/coap_session.c"
"libcoap/src/coap_time.c"
"libcoap/src/coap_debug.c"
"port/coap_debug.c"
"libcoap/src/encode.c"
"libcoap/src/mem.c"
"libcoap/src/net.c"
@@ -18,17 +18,15 @@ set(srcs
"libcoap/src/str.c"
"libcoap/src/subscribe.c"
"libcoap/src/uri.c"
"libcoap/src/coap_notls.c"
"port/coap_io.c")
set(COMPONENT_REQUIRES lwip)
"libcoap/src/coap_io.c"
"port/coap_mbedtls.c")
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
REQUIRES lwip)
REQUIRES lwip mbedtls)
# Silence format truncation warning, until it is fixed upstream
set_source_files_properties(libcoap/src/coap_debug.c PROPERTIES COMPILE_FLAGS -Wno-format-truncation)
set_source_files_properties(port/coap_debug.c PROPERTIES COMPILE_FLAGS -Wno-format-truncation)
# Needed for coap headers in public builds, also.
#

74
components/coap/Kconfig Normal file
View File

@@ -0,0 +1,74 @@
menu "CoAP Configuration"
choice COAP_MBEDTLS_ENCRYPTION_MODE
prompt "CoAP Encryption method"
default COAP_MBEDTLS_PSK
help
If the CoAP information is to be encrypted, the encryption environment
can be set up in one of two ways (default being Pre-Shared key mode)
- Encrypt using defined Pre-Shared Keys (PSK if uri includes coaps://)
- Encrypt using defined Public Key Infrastructure (PKI if uri includes coaps://)
config COAP_MBEDTLS_PSK
select MBEDTLS_SSL_PROTO_DTLS
select MBEDTLS_PSK_MODES
select MBEDTLS_KEY_EXCHANGE_PSK
bool "Pre-Shared Keys"
config COAP_MBEDTLS_PKI
select MBEDTLS_SSL_PROTO_DTLS
select MBEDTLS_PSK_MODES
select MBEDTLS_KEY_EXCHANGE_PSK
bool "PKI Certificates"
endchoice #COAP_MBEDTLS_ENCRYPTION_MODE
config COAP_MBEDTLS_DEBUG
bool "Enable CoAP debugging"
default n
help
Enable CoAP debugging functions at compile time for the example code.
If this option is enabled, call coap_set_log_level()
at runtime in order to enable CoAP debug output via the ESP
log mechanism.
choice COAP_MBEDTLS_DEBUG_LEVEL
bool "Set CoAP debugging level"
depends on COAP_MBEDTLS_DEBUG
default COAP_LOG_WARNING
help
Set CoAP debugging level
config COAP_LOG_EMERG
bool "Emergency"
config COAP_LOG_ALERT
bool "Alert"
config COAP_LOG_CRIT
bool "Critical"
config COAP_LOG_ERROR
bool "Error"
config COAP_LOG_WARNING
bool "Warning"
config COAP_LOG_NOTICE
bool "Notice"
config COAP_LOG_INFO
bool "Info"
config COAP_LOG_DEBUG
bool "Debug"
endchoice
config COAP_LOG_DEFAULT_LEVEL
int
default 0 if !COAP_MBEDTLS_DEBUG
default 0 if COAP_LOG_EMERG
default 1 if COAP_LOG_ALERT
default 2 if COAP_LOG_CRIT
default 3 if COAP_LOG_ERROR
default 4 if COAP_LOG_WARNING
default 5 if COAP_LOG_NOTICE
default 6 if COAP_LOG_INFO
default 7 if COAP_LOG_DEBUG
endmenu

View File

@@ -4,11 +4,11 @@
COMPONENT_ADD_INCLUDEDIRS := port/include port/include/coap libcoap/include libcoap/include/coap2
COMPONENT_OBJS = libcoap/src/address.o libcoap/src/async.o libcoap/src/block.o libcoap/src/coap_event.o libcoap/src/coap_hashkey.o libcoap/src/coap_session.o libcoap/src/coap_time.o libcoap/src/coap_debug.o libcoap/src/encode.o libcoap/src/mem.o libcoap/src/net.o libcoap/src/option.o libcoap/src/pdu.o libcoap/src/resource.o libcoap/src/str.o libcoap/src/subscribe.o libcoap/src/uri.o libcoap/src/coap_notls.o port/coap_io.o
COMPONENT_OBJS = libcoap/src/address.o libcoap/src/async.o libcoap/src/block.o libcoap/src/coap_event.o libcoap/src/coap_hashkey.o libcoap/src/coap_session.o libcoap/src/coap_time.o port/coap_debug.o libcoap/src/encode.o libcoap/src/mem.o libcoap/src/net.o libcoap/src/option.o libcoap/src/pdu.o libcoap/src/resource.o libcoap/src/str.o libcoap/src/subscribe.o libcoap/src/uri.o port/coap_mbedtls.o libcoap/src/coap_io.o
COMPONENT_SRCDIRS := libcoap/src libcoap port
COMPONENT_SUBMODULES += libcoap
# Silence format truncation warning, until it is fixed upstream
libcoap/src/coap_debug.o: CFLAGS += -Wno-format-truncation
port/coap_debug.o: CFLAGS += -Wno-format-truncation

View File

@@ -0,0 +1,888 @@
/* debug.c -- debug utilities
*
* Copyright (C) 2010--2012,2014--2019 Olaf Bergmann <bergmann@tzi.org> and others
*
* This file is part of the CoAP library libcoap. Please see
* README for terms of use.
*/
#include "coap_config.h"
#if defined(HAVE_STRNLEN) && defined(__GNUC__) && !defined(_GNU_SOURCE)
#define _GNU_SOURCE 1
#endif
#if defined(HAVE_ASSERT_H) && !defined(assert)
# include <assert.h>
#endif
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif
#ifdef HAVE_TIME_H
#include <time.h>
#endif
#include "libcoap.h"
#include "coap_dtls.h"
#include "block.h"
#include "coap_debug.h"
#include "encode.h"
#include "net.h"
#include "coap_mutex.h"
#ifdef WITH_LWIP
# define fprintf(fd, ...) LWIP_PLATFORM_DIAG((__VA_ARGS__))
# define fflush(...)
#endif
#ifdef WITH_CONTIKI
# ifndef DEBUG
# define DEBUG DEBUG_PRINT
# endif /* DEBUG */
#include "net/ip/uip-debug.h"
#endif
static coap_log_t maxlog = LOG_WARNING; /* default maximum log level */
static int use_fprintf_for_show_pdu = 1; /* non zero to output with fprintf */
const char *coap_package_name(void) {
return PACKAGE_NAME;
}
const char *coap_package_version(void) {
return PACKAGE_STRING;
}
void
coap_set_show_pdu_output(int use_fprintf) {
use_fprintf_for_show_pdu = use_fprintf;
}
coap_log_t
coap_get_log_level(void) {
return maxlog;
}
void
coap_set_log_level(coap_log_t level) {
maxlog = level;
}
/* this array has the same order as the type log_t */
static const char *loglevels[] = {
"EMRG", "ALRT", "CRIT", "ERR ", "WARN", "NOTE", "INFO", "DEBG"
};
#ifdef HAVE_TIME_H
COAP_STATIC_INLINE size_t
print_timestamp(char *s, size_t len, coap_tick_t t) {
struct tm *tmp;
time_t now = coap_ticks_to_rt(t);
tmp = localtime(&now);
return strftime(s, len, "%b %d %H:%M:%S", tmp);
}
#else /* alternative implementation: just print the timestamp */
COAP_STATIC_INLINE size_t
print_timestamp(char *s, size_t len, coap_tick_t t) {
#ifdef HAVE_SNPRINTF
return snprintf(s, len, "%u.%03u",
(unsigned int)coap_ticks_to_rt(t),
(unsigned int)(t % COAP_TICKS_PER_SECOND));
#else /* HAVE_SNPRINTF */
/* @todo do manual conversion of timestamp */
return 0;
#endif /* HAVE_SNPRINTF */
}
#endif /* HAVE_TIME_H */
#ifndef HAVE_STRNLEN
/**
* A length-safe strlen() fake.
*
* @param s The string to count characters != 0.
* @param maxlen The maximum length of @p s.
*
* @return The length of @p s.
*/
static inline size_t
strnlen(const char *s, size_t maxlen) {
size_t n = 0;
while(*s++ && n < maxlen)
++n;
return n;
}
#endif /* HAVE_STRNLEN */
static size_t
print_readable( const uint8_t *data, size_t len,
unsigned char *result, size_t buflen, int encode_always ) {
const uint8_t hex[] = "0123456789ABCDEF";
size_t cnt = 0;
assert(data || len == 0);
if (buflen == 0) { /* there is nothing we can do here but return */
return 0;
}
while (len) {
if (!encode_always && isprint(*data)) {
if (cnt+1 < buflen) { /* keep one byte for terminating zero */
*result++ = *data;
++cnt;
} else {
break;
}
} else {
if (cnt+4 < buflen) { /* keep one byte for terminating zero */
*result++ = '\\';
*result++ = 'x';
*result++ = hex[(*data & 0xf0) >> 4];
*result++ = hex[*data & 0x0f];
cnt += 4;
} else
break;
}
++data; --len;
}
*result = '\0'; /* add a terminating zero */
return cnt;
}
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
size_t
coap_print_addr(const struct coap_address_t *addr, unsigned char *buf, size_t len) {
#if defined( HAVE_ARPA_INET_H ) || defined( HAVE_WS2TCPIP_H )
const void *addrptr = NULL;
in_port_t port;
unsigned char *p = buf;
size_t need_buf;
switch (addr->addr.sa.sa_family) {
case AF_INET:
addrptr = &addr->addr.sin.sin_addr;
port = ntohs(addr->addr.sin.sin_port);
need_buf = INET_ADDRSTRLEN;
break;
case AF_INET6:
if (len < 7) /* do not proceed if buffer is even too short for [::]:0 */
return 0;
*p++ = '[';
addrptr = &addr->addr.sin6.sin6_addr;
port = ntohs(addr->addr.sin6.sin6_port);
need_buf = INET6_ADDRSTRLEN;
break;
default:
memcpy(buf, "(unknown address type)", min(22, len));
return min(22, len);
}
/* Cast needed for Windows, since it doesn't have the correct API signature. */
if (inet_ntop(addr->addr.sa.sa_family, addrptr, (char *)p,
min(len, need_buf)) == 0) {
perror("coap_print_addr");
return 0;
}
p += strnlen((char *)p, len);
if (addr->addr.sa.sa_family == AF_INET6) {
if (p < buf + len) {
*p++ = ']';
} else
return 0;
}
p += snprintf((char *)p, buf + len - p + 1, ":%d", port);
return buf + len - p;
#else /* HAVE_ARPA_INET_H */
# if WITH_CONTIKI
unsigned char *p = buf;
uint8_t i;
# if NETSTACK_CONF_WITH_IPV6
const uint8_t hex[] = "0123456789ABCDEF";
if (len < 41)
return 0;
*p++ = '[';
for (i=0; i < 16; i += 2) {
if (i) {
*p++ = ':';
}
*p++ = hex[(addr->addr.u8[i] & 0xf0) >> 4];
*p++ = hex[(addr->addr.u8[i] & 0x0f)];
*p++ = hex[(addr->addr.u8[i+1] & 0xf0) >> 4];
*p++ = hex[(addr->addr.u8[i+1] & 0x0f)];
}
*p++ = ']';
# else /* WITH_UIP6 */
# warning "IPv4 network addresses will not be included in debug output"
if (len < 21)
return 0;
# endif /* WITH_UIP6 */
if (buf + len - p < 6)
return 0;
#ifdef HAVE_SNPRINTF
p += snprintf((char *)p, buf + len - p + 1, ":%d", uip_htons(addr->port));
#else /* HAVE_SNPRINTF */
/* @todo manual conversion of port number */
#endif /* HAVE_SNPRINTF */
return p - buf;
# else /* WITH_CONTIKI */
/* TODO: output addresses manually */
# warning "inet_ntop() not available, network addresses will not be included in debug output"
# endif /* WITH_CONTIKI */
return 0;
#endif
}
#ifdef WITH_CONTIKI
# define fprintf(fd, ...) PRINTF(__VA_ARGS__)
# define fflush(...)
# ifdef HAVE_VPRINTF
# define vfprintf(fd, ...) vprintf(__VA_ARGS__)
# else /* HAVE_VPRINTF */
# define vfprintf(fd, ...) PRINTF(__VA_ARGS__)
# endif /* HAVE_VPRINTF */
#endif /* WITH_CONTIKI */
/** Returns a textual description of the message type @p t. */
static const char *
msg_type_string(uint16_t t) {
static const char *types[] = { "CON", "NON", "ACK", "RST", "???" };
return types[min(t, sizeof(types)/sizeof(char *) - 1)];
}
/** Returns a textual description of the method or response code. */
static const char *
msg_code_string(uint16_t c) {
static const char *methods[] = { "0.00", "GET", "POST", "PUT", "DELETE",
"FETCH", "PATCH", "iPATCH" };
static const char *signals[] = { "7.00", "CSM", "Ping", "Pong", "Release",
"Abort" };
static char buf[5];
if (c < sizeof(methods)/sizeof(const char *)) {
return methods[c];
} else if (c >= 224 && c - 224 < (int)(sizeof(signals)/sizeof(const char *))) {
return signals[c-224];
} else {
snprintf(buf, sizeof(buf), "%u.%02u", (c >> 5) & 0x7, c & 0x1f);
return buf;
}
}
/** Returns a textual description of the option name. */
static const char *
msg_option_string(uint8_t code, uint16_t option_type) {
struct option_desc_t {
uint16_t type;
const char *name;
};
static struct option_desc_t options[] = {
{ COAP_OPTION_IF_MATCH, "If-Match" },
{ COAP_OPTION_URI_HOST, "Uri-Host" },
{ COAP_OPTION_ETAG, "ETag" },
{ COAP_OPTION_IF_NONE_MATCH, "If-None-Match" },
{ COAP_OPTION_OBSERVE, "Observe" },
{ COAP_OPTION_URI_PORT, "Uri-Port" },
{ COAP_OPTION_LOCATION_PATH, "Location-Path" },
{ COAP_OPTION_URI_PATH, "Uri-Path" },
{ COAP_OPTION_CONTENT_FORMAT, "Content-Format" },
{ COAP_OPTION_MAXAGE, "Max-Age" },
{ COAP_OPTION_URI_QUERY, "Uri-Query" },
{ COAP_OPTION_ACCEPT, "Accept" },
{ COAP_OPTION_LOCATION_QUERY, "Location-Query" },
{ COAP_OPTION_BLOCK2, "Block2" },
{ COAP_OPTION_BLOCK1, "Block1" },
{ COAP_OPTION_PROXY_URI, "Proxy-Uri" },
{ COAP_OPTION_PROXY_SCHEME, "Proxy-Scheme" },
{ COAP_OPTION_SIZE1, "Size1" },
{ COAP_OPTION_SIZE2, "Size2" },
{ COAP_OPTION_NORESPONSE, "No-Response" }
};
static struct option_desc_t options_csm[] = {
{ COAP_SIGNALING_OPTION_MAX_MESSAGE_SIZE, "Max-Message-Size" },
{ COAP_SIGNALING_OPTION_BLOCK_WISE_TRANSFER, "Block-wise-Transfer" }
};
static struct option_desc_t options_pingpong[] = {
{ COAP_SIGNALING_OPTION_CUSTODY, "Custody" }
};
static struct option_desc_t options_release[] = {
{ COAP_SIGNALING_OPTION_ALTERNATIVE_ADDRESS, "Alternative-Address" },
{ COAP_SIGNALING_OPTION_HOLD_OFF, "Hold-Off" }
};
static struct option_desc_t options_abort[] = {
{ COAP_SIGNALING_OPTION_BAD_CSM_OPTION, "Bad-CSM-Option" }
};
static char buf[6];
size_t i;
if (code == COAP_SIGNALING_CSM) {
for (i = 0; i < sizeof(options_csm)/sizeof(struct option_desc_t); i++) {
if (option_type == options_csm[i].type) {
return options_csm[i].name;
}
}
} else if (code == COAP_SIGNALING_PING || code == COAP_SIGNALING_PONG) {
for (i = 0; i < sizeof(options_pingpong)/sizeof(struct option_desc_t); i++) {
if (option_type == options_pingpong[i].type) {
return options_pingpong[i].name;
}
}
} else if (code == COAP_SIGNALING_RELEASE) {
for (i = 0; i < sizeof(options_release)/sizeof(struct option_desc_t); i++) {
if (option_type == options_release[i].type) {
return options_release[i].name;
}
}
} else if (code == COAP_SIGNALING_ABORT) {
for (i = 0; i < sizeof(options_abort)/sizeof(struct option_desc_t); i++) {
if (option_type == options_abort[i].type) {
return options_abort[i].name;
}
}
} else {
/* search option_type in list of known options */
for (i = 0; i < sizeof(options)/sizeof(struct option_desc_t); i++) {
if (option_type == options[i].type) {
return options[i].name;
}
}
}
/* unknown option type, just print to buf */
snprintf(buf, sizeof(buf), "%u", option_type);
return buf;
}
static unsigned int
print_content_format(unsigned int format_type,
unsigned char *result, unsigned int buflen) {
struct desc_t {
unsigned int type;
const char *name;
};
static struct desc_t formats[] = {
{ COAP_MEDIATYPE_TEXT_PLAIN, "text/plain" },
{ COAP_MEDIATYPE_APPLICATION_LINK_FORMAT, "application/link-format" },
{ COAP_MEDIATYPE_APPLICATION_XML, "application/xml" },
{ COAP_MEDIATYPE_APPLICATION_OCTET_STREAM, "application/octet-stream" },
{ COAP_MEDIATYPE_APPLICATION_EXI, "application/exi" },
{ COAP_MEDIATYPE_APPLICATION_JSON, "application/json" },
{ COAP_MEDIATYPE_APPLICATION_CBOR, "application/cbor" },
{ COAP_MEDIATYPE_APPLICATION_COSE_SIGN, "application/cose; cose-type=\"cose-sign\"" },
{ COAP_MEDIATYPE_APPLICATION_COSE_SIGN1, "application/cose; cose-type=\"cose-sign1\"" },
{ COAP_MEDIATYPE_APPLICATION_COSE_ENCRYPT, "application/cose; cose-type=\"cose-encrypt\"" },
{ COAP_MEDIATYPE_APPLICATION_COSE_ENCRYPT0, "application/cose; cose-type=\"cose-encrypt0\"" },
{ COAP_MEDIATYPE_APPLICATION_COSE_MAC, "application/cose; cose-type=\"cose-mac\"" },
{ COAP_MEDIATYPE_APPLICATION_COSE_MAC0, "application/cose; cose-type=\"cose-mac0\"" },
{ COAP_MEDIATYPE_APPLICATION_COSE_KEY, "application/cose-key" },
{ COAP_MEDIATYPE_APPLICATION_COSE_KEY_SET, "application/cose-key-set" },
{ COAP_MEDIATYPE_APPLICATION_SENML_JSON, "application/senml+json" },
{ COAP_MEDIATYPE_APPLICATION_SENSML_JSON, "application/sensml+json" },
{ COAP_MEDIATYPE_APPLICATION_SENML_CBOR, "application/senml+cbor" },
{ COAP_MEDIATYPE_APPLICATION_SENSML_CBOR, "application/sensml+cbor" },
{ COAP_MEDIATYPE_APPLICATION_SENML_EXI, "application/senml-exi" },
{ COAP_MEDIATYPE_APPLICATION_SENSML_EXI, "application/sensml-exi" },
{ COAP_MEDIATYPE_APPLICATION_SENML_XML, "application/senml+xml" },
{ COAP_MEDIATYPE_APPLICATION_SENSML_XML, "application/sensml+xml" },
{ 75, "application/dcaf+cbor" }
};
size_t i;
/* search format_type in list of known content formats */
for (i = 0; i < sizeof(formats)/sizeof(struct desc_t); i++) {
if (format_type == formats[i].type) {
return snprintf((char *)result, buflen, "%s", formats[i].name);
}
}
/* unknown content format, just print numeric value to buf */
return snprintf((char *)result, buflen, "%d", format_type);
}
/**
* Returns 1 if the given @p content_format is either unknown or known
* to carry binary data. The return value @c 0 hence indicates
* printable data which is also assumed if @p content_format is @c 01.
*/
COAP_STATIC_INLINE int
is_binary(int content_format) {
return !(content_format == -1 ||
content_format == COAP_MEDIATYPE_TEXT_PLAIN ||
content_format == COAP_MEDIATYPE_APPLICATION_LINK_FORMAT ||
content_format == COAP_MEDIATYPE_APPLICATION_XML ||
content_format == COAP_MEDIATYPE_APPLICATION_JSON);
}
#define COAP_DO_SHOW_OUTPUT_LINE \
do { \
if (use_fprintf_for_show_pdu) { \
fprintf(COAP_DEBUG_FD, "%s", outbuf); \
} \
else { \
coap_log(level, "%s", outbuf); \
} \
} while (0)
void
coap_show_pdu(coap_log_t level, const coap_pdu_t *pdu) {
#if COAP_CONSTRAINED_STACK
static coap_mutex_t static_show_pdu_mutex = COAP_MUTEX_INITIALIZER;
static unsigned char buf[1024]; /* need some space for output creation */
static char outbuf[COAP_DEBUG_BUF_SIZE];
#else /* ! COAP_CONSTRAINED_STACK */
unsigned char buf[1024]; /* need some space for output creation */
char outbuf[COAP_DEBUG_BUF_SIZE];
#endif /* ! COAP_CONSTRAINED_STACK */
size_t buf_len = 0; /* takes the number of bytes written to buf */
int encode = 0, have_options = 0, i;
coap_opt_iterator_t opt_iter;
coap_opt_t *option;
int content_format = -1;
size_t data_len;
unsigned char *data;
int outbuflen = 0;
/* Save time if not needed */
if (level > coap_get_log_level())
return;
#if COAP_CONSTRAINED_STACK
coap_mutex_lock(&static_show_pdu_mutex);
#endif /* COAP_CONSTRAINED_STACK */
snprintf(outbuf, sizeof(outbuf), "v:%d t:%s c:%s i:%04x {",
COAP_DEFAULT_VERSION, msg_type_string(pdu->type),
msg_code_string(pdu->code), pdu->tid);
for (i = 0; i < pdu->token_length; i++) {
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen,
"%02x", pdu->token[i]);
}
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, "}");
/* show options, if any */
coap_option_iterator_init(pdu, &opt_iter, COAP_OPT_ALL);
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, " [");
while ((option = coap_option_next(&opt_iter))) {
if (!have_options) {
have_options = 1;
} else {
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, ",");
}
if (pdu->code == COAP_SIGNALING_CSM) switch(opt_iter.type) {
case COAP_SIGNALING_OPTION_MAX_MESSAGE_SIZE:
buf_len = snprintf((char *)buf, sizeof(buf), "%u",
coap_decode_var_bytes(coap_opt_value(option),
coap_opt_length(option)));
break;
default:
buf_len = 0;
break;
} else if (pdu->code == COAP_SIGNALING_PING
|| pdu->code == COAP_SIGNALING_PONG) {
buf_len = 0;
} else if (pdu->code == COAP_SIGNALING_RELEASE) switch(opt_iter.type) {
case COAP_SIGNALING_OPTION_ALTERNATIVE_ADDRESS:
buf_len = print_readable(coap_opt_value(option),
coap_opt_length(option),
buf, sizeof(buf), 0);
break;
case COAP_SIGNALING_OPTION_HOLD_OFF:
buf_len = snprintf((char *)buf, sizeof(buf), "%u",
coap_decode_var_bytes(coap_opt_value(option),
coap_opt_length(option)));
break;
default:
buf_len = 0;
break;
} else if (pdu->code == COAP_SIGNALING_ABORT) switch(opt_iter.type) {
case COAP_SIGNALING_OPTION_BAD_CSM_OPTION:
buf_len = snprintf((char *)buf, sizeof(buf), "%u",
coap_decode_var_bytes(coap_opt_value(option),
coap_opt_length(option)));
break;
default:
buf_len = 0;
break;
} else switch (opt_iter.type) {
case COAP_OPTION_CONTENT_FORMAT:
content_format = (int)coap_decode_var_bytes(coap_opt_value(option),
coap_opt_length(option));
buf_len = print_content_format(content_format, buf, sizeof(buf));
break;
case COAP_OPTION_BLOCK1:
case COAP_OPTION_BLOCK2:
/* split block option into number/more/size where more is the
* letter M if set, the _ otherwise */
buf_len = snprintf((char *)buf, sizeof(buf), "%u/%c/%u",
coap_opt_block_num(option), /* block number */
COAP_OPT_BLOCK_MORE(option) ? 'M' : '_', /* M bit */
(1 << (COAP_OPT_BLOCK_SZX(option) + 4))); /* block size */
break;
case COAP_OPTION_URI_PORT:
case COAP_OPTION_MAXAGE:
case COAP_OPTION_OBSERVE:
case COAP_OPTION_SIZE1:
case COAP_OPTION_SIZE2:
/* show values as unsigned decimal value */
buf_len = snprintf((char *)buf, sizeof(buf), "%u",
coap_decode_var_bytes(coap_opt_value(option),
coap_opt_length(option)));
break;
default:
/* generic output function for all other option types */
if (opt_iter.type == COAP_OPTION_URI_PATH ||
opt_iter.type == COAP_OPTION_PROXY_URI ||
opt_iter.type == COAP_OPTION_URI_HOST ||
opt_iter.type == COAP_OPTION_LOCATION_PATH ||
opt_iter.type == COAP_OPTION_LOCATION_QUERY ||
opt_iter.type == COAP_OPTION_URI_QUERY) {
encode = 0;
} else {
encode = 1;
}
buf_len = print_readable(coap_opt_value(option),
coap_opt_length(option),
buf, sizeof(buf), encode);
}
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen,
" %s:%.*s", msg_option_string(pdu->code, opt_iter.type),
(int)buf_len, buf);
}
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, " ]");
if (coap_get_data(pdu, &data_len, &data)) {
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, " :: ");
if (is_binary(content_format)) {
int keep_data_len = data_len;
uint8_t *keep_data = data;
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen,
"binary data length %zu\n", data_len);
COAP_DO_SHOW_OUTPUT_LINE;
/*
* Output hex dump of binary data as a continuous entry
*/
outbuf[0] = '\000';
snprintf(outbuf, sizeof(outbuf), "<<");
while (data_len--) {
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen,
"%02x", *data++);
}
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, ">>");
data_len = keep_data_len;
data = keep_data;
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, "\n");
COAP_DO_SHOW_OUTPUT_LINE;
/*
* Output ascii readable (if possible), immediately under the
* hex value of the character output above to help binary debugging
*/
outbuf[0] = '\000';
snprintf(outbuf, sizeof(outbuf), "<<");
while (data_len--) {
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen,
"%c ", isprint (*data) ? *data : '.');
data++;
}
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, ">>");
} else {
if (print_readable(data, data_len, buf, sizeof(buf), 0)) {
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, "'%s'", buf);
}
}
}
outbuflen = strlen(outbuf);
snprintf(&outbuf[outbuflen], sizeof(outbuf)-outbuflen, "\n");
COAP_DO_SHOW_OUTPUT_LINE;
#if COAP_CONSTRAINED_STACK
coap_mutex_unlock(&static_show_pdu_mutex);
#endif /* COAP_CONSTRAINED_STACK */
}
void coap_show_tls_version(coap_log_t level)
{
char buffer[64];
coap_string_tls_version(buffer, sizeof(buffer));
coap_log(level, "%s\n", buffer);
}
char *coap_string_tls_version(char *buffer, size_t bufsize)
{
coap_tls_version_t *tls_version = coap_get_tls_library_version();
char beta[8];
char sub[2];
char b_beta[8];
char b_sub[2];
switch (tls_version->type) {
case COAP_TLS_LIBRARY_NOTLS:
snprintf(buffer, bufsize, "TLS Library: None");
break;
case COAP_TLS_LIBRARY_TINYDTLS:
snprintf(buffer, bufsize, "TLS Library: TinyDTLS - runtime %lu.%lu.%lu, "
"libcoap built for %lu.%lu.%lu",
(unsigned long)(tls_version->version >> 16),
(unsigned long)((tls_version->version >> 8) & 0xff),
(unsigned long)(tls_version->version & 0xff),
(unsigned long)(tls_version->built_version >> 16),
(unsigned long)((tls_version->built_version >> 8) & 0xff),
(unsigned long)(tls_version->built_version & 0xff));
break;
case COAP_TLS_LIBRARY_OPENSSL:
switch (tls_version->version &0xf) {
case 0:
strcpy(beta, "-dev");
break;
case 0xf:
strcpy(beta, "");
break;
default:
strcpy(beta, "-beta");
beta[5] = (tls_version->version &0xf) + '0';
beta[6] = '\000';
break;
}
sub[0] = ((tls_version->version >> 4) & 0xff) ?
((tls_version->version >> 4) & 0xff) + 'a' -1 : '\000';
sub[1] = '\000';
switch (tls_version->built_version &0xf) {
case 0:
strcpy(b_beta, "-dev");
break;
case 0xf:
strcpy(b_beta, "");
break;
default:
strcpy(b_beta, "-beta");
b_beta[5] = (tls_version->built_version &0xf) + '0';
b_beta[6] = '\000';
break;
}
b_sub[0] = ((tls_version->built_version >> 4) & 0xff) ?
((tls_version->built_version >> 4) & 0xff) + 'a' -1 : '\000';
b_sub[1] = '\000';
snprintf(buffer, bufsize, "TLS Library: OpenSSL - runtime "
"%lu.%lu.%lu%s%s, libcoap built for %lu.%lu.%lu%s%s",
(unsigned long)(tls_version->version >> 28),
(unsigned long)((tls_version->version >> 20) & 0xff),
(unsigned long)((tls_version->version >> 12) & 0xff), sub, beta,
(unsigned long)(tls_version->built_version >> 28),
(unsigned long)((tls_version->built_version >> 20) & 0xff),
(unsigned long)((tls_version->built_version >> 12) & 0xff),
b_sub, b_beta);
break;
case COAP_TLS_LIBRARY_GNUTLS:
snprintf(buffer, bufsize, "TLS Library: GnuTLS - runtime %lu.%lu.%lu, "
"libcoap built for %lu.%lu.%lu",
(unsigned long)(tls_version->version >> 16),
(unsigned long)((tls_version->version >> 8) & 0xff),
(unsigned long)(tls_version->version & 0xff),
(unsigned long)(tls_version->built_version >> 16),
(unsigned long)((tls_version->built_version >> 8) & 0xff),
(unsigned long)(tls_version->built_version & 0xff));
break;
case COAP_TLS_LIBRARY_MBEDTLS:
snprintf(buffer, bufsize, "TLS Library: MbedTLS - runtime %lu.%lu.%lu, "
"libcoap built for %lu.%lu.%lu",
(unsigned long)(tls_version->version >> 24),
(unsigned long)((tls_version->version >> 16) & 0xff),
(unsigned long)((tls_version->version >> 8) & 0xff),
(unsigned long)(tls_version->built_version >> 24),
(unsigned long)((tls_version->built_version >> 16) & 0xff),
(unsigned long)((tls_version->built_version >> 8) & 0xff));
break;
default:
snprintf(buffer, bufsize, "Library type %d unknown", tls_version->type);
break;
}
return buffer;
}
static coap_log_handler_t log_handler = NULL;
void coap_set_log_handler(coap_log_handler_t handler) {
log_handler = handler;
}
void
coap_log_impl(coap_log_t level, const char *format, ...) {
if (maxlog < level)
return;
if (log_handler) {
#if COAP_CONSTRAINED_STACK
static coap_mutex_t static_log_mutex = COAP_MUTEX_INITIALIZER;
static char message[COAP_DEBUG_BUF_SIZE];
#else /* ! COAP_CONSTRAINED_STACK */
char message[COAP_DEBUG_BUF_SIZE];
#endif /* ! COAP_CONSTRAINED_STACK */
va_list ap;
va_start(ap, format);
#if COAP_CONSTRAINED_STACK
coap_mutex_lock(&static_log_mutex);
#endif /* COAP_CONSTRAINED_STACK */
vsnprintf( message, sizeof(message), format, ap);
va_end(ap);
log_handler(level, message);
#if COAP_CONSTRAINED_STACK
coap_mutex_unlock(&static_log_mutex);
#endif /* COAP_CONSTRAINED_STACK */
} else {
char timebuf[32];
coap_tick_t now;
va_list ap;
FILE *log_fd;
log_fd = level <= LOG_CRIT ? COAP_ERR_FD : COAP_DEBUG_FD;
coap_ticks(&now);
if (print_timestamp(timebuf,sizeof(timebuf), now))
fprintf(log_fd, "%s ", timebuf);
if (level <= LOG_DEBUG)
fprintf(log_fd, "%s ", loglevels[level]);
va_start(ap, format);
vfprintf(log_fd, format, ap);
va_end(ap);
fflush(log_fd);
}
}
static struct packet_num_interval {
int start;
int end;
} packet_loss_intervals[10];
static int num_packet_loss_intervals = 0;
static int packet_loss_level = 0;
static int send_packet_count = 0;
int coap_debug_set_packet_loss(const char *loss_level) {
const char *p = loss_level;
char *end = NULL;
int n = (int)strtol(p, &end, 10), i = 0;
if (end == p || n < 0)
return 0;
if (*end == '%') {
if (n > 100)
n = 100;
packet_loss_level = n * 65536 / 100;
coap_log(LOG_DEBUG, "packet loss level set to %d%%\n", n);
} else {
if (n <= 0)
return 0;
while (i < 10) {
packet_loss_intervals[i].start = n;
if (*end == '-') {
p = end + 1;
n = (int)strtol(p, &end, 10);
if (end == p || n <= 0)
return 0;
}
packet_loss_intervals[i++].end = n;
if (*end == 0)
break;
if (*end != ',')
return 0;
p = end + 1;
n = (int)strtol(p, &end, 10);
if (end == p || n <= 0)
return 0;
}
if (i == 10)
return 0;
num_packet_loss_intervals = i;
}
send_packet_count = 0;
return 1;
}
int coap_debug_send_packet(void) {
++send_packet_count;
if (num_packet_loss_intervals > 0) {
int i;
for (i = 0; i < num_packet_loss_intervals; i++) {
if (send_packet_count >= packet_loss_intervals[i].start
&& send_packet_count <= packet_loss_intervals[i].end)
return 0;
}
}
if ( packet_loss_level > 0 ) {
uint16_t r = 0;
prng( (uint8_t*)&r, 2 );
if ( r < packet_loss_level )
return 0;
}
return 1;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,631 @@
/*
* coap_dtls.h -- (Datagram) Transport Layer Support for libcoap
*
* Copyright (C) 2016 Olaf Bergmann <bergmann@tzi.org>
* Copyright (C) 2017 Jean-Claude Michelou <jcm@spinetix.com>
*
* This file is part of the CoAP library libcoap. Please see README for terms
* of use.
*/
#ifndef COAP_DTLS_H_
#define COAP_DTLS_H_
#include "coap_time.h"
#include "str.h"
struct coap_context_t;
struct coap_session_t;
struct coap_dtls_pki_t;
/**
* @defgroup dtls DTLS Support
* API functions for interfacing with DTLS libraries.
* @{
*/
/**
* Check whether DTLS is available.
*
* @return @c 1 if support for DTLS is enabled, or @c 0 otherwise.
*/
int coap_dtls_is_supported(void);
/**
* Check whether TLS is available.
*
* @return @c 1 if support for TLS is enabled, or @c 0 otherwise.
*/
int coap_tls_is_supported(void);
typedef enum coap_tls_library_t {
COAP_TLS_LIBRARY_NOTLS = 0, /**< No DTLS library */
COAP_TLS_LIBRARY_TINYDTLS, /**< Using TinyDTLS library */
COAP_TLS_LIBRARY_OPENSSL, /**< Using OpenSSL library */
COAP_TLS_LIBRARY_GNUTLS, /**< Using GnuTLS library */
COAP_TLS_LIBRARY_MBEDTLS, /**< Using MbedTLS library */
} coap_tls_library_t;
/**
* The structure used for returning the underlying (D)TLS library
* information.
*/
typedef struct coap_tls_version_t {
uint64_t version; /**< (D)TLS runtime Library Version */
coap_tls_library_t type; /**< Library type. One of COAP_TLS_LIBRARY_* */
uint64_t built_version; /**< (D)TLS Built against Library Version */
} coap_tls_version_t;
/**
* Determine the type and version of the underlying (D)TLS library.
*
* @return The version and type of library libcoap was compiled against.
*/
coap_tls_version_t *coap_get_tls_library_version(void);
/**
* Additional Security setup handler that can be set up by
* coap_context_set_pki().
* Invoked when libcoap has done the validation checks at the TLS level,
* but the application needs to do some additional checks/changes/updates.
*
* @param tls_session The security session definition - e.g. SSL * for OpenSSL.
* NULL if server call-back.
* This will be dependent on the underlying TLS library -
* see coap_get_tls_library_version()
* @param setup_data A structure containing setup data originally passed into
* coap_context_set_pki() or coap_new_client_session_pki().
*
* @return @c 1 if successful, else @c 0.
*/
typedef int (*coap_dtls_security_setup_t)(void* tls_session,
struct coap_dtls_pki_t *setup_data);
/**
* CN Validation call-back that can be set up by coap_context_set_pki().
* Invoked when libcoap has done the validation checks at the TLS level,
* but the application needs to check that the CN is allowed.
* CN is the SubjectAltName in the cert, if not present, then the leftmost
* Common Name (CN) component of the subject name.
*
* @param cn The determined CN from the certificate
* @param asn1_public_cert The ASN.1 DER encoded X.509 certificate
* @param asn1_length The ASN.1 length
* @param coap_session The CoAP session associated with the certificate update
* @param depth Depth in cert chain. If 0, then client cert, else a CA
* @param validated TLS layer can find no issues if 1
* @param arg The same as was passed into coap_context_set_pki()
* in setup_data->cn_call_back_arg
*
* @return @c 1 if accepted, else @c 0 if to be rejected.
*/
typedef int (*coap_dtls_cn_callback_t)(const char *cn,
const uint8_t *asn1_public_cert,
size_t asn1_length,
struct coap_session_t *coap_session,
unsigned depth,
int validated,
void *arg);
/**
* The enum used for determining the provided PKI ASN.1 (DER) Private Key
* formats.
*/
typedef enum coap_asn1_privatekey_type_t {
COAP_ASN1_PKEY_NONE, /**< NONE */
COAP_ASN1_PKEY_RSA, /**< RSA type */
COAP_ASN1_PKEY_RSA2, /**< RSA2 type */
COAP_ASN1_PKEY_DSA, /**< DSA type */
COAP_ASN1_PKEY_DSA1, /**< DSA1 type */
COAP_ASN1_PKEY_DSA2, /**< DSA2 type */
COAP_ASN1_PKEY_DSA3, /**< DSA3 type */
COAP_ASN1_PKEY_DSA4, /**< DSA4 type */
COAP_ASN1_PKEY_DH, /**< DH type */
COAP_ASN1_PKEY_DHX, /**< DHX type */
COAP_ASN1_PKEY_EC, /**< EC type */
COAP_ASN1_PKEY_HMAC, /**< HMAC type */
COAP_ASN1_PKEY_CMAC, /**< CMAC type */
COAP_ASN1_PKEY_TLS1_PRF, /**< TLS1_PRF type */
COAP_ASN1_PKEY_HKDF /**< HKDF type */
} coap_asn1_privatekey_type_t;
/**
* The enum used for determining the PKI key formats.
*/
typedef enum coap_pki_key_t {
COAP_PKI_KEY_PEM = 0, /**< The PKI key type is PEM file */
COAP_PKI_KEY_ASN1, /**< The PKI key type is ASN.1 (DER) */
COAP_PKI_KEY_PEM_BUF, /**< The PKI key type is PEM buffer */
} coap_pki_key_t;
/**
* The structure that holds the PKI PEM definitions.
*/
typedef struct coap_pki_key_pem_t {
const char *ca_file; /**< File location of Common CA in PEM format */
const char *public_cert; /**< File location of Public Cert in PEM format */
const char *private_key; /**< File location of Private Key in PEM format */
} coap_pki_key_pem_t;
/**
* The structure that holds the PKI PEM buffer definitions.
*/
typedef struct coap_pki_key_pem_buf_t {
const uint8_t *ca_cert; /**< PEM buffer Common CA Cert */
const uint8_t *public_cert; /**< PEM buffer Public Cert */
const uint8_t *private_key; /**< PEM buffer Private Key */
size_t ca_cert_len; /**< PEM buffer CA Cert length */
size_t public_cert_len; /**< PEM buffer Public Cert length */
size_t private_key_len; /**< PEM buffer Private Key length */
} coap_pki_key_pem_buf_t;
/**
* The structure that holds the PKI ASN.1 (DER) definitions.
*/
typedef struct coap_pki_key_asn1_t {
const uint8_t *ca_cert; /**< ASN1 (DER) Common CA Cert */
const uint8_t *public_cert; /**< ASN1 (DER) Public Cert */
const uint8_t *private_key; /**< ASN1 (DER) Private Key */
size_t ca_cert_len; /**< ASN1 CA Cert length */
size_t public_cert_len; /**< ASN1 Public Cert length */
size_t private_key_len; /**< ASN1 Private Key length */
coap_asn1_privatekey_type_t private_key_type; /**< Private Key Type */
} coap_pki_key_asn1_t;
/**
* The structure that holds the PKI key information.
*/
typedef struct coap_dtls_key_t {
coap_pki_key_t key_type; /**< key format type */
union {
coap_pki_key_pem_t pem; /**< for PEM file keys */
coap_pki_key_pem_buf_t pem_buf; /**< for PEM memory keys */
coap_pki_key_asn1_t asn1; /**< for ASN.1 (DER) file keys */
} key;
} coap_dtls_key_t;
/**
* Server Name Indication (SNI) Validation call-back that can be set up by
* coap_context_set_pki().
* Invoked if the SNI is not previously seen and prior to sending a certificate
* set back to the client so that the appropriate certificate set can be used
* based on the requesting SNI.
*
* @param sni The requested SNI
* @param arg The same as was passed into coap_context_set_pki()
* in setup_data->sni_call_back_arg
*
* @return New set of certificates to use, or @c NULL if SNI is to be rejected.
*/
typedef coap_dtls_key_t *(*coap_dtls_sni_callback_t)(const char *sni,
void* arg);
#define COAP_DTLS_PKI_SETUP_VERSION 1 /**< Latest PKI setup version */
/**
* The structure used for defining the PKI setup data to be used.
*/
typedef struct coap_dtls_pki_t {
uint8_t version; /** Set to 1 to support this version of the struct */
/* Options to enable different TLS functionality in libcoap */
uint8_t verify_peer_cert; /**< 1 if peer cert is to be verified */
uint8_t require_peer_cert; /**< 1 if peer cert is required */
uint8_t allow_self_signed; /**< 1 if self signed certs are allowed */
uint8_t allow_expired_certs; /**< 1 if expired certs are allowed */
uint8_t cert_chain_validation; /**< 1 if to check cert_chain_verify_depth */
uint8_t cert_chain_verify_depth; /**< recommended depth is 3 */
uint8_t check_cert_revocation; /**< 1 if revocation checks wanted */
uint8_t allow_no_crl; /**< 1 ignore if CRL not there */
uint8_t allow_expired_crl; /**< 1 if expired crl is allowed */
uint8_t allow_bad_md_hash; /**< 1 if expired certs are allowed */
uint8_t allow_short_rsa_length; /**< 1 if expired certs are allowed */
uint8_t reserved[4]; /**< Reserved - must be set to 0 for
future compatibility */
/* Size of 4 chosen to align to next
* parameter, so if newly defined option
* it can use one of the reserverd slot so
* no need to change
* COAP_DTLS_PKI_SETUP_VERSION and just
* decrement the reserved[] count.
*/
/** CN check call-back function.
* If not NULL, is called when the TLS connection has passed the configured
* TLS options above for the application to verify if the CN is valid.
*/
coap_dtls_cn_callback_t validate_cn_call_back;
void *cn_call_back_arg; /**< Passed in to the CN call-back function */
/** SNI check call-back function.
* If not @p NULL, called if the SNI is not previously seen and prior to
* sending a certificate set back to the client so that the appropriate
* certificate set can be used based on the requesting SNI.
*/
coap_dtls_sni_callback_t validate_sni_call_back;
void *sni_call_back_arg; /**< Passed in to the sni call-back function */
/** Additional Security call-back handler that is invoked when libcoap has
* done the standerd, defined validation checks at the TLS level,
* If not @p NULL, called from within the TLS Client Hello connection
* setup.
*/
coap_dtls_security_setup_t additional_tls_setup_call_back;
char* client_sni; /**< If not NULL, SNI to use in client TLS setup.
Owned by the client app and must remain valid
during the call to coap_new_client_session_pki() */
coap_dtls_key_t pki_key; /**< PKI key definition */
} coap_dtls_pki_t;
/** @} */
/**
* @defgroup dtls_internal DTLS Support (Internal)
* Internal API functions for interfacing with DTLS libraries.
* @{
*/
/**
* Creates a new DTLS context for the given @p coap_context. This function
* returns a pointer to a new DTLS context object or @c NULL on error.
*
* Internal function.
*
* @param coap_context The CoAP context where the DTLS object shall be used.
*
* @return A DTLS context object or @c NULL on error.
*/
void *
coap_dtls_new_context(struct coap_context_t *coap_context);
typedef enum coap_dtls_role_t {
COAP_DTLS_ROLE_CLIENT, /**< Internal function invoked for client */
COAP_DTLS_ROLE_SERVER /**< Internal function invoked for server */
} coap_dtls_role_t;
/**
* Set the DTLS context's default PSK information.
* This does the PSK specifics following coap_dtls_new_context().
* If @p COAP_DTLS_ROLE_SERVER, then identity hint will also get set.
* If @p COAP_DTLS_ROLE_SERVER, then the information will get put into the
* TLS library's context (from which sessions are derived).
* If @p COAP_DTLS_ROLE_CLIENT, then the information will get put into the
* TLS library's session.
*
* Internal function.
*
* @param coap_context The CoAP context.
* @param identity_hint The default PSK server identity hint sent to a client.
* Required parameter. If @p NULL, will be set to "".
* Empty string is a valid hint.
* This parameter is ignored if COAP_DTLS_ROLE_CLIENT
* @param role One of @p COAP_DTLS_ROLE_CLIENT or @p COAP_DTLS_ROLE_SERVER
*
* @return @c 1 if successful, else @c 0.
*/
int
coap_dtls_context_set_psk(struct coap_context_t *coap_context,
const char *identity_hint,
coap_dtls_role_t role);
/**
* Set the DTLS context's default server PKI information.
* This does the PKI specifics following coap_dtls_new_context().
* If @p COAP_DTLS_ROLE_SERVER, then the information will get put into the
* TLS library's context (from which sessions are derived).
* If @p COAP_DTLS_ROLE_CLIENT, then the information will get put into the
* TLS library's session.
*
* Internal function.
*
* @param coap_context The CoAP context.
* @param setup_data Setup information defining how PKI is to be setup.
* Required parameter. If @p NULL, PKI will not be
* set up.
* @param role One of @p COAP_DTLS_ROLE_CLIENT or @p COAP_DTLS_ROLE_SERVER
*
* @return @c 1 if successful, else @c 0.
*/
int
coap_dtls_context_set_pki(struct coap_context_t *coap_context,
coap_dtls_pki_t *setup_data,
coap_dtls_role_t role);
/**
* Set the dtls context's default Root CA information for a client or server.
*
* Internal function.
*
* @param coap_context The current coap_context_t object.
* @param ca_file If not @p NULL, is the full path name of a PEM encoded
* file containing all the Root CAs to be used.
* @param ca_dir If not @p NULL, points to a directory containing PEM
* encoded files containing all the Root CAs to be used.
*
* @return @c 1 if successful, else @c 0.
*/
int
coap_dtls_context_set_pki_root_cas(struct coap_context_t *coap_context,
const char *ca_file,
const char *ca_dir);
/**
* Check whether one of the coap_dtls_context_set_{psk|pki}() functions have
* been called.
*
* Internal function.
*
* @param coap_context The current coap_context_t object.
*
* @return @c 1 if coap_dtls_context_set_{psk|pki}() called, else @c 0.
*/
int coap_dtls_context_check_keys_enabled(struct coap_context_t *coap_context);
/**
* Releases the storage allocated for @p dtls_context.
*
* Internal function.
*
* @param dtls_context The DTLS context as returned by coap_dtls_new_context().
*/
void coap_dtls_free_context(void *dtls_context);
/**
* Create a new client-side session. This should send a HELLO to the server.
*
* Internal function.
*
* @param coap_session The CoAP session.
*
* @return Opaque handle to underlying TLS library object containing security
* parameters for the session.
*/
void *coap_dtls_new_client_session(struct coap_session_t *coap_session);
/**
* Create a new DTLS server-side session.
* Called after coap_dtls_hello() has returned @c 1, signalling that a validated
* HELLO was received from a client.
* This should send a HELLO to the server.
*
* Internal function.
*
* @param coap_session The CoAP session.
*
* @return Opaque handle to underlying TLS library object containing security
* parameters for the DTLS session.
*/
void *coap_dtls_new_server_session(struct coap_session_t *coap_session);
/**
* Terminates the DTLS session (may send an ALERT if necessary) then frees the
* underlying TLS library object containing security parameters for the session.
*
* Internal function.
*
* @param coap_session The CoAP session.
*/
void coap_dtls_free_session(struct coap_session_t *coap_session);
/**
* Notify of a change in the CoAP session's MTU, for example after
* a PMTU update.
*
* Internal function.
*
* @param coap_session The CoAP session.
*/
void coap_dtls_session_update_mtu(struct coap_session_t *coap_session);
/**
* Send data to a DTLS peer.
*
* Internal function.
*
* @param coap_session The CoAP session.
* @param data pointer to data.
* @param data_len Number of bytes to send.
*
* @return @c 0 if this would be blocking, @c -1 if there is an error or the
* number of cleartext bytes sent.
*/
int coap_dtls_send(struct coap_session_t *coap_session,
const uint8_t *data,
size_t data_len);
/**
* Check if timeout is handled per CoAP session or per CoAP context.
*
* Internal function.
*
* @return @c 1 of timeout and retransmit is per context, @c 0 if it is
* per session.
*/
int coap_dtls_is_context_timeout(void);
/**
* Do all pending retransmits and get next timeout
*
* Internal function.
*
* @param dtls_context The DTLS context.
*
* @return @c 0 if no event is pending or date of the next retransmit.
*/
coap_tick_t coap_dtls_get_context_timeout(void *dtls_context);
/**
* Get next timeout for this session.
*
* Internal function.
*
* @param coap_session The CoAP session.
* @param now The current time in ticks.
*
* @return @c 0 If no event is pending or ticks time of the next retransmit.
*/
coap_tick_t coap_dtls_get_timeout(struct coap_session_t *coap_session,
coap_tick_t now);
/**
* Handle a DTLS timeout expiration.
*
* Internal function.
*
* @param coap_session The CoAP session.
*/
void coap_dtls_handle_timeout(struct coap_session_t *coap_session);
/**
* Handling incoming data from a DTLS peer.
*
* Internal function.
*
* @param coap_session The CoAP session.
* @param data Encrypted datagram.
* @param data_len Encrypted datagram size.
*
* @return Result of coap_handle_dgram on the decrypted CoAP PDU
* or @c -1 for error.
*/
int coap_dtls_receive(struct coap_session_t *coap_session,
const uint8_t *data,
size_t data_len);
/**
* Handling client HELLO messages from a new candiate peer.
* Note that session->tls is empty.
*
* Internal function.
*
* @param coap_session The CoAP session.
* @param data Encrypted datagram.
* @param data_len Encrypted datagram size.
*
* @return @c 0 if a cookie verification message has been sent, @c 1 if the
* HELLO contains a valid cookie and a server session should be created,
* @c -1 if the message is invalid.
*/
int coap_dtls_hello(struct coap_session_t *coap_session,
const uint8_t *data,
size_t data_len);
/**
* Get DTLS overhead over cleartext PDUs.
*
* Internal function.
*
* @param coap_session The CoAP session.
*
* @return Maximum number of bytes added by DTLS layer.
*/
unsigned int coap_dtls_get_overhead(struct coap_session_t *coap_session);
/**
* Create a new TLS client-side session.
*
* Internal function.
*
* @param coap_session The CoAP session.
* @param connected Updated with whether the connection is connected yet or not.
* @c 0 is not connected, @c 1 is connected.
*
* @return Opaque handle to underlying TLS library object containing security
* parameters for the session.
*/
void *coap_tls_new_client_session(struct coap_session_t *coap_session, int *connected);
/**
* Create a TLS new server-side session.
*
* Internal function.
*
* @param coap_session The CoAP session.
* @param connected Updated with whether the connection is connected yet or not.
* @c 0 is not connected, @c 1 is connected.
*
* @return Opaque handle to underlying TLS library object containing security
* parameters for the session.
*/
void *coap_tls_new_server_session(struct coap_session_t *coap_session, int *connected);
/**
* Terminates the TLS session (may send an ALERT if necessary) then frees the
* underlying TLS library object containing security parameters for the session.
*
* Internal function.
*
* @param coap_session The CoAP session.
*/
void coap_tls_free_session( struct coap_session_t *coap_session );
/**
* Send data to a TLS peer, with implicit flush.
*
* Internal function.
*
* @param coap_session The CoAP session.
* @param data Pointer to data.
* @param data_len Number of bytes to send.
*
* @return @c 0 if this should be retried, @c -1 if there is an error
* or the number of cleartext bytes sent.
*/
ssize_t coap_tls_write(struct coap_session_t *coap_session,
const uint8_t *data,
size_t data_len
);
/**
* Read some data from a TLS peer.
*
* Internal function.
*
* @param coap_session The CoAP session.
* @param data Pointer to data.
* @param data_len Maximum number of bytes to read.
*
* @return @c 0 if this should be retried, @c -1 if there is an error
* or the number of cleartext bytes read.
*/
ssize_t coap_tls_read(struct coap_session_t *coap_session,
uint8_t *data,
size_t data_len
);
/**
* Initialize the underlying (D)TLS Library layer.
*
* Internal function.
*
*/
void coap_dtls_startup(void);
/** @} */
/**
* @ingroup logging
* Sets the (D)TLS logging level to the specified @p level.
* Note: coap_log_level() will influence output if at a specified level.
*
* @param level The logging level to use - LOG_*
*/
void coap_dtls_set_log_level(int level);
/**
* @ingroup logging
* Get the current (D)TLS logging.
*
* @return The current log level (one of LOG_*).
*/
int coap_dtls_get_log_level(void);
#endif /* COAP_DTLS_H */

View File

@@ -21,18 +21,27 @@
#ifdef WITH_POSIX
#include <sys/socket.h>
#include <net/if.h>
#define HAVE_SYS_SOCKET_H
#define HAVE_MALLOC
#define HAVE_ARPA_INET_H
#define HAVE_TIME_H
#define HAVE_NETDB_H
#define HAVE_NETINET_IN_H
#define IPV6_PKTINFO IPV6_V6ONLY
#define PACKAGE_NAME "libcoap-posix"
#define PACKAGE_VERSION "?"
#define COAP_BAD_RECVMSG
#define HAVE_MBEDTLS
#define COAP_CONSTRAINED_STACK 1
#define ESPIDF_VERSION
#define _POSIX_TIMERS 1
#define gai_strerror(x) "gai_strerror() not supported"
#endif /* WITH_POSIX */
#endif /* COAP_CONFIG_POSIX_H_ */

View File

@@ -70,7 +70,7 @@ esp_err_t esp_console_init(const esp_console_config_t *config)
return ESP_OK;
}
esp_err_t esp_console_deinit()
esp_err_t esp_console_deinit(void)
{
if (!s_tmp_line_buf) {
return ESP_ERR_INVALID_STATE;
@@ -232,7 +232,7 @@ static int help_command(int argc, char **argv)
}
esp_err_t esp_console_register_help_command()
esp_err_t esp_console_register_help_command(void)
{
esp_console_cmd_t command = {
.command = "help",

View File

@@ -52,7 +52,7 @@ esp_err_t esp_console_init(const esp_console_config_t* config);
* - ESP_OK on success
* - ESP_ERR_INVALID_STATE if not initialized yet
*/
esp_err_t esp_console_deinit();
esp_err_t esp_console_deinit(void);
/**
@@ -185,7 +185,7 @@ const char *esp_console_get_hint(const char *buf, int *color, int *bold);
* - ESP_OK on success
* - ESP_ERR_INVALID_STATE, if esp_console_init wasn't called
*/
esp_err_t esp_console_register_help_command();
esp_err_t esp_console_register_help_command(void);
#ifdef __cplusplus
}

View File

@@ -205,7 +205,7 @@ void linenoiseSetDumbMode(int set) {
/* Use the ESC [6n escape sequence to query the horizontal cursor position
* and return it. On error -1 is returned, on success the position of the
* cursor. */
static int getCursorPosition() {
static int getCursorPosition(void) {
char buf[32];
int cols, rows;
unsigned int i = 0;
@@ -228,7 +228,7 @@ static int getCursorPosition() {
/* Try to get the number of columns in the current terminal, or assume 80
* if it fails. */
static int getColumns() {
static int getColumns(void) {
int start, cols;
/* Get the initial position so we can restore it later. */
@@ -887,7 +887,7 @@ static int linenoiseEdit(char *buf, size_t buflen, const char *prompt)
return l.len;
}
int linenoiseProbe() {
int linenoiseProbe(void) {
/* Switch to non-blocking mode */
int flags = fcntl(STDIN_FILENO, F_GETFL);
flags |= O_NONBLOCK;
@@ -1000,7 +1000,7 @@ void linenoiseFree(void *ptr) {
/* ================================ History ================================= */
void linenoiseHistoryFree() {
void linenoiseHistoryFree(void) {
if (history) {
for (int j = 0; j < history_len; j++) {
free(history[j]);

View File

@@ -63,7 +63,7 @@ int linenoiseHistoryAdd(const char *line);
int linenoiseHistorySetMaxLen(int len);
int linenoiseHistorySave(const char *filename);
int linenoiseHistoryLoad(const char *filename);
void linenoiseHistoryFree();
void linenoiseHistoryFree(void);
void linenoiseClearScreen(void);
void linenoiseSetMultiLine(int ml);
void linenoiseSetDumbMode(int set);

View File

@@ -36,7 +36,7 @@ static size_t s_static_init_max_waiting_count = 0; //!< maximum ever va
extern "C" int __cxa_guard_acquire(__guard* pg);
extern "C" void __cxa_guard_release(__guard* pg);
extern "C" void __cxa_guard_abort(__guard* pg);
extern "C" void __cxa_guard_dummy();
extern "C" void __cxa_guard_dummy(void);
/**
* Layout of the guard object (defined by the ABI).
@@ -215,6 +215,6 @@ extern "C" void __cxa_guard_abort(__guard* pg)
* Dummy function used to force linking this file instead of the same one in libstdc++.
* This works via -u __cxa_guard_dummy flag in component.mk
*/
extern "C" void __cxa_guard_dummy()
extern "C" void __cxa_guard_dummy(void)
{
}

View File

@@ -29,7 +29,7 @@ extern "C" {
* This is an internal API for I2S module to call to enable I2S-ADC function.
* Note that adc_power_off() can still power down ADC.
*/
void adc_power_always_on();
void adc_power_always_on(void);
/**
* @brief For I2S dma to claim the usage of ADC1.
@@ -41,7 +41,7 @@ void adc_power_always_on();
* - ESP_OK success
* - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
*/
esp_err_t adc1_i2s_mode_acquire();
esp_err_t adc1_i2s_mode_acquire(void);
/**
* @brief For ADC1 to claim the usage of ADC1.
@@ -53,7 +53,7 @@ esp_err_t adc1_i2s_mode_acquire();
* - ESP_OK success
* - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
*/
esp_err_t adc1_adc_mode_acquire();
esp_err_t adc1_adc_mode_acquire(void);
/**
* @brief to let other tasks use the ADC1 when I2S is not work.
@@ -63,7 +63,7 @@ esp_err_t adc1_adc_mode_acquire();
*
* @return always return ESP_OK.
*/
esp_err_t adc1_lock_release();
esp_err_t adc1_lock_release(void);
#ifdef __cplusplus
}

View File

@@ -141,7 +141,7 @@ static portMUX_TYPE can_spinlock = portMUX_INITIALIZER_UNLOCKED;
/* ------------------- Configuration Register Functions---------------------- */
static inline esp_err_t can_enter_reset_mode()
static inline esp_err_t can_enter_reset_mode(void)
{
/* Enter reset mode (required to write to configuration registers). Reset mode
also prevents all CAN activity on the current module and is automatically
@@ -151,7 +151,7 @@ static inline esp_err_t can_enter_reset_mode()
return ESP_OK;
}
static inline esp_err_t can_exit_reset_mode()
static inline esp_err_t can_exit_reset_mode(void)
{
/* Exiting reset mode will return the CAN module to operating mode. Reset mode
must also be exited in order to trigger BUS-OFF recovery sequence. */
@@ -160,7 +160,7 @@ static inline esp_err_t can_exit_reset_mode()
return ESP_OK;
}
static inline void can_config_pelican()
static inline void can_config_pelican(void)
{
//Use PeliCAN address layout. Exposes extra registers
CAN.clock_divider_reg.can_mode = 1;
@@ -286,23 +286,23 @@ static void can_set_tx_buffer_and_transmit(can_frame_t *frame)
can_set_command(command);
}
static inline uint32_t can_get_status()
static inline uint32_t can_get_status(void)
{
return CAN.status_reg.val;
}
static inline uint32_t can_get_interrupt_reason()
static inline uint32_t can_get_interrupt_reason(void)
{
return CAN.interrupt_reg.val;
}
static inline uint32_t can_get_arbitration_lost_capture()
static inline uint32_t can_get_arbitration_lost_capture(void)
{
return CAN.arbitration_lost_captue_reg.val;
//Todo: ALC read only to re-arm arb lost interrupt. Add function to decode ALC
}
static inline uint32_t can_get_error_code_capture()
static inline uint32_t can_get_error_code_capture(void)
{
return CAN.error_code_capture_reg.val;
//Todo: ECC read only to re-arm bus error interrupt. Add function to decode ECC
@@ -328,7 +328,7 @@ static inline void can_get_rx_buffer_and_clear(can_frame_t *frame)
can_set_command(CMD_RELEASE_RX_BUFF);
}
static inline uint32_t can_get_rx_message_counter()
static inline uint32_t can_get_rx_message_counter(void)
{
return CAN.rx_message_counter_reg.val;
}
@@ -725,7 +725,7 @@ esp_err_t can_driver_install(const can_general_config_t *g_config, const can_tim
return ret;
}
esp_err_t can_driver_uninstall()
esp_err_t can_driver_uninstall(void)
{
can_obj_t *p_can_obj_dummy;
@@ -761,7 +761,7 @@ esp_err_t can_driver_uninstall()
return ESP_OK;
}
esp_err_t can_start()
esp_err_t can_start(void)
{
//Check state
CAN_ENTER_CRITICAL();
@@ -791,7 +791,7 @@ esp_err_t can_start()
return ESP_OK;
}
esp_err_t can_stop()
esp_err_t can_stop(void)
{
//Check state
CAN_ENTER_CRITICAL();
@@ -928,7 +928,7 @@ esp_err_t can_reconfigure_alerts(uint32_t alerts_enabled, uint32_t *current_aler
return ESP_OK;
}
esp_err_t can_initiate_recovery()
esp_err_t can_initiate_recovery(void)
{
CAN_ENTER_CRITICAL();
//Check state
@@ -982,7 +982,7 @@ esp_err_t can_get_status_info(can_status_info_t *status_info)
return ESP_OK;
}
esp_err_t can_clear_transmit_queue()
esp_err_t can_clear_transmit_queue(void)
{
//Check State
CAN_CHECK(p_can_obj != NULL, ESP_ERR_INVALID_STATE);
@@ -997,7 +997,7 @@ esp_err_t can_clear_transmit_queue()
return ESP_OK;
}
esp_err_t can_clear_receive_queue()
esp_err_t can_clear_receive_queue(void)
{
//Check State
CAN_CHECK(p_can_obj != NULL, ESP_ERR_INVALID_STATE);

View File

@@ -419,7 +419,7 @@ esp_err_t gpio_install_isr_service(int intr_alloc_flags)
return ret;
}
void gpio_uninstall_isr_service()
void gpio_uninstall_isr_service(void)
{
if (gpio_isr_func == NULL) {
return;

View File

@@ -942,7 +942,7 @@ esp_err_t i2c_set_pin(i2c_port_t i2c_num, int sda_io_num, int scl_io_num, gpio_p
return ESP_OK;
}
i2c_cmd_handle_t i2c_cmd_link_create()
i2c_cmd_handle_t i2c_cmd_link_create(void)
{
#if !CONFIG_SPIRAM_USE_MALLOC
i2c_cmd_desc_t* cmd_desc = (i2c_cmd_desc_t*) calloc(1, sizeof(i2c_cmd_desc_t));

View File

@@ -740,7 +740,7 @@ esp_err_t i2s_set_dac_mode(i2s_dac_mode_t dac_mode)
return ESP_OK;
}
static esp_err_t _i2s_adc_mode_recover()
static esp_err_t _i2s_adc_mode_recover(void)
{
I2S_CHECK(((_i2s_adc_unit != -1) && (_i2s_adc_channel != -1)), "i2s ADC recover error, not initialized...", ESP_ERR_INVALID_ARG);
return adc_i2s_mode_init(_i2s_adc_unit, _i2s_adc_channel);
@@ -944,7 +944,7 @@ static esp_err_t i2s_param_config(i2s_port_t i2s_num, const i2s_config_t *i2s_co
I2S[i2s_num]->conf.rx_start = 0;
if (i2s_config->mode & I2S_MODE_TX) {
I2S[i2s_num]->conf.tx_msb_right = 0;
I2S[i2s_num]->conf.tx_msb_right = 1;
I2S[i2s_num]->conf.tx_right_first = 0;
I2S[i2s_num]->conf.tx_slave_mod = 0; // Master
@@ -956,7 +956,7 @@ static esp_err_t i2s_param_config(i2s_port_t i2s_num, const i2s_config_t *i2s_co
}
if (i2s_config->mode & I2S_MODE_RX) {
I2S[i2s_num]->conf.rx_msb_right = 0;
I2S[i2s_num]->conf.rx_msb_right = 1;
I2S[i2s_num]->conf.rx_right_first = 0;
I2S[i2s_num]->conf.rx_slave_mod = 0; // Master
I2S[i2s_num]->fifo_conf.rx_fifo_mod_force_en = 1;

View File

@@ -229,13 +229,13 @@ int adc1_get_voltage(adc1_channel_t channel) __attribute__((deprecated));
/**
* @brief Enable ADC power
*/
void adc_power_on();
void adc_power_on(void);
/**
* @brief Power off SAR ADC
* This function will force power down for ADC
*/
void adc_power_off();
void adc_power_off(void);
/**
* @brief Initialize ADC pad
@@ -292,7 +292,7 @@ esp_err_t adc_i2s_mode_init(adc_unit_t adc_unit, adc_channel_t channel);
* Note that adc1_config_channel_atten, adc1_config_width functions need
* to be called to configure ADC1 channels, before ADC1 is used by the ULP.
*/
void adc1_ulp_enable();
void adc1_ulp_enable(void);
/**
* @brief Read Hall Sensor
@@ -313,7 +313,7 @@ void adc1_ulp_enable();
*
* @return The hall sensor reading.
*/
int hall_sensor_read();
int hall_sensor_read(void);
/**
* @brief Get the gpio number of a specific ADC2 channel.

View File

@@ -31,7 +31,7 @@ extern "C" {
* - ESP_OK success
* - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
*/
esp_err_t adc2_wifi_acquire();
esp_err_t adc2_wifi_acquire(void);
/**
@@ -42,7 +42,7 @@ esp_err_t adc2_wifi_acquire();
*
* @return always return ESP_OK.
*/
esp_err_t adc2_wifi_release();
esp_err_t adc2_wifi_release(void);
#ifdef __cplusplus
}

View File

@@ -238,7 +238,7 @@ esp_err_t can_driver_install(const can_general_config_t *g_config, const can_tim
* - ESP_OK: Successfully uninstalled CAN driver
* - ESP_ERR_INVALID_STATE: Driver is not in stopped/bus-off state, or is not installed
*/
esp_err_t can_driver_uninstall();
esp_err_t can_driver_uninstall(void);
/**
* @brief Start the CAN driver
@@ -253,7 +253,7 @@ esp_err_t can_driver_uninstall();
* - ESP_OK: CAN driver is now running
* - ESP_ERR_INVALID_STATE: Driver is not in stopped state, or is not installed
*/
esp_err_t can_start();
esp_err_t can_start(void);
/**
* @brief Stop the CAN driver
@@ -272,7 +272,7 @@ esp_err_t can_start();
* - ESP_OK: CAN driver is now Stopped
* - ESP_ERR_INVALID_STATE: Driver is not in running state, or is not installed
*/
esp_err_t can_stop();
esp_err_t can_stop(void);
/**
* @brief Transmit a CAN message
@@ -379,7 +379,7 @@ esp_err_t can_reconfigure_alerts(uint32_t alerts_enabled, uint32_t *current_aler
* - ESP_OK: Bus recovery started
* - ESP_ERR_INVALID_STATE: CAN driver is not in the bus-off state, or is not installed
*/
esp_err_t can_initiate_recovery();
esp_err_t can_initiate_recovery(void);
/**
* @brief Get current status information of the CAN driver
@@ -405,7 +405,7 @@ esp_err_t can_get_status_info(can_status_info_t *status_info);
* - ESP_OK: Transmit queue cleared
* - ESP_ERR_INVALID_STATE: CAN driver is not installed or TX queue is disabled
*/
esp_err_t can_clear_transmit_queue();
esp_err_t can_clear_transmit_queue(void);
/**
* @brief Clear the receive queue
@@ -419,7 +419,7 @@ esp_err_t can_clear_transmit_queue();
* - ESP_OK: Transmit queue cleared
* - ESP_ERR_INVALID_STATE: CAN driver is not installed
*/
esp_err_t can_clear_receive_queue();
esp_err_t can_clear_receive_queue(void);
#ifdef __cplusplus
}

View File

@@ -99,12 +99,12 @@ esp_err_t dac_output_disable(dac_channel_t channel);
/**
* @brief Enable DAC output data from I2S
*/
esp_err_t dac_i2s_enable();
esp_err_t dac_i2s_enable(void);
/**
* @brief Disable DAC output data from I2S
*/
esp_err_t dac_i2s_disable();
esp_err_t dac_i2s_disable(void);
#ifdef __cplusplus
}
#endif

View File

@@ -475,7 +475,7 @@ esp_err_t gpio_install_isr_service(int intr_alloc_flags);
/**
* @brief Uninstall the driver's GPIO ISR service, freeing related resources.
*/
void gpio_uninstall_isr_service();
void gpio_uninstall_isr_service(void);
/**
* @brief Add ISR handler for the corresponding GPIO pin.

View File

@@ -224,7 +224,7 @@ esp_err_t i2c_set_pin(i2c_port_t i2c_num, int sda_io_num, int scl_io_num,
*
* @return i2c command link handler
*/
i2c_cmd_handle_t i2c_cmd_link_create();
i2c_cmd_handle_t i2c_cmd_link_create(void);
/**
* @brief Free I2C command link

View File

@@ -51,6 +51,13 @@ typedef enum {
LEDC_APB_CLK, /*!< LEDC timer clock divided from APB clock (80Mhz) */
} ledc_clk_src_t;
typedef enum {
LEDC_AUTO_CLK, /*!< The driver will automatically select the source clock(REF_TICK or APB) based on the giving resolution and duty parameter when init the timer*/
LEDC_USE_REF_TICK, /*!< LEDC timer select REF_TICK clock as source clock*/
LEDC_USE_APB_CLK, /*!< LEDC timer select APB clock as source clock*/
LEDC_USE_RTC8M_CLK, /*!< LEDC timer select RTC8M_CLK as source clock. Only for low speed channels and this parameter must be the same for all low speed channels*/
} ledc_clk_cfg_t;
typedef enum {
LEDC_TIMER_0 = 0, /*!< LEDC timer 0 */
LEDC_TIMER_1, /*!< LEDC timer 1 */
@@ -125,6 +132,9 @@ typedef struct {
};
ledc_timer_t timer_num; /*!< The timer source of channel (0 - 3) */
uint32_t freq_hz; /*!< LEDC timer frequency (Hz) */
ledc_clk_cfg_t clk_cfg; /*!< Configure LEDC source clock.
For low speed channels and high speed channels, you can specify the source clock using LEDC_USE_REF_TICK, LEDC_USE_APB_CLK or LEDC_AUTO_CLK.
For low speed channels, you can also specify the source clock using LEDC_USE_RTC8M_CLK, in this case, all low speed channel's source clock must be RTC8M_CLK*/
} ledc_timer_config_t;
typedef intr_handle_t ledc_isr_handle_t;
@@ -435,7 +445,7 @@ esp_err_t ledc_fade_func_install(int intr_alloc_flags);
* @brief Uninstall LEDC fade function.
*
*/
void ledc_fade_func_uninstall();
void ledc_fade_func_uninstall(void);
/**
* @brief Start LEDC fading.

View File

@@ -219,7 +219,7 @@ esp_err_t rtc_gpio_isolate(gpio_num_t gpio_num);
* Force hold signal is enabled before going into deep sleep for pins which
* are used for EXT1 wakeup.
*/
void rtc_gpio_force_hold_dis_all();
void rtc_gpio_force_hold_dis_all(void);
/**
* @brief Set RTC GPIO pad drive capability

View File

@@ -111,7 +111,7 @@ esp_err_t sdio_slave_initialize(sdio_slave_config_t *config);
/** De-initialize the sdio slave driver to release the resources.
*/
void sdio_slave_deinit();
void sdio_slave_deinit(void);
/** Start hardware for sending and receiving, as well as set the IOREADY1 to 1.
*
@@ -122,19 +122,19 @@ void sdio_slave_deinit();
* - ESP_ERR_INVALID_STATE if already started.
* - ESP_OK otherwise.
*/
esp_err_t sdio_slave_start();
esp_err_t sdio_slave_start(void);
/** Stop hardware from sending and receiving, also set IOREADY1 to 0.
*
* @note this will not clear the data already in the driver, and also not reset the PKT_LEN and TOKEN1 counting. Call ``sdio_slave_reset`` to do that.
*/
void sdio_slave_stop();
void sdio_slave_stop(void);
/** Clear the data still in the driver, as well as reset the PKT_LEN and TOKEN1 counting.
*
* @return always return ESP_OK.
*/
esp_err_t sdio_slave_reset();
esp_err_t sdio_slave_reset(void);
/*---------------------------------------------------------------------------
* Receive
@@ -263,7 +263,7 @@ esp_err_t sdio_slave_write_reg(int pos, uint8_t reg);
*
* @return the interrupt mask.
*/
sdio_slave_hostint_t sdio_slave_get_host_intena();
sdio_slave_hostint_t sdio_slave_get_host_intena(void);
/** Set the interrupt enable for host.
*

View File

@@ -91,7 +91,7 @@ typedef struct {
* - ESP_ERR_INVALID_STATE if sdmmc_host_init was already called
* - ESP_ERR_NO_MEM if memory can not be allocated
*/
esp_err_t sdmmc_host_init();
esp_err_t sdmmc_host_init(void);
/**
* @brief Initialize given slot of SDMMC peripheral
@@ -218,7 +218,7 @@ esp_err_t sdmmc_host_io_int_wait(int slot, TickType_t timeout_ticks);
* - ESP_OK on success
* - ESP_ERR_INVALID_STATE if sdmmc_host_init function has not been called
*/
esp_err_t sdmmc_host_deinit();
esp_err_t sdmmc_host_deinit(void);
/**
* @brief Enable the pull-ups of sd pins.

View File

@@ -91,7 +91,7 @@ typedef struct {
* - ESP_OK on success
* - other error codes may be returned in future versions
*/
esp_err_t sdspi_host_init();
esp_err_t sdspi_host_init(void);
/**
* @brief Initialize SD SPI driver for the specific SPI controller
@@ -159,7 +159,7 @@ esp_err_t sdspi_host_set_card_clk(int slot, uint32_t freq_khz);
* - ESP_OK on success
* - ESP_ERR_INVALID_STATE if sdspi_host_init function has not been called
*/
esp_err_t sdspi_host_deinit();
esp_err_t sdspi_host_deinit(void);
/**
* @brief Enable SDIO interrupt.

Some files were not shown because too many files have changed in this diff Show More