Ignore:
Timestamp:
2011-03-13T13:59:19Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6143ce3
Parents:
67352d2
Message:

Doxygen comments, use helper function for setting IOC flag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.h

    r67352d2 reb0dc58  
    4545
    4646        volatile uint32_t status;
    47 
    4847#define TD_STATUS_RESERVED_MASK 0xc000f800
    4948#define TD_STATUS_SPD_FLAG ( 1 << 29 )
     
    7069
    7170        volatile uint32_t device;
    72 
    7371#define TD_DEVICE_MAXLEN_POS 21
    7472#define TD_DEVICE_MAXLEN_MASK ( 0x7ff )
     
    8583
    8684        /* there is 16 bytes of data available here, according to UHCI
    87          * Design guide, according to linux kernel the hardware does not care
    88          * we don't use it anyway
     85         * Design guide, according to linux kernel the hardware does not care,
     86         * it just needs to be aligned, we don't use it anyway
    8987         */
    9088} __attribute__((packed)) td_t;
     
    9795int td_status(td_t *instance);
    9896
     97void td_print_status(td_t *instance);
     98/*----------------------------------------------------------------------------*/
     99/** Helper function for parsing actual size out of TD.
     100 *
     101 * @param[in] instance TD structure to use.
     102 * @return Parsed actual size.
     103 */
    99104static inline size_t td_act_size(td_t *instance)
    100105{
    101106        assert(instance);
    102         return
    103             ((instance->status >> TD_STATUS_ACTLEN_POS) + 1)
    104             & TD_STATUS_ACTLEN_MASK;
     107        const uint32_t s = instance->status;
     108        return ((s >> TD_STATUS_ACTLEN_POS) + 1) & TD_STATUS_ACTLEN_MASK;
    105109}
    106 
     110/*----------------------------------------------------------------------------*/
     111/** Checks whether less than max data were recieved and packet is marked as SPD.
     112 *
     113 * @param[in] instance TD structure to use.
     114 * @return True if packet is short (less than max bytes and SPD set), false
     115 *     otherwise.
     116 */
    107117static inline bool td_is_short(td_t *instance)
    108118{
     
    114124            (instance->status | TD_STATUS_SPD_FLAG) && act_size < max_size;
    115125}
    116 
     126/*----------------------------------------------------------------------------*/
     127/** Helper function for parsing value of toggle bit.
     128 *
     129 * @param[in] instance TD structure to use.
     130 * @return Toggle bit value.
     131 */
    117132static inline int td_toggle(td_t *instance)
    118133{
    119134        assert(instance);
    120         return ((instance->device & TD_DEVICE_DATA_TOGGLE_ONE_FLAG) != 0)
    121             ? 1 : 0;
     135        return (instance->device & TD_DEVICE_DATA_TOGGLE_ONE_FLAG) ? 1 : 0;
    122136}
    123 
     137/*----------------------------------------------------------------------------*/
     138/** Helper function for parsing value of active bit
     139 *
     140 * @param[in] instance TD structure to use.
     141 * @return Active bit value.
     142 */
    124143static inline bool td_is_active(td_t *instance)
    125144{
     
    127146        return (instance->status & TD_STATUS_ERROR_ACTIVE) != 0;
    128147}
    129 
    130 void td_print_status(td_t *instance);
     148/*----------------------------------------------------------------------------*/
     149/** Helper function for setting IOC bit.
     150 *
     151 * @param[in] instance TD structure to use.
     152 */
     153static inline void td_set_ioc(td_t *instance)
     154{
     155        assert(instance);
     156        instance->status |= TD_STATUS_IOC_FLAG;
     157}
     158/*----------------------------------------------------------------------------*/
    131159#endif
    132160/**
Note: See TracChangeset for help on using the changeset viewer.