Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / tc / ascvar.h
blobe4e48c951cefd937e3e36b4c1d780a1a37f0e123
1 /* $NetBSD: ascvar.h,v 1.10 2005/12/11 12:24:00 christos Exp $ */
4 /*
5 * State kept for each active SCSI device.
6 */
7 struct script;
9 typedef struct scsi_state {
10 struct script *script; /* saved script while processing error */
11 int statusByte; /* status byte returned during STATUS_PHASE */
12 int error; /* errno to pass back to device driver */
13 u_char *dmaBufAddr; /* DMA buffer address */
14 int dmalen; /* amount to transfer in this chunk */
15 int dmaresid; /* amount not transfered if chunk suspended */
16 int buflen; /* total remaining amount of data to transfer */
17 char *buf; /* current pointer within scsicmd->buf */
18 int flags; /* see below */
19 int msglen; /* number of message bytes to read */
20 int msgcnt; /* number of message bytes received */
21 u_char sync_period; /* DMA synchronous period */
22 u_char sync_offset; /* DMA synchronous xfer offset or 0 if async */
23 u_char msg_out; /* next MSG_OUT byte to send */
24 u_char msg_in[16]; /* buffer for multibyte messages */
25 } State;
27 /* state flags */
28 #define DISCONN 0x001 /* true if currently disconnected from bus */
29 #define DMA_IN_PROGRESS 0x002 /* true if data DMA started */
30 #define DMA_IN 0x004 /* true if reading from SCSI device */
31 #define DMA_RESUME 0x008 /* true if DMA was interrupted by disc. */
32 #define DMA_OUT 0x010 /* true if writing to SCSI device */
33 #define DID_SYNC 0x020 /* true if synchronous offset was negotiated */
34 #define TRY_SYNC 0x040 /* true if try neg. synchronous offset */
35 #define PARITY_ERR 0x080 /* true if parity error seen */
36 #define CHECK_SENSE 0x100 /* true if doing sense command */
40 * State kept for each active SCSI host interface (53C94).
43 struct asc_softc {
44 struct device sc_dev; /* us as a device */
46 bus_space_tag_t sc_bst;
47 bus_space_handle_t sc_bsh;
48 bus_space_handle_t sc_scsi_bsh;
49 bus_dma_tag_t sc_dmat;
50 bus_dmamap_t sc_dmamap;
52 asc_regmap_t *regs; /* chip address */
53 volatile int *dmar; /* DMA address register address */
54 int sc_id; /* SCSI ID of this interface */
55 int myidmask; /* ~(1 << myid) */
56 int state; /* current SCSI connection state */
57 int target; /* target SCSI ID if busy */
58 struct script *script; /* next expected interrupt & action */
59 ScsiCmd *cmd[ASC_NCMD]; /* active command indexed by SCSI ID */
60 State st[ASC_NCMD]; /* state info for each active command */
61 /* Start DMA routine */
62 int (*dma_start)(struct asc_softc *asc,
63 struct scsi_state *state,
64 void *cp, int flag, int len, int off);
65 /* End DMA routine */
66 void (*dma_end)(struct asc_softc *asc,
67 struct scsi_state *state, int flag);
69 u_char *dma_next;
70 int dma_xfer; /* DMA len still to go */
71 int min_period; /* Min transfer period clk/byte */
72 int max_period; /* Max transfer period clk/byte */
73 int ccf; /* CCF, whatever that really is? */
74 int timeout_250; /* 250ms timeout */
75 int tb_ticks; /* 4ns. ticks/tb channel ticks */
77 typedef struct asc_softc *asc_softc_t;
79 #define ASC_STATE_IDLE 0 /* idle state */
80 #define ASC_STATE_BUSY 1 /* selecting or currently connected */
81 #define ASC_STATE_TARGET 2 /* currently selected as target */
82 #define ASC_STATE_RESEL 3 /* currently waiting for reselect */
85 #define ASC_SPEED_25_MHZ 250
86 #define ASC_SPEED_12_5_MHZ 125
88 void ascattach(struct asc_softc *asc, int bus_speed);
89 int asc_intr(void *asc);
92 * DMA operations.
94 #define ASCDMA_READ 1
95 #define ASCDMA_WRITE 2