OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [peripheral/] [dma.h] - Blame information for rev 650

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 jeremybenn
/* dma.h -- Definition of DMA<->peripheral interface
2
 
3
   Copyright (C) 2001 by Erez Volk, erez@opencores.org
4
   Copyright (C) 2008 Embecosm Limited
5
 
6
   Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
7
 
8
   This file is part of Or1ksim, the OpenRISC 1000 Architectural Simulator.
9
 
10
   This program is free software; you can redistribute it and/or modify it
11
   under the terms of the GNU General Public License as published by the Free
12
   Software Foundation; either version 3 of the License, or (at your option)
13
   any later version.
14
 
15
   This program is distributed in the hope that it will be useful, but WITHOUT
16
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18
   more details.
19
 
20
   You should have received a copy of the GNU General Public License along
21
   with this program.  If not, see <http://www.gnu.org/licenses/>.  */
22
 
23
/* This program is commented throughout in a fashion suitable for processing
24
   with Doxygen. */
25
 
26
#ifndef DMA__H
27
#define DMA__H
28
 
29
/* Package includes */
30
#include "dma-defs.h"
31
#include "sim-config.h"
32
 
33
/* Implementation of DMA Channel Registers and State */
34
struct dma_channel
35
{
36
  /* The controller we belong to */
37
  struct dma_controller *controller;
38
 
39
  /* Our channel number and bit mask */
40
  unsigned channel_number;
41
  unsigned long channel_mask;
42
 
43
  /* Used for dump, to save dumping all 32 channels */
44
  unsigned referenced;
45
 
46
  /* Inner state of transfer etc. */
47
  unsigned load_next_descriptor_when_done;
48
  unsigned long current_descriptor;
49
  oraddr_t source, destination, source_mask, destination_mask;
50
  unsigned long chunk_size, total_size, words_transferred;
51
 
52
  /* The interface registers */
53
  struct
54
  {
55
    unsigned long csr;
56
    unsigned long sz;
57
    unsigned long a0;
58
    unsigned long am0;
59
    unsigned long a1;
60
    unsigned long am1;
61
    unsigned long desc;
62
    unsigned long swptr;
63
  } regs;
64
 
65
  /* Some control signals */
66
  unsigned dma_req_i;
67
  unsigned dma_ack_o;
68
  unsigned dma_nd_i;
69
};
70
 
71
 
72
/* Implementation of DMA Controller Registers and State */
73
struct dma_controller
74
{
75
  /* Is peripheral enabled */
76
  int enabled;
77
 
78
  /* Base address in memory */
79
  oraddr_t baseaddr;
80
 
81
  /* Which interrupt number we generate */
82
  unsigned irq;
83
 
84
  /* VAPI id */
85
  int vapi_id;
86
 
87
  /* Controller Registers */
88
  struct
89
  {
90
    unsigned long csr;
91
    unsigned long int_msk_a;
92
    unsigned long int_msk_b;
93
    unsigned long int_src_a;
94
    unsigned long int_src_b;
95
  } regs;
96
 
97
  /* Channels */
98
  struct dma_channel ch[DMA_NUM_CHANNELS];
99
 
100
  struct dma_controller *next;
101
};
102
 
103
void set_dma_req_i (struct dma_channel *channel);
104
void clear_dma_req_i (struct dma_channel *channel);
105
void set_dma_nd_i (struct dma_channel *channel);
106
void clear_dma_nd_i (struct dma_channel *channel);
107
unsigned check_dma_ack_o (struct dma_channel *channel);
108
struct dma_channel *find_dma_controller_ch (unsigned controller,
109
                                            unsigned channel);
110
 
111
/* Prototype for external use */
112
extern void  reg_dma_sec ();
113
 
114
#endif  /* DMA__H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.