![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-or-later */ 0002 /* 0003 * Copyright (c) 2003 Evgeniy Polyakov <zbr@ioremap.net> 0004 */ 0005 0006 #ifndef __W1_NETLINK_H 0007 #define __W1_NETLINK_H 0008 0009 #include <asm/types.h> 0010 #include <linux/connector.h> 0011 0012 #include "w1_internal.h" 0013 0014 /** 0015 * enum w1_cn_msg_flags - bitfield flags for struct cn_msg.flags 0016 * 0017 * @W1_CN_BUNDLE: Request bundling replies into fewer messagse. Be prepared 0018 * to handle multiple struct cn_msg, struct w1_netlink_msg, and 0019 * struct w1_netlink_cmd in one packet. 0020 */ 0021 enum w1_cn_msg_flags { 0022 W1_CN_BUNDLE = 1, 0023 }; 0024 0025 /** 0026 * enum w1_netlink_message_types - message type 0027 * 0028 * @W1_SLAVE_ADD: notification that a slave device was added 0029 * @W1_SLAVE_REMOVE: notification that a slave device was removed 0030 * @W1_MASTER_ADD: notification that a new bus master was added 0031 * @W1_MASTER_REMOVE: notification that a bus masterwas removed 0032 * @W1_MASTER_CMD: initiate operations on a specific master 0033 * @W1_SLAVE_CMD: sends reset, selects the slave, then does a read/write/touch 0034 * operation 0035 * @W1_LIST_MASTERS: used to determine the bus master identifiers 0036 */ 0037 enum w1_netlink_message_types { 0038 W1_SLAVE_ADD = 0, 0039 W1_SLAVE_REMOVE, 0040 W1_MASTER_ADD, 0041 W1_MASTER_REMOVE, 0042 W1_MASTER_CMD, 0043 W1_SLAVE_CMD, 0044 W1_LIST_MASTERS, 0045 }; 0046 0047 /** 0048 * struct w1_netlink_msg - holds w1 message type, id, and result 0049 * 0050 * @type: one of enum w1_netlink_message_types 0051 * @status: kernel feedback for success 0 or errno failure value 0052 * @len: length of data following w1_netlink_msg 0053 * @id: union holding bus master id (msg.id) and slave device id (id[8]). 0054 * @id.id: Slave ID (8 bytes) 0055 * @id.mst: bus master identification 0056 * @id.mst.id: bus master ID 0057 * @id.mst.res: bus master reserved 0058 * @data: start address of any following data 0059 * 0060 * The base message structure for w1 messages over netlink. 0061 * The netlink connector data sequence is, struct nlmsghdr, struct cn_msg, 0062 * then one or more struct w1_netlink_msg (each with optional data). 0063 */ 0064 struct w1_netlink_msg 0065 { 0066 __u8 type; 0067 __u8 status; 0068 __u16 len; 0069 union { 0070 __u8 id[8]; 0071 struct w1_mst { 0072 __u32 id; 0073 __u32 res; 0074 } mst; 0075 } id; 0076 __u8 data[]; 0077 }; 0078 0079 /** 0080 * enum w1_commands - commands available for master or slave operations 0081 * 0082 * @W1_CMD_READ: read len bytes 0083 * @W1_CMD_WRITE: write len bytes 0084 * @W1_CMD_SEARCH: initiate a standard search, returns only the slave 0085 * devices found during that search 0086 * @W1_CMD_ALARM_SEARCH: search for devices that are currently alarming 0087 * @W1_CMD_TOUCH: Touches a series of bytes. 0088 * @W1_CMD_RESET: sends a bus reset on the given master 0089 * @W1_CMD_SLAVE_ADD: adds a slave to the given master, 0090 * 8 byte slave id at data[0] 0091 * @W1_CMD_SLAVE_REMOVE: removes a slave to the given master, 0092 * 8 byte slave id at data[0] 0093 * @W1_CMD_LIST_SLAVES: list of slaves registered on this master 0094 * @W1_CMD_MAX: number of available commands 0095 */ 0096 enum w1_commands { 0097 W1_CMD_READ = 0, 0098 W1_CMD_WRITE, 0099 W1_CMD_SEARCH, 0100 W1_CMD_ALARM_SEARCH, 0101 W1_CMD_TOUCH, 0102 W1_CMD_RESET, 0103 W1_CMD_SLAVE_ADD, 0104 W1_CMD_SLAVE_REMOVE, 0105 W1_CMD_LIST_SLAVES, 0106 W1_CMD_MAX 0107 }; 0108 0109 /** 0110 * struct w1_netlink_cmd - holds the command and data 0111 * 0112 * @cmd: one of enum w1_commands 0113 * @res: reserved 0114 * @len: length of data following w1_netlink_cmd 0115 * @data: start address of any following data 0116 * 0117 * One or more struct w1_netlink_cmd is placed starting at w1_netlink_msg.data 0118 * each with optional data. 0119 */ 0120 struct w1_netlink_cmd 0121 { 0122 __u8 cmd; 0123 __u8 res; 0124 __u16 len; 0125 __u8 data[]; 0126 }; 0127 0128 #ifdef __KERNEL__ 0129 0130 void w1_netlink_send(struct w1_master *, struct w1_netlink_msg *); 0131 int w1_init_netlink(void); 0132 void w1_fini_netlink(void); 0133 0134 #endif /* __KERNEL__ */ 0135 #endif /* __W1_NETLINK_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |