Linux Audio

Check our new training course

Loading...
v3.15
 
 1/*
 2 * Definitions for ADB (Apple Desktop Bus) support.
 3 */
 4#ifndef __ADB_H
 5#define __ADB_H
 6
 7#include <uapi/linux/adb.h>
 8
 9
10struct adb_request {
11	unsigned char data[32];
12	int nbytes;
13	unsigned char reply[32];
14	int reply_len;
15	unsigned char reply_expected;
16	unsigned char sent;
17	unsigned char complete;
18	void (*done)(struct adb_request *);
19	void *arg;
20	struct adb_request *next;
21};
22
23struct adb_ids {
24	int nids;
25	unsigned char id[16];
26};
27
28/* Structure which encapsulates a low-level ADB driver */
29
30struct adb_driver {
31	char name[16];
32	int (*probe)(void);
33	int (*init)(void);
34	int (*send_request)(struct adb_request *req, int sync);
35	int (*autopoll)(int devs);
36	void (*poll)(void);
37	int (*reset_bus)(void);
38};
39
40/* Values for adb_request flags */
41#define ADBREQ_REPLY	1	/* expect reply */
42#define ADBREQ_SYNC	2	/* poll until done */
43#define ADBREQ_NOSEND	4	/* build the request, but don't send it */
44
45/* Messages sent thru the client_list notifier. You should NOT stop
46   the operation, at least not with this version */
47enum adb_message {
48    ADB_MSG_POWERDOWN,	/* Currently called before sleep only */
49    ADB_MSG_PRE_RESET,	/* Called before resetting the bus */
50    ADB_MSG_POST_RESET	/* Called after resetting the bus (re-do init & register) */
51};
52extern struct blocking_notifier_head adb_client_list;
53
54int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
55		int flags, int nbytes, ...);
56int adb_register(int default_id,int handler_id,struct adb_ids *ids,
57		 void (*handler)(unsigned char *, int, int));
58int adb_unregister(int index);
59void adb_poll(void);
60void adb_input(unsigned char *, int, int);
61int adb_reset_bus(void);
62
63int adb_try_handler_change(int address, int new_id);
64int adb_get_infos(int address, int *original_address, int *handler_id);
65
66#endif /* __ADB_H */
v4.17
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * Definitions for ADB (Apple Desktop Bus) support.
 4 */
 5#ifndef __ADB_H
 6#define __ADB_H
 7
 8#include <uapi/linux/adb.h>
 9
10
11struct adb_request {
12	unsigned char data[32];
13	int nbytes;
14	unsigned char reply[32];
15	int reply_len;
16	unsigned char reply_expected;
17	unsigned char sent;
18	unsigned char complete;
19	void (*done)(struct adb_request *);
20	void *arg;
21	struct adb_request *next;
22};
23
24struct adb_ids {
25	int nids;
26	unsigned char id[16];
27};
28
29/* Structure which encapsulates a low-level ADB driver */
30
31struct adb_driver {
32	char name[16];
33	int (*probe)(void);
34	int (*init)(void);
35	int (*send_request)(struct adb_request *req, int sync);
36	int (*autopoll)(int devs);
37	void (*poll)(void);
38	int (*reset_bus)(void);
39};
40
41/* Values for adb_request flags */
42#define ADBREQ_REPLY	1	/* expect reply */
43#define ADBREQ_SYNC	2	/* poll until done */
44#define ADBREQ_NOSEND	4	/* build the request, but don't send it */
45
46/* Messages sent thru the client_list notifier. You should NOT stop
47   the operation, at least not with this version */
48enum adb_message {
49    ADB_MSG_POWERDOWN,	/* Currently called before sleep only */
50    ADB_MSG_PRE_RESET,	/* Called before resetting the bus */
51    ADB_MSG_POST_RESET	/* Called after resetting the bus (re-do init & register) */
52};
53extern struct blocking_notifier_head adb_client_list;
54
55int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
56		int flags, int nbytes, ...);
57int adb_register(int default_id,int handler_id,struct adb_ids *ids,
58		 void (*handler)(unsigned char *, int, int));
59int adb_unregister(int index);
60void adb_poll(void);
61void adb_input(unsigned char *, int, int);
62int adb_reset_bus(void);
63
64int adb_try_handler_change(int address, int new_id);
65int adb_get_infos(int address, int *original_address, int *handler_id);
66
67#endif /* __ADB_H */