Kinetis SDK v.1.2 Demo Applications User's Guide
Rev. 0
Freescale Semiconductor, Inc.
Main Page
Related Pages
Demos
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
freemaster_protocol.h
Go to the documentation of this file.
1
/******************************************************************************
2
*
3
* Freescale Semiconductor Inc.
4
* (c) Copyright 2004-2010 Freescale Semiconductor
5
* ALL RIGHTS RESERVED.
6
*
7
****************************************************************************/
19
#ifndef __FREEMASTER_PROTOCOL_H
20
#define __FREEMASTER_PROTOCOL_H
21
22
/*-------------------------------------
23
command message - standard commands
24
-------------------------------------*/
25
26
#define FMSTR_CMD_READMEM 0x01U
27
#define FMSTR_CMD_WRITEMEM 0x02U
28
#define FMSTR_CMD_WRITEMEMMASK 0x03U
29
#define FMSTR_CMD_READMEM_EX 0x04U
/* read a block of memory */
30
#define FMSTR_CMD_WRITEMEM_EX 0x05U
/* write a block of memory */
31
#define FMSTR_CMD_WRITEMEMMASK_EX 0x06U
/* write block of memory with bit mask */
32
#define FMSTR_CMD_SETUPSCOPE 0x08U
33
#define FMSTR_CMD_SETUPREC 0x09U
34
#define FMSTR_CMD_SETUPSCOPE_EX 0x0aU
/* setup the osciloscope */
35
#define FMSTR_CMD_SETUPREC_EX 0x0bU
/* setup the recorder */
36
#define FMSTR_CMD_SENDAPPCMD 0x10U
/* send the application command */
37
#define FMSTR_CMD_GETTSAINFO 0x11U
/* get TSA info */
38
#define FMSTR_CMD_GETTSAINFO_EX 0x12U
/* get TSA info 32bit */
39
#define FMSTR_CMD_SFIOFRAME_1 0x13U
/* deliver & execute SFIO frame (even) */
40
#define FMSTR_CMD_SFIOFRAME_0 0x14U
/* deliver & execute SFIO frame (odd) */
41
#define FMSTR_CMD_PIPE 0x15U
/* read/write pipe data */
42
43
/*-------------------------------------
44
command message - Fast Commands
45
-------------------------------------*/
46
47
/* no data part */
48
#define FMSTR_CMD_GETINFO 0xc0U
/* retrieve board information structure */
49
#define FMSTR_CMD_STARTREC 0xc1U
/* start data recorder */
50
#define FMSTR_CMD_STOPREC 0xc2U
/* stop data recorder */
51
#define FMSTR_CMD_GETRECSTS 0xc3U
/* get the recorder status */
52
#define FMSTR_CMD_GETRECBUFF 0xc4U
53
#define FMSTR_CMD_READSCOPE 0xc5U
/* read the scope data */
54
#define FMSTR_CMD_GETAPPCMDSTS 0xc6U
/* get the application command status */
55
#define FMSTR_CMD_GETINFOBRIEF 0xc8U
/* retrieve a subset of board information structure */
56
#define FMSTR_CMD_GETRECBUFF_EX 0xc9U
/* get the recorder data */
57
#define FMSTR_CMD_SFIOGETRESP_0 0xcaU
/* retry to get last SFIO response (even) */
58
#define FMSTR_CMD_SFIOGETRESP_1 0xcbU
/* retry to get last SFIO response (odd) */
59
60
/* 2 bytes data part */
61
#define FMSTR_CMD_READVAR8 0xD0U
62
#define FMSTR_CMD_READVAR16 0xD1U
63
#define FMSTR_CMD_READVAR32 0xD2U
64
#define FMSTR_CMD_GETAPPCMDDATA 0xD3U
/* get the application command data */
65
#define FMSTR_CMD_GETSTRLEN 0xD4U
/* get string length (required by TSA) */
66
67
/* 4 bytes data part */
68
#define FMSTR_CMD_READVAR8_EX 0xe0U
/* read byte variable */
69
#define FMSTR_CMD_READVAR16_EX 0xe1U
/* read word variable */
70
#define FMSTR_CMD_READVAR32_EX 0xe2U
/* read dword variable */
71
#define FMSTR_CMD_WRITEVAR8 0xe3U
/* write byte variable */
72
#define FMSTR_CMD_WRITEVAR16 0xe4U
/* write word variable */
73
#define FMSTR_CMD_WRITEVAR8MASK 0xe5U
/* write specified bits in byte variable */
74
#define FMSTR_CMD_GETSTRLEN_EX 0xe6U
/* get string length (required by TSA) */
75
76
/* 6 bytes data part */
77
#define FMSTR_CMD_WRITEVAR32 0xf0U
/* write dword variable */
78
#define FMSTR_CMD_WRITEVAR16MASK 0xf1U
/* write specified bits in word variable */
79
80
/*-------------------------------------
81
response message - status byte
82
-------------------------------------*/
83
84
/* flags in response codes */
85
#define FMSTR_STSF_ERROR 0x80U
/* FLAG: error answer (no response data) */
86
#define FMSTR_STSF_VARLEN 0x40U
/* FLAG: variable-length answer (length byte) */
87
#define FMSTR_STSF_EVENT 0x20U
/* FLAG: reserved */
88
89
/* confirmation codes */
90
#define FMSTR_STS_OK 0x00U
/* operation finished successfully */
91
#define FMSTR_STS_RECRUN 0x01U
/* data recorder is running */
92
#define FMSTR_STS_RECDONE 0x02U
/* data recorder is stopped */
93
94
/* error codes */
95
#define FMSTR_STC_INVCMD 0x81U
/* unknown command code */
96
#define FMSTR_STC_CMDCSERR 0x82U
/* command checksum error */
97
#define FMSTR_STC_CMDTOOLONG 0x83U
/* comand is too long */
98
#define FMSTR_STC_RSPBUFFOVF 0x84U
/* the response would not fit into transmit buffer */
99
#define FMSTR_STC_INVBUFF 0x85U
/* invalid buffer length or operation */
100
#define FMSTR_STC_INVSIZE 0x86U
/* invalid size specified */
101
#define FMSTR_STC_SERVBUSY 0x87U
/* service is busy */
102
#define FMSTR_STC_NOTINIT 0x88U
/* service is not initialised */
103
#define FMSTR_STC_EACCESS 0x89U
/* access is denied */
104
#define FMSTR_STC_SFIOERR 0x8AU
/* Error in SFIO frame */
105
#define FMSTR_STC_SFIOUNMATCH 0x8BU
/* Even/odd mismatch in SFIO transaction */
106
#define FMSTR_STC_PIPEERR 0x8CU
/* Pipe error */
107
#define FMSTR_STC_FASTRECERR 0x8DU
/* Feature not implemented in Fast Recorder */
108
#define FMSTR_STC_CANTGLERR 0x8EU
/* CAN fragmentation (toggle bit) error */
109
#define FMSTR_STC_CANMSGERR 0x8FU
/* CAN message format error */
110
111
/******************************************************************************
112
* Protocol constants
113
*******************************************************************************/
114
115
#define FMSTR_SOB 0x2bU
/* '+' - start of message*/
116
#define FMSTR_FASTCMD 0xc0U
/* code of fast cmd 0xc0> */
117
#define FMSTR_FASTCMD_DATALEN_MASK 0x30U
/* mask of data length part of fast command */
118
#define FMSTR_FASTCMD_DATALEN_SHIFT 3
119
#define FMSTR_DESCR_SIZE 25U
/* length board desription string */
120
121
/* Board configuration flags */
122
#define FMSTR_CFGFLAG_BIGENDIAN 0x01U
/*/< used when CPU is big endian */
123
124
/* TSA-global flags */
125
#define FMSTR_TSA_INFO_VERSION_MASK 0x000fU
/*/< TSA version */
126
#define FMSTR_TSA_INFO_32BIT 0x0100U
/*/< TSA address format (16/32 bit) */
127
#define FMSTR_TSA_INFO_HV2BA 0x0200U
/*/< TSA HawkV2 byte-addressing mode */
128
129
/******************************************************************************
130
* CAN Protocol constants
131
*******************************************************************************/
132
133
/* control byte (the first byte in each CAN message) */
134
#define FMSTR_CANCTL_TGL 0x80
/* toggle bit, first message clear, then toggles */
135
#define FMSTR_CANCTL_M2S 0x40
/* master to slave direction */
136
#define FMSTR_CANCTL_FST 0x20
/* first CAN message of FreeMASTER packet */
137
#define FMSTR_CANCTL_LST 0x10
/* last CAN message of FreeMASTER packet */
138
#define FMSTR_CANCTL_SPC 0x08
/* special command (in data[1], handled by CAN sublayer (no FM protocol decode) */
139
#define FMSTR_CANCTL_LEN_MASK 0x07
/* number of data bytes after the CTL byte (0..7) */
140
141
/* special commands */
142
#define FMSTR_CANSPC_PING 0xc0
143
144
145
#endif
/* __FREEMASTER_PROTOCOL_H */
146
147
Mon Apr 27 2015 © 2015 Freescale Semiconductor, Inc. All rights reserved.