/* usb/task-slow.h
 *
 * (c) 2002 Simtec Electronics
 *
 * Ben Dooks
 *
 * `slow` task structures and functions
 *
 * $Id: task-slow.h,v 1.10 2003/08/06 15:56:11 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_TASK_SLOW_H
#define __USB_TASK_SLOW_H "$Id: task-slow.h,v 1.10 2003/08/06 15:56:11 ben Exp $"
#include "usb/dlist.h"
#include "usb/dilist.h"

#define task_slow_resource_s  task_resource_s
#define task_slow_condition_s task_condition_s

struct task_slow_s {
  int                      operation;
  task_arg_t               op_parameter1;
  task_arg_t               op_parameter2;
  int                      priority;
  int                      number_of_conditions;

  /* unfortunately we cannot do anything about this until the usb hub
   * module gets re-written... oh well */
  struct task_condition_s  condition[5];
};

struct task_slow_list_s {
  dilist_head_t    head;
};

extern struct task_resource_s *usbtask_slow_resource_malloc(void);
extern int usbtask_slow_resource_free(struct task_resource_s *);

extern int usbtask_slow_resource_change(struct task_slow_resource_s *act_resource,
					unsigned long value,
					unsigned long mask);

extern int usbtask_slow_register(struct task_slow_list_s *tasks_list,
				 struct task_slow_s *new_task);


extern int usbtask_slow_get(struct task_slow_list_s *tasks_list,
			    int *operation,
			    void **parameter1,
			    void **parameter2);

extern int usbtask_slow_initialize(struct task_slow_list_s *);
extern int usbtask_slow_finalize(struct task_slow_list_s *);

/* define data structure redirections */

#define task_list_s task_slow_list_s
#define task_s      task_slow_s

/* function redirections */

#define task_initialize    usbtask_slow_initialize
#define task_finalize      usbtask_slow_finalize
#define task_get           usbtask_slow_get
#define task_register      usbtask_slow_register

#define task_resource_malloc  usbtask_slow_resource_malloc
#define task_resource_free    usbtask_slow_resource_free
#define task_resource_change  usbtask_slow_resource_change


/* new function defs */

#define usbtask_initialize    usbtask_slow_initialize
#define usbtask_finalize      usbtask_slow_finalize
#define usbtask_get           usbtask_slow_get
#define usbtask_register      usbtask_slow_register

#define usbtask_resource_malloc  usbtask_slow_resource_malloc
#define usbtask_resource_free    usbtask_slow_resource_free
#define usbtask_resource_change  usbtask_slow_resource_change

#endif
