/* libnexys.h
 * Main include file for libnexys
 * libnexys, a free driver for Digilent NEXYS2 boards
 *
 * Copyright (c) 2007-2008 Joshua Wise
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License.
 *
 * Commercial licenses are available by request.
 */
#ifndef _LIBNEXYS_H
#define _LIBNEXYS_H

#ifdef LIBNEXYS_INTERNAL
#ifdef WIN32_NATIVE
#	include <windows.h>
#	include "gendefs.h"
#	include "dpcdefs.h"
#	include "dpcutil.h"
	typedef HANDLE nexys2_t;
#else
#ifdef PARPORT
	typedef int nexys2_t;
#else
#	include <usb.h>
	typedef usb_dev_handle *nexys2_t;
#endif
#endif
#else
	typedef void *nexys2_t;
#endif

extern nexys2_t nexys2_init(void);
extern int nexys2_jtag_enable(nexys2_t dev);
extern int nexys2_jtag_disable(nexys2_t dev);
extern int nexys2_jtag_setbits(nexys2_t dev, int tms, int tdi, int tck);
extern int nexys2_jtag_puttdi(nexys2_t dev, int tms, int nbits, unsigned char *bits, unsigned char *obits);
extern int nexys2_jtag_puttmstdi(nexys2_t dev, int nbits, unsigned char *bits, unsigned char *obits);
extern int nexys2_jtag_gettdo(nexys2_t dev, int tdi, int tms, int nbits, unsigned char *obits);

#endif
