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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_AT91SAM3U256_IAR/] [AT91Lib/] [peripherals/] [efc/] [efc.h] - Blame information for rev 675

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

Line No. Rev Author Line
1 580 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
/// \unit
31
///
32
/// !Purpose
33
///
34
/// Interface for configuration the Embedded Flash Controller (EFC) peripheral.
35
///
36
/// !Usage
37
///
38
/// -# Initialize system master clock of the EFC with EFC_SetMasterClock().
39
/// -# Enable/disable interrupt sources using EFC_EnableIt() and EFC_DisableIt().
40
/// -# Enables or disable the "Erase before programming" feature using 
41
///    EFC_SetEraseBeforeProgramming().
42
/// -# Translates the given address into which EFC, page and offset values for 
43
///    difference density %flash memory using EFC_TranslateAddress().
44
/// -# Computes the address of a %flash access given the EFC, page and offset 
45
///    for difference density %flash memory using EFC_ComputeAddress().
46
/// -# Start the executing command with EFC_StartCommand()
47
/// -# Retrieve the current status of the EFC using EFC_GetStatus().
48
///
49
//------------------------------------------------------------------------------
50
#ifndef EFC_H
51
#define EFC_H
52
 
53
//------------------------------------------------------------------------------
54
//         Headers
55
//------------------------------------------------------------------------------
56
 
57
#include <board.h>
58
 
59
#ifdef BOARD_FLASH_EFC
60
 
61
//------------------------------------------------------------------------------
62
//         Constants
63
//------------------------------------------------------------------------------
64
 
65
/// Number of GPNVMs available on each chip.
66
#if defined(at91sam7s16) || defined(at91sam7s161) || defined(at91sam7s32) \
67
    || defined(at91sam7s321) || defined(at91sam7s64) || defined(at91sam7s128) \
68
    || defined(at91sam7s256) || defined(at91sam7s512)
69
 
70
    #define EFC_NUM_GPNVMS          2
71
 
72
#elif defined(at91sam7se32) || defined(at91sam7se256) || defined(at91sam7se512) \
73
      || defined(at91sam7x128) || defined(at91sam7x256) || defined(at91sam7x512) \
74
      || defined(at91sam7xc128) || defined(at91sam7xc256) || defined(at91sam7xc512) \
75
 
76
    #define EFC_NUM_GPNVMS          3
77
 
78
#elif defined(at91sam7a3)
79
 
80
    #define EFC_NUM_GPNVMS          0
81
#endif
82
 
83
// Missing FRDY bit for SAM7A3
84
#if defined(at91sam7a3)
85
    #define AT91C_MC_FRDY       (AT91C_MC_EOP | AT91C_MC_EOL)
86
#endif
87
 
88
// No security bit on SAM7A3
89
#if defined(at91sam7a3)
90
    #define EFC_NO_SECURITY_BIT
91
#endif
92
 
93
//------------------------------------------------------------------------------
94
//         Types
95
//------------------------------------------------------------------------------
96
 
97
// For chips which do not define AT91S_EFC
98
#if !defined(AT91C_BASE_EFC) && !defined(AT91C_BASE_EFC0)
99
typedef struct _AT91S_EFC {
100
 
101
    AT91_REG EFC_FMR;
102
    AT91_REG EFC_FCR;
103
    AT91_REG EFC_FSR;
104
 
105
} AT91S_EFC, *AT91PS_EFC;
106
        #define AT91C_BASE_EFC       (AT91_CAST(AT91PS_EFC)     0xFFFFFF60) 
107
#endif  
108
 
109
//------------------------------------------------------------------------------
110
//         Functions
111
//------------------------------------------------------------------------------
112
 
113
extern void EFC_SetMasterClock(unsigned int mck);
114
 
115
extern void EFC_EnableIt(AT91S_EFC *pEfc, unsigned int sources);
116
 
117
extern void EFC_DisableIt(AT91S_EFC *pEfc, unsigned int sources);
118
 
119
extern void EFC_SetEraseBeforeProgramming(AT91S_EFC *pEfc, unsigned char enable);
120
 
121
extern void EFC_TranslateAddress(
122
    unsigned int address,
123
    AT91S_EFC **ppEfc,
124
    unsigned short *pPage,
125
    unsigned short *pOffset);
126
 
127
extern void EFC_ComputeAddress(
128
    AT91S_EFC *pEfc,
129
    unsigned short page,
130
    unsigned short offset,
131
    unsigned int *pAddress);
132
 
133
extern void EFC_StartCommand(
134
    AT91S_EFC *pEfc,
135
    unsigned char command,
136
    unsigned short argument);
137
 
138
extern unsigned char EFC_PerformCommand(
139
    AT91S_EFC *pEfc,
140
    unsigned char command,
141
    unsigned short argument);
142
 
143
extern unsigned int EFC_GetStatus(AT91S_EFC *pEfc);
144
 
145
#endif //#ifdef BOARD_FLASH_EFC
146
#endif //#ifndef EFC_H
147
 

powered by: WebSVN 2.1.0

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