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

📄 sysserial.c

📁 WRS官方的基于VxWorks的X86 BSP通用模版
💻 C
字号:
/* sysSerial.c - template BSP serial device initialization *//* Copyright 1984-1997 Wind River Systems, Inc. *//*modification history--------------------01a,21sep98,fle  added library descriptionTODO -  Remove the template modification history and begin a new history        starting with version 01a and growing the history upward with        each revision.01c,10mar97,dat  comments from reviewers.01b,17jan97,dat  added sysSiosChans[], chgs sysSerialChanGet01a,22oct96,ms   derived from the mv147 BSP*//*DESCRIPTIONThis file contains the board-specific routines for serial channelinitialization.During development, it is easiest to #include thegeneric driver (in this case "src/drv/sio/templateSio.c").Once the BSP initialization code is working with the genericdriver, it should no longer be #included, but rather should belinked from the library archives.*/#include "vxWorks.h"#include "config.h"#include "intLib.h"#include "iv.h"#include "sysLib.h"#include "template.h"#include "drv/sio/templateSio.h"/* * Sio drivers are delivered in both source and object formats.  You * can include it in source form, or link against it in the library. */#include "sio/templateSio.c"/* static variables */static TEMPLATE_DUSART	templateDusart1;/* * Array of pointers to all serial channels configured in system. * See sioChanGet(). It is this array that maps channel pointers * to standard device names.  The first entry will become "/tyCo/0", * the second "/tyCo/1", and so forth. * * TODO - Update this table as needed. */SIO_CHAN * sysSioChans [] =    {    &templateDusart1.portA.sio,	/* /tyCo/0 */    &templateDusart1.portB.sio	/* /tyCo/1 */    };/* definitions */#if FALSE			/* These are just dummy definitions */#define	DUSART_MASTER_CR	xxx#define	DUSART_PORTA_CR		xxx#define	DUSART_PORTA_DR		xxx#define	DUSART_BAUD_FREQ	BAUD_CLK_FREQ#endif/******************************************************************************** sysSerialHwInit - initialize the BSP serial devices to a quiescent state** This routine initializes the BSP serial device descriptors and puts the* devices in a quiescent state.  It is called from sysHwInit() with* interrupts locked.** RETURNS: N/A** SEE ALSO: sysHwInit()*/ void sysSerialHwInit (void)    {    /*     * TODO - initialize the board-specific fields of the TEMPLATE_DUSART     * device descriptors.     */    /* let the driver perform generic chip initialization and reset */    templateDevInit (&templateDusart1);    }/******************************************************************************** sysSerialHwInit2 - connect BSP serial device interrupts** This routine connects the BSP serial device interrupts.  It is called from* sysHwInit2().  ** Serial device interrupts cannot be connected in sysSerialHwInit() because* the  kernel memory allocator is not initialized at that point and* intConnect() calls malloc().** RETURNS: N/A** SEE ALSO: sysHwInit2()*/ void sysSerialHwInit2 (void)    {    /* TODO - connect all serial device interrupts */    /* second stage initialization will activate interrupt/dma operation */    templateDevInit2 (&templateDusart1);    }/******************************************************************************** sysSerialChanGet - get the SIO_CHAN device associated with a serial channel** This routine returns a pointer to the SIO_CHAN device associated* with a specified serial channel.  It is called by usrRoot() to obtain * pointers when creating the system serial devices, `/tyCo/x'.  It* is also used by the WDB agent to locate its serial channel.** RETURNS: A pointer to the SIO_CHAN structure for the channel, or ERROR* if the channel is invalid.*/SIO_CHAN * sysSerialChanGet    (    int channel         /* serial channel */    )    {    if (channel < 0     || channel >= NELEMENTS(sysSioChans) )	return (SIO_CHAN *) ERROR;    return sysSioChans[channel];    }

⌨️ 快捷键说明

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