dbp.h 1.32 KB
#ifndef __DBP_H__
#define __DBP_H__

/*************************************************************************
 *
 *  File: dbp.h
 *
 *  BB debug board parallel port host definitions and function prototypes
 */


#include <linux/parport.h>
#include <linux/ppdev.h>
#include "PR/bcp.h"
#include "jtag.h"


typedef enum { dbp_JTAG, dbp_TinyMon, dbp_Rmon, dbp_SIM, dbp_MUX } dbp_Protocol;

#define DBP_CTRL_READ		0
#define DBP_CTRL_WRITE		1

#define DBP_CTRL_SET_WR_PTR	0x80
#define DBP_CTRL_SET_RD_PTR	0xc0
#define DBP_CTRL_RESET_HOST	0x40
#define DBP_CTRL_SET_HOST_REQ	0x01
#define DBP_CTRL_SET_HOST_ACK	0x02
#define DBP_CTRL_CLR_BB_REQ	0x04
#define DBP_CTRL_CLR_BB_ACK	0x08

#define DBP_STATUS_HOST_REQ	0x01
#define DBP_STATUS_HOST_ACK	0x02
#define DBP_STATUS_BB_REQ	0x04
#define DBP_STATUS_BB_ACK	0x08

extern int dbp_verbose;         /* default 0, can be set by lib clients */
extern int dbp_dont_negotiate;  /* default 0, can be set by lib clients */

int dbp_open(dbp_Protocol protocol, const char* devname_or_null);
int dbp_close();
int dbp_cl(int);
int dbp_set_protocol(dbp_Protocol protocol); /* only valid for open dbp */
int dbp_ctrl(int wr, unsigned char* ctrl);
int dbp_set_wptr(int addr);
int dbp_set_rptr(int addr);
int dbp_write_data(const unsigned char* buf, int n);
int dbp_read_data(unsigned char* buf, int n);

#endif /* __DBP_H__ */