代码拉取完成,页面将自动刷新
同步操作将从 Phytium嵌入式软件/Phytium-Standalone-SDK 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
串口硬盘SATA(Serial ATA)与以往的并口硬盘PATA(Parallel ATA)相比,数据传输速度更加快捷,并支持热插拔; SATA总线使用嵌入式时钟信号,具备了更强的纠错能力,能对传输指令进行检查,如果发现错误会自动矫正,提高了数据传输的可靠性;
AHCI控制器驱动提供了SATA的控制访问方法,
驱动相关的源文件包括,
fsata
├── fsata_g.c
├── fsata_hw.c
├── fsata_hw.h
├── fsata_intr.c
├── fsata_sinit.c
├── fsata.c
└── fsata.h
以下部分将指导您完成 fsata 驱动的软件配置:
typedef struct
{
FSataConfig config; /* sata配置 */
u32 is_ready; /* sata初始化完成标志 */
u32 private_data;
FSataAhciIoPorts port[FSATA_AHCI_MAX_PORTS];
u16 *ataid[FSATA_AHCI_MAX_PORTS];
u32 n_ports;
u32 cap; /* cache of HOST_CAP register */
u32 port_map; /* cache of HOST_PORTS_IMPL reg */
u32 link_port_map; /*linkup port map*/
FSataIrqCallBack fsata_dhrs_cb; /* device-to-host register fis interrupt */
void *dhrs_args;
FSataIrqCallBack fsata_pss_cb; /* pio setup fis interrupt */
void *pss_args;
FSataIrqCallBack fsata_dss_cb; /* dma setup fis interrupt */
void *dss_args;
FSataIrqCallBack fsata_sdbs_cb; /* set device bits interrupt */
void *sdbs_args;
FSataIrqCallBack fsata_pcs_cb; /* port connect change status interrupt */
void *pcs_args;
} FSataCtrl;
typedef struct
{
uintptr base_addr; /* sata控制寄存器基地址 */
const char *instance_name; /* instance name */
u32 irq_num; /* Irq number */
} FSataConfig; /* sata配置 */
typedef struct
{
uintptr port_mmio;
FSataAhciCommandList *cmd_list; /* Command List structure, will include cmd_tbl's address */
uintptr cmd_tbl_base_addr; /* command table addr, also the command table's first part */
FSataAhciCommandTablePrdt *cmd_tbl_prdt; /* command table's second part , cmd_tbl + cmd_tbl_prdt = command table*/
FSataAhciRecvFis *rx_fis; /* Received FIS Structure */
uintptr mem;
FSataInfo dev_info;
} FSataAhciIoPorts;
typedef struct
{
unsigned char if_type; /* type of the interface */
unsigned char part_type; /* partition type */
unsigned char type; /* device type */
unsigned char removable; /* removable device */
char vendor[BLK_VEN_SIZE + 1]; /* device vendor string */
char product[BLK_PRD_SIZE + 1]; /* device product number */
char revision[BLK_REV_SIZE + 1]; /* firmware revision */
unsigned long lba; /* number of blocks */
unsigned long blksz; /* block size */
}FSataInfo;
#define FSATA_PORT_IRQ_COLD_PRES BIT(31) /* cold presence detect */
#define FSATA_PORT_IRQ_TF_ERR BIT(30) /* task file error */
#define FSATA_PORT_IRQ_HBUS_ERR BIT(29) /* host bus fatal error */
#define FSATA_PORT_IRQ_HBUS_DATA_ERR BIT(28) /* host bus data error */
#define FSATA_PORT_IRQ_IF_ERR BIT(27) /* interface fatal error */
#define FSATA_PORT_IRQ_IF_NONFATAL BIT(26) /* interface non-fatal error */
#define FSATA_PORT_IRQ_OVERFLOW BIT(24) /* xfer exhausted available S/G */
#define FSATA_PORT_IRQ_BAD_PMP BIT(23) /* incorrect port multiplier */
#define FSATA_PORT_IRQ_PHYRDY BIT(22) /* PhyRdy changed */
#define FSATA_PORT_IRQ_DEV_ILCK BIT(7) /* device interlock */
#define FSATA_PORT_IRQ_CONNECT BIT(6) /* port connect change status */
#define FSATA_PORT_IRQ_SG_DONE BIT(5) /* descriptor processed */
#define FSATA_PORT_IRQ_UNK_FIS BIT(4) /* unknown FIS rx'd */
#define FSATA_PORT_IRQ_SDB_FIS BIT(3) /* Set Device Bits FIS rx'd */
#define FSATA_PORT_IRQ_DMAS_FIS BIT(2) /* DMA Setup FIS rx'd */
#define FSATA_PORT_IRQ_PIOS_FIS BIT(1) /* PIO Setup FIS rx'd */
#define FSATA_PORT_IRQ_D2H_REG_FIS BIT(0) /* D2H Register FIS rx'd */
const FSataConfig *FSataLookupConfig(void);
Note:
Input:
Return:
FError FSataCfgInitialize(FSataCtrl *instance_p, const FSataConfig *input_config_p);
Note:
Input:
Return:
FError FSataAhciInit(FSataCtrl *instance_p);
Note:
Input:
Return:
FError FSataAhciReadInfo(FSataCtrl *instance_p, u8 port);
Note:
Input:
Return:
FError FSataReadWrite(FSataCtrl *instance_p, u8 port, u32 start,
u16 blk_cnt, u8 *buffer, u8 is_write);
Note:
Input:
Return:
FError FSataFPDmaReadWrite(FSataCtrl *instance_p, u8 port, u32 start,
u16 blk_cnt, u8 *buffer, u8 is_write);
Note:
Input:
Return:
/* set specific sata irq function entry */ FError FSataSetHandler(FSataCtrl *instance_p, u32 handler_type, void *func_pointer, void *call_back_ref);
FError FSataSetHandler(FSataCtrl *instance_p, u32 handler_type,
void *func_pointer, void *call_back_ref);
Note:
Input:
Return:
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。