Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Invalid comment in nrf_memobj.h

I found this in nRF5_SDK_17.0.2_d674dde/components/libraries/memobj/nrf_memobj.h :

/**
* A memory object can consist of multiple chunks with the same size. Each object has a header part
* and a data part. The first element in a memory object is memory object head which has a special header.
* The remaining objects have a header of the same size.
*
@verbatim
_____________________ _____________________ _____________________
| | | | | |
|4 B head header | --> |4 B p_next |------->|4 B p_memobj_pool |
|_____________________| | |_____________________| |_____________________|
| | | | | | |
|4 B p_next |--| | | | |
|_____________________| | | .... | |
| | | data | | data |
| | | | | |
| data | | | | |
| | | | | |
|_____________________| |_____________________| |_____________________|
head mid_element last_element
@endverbatim
*
*/

However, I think that there is a mistake, the head block starts with p_next, and then head header, and not the other way round.

This can be inferred from this definition :

/** @brief Head chunk structure. */
typedef struct
{
memobj_header_t header; ///< Standard header.
memobj_head_header_t head_header; ///< Head-specific header part.
uint8_t data[1]; ///< Data.
} memobj_head_t;

where the usual head is in the first place.
  

Parents Reply Children
Related