­

Whereas interrupts provide notification to the target that an event has occurred, Events allow the target to notify other host components of the event occurrence, such as to signal to a virtual USB host that a virtual USB endpoint is armed and ready.

To create an event which the target can fire, open the Target Model Builder and select the Events tab. Right-click in the tab area and click “New” to create a new event. Name the event “USBEP0INArmed” to indicate that the event fires when the target has armed the USB Endpoint 0 IN endpoint, then click Done.

You will now see the target schematic component updated with a USBEP0INArmed output port, ready to be connected to another host component or another virtual target which can receive the event.

To fire the event from the target code, open Virtuoso.h and you will see the header file has been updated to include a hUSBEP0INArmed symbol.

You will also notice a RaiseVirtuosoEvent function defined in Virtuoso.h, as shown below.

To fire the event, simply call this function, specifying the appropriate event handle symbol, and the framework will route the event as needed.