summaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-28 15:01:43 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-28 15:01:43 +0000
commit82fb23b2cc78fade702316d00510efcf9d65954f (patch)
treea997a6f40b080a1e31890359dde9fc466e726221 /nuttx/include
parentb197eb1609652b2b766bb79caf00b23ef07eed40 (diff)
downloadpx4-nuttx-82fb23b2cc78fade702316d00510efcf9d65954f.tar.gz
px4-nuttx-82fb23b2cc78fade702316d00510efcf9d65954f.tar.bz2
px4-nuttx-82fb23b2cc78fade702316d00510efcf9d65954f.zip
More changes from Uros
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3431 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r--nuttx/include/nuttx/i2c.h38
-rw-r--r--nuttx/include/sched.h2
2 files changed, 37 insertions, 3 deletions
diff --git a/nuttx/include/nuttx/i2c.h b/nuttx/include/nuttx/i2c.h
index b4aadb709..379105fc6 100644
--- a/nuttx/include/nuttx/i2c.h
+++ b/nuttx/include/nuttx/i2c.h
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/i2c.h
*
- * Copyright(C) 2009-2010 Gregory Nutt. All rights reserved.
+ * Copyright(C) 2009-2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -109,13 +109,39 @@
* nbits - The number of address bits provided (7 or 10)
*
* Returned Value:
- * Returns the actual frequency selected
+ * Returns OK on success; a negated errno on failure.
*
****************************************************************************/
#define I2C_SETADDRESS(d,f,b) ((d)->ops->setaddress(d,f,b))
/****************************************************************************
+ * Name: I2C_SETOWNADDRESS
+ *
+ * Description:
+ * Set our own I2C address. Calling this function enables Slave mode and
+ * disables Master mode on given instance (note that I2C is a bus, where
+ * multiple masters and slave may be handled by one device driver).
+ *
+ * One may register callback to be notifyed about reception. During the
+ * slave mode reception, the function READ and WRITE must be used to
+ * to handle reads and writes from a master.
+ *
+ * Input Parameters:
+ * dev - Device-specific state data
+ * address - Our own slave address; If it is 0x00, then the device driver
+ * listens to general call
+ * nbits - The number of address bits provided (7 or 10)
+ *
+ * Returned Value:
+ * OK on valid address and if the same address has not been assigned
+ * to other existance sharing the same port. Otherwise ERROR is returned.
+ *
+ ****************************************************************************/
+
+#define I2C_SETOWNADDRESS(d,f,b) ((d)->ops->setownaddress(d,f,b))
+
+/****************************************************************************
* Name: I2C_WRITE
*
* Description:
@@ -192,9 +218,17 @@ struct i2c_ops_s
int (*setaddress)(FAR struct i2c_dev_s *dev, int addr, int nbits);
int (*write)(FAR struct i2c_dev_s *dev, const uint8_t *buffer, int buflen);
int (*read)(FAR struct i2c_dev_s *dev, uint8_t *buffer, int buflen);
+#ifdef CONFIG_I2C_WRITEREAD
+ int (*writeread)(FAR struct i2c_dev_s *inst, const uint8_t *wbuffer, int wbuflen,
+ uint8_t *rbuffer, int rbuflen);
+#endif
#ifdef CONFIG_I2C_TRANSFER
int (*transfer)(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *msgs, int count);
#endif
+#ifdef CONFIG_I2C_SLAVE
+ int (*setownaddress)(FAR struct i2c_dev_s *dev, int addr, int nbits);
+ int (*registercallback)(FAR struct i2c_dev_s *dev, int (*callback)(void) );
+#endif
};
/* I2C transaction segment beginning with a START. A number of these can
diff --git a/nuttx/include/sched.h b/nuttx/include/sched.h
index 739f6a98b..f7ebd9c82 100644
--- a/nuttx/include/sched.h
+++ b/nuttx/include/sched.h
@@ -66,7 +66,7 @@
/* Non-standard Helper **********************************************************/
/* One processor family supported by NuttX has a single, fixed hardware stack.
* That is the 8051 family. So for that family only, there is a variant form
- * of task_create() that does not task a stack size of a parameter. The following
+ * of task_create() that does not take a stack size parameter. The following
* helper macro is provided to work around the ugliness of that exception.
*/