linux/drivers/scsi/pcmcia/nsp_cs.h

/*=======================================================/
  Header file for nsp_cs.c
      By: YOKOTA Hiroshi <[email protected]>

    Ver.1.0 : Cut unused lines.
    Ver 0.1 : Initial version.

    This software may be used and distributed according to the terms of
    the GNU General Public License.

=========================================================*/

#ifndef  __nsp_cs__
#define __nsp_cs__

/* for debugging */
//#define NSP_DEBUG 9

/*
#define static
#define inline
*/

/************************************
 * Some useful macros...
 */

/* SCSI initiator must be ID 7 */
#define NSP_INITIATOR_ID

#define NSP_SELTIMEOUT

/***************************************************************************
 * register definitions
 ***************************************************************************/
/*========================================================================
 * base register
 ========================================================================*/
#define IRQCONTROL
#define IRQCONTROL_RESELECT_CLEAR
#define IRQCONTROL_PHASE_CHANGE_CLEAR
#define IRQCONTROL_TIMER_CLEAR
#define IRQCONTROL_FIFO_CLEAR
#define IRQCONTROL_ALLMASK
#define IRQCONTROL_ALLCLEAR
#define IRQCONTROL_IRQDISABLE

#define IRQSTATUS
#define IRQSTATUS_SCSI
#define IRQSTATUS_TIMER
#define IRQSTATUS_FIFO
#define IRQSTATUS_MASK

#define IFSELECT
#define IF_IFSEL
#define IF_REGSEL

#define FIFOSTATUS
#define FIFOSTATUS_CHIP_REVISION_MASK
#define FIFOSTATUS_CHIP_ID_MASK
#define FIFOSTATUS_FULL_EMPTY

#define INDEXREG
#define DATAREG
#define FIFODATA
#define FIFODATA1
#define FIFODATA2
#define FIFODATA3

/*====================================================================
 * indexed register
 ====================================================================*/
#define EXTBUSCTRL

#define CLOCKDIV
#define CLOCK_40M
#define CLOCK_20M
#define FAST_20

#define TERMPWRCTRL
#define POWER_ON

#define SCSIIRQMODE
#define SCSI_PHASE_CHANGE_EI
#define RESELECT_EI
#define FIFO_IRQ_EI
#define SCSI_RESET_IRQ_EI

#define IRQPHASESENCE
#define LATCHED_MSG
#define LATCHED_IO
#define LATCHED_CD
#define LATCHED_BUS_FREE
#define PHASE_CHANGE_IRQ
#define RESELECT_IRQ
#define FIFO_IRQ
#define SCSI_RESET_IRQ

#define TIMERCOUNT

#define SCSIBUSCTRL
#define SCSI_SEL
#define SCSI_RST
#define SCSI_DATAOUT_ENB
#define SCSI_ATN
#define SCSI_ACK
#define SCSI_BSY
#define AUTODIRECTION
#define ACKENB

#define SCSIBUSMON

#define SETARBIT
#define ARBIT_GO
#define ARBIT_FLAG_CLEAR

#define ARBITSTATUS
/*#  define ARBIT_GO        BIT(0)*/
#define ARBIT_WIN
#define ARBIT_FAIL
#define RESELECT_FLAG

#define PARITYCTRL
#define PARITYSTATUS

#define COMMANDCTRL
#define CLEAR_COMMAND_POINTER
#define AUTO_COMMAND_GO

#define RESELECTID
#define COMMANDDATA

#define POINTERCLR
#define POINTER_CLEAR
#define ACK_COUNTER_CLEAR
#define REQ_COUNTER_CLEAR
#define HOST_COUNTER_CLEAR
#define READ_SOURCE
#define ACK_COUNTER
#define REQ_COUNTER
#define HOST_COUNTER

#define TRANSFERCOUNT

#define TRANSFERMODE
#define MODE_MEM8
#define MODE_MEM32
#define MODE_ADR24
#define MODE_ADR32
#define MODE_IO8
#define MODE_IO32
#define TRANSFER_GO
#define BRAIND

#define SYNCREG
#define SYNCREG_OFFSET_MASK
#define SYNCREG_PERIOD_MASK
#define SYNCREG_PERIOD_SHIFT

#define SCSIDATALATCH
#define SCSIDATAIN
#define SCSIDATAWITHACK
#define SCAMCONTROL
#define SCAMSTATUS
#define SCAMDATA

#define OTHERCONTROL
#define TPL_ROM_WRITE_EN
#define TPWR_OUT
#define TPWR_SENSE
#define RA8_CONTROL

#define ACKWIDTH
#define CLRTESTPNT
#define ACKCNTLD
#define REQCNTLD
#define HSTCNTLD
#define CHECKSUM

/************************************************************************
 * Input status bit definitions.
 ************************************************************************/
#define S_MESSAGE
#define S_IO
#define S_CD
#define S_BUSY
#define S_ACK
#define S_REQUEST
#define S_SELECT
#define S_ATN

/***********************************************************************
 * Useful Bus Monitor status combinations.
 ***********************************************************************/
#define BUSMON_SEL
#define BUSMON_BSY
#define BUSMON_REQ
#define BUSMON_IO
#define BUSMON_ACK
#define BUSMON_BUS_FREE
#define BUSMON_COMMAND
#define BUSMON_MESSAGE_IN
#define BUSMON_MESSAGE_OUT
#define BUSMON_DATA_IN
#define BUSMON_DATA_OUT
#define BUSMON_STATUS
#define BUSMON_SELECT
#define BUSMON_RESELECT
#define BUSMON_PHASE_MASK

#define BUSPHASE_SELECT
#define BUSPHASE_COMMAND
#define BUSPHASE_MESSAGE_IN
#define BUSPHASE_MESSAGE_OUT
#define BUSPHASE_DATA_IN
#define BUSPHASE_DATA_OUT
#define BUSPHASE_STATUS

/*====================================================================*/

scsi_info_t;


/* synchronous transfer negotiation data */
sync_data;

nsp_hw_data;

/****************************************************************************
 *
 */

/* Card service functions */
static void        nsp_cs_detach (struct pcmcia_device *p_dev);
static void        nsp_cs_release(struct pcmcia_device *link);
static int        nsp_cs_config (struct pcmcia_device *link);

/* Linux SCSI subsystem specific functions */
static struct Scsi_Host *nsp_detect     (struct scsi_host_template *sht);
static const  char      *nsp_info       (struct Scsi_Host *shpnt);
static        int        nsp_show_info  (struct seq_file *m,
	                                 struct Scsi_Host *host);
static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt);

/* Error handler */
/*static int nsp_eh_abort       (struct scsi_cmnd *SCpnt);*/
/*static int nsp_eh_device_reset(struct scsi_cmnd *SCpnt);*/
static int nsp_eh_bus_reset    (struct scsi_cmnd *SCpnt);
static int nsp_eh_host_reset   (struct scsi_cmnd *SCpnt);
static int nsp_bus_reset       (nsp_hw_data *data);

/* */
static void nsphw_init           (nsp_hw_data *data);
static bool nsphw_start_selection(struct scsi_cmnd *SCpnt);
static void nsp_start_timer      (struct scsi_cmnd *SCpnt, int time);
static int  nsp_fifo_count       (struct scsi_cmnd *SCpnt);
static void nsp_pio_read         (struct scsi_cmnd *SCpnt);
static void nsp_pio_write        (struct scsi_cmnd *SCpnt);
static int  nsp_nexus            (struct scsi_cmnd *SCpnt);
static void nsp_scsi_done        (struct scsi_cmnd *SCpnt);
static int  nsp_analyze_sdtr     (struct scsi_cmnd *SCpnt);
static int  nsp_negate_signal    (struct scsi_cmnd *SCpnt,
				  unsigned char mask, char *str);
static int  nsp_expect_signal    (struct scsi_cmnd *SCpnt,
				  unsigned char current_phase,
				  unsigned char  mask);
static int  nsp_xfer             (struct scsi_cmnd *SCpnt, int phase);
static int  nsp_dataphase_bypass (struct scsi_cmnd *SCpnt);
static void nsp_reselected       (struct scsi_cmnd *SCpnt);
static struct Scsi_Host *nsp_detect(struct scsi_host_template *sht);

/* Interrupt handler */
//static irqreturn_t nspintr(int irq, void *dev_id);

/* Debug */
#ifdef NSP_DEBUG
static void show_command (struct scsi_cmnd *SCpnt);
static void show_phase   (struct scsi_cmnd *SCpnt);
static void show_busphase(unsigned char stat);
static void show_message (nsp_hw_data *data);
#else
#define show_command(ptr)
#define show_phase(SCpnt)
#define show_busphase(stat)
#define show_message(data)
#endif

/*
 * SCSI phase
 */
enum _scsi_phase {};

enum _data_in_out {};

enum _burst_mode {};

/* scatter-gather table */
#define BUFFER_ADDR(SCpnt)

#endif  /*__nsp_cs__*/
/* end */