/** * @brief default NPE event processing callback * * @param npeID ID of the NPE that generated the event * @param msg NPE message (encapsulated event) * * Creates an event object on the Ethernet event processor queue * and signals the new event by incrementing the event queue semaphore. * Events are processed by @ref ixEthDBEventProcessorLoop() which runs * at user level. * * @see ixEthDBEventProcessorLoop() * * @warning do not call directly * * @internal */ IX_ETH_DB_PUBLIC void ixEthDBNPEEventCallback(IxNpeMhNpeId npeID, IxNpeMhMessage msg) { PortEvent *local_event; IX_ETH_DB_IRQ_EVENTS_TRACE("DB: (Events) new event received by processor callback from port %d, id 0x%X\n", IX_ETH_DB_NPE_TO_PORT_ID(npeID), NPE_MSG_ID(msg), 0, 0, 0, 0); if (CAN_ENQUEUE(&eventQueue)) { TEST_FIXTURE_LOCK_EVENT_QUEUE; local_event = QUEUE_HEAD(&eventQueue); /* create event structure on queue */ local_event->eventType = NPE_MSG_ID(msg); local_event->portID = IX_ETH_DB_NPE_TO_PORT_ID(npeID); /* update queue */ PUSH_UPDATE_QUEUE(&eventQueue); TEST_FIXTURE_UNLOCK_EVENT_QUEUE; IX_ETH_DB_IRQ_EVENTS_TRACE("DB: (Events) Waking up main processor loop...\n", 0, 0, 0, 0, 0, 0); /* increment event queue semaphore */ ixOsalSemaphorePost(&eventQueueSemaphore); } else { IX_ETH_DB_IRQ_EVENTS_TRACE("DB: (Events) Warning: could not enqueue event (overflow)\n", 0, 0, 0, 0, 0, 0); } }
/** * @brief general-purpose NPE callback function * * @param npeID NPE ID * @param msg NPE message * * This function will unblock the caller by unlocking * the npeAckLock mutex defined for each NPE port * * @internal */ IX_ETH_DB_PUBLIC void ixEthDBNpeMsgAck(IxNpeMhNpeId npeID, IxNpeMhMessage msg) { IxEthDBPortId portID = IX_ETH_DB_NPE_TO_PORT_ID(npeID); PortInfo *portInfo; if (portID >= IX_ETH_DB_NUMBER_OF_PORTS) { /* invalid port */ return; } if (ixEthDBPortDefinitions[portID].type != IX_ETH_NPE) { /* not an NPE */ return; } portInfo = &ixEthDBPortInfo[portID]; ixOsalMutexUnlock(&portInfo->npeAckLock); }