blackfin.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * Common header file for blackfin family of processors.
  3. *
  4. */
  5. #ifndef _BLACKFIN_H_
  6. #define _BLACKFIN_H_
  7. #define LO(con32) ((con32) & 0xFFFF)
  8. #define lo(con32) ((con32) & 0xFFFF)
  9. #define HI(con32) (((con32) >> 16) & 0xFFFF)
  10. #define hi(con32) (((con32) >> 16) & 0xFFFF)
  11. #include <asm/mach/blackfin.h>
  12. #include <asm/bfin-global.h>
  13. #ifndef __ASSEMBLY__
  14. /* SSYNC implementation for C file */
  15. #if defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
  16. static inline void SSYNC (void)
  17. {
  18. int _tmp;
  19. __asm__ __volatile__ ("cli %0;\n\t"
  20. "nop;nop;\n\t"
  21. "ssync;\n\t"
  22. "sti %0;\n\t"
  23. :"=d"(_tmp):);
  24. }
  25. #elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
  26. static inline void SSYNC (void)
  27. {
  28. int _tmp;
  29. __asm__ __volatile__ ("cli %0;\n\t"
  30. "ssync;\n\t"
  31. "sti %0;\n\t"
  32. :"=d"(_tmp):);
  33. }
  34. #elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
  35. static inline void SSYNC (void)
  36. {
  37. __asm__ __volatile__ ("nop; nop; nop;\n\t"
  38. "ssync;\n\t"
  39. ::);
  40. }
  41. #elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
  42. static inline void SSYNC (void)
  43. {
  44. __asm__ __volatile__ ("ssync;\n\t");
  45. }
  46. #endif
  47. /* CSYNC implementation for C file */
  48. #if defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
  49. static inline void CSYNC (void)
  50. {
  51. int _tmp;
  52. __asm__ __volatile__ ("cli %0;\n\t"
  53. "nop;nop;\n\t"
  54. "csync;\n\t"
  55. "sti %0;\n\t"
  56. :"=d"(_tmp):);
  57. }
  58. #elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
  59. static inline void CSYNC (void)
  60. {
  61. int _tmp;
  62. __asm__ __volatile__ ("cli %0;\n\t"
  63. "csync;\n\t"
  64. "sti %0;\n\t"
  65. :"=d"(_tmp):);
  66. }
  67. #elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
  68. static inline void CSYNC (void)
  69. {
  70. __asm__ __volatile__ ("nop; nop; nop;\n\t"
  71. "ssync;\n\t"
  72. ::);
  73. }
  74. #elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
  75. static inline void CSYNC (void)
  76. {
  77. __asm__ __volatile__ ("csync;\n\t");
  78. }
  79. #endif
  80. #else /* __ASSEMBLY__ */
  81. /* SSYNC & CSYNC implementations for assembly files */
  82. #define ssync(x) SSYNC(x)
  83. #define csync(x) CSYNC(x)
  84. #if defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
  85. #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
  86. #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
  87. #elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
  88. #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
  89. #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
  90. #elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
  91. #define SSYNC(scratch) nop; nop; nop; SSYNC;
  92. #define CSYNC(scratch) nop; nop; nop; CSYNC;
  93. #elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
  94. #define SSYNC(scratch) SSYNC;
  95. #define CSYNC(scratch) CSYNC;
  96. #endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */
  97. #endif /* __ASSEMBLY__ */
  98. #endif /* _BLACKFIN_H_ */