Not sure if Serhii is in the ML, so I'm resending this with direct CC.


---------- Původní e-mail ----------
Od: Jiri Svoboda <[email protected]>
Komu: HelenOS development mailing list <[email protected]>
Datum: 10. 5. 2022 15:44:58
Předmět: Re: [HelenOS-devel] Work with PCI registers
"
Hi Serhii,




mapping the registers would be typically done in the driver's dev_add entry
point.

  * get the parent session using ddf_dev_parent_sess_get()

  * get list of HW resources (hw_res_list_parsed_init() / hw_res_get_list_
parsed()

     - memory ranges, I/O ranges, interrupts

  * map registers using pio_enable()

  * access registers using pio_read_x() / pio_write_x()





Handling interrupts:

    * prepare IRQ pseudocode and handler function


    * register_interrupt_handler()

    * hw_res_enable_interrupt()




Handling DMA

   * dmamem_map_anonymous() / dmamem_unmap_anonymous()




If you'd like to see an example how this is done, you can check, for
example:

*  uspace/drv/audio/hdaudio/hdaudio.c : hda_dev_add()


*   uspace/drv/nic/e1k/e1k.c : e1000_dev_add()



Hope this helps,

Jiri




---------- Původní e-mail ----------
Od: Serhii Sakhno <[email protected]>
Komu: [email protected]
Datum: 9. 5. 2022 10:38:21
Předmět: [HelenOS-devel] Work with PCI registers
"I read an article on Wiki about writing drivers and checked existing
drivers, but I did not understand some things with PCI/PCIe buses. How
to map needed registers?



Regards,

Serhii


_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel
""
_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to