Commit graph

180 commits

Author SHA1 Message Date
Jeroen Domburg 68f39c1ed9 Only init crosscore when FreeRTOS runs in multicore mode, add warnings that cross_int calls are private. 2016-10-27 16:50:28 +08:00
Jeroen Domburg b14faabfda Merge latest master in 2016-10-27 16:18:55 +08:00
Jeroen Domburg 3371083c16 Add checks for tasks woken up on other CPUs where needed, make xYieldPending and xPendingReadyList per-processor, add configurable ISR stack size to Kconfig, in general fix the entire wake-up-task-on-other-cpu-by-interrupt implementation 2016-10-27 16:07:47 +08:00
Liu Zhi Fu e0f49c2221 esp32: add esp_wifi_sta_get_ap_info
The customers need to get information about AP that associated with ESP32 station,
these information includes RSSI, channel number etc, so add this new API
2016-10-27 10:42:01 +08:00
Jeroen Domburg fd887dbeea Merge remote-tracking branch 'origin/master' into feature/wdts 2016-10-27 10:25:23 +08:00
liuzhifu df1c2f0da5 components/esp32: refractor according to review comments
modify esp_wifi_kick_sta to esp_wifi_deauth_sta
2016-10-26 21:50:15 +08:00
Jeroen Domburg d3d9a8bc28 Most code written. Interrupts still do not fire yet. 2016-10-26 21:09:55 +08:00
liuzhifu 750d6faf51 esp32/tcpip_adapter: rework according to review comments
1. Modify sta to station in comments
2. Modify esp_wifi_get_ap_num to esp_wifi_scan_get_ap_num
3. Modify esp_wifi_get_ap_list to esp_wifi_scan_get_ap_records
2016-10-26 20:02:39 +08:00
liuzhifu 3cca62dfa4 esp32/tcpip_adapter: refractor for some wifi APIs
1. Modify esp_wifi_get_station_list to esp_wifi_ap_get_sta_list
2. Modify tcpip_adapter_get_station_list to tcpip_adapter_get_sta_list
3. Remove esp_wifi_free_station_list
4. Remove tcpip_adapter_free_station_list
5. Modify related data struct accordingly
2016-10-26 18:16:40 +08:00
Jeroen Domburg 9546ad5b5e Move write key and stage action select constants into headers 2016-10-26 14:54:50 +08:00
liuzhifu a90217e201 components esp32/lwip: modify code according to review comments
1. Modify comments for esp_wifi_internal_tx
2. Fix delay time error in esp32_tx_flow_ctrl which is found in code review,
   modify _wait_delay init value from 0 to 1
2016-10-26 14:09:54 +08:00
liuzhifu 612aaa69e4 lwip/esp32: move the extern wifi calls into esp_wifi_internal.h
1. Add esp_wifi_internal.h
2. Rename system_pp_recycle_rx_pkt to esp_wifi_internal_free_rx_buffer
3. rename esp_wifi_tx_is_stop to esp_wifi_internal_tx_is_stop
4. rename ieee80211_output to esp_wifi_internal_tx
2016-10-26 13:23:35 +08:00
Jeroen Domburg 7d254eb3f0 Move panic handler and gdbstub into esp32 component, clean up wdt according to merge req suggestions 2016-10-26 12:23:01 +08:00
Jeroen Domburg 1ca97f5adb Move panic handler code from FreeRTOS to esp32 component 2016-10-26 11:06:53 +08:00
Jeroen Domburg 6f96b23989 Merge in master updates 2016-10-26 11:04:42 +08:00
Jeroen Domburg 06bff71481 Add licenses, docbook, general cleanup 2016-10-25 18:18:11 +08:00
Wangjialin 288f4f63f0 Add UART driver
1. add uart.h and uart.c
2. add ESP_ERR_TIMEOUT in esp_err.h
3. add UART AHB FIFO address in uart_reg.h
4. modify xRingbufferSendFromISR return value in ringbuffer.c
5. add #include "soc/gpio_sig_map.h" in gpio.h
2016-10-24 09:17:10 +08:00
Jeroen Domburg 53146799a0 Initial addition of wdt and brownout code 2016-10-21 17:59:57 +08:00
Ivan Grokhotkov 42827ff869 bootloader, menuconfig: add flash size setting support 2016-10-21 15:27:25 +11:00
Angus Gratton feca308f1f rom/spi_flash.h: Remove first parameter of SPI_read_status_high()
Corrects the prototype to match the one compiled into ROM.
2016-10-21 10:44:05 +11:00
Angus Gratton da70611196 Deep sleep: Any source named rtc_wake_stub* is linked as RTC wake stub code
Also move esp_deepsleep.h documentation out to docs/deep-sleep-stub.rst
2016-10-19 15:58:37 +11:00
Jeroen Domburg fa476c8ba9 Merge branch 'bugfix/small_fixes_jd' into 'master'
Some small fixes

- Kill unused uxReturn in task.c,  https://github.com/espressif/esp-idf/issues/48
- Line end conversion in gpio.c
- Move heap_alloc_caps.h so components can also use it

See merge request !135
2016-10-12 21:13:34 +08:00
Angus Gratton 9632c8e56c RSA Accelerator: Add mod_exp, refactor to avoid memory allocation & copying
Not fully working at the moment, mod_exp has a bug.
2016-10-12 16:19:09 +11:00
Jeroen Domburg df31bb8dfc Rename include, use spaces instead of tabs 2016-10-09 15:32:08 +08:00
Jeroen Domburg a03e75d34c Move heap_alloc_caps.h to a location where it can be included by components 2016-10-08 14:11:34 +08:00
Jeroen Domburg 5cd3bd5c4b Add data memory for RMT peripheral 2016-10-08 13:15:06 +08:00
Wu Jian Gang f17f57b48d esp32: remove esp_wps.h
not support now
2016-09-30 13:48:37 +08:00
Wangjialin 9d0daa3722 add smartconfig header files(merge this after updating libsmartconfig.a version v2.6.2)
1. change the original API names.
2. return esp_err_t
3. merge this after updating libsmartconfig.a version v2.6.2
2016-09-30 02:31:14 +08:00
Wu Jian Gang 702e749667 Merge branch 'feature/deep_sleep_wake_stub' into 'master'
esp32: Bootloader wake deep sleep stub

App can contain a stub program resident in RTC fast memory. Bootloader
will load the stub on initial boot. If the device wakes from deep sleep,
the stub is run immediately (before any other data is loaded, etc.)

To implement a custom wake stub, implement a function in your program:

```
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
  esp_default_wake_deep_sleep();
  // other wake logic
}
```

... and it will replace the default implementation.

See merge request !78
2016-09-29 18:07:16 +08:00
jack 4e092be6d6 Add Comments
We reserve 4KB Slow RTC memory to save RF calibation result and BT NVS data.
If not all these Slow RTC momory Blocks are used, we will open the other parts.
2016-09-29 16:29:13 +08:00
Wangjialin 9cfb3227a3 Merge branch 'master' into driver_merge_tmp/merge_ledc
Merge master branch to pass building.
2016-09-28 13:27:58 +08:00
xiaxiaotian ec03c31ec4 1. Change the deep sleep stub code to fix wake bug. 2016-09-28 11:52:39 +08:00
Angus Gratton 5f45cbc16a esp32: Add esp_deepsleep.h to esp_system.h to keep backwards compatibility with system_deep_sleep() 2016-09-28 11:14:58 +08:00
Angus Gratton 7c494055e3 esp32: Bootloader wake deep sleep stub
App can contain a stub program resident in RTC fast memory. Bootloader
will load the stub on initial boot. If the device wakes from deep sleep,
the stub is run immediately (before any other data is loaded, etc.)

To implement a custom wake stub, implement a function in your program:

```
void RTC_IRAM_ATTR esp_wake_deep_sleep(void)
{
  esp_default_wake_deep_sleep();
  // other wake logic
}
```

... and it will replace the default implementation.
2016-09-28 11:14:58 +08:00
Ivan Grokhotkov 952df01a10 wifi: move type definitions into separate header file
While this may reduce esp_wifi.h file readability for people who don't have a "go to definition" function in their editors, this is needed to decouple esp_wifi and esp_event headers, and possibly other headers which may use wifi types in the future.
2016-09-27 11:47:47 +08:00
Ivan Grokhotkov 01a7efad88 wifi: use default esp_event_send handler in WIFI_INIT_CONFIG_DEFAULT 2016-09-27 11:33:19 +08:00
liuzhifu 0aace445a6 component/esp32: modify bool argument name from enable to en
1. Modify WIFI_INIT_CONFIG_DEFAULT
2. Modify bool argument name from enable to en
2016-09-26 20:15:16 +08:00
liuzhifu bd2e55def3 component/esp32: adjust some APIs
1. Modify wifi_init_config_t to:
   typedef struct {
      wifi_event_handler_t event_handler;  /**< WiFi event handler */
   } wifi_init_config_t;
2. Modify argument of esp_wifi_set/get_promiscuous from uint8_t/uint8_t* to bool/bool*
2016-09-26 19:45:36 +08:00
Wangjialin ec45e1a593 components/driver: modify LEDC driver
1. modify ledc struct header: combine high speed and low speed channel
2. modify ledc init function
3. add timer control api
4. modify typo in ledc.h
2016-09-26 09:56:03 +08:00
Ivan Grokhotkov 5a762d9eee components/esp32: clarify type of queue in wifi_init_config_t, add default init macro 2016-09-26 01:35:31 +08:00
Ivan Grokhotkov e9b54b6b45 components/esp32: add ESP_ERROR_CHECK
Convenience macro to do error check and assert in cases when error recovery is not expected
2016-09-26 01:34:05 +08:00
Ivan Grokhotkov 53de9f115f Event handling refactoring
This change separates definitions in esp_event.h and functions in event.c into several parts:
- event structure definitions (esp_event.h)
- default implementations of event handlers (event_default_handlers.c)
- default implementation of event loop (event_loop.c, esp_event_loop.h)

Purpose of this change is to allow applications choose their own poison:
- full control of event loop at the expense of more bootstrap code
- pre-defined event task firing event callbacks, but less code in app_main.c
2016-09-26 01:17:32 +08:00
Ivan Grokhotkov e1c782a206 components/esp32,bt: fix typos in comments 2016-09-26 00:51:56 +08:00
Ivan Grokhotkov b936441b9b Startup flow refactoring
This change removes implicit WiFi/BT initialization from startup code.
"main" task is started once essential part of startup code is complete.
This task calls application-provided "int main(void)" function, which can call WiFi/BT init functions if necessary.
2016-09-26 00:50:57 +08:00
Wangjialin 3f1c5c4d5b 1. add a macro 'GPIO_IS_VALID_OUTPUT_GPIO' and 'GPIO_IS_VALID_OUTPUT_GPIO' in gpio.h
2. add PIN_FUNC_GPIO in io_mux_reg.h, put the io_mux_regs in order
3. use braces around single line if statements in ledc.c and gpio.c
2016-09-23 14:52:26 +08:00
snake 95c48d4b84 1. clean up the macro. 2. change component/bt/lib url to use new lib 2016-09-23 10:48:55 +08:00
snake 993287af61 add btdm_controller 1st 2016-09-22 16:40:31 +08:00
Ivan Grokhotkov 226e64bd1e Merge branch 'driver_merge_tmp/fix_fifo_struct_header' into 'master'
use uint8_t for fifo struct in uart and i2c

use uint8_t for fifo struct in uart and i2c

See merge request !106
2016-09-22 11:39:16 +08:00
Wangjialin 71fe8d9f15 Merge branch 'master' into driver_merge_tmp/merge_gpio 2016-09-22 10:50:06 +08:00
Wangjialin d2420b667c use uint8_t for fifo struct in uart and i2c 2016-09-22 09:05:39 +08:00
Wu Jian Gang 835cc55138 esp32: wait uart tx finish before cpu freq change 2016-09-21 16:15:42 +08:00
Ivan Grokhotkov da69d6ad3c Merge branch 'master' into feature/menuconfig_cpu_frequency_option
* master: (57 commits)
  components/lwip: fix grammar
  components/lwip: make SO_REUSE configurable via menuconfig
  bootloader: remove trailing newlines from log messages
  components/freertos: override per-task __cleanup handler to close stdin, stdout, stderr
  components/esp32: move peripheral symbols to separate ld script
  components/log: regroup macros for better readability
  gitlab-ci: allow running tests for branches, triggered via API
  components/log: fix timestamp calculation
  components/log: set default runtime log level to ESP_LOG_VERBOSE
  components/log: fix error when using ESP_LOGx from C++ code
  components/log: fix bugs, add options to override log level for files, components, and bootloader
  fix ledc and spi typo
  remove prefix and postfix
  Enable SO_REUSEADDR in LWIP
  freertos: fix memory debug macro issue Define configENABLE_MEMORY_DEBUG according to CONFIG_ENABLE_MEMORY_DEBUG
  peripheral structure headers: move volatile keyword from members to typedef
  Adding -fstrict-volatile-bitfields to the CFLAGS/CXXFLAGS. Without this, gcc tries to access bitfields using the smallest possible methods (eg l8i to grab an 8-bit field from a 32-bit). Our hardware does not like that. This flag tells gcc that if a bitfield is volatile, it should always use the type the field is defined at (uint32_t in our case) to size its access to the field. This fixes accessing the hardware through the xxx_struct.h headers.
  add peripheral  module struct headers
  build system docs: Add note about no spaces in component names
  Docs: Add note about unusual submodule messages when cloning on Windows
  ...

# Conflicts:
#	components/esp32/cpu_start.c
#	components/esp32/include/soc/cpu.h
2016-09-20 17:22:18 +08:00
Ivan Grokhotkov 6e35c0a91a Merge branch 'feature/logging' into 'master'
Add logging library

Logging library, intended to be used across other components.
Uses design similar to Android NDK logging APIs and allows for both compile time and run time filters, similar to logcat.

Also includes cleanup of cpu_startup.c — i was changing some logging output in this file so decided to re-format it and reduce code duplication.

Ref TW6703

See merge request !68
2016-09-20 17:16:41 +08:00
Wangjialin 2be163f6cc add gpio driver code 2016-09-19 17:33:21 +08:00
Ivan Grokhotkov b1ac144874 Merge branch 'driver_merge_tmp/merge_struct_header' into 'master'
add peripheral modules struct headers



See merge request !88
2016-09-19 15:34:37 +08:00
Wangjialin 015ae7e0d0 fix ledc and spi typo 2016-09-18 19:24:43 +08:00
Wangjialin 94bcb14bcc remove prefix and postfix 2016-09-18 19:05:37 +08:00
Ivan Grokhotkov 9938f512f3 peripheral structure headers: move volatile keyword from members to typedef 2016-09-18 12:36:33 +08:00
Wangjialin 489b4f31a9 add peripheral module struct headers 2016-09-18 03:14:18 +08:00
Angus Gratton 6cffb5d8b4 rom/gpio.h: Use new GPIO_PIN0_REG register name
Closes github #12
2016-09-16 09:43:52 +10:00
Ivan Grokhotkov cf22e4445a Merge branch 'master' into feature/logging
* master: (45 commits)
  esp32/lib: update to 1303c92c
  dhcpserver: Fix crash when switching wifi mode
  mbedtls: Temporarily disable default hardware crypto SHA & bignum
  mbedtls hwcrypto sha512: Fix redirection of function names
  mbedtls upstream tweak: Move mbedtls_sha512_process in sha512.h
  Format code by using 4 spaces instead
  modify  character conversion error and typo
  modify i2s_reg.h, rebase to master
  Only modify headers in soc/ . Pass compiling under esp-idf-tests/merge_soc_tmp/merge_for_soc_headers branch.(only change some names of register and INUM).
  Rename vender_ie_type_t and vendor_ie_id_t to wifi_vendor_ie_type_t and wifi_vendor_ie_id_t respectively
  modify arguments for vendor ie APIs by using enum instead
  esp32: fix typo
  esp32: fix kconfig
  define lwip task priority in esp_task.h
  components: esp32 - fix build error
  components: lwip - Modify lwip task priority and stack definition method
  components: esp32
  components: esp32
  components: esp32/lwip
  task priority: modify lwip/wifi/event task priority
  ...

# Conflicts:
#	components/bootloader/src/main/bootloader_start.c
#	components/bootloader/src/main/flash_encrypt.c
#	components/bootloader/src/main/secure_boot.c
#	components/esp32/cpu_start.c
2016-09-15 02:15:50 +08:00
Ivan Grokhotkov 0290a34b55 components/esp32: clean up cpu_start
Move CPU region protection setup into soc/cpu.h
change tabs to spaces
remove unused extern declarations
use RTC_WDTCONFIG0 instead of numeric address (still need to fix BB reg)
2016-09-15 02:03:55 +08:00
Wu Jian Gang 2efaf42253 Merge remote-tracking branch 'origin/feature/mbedtls' 2016-09-14 18:05:56 +08:00
Ivan Grokhotkov 5ab769516d components/esp32: add CPU frequency selection in menuconfig
Note that with WiFi stack enabled, system_init will reset frequency to 240MHz.
To make this setting useful, esp32-wifi-libs submodule needs to be updated.
2016-09-14 17:54:34 +08:00
Wu Jian Gang 6104370ac9 Merge branch 'feature/support_vendor_ie_api' into 'master'
esp32: add vendor ie API

1. add esp_wifi_set_vnd_ie
2. add esp_wifi_set_vnd_ie_cb

See merge request !75
2016-09-14 16:53:53 +08:00
qiyueixa 56586a10ac Format code by using 4 spaces instead 2016-09-14 15:18:06 +08:00
Wangjialin f32823ff6c modify character conversion error and typo 2016-09-14 13:47:28 +08:00
Wangjialin c13ab62e4c modify i2s_reg.h, rebase to master 2016-09-14 13:47:28 +08:00
Wangjialin 41d397cf3f Only modify headers in soc/ .
Pass compiling under esp-idf-tests/merge_soc_tmp/merge_for_soc_headers branch.(only change some names of register and INUM).
2016-09-14 13:47:28 +08:00
qiyueixa f02e5cdec7 Rename vender_ie_type_t and vendor_ie_id_t to wifi_vendor_ie_type_t and wifi_vendor_ie_id_t respectively 2016-09-14 13:39:30 +08:00
qiyueixa d866fe84a4 modify arguments for vendor ie APIs by using enum instead 2016-09-14 13:39:30 +08:00
Wu Jian Gang c1a874fb9e esp32: fix kconfig 2016-09-14 12:55:41 +08:00
liuzhifu d2d231de29 define lwip task priority in esp_task.h 2016-09-14 12:00:46 +08:00
liuzhifu 8ed5010356 components: esp32 - fix build error 2016-09-14 12:00:46 +08:00
liuzhifu 2a15eda8bc components: esp32
Remove priority/stack definition of task that is freertos/lwip/app
2016-09-14 12:00:46 +08:00
liuzhifu 109691f9bc components: esp32
add missing file esp_task.h
2016-09-14 12:00:46 +08:00
Wu Jian Gang ed8e8848e3 fix typos 2016-09-13 20:54:20 +08:00
Wu Jian Gang b56098a612 Merge remote-tracking branch 'origin/master' into feature/mbedtls 2016-09-13 16:31:48 +08:00
Wu Jian Gang bf5e83a6ed callback: add a void* pointer with each callback
also format event.c/wifi.c/esp_event.h/esp_wifi.h
2016-09-13 16:20:29 +08:00
Wu Jian Gang c56a790f64 header: callbacks use "void *" as arguments 2016-09-13 16:19:09 +08:00
Wu Jian Gang c5f8396df4 header: format and fix typos
SYSTEM_EVENT_STA_GOTIP to SYSTEM_EVENT_STA_GOT_IP
2016-09-13 16:17:41 +08:00
liuzhifu ded5df7513 add wifi api comments 2016-09-13 16:17:41 +08:00
liuzhifu b86e060647 add wifi api comments 2016-09-13 16:17:41 +08:00
Ivan Grokhotkov f9013d9ff8 Merge branch 'feature/dualcore_spi_flash_api' into 'master'
Dual core compatible spi flash APIs

Implementation of spi flash APIs which work in dual core mode.

This also includes other changes:
- fixes to FreeRTOS tasks.c made by Jeroen and me — these were originally made to fix issues with high priority tasks seen in WiFi stack, but were required to get stuff in ipc.c working as well
- initial base idea with two high-priority tasks was separated into a separate API — esp_ipc.h. That API allows one to run a function on the other CPU from a high-priority task. Because we don't have preemption across CPUs, this is currently not very fast: it requires on average half a tick until the second CPU switches to the high priority task. Currently that API can be either blocking, or non-blocking with queue length of 1. I haven't yet found a use case for arbitrary sized queue of IPC requests. Anyone who needs that can trivially add that later by replacing a binary semaphore with a generic queue.

With these changes i can run application with WiFi stack and NVS on both cores.

See merge request !25
2016-09-13 13:58:54 +08:00
Ivan Grokhotkov 23d5c7579b components/esp32,spi_flash: update some comments 2016-09-12 20:02:51 +08:00
Ivan Grokhotkov e9f2645b21 components/esp32: add inter-processor call API and implement spi_flash through it
With this change, flash operations can run on both cores.
NVS and WiFi stack can also run in dual core mode now.
2016-09-12 18:54:45 +08:00
Jack bd8febe58c add MACRO to get flash pad number from efuse value 2016-09-12 17:47:50 +08:00
Jack d0442602c7 add comments to register read/write operations 2016-09-12 17:47:50 +08:00
Wu Jian Gang 04b53643ef header files: clean up
1. format;
2. Slow RTC memory reverse 2KB;
2016-09-12 17:47:50 +08:00
jack 24011ddd05 header files: modify rom code and soc header files
1. timer reg file for both time group 0 and time group 1, not only timer group 0
2. fix bug that io mux header file mismatch with chip
3. fix bug that some BASE address not correct
4. add some static function to eagle.fpga32.rom.addr.v7.ld
5. add interrupts usage table
6. add some comments for rom code functions
2016-09-12 17:47:49 +08:00
xiaxiaotian 7c607e4d63 Change the enum of wifi_storage_t to be the same as that in wifi lib. 2016-09-12 11:38:13 +08:00
Wu Jian Gang 95defc7d32 mbedtls: Use hardware accelerated AES, SHA, bignum 2016-09-08 17:41:43 +08:00
Angus Gratton 0a970e3a25 hwcrypto: Match API completely to mbedTLS naming conventions 2016-09-08 16:47:31 +08:00
Angus Gratton 2580c07ae6 esp32 hwcrypto: Make SHA-224 an obvious no-op for now
This is not the long term solution...
2016-09-08 16:47:28 +08:00
Angus Gratton 2bee84062a esp32: Add comment to ROM crypto functions recommending they not be used directly 2016-09-08 16:47:24 +08:00
Angus Gratton 0647d1e922 esp32 hwcrypto: Rework hardware crypto locking
Should protect against concurrent use of hardware crypto primitives,
with good performance.

Not necessary to call esp_aes_acquire_hardware(),
esp_sha_acquire_hardware(), etc when using these APIs. These are
provided for external users calling the hardware crypto hardware
directly, to coexist with this implementation.
2016-09-08 16:47:13 +08:00
Angus Gratton 4167b68eef esp32: Move hardware crypto implementation/headers to hwcrypto directories 2016-09-08 16:46:28 +08:00
Wu Jian Gang fc2bfc1f49 mbedtls: just format related files
method from !46
2016-09-08 16:46:25 +08:00
liuhan 1900c50d3b components/mbedtls: modify hardware encryption feature
rename "flag" and "keybites" in aes file,
rename "xxx_starts" and add license in sha file.
2016-09-08 16:45:51 +08:00
liuhan 2d80fada70 components/mbedtls: MBEDTLS Handshake result check
modify esp_config.h add some feature for support http2.0 protocol, TLS Handshake OK.
2016-09-08 16:45:44 +08:00