int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, int ChanNum) 
static int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum, int ChanNum) 
int sInitChan(CONTROLLER_T * CtlP, CHANNEL_T * ChP, int AiopNum,	      int ChanNum){	int i;	WordIO_t AiopIO;	WordIO_t ChIOOff;	Byte_t *ChR;	Word_t ChOff;	static Byte_t R[4];	int brd9600;	if (ChanNum >= CtlP->AiopNumChan[AiopNum])		return (FALSE);	/* exceeds num chans in AIOP */	/* Channel, AIOP, and controller identifiers */	ChP->CtlP = CtlP;	ChP->ChanID = CtlP->AiopID[AiopNum];	ChP->AiopNum = AiopNum;	ChP->ChanNum = ChanNum;	/* Global direct addresses */	AiopIO = CtlP->AiopIO[AiopNum];	ChP->Cmd = (ByteIO_t) AiopIO + _CMD_REG;	ChP->IntChan = (ByteIO_t) AiopIO + _INT_CHAN;	ChP->IntMask = (ByteIO_t) AiopIO + _INT_MASK;	ChP->IndexAddr = (DWordIO_t) AiopIO + _INDX_ADDR;	ChP->IndexData = AiopIO + _INDX_DATA;	/* Channel direct addresses */	ChIOOff = AiopIO + ChP->ChanNum * 2;	ChP->TxRxData = ChIOOff + _TD0;	ChP->ChanStat = ChIOOff + _CHN_STAT0;	ChP->TxRxCount = ChIOOff + _FIFO_CNT0;	ChP->IntID = (ByteIO_t) AiopIO + ChP->ChanNum + _INT_ID0;	/* Initialize the channel from the RData array */	for (i = 0; i < RDATASIZE; i += 4) {		R[0] = RData[i];		R[1] = RData[i + 1] + 0x10 * ChanNum;		R[2] = RData[i + 2];		R[3] = RData[i + 3];		sOutDW(ChP->IndexAddr, *((DWord_t *) & R[0]));	}	ChR = ChP->R;	for (i = 0; i < RREGDATASIZE; i += 4) {		ChR[i] = RRegData[i];		ChR[i + 1] = RRegData[i + 1] + 0x10 * ChanNum;		ChR[i + 2] = RRegData[i + 2];		ChR[i + 3] = RRegData[i + 3];	}	/* Indexed registers */	ChOff = (Word_t) ChanNum *0x1000;	if (sClockPrescale == 0x14)		brd9600 = 47;	else		brd9600 = 23;	ChP->BaudDiv[0] = (Byte_t) (ChOff + _BAUD);	ChP->BaudDiv[1] = (Byte_t) ((ChOff + _BAUD) >> 8);	ChP->BaudDiv[2] = (Byte_t) brd9600;	ChP->BaudDiv[3] = (Byte_t) (brd9600 >> 8);	sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->BaudDiv[0]);	ChP->TxControl[0] = (Byte_t) (ChOff + _TX_CTRL);	ChP->TxControl[1] = (Byte_t) ((ChOff + _TX_CTRL) >> 8);	ChP->TxControl[2] = 0;	ChP->TxControl[3] = 0;	sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxControl[0]);	ChP->RxControl[0] = (Byte_t) (ChOff + _RX_CTRL);	ChP->RxControl[1] = (Byte_t) ((ChOff + _RX_CTRL) >> 8);	ChP->RxControl[2] = 0;	ChP->RxControl[3] = 0;	sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->RxControl[0]);	ChP->TxEnables[0] = (Byte_t) (ChOff + _TX_ENBLS);	ChP->TxEnables[1] = (Byte_t) ((ChOff + _TX_ENBLS) >> 8);	ChP->TxEnables[2] = 0;	ChP->TxEnables[3] = 0;	sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxEnables[0]);	ChP->TxCompare[0] = (Byte_t) (ChOff + _TXCMP1);	ChP->TxCompare[1] = (Byte_t) ((ChOff + _TXCMP1) >> 8);	ChP->TxCompare[2] = 0;	ChP->TxCompare[3] = 0;	sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxCompare[0]);	ChP->TxReplace1[0] = (Byte_t) (ChOff + _TXREP1B1);	ChP->TxReplace1[1] = (Byte_t) ((ChOff + _TXREP1B1) >> 8);	ChP->TxReplace1[2] = 0;	ChP->TxReplace1[3] = 0;	sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxReplace1[0]);	ChP->TxReplace2[0] = (Byte_t) (ChOff + _TXREP2);	ChP->TxReplace2[1] = (Byte_t) ((ChOff + _TXREP2) >> 8);	ChP->TxReplace2[2] = 0;	ChP->TxReplace2[3] = 0;	sOutDW(ChP->IndexAddr, *(DWord_t *) & ChP->TxReplace2[0]);	ChP->TxFIFOPtrs = ChOff + _TXF_OUTP;	ChP->TxFIFO = ChOff + _TX_FIFO;	sOutB(ChP->Cmd, (Byte_t) ChanNum | RESTXFCNT);	/* apply reset Tx FIFO count */	sOutB(ChP->Cmd, (Byte_t) ChanNum);	/* remove reset Tx FIFO count */	sOutW((WordIO_t) ChP->IndexAddr, ChP->TxFIFOPtrs);	/* clear Tx in/out ptrs */	sOutW(ChP->IndexData, 0);	ChP->RxFIFOPtrs = ChOff + _RXF_OUTP;	ChP->RxFIFO = ChOff + _RX_FIFO;	sOutB(ChP->Cmd, (Byte_t) ChanNum | RESRXFCNT);	/* apply reset Rx FIFO count */	sOutB(ChP->Cmd, (Byte_t) ChanNum);	/* remove reset Rx FIFO count */	sOutW((WordIO_t) ChP->IndexAddr, ChP->RxFIFOPtrs);	/* clear Rx out ptr */	sOutW(ChP->IndexData, 0);	sOutW((WordIO_t) ChP->IndexAddr, ChP->RxFIFOPtrs + 2);	/* clear Rx in ptr */	sOutW(ChP->IndexData, 0);	ChP->TxPrioCnt = ChOff + _TXP_CNT;	sOutW((WordIO_t) ChP->IndexAddr, ChP->TxPrioCnt);	sOutB(ChP->IndexData, 0);	ChP->TxPrioPtr = ChOff + _TXP_PNTR;	sOutW((WordIO_t) ChP->IndexAddr, ChP->TxPrioPtr);	sOutB(ChP->IndexData, 0);	ChP->TxPrioBuf = ChOff + _TXP_BUF;	sEnRxProcessor(ChP);	/* start the Rx processor */	return (TRUE);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/f15313bf42337ade55376303932d8b6a62e6be43/rocket.c/buggy/drivers/char/rocket.c