BOOTLOADER
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
uda1341.c
Go to the documentation of this file.
1 //======
2 // iis device driver
3 //======
4 #include "includes.h"
5 
6 #define F_L3ModeSet() rGPBDAT|=(1<<2) // GPB^2...TOUT2
7 #define F_L3ModeClear() rGPBDAT&=~(1<<2) // GPB^2...TOUT2
8 #define F_L3DataSet() rGPBDAT|=(1<<3) // GPB^3...TOUT3
9 #define F_L3DataClear() rGPBDAT&=~(1<<3) // GPB^3...TOUT3
10 #define F_L3ClockSet() rGPBDAT|=(1<<4) // GPB^4...TOUT4
11 #define F_L3ClockClear() rGPBDAT&=~(1<<4) // GPB^4...TOUT4
12 
14  //INT16U Index;
15 
16  F_L3ModeSet();
17  F_L3DataSet();
18  F_L3ClockSet();
23  else F_Uda1341L3DataWrite(0x28);
26  if(Mode==UDA_RECORD_MODE){
38  F_Uda1341L3DataWrite(0xf9);
39  }
40 }
42  INT8U i,j;
43 
44  F_L3DataClear();
45  //F_L3ClockSet(); // ??
46  //for(i=0;i<10;i++); // L3 tsu >190ns
47  //F_L3ModeSet(); // ??
48  //for(i=0;i<10;i++); // L3 tsu >190ns
49  F_L3ModeClear();
50  for(i=0;i<10;i++); // L3 tsu >190ns
51  for(i=0;i<8;i++){
52  if(Address&0x01){
53  F_L3DataSet();
54  F_L3ClockClear();
55  for(j=0;j<10;j++);
56  F_L3ClockSet();
57  for(j=0;j<10;j++);
58  }
59  else{
60  F_L3DataClear();
61  F_L3ClockClear();
62  for(j=0;j<10;j++);
63  F_L3ClockSet();
64  for(j=0;j<10;j++);
65  }
66  Address>>=1;
67  }
68  //F_L3ClockSet(); // no need
69  F_L3ModeSet();
70  for(j=0;j<10;j++);
71 }
73  INT8U i,j;
74 
75  F_L3DataClear();
76  //F_L3ClockSet(); // no need
77  //for(i=0;i<10;i++); // L3 tsu >190ns
78  //F_L3ModeSet();
79  //for(i=0;i<10;i++); // L3 tsu >190ns
80  F_L3ModeClear();
81  for(i=0;i<10;i++); // L3 tsu >190ns
82  F_L3ModeSet();
83  for(i=0;i<10;i++); // L3 tsu >190ns
84  for(i=0;i<8;i++){
85  if(Data&0x01){
86  F_L3DataSet();
87  F_L3ClockClear();
88  for(j=0;j<10;j++);
89  F_L3ClockSet();
90  for(j=0;j<10;j++);
91  }
92  else{
93  F_L3DataClear();
94  F_L3ClockClear();
95  for(j=0;j<10;j++);
96  F_L3ClockSet();
97  for(j=0;j<10;j++);
98  }
99  Data>>=1;
100  }
101  //F_L3ClockSet(); // no need
102  //for(j=0;j<10;j++);
103  F_L3ModeClear();
104  for(j=0;j<10;j++);
105  F_L3ModeSet();
106  for(j=0;j<10;j++);
107 }
108 #define UDA1341_MAX_VOLUMN 61
110  F_L3ClockSet();
111  F_L3ModeSet();
112  F_L3DataClear();
113  Volumn=(Volumn*UDA1341_MAX_VOLUMN)/0xffff; // Volumn=0~0xffff...65525
116 }
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145