PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
Main Page
Modules
Data Structures
Files
File List
Globals
extif.h
Go to the documentation of this file.
1
/*******************************************************************************
2
* Copyright (C) 2013 Spansion LLC. All Rights Reserved.
3
*
4
* This software is owned and published by:
5
* Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion").
6
*
7
* BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
8
* BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
9
*
10
* This software contains source code for use with Spansion
11
* components. This software is licensed by Spansion to be adapted only
12
* for use in systems utilizing Spansion components. Spansion shall not be
13
* responsible for misuse or illegal use of this software for devices not
14
* supported herein. Spansion is providing this software "AS IS" and will
15
* not be responsible for issues arising from incorrect user implementation
16
* of the software.
17
*
18
* SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
19
* REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
20
* ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
21
* WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
22
* WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
23
* WARRANTY OF NONINFRINGEMENT.
24
* SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
25
* NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
26
* LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
27
* LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
28
* INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
29
* INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
30
* SAVINGS OR PROFITS,
31
* EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32
* YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
33
* INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
34
* FROM, THE SOFTWARE.
35
*
36
* This software may be replicated in part or whole for the licensed use,
37
* with the restriction that this Disclaimer and Copyright notice must be
38
* included with each copy of this software, whether used in part or whole,
39
* at all times.
40
*/
41
/******************************************************************************/
51
#ifndef __EXTIF_H__
52
#define __EXTIF_H__
53
54
/******************************************************************************/
55
/* Include files */
56
/******************************************************************************/
57
#include "
pdl.h
"
58
59
#if (defined(PDL_PERIPHERAL_EXTIF_ACTIVE))
60
61
/* C binding of definitions if building with C++ compiler */
62
#ifdef __cplusplus
63
extern
"C"
64
{
65
#endif
66
89
90
/******************************************************************************/
91
/* Global pre-processor symbols/macros ('#define') */
92
/******************************************************************************/
93
#define EXTIF (*((stc_extif_arrays_t *) FM4_EXBUS_BASE))
94
95
/******************************************************************************
96
* NAND Flash access macros (intern)
97
******************************************************************************/
98
#define EXITIF_NAND_ALE_OFFSET 0x00003000ul
99
#define EXITIF_NAND_ADDR_OFFSET 0x00002000ul
100
#define EXITIF_NAND_CMD_OFFSET 0x00001000ul
101
#define EXITIF_NAND_DATA_OFFSET 0x00000000ul
102
103
/******************************************************************************
104
* NAND Flash access macros (user)
105
******************************************************************************/
106
#define Extif_Nand_SetCommand(base, cmd) {*(volatile unsigned char*)((base) + EXITIF_NAND_CMD_OFFSET) = (unsigned char)(cmd);}
107
#define Extif_Nand_SetAddress(base, addr) {*(volatile unsigned char*)((base) + EXITIF_NAND_ADDR_OFFSET) = (unsigned char)(addr);}
108
#define Extif_Nand_ReadData(base) (*(volatile unsigned char*)((base) + EXITIF_NAND_DATA_OFFSET))
109
#define Extif_Nand_WriteData(base, data) {*(volatile unsigned char*)((base) + EXITIF_NAND_DATA_OFFSET) = (unsigned char)(data);}
110
#define Extif_Nand_ClearAle(base) {*(volatile unsigned char*)((base) + EXITIF_NAND_ALE_OFFSET) = (unsigned char)0;}
111
112
/******************************************************************************
113
* Global type definitions
114
******************************************************************************/
115
122
typedef
struct
stc_extif_arrays
123
{
124
union
{
125
uint32_t
au32MODE
[8];
126
stc_exbus_mode_field_t
astcMODE
[8];
127
};
128
union
{
129
uint32_t
au32TIM
[8];
130
stc_exbus_tim_field_t
astcTIM
[8];
131
};
132
union
{
133
uint32_t
au32AREA
[8];
134
stc_exbus_area_field_t
astcAREA
[8];
135
};
136
union
{
137
uint32_t
au32ATIM
[8];
138
stc_exbus_atim_field_t
astcATIM
[8];
139
};
140
}
stc_extif_arrays_t
;
141
148
typedef
enum
en_extif_width
149
{
150
Extif8Bit
= 0,
151
Extif16Bit
= 1
152
}
en_extif_width_t
;
153
163
typedef
enum
en_extif_cycle
164
{
165
Extif0Cycle
= 0,
166
Extif1Cycle
= 1,
167
Extif2Cycle
= 2,
168
Extif3Cycle
= 3,
169
Extif4Cycle
= 4,
170
Extif5Cycle
= 5,
171
Extif6Cycle
= 6,
172
Extif7Cycle
= 7,
173
Extif8Cycle
= 8,
174
Extif9Cycle
= 9,
175
Extif10Cycle
= 10,
176
Extif11Cycle
= 11,
177
Extif12Cycle
= 12,
178
Extif13Cycle
= 13,
179
Extif14Cycle
= 14,
180
Extif15Cycle
= 15,
181
Extif16Cycle
= 16,
182
ExtifDisabled
= 17
183
}
en_extif_cycle_t
;
184
194
typedef
enum
en_extif_mask
195
{
196
Extif1MB
= 0,
197
Extif2MB
= 1,
198
Extif4MB
= 2,
199
Extif8MB
= 3,
200
Extif16MB
= 4,
201
Extif32MB
= 5,
202
Extif64MB
= 6,
203
Extif128MB
= 7
204
}
en_extif_mask_t
;
205
215
typedef
enum
en_extif_cas
216
{
217
ExtifCas16Bit
= 0,
218
ExtifCas32Bit
= 1
219
}
en_extif_cas_t
;
220
230
typedef
enum
en_extif_ras
231
{
232
ExtifRas_19_6
= 0,
233
ExtifRas_20_7
= 1,
234
ExtifRas_21_8
= 2,
235
ExtifRas_22_9
= 3,
236
ExtifRas_23_10
= 4,
237
ExtifRas_24_11
= 5,
238
ExtifRas_25_12
= 6,
239
}
en_extif_ras_t
;
240
250
typedef
enum
en_extif_bas
251
{
252
ExtifBas_20_19
= 0,
253
ExtifBas_21_20
= 1,
254
ExtifBas_22_21
= 2,
255
ExtifBas_23_22
= 3,
256
ExtifBas_24_23
= 4,
257
ExtifBas_25_24
= 5,
258
ExtifBas_26_25
= 6,
259
}
en_extif_bas_t
;
260
267
typedef
struct
stc_extif_area_config
268
{
269
en_extif_width_t
enWidth
;
270
boolean_t
bReadByteMask
;
271
boolean_t
bWriteEnableOff
;
272
boolean_t
bNandFlash
;
273
boolean_t
bPageAccess
;
274
boolean_t
bRdyOn
;
275
boolean_t
bStopDataOutAtFirstIdle
;
276
boolean_t
bMultiplexMode
;
277
boolean_t
bAleInvert
;
278
boolean_t
bAddrOnDataLinesOff
;
279
boolean_t
bMpxcsOff
;
280
boolean_t
bMoexWidthAsFradc
;
281
en_extif_cycle_t
enReadAccessCycle
;
282
en_extif_cycle_t
enReadAddressSetupCycle
;
283
en_extif_cycle_t
enFirstReadAddressCycle
;
284
en_extif_cycle_t
enReadIdleCycle
;
285
en_extif_cycle_t
enWriteAccessCycle
;
286
en_extif_cycle_t
enWriteAddressSetupCycle
;
287
en_extif_cycle_t
enWriteEnableCycle
;
288
en_extif_cycle_t
enWriteIdleCycle
;
289
uint8_t
u8AreaAddress
;
290
en_extif_mask_t
enAreaMask
;
291
en_extif_cycle_t
enAddressLatchCycle
;
292
en_extif_cycle_t
enAddressLatchSetupCycle
;
293
en_extif_cycle_t
enAddressLatchWidthCycle
;
294
boolean_t
bSdramEnable
;
295
boolean_t
bSdramPowerDownMode
;
296
boolean_t
bSdramRefreshOff
;
297
en_extif_cas_t
enCasel
;
298
en_extif_ras_t
enRasel
;
299
en_extif_bas_t
enBasel
;
300
uint16_t
u16RefreshCount
;
301
uint8_t
u8RefreshNumber
;
302
boolean_t
bRefreshEnable
;
303
uint16_t
u16PowerDownCount
;
304
en_extif_cycle_t
enSdramCasLatencyCycle
;
305
en_extif_cycle_t
enSdramRasCycle
;
306
en_extif_cycle_t
enSdramRasPrechargeCycle
;
307
en_extif_cycle_t
enSdramRasCasDelayCycle
;
308
en_extif_cycle_t
enSdramRasActiveCycle
;
309
en_extif_cycle_t
enSdramRefreshCycle
;
310
en_extif_cycle_t
enSdramPrechargeCycle
;
311
boolean_t
bSdramErrorInterruptEnable
;
312
boolean_t
bSramFlashErrorInterruptEnable
;
313
func_ptr_t
pfnSdramErrorCallback
;
314
func_ptr_t
pfnSramFlashErrorCallback
;
315
boolean_t
bMclkoutEnable
;
316
uint8_t
u8MclkDivision
;
317
boolean_t
bPrecedReadContinuousWrite
;
318
}
stc_extif_area_config_t
;
319
321
typedef
struct
stc_extif_intern_data
322
{
323
boolean_t
bSdramErrorInterruptEnable
;
324
boolean_t
bSramFlashErrorInterruptEnable
;
325
func_ptr_t
pfnSdramErrorCallback
;
326
func_ptr_t
pfnSramFlashErrorCallback
;
327
}
stc_extif_intern_data_t
;
328
329
/******************************************************************************/
330
/* Global function prototypes ('extern', definition in C source) */
331
/******************************************************************************/
332
333
extern
void
ExtifIrqHandler
(
void
);
334
335
extern
en_result_t
Extif_InitArea
( uint8_t u8Area,
336
stc_extif_area_config_t
* pstcConfig );
337
338
extern
en_result_t
Extif_ReadErrorStatus
(
void
);
339
340
extern
uint32_t
Extif_ReadErrorAddress
(
void
);
341
342
extern
en_result_t
Extif_ClearErrorStatus
(
void
);
343
344
extern
en_result_t
Extif_CheckSdcmdReady
(
void
);
345
346
extern
en_result_t
Extif_SetSdramCommand
( uint16_t u16Address,
347
boolean_t
bMsdwex,
348
boolean_t
bMcasx,
349
boolean_t
bMrasx,
350
boolean_t
bMcsx8,
351
boolean_t
bMadcke
352
);
353
355
356
#ifdef __cplusplus
357
}
358
#endif
359
360
#endif // #if (defined(PDL_PERIPHERAL_EXTIF_ACTIVE))
361
362
#endif
/* __EXTIF_H__ */
363
/******************************************************************************/
364
/* EOF (not truncated) */
365
/******************************************************************************/
PDL_1_2
library
driver
extif
extif.h
Generated on Wed May 28 2014 09:28:10 for PDL for FM4 by
1.8.3.1