Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
b9b2a462
Commit
b9b2a462
authored
Aug 31, 2014
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
greybus: split svc msg out into separate header file
parent
2ecd536d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
163 additions
and
135 deletions
+163
-135
drivers/staging/greybus/ap.c
drivers/staging/greybus/ap.c
+1
-135
drivers/staging/greybus/svc_msg.h
drivers/staging/greybus/svc_msg.h
+162
-0
No files found.
drivers/staging/greybus/ap.c
View file @
b9b2a462
...
...
@@ -16,143 +16,9 @@
#include <linux/uaccess.h>
#include <linux/kthread.h>
#include <linux/device.h>
#include "svc_msg.h"
#include "greybus.h"
/*
* AP <-> SVC message structure format:
*
*
*
*/
enum
svc_function_type
{
SVC_FUNCTION_HANDSHAKE
=
0x00
,
SVC_FUNCTION_UNIPRO_NETWORK_MANAGEMENT
=
0x01
,
SVC_FUNCTION_HOTPLUG
=
0x02
,
SVC_FUNCTION_DDB
=
0x03
,
SVC_FUNCTION_POWER
=
0x04
,
SVC_FUNCTION_EPM
=
0x05
,
SVC_FUNCTION_SUSPEND
=
0x06
,
};
struct
svc_msg_header
{
u8
function
;
u8
type
;
/* enum svc_function_type */
u8
version_major
;
u8
version_minor
;
u16
payload_length
;
};
enum
svc_function_handshake_type
{
SVC_HANDSHAKE_SVC_HELLO
=
0x00
,
SVC_HANDSHAKE_AP_HELLO
=
0x01
,
SVC_HANDSHAKE_MODULE_HELLO
=
0x02
,
};
struct
svc_function_handshake
{
u8
handshake_type
;
/* enum svc_function_handshake_type */
};
struct
svc_function_unipro_set_route
{
u8
source_device_id
;
u8
source_cport_id
;
u8
destination_device_id
;
u8
destination_cport_id
;
};
struct
svc_function_unipro_link_up
{
u8
device_id
;
};
enum
svc_function_management_event
{
SVC_MANAGEMENT_SET_ROUTE
=
0x00
,
SVC_MANAGEMENT_LINK_UP
=
0x01
,
};
struct
svc_function_unipro_management
{
u8
management_packet_type
;
/* enum svc_function_management_event */
union
{
struct
svc_function_unipro_set_route
set_route
;
struct
svc_function_unipro_link_up
link_up
;
};
};
enum
svc_function_hotplug_event
{
SVC_HOTPLUG_EVENT
=
0x00
,
SVC_HOTUNPLUG_EVENT
=
0x01
,
};
struct
svc_function_hotplug
{
u8
hotplug_event
;
/* enum svc_function_hotplug_event */
u8
device_id
;
};
enum
svc_function_ddb_type
{
SVC_DDB_GET
=
0x00
,
SVC_DDB_RESPONSE
=
0x01
,
};
struct
svc_function_ddb_get
{
u8
device_id
;
u8
message_id
;
};
struct
svc_function_ddb_response
{
u8
device_id
;
u8
message_id
;
u16
descriptor_length
;
u8
ddb
[
0
];
};
struct
svc_function_ddb
{
u8
ddb_type
;
/* enum svc_function_ddb_type */
union
{
struct
svc_function_ddb_get
ddb_get
;
struct
svc_function_ddb_response
ddb_response
;
};
};
enum
svc_function_power_type
{
SVC_POWER_BATTERY_STATUS
=
0x00
,
SVC_POWER_BATTERY_STATUS_REQUEST
=
0x01
,
};
enum
svc_function_battery_status
{
SVC_BATTERY_UNKNOWN
=
0x00
,
SVC_BATTERY_CHARGING
=
0x01
,
SVC_BATTERY_DISCHARGING
=
0x02
,
SVC_BATTERY_NOT_CHARGING
=
0x03
,
SVC_BATTERY_FULL
=
0x04
,
};
struct
svc_function_power_battery_status
{
u16
charge_full
;
u16
charge_now
;
u8
status
;
/* enum svc_function_battery_status */
};
struct
svc_function_power_battery_status_request
{
};
struct
svc_function_power
{
u8
power_type
;
/* enum svc_function_power_type */
union
{
struct
svc_function_power_battery_status
status
;
struct
svc_function_power_battery_status_request
request
;
};
};
struct
svc_msg
{
struct
svc_msg_header
header
;
union
{
struct
svc_function_handshake
handshake
;
struct
svc_function_unipro_management
management
;
struct
svc_function_hotplug
hotplug
;
struct
svc_function_ddb
ddb
;
u8
data
[
0
];
};
};
struct
ap_msg
{
u8
*
data
;
...
...
drivers/staging/greybus/svc_msg.h
0 → 100644
View file @
b9b2a462
/*
* Greybus AP <-> SVC message structure format.
*
* Defined in the "Greybus Application Protocol" document.
* See that document for any details on these values and structures.
*
* Copyright 2014 Google Inc.
*/
enum
svc_function_type
{
SVC_FUNCTION_HANDSHAKE
=
0x00
,
SVC_FUNCTION_UNIPRO_NETWORK_MANAGEMENT
=
0x01
,
SVC_FUNCTION_HOTPLUG
=
0x02
,
SVC_FUNCTION_DDB
=
0x03
,
SVC_FUNCTION_POWER
=
0x04
,
SVC_FUNCTION_EPM
=
0x05
,
SVC_FUNCTION_SUSPEND
=
0x06
,
};
struct
svc_msg_header
{
u8
function
;
u8
type
;
/* enum svc_function_type */
u8
version_major
;
u8
version_minor
;
u16
payload_length
;
};
enum
svc_function_handshake_type
{
SVC_HANDSHAKE_SVC_HELLO
=
0x00
,
SVC_HANDSHAKE_AP_HELLO
=
0x01
,
SVC_HANDSHAKE_MODULE_HELLO
=
0x02
,
};
struct
svc_function_handshake
{
u8
handshake_type
;
/* enum svc_function_handshake_type */
};
struct
svc_function_unipro_set_route
{
u8
source_device_id
;
u8
source_cport_id
;
u8
destination_device_id
;
u8
destination_cport_id
;
};
struct
svc_function_unipro_link_up
{
u8
device_id
;
};
enum
svc_function_management_event
{
SVC_MANAGEMENT_SET_ROUTE
=
0x00
,
SVC_MANAGEMENT_LINK_UP
=
0x01
,
};
struct
svc_function_unipro_management
{
u8
management_packet_type
;
/* enum svc_function_management_event */
union
{
struct
svc_function_unipro_set_route
set_route
;
struct
svc_function_unipro_link_up
link_up
;
};
};
enum
svc_function_hotplug_event
{
SVC_HOTPLUG_EVENT
=
0x00
,
SVC_HOTUNPLUG_EVENT
=
0x01
,
};
struct
svc_function_hotplug
{
u8
hotplug_event
;
/* enum svc_function_hotplug_event */
u8
device_id
;
};
enum
svc_function_ddb_type
{
SVC_DDB_GET
=
0x00
,
SVC_DDB_RESPONSE
=
0x01
,
};
struct
svc_function_ddb_get
{
u8
device_id
;
u8
message_id
;
};
struct
svc_function_ddb_response
{
u8
device_id
;
u8
message_id
;
u16
descriptor_length
;
u8
ddb
[
0
];
};
struct
svc_function_ddb
{
u8
ddb_type
;
/* enum svc_function_ddb_type */
union
{
struct
svc_function_ddb_get
ddb_get
;
struct
svc_function_ddb_response
ddb_response
;
};
};
enum
svc_function_power_type
{
SVC_POWER_BATTERY_STATUS
=
0x00
,
SVC_POWER_BATTERY_STATUS_REQUEST
=
0x01
,
};
enum
svc_function_battery_status
{
SVC_BATTERY_UNKNOWN
=
0x00
,
SVC_BATTERY_CHARGING
=
0x01
,
SVC_BATTERY_DISCHARGING
=
0x02
,
SVC_BATTERY_NOT_CHARGING
=
0x03
,
SVC_BATTERY_FULL
=
0x04
,
};
struct
svc_function_power_battery_status
{
u16
charge_full
;
u16
charge_now
;
u8
status
;
/* enum svc_function_battery_status */
};
struct
svc_function_power_battery_status_request
{
u8
epm_command_type
;
/* enum svc_function_epm_command_type */
u8
device_id
;
};
struct
svc_function_power
{
u8
power_type
;
/* enum svc_function_power_type */
union
{
struct
svc_function_power_battery_status
status
;
struct
svc_function_power_battery_status_request
request
;
};
};
enum
svc_function_epm_command_type
{
SVC_EPM_ENABLE
=
0x00
,
SVC_EPM_DISABLE
=
0x01
,
};
struct
svc_function_epm
{
u8
epm_command_type
;
/* enum svc_function_epm_command_type */
u8
device_id
;
};
enum
svc_function_suspend_command_type
{
SVC_SUSPEND_FIXME_1
=
0x00
,
// FIXME
SVC_SUSPEND_FIXME_2
=
0x01
,
};
struct
svc_function_suspend
{
u8
suspend_command_type
;
/* enum function_suspend_command_type */
u8
device_id
;
};
struct
svc_msg
{
struct
svc_msg_header
header
;
union
{
struct
svc_function_handshake
handshake
;
struct
svc_function_unipro_management
management
;
struct
svc_function_hotplug
hotplug
;
struct
svc_function_ddb
ddb
;
struct
svc_function_power
power
;
struct
svc_function_epm
epm
;
struct
svc_function_suspend
suspend
;
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment