Go to the documentation of this file.00001
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef FLASH_DRV_H
00047 #define FLASH_DRV_H
00048
00049
00050
00051 #include "config.h"
00052
00053
00054
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
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