Solaris Software
Toggle main menu visibility
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
"
7
#include "
spp/core/returnTypes.h
"
8
#include "
spp/core/commonbit.h
"
9
#include "
spp/core/version.h
"
10
#include "
spp/core/packet.h
"
11
#include "
spp/core/types.h
"
12
#include "
spp/services/databank/databank.h
"
13
#include "
spp/core/pubsub/pubsub.h
"
14
#include "
spp/services/log/log.h
"
15
#include "
spp/core/commonbit.h
"
16
17
18
/* ----------------------------------------------------------------
19
* VARIABLES
20
* ---------------------------------------------------------------- */
21
static
spp_uint16_t
s_logSeq
= 0U;
22
static
spp_bool_t
s_logBusy
=
false
;
23
24
25
/* ----------------------------------------------------------------
26
* STATIC FUNCTIONS DECLARATIONS
27
* ---------------------------------------------------------------- */
28
static
void
coreLogOutput
(
const
char
*p_tag,
SPP_LogLevel_t
level,
const
char
*p_message);
29
30
/* ----------------------------------------------------------------
31
* PUBLIC FUNCTIONS
32
* ---------------------------------------------------------------- */
33
34
SPP_RetVal_t
SPP_CORE_init
()
35
{
36
CommonBitErrors_t
*p_commonBit =
SPP_CORE_COMMONBIT_getBit
();
37
if
(p_commonBit == NULL)
38
{
39
return
K_SPP_ERROR_NULL_POINTER
;
40
}
41
42
SPP_RetVal_t
ret =
SPP_SERVICES_LOG_init
();
43
if
(ret !=
K_SPP_OK
)
44
{
45
p_commonBit->logInitError = 1;
46
return
ret;
47
}
48
49
ret =
SPP_SERVICES_DATABANK_init
();
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
57
ret =
SPP_SERVICES_PUBSUB_init
();
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
,
67
K_SPP_VERSION_PATCH
);
68
69
return
K_SPP_OK
;
70
}
SPP_CORE_COMMONBIT_getBit
CommonBitErrors_t * SPP_CORE_COMMONBIT_getBit(void)
Get the pointer to the common bit.
Definition
commonbit.c:24
commonbit.h
s_logBusy
static spp_bool_t s_logBusy
Definition
core.c:22
s_logSeq
static spp_uint16_t s_logSeq
Definition
core.c:21
coreLogOutput
static void coreLogOutput(const char *p_tag, SPP_LogLevel_t level, const char *p_message)
SPP_CORE_init
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
core.h
SPP core initialisation and port registration API.
SPP_SERVICES_DATABANK_init
SPP_RetVal_t SPP_SERVICES_DATABANK_init(void)
Initialise the packet pool.
Definition
databank.c:33
databank.h
Static packet pool manager.
SPP_SERVICES_LOG_init
SPP_RetVal_t SPP_SERVICES_LOG_init(void)
Definition
log.c:20
log.h
SPP logging service.
SPP_LOGI
#define SPP_LOGI(tag, fmt,...)
Definition
log.h:69
SPP_LogLevel_t
SPP_LogLevel_t
Definition
log.h:28
packet.h
Solaris Packet Protocol (SPP) packet structure definitions.
SPP_SERVICES_PUBSUB_init
SPP_RetVal_t SPP_SERVICES_PUBSUB_init(void)
Definition
pubsub.c:182
pubsub.h
Publish-subscribe packet router.
returnTypes.h
Standard return-value type used across all SPP modules.
SPP_RetVal_t
SPP_RetVal_t
Unified return type for all SPP API functions.
Definition
returnTypes.h:24
K_SPP_OK
@ K_SPP_OK
Definition
returnTypes.h:25
K_SPP_ERROR_ALREADY_INITIALIZED
@ K_SPP_ERROR_ALREADY_INITIALIZED
Definition
returnTypes.h:29
K_SPP_ERROR_NULL_POINTER
@ K_SPP_ERROR_NULL_POINTER
Definition
returnTypes.h:30
types.h
Portable integer types and SPI/storage configuration types for SPP.
spp_uint16_t
uint16_t spp_uint16_t
Definition
types.h:29
spp_bool_t
bool spp_bool_t
Definition
types.h:36
CommonBitErrors_t
Definition
commonbit.h:6
version.h
SPP library version constants.
K_SPP_VERSION_PATCH
#define K_SPP_VERSION_PATCH
SPP library patch version number.
Definition
version.h:19
K_SPP_VERSION_MAJOR
#define K_SPP_VERSION_MAJOR
SPP library major version number.
Definition
version.h:13
K_SPP_VERSION_MINOR
#define K_SPP_VERSION_MINOR
SPP library minor version number.
Definition
version.h:16
solaris-v2
spp
core
core.c
Generated by
1.18.0