HW access

Matthias Lange matthias.lange at kernkonzept.com
Tue Aug 9 17:49:19 CEST 2016


On 08/09/2016 04:44 PM, ba_f wrote:
> Am 2016-08-09 15:19, schrieb Matthias Lange:
>> Hi,
>>
>> On 08/09/2016 02:35 PM, ba_f wrote:
>>> Hello,
>>>
>>>
>>> due to sloppy documentation I need help from mailing-list, again.
>>
>> We are constantly seeking to improve our documentation. What exactly did
>> you find sloppy or misleading?
>>
>>
>>> Well, mine looks like this:
>>>
>>> -- vim:ft=lua:
>>> Io.Dt.add_children(Io.system_bus(), function()
>>>   RNG = Io.Hw.Device(function()
>>>     compatible = {"dev-rng,mmio", "dev-rng"};
>>>     Property.hid  = "dev-rng, RNG_0";
>>>     Resource.regs = Io.Res.mmio(0x43c00000, 0x43c0ffff);
>>>   end);
>>> end);
>>>
>>> Io.add_vbusses
>>> {
>>>     rng_server = Io.Vi.System_bus(function ()
>>>     dev = wrap(Io.system_bus():match("RNG"));
>>
>> The match() function takes a string as an argument and compares it with
>> the list of CIDs. As your device tree does not contain a device with a
>> HID or CID matching "RNG", no device is added to the 'rng_server' vbus.
>>
>> The solution is to supply a string from either the compatible table or
>> the hid property of the device(s) you want to match.
>>
>> Btw, by adding a few '-v' options to io's cmdline you can make io more
>> verbose to e.g. print the whole device tree or vbus trees.
>>
>> Matthias.
>>
>  
> Great, all L4Re-Apps boot now.
> 
> But, there's still something wrong.
> Here's my code to access HW:
> 
> 
>   printf("io_request...");
>   long ret = l4io_request_iomem( 0x43c00000, 4, L4IO_MEM_NONCACHED,
> baseaddr);

Did you initialize 'baseaddr' to NULL?

A few more recommendations. It is usually bad practice to use hard-coded
device addresses. If you like the convinience of libio-io you can use
l4io_lookup_device() to get a device handle which you can use to iterate
the device resources with l4vbus_get_resource().

Matthias.

>   printf("done!\n");
> 
>   if (ret != 0){
>     return -1;
>   }
> 
>   l4_uint32_t rng = *baseaddr; // ERR comes here
> 
> 
> When accessing *baseaddr, there's an Error.
> This code used to work with an older snapshot...
> 
> RNG    | Hi, this is RNG server.
> RNG    | io_request...done!
> RNG    | L4Re[rm]: mapping for page fault failed with error -34 at
> 0x9000 pc=0x1000280
> RNG    | L4Re: unhandled exception: pc=0x1000280 (pfa=9000)
> RNG    | L4Re: Global::l4re_aux->ldr_flags=0
> 
> 
> So, is this the correct way to access a certain HW-Address?
> 
> 
> 
> Thanks,
> 
> ba_f
> 
> 
>>> (Not sure if I really need 'compatible and 'Property.hid', here..?)
>>>
>>> Anyway, all I see is output from IO but, no other L4Re-App seems to
>>> start.
>>> IO      | Io service
>>> IO      | Ready. Waiting for request.
>>>
>>> Anybody already spot the fault?
>>>
>>> May I still use l4io_request_iomem() to access the HW or, did things
>>> change here, too?
>>>
>>>
>>>
>>> Thanks,
>>>
>>> ba_f
>>>
>>> _______________________________________________
>>> l4-hackers mailing list
>>> l4-hackers at os.inf.tu-dresden.de
>>> http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
> 


-- 
Matthias Lange, matthias.lange at kernkonzept.com, +49-351-41 888 614

Kernkonzept GmbH.  Sitz: Dresden.  Amtsgericht Dresden, HRB 31129.
Geschäftsführer: Dr.-Ing. Michael Hohmuth




More information about the l4-hackers mailing list