Академический Документы
Профессиональный Документы
Культура Документы
This software is proprietary and confidential. By using this software you agree
*********************************************************************************/
/*
*/
#include <platform_include.h> /* System and IOP register bit and address definitions. */
#include "adi_initialize.h"
#include <sru.h>
/* The following definition allows the SRU macro to check for errors. Once the routings have
been verified, this definition can be removed to save some program memory space.
The preprocessor will issue a warning stating this when using the SRU macro without this
definition*/
#define LED1 1
#define LED2 2
#define LED3 4
#define LED4 8
void DAIroutine(void);
void IRQ1_routine(void);
void IRQ2_routine(void);
void handle_LED(int);
void main()
adi_initComponents();
*pSYSCTL |= IRQ1EN|IRQ2EN;
sysreg_bit_set( sysreg_MODE2,IRQ1E|IRQ2E);
adi_int_InstallHandler(ADI_CID_DAIHI,(ADI_INT_HANDLER_PTR )DAIroutine,0,true);
adi_int_InstallHandler(ADI_CID_SPIHI,(ADI_INT_HANDLER_PTR )DAIroutine,0,true);
adi_int_InstallHandler(ADI_CID_IRQ1I,(ADI_INT_HANDLER_PTR ) IRQ1_routine,0,true);
adi_int_InstallHandler(ADI_CID_IRQ2I,(ADI_INT_HANDLER_PTR ) IRQ2_routine,0,true);
/*Pin Assignments in SRU_PIN3 (Group D)*/
SRU(LOW,DAI_PB19_I);
SRU(LOW,DAI_PB20_I);
SRU(DAI_PB19_O,MISCB1_I);
SRU(DAI_PB20_O,MISCB2_I);
SRU(LOW,PBEN19_I);
SRU(LOW,PBEN20_I);
for(;;)
NOP();
}
}
void IRQ1_routine(void)
handle_LED(LED1);
void IRQ2_routine(void)
handle_LED(LED2);
void DAIroutine(void)
interrupt_reg = *pDAI_IRPTL_H;
handle_LED(LED3);
handle_LED(LED4);
*pPPCTL=0;
*pIIPP=(int) &led_value;
*pIMPP=1;
*pICPP=1;
*pEMPP=1;
*pECPP=1;
*pEIPP=0x400000;
*pPPCTL=PPTRAN|PPBHC|PPDUR20|PPDEN|PPEN;