/* usb/structs.h
 *
 * (c) 2002 Simtec Electronics
 *
 * Ben Dooks
 *
 * USB structures
 *
 * $Id: structs.h,v 1.15 2003/08/11 09:11:12 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_STRUCTS_H
#define __USB_STRUCTS_H "$Id: structs.h,v 1.15 2003/08/11 09:11:12 ben Exp $"

/* ---------- Buffer ---------- */
/** IO buffer structure
*/
struct usb_io_buffer_s {
  /* Normally points to data at the end of this structure but sometimes
     it is pointing directly to a piece of external memory */

  /* (25sep02) - renamed the pointer_to_data field to data, less confusing */

  void          *data;               /* pointer to actual data */
  unsigned long  size;               /* total size of the buffer */
  unsigned long  used_size;          /* amount of data in the buffer */
  unsigned long  actual_position;    /* read/write position offset */

  /* Filled by the USB host controller driver with the frame number
     at which this buffer was recieved/sent completely */
  unsigned long  completed_at;

  /* Filled by the USB host controller driver with the data toggle
     as this buffer was recieved/sent - note, this currently not up-to-date
     until the transaction has completed from the host controller */
  unsigned long  data_toggle;

  /* fields upto here are fixed from revision 1.8 (26Jun2002), following
   * fields cannot be relied upon to exist, and should not be used.
   */

  /* Note that this size may vary at later version but there will
     be always a sub size information to detect start of following
     data */
  usb_wait_t     waiting_mode;

  /* anything before here is now fixed for the initial release, and
   * must not change (release usb-24may02, revision 1.5)
  */

  /* removed the data field (25sep02) as it is not necessary and is using
   * 4 bytes of storage that could go elsewhere. */
};

/* re-define old pointer to data to allow old apps to be built */
#define pointer_to_data data

/** definied type for usb_io_buffer
 * @memo definied type for usb_io_buffer
*/
typedef struct usb_io_buffer_s usb_io_buffer;

/** definied type for struct usb_buffer_s
 * @memo definied type for usb_io_buffer
*/
typedef struct usb_io_buffer_s usb_buffer_t;

/* ---------- Transaction ---------- */
/** basic transaction structure
 */
struct usb_transaction_basic_s {
       void *unused;
#if 0
  /* remove this is if it is no longer used */
  unsigned long size;
  unsigned long no_of_offsets;
  /* Size of this structure may vary */
  unsigned long offset[1];
#endif
};

/* ---------- Hostcontroller ---------- */
/** host controller property structure
 */
struct usb_hc_property_s {
  unsigned long  size;
  unsigned long  minimal_speed;
  unsigned long  maximal_speed;
  unsigned long  maximum_frame_repeat;
  unsigned long  max_number_of_transaction_type;
  unsigned long *maximal_running_requests_to_note;
  unsigned long  frame_number_mask;

  /* structure contents before this fixed from usb release 24may02,
   * revision 1.5 */

};

#endif /* __USB_STRUCTS_H */
