Microchip® Advanced Software Framework

D_XNv.h File Reference

D_XNv Driver Interface.

Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.

#include "N_Types.h"

Macros

#define D_XNV_SECTOR_SIZE   (65536uL)
 

Typedefs

typedef uint16_t D_XNv_Size_t
 

Functions

void D_XNv_EraseSector (uint8_t sector)
 Erases a sector of the external NV. More...
 
bool D_XNv_IsEmpty (uint8_t sector, uint16_t offset, D_XNv_Size_t numberOfBytes)
 Checks if the requested range is empty (containing all 0xFF). More...
 
bool D_XNv_IsEqual (uint8_t sector, uint16_t offset, uint8_t *pBuffer, D_XNv_Size_t numberOfBytes)
 Compare bytes with contents of the external NV. More...
 
void D_XNv_Read (uint8_t sector, uint16_t offset, uint8_t *pBuffer, D_XNv_Size_t numberOfBytes)
 Read bytes from the external NV. More...
 
void D_XNv_Write (uint8_t sector, uint16_t offset, const uint8_t *pBuffer, D_XNv_Size_t numberOfBytes)
 Write bytes to the external NV. More...
 

#define D_XNV_SECTOR_SIZE   (65536uL)

typedef uint16_t D_XNv_Size_t

void D_XNv_EraseSector ( uint8_t  sector)

Erases a sector of the external NV.

Note
The erase operation can take very long, depending on the actual chip that is used. Typical erase times are 600-1500 ms. This function will return immediately, however. The next request to D_XNv will first wait until the erase has finished.
bool D_XNv_IsEmpty ( uint8_t  sector,
uint16_t  offset,
D_XNv_Size_t  numberOfBytes 
)

Checks if the requested range is empty (containing all 0xFF).

Parameters
sectorThe sector to use (0..7)
offsetThe start offset to check
numberOfBytesThe number of bytes to check
Returns
TRUE if the range is empty, FALSE otherwise.
Note
A special case is when numberOfBytes==0, which requests to check 0x10000 bytes
Sector crossing is not permitted
bool D_XNv_IsEqual ( uint8_t  sector,
uint16_t  offset,
uint8_t *  pBuffer,
D_XNv_Size_t  numberOfBytes 
)

Compare bytes with contents of the external NV.

Parameters
sectorThe sector to use (0..7)
offsetThe offset to start comparing with
[in]pBufferThe start address of the buffer that contains the data to compare with
numberOfBytesThe number of bytes to compare
Note
offset+numberOfBytes must be <=0x10000 (meaning sector crossing is not permitted)
void D_XNv_Read ( uint8_t  sector,
uint16_t  offset,
uint8_t *  pBuffer,
D_XNv_Size_t  numberOfBytes 
)

Read bytes from the external NV.

Parameters
sectorThe sector to use (0..7)
offsetThe offset to start reading at
[out]pBufferThe start address of the buffer to store the read data to
numberOfBytesThe number of bytes to read
Note
offset+numberOfBytes must be <=0x10000 (meaning sector crossing is not permitted)
void D_XNv_Write ( uint8_t  sector,
uint16_t  offset,
const uint8_t *  pBuffer,
D_XNv_Size_t  numberOfBytes 
)

Write bytes to the external NV.

Parameters
sectorThe sector to use (0..7)
offsetThe offset to start writing to
[in]pBufferThe start address of the buffer that contains the data to write
numberOfBytesThe number of bytes to write
Note
offset+numberOfBytes must be <=0x10000 (meaning sector crossing is not permitted)