FreeBSD/sys/dev/rp/rp.c
/***************************************************************************
Function: sWriteTxPrioByte
Purpose:  Write a byte of priority transmit data to a channel
Call:	  sWriteTxPrioByte(ChP,Data)
	  CHANNEL_T *ChP; Ptr to channel structure
	  Byte_t Data; The transmit data byte

Return:   int: 1 if the bytes is successfully written, otherwise 0.

Comments: The priority byte is transmitted before any data in the Tx FIFO.

Warnings: No context switches are allowed while executing this function.
*/
sWriteTxPrioByte
Purpose:  Write a byte of priority transmit data to a channel
Call:     sWriteTxPrioByte(ChP,Data)
CHANNEL_T *ChP; Ptr to channel structure
Byte_t Data; The transmit data byte

1 if the bytes is successfully written, otherwise 0.

The priority byte is transmitted before any data in the Tx FIFO.

No context switches are allowed while executing this function.
sWriteTxPrioByte Purpose : Write a byte of priority transmit data to a channel Call : sWriteTxPrioByte ( ChP Data ) CHANNEL_T * ChP ; Ptr to channel structure Byte_t Data ; The transmit data byte 1 if the bytes is successfully written otherwise 0 . The priority byte is transmitted before any data in the Tx FIFO . No context switches are allowed while executing this function .
int sWriteTxPrioByte(CHANNEL_T *ChP, Byte_t Data)
{
   Byte_t DWBuf[4];		
   if(sGetTxCnt(ChP) > 1)	       
   {
      rp_writech2(ChP,_INDX_ADDR,ChP->TxPrioCnt); 
      if(rp_readch1(ChP,_INDX_DATA) & PRI_PEND) 
	 return(0);		       
      le16enc(DWBuf,ChP->TxPrioBuf);   
      DWBuf[2] = Data;		       
      DWBuf[3] = 0;		       
      rp_writech4(ChP,_INDX_ADDR,le32dec(DWBuf)); 
      le16enc(DWBuf,ChP->TxPrioCnt);   
      DWBuf[2] = PRI_PEND + 1;	       
      DWBuf[3] = 0;		       
      rp_writech4(ChP,_INDX_ADDR,le32dec(DWBuf)); 
   }
   else 			       
   {
      sWriteTxByte(ChP,sGetTxRxDataIO(ChP),Data);
   }
   return(1);			       
}
int sWriteTxPrioByte ( CHANNEL_T * ChP , Byte_t Data ) { Byte_t DWBuf [ 4 ] ; if ( sGetTxCnt ( ChP ) > 1 ) { rp_writech2 ( ChP , _INDX_ADDR , ChP -> TxPrioCnt ) ; if ( rp_readch1 ( ChP , _INDX_DATA ) & PRI_PEND ) return ( 0 ) ; le16enc ( DWBuf , ChP -> TxPrioBuf ) ; DWBuf [ 2 ] = Data ; DWBuf [ 3 ] = 0 ; rp_writech4 ( ChP , _INDX_ADDR , le32dec ( DWBuf ) ) ; le16enc ( DWBuf , ChP -> TxPrioCnt ) ; DWBuf [ 2 ] = PRI_PEND + 1 ; DWBuf [ 3 ] = 0 ; rp_writech4 ( ChP , _INDX_ADDR , le32dec ( DWBuf ) ) ; } else { sWriteTxByte ( ChP , sGetTxRxDataIO ( ChP ) , Data ) ; } return ( 1 ) ; }
Function: sWriteTxPrioByte
Purpose:  Write a byte of priority transmit data to a channel
Call:     sWriteTxPrioByte(ChP,Data)
CHANNEL_T *ChP; Ptr to channel structure
Byte_t Data; The transmit data byte
Function : sWriteTxPrioByte Purpose : Write a byte of priority transmit data to a channel Call : sWriteTxPrioByte ( ChP Data ) CHANNEL_T * ChP ; Ptr to channel structure Byte_t Data ; The transmit data byte
/* buffer for double word writes */ /* write it to Tx priority buffer */ /* get priority buffer status */ /* priority buffer busy */ /* nothing sent */ /* data byte address */ /* data byte value */ /* priority buffer pointer */ /* write it out */ /* Tx priority count address */ /* indicate 1 byte pending */ /* priority buffer pointer */ /* write it out */ /* write it to Tx FIFO */ /* 1 byte sent */