Commit Graph

54 Commits

Author SHA1 Message Date
Darian Leung
7d983fe5a3 esp_ringbuf: Add xRingbufferCreateWithCaps()
This commit adds APIS to create a ring buffer with specific memory caps. The
following APIs have been added:

- xRingbufferGetStaticBuffer()
- xRingbufferCreateWithCaps()
- vRingbufferDeleteWithCaps()
2023-06-26 15:05:29 +08:00
Darian Leung
b104b52b0e ringbuf: Fix ordering of StaticRingbuffer_t
When building on linux/host compilers (e.g., GCC), the compiler may add padding
depending on the size and order of the member types.

This commit fixes the ordering or the StaticRingbuffer_t such that it matches
the internal Ringbuffer_t. The "_Static_assert" is always enabled for all
compilers.

Closes https://github.com/espressif/esp-idf/issues/11726
2023-06-25 15:30:19 +08:00
Zim Kalinowski
3050af45a1 ringbuf: enable qemu tests 2023-06-20 13:57:22 +02:00
Marius Vikhammer
1a5e47bd07 ci: fixed test apps overriding pytest configs 2023-04-26 11:07:35 +08:00
Sudeep Mohanty
dac48f2a40 esp_ringbuf: Added functions to linker.lf file which can be placed in Flash
This commit adds symbols from the ringbuf.c file which can be placed in
Flash in order to free up IRAM space.
2023-04-03 08:57:56 +02:00
Darian Leung
a8b9314353 esp_ringbuf: Clarify behavior when sending items of 0 size
Ring buffers permit sending items of 0 size where:

- No-split/allow-split buffers will send an item (i.e., header) but the item
will have a 0 sized data section
- Byte buffers will simply return pdTRUE

This commit fixes an incorrect assert w.r.t 0 item size in
xRingbufferSendAcquire() and also adds a note to the API descriptions regarding
0 item sizes. A test case has also been added.
2023-02-28 23:56:45 +08:00
Darian Leung
443d87c2ff esp_ringbuf: Replace internal semaphores with task event lists
This commit replaces the existing TX/RX semaphores with FreeRTOS task event
lists (similar to how FreeRTOS queues implement task blocking). Using task
event lists allows the ring buffer object to be smaller and various ring buffer
functions to be faster. The ring buffer queue set impelementation was also
updated as a result.
2023-02-28 23:56:45 +08:00
Marius Vikhammer
25abc7f6d8 ci: update idf-core related tests for C6 2023-02-13 13:01:57 +08:00
Sudeep Mohanty
6feab513e4 esp_ringbuf: migrated esp_ringbuf component tests to pytest framework
This commit migrates the esp_ringbuf tests to the pytest framework.
2022-10-11 11:31:04 +02:00
Darian
c0f5e123c5 Merge branch 'contrib/github_pr_9497' into 'master'
Move xSemaphoreGive out of configASSERT (GitHub PR)

Closes IDFGH-7988

See merge request espressif/esp-idf!19522
2022-08-12 17:43:46 +08:00
tgotic
4837ba9b84 rename xHoldSemaphore to result 2022-08-05 10:19:47 +02:00
tgotic
480253d659 Move xSemaphoreGive out of configASSERT
xSemaphoreGive won't be executed in configASSERT and semaphore will stay locked if NDEBUG (idf v5) or CONFIG_FREERTOS_ASSERT_DISABLE (idf v3, v4) are defined.
2022-08-04 16:41:18 +02:00
Ivan Grokhotkov
401c10ecfb build system: re-add -Wno-format as private flag for some components 2022-08-03 16:42:47 +04:00
morris
45524408df coverity: fix uninit variable issue in driver
Related CID:
389832, 389838, 389880, 286743, 286752, 395156, 291011, 396001, 396002
2022-08-03 10:46:50 +08:00
Marius Vikhammer
fd37129651 esp_ringbuf: placement in flash is no longer controlled by CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH
esp-ringbuf funtion placement is now controlled by its own configs:
CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH and CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH

Closes https://github.com/espressif/esp-idf/issues/9198
2022-07-11 09:24:20 +08:00
Cao Sen Miao
a690a87829 spi_flash: Remove legacy spi_flash drivers 2022-07-01 11:01:34 +08:00
morris
e7295c3577 gptimer: added enable/disable functions 2022-05-06 18:18:39 +08:00
morris
f32a89826c clk_tree: added default clock source for peripheral 2022-04-14 15:44:56 +08:00
Darian Leung
57fd78f5ba freertos: Remove legacy data types
This commit removes the usage of all legacy FreeRTOS data types that
are exposed via configENABLE_BACKWARD_COMPATIBILITY. Legacy types can
still be used by enabling CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY.
2022-02-09 23:05:45 +08:00
morris
705788a13f unit_tests: replace legacy timer group with gptimer 2022-01-07 14:59:09 +08:00
Sudeep Mohanty
722a6b7cf4 docs: update programming guide for esp32s3 chip independent system chapters
This commit updates the chip independent system chapters of the
programming guide for esp32s3.

Signed-off-by: Sudeep Mohanty <sudeep.mohanty@espressif.com>
2021-11-23 12:48:10 +05:30
Darian Leung
9b3796d2f1 freertos: Add portTRY_ENTRY_CRITICAL() and deprecate legacy spinlock fucntions
Add TRY_ENTRY_CRITICAL() API to all for timeouts when entering critical sections.
The following port API were added:
- portTRY_ENTER_CRITICAL()
- portTRY_ENTER_CRITICAL_ISR()
- portTRY_ENTER_CRITICAL_SAFE()

Deprecated legacy spinlock API in favor of spinlock.h. The following API were deprecated:
- vPortCPUInitializeMutex()
- vPortCPUAcquireMutex()
- vPortCPUAcquireMutexTimeout()
- vPortCPUReleaseMutex()

Other Changes:
- Added portMUX_INITIALIZE() to replace vPortCPUInitializeMutex()
- The assembly of the critical section functions ends up being about 50 instructions longer,
  thus the spinlock test pass threshold had to be increased to account for the extra runtime.

Closes https://github.com/espressif/esp-idf/issues/5301
2021-11-22 13:28:39 +08:00
Roland Dobai
766aa57084 Build & config: Remove leftover files from the unsupported "make" build system 2021-11-11 15:32:36 +01:00
Sudeep Mohanty
ac0cbebb89 ringbuf: Fix bug where comparision between a signed and unsigned operand resulted in incorrect free size for no-split/allow-split buffers
This commit fixes a bug in no-split and allow-split ring buffers free buffer size calculation.
When the free size available in the buffers less than the size of one item header,
the function prvGetCurMaxSizeNoSplit/AllowSplit() incorrectly returned the maxItemSize instead of 0.
This is due to the comparision between a negative and a positive value
where both operands are treated as unsigned during the comparision operation,
thereby treating the negative operand as a large integer.

Also added new unit tests to test buffer-full and almost-full conditions
where this scenario is likely to be hit.

Closes https://github.com/espressif/esp-idf/issues/7344
Closes https://github.com/espressif/esp-idf/pull/7371
2021-10-28 14:02:18 +05:30
RichFalk
1222f6dd3a esp_ringbuf: Fix assertion xQueueGenericSend queue.c:818
The release of the semaphore indicating the item was successfully sent must be the last semaphore released.  The receiver may be in another task and may delete the Ringbuffer (such as with a return code across tasks design pattern) if they are through with the Ringbuffer.

The function xRingbufferSendAcquire followed by xRingbufferSendComplete had the semaphores released in the proper order and that same pattern should have been used in xRingbufferSend and xRingbufferSendFromISR.  This commit fixes this order.

Issue (IDFGH-6030) #7716 describes the problem in more detail.

Closes IDFGH-6030, https://github.com/espressif/esp-idf/issues/7716
Closes IDFGH-6036, https://github.com/espressif/esp-idf/pull/7721
2021-10-27 09:54:36 +05:30
morris
e2275b1f63 gptimer: clean up hal and ll for driver-ng 2021-10-20 18:40:08 +08:00
Renz Bagaporo
7c22cccb9c esp32: cleanup build script 2021-07-16 20:14:27 +08:00
Ivan Grokhotkov
b69f94fb3a Merge branch 'feature/move_ringbuf_funcs_into_flash' into 'master'
esp_ringbuf: add kconfig opt to move ringbuffer functions into flash

Closes IDF-2247

See merge request espressif/esp-idf!10731
2021-01-20 07:32:39 +08:00
Alex Lisitsyn
8bde6b8fca esp_ringbuf: add kconfig opt to move ringbuffer functions into flash 2021-01-20 07:32:31 +08:00
Marius Vikhammer
9c8e4fd4c5 C3: build and run unit tests
Enable building and running of unit tests in CI for C3 as well as fix
related compile errors

Also enables building of C3 test apps
2021-01-11 11:34:37 +08:00
Ivan Grokhotkov
7f3b16a99d freertos: always enable static allocation
to use it for newlib locks
2020-12-29 16:18:04 +01:00
Angus Gratton
420aef1ffe Updates for riscv support
* Target components pull in xtensa component directly
* Use CPU HAL where applicable
* Remove unnecessary xtensa headers
* Compilation changes necessary to support non-xtensa gcc types (ie int32_t/uint32_t is no
  longer signed/unsigned int).

Changes come from internal branch commit a6723fc
2020-11-13 07:49:11 +11:00
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Jakob Hasse
20c068ef3b cmock: added cmock as component
* changing dependencies from unity->cmock
* added component.mk and Makefile.projbuild
* ignore test dir in gen_esp_err_to_name.py
* added some brief introduction of CMock in IDF
2020-09-02 16:38:37 +08:00
Wang Fang
ee135b8e28 Add a note to specify that two calls to RingbufferReceive are required in wrap mode 2020-08-10 18:25:51 +08:00
morris
2917651478 esp_rom: extract common ets apis into esp_rom_sys.h 2020-07-27 15:27:01 +08:00
michael
1ca25688a8 freertos: place xQueueGenericCreateStatic into flash
`xQueueGenericCreateStatic` is placed into flash by the linker script to
reduce IRAM usage.  This will also cause the `xRingbufferCreate` not
not callable when cache is disabled.
2020-04-22 16:06:13 +08:00
Renz Bagaporo
3d0967a58a test: declare requirements and include dirs private 2020-03-23 10:58:50 +08:00
chenjianqiang
9f9da9ec96 feat(timer): refator timer group driver
1. add hal and low-level layer for timer group
2. add callback functions to handle interrupt
3. add timer deinit function
4. add timer spinlock take function
2019-11-21 14:14:19 +08:00
Angus Gratton
2e067f5b57 ringbuf: Remove deprecated RingbufferType_t
Deprecated in ESP-IDF V3.1
2019-09-13 09:44:07 +10:00
Michael (XIAO Xufeng)
264ffbeb14 timer_group: use the LL 2019-08-09 13:46:31 +08:00
Anton Maklakov
afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
Michael (XIAO Xufeng)
687908b1e9 ringbuffer: support to allocate memory on the ringbuffer before send 2019-07-01 11:41:50 +08:00
Michael (XIAO Xufeng)
c5150d16b2 ringbuffer: seperate acquire from send 2019-07-01 11:40:45 +08:00
Darian Leung
8a597b865f esp_ringbuf: Add static allocation, refactor, and update API reference
This commit updates does the following:
    - xRingbufferCreateStatic() added to allow ringbuffers via to be statically
      allocated. Docs and unit tests update accordingly. Closes #3064

    - Fix doc typos, closes #3248. Updated API reference regarding to mention
      item size limits of no-split buffers when calling
      xRingbufferGetCurFreeSize() or xRingbufferGetMaxItemSize(), closes #3117.

    - Remove the following deprecated types/functions for v4.0
        - xRingbufferIsNextItemWrapped()
        - xRingbufferAddToQueueSetWrite()
        - xRingbufferRemoveFromQueueSetWrite()
2019-06-26 16:04:38 +08:00
Renz Christian Bagaporo
9eccd7c082 components: use new component registration api 2019-06-21 19:53:29 +08:00
Renz Christian Bagaporo
90ee405afd ldgen: update component linker fragment files 2019-04-04 15:57:34 +08:00
Pieter du Preez
496bfe3842 Initialized some uninitialized variables in rtc_clk.c and ringbuf.c.
The following 2 compiler warnings are only reproducible when setting:
   OPTIMIZATION_FLAGS = -Ofast

esp-idf/components/soc/esp32/rtc_clk.c:
In function 'rtc_clk_cpu_freq_get':
esp-idf/components/soc/esp32/rtc_clk.c:506:12:
error: 'freq' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
	return freq;

esp-idf/components/esp_ringbuf/ringbuf.c:
In function 'xRingbufferReceiveSplitFromISR':
esp-idf/components/esp_ringbuf/ringbuf.c:934:26:
error: 'pvTempTailItem' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
	*ppvTailItem = pvTempTailItem;

Closes https://github.com/espressif/esp-idf/pull/2878
2019-01-23 16:47:23 +05:30
Ivan Grokhotkov
a46b884a14 Merge branch 'feature/unit_test_example' into 'master'
Move Unity into components, add unit test example

See merge request idf/esp-idf!3562
2018-11-19 18:35:54 +08:00
Ivan Grokhotkov
6091021e83 unity: separate common and IDF specific functionality
New unity component can be used for testing other applications.
Upstream version of Unity is included as a submodule.
Utilities specific to ESP-IDF unit tests (partitions, leak checking
setup/teardown functions, etc) are kept only in unit-test-app.
Kconfig options are added to allow disabling certain Unity features.
2018-11-19 12:36:31 +08:00