SyterKit 0.4.0.x
SyterKit is a bare-metal framework
Loading...
Searching...
No Matches
Functions
usb_dma.h File Reference
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include "reg/reg-usb.h"
Include dependency graph for usb_dma.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int usb_dma_init (uint64_t husb)
 Initialize USB DMA.
 
int usb_dma_request (void)
 Request a USB DMA channel.
 
int usb_dma_release (uint32_t dma_index)
 Release a USB DMA channel.
 
int usb_dma_setting (uint32_t dma_index, uint32_t trans_dir, uint32_t ep)
 Set the parameters of a USB DMA channel.
 
int usb_dma_set_pktlen (uint32_t dma_index, uint32_t pkt_len)
 Set the packet length of a USB DMA channel.
 
int usb_dma_start (uint32_t dma_index, uint32_t addr, uint32_t bytes)
 Start a USB DMA transfer.
 
int usb_dma_stop (uint32_t dma_index)
 Stop a USB DMA transfer.
 
int usb_dma_int_query (uint32_t dma_index)
 Query the interrupt status of a USB DMA channel.
 
int usb_dma_int_clear (void)
 Clear the interrupt status of all USB DMA channels.
 

Function Documentation

◆ usb_dma_init()

int usb_dma_init ( uint64_t  husb)

Initialize USB DMA.

This function is used to initialize USB DMA.

Parameters
husbThe USB controller handle
Returns
0 on success

◆ usb_dma_int_clear()

int usb_dma_int_clear ( void  )

Clear the interrupt status of all USB DMA channels.

This function is used to clear the interrupt status of all USB DMA channels.

Returns
0 on success, -1 on failure

◆ usb_dma_int_query()

int usb_dma_int_query ( uint32_t  dma_index)

Query the interrupt status of a USB DMA channel.

This function is used to query the interrupt status of a USB DMA channel.

Parameters
dma_indexThe DMA index to query
Returns
The interrupt status of the DMA channel

◆ usb_dma_release()

int usb_dma_release ( uint32_t  dma_index)

Release a USB DMA channel.

This function is used to release a USB DMA channel.

Parameters
dma_indexThe DMA index to release
Returns
0 on success, -1 on failure

◆ usb_dma_request()

int usb_dma_request ( void  )

Request a USB DMA channel.

This function is used to request a USB DMA channel.

Returns
The DMA index on success, 0 if no available DMA channel is found

◆ usb_dma_set_pktlen()

int usb_dma_set_pktlen ( uint32_t  dma_index,
uint32_t  pkt_len 
)

Set the packet length of a USB DMA channel.

This function is used to set the packet length of a USB DMA channel.

Parameters
dma_indexThe DMA index to configure
pkt_lenThe packet length to set
Returns
0 on success, -1 on failure

◆ usb_dma_setting()

int usb_dma_setting ( uint32_t  dma_index,
uint32_t  trans_dir,
uint32_t  ep 
)

Set the parameters of a USB DMA channel.

This function is used to set the parameters of a USB DMA channel.

Parameters
dma_indexThe DMA index to configure
trans_dirThe transfer direction (IN or OUT)
epThe endpoint number
Returns
0 on success, -1 on failure

◆ usb_dma_start()

int usb_dma_start ( uint32_t  dma_index,
uint32_t  addr,
uint32_t  bytes 
)

Start a USB DMA transfer.

This function is used to start a USB DMA transfer.

Parameters
dma_indexThe DMA index to use
addrThe address of the buffer for the transfer
bytesThe number of bytes to transfer
Returns
0 on success, -1 on failure

◆ usb_dma_stop()

int usb_dma_stop ( uint32_t  dma_index)

Stop a USB DMA transfer.

This function is used to stop a USB DMA transfer.

Parameters
dma_indexThe DMA index to stop
Returns
0 on success, -1 on failure