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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? uart.c

?? freertosV4.40 是一種small的嵌入式系統(tǒng)。利于嵌入式開好者入門學(xué)習(xí)嵌入式操作系統(tǒng)。通過對于源碼的學(xué)習(xí)可以很好的掌握freertos的運行機制。
?? C
?? 第 1 頁 / 共 2 頁
字號:
//*****************************************************************************
//
// uart.c - Driver for the UART.
//
// Copyright (c) 2005,2006 Luminary Micro, Inc.  All rights reserved.
//
// Software License Agreement
//
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
// exclusively on LMI's Stellaris Family of microcontroller products.
//
// The software is owned by LMI and/or its suppliers, and is protected under
// applicable copyright laws.  All rights are reserved.  Any use in violation
// of the foregoing restrictions may subject the user to criminal sanctions
// under applicable laws, as well as to civil liability for the breach of the
// terms and conditions of this license.
//
// THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 991 of the Stellaris Driver Library.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup uart_api
//! @{
//
//*****************************************************************************

#include "../hw_ints.h"
#include "../hw_memmap.h"
#include "../hw_types.h"
#include "../hw_uart.h"
#include "debug.h"
#include "interrupt.h"
#include "sysctl.h"
#include "uart.h"

//*****************************************************************************
//
//! Sets the type of parity.
//!
//! \param ulBase is the base address of the UART port.
//! \param ulParity specifies the type of parity to use.
//!
//! Sets the type of parity to use for transmitting and expect when receiving.
//! The \e ulParity parameter must be one of \b UART_CONFIG_PAR_NONE,
//! \b UART_CONFIG_PAR_EVEN, \b UART_CONFIG_PAR_ODD, \b UART_CONFIG_PAR_ONE,
//! or \b UART_CONFIG_PAR_ZERO.  The last two allow direct control of the
//! parity bit; it will always be either be one or zero based on the mode.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_paritymodeset) || defined(BUILD_ALL) || defined(DOXYGEN)
void
UARTParityModeSet(unsigned long ulBase, unsigned long ulParity)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE));
    ASSERT((ulParity == UART_CONFIG_PAR_NONE) ||
           (ulParity == UART_CONFIG_PAR_EVEN) ||
           (ulParity == UART_CONFIG_PAR_ODD) ||
           (ulParity == UART_CONFIG_PAR_ONE) ||
           (ulParity == UART_CONFIG_PAR_ZERO));

    //
    // Set the parity mode.
    //
    HWREG(ulBase + UART_O_LCR_H) = ((HWREG(ulBase + UART_O_LCR_H) &
                                     ~(UART_LCR_H_SPS | UART_LCR_H_EPS |
                                       UART_LCR_H_PEN)) | ulParity);
}
#endif

//*****************************************************************************
//
//! Gets the type of parity currently being used.
//!
//! \param ulBase is the base address of the UART port.
//!
//! \return The current parity settings, specified as one of
//! \b UART_CONFIG_PAR_NONE, \b UART_CONFIG_PAR_EVEN, \b UART_CONFIG_PAR_ODD,
//! \b UART_CONFIG_PAR_ONE, or \b UART_CONFIG_PAR_ZERO.
//
//*****************************************************************************
#if defined(GROUP_paritymodeget) || defined(BUILD_ALL) || defined(DOXYGEN)
unsigned long
UARTParityModeGet(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE));

    //
    // Return the current parity setting.
    //
    return(HWREG(ulBase + UART_O_LCR_H) &
           (UART_LCR_H_SPS | UART_LCR_H_EPS | UART_LCR_H_PEN));
}
#endif

//*****************************************************************************
//
//! Sets the configuration of a UART.
//!
//! \param ulBase is the base address of the UART port.
//! \param ulBaud is the desired baud rate.
//! \param ulConfig is the data format for the port (number of data bits,
//! number of stop bits, and parity).
//!
//! This function will configure the UART for operation in the specified data
//! format.  The baud rate is provided in the \e ulBaud parameter and the
//! data format in the \e ulConfig parameter.
//!
//! The \e ulConfig parameter is the logical OR of three values: the number of
//! data bits, the number of stop bits, and the parity.  \b UART_CONFIG_WLEN_8,
//! \b UART_CONFIG_WLEN_7, \b UART_CONFIG_WLEN_6, and \b UART_CONFIG_WLEN_5
//! select from eight to five data bits per byte (respectively).
//! \b UART_CONFIG_STOP_ONE and \b UART_CONFIG_STOP_TWO select one or two stop
//! bits (respectively).  \b UART_CONFIG_PAR_NONE, \b UART_CONFIG_PAR_EVEN,
//! \b UART_CONFIG_PAR_ODD, \b UART_CONFIG_PAR_ONE, and \b UART_CONFIG_PAR_ZERO
//! select the parity mode (no parity bit, even parity bit, odd parity bit,
//! parity bit always one, and parity bit always zero, respectively).
//!
//! The baud rate is dependent upon the system clock rate returned by
//! SysCtlClockGet(); if it does not return the correct system clock rate then
//! the baud rate will be incorrect.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_configset) || defined(BUILD_ALL) || defined(DOXYGEN)
void
UARTConfigSet(unsigned long ulBase, unsigned long ulBaud,
              unsigned long ulConfig)
{
    unsigned long ulUARTClk, ulInt, ulFrac;

    //
    // Check the arguments.
    //
    ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE));

    //
    // Stop the UART.
    //
    UARTDisable(ulBase);

    //
    // Determine the UART clock rate.
    //
    ulUARTClk = SysCtlClockGet();

    //
    // Compute the fractional baud rate divider.
    //
    ulInt = ulUARTClk / (16 * ulBaud);
    ulFrac = ulUARTClk % (16 * ulBaud);
    ulFrac = ((((2 * ulFrac * 4) / ulBaud) + 1) / 2);

    //
    // Set the baud rate.
    //
    HWREG(ulBase + UART_O_IBRD) = ulInt;
    HWREG(ulBase + UART_O_FBRD) = ulFrac;

    //
    // Set parity, data length, and number of stop bits.
    //
    HWREG(ulBase + UART_O_LCR_H) = ulConfig;

    //
    // Clear the flags register.
    //
    HWREG(ulBase + UART_O_FR) = 0;

    //
    // Start the UART.
    //
    UARTEnable(ulBase);
}
#endif

//*****************************************************************************
//
//! Gets the current configuration of a UART.
//!
//! \param ulBase is the base address of the UART port.
//! \param pulBaud is a pointer to storage for the baud rate.
//! \param pulConfig is a pointer to storage for the data format.
//!
//! The baud rate and data format for the UART is determined.  The returned
//! baud rate is the actual baud rate; it may not be the exact baud rate
//! requested or an ``official'' baud rate.  The data format returned in
//! \e pulConfig is enumerated the same as the \e ulConfig parameter of
//! UARTConfigSet().
//!
//! The baud rate is dependent upon the system clock rate returned by
//! SysCtlClockGet(); if it does not return the correct system clock rate then
//! the baud rate will be computed incorrectly.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_configget) || defined(BUILD_ALL) || defined(DOXYGEN)
void
UARTConfigGet(unsigned long ulBase, unsigned long *pulBaud,
              unsigned long *pulConfig)

{
    unsigned long ulInt, ulFrac;

    //
    // Check the arguments.
    //
    ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE));

    //
    // Compute the baud rate.
    //
    ulInt = HWREG(ulBase + UART_O_IBRD);
    ulFrac = HWREG(ulBase + UART_O_FBRD);
    *pulBaud = (SysCtlClockGet() * 4) / ((64 * ulInt) + ulFrac);

    //
    // Get the parity, data length, and number of stop bits.
    //
    *pulConfig = (HWREG(ulBase + UART_O_LCR_H) &
                  (UART_LCR_H_SPS | UART_LCR_H_WLEN | UART_LCR_H_STP2 |
                   UART_LCR_H_EPS | UART_LCR_H_PEN));
}
#endif

//*****************************************************************************
//
//! Enables transmitting and receiving.
//!
//! \param ulBase is the base address of the UART port.
//!
//! Sets the UARTEN, TXE, and RXE bits, and enables the transmit and receive
//! FIFOs.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_enable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
UARTEnable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE));

    //
    // Enable the FIFO.
    //
    HWREG(ulBase + UART_O_LCR_H) |= UART_LCR_H_FEN;

    //
    // Enable RX, TX, and the UART.
    //
    HWREG(ulBase + UART_O_CTL) |= (UART_CTL_UARTEN | UART_CTL_TXE |
                                   UART_CTL_RXE);
}
#endif

//*****************************************************************************
//
//! Disables transmitting and receiving.
//!
//! \param ulBase is the base address of the UART port.
//!
//! Clears the UARTEN, TXE, and RXE bits, then waits for the end of
//! transmission of the current character, and flushes the transmit FIFO.
//!
//! \return None.
//
//*****************************************************************************
#if defined(GROUP_disable) || defined(BUILD_ALL) || defined(DOXYGEN)
void
UARTDisable(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE));

    //
    // Wait for end of TX.
    //
    while(HWREG(ulBase + UART_O_FR) & UART_FR_BUSY)
    {
    }

    //
    // Disable the FIFO.
    //
    HWREG(ulBase + UART_O_LCR_H) &= ~(UART_LCR_H_FEN);

    //
    // Disable the UART.
    //
    HWREG(ulBase + UART_O_CTL) &= ~(UART_CTL_UARTEN | UART_CTL_TXE |
                                    UART_CTL_RXE);
}
#endif

//*****************************************************************************
//
//! Determines if there are any characters in the receive FIFO.
//!
//! \param ulBase is the base address of the UART port.
//!
//! This function returns a flag indicating whether or not there is data
//! available in the receive FIFO.
//!
//! \return Returns \b true if there is data in the receive FIFO, and \b false
//! if there is no data in the receive FIFO.
//
//*****************************************************************************
#if defined(GROUP_charsavail) || defined(BUILD_ALL) || defined(DOXYGEN)
tBoolean
UARTCharsAvail(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE));

    //
    // Return the availability of characters.
    //
    return((HWREG(ulBase + UART_O_FR) & UART_FR_RXFE) ? false : true);
}
#endif

//*****************************************************************************
//
//! Determines if there is any space in the transmit FIFO.
//!
//! \param ulBase is the base address of the UART port.
//!
//! This function returns a flag indicating whether or not there is space
//! available in the transmit FIFO.
//!
//! \return Returns \b true if there is space available in the transmit FIFO,
//! and \b false if there is no space available in the transmit FIFO.
//
//*****************************************************************************
#if defined(GROUP_spaceavail) || defined(BUILD_ALL) || defined(DOXYGEN)
tBoolean
UARTSpaceAvail(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE));

    //
    // Return the availability of space.
    //
    return((HWREG(ulBase + UART_O_FR) & UART_FR_TXFF) ? false : true);
}
#endif

//*****************************************************************************
//
//! Receives a character from the specified port.
//!
//! \param ulBase is the base address of the UART port.
//!
//! Gets a character from the receive FIFO for the specified port.
//!
//! \return Returns the character read from the specified port, cast as a
//! \e long.  A \b -1 will be returned if there are no characters present in
//! the receive FIFO.  The UARTCharsAvail() function should be called before
//! attempting to call this function.
//
//*****************************************************************************
#if defined(GROUP_charnonblockingget) || defined(BUILD_ALL) || defined(DOXYGEN)
long
UARTCharNonBlockingGet(unsigned long ulBase)
{
    //
    // Check the arguments.
    //
    ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE));

    //
    // See if there are any characters in the receive FIFO.
    //
    if(!(HWREG(ulBase + UART_O_FR) & UART_FR_RXFE))
    {
        //
        // Read and return the next character.
        //
        return(HWREG(ulBase + UART_O_DR));
    }
    else
    {
        //

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人在线免费| 亚洲欧美在线视频| 91免费视频观看| 粉嫩一区二区三区在线看| 久久国产人妖系列| 美国欧美日韩国产在线播放| 日本中文一区二区三区| 色一情一乱一乱一91av| 91蝌蚪国产九色| av网站免费线看精品| zzijzzij亚洲日本少妇熟睡| 成人av网站大全| 色欲综合视频天天天| 在线国产电影不卡| 欧美久久免费观看| 精品欧美一区二区在线观看| 精品成a人在线观看| 国产调教视频一区| 自拍av一区二区三区| 亚洲影视在线播放| 蜜臀91精品一区二区三区| 老司机精品视频一区二区三区| 九九九久久久精品| 国产精品一卡二| 色偷偷久久人人79超碰人人澡| 欧美日韩视频在线第一区| 日韩欧美第一区| 国产精品色哟哟| 亚洲午夜久久久久中文字幕久| 亚洲精品国产精品乱码不99 | 亚洲一区免费观看| 亚洲国产精品久久久久婷婷884| 日韩综合一区二区| 国产一区二区毛片| 在线欧美日韩精品| 久久亚洲影视婷婷| 亚洲一区免费在线观看| 国产又粗又猛又爽又黄91精品| fc2成人免费人成在线观看播放| 欧美久久久久久蜜桃| 中文字幕av一区 二区| 亚洲一区二区三区视频在线播放 | 午夜免费久久看| 国产精品99久久久久| 欧美三级中文字幕在线观看| 久久综合一区二区| 亚洲精品国产一区二区三区四区在线 | 亚洲欧美国产三级| 日韩av中文字幕一区二区 | 自拍偷拍亚洲欧美日韩| 蜜臀av一区二区| 欧美日本一区二区在线观看| 国产欧美综合色| 久久99精品一区二区三区三区| 99国内精品久久| 国产日韩av一区| 看片的网站亚洲| 欧美久久久久久久久久| 国产精品久久久久一区二区三区 | 亚洲自拍欧美精品| 成人小视频免费观看| 欧美成人一区二区三区片免费 | 精品免费99久久| 午夜电影久久久| 欧美三级日韩三级国产三级| 欧美国产日韩精品免费观看| 免费一区二区视频| 欧美日韩第一区日日骚| 亚洲综合在线第一页| 国产精品一区二区不卡| 精品国产一区二区精华| 丝袜a∨在线一区二区三区不卡| 色综合欧美在线视频区| xnxx国产精品| 国内久久精品视频| 久久久精品蜜桃| 国产不卡在线视频| 日本一区二区三区四区| 丁香激情综合五月| 久久久91精品国产一区二区三区| 美女视频一区二区三区| 欧美三日本三级三级在线播放| 亚洲欧洲无码一区二区三区| 99精品视频在线免费观看| 久久久久国产一区二区三区四区 | 国产欧美一区二区精品仙草咪 | 一区二区三区不卡视频| 欧美综合一区二区| 视频一区视频二区中文| 欧美一激情一区二区三区| 韩国av一区二区三区在线观看| 欧美精品一区二区三区高清aⅴ| 国产一区二区中文字幕| 国产精品久久久久aaaa| 在线免费观看一区| 青草av.久久免费一区| 精品国产免费一区二区三区四区| 国产制服丝袜一区| 国产精品美女久久福利网站| 色婷婷综合五月| 欧美aⅴ一区二区三区视频| 欧美精品一区二区不卡| 99久久99久久综合| 日韩一区精品字幕| 国产精品免费视频网站| 欧美在线观看一二区| 精品一区二区日韩| 亚洲人成伊人成综合网小说| 这里只有精品视频在线观看| 国产成人亚洲综合色影视| 亚洲综合成人网| 国产视频一区二区在线观看| 欧美在线观看你懂的| 国产美女娇喘av呻吟久久| 一区二区三区国产豹纹内裤在线| 3751色影院一区二区三区| 丁香一区二区三区| 日本在线不卡视频一二三区| 久久久久久久性| 欧美三级午夜理伦三级中视频| 国产一区二区精品在线观看| 亚洲一区二区三区自拍| 亚洲国产精品传媒在线观看| 欧美日韩高清一区二区不卡| 9久草视频在线视频精品| 蜜臂av日日欢夜夜爽一区| 亚洲欧美一区二区久久| 2023国产精品自拍| 欧美乱熟臀69xxxxxx| 91在线你懂得| 福利视频网站一区二区三区| 琪琪一区二区三区| 亚洲综合色成人| 亚洲欧洲日韩综合一区二区| 久久综合色8888| 日韩精品一区国产麻豆| 欧美亚洲动漫精品| 99国产精品国产精品久久| 国产精品乡下勾搭老头1| 丝袜美腿亚洲色图| 亚洲国产日韩综合久久精品| 亚洲视频在线观看一区| 欧美高清在线一区二区| 国产亚洲精品7777| 久久综合久色欧美综合狠狠| 精品裸体舞一区二区三区| 日韩欧美一级片| 日韩三级视频在线看| 在线成人av网站| 欧美电影在哪看比较好| 欧美精品自拍偷拍动漫精品| 欧美这里有精品| 在线观看免费视频综合| 日本韩国欧美一区| 在线观看日韩av先锋影音电影院| 97精品超碰一区二区三区| 99久久伊人网影院| 色噜噜久久综合| 欧美自拍偷拍午夜视频| 欧美日韩不卡一区二区| 91精品国产免费久久综合| 日韩欧美在线网站| 日韩美女在线视频| 国产日韩欧美综合在线| 中文字幕亚洲综合久久菠萝蜜| 国产精品高潮久久久久无| 亚洲人成网站影音先锋播放| 亚洲精品国产成人久久av盗摄 | 日韩精品一区二区三区中文不卡| 91麻豆精品91久久久久久清纯| 日韩女优毛片在线| 久久久精品国产免大香伊| 国产精品久久影院| 性做久久久久久久久| 久久er精品视频| aaa亚洲精品一二三区| 欧美人牲a欧美精品| 久久午夜电影网| 亚洲黄色av一区| 欧美aaaaaa午夜精品| 成人精品鲁一区一区二区| 日本黄色一区二区| 精品少妇一区二区| 中文字幕在线不卡视频| 午夜影院久久久| 国产iv一区二区三区| 欧美色老头old∨ideo| 精品精品国产高清a毛片牛牛| 国产精品视频免费| 免费成人在线网站| av网站免费线看精品| 日韩欧美一区二区在线视频| 中文一区一区三区高中清不卡| 亚洲日穴在线视频| 色综合咪咪久久| 亚洲精品伦理在线| 成人av在线影院| 亚洲男人的天堂在线aⅴ视频| 日韩欧美一二三四区| 欧美一区二区大片|