?? sysserial.c
字號:
/* sysSerial.c - template BSP serial device initialization *//* Copyright 2002 Wind River Systems, Inc. */#include "copyright_wrs.h"/*TODO - Remove the template modification history and begin a new history starting with version 01a and growing the history upward with each revision.modification history--------------------01a,21may02,scm written.*//* TODO - Fill in this file with I/O addresses and related constants for the template BSP. Anything with "template" as a prefix needs to examined and re-named to id the BSP (i.e. iq80321, iq80310, etc.) *//*DESCRIPTIONThis file contains the board-specific routines for serial channelinitialization.*/#include "vxWorks.h"#include "iv.h"#include "intLib.h"#include "config.h"#include "sysLib.h"#include "drv/sio/ns16552Sio.h"/* local data *//* TODO - flush out template defines... */static NS16550_CHAN ns16550Chan[template_UART_N_UARTS];/******************************************************************************** sysSerialHwInit - initialize the BSP serial devices to a quiesent state** This routine initializes the BSP serial device descriptors and puts the* devices in a quiesent state. It is called from sysHwInit() with* interrupts locked.** RETURNS: N/A*/void sysSerialHwInit (void) { /* * TODO - Do any special board-specific init of hardware to shut down * any hardware that may be active (dma, interrupting, etc). * * Any code called here cannot use malloc/free, or do any intConnect * type functions. */ /* intialize the chips device descriptors */ ns16550Chan[0].regs = (UINT8 *)template_UART1_REG; ns16550Chan[0].level = template_INT_XINT1; ns16550Chan[0].regDelta = template_UART_REG_DELTA; ns16550Chan[0].xtal = template_UART_XTAL; ns16550Chan[0].baudRate = UART_DEFAULT_BAUD;#ifdef SECOND_UART ns16550Chan[1].regs = (UINT8 *)template_UART2_REG; ns16550Chan[1].level = template_UART2_INT; ns16550Chan[1].regDelta = template_UART2_REG_DELTA; ns16550Chan[1].xtal = template_UART2_XTAL; ns16550Chan[1].baudRate = UART_DEFAULT_BAUD;#endif /* reset the chips */ ns16550DevInit (&ns16550Chan[0]);#ifdef SECOND_UART ns16550DevInit (&ns16550Chan[1]);#endif }/******************************************************************************** sysSerialHwInit2 - connect BSP serial device interrupts** This routine connects the BSP serial device interrupts. It is called from* sysHwInit2().* Serial device interrupts could not be connected in sysSerialHwInit() because * the kernel memory allocator was not initialized at that point, and intConnect() * calls malloc().** This is where most device driver modules get called and devices are created.** RETURNS: N/A*/void sysSerialHwInit2 (void) { /* now connect the serial device interrupts */ /* Connect serial interrupts. */ (void) intConnect (INUM_TO_IVEC((UINT32)ns16550Chan[0].level), (VOIDFUNCPTR) ns16550Int, (int)&ns16550Chan[0]);#ifdef SECOND_UART (void) intConnect (INUM_TO_IVEC((UINT32)ns16550Chan[1].level), (VOIDFUNCPTR) ns16550Int, (int)&ns16550Chan[1]);#endif /* Enable the UART interrupt */ intEnable (ns16550Chan[0].level);#ifdef SECOND_UART intEnable (ns16550Chan[1].level);#endif }/******************************************************************************** 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 ) { switch (channel) { case 0: return ((SIO_CHAN *)&ns16550Chan[0]);#ifdef SECOND_UART case 1: return ((SIO_CHAN *)&ns16550Chan[1]);#endif default: return ((SIO_CHAN *)ERROR); } }/******************************************************************************** sysSerialReset - reset the sio devices to a quiet state** Reset all devices to prevent them from generating interrupts.** This is called from sysToMonitor() to shutdown the system gracefully* before transferring control to the boot ROM.** RETURNS: N/A.*/void sysSerialReset (void) { /* Disable the UART interrupt */ intDisable (ns16550Chan[0].level);#ifdef SECOND_UART intDisable (ns16550Chan[1].level);#endif }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -