Von: beagl...@googlegroups.com [mailto:beagl...@googlegroups.com]Im Auftrag von Sandeep Nair
Gesendet: Samstag, 6. September 2008 01:53
An: beagl...@googlegroups.com
Betreff: [beagleboard] Re: Accessing SPI interface from user space"spidev" driver provides userspace access to SPI port. You can see a sample userspace program using spidev on :
http://www.google.com/codesearch?hl=en&q=spidev.h+lang:c+show:bXp711pR3ZI:Jhc81BqH8XI:P4HqIm5CIgg&sa=N&cd=2&ct=rc&cs_p=http://www.landley.net&cs_f=kdocs/Documentation/spi/spidev_test.c
But you do need to do the pin mux configuration for getting the SPI port on the expansion connector. And you also need to register "spidev" as the driver for that SPI port.
Best Regards
Sandeep
On Fri, Sep 5, 2008 at 7:09 PM, John Beetem <johnb...@yahoo.com> wrote:
On the Ångström demo I've been able to use mmap() and /dev/mem to map
OMAP peripheral memory into my user space application. So far I've
only accessed the GPIO registers so I could play with the user LEDs.
Code looks something like this:
int fd = open("/dev/mem", O_RDWR); volatile ulong *A;
if (fd < 0) {printf("Could not open file\n"); return;}
A = (ulong*) mmap(NULL, 0x10000, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0x49050000);
if (A == MAP_FAILED) {printf("Mapping failed\n"); close(fd);
return;}
A[0x603C / 4] |= 0x600000; // Turn on LEDs
On Sep 5, 2:03 pm, "Philip Balister" <philip.balis...@gmail.com>
wrote:
> I'd like to use one of the SPI ports on the expansion connector to
> test my FPGA skillz by sending some data to the FPGA via the expansion
> connector.
>
> Is there a user space utility that wuold let me do this. My
> understanding is I need to set a mux register so the expansion
> connector has some spi interfaces and make sure the relevant clocks
> are active. Has someone already created a utility to do this?
>
> Philip-
Generally you need something like the following in your kernel
platform code (this is PXA, but OMAP should be similar). It is fairly
tedious to get the bus_num and chip_select right, the is the price of
flexibility.
static struct pxa2xx_spi_master pxa_ssp_master_info = {
.num_chipselect = 1,
};
static struct spi_board_info spi_board_info[] __initdata = {
{
.modalias = "spidev",
.max_speed_hz = 13000000,
.bus_num = 1,
.chip_select = 0,
},
};
pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
Cliff
--
=======================
Cliff Brake
http://bec-systems.com