Solaris Software
Loading...
Searching...
No Matches
hal.c
Go to the documentation of this file.
1/**
2 * @file hal.c
3 * @brief HAL port. All the necessary functions needed to setup the HAL ports and
4 * to get the pointers to the functions that are used by the SPP library.
5 */
6
7
8/* ----------------------------------------------------------------
9 * INCLUDES
10 * ---------------------------------------------------------------- */
12#include "spp/hal/hal.h"
13#include "spp/hal/spi/spi.h"
14#include "spp/hal/uart/uart.h"
15
16/* ----------------------------------------------------------------
17 * VARIABLES
18 * ---------------------------------------------------------------- */
19
20static const SPP_HalPort_t *s_p_halPort = {NULL}; /**< Pointer to the HAL ports struct. */
21
22/* ----------------------------------------------------------------
23 * PUBLIC FUNCTIONS
24 * ---------------------------------------------------------------- */
25
26SPP_RetVal_t SPP_HAL_init(void *p_halPorts)
27{
28 const SPP_HalPort_t *p_port = (SPP_HalPort_t *)p_halPorts;
30 if (p_port == NULL)
31 {
33 }
34 s_p_halPort = p_port;
35
36 /* Init the UART port */
38 if (ret != K_SPP_OK)
39 {
40 return K_SPP_ERROR;
41 }
42
43 /* Init the SPI bus */
44 ret = SPP_HAL_SPI_busInit();
45 if (ret != K_SPP_OK)
46 {
47 return ret;
48 }
49 return K_SPP_OK;
50}
51
53{
54 return (SPP_HalPort_t *)s_p_halPort;
55}
const SPP_HalPort_t * SPP_HAL_getPort(void)
This function is used to get the pointers to the functions that are used by the SPP library....
Definition hal.c:52
SPP_RetVal_t SPP_HAL_init(void *p_halPorts)
This functions initializes the ports struct and initializes all the peripherals.
Definition hal.c:26
static const SPP_HalPort_t * s_p_halPort
Definition hal.c:20
This file contains the structs that contain all the pointers to the functions that are used by the SP...
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
Definition returnTypes.h:26
@ K_SPP_ERROR_NULL_POINTER
Definition returnTypes.h:30
SPP_RetVal_t SPP_HAL_SPI_busInit(void)
Initialise the SPI bus.
Definition spi.c:19
SPP SPI HAL API — dispatches through the registered HAL port.
Ports struct that contains all the pointers to the Ports functions.
Definition hal.h:215
SPP_RetVal_t SPP_HAL_UART_portInit(void)
Initialise the UART port.
Definition uart.c:22
SPP UART HAL API — dispatches through the registered HAL port.