📄 mk_extern.h
字号:
// ==================================================================
// MK_GetCurrentTime() -
//
// To get the current System Timer counter value(unit = 1ms).
//
//
// Input - nil
//
// Output - nil
//
// Function returns the current counter value.
//
//
muint16 MK_GetCurrentTime(void);
// ==================================================================
// MK_SetTimerHook() -
//
// To attach a hook function to the system timer.
//
//
// Input - myTimerHookFunc = Pointer to the hook function
// myInterval = The time interval to call to the
// function.
//
// Output - nil
//
// Function returns the error code of the result.
//
//
mErrorCode MK_SetTimerHook(pHookFunc myTimerHookFunc, muint16 myInterval);
// ==================================================================
// MK_RemoveTimerHook() -
//
// To remove a hook function to the system timer.
//
//
// Input - myTimerHookFunc = Pointer to the hook function
//
// Output - nil
//
// Function returns the error code of the result.
//
//
mErrorCode MK_RemoveTimerHook(pHookFunc myTimerHookFunc);
// ==================================================================
// MK_Sci_Open() -
//
// To open & config an assigned SCI port for later use.
//
// **Please note that when 7 data bit is selected, parity must
// be enabled. (non-parity + 7 data bits) mode is not supported.
//
//
// Input - index = index of SCI port #. (0, 1, 2...)
// config = required configuration of SCI port
// Bit 0 - 2
// 0 - 115200 baud
// 1 - 57600 baud
// 2 - 38400 baud
// 3 - 19200 baud
// 4 - 9600 baud
// 5 - 4800 baud
// 6 - 2400 baud
// 7 - 1200 baud
//
// Bit 3 is reserved (always = zero)
//
// Bit 4
// 0 - 7 data bit
// 1 - 8 data bit
//
// Bit 5
// 0 - Parity Disabled
// 1 - Parity Enabled
//
// Bit 6
// 0 - Even Parity
// 1 - Odd Parity
//
// Bit 7 is reserved. (always = zero)
//
// Output - nil
//
// Function returns the error code of the result.
//
// ==================================================================
mErrorCode MK_Sci_Open(muint8 index, muint8 config);
// ==================================================================
// MK_Sci_Close() -
//
// To close an session of using of SCI port.
//
//
// Input - index = index of SCI port #. (0, 1, 2...)
//
// Output - nil
//
// Function returns the error code of the result.
//
// ==================================================================
mErrorCode MK_Sci_Close(muint8 index);
// ==================================================================
// MK_Sci_GetStatus() -
//
// To check the current operation status of assigned SCI port.
//
//
// Input - index = index of SCI port #. (0, 1, 2...)
//
// Output - nil
//
// Function returns - a 16-bit number represent the current status
//
// ==================================================================
muint16 MK_Sci_GetStatus(muint8 index);
// ==================================================================
// MK_Sci_SetReadBuffer() -
//
// To write a data block to assigned SCI port.
//
//
// Input - index = index of SCI port #. (0, 1, 2...)
// bufferPtr = pointer to data buffer
// byteCount = how many bytes to receive
// clientHook = client's hook function
//
// Output - nil
//
// Function returns the error code of the result.
//
// ==================================================================
mErrorCode MK_Sci_SetReadBuffer(muint8 index, muint8* bufferPtr,
muint16 byteCount, pHookFunc clientHook);
// ==================================================================
// MK_Sci_WriteData() -
//
// To write a data block to assigned SCI port.
//
//
// Input - index = index of SCI port #. (0, 1, 2...)
// bufferPtr = pointer to data buffer
// byteCount = how many bytes to be sent out
//
// Output - nil
//
// Function returns the error code of the result.
//
// ==================================================================
mErrorCode MK_Sci_WriteData(muint8 index, muint8* bufferPtr, muint16 byteCount);
// ==================================================================
// MK_Debug_ShowPort() -
//
// To display a message to Port B.
//
//
// Input - message = a byte number to shown on Port B
//
// Output - nil
//
// Function returns - nil.
//
// ==================================================================
void MK_Debug_ShowPort(muint8 message);
// ==================================================================
// MK_Debug_Halt() -
//
// To display a message to Port B and halt the system
//
//
// Input - message = a byte number to shown on Port B
//
// Output - nil
//
// Function returns - nil.
//
// ==================================================================
void MK_Debug_Halt(muint16 message);
// ==================================================================
// MK_Debug_StrPrint() -
//
// To send a text message to SCI port. Please be noted that
// the string length should be less than (kMaxSciTxBeffSize/2)
// due to the limitation of the Tx buffer.
//
//
// Input - pMsgString = a pointer to a C string
//
// Output - nil
//
// Function returns the error status.
//
// ==================================================================
mErrorCode MK_Debug_StrPrint(muint8 *pMsgString);
// ==================================================================
// MK_Debug_IntPrint() -
//
// To convert a given integer to text and send to SCI port.
//
//
// Input - shownNum = an 16-bit integer number
//
// Output - nil
//
// Function returns the error status.
//
// ==================================================================
mErrorCode MK_Debug_IntPrint(muint16 shownNum);
//*****************************************************************************
//
// ISRs in this system
//
// ===========================================================
// IsrSciCh0() -
//
// SCI CH#0 interrupt service routine.
//
// ===========================================================
void IsrSciCh0(void);
// ===========================================================
// IsrSciCh1() -
//
// SCI CH#1 interrupt service routine.
//
// ===========================================================
void IsrSciCh1(void);
// ===========================================================
// IsrTimOvfl() -
//
// Timer CH#0 interrupt service routine.
//
//
void IsrModulusOvfl(void);
#endif _H_EXTVARS_ // end of my external variables definition
//
// The end of file mk_extern.h
// *********************************************************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -