📄 consol.h
字号:
/**************************************************************************
* *
* PROJECT : ARM port for uC/OS-II *
* *
* MODULE : CONSOL.h *
* *
* AUTHOR : Michael Anburaj *
* URL : http://geocities.com/michaelanburaj/ *
* EMAIL: michaelanburaj@hotmail.com *
* *
* SPONSORS : Thanks to Martin Li (mli00@yahoo.com) & Don Williams *
* (donw@clearblu.net) for sponsoring hardware. *
* *
* PROCESSOR : LPC210x (32 bit ARM7TDMI-S RISC core from Philips) *
* *
* TOOL-CHAIN : SDT 2.51, ADS 1.2 or GCC *
* *
* DESCRIPTION : *
* External interface & Module configuration header for CONSOL. *
* *
**************************************************************************/
#ifndef __CONSOL_H__
#define __CONSOL_H__
#include "frmwrk_cfg.h"
#include "def.h"
#ifdef __cplusplus
extern "C" {
#endif
/* ********************************************************************* */
/* Module configuration */
/* ********************************************************************* */
/* Interface macro & data definition */
/* ********************************************************************* */
/* Interface function definition */
/*
*********************************************************************************************
* CONSOL_Init
*
* Description: This routine initializes the consol port by setting its baud rate & FIFO
* buffer.
*
* Arguments : hwBaudVal - Baud value corresponding to the Baud Rate in bit/sec.
* bFifoFlag - FIFO
* True - FIFO enabled.
* False - FIFO disabled.
*
* Return : none.
*
* Note(s) : Before calling this, CONSOL_Select needs to be called for selecting the consol
* port.
*********************************************************************************************
*/
void CONSOL_Init(U16 hwBaudVal, U8 bFifoFlag);
#if (INCLUDE_CONSOL1 == 1)
/*
*********************************************************************************************
* CONSOL1_Init
*
* Description: This routine initializes the consol port by setting its baud rate & FIFO
* buffer.
*
* Arguments : hwBaudVal - Baud value corresponding to the Baud Rate in bit/sec.
* bFifoFlag - FIFO
* True - FIFO enabled.
* False - FIFO disabled.
*
* Return : none.
*
* Note(s) : Before calling this, CONSOL_Select needs to be called for selecting the consol
* port.
*********************************************************************************************
*/
void CONSOL1_Init(U16 hwBaudVal, U8 bFifoFlag);
#endif
/*
*********************************************************************************************
* CONSOL_GetCh
*
* Description: This routine waits for a character from the CONSOL port & returns it.
*
* Arguments : none.
*
* Return : Returns the character read from the consol port.
*
* Note(s) :
*********************************************************************************************
*/
char CONSOL_GetCh(void);
/*
*********************************************************************************************
* CONSOL_GetChar
*
* Description: This routine reads a character from the consol port if available.
*
* Arguments : pbData - Pointer to return the received data.
*
* Return : The status of the RX buffer.
* True - Data returned is valid.
* False - Data returned is invalid.
*
* Note(s) :
*********************************************************************************************
*/
char CONSOL_GetChar(char * pbData);
/*
*********************************************************************************************
* CONSOL_GetString
*
* Description: This routine waits for a string from the CONSOL port & returns it.
*
* Arguments : pbString - Pointer to return the received string.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL_GetString(char *pbString);
#if (INCLUDE_CONSOL1 == 1)
/*
*********************************************************************************************
* CONSOL1_GetCh
*
* Description: This routine waits for a character from the CONSOL port & returns it.
*
* Arguments : none.
*
* Return : Returns the character read from the consol port.
*
* Note(s) :
*********************************************************************************************
*/
char CONSOL1_GetCh(void);
/*
*********************************************************************************************
* CONSOL1_GetChar
*
* Description: This routine reads a character from the consol port if available.
*
* Arguments : pbData - Pointer to return the received data.
*
* Return : The status of the RX buffer.
* True - Data returned is valid.
* False - Data returned is invalid.
*
* Note(s) :
*********************************************************************************************
*/
char CONSOL1_GetChar(char * pbData);
/*
*********************************************************************************************
* CONSOL1_GetString
*
* Description: This routine waits for a string from the CONSOL1 port & returns it.
*
* Arguments : pbString - Pointer to return the received string.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL1_GetString(char *pbString);
#endif
/*
*********************************************************************************************
* CONSOL_GetIntNum
*
* Description: This routine waits for a Integer from the CONSOL port & returns it.
*
* Arguments : none.
*
* Return : Returns the received Integer value.
*
* Note(s) :
*********************************************************************************************
*/
int CONSOL_GetIntNum(void);
/*
*********************************************************************************************
* CONSOL_SendCh
*
* Description: This routine waits till the character is sent. It also sends an extra carriage
* return character when sending a new line character
*
* Arguments : bData - Data to be sent.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL_SendCh(char bData);
/*
*********************************************************************************************
* CONSOL_SendChar
*
* Description: This routine waits till the character is sent.
*
* Arguments : bData - Data to be sent.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL_SendChar(char bData);
/*
*********************************************************************************************
* CONSOL_SendString
*
* Description: This routine waits till the string is sent.
*
* Arguments : pbString - String to be sent.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL_SendString(char *pbString);
#if (INCLUDE_CONSOL1 == 1)
/*
*********************************************************************************************
* CONSOL1_SendCh
*
* Description: This routine waits till the character is sent. It also sends an extra carriage
* return character when sending a new line character
*
* Arguments : bData - Data to be sent.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL1_SendCh(char bData);
/*
*********************************************************************************************
* CONSOL1_SendChar
*
* Description: This routine waits till the character is sent.
*
* Arguments : bData - Data to be sent.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL1_SendChar(char bData);
/*
*********************************************************************************************
* CONSOL1_SendString
*
* Description: This routine waits till the string is sent.
*
* Arguments : pbString - String to be sent.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL1_SendString(char *pbString);
#endif
/*
*********************************************************************************************
* CONSOL_PrintNum
*
* Description: This routine is a special printf for numbers only.
*
* Arguments : pbString - String to be sent.
*
* Return : bBase - Number base.
* bNoDigits - Number of digits printed.
* bSign - Sign flag.
* wNum - Number to print.
*
* Note(s) :
* see formatting information below
* Print the number 'n' in the given 'bBase' using exactly 'bNoDigits'
* print +/- if signed flag 'bSign' is TRUE
* use the character specified in 'bPad' to pad extra characters
*********************************************************************************************
*/
void CONSOL_PrintNum(U8 bBase, U8 bNoDigits, U8 bSign, char bPad, S32 wNum);
/*
*********************************************************************************************
* CONSOL_vPrintData
*
* Description: This routine prints the hex data through the CONSOL port.
*
* Arguments : pbData - Pointer to data.
* hwLen - Data length.
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL_vPrintData(U8 *pbData, U16 hwLen);
#if (CONSOL_VARARG == 1)
/*
*********************************************************************************************
* CONSOL_Scanf
*
* Description: Reads input from the consol stream, under control of the string pointed to by
* format that specifies the admissible input sequences and how they are to be
* converted for assignment, using subsequent arguments as pointers to the
* objects to receive the converted input. If there are insufficient arguments
* for the format, the behavior is undefined. If the format is exhausted while
* arguments remain, the excess arguments are ignored.
*
* Arguments : pcFmt - Format string. It can contain only the following format specifiers:
* %s - String.
* %c - character.
* %i - Integer.
* ... - Are the passed parameters (pointers to the objects to receive the
* converted input).
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL_Scanf(char *pcFmt,...);
/*
*********************************************************************************************
* CONSOL_Printf
*
* Description: Writes output to the consol stream, under control of the string pointed to by
* format that specifies how subsequent arguments are converted for output. If
* there are insufficient arguments for the format, the behavior is undefined.
* If the format is exhausted while arguments remain, the excess arguments are
* ignored.
*
* Arguments : pcFmt - Format string. It can contain all the format specifies.
* ... - Are the passed parameters (pointers to the objects to receive the
* converted input).
*
* Return : none.
*
* Note(s) :
*********************************************************************************************
*/
void CONSOL_Printf(char *pcFmt,...);
#endif /* (CONSOL_VARARG == 1) */
/* ********************************************************************* */
#ifdef __cplusplus
}
#endif
#endif /*__CONSOL_H__*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -