RTEMS 6.1-rc4
Loading...
Searching...
No Matches
pcmcia_ide.h
1/*
2 * RTEMS generic MPC5200 BSP
3 *
4 * RTEMS MPC5x00 PCMCIA IDE harddisk header file
5 * This file contains declarations for the PCMCIA IDE Interface.
6 */
7
8/*
9 * Copyright (c) 2003 IPR Engineering
10 * Copyright (c) 2005 embedded brains GmbH & Co. KG
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
17#ifndef __PCMCIA_IDE_h
18#define __PCMCIA_IDE_h
19
20#include <bsp.h>
21
22#define GPIOPCR_ATA_CS_4_5 (1 << 24)
23
24/*#define DEBUG_OUT*/
25#define GET_UP_BYTE_OF_MPC5200_ATA_DRIVE_REG(val32) ((uint16_t)((val32) >> 24))
26#define SET_UP_BYTE_OF_MPC5200_ATA_DRIVE_REG(val8) ((uint32_t)((val8) << 24))
27#define GET_UP_WORD_OF_MPC5200_ATA_DRIVE_REG(val32) ((uint16_t)((val32) >> 16))
28#define SET_UP_WORD_OF_MPC5200_ATA_DRIVE_REG(val16) ((uint32_t)((val16) << 16))
29
30#define ATA_HCFG_SMR (1 << 31)
31#define ATA_HCFG_FR (1 << 30)
32#define ATA_HCFG_IORDY (1 << 24)
33#define ATA_HCFG_IE (1 << 25)
34
35#define COUNT_VAL(nsec) (((nsec) * (IPB_CLOCK / 1000000) + 999) / 1000)
36
37#define PIO_3 0
38#define PIO_4 1
39
40#define T0 0
41#define T2_8 1
42#define T2_16 2
43#define T4 3
44#define T1 4
45#define TA 5
46
47#define ATA_PIO_TIMING_1(t0,t2_8,t2_16) (((COUNT_VAL(t0)) << 24) | ((COUNT_VAL(t2_8)) << 16) | ((COUNT_VAL(t2_16)) << 8))
48#define ATA_PIO_TIMING_2(t4,t1,ta) (((COUNT_VAL(t4)) << 24) | ((COUNT_VAL(t1)) << 16) | ((COUNT_VAL(ta)) << 8))
49
50#endif