WE310F5  39.00.000
M2MB RTC MEMORY

This section describes the M2MB APIs to perform various RTC operations. More...

#define M2MB_RTC_INVALID_BUFFER   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 1)))
 
#define M2MB_RTC_INVALID_POOL_ID   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 2)))
 
#define M2MB_RTC_INVALID_CLIENT_ID   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 3)))
 
#define M2MB_RTC_DRIVER_NOT_INITIALIZED   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 4)))
 
#define M2MB_RTC_POOL_NOT_INITIALIZED   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 5)))
 
#define M2MB_RTC_CLIENT_NOT_FOUND   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 6)))
 
#define M2MB_RTC_INVALID_CALL_SEQUENCE   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 7)))
 
#define M2MB_RTC_OUT_OF_MEMORY   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 8)))
 
#define M2MB_RTC_ERROR   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 9)))
 
#define M2MB_RTC_FATAL_ERROR   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 10)))
 
INT32 m2mb_rtc_mem_alloc (UINT16 client_id, UINT16 buffer_size, void **buffer_ptr)
 Allocate Buffer in RTC memory. More...
 
INT32 m2mb_rtc_mem_write (UINT16 client_id)
 Save data in RTC memory. More...
 
INT32 m2mb_rtc_mem_read (UINT16 client_id, UINT16 *buffer_size, void **buffer_ptr)
 Read data from RTC memory. More...
 
INT32 m2mb_rtc_mem_free (UINT16 client_id)
 Free the previously alloctaed buffer in RTC memory. More...
 

Detailed Description

This section describes the M2MB APIs to perform various RTC operations.

Macro Definition Documentation

◆ M2MB_RTC_CLIENT_NOT_FOUND

#define M2MB_RTC_CLIENT_NOT_FOUND   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 6)))

Definition at line 59 of file m2mb_rtc_mem.h.

◆ M2MB_RTC_DRIVER_NOT_INITIALIZED

#define M2MB_RTC_DRIVER_NOT_INITIALIZED   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 4)))

Definition at line 57 of file m2mb_rtc_mem.h.

◆ M2MB_RTC_ERROR

#define M2MB_RTC_ERROR   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 9)))

Definition at line 62 of file m2mb_rtc_mem.h.

◆ M2MB_RTC_FATAL_ERROR

#define M2MB_RTC_FATAL_ERROR   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 10)))

Definition at line 63 of file m2mb_rtc_mem.h.

◆ M2MB_RTC_INVALID_BUFFER

#define M2MB_RTC_INVALID_BUFFER   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 1)))

Definition at line 54 of file m2mb_rtc_mem.h.

◆ M2MB_RTC_INVALID_CALL_SEQUENCE

#define M2MB_RTC_INVALID_CALL_SEQUENCE   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 7)))

Definition at line 60 of file m2mb_rtc_mem.h.

◆ M2MB_RTC_INVALID_CLIENT_ID

#define M2MB_RTC_INVALID_CLIENT_ID   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 3)))

Definition at line 56 of file m2mb_rtc_mem.h.

◆ M2MB_RTC_INVALID_POOL_ID

#define M2MB_RTC_INVALID_POOL_ID   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 2)))

Definition at line 55 of file m2mb_rtc_mem.h.

◆ M2MB_RTC_OUT_OF_MEMORY

#define M2MB_RTC_OUT_OF_MEMORY   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 8)))

Definition at line 61 of file m2mb_rtc_mem.h.

◆ M2MB_RTC_POOL_NOT_INITIALIZED

#define M2MB_RTC_POOL_NOT_INITIALIZED   ((M2MB_STATUS_T)(__M2MB_ERROR(M2MB_MOD_BASE, 5)))

Definition at line 58 of file m2mb_rtc_mem.h.

Function Documentation

◆ m2mb_rtc_mem_alloc()

INT32 m2mb_rtc_mem_alloc ( UINT16  client_id,
UINT16  buffer_size,
void **  buffer_ptr 
)

Allocate Buffer in RTC memory.

This function is called by clients who need to save data before the framework decides to do a Operating Mode [OM] transition. The Pool from which the buffer is requested is assumed to be retained across the pending Mode Transition. The client will get a valid handle to a buffer in the pool, if the allocation succeeds. These resources are releases in the m2mb_rtc_mem_free.

Parameters
[in]client_id
Unique client ID corresponding to the caller.
[in]buffer_size
Size of the buffer requested by the client in Bytes. Max Buffer size requested limited to 2^16 Bytes
[out]buffer_ptr
Valid handle to the buffer if the allocation is successful. If not successful handle will be NULL.
Returns
M2MB_OK
M2MB_RTC_ERR_INVALID_PARAMETER
M2MB_RTC_ERR_INVALID_CALL_SEQUENCE
M2MB_RTC_ERR_OUT_OF_MEMORY
M2MB_RTC_ERR_FATAL
Note

Example

◆ m2mb_rtc_mem_free()

INT32 m2mb_rtc_mem_free ( UINT16  client_id)

Free the previously alloctaed buffer in RTC memory.

De-initialize and frees the resources allocated through m2mb_rtc_mem_alloc API.

Parameters
[in]client_idUnique client ID corresponding to the caller.
Returns
M2MB_OK
M2MB_RTC_ERR_INVALID_PARAMETER
M2MB_RTC_ERR_INVALID_CALL_SEQUENCE
Note
This api is equivalent to closing a file handle. The handle obtained through m2mb_rtc_mem_read is not be used after this api is called. The handle is not guaranteed to point to the client's data and can lead to corruption if used, after m2mb_rtc_mem_free is called.

Example

◆ m2mb_rtc_mem_read()

INT32 m2mb_rtc_mem_read ( UINT16  client_id,
UINT16 buffer_size,
void **  buffer_ptr 
)

Read data from RTC memory.

This function is called by clients to retrieve data saved in a Pool before performing Operating Mode transition. The client will get a valid handle to a buffer in the pool, and size of the buffer, if the allocation was valid. The client can then copy over the data to their local memory.

Parameters
[in]client_id
Unique client ID corresponding to the caller.
[out]buffer_size
Returns the size of the buffer orinally allocated to the client through m2mb_rtc_mem_alloc
[out]buffer_ptr
Valid handle to the buffer if the allocation is successful. If not successful handle will be NULL.
Returns
M2MB_OK
M2MB_RTC_ERR_INVALID_PARAMETER
M2MB_RTC_ERR_INVALID_CALL_SEQUENCE
Note

Example

◆ m2mb_rtc_mem_write()

INT32 m2mb_rtc_mem_write ( UINT16  client_id)

Save data in RTC memory.

This function is called by client after they have copied the data that needs to be saved to the buffer allocated through m2mb_rtc_mem_alloc or through m2mb_rtc_mem_read. After OM transition clients can retrieve data from their buffer and either close the buffer through ( m2mb_rtc_mem_free ) or again commit the data after data manipulation.

Parameters
[in]client_id
Unique client ID corresponding to the caller.
Returns
M2MB_OK
M2MB_RTC_ERR_INVALID_PARAMETER
M2MB_RTC_ERR_INVALID_CALL_SEQUENCE
Note
This api is equivalent to closing a file handle. The handle obtained through m2mb_rtc_mem_alloc/ m2mb_rtc_mem_read is not be used after this api is called. The handle is not guaranteed to point to the client's data and can lead to corruption if used, after m2mb_rtc_mem_write is called. This api can be called again after retrieving data through m2mb_rtc_mem_read. If the client decides to manipulate the data, and commit it back, pay attention to the size allocated in the buffer. Size of the data should not be different from what is returned in m2mb_rtc_mem_read, to avoid corruption

Example