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

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

?? ser_mcf5272_uart.c

?? 開放源碼實時操作系統源碼.
?? C
?? 第 1 頁 / 共 3 頁
字號:
//==========================================================================
//
//      devs/serial/MCF52xx/MCF5282
//
//      MCF5272 UART 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####
//==========================================================================

#include <cyg/io/io.h>
#include <cyg/io/devtab.h>
#include <cyg/io/serial.h>
#include <cyg/infra/diag.h>
#include <cyg/hal/hal_intr.h>
#include <cyg/hal/hal_memmap.h>
#include <cyg/infra/cyg_type.h>
#include <cyg/hal/hal_arch.h>
#include <cyg/hal/drv_api.h>
#include <pkgconf/hal.h>
#include <pkgconf/system.h>
#include <pkgconf/io_serial.h>
#include <pkgconf/io.h>
#include <pkgconf/io_serial_mcf5272_uart.h>
#include <cyg/io/ser_mcf5272_uart.h>


/* The UART priority level */
#define MCF5272_UART_PRIORITY_LEVEL 2


/* Autobaud states */
typedef enum autobaud_states_t
{
    AB_IDLE = 0,  /* Normal state. Autobaud process hasn't been initiated yet. */
    AB_BEGIN_BREAK, /* Detected a start of the break */
    AB_BEGIN,       /* Detected the end of the break and has set up the autobaud.*/

}autobaud_states_t;

#define FIELD_OFFSET(type,field) (cyg_uint32)(&(((type*)0)->field))

typedef struct MCF5272_uart_info_t
{

    volatile mcf5272_sim_uart_t*    base;                       // Base address of the UART registers
    uint32                          uart_vector;                // UART interrupt vector number

    cyg_interrupt                   serial_interrupt;           // Interrupt context
    cyg_handle_t                    serial_interrupt_handle;    // Interrupt handle

    volatile uint8                  imr_mirror;                 // Interrupt mask register mirror

    cyg_serial_info_t               config;                     // The channel configuration

    autobaud_states_t               autobaud_state;             // The autobaud state


} MCF5272_uart_info_t;

/* Function prtoftyps for the MCF5272 UART ISR and DSR. */
static cyg_uint32 MCF5272_uart_ISR(cyg_vector_t vector, cyg_addrword_t data);
static void       MCF5272_uart_DSR(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t data);


/* Function prototypes for the serial functions. */
static bool MCF5272_uart_init(struct cyg_devtab_entry * tab);
static Cyg_ErrNo MCF5272_uart_lookup(struct cyg_devtab_entry **tab,
                  struct cyg_devtab_entry *sub_tab,
                  const char *name);
static bool MCF5272_uart_putc(serial_channel *chan, unsigned char c);
static unsigned char MCF5272_uart_getc(serial_channel *chan);
Cyg_ErrNo MCF5272_uart_set_config(serial_channel *chan, cyg_uint32 key,
                            const void *xbuf, cyg_uint32 *len);
static void MCF5272_uart_start_xmit(serial_channel *chan);
static void MCF5272_uart_stop_xmit(serial_channel * chan);


/* Declare the serial functions that are called by the common serial driver layer. */
static SERIAL_FUNS
(
    MCF5272_uart_funs,
    MCF5272_uart_putc,
    MCF5272_uart_getc,
    MCF5272_uart_set_config,
    MCF5272_uart_start_xmit,
    MCF5272_uart_stop_xmit
);


/* Definition for channel 0 UART configuration. */
/************************************************/
#ifdef CYGPKG_IO_SERIAL_MCF5272_UART_CHANNEL0

/* Data structure contains
   channel informtion.
 */
static MCF5272_uart_info_t MCF5272_uart_channel_info_0;

/* If the channel buffer size is zero, do not include interrupt UART processing */
#if CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL0_BUFSIZE > 0

/*      Allocated receive and transmit buffer.   The size of the buffer  is */
/* configured by the configtool.                                            */

static unsigned char MCF5272_uart_out_buf0[CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL0_BUFSIZE];
static unsigned char MCF5272_uart_in_buf0[CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL0_BUFSIZE];

/*      Channel function table.   We register  the UART  functions here  so */
/* that uppper serial drivers can call the serial driver's routines.        */

static SERIAL_CHANNEL_USING_INTERRUPTS(
    MCF5272_uart_channel_0,
    MCF5272_uart_funs,
    MCF5272_uart_channel_info_0,
    CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL0_BAUD),
    CYG_SERIAL_STOP_DEFAULT,
    CYG_SERIAL_PARITY_DEFAULT,
    CYG_SERIAL_WORD_LENGTH_DEFAULT,
    CYG_SERIAL_FLAGS_DEFAULT,
    MCF5272_uart_out_buf0, sizeof(MCF5272_uart_out_buf0),
    MCF5272_uart_in_buf0, sizeof(MCF5272_uart_in_buf0)
);
#else
/* Don't use interrupt processing for the UART. */
static SERIAL_CHANNEL(
    MCF5272_uart_channel_0,
    MCF5272_uart_funs,
    MCF5272_uart_channel_info_0,
    CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL0_BAUD),
    CYG_SERIAL_STOP_DEFAULT,
    CYG_SERIAL_PARITY_DEFAULT,
    CYG_SERIAL_WORD_LENGTH_DEFAULT,
    CYG_SERIAL_FLAGS_DEFAULT
);
#endif

DEVTAB_ENTRY(
    MCF5272_uart_io0,
    CYGDAT_IO_SERIAL_MCF5272_UART_CHANNEL0_NAME,
    0,                       // Does not depend on a lower level interface
    &cyg_io_serial_devio,    // The table of I/O functions.
    MCF5272_uart_init,       // UART initialization function.
    MCF5272_uart_lookup,     // The UART lookup function. This function typically sets
                             // up the device for actual use, turing on interrupts, configuring the port, etc.
    &MCF5272_uart_channel_0
);
#endif //  CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL0

/* Definition for channel 1 UART configuration. */
/************************************************/

#ifdef CYGPKG_IO_SERIAL_MCF5272_UART_CHANNEL1


/* Data structure contains
   channel informtion.
 */
static MCF5272_uart_info_t MCF5272_uart_channel_info_1;

/* If the channel buffer size is zero, do not include interrupt UART processing */
#if CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL1_BUFSIZE > 0

/*      Allocated receive and transmit buffer.   The size of the buffer  is */
/* configured by the configtool.                                            */

static unsigned char MCF5272_uart_out_buf1[CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL1_BUFSIZE];
static unsigned char MCF5272_uart_in_buf1[CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL1_BUFSIZE];

/*      Channel function table.   We register  the UART  functions here  so */
/* that uppper serial drivers can call the serial driver's routines.        */

static SERIAL_CHANNEL_USING_INTERRUPTS(
    MCF5272_uart_channel_1,
    MCF5272_uart_funs,
    MCF5272_uart_channel_info_1,
    CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL1_BAUD),
    CYG_SERIAL_STOP_DEFAULT,
    CYG_SERIAL_PARITY_DEFAULT,
    CYG_SERIAL_WORD_LENGTH_DEFAULT,
    CYG_SERIAL_FLAGS_DEFAULT,
    MCF5272_uart_out_buf1, sizeof(MCF5272_uart_out_buf1),
    MCF5272_uart_in_buf1, sizeof(MCF5272_uart_in_buf1)
);

#else
static SERIAL_CHANNEL(MCF5272_uart_channel_1,
                      MCF5272_uart_funs,
                      MCF5272_uart_channel_info_1,
                      CYG_SERIAL_BAUD_RATE(CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL0_BAUD),
                      CYG_SERIAL_STOP_DEFAULT,
                      CYG_SERIAL_PARITY_DEFAULT,
                      CYG_SERIAL_WORD_LENGTH_DEFAULT,
                      CYG_SERIAL_FLAGS_DEFAULT
    );
#endif
DEVTAB_ENTRY(
    MCF5272_uart_io1,
    CYGDAT_IO_SERIAL_MCF5272_UART_CHANNEL1_NAME,
    0,                     // Does not depend on a lower level interface
    &cyg_io_serial_devio,  // The table of I/O functions.
    MCF5272_uart_init,     // UART initialization function.
    MCF5272_uart_lookup,   // The UART lookup function. This function typically sets
                           // up the device for actual use, turing on interrupts, configuring the port, etc.
    &MCF5272_uart_channel_1
);
#endif //  CYGNUM_IO_SERIAL_MCF5272_UART_CHANNEL1



/* Definition of macros that access the UART's SIM registers */
/* Read from a register */

#define MCF5272_UART_WRITE(_addr_,_value_) \
   *((volatile CYG_BYTE*)&(_addr_)) = (CYG_BYTE)(_value_)
/* Write to a register */
#define MCF5272_UART_READ(_addr_) \
   *(volatile CYG_BYTE*)&(_addr_)


/* Function Prototypes */
/* =================== */
/* Internal function to actually configure the hardware to desired baud rate, etc. */
static bool MCF5272_uart_config_port(serial_channel*, cyg_serial_info_t*);
static void MCF5272_uart_start_xmit(serial_channel*);


/* Baudrate conversion table. */
static unsigned long baud_rates_table[]=
{
    0,
    50,     // CYGNUM_SERIAL_BAUD_50 = 1
    75,     // CYGNUM_SERIAL_BAUD_75
    110,    // CYGNUM_SERIAL_BAUD_110
    134,    // CYGNUM_SERIAL_BAUD_134_5
    150,    // CYGNUM_SERIAL_BAUD_150
    200,    // CYGNUM_SERIAL_BAUD_200
    300,    // CYGNUM_SERIAL_BAUD_300
    600,    // CYGNUM_SERIAL_BAUD_600
    1200,   // CYGNUM_SERIAL_BAUD_1200
    1800,   // CYGNUM_SERIAL_BAUD_1800
    2400,   // CYGNUM_SERIAL_BAUD_2400
    3600,   // CYGNUM_SERIAL_BAUD_3600
    4800,   // CYGNUM_SERIAL_BAUD_4800
    7200,   // CYGNUM_SERIAL_BAUD_7200
    9600,   // CYGNUM_SERIAL_BAUD_9600
    14400,  // CYGNUM_SERIAL_BAUD_14400
    19200,  // CYGNUM_SERIAL_BAUD_19200
    38400,  // CYGNUM_SERIAL_BAUD_38400
    57600,  // CYGNUM_SERIAL_BAUD_57600
    115200, // CYGNUM_SERIAL_BAUD_115200
    230400  // CYGNUM_SERIAL_BAUD_230400
};

/*      The table contains  divers  to  divide  the  clock  to  configre  a */
/* approppriate for the UART.                                               */

static unsigned long dividers_table[]=
{
    0,
    46080,   // 50
    30720,   // 75
    20945,   // 110
    17130,   // 134_5
    15360,   // 150
    11520,   // 200
    7680,    // 300
    3840,    // 600
    1920,    // 1200
    1280,    // 1800
    960,     // 2400
    640,     // 3600
    480,     // 4800
    320,     // 7200
    240,     // 9600
    160,     // 14400
    120,     // 19200
    60,      // 38400
    40,      // 57600
    20,      // 115200
    10       // 230400
};

/*******************************************************************************
 MCF5272_uart_init() - This routine is called during bootstrap to set up the

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本韩国欧美一区| 一本色道a无线码一区v| 亚洲天堂a在线| 91精品国产欧美一区二区18| 粉嫩一区二区三区性色av| 性欧美疯狂xxxxbbbb| 中文字幕不卡在线| 日韩欧美久久一区| 欧美日韩免费视频| 不卡的av在线| 国产成人午夜视频| 精品一区二区在线播放| 午夜a成v人精品| 一区二区欧美精品| 亚洲欧洲日韩一区二区三区| 26uuu成人网一区二区三区| 欧美日韩不卡一区| 在线观看国产一区二区| 99久久亚洲一区二区三区青草| 国内久久精品视频| 久久 天天综合| 日韩国产欧美在线播放| 亚洲高清免费一级二级三级| 亚洲免费在线看| 中文字幕一区二区三区四区不卡| 日本一区二区三区dvd视频在线| 精品久久久久久久久久久院品网| 欧美一区二区三区四区视频| 欧美理论电影在线| 欧美日韩色一区| 欧美午夜精品一区二区三区| 在线视频你懂得一区| 欧美在线综合视频| 一本色道综合亚洲| 色综合天天综合网天天狠天天| 99久精品国产| 91社区在线播放| 92国产精品观看| 在线观看成人小视频| 欧美色涩在线第一页| 欧美男人的天堂一二区| 欧美一区永久视频免费观看| 日韩欧美一区中文| 久久人人97超碰com| 久久久久久影视| 国产精品久久午夜| 亚洲女人的天堂| 一区二区三区免费网站| 亚洲午夜免费电影| 蜜臀av国产精品久久久久| 激情综合网激情| 成人午夜免费电影| 91色.com| 在线不卡免费av| 亚洲精品一线二线三线| 日本一区二区免费在线观看视频 | 2014亚洲片线观看视频免费| 欧美精品一区二区不卡| 国产日韩在线不卡| 1000精品久久久久久久久| 一区二区三区日韩欧美| 奇米综合一区二区三区精品视频| 老司机免费视频一区二区| 国产超碰在线一区| 91国产丝袜在线播放| 欧美高清精品3d| 久久久激情视频| 亚洲精品国产无天堂网2021| 免费一级片91| 国产98色在线|日韩| 91九色02白丝porn| 欧美大黄免费观看| 日韩理论电影院| 奇米一区二区三区av| 丰满白嫩尤物一区二区| 欧美午夜精品电影| 国产调教视频一区| 亚洲成人综合网站| 成人一二三区视频| 欧美卡1卡2卡| 国产精品美女久久久久aⅴ国产馆| 亚洲va欧美va人人爽午夜| 国产一区二区三区在线观看免费视频| 91免费版在线看| 精品国产sm最大网站| 亚洲激情一二三区| 国产毛片精品国产一区二区三区| 一本色道久久综合亚洲aⅴ蜜桃| 精品美女在线播放| 亚洲国产裸拍裸体视频在线观看乱了| 国产精品一二三在| 欧美日韩成人高清| 亚洲免费电影在线| 国产精品一卡二卡| 欧美日韩一区在线| 自拍偷拍欧美激情| 国产精品亚洲第一| 日韩三级电影网址| 亚洲图片有声小说| 99久久伊人久久99| 久久久久久久久久久久久久久99| 性欧美大战久久久久久久久| 91尤物视频在线观看| 国产欧美一区二区精品性色超碰| 日韩1区2区3区| 欧美日韩情趣电影| 一区二区三区日本| 99视频热这里只有精品免费| 国产亚洲女人久久久久毛片| 蜜臂av日日欢夜夜爽一区| 欧美日韩在线播放三区四区| 亚洲美女屁股眼交| www.亚洲人| 国产精品午夜免费| 国产乱淫av一区二区三区| 欧美v国产在线一区二区三区| 视频一区视频二区中文| 91精品1区2区| 亚洲伦理在线免费看| av在线不卡网| 亚洲欧洲精品一区二区精品久久久| 国产精品99久久久久久久女警| 欧美电影免费观看高清完整版在线观看| 亚洲成人tv网| 欧美日韩aaaaa| 日韩国产高清影视| 欧美一区国产二区| 日本亚洲一区二区| 日韩一区二区三区免费观看| 免费在线观看一区二区三区| 91精品国产一区二区| 日韩av成人高清| 日韩一区二区免费在线电影| 视频一区视频二区中文字幕| 欧美老女人第四色| 热久久久久久久| 精品国产91久久久久久久妲己| 蜜桃视频在线观看一区| 日韩精品专区在线影院观看| 精品一区二区三区免费播放| 精品久久久久香蕉网| 国产精品一级黄| 亚洲欧洲av色图| 在线视频观看一区| 天堂久久久久va久久久久| 欧美一二三在线| 国产一区二区福利视频| 国产精品免费aⅴ片在线观看| 99久久99久久精品国产片果冻| 依依成人精品视频| 欧美二区在线观看| 极品尤物av久久免费看| 欧美激情综合五月色丁香| 91浏览器打开| 午夜精品一区在线观看| 欧美不卡一区二区| 成人动漫一区二区三区| 亚洲一级电影视频| 欧美大胆人体bbbb| 成人免费va视频| 亚洲成人中文在线| 久久理论电影网| 一本高清dvd不卡在线观看 | 成人激情动漫在线观看| 一区二区三区小说| 日韩美一区二区三区| 成人天堂资源www在线| 亚洲午夜精品网| 精品粉嫩aⅴ一区二区三区四区| 粉嫩欧美一区二区三区高清影视| 一二三四社区欧美黄| 精品欧美久久久| 91玉足脚交白嫩脚丫在线播放| 日韩精品福利网| 国产精品色在线| 欧美一二三四在线| 99久久99久久精品免费看蜜桃| 日韩和欧美一区二区三区| 国产欧美日韩综合精品一区二区| 色婷婷综合久久| 国产乱子伦一区二区三区国色天香| 一区二区三区四区国产精品| 精品国产污污免费网站入口| 色av成人天堂桃色av| 国模少妇一区二区三区| 精品久久人人做人人爽| 91精品国产品国语在线不卡| 国产麻豆日韩欧美久久| 亚洲欧美激情小说另类| 久久婷婷成人综合色| 在线观看视频一区| 粉嫩绯色av一区二区在线观看| 天天综合日日夜夜精品| 亚洲色大成网站www久久九九| 久久综合精品国产一区二区三区| 欧美亚洲国产一区二区三区va| 国产成人夜色高潮福利影视| 日本中文一区二区三区| 亚洲另类一区二区| 国产精品乱人伦中文|