71 #define iob_reserve( iobuf, len ) ( { \ 73 __result = iob_reserve ( (iobuf), (len) ); \ 74 assert ( (iobuf)->tail <= (iobuf)->end ); \ 88 #define iob_push( iobuf, len ) ( { \ 90 __result = iob_push ( (iobuf), (len) ); \ 91 assert ( (iobuf)->data >= (iobuf)->head ); \ 106 #define iob_pull( iobuf, len ) ( { \ 108 __result = iob_pull ( (iobuf), (len) ); \ 109 assert ( (iobuf)->data <= (iobuf)->tail ); \ 120 void *old_tail = iobuf->
tail;
124 #define iob_put( iobuf, len ) ( { \ 126 __result = iob_put ( (iobuf), (len) ); \ 127 assert ( (iobuf)->tail <= (iobuf)->end ); \ 139 #define iob_unput( iobuf, len ) do { \ 140 iob_unput ( (iobuf), (len) ); \ 141 assert ( (iobuf)->tail >= (iobuf)->data ); \ 160 return ( iobuf->
tail - iobuf->
data );
170 return ( iobuf->
data - iobuf->
head );
180 return ( iobuf->
end - iobuf->
tail );
195 void *
data,
size_t len,
size_t max_len ) {
198 iobuf->
end = (
data + max_len );
216 #define iob_disown( iobuf ) ( { \ 217 struct io_buffer *__iobuf = (iobuf); \ #define iob_pull(iobuf, len)
#define DMA_TX
Device will read data from host memory.
#define iob_put(iobuf, len)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
struct io_buffer *__malloc alloc_rx_iob(size_t len, struct dma_device *dma)
Allocate and map I/O buffer for receive DMA.
struct dma_mapping map
DMA mapping.
struct io_buffer * iob_concatenate(struct list_head *list)
Concatenate I/O buffers into a single buffer.
#define iob_push(iobuf, len)
void dma_unmap(struct dma_mapping *map, size_t len)
Unmap buffer.
#define DMA_RX
Device will write data to host memory.
static __always_inline int iob_map(struct io_buffer *iobuf, struct dma_device *dma, size_t len, int flags)
Map I/O buffer for DMA.
static void iob_populate(struct io_buffer *iobuf, void *data, size_t len, size_t max_len)
Create a temporary I/O buffer.
A doubly-linked list entry (or list head)
static __always_inline int iob_map_tx(struct io_buffer *iobuf, struct dma_device *dma)
Map I/O buffer for transmit DMA.
void free_rx_iob(struct io_buffer *iobuf)
Unmap and free I/O buffer for receive DMA.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static __always_inline void iob_unmap(struct io_buffer *iobuf)
Unmap I/O buffer for DMA.
static __always_inline physaddr_t iob_dma(struct io_buffer *iobuf)
Get I/O buffer DMA address.
static void iob_empty(struct io_buffer *iobuf)
Empty an I/O buffer.
struct io_buffer *__malloc alloc_iob(size_t len)
Allocate I/O buffer.
#define iob_unput(iobuf, len)
struct io_buffer * iob_split(struct io_buffer *iobuf, size_t len)
Split I/O buffer.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define __always_inline
Declare a function to be always inline.
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
void * end
End of the buffer.
struct io_buffer *__malloc alloc_iob_raw(size_t len, size_t align, size_t offset)
Allocate I/O buffer with specified alignment and offset.
#define iob_reserve(iobuf, len)
static size_t iob_headroom(struct io_buffer *iobuf)
Calculate available space at start of an I/O buffer.
struct list_head list
List of which this buffer is a member.
static __always_inline int iob_map_rx(struct io_buffer *iobuf, struct dma_device *dma)
Map empty I/O buffer for receive DMA.
#define __malloc
Declare a pointer returned by a function as a unique memory address as returned by malloc-type functi...
void * head
Start of the buffer.
void * data
Start of data.
uint8_t data[48]
Additional event data.
uint16_t offset
Offset to command line.
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
int iob_ensure_headroom(struct io_buffer *iobuf, size_t len)
Ensure I/O buffer has sufficient headroom.
void iob_pad(struct io_buffer *iobuf, size_t min_len)
Pad I/O buffer.