# //////////////////////////////////////////////////////////////////////////////
# // Copyright (C) 2008 Cinterion Wireless Modules GmbH
# // Copyright (C) 2006-2008 Siemens AG
# //
# // Version: 1.0
# // Date:    dummy
# //
# //////////////////////////////////////////////////////////////////////////////

TARGETNAME=HcUsbDrv
RELEASETYPE=PLATFORM
TARGETTYPE=DYNLINK
DLLENTRY=HcUsbDrvDllMain

# The driver prints additional debug messages. If the following compiler flag
# is enabled the driver prints additional useful debug messages also in retail
# build of driver to debug out.
CDEFINES=$(CDEFINES) -DWANT_RETAIL_USB_OUTPUT

# The driver provides the possiblity to send debug messages from the macro
# "USBRetailTrace()" enabled with the compiler flag "WANT_RETAIL_USB_OUTPUT"
# to a serial port. This feature is enabled by setting the following compiler
# flag to the appropriate COM port device name.
#CDEFINES=$(CDEFINES) -DUSB_RETAIL_OUTPUT_PORT=TEXT(\"COM1:\")

# The driver provides the possiblity to send debug messages from the macro
# "USBRetailTrace()" enabled with the compiler flag "WANT_RETAIL_USB_OUTPUT"
# to a file. This feature is enabled by setting the compiler flag to the
# appropriate file name.
#CDEFINES=$(CDEFINES) -DUSB_RETAIL_OUTPUT_FILE=TEXT(\"\\HcUsbDrv.log\")

# USB_RETAIL_KEEP_FILE_ON_BOOT: If this option is set, the driver keeps an
# existing log file specified with USB_RETAIL_OUTPUT_FILE on warm and cold
# boot. If this option is not set, the RIL deletes this file on device boot.
#CDEFINES=$(CDEFINES) -DUSB_RETAIL_KEEP_FILE_ON_BOOT

# WANT_USBDRV_RTC_TIMESTAMPS: This settings applies only, if
# WANT_RETAIL_USBDRV_OUTPUT is set. It switches the source of
# the timestamp from GetTickCount() to GetLocalTime().
#CDEFINES=$(CDEFINES) -DWANT_USBDRV_RTC_TIMESTAMPS

# USB_INCLUDE_TIMSTAMPS_TO_RETAIL: When the USB is tested with the Platform
# Builder, timestamps are added automatically by the Platform Builder. This
# doesn't apply on traces which are printed on the debug port of a device.
# If this option is activated, the USB will add timestamps to its trace
# output.
CDEFINES=$(CDEFINES) -DUSB_INCLUDE_TIMESTAMPS_TO_RETAIL

# USE_WA_RESET_ON_RESUME: Some host controller require a reset on each pipe
# after resuming from selective suspend. This option enables a workaround for
# this problem.
CDEFINES=$(CDEFINES) -DUSE_WA_RESET_ON_RESUME

# USE_WA_PAUSE_ON_RESUME: Sometimes the module does not respond to any request
# if the request is sent shortly after the devices is resumed. If this option
# is activated the USB device driver will delay the first transaction on the
# bus after resume.
CDEFINES=$(CDEFINES) -DUSE_WA_PAUSE_ON_RESUME

# On some host unexpected USB resumes were observed. The problem is here that
# such host suspend the USB device again without any interaction of the driver.
# To synchronize the suspend and resume states between device driver and the
# device itself the driver will try to suspend and resume the device to recover
# from this situation.
#CDEFINES=$(CDEFINES) -DWA_RESUME_ON_UNEXPECTED_HOST_WAKEUPS

# If a call to a USB Host Client Driver function fails, the USB host client
# driver usually do not retry to call this function. If this option is activated
# the driver will call the function that failed again.
#CDEFINES=$(CDEFINES) -DUSE_WA_RETRY_ON_HOSTFN_FAIL

# Extended notifications for USBNotify function:
#    USB_DEVICE_SUSPENDED
#    USB_DEVICE_RESUMED
# These defines should be used to inform an USB host client driver that one
# of its interfaces is suspended resp. resumed now.
# It is used to avoid polling to check for a remote wakeup of the device.
#CDEFINES=$(CDEFINES) -DUSB_DEVICE_SUSPENDED=2
#CDEFINES=$(CDEFINES) -DUSB_DEVICE_RESUMED=3

# Unfortunately some USB controller hardware has a bug that causes a USB
# reset during a Windows resume cycle which causes all USB devices to be
# reenumerated. Even more unfortunately some USB host drivers has another
# bug in this context which causes the USBDeviceAttach() function being
# called before USBDeviceNotify() with the USB_CLOSE_DEVICE notification
# has been called. Obviously this bug chain requires a workaround in the
# USB driver for a proper locking mechanism. This workaround is enabled
# with the compiler flag ATTACH_BEFORE_DETACH.
# Please note that the driver looses its capability to handle more than
# one device instance when the flag is enabled.
CDEFINES=$(CDEFINES) -DATTACH_BEFORE_DETACH

# Defines to find bugs if an USB function does not return
#CDEFINES=$(CDEFINES) -DUSE_WATCHDOG_RESET_PIPE
#CDEFINES=$(CDEFINES) -DUSE_WATCHDOG_SUSPEND_DEVICE

# Create .cod files
WINCECOD=1

!IF "$(_WINCEOSVER)" >= "600"
CDEFINES=$(CDEFINES) -DHCUSBDRV_CE6
!ENDIF

RDEFINES=$(RDEFINES) -DWINCEOSVER=$(_WINCEOSVER)

TARGETLIBS= \
  $(_COMMONSDKROOT)\lib\$(_CPUINDPATH)\coredll.lib \
  $(_SYSGENOAKROOT)\lib\$(_CPUINDPATH)\usbd.lib

INCLUDES=$(INCLUDES)

SOURCES=                             \
  DrvEntryUsb.cpp                    \
  DrvEntryVCom.cpp                   \
  SelectiveSuspend.cpp               \
  UsbPipe.cpp                        \
  UsbHandling.cpp                    \
  VirtualPort.cpp                    \
  Util.cpp                           \
  UsbDriver.cpp                      \
  UsbWatchdog.cpp                    \
  UsbTrace.cpp                       \
  HcUsbDrv.rc

