blockdev.h

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

H
241
字号
//$6 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


#ifndef _BLOCKDEV_H
#define _BLOCKDEV_H

#define MULTI_ATAPI_DEVICE

#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
#define BLOCK_STATE_SETTING         9
#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
//

//
// * only valid while (1) CD (2) ADR_TYPE_SECTOR (3) CONTROL_FORCE_SEND be 0; if it
// * is set, c1/c2 check result will be ignored
//
#define CONTROL_C3_EDCCHECK 0x0100

//
// * only valid while (1) CD (2) ADR_TYPE_SECTOR ; if it is set, c1/c2 check result
// * will be ignored
//
#define CONTROL_C3_ECCENABLE    0x0200

typedef struct
{
    union
    {
        TOC cddvdinfo;
    } discinfo;
} DiscInformation;

// ifndef AVOS
#else

//
// * only valid while (1) CD (2) ADR_TYPE_SECTOR (3) CONTROL_FORCE_SEND be 0; if it
// * is set, c1/c2 check result will be ignored
//
#define CONTROL_C3_EDCCHECK 0x0100

//
// * only valid while (1) CD (2) ADR_TYPE_SECTOR ; if it is set, c1/c2 check result
// * will be ignored
//
#define CONTROL_C3_ECCENABLE    0x0200

#define MODE_QSUBCODE           10

// define CONTROL_FORCE_SEND 0x1
// define CONTROL_CDDA_REPAIR 0x2
// define CONTROL_WITHINFO_ERRFLAG 0x4
// define CONTROL_WITHINFO_SUBCH 0x8
#endif
typedef struct
{
    MINIMSG         MsgHdr;             // message header
    unsigned int   cmd_type;
    #define TRYTIMES_RETRY_CONFUN   0xff
    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   // 0x00
#define BLOCK_ASYREAD               (BLOCK_NULL + 1)           
#define BLOCK_STOPREAD              (IOCBASECMD(BLKIO_STOPREAD))       
#define BLOCK_EJECTDISC             (IOCBASECMD(BLKIO_EJECTDISC))      
#define BLOCK_LOADDISC              (IOCBASECMD(BLKIO_LOADDISC))      
#define BLOCK_DESCRAMBLE            (IOCBASECMD(BLKIO_DESCRAMBLE))      
#define BLOCK_STOP                  (IOCBASECMD(BLKIO_STOP))     
#define BLOCK_START                 (IOCBASECMD(BLKIO_START))          
#define BLOCK_GETDISCINFO           (IOCBASECMD(BLKIO_GETDISCINFO))          
#define BLOCK_STATE_SETTING         (IOCBASECMD(BLKIO_SETTING))   
#define BLOCK_PREFILL               (IOCBASECMD(BLKIO_PREFILL))   
#define MAX_USER_CMD                BLOCK_PREFILL+1	
#else
#define BLOCK_NULL                  0   // 0x00
#define BLOCK_ASYREAD               (BLOCK_NULL + 1)            // 0x01
#define BLOCK_STOPREAD              (BLOCK_ASYREAD + 1)         // 0x02
#define BLOCK_EJECTDISC             (BLOCK_STOPREAD + 1)        // 0x03
#define BLOCK_LOADDISC              (BLOCK_EJECTDISC + 1)       // 0x04
#define BLOCK_DESCRAMBLE            (BLOCK_LOADDISC + 1)        // 0x05
#define BLOCK_STOP                  (BLOCK_DESCRAMBLE + 1)      // 0x06
#define BLOCK_START                 (BLOCK_STOP + 1)            // 0x07
#define BLOCK_GETDISCINFO           (BLOCK_START + 1)           // 0x08
#define BLOCK_STATE_SETTING         (BLOCK_GETDISCINFO + 1)     // 0x09
#define BLOCK_PREFILL               (BLOCK_STATE_SETTING + 1)   // 0x0a
#define BLOCK_PUASE_TASK            (BLOCK_PREFILL + 1)         // 0x0b
#define BLOCK_CMD_END               (BLOCK_PUASE_TASK + 1)
#define MAX_USER_CMD                BLOCK_CMD_END
#endif
#define BLOCK_STATE_TIMEOUT         (MAX_USER_CMD + 1)
#define BLOCK_STATE_SUCCESS         (BLOCK_STATE_TIMEOUT + 1)
#define BLOCK_STATE_FAIL            (BLOCK_STATE_SUCCESS + 1)
#define BLOCK_STATE_DATAREADY       (BLOCK_STATE_FAIL + 1)
#define BLOCK_STATE_MSFDATAREADY    (BLOCK_STATE_DATAREADY + 1)
#define MAX_THOM_STATE              BLOCK_STATE_MSFDATAREADY

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_BUFFER_TYPE_COMMON_CD    0
#define BS_BUFFER_TYPE_DVD          1
#define BS_BUFFER_TYPE_JPEG         2
#define BS_BUFFER_TYPE_MPEG4        3
#define BS_BUFFER_TYPE_CDDA         4
#define BS_BUFFER_TYPE_MINIDVD      5
#define BS_BUFFER_TYPE_USER         20
#define BS_SECTOR_UNIT              2
#define BS_START_TYPE               3
#define BS_BUFFER_TYPE_EXT          4
#define BS_BUFFER_TYPE_EXT_NONE     0
#define BS_BUFFER_TYPE_EXT_VCD      1
#define BS_BUFFER_TYPE_EXT_CDDA     2
#define BS_BUFFER_TYPE_EXT_DVD      3
#define BS_BUFFER_TYPE_EXT_HVD      4
#define BS_BUFFER_TYPE_EXT_CDG      5
#define BS_BUFFER_TYPE_EXT_USER     20
#define BS_BUFFER_LEVEL             5
#define BS_DVD_ECC_DISC             6
#define BS_TRACKBUF_START_END       10
#define BS_FORCE_EJECT              20
#define BS_FORCE_STOPREAD           21
#define BS_CDTYPE23_BLKMOV_DIRECTLY 30
#define BS_LOADER_SPEED             31
#define BS_CDTYPE23_OPTIMIZE        32
#define BS_RETRY_CONFUN             33
#define BS_LAODER_STATUS            34

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

⌨️ 快捷键说明

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