Solaris Software
Loading...
Searching...
No Matches
core.c
Go to the documentation of this file.
1/**
2 * @file core.c
3 * @brief SPP core initialisation and port registry implementation.
4 */
5
6#include "spp/core/core.h"
9#include "spp/core/version.h"
10#include "spp/core/packet.h"
11#include "spp/core/types.h"
15#include "spp/core/commonbit.h"
16
17
18/* ----------------------------------------------------------------
19* VARIABLES
20* ---------------------------------------------------------------- */
22static spp_bool_t s_logBusy = false;
23
24
25/* ----------------------------------------------------------------
26* STATIC FUNCTIONS DECLARATIONS
27* ---------------------------------------------------------------- */
28static void coreLogOutput(const char *p_tag, SPP_LogLevel_t level, const char *p_message);
29
30/* ----------------------------------------------------------------
31* PUBLIC FUNCTIONS
32* ---------------------------------------------------------------- */
33
35{
37 if (p_commonBit == NULL)
38 {
40 }
41
43 if (ret != K_SPP_OK)
44 {
45 p_commonBit->logInitError = 1;
46 return ret;
47 }
48
50 if ((ret != K_SPP_OK) && (ret != K_SPP_ERROR_ALREADY_INITIALIZED))
51 {
52 p_commonBit->dataBankInitError = 1;
53 return ret;
54 }
55
56 // Init all the producers and consumer init functions
58 if (ret != K_SPP_OK)
59 {
60 p_commonBit->pubsubInitError = 1;
61 return ret;
62 }
63
64 // SPP_SERVICES_LOG_setOutput(coreLogOutput);
65
66 SPP_LOGI("SPP_CORE", "SPP core initialised (v%u.%u.%u)", K_SPP_VERSION_MAJOR, K_SPP_VERSION_MINOR,
68
69 return K_SPP_OK;
70}
CommonBitErrors_t * SPP_CORE_COMMONBIT_getBit(void)
Get the pointer to the common bit.
Definition commonbit.c:24
static spp_bool_t s_logBusy
Definition core.c:22
static spp_uint16_t s_logSeq
Definition core.c:21
static void coreLogOutput(const char *p_tag, SPP_LogLevel_t level, const char *p_message)
SPP_RetVal_t SPP_CORE_init()
Initialise the core software stack. Must be called before any other SPP function. It starts the datab...
Definition core.c:34
SPP core initialisation and port registration API.
SPP_RetVal_t SPP_SERVICES_DATABANK_init(void)
Initialise the packet pool.
Definition databank.c:33
Static packet pool manager.
SPP_RetVal_t SPP_SERVICES_LOG_init(void)
Definition log.c:20
SPP logging service.
#define SPP_LOGI(tag, fmt,...)
Definition log.h:69
SPP_LogLevel_t
Definition log.h:28
Solaris Packet Protocol (SPP) packet structure definitions.
SPP_RetVal_t SPP_SERVICES_PUBSUB_init(void)
Definition pubsub.c:182
Publish-subscribe packet router.
Standard return-value type used across all SPP modules.
SPP_RetVal_t
Unified return type for all SPP API functions.
Definition returnTypes.h:24
@ K_SPP_OK
Definition returnTypes.h:25
@ K_SPP_ERROR_ALREADY_INITIALIZED
Definition returnTypes.h:29
@ K_SPP_ERROR_NULL_POINTER
Definition returnTypes.h:30
Portable integer types and SPI/storage configuration types for SPP.
uint16_t spp_uint16_t
Definition types.h:29
bool spp_bool_t
Definition types.h:36
SPP library version constants.
#define K_SPP_VERSION_PATCH
SPP library patch version number.
Definition version.h:19
#define K_SPP_VERSION_MAJOR
SPP library major version number.
Definition version.h:13
#define K_SPP_VERSION_MINOR
SPP library minor version number.
Definition version.h:16