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

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

?? uart.c

?? 飛利浦LM3S系列ARM的庫文件,在進行arm開發時所必須的庫文件,直接加到工程中,一般不必修改.
?? 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 687 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.
//
//*****************************************************************************
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);
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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));
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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);
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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));
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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);
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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);
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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);
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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);
}

//*****************************************************************************
//
//! 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.
//
//*****************************************************************************
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一区二区三区免费野_久草精品视频
国产成人在线色| 国产色一区二区| 欧美精品日韩一区| 欧美日韩一区二区三区四区五区| 色婷婷综合久久久久中文| 色综合久久久久综合| 色8久久精品久久久久久蜜| 色综合色狠狠天天综合色| 99re亚洲国产精品| 一本久久a久久免费精品不卡| 91国偷自产一区二区三区观看| 91色视频在线| 色婷婷激情综合| 在线播放日韩导航| 日韩欧美国产综合在线一区二区三区| 91精品国产色综合久久不卡电影 | 成人av电影观看| jiyouzz国产精品久久| 99精品久久只有精品| 一本大道久久a久久综合| 欧美日韩中文一区| 精品少妇一区二区三区视频免付费 | 黑人巨大精品欧美一区| 国产盗摄女厕一区二区三区| jvid福利写真一区二区三区| a亚洲天堂av| 欧美日韩一级黄| 精品少妇一区二区三区免费观看 | 日韩二区三区四区| 极品少妇一区二区| 成人激情开心网| 欧美乱妇15p| 精品福利视频一区二区三区| 中文字幕欧美日韩一区| 亚洲午夜电影在线观看| 麻豆精品国产传媒mv男同| 成人综合日日夜夜| 欧美日韩一区二区三区高清| 久久综合国产精品| 亚洲少妇30p| 麻豆精品在线观看| 99国产一区二区三精品乱码| 欧美卡1卡2卡| 国产精品少妇自拍| 日本va欧美va精品| 成人国产亚洲欧美成人综合网| 欧亚洲嫩模精品一区三区| 日韩免费视频一区二区| 亚洲欧美区自拍先锋| 久久国产三级精品| 日本丶国产丶欧美色综合| 日韩视频免费观看高清完整版在线观看 | 成人午夜精品一区二区三区| 欧美午夜片在线看| 国产欧美日韩另类视频免费观看| 亚洲一二三区视频在线观看| 国产成人免费视频网站高清观看视频| 欧美色网一区二区| 国产精品美女久久久久av爽李琼| 日本欧美韩国一区三区| 91亚洲精品久久久蜜桃| 久久综合色婷婷| 午夜精品久久久久久| 不卡电影一区二区三区| 欧美一级片免费看| 亚洲综合自拍偷拍| 成人午夜免费电影| 欧美成人免费网站| 午夜不卡av在线| 色屁屁一区二区| 国产精品区一区二区三区| 精品写真视频在线观看| 欧美伊人久久久久久午夜久久久久| 国产网站一区二区| 理论片日本一区| 欧美另类一区二区三区| 伊人色综合久久天天| 成人国产一区二区三区精品| www久久久久| 久久国产视频网| 日韩一区国产二区欧美三区| 亚洲一区二区三区四区的| 91小视频在线| 国产精品久久久久久久久免费相片 | 日韩你懂的电影在线观看| 亚洲午夜国产一区99re久久| 91在线porny国产在线看| 国产精品午夜在线| 国产精品亚洲视频| 久久久久久**毛片大全| 国精产品一区一区三区mba视频| 69久久夜色精品国产69蝌蚪网| 亚洲另类在线制服丝袜| 91影院在线观看| 亚洲视频一区二区在线| www.成人网.com| 国产精品天干天干在线综合| 国产69精品久久久久毛片| 国产日韩精品一区二区三区在线| 九一久久久久久| 欧美草草影院在线视频| 久久精品国产999大香线蕉| 日韩欧美色电影| 久久国内精品自在自线400部| 欧美一级艳片视频免费观看| 美美哒免费高清在线观看视频一区二区 | 欧美三级欧美一级| 污片在线观看一区二区| 欧美一二区视频| 国内精品不卡在线| 欧美国产日韩精品免费观看| 暴力调教一区二区三区| 亚洲三级视频在线观看| 日本电影欧美片| 午夜久久久久久电影| 欧美一区二区三区性视频| 麻豆视频观看网址久久| 欧美精品一区二区精品网| 国产乱人伦偷精品视频免下载| 久久蜜臀中文字幕| 成人一区二区三区在线观看| 综合久久久久久| 欧美色综合久久| 久久精品国产亚洲高清剧情介绍| 国产亚洲一区二区三区在线观看| 成人激情校园春色| 亚洲男同性视频| 日韩亚洲欧美在线| 国产一区二区三区免费| 中文字幕色av一区二区三区| 色婷婷综合在线| 亚洲高清不卡在线观看| 久久久激情视频| 精品久久一区二区三区| 成人综合婷婷国产精品久久蜜臀| 国产精品伦理一区二区| 欧美综合天天夜夜久久| 蜜臀精品久久久久久蜜臀| 久久久久久久久久久电影| 97se亚洲国产综合在线| 日精品一区二区三区| 国产亚洲一本大道中文在线| 日本韩国精品一区二区在线观看| 男男成人高潮片免费网站| 中文一区二区完整视频在线观看 | 久久精品网站免费观看| 色综合视频在线观看| 久久不见久久见中文字幕免费| 国产精品久久99| 5月丁香婷婷综合| 99久久综合狠狠综合久久| 日韩中文字幕亚洲一区二区va在线| 国产色综合久久| 欧美精品777| 99久久综合99久久综合网站| 免费国产亚洲视频| 亚洲欧美另类久久久精品| 日韩一级完整毛片| 99精品桃花视频在线观看| 日本va欧美va瓶| 一区二区三区精品在线| 国产婷婷色一区二区三区在线| 亚洲妇熟xx妇色黄| 高清beeg欧美| 欧美一区二区视频免费观看| 欧美精彩视频一区二区三区| 欧美放荡的少妇| 99久久国产综合精品女不卡| 老司机精品视频一区二区三区| 亚洲另类在线视频| 国产日韩欧美精品综合| 日韩一区二区影院| 欧美性高清videossexo| 成人av在线网站| 国产米奇在线777精品观看| 日韩电影在线观看一区| 亚洲欧美一区二区在线观看| 久久久欧美精品sm网站| 7777精品伊人久久久大香线蕉的 | 日韩1区2区日韩1区2区| 亚洲精品自拍动漫在线| 欧美国产精品中文字幕| 26uuu国产电影一区二区| 欧美日韩国产一区| 日本韩国欧美三级| 99精品在线观看视频| av亚洲精华国产精华精华| 国产乱国产乱300精品| 久久精品国内一区二区三区| 午夜精品福利视频网站| 亚洲夂夂婷婷色拍ww47| 亚洲猫色日本管| 国产精品国产成人国产三级| 久久久久久久久久久久电影| 精品国产乱码久久久久久图片| 这里是久久伊人| 欧美一区二区三区色| 日韩一区二区三区四区| 91精品国产91综合久久蜜臀| 制服丝袜亚洲网站|