In the serial ISR (`rt_hw_serial_isr`), the previous logic for handling a full RX FIFO was flawed. When the buffer was filled, it would increment `get_index` (`get_index += 1`).
This had two negative consequences:
1. It effectively discarded the oldest byte of data prematurely.
2. It reduced the usable capacity of a buffer of size N to N-1. For example, a 64-byte buffer could only ever hold 63 readable bytes after becoming full.
This patch corrects the behavior by implementing a standard overwriting ring buffer strategy. When the buffer is full, the logic is changed to `get_index = put_index`.
This ensures that:
- When new data arrives, it correctly overwrites the oldest data.
- The `get_index` is advanced along with the `put_index`, correctly marking the new start of the buffer.
- The full N-byte capacity of the buffer is utilized, always storing the N most recent bytes.
This change resolves the unexpected data loss and makes the buffer behavior correct and predictable.
* [bugfix][component/dfs]1.Skip the trailing slash character failed. 2. Scenario that parent path is root is not considered.
* replace strdup() by rt_strdup().
* free memory after strdup().
* fix issue of not appending '\0' at end when parent path is root.
Problen:
Duplicated definition of group_clk in clk.c and clk.h.
Solution:
Delete the definition in clk.c and keep only the definition
in clk.h.
Also change the name of group_clk to group_driver_clock to
conform to the naming convention of other driver groups.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
[Fix] <components>:finsh/shell.c
When using char rt_hw_console_getchar(void),
some compilers may default to returning 255 instead of the expected -1,
causing the condition if(ch < 0) at F: shell.c L:519 to fail and enter an erroneous loop.
Solution: Use the signed char type return value as rt_hw_console_getchar
Signed-off-by: Yucai Liu <1486344514@qq.com>
[Descriptions]:
1. Make these functions public to avoid code duplication and allow direct usage by other components.
2. Fix ifdef's error note.
[Root Cause]:NA
[Side Effects]:NA
This patch only updated the groups defined in documentation/0.doxygen.
Other groups will be moved into documentation/0.doxygen and updated at
that time.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
There is a problem with the matching of case names
in the original code. Due to original code use memcmp
with len, if the input case name and the existing
case name have an inclusion relationship, for example,
if the actual case name is "gpip_irq", and run
`utest_run gpio` will also match successfully, but it's
not expected.
Modify the logic of exact matching and use strcmp instead.
Keep the original wildcard logic, that is,
`utest_run gpio*` can match both "gpio_irq" and "gpio".
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
gcc build warnings:
cast from pointer to integer of different size [-Wpointer-to-int-cast]
For rt_adc_ops.enabled, the type of second param is rt_int8_t,
original _adc_control also called with wrong type casting.
Convert first to rt_base_t, then cast to rt_int8_t to remove the
build warnings.
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
The originally defined "group_Drivers" should actually
be part of the device-driver component, so
"group_Drivers" is renamed to "group_device_driver".
In this way, the original "group_Device" and
"group_Drivers" are merged into "group_device_driver".
Adjusted the writing method of doxygen comments in the
driver code to be unified as follows:
```c
* @defgroup group_XXX XXX
* @brief xxxxxx
* @ingroup group_device_driver
```
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>