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

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

?? sndssio.c

?? 三星官方基于VXWORKS的S3C2510的BSP
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* sndsSio.c - Samsung SNDS100 serial driver */

/*
modification history
--------------------
01c,25nov99,ak  changed sndsTxStartup as per Samsung note
01b,08Oct99,ak	Added polled mode support
01a,22aug99,ak  adapated from WRS sio template
*/

/*
DESCRIPTION

This is an sio driver for Samsung's SNDS100 evaluation board for their
KS32C50100 microprocessor.  This is an ARM based processor with several 
integrated peripherals.  It has an interrupt controller, two 32-bit timers,
one Ethernet controller,two HDLC controllers, one IIC controller, general 
purpose I/O ports, and a 2 channel DMA controller.

The 2 UART channels integrated with the processor are controlled by this
driver.  Both the UARTs can work in interrupt mode as well as DMA mode.
This driver supports only the interrupt mode for the UARTs.

All the UART registers are accessible as 32-bit integers from the internal
system registers.  The macros SNDS_REG_READ and SNDS_REG_WRITE read and write
32-bit integers from and to the given addresses.  SNDS_SIO_DEFAULT_BAUD is
defined to 38400 in this file.  This is the default baud rate with which 
the UART channels will be initialized.  The channels are also initialized 
with one start bit, one stop bit, 8 bit data and no parity bits.

The driver is typically only called only by the BSP. The directly callable
routines in this module are sndsDevInit(), sndsDevInit2(), sndsIntRcv(), 
sndsIntTx(), and sndsIntErr().

The BSP calls sndsDevInit() to initialize or reset the device.
It connects the driver's interrupt handlers (sndsIntRcv, sndsIntTx,
and sndsIntErr), using intConnect().
After connecting the interrupt handlers, the BSP calls sndsDevInit2()
to inform the driver that interrupt mode operation is now possible.

INCLUDES:
sndsSio.h sioLib.h
*/

#include "vxWorks.h"
#include "sioLib.h"
#include "intLib.h"
#include "errno.h"
#include "sndsSio.h"
#include "ioLib.h"


#define SNDS_BAUD_MIN	1200
#define SNDS_BAUD_MAX	460860
#define SNDS_SIO_DEFAULT_BAUD 38400

/* Hardware abstraction macros */

/* local defines  */

#ifndef SNDS_REG_READ
#define SNDS_REG_READ(pChan, reg, result) \
	((result) = (*(volatile UINT32 *)((UINT32)(pChan)->regs + (reg))))
#endif	/*SNDS_REG_READ*/

#ifndef SNDS_REG_WRITE
#define SNDS_REG_WRITE(pChan, reg, data) \
	((*(volatile UINT32 *)((UINT32)(pChan)->regs + (reg))) = (data))
#endif	/*SNDS_REG_WRITE*/


/* for backward compatibility */

#ifndef	SIO_HUP
#   define SIO_OPEN	0x100A	/* open channel, raise DTR, RTS */
#   define SIO_HUP	0x100B	/* hang-up, lower DTR, RTS */
#endif

/* forward static declarations */

LOCAL int	sndsTxStartup (SIO_CHAN * pSioChan);
LOCAL int	sndsCallbackInstall (SIO_CHAN *pSioChan, int callbackType,
				    STATUS (*callback)(), void *callbackArg);
LOCAL int	sndsPollOutput (SIO_CHAN *pSioChan, char	outChar);
LOCAL int	sndsPollInput (SIO_CHAN *pSioChan, char *thisChar);
LOCAL int	sndsIoctl (SIO_CHAN *pSioChan, int request, void *arg);
LOCAL STATUS	dummyCallback (void);

/* local variables */

LOCAL	SIO_DRV_FUNCS sndsSioDrvFuncs =
    {
    sndsIoctl,
    sndsTxStartup,
    sndsCallbackInstall,
    sndsPollInput,
    sndsPollOutput
    };

LOCAL BOOL sndsIntrMode = FALSE;	/* interrupt mode allowed flag */

/******************************************************************************
*
* sndsDevInit - initialize a SNDS_DUSART
*
* This routine initializes the driver
* function pointers and then resets the chip in a quiescent state.
* The BSP must have already initialized all the device addresses and the
* baudFreq fields in the SNDS_DUSART structure before passing it to
* this routine.
*
* RETURNS: N/A
*/

void sndsDevInit
    (
    SNDS_CHAN * pChan
    )
    {
    /* initialize each channel's driver function pointers */

    pChan->sio.pDrvFuncs	= &sndsSioDrvFuncs;

    /* install dummy driver callbacks */

    pChan->getTxChar    = dummyCallback;
    pChan->putRcvChar	= dummyCallback;
    
    /* reset the chip */

    SNDS_REG_WRITE(pChan,SNDS_ULCON,(EXT_CLK | PARITY_NONE | ONE_STOP |WORD_LEN));


    /* setting polled mode is one way to make the device quiet */

    sndsIoctl ((SIO_CHAN *)pChan,SIO_MODE_SET,(void *)SIO_MODE_POLL);
	sndsIoctl ((SIO_CHAN *)pChan, SIO_BAUD_SET, (void *)SNDS_SIO_DEFAULT_BAUD);

    }

/******************************************************************************
*
* sndsDevInit2 - initialize a SNDS_DUSART, part 2
*
* This routine is called by the BSP after interrupts have been connected.
* The driver can now operate in interrupt mode.  Before this routine is
* called only polled mode operations should be allowed.
*
* RETURNS: N/A
* ARGSUSED
*/

void sndsDevInit2
    (
    SNDS_CHAN * pChan		/* device to initialize */
    )
    {
	char outchar = NULL;
    /* Interrupt mode is allowed */

    SNDS_REG_WRITE(pChan,SNDS_UCON,UCON_RX|UCON_TX);

	/* 
	 * Dummy write to TXBUF to start TX empty interrupt
	 */

	SNDS_REG_WRITE(pChan,SNDS_UTXBUF,outchar);
    sndsIntrMode = TRUE;
    }

/******************************************************************************
*
* sndsIntRcv - handle a channel's receive-character interrupt
*
* RETURNS: N/A
*/ 

void sndsIntRcv
    (
    SNDS_CHAN *	pChan		/* channel generating the interrupt */
    )
    {
    char            inChar;
    UINT32	    status;

    /*
     * Grab the input character from the chip and hand it off via a
     * callback. For chips with input FIFO's it is more efficient
     * to empty the entire FIFO here.
     */
    SNDS_REG_READ(pChan,SNDS_USTAT, status);

    if((status & USTAT_RX_READY) == USTAT_RX_READY)
    {
    SNDS_REG_READ(pChan,SNDS_URXBUF, inChar);
	(*pChan->putRcvChar) (pChan->putRcvArg, inChar);
    }
    }

/******************************************************************************
*
* sndsIntTx - handle a channels transmitter-ready interrupt
*
* RETURNS: N/A
*/ 

void sndsIntTx
    (
    SNDS_CHAN *	pChan		/* channel generating the interrupt */
    )
    {
    char            outChar;
	UINT32	status;
    /*
     * If there's a character to transmit then write it out, else reset
     * the transmitter. For chips with output FIFO's it is more efficient
     * to fill the entire FIFO here.
     */

    SNDS_REG_READ(pChan,SNDS_USTAT, status);	

    if((status & USTAT_TX_READY) != USTAT_TX_READY)	
		return;
	if ((*pChan->getTxChar) (pChan->getTxArg, &outChar) != ERROR)
		SNDS_REG_WRITE(pChan, SNDS_UTXBUF, outChar);
	else
	{	
	    if (pChan == &sndsChan[0])
		{
	        intDisable (INT_LVL_UARTTX0);
		    /* *(UINT32 *) SNDS_INT_CSR_PEND = (1 << INT_LVL_UARTTX0); */
		}
	    else
		{
	        intDisable (INT_LVL_UARTTX1);
		    /* *(UINT32 *) SNDS_INT_CSR_PEND = (1 << INT_LVL_UARTTX1); */
		}
	}
    }

/******************************************************************************
*
* sndsTxStartup - start the interrupt transmitter
*
* RETURNS: OK on success, ENOSYS if the device is polled-only, or
* EIO on hardware error.
*/

LOCAL int sndsTxStartup
    (
    SIO_CHAN * pSioChan                 /* channel to start */
    )
    {
    SNDS_CHAN * pChan = (SNDS_CHAN *)pSioChan;
	*(UINT32 *)SNDS_IOPMOD = 0xff ;

	if (pChan == &sndsChan[0])
	{
		SNDS_REG_WRITE(pChan, SNDS_UTXBUF, NULL);
		*(UINT32 *)SNDS_IOPDATA = 0x0f ;
	    /* *(UINT32 *) SNDS_INTPENDTST |= (1 << INT_LVL_UARTTX0); */
        intEnable (INT_LVL_UARTTX0);
	}
    else if (pChan == &sndsChan[1])
	{
		SNDS_REG_WRITE(pChan, SNDS_UTXBUF, NULL);
	    /* *(UINT32 *) SNDS_INTPENDTST |= (1 << INT_LVL_UARTTX1); */
        intEnable (INT_LVL_UARTTX1);
	}
    return (OK);
    }

/******************************************************************************
*
* sndsCallbackInstall - install ISR callbacks to get/put chars
*
* This driver allows interrupt callbacks for transmitting characters
* and receiving characters. In general, drivers may support other
* types of callbacks too.
*
* RETURNS: OK on success, or ENOSYS for an unsupported callback type.
*/ 

LOCAL int sndsCallbackInstall
    (
    SIO_CHAN *	pSioChan,               /* channel */
    int		callbackType,           /* type of callback */
    STATUS	(*callback)(),          /* callback */
    void *      callbackArg             /* parameter to callback */
    )
    {
    SNDS_CHAN * pChan = (SNDS_CHAN *)pSioChan;
    switch (callbackType)
	{
	case SIO_CALLBACK_GET_TX_CHAR:
	    pChan->getTxChar	= callback;
	    pChan->getTxArg	= callbackArg;
	    return (OK);

	case SIO_CALLBACK_PUT_RCV_CHAR:
	    pChan->putRcvChar	= callback;
	    pChan->putRcvArg	= callbackArg;
	    return (OK);

	default:
	    return (ENOSYS);
	}
    }

/*******************************************************************************
*
* sndsPollOutput - output a character in polled mode
*
* RETURNS: OK if a character arrived, EIO on device error, EAGAIN
* if the output buffer if full. ENOSYS if the device is
* interrupt-only.
*/

LOCAL int sndsPollOutput
    (
    SIO_CHAN *	pSioChan,
    char	outChar
    )
    {
    SNDS_CHAN * pChan = (SNDS_CHAN *)pSioChan;
    UINT32	status;

    /* is the transmitter ready to accept a character? */

    SNDS_REG_READ (pChan, SNDS_USTAT, status);
    if ((status & USTAT_TX_READY) == 0x00)
		return (EAGAIN);

    /* write out the character */

    SNDS_REG_WRITE(pChan, SNDS_UTXBUF, outChar);
	return (OK);
    }

/******************************************************************************
*
* sndsPollInput - poll the device for input
*
* RETURNS: OK if a character arrived, EIO on device error, EAGAIN
* if the input buffer if empty, ENOSYS if the device is
* interrupt-only.
*/

LOCAL int sndsPollInput
    (
    SIO_CHAN *	pSioChan,
    char *	thisChar
    )
    {
    SNDS_CHAN * pChan = (SNDS_CHAN *)pSioChan;
    UINT32	status;

    SNDS_REG_READ (pChan,SNDS_USTAT, status);

    if ((status & USTAT_RX_AVAIL) == 0x00)
		return (EAGAIN);	/* no input available at this time */

    /* got a character */

    SNDS_REG_READ(pChan, SNDS_URXBUF, *thisChar);

    return (OK);
    }

/******************************************************************************
*
* sndsModeSet - toggle between interrupt and polled mode
*
* RETURNS: OK on success, EIO on unsupported mode.
*/

LOCAL int sndsModeSet
    (
    SNDS_CHAN * pChan,		/* channel */
    uint_t	newMode        	/* new mode */
    )
    {
    UINT32	temp;


    if ((newMode != SIO_MODE_POLL) && (newMode != SIO_MODE_INT))	
	return (EIO);


    /* Don't enter interrupt mode unless it is allowed. */

    if ((newMode == SIO_MODE_INT) && (!sndsIntrMode))
	return (EIO);

    /* set the new mode */

    pChan->mode = newMode;

    if (pChan->mode == SIO_MODE_INT)
		{
  
 	   	SNDS_REG_READ(pChan, SNDS_UCON, temp);
		temp &=UCON_RX_TX_RESET;	/**Reset RX and TX mode bits*/
    	temp |= (UCON_RX|UCON_TX);
    	SNDS_REG_WRITE(pChan,SNDS_UCON, temp);
		if (pChan == &sndsChan[0])
			{
        	intEnable(INT_LVL_UARTRX0);
			}
    	else if (pChan == &sndsChan[1])
			{
         	intEnable(INT_LVL_UARTRX1);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美96一区二区免费视频| 蜜臀av性久久久久蜜臀aⅴ四虎| 精品视频在线看| 99久久精品国产观看| 高清av一区二区| 国产精华液一区二区三区| 国产福利视频一区二区三区| 高清久久久久久| 色欲综合视频天天天| 欧美性生活一区| 日韩一级黄色大片| 久久久久久久久岛国免费| 欧美激情在线观看视频免费| 日韩毛片一二三区| 亚洲一区二区在线观看视频| 香蕉成人啪国产精品视频综合网| 偷拍日韩校园综合在线| 日本sm残虐另类| 高清国产午夜精品久久久久久| 成人网页在线观看| 91福利资源站| 日韩欧美电影在线| 亚洲国产激情av| 亚洲1区2区3区视频| 九九视频精品免费| 99久久久久久| 欧美福利视频导航| 国产精品视频看| 午夜久久福利影院| 国产成人综合视频| 欧美日韩亚洲国产综合| 2022国产精品视频| 一区二区三区精品视频| 久久国产精品99精品国产| 成人动漫一区二区| 欧美一级黄色片| 国产精品福利一区| 免费高清成人在线| 99久久777色| 精品国产一区二区在线观看| 亚洲老妇xxxxxx| 国产精品 日产精品 欧美精品| 欧美天天综合网| 国产精品欧美久久久久无广告| 丝袜诱惑制服诱惑色一区在线观看 | 91网站在线播放| 日韩一区二区精品葵司在线| 国产精品萝li| 老司机免费视频一区二区| 色妞www精品视频| 26uuu亚洲| 午夜日韩在线观看| 日本福利一区二区| 亚洲视频资源在线| 国产福利一区在线| 欧美变态tickle挠乳网站| 亚洲第一在线综合网站| 91网址在线看| 中文字幕第一区综合| 久久精品免费看| 欧美精品免费视频| 亚洲午夜精品17c| 色婷婷综合激情| 亚洲欧美日韩久久精品| 成人丝袜高跟foot| 欧美精品一区二区三区一线天视频 | 亚洲国产精品久久久久婷婷884| 国产91清纯白嫩初高中在线观看| 日韩欧美激情四射| 蜜臀精品一区二区三区在线观看| 欧美肥妇bbw| 日本不卡视频一二三区| 51精品视频一区二区三区| 天天综合色天天| 欧美精品久久久久久久久老牛影院| 亚洲免费色视频| 本田岬高潮一区二区三区| 欧美激情一区二区三区不卡| 国产一区二区三区在线观看免费视频| 日韩欧美中文字幕制服| 美国av一区二区| 欧美精品一区二区三区很污很色的 | 国模大尺度一区二区三区| 久久久久国产精品免费免费搜索| 蜜桃免费网站一区二区三区| 欧美一区二区三区系列电影| 久久99九九99精品| 欧美va在线播放| 丁香五精品蜜臀久久久久99网站| 国产欧美一区二区精品仙草咪| 成人精品一区二区三区中文字幕| 综合婷婷亚洲小说| 91久久线看在观草草青青| 亚洲国产精品久久艾草纯爱| 4438x成人网最大色成网站| 奇米一区二区三区av| 国产视频一区在线观看 | 亚洲综合色视频| 日韩午夜在线观看视频| 久久97超碰国产精品超碰| 国产人成亚洲第一网站在线播放 | 久久午夜羞羞影院免费观看| 国产精品小仙女| 亚洲男人的天堂av| 欧美福利视频一区| www.欧美亚洲| 日韩精彩视频在线观看| 国产午夜三级一区二区三| 一本大道久久a久久精品综合| 爽爽淫人综合网网站| 中文字幕不卡一区| 欧美一二三四在线| 91丨九色丨黑人外教| 日韩av中文在线观看| 国产精品丝袜91| 日韩区在线观看| 99这里都是精品| 精品制服美女丁香| 亚洲福利一区二区| 欧美激情在线一区二区三区| 亚洲精品在线网站| 欧美私人免费视频| 国产白丝精品91爽爽久久| 五月婷婷久久综合| 中文字幕在线观看一区| 欧美变态凌虐bdsm| 欧美男生操女生| 色婷婷av一区二区三区软件| 国产一区二区导航在线播放| 日韩av不卡一区二区| 亚洲乱码精品一二三四区日韩在线| 精品免费视频一区二区| 日韩一区二区三免费高清| 在线免费观看日韩欧美| 91在线观看地址| 国产精品正在播放| 久久99久久久久| 久久精品国内一区二区三区| 亚洲自拍偷拍麻豆| 日本一区二区免费在线观看视频 | 欧美电视剧免费全集观看| 94色蜜桃网一区二区三区| 国产乱码精品一区二区三区忘忧草| 天天色天天操综合| 亚洲午夜久久久| 亚洲主播在线播放| 一区二区三区欧美视频| 亚洲免费观看高清完整版在线 | 欧美视频在线一区| 日本韩国欧美三级| 色婷婷av一区二区三区gif| 91在线观看视频| 在线欧美日韩精品| 欧美色视频一区| 欧美亚洲图片小说| 欧美一a一片一级一片| 欧美日韩一区二区欧美激情| 在线观看不卡一区| 在线观看91av| 亚洲精品在线电影| 久久九九99视频| 亚洲同性gay激情无套| 亚洲欧洲精品一区二区三区不卡| 一区免费观看视频| 一区二区三区日韩欧美| 亚洲第一成年网| 久草这里只有精品视频| 粉嫩av亚洲一区二区图片| 99久久er热在这里只有精品66| 一本一道波多野结衣一区二区| 欧美主播一区二区三区美女| 欧美美女一区二区在线观看| 51午夜精品国产| 国产亚洲综合av| 亚洲欧洲综合另类在线 | 日韩欧美国产午夜精品| 久久综合色综合88| 亚洲日本一区二区三区| 性感美女极品91精品| 国产美女精品人人做人人爽| 不卡在线视频中文字幕| 欧美精品日韩精品| 日本一区二区免费在线| 亚洲女人的天堂| 精品一区二区三区日韩| 91在线观看一区二区| 欧美一区二区私人影院日本| 中文字幕乱码日本亚洲一区二区| 亚洲二区视频在线| 成人国产视频在线观看| 欧美一区二区三区的| 国产精品久久久久一区二区三区共| 亚洲午夜电影在线观看| 国产91综合一区在线观看| 欧美精品久久久久久久久老牛影院 | 欧美电影免费观看高清完整版在| 日韩一区日韩二区| 国产一区二区三区蝌蚪| 欧美伊人久久大香线蕉综合69 | 正在播放亚洲一区|