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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [Common/] [drivers/] [Atmel/] [at91lib/] [peripherals/] [eefc/] [eefc.h] - Blame information for rev 608

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 608 jeremybenn
/* ----------------------------------------------------------------------------
2
 *         ATMEL Microcontroller Software Support
3
 * ----------------------------------------------------------------------------
4
 * Copyright (c) 2008, Atmel Corporation
5
 *
6
 * All rights reserved.
7
 *
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions are met:
10
 *
11
 * - Redistributions of source code must retain the above copyright notice,
12
 * this list of conditions and the disclaimer below.
13
 *
14
 * Atmel's name may not be used to endorse or promote products derived from
15
 * this software without specific prior written permission.
16
 *
17
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 * ----------------------------------------------------------------------------
28
 */
29
 
30
#ifndef EEFC_H
31
#define EEFC_H
32
 
33
//------------------------------------------------------------------------------
34
//         Headers
35
//------------------------------------------------------------------------------
36
 
37
#include <board.h>
38
 
39
#ifdef BOARD_FLASH_EEFC
40
 
41
//------------------------------------------------------------------------------
42
//         Constants
43
//------------------------------------------------------------------------------
44
 
45
/// Number of GPNVMs available on each chip.
46
#if defined(at91sam7l64) || defined(at91sam7l128)
47
 
48
    #define EFC_NUM_GPNVMS          2
49
 
50
#elif defined(at91sam9xe128) || defined(at91sam9xe256) || defined(at91sam9xe512)
51
 
52
    #define EFC_NUM_GPNVMS          17
53
#endif
54
 
55
//------------------------------------------------------------------------------
56
//         Types
57
//------------------------------------------------------------------------------
58
 
59
// Needed when EEFC is integrated in MC.
60
#if !defined(AT91C_BASE_EFC) && defined(AT91C_BASE_MC)
61
typedef struct _AT91S_EFC {
62
        AT91_REG         EFC_FMR;       // EFC Flash Mode Register
63
        AT91_REG         EFC_FCR;       // EFC Flash Command Register
64
        AT91_REG         EFC_FSR;       // EFC Flash Status Register
65
        AT91_REG         EFC_FRR;       // EFC Flash Result Register
66
        AT91_REG         EFC_FVR;       // EFC Flash Version Register
67
} AT91S_EFC, *AT91PS_EFC;
68
 
69
#define AT91C_EFC_FRDY              AT91C_MC_FRDY
70
#define AT91C_EFC_FWS               AT91C_MC_FWS
71
#define AT91C_EFC_FWS_0WS           AT91C_MC_FWS_0WS
72
#define AT91C_EFC_FWS_1WS           AT91C_MC_FWS_1WS
73
#define AT91C_EFC_FWS_2WS           AT91C_MC_FWS_2WS
74
#define AT91C_EFC_FWS_3WS           AT91C_MC_FWS_3WS
75
#define AT91C_EFC_FCMD              AT91C_MC_FCMD
76
#define AT91C_EFC_FCMD_GETD         AT91C_MC_FCMD_GETD
77
#define AT91C_EFC_FCMD_WP           AT91C_MC_FCMD_WP  
78
#define AT91C_EFC_FCMD_WPL          AT91C_MC_FCMD_WPL 
79
#define AT91C_EFC_FCMD_EWP          AT91C_MC_FCMD_EWP 
80
#define AT91C_EFC_FCMD_EWPL         AT91C_MC_FCMD_EWPL
81
#define AT91C_EFC_FCMD_EA           AT91C_MC_FCMD_EA  
82
#define AT91C_EFC_FCMD_EPL          AT91C_MC_FCMD_EPL 
83
#define AT91C_EFC_FCMD_EPA          AT91C_MC_FCMD_EPA 
84
#define AT91C_EFC_FCMD_SLB          AT91C_MC_FCMD_SLB 
85
#define AT91C_EFC_FCMD_CLB          AT91C_MC_FCMD_CLB 
86
#define AT91C_EFC_FCMD_GLB          AT91C_MC_FCMD_GLB 
87
#define AT91C_EFC_FCMD_SFB          AT91C_MC_FCMD_SFB 
88
#define AT91C_EFC_FCMD_CFB          AT91C_MC_FCMD_CFB 
89
#define AT91C_EFC_FCMD_GFB          AT91C_MC_FCMD_GFB 
90
#define AT91C_EFC_FARG              AT91C_MC_FARG     
91
#define AT91C_EFC_FKEY              AT91C_MC_FKEY     
92
#define AT91C_EFC_FRDY_S            AT91C_MC_FRDY_S   
93
#define AT91C_EFC_FCMDE             AT91C_MC_FCMDE   
94
#define AT91C_EFC_LOCKE             AT91C_MC_LOCKE    
95
#define AT91C_EFC_FVALUE            AT91C_MC_FVALUE   
96
 
97
#define AT91C_BASE_EFC              (AT91_CAST(AT91PS_EFC)      0xFFFFFF60)    
98
 
99
#endif //#if !defined(AT91C_BASE_EFC) && defined(AT91C_BASE_MC)
100
 
101
//------------------------------------------------------------------------------
102
//         Functions
103
//------------------------------------------------------------------------------
104
 
105
extern void EFC_EnableFrdyIt(void);
106
 
107
extern void EFC_DisableFrdyIt(void);
108
 
109
extern void EFC_TranslateAddress(
110
    unsigned int address,
111
    unsigned short *pPage,
112
    unsigned short *pOffset);
113
 
114
extern void EFC_ComputeAddress(
115
    unsigned short page,
116
    unsigned short offset,
117
    unsigned int *pAddress);
118
 
119
extern void EFC_StartCommand(
120
    unsigned char command,
121
    unsigned short argument);
122
 
123
extern unsigned char EFC_PerformCommand(
124
    unsigned char command,
125
    unsigned short argument);
126
 
127
extern unsigned int EFC_GetStatus(void);
128
 
129
extern unsigned int EFC_GetResult(void);
130
 
131
#endif //#ifdef BOARD_FLASH_EEFC
132
#endif //#ifndef EEFC_H
133
 

powered by: WebSVN 2.1.0

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