- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

# flash_drv.h

Go to the documentation of this file.

    00001 /*This file is prepared for Doxygen automatic documentation generation.*/
    00014
    00015 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
    00016  *
    00017  * Redistribution and use in source and binary forms, with or without
    00018  * modification, are permitted provided that the following conditions are met:
    00019  *
    00020  * 1. Redistributions of source code must retain the above copyright notice,
    00021  * this list of conditions and the following disclaimer.
    00022  *
    00023  * 2. Redistributions in binary form must reproduce the above copyright notice,
    00024  * this list of conditions and the following disclaimer in the documentation
    00025  * and/or other materials provided with the distribution.
    00026  *
    00027  * 3. The name of Atmel may not be used to endorse or promote products derived
    00028  * from this software without specific prior written permission.
    00029  *
    00030  * 4. This software may only be redistributed and used in connection with an Atmel
    00031  * AVR product.
    00032  *
    00033  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
    00034  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00035  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND
    00036  * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
    00037  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    00038  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    00039  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    00040  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    00041  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    00042  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00043  */
    00044
    00045
    00046 #ifndef FLASH_DRV_H
    00047 #define FLASH_DRV_H
    00048
    00049 //_____ I N C L U D E S ______________________________________________________
    00050
    00051 #include "config.h"
    00052
    00053
    00054 //_____ M A C R O S ________________________________________________________
    00055
    00058 #define Flash_read_id1()            ( flash_read_sig(0x0000))  //!< This macro function allows to read device ID1 of the product.
    00059 #define Flash_read_id2()            ( flash_read_sig(0x0002))  //!< This macro function allows to read device ID2 of the product.
    00060 #define Flash_read_id3()            ( flash_read_sig(0x0004))  //!< This macro function allows to read device ID3 of the product.
    00061 #define Flash_read_osccal()         ( flash_read_sig(0x0001))  //!< This macro function allows to read the OSCAL byte of the product.
    00062 #define Flash_read_sn(pos)          ( flash_read_sig((0x07*2)+pos))//!< This macro function allows to read the serial number of the product.
    00063 #define SN_LENGTH                   10                         //!< Size of the serial number containt in product.
    00064
    00065
    00068 #define Flash_read_fuse_low()       ( flash_read_fuse(0x0000)) //!< @brief This macro function allows to read the low fuse byte of the product.
    00069 #define Flash_read_fuse_high()      ( flash_read_fuse(0x0003)) //!< @brief This macro function allows to read device high fuse byte of the product.
    00070 #define Flash_read_fuse_extended()  ( flash_read_fuse(0x0002)) //!< @brief This macro function allows to read extended fuse byte of the product.
    00071 #define Flash_read_lock()           ( flash_read_fuse(0x0001)) //!< @brief This macro function allows to read lock byte of the product.
    00072
    00073
    00076 #define Is_OCD_enable()             (0==(Flash_read_fuse_high()&(1<<FUSE_OCDEN_bp)))  //!< @brief Check if the OCD is running
    00077 #define Is_JTAG_enable()            (0==(Flash_read_fuse_high()&(1<<FUSE_JTAGEN_bp))) //!< @brief Check if the JTAG interface is enabled
    00078
    00079
    00080
    00083 #define FUSE_BOOTRST_bp    0  // Select Reset Vector
    00084 #define FUSE_BOOTSZ0_bp    1  // Select Boot Size
    00085 #define FUSE_BOOTSZ1_bp    2  // Select Boot Size
    00086 #define FUSE_EESAVE_bp     3  // EEPROM memory is preserved through chip erase
    00087 #define FUSE_WDTON_bp      4  // Watchdog timer always on
    00088 #define FUSE_SPIEN_bp      5  // Enable Serial programming and Data Downloading
    00089 #define FUSE_JTAGEN_bp     6  // Enable JTAG
    00090 #define FUSE_OCDEN_bp      7  // Enable OCD
    00091
    00092
    00093
    00094 //_____ D E C L A R A T I O N S ____________________________________________
    00095
    00102 U8    flash_read_sig(unsigned long adr);
    00103
    00110 U8    flash_read_fuse(unsigned long adr);
    00111
    00112
    00113 #endif  // FLASH_DRV_H
    00114
    00115
    00116