USB 端点基类 / USB Endpoint base class.
EPNumber
端点号 Endpoint number
@ EP_MAX_NUM
端点数量上限 / Maximum number of endpoints
Direction
端点方向 Endpoint direction
USB端点池类 / USB endpoint pool class.
SlotUse use_[SLOT_COUNT][DIR_COUNT]
对应槽占用状态 / Per-slot usage
EndpointPool(size_t endpoint_num)
构造函数 / Constructor
static constexpr size_t DIR_COUNT
方向数量(OUT=0, IN=1)/ Number of direction slots (OUT=0, IN=1)
ErrorCode Put(Endpoint *ep)
登记一个端点到池中 / Register an endpoint into the pool
Endpoint * GetEndpoint0In()
获取端点0的IN对象 / Get Endpoint 0's IN object
void SetEndpoint0(Endpoint *ep0_in, Endpoint *ep0_out)
设置端点0的IN/OUT对象 / Set Endpoint 0 IN/OUT objects
ErrorCode Release(Endpoint *ep_info)
回收端点 / Release endpoint
SlotUse
槽占用状态 / Slot usage state
@ AVAILABLE
已登记、空闲可分配 / Registered and free to allocate
@ IN_USE
已分配、正在使用 / Allocated and in use
Endpoint * slots_[SLOT_COUNT][DIR_COUNT]
[端点号][方向] 端点指针 / [num][dir]
Endpoint * ep0_in_
端点0 IN对象 / Endpoint 0 IN pointer
ErrorCode FindEndpoint(uint8_t ep_addr, Endpoint *&ans)
查找端点/ Lookup endpoint
static constexpr size_t SLOT_COUNT
索引数组容量(端点号 0..EP_MAX_NUM-1)/ Index array size (endpoint numbers)
Endpoint * ep0_out_
端点0 OUT对象 / Endpoint 0 OUT pointer
Endpoint * GetEndpoint0Out()
获取端点0的OUT对象 / Get Endpoint 0's OUT object
static size_t DirIndex(Endpoint::Direction dir)
方向枚举转索引下标 / Convert direction enum to array index
ErrorCode Get(Endpoint *&ep_info, Endpoint::Direction direction, Endpoint::EPNumber ep_num)
分配端点 / Allocate endpoint