HelenOS sources
This source file includes following definitions.
- td_active
- td_remain_size
#ifndef DRV_EHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
#define DRV_EHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
#include <stddef.h>
#include <stdint.h>
#include <macros.h>
#include "link_pointer.h"
#include "mem_access.h"
typedef struct td {
link_pointer_t next;
link_pointer_t alternate;
volatile uint32_t status;
volatile uint32_t buffer_pointer[5];
volatile uint32_t extended_bp[5];
} __attribute__((packed, aligned(32))) td_t;
#define TD_STATUS_TOGGLE_FLAG (1 << 31)
#define TD_STATUS_TOTAL_MASK 0x7fff
#define TD_STATUS_TOTAL_SHIFT 16
#define TD_STATUS_IOC_FLAG (1 << 15)
#define TD_STATUS_C_PAGE_MASK 0x7
#define TD_STATUS_C_PAGE_SHIFT 12
#define TD_STATUS_CERR_MASK 0x3
#define TD_STATUS_CERR_SHIFT 10
#define TD_STATUS_PID_MASK 0x3
#define TD_STATUS_PID_SHIFT 8
#define TD_STATUS_PID_OUT 0x0
#define TD_STATUS_PID_IN 0x1
#define TD_STATUS_PID_SETUP 0x2
#define TD_STATUS_ACTIVE_FLAG (1 << 7)
#define TD_STATUS_HALTED_FLAG (1 << 6)
#define TD_STATUS_BUFF_ERROR_FLAG (1 << 5)
#define TD_STATUS_BABBLE_FLAG (1 << 4)
#define TD_STATUS_TRANS_ERR_FLAG (1 << 3)
#define TD_STATUS_MISSED_FLAG (1 << 2)
#define TD_STATUS_SPLIT_FLAG (1 << 1)
#define TD_STATUS_PING_FLAG (1 << 0)
#define TD_BUFFER_POINTER_MASK 0xfffff000
#define TD_BUFFER_POINTER_OFFSET_MASK 0xfff
static_assert(sizeof(td_t) % 32 == 0, "");
static inline bool td_active(const td_t *td)
{
assert(td);
return (EHCI_MEM32_RD(td->status) & TD_STATUS_HALTED_FLAG) != 0;
}
static inline size_t td_remain_size(const td_t *td)
{
assert(td);
return (EHCI_MEM32_RD(td->status) >> TD_STATUS_TOTAL_SHIFT) &
TD_STATUS_TOTAL_MASK;
}
errno_t td_error(const td_t *td);
void td_init(td_t *td, uintptr_t next_phys, uintptr_t buf, usb_direction_t dir,
size_t buf_size, int toggle, bool ioc);
#endif
HelenOS homepage, sources at GitHub