ðJOberon10.Scn.FntOberon10b.Scn.Fnt 0I Courier10.Scn.Fnt #’Õ’ +’ÿ/ `’H,’8-% 9J’¾€üMODULE AosUsbPegasus; (** AUTHOR: ""; PURPOSE: "USB device driver for a network adapter based on the ADMtek ADM8511, ADM8513, ADM8515 or AN986 chip." *) (** * * Steps to write a USB device driver: * * - Implement the Probe procedure. * - Implement the actual device driver. * * For an example, see AosUsbNetworkUSB200M.Mod . * * * Getting control: * When a USB device is connected to the USB, the USB driver manager will call the Probe procedure of all device drivers it knows * (See module body for driver registration). The Probe procedure uses the device descriptor and configuration descriptor to check whether * the associated driver can handle the device. If it can, the Probe procedure returns an instance of the USB driver (YourDriver in this example). * If an instance of a driver object is returned, the USB driver manager initializes the driver object's field and then calls the Connect procedure. * This is the place where you get control over the USB device. * * Petko Manolov, author of pegasus.c, explained the name. "The first chip was codenamed Pegasus. Later ADMTek kept * the name and even evolved it to Pegasus II for the later revisions." * * This driver should work with USB ethernet adapters based on ADMtek ADM8511, ADM8513, ADM8515 or AN986 chip. * Initially only the Belkin F5D5050 adapter will be tested. * * References: * * At http://www.infineon.com/ search for * ADM8511_DSH_204.pdf, ADM8513_X_DS_green+version.pdf, ADM8515_X_DS_green_version.pdf * * History: * * 2007-10-13 Copied from AosUsbSkeleton.Mod (peasthope) * *) IMPORT AosModules, AosUsbdi; CONST Name = "Pegasus"; Description = "USB device Driver for the ADMtek ADM8511, ADM8513, ADM8515 and AN986 chips."; Priority = 10; TYPE YourDriver= OBJECT (AosUsbdi.Driver) (* * Fields inherited from AosUsbdi.Driver: * device: Provides access to the device descriptors and the pipe mechanism. * interface: Number of the interface this driver instance is associated to. *) (* This procedure is called by the USB system software after an instance of this object has been passed to it via the probe procedure. Typically, the code here sets up the communication pipe(s) use by the driver using device.GetPipe(endpointnumber) *) PROCEDURE Connect*() : BOOLEAN; BEGIN RETURN TRUE; END Connect; (* This procedure is called by the USB system software when the device is removed or your driver is unregistered using AosUsbdi.drivers.Remove(Name). Note that the USB system software will automatically remove all pipes allocated by this driver *) PROCEDURE Disconnect*; BEGIN END Disconnect; END YourDriver; (** The Probe procedure uses the device descriptor and configuration descriptors provided by the device to see whether the device can be handled by the device driver. If not, the probe procedure returns NIL, otherwise it returns an instance of the device driver object. *) PROCEDURE Probe(dev : AosUsbdi.UsbDevice; id : AosUsbdi.InterfaceDescriptor) : AosUsbdi.Driver; VAR driver : YourDriver; BEGIN (* RETURN NIL if device not supported by this USB device driver *) NEW(driver); RETURN driver; END Probe; PROCEDURE Cleanup; BEGIN (* Unregister the driver at the USB driver registry *) AosUsbdi.drivers.Remove(Name); END Cleanup; PROCEDURE Install*(ptr : PTR): PTR; BEGIN (* Load the module into memory and execute its body *) RETURN NIL; END Install; BEGIN AosModules.InstallTermHandler(Cleanup); (* This registers your driver at the USB driver registry. When a device is attached to the USB, the Probe procedures of all registered device drivers will be called by the USB driver *) AosUsbdi.drivers.Add(Probe, Name, Description, Priority) END AosUsbSkeleton. AosUsbSkeleton.Install ~ S.Free AosUsbSkeleton ~