|
libxr
1.0
Want to be the best embedded framework
|
STM32 USB 设备核心实现 / STM32 USB device core implementation. More...
#include <stm32_usb_dev.hpp>
Public Member Functions | |
| STM32USBDevice (PCD_HandleTypeDef *hpcd, stm32_usb_dev_id_t id, size_t max_ep_num, USB::DeviceDescriptor::PacketSize0 packet_size, uint16_t vid, uint16_t pid, uint16_t bcd, const std::initializer_list< const USB::DescriptorStrings::LanguagePack * > LANG_LIST, const std::initializer_list< const std::initializer_list< USB::ConfigDescriptorItem * > > CONFIGS, ConstRawData uid={nullptr, 0}, USB::Speed speed=USB::Speed::FULL, USB::USBSpec spec=USB::USBSpec::USB_2_1) | |
| 构造 USB 设备核心对象 / Construct USB device core object | |
| void | Init (bool in_isr) override |
| 初始化 / Initialize | |
| void | Deinit (bool in_isr) override |
| 反初始化 / Deinitialize | |
| void | Start (bool) override |
| 启动设备(由子类实现)/ Start device (implemented by derived class) | |
| void | Stop (bool) override |
| 停止设备(由子类实现)/ Stop device (implemented by derived class) | |
Public Member Functions inherited from LibXR::USB::EndpointPool | |
| EndpointPool (size_t endpoint_num) | |
| 构造函数 / Constructor | |
| ErrorCode | Get (Endpoint *&ep_info, Endpoint::Direction direction, Endpoint::EPNumber ep_num=Endpoint::EPNumber::EP_AUTO) |
| 分配端点 / Allocate endpoint | |
| ErrorCode | Release (Endpoint *ep_info) |
| 回收端点 / Release endpoint | |
| ErrorCode | FindEndpoint (uint8_t ep_addr, Endpoint *&ans) |
| 查找端点/ Lookup endpoint | |
| Endpoint * | GetEndpoint0Out () |
| 获取端点0的OUT对象 / Get Endpoint 0's OUT object | |
| 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 | |
Public Member Functions inherited from LibXR::USB::DeviceCore | |
| DeviceCore (EndpointPool &ep_pool, USBSpec spec, Speed speed, DeviceDescriptor::PacketSize0 packet_size, uint16_t vid, uint16_t pid, uint16_t bcd, const std::initializer_list< const DescriptorStrings::LanguagePack * > &lang_list, const std::initializer_list< const std::initializer_list< ConfigDescriptorItem * > > &configs, ConstRawData uid={nullptr, 0}) | |
| 构造函数 / Constructor | |
| void | OnSetupPacket (bool in_isr, const SetupPacket *setup) |
| 处理 Setup 包 / Handle Setup packet | |
Data Fields | |
| PCD_HandleTypeDef * | hpcd_ |
| stm32_usb_dev_id_t | id_ |
Data Fields inherited from LibXR::USB::DeviceCore | |
Static Public Attributes | |
| static STM32USBDevice * | map_ [STM32_USB_DEV_ID_NUM] = {} |
Additional Inherited Members | |
Public Types inherited from LibXR::USB::DeviceCore | |
| enum | Context : uint8_t { UNKNOWN = 0 , SETUP , DATA_OUT , STATUS_OUT , DATA_IN , STATUS_IN , ZLP } |
| 控制传输上下文 / Control transfer context More... | |
Protected Types inherited from LibXR::LockFreePool< Endpoint * > | |
| enum | SlotState |
| 槽状态 / Slot state More... | |
Protected Member Functions inherited from LibXR::LockFreePool< Endpoint * > | |
| Slot & | operator[] (uint32_t index) |
| LockFreePool (uint32_t slot_count) | |
| 构造对象池 / Constructor for the pool | |
| ~LockFreePool () | |
| 析构,释放槽池内存 / Destructor, releasing pool memory | |
| ErrorCode | Put (const Endpoint *&data) |
| 向池中放入一个元素 / Put an element into the pool | |
| ErrorCode | Put (const Endpoint *&data, uint32_t &start_index) |
| 向池中放入一个元素,返回起始槽索引 / Put an element into the pool and return the starting slot index | |
| ErrorCode | PutToSlot (const Endpoint *&data, uint32_t index) |
| 向指定槽放入一个元素 / Put an element into a specific slot | |
| ErrorCode | Get (Endpoint *&data) |
| 从池中取出一个元素 / Retrieve an element from the pool | |
| ErrorCode | Get (Endpoint *&data, uint32_t &start_index) |
| 从指定槽位开始,取出一个元素 / Retrieve an element from the pool | |
| ErrorCode | GetFromSlot (Endpoint *&data, uint32_t index) |
| 从指定槽位开始,取出一个元素 / Retrieve an element from the pool | |
| ErrorCode | RecycleSlot (uint32_t index) |
| 回收指定槽位 / Recycle a slot | |
| size_t | Size () const |
| 查询池中可取元素数量 / Query the number of available elements in the pool | |
| size_t | EmptySize () |
| 查询当前池可用槽数量 / Query the number of writable slots in the pool | |
| uint32_t | SlotCount () const |
| 获取槽总数 / Get the total number of slots in the pool | |
Protected Member Functions inherited from LibXR::USB::DeviceCore | |
| virtual ErrorCode | SetAddress (uint8_t address, Context state)=0 |
| 设置设备地址(由子类实现) Set device address (implemented by derived class). | |
| virtual void | EnableRemoteWakeup () |
| 启用远程唤醒 / Enable remote wakeup | |
| virtual void | DisableRemoteWakeup () |
| 禁用远程唤醒 / Disable remote wakeup | |
| virtual bool | IsRemoteWakeupEnabled () const |
| 远程唤醒是否启用 / Whether remote wakeup is enabled | |
| Speed | GetSpeed () const |
| 获取设备速度 / Get device speed | |
STM32 USB 设备核心实现 / STM32 USB device core implementation.
Definition at line 21 of file stm32_usb_dev.hpp.
|
inline |
构造 USB 设备核心对象 / Construct USB device core object
Definition at line 27 of file stm32_usb_dev.hpp.
|
inlineoverridevirtual |
反初始化 / Deinitialize
| in_isr | 是否在 ISR / Whether in ISR context |
Reimplemented from LibXR::USB::DeviceCore.
Definition at line 47 of file stm32_usb_dev.hpp.
|
inlineoverridevirtual |
初始化 / Initialize
| in_isr | 是否在 ISR / Whether in ISR context |
Reimplemented from LibXR::USB::DeviceCore.
Definition at line 45 of file stm32_usb_dev.hpp.
|
inlineoverridevirtual |
启动设备(由子类实现)/ Start device (implemented by derived class)
| in_isr | 是否在 ISR / Whether in ISR context |
Implements LibXR::USB::DeviceCore.
Definition at line 49 of file stm32_usb_dev.hpp.
|
inlineoverridevirtual |
停止设备(由子类实现)/ Stop device (implemented by derived class)
| in_isr | 是否在 ISR / Whether in ISR context |
Implements LibXR::USB::DeviceCore.
Definition at line 50 of file stm32_usb_dev.hpp.
| PCD_HandleTypeDef* LibXR::STM32USBDevice::hpcd_ |
Definition at line 52 of file stm32_usb_dev.hpp.
| stm32_usb_dev_id_t LibXR::STM32USBDevice::id_ |
Definition at line 53 of file stm32_usb_dev.hpp.
|
inlinestatic |
Definition at line 54 of file stm32_usb_dev.hpp.