Solaris Software
Toggle main menu visibility
Loading...
Searching...
No Matches
main_perf.c
Go to the documentation of this file.
1
#include "
spp/services/fsm/fsm.h
"
2
#include "
spp/services/bmp390/bmp390.h
"
3
4
#include "
spp/ports/hal/esp32/halEsp32.h
"
5
#include "
spp/hal/hal.h
"
6
#include "
spp/hal/time/time.h
"
7
8
#include "
custom.h
"
9
10
#include <stdio.h>
11
12
void
app_main
(
void
)
13
{
14
// Get HAL port
15
const
SPP_HalPort_t
*p_halPorts =
SPP_PORTS_ESP32S3_getHalPorts
();
16
17
// HAL init
18
SPP_RetVal_t
ret =
SPP_HAL_init
((
void
*)p_halPorts);
19
if
(ret !=
K_SPP_OK
)
20
{
21
while
(1)
22
{
23
// Infinite loop
24
}
25
}
26
27
// Get custom FSM table
28
const
FSM_Transition_t
*p_fsmTable =
CUSTOM_getFsmTable
();
29
30
// FSM init
31
ret =
FSM_init
(p_fsmTable,
K_CUSTOM_FSM_TABLE_SIZE
);
32
if
(ret !=
K_SPP_OK
)
33
{
34
while
(1)
35
{
36
// Infinite loop
37
}
38
}
39
40
FSM_tick
();
41
42
spp_uint32_t
t0 =
SPP_HAL_TIME_getTimeUs
();
43
44
while
(
CUSTOM_getProcessedSamples
() < 10000)
45
{
46
FSM_tick
();
47
}
48
49
spp_uint32_t
t1 =
SPP_HAL_TIME_getTimeUs
();
50
51
spp_uint32_t
totalTimeUs = t1 - t0;
52
spp_uint32_t
busyTimeUs =
CUSTOM_getBusyTimeUs
();
53
spp_float32_t
utilization = ((
spp_float32_t
)busyTimeUs * 100.0f) / (
spp_float32_t
)totalTimeUs;
54
55
printf(
"Total time: %lu us\n"
, (
unsigned
long
)totalTimeUs);
56
57
printf(
"Busy time: %lu us\n"
, (
unsigned
long
)busyTimeUs);
58
59
printf(
"Processed samples: %u\n"
, (
unsigned
int
)
CUSTOM_getProcessedSamples
());
60
61
printf(
"SPP processing utilization: %.2f %%\n"
, (
double
)utilization);
62
}
bmp390.h
BMP390 barometric pressure sensor driver and service.
CUSTOM_getFsmTable
const FSM_Transition_t * CUSTOM_getFsmTable(void)
Definition
custom.c:66
CUSTOM_getProcessedSamples
spp_uint16_t CUSTOM_getProcessedSamples(void)
Definition
custom.c:76
CUSTOM_getBusyTimeUs
spp_uint32_t CUSTOM_getBusyTimeUs(void)
Definition
custom.c:71
custom.h
Finite State Machine (FSM) module for the SPP core.
K_CUSTOM_FSM_TABLE_SIZE
#define K_CUSTOM_FSM_TABLE_SIZE
Definition
custom.h:17
FSM_init
SPP_RetVal_t FSM_init(const FSM_Transition_t *p_transitionTable, const spp_uint8_t tableSize)
Initialize the FSM.
Definition
fsm.c:38
FSM_tick
void FSM_tick(void)
Evaluate the transition table and advance the FSM if a guard passes. Call this once per superloop tic...
Definition
fsm.c:58
fsm.h
Finite State Machine (FSM) module for the SPP core.
SPP_PORTS_ESP32S3_getHalPorts
const SPP_HalPort_t * SPP_PORTS_ESP32S3_getHalPorts(void)
Returns a pointer to the ESP32-S3 HAL port descriptor.
Definition
halEsp32.c:105
halEsp32.h
ESP32-S3 HAL port descriptor for SPP.
SPP_HAL_init
SPP_RetVal_t SPP_HAL_init(void *p_halPorts)
This functions initializes the ports struct and initializes all the peripherals.
Definition
hal.c:26
hal.h
This file contains the structs that contain all the pointers to the functions that are used by the SP...
app_main
void app_main(void)
Definition
main.c:5
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
FSM_Transition_t
A single row in the FSM transition table.
Definition
fsm.h:49
SPP_HalPort_t
Ports struct that contains all the pointers to the Ports functions.
Definition
hal.h:215
SPP_HAL_TIME_getTimeUs
spp_uint32_t SPP_HAL_TIME_getTimeUs(void)
Return the current hardware time in microseconds.
Definition
time.c:27
time.h
SPP HAL time API — dispatches through the registered HAL port.
spp_uint32_t
uint32_t spp_uint32_t
Definition
types.h:31
spp_float32_t
float spp_float32_t
Definition
types.h:35
solaris-v2
main
main_perf.c
Generated by
1.18.0