uiser.c

来自「基于EP7312的MP3播放器源代码,包括MCU和PC端代码.」· C语言 代码 · 共 126 行

C
126
字号
//****************************************************************************//// UISER.C - User interface using a serial port.//// Copyright (c) 2000,2001 Cirrus Logic, Inc.////****************************************************************************#include "../hwport.h"#include "../hwdefs.h"//****************************************************************************//// Only include this file if the serial port is being used for the user// interface.////****************************************************************************#ifdef UI_IS_SERIAL_PORT//****************************************************************************//// SerialSendString sends a string to the serial port.////****************************************************************************static voidSerialSendString(char *pcString){    volatile unsigned long *pulPtr = (unsigned long *)HwBaseAddress;    //    // Send the string character by character.    //    while(*pcString)    {        //        // Wait until there is space available in the transmit FIFO.        //        while(pulPtr[HwStatus >> 2] & HwStatusUartTxFifoFull)        {        }        //        // Write the next character to the transmit FIFO.        //        pulPtr[HwUartData >> 2] = *pcString++;    }    //    // Wait until the serial port transmit is not busy.    //    while(pulPtr[HwStatus >> 2] & HwStatusUartTxBusy)    {    }}//****************************************************************************//// UIEnable initializes the user interface.////****************************************************************************voidUIEnable(void){    volatile unsigned long *pulPtr = (unsigned long *)HwBaseAddress;    //    // Configure the serial port for 115,200, 8-N-1.    //    pulPtr[HwUartControl >> 2] = HwUartControlFifoEnable |                                 HwUartControlDataLength8 |                                 HwUartControlRate115200;    //    // Enable the serial port.    //    pulPtr[HwControl >> 2] |= HwControlUartEnable;}//****************************************************************************//// UIDisable shuts down the user interface.////****************************************************************************voidUIDisable(void){    volatile unsigned long *pulPtr = (unsigned long *)HwBaseAddress;    //    // Disable the serial port.    //    pulPtr[HwControl >> 2] &= ~HwControlUartEnable;}//****************************************************************************//// UIRequestUpdate displays a message telling the user to update the player// software.////****************************************************************************voidUIRequestUpdate(void){    //    // Send a message to the serial port.    //    SerialSendString("\rThe player software needs to be updated.");}//****************************************************************************//// UIUpdate displays a message on the LCD telling the user that an update is// in progress.////****************************************************************************voidUIUpdate(void){    //    // Send a message to the serial port.    //    SerialSendString("\r                                        ");    SerialSendString("\rUpdating              ");}#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?