]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/pkg/l4sys/include/vcon.h
update
[l4.git] / l4 / pkg / l4sys / include / vcon.h
index 6bd01fbc7d2fffeacc08a66db6eea847d18479ab..2b3598a6b2de95689488ab730d8503d90e155b03 100644 (file)
@@ -36,7 +36,7 @@
  */
 
 /**
- * \brief Write data to virtual console.
+ * \brief Send data to virtual console.
  * \ingroup l4_vcon_api
  *
  * \param vcon    Vcon object.
  * \note Size must not exceed L4_VCON_WRITE_SIZE.
  */
 L4_INLINE l4_msgtag_t
-l4_vcon_write(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW;
+l4_vcon_send(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW;
 
 /**
  * \internal
  */
 L4_INLINE l4_msgtag_t
+l4_vcon_send_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW;
+
+
+/**
+ * \brief Write data to virtual console.
+ * \ingroup l4_vcon_api
+ *
+ * \param vcon    Vcon object.
+ * \param buf     Pointer to data buffer.
+ * \param size    Size of buffer in bytes.
+ *
+ * \return Number of bytes written to the virtual console.
+ */
+L4_INLINE long
+l4_vcon_write(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW;
+
+/**
+ * \internal
+ */
+L4_INLINE long
 l4_vcon_write_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW;
 
 /**
@@ -184,7 +204,7 @@ enum L4_vcon_ops
 /******* Implementations ********************/
 
 L4_INLINE l4_msgtag_t
-l4_vcon_write_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW
+l4_vcon_send_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW
 {
   l4_msg_regs_t *mr = l4_utcb_mr_u(utcb);
   mr->mr[0] = L4_VCON_WRITE_OP;
@@ -197,6 +217,33 @@ l4_vcon_write_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L
                                L4_IPC_NEVER);
 }
 
+L4_INLINE l4_msgtag_t
+l4_vcon_send(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW
+{
+  return l4_vcon_send_u(vcon, buf, size, l4_utcb());
+}
+
+L4_INLINE long
+l4_vcon_write_u(l4_cap_idx_t vcon, char const *buf, int size, l4_utcb_t *utcb) L4_NOTHROW
+{
+  l4_msgtag_t t;
+
+  if (size > L4_VCON_WRITE_SIZE)
+    size = L4_VCON_WRITE_SIZE;
+
+  t = l4_vcon_send_u(vcon, buf, size, utcb);
+  if (l4_msgtag_has_error(t))
+    return l4_error(t);
+
+  return size;
+}
+
+L4_INLINE long
+l4_vcon_write(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW
+{
+  return l4_vcon_write_u(vcon, buf, size, l4_utcb());
+}
+
 L4_INLINE int
 l4_vcon_read_u(l4_cap_idx_t vcon, char *buf, int size, l4_utcb_t *utcb) L4_NOTHROW
 {
@@ -228,12 +275,6 @@ l4_vcon_read_u(l4_cap_idx_t vcon, char *buf, int size, l4_utcb_t *utcb) L4_NOTHR
   return ret;
 }
 
-L4_INLINE l4_msgtag_t
-l4_vcon_write(l4_cap_idx_t vcon, char const *buf, int size) L4_NOTHROW
-{
-  return l4_vcon_write_u(vcon, buf, size, l4_utcb());
-}
-
 L4_INLINE int
 l4_vcon_read(l4_cap_idx_t vcon, char *buf, int size) L4_NOTHROW
 {