firmware  v0.1.2
Chromation Spectrometer Dev-Kit
Usb_faked.c
Go to the documentation of this file.
1 
37 #include "Usb_faked.h"
38 #include "Mock.h" // record call history in "mock"
39 #include "Usb.h"
40 
41 // ---Private functions faked for testing---
42 
43 /* =====[ Mock _FtClockDatabus(FtDrive) ]===== */
44 static RecordedCall * Record__FtClockDatabus(uint8_t arg1)
45 { // Define **what is recorded** when fake is called.
46  char const *call_name = "_FtClockDatabus";
47  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
48  RecordedArg *record_of_arg1 = RecordedArg_new(SetupRecord_uint8_t);
49  *((uint8_t *)record_of_arg1->pArg) = arg1;
50  // Store the arg records in the call record.
51  RecordArg(record_of_this_call, record_of_arg1);
52  return record_of_this_call;
53 }
54 void _FtClockDatabus_fake(uint8_t direction)
55 {
60  RecordActualCall(mock, Record__FtClockDatabus(direction));
61 }
62 
63 /* =====[ Mock _FtReadDatabus ]===== */
64 static RecordedCall * Record__FtReadDatabus(uint8_t * arg1)
65 { // Define **what is recorded** when fake is called.
66  char const *call_name = "_FtReadDatabus";
67  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
68  RecordedArg *record_of_arg1 = RecordedArg_new(SetupRecord_p_uint8_t);
69  *((uint8_t **)record_of_arg1->pArg) = arg1;
70  // Store the arg records in the call record.
71  RecordArg(record_of_this_call, record_of_arg1);
72  return record_of_this_call;
73 }
74 void _FtReadDatabus_fake(uint8_t * pbyte)
75 {
80  RecordActualCall( mock, Record__FtReadDatabus(pbyte) );
81 }
82 
83 /* =====[ Mock _FtWriteDatabus ]===== */
84 static RecordedCall * Record__FtWriteDatabus(uint8_t arg1)
85 { // Define **what is recorded** when fake is called.
86  char const *call_name = "_FtWriteDatabus";
87  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
88  RecordedArg *record_of_arg1 = RecordedArg_new(SetupRecord_uint8_t);
89  *((uint8_t *)record_of_arg1->pArg) = arg1;
90  // Store the arg records in the call record.
91  RecordArg(record_of_this_call, record_of_arg1);
92  return record_of_this_call;
93 }
94 void _FtWriteDatabus_fake(uint8_t byte)
95 {
100  RecordActualCall( mock, Record__FtWriteDatabus(byte) );
101 }
102 
103 /* =====[ Mock _FtDatabusPinDirection ]===== */
104 static RecordedCall * Record__FtDatabusPinDirection(uint8_t arg1)
105 { // Define **what is recorded** when fake is called.
106  char const *call_name = "_FtDatabusPinDirection";
107  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
108  RecordedArg *record_of_arg1 = RecordedArg_new(SetupRecord_uint8_t);
109  *((uint8_t *)record_of_arg1->pArg) = arg1;
110  // Store the arg records in the call record.
111  RecordArg(record_of_this_call, record_of_arg1);
112  return record_of_this_call;
113 }
114 void _FtDatabusPinDirection_fake(uint8_t pin_direction)
115 {
120  RecordActualCall( mock, Record__FtDatabusPinDirection(pin_direction) );
121 }
122 
123 // ---Ft API used internally by Usb---
124 
125 /* =====[ Mock FtSelectFT221X() ]===== */
126 static RecordedCall * Record_FtSelectFT221X(void)
127 { // Define **what is recorded** when fake is called.
128  char const *call_name = "FtSelectFT221X";
129  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
130  return record_of_this_call;
131 }
133 {
137  RecordActualCall(mock, Record_FtSelectFT221X());
138 }
139 
140 /* =====[ Mock FtBusTurnaround() ]===== */
141 static RecordedCall * Record_FtBusTurnaround(void)
142 { // Define **what is recorded** when fake is called.
143  char const *call_name = "FtBusTurnaround";
144  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
145  return record_of_this_call;
146 }
148 {
152  RecordActualCall(mock, Record_FtBusTurnaround());
153 }
154 
155 /* =====[ Mock FtIsOk() ]===== */
156 static RecordedCall * Record_FtIsOk(void)
157 { // Define **what is recorded** when fake is called.
158  char const *call_name = "FtIsOk";
159  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
160  return record_of_this_call;
161 }
162 bool FtIsOk_fake(void)
163 {
167  RecordActualCall(mock, Record_FtIsOk());
168  return false;
169 }
170 
171 /* =====[ Mock FtRead(pbyte) ]===== */
172 static RecordedCall * Record_FtRead(uint8_t * arg1)
173 { // Define **what is recorded** when fake is called.
174  char const *call_name = "FtRead";
175  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
176  RecordedArg *record_of_arg1 = RecordedArg_new(SetupRecord_p_uint8_t);
177  *((uint8_t **)record_of_arg1->pArg) = arg1;
178  // Store the arg records in the call record.
179  RecordArg(record_of_this_call, record_of_arg1);
180  return record_of_this_call;
181 }
182 void FtRead_fake(uint8_t * pbyte)
183 {
188  RecordActualCall( mock, Record_FtRead(pbyte) );
189 }
190 
191 /* =====[ Mock FtWrite(byte) ]===== */
192 static RecordedCall * Record_FtWrite(uint8_t arg1)
193 { // Define **what is recorded** when fake is called.
194  char const *call_name = "FtWrite";
195  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
196  RecordedArg *record_of_arg1 = RecordedArg_new(SetupRecord_uint8_t);
197  *((uint8_t *)record_of_arg1->pArg) = arg1;
198  // Store the arg records in the call record.
199  RecordArg(record_of_this_call, record_of_arg1);
200  return record_of_this_call;
201 }
202 void FtWrite_fake(uint8_t byte)
203 {
208  RecordActualCall(mock, Record_FtWrite(byte));
209 }
210 
211 /* =====[ Mock FtUnselectFT221X() ]===== */
212 static RecordedCall * Record_FtUnselectFT221X(void)
213 { // Define **what is recorded** when fake is called.
214  char const *call_name = "FtUnselectFT221X";
215  RecordedCall *record_of_this_call = RecordedCall_new(call_name);
216  return record_of_this_call;
217 }
219 {
223  RecordActualCall(mock, Record_FtUnselectFT221X());
224 }
225 
usb-bridge communicates over USB via FTDI USB Bridge IC FT221X
void _FtWriteDatabus_fake(uint8_t byte)
Definition: Usb_faked.c:94
void _FtDatabusPinDirection_fake(uint8_t pin_direction)
Definition: Usb_faked.c:114
void _FtReadDatabus_fake(uint8_t *pbyte)
Definition: Usb_faked.c:74
void FtRead_fake(uint8_t *pbyte)
Definition: Usb_faked.c:182
void FtBusTurnaround_fake(void)
Definition: Usb_faked.c:147
void FtSelectFT221X_fake(void)
Definition: Usb_faked.c:132
void _FtClockDatabus_fake(uint8_t direction)
Definition: Usb_faked.c:54
bool FtIsOk_fake(void)
Definition: Usb_faked.c:162
void FtWrite_fake(uint8_t byte)
Definition: Usb_faked.c:202
void FtUnselectFT221X_fake(void)
Definition: Usb_faked.c:218