summaryrefslogtreecommitdiffstats
path: root/bsps/include/libchip/ide_ctrl_io.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-12-23 18:18:56 +1100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-01-25 08:45:26 +0100
commit2afb22b7e1ebcbe40373ff7e0efae7d207c655a9 (patch)
tree44759efe9374f13200a97e96d91bd9a2b7e5ce2a /bsps/include/libchip/ide_ctrl_io.h
parentMAINTAINERS: Add myself to Write After Approval. (diff)
downloadrtems-2afb22b7e1ebcbe40373ff7e0efae7d207c655a9.tar.bz2
Remove make preinstall
A speciality of the RTEMS build system was the make preinstall step. It copied header files from arbitrary locations into the build tree. The header files were included via the -Bsome/build/tree/path GCC command line option. This has at least seven problems: * The make preinstall step itself needs time and disk space. * Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error. * There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult. * The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit. * An introduction of a new build system is difficult. * Include paths specified by the -B option are system headers. This may suppress warnings. * The parallel build had sporadic failures on some hosts. This patch removes the make preinstall step. All installed header files are moved to dedicated include directories in the source tree. Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc, etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g. erc32, imx, qoriq, etc. The new cpukit include directories are: * cpukit/include * cpukit/score/cpu/@RTEMS_CPU@/include * cpukit/libnetworking The new BSP include directories are: * bsps/include * bsps/@RTEMS_CPU@/include * bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include There are build tree include directories for generated files. The include directory order favours the most general header file, e.g. it is not possible to override general header files via the include path order. The "bootstrap -p" option was removed. The new "bootstrap -H" option should be used to regenerate the "headers.am" files. Update #3254.
Diffstat (limited to 'bsps/include/libchip/ide_ctrl_io.h')
-rw-r--r--bsps/include/libchip/ide_ctrl_io.h186
1 files changed, 186 insertions, 0 deletions
diff --git a/bsps/include/libchip/ide_ctrl_io.h b/bsps/include/libchip/ide_ctrl_io.h
new file mode 100644
index 0000000000..9534b0e88f
--- /dev/null
+++ b/bsps/include/libchip/ide_ctrl_io.h
@@ -0,0 +1,186 @@
+/*
+ * 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.rtems.org/license/LICENSE.
+ */
+#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 (1 << 7) /* Interface CRC error on */
+ /* UDMA data transfer */
+#define IDE_REGISTER_ERROR_UNC (1 << 6) /* Uncorrectable data error */
+#if CCJ_COULD_NOT_FIND_THIS_ERROR
+#define IDE_REGISTER_ERROR_WP (1 << 6) /* Write protect */
+#endif
+#define IDE_REGISTER_ERROR_MC (1 << 5) /* Media changed */
+#define IDE_REGISTER_ERROR_IDNF (1 << 4) /* Sector ID not found */
+#define IDE_REGISTER_ERROR_MCR (1 << 3) /* Media change requested */
+ /* obsolette */
+#define IDE_REGISTER_ERROR_ABRT (1 << 2) /* Aborted command */
+#define IDE_REGISTER_ERROR_NM (1 << 1) /* No media, End of Media. */
+#define IDE_REGISTER_ERROR_AMNF (1 << 0) /* Address mark not found */
+ /* --obsolette in ATA-4 */
+#define IDE_REGISTER_ERROR_MED (1 << 0) /* 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,
+ uint32_t block_size,
+ rtems_blkdev_sg_buffer *bufs,
+ uint32_t *cbuf,
+ uint32_t *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,
+ uint32_t block_size,
+ rtems_blkdev_sg_buffer *bufs,
+ uint32_t *cbuf,
+ uint32_t *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,
+ uint16_t *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, uint16_t value);
+
+/*
+ * ide_controller_config_io_speed --
+ * Set controller's speed of IO operations
+ *
+ * PARAMETERS:
+ * minor - minor number of controller
+ * modes_available - speeds available
+ *
+ * RETURNS:
+ * RTEMS_SUCCESSFUL on success, or error code if
+ * error occured
+ */
+rtems_status_code
+ide_controller_config_io_speed(int minor, uint16_t modes_available);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __IDE_CTRL_IO_H__ */