STRUCT XUSB_UDC(9)
π 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β ausb_ctrlrequeststructure 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 tostruct 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_fnarevoid __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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms