IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page


Non-volatile data API

See also:
BIOS_Write_Persistent_Data(), BIOS_Read_Persistent_Data()

The SC2x3 offers a onboard SRAM, which can be battery powered. It can be used to store and restore user non-volatile data. The address of the SRAM can be queried over the SysPublic::sramSize variable. The SysPublic::sramSize variable tells how much data can be stored. To gain access to this area, the user must call the RTX_MemWindow() API.

Example:
#include <stdio.h>
#include <string.h>
#include <clib.h>

void * getSramAddr (void)
{
   printf("\r\nSRAM address: %Xh, size: %Xh",
          (unsigned int)gSysPublicData.sramAddr,
          (unsigned int)gSysPublicData.sramSize);

   if (RTX_MemWindow(gSysPublicData.sramAddr, gSysPublicData.sramSize) == 0)
   {
      return gSysPublicData.sramAddr;
   }
   else
   {
      return NULL;
   }
}

int main (int argc, char *argv[])
{
   unsigned int *psram;

   psram = getSramAddr();
   if (psram == 0)
   {
      printf("\r\nError: getSramAddr() failed");
      return 1;
   }

   if ((argc == 2) && (strcmpi(argv[1], "init") == 0))
   {
      printf("\r\nInit SRAM");
      *psram = 0;
   }
   else
   {
      printf("\r\nSRAM value: %X", *psram);
      *psram = *psram + 1;
   }

   printf("\r\nDone\n");
   return 0;
}





Top of page | Main page

Copyright © 2017 Beck IPC GmbH
Generated on Thu Jan 26 16:21:36 2017 by Doxygen 1.6.1