Kinetis SDK v.1.2 Demo Applications User's Guide  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
freemaster_protocol.c File Reference

FreeMASTER protocol handler. More...

#include "freemaster.h"
#include "freemaster_private.h"
#include "freemaster_protocol.h"

Functions

FMSTR_BOOL FMSTR_Init (void)
 FreeMASTER driver initialization. More...
 
FMSTR_BOOL FMSTR_ProtocolDecoder (FMSTR_BPTR pMessageIO)
 Decodes the FreeMASTER protocol and calls appropriate handlers. More...
 
FMSTR_BPTR FMSTR_GetBoardInfo (FMSTR_BPTR pMessageIO)
 Handling GETINFO or GETINFO_BRIEF. More...
 
FMSTR_BPTR FMSTR_ReadMem (FMSTR_BPTR pMessageIO)
 Handling READMEM and READMEM_EX commands. More...
 
FMSTR_BPTR FMSTR_ReadVar (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nSize)
 Handling READVAR and READVAR_EX commands (for all sizes 1,2,4) More...
 
FMSTR_BPTR FMSTR_WriteMem (FMSTR_BPTR pMessageIO)
 Handling WRITEMEM and WRITEMEM_EX commands. More...
 
FMSTR_BPTR FMSTR_WriteVar (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nSize)
 Handling WRITEVAR command. More...
 
FMSTR_BPTR FMSTR_WriteMemMask (FMSTR_BPTR pMessageIO)
 Handling WRITEMEMMASK and WRITEMEMMASK_EX commands. More...
 
FMSTR_BPTR FMSTR_WriteVarMask (FMSTR_BPTR pMessageIO, FMSTR_SIZE8 nSize)
 Handling WRITEVARMASK command. More...
 
FMSTR_U16 FMSTR_StrLen (FMSTR_ADDR nAddr)
 Private inline implementation of "strlen" used by TSA and Pipes. More...
 

Detailed Description

Version
1.0.1.0
Date
May-4-2012

This file contains the FreeMASTER protocol decoder and also the handlers of basic protocol commands (read/write memory etc).

Function Documentation

FMSTR_BPTR FMSTR_GetBoardInfo ( FMSTR_BPTR  pMessageIO)
Parameters
pMessageIO- original command (in) and response buffer (out)
Returns
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BOOL FMSTR_Init ( void  )
FMSTR_BOOL FMSTR_ProtocolDecoder ( FMSTR_BPTR  pMessageIO)
Parameters
pMessageIO- message in/out buffer
Returns
TRUE if frame was valid and any output was generated to IO buffer

This Function decodes given message and invokes proper command handler which fills in the response. The response transmission is initiated in this call as well.

FMSTR_BPTR FMSTR_ReadMem ( FMSTR_BPTR  pMessageIO)
Parameters
pMessageIO- original command (in) and response buffer (out)
Returns
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_ReadVar ( FMSTR_BPTR  pMessageIO,
FMSTR_SIZE8  nSize 
)
Parameters
pMessageIO- original command (in) and response buffer (out)
Returns
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_U16 FMSTR_StrLen ( FMSTR_ADDR  nAddr)
FMSTR_BPTR FMSTR_WriteMem ( FMSTR_BPTR  pMessageIO)
Parameters
pMessageIO- original command (in) and response buffer (out)
Returns
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteMemMask ( FMSTR_BPTR  pMessageIO)
Parameters
pMessageIO- original command (in) and response buffer (out)
Returns
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteVar ( FMSTR_BPTR  pMessageIO,
FMSTR_SIZE8  nSize 
)
Parameters
pMessageIO- original command (in) and response buffer (out)
nSize- variable size
Returns
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)
FMSTR_BPTR FMSTR_WriteVarMask ( FMSTR_BPTR  pMessageIO,
FMSTR_SIZE8  nSize 
)
Parameters
pMessageIO- original command (in) and response buffer (out)
nSize- variable size
Returns
As all command handlers, the return value should be the buffer pointer where the response output finished (except checksum)