Beispiel #1
0
// LED4
static ADI_INT_HANDLER(Timer0_ISR) {

	// See if this is a timer 0 event, by calling a function to
	// read corresponding bit (16) in the the SIC_ISR register

	if (adi_int_SICInterruptAsserted(ADI_INT_TIMER0) == ADI_INT_RESULT_NOT_ASSERTED)
	
	// This return value tells the interrupt manager to process the next
	// ISR in the chain for this IVG, because we haven't yet serviced the 
	// peripheral that interrupted this time

 		return (ADI_INT_RESULT_NOT_PROCESSED);	

	// clear timer 0 interupt
	adi_tmr_GPControl(ADI_TMR_GP_TIMER_0, ADI_TMR_GP_CMD_CLEAR_INTERRUPT, NULL);
		
	// toggle the specified LED
	// ON|ON|ON		
	if(button0 && button1 && button2){
		ezToggleLED(EZ_FIRST_LED);        // LED4,5,6 BLINK
	}

 	//***CODE SNIPPED****//
	
	return (ADI_INT_RESULT_PROCESSED);
	
}
Beispiel #2
0
static ADI_INT_HANDLER ( RTCHandler )
{

    ADI_INT_HANDLER_RESULT  Result;             /* return code */
	int                     i;                  /* counter */
	u16                     LocalISTAT;         /* local copy of ISTAT */
	ADI_RTC_REGISTER        *pCacheRegister;    /* pointer to cached register */
	ADI_RTC_CALLBACK_ENTRY  *pCallbackEntry;    /* callback entry */
	
	/* IF (RTC is asserting an interrupt) */
	if (adi_int_SICInterruptAsserted(ADI_INT_RTC) == ADI_INT_RESULT_ASSERTED) {
    	
        /* read the interrupt status register */
        LocalISTAT = *ADI_RTC_ADDRESS_ISTAT;
    	
        /* IF (the service had register writes pending and they indeed completed) */
        if (RTC.WritesPendingFlag && (LocalISTAT & ADI_RTC_BIT_WRITE_COMPLETE)) {
            
            /* clear writes pending flag */
            RTC.WritesPendingFlag = FALSE;
                        
            /* FOR (each cache register) */
            for (i = 0, pCacheRegister = &RTC.Register[0]; i < ADI_RTC_CACHE_REGISTER_COUNT; i++, pCacheRegister++) {
                
                /* IF (this register was being written) */
                if (pCacheRegister->WritePendingFlag) {
                    
                    /* IF (the register is dirty again) */
                    if (pCacheRegister->DirtyFlag) {
                        
                        /* write the new value to the RTC register */
                        if (pCacheRegister->MMRWidth == 16) {
                            *((volatile u16 *)pCacheRegister->pMMRAddress) = pCacheRegister->Value;
                        } else {
                            *((volatile u32 *)pCacheRegister->pMMRAddress) = pCacheRegister->Value;
                        }
                        
                        /* set writes pending flag */
                        RTC.WritesPendingFlag = TRUE;
                        
                        /* clear the dirty flag */
                        pCacheRegister->DirtyFlag = FALSE;
                        
                    /* ELSE */
                    } else {
                        
                        /* clear write pending */
                        pCacheRegister->WritePendingFlag = FALSE;
                        
                    /* ENDIF */
                    }
                    
                /* ENDIF */
                }
                
            /* ENDFOR */
            }
            
        /* ENDIF */
        }
        
        /* IF (we have client callbacks) */
        if (RTC.ClientCallbackCount) {
        	
        	/* FOR (each potential event in ISTAT) */
            for (i = 0, pCallbackEntry = RTC.CallbackEntry; i < ADI_RTC_MAX_EVENTS; i++, pCallbackEntry++ ) {

                /* IF (ISTAT is indicating the event triggered) */
                if (LocalISTAT & RTCEventIDToMask[i]) {
                
                    /* IF (we have a callback installed for that event) */
                    if (pCallbackEntry->ClientCallback) {
                    
                        /* execute the callback */
                        if (pCallbackEntry->DCBHandle) {
                            adi_dcb_Post(pCallbackEntry->DCBHandle, 0, pCallbackEntry->ClientCallback, pCallbackEntry->ClientHandle, (i + ADI_RTC_EVENT_START + 1), NULL);
                        } else {
                            (pCallbackEntry->ClientCallback)(pCallbackEntry->ClientHandle, (i + ADI_RTC_EVENT_START + 1), NULL);
                        }
                    
                    /* ENDIF */
                    }
                
                /* ENDIF */
                }
            
            /* ENDFOR */
            }
            
        /* ENDIF */
        }

        /* clear all pending events */
        *ADI_RTC_ADDRESS_ISTAT = LocalISTAT;

        /* indicate the interrupt was for us */
        Result = ADI_INT_RESULT_PROCESSED;
        
    /* ELSE */
    } else {
        
        /* indicate the interrupt was not for us */
        Result = ADI_INT_RESULT_NOT_PROCESSED;
        
    /* ENDIF */
    }

    /* return */
    return(Result);
}