📄 sysserial.c
字号:
/* sysSerial.c - Intel ixm1200 serial device initialisation *//* Copyright 1996-1998 Wind River Systems, Inc.; Copyright 1999 Intel Corp. */#include "copyright_wrs.h"/*modification history--------------------01c,30aug01,scm adjust to reflect ixm1200...01b,13aug99,jdg changed name from vbsa1200 to ixp1200eb01a,07may99,jdg created, based on brutus, version 01a*//*DESCRIPTIONThis file contains the board-specific routines for serial channelinitialisation of the UART built in to the IXM1200 chip on the ixm1200 board.*//* includes */#include "vxWorks.h"#include "iv.h"#include "intLib.h"#include "config.h"#include "sysLib.h"#include "ixm1200Sio.h"#include "hpcSerial.h"/* Local data structures */LOCAL IXM1200_CHAN ixm1200Chan[N_IXM1200_UART_CHANNELS];#ifdef INCLUDE_HPC_SERIALLOCAL HPC_SERIAL_CHAN hpcSerChan[N_HPC_SERIAL_CHANNELS];#endif/* * 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. */SIO_CHAN * sysSioChans [] = { &ixm1200Chan[0].sio, /* /tyCo/0 */#ifdef INCLUDE_HPC_SERIAL &hpcSerChan[0].sio, &hpcSerChan[1].sio,#endif };/******************************************************************************** sysSerialHwInit - initialise the BSP serial devices to a quiescent state** This routine initialises 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) { int i; for (i = 0; i < N_IXM1200_UART_CHANNELS; i++) { ixm1200Chan[i].baudRate = CONSOLE_BAUD_RATE; ixm1200Chan[i].xtal = UART_XTAL_FREQ; /* * Initialise driver functions, getTxChar, putRcvChar and channelMode * and initialise UART */ ixm1200UartDevInit(&ixm1200Chan[i]); }#ifdef INCLUDE_HPC_SERIAL for (i=0; i < N_HPC_SERIAL_CHANNELS; i++) { hpcSerChan[i].channelNum = FIRST_HPC_SERIAL_CHANNEL + i; hpcsDevInit(&hpcSerChan[i]); }#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* initialised at that point, and intConnect() may call malloc().* * RETURNS: N/A ** SEE ALSO: sysHwInit2()*/void sysSerialHwInit2 (void) { int i; for (i = 0; i < N_IXM1200_UART_CHANNELS; i++) { /* * We would like to check the return value from this and log a message * if it failed. However, logLib has not been initialised yet, so we * cannot log a message, so there's little point in checking it. */ /* connect and enable interrupts */ (void) intConnect (INUM_TO_IVEC(INT_VEC_UART), ixm1200UartInt, (int) &ixm1200Chan[i]); ixm1200UartDevInit2(&ixm1200Chan[i]); }#ifdef INCLUDE_HPC_SERIAL for (i=0; i < N_HPC_SERIAL_CHANNELS; i++) { /* * Open the HPC channel */ hpcsDevInit2(&hpcSerChan[i]); }#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 /* serial channel */ ) { if (channel < 0 || channel >= (int) (NELEMENTS(sysSioChans)) ) return (SIO_CHAN *) ERROR; return sysSioChans[channel]; }/******************************************************************************** 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 to the bootroms.** RETURNS: N/A.*/void sysSerialReset (void) { int i; for (i = 0; i < N_IXM1200_UART_CHANNELS; i++) { /* disable interrupts */ ixm1200UartDevReset(&ixm1200Chan[i]); } return; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -