📄 idetask.h
字号:
/*
* description :
* Maker : Nobuhiro Hatazawa 2004.11.20 S1R72V03
* Copyright : (C)2004,SEIKO EPSON Corp. All Rights Reserved.
* description :
* Maker : Nobuhiro Hatazawa 2004.11.20 S1R72V03
* Copyright : (C)2004,SEIKO EPSON Corp. All Rights Reserved.
*/
#ifndef IDE_TASK_H
#define IDE_TASK_H
#include "SPRDEF.h"
/*
* Function prototype declaration
*/
// IDE Task: Task
#define TSK_EXINFO_IDE (NULL)
#define TSK_ATTRIBUTE_IDE (OS_TA_HLNG)
#define TSK_PRIORITY_IDE (5)
#define TSK_STACK_SIZE_IDE (1024)
#define TSK_STACK_ADD_IDE (0)
// IDE Task: Fixed size memory pool for sending message
#define MPF_ATTRIBUTE_IDE_MSG (OS_TA_TFIFO)
#define MPF_BLOCK_CNT_IDE_MSG (8)
#define MPF_BLOCK_SIZE_IDE_MSG (44 + OS_TMSG_SIZE)
#define MPF_BLOCK_ADD_IDE_MSG (NULL)
// IDE Task: Mail box
#define MBX_ATTRIBUTE_IDE (OS_TA_TFIFO)
#define MBX_MAX_PRI_IDE (1)
#define MBX_PRI_ADD_IDE (NULL)
// IDE Task: Event flag
#define FLG_ATTRIBUTE_IDE (OS_TA_TFIFO)
#define FLG_PATTERN_IDE (0)
// Event flag bit definition
#define FLG_EVENT_FORCE_IDE 0x80000000/* (bit31)Force process event */
#define FLG_EVENT_INT_IDE 0x08000000/* (bit27) interrupt porcess event */
#define FLG_EVENT_MSG_IDE 0x00000001/* (bit0 ) message process event */
// Event flag waiting pattern
#define FLG_WAIT_PTN_IDE ( FLG_EVENT_FORCE_IDE | FLG_EVENT_INT_IDE | FLG_EVENT_MSG_IDE )
#define MSGIDE_DATSIZE (32)/* The size of the IDE message data part */
extern void IDETask( void );
extern void USBH_IDETask( void );
/*
* Common definition of IDE TASK
*/
/*--------------------------------------------------------------------------*/
/* Main state */
/*--------------------------------------------------------------------------*/
#define IDE_MSTS_INIT 0 /* Initial State */
#define IDE_MSTS_RESET 1 /* Reset State */
#define IDE_MSTS_IDLE 2 /* Idle State */
#define IDE_MSTS_CMDEXEC 3 /* Command Executing State */
/*--------------------------------------------------------------------------*/
/* Sub state of Command Executing State */
/*--------------------------------------------------------------------------*/
#define IDE_SSTS_IDLE 0 /* Idle */
#define IDE_SSTS_COMMAND 1 /* Command Phase */
#define IDE_SSTS_XFER 2 /* Data transfer Phase */
#define IDE_SSTS_STATUS 3 /* Status Phase */
/*--------------------------------------------------------------------------*/
/* Message Parameter */
/*--------------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/* Processing Result */
/*------------------------------------------------------------------*/
#define IDE_REQ_OK 0 /* OK */
#define IDE_REQ_NG 1 /* NG */
#define IDE_REQ_ABORT 2 /* Abort */
#define IDE_REQ_PHASE_ERR 3 /* Phase Error */
/*------------------------------------------------------------------*/
/* Device Type */
/*------------------------------------------------------------------*/
#define IDE_DEV_NOT 0 /* Not connected */
#define IDE_DEV_ATA 1 /* ATA device */
#define IDE_DEV_ATAPI 2 /* ATAPI device */
/*------------------------------------------------------------------*/
/* Command Type */
/*------------------------------------------------------------------*/
#define IDE_CMD_NOT 0
#define IDE_CMD_ATA 1
#define IDE_CMD_ATAPI 2
/*------------------------------------------------------------------*/
/* Command mode */
/*------------------------------------------------------------------*/
#define IDE_CMD_MANUAL 0 /* manual mode */
#define IDE_CMD_AUTO 1 /* Auto mode */
/*------------------------------------------------------------------*/
/* Transfer mode */
/*------------------------------------------------------------------*/
#define IDE_XFER_DMA 0 /* DMA transfer */
#define IDE_XFER_HPIO 1 /* Hard PIO transfer */
#define IDE_XFER_SPIO 2 /* SOFT PIO Transfer */
#define IDE_XFER_DIRECT 3 /* Direct Copy */
/*--------------------------------------------------------------------------*/
/* Task process event */
/*--------------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/* interrupt */
/*------------------------------------------------------------------*/
#define IDE_TASK_EVT_INT 0x01/* Interrupt event notify */
/*------------------------------------------------------------------*/
/* Message */
/*------------------------------------------------------------------*/
#define IDE_TASK_EVT_MSG_CMD 0x11
#define IDE_TASK_EVT_MSG_START 0x12
#define IDE_TASK_EVT_MSG_STOP 0x13
/*--------------------------------------------------------------------------*/
/* Command Process Event */
/*--------------------------------------------------------------------------*/
#define IDE_CMD_PROT_FW_NON_DATA 0x11/* FW Non-data command */
#define IDE_CMD_PROT_FW_IN_DATA 0x12/* FW in-data command */
#define IDE_CMD_PROT_FW_OUT_DATA 0x13/* FW out-data command */
#define IDE_CMD_ATA_PROT_NON_DATA 0x41/* Non-data command protocol */
#define IDE_CMD_ATA_PROT_SPIO 0x42/* PIO data in command protocol */
#define IDE_CMD_ATA_PROT_HPIO 0x43/* PIO data out command protocol */
#define IDE_CMD_ATA_PROT_DMA 0x44/* DMA command protocol */
#define IDE_CMD_ATAPI_PROT_NON_DATA 0x31/* Non-data command protocol */
#define IDE_CMD_ATAPI_PROT_HPIO_DATA 0x32/* PIO data in command protocol */
#define IDE_CMD_ATAPI_PROT_SPIO_DATA 0x33/* PIO data in command protocol */
#define IDE_CMD_ATAPI_PROT_DMA 0x34/* DMA command protocol */
//------------------------------------//
// Message Number //
//------------------------------------//
// -The definition name is the real name,but the value is Tentative
// Start
#define MSG_REQ_IDE_HRST 0x0001/* Hard reset IDE request */
#define MSG_NTFY_IDE_HRST 0x0002/* Hard reset IDE completing notification */
#define MSG_REQ_IDE_DEV_LIST 0x0003/* Get IDE device list request */
#define MSG_NTFY_IDE_DEV_LIST 0x0004/* Get IDE device list completing notification */
#define MSG_REQ_IDE_SET_XFERRATE 0x0005/* Set IDE data rate request */
#define MSG_NTFY_IDE_SET_XFERRATE 0x0006/* Set IDE data rate completing notification */
// USB Mode
#define MSG_REQ_IDE_SRST 0x1010/* Soft reset IDE request */
#define MSG_NTFY_IDE_SRST 0x1011/* Soft reset IDE completting notification */
// USB Mode,Play Mode
#define MSG_REQ_IDE_CMD 0x2001/* ATA/ATAPI command processing request */
#define MSG_NTFY_IDE_CMP_XFER_READY 0x2002/* It notified that the IDE data transfer is ready */
#define MSG_REQ_IDE_XFER_START 0x2003/* IDE Data transfer request */
/* Abort IDE data transfer request */
#define MSG_NTFY_IDE_XFER_CMP 0x2005/* It Notifies the completion of the IDE data transfer. */
#define MSG_NTFY_IDE_CMD 0x2006/* It notifies the completion of ATA/ATAPI command processing */
#define MSG_NTFY_IDE_FORCE_CMP 0x2007/* It notifies the completion of the force process */
#define IDE_EVT_ON 0
#define IDE_EVT_OFF 1
#define IDE_ATA_SECTOR 0x200
/*
* Structures
*/
/*--------------------------------------------------------------------------*/
/* Message header */
/*--------------------------------------------------------------------------*/
typedef struct _MsgHeadIde{ /* Message common header */
T_MSG header; /* Filed used by OS */
OS_ID useMpfId; /* The ID of the memory pool */
OS_ID msgSndTskId; /* The ID of the task that send */
/* the messsage */
USHORT msgNo; /* Message Number */
USHORT msgLength; /* The length of the message */
}MSGHEADIDE, *PMSGHEADIDE;
typedef struct _MsgIde{ /* mail box of IDE task */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -