|
Has anyone program the DMAC registers directly?
In our Linux distribution even the DMAC related symbols aren't defined.
The system controller memory area can be accessed from the kernel space simply using the macros at91_sys_read and at91_sys_write, no need for remapping (linux kernel level).
Accessing the Internal memory Map (0x00000000-0x00B00000) requires on a kernel module requesting the targeted memory region. In case of the LCD controller (from atmel_lcdfb.c):
/*******************************/
/* LCDC registers */
info->fix.mmio_start = regs->start;
info->fix.mmio_len = regs->end - regs->start + 1;
if (!request_mem_region(info->fix.mmio_start,
info->fix.mmio_len, pdev->name)) {
ret = -EBUSY;
goto free_fb;
}
sinfo->mmio = ioremap(info->fix.mmio_start, info->fix.mmio_len);
if (!sinfo->mmio) {
dev_err(dev, "cannot map LCDC registers\n");
goto release_mem;
}
/**************************/
This code configures properly the acces to the LCD controller internal registers that are marked in the third AT91 AHB Slave group. Within this group is also the DMAC controller, following the guidelines from the code in atmel_lcdfb.c we try to do our simple own DMAC driver:
/**************************************/
/*Requests IO ports for DMAC memory region*/
if(!request_mem_region(DMAC_IOMEM_START,DMAC_IOMEM_LENGTH,DMAC_IOMEM_NAME)){
printk("Error requesting DMAC IOMEM\n");
//fpga_dev_exit();
return -ENXIO;
}
DMAC_base_address= ioremap(DMAC_IOMEM_START,DMAC_IOMEM_LENGTH);
if(!DMAC_base_address){
printk("Error remaping DMAC IOMEM\n");
//fpga_dev_exit();
return -ENXIO;
}
/************************************/
With the code shown above, the LCD controller registers can be read. The internal registers of the DMAC controller can NOT be read.
A read instruction on a mapped DMAC internal register returns allways zero.
A read instruction on a unmapped DMAC internal register returns allways access violation exception.
Both LCD controller and DMAC are in the same AHB slave interface.
Does anyone face this problem?
thanks
|