@@ -129,9 +129,10 @@ static inline enum soc_dma_port_type soc_dma_ch_update_type(
struct memmap_entry_s *entry = soc_dma_lookup(dma, ch->vaddr[port]);
if (entry->type == soc_dma_port_fifo) {
- while (entry < dma->memmap + dma->memmap_size &&
+ while (entry > dma->memmap &&
entry->u.fifo.out != port)
- entry ++;
+ entry --;
+
if (entry->addr != ch->vaddr[port] || entry->u.fifo.out != port)
return soc_dma_port_other;
@@ -148,11 +149,12 @@ static inline enum soc_dma_port_type soc_dma_ch_update_type(
/* TODO: support constant memory address for source port as used for
* drawing solid rectangles by PalmOS(R). */
- if (ch->type[port] != soc_dma_access_const)
+ if (ch->type[port] != soc_dma_access_linear)
return soc_dma_port_other;
ch->paddr[port] = (uint8_t *) entry->u.mem.base +
(ch->vaddr[port] - entry->addr);
+
/* TODO: save bytes left to the end of the mapping somewhere so we
* can check we're not reading beyond it. */
return soc_dma_port_mem;