Changeset eb0dc58 in mainline


Ignore:
Timestamp:
2011-03-13T13:59:19Z (14 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

Location:
uspace/drv/uhci-hcd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/batch.c

    r67352d2 reb0dc58  
    319319                ++packet;
    320320        }
    321         instance->tds[packet - 1].status |= TD_STATUS_IOC_FLAG;
     321        td_set_ioc(&instance->tds[packet - 1]);
    322322        device_keeper_set_toggle(instance->manager, instance->target, toggle);
    323323}
     
    371371            0, 1, false, low_speed, instance->target, status_stage, NULL, NULL);
    372372
    373 
    374         instance->tds[packet].status |= TD_STATUS_IOC_FLAG;
     373        td_set_ioc(&instance->tds[packet]);
    375374        usb_log_debug2("Control last TD status: %x.\n",
    376375            instance->tds[packet].status);
  • uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.c

    r67352d2 reb0dc58  
    4444 * @param[in] size Size of data source.
    4545 * @param[in] toggle Value of toggle bit.
    46  * @param[in] iso True if TD is for Isochronous transfer.
     46 * @param[in] iso True if TD represents Isochronous transfer.
    4747 * @param[in] low_speed Target device's speed.
    4848 * @param[in] target Address and endpoint receiving the transfer.
     
    5151 * @param[in] next Net TD in transaction.
    5252 * @return Error code.
     53 *
     54 * Uses a mix of supplied and default values.
     55 * Implicit values:
     56 *  - all TDs have vertical flag set (makes transfers to endpoints atomic)
     57 *  - in the error field only active it is set
     58 *  - if the packet uses PID_IN and is not isochronous SPD is set
     59 *
     60 * Dumps 8 bytes of buffer if PID_SETUP is used.
    5361 */
    5462void td_init(td_t *instance, int err_count, size_t size, bool toggle, bool iso,
     
    94102        if (pid == USB_PID_SETUP) {
    95103                usb_log_debug("SETUP BUFFER: %s\n",
    96                         usb_debug_str_buffer(buffer, 8, 8));
     104                    usb_debug_str_buffer(buffer, 8, 8));
    97105        }
    98106}
     
    128136}
    129137/*----------------------------------------------------------------------------*/
     138/** Print values in status field (dw1) in a human readable way.
     139 *
     140 * @param[in] instance TD structure to use.
     141 */
    130142void td_print_status(td_t *instance)
    131143{
  • 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.