patch-2.4.0-test2 linux/drivers/ieee1394/ieee1394_core.c
Next file: linux/drivers/ieee1394/ieee1394_syms.c
Previous file: linux/drivers/ieee1394/guid.h
Back to the patch index
Back to the overall index
- Lines: 136
- Date:
Mon Jun 19 17:59:40 2000
- Orig file:
v2.4.0-test1/linux/drivers/ieee1394/ieee1394_core.c
- Orig date:
Mon Mar 27 08:08:24 2000
diff -u --recursive --new-file v2.4.0-test1/linux/drivers/ieee1394/ieee1394_core.c linux/drivers/ieee1394/ieee1394_core.c
@@ -25,6 +25,7 @@
#include "highlevel.h"
#include "ieee1394_transactions.h"
#include "csr.h"
+#include "guid.h"
atomic_t hpsb_generation = ATOMIC_INIT(0);
@@ -45,6 +46,26 @@
}
+/**
+ * alloc_hpsb_packet - allocate new packet structure
+ * @data_size: size of the data block to be allocated
+ *
+ * This function allocates, initializes and returns a new &struct hpsb_packet.
+ * It can be used in interrupt context. A header block is always included, its
+ * size is big enough to contain all possible 1394 headers. The data block is
+ * only allocated when @data_size is not zero.
+ *
+ * For packets for which responses will be received the @data_size has to be big
+ * enough to contain the response's data block since no further allocation
+ * occurs at response matching time.
+ *
+ * The packet's generation value will be set to the current generation number
+ * for ease of use. Remember to overwrite it with your own recorded generation
+ * number if you can not be sure that your code will not race with a bus reset.
+ *
+ * Return value: A pointer to a &struct hpsb_packet or NULL on allocation
+ * failure.
+ */
struct hpsb_packet *alloc_hpsb_packet(size_t data_size)
{
struct hpsb_packet *packet = NULL;
@@ -83,6 +104,14 @@
return packet;
}
+
+/**
+ * free_hpsb_packet - free packet and data associated with it
+ * @packet: packet to free (is NULL safe)
+ *
+ * This function will free packet->data, packet->header and finally the packet
+ * itself.
+ */
void free_hpsb_packet(struct hpsb_packet *packet)
{
if (packet == NULL) {
@@ -336,6 +365,20 @@
queue_task(&host->timeout_tq, &tq_timer);
}
+/**
+ * hpsb_send_packet - transmit a packet on the bus
+ * @packet: packet to send
+ *
+ * The packet is sent through the host specified in the packet->host field.
+ * Before sending, the packet's transmit speed is automatically determined using
+ * the local speed map.
+ *
+ * Possibilities for failure are that host is either not initialized, in bus
+ * reset, the packet's generation number doesn't match the current generation
+ * number or the host reports a transmit error.
+ *
+ * Return value: False (0) on failure, true (1) otherwise.
+ */
int hpsb_send_packet(struct hpsb_packet *packet)
{
struct hpsb_host *host = packet->host;
@@ -721,47 +764,6 @@
}
-#if 0
-int hpsb_host_thread(void *hostPointer)
-{
- struct hpsb_host *host = (struct hpsb_host *)hostPointer;
-
- /* I don't understand why, but I just want to be on the safe side. */
- lock_kernel();
-
- HPSB_INFO(__FUNCTION__ " starting for one %s adapter",
- host->template->name);
-
- exit_mm(current);
- exit_files(current);
- exit_fs(current);
-
- strcpy(current->comm, "ieee1394 thread");
-
- /* ... but then again, I think the following is safe. */
- unlock_kernel();
-
- for (;;) {
- siginfo_t info;
- unsigned long signr;
-
- if (signal_pending(current)) {
- spin_lock_irq(¤t->sigmask_lock);
- signr = dequeue_signal(¤t->blocked, &info);
- spin_unlock_irq(¤t->sigmask_lock);
-
- break;
- }
-
- abort_timedouts(host);
- }
-
- HPSB_INFO(__FUNCTION__ " exiting");
- return 0;
-}
-#endif
-
-
#ifndef MODULE
void __init ieee1394_init(void)
@@ -769,6 +771,7 @@
register_builtin_lowlevels();
init_hpsb_highlevel();
init_csr();
+ init_ieee1394_guid();
}
#else
@@ -777,6 +780,8 @@
{
init_hpsb_highlevel();
init_csr();
+ init_ieee1394_guid();
+
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)