changeset 2112:44d250ab3b3a

* src/iosys.c: * include/devtab.h: Add comments that bread/bwrite takes there parameters in blocks, not bytes.
author asl
date Fri, 02 Dec 2005 20:03:52 +0000
parents 0ad51d0b250b
children ba637aa555ec
files packages/io/common/current/ChangeLog packages/io/common/current/include/devtab.h packages/io/common/current/src/iosys.c
diffstat 3 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/packages/io/common/current/ChangeLog
+++ b/packages/io/common/current/ChangeLog
@@ -1,3 +1,9 @@
+2005-12-02  Andrew Lunn  <andrew.lunn@ascom.ch>
+
+	* src/iosys.c: 
+	* include/devtab.h: Add comments that bread/bwrite takes there
+	parameters in blocks, not bytes.
+
 2005-09-11  Uwe Kindler  <uwe_kindler@web.de>
 
 	* include/config_keys.h Configuration keys for CAN driver added. 
--- a/packages/io/common/current/include/devtab.h
+++ b/packages/io/common/current/include/devtab.h
@@ -69,13 +69,13 @@ typedef struct {
                       void *buf, 
                       cyg_uint32 *len);
     Cyg_ErrNo (*bwrite)(cyg_io_handle_t handle, 
-                       const void *buf, 
-                       cyg_uint32 *len,
-                       cyg_uint32 pos);
+                        const void *buf, 
+                        cyg_uint32 *len,   // in blocks
+                        cyg_uint32 pos);   // in blocks
     Cyg_ErrNo (*bread)(cyg_io_handle_t handle, 
-                      void *buf, 
-                      cyg_uint32 *len,
-                      cyg_uint32 pos);
+                       void *buf, 
+                       cyg_uint32 *len,    // in blocks
+                       cyg_uint32 pos);    // in blocks
     cyg_bool  (*select)(cyg_io_handle_t handle,
                         cyg_uint32 which,
                         CYG_ADDRWORD info);
@@ -130,6 +130,8 @@ cyg_devio_table_t _l = {                
     _set_config,                                                \
 };
 
+// Note: _bwrite and _bread pass len and pos in terms of blocks, not
+// bytes.
 #define BLOCK_DEVIO_TABLE(_l,_bwrite,_bread,_select,_get_config,_set_config)    \
 cyg_devio_table_t _l = {                                        \
     cyg_devio_cwrite,                                           \
--- a/packages/io/common/current/src/iosys.c
+++ b/packages/io/common/current/src/iosys.c
@@ -198,6 +198,10 @@ cyg_io_read(cyg_io_handle_t handle, void
     return t->handlers->read(handle, buf, len);
 }
 
+//
+// 'write' blocks to a device. The len and the position are in terms
+// of blocks, not bytes like the cyg_io_write.
+//
 Cyg_ErrNo 
 cyg_io_bwrite(cyg_io_handle_t handle, const void *buf, cyg_uint32 *len, cyg_uint32 pos)
 {
@@ -215,9 +219,9 @@ cyg_io_bwrite(cyg_io_handle_t handle, co
 }
 
 //
-// 'read' data from a device.
+// 'read' blocks from a device. The len and the position are in terms of
+// blocks, not bytes like the cyg_io_read.
 //
-
 Cyg_ErrNo 
 cyg_io_bread(cyg_io_handle_t handle, void *buf, cyg_uint32 *len, cyg_uint32 pos)
 {