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

4.115
Last change on this file since 6279149 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

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