STRUCT XUSB_UDC(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct xusb_udc(9)

okay so welcome to the Kernel API Manual, bestie πŸ’– β€” this is the page for struct xusb_udc, and it's literally the whole personality of the USB peripheral driver. She's a struct, she's got a spinlock, she's got function pointers, she's booked and busy. Let's get into it πŸŽ€


🌸 NAME 🌸

struct xusb_udc β€” USB peripheral driver structure. that's the vibe. no cap 🫢


✨ SYNOPSIS ✨

here's the whole fit, character for character, don't touch a single brace:

struct xusb_udc {
    struct usb_gadget gadget;
    struct xusb_ep ep[8];
    struct usb_gadget_driver *driver;
    struct usb_ctrlrequest setup;
    struct xusb_req *req;
    struct device *dev;
    u32 usb_state;
    u32 remote_wkp;
    u32 setupseqtx;
    u32 setupseqrx;
    void __iomem *addr;
    spinlock_t lock;
    bool dma_enabled;
    struct clk *clk;
    unsigned int (*read_fn)(void __iomem *reg);
    void (*write_fn)(void __iomem *, u32, u32);
 };

she's giving very much "i contain multitudes" πŸ’€


πŸ¦‹ Members πŸ¦‹

okay so let's do a member-by-member vibe check, everyone gets their moment πŸ‘‘

  • gadget β€” the USB gadget driver instance. this is her main character energy, the actual gadget herself ✨
  • ep β€” an array of endpoint structures. yes, an array, the endpoints are matching besties 🫢
  • driver β€” pointer to the usb gadget driver instance. it's a pointer, it points, that's the job πŸ’…
  • setup β€” a usb_ctrlrequest structure for control requests. control requests said "i'll handle it" πŸŽ€
  • req β€” pointer to a dummy request for the get status command. dummy request, real job πŸ“
  • dev β€” pointer to the device structure in the gadget. the device, in the gadget, as one does πŸ¦‹
  • usb_state β€” tells you whether the device is in a suspended state or not. she keeps receipts πŸ’€
  • remote_wkp β€” remote wakeup enabled by host. host said yes, lowkey 🌸
  • setupseqtx β€” tx status. that's it, that's the member πŸ“€
  • setupseqrx β€” rx status. same energy, incoming πŸ“₯
  • addr β€” the usb device base address. like, the address. the base one. iconic 🌈
  • lock β€” an instance of spinlock. spinlock said "i will be spinning" πŸ’«
  • dma_enabled β€” flag indicating whether the dma is included in the system. a bool, a whole yes-or-no moment ⭐
  • clk β€” pointer to struct clk. clock said hi πŸ•
  • read_fn β€” function pointer to read device registers. she reads πŸ’–
  • write_fn β€” function pointer to write to device registers. and she writes πŸ’œ
ngl the function pointers are the slay of this whole struct β€” read_fn/write_fn are void __iomem * coded and everything, exactly like the synopsis says, don't come for me πŸ’…

πŸ”₯ SEE ALSO πŸ”₯

like, the whole friend group lives in the Kernel file ./drivers/usb/gadget/udc/udc-xilinx.c β€” go say hi to struct xusb_req(9), struct xusb_ep(9), xudc_write32(9), xudc_read32(9), xudc_write32_be(9), xudc_read32_be(9), xudc_wrstatus(9), xudc_epconfig(9), xudc_start_dma(9), xudc_dma_send(9), xudc_dma_receive(9), xudc_eptxrx(9), xudc_done(9), xudc_read_fifo(9), xudc_write_fifo(9), xudc_nuke(9), xudc_ep_set_halt(9), __xudc_ep_enable(9), xudc_ep_enable(9), xudc_ep_disable(9), xudc_ep_alloc_request(9), xudc_free_request(9), __xudc_ep0_queue(9), xudc_ep0_queue(9), xudc_ep_queue(9), xudc_ep_dequeue(9), xudc_ep0_enable(9), xudc_ep0_disable(9), xudc_get_frame(9), xudc_wakeup(9), xudc_pullup(9), xudc_eps_init(9), xudc_stop_activity(9), xudc_start(9), xudc_stop(9), xudc_clear_stall_all_ep(9), xudc_startup_handler(9), xudc_ep0_stall(9), xudc_setaddress(9), xudc_getstatus(9), xudc_set_clear_feature(9), xudc_handle_setup(9), xudc_ep0_out(9), xudc_ep0_in(9), xudc_ctrl_ep_handler(9), xudc_nonctrl_ep_handler(9), xudc_irq(9), xudc_probe(9), xudc_remove(9).


and that's the page, bestie 🧚 β€” brought to you from ./drivers/usb/gadget/udc, dated October 2026, and honestly the date understood the assignment too πŸ“…πŸ’– mwah, go read some kernel source πŸŽ€

πŸ“¦ where this page comes from