📄 elinmint.h
字号:
*
* Input: tag - the identification of the message that returned
* a problem.
*
* Output: The error code according to the table:
*
* 0x00 // NO ERROR
* ELINMINT_THMIN_ERROR 0x10 // ERROR CODE: HEADER time too short
* ELINMINT_THMAX_ERROR 0x20 // ERROR CODE: HEADER time too long
* ELINMINT_TFMIN_ERROR 0x30 // ERROR CODE: FRAME time too short
* ELINMINT_TFMAX_ERROR 0x40 // ERROR CODE: FRAME time too long
* ELINMINT_CHECKSUM_ERROR 0x50 // ERROR CODE: Checksum
* ELINMINT_DATA_ERROR 0x60 // ERROR CODE: Data Transmitted different from received
* ELINMINT_FRAMING_ERROR 0x70 // ERROR CODE: Data received incorrectly -> Framing Error
*
* Side Effects:
*
* Note:
*
********************************************************************/
#define mELINMIntTXErrorCode(tag) (_ELINMIntStatus.ELINMIntStatusByte&0xF0)
/*********************************************************************
* Macro: mELINMIntTXErrorTag()
*
* PreCondition:Error been detected by mELINMIntRXErrorDetected()
*
* Input:
*
* Output: Returns the Tag of the message that presented a problem
*
* Side Effects:
*
* Note:
*
********************************************************************/
#define mELINMIntTXErrorTag() (_ELINMIntMessageTag)
/*********************************************************************
* Macro: mELINMIntRXErrorTag()
*
* PreCondition:Error been detected by mELINMIntRXErrorDetected()
*
* Input:
*
* Output: Returns the Tag of the message that with error
*
* Side Effects:
*
* Note:
*
********************************************************************/
#define mELINMIntRXErrorTag() (_ELINMIntMessageTag)
/*********************************************************************
* Macro: mELINMIntRXErrorCode(tag)
*
* PreCondition:Error been detected by mELINMIntRXErrorDetected()
*
* Input: tag - the identification of the message that returned
* a problem.
*
* Output: The error code in the HIGH nibble according to the table:
*
* 0x00 // NO ERROR
* ELINMINT_THMIN_ERROR 0x10 // ERROR CODE: HEADER time too short
* ELINMINT_THMAX_ERROR 0x20 // ERROR CODE: HEADER time too long
* ELINMINT_TFMIN_ERROR 0x30 // ERROR CODE: FRAME time too short
* ELINMINT_TFMAX_ERROR 0x40 // ERROR CODE: FRAME time too long
* ELINMINT_CHECKSUM_ERROR 0x50 // ERROR CODE: Checksum
* ELINMINT_DATA_ERROR 0x60 // ERROR CODE: Data Transmitted different from received
* ELINMINT_FRAMING_ERROR 0x70 // ERROR CODE: Data received incorrectly -> Framing Error
*
* Side Effects:
*
* Note:
*
********************************************************************/
#define mELINMIntRXErrorCode(tag) (_ELINMIntStatus.ELINMIntStatusByte&0xF0)
/*********************************************************************
* Macro: mELINMIntGetTXPointer(tag)
*
* PreCondition:mELINMIntInitialize() invoked.
* Available buffer detected by mELINMIntTXBufferAvailable()
*
* Input: tag - the message tag, an identification of the message to
* be sent
*
* Output: Returns a data pointer to the TX buffer
*
* Side Effects:
*
* Note: This macro takes the number by which that specific
* message is going to be identified (tag) and
* returns the data pointer to the buffer where the message
* shall be loaded for transmission.
*
********************************************************************/
#define mELINMIntGetTXPointer(tag) _ELINMIntGetPointer(tag,ELIMINT_TXMSG_INIT)
/*********************************************************************
* Macro: mELINMIntRXStatus(Tag)
*
* PreCondition:Reception completed, checked by mELINMIntMessageReceived
*
* Input: tag - the identification of the message
*
* Output: Returns error code according to the table:
*
* 0x00 // NO ERROR Detected
* ELINMINT_THMIN_ERROR 0x10 // ERROR CODE: HEADER time too short
* ELINMINT_THMAX_ERROR 0x20 // ERROR CODE: HEADER time too long
* ELINMINT_TFMIN_ERROR 0x30 // ERROR CODE: FRAME time too short
* ELINMINT_TFMAX_ERROR 0x40 // ERROR CODE: FRAME time too long
* ELINMINT_CHECKSUM_ERROR 0x50 // ERROR CODE: Checksum
* ELINMINT_DATA_ERROR 0x60 // ERROR CODE: Data Transmitted different from received
* ELINMINT_FRAMING_ERROR 0x70 // ERROR CODE: Data received incorrectly -> Framing Error
*
* Side Effects:
*
* Note:
*
********************************************************************/
#define mELINMIntRXStatus(Tag) (_ELINMIntStatus.ELINMIntStatusByte&0xF0)
/*********************************************************************
* Macro: mELINMIntTXStatus(Tag)
*
* PreCondition:Transmission completed, checked by mELINMIntMessageSent
*
* Input: tag - the identification of the message
*
* Output: Returns error code according to the table:
*
* 0x00 // NO ERROR Detected
* ELINMINT_THMIN_ERROR 0x10 // ERROR CODE: HEADER time too short
* ELINMINT_THMAX_ERROR 0x20 // ERROR CODE: HEADER time too long
* ELINMINT_TFMIN_ERROR 0x30 // ERROR CODE: FRAME time too short
* ELINMINT_TFMAX_ERROR 0x40 // ERROR CODE: FRAME time too long
* ELINMINT_CHECKSUM_ERROR 0x50 // ERROR CODE: Checksum
* ELINMINT_DATA_ERROR 0x60 // ERROR CODE: Data Transmitted different from received
* ELINMINT_FRAMING_ERROR 0x70 // ERROR CODE: Data received incorrectly -> Framing Error
*
* Side Effects:
*
* Note:
*
********************************************************************/
#define mELINMIntTXStatus(Tag) (_ELINMIntStatus.ELINMIntStatusByte&0xF0)
/*********************************************************************
* Macro: mELINMIntRXMessageAvailable()
*
* PreCondition:mELINMIntReceiveMessage(tag,i,s) invoked
*
* Input:
*
* Output: 1 = message was received
* 0 = no message was received
*
* Side Effects:
*
* Note: This macro will flag the reception of a message even
* if an error was encountered, therefore before reading the
* message is necessary to check it's integrity with
* mELINMIntRXErrorDetected()
*
********************************************************************/
#define mELINMIntRXMessageAvailable() (_ELINMIntStatus.ELINMINTSTS.IDLE)
/*********************************************************************
* Macro: mELINMIntGetRXPointer(tag)
*
* PreCondition:mELINMIntInitialize() invoked.
* Available buffer detected by mELINMIntRXBufferAvailable()
*
* Input: Tag - the message tag, an identification of the message to
* be received
*
* Output: Returns a data pointer to the buffer containing the
* received message
*
* Side Effects:
*
* Note: This macro takes the number by which that specific
* message was identified (tag) and returns
* the data pointer used to read the message
*
********************************************************************/
#define mELINMIntGetRXPointer(tag) _ELINMIntGetPointer(tag,0)
/*********************************************************************
* Macro: mELINMIntReceiveMessage(tag,i,s)
*
* PreCondition:mELINMIntInitialize() invoked.
* Available buffer detected by mELINMIntRXBufferAvailable()
*
* Input: tag of the message
* i = ID of the message
* s = size of the message
*
* Output:
*
* Side Effects:
*
* Note: This macro sends a request to the slaves to receive
* 's' data bytes.
*
********************************************************************/
#define mELINMIntReceiveMessage(tag,i,s) _ELINMIntReceiveMessage(tag,i,s)
/*********************************************************************
* Macro: mELINMIntMessageReceived(tag)
*
* PreCondition:mELINMIntReceiveMessage(tag,i,s) invoked
*
* Input: tag - the identification number the message
*
* Output: 1 = message was received.
* 0 = the message wasn't received yet
*
* Side Effects:
*
* Note: This macro will flag the reception of a message even
* if an error was encountered, therefore before reading the
* message is necessary to check it's integrity
*
********************************************************************/
#define mELINMIntMessageReceived(tag) (_ELINMIntStatus.ELINMINTSTS.IDLE)
/*********************************************************************
* Macro: mELINMIntCheckWakeUPReceived()
*
* PreCondition:
*
* Input:
*
* Output: 1 = wake-up signal was received.
* 0 = NO wake-up signal was received.
*
* Side Effects:
*
* Note: This macro will flag the reception of a wake-up signal
* This signal will remain active until a transmission or
* reception is completed. The sleep timeout bit is reset.
*
********************************************************************/
#define mELINMIntCheckWakeUPReceived() (_ELINMIntStatus1.ELINMINTSTS.WAKEUP_RECEIVED)
/*********************************************************************
* Macro: mELINMIntSendWakeUPSignal()
*
* PreCondition:Protocol Initialized by ELINMIntInitialize().
*
* Input:
*
* Output:
*
* Side Effects:
*
* Note: This macro sends a Wake-Up signal and resets the
* sleep timeout flag
*
********************************************************************/
#define mELINMIntSendWakeUPSignal() if(_ELINMIntStatus1.ELINMIntStatusByte=0x20) TXREG=0x80
/*********************************************************************
* Macro: mELINMIntMessageSent(tag)
*
* PreCondition:mELINMIntSendMessage invoked with the same tag
*
* Input: tag - The message indentification number
*
* Output: 1 = transmission completed
* 0 = Transmission not completed
* Side Effects:
*
* Note:
*
********************************************************************/
#define mELINMIntMessageSent(tag) (_ELINMIntStatus.ELINMIntStatusByte&ELINMINT_IDLEBIT_POSITION)
/*********************************************************************
* Macro: mELINMIntSleepTimeOut()
*
* PreCondition:mELINMIntInitialize() invoked.
*
* Input:
*
* Output:
* 1 = Time-Out detected
* 0 = NO Time-Out detected
*
* Side Effects:
*
* Note: The sleep time-out is issued after 25000 bits-time
* of silence in the bus.
*
********************************************************************/
#define mELINMIntSleepTimeOut() (_ELINMIntStatus1.ELINMINTSTS.SLEEP_TIMEOUT)
/*********************************************************************
* Macro: mELINMIntInitialize()
*
* PreCondition:
*
* Input:
*
* Output:
* 0 = Initialization OK
* !0= Initialization Error Code
*
* Side Effects:
*
* Note:
*
********************************************************************/
#define mELINMIntInitialize() (_ELINMIntInitialize())
// *********************************************************
// to allow access to the variables by user's program
//**********************************************************
extern ELINMINT_STATUS _ELINMIntStatus;
extern ELINMINT_STATUS1 _ELINMIntStatus1;
extern BYTE _ELINMIntMessageTag;
extern BYTE _ELINMIntMessageBuffer[];
#endif //#ifndef _ELINMINT_H // Used to avoid duplicate inclusion
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -