/**
* \file interrupt.c
*
* \brief Contains DSP interrupt related APIs.
*/
/*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <c6x.h>
#include "interrupt.h"
/******************************************************************************
** INTERNAL DEFINES
******************************************************************************/
#define C674X_NMI 1
#define C674X_GEE 2
#define C674X_XEN 3
#define C674X_INT_COUNT 16
#define NUM_SYS_EVENTS 128
/******************************************************************************
** EXTERNALLY DEFINED FUNCTIONS
******************************************************************************/
#ifdef __TI_EABI__
extern void _intcVectorTable (void);
#else
extern void intcVectorTable (void);
#endif
/******************************************************************************
** STATIC VARIABLES/FUNCTIONS
******************************************************************************/
static c674xISR c674xISRtbl[C674X_INT_COUNT];
static c674xISR c674xECMtbl[NUM_SYS_EVENTS];
static void IntDefaultHandler (void);
static void IntEventCombineIsr0 (void);
static void IntEventCombineIsr1 (void);
static void IntEventCombineIsr2 (void);
static void IntEventCombineIsr3 (void);
static void IntEventCombinerDispatch (unsigned int evtReg);
/******************************************************************************
** API INTERRUPT FUNCTIONS
******************************************************************************/
/**
* \function IntDSPINTCInit
*
* \brief This API is used to setup the DSP Interrupt Controller (INTC)
* and should be called before using the DSP INTC. All CPU
* maskable interrupts will be disabled after calling this API and
* the user should proceed to setup the required interrupts for
* processing.
*
* \param None
*
* \return None
*/
void IntDSPINTCInit (void)
{
unsigned int step = 0;
/* Set ISRs to default "do-nothing" routine */
while(step != C674X_INT_COUNT)
c674xISRtbl[step++] = IntDefaultHandler;
/* Set interrupt service table pointer to the vector table */
#ifdef __TI_EABI__
ISTP = (unsigned int)_intcVectorTable;
#else
ISTP = (unsigned int)intcVectorTable;
#endif
/* Clear pending CPU maskable interrupts (if any) */
ICR = 0xFFF0;
/* Enable NMIE bit to allow CPU maskable interrupts */
IER = (1 << C674X_NMI);
}
/**
* \function IntRegister
*
* \brief Registers an interrupt service routine in the interrupt
* vector table for CPU maskable interrupts, NMI, or
* reserved interrupts.
*
* \param cpuINT - CPU maskable interrupt number (4-15), NMI (1),
* or reserved interrupt (2-3)
* \param userISR - Function pointer to the ISR
*
* \return None
*/
void IntRegister (unsigned int cpuINT, void (*userISR)(void))
{
/* Check the CPU maskable interrupt number */
ASSERT(((cpuINT >= 1) && (cpuINT <= 15)));
/* Assign the user's ISR to the CPU maskable interrupt */
c674xISRtbl[cpuINT] = userISR;
}
/**
* \function IntUnRegister
*
* \brief Unregisters an interrupt.
*
* \param cpuINT - CPU maskable interrupt number (4-15), NMI (1),
* or reserved interrupt (2-3)
*
* \return None
*/
void IntUnRegister (unsigned int cpuINT)
{
/* Check the CPU maskable interrupt number */
ASSERT(((cpuINT >= 1) && (cpuINT <= 15)));
/* Assign the default "do-nothing" routine to the CPU maskable interrupt */
c674xISRtbl[cpuINT] = IntDefaultHandler;
}
/**
* \function IntEventMap
*
* \brief This API maps a system event to a CPU maskable interrupt.
*
* \param cpuINT - CPU maskable interrupt number
* \param sysINT - System event number
*
* \return None
*/
void IntEventMap (unsigned int cpuINT, unsigned int sysINT)
{
unsigned int dspintcREG, restoreVal;
/* Check the CPU maskable interrupt number */
ASSERT(((cpuINT >= 4) && (cpuINT <= 15)));
/* Check the system event number */
ASSERT((sysINT <= 127));
/* Get the address of the correct interrupt mux register */
dspintcREG = SOC_INTC_0_REGS + DSPINTC_INTMUX((cpuINT >> 2));
/* Disable interrupts */
restoreVal = IntGlobalDisable();
/* Clear and set INTSELx with system event number */
HWREG(dspintcREG) = (HWREG(dspintcREG) &
~DSPINTC_INTMUX_INTSEL(cpuINT)) |
(sysINT << DSPINTC_INTMUX_INTSEL_SHIFT(cpuINT));
/* Clear any residual interrupt */
ICR = (1 << cpuINT);
/* Restore interrupts */
IntGlobalRestore(restoreVal);
}
/**
* \function IntEventSet
*
* \brief This API manually sets a system event in the event flag
* register.
*
* \param sysINT - System event number
*
* \return None
*/
void IntEventSet (unsigned int sysINT)
{
unsigned int dspintcREG;
/* Check the system event number */
ASSERT((sysINT <= 127));
/* Get the address of the correct event register */
dspintcREG = SOC_INTC_0_REGS + DSPINTC_EVTSET((sysINT >> 5));
/* Set the corresponding bit within the event flag register */
HWREG(dspintcREG) = DSPINTC_EVTSET_ES(sysINT);
}
/**
* \function IntEventClear
*
* \brief This API clears the system interrupt status in the DSP
* interrupt controller.
*
* \param sysINT - System event number
*
* \return None
*/
void IntEventClear(unsigned int sysINT)
{
unsigned int dspintcREG;
/* Check the system event number */
ASSERT((sysINT <= 127));
/* Get the address of the correct event register */
dspintcREG = SOC_INTC_0_REGS + DSPINTC_EVTCLR((sysINT >> 5));
/* Clear the corresponding bit within the event clear register */
HWREG(dspintcREG) = DSPINTC_EVTCLR_EC(sysINT);
}
/**
* \function IntEventCombineInit
*
* \brief This API removes all system events from the ECM, assigns
* the event ISRs to a default handler, registers the ECM
* ISR to the corresponding CPU interrupt, maps the ECM
* system event to the corresponding CPU interrupt, and
没有合适的资源?快使用搜索试试~ 我知道了~
uart.rar_6748串口_TMS320C6748_c6748 UART_c6748 UARTGets_tms320c67
共73个文件
obj:9个
pp:8个
c:8个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 172 浏览量
2022-09-21
20:54:55
上传
评论 1
收藏 233KB RAR 举报
温馨提示
tms320c6748 串口开发例程,已经调试成功。
资源推荐
资源详情
资源评论
收起资源包目录
uart.rar (73个子文件)
uart
uart.PR 6KB
uart.IAB 224KB
uart.PFI 68B
.launches
uart.launch 7KB
inc
interrupt.c 20KB
rk6748_gpio.h 3KB
test_uart.c 3KB
rk6748.h 63KB
rk6748.c 18KB
intvecs.asm 2KB
types.h 1KB
test_uart.h 639B
test_led.c 3KB
rk6748_timer.h 5KB
rk6748_gpio.c 7KB
rk6748_timer.c 6KB
test_led.h 626B
interrupt.h 38KB
rk6748_uart.c 7KB
uart.PS 398KB
.cdtbuild 8KB
uart.SearchResults 151B
uart.IMB 56KB
uart.IMD 888B
.settings
org.eclipse.core.resources.prefs 301B
org.eclipse.cdt.codan.core.prefs 62B
org.eclipse.cdt.debug.core.prefs 123B
org.eclipse.cdt.managedbuilder.core.prefs 638B
src
main_uart.c 1KB
rk6748_DSP.cmd 2KB
XDS100V2.ccxml 2KB
.project_initial 616B
.project 834B
.cdtbuild_initial 8KB
.cdtproject 677B
.cproject 17KB
.ccsproject 423B
uart.PRI 36KB
uart.PO 776B
Debug
RK6748_AIS.cfg 1KB
sources.mk 2KB
inc
ccsSrcs.opt 171B
rk6748_gpio.obj 9KB
rk6748_timer.pp 267B
rk6748_uart.obj 16KB
subdir_vars.mk 1KB
interrupt.obj 37KB
test_uart.obj 7KB
subdir_rules.mk 4KB
rk6748.obj 22KB
test_led.obj 9KB
rk6748_timer.obj 7KB
rk6748.pp 751B
test_led.pp 899B
rk6748_gpio.pp 259B
intvecs.obj 3KB
test_uart.pp 845B
rk6748_uart.pp 255B
interrupt.pp 572B
uart.out 191KB
uart_linkInfo.xml 130KB
objects.mk 250B
ccsObjs.opt 234B
uart.bin 39KB
src
ccsSrcs.opt 21B
subdir_vars.mk 566B
subdir_rules.mk 786B
main_uart.obj 6KB
main_uart.pp 1005B
makefile 4KB
uart.map 20KB
uart.WK3 38KB
uart.IAD 3KB
共 73 条
- 1
资源评论
周楷雯
- 粉丝: 78
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功