blockdev.h

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

H
182
字号
/*******************************************************************
 * 
 *  Copyright C 2005 by Amlogic, Inc. All Rights Reserved.
 *
 *  Description: 
 *
 *  Author: Amlogic Software
 *  Created: Thu Nov 10 23:57:40 2005
 *
 *******************************************************************/
#ifndef _BLOCKDEV_H
#define _BLOCKDEV_H

#define BLOCK_ID_ATAPI 		0
#define BLOCK_ID_THOM  		1
#define BLOCK_ID_PHILIPS 	2
#define BLOCK_ID_ANY		0xff
extern unsigned block_id;

#ifndef AVOS
#define BLOCK_STATE_STOP 		0
#define BLOCK_STATE_DOOROPEN 		1
#define BLOCK_STATE_CHECKINGDISC 	2
#define BLOCK_STATE_READINGINFO 	3
#define BLOCK_STATE_NODISC 		4
#define BLOCK_STATE_DISCERROR 		5
#define BLOCK_STATE_IDLE 		6
#define BLOCK_STATE_PROCESSING 		7
#define BLOCK_STATE_READING 		8
//#ifndef AVOS
#endif

#define CMD_NEED_NONE_IND 0
#define CMD_NEED_STATUS_IND (1<<0)
#define CMD_NEED_DATA_IND (1<<1)

#ifndef AVOS
#define ADR_TYPE_SECTOR 	0
#define ADR_TYPE_MSF 		1

//2048
#define MODE_2048 		0
//below only for cd
//2340
#define MODE_2340		1
//2352
#define MODE_CDDA 		3
//12+2324
#define MODE_VCD		4
//2352+96subcode
#define MODE_CDG 		5
//QSubCode; for test
#define MODE_QSUBCODE		10

#define CONTROL_FORCE_SEND 	0x1
#define CONTROL_CDDA_REPAIR 0x2
#define CONTROL_WITHINFO_ERRFLAG 0x4
#define CONTROL_WITHINFO_SUBCH 0x8
/*CONTROL_WITHINFO_ERRFLAG:use with CONTROL_FORCE_SEND,block_driver will place errflag in dest_adr_ext 
CONTROL_WITHINFO_SUBCH: use in MODE_CDDA, block_driver will place subchan data in dest_adr_ext, 98bytes/1sector */

typedef struct{
    union{
	TOC cddvdinfo;
    }discinfo;	
} DiscInformation;
//#ifndef AVOS
#else
#define MODE_QSUBCODE		10
#endif

typedef struct
  {
    MINIMSG MsgHdr;                /* message header */
    unsigned char cmd_type;
    unsigned char trytimes;
    unsigned char device_id;
    unsigned char need_ind_type;
    unsigned int len;
    union{
    	struct{
    		unsigned block_adr;
    		unsigned dest_adr;
    		unsigned dest_adr_ext;
    		unsigned short boffset; 
    		unsigned short blength; /*while length be 0,only read 1 sector, boffset is the start position in bytes, and blength is the length in bytes
    					while length not be 0, it is control flag, bit0: error force send	*/
    		unsigned char length;
    		unsigned char endian;
    		unsigned char adrtype;  /*0:sector, 1:MSF (only for cd)*/  
    		unsigned char mode; 
	}rdcmd;
    	struct{
    		DiscInformation* pdiscinfo;
    		unsigned reserved0;
    		unsigned reserved1;
    		unsigned reserved2;
    		unsigned reserved3;
	}inqcmd;
    	struct{
    		unsigned type;
    		unsigned data0;
    		unsigned data1;
    		unsigned data2;
    		unsigned data3;
	}setcmd;
    }cmd;	
    /* for data*/
  }BLOCKDEV_CMDHDR; 

#ifdef AVOS
#define BLOCK_NULL   		  0	  
#define BLOCK_ASYREAD  		  1
#define BLOCK_STOPREAD 		  (BLKIO_STOPREAD&0xff)
#define BLOCK_EJECTDISC           (BLKIO_EJECTDISC&0xff)
#define BLOCK_LOADDISC            (BLKIO_LOADDISC&0xff)
#define BLOCK_DESCRAMBLE          (BLKIO_DESCRAMBLE&0xff)
#define BLOCK_STOP                (BLKIO_STOP&0xff)
#define BLOCK_START               (BLKIO_START&0xff)
#define BLOCK_GETDISCINFO         (BLKIO_GETDISCINFO&0xff)
#define BLOCK_STATE_SETTING	  (BLKIO_SETTING&0xff)

#define MAX_USER_CMD  		  BLOCK_STATE_SETTING+1	
#else
#define BLOCK_NULL   0	  
#define BLOCK_ASYREAD  1
#define BLOCK_STOPREAD 2
#define BLOCK_EJECTDISC 3 
#define BLOCK_LOADDISC 4
#define BLOCK_DESCRAMBLE 5
#define BLOCK_STOP 6
#define BLOCK_START 7
#define BLOCK_GETDISCINFO  8
#define BLOCK_STATE_SETTING 		9
#endif

#define BLOCK_STATE_TIMEOUT 100
#define BLOCK_STATE_SUCCESS 101
#define BLOCK_STATE_FAIL 102
#define BLOCK_STATE_DATAREADY 103
#define BLOCK_STATE_MSFDATAREADY 104

#define BLOCK_ATAPI_SENDKEY 110
#define BLOCK_ATAPI_REPORTKEY 111 

typedef struct
  {
    MINIMSG MsgHdr;                /* message header */
    unsigned char ind_type;
    unsigned char reserved;
    unsigned char device_id;
    unsigned char reserved1;
    unsigned int len;
    unsigned int data; /*for BLOCK_IND_DATAERROR,BLOCK_IND_DATAREADY, it is errorflag*/
    /* for data*/
}BLOCKDEV_INDHDR;


#define BLOCK_IND_SUCCESS  1
#define BLOCK_IND_FAIL 	2
#define BLOCK_IND_DATAREADY  3
#define BLOCK_IND_DATAERROR  4


#define BS_STATE 0
#define BS_BUFFER_TYPE 1
#define BS_SECTOR_UNIT 2
#define BS_START_TYPE 3
#define BS_TRACKBUF_START 10
#define BS_TRACKBUF_SIZE 11
#define BS_FORCE_EJECT 20
// 
#define BS_CDTYPE23_BLKMOV_DIRECTLY 30
#define BS_LOADER_SPEED 31
#define BS_CDTYPE23_OPTIMIZE 32

extern unsigned char Block_Status(unsigned char item);
extern unsigned int Block_Open();
extern void Block_Set(unsigned char item, unsigned value);

#endif

⌨️ 快捷键说明

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