Dave,
i am using code of irq_measure,and try to make changes where i need
“adl_irqSubscribe && adl_extintSubscribe” has been subscribed,but i don’t know why the “handler” MyExtIntIrqHandler is not executing…(i mean code inside handler is not executing…)
can’t i run it in debug mode whenever i tried to do so it gives me error…
with best regards
i am also posting whole code
const u16 wm_apmCustomStackSize = 1024*3;
const u32 wm_apmIRQLowLevelStackSize = 2048;
const u32 wm_apmIRQHighLevelStackSize = 1024;
/***************************************************************************/
/* Local variables */
/***************************************************************************/
// TODO: Configure TCU Time period, in ms
#define TIME_PERIOD 500
// TODO: Configure EXTINT pin
#define IRQ_INPUT_PIN 0
// TODO: Configure GPIO OUTPU pin
#define GPIO_OUTPUT_PIN 20
// TODO: Configure processing time
#define IRQ_PROCESSING_TIME 20
// TODO: Configure max loop
#define MAX_LOOP 350000
// Interrupt handles
static s32 MyExtIntIrqHandle ;
// TCU service handle
//static s32 MyTCUHandle = ERROR;
// ExtInt service handle
static s32 MyExtIntHandle = ERROR;
// GPIO service handle
static s32 MyGPIOHandle = ERROR;
// ExtInt settings
static adl_extintConfig_t irq_ExtIntSettings;
// ExtInt Capabilities
static adl_extintCapabilities_t irq_ExtIntCapabilities;
// EXTINT Interrupts counter
static u32 irq_EXTINTCounter = 0;
/***************************************************************************/
/* Local functions */
/***************************************************************************/
/****************************************************************************/
/* Function : MyExtIntIrqHandler */
/*--------------------------------------------------------------------------*/
/* Scope : ADL Interrupt service low level handler */
/* */
/* Return : TRUE to enable High level handler notification */
/* FALSE to disable High level handler notification */
/* */
/*--------------------+---+---+---------------------------------------------*/
/* Variable Name |IN |OUT| Use */
/*--------------------+---+---+---------------------------------------------*/
/* Source | X | | Interrupt source identifier */
/*--------------------+---+---+---------------------------------------------*/
/* NotificationLevel | X | | Handler notification level */
/*--------------------+---+---+---------------------------------------------*/
/* Data | X | X | Interrupt event data structure */
/*--------------------+---+---+---------------------------------------------*/
/****************************************************************************/
static bool MyExtIntIrqHandler ( adl_irqID_e Source, adl_irqNotificationLevel_e NotificationLevel, adl_irqEventData_t * Data )
{
// WARNING: low level execution context
adl_atSendResponse ( ADL_AT_UNS, "\r\n i am in interrupt handlers \r\n" );
// Increase counter
irq_EXTINTCounter++;
adl_extintInfo_t * pData = (adl_extintInfo_t*)Data->SourceData;
TRACE (( 1, "Entering EXTINT interrupt handler (notified %d times)", irq_EXTINTCounter ));
if (pData->PinState)
adl_atSendResponse ( ADL_AT_UNS, "\r\n interrupt 1 handlers \r\n" );
else
adl_atSendResponse ( ADL_AT_UNS, "\r\n interrupt 0 handlers \r\n" );
return FALSE;
}
/***************************************************************************/
/* Function : adl_main */
/*-------------------------------------------------------------------------*/
/* Object : Customer application initialisation */
/* */
/*-------------------------------------------------------------------------*/
/* Variable Name |IN |OUT|GLB| Utilisation */
/*--------------------+---+---+---+----------------------------------------*/
/* InitType | | | | Application start mode reason */
/*--------------------+---+---+---+----------------------------------------*/
/***************************************************************************/
void adl_main ( adl_InitType_e InitType )
{
TRACE (( 1, "IRQ Measure Application: Main" ));
adl_atSendResponse ( ADL_AT_UNS, "\r\nIRQ Measure Application: Main.\r\n" );
// Interrupt handler definition
MyExtIntIrqHandle = adl_irqSubscribe ( MyExtIntIrqHandler, ADL_IRQ_NOTIFY_LOW_LEVEL, 1, 0 );
TRACE (( 1, "Interrupt handlers subscriptions: Extint %d ", MyExtIntIrqHandle ));
if(MyExtIntIrqHandle>=0)
adl_atSendResponse ( ADL_AT_UNS, "Interrupt subscriptions is successful \r\n " );
else
adl_atSendResponse ( ADL_AT_UNS, "Interrupt subscriptions is not successful \r\n " );
//MyTCUIrqHandle = adl_irqSubscribe ( MyTCUIrqHandler, ADL_IRQ_NOTIFY_LOW_LEVEL, 0, 0 );
//TRACE (( 1, "Interrupt handlers subscriptions: TCU %d ", MyTCUIrqHandle ));
TRACE (( 1, "Application context diagnostic: %X", adl_ctxGetDiagnostic() ));
// Get ExtInt Capabilties
adl_extintGetCapabilities( &irq_ExtIntCapabilities );
// Set ExtInt signal sentivity
//irq_ExtIntSettings.Sensitivity = ADL_EXTINT_SENSITIVITY_RISING_EDGE;
irq_ExtIntSettings.Sensitivity = ADL_EXTINT_SENSITIVITY_FALLING_EDGE;;
if ( !irq_ExtIntCapabilities.FallingEdgeSensitivity )
{
adl_atSendResponse ( ADL_AT_UNS, "\r\nWarning ADL_EXTINT_SENSITIVITY_RISING_EDGE not supported.\r\n" );
}
// Set ExtInt Filter parameters
irq_ExtIntSettings.Filter = ADL_EXTINT_FILTER_BYPASS_MODE;
irq_ExtIntSettings.FilterDuration = 0;
TRACE (( 1, "DebounceMode : available %d DebounceNbStep %d", irq_ExtIntCapabilities.DebounceMode , irq_ExtIntCapabilities.DebounceNbStep ));
// Check if debounce filter is available
if ( ( irq_ExtIntCapabilities.DebounceMode ) && ( irq_ExtIntCapabilities.DebounceNbStep >= 1 ) )
{
irq_ExtIntSettings.Filter = ADL_EXTINT_FILTER_DEBOUNCE_MODE;
irq_ExtIntSettings.FilterDuration = 1;
adl_atSendResponse ( ADL_AT_UNS, "\r\ndebounceMode is OK.\r\n" );
}
else
{
adl_atSendResponse ( ADL_AT_UNS, "\r\nWarning ADL_EXTINT_FILTER_DEBOUNCE_MODE not supported.\r\n" );
}
// Subscribe to start/stop command if all is OK for IRQ subscription
if ( ( MyExtIntIrqHandle >= OK ) )
{
adl_atSendResponse ( ADL_AT_UNS, "\r\n MyExtIntIrqHandle is OK .\r\n" );
// Subscribe to the ExtInt service
MyExtIntHandle = adl_extintSubscribe ( IRQ_INPUT_PIN, MyExtIntIrqHandle, 0, &irq_ExtIntSettings );
if(MyExtIntHandle>=0)
adl_atSendResponse ( ADL_AT_UNS, "\r\n MyExtIntHandle is OK .\r\n" );
else
adl_atSendResponse ( ADL_AT_UNS, "\r\n MyExtIntHandle is not OK .\r\n" );
TRACE (( 1, "Subscribe to ExtInt (%d): %d", IRQ_INPUT_PIN, MyExtIntHandle ));
}
else if ( ( MyExtIntIrqHandle == ADL_RET_ERR_NOT_SUPPORTED ) )
{
// Feature not enabled
adl_atSendResponse ( ADL_AT_UNS, "\r\nInit Failed; Real Time enhancement feature not enabled.\r\n" );
}
}