Lines Matching refs:req
91 static int macii_send_request(struct adb_request *req, int sync);
92 static int macii_write(struct adb_request *req);
116 static unsigned char *reply_ptr; /* next byte in reply_buf or req->reply */
117 static bool reading_reply; /* store reply in reply_buf else req->reply */
118 static int data_index; /* index of the next byte to send from req->data */
119 static int reply_len; /* number of bytes received in reply_buf or req->reply */
186 static struct adb_request req;
221 adb_request(&req, NULL, ADBREQ_NOSEND, 1, poll_command);
223 req.sent = 0;
224 req.complete = 0;
225 req.reply_len = 0;
226 req.next = current_req;
229 current_req = &req;
231 current_req = &req;
232 last_req = &req;
237 static int macii_send_request(struct adb_request *req, int sync)
241 err = macii_write(req);
246 while (!req->complete)
253 static int macii_write(struct adb_request *req)
257 if (req->nbytes < 2 || req->data[0] != ADB_PACKET || req->nbytes > 15) {
258 req->complete = 1;
262 req->next = NULL;
263 req->sent = 0;
264 req->complete = 0;
265 req->reply_len = 0;
270 last_req->next = req;
271 last_req = req;
273 current_req = req;
274 last_req = req;
314 struct adb_request req;
317 adb_request(&req, NULL, ADBREQ_NOSEND, 1, ADB_BUSRESET);
318 macii_send_request(&req, 1);
329 struct adb_request *req;
331 req = current_req;
335 * And req->nbytes is the number of bytes of real data plus one.
341 via[SR] = req->data[1];
373 struct adb_request *req;
420 req = current_req;
428 last_cmd = req->data[1];
451 } else if (data_index >= req->nbytes) {
452 req->sent = 1;
454 if (req->reply_expected) {
458 reply_ptr = req->reply;
459 *reply_ptr = req->data[1];
464 } else if ((req->data[1] & OP_MASK) == TALK) {
469 *reply_ptr = req->data[1];
475 req->complete = 1;
476 current_req = req->next;
477 if (req->done)
478 (*req->done)(req);
482 req->complete = 1;
483 current_req = req->next;
484 if (req->done)
485 (*req->done)(req);
489 via[SR] = req->data[data_index++];
518 struct adb_request *req = current_req;
520 req->reply_len = reply_len;
522 req->complete = 1;
523 current_req = req->next;
524 if (req->done)
525 (*req->done)(req);