[258] | 1 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 2 | // File : xcu_driver.h |
---|
| 3 | // Date : 01/11/2013 |
---|
| 4 | // Author : alain greiner |
---|
| 5 | // Copyright (c) UPMC-LIP6 |
---|
| 6 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[295] | 7 | // The xcu_driver.c and xcu_driver.h files are part ot the GIET-VM nano-kernel. |
---|
| 8 | // This driver supports the SoCLib vci_xicu, that is a vectorised interrupt |
---|
| 9 | // controler supporting IPI (Inter Processor Interrupts) and integrated timers. |
---|
| 10 | // |
---|
| 11 | // It can exist several interrupt controller unit in the architecture |
---|
| 12 | // (one per cluster), and each one can contain several channels. |
---|
| 13 | // The number of XICU channels is equal to NB_PROCS_MAX, because there is |
---|
| 14 | // one private XICU channel per processor in a cluster. |
---|
| 15 | //////////////////////////////////////////////////////////////////////////////// |
---|
| 16 | // The virtual base address of the segment associated to the component is: |
---|
| 17 | // |
---|
| 18 | // seg_xcu_base + cluster_xy * vseg_cluster_increment |
---|
| 19 | // |
---|
| 20 | // The seg_xcu_base and vseg_cluster_increment values must be defined |
---|
| 21 | // in giet_vsegs.ld file. |
---|
| 22 | //////////////////////////////////////////////////////////////////////////////// |
---|
[258] | 23 | |
---|
| 24 | #ifndef _GIET_XCU_DRIVER_H_ |
---|
| 25 | #define _GIET_XCU_DRIVER_H_ |
---|
| 26 | |
---|
| 27 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 28 | // XICU registers offsets |
---|
| 29 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 30 | |
---|
[320] | 31 | enum Xcu_registers |
---|
[258] | 32 | { |
---|
[320] | 33 | XCU_WTI_REG = 0, |
---|
| 34 | XCU_PTI_PER = 1, |
---|
| 35 | XCU_PTI_VAL = 2, |
---|
| 36 | XCU_PTI_ACK = 3, |
---|
[258] | 37 | |
---|
[320] | 38 | XCU_MSK_PTI = 4, |
---|
| 39 | XCU_MSK_PTI_ENABLE = 5, |
---|
| 40 | XCU_MSK_PTI_DISABLE = 6, |
---|
| 41 | XCU_PTI_ACTIVE = 6, |
---|
[258] | 42 | |
---|
[320] | 43 | XCU_MSK_HWI = 8, |
---|
| 44 | XCU_MSK_HWI_ENABLE = 9, |
---|
| 45 | XCU_MSK_HWI_DISABLE = 10, |
---|
| 46 | XCU_HWI_ACTIVE = 10, |
---|
[258] | 47 | |
---|
[320] | 48 | XCU_MSK_WTI = 12, |
---|
| 49 | XCU_MSK_WTI_ENABLE = 13, |
---|
| 50 | XCU_MSK_WTI_DISABLE = 14, |
---|
| 51 | XCU_WTI_ACTIVE = 14, |
---|
[258] | 52 | |
---|
[320] | 53 | XCU_PRIO = 15, |
---|
[258] | 54 | }; |
---|
| 55 | |
---|
[320] | 56 | #define XCU_REG(func, index) (((func)<<5)|(index)) |
---|
[263] | 57 | |
---|
[258] | 58 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 59 | // XICU access functions |
---|
| 60 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 61 | |
---|
[295] | 62 | extern void _xcu_set_mask( unsigned int cluster_xy, |
---|
| 63 | unsigned int channel, |
---|
| 64 | unsigned int mask, |
---|
| 65 | unsigned int irq_type ); |
---|
[258] | 66 | |
---|
[295] | 67 | extern void _xcu_get_index( unsigned int cluster_xy, |
---|
| 68 | unsigned int channel, |
---|
| 69 | unsigned int * index, |
---|
| 70 | unsigned int * irq_type ); |
---|
[258] | 71 | |
---|
[295] | 72 | extern void _xcu_send_wti( unsigned int cluster_xy, |
---|
| 73 | unsigned int wti_index, |
---|
| 74 | unsigned int wdata ); |
---|
[258] | 75 | |
---|
[295] | 76 | extern void _xcu_get_wti_value( unsigned int cluster_xy, |
---|
| 77 | unsigned int wti_index, |
---|
| 78 | unsigned int * value ); |
---|
[258] | 79 | |
---|
[295] | 80 | extern void _xcu_get_wti_address( unsigned int wti_index, |
---|
| 81 | unsigned int * address ); |
---|
[258] | 82 | |
---|
[295] | 83 | extern void _xcu_timer_start( unsigned int cluster_xy, |
---|
| 84 | unsigned int pti_index, |
---|
| 85 | unsigned int period ); |
---|
[258] | 86 | |
---|
[295] | 87 | extern void _xcu_timer_stop( unsigned int cluster_xy, |
---|
| 88 | unsigned int pti_index ); |
---|
[258] | 89 | |
---|
[320] | 90 | extern unsigned int _xcu_timer_reset_irq( unsigned int cluster_xy, |
---|
| 91 | unsigned int pti_index ); |
---|
[295] | 92 | |
---|
| 93 | extern void _xcu_timer_reset_cpt( unsigned int cluster_xy, |
---|
| 94 | unsigned int pti_index ); |
---|
| 95 | |
---|
[258] | 96 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 97 | |
---|
| 98 | #endif |
---|
| 99 | |
---|
| 100 | // Local Variables: |
---|
| 101 | // tab-width: 4 |
---|
| 102 | // c-basic-offset: 4 |
---|
| 103 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 104 | // indent-tabs-mode: nil |
---|
| 105 | // End: |
---|
| 106 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 107 | |
---|