sync hh.org
[hh.org.git] / include / linux / l3 / l3.h
blob277bb60c29af8dea94707bf4727a7297ece5d51c
1 /*
2 * linux/include/linux/l3/l3.h
4 * Copyright (C) 2001 Russell King, All Rights Reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License.
10 * Derived from i2c.h by Simon G. Vogl
12 #ifndef L3_H
13 #define L3_H
15 struct l3_msg {
16 unsigned char addr; /* slave address */
17 unsigned char flags;
18 #define L3_M_RD 0x01
19 #define L3_M_NOADDR 0x02
20 unsigned short len; /* msg length */
21 unsigned char *buf; /* pointer to msg data */
24 #ifdef __KERNEL__
26 #include <linux/types.h>
27 #include <linux/list.h>
29 struct l3_adapter;
31 struct l3_algorithm {
32 /* textual description */
33 char name[32];
35 /* perform bus transactions */
36 int (*xfer)(struct l3_adapter *, struct l3_msg msgs[], int num);
39 struct semaphore;
42 * l3_adapter is the structure used to identify a physical L3 bus along
43 * with the access algorithms necessary to access it.
45 struct l3_adapter {
47 * This name is used to uniquely identify the adapter.
48 * It should be the same as the module name.
50 char name[32];
53 * the algorithm to access the bus
55 struct l3_algorithm *algo;
58 * Algorithm specific data
60 void *algo_data;
63 * This may be NULL, or should point to the module struct
65 struct module *owner;
68 * private data for the adapter
70 void *data;
73 * Our lock. Unlike the i2c layer, we allow this to be used for
74 * other stuff, like the i2c layer lock. Some people implement
75 * i2c stuff using the same signals as the l3 bus.
77 struct semaphore *lock;
80 * List of all adapters.
82 struct list_head adapters;
85 extern int l3_add_adapter(struct l3_adapter *);
86 extern int l3_del_adapter(struct l3_adapter *);
87 extern void l3_put_adapter(struct l3_adapter *);
88 extern struct l3_adapter *l3_get_adapter(const char *name);
90 extern int l3_write(struct l3_adapter *, int, const char *, int);
91 extern int l3_read(struct l3_adapter *, int, char *, int);
93 #endif
95 #endif /* L3_H */