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