亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? s3c4510_serial.c

?? eCos/RedBoot for勤研ARM AnywhereII(4510) 含全部源代碼
?? C
字號:
//==========================================================================
//
//      io/serial/arm/s3c4510_serial.c
//
//      ARM S3C4510 Serial I/O Interface Module (interrupt driven)
//
//==========================================================================
//####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):    Lars.Lindqvist@combitechsystems.com
// Contributors: jlarmour
// Date:         2001-10-19
// Purpose:      ARM S3C4510 Serial I/O Interface Module (interrupt driven)
// Description:
//
//####DESCRIPTIONEND####
//
// ====================================================================

#include <pkgconf/system.h>
#include <pkgconf/io_serial.h>
#include <pkgconf/io.h>
#include <cyg/io/io.h>
#include <cyg/hal/hal_intr.h>
#include <cyg/io/devtab.h>
#include <cyg/io/serial.h>
#include <cyg/io/serialio.h>
#include <cyg/infra/diag.h>

#if defined(CYGPKG_IO_SERIAL_ARM_S3C4510) && defined(CYGDAT_IO_SERIAL_ARM_S3C4510_INL)

typedef struct s3c4510_serial_info {
    CYG_ADDRWORD   base;
    CYG_WORD       tx_int_num;
    CYG_WORD       rx_int_num;
    cyg_interrupt  serial_tx_interrupt;
    cyg_interrupt  serial_rx_interrupt;
    cyg_handle_t   serial_tx_interrupt_handle;
    cyg_handle_t   serial_rx_interrupt_handle;
    bool           tx_enabled;
} s3c4510_serial_info;

static bool s3c4510_serial_init(struct cyg_devtab_entry *tab);
static bool s3c4510_serial_putc(serial_channel *chan, unsigned char c);
static Cyg_ErrNo s3c4510_serial_lookup(struct cyg_devtab_entry **tab, 
                                   struct cyg_devtab_entry *sub_tab,
                                   const char *name);
static unsigned char s3c4510_serial_getc(serial_channel *chan);
static Cyg_ErrNo s3c4510_serial_set_config(serial_channel *chan, 
                                       cyg_uint32 key,
                                       const void *xbuf, cyg_uint32 *len);
static void s3c4510_serial_start_xmit(serial_channel *chan);
static void s3c4510_serial_stop_xmit(serial_channel *chan);

static cyg_uint32 s3c4510_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data);
static void       s3c4510_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data);
static cyg_uint32 s3c4510_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data);
static void       s3c4510_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data);

static SERIAL_FUNS(s3c4510_serial_funs, 
                   s3c4510_serial_putc, 
                   s3c4510_serial_getc,
                   s3c4510_serial_set_config,
                   s3c4510_serial_start_xmit,
                   s3c4510_serial_stop_xmit
    );

#include CYGDAT_IO_SERIAL_ARM_S3C4510_INL

#include "s3c4510_serial.h"

// Internal function to actually configure the hardware to desired baud rate, etc.
static bool
s3c4510_serial_config_port(serial_channel *chan, cyg_serial_info_t *new_config, bool init)
{
  s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
  volatile struct serial_port *port = (volatile struct serial_port *)s3c4510_chan->base;
  cyg_uint32 word_length = select_word_length[(new_config->word_length)-CYGNUM_SERIAL_WORD_LENGTH_5];
  cyg_uint32 stop_bits = select_stop_bits[(new_config->stop)-CYGNUM_SERIAL_STOP_1];
  cyg_uint32 parity_mode = select_parity[(new_config->parity)-CYGNUM_SERIAL_PARITY_NONE];
  cyg_uint32 baud_divisor = select_baud[(new_config->baud)-CYGNUM_SERIAL_BAUD_50];
  cyg_uint32 res = word_length | stop_bits | parity_mode | ULCON_SCI | ULCON_IROFF;
  if ((word_length|stop_bits|parity_mode|baud_divisor) == U_NOT_SUPP) {
    return false;
  };
  port->REG_ULCON = res;
  port->REG_UCON = UCON_RXMINT | UCON_RXSIOFF | UCON_TXMINT | UCON_DSROFF | UCON_SBKOFF | UCON_LPBOFF;
  port->REG_UBRDIV = baud_divisor;
  if (new_config != &chan->config) {
    chan->config = *new_config;
  };
  return true;
}

// Function to initialize the device.  Called at bootstrap time.
static bool 
s3c4510_serial_init(struct cyg_devtab_entry *tab)
{
    serial_channel *chan = (serial_channel *)tab->priv;
    s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
#ifdef CYGDBG_IO_INIT
    diag_printf("S3C4510 SERIAL init - dev: %x.%d.%d\n", s3c4510_chan->base, s3c4510_chan->tx_int_num, s3c4510_chan->rx_int_num);
#endif
    (chan->callbacks->serial_init)(chan);  // Really only required for interrupt driven devices
    if (chan->out_cbuf.len != 0) {         // If bufferlength > 0 then interrupts are used for tx
        cyg_drv_interrupt_create(s3c4510_chan->tx_int_num,
                                 99,                     // Priority - unused
                                 (cyg_addrword_t)chan,   //  Data item passed to interrupt handler
                                 s3c4510_serial_tx_ISR,
                                 s3c4510_serial_tx_DSR,
                                 &s3c4510_chan->serial_tx_interrupt_handle,
                                 &s3c4510_chan->serial_tx_interrupt);
        cyg_drv_interrupt_attach(s3c4510_chan->serial_tx_interrupt_handle);
        cyg_drv_interrupt_mask(s3c4510_chan->tx_int_num);
        s3c4510_chan->tx_enabled = false;
    }
    if (chan->in_cbuf.len != 0) {         // If bufferlength > 0 then interrupts are used for rx
        cyg_drv_interrupt_create(s3c4510_chan->rx_int_num,
                                 99,                     // Priority - unused
                                 (cyg_addrword_t)chan,   //  Data item passed to interrupt handler
                                 s3c4510_serial_rx_ISR,
                                 s3c4510_serial_rx_DSR,
                                 &s3c4510_chan->serial_rx_interrupt_handle,
                                 &s3c4510_chan->serial_rx_interrupt);
        cyg_drv_interrupt_attach(s3c4510_chan->serial_rx_interrupt_handle);
        cyg_drv_interrupt_unmask(s3c4510_chan->rx_int_num);
    }
    s3c4510_serial_config_port(chan, &chan->config, true);
    return true;
}

// This routine is called when the device is "looked" up (i.e. attached)
static Cyg_ErrNo 
s3c4510_serial_lookup(struct cyg_devtab_entry **tab, 
                  struct cyg_devtab_entry *sub_tab,
                  const char *name)
{
    serial_channel *chan = (serial_channel *)(*tab)->priv;
    (chan->callbacks->serial_init)(chan);  // Really only required for interrupt driven devices
    return ENOERR;
}

// Send a character to the device output buffer.
// Return 'true' if character is sent to device
static bool
s3c4510_serial_putc(serial_channel *chan, unsigned char c)
{
    s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
    volatile struct serial_port *port = (volatile struct serial_port *)s3c4510_chan->base;

    if (port->REG_USTAT & USTAT_TBE) {
      // Transmit buffer is empty
      port->REG_UTXBUF = c;
      return true;
    } else {
      // No space
      return false;
    }
}

// Fetch a character from the device input buffer, waiting if necessary
static unsigned char 
s3c4510_serial_getc(serial_channel *chan)
{
    unsigned char c;
    s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
    volatile struct serial_port *port = (volatile struct serial_port *)s3c4510_chan->base;
    while ((port->REG_USTAT & USTAT_RDR) == 0) ;   // Wait for char
    c = port->REG_URXBUF;
    return c;
}

// Set up the device characteristics; baud rate, etc.
static Cyg_ErrNo
s3c4510_serial_set_config(serial_channel *chan, cyg_uint32 key,
                      const void *xbuf, cyg_uint32 *len)
{
    switch (key) {
    case CYG_IO_SET_CONFIG_SERIAL_INFO:
      {
        cyg_serial_info_t *config = (cyg_serial_info_t *)xbuf;
        if ( *len < sizeof(cyg_serial_info_t) ) {
            return -EINVAL;
        }
        *len = sizeof(cyg_serial_info_t);
        if ( true != s3c4510_serial_config_port(chan, config, false) )
            return -EINVAL;
      }
      break;
    default:
        return -EINVAL;
    }
    return ENOERR;
}

// Enable the transmitter on the device
static void
s3c4510_serial_start_xmit(serial_channel *chan)
{
    s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
    s3c4510_chan->tx_enabled = true;
    (chan->callbacks->xmt_char)(chan);
    if (s3c4510_chan->tx_enabled) {
        cyg_drv_interrupt_unmask(s3c4510_chan->tx_int_num);
    }
}

// Disable the transmitter on the device
static void 
s3c4510_serial_stop_xmit(serial_channel *chan)
{
    s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
    cyg_drv_interrupt_mask(s3c4510_chan->tx_int_num);
    s3c4510_chan->tx_enabled = false;
}

// Serial I/O - low level tx interrupt handler (ISR)
static cyg_uint32 
s3c4510_serial_tx_ISR(cyg_vector_t vector, cyg_addrword_t data)
{
    serial_channel *chan = (serial_channel *)data;
    s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
    cyg_drv_interrupt_mask(s3c4510_chan->tx_int_num);
    cyg_drv_interrupt_acknowledge(s3c4510_chan->tx_int_num);
    return CYG_ISR_CALL_DSR;  // Cause DSR to be run
}

// Serial I/O - high level tx interrupt handler (DSR)
static void       
s3c4510_serial_tx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
{
    serial_channel *chan = (serial_channel *)data;
    s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
    (chan->callbacks->xmt_char)(chan);
    if (s3c4510_chan->tx_enabled) {
        cyg_drv_interrupt_unmask(s3c4510_chan->tx_int_num);
    }
}

// Serial I/O - low level rx interrupt handler (ISR)
static cyg_uint32 
s3c4510_serial_rx_ISR(cyg_vector_t vector, cyg_addrword_t data)
{
    serial_channel *chan = (serial_channel *)data;
    s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
    cyg_drv_interrupt_mask(s3c4510_chan->rx_int_num);
    cyg_drv_interrupt_acknowledge(s3c4510_chan->rx_int_num);
    return CYG_ISR_CALL_DSR;  // Cause DSR to be run
}

// Serial I/O - high level rx interrupt handler (DSR)
static void       
s3c4510_serial_rx_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data)
{
    serial_channel *chan = (serial_channel *)data;
    s3c4510_serial_info *s3c4510_chan = (s3c4510_serial_info *)chan->dev_priv;
    volatile struct serial_port *port = (volatile struct serial_port *)s3c4510_chan->base;
    (chan->callbacks->rcv_char)(chan, port->REG_URXBUF);
    cyg_drv_interrupt_unmask(s3c4510_chan->rx_int_num);
}

#endif // CYGPKG_IO_SERIAL_ARM_S3C4510 && CYGDAT_IO_SERIAL_ARM_S3C4510_INL

// EOF s3c4510_serial.c

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产精品一区二区www在线| 有码一区二区三区| 日本道色综合久久| 韩国成人在线视频| 亚洲成人自拍网| 中文字幕av一区二区三区免费看| 精品视频一区 二区 三区| 粉嫩aⅴ一区二区三区四区| 婷婷久久综合九色综合绿巨人 | 成年人网站91| 老司机一区二区| 亚洲成国产人片在线观看| 国产精品传媒视频| 国产日韩欧美亚洲| 精品国产免费久久| 欧美日韩一区二区电影| av网站免费线看精品| 国产精品自拍网站| 韩国在线一区二区| 美女视频免费一区| 丝袜美腿亚洲色图| 亚洲成人福利片| 亚洲国产综合人成综合网站| 亚洲女同ⅹxx女同tv| 国产欧美日韩精品在线| 日韩欧美中文字幕制服| 91精品国产一区二区三区香蕉| 在线观看成人免费视频| 91丨porny丨中文| a美女胸又www黄视频久久| 成人在线视频一区二区| 国产成人av电影在线| 国产精品18久久久久久久网站| 激情av综合网| 国产一区二区视频在线| 精彩视频一区二区三区| 九一久久久久久| 国内精品伊人久久久久av影院| 久久成人免费网站| 精品亚洲porn| 国产成人综合网站| 成人性色生活片免费看爆迷你毛片| 国产一区二区在线免费观看| 国产福利91精品一区二区三区| 激情六月婷婷久久| 粉嫩av一区二区三区在线播放| 成人免费视频一区| av电影在线观看完整版一区二区| caoporn国产精品| 欧美羞羞免费网站| 欧美顶级少妇做爰| 欧美变态tickling挠脚心| www日韩大片| 欧美国产一区在线| 亚洲视频资源在线| 亚洲成av人片一区二区| 奇米影视一区二区三区小说| 韩国三级在线一区| 成人18视频日本| 欧美日韩美女一区二区| 日韩一本二本av| 久久亚区不卡日本| 国产精品成人一区二区三区夜夜夜| 亚洲色图视频网站| 五月天国产精品| 黑人巨大精品欧美一区| k8久久久一区二区三区| 欧美日韩一区二区三区四区| 日韩欧美一区二区三区在线| 久久综合成人精品亚洲另类欧美 | 五月开心婷婷久久| 国产一二精品视频| 欧美亚洲综合久久| 欧美不卡视频一区| 亚洲婷婷国产精品电影人久久| 亚洲国产色一区| 国内一区二区视频| 色网站国产精品| 日韩欧美你懂的| 日韩理论电影院| 美女视频黄久久| 91香蕉视频mp4| 精品久久一区二区三区| 亚洲青青青在线视频| 男人的j进女人的j一区| 91在线观看高清| 欧美精品一区二| 亚洲综合色噜噜狠狠| 国产一区二区三区四| 欧美在线一二三四区| 国产欧美日韩在线视频| 视频一区二区三区中文字幕| 成人av在线网| 欧美va在线播放| 亚洲午夜久久久| 成人理论电影网| 精品播放一区二区| 亚洲成人午夜影院| 国产成人亚洲综合a∨婷婷| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 26uuu成人网一区二区三区| 午夜精品久久久久久久蜜桃app| 成人黄色在线看| 精品欧美乱码久久久久久| 亚洲综合清纯丝袜自拍| www.亚洲精品| 久久综合一区二区| 三级欧美在线一区| 在线亚洲一区二区| 国产精品美女视频| 激情文学综合网| 在线91免费看| 亚洲综合免费观看高清完整版| 成人高清视频免费观看| 337p日本欧洲亚洲大胆色噜噜| 日韩福利电影在线| 欧美色图第一页| 亚洲欧美成人一区二区三区| 岛国一区二区三区| 久久精品亚洲精品国产欧美| 日本不卡不码高清免费观看| 欧美久久久久久蜜桃| 亚洲综合激情另类小说区| 一本一本久久a久久精品综合麻豆| 欧美激情综合在线| 国产99一区视频免费| 久久久午夜精品| 韩国欧美一区二区| 久久久久99精品一区| 国产精品白丝av| 久久久亚洲综合| 国产乱妇无码大片在线观看| 精品国产乱码久久久久久久 | 日本韩国精品在线| 亚洲同性gay激情无套| 91免费看片在线观看| 亚洲免费观看高清| 欧美性感一区二区三区| 亚洲风情在线资源站| 欧美日韩1234| 秋霞电影一区二区| 欧美刺激脚交jootjob| 日韩电影免费在线观看网站| 337p亚洲精品色噜噜噜| 日av在线不卡| 26uuu精品一区二区| 成人午夜又粗又硬又大| 亚洲免费视频中文字幕| 欧美色偷偷大香| 麻豆精品一区二区av白丝在线| 精品av综合导航| 成人免费视频网站在线观看| 国产精品久久久久久亚洲伦| 91天堂素人约啪| 午夜精品久久久久久久久| 日韩一区二区免费在线电影| 狠狠网亚洲精品| 中文字幕亚洲欧美在线不卡| 91丨九色丨蝌蚪富婆spa| 亚洲线精品一区二区三区八戒| 欧美一区二区三区四区高清| 精一区二区三区| 一区视频在线播放| 欧美日韩一级二级| 精品写真视频在线观看| 国产欧美日韩不卡免费| 在线不卡a资源高清| 久国产精品韩国三级视频| 中文文精品字幕一区二区| 91看片淫黄大片一级在线观看| 天天av天天翘天天综合网| 久久久久久久久岛国免费| 91麻豆产精品久久久久久| 日本女优在线视频一区二区 | 国产精品盗摄一区二区三区| 欧美另类久久久品| 国产成人精品免费在线| 亚洲高清视频在线| 2020国产精品| 欧美日韩在线电影| 国产精品88888| 日韩在线卡一卡二| 国产精品乱子久久久久| 678五月天丁香亚洲综合网| 成人精品视频一区| 男人操女人的视频在线观看欧美| 国产精品福利电影一区二区三区四区| 欧美亚一区二区| 成人aaaa免费全部观看| 蓝色福利精品导航| 一区二区三区四区精品在线视频 | 91精品国产色综合久久| 波多野结衣亚洲| 九九九久久久精品| 亚洲va韩国va欧美va| 国产精品国产三级国产| 精品久久久久久久久久久久包黑料| 一本色道久久综合狠狠躁的推荐| 精品一区二区三区免费观看 | 欧美激情一区二区三区不卡|