Blame view
drivers/ieee1394/ieee1394_core.h
5.22 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 |
#ifndef _IEEE1394_CORE_H #define _IEEE1394_CORE_H |
de4394f13 [PATCH] ieee1394:... |
3 4 5 |
#include <linux/device.h> #include <linux/fs.h> #include <linux/list.h> |
de4394f13 [PATCH] ieee1394:... |
6 |
#include <linux/types.h> |
9fd5746fd fs: Remove i_cind... |
7 |
#include <linux/cdev.h> |
1da177e4c Linux-2.6.12-rc2 |
8 |
#include <asm/atomic.h> |
1da177e4c Linux-2.6.12-rc2 |
9 |
|
de4394f13 [PATCH] ieee1394:... |
10 11 |
#include "hosts.h" #include "ieee1394_types.h" |
1da177e4c Linux-2.6.12-rc2 |
12 13 |
struct hpsb_packet { |
741854e4f ieee1394: whitesp... |
14 |
/* This struct is basically read-only for hosts with the exception of |
7542e0e69 ieee1394: remove ... |
15 |
* the data buffer contents and driver_list. */ |
1da177e4c Linux-2.6.12-rc2 |
16 17 18 19 20 21 22 23 |
/* This can be used for host driver internal linking. * * NOTE: This must be left in init state when the driver is done * with it (e.g. by using list_del_init()), since the core does * some sanity checks to make sure the packet is not on a * driver_list when free'ing it. */ struct list_head driver_list; |
741854e4f ieee1394: whitesp... |
24 |
nodeid_t node_id; |
1da177e4c Linux-2.6.12-rc2 |
25 |
|
53c96b417 ieee1394: remove ... |
26 27 |
/* hpsb_raw = send as-is, do not CRC (but still byte-swap it) */ enum { hpsb_async, hpsb_raw } __attribute__((packed)) type; |
1da177e4c Linux-2.6.12-rc2 |
28 |
|
741854e4f ieee1394: whitesp... |
29 30 31 32 33 34 35 36 |
/* Okay, this is core internal and a no care for hosts. * queued = queued for sending * pending = sent, waiting for response * complete = processing completed, successful or not */ enum { hpsb_unused, hpsb_queued, hpsb_pending, hpsb_complete } __attribute__((packed)) state; |
1da177e4c Linux-2.6.12-rc2 |
37 |
|
6552731a0 ieee1394: add com... |
38 |
/* These are core-internal. */ |
741854e4f ieee1394: whitesp... |
39 |
signed char tlabel; |
07bbeaf12 ieee1394: fix bro... |
40 41 |
signed char ack_code; unsigned char tcode; |
1da177e4c Linux-2.6.12-rc2 |
42 |
|
741854e4f ieee1394: whitesp... |
43 44 |
unsigned expect_response:1; unsigned no_waiter:1; |
1da177e4c Linux-2.6.12-rc2 |
45 |
|
741854e4f ieee1394: whitesp... |
46 47 |
/* Speed to transmit with: 0 = 100Mbps, 1 = 200Mbps, 2 = 400Mbps */ unsigned speed_code:2; |
1da177e4c Linux-2.6.12-rc2 |
48 |
|
741854e4f ieee1394: whitesp... |
49 50 |
struct hpsb_host *host; unsigned int generation; |
1da177e4c Linux-2.6.12-rc2 |
51 52 |
atomic_t refcnt; |
7542e0e69 ieee1394: remove ... |
53 |
struct list_head queue; |
1da177e4c Linux-2.6.12-rc2 |
54 55 56 57 58 |
/* Function (and possible data to pass to it) to call when this * packet is completed. */ void (*complete_routine)(void *); void *complete_data; |
741854e4f ieee1394: whitesp... |
59 60 |
/* Store jiffies for implementing bus timeouts. */ unsigned long sendtime; |
1da177e4c Linux-2.6.12-rc2 |
61 |
|
6552731a0 ieee1394: add com... |
62 |
/* Core-internal. */ |
7542e0e69 ieee1394: remove ... |
63 |
size_t allocated_data_size; /* as allocated */ |
6552731a0 ieee1394: add com... |
64 65 |
/* Sizes are in bytes. To be set by caller of hpsb_alloc_packet. */ |
7542e0e69 ieee1394: remove ... |
66 67 |
size_t data_size; /* as filled in */ size_t header_size; /* as filled in, not counting the CRC */ |
6552731a0 ieee1394: add com... |
68 69 70 |
/* Buffers */ quadlet_t *data; /* can be DMA-mapped */ |
7542e0e69 ieee1394: remove ... |
71 72 |
quadlet_t header[5]; quadlet_t embedded_data[0]; /* keep as last member */ |
1da177e4c Linux-2.6.12-rc2 |
73 |
}; |
1da177e4c Linux-2.6.12-rc2 |
74 |
void hpsb_set_packet_complete_task(struct hpsb_packet *packet, |
e1d118f16 [PATCH] ieee1394:... |
75 |
void (*routine)(void *), void *data); |
1da177e4c Linux-2.6.12-rc2 |
76 77 78 79 |
static inline struct hpsb_packet *driver_packet(struct list_head *l) { return list_entry(l, struct hpsb_packet, driver_list); } |
1da177e4c Linux-2.6.12-rc2 |
80 |
void abort_timedouts(unsigned long __opaque); |
1da177e4c Linux-2.6.12-rc2 |
81 82 |
struct hpsb_packet *hpsb_alloc_packet(size_t data_size); void hpsb_free_packet(struct hpsb_packet *packet); |
afd6546d8 ieee1394: move so... |
83 84 |
/** * get_hpsb_generation - generation counter for the complete 1394 subsystem |
1da177e4c Linux-2.6.12-rc2 |
85 |
* |
afd6546d8 ieee1394: move so... |
86 87 |
* Generation gets incremented on every change in the subsystem (notably on bus * resets). Use the functions, not the variable. |
1da177e4c Linux-2.6.12-rc2 |
88 89 90 |
*/ static inline unsigned int get_hpsb_generation(struct hpsb_host *host) { |
741854e4f ieee1394: whitesp... |
91 |
return atomic_read(&host->generation); |
1da177e4c Linux-2.6.12-rc2 |
92 |
} |
1da177e4c Linux-2.6.12-rc2 |
93 |
int hpsb_send_phy_config(struct hpsb_host *host, int rootid, int gapcnt); |
1da177e4c Linux-2.6.12-rc2 |
94 |
int hpsb_send_packet(struct hpsb_packet *packet); |
1da177e4c Linux-2.6.12-rc2 |
95 |
int hpsb_send_packet_and_wait(struct hpsb_packet *packet); |
1da177e4c Linux-2.6.12-rc2 |
96 |
int hpsb_reset_bus(struct hpsb_host *host, int type); |
3dc5ea9b3 ieee1394: cycle t... |
97 98 |
int hpsb_read_cycle_timer(struct hpsb_host *host, u32 *cycle_timer, u64 *local_time); |
1da177e4c Linux-2.6.12-rc2 |
99 |
int hpsb_bus_reset(struct hpsb_host *host); |
1da177e4c Linux-2.6.12-rc2 |
100 |
void hpsb_selfid_received(struct hpsb_host *host, quadlet_t sid); |
1da177e4c Linux-2.6.12-rc2 |
101 |
void hpsb_selfid_complete(struct hpsb_host *host, int phyid, int isroot); |
1da177e4c Linux-2.6.12-rc2 |
102 |
void hpsb_packet_sent(struct hpsb_host *host, struct hpsb_packet *packet, |
741854e4f ieee1394: whitesp... |
103 |
int ackcode); |
1da177e4c Linux-2.6.12-rc2 |
104 |
void hpsb_packet_received(struct hpsb_host *host, quadlet_t *data, size_t size, |
741854e4f ieee1394: whitesp... |
105 |
int write_acked); |
1da177e4c Linux-2.6.12-rc2 |
106 |
|
1da177e4c Linux-2.6.12-rc2 |
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
/* * CHARACTER DEVICE DISPATCHING * * All ieee1394 character device drivers share the same major number * (major 171). The 256 minor numbers are allocated to the various * task-specific interfaces (raw1394, video1394, dv1394, etc) in * blocks of 16. * * The core ieee1394.o module allocates the device number region * 171:0-255, the various drivers must then cdev_add() their cdev * objects to handle their respective sub-regions. * * Minor device number block allocations: * * Block 0 ( 0- 15) raw1394 * Block 1 ( 16- 31) video1394 * Block 2 ( 32- 47) dv1394 * * Blocks 3-14 free for future allocation * * Block 15 (240-255) reserved for drivers under development, etc. */ |
741854e4f ieee1394: whitesp... |
129 |
#define IEEE1394_MAJOR 171 |
1da177e4c Linux-2.6.12-rc2 |
130 |
|
741854e4f ieee1394: whitesp... |
131 132 133 |
#define IEEE1394_MINOR_BLOCK_RAW1394 0 #define IEEE1394_MINOR_BLOCK_VIDEO1394 1 #define IEEE1394_MINOR_BLOCK_DV1394 2 |
1da177e4c Linux-2.6.12-rc2 |
134 |
#define IEEE1394_MINOR_BLOCK_EXPERIMENTAL 15 |
741854e4f ieee1394: whitesp... |
135 |
#define IEEE1394_CORE_DEV MKDEV(IEEE1394_MAJOR, 0) |
e1d118f16 [PATCH] ieee1394:... |
136 137 138 139 140 141 142 143 |
#define IEEE1394_RAW1394_DEV MKDEV(IEEE1394_MAJOR, \ IEEE1394_MINOR_BLOCK_RAW1394 * 16) #define IEEE1394_VIDEO1394_DEV MKDEV(IEEE1394_MAJOR, \ IEEE1394_MINOR_BLOCK_VIDEO1394 * 16) #define IEEE1394_DV1394_DEV MKDEV(IEEE1394_MAJOR, \ IEEE1394_MINOR_BLOCK_DV1394 * 16) #define IEEE1394_EXPERIMENTAL_DEV MKDEV(IEEE1394_MAJOR, \ IEEE1394_MINOR_BLOCK_EXPERIMENTAL * 16) |
1da177e4c Linux-2.6.12-rc2 |
144 |
|
afd6546d8 ieee1394: move so... |
145 146 147 |
/** * ieee1394_file_to_instance - get the index within a minor number block */ |
1da177e4c Linux-2.6.12-rc2 |
148 149 |
static inline unsigned char ieee1394_file_to_instance(struct file *file) { |
9fd5746fd fs: Remove i_cind... |
150 151 152 153 |
int idx = cdev_index(file->f_path.dentry->d_inode); if (idx < 0) idx = 0; return idx; |
1da177e4c Linux-2.6.12-rc2 |
154 155 156 157 158 159 160 |
} extern int hpsb_disable_irm; /* Our sysfs bus entry */ extern struct bus_type ieee1394_bus_type; extern struct class hpsb_host_class; |
7e25ab915 [PATCH] class: co... |
161 |
extern struct class *hpsb_protocol_class; |
1da177e4c Linux-2.6.12-rc2 |
162 163 |
#endif /* _IEEE1394_CORE_H */ |