home *** CD-ROM | disk | FTP | other *** search
- /*
- File: ModemDriver.h
-
- Contains: Definitions for the USB Modem Driver
-
- Version: xxx put version here xxx
-
- Written by:
-
-
- */
-
- #ifndef _MODEMDRIVER_
- #define _MODEMDRIVER_
-
- typedef struct{
- USBPB pb;
- UInt8 *errorString;
- USBConfigurationDescriptor *conf;
- USBInterfaceDescriptor *interface;
- UInt32 interfaceOffset;
- USBDeviceRef deviceRef;
- USBPipeRef bulkIn;
- USBPipeRef bulkOut;
- USBInterfaceDescriptor *clinterface;
- UInt32 clinterfaceOffset;
- USBPipeRef interrupt;
- USBDeviceDescriptorPtr deviceDescriptor;
- UInt8 modemStatus;
- UInt8 lineStatus;
- UInt8 onError;
- UInt8 retries;
- Boolean DTRClose; // true means don't negate DTR
- UInt16 modemUSBStatus; // Modem and line status USB
- UInt16 lineState; // Current USB line state
- LineParms Line_Settings; // USB current line settings
- } serPB;
-
- enum{
- kReset = 0,
- kStartConfig = 1,
- kGetConfig = 2,
- kGetDataInterface = 3,
- kGetEndpoint = 4,
- kGetCommInterface = 5,
- kConfigDone = 6,
- kEndpointStall = 1,
- kStallDone = 2,
- kAvailableStatus = 'okok'
- };
-
- /********************************************************************************************/
- //
- // Prototypes
- //
- /********************************************************************************************/
-
- static Boolean immediateError(OSStatus err);
- static void ConfigurationHandler(USBPB *pb);
- static void ResetInterruptPB(USBPB *pb);
- static void interruptCompletion(USBPB *pb);
- static void StartStatusMonitor(USBPipeRef interruptPipe);
- static void syncCompletion(USBPB *pb);
- Boolean TimeoutPrevRequest(void);
- Boolean TimeoutStallRequest(void);
- Boolean TimeoutDelayRequest(void);
- void USBSetBaudRate(UInt32 baudRate);
- void USBSetLineCoding(LineParms Line_Coding);
- void USBSetControlLineState(void);
- void USBSetDTRState(Boolean state);
- void USBSetRTSState(Boolean state);
- void USBSendBreak(Boolean state);
- void USBSetCloseDTR(void);
- UInt8 USBGetDCDValue(void);
- void modemDriverEntry(USBDeviceRef device, USBDeviceDescriptor *desc);
- static void InitializePB(USBPB *pb, USBDeviceRef ref, USBCompletion handler);
- void readCompletion(USBPB *pb);
- void USBStartReadPolling();
- void USBStopReadPolling(void);
- void writeCompletion(USBPB *pb);
- OSStatus USBSerialWrite(IOParam *pb);
- void KillUSBIO(void);
- void InitLineCoding(LineParms Line_Coding);
- void DoDelay(void);
- static void delayHandler(USBPB *pb);
- void ClearDevice(void);
- static void stallHandler(USBPB *pb);
-
- #if ((DebugOn > 0) && (LogOn > 0))
- UInt8 Asciify(UInt8 i);
- void USBLogData(UInt8 Dir, UInt32 Count, UInt8 *buf);
- #endif
-
- #endif
-