Solaris Software
Loading...
Searching...
No Matches
main_perf.c
Go to the documentation of this file.
3
5#include "spp/hal/hal.h"
6#include "spp/hal/time/time.h"
7
8#include "custom.h"
9
10#include <stdio.h>
11
12void 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
43
44 while (CUSTOM_getProcessedSamples() < 10000)
45 {
46 FSM_tick();
47 }
48
50
51 spp_uint32_t totalTimeUs = t1 - t0;
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 barometric pressure sensor driver and service.
const FSM_Transition_t * CUSTOM_getFsmTable(void)
Definition custom.c:66
spp_uint16_t CUSTOM_getProcessedSamples(void)
Definition custom.c:76
spp_uint32_t CUSTOM_getBusyTimeUs(void)
Definition custom.c:71
Finite State Machine (FSM) module for the SPP core.
#define K_CUSTOM_FSM_TABLE_SIZE
Definition custom.h:17
SPP_RetVal_t FSM_init(const FSM_Transition_t *p_transitionTable, const spp_uint8_t tableSize)
Initialize the FSM.
Definition fsm.c:38
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
Finite State Machine (FSM) module for the SPP core.
const SPP_HalPort_t * SPP_PORTS_ESP32S3_getHalPorts(void)
Returns a pointer to the ESP32-S3 HAL port descriptor.
Definition halEsp32.c:105
ESP32-S3 HAL port descriptor for SPP.
SPP_RetVal_t SPP_HAL_init(void *p_halPorts)
This functions initializes the ports struct and initializes all the peripherals.
Definition hal.c:26
This file contains the structs that contain all the pointers to the functions that are used by the SP...
void app_main(void)
Definition main.c:5
SPP_RetVal_t
Unified return type for all SPP API functions.
Definition returnTypes.h:24
@ K_SPP_OK
Definition returnTypes.h:25
A single row in the FSM transition table.
Definition fsm.h:49
Ports struct that contains all the pointers to the Ports functions.
Definition hal.h:215
spp_uint32_t SPP_HAL_TIME_getTimeUs(void)
Return the current hardware time in microseconds.
Definition time.c:27
SPP HAL time API — dispatches through the registered HAL port.
uint32_t spp_uint32_t
Definition types.h:31
float spp_float32_t
Definition types.h:35