<commit_before>
/*
 * GPIB driver for FreeBSD.
 * Version 0.1 (No interrupts, no DMA)
 * Supports National Instruments AT-GPIB and AT-GPIB/TNT boards. 
 * (AT-GPIB not tested, but it should work)
 * 
 * Written by <NAME> (<EMAIL>) 
 * Some sections were based partly on the lpt driver.
 *  (some remnants may remain)
 *
 * This software is distributed with NO WARRANTIES, not even the implied
 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * The author grants any other persons or organizations permission to use
 * or modify this software as long as this message is kept with the software,
 * all derivative works or modified versions.
 *
 *
 */
/*Please read the README file for usage information*/

#include "gp.h"

#if NGP > 0 

#include "param.h"
#include "buf.h"
#include "systm.h"
#include "sys/ioctl.h"
#include "tty.h"
#include "proc.h"
#include "user.h"
#include "uio.h"
#include "kernel.h"
#include "malloc.h"



#include "i386/isa/gpibreg.h"
#include "i386/isa/gpib.h"
#include "i386/isa/isa.h"
#include "i386/isa/isa_device.h"


#define GPIBPRI  (PZERO+8)|PCATCH 
#define SLEEP_MAX 1000
#define SLEEP_MIN 4 

int initgpib(void);
void closegpib(void);
int sendgpibfifo(unsigned char device,char *data,int count);
int sendrawgpib(unsigned char device,char *data,int count);
int sendrawgpibfifo(unsigned char device,char *data,int count);
int readgpibfifo(unsigned char device,char *data,int count);
void showregs(void);
void enableremote(unsigned char device);
void gotolocal(unsigned char device);
void menableremote(unsigned char *device);
void mgotolocal(unsigned char *device);
void mtrigger(unsigned char *device);
void trigger(unsigned char device);
void mdevclear(unsigned char *device);
void devclear(unsigned char device);
char spoll(unsigned char device);

int gpprobe(struct isa_device *dvp);



int gpprobe(), gpattach();
struct   isa_driver gpdriver = {gpprobe, gpattach, "gp"};

#define   BUFSIZE      1024
#define   ATTACHED     0x08
#define   OPEN         0x04
#define   INIT	       0x02		


static struct gpib_softc {
	char	*sc_cp;		/* current data to send		*/
	int	sc_count;	/* bytes queued in sc_inbuf	*/
	int	sc_type;	/* Type of gpib controller	*/
	u_char	sc_flags;	/* flags (open and internal)	*/
        char	sc_unit;	/* gpib device number		*/ 	
        char	*sc_inbuf;	/* buffer for data		*/
} gpib_sc;
static int oldcount;
static char oldbytes[2];<commit_msg>Fix a few nasties in the conversion.<commit_after>
/*
 * GPIB driver for FreeBSD.
 * Version 0.1 (No interrupts, no DMA)
 * Supports National Instruments AT-GPIB and AT-GPIB/TNT boards. 
 * (AT-GPIB not tested, but it should work)
 * 
 * Written by <NAME> (<EMAIL>) 
 * Some sections were based partly on the lpt driver.
 *  (some remnants may remain)
 *
 * This software is distributed with NO WARRANTIES, not even the implied
 * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * The author grants any other persons or organizations permission to use
 * or modify this software as long as this message is kept with the software,
 * all derivative works or modified versions.
 *
 *
 */
/*Please read the README file for usage information*/

#include "gp.h"

#if NGP > 0 

#include "param.h"
#include "buf.h"
#include "systm.h"
#include "sys/ioctl.h"
#include "tty.h"
#include "proc.h"
#include "user.h"
#include "uio.h"
#include "kernel.h"
#include "malloc.h"



#include "i386/isa/gpibreg.h"
#include "i386/isa/gpib.h"
#include "i386/isa/isa.h"
#include "i386/isa/isa_device.h"

#define MIN(a,b) ((a < b) ? a : b)

#define GPIBPRI  (PZERO+8)|PCATCH 
#define SLEEP_MAX 1000
#define SLEEP_MIN 4 

int initgpib(void);
void closegpib(void);
int sendgpibfifo(unsigned char device,char *data,int count);
int sendrawgpib(unsigned char device,char *data,int count);
int sendrawgpibfifo(unsigned char device,char *data,int count);
int readgpibfifo(unsigned char device,char *data,int count);
void showregs(void);
void enableremote(unsigned char device);
void gotolocal(unsigned char device);
void menableremote(unsigned char *device);
void mgotolocal(unsigned char *device);
void mtrigger(unsigned char *device);
void trigger(unsigned char device);
void mdevclear(unsigned char *device);
void devclear(unsigned char device);
char spoll(unsigned char device);

int gpprobe(struct isa_device *dvp);
int gpattach();

struct   isa_driver gpdriver = {gpprobe, gpattach, "gp"};

#define   BUFSIZE      1024
#define   ATTACHED     0x08
#define   OPEN         0x04
#define   INIT	       0x02		


static struct gpib_softc {
	char	*sc_cp;		/* current data to send		*/
	int	sc_count;	/* bytes queued in sc_inbuf	*/
	int	sc_type;	/* Type of gpib controller	*/
	u_char	sc_flags;	/* flags (open and internal)	*/
        char	sc_unit;	/* gpib device number		*/ 	
        char	*sc_inbuf;	/* buffer for data		*/
} gpib_sc;
static int oldcount;
static char oldbytes[2];
{'fraction_non_alphanumeric': 0.10779300470443853, 'fraction_numerical': 0.014317856412354264, 'mean_word_length': 4.1691331923890065, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6570504', 'n_tokens_mistral': 1759, 'n_tokens_neox': 1636, 'n_words': 566}