1.1 --- a/pkg/devices/lib/dma/src/jz4780.cc Wed Apr 24 00:47:34 2024 +0200
1.2 +++ b/pkg/devices/lib/dma/src/jz4780.cc Sat Apr 27 23:46:28 2024 +0200
1.3 @@ -20,6 +20,7 @@
1.4 * Boston, MA 02110-1301, USA
1.5 */
1.6
1.7 +#include <l4/devices/cpm-jz4780.h>
1.8 #include <l4/devices/dma-jz4780.h>
1.9 #include <l4/devices/hw_mmio_register_block.h>
1.10
1.11 @@ -156,7 +157,7 @@
1.12
1.13 // Initialise a channel.
1.14
1.15 -Dma_jz4780_channel::Dma_jz4780_channel(Dma_jz4780_chip *chip, uint8_t channel,
1.16 +Dma_jz4780_channel::Dma_jz4780_channel(Dma_chip *chip, uint8_t channel,
1.17 l4_addr_t start, l4_cap_idx_t irq)
1.18 : _chip(chip), _channel(channel), _irq(irq)
1.19 {
1.20 @@ -267,7 +268,7 @@
1.21 bool source_increment, bool destination_increment,
1.22 uint8_t source_width, uint8_t destination_width,
1.23 uint8_t transfer_unit_size,
1.24 - enum Dma_jz4780_request_type type,
1.25 + int type,
1.26 l4_addr_t desc_vaddr,
1.27 l4re_dma_space_dma_addr_t desc_paddr)
1.28 {
1.29 @@ -321,7 +322,7 @@
1.30 desc->destination = destination;
1.31 desc->transfer_count = (units & Dma_transfer_count_mask) |
1.32 (descriptor_offset << Dma_descriptor_offset_shift);
1.33 - desc->request_source = type;
1.34 + desc->request_source = (enum Dma_jz4780_request_type) type;
1.35
1.36 // NOTE: Stride not supported yet.
1.37
1.38 @@ -459,8 +460,7 @@
1.39
1.40 // Initialise the I2C controller.
1.41
1.42 -Dma_jz4780_chip::Dma_jz4780_chip(l4_addr_t start, l4_addr_t end,
1.43 - Cpm_jz4780_chip *cpm)
1.44 +Dma_jz4780_chip::Dma_jz4780_chip(l4_addr_t start, l4_addr_t end, Cpm_chip *cpm)
1.45 : _start(start), _end(end), _cpm(cpm)
1.46 {
1.47 _regs = new Hw::Mmio_register_block<32>(start);
1.48 @@ -490,7 +490,7 @@
1.49
1.50 // Obtain a channel object.
1.51
1.52 -Dma_jz4780_channel *
1.53 +Dma_channel *
1.54 Dma_jz4780_chip::get_channel(uint8_t channel, l4_cap_idx_t irq)
1.55 {
1.56 if (channel < 32)
1.57 @@ -537,28 +537,33 @@
1.58 _regs[Dma_doorbell_set] = (1 << channel);
1.59 }
1.60
1.61 +Dma_chip *jz4780_dma_chip(l4_addr_t start, l4_addr_t end, Cpm_chip *cpm)
1.62 +{
1.63 + return new Dma_jz4780_chip(start, end, cpm);
1.64 +}
1.65 +
1.66
1.67
1.68 // C language interface functions.
1.69
1.70 void *jz4780_dma_init(l4_addr_t start, l4_addr_t end, void *cpm)
1.71 {
1.72 - return (void *) new Dma_jz4780_chip(start, end, static_cast<Cpm_jz4780_chip *>(cpm));
1.73 + return (void *) jz4780_dma_chip(start, end, static_cast<Cpm_chip *>(cpm));
1.74 }
1.75
1.76 void jz4780_dma_disable(void *dma_chip)
1.77 {
1.78 - static_cast<Dma_jz4780_chip *>(dma_chip)->disable();
1.79 + static_cast<Dma_chip *>(dma_chip)->disable();
1.80 }
1.81
1.82 void jz4780_dma_enable(void *dma_chip)
1.83 {
1.84 - static_cast<Dma_jz4780_chip *>(dma_chip)->enable();
1.85 + static_cast<Dma_chip *>(dma_chip)->enable();
1.86 }
1.87
1.88 void *jz4780_dma_get_channel(void *dma, uint8_t channel, l4_cap_idx_t irq)
1.89 {
1.90 - return static_cast<Dma_jz4780_chip *>(dma)->get_channel(channel, irq);
1.91 + return static_cast<Dma_chip *>(dma)->get_channel(channel, irq);
1.92 }
1.93
1.94 unsigned int jz4780_dma_transfer(void *dma_channel,