| 3 | [[PageOutline]] |
| 4 | |
| 5 | == A) General principles == |
| 6 | |
| 7 | The PIC generic device describes an external interrupt Controler, that translates N input IRQs generated by external peripherals to N WTI IRQs, that will be routed to a dynamically allocated WTI mailbox in a given cluster. |
| 8 | |
| 9 | The max number of input IRQs is defined by the CONFIG_IRQ_PIC_MAX parameter. The actual number of connected IRQs is defined in the ''arch_info'' file, and stored in the PIC device extension. |
| 10 | |
| 11 | The "source" device for each input IRQ is also defined in the ''arch_info'' file, and are stored in the ''devices_irq'' global variable in the kernel initialization phase. |
| 12 | |
| 13 | This external peripheral does not execute I/O operations, but is just acting as a dynamically configurable interrupt router for another I/O operation. Therefore, ALMOS-MK does not use the PIC device waiting queue, but call directly the PIC driver blocking functions to dynamically configure the PIC component. |
| 14 | |
| 15 | == B) Access Functions == |
| 16 | |
| 17 | === 1) '''void dev_pic_init'''( xptr_t xp_dev , uint32_t irq_nr ) === |
| 18 | |
| 19 | This function makes two initializations: |
| 20 | It initializes the PIC specific fields of the device descriptor. It call the PIC driver to initialize the PIC hardware device. |
| 21 | It is executed once in the kernel initialisation phase. |
| 22 | |
| 23 | === 2) '''void dev_pic_bind_irq'''( uint32_t irq_id , cxy_t cxy , uint32_t wti_id ) === |
| 24 | |
| 25 | This function link a WTI mailbox to the PIC input IRQ identified by its index, and unmask the selected input IRQ. |
| 26 | The <irq_id> argument is the input IRQ index. The <cxy> argument is the WTI mailbox cluster. The <wti_id> argument |
| 27 | is the WTI mailbox index in cluster. |
| 28 | |
| 29 | === 3) '''void dev_pic_unbind_irq'''( uint32_t irq_id ) === |
| 30 | |
| 31 | This function mask a PIC input IRQ identified by its index. The <irq_id> argument is the input IRQ index. |
| 32 | |
| 33 | /***************************************************************************************** |
| 34 | * This function mask a PIC input IRQ identified by its index. |
| 35 | ***************************************************************************************** |
| 36 | * @ irq_id : input IRQ index. |
| 37 | * @ returns 0 if success / returns EINVAL if input IRQ not found. |
| 38 | ****************************************************************************************/ |
| 39 | void dev_pic_unbind_irq( uint32_t irq_id ); |
| 40 | |