?? het_int_01.c
字號:
//*****************************************************************************
// TMS470 Demo - HET Interrupt Sample Program
//
// Program name : HET_INT_01.c associated with HET program HET_INT_01_H.het
//
// Description; This program uses the HET to interrupt the CPU. The
// interrupt in this example flashes the LED bank on the A256 EVM.
//
// *An external 12Mhz XTAL on OSCIN OSCOUT with proper load caps required*
//
// TMS-FET470A256
// -----------------
// /|\| OSCIN|-
// | | | 12MHz
// --|PLLDIS OSCOUT|-
// | |
// >---|ADIN0 HET|---> 10 LEDs
// | |
//
// John Mangino / Lane Westlund
// Texas Instruments, Inc
// May 2005
// Built with IAR Embedded Workbench Version: 4.20A
// A256 EVM
//******************************************************************************
#include <intrinsic.h>
#include "iotms470r1a256.h"
#include "tms470r1a256_bit_definitions.h"
#include "std_het.h"
#include "HET_INT_01_H.h"
__no_init volatile HETPROGRAM0_UN e_HETPROGRAM0_UN @ 0x00800000;
void MemCopy32(unsigned long *dst, unsigned long *src, int bytes);
void HET_CNT_INT();
void HET1_irq_handler();
void main(void)
{
// Set up peripheral registers.
PCR = CLKDIV_1; // ICLK = SYSCLK/4
PCR |= PENABLE; // enable peripherals
REQMASK=(1 << CIM_HET1); // Enable HET Interrupt mask
HETGCR = CLK_MASTER + IGNORE_SUSPEND; // HET Master Mode, Ignore SW BP
// copy HET instructions to HET ram
MemCopy32((void *) &e_HETPROGRAM0_UN, (void *) HET_INIT0_PST, sizeof(HET_INIT0_PST));
HETPRY = 0x01; // enable interrupt for instruction 1
HETPFR = 0x0000052b; // Set PFR register
HETDIR = 0xFFFFFFFF; // Set all HET as GIO outputs
HETDOUT = 0xFFFFFFFF; // Flash all leds off and on and off
HETGCR |= ON; // Start HET
__enable_interrupt(); // Enable Interrupts
while(1);
}
//------------------------------------------------------------------------------
// This module programms the HET RAM with the HET code
//------------------------------------------------------------------------------
void MemCopy32(unsigned long *dst, unsigned long *src, int bytes)
{
for (int i = 0; i < (bytes + 3) / 4; i++)
*dst++ = *src++;
}
//------------------------------------------------------------------------------
// TMS470R1A256 Standard Interrupt Handler
//------------------------------------------------------------------------------
#pragma vector = IRQV
__irq __arm void irq_handler(void)
{
switch((0xff & IRQIVEC)-1)
{
case CIM_HET1 : HET1_irq_handler(); break; // Check for the HET interrupt
}
}
//------------------------------------------------------------------------------
// Flash the LED code
//------------------------------------------------------------------------------
void HET_CNT_INT()
{
HETDOUT ^= 0xFFFFFFFF; // Flash LEDs
}
//------------------------------------------------------------------------------
// HET Interrupt Handler
//------------------------------------------------------------------------------
void HET1_irq_handler()
{
switch((0xff & HETOFF1)-1)
{
case 0 : HET_CNT_INT(); break; // Check which the HET interrupt
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -