diff options
| author | 2001-05-14 01:05:58 +0000 | |
|---|---|---|
| committer | 2001-05-14 01:05:58 +0000 | |
| commit | e02dee488a2c3c3ea8374e7bd49e59176eab32dd (patch) | |
| tree | aacc99ac9584e29b2477db7acc3f5e27d54803c3 /src | |
| parent | Fix macros so that they actually work. (diff) | |
Handle generation number is not automatically advanced with bus reset.
Function raw1394_update_generation() added for manual update.
Bus reset handler get current generation number as argument.
Default bus reset handler calls raw1394_update_generation().
git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@60 53a565d1-3bb7-0310-b661-cf11e63c67ab
Diffstat (limited to '')
| -rw-r--r-- | src/eventloop.c | 5 | ||||
| -rw-r--r-- | src/main.c | 8 | ||||
| -rw-r--r-- | src/raw1394.h | 18 | ||||
| -rw-r--r-- | src/version.c | 3 |
4 files changed, 26 insertions, 8 deletions
diff --git a/src/eventloop.c b/src/eventloop.c index 7f1f519..f3a8f7c 100644 --- a/src/eventloop.c +++ b/src/eventloop.c @@ -28,8 +28,6 @@ int raw1394_loop_iterate(struct raw1394_handle *handle) switch (req->type) { case RAW1394_REQ_BUS_RESET: - handle->generation = req->generation; - if (handle->protocol_version == 3) { handle->num_of_nodes = req->misc & 0xffff; handle->local_id = req->misc >> 16; @@ -40,7 +38,8 @@ int raw1394_loop_iterate(struct raw1394_handle *handle) } if (handle->bus_reset_handler) { - retval = handle->bus_reset_handler(handle); + retval = handle->bus_reset_handler(handle, + req->generation); } break; @@ -20,8 +20,9 @@ #include "raw1394_private.h" -static int bus_reset_default(struct raw1394_handle *handle) +static int bus_reset_default(struct raw1394_handle *handle, unsigned int gen) { + raw1394_update_generation(handle, gen); return 0; } @@ -124,6 +125,11 @@ unsigned int raw1394_get_generation(struct raw1394_handle *handle) return handle->generation; } +void raw1394_update_generation(struct raw1394_handle *handle, unsigned int gen) +{ + handle->generation = gen; +} + int raw1394_get_nodecount(struct raw1394_handle *handle) { return handle->num_of_nodes; diff --git a/src/raw1394.h b/src/raw1394.h index 4661cb1..5314409 100644 --- a/src/raw1394.h +++ b/src/raw1394.h @@ -45,7 +45,6 @@ int raw1394_get_fd(raw1394handle_t handle); void *raw1394_get_userdata(raw1394handle_t handle); void raw1394_set_userdata(raw1394handle_t handle, void *data); -unsigned int raw1394_get_generation(raw1394handle_t handle); nodeid_t raw1394_get_local_id(raw1394handle_t handle); nodeid_t raw1394_get_irm_id(raw1394handle_t handle); @@ -92,13 +91,26 @@ int raw1394_loop_iterate(raw1394handle_t handle); /* * Set the handler that will be called when a bus reset message is encountered. - * The default action is to do nothing. Returns old handler. + * The default action is to just call raw1394_update_generation(). Returns old + * handler. */ -typedef int (*bus_reset_handler_t)(raw1394handle_t); +typedef int (*bus_reset_handler_t)(raw1394handle_t, unsigned int generation); bus_reset_handler_t raw1394_set_bus_reset_handler(raw1394handle_t handle, bus_reset_handler_t new_h); /* + * Since node IDs may change during a bus reset, generation numbers incremented + * every bus reset are used to verify if a transaction request is intended for + * this configuration. If numbers don't match, they will fail immediately. + * + * raw1394_get_generation() returns the generation number in use by the handle, + * not the current generation number. The current generation number is passed + * to the bus reset handler. + */ +unsigned int raw1394_get_generation(raw1394handle_t handle); +void raw1394_update_generation(raw1394handle_t handle, unsigned int generation); + +/* * Set the handler that will be called when an async read/write/lock returns. * The default action is to call the callback in the raw1394_reqhandle pointed * to by tag. Returns old handler. diff --git a/src/version.c b/src/version.c index 2fb41b5..3cedd13 100644 --- a/src/version.c +++ b/src/version.c @@ -12,7 +12,8 @@ /* Variables to find version by linking (avoid need for test program) */ -char __libraw1394_version_0_8_99; +char __libraw1394_version_0_9; +char __libraw1394_version_0_9_0; /* This function is to be used by the autoconf macro to find the lib version */ const char *raw1394_get_libversion() |
