Wykres commitów

14 Commity (8efc66495bb9a27c8326de42d857c34c2721d57a)

Autor SHA1 Wiadomość Data
tgotic 047d75eee5 rename xHoldSemaphore to result 2022-08-12 17:54:34 +08:00
tgotic d96121221d 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-12 17:54:29 +08:00
Jiang Jiang Jian f2db4c7520 Merge branch 'bugfix/ringbuf_send_semaphore_release_order_v4.4' into 'release/v4.4'
esp_ringbuf: Fix order of semaphore release in xRingbufferSend (v4.4)

See merge request espressif/esp-idf!16229
2021-12-08 10:26:12 +00:00
Jiang Jiang Jian 67fcfc2e02 Merge branch 'feature/freertos_try_enter_critical_v4.4' into 'release/v4.4'
freertos: Add portTRY_ENTRY_CRITICAL() and deprecate legacy spinlock fucntions (v4.4)

See merge request espressif/esp-idf!16040
2021-12-08 10:10:17 +00:00
RichFalk 92829f66c8 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-12-02 10:25:06 +05:30
Darian Leung c5efb55d43 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 18:42:10 +08:00
Sudeep Mohanty 9e46667545 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-11-10 14:42:40 +05:30
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
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
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
Mahavir Jain 152043d469 esp_ringbuf: move ringbuf to seperate component
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2018-09-17 17:04:57 +05:30