?? intc_example3.c
字號:
* The first group includes events 4-31,the second group includes events
* 32-63, the third group includes events 64-95, the fourth group includes
* events 96-127. Events within each group can be combined to provide a new
* combined event. These new events are designated interrupt vector line 4,
* interrupt vector line 5, interrupt vector line 6, interrupt vector line 7
* respectively.
*/
/* For loop to check 4 to 31 interrupts with interrupt vector line 4 */
for (eventId = 4; eventId <32; eventId++) {
/* Open and setup the handler for each eventId*/
vectId = CSL_INTC_VECTID_COMBINE;
hIntc = CSL_intcOpen (&intcObj, (CSL_IntcEventId)eventId, &vectId,
NULL);
EventRecord.handler = (CSL_IntcEventHandler)&eventHandler;
EventRecord.arg = hIntc;
CSL_intcPlugEventHandler(hIntc,&EventRecord);
evtEn = (1<<eventId);
/* Note :- Combined events along with the combiner event all can be
enabled in one API */
intStat = CSL_intcHwControl(hIntc0,CSL_INTC_CMD_EVTENABLE,&evtEn);
if(intStat != CSL_SOK) {
printf("INTR: HwControl to enable event ... Failed.\n");
}
else
printf("INTR: HwControl to enable event ... Passed.\n");
/* Set events manually */
intStat = CSL_intcHwControl(hIntc,CSL_INTC_CMD_EVTSET,NULL);
if(intStat != CSL_SOK) {
printf("INTR: HwControl to set an event ... Failed.\n");
}
else
printf("INTC: HwControl to set an event ... Passed.\n");
}
/* For loop to check 32 to 63 interrupts with interrupt vector line 5 */
for (eventId = 32; eventId <64; eventId++) {
/* Open and setup the handler for each eventId*/
vectId = CSL_INTC_VECTID_COMBINE;
hIntc2 = CSL_intcOpen (&intcObj2, (CSL_IntcEventId)eventId, &vectId,
NULL);
EventRecord.handler = (CSL_IntcEventHandler)&eventHandler;
EventRecord.arg = hIntc2;
CSL_intcPlugEventHandler(hIntc2,&EventRecord);
evtEn = (1<<(eventId-32));
/* Note :- Combined events along with the combiner event all can be
enabled in one API */
intStat = CSL_intcHwControl(hIntc1,CSL_INTC_CMD_EVTENABLE,&evtEn);
if(intStat != CSL_SOK) {
printf("INTR: HwControl to enable event ... Failed.\n");
}
else
printf("INTR: HwControl to enable event ... Passed.\n");
/* Set events manually */
intStat = CSL_intcHwControl(hIntc2,CSL_INTC_CMD_EVTSET,NULL);
if(intStat != CSL_SOK) {
printf("INTR: HwControl to set an event ... Failed.\n");
}
else
printf("INTR: HwControl to set an event ... Passed.\n");
}
/* For loop to check 64 to 95 interrupts with interrupt vector line 6 */
for (eventId = 64; eventId <96; eventId++) {
/* Open and setup the handler for each eventId*/
vectId = CSL_INTC_VECTID_COMBINE;
hIntc4 = CSL_intcOpen (&intcObj4, (CSL_IntcEventId)eventId, &vectId ,
NULL);
EventRecord.handler = (CSL_IntcEventHandler)&eventHandler;
EventRecord.arg = hIntc4;
CSL_intcPlugEventHandler(hIntc4,&EventRecord);
evtEn = (1<<(eventId-64));
/* Note :- Combined events along with the combiner event all can be
enabled in one API */
intStat = CSL_intcHwControl(hIntc3,CSL_INTC_CMD_EVTENABLE,&evtEn);
if(intStat != CSL_SOK) {
printf("INTR: HwControl to enable event ... Failed.\n");
}
else
printf("INTR: HwControl to enable event ... Passed.\n");
/* Set events manually */
intStat = CSL_intcHwControl(hIntc4,CSL_INTC_CMD_EVTSET,NULL);
if(intStat != CSL_SOK) {
printf("INTR: HwControl to set an event ... Failed.\n");
}
else
printf("INTR: HwControl to set an event ... Passed.\n");
}
/* For loop to check 96 to 128 interrupts with interrupt vector line 7 */
for (eventId = 96; eventId <128; eventId++) {
/* Open and setup the handler for each eventId*/
vectId = CSL_INTC_VECTID_COMBINE;
hIntc6 = CSL_intcOpen (&intcObj6, (CSL_IntcEventId)eventId, &vectId ,
NULL);
EventRecord.handler = (CSL_IntcEventHandler)&eventHandler;
EventRecord.arg = hIntc6;
CSL_intcPlugEventHandler(hIntc6,&EventRecord);
evtEn = (1<<(eventId-96));
/* Note :- Combined events along with the combiner event all can be
enabled in one API */
intStat = CSL_intcHwControl(hIntc5,CSL_INTC_CMD_EVTENABLE,&evtEn);
if(intStat != CSL_SOK) {
printf("INTR: HwControl to enable event ... Failed.\n");
}
else
printf("INTR: HwControl to enable event ... Passed.\n");
/* Set events manually */
intStat = CSL_intcHwControl(hIntc6,CSL_INTC_CMD_EVTSET,NULL);
if(intStat != CSL_SOK) {
printf("INTR: HwControl to set an event ... Failed.\n");
}
else
printf("INTR: HwControl to set an event ... Passed.\n");
}
printf("INTR: The Total number of Events occured are: %d\n", evtNum);
/* Closing all handles */
intStat = CSL_intcClose(hIntc);
if (intStat != CSL_SOK) {
printf ("INTR: Close ... Failed.\n");
printf ("\tReason: Intc Close failed. [status = 0x%x].\n", intStat);
}
else {
printf ("INTR: Close ... Passed.\n");
}
intStat = CSL_intcClose(hIntc0);
if (intStat != CSL_SOK) {
printf ("INTR: Close ... Failed.\n");
printf ("\tReason: Intc Close failed. [status = 0x%x].\n", intStat);
}
else {
printf ("INTR: Close ... Passed.\n");
}
intStat = CSL_intcClose(hIntc1);
if (intStat != CSL_SOK) {
printf ("INTR: Close ... Failed.\n");
printf ("\tReason: Intc Close failed. [status = 0x%x].\n", intStat);
}
else {
printf ("INTR: Close ... Passed.\n");
}
intStat = CSL_intcClose(hIntc2);
if (intStat != CSL_SOK) {
printf ("INTR: Close ... Failed.\n");
printf ("\tReason: Intc Close failed. [status = 0x%x].\n", intStat);
}
else {
printf ("INTR: Close ... Passed.\n");
}
intStat = CSL_intcClose(hIntc3);
if (intStat != CSL_SOK) {
printf ("INTR: Close ... Failed.\n");
printf ("\tReason: Intc Close failed. [status = 0x%x].\n", intStat);
}
else {
printf ("INTR: Close ... Passed.\n");
}
intStat = CSL_intcClose(hIntc4);
if (intStat != CSL_SOK) {
printf ("INTR: Close ... Failed.\n");
printf ("\tReason: Intc Close failed. [status = 0x%x].\n", intStat);
}
else {
printf ("INTR: Close ... Passed.\n");
}
intStat = CSL_intcClose(hIntc5);
if (intStat != CSL_SOK) {
printf ("INTR: Close ... Failed.\n");
printf ("\tReason: Intc Close failed. [status = 0x%x].\n", intStat);
}
else {
printf ("INTR: Close ... Passed.\n");
}
intStat = CSL_intcClose(hIntc6);
if (intStat != CSL_SOK) {
printf ("INTR: Close ... Failed.\n");
printf ("\tReason: Intc Close failed. [status = 0x%x].\n", intStat);
}
else {
printf ("INTR: Close ... Passed.\n");
}
}
/*
* =============================================================================
* @func eventHandler
*
* @desc
* This is the intc event handler
*
* @arg event
* Pointer to events
*
*
* @eg
* eventHandler ();
* =============================================================================
*/
void eventHandler (
CSL_IntcEventId *event
)
{
evtNum += 1;
printf("INTR: EVENT Handler for event:%d\n",*event);
CSL_intcEventClear (*event);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -