leomacro.h
4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
* F i l e N a m e : l e o m a c r o . h
*
****************************************************************************
* (C) Copyright ALPS Electric Co., Ltd. 1996
****************************************************************************
* Version
*
* ver Date
* ---- --------
* 1.04 '96-11-17 Add leomecha.c function leoWrite_drive_reset(void) .
* 1.03 '96-10-30 Change leomecha.c function external definition .
* 1.02 '96-09-18 Change drive_flg and clr_que_flg handling .
* 1.01 '96-09-17 Add cur_status in leoChk_asic_ready() argment .
* Change leoChk_clr_que_flag(),leoSet_clr_que_flag(),
* and leoClr_clr_que_flag() use LEOclr_que_flag .
* 1.00 '96-08-02 Initial revision .
****************************************************************************
*/
/************************************************************/
/* FUNCTIONALLY MACRO FOR DEVICE DRIVER */
/************************************************************/
/*----------------------------------------------*/
/* Macros to Acccesss Drive Registers */
/*----------------------------------------------*/
#define leoAd16ReadIo(adr,data) osEPiReadIo(LEOPiInfo,adr,data)
#define leoAd16WriteIo(adr,data) osEPiWriteIo(LEOPiInfo,adr,data)
#define leoAd16StartDma(flag) osEPiStartDma(LEOPiInfo,&LEOPiDmaParam,flag)
/*----------------------------------------------*/
#define leoGet_leo_status(x) osEPiReadIo(LEOPiInfo,ASIC_STATUS, x)
#define leoGet_leo_bm_status(x) osEPiReadIo(LEOPiInfo,ASIC_BM_STATUS, x)
#define leoGet_leo_err_sec(x) osEPiReadIo(LEOPiInfo,ASIC_ERR_SECTOR, x)
#define leoGet_leo_asic_id(x) osEPiReadIo(LEOPiInfo,ASIC_ID_REG, x)
#define leoGet_leo_asic_data(x) osEPiReadIo(LEOPiInfo,ASIC_DATA, x)
#define leoGet_leo_cur_tk(x) osEPiReadIo(LEOPiInfo,ASIC_CUR_TK, x)
/*----------------------------------------------*/
/* Macros for setup BM */
/*----------------------------------------------*/
#define leoMicro_pc_disable() LEOasic_seq_ctl_shadow &= (~MICRO_PC_ENABLE),\
osEPiWriteIo(LEOPiInfo,ASIC_SEQ_CTL,LEOasic_seq_ctl_shadow)
#define leoMicro_pc_enable() LEOasic_seq_ctl_shadow |= MICRO_PC_ENABLE,\
osEPiWriteIo(LEOPiInfo,ASIC_SEQ_CTL,LEOasic_seq_ctl_shadow)
#define leoClear_bm_error() osEPiWriteIo(LEOPiInfo,ASIC_BM_CTL,(LEOasic_bm_ctl_shadow | BM_RESET) ),\
osEPiWriteIo(LEOPiInfo,ASIC_BM_CTL, LEOasic_bm_ctl_shadow)
#define leoStart_sequencer() osEPiWriteIo(LEOPiInfo,ASIC_BM_CTL,(LEOasic_bm_ctl_shadow | START_BM))
#define leoStop_sequencer() osEPiWriteIo(LEOPiInfo,ASIC_BM_CTL,(LEOasic_bm_ctl_shadow | BM_RESET) ),\
osEPiWriteIo(LEOPiInfo,ASIC_BM_CTL, LEOasic_bm_ctl_shadow)
#define leoClear_mecha_int() /* osEPiWriteIo(LEOPiInfo,ASIC_BM_CTL,(LEOasic_bm_ctl_shadow | (BM_MECHA_INT_RESET+BM_INT_MASK))),\ */
/* osEPiWriteIo(LEOPiInfo,ASIC_BM_CTL,(LEOasic_bm_ctl_shadow &= (~BM_INT_MASK))); */
/*----------------------------------------------*/
/* Macros for system information */
/*----------------------------------------------*/
#define leoChk_sys_read() (LEOdrive_flag)
#define leoSet_sys_read() (LEOdrive_flag = 0xff)
#define leoClr_sys_read() (LEOdrive_flag = 0)
/*------------------------------------*/
/* Macros for CLEAR_QUEUE command */
/*------------------------------------*/
#define leoChk_clr_que_flag() (LEOclr_que_flag)
#define leoSet_clr_que_flag() (LEOclr_que_flag = 0xff)
#define leoClr_clr_que_flag() (LEOclr_que_flag = 0)
/*-----------------------------------*/
/* External Functions Definitions */
/*-----------------------------------*/
#ifndef _ASIC_IF
extern u8 leoChk_asic_ready(u32 asic_cmd);
extern u8 leoWait_mecha_cmd_done(u32 asic_cmd );
extern u8 leoSend_asic_cmd_w(u32 asic_cmd, u32 asic_data);
extern u8 leoDetect_index_w(void);
extern u8 leoRecal_w(void);
extern u8 leoSeek_i(u16 rwmode);
extern u8 leoSeek_w(void);
extern u8 leoChk_cur_drvmode(void);
extern u32 leoChk_err_retry(u32 sense);
extern void leoDrive_reset(void);
#endif
#define leoSeek_read_i() (leoSeek_i(R_MODE))
#define leoSeek_write_i() (leoSeek_i(W_MODE))