📄 sysserial.c
字号:
/* sysSerial.c - NS 16550 UART bsp serial device initialization *//* Copyright 1984-1996 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01c,18jan02,scm modify uart inclusion definition...01b,23oct00,jb Resolving warnings at lines 79 and 8301a,01aug00,scm written*/#include "vxWorks.h"#include "iv.h"#include "intLib.h"#include "config.h"#include "sysLib.h"#include "drv/sio/ns16552Sio.h"/* local data */static NS16550_CHAN ns16550Chan[IQ80310_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) { /* intialize the chips device descriptors */ ns16550Chan[0].regs = (UINT8 *)IQ80310_UART_BASE_UART1; ns16550Chan[0].level = I80312INT_VEC_UART1; ns16550Chan[0].regDelta = IQ80310_UART_REG_DELTA; ns16550Chan[0].xtal = IQ80310_UART_XTAL; ns16550Chan[0].baudRate = UART_DEFAULT_BAUD;#ifdef SECOND_UART ns16550Chan[1].regs = (UINT8 *)IQ80310_UART_BASE_UART2; ns16550Chan[1].level = I80312INT_VEC_UART2; ns16550Chan[1].regDelta = IQ80310_UART_REG_DELTA; ns16550Chan[1].xtal = IQ80310_UART_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().** RETURNS: N/A*/void sysSerialHwInit2 (void) { /* now connect the serial device interrupts */ /* Connect serial interrupts. */ (void) intConnect ((VOIDFUNCPTR *)((UINT32)ns16550Chan[0].level), (VOIDFUNCPTR) ns16550Int, (int)&ns16550Chan[0]);#ifdef SECOND_UART (void) intConnect ((VOIDFUNCPTR *)((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 gets the SIO_CHAN device associated with a specified 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 + -