Zerocat Chipflasher  v0.4.3 (board-edition-1)
Flash free firmware to BIOS chips, kick the Manageability Engine.
fast-SPI.h
Go to the documentation of this file.
1 /******************************************************************/
34 #ifndef __FAST_SPI_H__
35 #define __FAST_SPI_H__
36 
37 #define NOP __asm__ volatile \
38  ("nop 'delay 50ns" \
39  : /* no outputs */ \
40  : /* no inputs */ )
41 
42 #define t_NONE
43 #define t_FAST ; NOP
44 #define t_SLOW ; NOP; NOP; NOP
45 
46 #define tSCLK t_NONE
47 #define tCLQV t_NONE
48 #define tDSU t_NONE
49 #define tCSL t_NONE
50 
51 #define tCSH ; NOP; NOP
52 #define tSHWL ; NOP; NOP
53 #define tWHSL ; NOP; NOP
54 #define tHHQX ; NOP
55 #define tHLQZ ; NOP
56 
57 #define CHIP_ON __asm__ volatile \
58  ("or dira, %0 'activate output, CE# goes low" \
59  : /* no outputs */ \
60  : "i" (CEn_AVAIL)) \
61  tCSL
62 
63 #define CHIP_OFF __asm__ volatile \
64  ("andn dira, %0 'tristate, CE# goes high via pull-up" \
65  : /* no outputs */ \
66  : "i" (CEn_AVAIL)) \
67  tCSH
68 
69 #define WPn_HIGH __asm__ volatile \
70  ("or outa, %0 'WP# high" \
71  : /* no outputs */ \
72  : "i" (BIT_WPn)) \
73  tWHSL
74 
75 #define WPn_LOW __asm__ volatile \
76  ("andn outa, %0 'WP# low" \
77  : /* no outputs */ \
78  : "i" (BIT_WPn)) \
79  tSHWL
80 
81 #define CLOCK_HIGH __asm__ volatile \
82  ("or outa, %0 'clock high" \
83  : /* no outputs */ \
84  : "i" (SCLK_AVAIL)) \
85  tSCLK
86 
87 #define CLOCK_LOW __asm__ volatile \
88  ("andn outa, %0 'clock low" \
89  : /* no outputs */ \
90  : "i" (SCLK_AVAIL)) \
91  tSCLK
92 
93 #define SO_HIGH __asm__ volatile \
94  ("or outa, %0 'SO high" \
95  : /* no outputs */ \
96  : "i" (BIT_MOSI)) \
97  tDSU
98 
99 #define SO_LOW __asm__ volatile \
100  ("andn outa, %0 'SO low" \
101  : /* no outputs */ \
102  : "i" (BIT_MOSI)) \
103  tDSU
104 
105 /*
106 #define HOLDn_HIGH __asm__ volatile \
107  ("or outa, %0 'HOLD# high" \
108  : \
109  : "i" (BIT_HOLDn)) \
110  tHLQZ
111 
112 #define HOLDn_LOW __asm__ volatile \
113  ("andn outa, %0 'HOLD# low" \
114  : \
115  : "i" (BIT_HOLDn)) \
116  tHHQX
117 */
118 #define HOLDn_HIGH OUTA |= BIT_HOLDn \
119  tHLQZ
120 
121 #define HOLDn_LOW OUTA &= ~BIT_HOLDn \
122  tHHQX
123 
124 
125 #endif
126 /* __FAST_SPI_H__ */