param.h

00001 /* param.h - 
00002    Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
00003 
00004 This file is free software; you can redistribute it and/or modify it
00005 under the terms of the GNU General Public License as published by the
00006 Free Software Foundation; either version 2, or (at your option) any
00007 later version.
00008 
00009 In addition to the permissions in the GNU General Public License, the
00010 Free Software Foundation gives you unlimited permission to link the
00011 compiled version of this file with other programs, and to distribute
00012 those programs without any restriction coming from the use of this
00013 file.  (The General Public License restrictions do apply in other
00014 respects; for example, they cover modification of the file, and
00015 distribution when not linked into another program.)
00016 
00017 This file is distributed in the hope that it will be useful, but
00018 WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 General Public License for more details.
00021 
00022 You should have received a copy of the GNU General Public License
00023 along with this program; see the file COPYING.  If not, write to
00024 the Free Software Foundation, 59 Temple Place - Suite 330,
00025 Boston, MA 02111-1307, USA.  */
00026 
00027 #ifndef _M68HC12_RSI_PARAM_H
00028 #define _M68HC12_RSI_PARAM_H
00029 
00030 /*EMAC STM-100 board definitions.  */
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            /* 9600 baud.  */
00046 
00047 #undef RAM_SIZE
00048 #define RAM_SIZE       0x2000           /* 8Kb of memory  */
00049 
00050 #undef ROM_SIZE
00051 #define ROM_SIZE       0x40000           /*256Kb of memory  */
00052 
00053 #undef DATA_SIZE
00054 #define DATA_SIZE      RAM_SIZE         /* Data section size.  */
00055 
00056 #undef TEXT_SIZE
00057 #define TEXT_SIZE      ROM_SIZE        /* Text section 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 /* Number of COM Ports */
00178 #define NUM_COMPORTS 2
00179 
00180 #endif
00181 
00182 

Generated on Fri Mar 3 17:25:45 2006 for EMAC-HCS12-SDK by  doxygen 1.4.6