Showing changes from revision #2 to #3:
Added | Removed | Changed
Currently, only API versions 0, 0.1 and 1 are defined.
struct dmacontroller { /* Public interface */ struct device dev; uint32_t (*Features)(struct dmacontroller *); __value_in_regs struct { struct dmachannel **channel; uint32_t count; } (*Enumerate)(struct dmacontroller *); struct dmachannel *(*Allocate)(struct dmacontroller *, uint32_t channel); void (*Deallocate)(struct dmacontroller *, uint32_t channel); };
dev is the standard HAL Device descriptor. The address field is not used. Controllers are activated/deactivated on module initialisation/finalisation. dev.Reset is called on software-initiated OS resets. Interrupts are ignored – provide them using the DMA channel device instead.
Features returns a flag word indicating the capabilities of the controller. Currently no bits are defined; all bits should be zero.
Enumerate returns a static list of available physical DMA channel devices (Pointers to DMA buffer or DMA list devices)
Allocate returns a pointer to the physical DMA channel struct to associate with the given logical DMA channel. If the hardware requires a particular logical-physical mapping, this will be obeyed; otherwise one will be allocated at the whim of the software (typically: physical channels grouped according to priority of logical channel, then within each group logical channels are allocated on a one-to-one mapping until no physical channels remain, after which logical channels are arbitrarily doubled up). Return value NULL => this logical channel not supported on this controller
Recommended DMA priorities:
Deallocate is the partner of Allocate, this lets the device know that a particular logical channel is no longer being used.
API version 0.1 extends the dmacontroller struct:
struct dmacontroller_0_1 { /* Version 0 interface */ struct dmacontroller dev; /* 0.1 extension */ int32_t TestIRQ2(struct device *); }
The TestIRQ2 function allows the controller to take on the role of identifying which physical DMA channel is the cause of the current interrupt. This is useful in situations where all the physical DMA channels share the same IRQ number, and the DMA controller contains a flag word indicating which channel(s) are currently interrupting.
If TestIRQ2 is provided, then the following rules must be followed:
TestIRQ should return the index of the channel that is interrupting (relative to the list returned by Enumerate), or -1 if no channel is interrupting.
If TestIRQ is not provided, behaviour is as per API version 0.
API version 1 refines the specification of Deallocate:
void (*Deallocate)(struct dmacontroller *, uint32_t channel, struct device *dev);
The dev parameter is a pointer to the channel device that is being deallocated.
For both list-based and buffer-based DMA channels, it is the responsibility of the HAL device to ensure that the correct data read/write barriers are used where appropriate. Typically this means that:
The above covers situations where the HAL device should use barriers. The following covers situations where the client (e.g. a DMAManager client) should use barriers:
HALDeviceSysPeri_DMAC is supported by the trunk branch version of theDMAManager module.
Device ID | Description | Implemented in |
---|---|---|
HALDeviceID_DMAC_M1535 | Acer M1535+ legacy DMA controller | HAL.Tungsten.s.M1535DMA |
HALDeviceID_DMAC_M5229 | Acer M5229 ATA controller bus master | HAL.Tungsten.s.ATA |
HALDeviceID_DMAC_OMAP3 | OMAP3 system DMA controller | HAL.OMAP3.s.SDMA |