dataSynchronizationMemory.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. * bfin_can.h - interface to Blackfin CANs
  3. *
  4. * Copyright 2004-2009 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __ASM_BFIN_CAN_H__
  9. #define __ASM_BFIN_CAN_H__
  10. /*
  11. * transmit and receive channels
  12. */
  13. #define TRANSMIT_CHL 24
  14. #define RECEIVE_STD_CHL 0
  15. #define RECEIVE_EXT_CHL 4
  16. #define RECEIVE_RTR_CHL 8
  17. #define RECEIVE_EXT_RTR_CHL 12
  18. #define MAX_CHL_NUMBER 32
  19. /*
  20. * All Blackfin system MMRs are padded to 32bits even if the register
  21. * itself is only 16bits. So use a helper macro to streamline this.
  22. */
  23. #define __BFP(m) u16 m; u16 __pad_##m
  24. /*
  25. * bfin can registers layout
  26. */
  27. struct bfin_can_mask_regs {
  28. __BFP(aml);
  29. __BFP(amh);
  30. };
  31. struct bfin_can_channel_regs {
  32. /* data[0,2,4,6] -> data{0,1,2,3} while data[1,3,5,7] is padding */
  33. u16 data[8];
  34. __BFP(dlc);
  35. __BFP(tsv);
  36. __BFP(id0);
  37. __BFP(id1);
  38. };
  39. struct bfin_can_regs {
  40. /*
  41. * global control and status registers
  42. */
  43. __BFP(mc1); /* offset 0x00 */
  44. __BFP(md1); /* offset 0x04 */
  45. __BFP(trs1); /* offset 0x08 */
  46. __BFP(trr1); /* offset 0x0c */
  47. __BFP(ta1); /* offset 0x10 */
  48. __BFP(aa1); /* offset 0x14 */
  49. __BFP(rmp1); /* offset 0x18 */
  50. __BFP(rml1); /* offset 0x1c */
  51. __BFP(mbtif1); /* offset 0x20 */
  52. __BFP(mbrif1); /* offset 0x24 */
  53. __BFP(mbim1); /* offset 0x28 */
  54. __BFP(rfh1); /* offset 0x2c */
  55. __BFP(opss1); /* offset 0x30 */
  56. u32 __pad1[3];
  57. __BFP(mc2); /* offset 0x40 */
  58. __BFP(md2); /* offset 0x44 */
  59. __BFP(trs2); /* offset 0x48 */
  60. __BFP(trr2); /* offset 0x4c */
  61. __BFP(ta2); /* offset 0x50 */
  62. __BFP(aa2); /* offset 0x54 */
  63. __BFP(rmp2); /* offset 0x58 */
  64. __BFP(rml2); /* offset 0x5c */
  65. __BFP(mbtif2); /* offset 0x60 */
  66. __BFP(mbrif2); /* offset 0x64 */
  67. __BFP(mbim2); /* offset 0x68 */
  68. __BFP(rfh2); /* offset 0x6c */
  69. __BFP(opss2); /* offset 0x70 */
  70. u32 __pad2[3];
  71. __BFP(clock); /* offset 0x80 */
  72. __BFP(timing); /* offset 0x84 */
  73. __BFP(debug); /* offset 0x88 */
  74. __BFP(status); /* offset 0x8c */
  75. __BFP(cec); /* offset 0x90 */
  76. __BFP(gis); /* offset 0x94 */
  77. __BFP(gim); /* offset 0x98 */
  78. __BFP(gif); /* offset 0x9c */
  79. __BFP(control); /* offset 0xa0 */
  80. __BFP(intr); /* offset 0xa4 */
  81. __BFP(version); /* offset 0xa8 */
  82. __BFP(mbtd); /* offset 0xac */
  83. __BFP(ewr); /* offset 0xb0 */
  84. __BFP(esr); /* offset 0xb4 */
  85. u32 __pad3[2];
  86. __BFP(ucreg); /* offset 0xc0 */
  87. __BFP(uccnt); /* offset 0xc4 */
  88. __BFP(ucrc); /* offset 0xc8 */
  89. __BFP(uccnf); /* offset 0xcc */
  90. u32 __pad4[1];
  91. __BFP(version2); /* offset 0xd4 */
  92. u32 __pad5[10];
  93. /*
  94. * channel(mailbox) mask and message registers
  95. */
  96. struct bfin_can_mask_regs msk[MAX_CHL_NUMBER]; /* offset 0x100 */
  97. struct bfin_can_channel_regs chl[MAX_CHL_NUMBER]; /* offset 0x200 */
  98. };
  99. #undef __BFP
  100. /* CAN_CONTROL Masks */
  101. #define SRS 0x0001 /* Software Reset */
  102. #define DNM 0x0002 /* Device Net Mode */
  103. #define ABO 0x0004 /* Auto-Bus On Enable */
  104. #define TXPRIO 0x0008 /* TX Priority (Priority/Mailbox*) */
  105. #define WBA 0x0010 /* Wake-Up On CAN Bus Activity Enable */
  106. #define SMR 0x0020 /* Sleep Mode Request */
  107. #define CSR 0x0040 /* CAN Suspend Mode Request */
  108. #define CCR 0x0080 /* CAN Configuration Mode Request */
  109. /* CAN_STATUS Masks */
  110. #define WT 0x0001 /* TX Warning Flag */
  111. #define WR 0x0002 /* RX Warning Flag */
  112. #define EP 0x0004 /* Error Passive Mode */
  113. #define EBO 0x0008 /* Error Bus Off Mode */
  114. #define SMA 0x0020 /* Sleep Mode Acknowledge */
  115. #define CSA 0x0040 /* Suspend Mode Acknowledge */
  116. #define CCA 0x0080 /* Configuration Mode Acknowledge */
  117. #define MBPTR 0x1F00 /* Mailbox Pointer */
  118. #define TRM 0x4000 /* Transmit Mode */
  119. #define REC 0x8000 /* Receive Mode */
  120. /* CAN_CLOCK Masks */
  121. #define BRP 0x03FF /* Bit-Rate Pre-Scaler */
  122. /* CAN_TIMING Masks */
  123. #define TSEG1 0x000F /* Time Segment 1 */
  124. #define TSEG2 0x0070 /* Time Segment 2 */
  125. #define SAM 0x0080 /* Sampling */
  126. #define SJW 0x0300 /* Synchronization Jump Width */
  127. /* CAN_DEBUG Masks */
  128. #define DEC 0x0001 /* Disable CAN Error Counters */
  129. #define DRI 0x0002 /* Disable CAN RX Input */
  130. #define DTO 0x0004 /* Disable CAN TX Output */
  131. #define DIL 0x0008 /* Disable CAN Internal Loop */
  132. #define MAA 0x0010 /* Mode Auto-Acknowledge Enable */
  133. #define MRB 0x0020 /* Mode Read Back Enable */
  134. #define CDE 0x8000 /* CAN Debug Enable */
  135. /* CAN_CEC Masks */
  136. #define RXECNT 0x00FF /* Receive Error Counter */
  137. #define TXECNT 0xFF00 /* Transmit Error Counter */
  138. /* CAN_INTR Masks */
  139. #define MBRIRQ 0x0001 /* Mailbox Receive Interrupt */
  140. #define MBTIRQ 0x0002 /* Mailbox Transmit Interrupt */
  141. #define GIRQ 0x0004 /* Global Interrupt */
  142. #define SMACK 0x0008 /* Sleep Mode Acknowledge */
  143. #define CANTX 0x0040 /* CAN TX Bus Value */
  144. #define CANRX 0x0080 /* CAN RX Bus Value */
  145. /* CAN_MBxx_ID1 and CAN_MBxx_ID0 Masks */
  146. #define DFC 0xFFFF /* Data Filtering Code (If Enabled) (ID0) */
  147. #define EXTID_LO 0xFFFF /* Lower 16 Bits of Extended Identifier (ID0) */
  148. #define EXTID_HI 0x0003 /* Upper 2 Bits of Extended Identifier (ID1) */
  149. #define BASEID 0x1FFC /* Base Identifier */
  150. #define IDE 0x2000 /* Identifier Extension */
  151. #define RTR 0x4000 /* Remote Frame Transmission Request */
  152. #define AME 0x8000 /* Acceptance Mask Enable */