Solaris Software
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 * ---------------------------------------------------------------- */
10#include "spp/hal/hal.h"
12
13
14/* ----------------------------------------------------------------
15 * PUBLIC FUNCTIONS
16 * ---------------------------------------------------------------- */
17
19{
21
22 const SPP_HalPort_t *p_port = SPP_HAL_getPort();
23 if (p_port == NULL)
24 {
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
38SPP_RetVal_t SPP_HAL_STORAGE_write(const void *p_buffer, spp_uint32_t first_block, spp_uint16_t count)
39{
41
42 const SPP_HalPort_t *p_port = SPP_HAL_getPort();
43 if (p_port == NULL || p_buffer == NULL)
44 {
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}
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
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_STORAGE_init(void)
Definition storage.c:18
SPP_RetVal_t SPP_HAL_STORAGE_write(const void *p_buffer, spp_uint32_t first_block, spp_uint16_t count)
Definition storage.c:38
SPP storage HAL API — dispatches through the registered HAL port.
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_RetVal_t(*) storageInit(void)
Initialize the storage device.
Definition hal.h:159
Ports struct that contains all the pointers to the Ports functions.
Definition hal.h:215
SPP_HALStorage_t storage
Definition hal.h:218
uint16_t spp_uint16_t
Definition types.h:29
uint32_t spp_uint32_t
Definition types.h:31