From 46e56d73491d9141b7ed3f79f2a26d3d9addc8ef Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 1 May 2009 12:58:05 +0000 Subject: I/O queues improvements, removed half duplex queues. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@926 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/chserial.c | 92 ---------------------------------------------------------- 1 file changed, 92 deletions(-) (limited to 'src/chserial.c') diff --git a/src/chserial.c b/src/chserial.c index 725df207d..bb2d7b7d7 100644 --- a/src/chserial.c +++ b/src/chserial.c @@ -123,96 +123,4 @@ dflags_t chFDDGetAndClearFlags(FullDuplexDriver *sd) { } #endif /* CH_USE_SERIAL_FULLDUPLEX */ -#if CH_USE_SERIAL_HALFDUPLEX -/** - * @brief Initializes a generic half duplex driver. - * @details The HW dependent part of the initialization has to be performed - * outside, usually in the hardware initialization code. - * - * @param[out] sd pointer to a @p HalfDuplexDriver structure - * @param[in] b pointer to a memory area allocated for the queue buffer - * @param[in] size the buffer size - * @param[in] inotify pointer to a callback function that is invoked when - * some data is read from the queue. The value can be - * @p NULL. - * @param[in] onotify pointer to a callback function that is invoked when - * some data is written in the queue. The value can be - * @p NULL. - */ -void chHDDInit(HalfDuplexDriver *sd, uint8_t *b, size_t size, - qnotify_t inotify, qnotify_t onotify) { - - chDbgCheck((sd != NULL) && (b != NULL) && (size > 0), "chHDDInit"); - - chHDQInit(&sd->sd_queue, b, size, inotify, onotify); - chEvtInit(&sd->sd_ievent); - chEvtInit(&sd->sd_oevent); - chEvtInit(&sd->sd_sevent); - sd->sd_flags = SD_NO_ERROR; -} - -/** - * @brief Handles incoming data. - * @details This function must be called from the input interrupt service - * routine in order to enqueue incoming data and generate the - * related events. - * @param[in] sd pointer to a @p FullDuplexDriver structure - * @param[in] b the byte to be written in the driver's input queue - */ -void chHDDIncomingDataI(HalfDuplexDriver *sd, uint8_t b) { - - if (chHDQPutReceiveI(&sd->sd_queue, b) < Q_OK) - chHDDAddFlagsI(sd, SD_OVERRUN_ERROR); - else - chEvtBroadcastI(&sd->sd_ievent); -} - -/** - * @brief Handles outgoing data. - * @details Must be called from the output interrupt service routine in order - * to get the next byte to be transmitted. - * - * @param[in] sd pointer to a @p HalfDuplexDriver structure - * @return The byte value read from the driver's output queue. - * @retval Q_EMPTY if the queue is empty (the lower driver usually disables - * the interrupt source when this happens). - */ -msg_t chHDDRequestDataI(HalfDuplexDriver *sd) { - - msg_t b = chHDQGetTransmitI(&sd->sd_queue); - if (b < Q_OK) - chEvtBroadcastI(&sd->sd_oevent); - return b; -} - -/** - * @brief Handles communication events/errors. - * @details Must be called from the I/O interrupt service routine in order to - * notify I/O conditions as errors, signals change etc. - * - * @param[in] sd pointer to a @p HalfDuplexDriver structure - * @param[in] mask condition flags to be added to the mask - */ -void chHDDAddFlagsI(HalfDuplexDriver *sd, dflags_t mask) { - - sd->sd_flags |= mask; - chEvtBroadcastI(&sd->sd_sevent); -} - -/** - * @brief Returns and clears the errors mask associated to the driver. - * - * @param[in] sd pointer to a @p HalfDuplexDriver structure - * @return The condition flags modified since last time this function was - * invoked. - */ -dflags_t chHDDGetAndClearFlags(HalfDuplexDriver *sd) { - dflags_t mask; - - mask = sd->sd_flags; - sd->sd_flags = SD_NO_ERROR; - return mask; -} -#endif /* CH_USE_SERIAL_HALFDUPLEX */ - /** @} */ -- cgit v1.2.3