/* usb/driver/hid/usb/hid/msgs.h
 *
 * (c) 2002 Simtec Electronics
 *
 * Ben Dooks
 *
 * HID Driver - message definitions
 *
 * $Id: msgs.h,v 1.11 2003/08/08 11:17:17 ben Exp $
 *
 * This Library file is part of the Simtec Electronics USB stack development
 *   suite.
 * Specific licence is granted to use this file by third parties for the
 *   development of USB device drivers.
 *
*/

#ifndef __USB_DRIVER_HID_MSGS_H
#define __USB_DRIVER_HID_MSGS_H "$Id: msgs.h,v 1.11 2003/08/08 11:17:17 ben Exp $"

#define HID_MSG_BASE       (0x10000000)

#define usbmsg_class_hid_offer    ((usbmsg_class_t) (HID_MSG_BASE + 0x00))
#define usbmsg_class_hid_offer2   ((usbmsg_class_t) (HID_MSG_BASE + 0x01))
#define usbmsg_class_hid_stopping ((usbmsg_class_t) (HID_MSG_BASE + 0x02))
#define usbmsg_class_hid_release  ((usbmsg_class_t) (HID_MSG_BASE + 0x03))
#define usbmsg_class_hid_external_driver  ((usbmsg_class_t) (HID_MSG_BASE + 0x04))
#define usbmsg_class_hid_start    ((usbmsg_class_t) (HID_MSG_BASE + 0x05))
#define usbmsg_class_hid_stop     ((usbmsg_class_t) (HID_MSG_BASE + 0x06))
#define usbmsg_class_hid_take     ((usbmsg_class_t) (HID_MSG_BASE + 0x07))
#define usbmsg_class_hid_drop     ((usbmsg_class_t) (HID_MSG_BASE + 0x08))
#define usbmsg_class_hid_reoffer  ((usbmsg_class_t) (HID_MSG_BASE + 0x09))

/* usbmsg_class_hid_take -
 *
 * this has exactly the same format as the newdev message, as it is
 * intented to force the hid driver to latch onto this device
*/

/** usbmsg_hid_offer - offer new device before HID takes it
 *
 * claiming this will ensure the HID driver will not take any further
 * interest in this device.
*/

struct usbmsg_hid_offer_s {
  struct usbmsg_new_device     *msg;
};

/** usbmsg_hid_offer2 - offer new device once usage tables read
 *
 * this is sent once the hid driver has actually read the report tables
 * from the device, and created data-structures for them. If the device
 * is of a generic type (ie, not of protocol mouse or keyboard) then it
 * is offered round on this service. If it isn't claimed, the the device
 * will be removed from the HID's table and returned to the device manager
 * @memo offer new device once usage tables read
 */

struct usbmsg_hid_offer2_s {
  struct hid_dev               *dev;
};

/** usbmsg_hid_stopping - hid device is stopping
 *
 */

struct usmbsg_hid_stopping_s {
  struct hid_dev              *dev;
};

/** usbmsg_hid_release - hid driver releasing device
 *
 * this is sent by an external driver when it is stopping to allow the hid
 * driver to release the external driver's hold on the device.
 */

struct usbmsg_hid_release_s {
  struct hid_dev              *dev;
};

/** usbmsg_hid_external_driver
 *
 * sent by an external driver when it has been started or stopped. this should
 * be sent when the hid driver starts
 * @memo sent by an external driver when it has been started or stopped.
 */

enum usbmsg_hid_external_driver_type {
  USBMSG_HID_EXTDRIVER_STARTING,
  USBMSG_HID_EXTDRIVER_STOPPING
};

struct usbmsg_hid_external_driver_s {
  enum usbmsg_hid_external_driver_type    type;

  struct hid_dev_type                     *drvtype;
};

/** usbmsg_hid_drop_dev
 *
 * drop the device, and stop processing it. deallocate any resources but
 * do not pass the device back to the newdev handler
 * @memo drop the device, and stop processing it.
*/

struct usbmsg_hid_drop_dev_s {
  struct hid_dev              *dev;
};

/* usbmsg_class_hid_reoffer
 *
 * this message is sent to get the HID driver to re-offer any currently
 * unclaimed HID devices via the offer mechanism.
 * @memo get the HID driver to re-offer any currently unclaimed HID devices
*/

#endif /* __USB_DRIVER_HID_MSGS_H */
