⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inthandler.c

📁 M16C瑞萨平台
💻 C
字号:
/*
 * Copyright (c) 2007 EISLAB - Lulea University of Technology.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. 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.
 * 3. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
 *
 * This file is part of the eisplatform project.
 *
 */

/**
 *  The only function implemented in the following code is INT1_ISR() and it sets 
 *  the semaphore on interrupt. 
*/

#include "hardware.h"
#include "inthandler.h"
#include "sema.h"

extern I2CLocalStatus;
extern I2CGlobalStatus;
extern I2CMessageSetup;
 
extern RV_8564ram[];  

int ACK_IS_SET=0;
int ACK;

 

void UndefinedInstruction_ISR(void)
{
    /*add your code here*/
}
void Overflow_ISR(void)
{
    /*add your code here*/
}
void BRK_Instruction_ISR(void)
{
    /*add your code here*/
}
void AddressMatch_ISR(void)
{
    /*add your code here*/
}
void SingleStep_ISR(void)
{
    /*add your code here*/
}
void WatchdogTimer_ISR(void)
{
    /*add your code here*/
}
void DBC_ISR(void)
{
    /*add your code here*/
}
void NMI_ISR(void)
{
    /*add your code here*/
}
void BRK_ISR(void)
{
    /*add your code here*/
}
void INT3_ISR(void)
{
    /*add your code here*/
}
void TimerB5_ISR(void)
{
    /*add your code here*/
}
void TimerB4_ISR(void)
{
    /*add your code here*/
}
void TimerB3_ISR(void)
{
    /*add your code here*/
}
void SI04_INT5_ISR(void)
{
    /*add your code here*/
}
void SI03_INT4_ISR(void)
{
 
}
void BUS_COLLISION_ISR(void)
{
	 
	TwinkleLedP27();
		
////	unsigned int n;

////    if ( U2SMR.BIT.BBS ){       // Is the bus currently busy? DETERMINE this is a Start or Stop interrupt
////    	U2SMR3.BYTE = 0x02;		// CKPH = 1, all others 0 for now
		
//        if ( (I2CLocalStatus.MsgFormat <= 1) || (I2CLocalStatus.NumOfMsg > 1) ){    // Start or restart?
// this is a 'true start' condition
//            I2CLocalStatus.Bytes2Send = I2CLocalStatus.NumOfBytesMsgOne;// Load #bytes to local counter
//            I2CLocalStatus.MsgPtr = I2CLocalStatus.MsgBufOne;       	// load pointer to current message
						                    
////           i2c_enable_rx();	// Transfer/Receive enable// u2c1 = 0x05;
////	       U2SMR4.BYTE=0x00;// STSPSEL = 0,Cancel start condition	

////           U2TB.WORD = ( 0x0100 | Msg4Trans);   		// LSB '1' of high byte will release the bus for slave
//    		u2rb = 0x00;						                    	// Arbitration lost flag clear
//    		I2CLocalStatus.NumOfMsg--;          						// Decrement message number
//    		return;
//    	}
//    	else{                                                                        // This is a 'restart' condition
//            I2CLocalStatus.Bytes2Send = I2CLocalStatus.NumOfBytesMsgTwo;// Reset counter to new msg length
//            I2CLocalStatus.MsgPtr = I2CLocalStatus.MsgBufTwo;       	// Reset pointer to current message
//            if ( (I2CLocalStatus.MsgFormat == MstRdWr) || (I2CLocalStatus.MsgFormat == MstWrRd) ){ 	// If format changes, then flip Rd/Wr flag
//                I2CLocalStatus.RdWrFlg = ~I2CLocalStatus.RdWrFlg;
//            }
//    		u2smr4 = 0x00;						                    	// STSPSEL = 0 (SI/O output sel) (cancel Re-Start condition)
//            u2tb = ( 0x0100 | I2CLocalStatus.SlaveAddrMsgTwo);   		// LSB '1' of high byte will release the bus for slave
//    		u2rb = 0x00;						                    	// Arbitration lost flag clear
//    		I2CLocalStatus.NumOfMsg--;          						// Decrement message number
//    		return;
//    	}
////    }
	
////    else{                                                                           //  BBS not set, This is a 'stop' condition
////        U2SMR3.BYTE = 0x00;		// CKPH = 0, all others 0 for now
////        U2SMR4.BYTE = 0x00;						        	// STSPSEL = 0 (SI/O output sel) cancels stop condition
//        I2CGlobalStatus.I2CBusBusy = FALSE;          	// Return bus state to non-busy...

//    	if ( (I2CLocalStatus.MsgFormat == MstWr) || (I2CLocalStatus.MsgFormat == MstRdWr) || (I2CLocalStatus.MsgFormat == MstWrWr) ){
//			for (n = 1; n < I2CLocalStatus.NumOfBytesMsgOne; n++){
//	    		display_data1(MessageBuffer1[n]);
//			}
//		}
//		else if ( (I2CLocalStatus.MsgFormat == MstRd) || (I2CLocalStatus.MsgFormat == MstWrRd) || (I2CLocalStatus.MsgFormat == MstRdRd) ){
//			for (n = 0; n < I2CLocalStatus.NumOfBytesMsgTwo-1; n++){
//	    		display_data2(MessageBuffer2[n]);
//			}
//		}
////	}
	/*Bus collision detection:During I2C mode,  a start condition or a stop condition detection constitutes
	the factor of an interrupt.*/
}//end of interrupt function


void DMA0_ISR(void)
{
    /*add your code here*/
}
void DMA1_ISR(void)
{
    /*add your code here*/
}
void KeyInput_ISR(void)
{
    /*add your code here*/
}
void AD_CONVERTER_ISR(void)
{
    /*add your code here*/
}
void UART2_transmit_ISR(void)        /*************************** This is a subroutine for I2C bus S2 Nacknowledge ***********************/
{
    ACK_IS_SET = 1;
	ACK = 1;
 
	/*add your code here*/
}
void UART2_recv_ISR(void)           /*************************** This is a subroutine for I2C bus  S2 Acknowledge ***********************/
{
	
	
	
   	ACK_IS_SET = 1;// Semaphore for ACK interrupt.
 	ACK = 0;
	
	TwinkleLedP26();
	
//   	static int NumofRcvMsg=0;
//     	NumofRcvMsg++;	
//      if(NumofRcvMsg<18){  U2TB.WORD= ( 0x0100 | RV_8564ram[NumofRcvMsg]);  }
	 
	
//	idle();

	
/*	THIS is a restart condition generation for successive transmission
 if ( NumofMsg< 17 ){
	  i2c_restart();
  }
*/

 //	switch(NumofRcvMsg){
		
 //		case 1: U2TB.WORD=( 0x0100 | 0x01); break;
 //		case 2: U2TB.WORD=( 0x0100 | RV_8564ram[3]);break;
 //		
 //		default:  ;
 // 
 //		} 
	/*add your code here*/
}
void UART0_transmit_ISR(void)
{
    /*add your code here*/
}
void UART0_recv_ISR(void)
{
    /*add your code here*/
}
void UART1_transmit_ISR(void)
{
	
    /*add your code here*/
}
void UART1_recv_ISR(void)
{
    /*add your code here*/
}
void TimerA0_ISR(void)
{
    /*add your code here*/
}
void TimerA1_ISR(void)
{
    /*add your code here*/
}
void TimerA2_ISR(void)
{
    /*add your code here*/
}
void TimerA3_ISR(void)
{
    /*add your code here*/
}
void TimerA4_ISR(void)
{
    /*add your code here*/
}
void TimerB0_ISR(void)
{
    /*add your code here*/
}
void TimerB1_ISR(void)
{
    /*add your code here*/
}
void TimerB2_ISR(void)
{
    /*add your code here*/
}
void INT0_ISR(void)
{
	static int SecCount=0;
	SecCount++;
	
    if(SecCount%160==0) 
	ACK_IS_SET=1;
 // TwinkleLedP26();
    /*add your code here*/
}


void INT1_ISR(void)
{
 
#if (MULLE_BOARD == MULLEv1)
  sema_set(INT1_SEM);			/* Signal semaphore */                           
#endif
 
	
}


void INT2_ISR(void)
{	
 
 	TwinkleLedP26(); 
    /*add your code here*/
}
void SoftwareInt32_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt33_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt34_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt35_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt36_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt37_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt38_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt39_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt40_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt41_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt42_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt43_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt44_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt45_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt46_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt47_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt48_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt49_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt50_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt51_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt52_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt53_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt54_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt55_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt56_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt57_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt58_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt59_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt60_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt61_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt62_ISR(void)
{
    /*add your code here*/
}
void SoftwareInt63_ISR(void)
{
    /*add your code here*/
}

⌨️ 快捷键说明

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