📄 uartfax.h
字号:
* UAF_SetBuffer),
* - the state of a V.24 input line has changed,
* - a break is detected,
* - an escape sequence is detected.
* If no suspension is necessary the function returns the number of
* processed bytes.
*
* Arguments: In : uartNo : Used UART.
* suspend : mode of suspension in case of RX buffer empty.
* readOutFunc: Callback function.
* cldFromIrq: The driver sets this parameter to 1
* if the callback function is called
* from an interrupt service routine.
* reInstall : The call-back function sets this
* parameter to rm_reInstall if the
* driver must call again the callback
* function when the RX threshold level
* is reached. Else it will be set to
* rm_noInstall. Before to call the
* readOutFunc function this parameter
* is set to rm_notDefined.
* nsource : Informed the callback function about
* the number of fragments which are
* ready to copy from the circular RX
* buffer.
* source : Array which contains the addresses
* of the fragments.
* size : Array which contains the sizes of
* each fragments.
* state : The state parameter is the status
* of the V.24 lines and the break /
* escape detection. The state
* parameter is described in the
* specification of UAF_GetLineState.
* Out: none
*
* Returns : >= 0 : Succesful operation. Amount of processed bytes.
* FD_NOT_SUPPORTED: Wrong UART number.
* FD_SUSPENDED : The callback is suspended until the buffer or
* state condition changed.
* FD_NOT_READY : The function is called while the callback is
* activated and still not terminated.
* FD_INTERNAL_ERR : Internal problems with the hardware.
*
******************************************************************************/
T_FDRET UAF_ReadData (T_tr_UartId uartNo,
T_suspendMode suspend,
void (readOutFunc (SYS_BOOL cldFromIrq,
T_reInstMode *reInstall,
SYS_UWORD8 nsource,
SYS_UWORD8 *source[],
SYS_UWORD16 size[],
SYS_UWORD32 state)));
/*******************************************************************************
*
* UAF_WriteData
*
* Purpose : To write characters into the TX buffer the address of a function
* is passed. If free space is available in the buffer, the driver
* calls this function and passes the destination address and the
* amount of space. Because the TX buffer is circular, the callback
* function may be called with more than one address of buffer
* fragment.
* The writeInFunc function modifies the contents of the size array
* to return the driver the number of processed bytes. Each array
* entry is decremented by the number of bytes written in this
* fragment.
* If the UAF_WriteData function is called while the TX buffer is
* full, it depends on the suspend parameter to suspend the
* call-back or to leave this function without any operation. In the
* case of suspension the returned value of the UAF_WriteData is
* UAF_SUSPENDED. A delayed call-back will be performed if the TX
* buffer reaches the adjusted threshold (txThreshold of
* UAF_SetBuffer). If no suspension is necessary the function returns
* the number of processed bytes.
*
* Arguments: In : uartNo : Used UART.
* suspend : mode of suspension in case of TX buffer empty.
* writeInFunc: Callback function.
* cldFromIrq: The driver sets this parameter to 1
* if the call-back function is called
* from an interrupt service routine.
* reInstall : The callback function sets this
* parameter to rm_reInstall if the
* driver must call again the callback
* function when the TX threshold level
* is reached. Else it will be set to
* rm_noInstall. Before to call the
* writeInFunc function this parameter
* is set to rm_notDefined.
* ndest : Informed the callback function about
* the number of fragments which are
* available in the TX buffer.
* dest : Array which contains the addresses
* of the fragments.
* size : Array which contains the sizes of
* each fragments.
* Out: none
*
* Returns : >= 0 : Succesful operation. Amount of processed bytes.
* FD_NOT_SUPPORTED: Wrong UART number.
* FD_SUSPENDED : The callback is suspended until the buffer
* condition changed.
* FD_NOT_READY : The function is called while the callback is
* activated and still not terminated.
* FD_INTERNAL_ERR : Internal problems with the hardware.
*
******************************************************************************/
T_FDRET UAF_WriteData (T_tr_UartId uartNo,
T_suspendMode suspend,
void (writeInFunc (SYS_BOOL cldFromIrq,
T_reInstMode *reInstall,
SYS_UWORD8 ndest,
SYS_UWORD8 *dest[],
SYS_UWORD16 size[])));
/*******************************************************************************
*
* UAF_StopRec
*
* Purpose : If a flow control mode is set, this function tells the terminal
* equipment that no more data can be received.
* XON/XOFF: XOFF is sent.
* DTR/DSR : DTR is desactivated.
* RTS/CTS : RTS is deactivated.
*
* Arguments: In : uartNo: Used UART.
* Out: none
*
* Returns : FD_OK : Successful operation.
* FD_NOT_SUPPORTED: Wrong UART number.
* FD_INTERNAL_ERR : Internal problem with the hardware.
*
******************************************************************************/
T_FDRET UAF_StopRec (T_tr_UartId uartNo);
/*******************************************************************************
*
* UAF_StartRec
*
* Purpose : If a flow control mode is set, this function tells the terminal
* equipment that the receiver is again able to receive more data.
* If the buffer has already reached the high water mark the driver
* sends the signal only if the buffer drains to a low water mark.
* XON/XOFF: XON is sent.
* DTR/DSR : DTR is activated.
* RTS/CTS : RTS is activated.
*
* Arguments: In : uartNo: Used UART.
* Out: none
*
* Returns : FD_OK : Successful operation.
* FD_NOT_SUPPORTED: Wrong UART number.
* FD_INTERNAL_ERR : Internal problem with the hardware.
*
******************************************************************************/
T_FDRET UAF_StartRec (T_tr_UartId uartNo);
/*******************************************************************************
*
* UAF_GetLineState
*
* Purpose : Returns the state of the V.24 lines, the flow control state and
* the result of the break/escape detection process as a bit field.
*
* Arguments: In : uartNo: Used UART.
* Out: state : State of the V.24 lines, the flow control state and
* the result of the break/escape sequence detection
* process as a bit field.
*
* Returns : FD_OK : Successful operation.
* FD_NOT_SUPPORTED: Wrong UART number.
* FD_NOT_READY : The function is called while the callback of
* the readOutFunc function is activated and still
* not terminated.
* FD_INTERNAL_ERR : Internal problem with the hardware.
*
******************************************************************************/
T_FDRET UAF_GetLineState (T_tr_UartId uartNo,
SYS_UWORD32 *state);
/*******************************************************************************
*
* UAF_SetLineState
*
* Purpose : Sets the states of the V.24 status lines according to the bit
* field of the parameter state.
*
* Arguments: In : uartNo: Used UART.
* state : Bit field. Only the signals which are marked with
* the 'set' access can be used to change the state of
* the signal.
* mask : Bit field with the same structure as state. Each bit
* in state corresponds to a bit in mask. Settabled
* bits marked by a 1 are manipulated by the driver.
* Out: none
*
* Returns : FD_OK : Successful operation.
* FD_NOT_SUPPORTED: Wrong UART number.
* FD_INTERNAL_ERR : Internal problem with the hardware.
*
******************************************************************************/
T_FDRET UAF_SetLineState (T_tr_UartId uartNo,
SYS_UWORD32 state,
SYS_UWORD32 mask);
/*******************************************************************************
*
* UAF_InterruptHandler
*
* Purpose : Interrupt handler.
*
* Arguments: In : uart_id : origin of interrupt
* interrupt_status: source of interrupt
* Out: none
*
* Returns : none
*
******************************************************************************/
void UAF_InterruptHandler (T_tr_UartId uart_id,
SYS_UWORD8 interrupt_status);
/*******************************************************************************
*
* UAF_CheckXEmpty
*
* Purpose : Checks the empty condition of the Transmitter.
*
* Arguments: In : uartNo: Used UART.
* Out: none
*
* Returns : FD_OK : Empty condition OK.
* FD_NOT_SUPPORTED: Wrong UART number.
* FD_NOT_READY : Empty condition not OK.
* FD_INTERNAL_ERR : Internal problem with the hardware.
*
******************************************************************************/
T_FDRET UAF_CheckXEmpty (T_tr_UartId uartNo);
#ifdef USB_MCCI
#define USB_UART_ID 0
unsigned
bsp_USB_rxCallback_modem(void);
extern unsigned
COSTENOtoUSB_Write(
unsigned iPort,
unsigned char *pBuffer,
unsigned nBuffer
);
extern unsigned
COSTENOtoUSB_Read(
unsigned iPort,
unsigned char *pBuffer,
unsigned nBuffer
);
extern unsigned
COSTENOtoUSB_IsPortReady(
unsigned iPort
);
extern unsigned
COSTENOtoUSB_GetBufferSizeToRead(
unsigned iPort
);
#else
unsigned
bsp_USB_rxCallback_modem(void);
unsigned
COSTENOtoUSB_Write(
unsigned iPort,
unsigned char *pBuffer,
unsigned nBuffer
);
unsigned
COSTENOtoUSB_Read(
unsigned iPort,
unsigned char *pBuffer,
unsigned nBuffer
);
unsigned
COSTENOtoUSB_IsPortReady(
unsigned iPort
);
unsigned
COSTENOtoUSB_GetBufferSizeToRead(
unsigned iPort
);
#endif
#endif /* __UARTFAX_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -