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

Subversion Repositories funbase_ip_library

[/] [funbase_ip_library/] [trunk/] [TUT/] [ip.hwp.storage/] [sdram2hibi/] [1.0/] [drv/] [sdram_drv.h] - Blame information for rev 147

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

Line No. Rev Author Line
1 145 lanttu
// **************************************************************************
2
// File             : sdram_drv.h
3
// Authors          : Antti Kojo
4
// Date             : 12.06.2009
5
// Decription       : SDRAM contoller driver for eCos
6
// Version history  : 12.06.2009    ank    Original version
7
// **************************************************************************
8
 
9
#ifndef SDRAM_H
10
#define SDRAM_H
11
 
12
#include "types.h"
13
 
14
/* CPU uses these HIBI addresses when receiving mem_ctrl_offset or data from
15
   SDRAM. Offset is added to CPU's HIBI base address. */
16
#define HIBI_ADDRESS_OFFSET_FOR_SDRAM  (0x600)
17
#define SDRAM_CONF_CHANNEL_ADDR        (HIBI_ADDRESS_OFFSET_FOR_SDRAM + 1)
18
#define SDRAM_DATA_CHANNEL_ADDR        (HIBI_ADDRESS_OFFSET_FOR_SDRAM + 2)
19
 
20
/* parameters used with configuration function */
21
#define SDRAM_READ_OPERATION           (0)
22
#define SDRAM_WRITE_OPERATION          (1)
23
 
24
 
25
/* Call this init-function before using other functions. */
26
void sdram_init(const uint32 sdram_hibi_addr);
27
 
28
 
29
 
30
 
31
 
32
 
33
/* This function, sdram_config, configures SDRAM controller
34
   for read and write operations.
35
 
36
 * Parameters:
37
 
38
   sdram_byte_addr:      SDRAM byte address for read and write operations
39
 
40
   words:                Amount of words to read/write
41
 
42
   operation:            Use parameter SDRAM_WRITE_OPERATION when writing and
43
                         SDRAM_READ_OPERATION when reading.
44
 
45
   read_chn_addr:        In case of read operation, data from SDRAM will be
46
                         written to this hibi address. In case of write
47
                         operation, this parameter is not used.
48
 
49
   row_count_and_stride: This parameter is used when reading/writing
50
                         rectangular memory areas.
51
 
52
 
53
 * Return:
54
 
55
   In case of write operation, this function returns HIBI address where
56
   the data should be written.
57
 
58
*/
59
uint32 sdram_config( const uint32 sdram_byte_addr,
60
                     const uint32 words,
61
                     const uint8  operation,
62
                     const uint32 read_chn_addr,
63
                     const uint32 row_count_and_stride );
64
 
65
 
66
 
67
 
68
/* This function, sdram_write, writes data to SDRAM
69
 
70
 * Parameters:
71
 
72
   src:           Pointer to source data
73
   sdram_addr:    SDRAM target address
74
   words:         Amount of data words
75
 
76
*/
77
bool sdram_write( uint32* const src,
78
                  const uint32 sdram_addr,
79
                  const uint32 words );
80
 
81
 
82
 
83
 
84
 
85
 
86
/* This function, sdram_read, reads data from SDRAM.
87
   This is non-blocking read. After function returns,
88
   reading from SDRAM is in progress. User of this
89
   function has to declare sdram_rx_end-function
90
   which is called after data has been received.
91
 
92
 * Parameters:
93
 
94
   sdram_addr:    SDRAM source address
95
   words:         Amount of data words
96
 
97
*/
98
void sdram_read( const uint32 sdram_addr,
99
                 const uint32 words );
100
 
101
 
102
 
103
#endif
104
 
105
 
106
 

powered by: WebSVN 2.1.0

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