void ixQMgrShow (void) { IxQMgrQCfgStats *qCfgStats = NULL; IxQMgrDispatcherStats *dispatcherStats = NULL; int i; UINT32 lowIntRegRead, upIntRegRead; qCfgStats = ixQMgrQCfgStatsGet (); dispatcherStats = ixQMgrDispatcherStatsGet (); ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUELOW_GROUP, &lowIntRegRead); ixQMgrAqmIfQInterruptRegRead (IX_QMGR_QUEUPP_GROUP, &upIntRegRead); printf("Generic Stats........\n"); printf("=====================\n"); printf("Loop Run Count..........%u\n",dispatcherStats->loopRunCnt); printf("Watermark set count.....%d\n", qCfgStats->wmSetCnt); printf("===========================================\n"); printf("On the fly Interrupt Register Stats........\n"); printf("===========================================\n"); printf("Lower Interrupt Register............0x%08x\n",lowIntRegRead); printf("Upper Interrupt Register............0x%08x\n",upIntRegRead); printf("==============================================\n"); printf("Queue Specific Stats........\n"); printf("============================\n"); for (i=0; i<IX_QMGR_MAX_NUM_QUEUES; i++) { if (ixQMgrQIsConfigured(i)) { ixQMgrQShow(i); } } printf("============================\n"); }
IX_STATUS ixQMgrNotificationDisable (IxQMgrQId qId) { int ixQMgrLockKey; #ifndef NDEBUG /* Validate parameters */ if (!ixQMgrQIsConfigured (qId)) { return IX_QMGR_Q_NOT_CONFIGURED; } #endif /* * Enabling interrupts results in Read-Modify-Write * so need critical section */ #ifndef NDEBUG dispatcherStats.queueStats[qId].notificationEnabled = FALSE; #endif ixQMgrLockKey = ixOsalIrqLock(); ixQMgrAqmIfQInterruptDisable (qId); ixOsalIrqUnlock(ixQMgrLockKey); return IX_SUCCESS; }
IX_STATUS ixQMgrNotificationCallbackSet (IxQMgrQId qId, IxQMgrCallback callback, IxQMgrCallbackId callbackId) { if (!ixQMgrQIsConfigured(qId)) { return IX_QMGR_Q_NOT_CONFIGURED; } if (NULL == callback) { /* Reset to dummy callback */ dispatchQInfo[qId].callback = dummyCallback; dispatchQInfo[qId].dummyCallbackCount = 0; dispatchQInfo[qId].callbackId = 0; } else { dispatchQInfo[qId].callback = callback; dispatchQInfo[qId].callbackId = callbackId; } return IX_SUCCESS; }
IX_STATUS ixQMgrDispatcherPrioritySet (IxQMgrQId qId, IxQMgrPriority priority) { int ixQMgrLockKey; if (!ixQMgrQIsConfigured(qId)) { return IX_QMGR_Q_NOT_CONFIGURED; } if (!IX_QMGR_DISPATCHER_PRIORITY_CHECK(priority)) { return IX_QMGR_Q_INVALID_PRIORITY; } ixQMgrLockKey = ixOsalIrqLock(); /* Change priority */ dispatchQInfo[qId].priority = priority; /* Set flag */ rebuildTable = TRUE; ixOsalIrqUnlock(ixQMgrLockKey); #ifndef NDEBUG /* Update statistics */ dispatcherStats.queueStats[qId].priorityChangeCnt++; #endif return IX_SUCCESS; }
IX_STATUS ixQMgrWatermarkSet (IxQMgrQId qId, IxQMgrWMLevel ne, IxQMgrWMLevel nf) { IxQMgrQStatus qStatusOnEntry;/* The queue status on entry/exit */ IxQMgrQStatus qStatusOnExit; /* to this function */ if (!ixQMgrQIsConfigured(qId)) { return IX_QMGR_Q_NOT_CONFIGURED; } if (!watermarkLevelIsOk (qId, ne)) { return IX_QMGR_INVALID_Q_WM; } if (!watermarkLevelIsOk (qId, nf)) { return IX_QMGR_INVALID_Q_WM; } /* Get the current queue status */ ixQMgrAqmIfQueStatRead (qId, &qStatusOnEntry); #ifndef NDEBUG /* Update statistics */ stats.wmSetCnt++; #endif ixQMgrAqmIfWatermarkSet (qId, ne, nf); /* Get the current queue status */ ixQMgrAqmIfQueStatRead (qId, &qStatusOnExit); /* If the status has changed return a warning */ if (qStatusOnEntry != qStatusOnExit) { return IX_QMGR_WARNING; } return IX_SUCCESS; }
IX_STATUS ixQMgrQSizeInEntriesGet (IxQMgrQId qId, unsigned *qSizeInEntries) { if (!ixQMgrQIsConfigured(qId)) { return IX_QMGR_Q_NOT_CONFIGURED; } if(NULL == qSizeInEntries) { return IX_QMGR_PARAMETER_ERROR; } *qSizeInEntries = (UINT32)(cfgQueueInfo[qId].qSizeInWords) / (UINT32)cfgQueueInfo[qId].qEntrySizeInWords; return IX_SUCCESS; }
IX_STATUS ixQMgrQShow (IxQMgrQId qId) { IxQMgrQCfgStats *qCfgStats = NULL; IxQMgrDispatcherStats *dispatcherStats = NULL; if (!ixQMgrQIsConfigured(qId)) { return IX_QMGR_Q_NOT_CONFIGURED; } dispatcherStats = ixQMgrDispatcherStatsGet (); qCfgStats = ixQMgrQCfgQStatsGet (qId); printf("QId %d\n", qId); printf("======\n"); printf(" IxQMgrQCfg Stats\n"); printf(" Name..................... \"%s\"\n", qCfgStats->qStats[qId].qName); printf(" Size in words............ %u\n", qCfgStats->qStats[qId].qSizeInWords); printf(" Entry size in words...... %u\n", qCfgStats->qStats[qId].qEntrySizeInWords); printf(" Nearly empty watermark... %u\n", qCfgStats->qStats[qId].ne); printf(" Nearly full watermark.... %u\n", qCfgStats->qStats[qId].nf); printf(" Number of full entries... %u\n", qCfgStats->qStats[qId].numEntries); printf(" Sram base address........ 0x%X\n", qCfgStats->qStats[qId].baseAddress); printf(" Read pointer............. 0x%X\n", qCfgStats->qStats[qId].readPtr); printf(" Write pointer............ 0x%X\n", qCfgStats->qStats[qId].writePtr); #ifndef NDEBUG if (dispatcherStats->queueStats[qId].notificationEnabled) { char *localEvent = "none ????"; switch (dispatcherStats->queueStats[qId].srcSel) { case IX_QMGR_Q_SOURCE_ID_E: localEvent = "Empty"; break; case IX_QMGR_Q_SOURCE_ID_NE: localEvent = "Nearly Empty"; break; case IX_QMGR_Q_SOURCE_ID_NF: localEvent = "Nearly Full"; break; case IX_QMGR_Q_SOURCE_ID_F: localEvent = "Full"; break; case IX_QMGR_Q_SOURCE_ID_NOT_E: localEvent = "Not Empty"; break; case IX_QMGR_Q_SOURCE_ID_NOT_NE: localEvent = "Not Nearly Empty"; break; case IX_QMGR_Q_SOURCE_ID_NOT_NF: localEvent = "Not Nearly Full"; break; case IX_QMGR_Q_SOURCE_ID_NOT_F: localEvent = "Not Full"; break; default : break; } printf(" Notifications localEvent...... %s\n", localEvent); } else { printf(" Notifications............ not enabled\n"); } printf(" IxQMgrDispatcher Stats\n"); printf(" Callback count................%d\n", dispatcherStats->queueStats[qId].callbackCnt); printf(" Priority change count.........%d\n", dispatcherStats->queueStats[qId].priorityChangeCnt); printf(" Interrupt no callback count...%d\n", dispatcherStats->queueStats[qId].intNoCallbackCnt); printf(" Interrupt lost callback count...%d\n", dispatcherStats->queueStats[qId].intLostCallbackCnt); #endif return IX_SUCCESS; }
IX_STATUS ixQMgrNotificationEnable (IxQMgrQId qId, IxQMgrSourceId srcSel) { IxQMgrQStatus qStatusOnEntry;/* The queue status on entry/exit */ IxQMgrQStatus qStatusOnExit; /* to this function */ int ixQMgrLockKey; #ifndef NDEBUG if (!ixQMgrQIsConfigured (qId)) { return IX_QMGR_Q_NOT_CONFIGURED; } if ((qId < IX_QMGR_MIN_QUEUPP_QID) && !IX_QMGR_DISPATCHER_SOURCE_ID_CHECK(srcSel)) { /* QId 0-31 source id invalid */ return IX_QMGR_INVALID_INT_SOURCE_ID; } if ((IX_QMGR_Q_SOURCE_ID_NE != srcSel) && (qId >= IX_QMGR_MIN_QUEUPP_QID)) { /* * For queues 32-63 the interrupt source is fixed to the Nearly * Empty status flag and therefore should have a srcSel of NE. */ return IX_QMGR_INVALID_INT_SOURCE_ID; } #endif #ifndef NDEBUG dispatcherStats.queueStats[qId].notificationEnabled = TRUE; dispatcherStats.queueStats[qId].srcSel = srcSel; #endif /* Get the current queue status */ ixQMgrAqmIfQueStatRead (qId, &qStatusOnEntry); /* * Enabling interrupts results in Read-Modify-Write * so need critical section */ ixQMgrLockKey = ixOsalIrqLock(); /* Calculate the checkMask and checkValue for this q */ ixQMgrAqmIfQStatusCheckValsCalc (qId, srcSel, &dispatchQInfo[qId].statusWordOffset, &dispatchQInfo[qId].statusCheckValue, &dispatchQInfo[qId].statusMask); /* Set the interupt source is this queue is in the range 0-31 */ if (qId < IX_QMGR_MIN_QUEUPP_QID) { ixQMgrAqmIfIntSrcSelWrite (qId, srcSel); } /* Enable the interrupt */ ixQMgrAqmIfQInterruptEnable (qId); ixOsalIrqUnlock(ixQMgrLockKey); /* Get the current queue status */ ixQMgrAqmIfQueStatRead (qId, &qStatusOnExit); /* If the status has changed return a warning */ if (qStatusOnEntry != qStatusOnExit) { return IX_QMGR_WARNING; } return IX_SUCCESS; }