The code is as follows... how to solve this issue? ... i am trying to set the port interrupt in the code to verify if the code works and executes the interrupt....
U32 looper;
S32 retError;
U32 lsbMPC;
U32 megaframe[] = {0x23,0x34,0x54,0x65};
U32 *trial = (U32*)mem;
U32 doorbelldata = 0x0;
U32 counter = 0x1000;
//////////////////////////////////
volatile U32 index, dummy_cnt;
U8 lsu_no;
CSL_SrioContext context;
CSL_Status status;
CSL_SrioHandle hSrio;
CSL_SrioObj srioObj;
CSL_InstNum srioNum = 0; /* Instance number of the SRIO */
CSL_SrioParam srioParam;
CSL_SrioDirectIO_ConfigXfr lsu_conf = {0};
CSL_SrioDirectIO_ConfigXfr lsu_conf1 = {0};
CSL_SrioPortData response;
CSL_IntcObj intcObj;
CSL_IntcHandle hIntc;
CSL_IntcGlobalEnableState state;
CSL_IntcEventHandlerRecord EventRecord;
CSL_IntcContext icontext;
CSL_IntcParam vectid = CSL_INTC_VECTID_4;
CSL_IntcEventId eventId = CSL_INTC_EVENTID_GPINT12;
CSL_IntcEventEnableState prevstate;
//////////////////////////////////
void (*x)(void) = c_int00;
printf("%x\n",x);
*trial = 0x0450;
/* ------- Set up PLL: set core clock to 1G HZ ----- */
printf("Initializing PLL1...");
InitPll(1);
printf("Done\n");
/*------- Test 1: setup / test GPIO ----------*/
printf("Testing GPIO, blink GREEN/RED led three times...");
TestGpio();
//TurnOnRedLed();
printf("Done\n");
/*--------- Init DDR2 ---------*/
printf("Init DDR2 memory...");
InitDdr2();
printf("Done\n");
/*--------- Interrupt setup ----------*/
// prevstate = CSL_intcEventEnable(eventId);
EventRecord.handler = &event63Handler;
EventRecord.arg = hIntc;
icontext.numEvtEntries = 0; /* number of events handled by intc */
icontext.eventhandlerRecord = &EventRecord;
status = CSL_intcInit(&icontext);
if(status != CSL_SOK){
return;
}
// CSL_intcGlobalNmiEnable();
CSL_intcGlobalEnable(&state);
hIntc = CSL_intcOpen(&intcObj,eventId,&vectid,NULL);
status = CSL_intcPlugEventHandler(hIntc,&EventRecord);
prevstate = CSL_intcEventEnable(eventId);
//returnVal = CSL_intcInterrupEnable(vectid1);
/*--------- Srio Config --------*/
#if 0
/* Unlock the powersaver control register */
CSL_FINST (((CSL_DevRegs*)CSL_DEV_REGS)->PERLOCK, DEV_PERLOCK_LOCKVAL, UNLOCK);
/* Enable the SRIO */
CSL_FINST (((CSL_DevRegs*)CSL_DEV_REGS)->PERCFG0, DEV_PERCFG0_SRIOCTL, ENABLE);
status = CSL_srioInit (&context);
hSrio = CSL_srioOpen (&srioObj, srioNum, &srioParam, &status);
if (status != CSL_SOK) {
printf("SRIO: ... Cannot open SRIO, failed\n");
return;
}
/* Setup the source and destination */
/* for(index=0; index<TRANSFER_SIZE; index++) {
src[index] = index + 0x1;
dst[index] = 0;
}
*/
for(index=0; index<TRANSFER_SIZE; index++) {
src[index] = 0x12345678;
}
/* Create an LSU configuration */
lsu_conf.srcNodeAddr = (U32)&src[0]; /* Source address */
lsu_conf.dstNodeAddr.addressHi = 0;
lsu_conf.dstNodeAddr.addressLo = 0xb0000000; /* Destination address */
lsu_conf.byteCnt = TRANSFER_SIZE;
lsu_conf.idSize = 0; /* 8 bit device id */
lsu_conf.priority = 2; /* PKT priority is 2 */
lsu_conf.xambs = 0; /* Not an extended
address */
lsu_conf.dstId = SMALL_DEV_ID;
lsu_conf.intrReq = 0; /* No interrupts */
lsu_conf.pktType = SRIO_PKT_TYPE_NWRITE;
/* write with no
response */
lsu_conf.hopCount = 0; /* Valid for
maintainance pkt */
lsu_conf.doorbellInfo = 0; /* Not a doorbell pkt */
lsu_conf.outPortId = 0; /* Tx on Port 0 */
/* doorbell */
lsu_conf1.idSize = 0; /* 16 bit device id */
lsu_conf1.priority = 0; /* PKT priority is 0 */
lsu_conf1.xambs = 0; /* Not an extended
address */
lsu_conf1.dstId = SMALL_DEV_ID;
lsu_conf1.intrReq = 0; /* No interrupts */
lsu_conf1.pktType = SRIO_PKT_TYPE_DOORBELL;
/* write with no
response */
lsu_conf1.hopCount = 0; /* Valid for
maintainance pkt */
lsu_conf1.doorbellInfo = 0x0; /* doorbell 0 */
lsu_conf1.outPortId = 0; /* Tx on Port 0 */
/* Configure the LSU1 and start transmission */
lsu_no = SELECTED_LSU;
for(looper = 0; looper < 256; looper++)
{
CSL_srioLsuSetup (hSrio, &lsu_conf, lsu_no);
/* Wait for the completion of transfer */
response.index = lsu_no;
do {
CSL_srioGetHwStatus (hSrio, CSL_SRIO_QUERY_LSU_BSY_STAT, &response);
}while(response.data == 1);
lsu_conf.dstNodeAddr.addressLo = 0xb0000000+counter; /* Destination address */
counter += 0x1000;
}
//CSL_srioLsuSetup (hSrio, &lsu_conf1, 2);
/*
response.index = 2;
do {
CSL_srioGetHwStatus (hSrio, CSL_SRIO_QUERY_LSU_BSY_STAT, &response);
}while(response.data == 1);
}
*/
/* A delay, above checks seems to be not working
may be because, it is a write operation with
no response */
#endif
TurnOffAllLeds();
TurnOnGreenLed();
TurnOnRedLed();
printf("done\n");
*trial = 0x64;
// while(1)
// {
// }
CSL_intcEventSet(eventId);
CSL_intcEventSet(eventId);
CSL_intcEventSet(eventId);
CSL_intcEventSet(eventId);
while(1)
{
}
return;
}
//void event63Handler(CSL_IntcHandle hIntc)
void event63Handler(void* hIntc)
{
static U32* ptr = (U32*)mem1;
static U32 value = 0x1;
CSL_IntcEventId eventId = CSL_INTC_EVENTID_GPINT12;
value++;
*ptr = value;
CSL_intcEventClear(eventId);
}