| 1 | /*----------------------------------------------------------------------------- | 
|---|
| 2 | vmod.h -- VMOD specific definitions (message specifiers, values) | 
|---|
| 3 |  | 
|---|
| 4 | Copyright (c) 1994 JANZ Computer AG | 
|---|
| 5 | All Rights Reserved | 
|---|
| 6 |  | 
|---|
| 7 | Created 96/08/01 by Stefan Althoefer | 
|---|
| 8 | Version 1.19 of 00/03/29 | 
|---|
| 9 |  | 
|---|
| 10 | -----------------------------------------------------------------------------*/ | 
|---|
| 11 |  | 
|---|
| 12 | #ifndef vmod_DEFINED | 
|---|
| 13 | #define vmod_DEFINED | 
|---|
| 14 |  | 
|---|
| 15 | #ifdef __cplusplus | 
|---|
| 16 | extern "C" { | 
|---|
| 17 | #endif | 
|---|
| 18 |  | 
|---|
| 19 | /* Specifiers of general messages */ | 
|---|
| 20 | #define M_NOP           0x00  /* nil message, no operation */ | 
|---|
| 21 | #define M_CONNECT       0x01  /* connect to host without interrupts */ | 
|---|
| 22 | #define M_CONNECT_INTR  0x02  /* connect to host with interrupts */ | 
|---|
| 23 | #define M_DISCONNECT    0x03  /* disconnect from host */ | 
|---|
| 24 | #define M_IDVERS        0x04  /* get id and version */ | 
|---|
| 25 | #define M_MSG_LOST      0x05  /* messages lost, host reads too slow */ | 
|---|
| 26 | #define M_DEBUG         0x06  /* formatted debug output */ | 
|---|
| 27 | #define M_SELECT        0x07  /* select functionality */ | 
|---|
| 28 | #define M_NEWHOSTIF     0x08  /* switch to new stylish hostif */ | 
|---|
| 29 | #define M_MEMORY        0x09  /* get info about memory */ | 
|---|
| 30 | #define M_INQUIRY       0x0a  /* get some info about module status */ | 
|---|
| 31 |  | 
|---|
| 32 | #define M_LOCK_LOADER           0x0b    /* lock loader on next reset */ | 
|---|
| 33 | #define M_FW_DOWNLOAD_req       0x0c    /* host starts a firmware download */ | 
|---|
| 34 | #define M_FW_DOWNLOAD_CONT_ind  0x0d    /* target requests for more data */ | 
|---|
| 35 | #define M_FW_DOWNLOAD_CONT_res  0x0e    /* host responds with next data */ | 
|---|
| 36 | #define M_FW_DOWNLOAD_con       0x0f    /* target confirms the service */ | 
|---|
| 37 |  | 
|---|
| 38 | #define M_SET_AFIL              0x10    /* set acceptance filter mask */ | 
|---|
| 39 | #define M_INIT_FDPMQUEUE        0x11    /* initialize fast dpmqueue */ | 
|---|
| 40 | #define M_HW_CONF               0x12    /* configure hardware features */ | 
|---|
| 41 | #define M_SET_PRIO_BND          0x13    /* set priority boundaries */ | 
|---|
| 42 | #define M_HANDLE_HOST_GUARDING  0x14    /* spec dealing with host-guarding */ | 
|---|
| 43 |  | 
|---|
| 44 | #define M_FMSG_LOST             0x15    /* lost messages on fast queue */ | 
|---|
| 45 |  | 
|---|
| 46 | #define M_DEV_DEBUG             0x1f    /* for debugging purposes */ | 
|---|
| 47 |  | 
|---|
| 48 | /* host guarding stuff concerning macros */ | 
|---|
| 49 | #define GUARD_ACTIVE    0x01 | 
|---|
| 50 | #define GUARD_INACTIVE  0x00 | 
|---|
| 51 | #define ALIVE           0xaa | 
|---|
| 52 | #define DEAD            0x55 | 
|---|
| 53 |  | 
|---|
| 54 | /* module/host dependant CANopen configuration */ | 
|---|
| 55 | #define M_CONF_CANOPEN_MUX                              0x16    /* user <-> CANopen relevant config. */ | 
|---|
| 56 | #define M_CONF_CANOPEN_MUX_DPM_ENDIAN                   0x0 /* endianess of host */ | 
|---|
| 57 | /* possible values: */ | 
|---|
| 58 | #define COP_DPM_BIG_ENDIAN                              0x00    /* mapping for Big Endian hosts */ | 
|---|
| 59 | #define COP_DPM_LITTLE_ENDIAN                   0x01    /* mapping for Little Endian hosts */ | 
|---|
| 60 | /* mux for seeing the SYNC or not at host */ | 
|---|
| 61 | #define M_CONF_CANOPEN_MUX_SEND_SYNC_TO_HOST    0x1     /* visibility of SYNC on host */ | 
|---|
| 62 |  | 
|---|
| 63 | #define M_ADD_FDPMQUEUE_PRIO    0x17    /* create one additional prioritized fast fromhost dpmqueue */ | 
|---|
| 64 |  | 
|---|
| 65 | /* BULK_BUFFER-stuff shouldn't it  belong to mican.h (ICANOS) ??? */ | 
|---|
| 66 | #define M_CONFIG_BULK_BUFFER    0x18    /* configbulk buffer for CAN-Layer-2-messages */ | 
|---|
| 67 | #define MS_CONFIG_BULK_BUFFER_TIMEOUT_ONLY      0x0000  /* configure bulk buffers timeout to send */ | 
|---|
| 68 | #define MS_CONFIG_BULK_BUFFER_TIMEOUT_SIZE      0x0001  /* configure bulk buffers timeout and size */ | 
|---|
| 69 |  | 
|---|
| 70 | #define M_CONFIG_SNIFF  0x1a    /* config sniff buffer */ | 
|---|
| 71 | #define MS_CONFIG_SNIFF_BUFFER_TIMEOUT_ONLY     0x0000  /* config sniff buff. timeout to send */ | 
|---|
| 72 | #define MS_CONFIG_SNIFF_BUFFER_TIMEOUT_SIZE     0x0001  /* config sniff buff. timeout and size */ | 
|---|
| 73 | #define MS_CONFIG_SNIFF_BUFFER_ECHO     0x0002  /* config sniff buff. echo from queues */ | 
|---|
| 74 | #define MS_CONFIG_SNIFF_FILTER_STD              0x0003  /* set sniff acc. filt. (Std. CAN frames) */ | 
|---|
| 75 | #define MS_CONFIG_SNIFF_FILTER_XTD              0x0004  /* set sniff acc. filt. (Xtd. CAN frames) */ | 
|---|
| 76 | #define MS_SNIFF_INQUIRY                0x0005  /* inquiry module status (refer to M_INQUIRY) forces sending of INQUIRY message with SNIFF specifier */ | 
|---|
| 77 | #define MS_SNIFF_IDVERS         0x0006  /* inquiry module version (refer to M_IDVERS) forces sending of IDVERS message with SNIFF specifier */ | 
|---|
| 78 | #define MS_SNIFF_BUSLOAD_ALL    0x0007 | 
|---|
| 79 | #define MS_SNIFF_CONFIG_BUSLOAD 0x0008 | 
|---|
| 80 | #define MS_SNIFF_INQUIRY_CONTROLLER             0x0009  /* inquiry CAN controller status (refer to M_INQUIRY) forces sending of INQUIRY_CONTROLLER message with SNIFF specifier */ | 
|---|
| 81 |  | 
|---|
| 82 |  | 
|---|
| 83 |  | 
|---|
| 84 | /* message specifier/subspecifier for measurement of CAN bus load */ | 
|---|
| 85 | #define M_BUSLOAD       0x19    /* configure resp. send/receive bus-load-measurement parameter/values */ | 
|---|
| 86 | #define MS_CONFIG_BUSLOAD       0x0000  /* configure/de-/activate bus-load parameters (host -> module) */ | 
|---|
| 87 | #define MS_REQUEST_BUSLOAD_ALL  0x0001  /* configure/de-/activate bus-load parameters (host -> module) */ | 
|---|
| 88 |  | 
|---|
| 89 |  | 
|---|
| 90 | /* Customer 1 */ | 
|---|
| 91 | #define M_CUST1                 0xc0    /* Customer 1 */ | 
|---|
| 92 |  | 
|---|
| 93 | /* Subspecs for Customer 1 */ | 
|---|
| 94 | #define MS_CUST1_INIT_req       0x0000  /* SysClk Init */ | 
|---|
| 95 | #define MS_CUST1_START_TS_req   0x0001  /* OBSOLET! */ | 
|---|
| 96 |  | 
|---|
| 97 | /* Subspecs/defines for module inquiry M_INQUIRY */ | 
|---|
| 98 | #define MS_INQUIRY_STATUS               0x0000  /* CAN Chip / module status */ | 
|---|
| 99 | #define MS_INQUIRY_TIMING_MASKS_TERM    0x0001  /* CANbus bit rate, accept */ | 
|---|
| 100 | /* masks, termination state */ | 
|---|
| 101 | #define MS_INQUIRY_HOST_IF              0x0002  /* new/old host interface */ | 
|---|
| 102 | /* on module */ | 
|---|
| 103 | #define MS_INQUIRY_AFIL                 0x0003  /* looks for acceptance mask */ | 
|---|
| 104 | #define MS_INQUIRY_EXTD_STATUS          0x0004  /* CAN Chip / module status */ | 
|---|
| 105 | /* superior format. */ | 
|---|
| 106 |  | 
|---|
| 107 | #define MASK_COUNT      50      /* count of ID masks which will be sent */ | 
|---|
| 108 | /* on a MS_INQUIRY_AFIL response (CAVE AT */ | 
|---|
| 109 | /* the buffer size to loose no messages!) */ | 
|---|
| 110 | #define INVALID_ID      9       /* signals out of id-range in INQUIRY_AFIL */ | 
|---|
| 111 |  | 
|---|
| 112 | #define INQUIRY_CTRL_82C200     0x01    /* 82C200 extended infos */ | 
|---|
| 113 | #define INQUIRY_CTRL_SJA1000    0x02    /* SJA100 extended infos */ | 
|---|
| 114 |  | 
|---|
| 115 | /* Definitions for ICAN2/3 dependent termination states */ | 
|---|
| 116 | #define TERM_INFO_AVAILABLE     0x80 | 
|---|
| 117 | #define TERM_INFO_NOT_AVAILABLE 0x00 | 
|---|
| 118 | #define TERM_ON                 0x01 | 
|---|
| 119 | #define TERM_OFF                0x00 | 
|---|
| 120 |  | 
|---|
| 121 | /* Maximum data length of messages */ | 
|---|
| 122 | #define MSGLEN  252 | 
|---|
| 123 |  | 
|---|
| 124 |  | 
|---|
| 125 | /* Definition of some special DPM locations. */ | 
|---|
| 126 | #define TARGET_ALIVE            0xc | 
|---|
| 127 | #define TARGET_STATUS           0xe | 
|---|
| 128 |  | 
|---|
| 129 | /* | 
|---|
| 130 | * Some CANopen definitions for process picture | 
|---|
| 131 | */ | 
|---|
| 132 | /* length of necessary bytes for synchronization between host and VMOD-ICAN3 */ | 
|---|
| 133 | #define NUM_DPM_SYNC_BYTES                      2 | 
|---|
| 134 | #define SYNC_BYTE_ICAN_OWNED            0 | 
|---|
| 135 | #define SYNC_BYTE_HOST_OWNED            1 | 
|---|
| 136 |  | 
|---|
| 137 | #define MAX_DPM_PAGES                           256     /* 0 .. 255 */ | 
|---|
| 138 | #define MAX_DPM_BYTES                           256     /* 0 .. 255 */ | 
|---|
| 139 |  | 
|---|
| 140 | #define DPM_DATA_INVALID                        0 | 
|---|
| 141 | #define DPM_DATA_VALID                          1 | 
|---|
| 142 |  | 
|---|
| 143 | /* location of process picture */ | 
|---|
| 144 | #define PP_START_IN_DPM         0x8000  /* PP starts at 32KByte in DPM */ | 
|---|
| 145 | #define PP_MAX_BYTE_NUM         0x8000  /* PP has a length of 32KByte in DPM */ | 
|---|
| 146 |  | 
|---|
| 147 |  | 
|---|
| 148 |  | 
|---|
| 149 | #ifdef __cplusplus | 
|---|
| 150 | } | 
|---|
| 151 | #endif | 
|---|
| 152 |  | 
|---|
| 153 | #endif /* !vmod_DEFINED */ | 
|---|