Initialization wrapper for bplib. More...
Initialization wrapper for bplib.
Allows initializing and terminating the bplib stack using just two functions bplib_init() and bplib_terminate(). Initialization will init all of bplib's modules and start the generic worker thread.
This module owns the memory pool used for bundle allocation in a static array. Its size can be configured with CONFIG_BPLIB_MEMPOOL_LEN.
All defines in this module can be overwritten by CFLAGS definitions.
Files | |
| file | bplib_init.h |
| Initialization wrapper for bplib. | |
Data Structures | |
| struct | bplib_instance_data_t |
| State of the bplib instance. More... | |
Macros | |
| #define | CONFIG_BPLIB_MEMPOOL_LEN 8192 |
| Size of bplib's memory pool. | |
| #define | CONFIG_BPLIB_GEN_WORKER_TIMEOUT 1000u |
| Time after which the job queue worker (generic worker) times out. | |
| #define | CONFIG_BPLIB_GENERIC_STACK_SIZE THREAD_STACKSIZE_LARGE |
| Stack size of the generic bplib worker thread. | |
Functions | |
| int | bplib_init (void) |
| Initializes bplib, with all of its modules. | |
| void | bplib_terminate (void) |
| Terminates bplib. | |
Variables | |
| bplib_instance_data_t | bplib_instance_data |
| Global, containing the bplib instance and relevant information. | |
| #define CONFIG_BPLIB_GEN_WORKER_TIMEOUT 1000u |
Time after which the job queue worker (generic worker) times out.
If bplib is terminated, this amount of time [in ms] may pass, before this thread is terminated.
Definition at line 67 of file bplib_init.h.
| #define CONFIG_BPLIB_GENERIC_STACK_SIZE THREAD_STACKSIZE_LARGE |
Stack size of the generic bplib worker thread.
This worker thread calls the storage insertion function and this may need a larger stack size.
Definition at line 77 of file bplib_init.h.
| #define CONFIG_BPLIB_MEMPOOL_LEN 8192 |
Size of bplib's memory pool.
The memory pool is used to cache all bundles currently in bplib but not in storage, for example in egress queues.
Each bundle requires at least2 memory blocks (struct BPLib_MEM_Block), one for the bundle blocks and at least one for the payload. Each memory block is 720 B large (on an nRF 52840), since the bundle blocks are not CBOR encoded. The payload is split into 512 B large blocks, and also fitted into memory blocks. A single bundle thus requires at least 1440 B in memory.
Definition at line 57 of file bplib_init.h.
| int bplib_init | ( | void | ) |
Initializes bplib, with all of its modules.
Before calling this init function, if walltime is available, it should be set correctly.
| void bplib_terminate | ( | void | ) |
Terminates bplib.
The BPLib_CLA_ContactStop and BPLib_PI_StopApplication and respective teardown functions should also be called, before this function.
Ensures all of the CLAs terminate as well.