00001 //============================================================================= 00002 // 00003 // h8_sci.h 00004 // 00005 // Simple driver for the H8S Serial Communication Interface (SCI) 00006 // 00007 //============================================================================= 00008 //####ECOSGPLCOPYRIGHTBEGIN#### 00009 // ------------------------------------------- 00010 // This file is part of eCos, the Embedded Configurable Operating System. 00011 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. 00012 // 00013 // eCos is free software; you can redistribute it and/or modify it under 00014 // the terms of the GNU General Public License as published by the Free 00015 // Software Foundation; either version 2 or (at your option) any later version. 00016 // 00017 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY 00018 // WARRANTY; without even the implied warranty of MERCHANTABILITY or 00019 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00020 // for more details. 00021 // 00022 // You should have received a copy of the GNU General Public License along 00023 // with eCos; if not, write to the Free Software Foundation, Inc., 00024 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 00025 // 00026 // As a special exception, if other files instantiate templates or use macros 00027 // or inline functions from this file, or you compile this file and link it 00028 // with other works to produce a work based on this file, this file does not 00029 // by itself cause the resulting work to be covered by the GNU General Public 00030 // License. However the source code for this file must still be made available 00031 // in accordance with section (3) of the GNU General Public License. 00032 // 00033 // This exception does not invalidate any other reasons why a work based on 00034 // this file might be covered by the GNU General Public License. 00035 // 00036 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. 00037 // at http://sources.redhat.com/ecos/ecos-license/ 00038 // ------------------------------------------- 00039 //####ECOSGPLCOPYRIGHTEND#### 00040 //============================================================================= 00041 //#####DESCRIPTIONBEGIN#### 00042 // 00043 // Author(s): jskov 00044 // Contributors:jskov, Uwe Kindler 00045 // Date: 2003-12-06 00046 // 00047 //####DESCRIPTIONEND#### 00048 // 00049 //============================================================================= 00050 00051 00052 //============================================================================= 00053 // DOXYGEN FILE HEADER 00060 //============================================================================= 00061 00062 00063 //============================================================================= 00064 // INCLUDES 00065 //============================================================================= 00066 #include <pkgconf/hal.h> 00067 00068 00069 //============================================================================= 00070 // EXPORTED FUNCTIONS 00071 //============================================================================= 00072 externC void hal_sci_init_channel(void *__ch_data); 00073 externC cyg_uint8 hal_sci_getc(void *__ch_data); 00074 externC void hal_sci_putc(void *__ch_data, cyg_uint8 c); 00075 00076 // 00077 // if we use virtual vector channel for diagnostic ouutput then we have to 00078 // provide some additional functions for virtual vector table entries 00079 // 00080 #if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) 00081 externC void hal_sci_write(void *__ch_data, const cyg_uint8 *__buf, cyg_uint32 __len); 00082 externC void hal_sci_read(void *__ch_data, cyg_uint8 *__buf, cyg_uint32 __len); 00083 externC cyg_bool hal_sci_getc_timeout(void *__ch_data, cyg_uint8 *ch); 00084 externC int hal_sci_control(void *__ch_data, __comm_control_cmd_t __func, ...); 00085 externC int hal_sci_isr(void *__ch_data, int *__ctrlc, CYG_ADDRWORD __vector, CYG_ADDRWORD __data); 00086 #endif 00087 00088 //============================================================================= 00089 // DEFINES 00090 //============================================================================= 00091 00092 //-------------------------------------------------------------------------- 00093 // SCI register offsets 00094 // 00095 #define _REG_SCSMR 0x0 // serial mode register 00096 #define _REG_SCBRR 0x1 // bit rate register 00097 #define _REG_SCSCR 0x2 // serial control register 00098 #define _REG_SCTDR 0x3 // transmit data register 00099 #define _REG_SCSSR 0x4 // serial status register 00100 #define _REG_SCRDR 0x5 // receive data register 00101 00102 00103 //============================================================================= 00104 // TYPE DEFINITIONS 00105 //============================================================================= 00109 typedef struct 00110 { 00111 cyg_uint8 *base; 00112 cyg_uint32 msec_timeout; 00113 cyg_uint32 baud_rate; 00114 cyg_uint8 isr_vector; 00115 } channel_data_t; 00116 00117 00118 //-------------------------------------------------------------------------- 00119 // end of h8_sci.h
1.3.5