vuart.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * PS3 virtual uart
  3. *
  4. * Copyright (C) 2006 Sony Computer Entertainment Inc.
  5. * Copyright 2006 Sony Corp.
  6. *
  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.
  10. *
  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.
  15. *
  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
  19. */
  20. #if !defined(_PS3_VUART_H)
  21. #define _PS3_VUART_H
  22. /**
  23. * struct ps3_vuart_port_driver - a driver for a device on a vuart port
  24. */
  25. struct ps3_vuart_port_driver {
  26. enum ps3_match_id match_id;
  27. struct device_driver core;
  28. int (*probe)(struct ps3_vuart_port_device *);
  29. int (*remove)(struct ps3_vuart_port_device *);
  30. int (*tx_event)(struct ps3_vuart_port_device *dev);
  31. int (*rx_event)(struct ps3_vuart_port_device *dev);
  32. int (*disconnect_event)(struct ps3_vuart_port_device *dev);
  33. /* int (*suspend)(struct ps3_vuart_port_device *, pm_message_t); */
  34. /* int (*resume)(struct ps3_vuart_port_device *); */
  35. };
  36. int ps3_vuart_port_driver_register(struct ps3_vuart_port_driver *drv);
  37. void ps3_vuart_port_driver_unregister(struct ps3_vuart_port_driver *drv);
  38. int ps3_vuart_write(struct ps3_vuart_port_device *dev,
  39. const void* buf, unsigned int bytes);
  40. int ps3_vuart_read(struct ps3_vuart_port_device *dev, void* buf,
  41. unsigned int bytes);
  42. static inline struct ps3_vuart_port_driver *to_ps3_vuart_port_driver(
  43. struct device_driver *_drv)
  44. {
  45. return container_of(_drv, struct ps3_vuart_port_driver, core);
  46. }
  47. static inline struct ps3_vuart_port_device *to_ps3_vuart_port_device(
  48. struct device *_dev)
  49. {
  50. return container_of(_dev, struct ps3_vuart_port_device, core);
  51. }
  52. #endif