#include <linux/module.h>
#include <linux/printk.h>
#include <asm/io.h>
#define MCASP_START 0x48038000
#define MCASP_LENGTH 0x2000
#define PFUNC_REG_OFFSET 0x10
static int start(void)
{
pr_info("Calling for ioremap\n");
void *mcasp = ioremap(MCASP_START, MCASP_LENGTH);
if(mcasp == NULL) {
pr_info("ioremap failed!\n");
return -1;
}
u32 pfunc_reg = ioread32(mcasp + PFUNC_REG_OFFSET)
; // Kernel Oops here!
pr_info("Success! PFUNC=%08X\n", test);
iounmap(mcasp);
return 0;
}
module_init(start);
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
That is a good point. To understand how to enable the power and clock for McASP, look at the Starterware examples for McASP as they do everything you need to make this work.
On Dec 17, 2015, at 3:00 PM, William Hermans <yyr...@gmail.com> wrote:Probably easier, and more productive to read the TRM for the AM335x processors . . . All address offsets should be listed there as well, and the introduction for hardware module will give a short explanation of what needs doing, in order to bring the module up.That is a good point. To understand how to enable the power and clock for McASP, look at the Starterware examples for McASP as they do everything you need to make this work.
On Dec 17, 2015, at 3:48 PM, William Hermans <yyr...@gmail.com> wrote:I've no idea how ioremap() works, never used it. But if it's similar to how mmap() works on /dev/mem/, it does not matter what state the hardware module is in. Of course there are a few specified steps one must do in order to get a device working if it's not already. But if the device is already on, and functional, you can essentially override that module with mmap() and /dev/mem/. But it's probably not good idea, as the kernel will still think it has control . . .Anyway, I'm not sure I'd exactly call this a "driver" per se, as it's being done in userspace. But others might argue it's what's called a userspace driver . . . and yeah, I do not know about that. If you start changing pixels on your screen by poking at memory locations through /dev/mem/ does that mean you've created a graphics driver ? No . . .
On Dec 17, 2015, at 3:57 PM, William Hermans <yyr...@gmail.com> wrote:errr ooops. highlighted too many lines. https://github.com/BeaglePilot/PRUSS-C/blob/master/PRUSS_LIB/AM335X_StarterWare_02_00_01_01/drivers/mcspi.c#L422-L469