#ifndef _USBIO_TEST_H_
#define _USBIO_TEST_H_

#include <pthread.h>

#define USBIO_MAX(a, b) ((a) < (b)) ? (b) : (a)
#define USBIO_MIN(a, b) ((a) >= (b)) ? (b) : (a)


#define MEMSIZE 16777216

typedef struct usbio_context
{
  pthread_mutex_t usbio_mutex;
  unsigned int *mem;
} usbio_context;

usbio_context *usbio_open(int flag);
void usbio_close(usbio_context *ctxt);
int usbio_if_reset(usbio_context *ctxt);
int usbio_write(usbio_context *ctxt, int addr, int data);
int usbio_block_write(usbio_context *ctxt, int addr, 
                      unsigned int *data, int count);
int usbio_block_read(usbio_context *ctxt, int addr,
                     unsigned int *data, int count);
int usbio_mult_write(usbio_context *ctxt, int *addr, unsigned int *data,
                     int count);
#define usbio_read(ctxt, addr, data) usbio_block_read(ctxt, addr, data, 1)

#endif /* _USBIO_TEST_H_ */
