atapidev.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 213 行

H
213
字号
/*******************************************************************
 * 
 *  Copyright C 2005 by Amlogic, Inc. All Rights Reserved.
 *
 *  Description: 
 *
 *  Author: Amlogic Software
 *  Created: Thu Nov 10 23:57:23 2005
 *
 *******************************************************************/
//#define WITH_VOLATILE_INBLOCK
#ifdef WITH_VOLATILE_INBLOCK
#define _VO volatile
#else
#define _VO
#endif
#define IDE_DMA_MODE 1

unsigned char DVDROM_StopCmd(void);
unsigned char DVDROM_StartCmd(int type);
unsigned char DVDROM_CD_StartCmd(void);
unsigned CDROM_TestUnitReady_(void);
void HardwareReset(unsigned char);
void WaitHardwareResetDone(void);
void Device_Reset(void);
#define BLOCK_BUF_SIZE 1024*3

#define ATAPI_SUBSTA_IDLE 0
#define ATAPI_SUBSTA_BUSY 1
#define ATAPI_SUBSTA_RESETING 2
#define ATAPI_SUBSTA_SENSEBUSY 3


#define DESCR_GET_DISC_KEY 0
#define DESCR_GET_TITLE_KEY 1
#define DESCR_STOP_PROCESS 2
#define DESCR_IND_SUCCESS  3
#define DESCR_IND_FAIL 4
#if 1
typedef struct
{
   struct list_head list; //8 bytes	
   unsigned int sector;
   unsigned int max;
   unsigned int errorflag;
   unsigned short header_offset;
   unsigned char offset;
   unsigned char info0; //0: normal, 1: search fail, 2: none serious error for cdda
   unsigned char cd_read_type;
   unsigned char reserved0;
   unsigned char reserved1;
   unsigned char reserved2;
   _VO unsigned char* data;
}THOM_BUF_HDR;
#endif
typedef struct
{
	struct{
		unsigned char SenseKey;
		unsigned char ASC;
		unsigned char ASCQ;
	}sense ;
	unsigned char 		blocktype;  /* 0: dvdrom, 1:dvdrw-, 2: dvdrw+, 3:hd */
	unsigned char		status;  /* COMMAND_SUCCESS, COMMAND_FAIL,COMMAND_BUSY*/
	unsigned char		packet_cmd[12];     /* save atapi command packet */
	unsigned char blockbuf[BLOCK_BUF_SIZE];
	unsigned cmd_timer;  /* for command timeout */
	unsigned short	host_read_point;
	unsigned char block_state;
	unsigned char substate;
	unsigned char process_state; /*depend on each process*/
	unsigned handle;
	unsigned src_chk_handle;
	unsigned descramble_handle;
	unsigned door_status;
	unsigned char disktype; //0:DVD, 1:CD
#if 1	
	unsigned short sector_unit;
	unsigned char max_trytimes;
	unsigned short buf_map_size0;
	unsigned short buf_map_size;
	unsigned short buf_map_top;
	unsigned char pre_read_range;
	unsigned track_buffer_address;
	THOM_BUF_HDR* pre_thombuf0;
	THOM_BUF_HDR* pre_thombuf1;
#endif	
}ATAPIDEV;

typedef unsigned int MEMBER;

typedef struct
{
   int out;
   int in;
   int num;
   int size;
   MEMBER *members;
}
MEMBER_Q;
#define SC_STOP 0
#define SC_CHECK 1
#define SC_NOCHK_RD 2
#define SC_DOOR_OPENED 3
#define SC_SEARCH 4
#define SC_ROUND_SEARCH 5
#define SC_BETTER_SEARCH 6 	

//#define SEACH_TRY_COUNT 10

#define SRC_CHK_CMD_SEARCH 1
#define SRC_CHK_CMD_STOPREAD 2
#define SRC_CHK_CMD_NOCHK_RD 3
#define SRC_CHK_CMD_SCH_FAIL 4
#define SRC_CHK_CMD_CHK_FAIL 5
#define SRC_CHK_CMD_INIT 6
#define SRC_CHK_CMD_ATAPI 7


typedef struct
  {
    MINIMSG MsgHdr;                /* message header */
    unsigned char cmd_type;
    unsigned char reserved;
    unsigned char device_id;
    unsigned char need_ind_type;
    unsigned int len;

    unsigned block_adr;
    unsigned char mode;  
    unsigned char cd_read_type;
    /* for data*/
  }SCRCHK_CMDHDR; 


extern ATAPIDEV	Block;
extern unsigned char drv_num;
extern TOC DiscInfor;
extern unsigned char err_status;
extern unsigned Get_Disc_Key();

#define CHECKING_BEGIN 0
#define CHECKING_UNIT_READY 1
#define CHECKING_DISCTYPE 2

#define ATAPI_CMD_BASE 0xa0
#define ATAPI_CMD_INIT ATAPI_CMD_BASE+0
#define ATAPI_CMD_READ ATAPI_CMD_BASE+1

#define DEBUG_PRINT_USER_CMD 			0x1
#define DEBUG_ATAPI_CMD		 			0x2	
#define DEBUG_RETRY 					0x4
#define DEBUG_TRACE_BUF					0x8
#define DEBUG_PRINT_SEEK				0x10
#define DEBUG_ATAPI						0x20
#define DEBUG_UNKNOW_DMA_ABORTED 		0x40
#define DEBUG_CHECK_DATA				0x80
#define DEBUG_DESCRAMBLE				0x100


#define BUF_PROCESS_RESET  		0
#define BUF_PROCESS_ALLOC		1
#define BUF_PROCESS_DEALLOC		2
#define BUF_PROCESS_INTO_CHKBUF		3
#define BUF_PROCESS_OUT_CHKBUF		4
#define BUF_PROCESS_INTO_BUF		5
#define BUF_PROCESS_OUT_BUF		6
#define BUF_PROCESS_OTHER		7

#define COMMENT_THOMBUF0_SCH_READY 	1
#define COMMENT_THOMBUF1_SCH_READY 	2
#define COMMENT_THOMBUF0_SAVE		3

#define SUNIT (Block.sector_unit)

#define COMMENT_THOMBUF1_SAVE		4
#define COMMENT_THOMBUF0_EXCHANGE	5
#define COMMENT_PRETHOMBUF0_EXCHANGE	6
#define COMMENT_THOMBUF1_EXCHANGE	7
#define COMMENT_PRETHOMBUF1_EXCHANGE	8
#define COMMENT_ONLYTHOMBUF0_SCH_SEND 	9
#define COMMENT_THOMBUF0_SCH_SEND 	10
#define COMMENT_THOMBUF1_SCH_SEND	11
#define COMMENT_THOMBUF0_CHK_READY	12
#define COMMENT_THOMBUF0_CHK_SEND 	13
#define COMMENT_PRETHOMBUF0_SEND	14
#define COMMENT_PRETHOMBUF1_SEND	15
#define COMMENT_FAILDATA_SEND		16
#define COMMENT_RETURN_BACK_BUF		17
#define COMMENT_USING_BUF		18
#define COMMENT_EMPTY_BUF		19
#define COMMENT_EMPTY_CHKBUF		20
#define COMMENT_FREE_PRETHOMBUF0	21
#define COMMENT_FREE_PRETHOMBUF1	22

void thom_send_chk_sch_cmd(unsigned int sector,unsigned char cmdtype);
int GetPathTableStartSector_(void);

#define MU (75*60)
#define SU 75
#define CDBASEADR SU*2
#define USER_DATA_OFFSET 0
#define BLOCK_MOVE_SIZE (32)						

extern _VO IDEDMA_DESCRIPTOR* Ide_Descriptor2;

#define DISCTYPE_DVD 0
#define DISCTYPE_CD 1
#define DISCTYPE_NONE 2

extern unsigned char track_buffer_enable;
extern int Block_Print_Flag;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?