亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? consol.c

?? 請把uCosII的文件放到Core文件夾下。 共有三個任務
?? C
字號:
/**************************************************************************
*                                                                         *
*   PROJECT     : ARM port for UCOS-II                                    *
*                                                                         *
*   MODULE      : CONSOL.c                                                *
*                                                                         *
*   AUTHOR      : Michael Anburaj                                         *
*                 URL  : http://geocities.com/michaelanburaj/             *
*                 EMAIL: michaelanburaj@hotmail.com                       *
*                                                                         *
*   PROCESSOR   : EP7312 (32 bit ARM720T RISC core from CIRRUS Logic)     *
*                                                                         *
*   IDE         : SDT 2.51 & ADS 1.2                                      *
*                                                                         *
*   DESCRIPTION :                                                         *
*   This is the CONSOL Driver module. Supports multiple RS232 console     *
*   interfaces.                                                           *
*                                                                         *
**************************************************************************/


#include "def.h"
#include "ep7312.h"
#include "consol.h"
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>


/* ********************************************************************* */
/* Global definitions */


/* ********************************************************************* */
/* File local definitions */

static int __wChannel=1;

#define __isalpha(c) (c >'9')
#define __isupper(c) !(c & 0x20)


/* ********************************************************************* */
/* Local functions */


/* ********************************************************************* */
/* Global functions */

/*
*********************************************************************************************
*                                       CONSOL_Select
*
* Description: This routine selects the consol port for active usage.
*
* Arguments  : wCh - UART channel number.
*                    1 - UART1.
*                    2 - UART2.
*
* Return     : none.
*
* Note(s)    : 
*********************************************************************************************
*/

void CONSOL_Select(int wCh)
{
        __wChannel = wCh;
}

/*
*********************************************************************************************
*                                       CONSOL_Init
*
* Description: This routine initializes the consol port by setting its baud rate & FIFO
*              buffer.
*
* Arguments  : wBaud     - Baud Rate in bit/sec.
*              bFifoFlag - FIFO flag.
*                          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(int wBaud,U8 bFifoFlag)
{
        if(__wChannel == 1)
        {
                rUBRLCR1 = ((0x03<<17)|(bFifoFlag<<16)|((115200*2)/wBaud-1));
                rSYSCON1 |= (0x01<<8);
        }
        else
        {
                rUBRLCR2 = ((0x03<<17)|(bFifoFlag<<16)|((115200*2)/wBaud-1));
                rSYSCON2 |= (0x01<<8);
        }
}

/*
*********************************************************************************************
*                                       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)
{
        if(__wChannel == 1)
        {
                while(rSYSFLG1 & (0x01<<22));
                return rUARTDR1;
        }
        else
        {
                while(rSYSFLG2 & (0x01<<22));
                return rUARTDR2;
        }
}

/*
*********************************************************************************************
*                                       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)
{
        if(__wChannel==1)
        {
                if((rSYSFLG1 & (0x01<<22)) == 0x00)
                {
                        *pbData = rUARTDR1;
                        return True;
                }
                return False;
        }
        else
        {
                if((rSYSFLG2 & (0x01<<22)) == 0x00)
                {
                        *pbData = rUARTDR2;
                        return True;
                }
                return False;
        }
}

/*
*********************************************************************************************
*                                       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)
{
        char *pbString2=pbString;
        char bC;

        while((bC=CONSOL_GetCh())!='\r')
        {
                if(bC=='\b')
                {
                        if((int)pbString2<(int)pbString){CONSOL_Printf("\b \b");pbString--;}
                }
                else
                {
                        *pbString++=bC;CONSOL_SendCh(bC);
                }
        }
        *pbString='\0';
        CONSOL_SendCh('\n');
}

/*
*********************************************************************************************
*                                       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)
{
        char abStr[30];
        char *pbString=abStr;
        int wBase=10;
        int wMinus=0;
        int wLastIndex;
        int wResult=0;
        int wI;
        
        CONSOL_GetString(pbString);
        
        if(pbString[0]=='-'){wMinus=1;pbString++;}
        
        if(pbString[0]=='0' && (pbString[1]=='x' || pbString[1]=='X'))
        {
                wBase=16;
                pbString+=2;
        }
        
        wLastIndex=strlen(pbString)-1;
        if( pbString[wLastIndex]=='h' || pbString[wLastIndex]=='H' )
        {
                wBase=16;
                pbString[wLastIndex]=0;
                wLastIndex--;
        }

        if(wBase==10)
        {
                wResult=atoi(pbString);
                wResult=wMinus ? (-1*wResult):wResult;
        }
        else
        {
                for(wI=0; wI<=wLastIndex; wI++)
                {
                        if(__isalpha(pbString[wI]))
                        {
                                if(__isupper(pbString[wI]))
                                        wResult=(wResult<<4)+pbString[wI]-'A'+10;
                                else
                                        wResult=(wResult<<4)+pbString[wI]-'a'+10;
                        }
                        else
                        {
                                wResult=(wResult<<4)+pbString[wI]-'0';
                        }
                }
                wResult=wMinus ? (-1*wResult):wResult;
        }
        return wResult;
}

/*
*********************************************************************************************
*                                       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)
{
        if(__wChannel == 1)
        {
                while(rSYSFLG1 & (0x01<<23)); //Wait until THR is empty.
//                Delay(4);
                rUARTDR1 = bData;
        }
        else
        {
                while(rSYSFLG2 & (0x01<<23)); //Wait until THR is empty.
//                Delay(4);
                rUARTDR2 = bData;
        }        
}

/*
*********************************************************************************************
*                                       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)
{
        if(bData == '\n')
        {
                CONSOL_SendChar('\r');
        }

        CONSOL_SendChar(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)
{
        while(*pbString)CONSOL_SendCh(*pbString++);
}

/*
*********************************************************************************************
*                                       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,...)
{
        va_list pArg;
        char cChar;
        int *pwInt;
        char *pbChar;
        
        va_start(pArg, pcFmt);
        while((cChar=*pcFmt++) != '\0')
        {
                if(cChar != '%')continue;
                switch(*pcFmt)
                {
                        case 's':
                        case 'S':
                                pbChar = va_arg (pArg, char *);
                                CONSOL_GetString(pbChar);
                                break;
                        case 'i':
                        case 'I':
                                pwInt = va_arg (pArg, int *);
                                *pwInt = CONSOL_GetIntNum();
                                break;
                        case 'c':
                        case 'C':
                                pbChar = va_arg (pArg, char *);
                                *pbChar = CONSOL_GetCh();
                                break;
                }
        }
        va_end(pArg);
}

/*
*********************************************************************************************
*                                       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,...)
{
        va_list ap;
        char pbString[256];

        va_start(ap,pcFmt);
        vsprintf(pbString,pcFmt,ap);
        CONSOL_SendString(pbString);
        va_end(ap);
}

/* ********************************************************************* */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产毛片aaaaa无费看| 51精品视频一区二区三区| 成人免费毛片片v| 欧美日韩一区国产| 国产欧美日韩精品a在线观看| 玉米视频成人免费看| 国产精品亚洲人在线观看| 欧美日韩精品免费观看视频| 成人免费视频在线观看| 国产一区不卡在线| 日韩一区二区三区三四区视频在线观看 | 久久久国产精品麻豆| 一区二区三区电影在线播| 国产精品一区二区久久不卡| 欧美一级片在线观看| 亚洲激情网站免费观看| 国产99久久精品| 日韩免费视频线观看| 天天操天天综合网| 欧美优质美女网站| 亚洲免费资源在线播放| 99视频精品在线| 欧美国产精品一区二区三区| 国产一区在线不卡| 精品美女一区二区| 久久av资源网| 精品久久久久久久一区二区蜜臀| 日韩**一区毛片| 欧美精品在线视频| 午夜精品福利一区二区蜜股av| 欧洲精品一区二区| 26uuuu精品一区二区| 精品综合免费视频观看| 欧美日韩国产高清一区| 亚洲一级二级在线| 在线视频国内自拍亚洲视频| 亚洲色大成网站www久久九九| 丁香婷婷综合色啪| 国产精品麻豆久久久| 99久久精品国产网站| 亚洲视频一区二区在线观看| 色综合网色综合| 亚洲影院理伦片| 在线成人av影院| 蜜桃av一区二区在线观看| 欧美成人一区二区三区片免费| 蜜桃久久av一区| 国产欧美一区二区三区在线老狼| 成人少妇影院yyyy| 亚洲免费在线视频一区 二区| 色先锋久久av资源部| 伊人夜夜躁av伊人久久| 欧美日韩精品欧美日韩精品一 | 精品亚洲aⅴ乱码一区二区三区| 日韩欧美电影在线| 福利一区二区在线观看| 中文字幕佐山爱一区二区免费| 欧洲精品视频在线观看| 免费成人在线观看视频| 欧美极品另类videosde| 91福利视频在线| 久久av老司机精品网站导航| 欧美国产日韩a欧美在线观看| 色综合视频一区二区三区高清| 午夜a成v人精品| 国产肉丝袜一区二区| 91老师片黄在线观看| 蜜臀精品久久久久久蜜臀| 国产日本欧美一区二区| 欧美日韩不卡视频| 国产成人免费网站| 无码av免费一区二区三区试看| 久久综合九色综合97婷婷女人| 色偷偷久久人人79超碰人人澡| 欧美a级理论片| 亚洲乱码中文字幕综合| 亚洲精品一区二区三区蜜桃下载| 91猫先生在线| 精彩视频一区二区| 亚洲在线视频免费观看| 国产日韩综合av| 日韩美女视频在线| 在线观看网站黄不卡| 国产精品一区三区| 日韩不卡手机在线v区| 亚洲免费在线播放| 国产欧美一区二区精品性色超碰| 欧美精品久久99| 在线免费不卡电影| 北条麻妃一区二区三区| 国产在线一区观看| 奇米一区二区三区av| 亚洲永久精品国产| 亚洲柠檬福利资源导航| 久久精品一区二区| 日韩免费观看2025年上映的电影| 欧美在线一区二区三区| av不卡免费电影| 粉嫩av亚洲一区二区图片| 精品无人区卡一卡二卡三乱码免费卡| 亚洲国产精品自拍| 亚洲综合在线免费观看| 亚洲欧洲无码一区二区三区| 国产蜜臀av在线一区二区三区| 日韩丝袜情趣美女图片| 欧美一区二区视频网站| 欧美精品在欧美一区二区少妇| 91网站在线观看视频| 99国产精品久久久久久久久久久 | 三级成人在线视频| 亚洲一二三四区| 亚洲国产婷婷综合在线精品| 一区二区免费看| 亚洲精选一二三| 亚洲综合一区在线| 亚洲成人资源在线| 日韩高清不卡在线| 蜜臀av性久久久久蜜臀av麻豆| 免费三级欧美电影| 麻豆精品国产91久久久久久| 精品视频1区2区3区| 国产精品三级在线观看| 久久亚洲捆绑美女| 国产网红主播福利一区二区| 久久精品人人做人人综合 | 国产欧美日韩在线观看| 欧美精品一区二区三区蜜臀| 26uuu欧美日本| 国产三级精品三级在线专区| 国产精品麻豆网站| 亚洲精品日韩专区silk| 午夜精品免费在线观看| 热久久国产精品| 国产美女精品人人做人人爽| 国产成人精品免费在线| 99riav久久精品riav| 欧美三级电影在线看| 日韩精品一区二区三区四区视频 | 欧美视频一区在线| 欧美一区午夜精品| 欧美国产日韩在线观看| 一区二区国产盗摄色噜噜| 日本一区中文字幕| 不卡的电影网站| 欧美日韩在线亚洲一区蜜芽| 欧美成人精品福利| 国产精品久久久久久亚洲毛片 | 99riav一区二区三区| 成人国产精品视频| 欧美在线影院一区二区| 欧美成人精品二区三区99精品| 国产日韩av一区二区| 亚洲影院免费观看| 国产精品综合二区| 欧美日韩一区二区三区高清| 精品国产伦一区二区三区观看体验 | 国产精品视频一二| 亚洲最新视频在线观看| 国产自产高清不卡| 在线视频一区二区三区| 久久亚洲精华国产精华液| 亚洲日本va在线观看| 久久精品国产一区二区| 日本视频一区二区三区| 视频一区二区中文字幕| 国产a视频精品免费观看| 欧美午夜精品久久久久久孕妇| 久久久久久久久久电影| 亚洲精品美腿丝袜| 国产成人综合视频| 欧美一级精品大片| 一区二区三区不卡视频| 成人免费视频国产在线观看| 日韩一区二区在线播放| 亚洲激情男女视频| 成人少妇影院yyyy| 久久久精品人体av艺术| 日韩激情av在线| 欧美日韩一二三区| 亚洲精品免费在线| av亚洲精华国产精华| 国产欧美一二三区| 国产一区二区三区日韩| 欧美一区二区三区免费在线看 | 日本在线播放一区二区三区| 色8久久精品久久久久久蜜| 国产精品你懂的在线欣赏| 国产乱码精品一品二品| 日韩欧美亚洲一区二区| 亚洲a一区二区| 精品视频在线看| 亚洲第一综合色| 欧美日韩亚洲综合| 亚洲午夜视频在线| 欧美在线观看视频一区二区| 一区二区三区日韩精品| 91久久精品一区二区三| 一区二区成人在线视频| 欧美在线观看18| 婷婷开心激情综合|