blob: e58ba029a0a1fa04c2499a99be35f194d810b75a [file] [log] [blame]
Christina Quast637ace92014-11-28 13:28:37 +01001/* ----------------------------------------------------------------------------
2 * ATMEL Microcontroller Software Support
3 * ----------------------------------------------------------------------------
4 * Copyright (c) 2009, 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/**
31 * \file
32 *
33 * The flash driver provides the unified interface for flash program operations.
34 *
35 */
36
37#ifndef _FLASHD_
38#define _FLASHD_
39
40#include <stdint.h>
41
42#ifdef __cplusplus
43 extern "C" {
44#endif
45
46/*----------------------------------------------------------------------------
47 * Exported functions
48 *----------------------------------------------------------------------------*/
49
50extern void FLASHD_Initialize( uint32_t dwMCk, uint32_t dwUseIAP ) ;
51
52extern uint32_t FLASHD_Erase( uint32_t dwAddress ) ;
53
54extern uint32_t FLASHD_Write( uint32_t dwAddress, const void *pvBuffer, uint32_t dwSize ) ;
55
56extern uint32_t FLASHD_Lock( uint32_t dwStart, uint32_t dwEnd, uint32_t *pdwActualStart, uint32_t *pdwActualEnd ) ;
57
58extern uint32_t FLASHD_Unlock( uint32_t dwStart, uint32_t dwEnd, uint32_t *pdwActualStart, uint32_t *pdwActualEnd ) ;
59
60extern uint32_t FLASHD_IsLocked( uint32_t dwStart, uint32_t dwEnd ) ;
61
62extern uint32_t FLASHD_SetGPNVM( uint8_t gpnvm ) ;
63
64extern uint32_t FLASHD_ClearGPNVM( uint8_t gpnvm ) ;
65
66extern uint32_t FLASHD_IsGPNVMSet( uint8_t gpnvm ) ;
67
68#define FLASHD_IsSecurityBitSet() FLASHD_IsGPNVMSet( 0 )
69
70#define FLASHD_SetSecurityBit() FLASHD_SetGPNVM( 0 )
71
72extern uint32_t FLASHD_ReadUniqueID( uint32_t* pdwUniqueID ) ;
73
74#ifdef __cplusplus
75}
76#endif
77
78#endif /* #ifndef _FLASHD_ */
79