1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#if !defined(_PS3_VUART_H)
22#define _PS3_VUART_H
23
24#include <asm/ps3.h>
25
26struct ps3_vuart_stats {
27 unsigned long bytes_written;
28 unsigned long bytes_read;
29 unsigned long tx_interrupts;
30 unsigned long rx_interrupts;
31 unsigned long disconnect_interrupts;
32};
33
34struct ps3_vuart_work {
35 struct work_struct work;
36 unsigned long trigger;
37 struct ps3_system_bus_device *dev;
38};
39
40
41
42
43
44struct ps3_vuart_port_driver {
45 struct ps3_system_bus_driver core;
46 int (*probe)(struct ps3_system_bus_device *);
47 int (*remove)(struct ps3_system_bus_device *);
48 void (*shutdown)(struct ps3_system_bus_device *);
49 void (*work)(struct ps3_system_bus_device *);
50
51
52
53
54
55};
56
57int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv);
58void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv);
59
60static inline struct ps3_vuart_port_driver *
61 ps3_system_bus_dev_to_vuart_drv(struct ps3_system_bus_device *_dev)
62{
63 struct ps3_system_bus_driver *sbd =
64 ps3_system_bus_dev_to_system_bus_drv(_dev);
65 BUG_ON(!sbd);
66 return container_of(sbd, struct ps3_vuart_port_driver, core);
67}
68static inline struct ps3_system_bus_device *ps3_vuart_work_to_system_bus_dev(
69 struct work_struct *_work)
70{
71 struct ps3_vuart_work *vw = container_of(_work, struct ps3_vuart_work,
72 work);
73 return vw->dev;
74}
75
76int ps3_vuart_write(struct ps3_system_bus_device *dev, const void *buf,
77 unsigned int bytes);
78int ps3_vuart_read(struct ps3_system_bus_device *dev, void *buf,
79 unsigned int bytes);
80int ps3_vuart_read_async(struct ps3_system_bus_device *dev, unsigned int bytes);
81void ps3_vuart_cancel_async(struct ps3_system_bus_device *dev);
82void ps3_vuart_clear_rx_bytes(struct ps3_system_bus_device *dev,
83 unsigned int bytes);
84
85struct vuart_triggers {
86 unsigned long rx;
87 unsigned long tx;
88};
89
90int ps3_vuart_get_triggers(struct ps3_system_bus_device *dev,
91 struct vuart_triggers *trig);
92int ps3_vuart_set_triggers(struct ps3_system_bus_device *dev, unsigned int tx,
93 unsigned int rx);
94int ps3_vuart_enable_interrupt_tx(struct ps3_system_bus_device *dev);
95int ps3_vuart_disable_interrupt_tx(struct ps3_system_bus_device *dev);
96int ps3_vuart_enable_interrupt_rx(struct ps3_system_bus_device *dev);
97int ps3_vuart_disable_interrupt_rx(struct ps3_system_bus_device *dev);
98int ps3_vuart_enable_interrupt_disconnect(struct ps3_system_bus_device *dev);
99int ps3_vuart_disable_interrupt_disconnect(struct ps3_system_bus_device *dev);
100
101#endif
102