xheep_gen.peripherals.abstractions module
- class xheep_gen.peripherals.abstractions.BasePeripheral(offset=None, length=None)
Bases:
Peripheral,ABCAbstract class representing always-on peripherals. This class cannot be instantiated.
- class xheep_gen.peripherals.abstractions.Peripheral(offset=None, length=None)
Bases:
ABCBasic description of a peripheral. These peripherals are not linked to a hjson file, they only have a memory range. This class cannot be instantiated.
- Parameters:
- get_address()
- Returns:
The virtual (in peripheral domain) memory address of the peripheral. If not set, return None.
- Return type:
- set_address(address)
Set the virtual (in peripheral domain) memory address of the peripheral.
- class xheep_gen.peripherals.abstractions.PeripheralDomain(name: str, start_address: int, length: int)
Bases:
ABCAbstract class representing a peripheral domain. This class cannot be instantiated.
- Parameters:
name (str) – The name of the peripheral domain. Convention : starts with a capital letter and is in singular form (no “peripheral domain” at the end)
start_address (int) – The start address of the peripheral domain.
length (int) – The length of the peripheral domain.
peripherals (list[Peripheral]) – The list of peripherals in the domain. There can be more than one instance of the same peripheral.
- abstract add_peripheral(peripheral: Peripheral)
Add a peripheral to the domain. The peripheral should be fully configured when added. If the peripheral has no offset, it will be automatically computed during build. Must be defined by the subclass.
- Parameters:
peripheral (Peripheral) – The peripheral to add.
- build()
Build the peripheral domain. This function will compute the offset of the peripherals that have no offset.
- contains_peripheral(peripheral_name: str)
Check if the peripheral domain contains a peripheral with the given name.
- get_peripherals()
- Returns:
A copy of the list of peripherals in the domain.
- Return type:
- abstract remove_peripheral(peripheral: Peripheral)
Remove a peripheral from the domain. Must be defined by the subclass.
- Parameters:
peripheral (Peripheral) – The peripheral to remove.
- validate()
Validate the peripheral domain.
Checks if the peripherals do not overlap and if the peripheral domain is within the bounds.
- class xheep_gen.peripherals.abstractions.UserPeripheral(offset=None, length=None)
Bases:
Peripheral,ABCAbstract class representing user-configurable peripherals. This class cannot be instantiated.