Alex Elder | c68adb2 | 2014-10-01 21:54:14 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Greybus connections |
| 3 | * |
| 4 | * Copyright 2014 Google Inc. |
| 5 | * |
| 6 | * Released under the GPLv2 only. |
| 7 | */ |
| 8 | |
| 9 | #ifndef __CONNECTION_H |
| 10 | #define __CONNECTION_H |
| 11 | |
| 12 | #include <linux/list.h> |
| 13 | |
| 14 | #include "greybus.h" |
Alex Elder | c68adb2 | 2014-10-01 21:54:14 -0500 | [diff] [blame] | 15 | |
| 16 | struct gb_connection { |
Alex Elder | c68adb2 | 2014-10-01 21:54:14 -0500 | [diff] [blame] | 17 | struct greybus_host_device *hd; |
Alex Elder | cd34507 | 2014-10-02 12:30:05 -0500 | [diff] [blame] | 18 | struct gb_interface *interface; |
| 19 | u16 hd_cport_id; |
| 20 | u16 interface_cport_id; |
Alex Elder | c68adb2 | 2014-10-01 21:54:14 -0500 | [diff] [blame] | 21 | |
Alex Elder | cd34507 | 2014-10-02 12:30:05 -0500 | [diff] [blame] | 22 | struct list_head hd_links; |
| 23 | struct list_head interface_links; |
Alex Elder | ad1c449 | 2014-10-02 12:30:06 -0500 | [diff] [blame] | 24 | enum greybus_protocol protocol; |
Alex Elder | e88afa5 | 2014-10-01 21:54:15 -0500 | [diff] [blame] | 25 | |
| 26 | struct list_head operations; |
| 27 | atomic_t op_cycle; |
Alex Elder | 8a30672 | 2014-10-03 15:05:21 -0500 | [diff] [blame] | 28 | |
| 29 | void *private; |
Alex Elder | c68adb2 | 2014-10-01 21:54:14 -0500 | [diff] [blame] | 30 | }; |
| 31 | |
Alex Elder | cd34507 | 2014-10-02 12:30:05 -0500 | [diff] [blame] | 32 | struct gb_connection *gb_connection_create(struct gb_interface *interface, |
Alex Elder | ad1c449 | 2014-10-02 12:30:06 -0500 | [diff] [blame] | 33 | u16 cport_id, enum greybus_protocol protocol); |
Alex Elder | b05890d | 2014-10-02 12:30:01 -0500 | [diff] [blame] | 34 | void gb_connection_destroy(struct gb_connection *connection); |
Alex Elder | c68adb2 | 2014-10-01 21:54:14 -0500 | [diff] [blame] | 35 | |
Alex Elder | e88afa5 | 2014-10-01 21:54:15 -0500 | [diff] [blame] | 36 | u16 gb_connection_op_id(struct gb_connection *connection); |
| 37 | |
Alex Elder | eeeed42 | 2014-10-03 15:05:22 -0500 | [diff] [blame^] | 38 | __printf(2, 3) |
| 39 | void gb_connection_err(struct gb_connection *connection, const char *fmt, ...); |
| 40 | |
Alex Elder | c68adb2 | 2014-10-01 21:54:14 -0500 | [diff] [blame] | 41 | #endif /* __CONNECTION_H */ |