mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-22 01:04:26 +08:00
2002-10-28 Eugeny S. Mints <Eugeny.Mints@oktet.ru>
* New files: New directory ide/, ide/Makefile.am, ide/ide_ctrl_cfg.h, ide/ide_ctrl_io.h, ide/ide_ctrl.h: * configure.ac, Makefile.am: Modified to reflect changes above.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2002-10-28 Eugeny S. Mints <Eugeny.Mints@oktet.ru>
|
||||
|
||||
* New files: New directory ide/, ide/Makefile.am, ide/ide_ctrl_cfg.h,
|
||||
ide/ide_ctrl_io.h, ide/ide_ctrl.h:
|
||||
* configure.ac, Makefile.am: Modified to reflect changes above.
|
||||
|
||||
2002-10-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
|
||||
|
||||
* .cvsignore: Reformat.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I ../../../aclocal
|
||||
|
||||
SUBDIRS = rtc serial network
|
||||
SUBDIRS = rtc serial network ide
|
||||
|
||||
include $(top_srcdir)/../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../automake/local.am
|
||||
|
||||
@@ -46,5 +46,6 @@ AC_CONFIG_FILES([Makefile
|
||||
network/Makefile
|
||||
rtc/Makefile
|
||||
serial/Makefile
|
||||
ide/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -0,0 +1,23 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
|
||||
include_idedir = $(includedir)/libchip
|
||||
|
||||
include_ide_HEADERS = ide_ctrl_cfg.h ide_ctrl.h ide_ctrl_io.h
|
||||
|
||||
PREINSTALL_FILES = $(PROJECT_INCLUDE)/libchip \
|
||||
$(include_ide_HEADERS:%=$(PROJECT_INCLUDE)/libchip/%)
|
||||
|
||||
$(PROJECT_INCLUDE)/libchip:
|
||||
@$(mkinstalldirs) $@
|
||||
$(PROJECT_INCLUDE)/libchip/%.h: %.h
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
all-local: $(PREINSTALL_FILES)
|
||||
|
||||
EXTRA_DIST =
|
||||
|
||||
include $(top_srcdir)/../../../automake/subdirs.am
|
||||
include $(top_srcdir)/../../../automake/local.am
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* ide_ctrl.h
|
||||
*
|
||||
* This file describes the IDE controller driver for all boards.
|
||||
*
|
||||
* Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia
|
||||
* Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
#ifndef __IDE_CTRL_H__
|
||||
#define __IDE_CTRL_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
rtems_device_driver ide_controller_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *args);
|
||||
|
||||
|
||||
#define IDE_CONTROLLER_DRIVER_TABLE_ENTRY \
|
||||
{ide_controller_initialize, NULL, NULL, NULL, NULL, NULL}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __IDE_CTRL_H__ */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* ide_ctrl_cfg.h
|
||||
*
|
||||
* LibChip library IDE controller header file - structuers used for
|
||||
* configuration and plugin interface definition.
|
||||
*
|
||||
* Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia
|
||||
* Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
#ifndef __IDE_CTRL_CFG_H__
|
||||
#define __IDE_CTRL_CFG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/blkdev.h>
|
||||
|
||||
/*
|
||||
* Avaible drivers for IDE controllers
|
||||
*/
|
||||
typedef enum {
|
||||
IDE_CUSTOM /* BSP specific driver */
|
||||
} ide_ctrl_devs_t;
|
||||
|
||||
/*
|
||||
* Each driver for a particular controller have to provide following
|
||||
* functions in such a structure. The only field which should not be NULL
|
||||
* is contInit.
|
||||
*/
|
||||
typedef struct ide_ctrl_fns_s {
|
||||
boolean (*ctrl_probe)(int minor); /* probe routine */
|
||||
void (*ctrl_initialize)(int minor);
|
||||
int (*ctrl_control)(int minor, unsigned32 command,
|
||||
void *arg);
|
||||
/*
|
||||
* Functions which allow read/write registers of a particular controller.
|
||||
* (these functions may be used from ide_controller_read_register,
|
||||
* ide_controller_write_register)
|
||||
*/
|
||||
void (*ctrl_reg_read)(int minor, int regist, unsigned16 *value);
|
||||
void (*ctrl_reg_write)(int minor, int regist, unsigned16 value);
|
||||
|
||||
/*
|
||||
* The function allows to escape overhead for read/write register
|
||||
* functions calls
|
||||
*/
|
||||
void (*ctrl_read_block)(int minor, unsigned16 block_size,
|
||||
blkdev_sg_buffer *bufs, rtems_unsigned32 *cbuf,
|
||||
rtems_unsigned32 *pos);
|
||||
void (*ctrl_write_block)(int minor, unsigned16 block_size,
|
||||
blkdev_sg_buffer *bufs, rtems_unsigned32 *cbuf,
|
||||
rtems_unsigned32 *pos);
|
||||
|
||||
rtems_status_code (*ctrl_config_io_speed)(int minor,
|
||||
unsigned8 modes_available);
|
||||
} ide_ctrl_fns_t;
|
||||
|
||||
/*
|
||||
* IDE Controller configuration. Table of such configurations is provided
|
||||
* by BSP
|
||||
*/
|
||||
typedef struct ide_controller_bsp_table_s {
|
||||
char *name; /* device name */
|
||||
ide_ctrl_devs_t type; /* chip type */
|
||||
ide_ctrl_fns_t *fns; /* pointer to the set of driver routines */
|
||||
boolean (*probe)(int minor); /* probe routine */
|
||||
unsigned8 status; /* initialized/non initialized. Should be set
|
||||
* to zero by static initialization
|
||||
*/
|
||||
unsigned32 port1; /* port number for the port of the device */
|
||||
rtems_boolean int_driven; /* interrupt/poll driven */
|
||||
rtems_vector_number int_vec; /* the interrupt vector of the device */
|
||||
void *params; /* contains either device specific data or a
|
||||
* pointer to s device specific information
|
||||
* table
|
||||
*/
|
||||
} ide_controller_bsp_table_t;
|
||||
|
||||
/* IDE controllers Table */
|
||||
extern ide_controller_bsp_table_t IDE_Controller_Table[];
|
||||
|
||||
/* Number of rows in IDE_Controller_Table */
|
||||
extern unsigned long IDE_Controller_Count;
|
||||
|
||||
|
||||
#define IDE_CTRL_MAX_MINOR_NUMBER 4
|
||||
|
||||
#define IDE_CTRL_NON_INITIALIZED 0
|
||||
#define IDE_CTRL_INITIALIZED 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __IDE_CTRL_CFG_H__ */
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* ide_ctrl_io.h
|
||||
*
|
||||
* LibChip library IDE controller header file - IO operations defined for
|
||||
* IDE controllers.
|
||||
*
|
||||
* Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia
|
||||
* Author: Eugeny S. Mints <Eugeny.Mints@oktet.ru>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
#ifndef __IDE_CTRL_IO_H__
|
||||
#define __IDE_CTRL_IO_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/blkdev.h>
|
||||
|
||||
/* Command Block Registers */
|
||||
#define IDE_REGISTER_DATA 0
|
||||
#define IDE_REGISTER_ERROR 1
|
||||
#define IDE_REGISTER_FEATURES IDE_REGISTER_ERROR
|
||||
#define IDE_REGISTER_SECTOR_COUNT 2
|
||||
#define IDE_REGISTER_SECTOR_NUMBER 3
|
||||
#define IDE_REGISTER_LBA0 IDE_REGISTER_SECTOR_NUMBER
|
||||
#define IDE_REGISTER_CYLINDER_LOW 4
|
||||
#define IDE_REGISTER_LBA1 IDE_REGISTER_CYLINDER_LOW
|
||||
#define IDE_REGISTER_CYLINDER_HIGH 5
|
||||
#define IDE_REGISTER_LBA2 IDE_REGISTER_CYLINDER_HIGH
|
||||
#define IDE_REGISTER_DEVICE_HEAD 6
|
||||
#define IDE_REGISTER_LBA3 IDE_REGISTER_DEVICE_HEAD
|
||||
#define IDE_REGISTER_STATUS 7
|
||||
#define IDE_REGISTER_COMMAND IDE_REGISTER_STATUS
|
||||
|
||||
/* Control Block Registers */
|
||||
#define IDE_REGISTER_ALTERNATE_STATUS 6
|
||||
#define IDE_REGISTER_DEVICE_CONTROL IDE_REGISTER_ALTERNATE_STATUS
|
||||
|
||||
/* offsets used to access registers */
|
||||
#define IDE_REGISTER_DEVICE_CONTROL_OFFSET 8
|
||||
#define IDE_REGISTER_ALTERNATE_STATUS_OFFSET IDE_REGISTER_DEVICE_CONTROL_OFFSET
|
||||
#define IDE_REGISTER_DATA_BYTE 9
|
||||
#define IDE_REGISTER_DATA_WORD 10
|
||||
|
||||
/*
|
||||
* Registers bits
|
||||
*/
|
||||
#define IDE_REGISTER_STATUS_BSY 0x80 /* Busy bit */
|
||||
#define IDE_REGISTER_STATUS_DRDY 0x40 /* Device ready */
|
||||
#define IDE_REGISTER_STATUS_DF 0x20 /* Device fault */
|
||||
#define IDE_REGISTER_STATUS_DSC 0x10 /* Device seek complete-- */
|
||||
/* obsolete */
|
||||
#define IDE_REGISTER_STATUS_DRQ 0x08 /* Data request */
|
||||
#define IDE_REGISTER_STATUS_CORR 0x04 /* Corrected data-- */
|
||||
/* vendor specific--obsolete */
|
||||
#define IDE_REGISTER_STATUS_IDX 0x02 /* Index-- */
|
||||
/* vendor specific--obsolete */
|
||||
#define IDE_REGISTER_STATUS_ERR 0x01 /* Error */
|
||||
|
||||
#define IDE_REGISTER_DEVICE_CONTROL_SRST 0x04 /* Host software reset bit */
|
||||
#define IDE_REGISTER_DEVICE_CONTROL_nIEN 0x02 /* Negated interrupt enable */
|
||||
|
||||
#define IDE_REGISTER_DEVICE_HEAD_L 0x40 /* LBA mode bit */
|
||||
#define IDE_REGISTER_DEVICE_HEAD_DEV 0x10 /* Device0/Device1 bit */
|
||||
#define IDE_REGISTER_DEVICE_HEAD_DEV_POS 4 /* Dev0/Dev1 bit position */
|
||||
#define IDE_REGISTER_DEVICE_HEAD_HS 0x0f /* Head/LBA24_27 bits */
|
||||
#define IDE_REGISTER_LBA3_L 0x40
|
||||
#define IDE_REGISTER_LBA3_DEV 0x10
|
||||
#define IDE_REGISTER_LBA3_LBA 0x0f
|
||||
|
||||
#define IDE_REGISTER_ERROR_ICRC 0x80 /* Interface CRC error on */
|
||||
/* UDMA data transfer */
|
||||
#define IDE_REGISTER_ERROR_UNC 0x40 /* Uncorrectable data error */
|
||||
#define IDE_REGISTER_ERROR_WP 0x40 /* Write protect */
|
||||
#define IDE_REGISTER_ERROR_MC 0x20 /* Media changed */
|
||||
#define IDE_REGISTER_ERROR_IDNF 0x10 /* Sector ID not found */
|
||||
#define IDE_REGISTER_ERROR_MCR 0x08 /* Media change requested */
|
||||
#define IDE_REGISTER_ERROR_ABRT 0x04 /* Aborted command */
|
||||
#define IDE_REGISTER_ERROR_NM 0x02 /* No media */
|
||||
#define IDE_REGISTER_ERROR_AMNF 0x01 /* Address mark not found */
|
||||
/* --obsolette in ATA-4 */
|
||||
#define IDE_REGISTER_ERROR_MED 0x01 /* Media error is detected */
|
||||
|
||||
/*
|
||||
* ide_controller_read_data_block --
|
||||
* Read data block via controller's data register
|
||||
*
|
||||
* PARAMETERS:
|
||||
* minor - minor number of controller
|
||||
* block_size - number of bytes to read
|
||||
* bufs - set of buffers to store data
|
||||
* cbuf - number of current buffer from the set
|
||||
* pos - position inside current buffer 'cbuf'
|
||||
*
|
||||
* RETURNS:
|
||||
* NONE
|
||||
*/
|
||||
void
|
||||
ide_controller_read_data_block(rtems_device_minor_number minor,
|
||||
unsigned16 block_size,
|
||||
blkdev_sg_buffer *bufs,
|
||||
rtems_unsigned32 *cbuf,
|
||||
rtems_unsigned32 *pos);
|
||||
|
||||
/*
|
||||
* ide_controller_write_data_block --
|
||||
* Write data block via controller's data register
|
||||
*
|
||||
* PARAMETERS:
|
||||
* minor - minor number of controller
|
||||
* block_size - number of bytes to write
|
||||
* bufs - set of buffers which store data
|
||||
* cbuf - number of current buffer from the set
|
||||
* pos - position inside current buffer 'cbuf'
|
||||
*
|
||||
* RETURNS:
|
||||
* NONE
|
||||
*/
|
||||
void
|
||||
ide_controller_write_data_block(rtems_device_minor_number minor,
|
||||
unsigned16 block_size,
|
||||
blkdev_sg_buffer *bufs,
|
||||
rtems_unsigned32 *cbuf,
|
||||
rtems_unsigned32 *pos);
|
||||
|
||||
/*
|
||||
* ide_controller_read_register --
|
||||
* Read controller's register
|
||||
*
|
||||
* PARAMETERS:
|
||||
* minor - minor number of controller
|
||||
* reg - register to read
|
||||
* value - placeholder for result
|
||||
*
|
||||
* RETURNS
|
||||
* NONE
|
||||
*/
|
||||
void
|
||||
ide_controller_read_register(rtems_device_minor_number minor,
|
||||
int reg,
|
||||
unsigned16 *value);
|
||||
|
||||
/*
|
||||
* ide_controller_write_register --
|
||||
* Write controller's register
|
||||
*
|
||||
* PARAMETERS:
|
||||
* minor - minor number of controller
|
||||
* reg - register to write
|
||||
* value - value to write
|
||||
*
|
||||
* RETURNS:
|
||||
* NONE
|
||||
*/
|
||||
void
|
||||
ide_controller_write_register(rtems_device_minor_number minor,
|
||||
int reg, unsigned16 value);
|
||||
|
||||
/*
|
||||
* ide_controller_config_io_speed --
|
||||
* Set controller's speed of IO operations
|
||||
*
|
||||
* PARAMETERS:
|
||||
* minor - minor number of controller
|
||||
* modes_avaible - speeds available
|
||||
*
|
||||
* RETURNS:
|
||||
* RTEMS_SUCCESSFUL on success, or error code if
|
||||
* error occured
|
||||
*/
|
||||
rtems_status_code
|
||||
ide_controller_config_io_speed(int minor, unsigned8 modes_avaible);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __IDE_CTRL_IO_H__ */
|
||||
Reference in New Issue
Block a user