Solaris Software
Toggle main menu visibility
Loading...
Searching...
No Matches
storage.c
Go to the documentation of this file.
1
/**
2
* @file storage.c
3
* @brief HAL storage implementation that dispatches operations to the registered port.
4
*/
5
6
/* ----------------------------------------------------------------
7
* INCLUDES
8
* ---------------------------------------------------------------- */
9
#include "
spp/core/returnTypes.h
"
10
#include "
spp/hal/hal.h
"
11
#include "
spp/hal/storage/storage.h
"
12
13
14
/* ----------------------------------------------------------------
15
* PUBLIC FUNCTIONS
16
* ---------------------------------------------------------------- */
17
18
SPP_RetVal_t
SPP_HAL_STORAGE_init
(
void
)
19
{
20
SPP_RetVal_t
ret =
K_SPP_OK
;
21
22
const
SPP_HalPort_t
*p_port =
SPP_HAL_getPort
();
23
if
(p_port == NULL)
24
{
25
ret =
K_SPP_ERROR_NULL_POINTER
;
26
}
27
else
28
{
29
ret = p_port->
storage
.
storageInit
();
30
if
(ret !=
K_SPP_OK
)
31
{
32
ret =
K_SPP_ERROR
;
33
}
34
}
35
return
ret;
36
}
37
38
SPP_RetVal_t
SPP_HAL_STORAGE_write
(
const
void
*p_buffer,
spp_uint32_t
first_block,
spp_uint16_t
count)
39
{
40
SPP_RetVal_t
ret =
K_SPP_OK
;
41
42
const
SPP_HalPort_t
*p_port =
SPP_HAL_getPort
();
43
if
(p_port == NULL || p_buffer == NULL)
44
{
45
ret =
K_SPP_ERROR_NULL_POINTER
;
46
}
47
else
48
{
49
ret = p_port->
storage
.
storageWrite
(p_buffer, first_block, count);
50
if
(ret !=
K_SPP_OK
)
51
{
52
ret =
K_SPP_ERROR
;
53
}
54
}
55
56
return
ret;
57
}
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
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_STORAGE_init
SPP_RetVal_t SPP_HAL_STORAGE_init(void)
Definition
storage.c:18
SPP_HAL_STORAGE_write
SPP_RetVal_t SPP_HAL_STORAGE_write(const void *p_buffer, spp_uint32_t first_block, spp_uint16_t count)
Definition
storage.c:38
storage.h
SPP storage HAL API — dispatches through the registered HAL port.
SPP_HALStorage_t::storageWrite
SPP_RetVal_t(*) storageWrite(const void *p_buffer, spp_uint32_t first_block, spp_uint16_t count)
Write consecutive blocks to the storage device.
Definition
hal.h:171
SPP_HALStorage_t::storageInit
SPP_RetVal_t(*) storageInit(void)
Initialize the storage device.
Definition
hal.h:159
SPP_HalPort_t
Ports struct that contains all the pointers to the Ports functions.
Definition
hal.h:215
SPP_HalPort_t::storage
SPP_HALStorage_t storage
Definition
hal.h:218
spp_uint16_t
uint16_t spp_uint16_t
Definition
types.h:29
spp_uint32_t
uint32_t spp_uint32_t
Definition
types.h:31
solaris-v2
spp
hal
storage
storage.c
Generated by
1.18.0