📄 sdk7a404_os_viewc.c
字号:
/***********************************************************************
* $Workfile: sdk7a404_os_viewc.c $
* $Revision: 1.0 $
* $Author: WellsK $
* $Date: Oct 27 2003 10:57:20 $
*
* Project: uCos-II/View driver
*
* Description:
* This driver is ported to the SDK7A404 EVB and is intended to be
* used with uCos/View from Micrium and the SDK7A404 BSP.
*
* Notes on implementation:
* The OS_VIEW_BAUDRATE define in the header file only works with
* bit rates of 9600, 19200, 38400, 57600, and 115200. Using other
* rates will not work.
*
* Notes on resources used in this driver:
* This driver uses one UART and a timer. The UART can be selected
* by defining the UCOSUART macro as UART1, UART2, or UART3. The
* timer can be selected by defining the UCOSTIMER macro as TIMER1,
* TIMER2, or TIMER3. The interrupt driver must be initialized
* prior to this driver being used.
*
* Revision History:
* $Log: //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh7a404/bsps/sdk7a404/ports/ucosii/sdk7a404_os_viewc.c-arc $
*
* Rev 1.0 Oct 27 2003 10:57:20 WellsK
* Initial revision.
*
*
***********************************************************************
* SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
* OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
* AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES,
* SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
*
* SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY
* FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A
* SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
* FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
*
* COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
* CAMAS, WA
**********************************************************************/
#include "sdk7a404_os_viewc.h"
#include "abl_types.h"
#include "lh7a404_vic_driver.h"
#include "lh7a404_timer_driver.h"
#include "lh7a404_uart_driver.h"
/***********************************************************************
* Local defines and variables
**********************************************************************/
/* Name of CPU in uCos/View window */
#define OSCPU_NAME "Sharp LH7A404"
/* UART and interrupt to use for the uCos/View interface */
#define UCOSUART UART2
#define UCOSUART_INT VIC_UART2INTR
/* TIMER and interrupt to use for uCos/View time logging */
#define UCOSTIMER TIMER3
#define UCOSTIMER_INT VIC_TC3UINTR
/* UART device ID */
static INT_32 ucos_uart_dev;
/* Timer device id */
static INT_32 ucos_timer_dev;
/* Pointers to raw UART interrupt status and data registers */
volatile UNS_32 *uartintstatus, *uartdata;
/* Major time counter */
volatile INT32U cnts_major;
/***********************************************************************
* Functions
**********************************************************************/
/***********************************************************************
*
* Function: ucos_mjr_ttick
*
* Purpose: Time management major tick
*
* Processing:
* Increment the major time counter and clear the timer interrupt.
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void ucos_mjr_ttick(void)
{
/* Update major time count */
cnts_major = cnts_major + 0x10000;
/* Clear timer interrupt */
timer_ioctl(ucos_timer_dev, TIMER_INT_CLEAR, 0);
}
/***********************************************************************
*
* Function: OSView_RxIntDis
*
* Purpose: Disable UART receiver interrupts
*
* Processing:
* Disable the UART receive and receive timeout interrupts.
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void OSView_RxIntDis(void)
{
uart_ioctl(ucos_uart_dev, UART_DISABLE_INTS,
(UART_INTR_RI | UART_INTR_RTI));
}
/***********************************************************************
*
* Function: OSView_TxIntDis
*
* Purpose: Disable UART transmit interrupts
*
* Processing:
* Disable the UART transmit interrupt.
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void OSView_TxIntDis(void)
{
uart_ioctl(ucos_uart_dev, UART_DISABLE_INTS, UART_INTR_TI);
}
/***********************************************************************
*
* Function: OSView_RxIntEn
*
* Purpose: Enable UART receiver interrupts
*
* Processing:
* Enable the UART receive and receive timeout interrupts.
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void OSView_RxIntEn(void)
{
uart_ioctl(ucos_uart_dev, UART_ENABLE_INTS,
(UART_INTR_RI | UART_INTR_RTI));
}
/***********************************************************************
*
* Function: OSView_TxIntEn
*
* Purpose: Enable UART transmit interrupts
*
* Processing:
* Enable the UART transmit interrupt.
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void OSView_TxIntEn(void)
{
uart_ioctl(ucos_uart_dev, UART_ENABLE_INTS, UART_INTR_TI);
}
/***********************************************************************
*
* Function: OSView_RxISR
*
* Purpose: UART receive interrupt
*
* Processing:
* None
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes:
* This function is not used. OSView_RxTxISR is used instead.
*
**********************************************************************/
void OSView_RxISR(void)
{
;
}
/***********************************************************************
*
* Function: OSView_TxISR
*
* Purpose: UART transmit interrupt
*
* Processing:
* None
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes:
* This function is not used. OSView_RxTxISR is used instead.
*
**********************************************************************/
void OSView_TxISR(void)
{
;
}
/***********************************************************************
*
* Function: OSView_RxISRHandler
*
* Purpose: UART receive interrupt handler
*
* Processing:
* None
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes:
* This function is not used. OSView_RxTxISRHandler is used instead.
*
**********************************************************************/
void OSView_RxISRHandler(void)
{
;
}
/***********************************************************************
*
* Function: OSView_TxISRHandler
*
* Purpose: UART receive transmit handler
*
* Processing:
* None
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes:
* This function is not used. OSView_RxTxISRHandler is used instead.
*
**********************************************************************/
void OSView_TxISRHandler(void)
{
;
}
/***********************************************************************
*
* Function: OSVIew_RxTxISRHandler
*
* Purpose: Handle the UART receive/transmit interrupt for uCos/View
*
* Processing:
* Check the UART interrupt register. If an interrupt occurred due
* to a received character, read the character and pass it to the
* OSView_RxHandler function. If an interrupt occurred due to a
* completed character transmission, call the OSView_TxHandler
* function.
*
* Parameters: None
*
* Outputs: None
*
* Returns: Nothing
*
* Notes: None
*
**********************************************************************/
void OSVIew_RxTxISRHandler(void)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -