STRUCT CDNS3_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME

okay bestie, welcome to the Kernel API Manual page for struct cdns3_device(9) β€” and the NAME is literally: struct cdns3_device β€” represent USB device. That’s the whole vibe: this struct is how the driver represents a USB device. πŸ¦‹

✨ SYNOPSIS

Here’s the struct in all its glory, copied exactly so you can trust it:

struct cdns3_device {
    struct device                   *dev;
    struct device                   *sysdev;
    struct usb_gadget               gadget;
    struct usb_gadget_driver        *gadget_driver;
  #define CDNS_REVISION_V0                0x00024501;
  #define CDNS_REVISION_V1                0x00024509;
    u32 dev_ver;
    spinlock_t lock;
    struct cdns3_usb_regs           __iomem *regs;
    struct dma_pool                 *eps_dma_pool;
    struct usb_ctrlrequest          *setup_buf;
    dma_addr_t setup_dma;
    void *zlp_buf;
    u8 ep0_stage;
    int ep0_data_dir;
    struct cdns3_endpoint           *eps[CDNS3_ENDPOINTS_MAX_COUNT];
    struct list_head                aligned_buf_list;
    struct work_struct              aligned_buf_wq;
    u32 selected_ep;
    u16 isoch_delay;
    unsigned wait_for_setup:1;
    unsigned u1_allowed:1;
    unsigned u2_allowed:1;
    unsigned is_selfpowered:1;
    unsigned setup_pending:1;
    unsigned hw_configured_flag:1;
    unsigned wake_up_flag:1;
    unsigned status_completion_no_call:1;
    unsigned using_streams:1;
    int out_mem_is_allocated;
    struct work_struct              pending_status_wq;
    struct usb_request              *pending_status_request;
    u16 onchip_buffers;
    u16 onchip_used_size;
    u16 ep_buf_size;
    u16 ep_iso_burst;
};

Also peep the two revision defines living inside the struct: CDNS_REVISION_V0 is 0x00024501, and CDNS_REVISION_V1 is 0x00024509. Slay. πŸŽ€

πŸŽ€ Members

  • dev β€” pointer to the device structure associated with this controller.
  • sysdev β€” pointer to the DMA capable device.
  • gadget β€” device side representation of the peripheral controller.
  • gadget_driver β€” pointer to the gadget driver.
  • dev_ver β€” device controller version. πŸ‘‘
  • lock β€” for synchronizing.
  • regs β€” base address for device side registers.
  • setup_buf β€” used while processing USB control requests.
  • setup_dma β€” DMA address for setup_buf.
  • zlp_buf β€” zlp buffer.
  • ep0_stage β€” ep0 stage during the enumeration process.
  • ep0_data_dir β€” direction for control transfer.
  • eps β€” array of pointers to all endpoints, with ep0 excluded. The array is eps[CDNS3_ENDPOINTS_MAX_COUNT]. ✨
  • aligned_buf_list β€” list of aligned buffers internally allocated by driver.
  • aligned_buf_wq β€” workqueue freeing no longer used aligned buf.
  • selected_ep β€” actually selected endpoint. It’s used only to improve performance.
  • isoch_delay β€” value from Set Isoch Delay request. Only valid on SS/SSP.
  • u1_allowed:1 β€” allow device transition to u1 state.
  • u2_allowed:1 β€” allow device transition to u2 state.
  • is_selfpowered:1 β€” device is self powered.
  • setup_pending:1 β€” setup packet is processing by gadget driver.
  • hw_configured_flag:1 β€” hardware endpoint configuration was set.
  • wake_up_flag:1 β€” allow device to remote up the host.
  • status_completion_no_call:1 β€” indicate that driver is waiting for status s stage completion. It’s used in deferred SET_CONFIGURATION request.
  • pending_status_wq β€” workqueue handling status stage for deferred requests.
  • pending_status_request β€” request for which status stage was deferred.
  • onchip_buffers β€” number of available on-chip buffers.
  • onchip_used_size β€” actual size of on-chip memory assigned to endpoints.

🌸 Struct-only cameos (no separate member blurb in the original)

  • eps_dma_pool β€” it’s in the struct as struct dma_pool *eps_dma_pool;; the Members list doesn’t give it its own description here.
  • wait_for_setup:1 β€” bitfield in the struct, no separate member blurb in the original.
  • using_streams:1 β€” bitfield in the struct, no separate member blurb in the original.
  • out_mem_is_allocated β€” int in the struct, no separate member blurb in the original.
  • ep_buf_size β€” u16 in the struct, no separate member blurb in the original.
  • ep_iso_burst β€” u16 in the struct, no separate member blurb in the original.

🌈 SEE ALSO

Kernel file ./drivers/usb/cdns3/cdns3-gadget.h:

  • struct cdns3_usb_regs(9)
  • struct cdns3_trb(9)
  • struct cdns3_endpoint(9)
  • struct cdns3_aligned_buf(9)
  • struct cdns3_request(9)

xoxo, this page lives under source/version ./drivers/usb/cdns3 and is dated October 2026 β€” go be iconic with your USB gadget struct, bestie! πŸ’…βœ¨

πŸ“¦ where this page comes from