Using PDS in the Application

The following are the sequence of steps to use PDS in the application:

  1. 1.Include pds_interface.h in the application
  2. 2.Create an instance of the structure PdsFileMarks_t and update the fields. The maximum size combining all the elements in PdsFileMarks_t is 256 bytes.
  3. 3.Each instance of PdsFileMarks_t represents the data to be stored in one NVM row, which is 256 bytes. So, additional instances of the PdsFileMarks_t structure are created when the size of all the elements exceeds 256 bytes.
  4. 4.Create a File ID for each instance of PdsFileMarks_t and append it in the enum list PdsFileItemIdx_t available in file pds_interface.h.
    Figure 1. PDS File IDs

  5. 5.Create array instances of the structure ItemMap_t, according the number of elements to be stored. Ensure the elements have File ID in the MSB byte of the 16-bit data as shown in Figure 3. Macro DECLARE_ITEM() shown in Figure 2 assigns appropriate value to the ItemMap_t structure and it is declared in the pds_interface.h. The third parameter to the macro function is the element value and it has the File ID in the MSB. The macro function masks the File ID and assigns the element value to the structure element.
    Figure 2. Array of ItemMap Elements

    Figure 3. File ID Appended to Element List

  6. 6.Register each instance of the PdsFileMarks_t with the File ID and the instance name.
    Figure 4. FileMarks Structure Registration

  7. 7.Once registered, the application can use the PDS APIs with File ID and instance name. For more information on the PDS APIs, refer to the API document.