[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] Low level access



We do direct access to FPGA IP using the following macros:

#include <stdint.h>           // integer data types

// access 32-bit register data.
#define LAII_REG_READ(reg) (*(volatile uint32_t *)(reg))
#define LAII_REG_WRITE(reg,val)     { (*(volatile uint32_t *)(reg) = val); }

Our interface between a uClinux app and the FPGA IP is via these 32-bit memory-mapped "registers". It is true that doing this leaves you open to problems if the value of reg is not right.

Rod Campbell

Benny Chen wrote:
Hi Duy-ky,
Without hardware MMU support it is even more important for your application code to access your ipcore via the IOCTL() command. This is so because it would help prevent your application code from bringing down the kernel when it does incorrect memory access due to pointer referencing error.

The recommended way is to write a thin driver for your ipcore and provide access to the application program via the device file interface.

If you like the idea of referencing memory via their address instead of IOCTL then look at mmap() support for your driver.

Cheers,
B,

Duy-Ky Nguyen wrote:
Hello,

I got some experiences on low level access in Linux using X86 and MPC8272. They were "real Linux" with memory protection between kernel and user space, so I had to go through ioctl for low level access.

I'm quite aware that uCLinux does not have that kind of protection. In experience, loose something goes together with gain some thing, so I expect I'm able to have more direct access of low level.

Let's say I have a user_ip at 0x40080000, I've created a new myapp_hw in user-apps, and failed to compile a code using

// Start of code
#include <asm/io.h>
#define BASEADDR 0x40080000
. .
x = inl((volatile unsigned *) (BASEADDR));    // read-only reg
outl(1, (volatile unsigned *) (BASEADDR));    // write 1 to RWreg
..
// End of code

I had very long list of error from the compilation.

I'd really appreciate if I'd be shown how to use these low-level IO access functions.

Thanks a lot,

Duy-Ky





___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/



___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/