📄 kernel.h
字号:
//***********************************************************************
// *
// P H I L I P S P R O P R I E T A R Y *
// *
// COPYRIGHT (c) 1999 BY PHILIPS SINGAPORE (APIC). *
// -- ALL RIGHTS RESERVED -- *
// *
// File Name : Kernel.h *
// Author : Albert Goh *
// Created : 3 March 2000 *
// *
//***********************************************************************
//***********************************************************************
// *
// Kernel.h has the various external defintion and structure defintion *
// *
//***********************************************************************
//***********************************************************************
// *
// Module History *
// ************** *
// *
// Date Version Author Changes *
// ==== ======= ====== ======= *
// 030300 0.1 Albert Created *
// *
// *
//***********************************************************************
//***********************************************************************
//* *
//* Variable Definition *
//* *
//***********************************************************************
#define Crystal_Freq 16
#define DEVICE_RESET 0x0C
#define ENABLE_INTRQ 0x08
#define DISABLE_INTRQ 0x0A
#define MASTER_DRIVE 0xA0
#define SLAVE_DRIVE 0xB0
#define LBA_MODE 0x40
#define ATA_MASTER 0
#define ID_ATAPI_DEVICE 0xA1
#define ID_ATA_DEVICE 0xEC
#define ATAPI_SOFTRESET 0x08
#define SET_FEATURE 0xEF
#define INIT_DRIVE 0x91
#define Transfer_Mode 0x03
#define OFF 0
#define ON 1
#define Get_Status 0x00
#define Clear_Feature 0x01
#define Set_Feature 0x03
#define Set_Address 0x05
#define Get_Descriptor 0x06
#define Set_Descriptor 0x07
#define Get_Config 0x08
#define Set_Config 0x09
#define Get_Interface 0x0A
#define Set_Interface 0x0B
#define Synch_Frame 0x0C
#define USB_Default 0
#define USB_Addressed 1
#define USB_Configured 2
#define USB_Device_Descriptor 1
#define USB_Config_Descriptor_0 2
#define USB_Config_Descriptor_1 0x0102
#define USB_String_ID_Descriptor 3
#define Manufacturer_String_Descriptor 0x0103
#define Product_String_Descriptor 0x0203
#define USB_Interface_Descriptor 4
#define USB_Endpoint_Descriptor 5
#define USB_Device_Qualifier_Descriptor 6
#define USB_Other_Speed_Config_Descriptor 7
#define USB_Interface_Power_Descriptor 8
#define ATAPI_Cmd_Packet_Phase 0x09
#define ATAPI_Message_Phase 0x0B
#define ATAPI_Read_Phase 0x0A
#define ATAPI_Write_Phase 0x08
#define ATAPI_Status_Phase 0x03
#define Error_Phase 0xAA
#define No_Data_Phase 0x55
#define INQUIRY 0x12
#define LOAD_UNLOAD_CD 0xA6
#define MECHANISM_STATUS 0xBD
#define MODE_SELECT_10 0x55
#define MODE_SENSE_10 0x5A
#define PAUSE_RESUME 0x4B
#define PLAY_AUDIO_10 0x45
#define PLAY_AUDIO_MSF 0x47
#define PLAY_CD 0xBC
#define PREVENT_ALLOW_MEDIUM_REMOVAL 0x1E
#define READ_10 0x28
#define READ_12 0xA8
#define READ_CAPACITY 0x25
#define READ_CD 0xBE
#define READ_CD_MSF 0xB9
#define READ_HEADRER 0x44
#define READ_SUB_CHANNEL 0x42
#define READ_TOC 0x43
#define REQUEST_SENSE 0x03
#define SCAN 0xBA
#define SEEK 0x2B
#define SET_CD_SPEED 0xBB
#define STOP_PLAY_SCAN 0x4E
#define START_STOP_UNIT 0x1B
#define TEST_UNIT_READY 0x00
#define VERIFY_10 0x2E
#define WRITE_10 0x2A
#define READ_FORMAT_CAPACITIES 0x23
#define MODE_SENSE_06 0x1A
#define MODE_SELECT_06 0x11
#define SET_MULTIPLE_MODE 0xC6
#define READ_MULITPLE 0xC4
#define READ_SECTOR 0x20
#define READ_DMA 0xC8
#define WRITE_DMA 0xCA
#define UDMA2 0x0007
#define UDMA1 0x0003
#define UDMA0 0x0001
#define MDMA2 0x0007
#define MDMA1 0x0003
#define MDMA0 0x0001
#define PIO4 0x0003
#define PIO3 0x0001
#define ATAPI_PACKET_COMMAND 0xA0
#define UDMA_Read_Command 0x02
#define UDMA_Write_Command 0x03
#define PIO_Read_Command 0x04
#define PIO_Write_Command 0x05
#define MDMA_Read_Command 0x06
#define MDMA_Write_Command 0x07
#define PIO_Write_Complete 0x08
#define PIO_Read_Complete 0x09
#define READ_1F0 0x0A
#define POLL_BUSY 0x0B
#define UPDATE_TASKFILE 0x0C
#define DMA_VALIDATE_BUFFER 0x0E
#define CLEAR_BUFFER 0x0F
#define DMA_RESET 0x11
#define DMA_FLUSH 0x12
#define READ_1F1_TASKFILE 0x21
#define READ_1F2_TASKFILE 0x22
#define READ_1F3_TASKFILE 0x23
#define READ_1F4_TASKFILE 0x24
#define READ_1F5_TASKFILE 0x25
#define READ_1F6_TASKFILE 0x26
#define READ_3F6_TASKFILE 0x27
#define READ_3F7_TASKFILE 0x28
//Evalkit
#define DMA_START P10
#define DMA_Reset P11
#define DMA_Wr_Rd P12
#define CPLD_CS P13
#define LED_P14 P14
#define ISP1581_CS P15
#define ISP1581_RESET P16
#define RESET_IDE P17
#define HS_FS_LED P30
#define SRAM_CS P31
#define SUSPEND_INPUT P33
#define LED_P34 P34
#define LED_P35 P35
#define LED_P20 P20
#define LED_P21 P21
#define LED_P22 P22
#define LED_P23 P23
#define LED_P24 P24
#define LED_P25 P25
#define LED_P26 P26
#define LED_P27 P27
#define HIGH_SPEED 0
#define FULL_SPEED 1
#define HIGH_SPEED_LED 1
#define FULL_SPEED_LED 0
#define TEST_MODE 0x0200
#define ENDPOINT_HALT 0
#define DEVICE_REMOTE_WAKEUP 0x0100
#define TEST_J 1
#define TEST_K 2
#define TEST_SE0_NAK 3
#define TEST_PACKET 4
#define TEST_FORCE_ENABLE 5
//***********************************************************************
//* *
//* Structure Variable Definition *
//* *
//***********************************************************************
typedef union KERNEL
{
struct KERNEL_BITS
{
UC TIMER_ONOFF : 1,
STATE : 3,
MASTER_ATAPI_DRIVE : 1,
MASTER_ATA_DRIVE : 1,
SLAVE_ATAPI_DRIVE : 1,
SLAVE_ATA_DRIVE : 1;
UC Auto_PIO : 1,
UDMA_Mode : 1,
MDMA_Mode : 1,
GDMA_Mode : 1,
Timer_Expired : 1,
Bus_Reset : 1,
Error_Occur : 1,
Endpt_Stall : 1;
UC HS_FS_State : 1,
Transfer_Error : 1,
Device_Init : 1,
Endpoint_Stall : 1,
Send_CSW : 1,
Transfer_Done : 1,
Drive_Detected : 1,
Reserved5 : 1;
UC Reserved8 : 8;
}BITS;
ULI VALUE;
}KERNEL;
typedef struct DRIVE_CONFIG
{
UI General_Config; //word 0
UI Logical_Cylinders; //word 1
UI Logical_Heads; //word 3
UI Logical_Sectors; //word 6
UI Max_Burst_Length; //word 47
UI PIO_Mode; //word 51
UI Current_Cylinders; //word 54
UI Current_Heads; //word 55
UI Current_Sectors; //word 56
UC Current_Capacity[4]; //word 57,58
UC LBA[4]; //word 60,61
UI MDMA_Mode; //word 63
UI Advanced_PIO; //word 64
UI UDMA_Mode; //word 88
}DRIVE_CONFIG;
typedef struct TIMER
{
UI mSEC_Scale;
UI Hundred_mSEC_Scale;
}TIMER;
typedef struct FEATURE
{
UC SubCommand_Count;
UC SubCommand_Number;
UC SubCommand_Low;
UC SubCommand_High;
}FEATURE;
typedef union DMA_INT_FLAG
{
struct DMA_FLAG_BITS
{
UC CMD_AUTO_COMPLETE : 1;
UC CMD_INTRQ_OK : 1;
UC TASKFILE_READ_COMPLETE : 1;
UC BSY_DRQ_POLL_DONE : 1;
UC START_READ_1F0_RD_FIFO : 1;
UC RD_1F0_FIFO_EMPTY : 1;
UC WR_1F0_FIFO_FULL : 1;
UC WR_1F0_FIFO_EMPTY : 1;
UC DMA_DONE : 1;
UC INTRQ_SEEN : 1;
UC INT_EOT : 1;
UC EXT_EOT : 1;
UC RES1 : 4;
}BITS;
UI VALUE;
}DMA_INT_FLAG;
typedef union DATA_SWAP
{
UC byte[2];
UI word;
}DATA_SWAP;
typedef union ATAPI_BYTECOUNT
{
UC Byte[4];
ULI VALUE;
}ATAPI_BYTECOUNT;
typedef union BYTECOUNT
{
UC Byte[4];
ULI VALUE;
}BYTECOUNT;
typedef union USB_INT_FLAG
{
struct USB_FLAG_BITS
{
UC RESET : 1,
SOF : 1,
uSOF : 1,
SUSP : 1,
RESUME : 1,
HS_STAT : 1,
DMA : 1,
VBUS : 1;
UC EP0SETUP : 1,
RES02 : 1,
EP0RX : 1,
EP0TX : 1,
EP1RX : 1,
EP1TX : 1,
EP2RX : 1,
EP2TX : 1;
UC EP3RX : 1,
EP3TX : 1,
EP4RX : 1,
EP4TX : 1,
EP5RX : 1,
EP5TX : 1,
EP6RX : 1,
EP6TX : 1;
UC EP7RX : 1,
EP7TX : 1;
}BITS;
UL VALUE;
}USB_INT_FLAG;
typedef struct USB_DEVICE_REQ
{
UC bmRequestType;
UC bRequest;
UI wValue;
UI wIndex;
UI wLength;
}USB_DEVICE_REQ;
typedef struct USB_DEVICE
{
struct USB_DEVICE_BITS
{
UC Remote_Wakeup : 1,
Halt : 1,
Test_Mode : 1,
State : 3,
Alter_Interface : 1,
Reserved : 1;
}BITS;
}USB_DEVICE;
typedef struct USBCBW
{
union Signature
{
UC dCBWSignature[4];
ULI VALUE;
}Signature;
UC dCBWTag[4];
union Length
{
UC dCBWDataTransferLength[4];
ULI VALUE;
}Length;
UC dCBWFlags;
UC bCBWLUN;
UC bCDBLength;
UC CBWCDB[0x10];
} USBCBW;
typedef struct USB_CSW
{
union Residue
{
UC dCSWDataResidue[4];
ULI VALUE;
}Residue;
UC bCSWStatus;
}USBCSW;
typedef struct ERROR
{
UC SENSE_KEY;
UC ASC;
UC ASCQ;
}ERROR;
typedef union CHIP_ID
{
UC CHIP_ID[4];
ULI ID_NO;
}CHIP_ID;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -