Contiki 2.5
Macros | Enumerations | Functions
mfg-token.h File Reference

Cortex-M3 Manufacturing token system. More...

#include "hal/micro/cortexm3/token-manufacturing.h"

Go to the source code of this file.

Macros

#define TOKEN_MFG(name, creator, iscnt, isidx, type, arraysize,...)   extern const int16u TOKEN_##name;
 Macro for translating token defs into address variables that point to the correct location in the Info Blocks. More...
 
#define TOKEN_MFG(name, creator, iscnt, isidx, type, arraysize,...)   TOKEN_##name##_SIZE = sizeof(type),
 Macro for translating token defs into address variables that point to the correct location in the Info Blocks. More...
 
#define TOKEN_MFG(name, creator, iscnt, isidx, type, arraysize,...)   typedef type TOKEN_##name##_TYPE;
 Macro for translating token defs into address variables that point to the correct location in the Info Blocks. More...
 
#define TOKEN_NEXT_ADDRESS(region, address)   TOKEN_##region##_NEXT_ADDRESS = ((address) - 1),
 Macro for creating a 'region' element in the enum below. More...
 
#define TOKEN_MFG(name, creator, iscnt, isidx, type, arraysize,...)
 Macro for translating token defs into address variables that point to the correct location in the Info Blocks. More...
 

Enumerations

enum  
 The enum that operates on the two macros above. More...
 

Functions

void halInternalGetMfgTokenData (void *data, int16u token, int8u index, int8u len)
 Copies the token value from non-volatile storage into a RAM location. More...
 
void halInternalSetMfgTokenData (int16u token, void *data, int8u len)
 Sets the value of a token in non-volatile storage. More...
 

Detailed Description

Cortex-M3 Manufacturing token system.

Definition in file mfg-token.h.

Macro Definition Documentation

#define TOKEN_MFG (   name,
  creator,
  iscnt,
  isidx,
  type,
  arraysize,
  ... 
)    extern const int16u TOKEN_##name;

Macro for translating token defs into address variables that point to the correct location in the Info Blocks.

Macro for creating ADDRESS and END elements for each token in the enum below.

Macro for typedef'ing the CamelCase token type found in token-stack.h to a capitalized TOKEN style name that ends in _TYPE.

Macro for translating token definitions into size variables.

(This is the extern, the actual definition is found in hal/micro/cortexm3/token.c)

Parameters
name,:The name of the token.
TOKEN_#name##_ADDRESS,:The address in EEPROM at which the token will be stored. This parameter is generated with a macro above.

This provides a convenience for abstracting the 'sizeof(type)' anywhere.

Parameters
name,:The name of the token.
type,:The token type. The types are found in token-stack.h.

This macro allows other macros below to use 'token##_TYPE' to declare a local copy of that token.

Parameters
name,:The name of the token.
type,:The token type. The types are found in token-stack.h.

The ADDRESS element is linked to from the the normal TOKEN_##name macro and provides the value passed into the internal token system calls. The END element is a placeholder providing the starting point for the ADDRESS of the next dynamically positioned token.

Parameters
name,:The name of the token.
arraysize,:The number of elements in an indexed token (arraysize=1 for scalar tokens).

Definition at line 92 of file mfg-token.h.

#define TOKEN_MFG (   name,
  creator,
  iscnt,
  isidx,
  type,
  arraysize,
  ... 
)    TOKEN_##name##_SIZE = sizeof(type),

Macro for translating token defs into address variables that point to the correct location in the Info Blocks.

Macro for creating ADDRESS and END elements for each token in the enum below.

Macro for typedef'ing the CamelCase token type found in token-stack.h to a capitalized TOKEN style name that ends in _TYPE.

Macro for translating token definitions into size variables.

(This is the extern, the actual definition is found in hal/micro/cortexm3/token.c)

Parameters
name,:The name of the token.
TOKEN_#name##_ADDRESS,:The address in EEPROM at which the token will be stored. This parameter is generated with a macro above.

This provides a convenience for abstracting the 'sizeof(type)' anywhere.

Parameters
name,:The name of the token.
type,:The token type. The types are found in token-stack.h.

This macro allows other macros below to use 'token##_TYPE' to declare a local copy of that token.

Parameters
name,:The name of the token.
type,:The token type. The types are found in token-stack.h.

The ADDRESS element is linked to from the the normal TOKEN_##name macro and provides the value passed into the internal token system calls. The END element is a placeholder providing the starting point for the ADDRESS of the next dynamically positioned token.

Parameters
name,:The name of the token.
arraysize,:The number of elements in an indexed token (arraysize=1 for scalar tokens).

Definition at line 92 of file mfg-token.h.

#define TOKEN_MFG (   name,
  creator,
  iscnt,
  isidx,
  type,
  arraysize,
  ... 
)    typedef type TOKEN_##name##_TYPE;

Macro for translating token defs into address variables that point to the correct location in the Info Blocks.

Macro for creating ADDRESS and END elements for each token in the enum below.

Macro for typedef'ing the CamelCase token type found in token-stack.h to a capitalized TOKEN style name that ends in _TYPE.

Macro for translating token definitions into size variables.

(This is the extern, the actual definition is found in hal/micro/cortexm3/token.c)

Parameters
name,:The name of the token.
TOKEN_#name##_ADDRESS,:The address in EEPROM at which the token will be stored. This parameter is generated with a macro above.

This provides a convenience for abstracting the 'sizeof(type)' anywhere.

Parameters
name,:The name of the token.
type,:The token type. The types are found in token-stack.h.

This macro allows other macros below to use 'token##_TYPE' to declare a local copy of that token.

Parameters
name,:The name of the token.
type,:The token type. The types are found in token-stack.h.

The ADDRESS element is linked to from the the normal TOKEN_##name macro and provides the value passed into the internal token system calls. The END element is a placeholder providing the starting point for the ADDRESS of the next dynamically positioned token.

Parameters
name,:The name of the token.
arraysize,:The number of elements in an indexed token (arraysize=1 for scalar tokens).

Definition at line 92 of file mfg-token.h.

#define TOKEN_MFG (   name,
  creator,
  iscnt,
  isidx,
  type,
  arraysize,
  ... 
)
Value:
TOKEN_##name##_ADDRESS, \
TOKEN_##name##_END = TOKEN_##name##_ADDRESS + \
(TOKEN_##name##_SIZE * arraysize) - 1,

Macro for translating token defs into address variables that point to the correct location in the Info Blocks.

Macro for creating ADDRESS and END elements for each token in the enum below.

Macro for typedef'ing the CamelCase token type found in token-stack.h to a capitalized TOKEN style name that ends in _TYPE.

Macro for translating token definitions into size variables.

(This is the extern, the actual definition is found in hal/micro/cortexm3/token.c)

Parameters
name,:The name of the token.
TOKEN_#name##_ADDRESS,:The address in EEPROM at which the token will be stored. This parameter is generated with a macro above.

This provides a convenience for abstracting the 'sizeof(type)' anywhere.

Parameters
name,:The name of the token.
type,:The token type. The types are found in token-stack.h.

This macro allows other macros below to use 'token##_TYPE' to declare a local copy of that token.

Parameters
name,:The name of the token.
type,:The token type. The types are found in token-stack.h.

The ADDRESS element is linked to from the the normal TOKEN_##name macro and provides the value passed into the internal token system calls. The END element is a placeholder providing the starting point for the ADDRESS of the next dynamically positioned token.

Parameters
name,:The name of the token.
arraysize,:The number of elements in an indexed token (arraysize=1 for scalar tokens).

Definition at line 92 of file mfg-token.h.

#define TOKEN_NEXT_ADDRESS (   region,
  address 
)    TOKEN_##region##_NEXT_ADDRESS = ((address) - 1),

Macro for creating a 'region' element in the enum below.

This creates an element in the enum that provides a starting point (address) for subsequent tokens to align against. ( See hal/micro/cortexm3/token.c for the instances of TOKEN_NEXT_ADDRESS() );

Parameters
region,:The name to give to the element in the address enum..
address,:The address in EEPROM where the region begins.

Definition at line 77 of file mfg-token.h.

Enumeration Type Documentation

anonymous enum

The enum that operates on the two macros above.

Also provides an indentifier so the address of the top of the token system can be known.

Definition at line 101 of file mfg-token.h.

Function Documentation

void halInternalGetMfgTokenData ( void *  data,
int16u  token,
int8u  index,
int8u  len 
)

Copies the token value from non-volatile storage into a RAM location.

This is the internal function that the exposed API (halCommonGetMfgToken) expands out to. The API simplifies the access into this function by hiding the size parameter.

Parameters
data,:A pointer to where the data being read should be placed.
token,:The name of the token to get data from. On this platform that name is defined as an address.
index,:The index to access. If the token being accessed is not an indexed token, this parameter is set by the API to be 0x7F.
len,:The length of the token being worked on. This value is automatically set by the API to be the size of the token.

Definition at line 32 of file mfg-token.c.

void halInternalSetMfgTokenData ( int16u  token,
void *  data,
int8u  len 
)

Sets the value of a token in non-volatile storage.

This is the internal function that the exposed API (halCommonSetMfgToken) expands out to. The API simplifies the access into this function by hiding the size parameter.

NOTE: CIB manufacturing tokens can only be written by on-chip code if the token is currently unprogrammed.

REMEMBER: The flash hardware requires writing to 16bit aligned addresses with a length that is multiples of 16bits.

Parameters
token,:The name of the token to get data from. On this platform that name is defined as an address.
data,:A pointer to the data being written.
len,:The length of the token being worked on. This value is automatically set by the API to be the size of the token.

Definition at line 77 of file mfg-token.c.

References halInternalFlashWrite().