#define _DEBUG_GW16012_IO_
#endif
-/* system includes */
-
/* system includes */
// -ino: 060521-1036
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <sys/types.h>
#include <machine/sysarch.h>
#else
-#ifndef _WIN32
-#include <sys/io.h>
-#else
+#ifdef _WIN32
#include "errno.h"
#endif /* _WIN32 */
-#endif /* __FreeBSD__ */
+#endif /* __FreeBSD__, __FreeBSD_kernel__ */
#include <string.h>
#include <stdlib.h>
#include <time.h>
#if PARPORT_USE_PPDEV == 1
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <dev/ppbus/ppi.h>
#include <dev/ppbus/ppbconf.h>
#define PPRSTATUS PPIGSTATUS
#endif
#include <fcntl.h>
#include <sys/ioctl.h>
+#else /* not PARPORT_USE_PPDEV */
+#ifndef _WIN32
+#include <sys/io.h>
+#endif
#endif
#if PARPORT_USE_GIVEIO == 1
#include "log.h"
/* configuration */
-unsigned long gw16012_port;
+u16 gw16012_port;
/* interface variables
*/
.execute_queue = gw16012_execute_queue,
- .support_pathmove = 0,
-
.speed = gw16012_speed,
.register_commands = gw16012_register_commands,
.init = gw16012_init,
#if PARPORT_USE_PPDEV == 1
ioctl(device_handle, PPWDATA, &value);
#else
- #ifdef __FreeBSD__
+ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
outb(gw16012_port, value);
#else
outb(value, gw16012_port);
#if PARPORT_USE_PPDEV == 1
ioctl(device_handle, PPWCONTROL, &gw16012_control_value);
#else
- #ifdef __FreeBSD__
+ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
outb(gw16012_port + 2, gw16012_control_value);
#else
outb(gw16012_control_value, gw16012_port + 2);
int scan_size;
enum scan_type type;
u8 *buffer;
+ int retval;
+
+ /* return ERROR_OK, unless a jtag_read_buffer returns a failed check
+ * that wasn't handled by a caller-provided error handler
+ */
+ retval = ERROR_OK;
while (cmd)
{
#endif
gw16012_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size);
if (jtag_read_buffer(buffer, cmd->cmd.scan) != ERROR_OK)
- return ERROR_JTAG_QUEUE_FAILED;
+ retval = ERROR_JTAG_QUEUE_FAILED;
if (buffer)
free(buffer);
break;
case JTAG_SLEEP:
#ifdef _DEBUG_JTAG_IO_
- DEBUG("sleep", cmd->cmd.sleep->us);
+ DEBUG("sleep %i", cmd->cmd.sleep->us);
#endif
jtag_sleep(cmd->cmd.sleep->us);
break;
cmd = cmd->next;
}
- return ERROR_OK;
+ return retval;
}
#if PARPORT_USE_GIVEIO == 1
#if PARPORT_USE_PPDEV == 1
char buffer[256];
int i = 0;
- u8 control_port;
#endif
u8 status_port;
return ERROR_JTAG_INIT_FAILED;
}
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
DEBUG("opening /dev/ppi%d...", gw16012_port);
snprintf(buffer, 256, "/dev/ppi%d", gw16012_port);
DEBUG("...open");
-#ifndef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
i=ioctl(device_handle, PPCLAIM);
if (i<0)
{
WARNING("No gw16012 port specified, using default '0x378' (LPT1)");
}
- DEBUG("requesting privileges for parallel port 0x%x...", gw16012_port);
+ DEBUG("requesting privileges for parallel port 0x%lx...", gw16012_port);
#if PARPORT_USE_GIVEIO == 1
if (gw16012_get_giveio_access() != 0)
#else /* PARPORT_USE_GIVEIO */
DEBUG("...privileges granted");
/* make sure parallel port is in right mode (clear tristate and interrupt */
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
outb(gw16012_port + 2, 0x0);
#else
outb(0x0, gw16012_port + 2);