Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
The Contiki program loader

The Contiki program loader is an abstract interface for loading and starting programs.

Data Structures

struct  dsc
 The DSC program description structure. More...
 

Files

file  loader.h
 Default definitions and error values for the Contiki program loader.
 

Macros

#define DSC(dscname, description, prgname, process, icon)
 Instantiating macro for the DSC structure. More...
 
#define DSC_HEADER(name)   extern struct dsc name
 
#define LOADER_ERR_ARCH   7
 Wrong architecture. More...
 
#define LOADER_ERR_FMT   4
 Data format error. More...
 
#define LOADER_ERR_HDR   2
 Header error. More...
 
#define LOADER_ERR_MEM   5
 Not enough memory. More...
 
#define LOADER_ERR_NOLOADER   9
 Program loading not supported. More...
 
#define LOADER_ERR_OPEN   6
 Could not open file. More...
 
#define LOADER_ERR_OS   3
 Wrong OS. More...
 
#define LOADER_ERR_READ   1
 Read error. More...
 
#define LOADER_ERR_VERSION   8
 Wrong OS version. More...
 
#define LOADER_LOAD(name, arg)   LOADER_ERR_NOLOADER
 Load and execute a program. More...
 
#define LOADER_LOAD_DSC(name)   NULL
 Load a DSC (program description). More...
 
#define LOADER_OK   0
 No error. More...
 
#define LOADER_UNLOAD()
 Unload a program from memory. More...
 
#define LOADER_UNLOAD_DSC(dsc)
 Unload a DSC (program description). More...
 
#define NULL   0
 

The program description structure

The Contiki DSC structure is used for describing programs.It includes a string describing the program, the name of the program file on disk (or a pointer to the programs initialization function for systems without disk support), a bitmap icon and a text version of the same icon.The DSC is saved into a file which can be loaded by programs such as the "Directory" application which reads all DSC files on disk and presents the icons and descriptions in a window.

#define DSC (   dscname,
  description,
  prgname,
  process,
  icon 
)
Value:
const struct dsc dscname = {description, &process}
Definition: process.h:315
#define PROCESS_NAME(name)
Declare the name of a process.
Definition: process.h:286
The DSC program description structure.
Definition: dsc.h:74
char * description
A text string containing a one-line description of the program
Definition: dsc.h:75

Instantiating macro for the DSC structure.

Parameters
dscnameThe name of the C variable which is to contain the DSC.
descriptionA one-line text describing the program.
prgnameThe name of the program on disk.
initfuncA pointer to the initialization function of the program.
iconA pointer to the CTK icon.
#define DSC_HEADER (   name)    extern struct dsc name
#define LOADER_ERR_ARCH   7

Wrong architecture.

#define LOADER_ERR_FMT   4

Data format error.

#define LOADER_ERR_HDR   2

Header error.

#define LOADER_ERR_MEM   5

Not enough memory.

#define LOADER_ERR_NOLOADER   9

Program loading not supported.

#define LOADER_ERR_OPEN   6

Could not open file.

#define LOADER_ERR_OS   3

Wrong OS.

#define LOADER_ERR_READ   1

Read error.

#define LOADER_ERR_VERSION   8

Wrong OS version.

#define LOADER_LOAD (   name,
  arg 
)    LOADER_ERR_NOLOADER

Load and execute a program.

This macro is used for loading and executing a program, and requires support from the architecture dependent code. The actual program loading is made by architecture specific functions.

Note
A program loaded with LOADER_LOAD() must call the LOADER_UNLOAD() function to unload itself.
Parameters
nameThe name of the program to be loaded.
argA pointer argument that is passed to the program.
Returns
A loader error, or LOADER_OK if loading was successful.
#define LOADER_LOAD_DSC (   name)    NULL

Load a DSC (program description).

Loads a DSC (program description) into memory and returns a pointer to the dsc.

Returns
A pointer to the DSC or NULL if it could not be loaded.
#define LOADER_OK   0

No error.

#define LOADER_UNLOAD ( )

Unload a program from memory.

This macro is used for unloading a program and deallocating any memory that was allocated during the loading of the program. This function must be called by the program itself.

#define LOADER_UNLOAD_DSC (   dsc)

Unload a DSC (program description).

Unload a DSC from memory and deallocate any memory that was allocated when it was loaded.

#define NULL   0