RTEMS 7.0-rc1
Loading...
Searching...
No Matches
ide_ctrl_cfg.h
1/* SPDX-License-Identifier: GPL-2.0+-with-RTEMS-exception */
2
3/*
4 * ide_ctrl_cfg.h
5 *
6 * LibChip library IDE controller header file - structures used for
7 * configuration and plugin interface definition.
8 *
9 * Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia
10 * Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
11 *
12 * The license and distribution terms for this file may be
13 * found in the file LICENSE in this distribution or at
14 * http://www.rtems.org/license/LICENSE.
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, uint32_t block_size,
77 rtems_blkdev_sg_buffer *bufs, uint32_t *cbuf,
78 uint32_t *pos);
79 void (*ctrl_write_block)(int minor, uint32_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);
86
87/*
88 * IDE Controller configuration. Table of such configurations is provided
89 * by BSP
90 */
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 */
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__ */
Block Device Management.
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition: intr.h:102
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
Definition: ide_ctrl_cfg.h:91
Definition: ide_ctrl_cfg.h:59
Block device scatter or gather buffer structure.
Definition: blkdev.h:68