L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
IO interface

Typedefs

typedef l4vbus_resource_t l4io_resource_t
 Resource descriptor.
 
typedef l4vbus_device_t l4io_device_t
 Device descriptor.
 

Enumerations

enum  l4io_iomem_flags_t {
  L4IO_MEM_NONCACHED = 0 , L4IO_MEM_CACHED = 1 , L4IO_MEM_USE_MTRR = 2 , L4IO_MEM_ATTR_MASK = 0xf ,
  L4IO_MEM_WRITE_COMBINED = L4IO_MEM_USE_MTRR | L4IO_MEM_CACHED , L4IO_MEM_USE_RESERVED_AREA = 0x40 << 8 , L4IO_MEM_EAGER_MAP = 0x80 << 8
}
 Flags for IO memory. More...
 
enum  l4io_device_types_t {
  L4IO_DEVICE_INVALID = 0 , L4IO_DEVICE_PCI , L4IO_DEVICE_USB , L4IO_DEVICE_OTHER ,
  L4IO_DEVICE_ANY = ~0
}
 Device types. More...
 
enum  l4io_resource_types_t {
  L4IO_RESOURCE_INVALID = L4VBUS_RESOURCE_INVALID , L4IO_RESOURCE_IRQ = L4VBUS_RESOURCE_IRQ , L4IO_RESOURCE_MEM = L4VBUS_RESOURCE_MEM , L4IO_RESOURCE_PORT = L4VBUS_RESOURCE_PORT ,
  L4IO_RESOURCE_ANY = ~0
}
 Resource types. More...
 

Functions

long l4io_request_iomem (l4_addr_t phys, unsigned long size, int flags, l4_addr_t *virt)
 Request an IO memory region.
 
long l4io_request_iomem_region (l4_addr_t phys, l4_addr_t virt, unsigned long size, int flags)
 Request an IO memory region and map it to a specified region.
 
long l4io_release_iomem (l4_addr_t virt, unsigned long size)
 Release an IO memory region.
 
long l4io_request_ioport (unsigned portnum, unsigned len)
 Request an IO port region.
 
long l4io_release_ioport (unsigned portnum, unsigned len)
 Release an IO port region.
 
int l4io_lookup_device (const char *devname, l4io_device_handle_t *dev_handle, l4io_device_t *dev, l4io_resource_handle_t *res_handle)
 Find a device by name.
 
int l4io_lookup_resource (l4io_device_handle_t devhandle, enum l4io_resource_types_t type, l4io_resource_handle_t *reshandle, l4io_resource_t *res)
 Request a specific resource from a device description.
 
l4_addr_t l4io_request_resource_iomem (l4io_device_handle_t devhandle, l4io_resource_handle_t *reshandle)
 Request IO memory.
 
int l4io_has_resource (enum l4io_resource_types_t type, l4vbus_paddr_t start, l4vbus_paddr_t end)
 Check if a resource is available.
 

Detailed Description

Typedef Documentation

◆ l4io_resource_t

Resource descriptor.

For IRQ types, the end field is not used, i.e. only a single interrupt can be described with a l4io_resource_t

Definition at line 69 of file types.h.

Enumeration Type Documentation

◆ l4io_device_types_t

Device types.

Enumerator
L4IO_DEVICE_INVALID 

Invalid type.

L4IO_DEVICE_PCI 

PCI device.

L4IO_DEVICE_USB 

USB device.

L4IO_DEVICE_OTHER 

Any other device without unique IDs.

L4IO_DEVICE_ANY 

any type

Definition at line 38 of file types.h.

◆ l4io_iomem_flags_t

Flags for IO memory.

Enumerator
L4IO_MEM_NONCACHED 

Non-cache memory.

L4IO_MEM_CACHED 

Cache memory.

L4IO_MEM_USE_MTRR 

Use MTRR.

L4IO_MEM_USE_RESERVED_AREA 

Use reserved area for mapping I/O memory.

Flag only valid for l4io_request_iomem_region()

L4IO_MEM_EAGER_MAP 

Eagerly map the I/O memory.

Passthrough to the l4re-rm.

Definition at line 16 of file types.h.

◆ l4io_resource_types_t

Resource types.

Enumerator
L4IO_RESOURCE_INVALID 

Invalid type.

L4IO_RESOURCE_IRQ 

Interrupt resource.

L4IO_RESOURCE_MEM 

I/O memory resource.

L4IO_RESOURCE_PORT 

I/O port resource (x86 only)

L4IO_RESOURCE_ANY 

any type

Definition at line 50 of file types.h.

Function Documentation

◆ l4io_has_resource()

int l4io_has_resource ( enum l4io_resource_types_t  type,
l4vbus_paddr_t  start,
l4vbus_paddr_t  end 
)

Check if a resource is available.

Parameters
typeType of resource
startMinimal value.
endMaximum value.

◆ l4io_lookup_device()

int l4io_lookup_device ( const char *  devname,
l4io_device_handle_t *  dev_handle,
l4io_device_t dev,
l4io_resource_handle_t *  res_handle 
)

Find a device by name.

Parameters
devnameName of device.
[out]dev_handleDevice handle for found device, can be NULL.
[out]devDevice information, filled by the function, can be NULL.
[out]res_handleResource handle, can be NULL.
Returns
0 on success, error code otherwise

◆ l4io_lookup_resource()

int l4io_lookup_resource ( l4io_device_handle_t  devhandle,
enum l4io_resource_types_t  type,
l4io_resource_handle_t *  reshandle,
l4io_resource_t res 
)

Request a specific resource from a device description.

Parameters
devhandleDevice handle.
typeType of resource to request (see l4io_resource_types_t).
[in,out]reshandleResource handle, start with handle returned by device functions. The next resource handle is returned here.
[out]resDevice descriptor.
Returns
0 on success, error code otherwise, esp. -L4_ENOENT if no more resources found

◆ l4io_release_iomem()

long l4io_release_iomem ( l4_addr_t  virt,
unsigned long  size 
)

Release an IO memory region.

Parameters
virtVirtual address of region to free, see l4io_request_iomem
sizeSize of the region to release.
Returns
0 on success, <0 on error

◆ l4io_release_ioport()

long l4io_release_ioport ( unsigned  portnum,
unsigned  len 
)

Release an IO port region.

Parameters
portnumStart of port range to release
lenLength of range to request
Returns
0 on success, <0 on error
Note
X86 architecture only

◆ l4io_request_iomem()

long l4io_request_iomem ( l4_addr_t  phys,
unsigned long  size,
int  flags,
l4_addr_t virt 
)

Request an IO memory region.

Parameters
physPhysical address of the I/O memory region
sizeSize of the region in Bytes, granularity pages.
flagsSee l4io_iomem_flags_t
[in,out]virtVirtual address where the IO memory region should be mapped to. If the caller passes '0' a region in the caller's address space is searched and the virtual address is returned.
Return values
0Success.
-L4_ENOENTNo area in the caller's address space could be found to map the IO memory region.
-L4_EPERMOperation not allowed.
-L4_EINVALInvalid value.
-L4_EADDRNOTAVAILThe requested virtual address is not available.
-L4_ENOMEMThe requested IO memory region could not be allocated.
<0IPC errors.
Note
This function uses L4Re functionality to reserve a part of the virtual address space of the caller.

◆ l4io_request_iomem_region()

long l4io_request_iomem_region ( l4_addr_t  phys,
l4_addr_t  virt,
unsigned long  size,
int  flags 
)

Request an IO memory region and map it to a specified region.

Parameters
physPhysical address of the I/O memory region
virtVirtual address.
sizeSize of the region in Bytes, granularity pages.
flagsSee l4io_iomem_flags_t
Return values
0Success.
-L4_ENOENTNo area could be found to map the IO memory region.
-L4_EPERMOperation not allowed.
-L4_EINVALInvalid value.
-L4_EADDRNOTAVAILThe requested virtual address is not available.
-L4_ENOMEMThe requested IO memory region could not be allocated.
<0IPC errors.
Note
This function uses L4Re functionality to reserve a part of the virtual address space of the caller.

◆ l4io_request_ioport()

long l4io_request_ioport ( unsigned  portnum,
unsigned  len 
)

Request an IO port region.

Parameters
portnumStart of port range to request
lenLength of range to request
Returns
0 on success, <0 on error
Note
X86 architecture only

◆ l4io_request_resource_iomem()

l4_addr_t l4io_request_resource_iomem ( l4io_device_handle_t  devhandle,
l4io_resource_handle_t *  reshandle 
)

Request IO memory.

Parameters
devhandleDevice handle.
[in,out]reshandleResource handle from which IO memory should be requested. Upon successfull completion 'reshandle' points to the device's next resource.
Return values
0An error occured. The value of 'reshandle' is undefined.
>0The virtual address of the IO memory mapping.