1 | /////////////////////////////////////////////////////////////////////////////////// |
---|
2 | // File : mwr_driver.h |
---|
3 | // Date : 01/11/2013 |
---|
4 | // Author : alain greiner |
---|
5 | // Copyright (c) UPMC-LIP6 |
---|
6 | /////////////////////////////////////////////////////////////////////////////// |
---|
7 | // The mwr_driver.c and mwr_driver.h files are part ot the GIET-VM OS. |
---|
8 | // This driver supports the SoCLib vci_mwmr_dma component. |
---|
9 | // |
---|
10 | // It can exist several MWMR_DMA controlers in the architecture |
---|
11 | // (one per cluster), and each controller can contain several ports. |
---|
12 | // Each port defines a TO_COPROC or FROM_COPROC communication channel. |
---|
13 | // Each channel can be configured to run in one of three predefined modes |
---|
14 | // (MWMR / DMA_IRQ / DMA_NO_IRQ). |
---|
15 | // The MWMR_DMA controler is a private ressource, allocated to a given task. |
---|
16 | // |
---|
17 | // The virtual base address of the segment associated to the coprocessor |
---|
18 | // addressable registers is: |
---|
19 | // SEG_MWR_BASE + cluster_xy*PERI_CLUSTER_INCREMENT |
---|
20 | // |
---|
21 | // The virtual base address of the segments associated to a channel is: |
---|
22 | // SEG_MWR_BASE + |
---|
23 | // cluster_xy * PERI_CLUSTER_INCREMENT + |
---|
24 | // 4 * CHANNEL_SPAN * (channel+1) |
---|
25 | // |
---|
26 | // The SEG_MWR_BASE virtual address mus be defined in the hard_config.h file. |
---|
27 | /////////////////////////////////////////////////////////////////////////////// |
---|
28 | |
---|
29 | #ifndef _GIET_MWR_DRIVERS_H_ |
---|
30 | #define _GIET_MWR_DRIVERS_H_ |
---|
31 | |
---|
32 | /////////////////////////////////////////////////////////////////////////////// |
---|
33 | // MWMR controler registers offsets |
---|
34 | /////////////////////////////////////////////////////////////////////////////// |
---|
35 | |
---|
36 | enum MwmrDmaRegisters |
---|
37 | { |
---|
38 | CHANNEL_BUFFER_LSB = 0, // Data buffer paddr 32 LSB bits |
---|
39 | CHANNEL_BUFFER_MSB = 1, // Data buffer paddr extension |
---|
40 | CHANNEL_MWMR_LSB = 2, // MWMR descriptor paddr 32 LSB bits |
---|
41 | CHANNEL_MWMR_MSB = 3, // MWMR descriptor paddr extension |
---|
42 | CHANNEL_LOCK_LSB = 4, // MWMR lock paddr 32 LSB bits |
---|
43 | CHANNEL_LOCK_MSB = 5, // MWMR lock paddr extension |
---|
44 | CHANNEL_WAY = 6, // TO_COPROC / FROMCOPROC (Read-only) |
---|
45 | CHANNEL_MODE = 7, // MWMR / DMA / DMA_IRQ |
---|
46 | CHANNEL_SIZE = 8, // Data Buffer size (bytes) |
---|
47 | CHANNEL_RUNNING = 9, // channel running |
---|
48 | CHANNEL_STATUS = 10, // channel FSM state (Read-Only) |
---|
49 | CHANNEL_INFO = 11, // STS | CFG | FROM | TO (Read-Only) |
---|
50 | // |
---|
51 | CHANNEL_SPAN = 16, |
---|
52 | }; |
---|
53 | |
---|
54 | /////////////////////////////////////////////////////////////////////////////// |
---|
55 | // Low-level access functions |
---|
56 | /////////////////////////////////////////////////////////////////////////////// |
---|
57 | |
---|
58 | extern void _mwr_set_channel_register( unsigned int cluster_xy, |
---|
59 | unsigned int channel, |
---|
60 | unsigned int index, |
---|
61 | unsigned int value ); |
---|
62 | |
---|
63 | extern unsigned int _mwr_get_channel_register( unsigned int cluster_xy, |
---|
64 | unsigned int channel, |
---|
65 | unsigned int index ); |
---|
66 | |
---|
67 | extern void _mwr_set_coproc_register( unsigned int cluster_xy, |
---|
68 | unsigned int index, |
---|
69 | unsigned int value ); |
---|
70 | |
---|
71 | extern unsigned int _mwr_get_coproc_register( unsigned int cluster_xy, |
---|
72 | unsigned int index ); |
---|
73 | |
---|
74 | /////////////////////////////////////////////////////////////////////////////// |
---|
75 | // Interrupt Service Routine |
---|
76 | /////////////////////////////////////////////////////////////////////////////// |
---|
77 | |
---|
78 | extern void _mwr_isr( unsigned int irq_type, |
---|
79 | unsigned int irq_id, |
---|
80 | unsigned int channel ); |
---|
81 | #endif |
---|
82 | |
---|
83 | // Local Variables: |
---|
84 | // tab-width: 4 |
---|
85 | // c-basic-offset: 4 |
---|
86 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
87 | // indent-tabs-mode: nil |
---|
88 | // End: |
---|
89 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
90 | |
---|