AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
platform.h File Reference
#include <core/types.h>
#include <cpu/io.h>

Go to the source code of this file.

Data Structures

struct  platform_device
 A device of the platform's table. More...

Macros

#define PLATFORM_IRQS   2

Functions

const struct platform_device * platform_device_get (const char *name, int index)
 Finds one of the platform's devices by its driver's name.
int platform_device_io (const struct platform_device *pd, struct ioaddr *io)
 Gets a device's registers, ready for io_in8() and the others.

Variables

const struct platform_device platform_devices []

Macro Definition Documentation

◆ PLATFORM_IRQS

#define PLATFORM_IRQS   2

Definition at line 17 of file platform.h.

Function Documentation

◆ platform_device_get()

const struct platform_device * platform_device_get ( const char * name,
int index )

Finds one of the platform's devices by its driver's name.

Parameters
namethe driver's name ("8250", "pl011", "i8042", ...)
indexwhich of the devices with that name: 0 for the first
Returns
the device, or NULL if there are not that many

Definition at line 21 of file platform.c.

References platform_device::name, NULL, platform_device_get(), and platform_devices.

Referenced by i8042_init(), pl011_init(), platform_device_get(), and uart_8250_init().

◆ platform_device_io()

int platform_device_io ( const struct platform_device * pd,
struct ioaddr * io )

Gets a device's registers, ready for io_in8() and the others.

Ports are used as they are; memory-mapped registers are mapped first.

Parameters
pdthe device
ioset to its registers
Returns
0, or -ENOMEM if they couldn't be mapped

Definition at line 38 of file platform.c.

References ioaddr::addr, arch_mmio_map(), platform_device::io, IOADDR_PORT, platform_device_io(), platform_device::size, and ioaddr::type.

Referenced by i8042_init(), pl011_init(), platform_device_io(), and uart_8250_attach().

Variable Documentation

◆ platform_devices

const struct platform_device platform_devices[]
extern

Definition at line 11 of file devices.c.

Referenced by platform_device_get().