Changeset 65ffec3 in mainline for uspace/drv/char/i8042/buffer.h


Ignore:
Timestamp:
2011-12-26T22:40:45Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ff60d1
Parents:
e67e1be
Message:

i8042: buffer.h doxygen comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/i8042/buffer.h

    re67e1be r65ffec3  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 /** @addtogroup kbd_port
    29  * @ingroup kbd
     28/**
     29 * @addtogroup kbd
    3030 * @{
    3131 */
    3232/** @file
    33  * @brief i8042 port driver.
     33 * @brief Cyclic buffer structure.
    3434 */
    3535
     
    4040#include <fibril_synch.h>
    4141
     42/** Cyclic buffer that blocks on full/empty.
     43 *
     44 * read_head == write_head means that the buffer is empty.
     45 * write_head + 1 == read_head means that the buffer is full.
     46 * Attempt to insert byte into the full buffer will block until it can succeed.
     47 * Attempt to read from empty buffer will block until it can succeed.
     48 */
    4249typedef struct {
    43         uint8_t *buffer;
    44         uint8_t *buffer_end;
    45         fibril_mutex_t guard;
    46         fibril_condvar_t change;
    47         uint8_t *read_head;
    48         uint8_t *write_head;
     50        uint8_t *buffer;         /**< Storage space. */
     51        uint8_t *buffer_end;     /**< End of storage place. */
     52        fibril_mutex_t guard;    /**< Protects buffer structures. */
     53        fibril_condvar_t change; /**< Indicates change (empty/full). */
     54        uint8_t *read_head;      /**< Place of the next readable element. */
     55        uint8_t *write_head;     /**< Pointer to the next writable place. */
    4956} buffer_t;
    5057
     58/** Initialize cyclic buffer using provided memory space.
     59 * @param buffer Cyclic buffer structure to initialize.
     60 * @param data Memory space to use.
     61 * @param size Size of the memory place.
     62 */
    5163static inline void buffer_init(buffer_t *buffer, uint8_t *data, size_t size)
    5264{
     
    6173}
    6274
     75/** Write byte to cyclic buffer.
     76 * @param buffer Cyclic buffer to write to.
     77 * @param data Data to write.
     78 */
    6379static inline void buffer_write(buffer_t *buffer, uint8_t data)
    6480{
     
    86102}
    87103
     104/** Read byte from cyclic buffer.
     105 * @param buffer Cyclic buffer to read from.
     106 * @return Byte read.
     107 */
    88108static inline uint8_t buffer_read(buffer_t *buffer)
    89109{
     
    114134        return data;
    115135}
    116 
    117 
    118136#endif
    119137/**
Note: See TracChangeset for help on using the changeset viewer.