coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
console.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/usb.h>
4 #include "ehci_debug.h"
5 
6 static void usbdebug_tx_byte(struct dbgp_pipe *pipe, unsigned char data)
7 {
8  if (!dbgp_try_get(pipe))
9  return;
10  pipe->buf[pipe->bufidx++] = data;
11  if (pipe->bufidx >= 8) {
12  dbgp_bulk_write_x(pipe, pipe->buf, pipe->bufidx);
13  pipe->bufidx = 0;
14  }
15  dbgp_put(pipe);
16 }
17 
18 static void usbdebug_tx_flush(struct dbgp_pipe *pipe)
19 {
20  if (!dbgp_try_get(pipe))
21  return;
22  if (pipe->bufidx > 0) {
23  dbgp_bulk_write_x(pipe, pipe->buf, pipe->bufidx);
24  pipe->bufidx = 0;
25  }
26  dbgp_put(pipe);
27 }
28 
29 static unsigned char usbdebug_rx_byte(struct dbgp_pipe *pipe)
30 {
31  unsigned char data = 0xff;
32  if (!dbgp_try_get(pipe))
33  return 0xff;
34  while (pipe->bufidx >= pipe->buflen) {
35  pipe->buflen = 0;
36  pipe->bufidx = 0;
37  int count = dbgp_bulk_read_x(pipe, pipe->buf, 8);
38  if (count>0)
39  pipe->buflen = count;
40  }
41  data = pipe->buf[pipe->bufidx++];
42  dbgp_put(pipe);
43  return data;
44 }
45 
46 void usb_tx_byte(int idx, unsigned char data)
47 {
49 }
50 
51 void usb_tx_flush(int idx)
52 {
54 }
55 
56 unsigned char usb_rx_byte(int idx)
57 {
59 }
60 
61 int usb_can_rx_byte(int idx)
62 {
64 }
static unsigned char usbdebug_rx_byte(struct dbgp_pipe *pipe)
Definition: console.c:29
void usb_tx_byte(int idx, unsigned char data)
Definition: console.c:46
int usb_can_rx_byte(int idx)
Definition: console.c:61
unsigned char usb_rx_byte(int idx)
Definition: console.c:56
static void usbdebug_tx_flush(struct dbgp_pipe *pipe)
Definition: console.c:18
static void usbdebug_tx_byte(struct dbgp_pipe *pipe, unsigned char data)
Definition: console.c:6
void usb_tx_flush(int idx)
Definition: console.c:51
void dbgp_put(struct dbgp_pipe *pipe)
Definition: ehci_debug.c:625
struct dbgp_pipe * dbgp_console_output(void)
Definition: ehci_debug.c:719
struct dbgp_pipe * dbgp_console_input(void)
Definition: ehci_debug.c:724
int dbgp_bulk_read_x(struct dbgp_pipe *pipe, void *data, int size)
Definition: ehci_debug.c:285
int dbgp_ep_is_active(struct dbgp_pipe *pipe)
Definition: ehci_debug.c:714
int dbgp_try_get(struct dbgp_pipe *pipe)
Definition: ehci_debug.c:615
int dbgp_bulk_write_x(struct dbgp_pipe *pipe, const char *bytes, int size)
Definition: ehci_debug.c:249
pipe
Definition: i915.h:38
#define count