source: trunk/softs/tsar_boot/drivers/reset_ioc_hba.h

Last change on this file was 992, checked in by alain, 11 years ago

Introduce a new driver for SD Card using the 4bits wide SD bus.
THere is now 5 supported block device peripherals, and the driver names
have been re-organised: reset_ioc_xxx with xxx in (bdv, hba, rdk, spi, sdc)

File size: 3.2 KB
Line 
1/**
2 * \File : reset_hba.h
3 * \Date : 01/04/2015
4 * \Author : alain greiner
5 * \Copyright (c) UPMC-LIP6
6 */
7
8#ifndef _RESET_IOC_HBA_H
9#define _RESET_IOC_HBA_H
10
11///////////////////////////////////////////////////////////////////////////////////
12// HBA component registers offsets
13///////////////////////////////////////////////////////////////////////////////////
14
15enum SoclibMultiAhciRegisters
16{
17 HBA_PXCLB = 0, // command list base address 32 LSB bits
18 HBA_PXCLBU = 1, // command list base address 32 MSB bits
19 HBA_PXIS = 4, // interrupt status
20 HBA_PXIE = 5, // interrupt enable
21 HBA_PXCMD = 6, // run
22 HBA_PXCI = 14, // command bit-vector
23 HBA_SPAN = 0x400, // 4 Kbytes per channel => 1024 slots
24};
25
26///////////////////////////////////////////////////////////////////////////////////
27// structures for one AHCI command table
28///////////////////////////////////////////////////////////////////////////////////
29
30typedef struct hba_cmd_header_s // size = 16 bytes
31{
32 unsigned int res0; // reserved
33 unsigned char lba0; // LBA 7:0
34 unsigned char lba1; // LBA 15:8
35 unsigned char lba2; // LBA 23:16
36 unsigned char res1; // reserved
37 unsigned char lba3; // LBA 31:24
38 unsigned char lba4; // LBA 39:32
39 unsigned char lba5; // LBA 47:40
40 unsigned char res2; // reserved
41 unsigned int res3; // reserved
42
43} hba_cmd_header_t;
44
45typedef struct hba_cmd_buffer_s // size = 16 bytes
46{
47 unsigned int dba; // Buffer base address 32 LSB bits
48 unsigned int dbau; // Buffer base address 32 MSB bits
49 unsigned int res0; // reserved
50 unsigned int dbc; // Buffer byte count
51
52} hba_cmd_buffer_t;
53
54typedef struct hba_cmd_table_s // one command = header + one buffer
55{
56
57 hba_cmd_header_t header; // contains lba value
58 hba_cmd_buffer_t buffer; // contains buffer address & size
59
60} hba_cmd_table_t;
61
62///////////////////////////////////////////////////////////////////////////////////
63// structure for one AHCI command descriptor
64///////////////////////////////////////////////////////////////////////////////////
65
66typedef struct hba_cmd_desc_s // size = 16 bytes
67{
68 unsigned char flag[2]; // W in bit 6 of flag[0]
69 unsigned char prdtl[2]; // Number of buffers
70 unsigned int prdbc; // Number of bytes actually transfered
71 unsigned int ctba; // Command data base address 32 LSB bits
72 unsigned int ctbau; // Command data base address 32 MSB bits
73
74} hba_cmd_desc_t;
75
76///////////////////////////////////////////////////////////////////////////////////
77// access functions
78///////////////////////////////////////////////////////////////////////////////////
79
80int reset_hba_init ();
81
82int reset_hba_read( unsigned int lba,
83 void* buffer,
84 unsigned int count );
85#endif
86
87// Local Variables:
88// tab-width: 4
89// c-basic-offset: 4
90// c-file-offsets:((innamespace . 0)(inline-open . 0))
91// indent-tabs-mode: nil
92// End:
93// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
94
Note: See TracBrowser for help on using the repository browser.