[PATCH] libosmocore[master]: sercomm: Add doxygen-style documentation to public API

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon May 15 15:34:27 UTC 2017


Review at  https://gerrit.osmocom.org/2638

sercomm: Add doxygen-style documentation to public API

Change-Id: I2d8b11905692920d328262836420f01305be489e
---
M include/osmocom/core/sercomm.h
M src/sercomm.c
2 files changed, 32 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/38/2638/1

diff --git a/include/osmocom/core/sercomm.h b/include/osmocom/core/sercomm.h
index d84786e..3d986c6 100644
--- a/include/osmocom/core/sercomm.h
+++ b/include/osmocom/core/sercomm.h
@@ -22,27 +22,44 @@
 };
 
 struct osmo_sercomm_inst;
+/*! \brief call-back function for per-DLC receive handler
+ *  \param[in] sercomm instance on which msg was received
+ *  \param[in] dlci DLC Identifier of received msg
+ *  \param[in] msg received message that needs to be processed */
 typedef void (*dlci_cb_t)(struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg);
 
+/*! \brief one instance of a sercomm multiplex/demultiplex */
 struct osmo_sercomm_inst {
+	/*! \brief Has this instance been initialized? */
 	int initialized;
+	/*! \brief UART Identifier */
 	int uart_id;
 
-	/* transmit side */
+	/*! \brief transmit side */
 	struct {
+		/*! \brief per-DLC queue of pending transmit msgbs */
 		struct llist_head dlci_queues[_SC_DLCI_MAX];
+		/*! \brief msgb currently being transmitted */
 		struct msgb *msg;
+		/*! \brief transmit state */
 		int state;
+		/*! \brief next to-be-transmitted char in msg */
 		uint8_t *next_char;
 	} tx;
 
-	/* receive side */
+	/*! \brief receive side */
 	struct {
+		/*! \brief per-DLC handler call-back functions */
 		dlci_cb_t dlci_handler[_SC_DLCI_MAX];
+		/*! \brief msgb allocation size for rx msgs */
 		unsigned int msg_size;
+		/*! \brief currently received msgb */
 		struct msgb *msg;
+		/*! \brief receive state */
 		int state;
+		/*! \brief DLCI of currently received msgb */
 		uint8_t dlci;
+		/*! \brief CTRL of currently received msgb */
 		uint8_t ctrl;
 	} rx;
 };
@@ -60,23 +77,15 @@
 int osmo_sercomm_initialized(struct osmo_sercomm_inst *sercomm);
 
 /* User Interface: Tx */
-
-/* user interface for transmitting messages for a given DLCI */
 void osmo_sercomm_sendmsg(struct osmo_sercomm_inst *sercomm, uint8_t dlci, struct msgb *msg);
-/* how deep is the Tx queue for a given DLCI */
 unsigned int osmo_sercomm_tx_queue_depth(struct osmo_sercomm_inst *sercomm, uint8_t dlci);
 
 /* User Interface: Rx */
-
-/* receiving messages for a given DLCI */
 int osmo_sercomm_register_rx_cb(struct osmo_sercomm_inst *sercomm, uint8_t dlci, dlci_cb_t cb);
 
 /* Driver Interface */
 
-/* fetch one octet of to-be-transmitted serial data. returns 0 if no more data */
 int osmo_sercomm_drv_pull(struct osmo_sercomm_inst *sercomm, uint8_t *ch);
-/* the driver has received one byte, pass it into sercomm layer.
-   returns 1 in case of success, 0 in case of unrecognized char */
 int osmo_sercomm_drv_rx_char(struct osmo_sercomm_inst *sercomm, uint8_t ch);
 
 static inline struct msgb *osmo_sercomm_alloc_msgb(unsigned int len)
diff --git a/src/sercomm.c b/src/sercomm.c
index 111565f..dbe3d05 100644
--- a/src/sercomm.c
+++ b/src/sercomm.c
@@ -168,7 +168,10 @@
 }
 #endif
 
-/* fetch one octet of to-be-transmitted serial data */
+/*! \brief fetch one octet of to-be-transmitted serial data
+ *  \param[in] sercomm Sercomm Instance from which to fetch pending data
+ *  \param[out] ch pointer to caller-allocaed output memory
+ *  \returns 1 in case of succss; 0 if no data available; negative on error */
 int osmo_sercomm_drv_pull(struct osmo_sercomm_inst *sercomm, uint8_t *ch)
 {
 	unsigned long flags;
@@ -230,7 +233,11 @@
 	return 1;
 }
 
-/* register a handler for a given DLCI */
+/*! \brief Register a handler for a given DLCI
+ *  \param sercomm Sercomm Instance in which caller wishes to register
+ *  \param[in] dlci Data Ling Connection Identifier to register
+ *  \param[in] cb Callback function for \a dlci
+ *  \returns 0 on success; negative on error */
 int osmo_sercomm_register_rx_cb(struct osmo_sercomm_inst *sercomm, uint8_t dlci, dlci_cb_t cb)
 {
 	if (dlci >= ARRAY_SIZE(sercomm->rx.dlci_handler))
@@ -254,7 +261,10 @@
 	sercomm->rx.dlci_handler[dlci](sercomm, dlci, msg);
 }
 
-/* the driver has received one byte, pass it into sercomm layer */
+/*! \brief the driver has received one byte, pass it into sercomm layer
+ *  \param[in] sercomm Sercomm Instance for which a byte was received
+ *  \param[in] ch byte that was received from line for said instance
+ *  \returns 1 on success; 0 on unrecognized char; negative on error */
 int osmo_sercomm_drv_rx_char(struct osmo_sercomm_inst *sercomm, uint8_t ch)
 {
 	uint8_t *ptr;

-- 
To view, visit https://gerrit.osmocom.org/2638
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d8b11905692920d328262836420f01305be489e
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list