Blame view

drivers/ps3/vuart.h 2.84 KB
74e95d5de   Geoff Levand   [POWERPC] ps3: Ad...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  /*
   *  PS3 virtual uart
   *
   *  Copyright (C) 2006 Sony Computer Entertainment Inc.
   *  Copyright 2006 Sony Corp.
   *
   *  This program is free software; you can redistribute it and/or modify
   *  it under the terms of the GNU General Public License as published by
   *  the Free Software Foundation; version 2 of the License.
   *
   *  This program is distributed in the hope that it will be useful,
   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *  GNU General Public License for more details.
   *
   *  You should have received a copy of the GNU General Public License
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   */
  
  #if !defined(_PS3_VUART_H)
  #define _PS3_VUART_H
75c86e742   Geoff Levand   [POWERPC] PS3: Vu...
23
24
25
26
27
28
29
30
31
  #include <asm/ps3.h>
  
  struct ps3_vuart_stats {
  	unsigned long bytes_written;
  	unsigned long bytes_read;
  	unsigned long tx_interrupts;
  	unsigned long rx_interrupts;
  	unsigned long disconnect_interrupts;
  };
ea1547d31   Geoff Levand   [POWERPC] PS3: Vu...
32
33
34
  struct ps3_vuart_work {
  	struct work_struct work;
  	unsigned long trigger;
7626e78d2   Geoff Levand   [POWERPC] PS3: Vu...
35
  	struct ps3_system_bus_device *dev; /* to convert work to device */
75c86e742   Geoff Levand   [POWERPC] PS3: Vu...
36
  };
74e95d5de   Geoff Levand   [POWERPC] ps3: Ad...
37
38
39
40
41
  /**
   * struct ps3_vuart_port_driver - a driver for a device on a vuart port
   */
  
  struct ps3_vuart_port_driver {
7626e78d2   Geoff Levand   [POWERPC] PS3: Vu...
42
43
44
45
46
47
48
49
50
51
  	struct ps3_system_bus_driver core;
  	int (*probe)(struct ps3_system_bus_device *);
  	int (*remove)(struct ps3_system_bus_device *);
  	void (*shutdown)(struct ps3_system_bus_device *);
  	void (*work)(struct ps3_system_bus_device *);
  	/* int (*tx_event)(struct ps3_system_bus_device *dev); */
  	/* int (*rx_event)(struct ps3_system_bus_device *dev); */
  	/* int (*disconnect_event)(struct ps3_system_bus_device *dev); */
  	/* int (*suspend)(struct ps3_system_bus_device *, pm_message_t); */
  	/* int (*resume)(struct ps3_system_bus_device *); */
74e95d5de   Geoff Levand   [POWERPC] ps3: Ad...
52
  };
74e95d5de   Geoff Levand   [POWERPC] ps3: Ad...
53
54
  int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv);
  void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv);
97ec16759   Geoff Levand   [POWERPC] PS3: Mo...
55

7626e78d2   Geoff Levand   [POWERPC] PS3: Vu...
56
57
  static inline struct ps3_vuart_port_driver *
  	ps3_system_bus_dev_to_vuart_drv(struct ps3_system_bus_device *_dev)
74e95d5de   Geoff Levand   [POWERPC] ps3: Ad...
58
  {
7626e78d2   Geoff Levand   [POWERPC] PS3: Vu...
59
60
61
62
  	struct ps3_system_bus_driver *sbd =
  		ps3_system_bus_dev_to_system_bus_drv(_dev);
  	BUG_ON(!sbd);
  	return container_of(sbd, struct ps3_vuart_port_driver, core);
74e95d5de   Geoff Levand   [POWERPC] ps3: Ad...
63
  }
7626e78d2   Geoff Levand   [POWERPC] PS3: Vu...
64
  static inline struct ps3_system_bus_device *ps3_vuart_work_to_system_bus_dev(
ea1547d31   Geoff Levand   [POWERPC] PS3: Vu...
65
66
67
68
69
70
  	struct work_struct *_work)
  {
  	struct ps3_vuart_work *vw = container_of(_work, struct ps3_vuart_work,
  		work);
  	return vw->dev;
  }
7626e78d2   Geoff Levand   [POWERPC] PS3: Vu...
71
  int ps3_vuart_write(struct ps3_system_bus_device *dev, const void *buf,
ea1547d31   Geoff Levand   [POWERPC] PS3: Vu...
72
  	unsigned int bytes);
7626e78d2   Geoff Levand   [POWERPC] PS3: Vu...
73
  int ps3_vuart_read(struct ps3_system_bus_device *dev, void *buf,
ea1547d31   Geoff Levand   [POWERPC] PS3: Vu...
74
  	unsigned int bytes);
7626e78d2   Geoff Levand   [POWERPC] PS3: Vu...
75
76
77
  int ps3_vuart_read_async(struct ps3_system_bus_device *dev, unsigned int bytes);
  void ps3_vuart_cancel_async(struct ps3_system_bus_device *dev);
  void ps3_vuart_clear_rx_bytes(struct ps3_system_bus_device *dev,
ea1547d31   Geoff Levand   [POWERPC] PS3: Vu...
78
  	unsigned int bytes);
74e95d5de   Geoff Levand   [POWERPC] ps3: Ad...
79

74e95d5de   Geoff Levand   [POWERPC] ps3: Ad...
80
  #endif