/* hpib.h  --  HP-IB commands */

#define H_PTA      0x5e    /* Primary talk address */
#define H_PLA      0x3e    /* Primary listen address */
#define H_UNT      0x5f    /* untalk */
#define H_UNL      0x3f    /* unlisten */
#define H_DTAC     0x40
#define H_DLAC     0x20  
#define H_DCLR     0x04    /* clear */

#define A_DSJ	 0x70
#define A_DSAD	 0x68
#define A_DSTAT  0x03
#define A_SEEK   0x02
#define A_BREAD  0x6a
#define A_BWRITE 0x69
#define A_READ   0x05
#define A_WRITE  0x08
#define A_RADDR  0x14
#define A_SEND   0x60
#define A_RECV   0x60
#define A_SFM    0x0f
#define A_RECAL  0x01
#define A_IDNT   0x60
#define A_DCLR   0x70

#define A_TSTAT  0x61
#define A_TSAD   0x61
#define A_TBYTCT 0x62
#define A_TEND   0x67

/****************************************************************************
  amigo_macros  to simplify/clarify amigo protocol (if that's possible)
 ****************************************************************************/

#define disab_sim sim->sim_ctrl=zero
#define cmd       sim->phi_stat=P_FF_ATN
#define data      sim->phi_stat=zero
#define eoi       sim->phi_stat=P_FF_EOI
#define unlisten  cmd;sim->phi_fifo=H_UNL
#define untalk    cmd;sim->phi_fifo=H_UNT
#define shutup    unlisten;sim->phi_fifo=H_UNT
#define fif       sim->phi_fifo
#define tlkadr(u)     u | H_DTAC
#define inbound(x,u)  cmd;fif=H_PLA;fif=tlkadr(u);fif=x
#define lsnadr(u)     u | H_DLAC
#define otbound(x,u)  cmd;fif=H_PTA;fif=lsnadr(u);fif=x
#define msg_bytecount sim->phi_fifo=cxf->cx_bcount
