source: rtems/c/src/libchip/ide/ide_ctrl_cfg.h @ b0f45d8

4.104.115
Last change on this file since b0f45d8 was 6640459d, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/07/08 at 03:44:14

Convert to "bool".

  • Property mode set to 100644
File size: 4.0 KB
Line 
1/*
2 * ide_ctrl_cfg.h
3 *
4 * LibChip library IDE controller header file - structures used for
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
12 * http://www.rtems.com/license/LICENSE.
13 *
14 * $Id$
15 */
16#ifndef __IDE_CTRL_CFG_H__
17#define __IDE_CTRL_CFG_H__
18
19#include <rtems/blkdev.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/*
26 * Avaible drivers for IDE controllers
27 */
28typedef enum {
29    IDE_STD,
30    IDE_CUSTOM                /* BSP specific driver */
31} ide_ctrl_devs_t;
32
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
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
57 * is contInit.
58 */
59typedef struct ide_ctrl_fns_s {
60    bool              (*ctrl_probe)(int minor); /* probe routine */
61    void              (*ctrl_initialize)(int minor);
62    int               (*ctrl_control)(int minor, uint32_t   command,
63                                      void *arg);
64    /*
65     * Functions which allow read/write registers of a particular controller.
66     * (these functions may be used from ide_controller_read_register,
67     * ide_controller_write_register)
68     */
69    void    (*ctrl_reg_read)(int minor, int regist, uint16_t   *value);
70    void    (*ctrl_reg_write)(int minor, int regist, uint16_t   value);
71
72    /*
73     * The function allows to escape overhead for read/write register
74     * functions calls
75     */
76    void  (*ctrl_read_block)(int minor, uint16_t   block_size,
77                             rtems_blkdev_sg_buffer *bufs, uint32_t   *cbuf,
78                             uint32_t   *pos);
79    void  (*ctrl_write_block)(int minor, uint16_t   block_size,
80                              rtems_blkdev_sg_buffer *bufs, uint32_t   *cbuf,
81                              uint32_t   *pos);
82
83    rtems_status_code (*ctrl_config_io_speed)(int minor,
84                                              uint16_t modes_available);
85} ide_ctrl_fns_t;
86
87/*
88 * IDE Controller configuration. Table of such configurations is provided
89 * by BSP
90 */
91typedef 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 */
95    bool                 (*probe)(int minor); /* general probe routine */
96    uint8_t              status; /* initialized/non initialized. Should be set
97                                  * to zero by static initialization
98                                  */
99    uint32_t             port1; /* port number for the port of the device */
100    bool                 int_driven; /* interrupt/poll driven */
101    rtems_vector_number  int_vec; /* the interrupt vector of the device */
102    void                *params;  /* contains either device specific data or a
103                                   * pointer to s device specific information
104                                   * table
105                                   */
106} ide_controller_bsp_table_t;
107
108/* IDE controllers Table */
109extern ide_controller_bsp_table_t    IDE_Controller_Table[];
110
111/* Number of rows in IDE_Controller_Table */
112extern 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__ */
Note: See TracBrowser for help on using the repository browser.