Reboot Module for Synapticon SOMANET SoCs

This module provides a Service that can be triggered to force a SoC reset. When triggered the device will reset all internal registers and boot the first available application from flash. This first application can either be a bootloader or a user application which has been flashed as factory image to flash.

This Service must always be run on a COM Tile since it resets every tile connected to the system in reverse order, while the tile to which flash is connected needs to be the last one that is reset.

How to use

  1. Include the module in your app Makefile:

    USED_MODULES = module_reboot
    
  2. Include in your main.xc the board support packages that you might need in your hardware configuration as well as the reboot service header. e.g.

    #include <CORE_C22-rev-a.bsp>
    #include <IFM_DC100-rev-b.bsp>
    #include "reboot.h"
    
  3. Select the right target in your app Makefile. e.g.

    TARGET = SOMANET-C22
    
  4. In the COM Tile intantiate the reboot service and hand it the reboot interface as a parameter.

  5. Pass the interface to any other service in your application from which you want to be able to reboot the application.

  6. Call the interface function to reboot the device

    i_reboot.device_reboot();
    

The following code snippet shows the full usage:

#include <xs1.h>
#include "platform.h"

#include "CORE_C22-rev-a.bsp"

#include "reboot.h"

/* Prototype for task that will trigger the reboot */
void idle_and_reboot(client RebootInterface i_reboot);

int main(void)
{

    /* Definition of Reboot Interface */
    RebootInterface i_reboot;

    par
      {
          on tile [COM_TILE]:
          {
              par
              {
                  /* Start reboot service */
                  reboot_service(i_reboot);
              }
          }

          on tile[IFM_TILE]:
          {
              par
              {
                  /* Start task to reboot the system */
                  idle_and_reboot(i_reboot);
              }
          }
      }


    return 0;
}


void idle_and_reboot(client RebootInterface i_reboot)
{
    /* Do nothing for 2s */
    delay_milliseconds(2000);

    /* Restart the device */
    i_reboot.device_reboot();
}

API

Service

void reboot_service(server interface RebootInterface i_reboot)

Service to accept reboot commands from clients.

Parameters:
  • i_reboot – Interface between reboot service and user task (client)

Interface

interface RebootInterface

Interface to communicate with the reboot service.

void device_reboot(void)

Reboot all tiles of the device.

unsigned get_boot_flag(void)

INTERNAL USE ONLY Returns the value of the bootflag set.

Returns:Value of bootflag
void set_boot_flag(unsigned)

INTERNAL USE ONLY Sets a value for the bootflag.

Parameters:
  • Bootflag – value
void boot_to_bootloader(void)

INTERNAL USE ONLY Boots from the application to the bootloader.

void boot_to_application(void)

INTERNAL USE ONLY Boots from the bootloader to the application.

int has_rebooted_from_application(void)

INTERNAL USE ONLY Checks if the was a cold-boot or if the application requested a reboot to the bootloader.

Returns:Returns 1 if reboot to bootloader was requested by application