📄 sysserial.c
字号:
/* sysSerial.c - SAMSUNG SMDK2510 serial device initialization */
/* Copyright 2002 SAMSUNG ELECTRONICS */
/*
modification history
--------------------
01a,08feb02,jmLee created.
*/
#include "vxWorks.h"
#include "intLib.h"
#include "errno.h"
#include "sysLib.h"
#include "drv/multi/s3c2510.h"
#include "config.h"
#include "drv/intrCtl/s3c2510Intr.h"
#include "drv/sio/s3c2510Sio.h"
/* Driver Initialization Parameters */
LOCAL S3C2510_SIO_CHAN_PARAM s3c2510SioParams[] = {
{INT_LVL_CUARTRX, INT_LVL_CUARTTX, INT_VEC_CUARTRX, INT_VEC_CUARTTX, 0},
{INT_LVL_HUART0RX, INT_LVL_HUART0TX, INT_VEC_HUART0RX, INT_VEC_HUART0TX, 1},
{INT_LVL_HUART1RX, INT_LVL_HUART1TX, INT_VEC_HUART1RX, INT_VEC_HUART1TX, 2},
};
/* Array of all serial channels configured in system. */
LOCAL S3C2510_SIO_CHAN s3c2510SioChan[N_SIO_CHANNELS];
/******************************************************************************
*
* sysSerialHwInit - initialize the BSP serial devices to a quiescent 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
*
* SEE ALSO: sysHwInit()
*/
void sysSerialHwInit(void)
{
int i;
for (i=0; i<N_SIO_CHANNELS; i++)
{
s3c2510SioChan[i].intLvlRx = s3c2510SioParams[i].intLvlRx;
s3c2510SioChan[i].intLvlTx = s3c2510SioParams[i].intLvlTx;
s3c2510SioChan[i].intVecRx = s3c2510SioParams[i].intVecRx;
s3c2510SioChan[i].intVecTx = s3c2510SioParams[i].intVecTx;
s3c2510SioChan[i].ch = s3c2510SioParams[i].ch;
s3c2510SioDevInit(&s3c2510SioChan[i]);
LED_ON(LED_ALL_MASK);
}
}
/******************************************************************************
*
* 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() may call malloc().
*
* RETURNS: N/A
*
* SEE ALSO: sysHwInit2()
*/
void sysSerialHwInit2(void)
{
int i;
for (i=0; i<N_SIO_CHANNELS; i++)
{
/* Connect interrupt. */
intConnect(s3c2510SioChan[i].intVecRx, (VOIDFUNCPTR)s3c2510SioIntRx, (int)&s3c2510SioChan[i]);
intConnect(s3c2510SioChan[i].intVecTx, (VOIDFUNCPTR)s3c2510SioIntTx, (int)&s3c2510SioChan[i]);
/* Enable interrupt. */
intEnable(s3c2510SioChan[i].intLvlRx);
intEnable(s3c2510SioChan[i].intLvlTx);
s3c2510SioDevInit2(&s3c2510SioChan[i]);
}
}
/******************************************************************************
*
* 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 >= N_SIO_CHANNELS))
{
return (SIO_CHAN*)ERROR;
}
return ((SIO_CHAN*)&s3c2510SioChan[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 boot ROMs.
*
* RETURNS: N/A.
*/
void sysSerialReset(void)
{
int i;
for (i=0; i<N_SIO_CHANNELS; i++)
{
/* Disable interrupt. */
intDisable(s3c2510SioChan[i].intLvlRx);
intDisable(s3c2510SioChan[i].intLvlTx);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -