Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Definitions for ADB (Apple Desktop Bus) support.
0004  */
0005 #ifndef __ADB_H
0006 #define __ADB_H
0007 
0008 #include <uapi/linux/adb.h>
0009 
0010 
0011 struct adb_request {
0012     unsigned char data[32];
0013     int nbytes;
0014     unsigned char reply[32];
0015     int reply_len;
0016     unsigned char reply_expected;
0017     unsigned char sent;
0018     unsigned char complete;
0019     void (*done)(struct adb_request *);
0020     void *arg;
0021     struct adb_request *next;
0022 };
0023 
0024 struct adb_ids {
0025     int nids;
0026     unsigned char id[16];
0027 };
0028 
0029 /* Structure which encapsulates a low-level ADB driver */
0030 
0031 struct adb_driver {
0032     char name[16];
0033     int (*probe)(void);
0034     int (*init)(void);
0035     int (*send_request)(struct adb_request *req, int sync);
0036     int (*autopoll)(int devs);
0037     void (*poll)(void);
0038     int (*reset_bus)(void);
0039 };
0040 
0041 /* Values for adb_request flags */
0042 #define ADBREQ_REPLY    1   /* expect reply */
0043 #define ADBREQ_SYNC 2   /* poll until done */
0044 #define ADBREQ_NOSEND   4   /* build the request, but don't send it */
0045 
0046 /* Messages sent thru the client_list notifier. You should NOT stop
0047    the operation, at least not with this version */
0048 enum adb_message {
0049     ADB_MSG_POWERDOWN,  /* Currently called before sleep only */
0050     ADB_MSG_PRE_RESET,  /* Called before resetting the bus */
0051     ADB_MSG_POST_RESET  /* Called after resetting the bus (re-do init & register) */
0052 };
0053 extern struct blocking_notifier_head adb_client_list;
0054 
0055 int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
0056         int flags, int nbytes, ...);
0057 int adb_register(int default_id,int handler_id,struct adb_ids *ids,
0058          void (*handler)(unsigned char *, int, int));
0059 int adb_unregister(int index);
0060 void adb_poll(void);
0061 void adb_input(unsigned char *, int, int);
0062 int adb_reset_bus(void);
0063 
0064 int adb_try_handler_change(int address, int new_id);
0065 int adb_get_infos(int address, int *original_address, int *handler_id);
0066 
0067 #endif /* __ADB_H */