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

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

?? uart.c

?? freertosV4.40 是一種small的嵌入式系統。利于嵌入式開好者入門學習嵌入式操作系統。通過對于源碼的學習可以很好的掌握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
    {
        //

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲高清免费视频| 国产精品三级av| 亚洲图片你懂的| 9久草视频在线视频精品| 国产精品成人在线观看| 91毛片在线观看| 亚洲精品国产一区二区三区四区在线 | 高清国产午夜精品久久久久久| 26uuu欧美日本| 国产精品一品视频| 一色桃子久久精品亚洲| 欧美专区日韩专区| 免费高清不卡av| 国产无一区二区| 色婷婷综合在线| 午夜视频久久久久久| 久久99精品久久久久婷婷| 国产宾馆实践打屁股91| 7777精品伊人久久久大香线蕉 | 日日摸夜夜添夜夜添亚洲女人| 日韩精品一区二区三区蜜臀 | 亚洲午夜激情网站| 日韩欧美另类在线| 成人午夜激情在线| 亚洲高清视频中文字幕| 久久亚洲春色中文字幕久久久| 本田岬高潮一区二区三区| 亚洲综合色区另类av| 精品国产一区二区三区av性色| 99久久免费视频.com| 三级久久三级久久| 国产精品久久久久久久久动漫 | 日韩欧美激情四射| 国产成人a级片| 亚洲国产精品自拍| 国产亚洲综合在线| 欧美日韩视频在线观看一区二区三区 | 欧美日韩国产美| 国产一区二区三区电影在线观看| 亚洲免费在线视频| 久久先锋资源网| 精品视频一区三区九区| 成人国产视频在线观看| 蜜桃av一区二区| 亚洲精品一卡二卡| 国产日韩欧美电影| 日韩三级视频在线观看| 色欧美片视频在线观看| 国产91露脸合集magnet| 欧美aaaaa成人免费观看视频| 成人欧美一区二区三区黑人麻豆| 日韩欧美亚洲另类制服综合在线| 91农村精品一区二区在线| 国内精品在线播放| 免费成人结看片| 一区二区高清在线| 亚洲人成影院在线观看| 国产亚洲欧美日韩日本| 日韩欧美国产一区在线观看| 欧美午夜一区二区三区| 91色九色蝌蚪| 国产福利一区在线观看| 黑人巨大精品欧美一区| 日本在线不卡视频一二三区| 亚洲地区一二三色| 夜夜操天天操亚洲| 亚洲精品一二三四区| 中文字幕制服丝袜一区二区三区| 欧美精品一区二区三区高清aⅴ | 日韩欧美高清dvd碟片| 欧美精品在线观看一区二区| 欧美在线免费观看视频| 色999日韩国产欧美一区二区| 成人免费的视频| 久久疯狂做爰流白浆xx| 亚洲欧美电影院| 中文天堂在线一区| 精品国产第一区二区三区观看体验 | **性色生活片久久毛片| 成人免费在线播放视频| 国产精品久久看| 国产精品视频线看| 1000部国产精品成人观看| 中文字幕一区二区三区不卡在线| 国产日韩欧美精品综合| 国产精品伦理一区二区| 中文字幕在线观看一区| 国产精品无圣光一区二区| 国产精品久久久久永久免费观看 | 欧美大肚乱孕交hd孕妇| 欧美一区二区三区不卡| 精品国产三级电影在线观看| 国产日韩影视精品| 国产精品美女久久久久久久久久久 | 亚洲一区二区三区爽爽爽爽爽| 亚洲欧美国产高清| 亚洲精品成人在线| 亚洲国产美女搞黄色| 日韩av一区二区三区| 久久国产乱子精品免费女| 国模冰冰炮一区二区| www.在线欧美| 欧美日韩成人综合在线一区二区| 日韩亚洲欧美在线观看| 久久精品男人的天堂| 亚洲男人的天堂在线观看| 日韩在线一区二区三区| 丰满白嫩尤物一区二区| 91免费观看在线| 69堂精品视频| 日本一区二区久久| 亚洲国产视频直播| 国产乱码精品一品二品| 色综合久久六月婷婷中文字幕| 欧美四级电影在线观看| 精品国产乱码久久久久久浪潮 | aaa国产一区| 91精品国产综合久久香蕉的特点 | 欧美性受xxxx黑人xyx| 日韩欧美国产三级电影视频| 国产精品乱子久久久久| 婷婷开心久久网| 国产成人aaa| 欧美日本精品一区二区三区| 国产欧美一区二区精品性色 | 国产成人夜色高潮福利影视| 欧美羞羞免费网站| 国产亚洲精品bt天堂精选| 婷婷丁香久久五月婷婷| 成+人+亚洲+综合天堂| 日韩三级高清在线| 中文字幕亚洲电影| 精品一区二区av| 欧美日韩中文字幕精品| 中日韩免费视频中文字幕| 天堂av在线一区| 99re成人精品视频| 精品国内二区三区| 亚洲国产精品天堂| 91在线观看一区二区| 日韩精品综合一本久道在线视频| 亚洲免费在线视频一区 二区| 韩国精品一区二区| 国产精品一区二区在线观看网站| 欧美不卡视频一区| 欧美乱妇23p| 国产精品欧美一级免费| 久久超碰97中文字幕| 欧美日韩精品欧美日韩精品一综合| 久久亚洲一区二区三区四区| 日日欢夜夜爽一区| 91成人免费电影| 国产精品女主播av| 国产另类ts人妖一区二区| 欧美一级欧美一级在线播放| 亚洲观看高清完整版在线观看| a美女胸又www黄视频久久| 2023国产精品| 美腿丝袜亚洲综合| 欧美久久久久久蜜桃| 夜色激情一区二区| 91丨九色丨国产丨porny| 国产精品蜜臀在线观看| 成人免费看的视频| 国产精品嫩草99a| 国产91丝袜在线播放| 久久色成人在线| 黄页网站大全一区二区| 欧美mv日韩mv国产网站app| 麻豆一区二区三| 91精品综合久久久久久| 日韩精品一二三四| 欧美一级片免费看| 香蕉久久夜色精品国产使用方法| 国产天堂亚洲国产碰碰| 欧美成人欧美edvon| 久久99久久久久| 久久亚洲精精品中文字幕早川悠里| 国产综合久久久久影院| 国产三级欧美三级| 成人精品高清在线| 亚洲久草在线视频| 欧美日韩成人在线一区| 另类专区欧美蜜桃臀第一页| 精品国产露脸精彩对白| 国产成人在线视频免费播放| 成人欧美一区二区三区小说| 在线观看免费一区| 久久99久久久欧美国产| 国产午夜亚洲精品午夜鲁丝片| av成人动漫在线观看| 亚洲小说春色综合另类电影| 欧美日韩国产123区| 麻豆成人91精品二区三区| 久久久久久久一区| 91伊人久久大香线蕉| 亚洲成在线观看| 精品国产91九色蝌蚪| av成人免费在线观看| 午夜精品久久久久|