RTEMS  5.1
pcmcia_ide.h
1 /*===============================================================*\
2 | Project: RTEMS generic MPC5200 BSP |
3 +-----------------------------------------------------------------+
4 | Partially based on the code references which are named below. |
5 | Adaptions, modifications, enhancements and any recent parts of |
6 | the code are: |
7 | Copyright (c) 2005 |
8 | Embedded Brains GmbH |
9 | Obere Lagerstr. 30 |
10 | D-82178 Puchheim |
11 | Germany |
12 | rtems@embedded-brains.de |
13 +-----------------------------------------------------------------+
14 | The license and distribution terms for this file may be |
15 | found in the file LICENSE in this distribution or at |
16 | |
17 | http://www.rtems.org/license/LICENSE. |
18 | |
19 +-----------------------------------------------------------------+
20 | this file contains declarations for the PCMCIA IDE Interface |
21 \*===============================================================*/
22 /***********************************************************************/
23 /* */
24 /* Module: pcmcia_ide.h */
25 /* Date: 17/07/2003 */
26 /* Purpose: RTEMS MPC5x00 PCMCIA IDE harddisk header file */
27 /* */
28 /*---------------------------------------------------------------------*/
29 /* */
30 /* Description: */
31 /* */
32 /*---------------------------------------------------------------------*/
33 /* */
34 /* Code */
35 /* References: none */
36 /* Module: */
37 /* Project: */
38 /* Version */
39 /* Date: */
40 /* */
41 /* Author(s) / Copyright(s): */
42 /* */
43 /*---------------------------------------------------------------------*/
44 /* */
45 /* Partially based on the code references which are named above. */
46 /* Adaptions, modifications, enhancements and any recent parts of */
47 /* the code are under the right of */
48 /* */
49 /* IPR Engineering, Dachauer Straße 38, D-80335 München */
50 /* Copyright(C) 2003 */
51 /* */
52 /*---------------------------------------------------------------------*/
53 /* */
54 /* IPR Engineering makes no representation or warranties with */
55 /* respect to the performance of this computer program, and */
56 /* specifically disclaims any responsibility for any damages, */
57 /* special or consequential, connected with the use of this program. */
58 /* */
59 /*---------------------------------------------------------------------*/
60 /* */
61 /* Version history: 1.0 */
62 /* */
63 /***********************************************************************/
64 
65 #ifndef __PCMCIA_IDE_h
66 #define __PCMCIA_IDE_h
67 
68 #include <bsp.h>
69 
70 #define GPIOPCR_ATA_CS_4_5 (1 << 24)
71 
72 /*#define DEBUG_OUT*/
73 #define GET_UP_BYTE_OF_MPC5200_ATA_DRIVE_REG(val32) ((uint16_t)((val32) >> 24))
74 #define SET_UP_BYTE_OF_MPC5200_ATA_DRIVE_REG(val8) ((uint32_t)((val8) << 24))
75 #define GET_UP_WORD_OF_MPC5200_ATA_DRIVE_REG(val32) ((uint16_t)((val32) >> 16))
76 #define SET_UP_WORD_OF_MPC5200_ATA_DRIVE_REG(val16) ((uint32_t)((val16) << 16))
77 
78 #define ATA_HCFG_SMR (1 << 31)
79 #define ATA_HCFG_FR (1 << 30)
80 #define ATA_HCFG_IORDY (1 << 24)
81 #define ATA_HCFG_IE (1 << 25)
82 
83 #define COUNT_VAL(nsec) (((nsec) * (IPB_CLOCK / 1000000) + 999) / 1000)
84 
85 #define PIO_3 0
86 #define PIO_4 1
87 
88 #define T0 0
89 #define T2_8 1
90 #define T2_16 2
91 #define T4 3
92 #define T1 4
93 #define TA 5
94 
95 #define ATA_PIO_TIMING_1(t0,t2_8,t2_16) (((COUNT_VAL(t0)) << 24) | ((COUNT_VAL(t2_8)) << 16) | ((COUNT_VAL(t2_16)) << 8))
96 #define ATA_PIO_TIMING_2(t4,t1,ta) (((COUNT_VAL(t4)) << 24) | ((COUNT_VAL(t1)) << 16) | ((COUNT_VAL(ta)) << 8))
97 
98 #endif