[11bbeb9] | 1 | /* |
---|
| 2 | * ide_ctrl_cfg.h |
---|
| 3 | * |
---|
[bf474880] | 4 | * LibChip library IDE controller header file - structures used for |
---|
[11bbeb9] | 5 | * configuration and plugin interface definition. |
---|
| 6 | * |
---|
| 7 | * Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia |
---|
| 8 | * Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru> |
---|
| 9 | * |
---|
| 10 | * The license and distribution terms for this file may be |
---|
| 11 | * found in the file LICENSE in this distribution or at |
---|
[94365d9] | 12 | * http://www.rtems.com/license/LICENSE. |
---|
[11bbeb9] | 13 | * |
---|
| 14 | * $Id$ |
---|
| 15 | */ |
---|
| 16 | #ifndef __IDE_CTRL_CFG_H__ |
---|
| 17 | #define __IDE_CTRL_CFG_H__ |
---|
| 18 | |
---|
[6640459d] | 19 | #include <rtems/blkdev.h> |
---|
| 20 | |
---|
[11bbeb9] | 21 | #ifdef __cplusplus |
---|
| 22 | extern "C" { |
---|
| 23 | #endif |
---|
| 24 | |
---|
| 25 | /* |
---|
| 26 | * Avaible drivers for IDE controllers |
---|
| 27 | */ |
---|
| 28 | typedef enum { |
---|
[3446afa] | 29 | IDE_STD, |
---|
[11bbeb9] | 30 | IDE_CUSTOM /* BSP specific driver */ |
---|
| 31 | } ide_ctrl_devs_t; |
---|
| 32 | |
---|
[bf474880] | 33 | /* ATA modes: bit masks used in ctrl_config_io_speed call */ |
---|
| 34 | #define ATA_MODES_PIO3 0x001 |
---|
| 35 | #define ATA_MODES_PIO4 0x002 |
---|
| 36 | |
---|
| 37 | #define ATA_MODES_PIO 0x003 |
---|
| 38 | |
---|
| 39 | #define ATA_MODES_DMA0 0x004 |
---|
| 40 | #define ATA_MODES_DMA1 0x008 |
---|
| 41 | #define ATA_MODES_DMA2 0x010 |
---|
| 42 | |
---|
| 43 | #define ATA_MODES_UDMA0 0x020 |
---|
| 44 | #define ATA_MODES_UDMA1 0x040 |
---|
| 45 | #define ATA_MODES_UDMA2 0x080 |
---|
| 46 | #define ATA_MODES_UDMA3 0x100 |
---|
| 47 | #define ATA_MODES_UDMA4 0x200 |
---|
| 48 | #define ATA_MODES_UDMA5 0x400 |
---|
| 49 | |
---|
| 50 | #define ATA_MODES_UDMA 0x7e0 |
---|
| 51 | #define ATA_MODES_DMA 0x7fc |
---|
| 52 | |
---|
| 53 | |
---|
[11bbeb9] | 54 | /* |
---|
| 55 | * Each driver for a particular controller have to provide following |
---|
| 56 | * functions in such a structure. The only field which should not be NULL |
---|
[a3d3d9a] | 57 | * is contInit. |
---|
[11bbeb9] | 58 | */ |
---|
| 59 | typedef struct ide_ctrl_fns_s { |
---|
[6640459d] | 60 | bool (*ctrl_probe)(int minor); /* probe routine */ |
---|
[11bbeb9] | 61 | void (*ctrl_initialize)(int minor); |
---|
[a3d3d9a] | 62 | int (*ctrl_control)(int minor, uint32_t command, |
---|
[11bbeb9] | 63 | void *arg); |
---|
| 64 | /* |
---|
| 65 | * Functions which allow read/write registers of a particular controller. |
---|
[a3d3d9a] | 66 | * (these functions may be used from ide_controller_read_register, |
---|
[11bbeb9] | 67 | * ide_controller_write_register) |
---|
| 68 | */ |
---|
[ee4f57d] | 69 | void (*ctrl_reg_read)(int minor, int regist, uint16_t *value); |
---|
| 70 | void (*ctrl_reg_write)(int minor, int regist, uint16_t value); |
---|
[a3d3d9a] | 71 | |
---|
| 72 | /* |
---|
| 73 | * The function allows to escape overhead for read/write register |
---|
[11bbeb9] | 74 | * functions calls |
---|
| 75 | */ |
---|
[a3d3d9a] | 76 | void (*ctrl_read_block)(int minor, uint16_t block_size, |
---|
[3735f08] | 77 | rtems_blkdev_sg_buffer *bufs, uint32_t *cbuf, |
---|
[ee4f57d] | 78 | uint32_t *pos); |
---|
| 79 | void (*ctrl_write_block)(int minor, uint16_t block_size, |
---|
[3735f08] | 80 | rtems_blkdev_sg_buffer *bufs, uint32_t *cbuf, |
---|
[ee4f57d] | 81 | uint32_t *pos); |
---|
[a3d3d9a] | 82 | |
---|
| 83 | rtems_status_code (*ctrl_config_io_speed)(int minor, |
---|
[bf474880] | 84 | uint16_t modes_available); |
---|
[11bbeb9] | 85 | } ide_ctrl_fns_t; |
---|
| 86 | |
---|
[a3d3d9a] | 87 | /* |
---|
| 88 | * IDE Controller configuration. Table of such configurations is provided |
---|
[11bbeb9] | 89 | * by BSP |
---|
| 90 | */ |
---|
| 91 | typedef struct ide_controller_bsp_table_s { |
---|
| 92 | char *name; /* device name */ |
---|
| 93 | ide_ctrl_devs_t type; /* chip type */ |
---|
| 94 | ide_ctrl_fns_t *fns; /* pointer to the set of driver routines */ |
---|
[6640459d] | 95 | bool (*probe)(int minor); /* general probe routine */ |
---|
[a3d3d9a] | 96 | uint8_t status; /* initialized/non initialized. Should be set |
---|
| 97 | * to zero by static initialization |
---|
[11bbeb9] | 98 | */ |
---|
[ee4f57d] | 99 | uint32_t port1; /* port number for the port of the device */ |
---|
[6640459d] | 100 | bool int_driven; /* interrupt/poll driven */ |
---|
[11bbeb9] | 101 | rtems_vector_number int_vec; /* the interrupt vector of the device */ |
---|
[a3d3d9a] | 102 | void *params; /* contains either device specific data or a |
---|
| 103 | * pointer to s device specific information |
---|
[11bbeb9] | 104 | * table |
---|
| 105 | */ |
---|
| 106 | } ide_controller_bsp_table_t; |
---|
| 107 | |
---|
| 108 | /* IDE controllers Table */ |
---|
| 109 | extern ide_controller_bsp_table_t IDE_Controller_Table[]; |
---|
| 110 | |
---|
| 111 | /* Number of rows in IDE_Controller_Table */ |
---|
| 112 | extern unsigned long IDE_Controller_Count; |
---|
| 113 | |
---|
| 114 | |
---|
| 115 | #define IDE_CTRL_MAX_MINOR_NUMBER 4 |
---|
| 116 | |
---|
| 117 | #define IDE_CTRL_NON_INITIALIZED 0 |
---|
| 118 | #define IDE_CTRL_INITIALIZED 1 |
---|
| 119 | |
---|
| 120 | #ifdef __cplusplus |
---|
| 121 | } |
---|
| 122 | #endif |
---|
| 123 | |
---|
| 124 | |
---|
| 125 | #endif /* __IDE_CTRL_CFG_H__ */ |
---|