Mercurial > archived > louis > epitech > mq > rathaxes
view rathaxes_samples_e1000_add_a_dma_abstraction.patch @ 111:b072f682823d
Start a new series to refactor e1000::set_up_device
author | Louis Opter <louis@lse.epita.fr> |
---|---|
date | Sun, 14 Jul 2013 23:14:33 -0700 |
parents | |
children | bfe10def90e3 |
line wrap: on
line source
# HG changeset patch # Parent 0f12e80e810de1a9927db1f25dbea49acd73ae3c e1000: start a DMA allocation/mapping abstraction It currently matches a lot the Linux DMA API but it should be usable by other OSes too. The Linux DMA API is described at the end of the chapter 15 in the LDD3. This will be useful to remove Linux specific DMA code from e1000::set_up_device which should be only device independent code. diff --git a/rathaxes/samples/e1000/dma.rti b/rathaxes/samples/e1000/dma.rti new file mode 100644 --- /dev/null +++ b/rathaxes/samples/e1000/dma.rti @@ -0,0 +1,34 @@ +interface DMA : Builtin, LKM, Device +{ + provided type AbstractDMAHandle + { + chunk LKM::includes(); + decl data_types(); + attribute Builtin::symbol.scalar k_dma_handle; + } + + provided type Direction + { + decl data_types(); + } + + provided sequence map(Device::AbstractDevice, Builtin::symbol, Builtin::number, Direction) + { + provided chunk ::CALL(); /* -> AbstractDMAHandle */ + } + + provided sequence unmap(Device::AbstractDevice, AbstractDMAHandle, Builtin::number, Direction) + { + provided chunk ::CALL(); + } + + provided sequence alloc_coherent(Device::AbstractDevice, Builtin::number, Builtin::symbol) + { + provided chunk ::CALL(); /* -> AbstractDMAHandle + addr returned via the symbol */ + } + + provided sequence free_coherent(Device::AbstractDevice, Builtin::number, Builtin::symbol, AbstractDMAHandle) + { + provided chunk ::CALL(); + } +}