source: soft/giet_vm/giet_drivers/mwr_driver.h @ 698

Last change on this file since 698 was 554, checked in by alain, 10 years ago

Modify the _mwr_isr() to support descheduling/rescheduling of the
task using a coprocessor in DMA mode.

File size: 4.1 KB
RevLine 
[258]1///////////////////////////////////////////////////////////////////////////////////
2// File     : mwr_driver.h
3// Date     : 01/11/2013
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
[518]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///////////////////////////////////////////////////////////////////////////////
[258]28
29#ifndef _GIET_MWR_DRIVERS_H_
30#define _GIET_MWR_DRIVERS_H_
31
[518]32///////////////////////////////////////////////////////////////////////////////
[258]33// MWMR controler registers offsets
[518]34///////////////////////////////////////////////////////////////////////////////
[258]35
[518]36enum MwmrDmaRegisters
[258]37{
[554]38    MWR_CHANNEL_BUFFER_LSB   = 0,     // Data buffer paddr 32 LSB bits
39    MWR_CHANNEL_BUFFER_MSB   = 1,     // Data buffer paddr extension
40    MWR_CHANNEL_MWMR_LSB     = 2,     // MWMR descriptor paddr 32 LSB bits
41    MWR_CHANNEL_MWMR_MSB     = 3,     // MWMR descriptor paddr extension
42    MWR_CHANNEL_LOCK_LSB     = 4,     // MWMR lock paddr 32 LSB bits
43    MWR_CHANNEL_LOCK_MSB     = 5,     // MWMR lock paddr extension
44    MWR_CHANNEL_WAY          = 6,     // TO_COPROC / FROMCOPROC         (Read-only)
45    MWR_CHANNEL_MODE         = 7,     // MWMR / DMA / DMA_IRQ
46    MWR_CHANNEL_SIZE         = 8,     // Data Buffer size (bytes)
47    MWR_CHANNEL_RUNNING      = 9,     // channel running   
48    MWR_CHANNEL_STATUS       = 10,    // channel FSM state              (Read-Only)
49    MWR_CHANNEL_INFO         = 11,    // STS | CFG | FROM | TO          (Read-Only)
[518]50    //
[554]51    MWR_CHANNEL_SPAN         = 16,
[258]52};
53
[554]54enum MwrDmaStatus
55{
56    MWR_CHANNEL_SUCCESS    = 0,
57    MWR_CHANNEL_ERROR_DATA = 1,
58    MWR_CHANNEL_ERROR_LOCK = 2,
59    MWR_CHANNEL_ERROR_DESC = 3,
60    MWR_CHANNEL_BUSY       = 4,
61};
62
[518]63///////////////////////////////////////////////////////////////////////////////
64//           Low-level access functions
65///////////////////////////////////////////////////////////////////////////////
[258]66
[518]67extern void _mwr_set_channel_register( unsigned int cluster_xy,
68                                       unsigned int channel,
69                                       unsigned int index,
70                                       unsigned int value );
[258]71
[518]72extern unsigned int _mwr_get_channel_register( unsigned int cluster_xy,
73                                               unsigned int channel,
74                                               unsigned int index );
[258]75
[518]76extern void _mwr_set_coproc_register( unsigned int cluster_xy,
77                                      unsigned int index,
78                                      unsigned int value );
[258]79
[518]80extern unsigned int _mwr_get_coproc_register( unsigned int cluster_xy,
81                                              unsigned int index );
[258]82
[518]83///////////////////////////////////////////////////////////////////////////////
84//            Interrupt Service Routine
85///////////////////////////////////////////////////////////////////////////////
86
87extern void _mwr_isr( unsigned int irq_type,
88                      unsigned int irq_id,
89                      unsigned int channel ); 
[258]90#endif
91
92// Local Variables:
93// tab-width: 4
94// c-basic-offset: 4
95// c-file-offsets:((innamespace . 0)(inline-open . 0))
96// indent-tabs-mode: nil
97// End:
98// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
99
Note: See TracBrowser for help on using the repository browser.