00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _M68HC12_RSI_PARAM_H
00028 #define _M68HC12_RSI_PARAM_H
00029
00030
00031 #define STM100_ARCH
00032
00033 #include "regdefs.h"
00034
00035 #define DIGITALPORTNUM 0
00036 #define IOCNUMPORTS 0
00037 #define PWMNUM 0//not used for this rev of software
00038 #define PWMSYS PWMNUM+IOCNUMPORTS
00039 #define DACPWM0 6
00040 #define DACPWMNUM 0
00041 #define EXDACNUM 0
00042 #define DTOANUM (EXDACNUM+DACPWMNUM)
00043
00044 #undef M6811_DEF_BAUD
00045 #define M6811_DEF_BAUD 0x30
00046
00047 #undef RAM_SIZE
00048 #define RAM_SIZE 0x2000
00049
00050 #undef ROM_SIZE
00051 #define ROM_SIZE 0x40000
00052
00053 #undef DATA_SIZE
00054 #define DATA_SIZE RAM_SIZE
00055
00056 #undef TEXT_SIZE
00057 #define TEXT_SIZE ROM_SIZE
00058
00059 #define ATOD_RESOLUTION 1024
00060 #define ANALOG_VCC 5
00061
00062
00063 #define RS232PORT 0
00064 #define RS422PORT 1
00065 #define RS485PORT 1
00066
00067
00068 #define PORT1BLOCK PTT
00069 #define PORT1BLOCKCFG DDRT
00070
00071 #define CTS_DRVL_PORT PORT1BLOCK
00072 #define RI_DRVL_PORT PORT1BLOCK
00073 #define DSR_DRVL_PORT PORT1BLOCK
00074 #define DCD_DRVL_PORT PORT1BLOCK
00075 #define VALDAT_RCV_LED_PORT PORT1BLOCK
00076 #define OUTBOUND_XMT_LED_PORT PORT1BLOCK
00077
00078 #define CTS_DRVL_MASK 0x01
00079 #define RTS_INL_MASK 0x02
00080 #define RI_DRVL_MASK 0x04
00081 #define DTR_INL_MASK 0x08
00082 #define DSR_DRVL_MASK 0x10
00083 #define DCD_DRVL_MASK 0x20
00084 #define VALDAT_RCV_LED_MASK 0x40
00085 #define OUTBOUND_XMT_LED_MASK 0x80
00086
00087 #define PORT2BLOCK PORTA
00088 #define PORT2BLOCKCFG DDRA
00089
00090 #define STATUS_CONFIG PORT2BLOCKCFG
00091
00092 #define MODE_CODE_PORT PORT2BLOCK
00093 #define ENA_RS232_PORT PORT2BLOCK
00094 #define ENA4XX_TX_PORT PORT2BLOCK
00095 #define ENA_485_RX_PORT PORT2BLOCK
00096 #define ENA422_RX_PORT PORT2BLOCK
00097 #define STATUS_PORT PORT2BLOCK
00098
00099 #define MODE_CODE2_MASK 0x01
00100 #define MODE_CODE1_MASK 0x02
00101 #define STATUS_MASK 0x04
00102 #define ENA422_RX_MASK 0x08
00103 #define ENA_485_RX_MASK 0x10
00104 #define ENA4XX_TX_MASK 0x20
00105 #define ENA_RS232_MASK 0x40
00106 #define RS232_STATUS_MASK 0x80
00107
00108 #define OUTBOUND_XMT_LED_ON() (OUTBOUND_XMT_LED_PORT &=~OUTBOUND_XMT_LED_PORT)
00109 #define OUTBOUND_XMT_LED_OFF() (OUTBOUND_XMT_LED_PORT |=OUTBOUND_XMT_LED_PORT)
00110 #define VALDAT_RCV_LED_ON() (VALDAT_RCV_LED_PORT &=~VALDAT_RCV_LED_MASK)
00111 #define VALDAT_RCV_LED_OFF() (VALDAT_RCV_LED_PORT |=VALDAT_RCV_LED_MASK)
00112
00113 #define CANFLECTOR_MODE (MODE_CODE_PORT&(MODE_CODE1_MASK|MODE_CODE2_MASK))
00114 #define RS232REFLECTION 0
00115 #define RS422REFLECTION 1
00116 #define RS485REFLECTION 2
00117 #define CANREFLECTION 3
00118
00119 static inline void SET_PORT_DIRECTION(void){
00120 PORT1BLOCKCFG = 0xff&(~(RTS_INL_MASK|DTR_INL_MASK));
00121 PORT2BLOCKCFG = 0xff&(~(MODE_CODE2_MASK|MODE_CODE1_MASK|RS232_STATUS_MASK));
00122 }
00123
00124 static inline void DISABLE_HANDSHAKING(void){
00125 PORT1BLOCK = CTS_DRVL_MASK|RI_DRVL_MASK|DSR_DRVL_MASK|DCD_DRVL_MASK;
00126 }
00127
00128 static inline void RS232_SIGNAL_MODE(void) {
00129 SET_PORT_DIRECTION();
00130 DISABLE_HANDSHAKING();
00131 PORT2BLOCK = ENA_485_RX_MASK|ENA422_RX_MASK;
00132 }
00133
00134 static inline void RS422_SIGNAL_MODE(void) {
00135 SET_PORT_DIRECTION();
00136 DISABLE_HANDSHAKING();
00137 PORT2BLOCK = ENA_RS232_MASK|ENA_485_RX_MASK|ENA4XX_TX_MASK;
00138 }
00139
00140 static inline void RS485_SIGNAL_MODE(void) {
00141 SET_PORT_DIRECTION();
00142 DISABLE_HANDSHAKING();
00143 PORT2BLOCK = ENA_RS232_MASK|ENA422_RX_MASK|ENA4XX_TX_MASK;
00144 }
00145
00146 static inline void CAN_SIGNAL_MODE(void) {
00147 SET_PORT_DIRECTION();
00148 DISABLE_HANDSHAKING();
00149 PORT2BLOCK = ENA_RS232_MASK|ENA422_RX_MASK|ENA_485_RX_MASK;
00150 }
00151
00152 static inline unsigned int INPUT_LINE_MAP(void){
00153 unsigned int lines = PORT2BLOCK;
00154 lines<<=8;
00155 lines |= PORT1BLOCK;
00156 return lines;
00157 }
00158
00171 #define RTS_ENABLE(port){PORT2BLOCK|=(ENA_485_RX_MASK|ENA4XX_TX_MASK);} //set RTS line to output
00172 #define RTS_ON(port) {PORT2BLOCK=(PORT2BLOCK|ENA4XX_TX_MASK)&(~ENA_485_RX_MASK);}
00173 #define RTS_OFF(port) {PORT2BLOCK=(PORT2BLOCK|ENA_485_RX_MASK)&(~ENA4XX_TX_MASK);}
00174
00175 #define PORT232 RS232PORT
00176 #define PORT422 RS422PORT
00177
00178 #define NUM_COMPORTS 2
00179
00180 #endif
00181
00182