123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- extern "C" {
- do \
- { \
- __ALIGN(4) static uint8_t buffer_memory[(n_blocks) * (block_size)]; \
- static NRF_ATFLAGS_DEF(mutex_memory, n_blocks); \
- err_code = pm_buffer_init((p_buffer), \
- buffer_memory, \
- (n_blocks) * (block_size), \
- mutex_memory, \
- (n_blocks), \
- (block_size)); \
- } while (0)
- typedef struct
- {
- uint8_t * p_memory;
- nrf_atflags_t * p_mutex;
- uint32_t n_blocks;
- uint32_t block_size;
- } pm_buffer_t;
- ret_code_t pm_buffer_init(pm_buffer_t * p_buffer,
- uint8_t * p_buffer_memory,
- uint32_t buffer_memory_size,
- nrf_atflags_t * p_mutex_memory,
- uint32_t n_blocks,
- uint32_t block_size);
- uint8_t pm_buffer_block_acquire(pm_buffer_t * p_buffer, uint32_t n_blocks);
- uint8_t * pm_buffer_ptr_get(pm_buffer_t * p_buffer, uint8_t id);
- void pm_buffer_release(pm_buffer_t * p_buffer, uint8_t id);
- }
|