eport.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Edge Port Memory Map
  3. *
  4. * Copyright (C) 2004-2008 Freescale Semiconductor, Inc.
  5. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  6. *
  7. * See file CREDITS for list of people who contributed to this
  8. * project.
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License as
  12. * published by the Free Software Foundation; either version 2 of
  13. * the License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  23. * MA 02111-1307 USA
  24. */
  25. #ifndef __EPORT_H__
  26. #define __EPORT_H__
  27. /* Edge Port Module (EPORT) */
  28. typedef struct eport {
  29. #ifdef CONFIG_MCF547x_8x
  30. u16 par; /* 0x00 */
  31. u16 res0; /* 0x02 */
  32. u8 ddr; /* 0x04 */
  33. u8 ier; /* 0x05 */
  34. u16 res1; /* 0x06 */
  35. u8 dr; /* 0x08 */
  36. u8 pdr; /* 0x09 */
  37. u16 res2; /* 0x0A */
  38. u8 fr; /* 0x0C */
  39. u8 res3[3]; /* 0x0D */
  40. #else
  41. u16 par; /* 0x00 Pin Assignment */
  42. u8 ddr; /* 0x02 Data Direction */
  43. u8 ier; /* 0x03 Interrupt Enable */
  44. u8 dr; /* 0x04 Data */
  45. u8 pdr; /* 0x05 Pin Data */
  46. u8 fr; /* 0x06 Flag */
  47. u8 res0;
  48. #endif
  49. } eport_t;
  50. /* EPPAR */
  51. #define EPORT_PAR_EPPA1(x) (((x)&0x0003)<<2)
  52. #define EPORT_PAR_EPPA2(x) (((x)&0x0003)<<4)
  53. #define EPORT_PAR_EPPA3(x) (((x)&0x0003)<<6)
  54. #define EPORT_PAR_EPPA4(x) (((x)&0x0003)<<8)
  55. #define EPORT_PAR_EPPA5(x) (((x)&0x0003)<<10)
  56. #define EPORT_PAR_EPPA6(x) (((x)&0x0003)<<12)
  57. #define EPORT_PAR_EPPA7(x) (((x)&0x0003)<<14)
  58. #define EPORT_PAR_LEVEL (0)
  59. #define EPORT_PAR_RISING (1)
  60. #define EPORT_PAR_FALLING (2)
  61. #define EPORT_PAR_BOTH (3)
  62. #define EPORT_PAR_EPPA7_LEVEL (0x0000)
  63. #define EPORT_PAR_EPPA7_RISING (0x4000)
  64. #define EPORT_PAR_EPPA7_FALLING (0x8000)
  65. #define EPORT_PAR_EPPA7_BOTH (0xC000)
  66. #define EPORT_PAR_EPPA6_LEVEL (0x0000)
  67. #define EPORT_PAR_EPPA6_RISING (0x1000)
  68. #define EPORT_PAR_EPPA6_FALLING (0x2000)
  69. #define EPORT_PAR_EPPA6_BOTH (0x3000)
  70. #define EPORT_PAR_EPPA5_LEVEL (0x0000)
  71. #define EPORT_PAR_EPPA5_RISING (0x0400)
  72. #define EPORT_PAR_EPPA5_FALLING (0x0800)
  73. #define EPORT_PAR_EPPA5_BOTH (0x0C00)
  74. #define EPORT_PAR_EPPA4_LEVEL (0x0000)
  75. #define EPORT_PAR_EPPA4_RISING (0x0100)
  76. #define EPORT_PAR_EPPA4_FALLING (0x0200)
  77. #define EPORT_PAR_EPPA4_BOTH (0x0300)
  78. #define EPORT_PAR_EPPA3_LEVEL (0x0000)
  79. #define EPORT_PAR_EPPA3_RISING (0x0040)
  80. #define EPORT_PAR_EPPA3_FALLING (0x0080)
  81. #define EPORT_PAR_EPPA3_BOTH (0x00C0)
  82. #define EPORT_PAR_EPPA2_LEVEL (0x0000)
  83. #define EPORT_PAR_EPPA2_RISING (0x0010)
  84. #define EPORT_PAR_EPPA2_FALLING (0x0020)
  85. #define EPORT_PAR_EPPA2_BOTH (0x0030)
  86. #define EPORT_PAR_EPPA1_LEVEL (0x0000)
  87. #define EPORT_PAR_EPPA1_RISING (0x0004)
  88. #define EPORT_PAR_EPPA1_FALLING (0x0008)
  89. #define EPORT_PAR_EPPA1_BOTH (0x000C)
  90. /* EPDDR */
  91. #define EPORT_DDR_EPDD1 (0x02)
  92. #define EPORT_DDR_EPDD2 (0x04)
  93. #define EPORT_DDR_EPDD3 (0x08)
  94. #define EPORT_DDR_EPDD4 (0x10)
  95. #define EPORT_DDR_EPDD5 (0x20)
  96. #define EPORT_DDR_EPDD6 (0x40)
  97. #define EPORT_DDR_EPDD7 (0x80)
  98. /* EPIER */
  99. #define EPORT_IER_EPIE1 (0x02)
  100. #define EPORT_IER_EPIE2 (0x04)
  101. #define EPORT_IER_EPIE3 (0x08)
  102. #define EPORT_IER_EPIE4 (0x10)
  103. #define EPORT_IER_EPIE5 (0x20)
  104. #define EPORT_IER_EPIE6 (0x40)
  105. #define EPORT_IER_EPIE7 (0x80)
  106. /* EPDR */
  107. #define EPORT_DR_EPD1 (0x02)
  108. #define EPORT_DR_EPD2 (0x04)
  109. #define EPORT_DR_EPD3 (0x08)
  110. #define EPORT_DR_EPD4 (0x10)
  111. #define EPORT_DR_EPD5 (0x20)
  112. #define EPORT_DR_EPD6 (0x40)
  113. #define EPORT_DR_EPD7 (0x80)
  114. /* EPPDR */
  115. #define EPORT_PDR_EPPD1 (0x02)
  116. #define EPORT_PDR_EPPD2 (0x04)
  117. #define EPORT_PDR_EPPD3 (0x08)
  118. #define EPORT_PDR_EPPD4 (0x10)
  119. #define EPORT_PDR_EPPD5 (0x20)
  120. #define EPORT_PDR_EPPD6 (0x40)
  121. #define EPORT_PDR_EPPD7 (0x80)
  122. /* EPFR */
  123. #define EPORT_FR_EPF1 (0x02)
  124. #define EPORT_FR_EPF2 (0x04)
  125. #define EPORT_FR_EPF3 (0x08)
  126. #define EPORT_FR_EPF4 (0x10)
  127. #define EPORT_FR_EPF5 (0x20)
  128. #define EPORT_FR_EPF6 (0x40)
  129. #define EPORT_FR_EPF7 (0x80)
  130. #endif /* __EPORT_H__ */