[Gllug] Virtual memory error in driver
salsaman at xs4all.nl
salsaman at xs4all.nl
Tue Jul 26 13:19:09 UTC 2011
On Tue, July 26, 2011 13:53, James Courtier-Dutton wrote:
> On 26 July 2011 12:37, <salsaman at xs4all.nl> wrote:
>> On Tue, July 26, 2011 11:02, James Courtier-Dutton wrote:
>>> On 25 July 2011 22:14, <salsaman at xs4all.nl> wrote:
>>>> Hi all,
>>>> I am trying to write a driver to read the values of some peripheral.
>>>> The
>>>> first step is to set the direction of the pins to read, the code is
>>>> something like:
>>>>
>>>> unit8_t *address = 0x01e26088;
>>>> memset(address, 0xFF, 1);
>>>>
>>>> however when I load the module with this code, I get an error:
>>>>
>>>> Unable to handle kernel paging request at virtual address 01e26088
>>>>
>>>
>>> Where are you getting 0x01e26088 from?
>>
>> It's from the data sheet, the pin direction register for the device.
>>
>> Salsaman.
>>
>
> Do you have a url where I could download the datasheet?
> What sort of platform is this? Is it Linux on x86?
>
> If it is a PCI device, that address will be relative to the PCI
> assigned resources range.
> The first thing your driver will have to do is "claim" the PCI resources.
> As an example look in the Linux kernel for:
> ca0106_main.c (I wrote it)
>
> function:
> snd_ca0106_create
>
>
> Once your driver has claimed the PCI resources, it can then write to them.
> --
> Gllug mailing list - Gllug at gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug
>
>
OK, I solved it in the end.
There is a macro IO_ADDRESS() which translates the virtual address to a
real value.
Then another macro __raw_writeb() to do the actual writing.
Regards,
Salsaman.
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list