summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ddennedy 2002-10-23 21:22:22 +0000
committerGravatar ddennedy 2002-10-23 21:22:22 +0000
commit9d2badbe76f918c99778bb1c362f988c0172f9fe (patch)
tree4f141c884360217e2975924c3ea6b7aca7c31eb5
parentmerged weihs branch (diff)
added missing arm.c from weihs branch
git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@86 53a565d1-3bb7-0310-b661-cf11e63c67ab
-rw-r--r--src/arm.c93
1 files changed, 93 insertions, 0 deletions
diff --git a/src/arm.c b/src/arm.c
new file mode 100644
index 0000000..669b8ab
--- /dev/null
+++ b/src/arm.c
@@ -0,0 +1,93 @@
+/*
+ * libraw1394 - library for raw access to the 1394 bus with the Linux subsystem.
+ *
+ * Copyright (C) 2002 Manfred Weihs <weihs@ict.tuwien.ac.at>
+ * Christian Toegel <christian.toegel@gmx.at>
+ *
+ * This library is licensed under the GNU Lesser General Public License (LGPL),
+ * version 2.1 or later. See the file COPYING.LIB in the distribution for
+ * details.
+ */
+
+#include <config.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "raw1394.h"
+#include "kernel-raw1394.h"
+#include "raw1394_private.h"
+
+/*
+ * AdressRangeMapping REGISTERING:
+ * start, length .... identifies addressrange
+ * *initial_value ... pointer to buffer containing (if necessary) initial value
+ * NULL means undefined
+ * arm_tag .......... identifier for arm_tag_handler
+ * (usually pointer to raw1394_arm_reqhandle)
+ * access_rights .... access-rights for registered addressrange handled
+ * by kernel-part. Value is one or more binary or of the
+ * following flags: ARM_READ, ARM_WRITE, ARM_LOCK
+ * notification_options ... identifies for which type of request you want
+ * to be notified. Value is one or more binary or of the
+ * following flags: ARM_READ, ARM_WRITE, ARM_LOCK
+ * client_transactions ... identifies for which type of request you want
+ * to handle the request by the client application.
+ * for those requests no response will be generated, but
+ * has to be generated by the application.
+ * Value is one or more binary or of the
+ * following flags: ARM_READ, ARM_WRITE, ARM_LOCK
+ * For each bit set here, notification_options and
+ * access_rights will be ignored.
+ * returnvalue: 0 ... success
+ * <0 ... failure
+ */
+int raw1394_arm_register(struct raw1394_handle *handle, nodeaddr_t start,
+ size_t length, byte_t *initial_value,
+ octlet_t arm_tag, arm_options_t access_rights,
+ arm_options_t notification_options,
+ arm_options_t client_transactions)
+{
+ int retval=0;
+ struct raw1394_request *req = &(handle->req);
+
+ if (((start & ~(0xFFFFFFFFFFFF)) != 0) ||
+ (((start + length) & ~(0xFFFFFFFFFFFF)) != 0)) {
+ errno = EINVAL;
+ return (-1);
+ }
+ CLEAR_REQ(req);
+ req->type = RAW1394_REQ_ARM_REGISTER;
+ req->generation = handle->generation; /* not necessary */
+ req->address = start;
+ req->length = length;
+ req->tag = arm_tag;
+ req->recvb = ptr2int(handle->buffer); /* arm_handle on success */
+ req->misc = ((client_transactions & 0x0f) << 8)|((notification_options & 0x0F) << 4)|(access_rights & 0x0F)
+ |((ARM_REC_LENGTH & 0xFFFF) << 16);
+ req->sendb = ptr2int(initial_value);
+ retval = (int) write(handle->fd, req, sizeof(*req));
+ return (retval == sizeof(*req)) ? 0:-1;
+}
+
+/*
+ * AdressRangeMapping UNREGISTERING:
+ * start ............ identifies addressrange for unregistering
+ * (value of start have to be the same value
+ * used for registering this adressrange)
+ * returnvalue: 0 ... success
+ * <0 ... failure
+ */
+int raw1394_arm_unregister (struct raw1394_handle *handle, nodeaddr_t start)
+{
+ int retval;
+ struct raw1394_request *req = &(handle->req);
+
+ CLEAR_REQ(req);
+ req->type = RAW1394_REQ_ARM_UNREGISTER;
+ req->generation = handle->generation; /* not necessary */
+ req->address = start;
+ retval = write(handle->fd, req, sizeof(*req));
+ return (retval == sizeof(*req)) ? 0:-1;
+}
n 1-55/+52 2021-07-26typoGravatar John Cowan 1-1/+1 2021-07-26switching to explicit dtosGravatar John Cowan 1-88/+102 2021-07-26errorsGravatar John Cowan 1-1/+4 2021-07-26more MN-W reviewGravatar John Cowan 1-5/+5 2021-07-26update preview linkGravatar John Cowan 1-1/+1 2021-07-26MN-W reviewGravatar John Cowan 1-6/+6 2021-07-26paired mutatorsGravatar John Cowan 1-43/+68 2021-07-25exceptionsGravatar John Cowan 1-1/+15 2021-07-25new exampleGravatar John Cowan 1-1/+4 2021-07-25updatesGravatar John Cowan 1-2/+4 2021-07-24dtd always first argumentGravatar John Cowan 1-9/+9 2021-07-23DTO to DTDGravatar John Cowan 1-55/+52 2021-07-22typoGravatar John Cowan 1-1/+1 2021-07-22switching to explicit dtosGravatar John Cowan 1-88/+102 2021-07-22errorsGravatar John Cowan 1-1/+4 2021-07-22more MN-W reviewGravatar John Cowan 1-5/+5 2021-07-20update preview linkGravatar John Cowan 1-1/+1 2021-07-20MN-W reviewGravatar John Cowan 1-6/+6 2021-07-18Fix typo.Gravatar Arthur A. Gleckler 2-4/+4 2021-07-18Add <p> around abstract.Gravatar Arthur A. Gleckler 1-2/+2 2021-07-18Publish first draft.draft-1Gravatar Arthur A. Gleckler 3-0/+114 2021-07-18Ignore trailing whitespace.Gravatar Arthur A. Gleckler 11-129/+129 2021-07-18Ignore "Dictionaries.log".Gravatar Arthur A. Gleckler 1-1/+2 2021-07-18Fix errors reported by W3C HTML Validator.Gravatar Arthur A. Gleckler 1-27/+27 2021-07-18Eliminate unnecessary redirect by using TLS/SSL.Gravatar Arthur A. Gleckler 1-1/+1 >Gravatar ddennedy 1-4/+4 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@94 53a565d1-3bb7-0310-b661-cf11e63c67ab 2002-11-18merged rawiso branchGravatar ddennedy 7-6/+488 git-svn-id: svn://svn.linux1394.org/libraw1394/trunk@93 53a565d1-3bb7-0310-b661-cf11e63c67ab