Main Page | Modules | File List | Globals | Related Pages

host.h

Go to the documentation of this file.
00001 #ifndef _HOST_H_
00002 #define _HOST_H_
00003 
00004 /*
00005  * Copyright (C) 2004 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00024  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  */
00035 
00036 /*
00037  * $Log$
00038  */
00039 
00040 /*!
00041  * \file host.h
00042  * \brief Platform header file.
00043  */
00044 
00045 /*!
00046  * \addtogroup xgXEDefs
00047  */
00048 /*@{*/
00049 
00050 #ifdef ETHERNUT2
00051 
00052 /*! \brief The XSVF file is expected in the UROM file system. */
00053 #define XSVFNAME    "UROM:enut202.xsvf"
00054 
00055 #else
00056 
00057 #define XSVFNAME    "cpld/enut202.xsvf"
00058 
00059 #endif
00060 
00061 /*@}*/
00062 
00063 /*!
00064  * \addtogroup xgHost
00065  */
00066 /*@{*/
00067 
00068 
00069 /*! \brief Executor version string. */
00070 #define XSVFEXEC_VERSION    "1.0.1"
00071 
00072 /* Uncomment to enable debug output */
00073 //#define XSVF_DEBUG
00074 
00075 #ifdef ETHERNUT2
00076 
00077 #include <sys/types.h>
00078 
00079 /*! \brief Set TMS high on Ethernut 2. */
00080 #define SET_TMS()   sbi(PORTF, 5)
00081 
00082 /*! \brief Set TMS low on Ethernut 2. */
00083 #define CLR_TMS()   cbi(PORTF, 5)
00084 
00085 /*! \brief Set TDI high on Ethernut 2. */
00086 #define SET_TDI()   sbi(PORTF, 6)
00087 
00088 /*! \brief Set TDI low on Ethernut 2. */
00089 #define CLR_TDI()   cbi(PORTF, 6)
00090 
00091 /*! \brief Set TCK high on Ethernut 2. */
00092 #define SET_TCK()   sbi(PORTF, 4)
00093 
00094 /*! \brief Set TCK low on Ethernut 2. */
00095 #define CLR_TCK()   cbi(PORTF, 4)
00096 
00097 /*! \brief Get TDO status on Ethernut 2. */
00098 #define GET_TDO()   bit_is_set(PINF, 7)
00099 
00100 #else
00101 
00102 /* Generic routines, do nothing. */
00103 #define SET_TMS()
00104 #define CLR_TMS()
00105 #define SET_TDI()
00106 #define CLR_TDI()
00107 #define SET_TCK()
00108 #define CLR_TCK()
00109 
00110 #define GET_TDO()   (0)
00111 
00112 #endif
00113 
00114 /*! \brief Set TMS high and toggle TCK. */
00115 #define SET_TMS_TCK()   { SET_TMS(); CLR_TCK(); SET_TCK(); }
00116 
00117 /*! \brief Set TMS low and toggle TCK. */
00118 #define CLR_TMS_TCK()   { CLR_TMS(); CLR_TCK(); SET_TCK(); }
00119 
00120 extern int XsvfInit(void);
00121 extern void XsvfExit(int rc);
00122 
00123 extern int XsvfGetError(void);
00124 extern u_char XsvfGetCmd(void);
00125 extern u_char XsvfGetState(u_char state0, u_char state1);
00126 extern u_char XsvfGetByte(void);
00127 extern short XsvfGetShort(void);
00128 extern long XsvfGetLong(void);
00129 extern int XsvfReadBitString(void *buf, int num);
00130 extern int XsvfSkipComment(void);
00131 
00132 extern void XsvfDelay(long usecs);
00133 
00134 /*@}*/
00135 
00136 
00137 #endif

© 2004 by egnite Software GmbH - visit http://www.ethernut.de/