4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #if !defined(_PS3_VUART_H)
24 struct ps3_vuart_stats {
25 unsigned long bytes_written;
26 unsigned long bytes_read;
27 unsigned long tx_interrupts;
28 unsigned long rx_interrupts;
29 unsigned long disconnect_interrupts;
33 * struct ps3_vuart_port_device - a device on a vuart port
36 struct ps3_vuart_port_device {
37 enum ps3_match_id match_id;
40 /* private driver variables */
41 unsigned int port_number;
42 unsigned long interrupt_mask;
45 struct list_head head;
48 unsigned long bytes_held;
50 struct list_head head;
52 struct ps3_vuart_stats stats;
56 * struct ps3_vuart_port_driver - a driver for a device on a vuart port
59 struct ps3_vuart_port_driver {
60 enum ps3_match_id match_id;
61 struct device_driver core;
62 int (*probe)(struct ps3_vuart_port_device *);
63 int (*remove)(struct ps3_vuart_port_device *);
64 int (*tx_event)(struct ps3_vuart_port_device *dev);
65 int (*rx_event)(struct ps3_vuart_port_device *dev);
66 int (*disconnect_event)(struct ps3_vuart_port_device *dev);
67 /* int (*suspend)(struct ps3_vuart_port_device *, pm_message_t); */
68 /* int (*resume)(struct ps3_vuart_port_device *); */
71 int ps3_vuart_port_device_register(struct ps3_vuart_port_device *dev);
72 int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv);
73 void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv);
74 int ps3_vuart_write(struct ps3_vuart_port_device *dev,
75 const void* buf, unsigned int bytes);
76 int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
78 static inline struct ps3_vuart_port_driver *to_ps3_vuart_port_driver(
79 struct device_driver *_drv)
81 return container_of(_drv, struct ps3_vuart_port_driver, core);
83 static inline struct ps3_vuart_port_device *to_ps3_vuart_port_device(
86 return container_of(_dev, struct ps3_vuart_port_device, core);
89 int ps3_vuart_write(struct ps3_vuart_port_device *dev, const void* buf,
91 int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,