⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 h8s_sci.h

📁 ecos移植到R8H系列的源码。源码包来自http://www.cetoni.de/develop/develop_ecosh8s_en.html
💻 H
字号:
//=============================================================================
//
//      h8_sci.h
//
//      Simple driver for the H8S Serial Communication Interface (SCI)
//
//=============================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s):   jskov
// Contributors:jskov, Uwe Kindler
// Date:        2003-12-06
//
//####DESCRIPTIONEND####
//
//=============================================================================


//=============================================================================
//                            DOXYGEN FILE HEADER
/// \file    h8s_sci.h
/// \brief   Header for simple H8S SCI driver
/// \author  Uwe Kindler, Yoshinori Sato
/// \date    2003-12-06
///
/// Usage:   include <cyg/hal/h8s_sci.h>
//=============================================================================


//=============================================================================
//                                    INCLUDES
//=============================================================================
#include <pkgconf/hal.h>


//=============================================================================
//                                EXPORTED FUNCTIONS
//=============================================================================
externC void      hal_sci_init_channel(void *__ch_data);
externC cyg_uint8 hal_sci_getc(void *__ch_data);
externC void      hal_sci_putc(void *__ch_data, cyg_uint8 c);

//
// if we use virtual vector channel for diagnostic ouutput then we have to
// provide some additional functions for virtual vector table entries
//
#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG)
externC void      hal_sci_write(void *__ch_data, const cyg_uint8 *__buf, cyg_uint32 __len);
externC void      hal_sci_read(void *__ch_data, cyg_uint8 *__buf, cyg_uint32 __len);
externC cyg_bool  hal_sci_getc_timeout(void *__ch_data, cyg_uint8 *ch);
externC int       hal_sci_control(void *__ch_data, __comm_control_cmd_t __func, ...);
externC int       hal_sci_isr(void *__ch_data, int *__ctrlc, CYG_ADDRWORD __vector, CYG_ADDRWORD __data);
#endif

//=============================================================================
//                                    DEFINES
//=============================================================================

//--------------------------------------------------------------------------
// SCI register offsets
//
#define _REG_SCSMR                0x0 // serial mode register
#define _REG_SCBRR                0x1 // bit rate register
#define _REG_SCSCR                0x2 // serial control register
#define _REG_SCTDR                0x3 // transmit data register
#define _REG_SCSSR                0x4 // serial status register
#define _REG_SCRDR                0x5 // receive data register


//=============================================================================
//                                TYPE DEFINITIONS
//=============================================================================
///
/// Structure for storing configuration data of a single serial channel.
///
typedef struct 
{
    cyg_uint8  *base;           ///< stores SCI base address for register offset calculation
    cyg_uint32  msec_timeout;   ///< stores timeout for time limited read operations
    cyg_uint32  baud_rate;      ///< baud rate for serial channel
    cyg_uint8   isr_vector;     ///< isr vector number for receive interrupt   
} channel_data_t;      


//--------------------------------------------------------------------------
// end of h8_sci.h

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -