/* usb/lib/data.h
 *
 * (c) 2002 Simtec Electronics
 *
 * Ben Dooks
 *
 * USB data manipulation routines
 *
 * $Id: data.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_LIB_DATA_H
#define __USB_LIB_DATA_H "$Id: data.h,v 1.10 2003/08/06 15:56:11 ben Exp $"

/* define USB_DATA_SLOW to use the routine based variants of this code
 * instead of in-line macros
*/

#ifndef USB_DATA_SLOW
#include "usb/lib/data-fast.h"
#define USB_DATA_FAST
#endif

/**  usblib_data_content_get
@param data_structure
@param act_offset
@param array_element
*/
extern unsigned long usblib_data_content_get(void *data_structure,
					  unsigned long act_offset,
					  int array_element);

/**  usblib_data_content_set
@param data_structure
@param act_offset
@param array_element
@param act_value
*/
extern void usblib_data_content_set(void *data_structure,
				 unsigned long act_offset,
				 int array_element,
				 unsigned long act_value);

/** usblib_data_content_address
@param data_structure
@param act_offset
@param array_element
*/
extern void *usblib_data_content_address(void *data_structure,
				         unsigned long act_offset,
				         int array_element);

#ifndef USB_DATA_FAST
/** general usb_data_content_get function call - switched between a function or macro depending on USB_DATA_FAST */
#define usb_data_content_get(a,b,c)   usblib_data_content_get(a,b,c)
/** general usb_data_content_set function call - switched between a function or macro depending on USB_DATA_FAST */
#define usb_data_content_set(a,b,c,d) usblib_data_content_set(a,b,c,d)
/** general usb_data_content_address function call - switched between a function or macro depending on USB_DATA_FAST */
#define usb_data_content_address(a,b,c) usblib_data_content_address(a,b,c)
#else
#define usb_data_content_get(a,b,c)     usb_fast_dcg(a,b,c)
#define usb_data_content_set(a,b,c,d)   usb_fast_dcs(a,b,c,d)
#define usb_data_content_address(a,b,c) usb_fast_dca(a,b,c)
#endif

#ifndef usb_dcg
#define usb_dcg(a,b,c) usb_data_content_get(a,b,c)
#endif

#ifndef usb_dcs
#define usb_dcs(a,b,c,d) usb_data_content_set(a,b,c,d)
#endif

#ifndef usb_dca
#define usb_dca(a,b,c) usb_data_content_address(a,b,c)
#endif

#endif /* __USB_LIB_DATA_H */
