Solaris Software
Toggle main menu visibility
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
* ---------------------------------------------------------------- */
11
#include "
spp/core/returnTypes.h
"
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
20
static
const
SPP_HalPort_t
*
s_p_halPort
= {NULL};
/**< Pointer to the HAL ports struct. */
21
22
/* ----------------------------------------------------------------
23
* PUBLIC FUNCTIONS
24
* ---------------------------------------------------------------- */
25
26
SPP_RetVal_t
SPP_HAL_init
(
void
*p_halPorts)
27
{
28
const
SPP_HalPort_t
*p_port = (
SPP_HalPort_t
*)p_halPorts;
29
SPP_RetVal_t
ret =
K_SPP_ERROR
;
30
if
(p_port == NULL)
31
{
32
return
K_SPP_ERROR_NULL_POINTER
;
33
}
34
s_p_halPort
= p_port;
35
36
/* Init the UART port */
37
ret =
SPP_HAL_UART_portInit
();
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
52
const
SPP_HalPort_t
*
SPP_HAL_getPort
(
void
)
53
{
54
return
(
SPP_HalPort_t
*)
s_p_halPort
;
55
}
SPP_HAL_getPort
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_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
s_p_halPort
static const SPP_HalPort_t * s_p_halPort
Definition
hal.c:20
hal.h
This file contains the structs that contain all the pointers to the functions that are used by the SP...
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
@ K_SPP_ERROR
Definition
returnTypes.h:26
K_SPP_ERROR_NULL_POINTER
@ K_SPP_ERROR_NULL_POINTER
Definition
returnTypes.h:30
SPP_HAL_SPI_busInit
SPP_RetVal_t SPP_HAL_SPI_busInit(void)
Initialise the SPI bus.
Definition
spi.c:19
spi.h
SPP SPI HAL API — dispatches through the registered HAL port.
SPP_HalPort_t
Ports struct that contains all the pointers to the Ports functions.
Definition
hal.h:215
SPP_HAL_UART_portInit
SPP_RetVal_t SPP_HAL_UART_portInit(void)
Initialise the UART port.
Definition
uart.c:22
uart.h
SPP UART HAL API — dispatches through the registered HAL port.
solaris-v2
spp
hal
hal.c
Generated by
1.18.0