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

# flash_drv.h File Reference

`#include "config.h"`

Include dependency graph for flash_drv.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
These macros allow to read a specific device ID of the product.
#define | Flash_read_id1() ( flash_read_sig(0x0000))
| This macro function allows to read device ID1 of the product.
#define | Flash_read_id2() ( flash_read_sig(0x0002))
| This macro function allows to read device ID2 of the product.
#define | Flash_read_id3() ( flash_read_sig(0x0004))
| This macro function allows to read device ID3 of the product.
#define | Flash_read_osccal() ( flash_read_sig(0x0001))
| This macro function allows to read the OSCAL byte of the product.
#define | Flash_read_sn(pos) ( flash_read_sig((0x07*2)+pos))
| This macro function allows to read the serial number of the product.
#define | SN_LENGTH 10
| Size of the serial number containt in product.
These macros allow to read a specific fuse of the product.
#define | Flash_read_fuse_low() ( flash_read_fuse(0x0000))
#define | Flash_read_fuse_high() ( flash_read_fuse(0x0003))
#define | Flash_read_fuse_extended() ( flash_read_fuse(0x0002))
#define | Flash_read_lock() ( flash_read_fuse(0x0001))
These macros allow to check bits from extended fuse of the product.
#define | Is_OCD_enable() (0==(Flash_read_fuse_high()&(1<<FUSE_OCDEN_bp)))
#define | Is_JTAG_enable() (0==(Flash_read_fuse_high()&(1<<FUSE_JTAGEN_bp)))
High Fuse Byte
#define | FUSE_BOOTRST_bp 0
#define | FUSE_BOOTSZ0_bp 1
#define | FUSE_BOOTSZ1_bp 2
#define | FUSE_EESAVE_bp 3
#define | FUSE_WDTON_bp 4
#define | FUSE_SPIEN_bp 5
#define | FUSE_JTAGEN_bp 6
#define | FUSE_OCDEN_bp 7
## Functions
U8 | flash_read_sig (unsigned long adr)
U8 | flash_read_fuse (unsigned long adr)

## Detailed Description

Driver routines to read (no write) datas stored in AVRMega flash These routines can be stored and executed in all flash space.

- Compiler: IAR EWAVR and GNU GCC for AVR
- Supported devices: All AVRMega devices

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file flash_drv.h.

## Define Documentation

#define Flash_read_id1 | ( |  | ) | ( flash_read_sig(0x0000))

This macro function allows to read device ID1 of the product.

Definition at line 55 of file flash_drv.h.

#define Flash_read_id2 | ( |  | ) | ( flash_read_sig(0x0002))

This macro function allows to read device ID2 of the product.

Definition at line 56 of file flash_drv.h.

#define Flash_read_id3 | ( |  | ) | ( flash_read_sig(0x0004))

This macro function allows to read device ID3 of the product.

Definition at line 57 of file flash_drv.h.

#define Flash_read_osccal | ( |  | ) | ( flash_read_sig(0x0001))

This macro function allows to read the OSCAL byte of the product.

Definition at line 58 of file flash_drv.h.

#define Flash_read_sn | ( | pos |  | ) | ( flash_read_sig((0x07*2)+pos))

This macro function allows to read the serial number of the product.

Definition at line 59 of file flash_drv.h.

Referenced by usb_get_descriptor().

#define SN_LENGTH 10

Size of the serial number containt in product.

Definition at line 60 of file flash_drv.h.

Referenced by usb_user_get_descriptor().

#define Flash_read_fuse_low | ( |  | ) | ( flash_read_fuse(0x0000))

This macro function allows to read the low fuse byte of the product.

Definition at line 65 of file flash_drv.h.

#define Flash_read_fuse_high | ( |  | ) | ( flash_read_fuse(0x0003))

This macro function allows to read device high fuse byte of the product.

Definition at line 66 of file flash_drv.h.

#define Flash_read_fuse_extended | ( |  | ) | ( flash_read_fuse(0x0002))

This macro function allows to read extended fuse byte of the product.

Definition at line 67 of file flash_drv.h.

#define Flash_read_lock | ( |  | ) | ( flash_read_fuse(0x0001))

This macro function allows to read lock byte of the product.

Definition at line 68 of file flash_drv.h.

#define Is_OCD_enable | ( |  | ) | (0==(Flash_read_fuse_high()&(1<<FUSE_OCDEN_bp)))

Check if the OCD is running

Definition at line 73 of file flash_drv.h.

#define Is_JTAG_enable | ( |  | ) | (0==(Flash_read_fuse_high()&(1<<FUSE_JTAGEN_bp)))

Check if the JTAG interface is enabled

Definition at line 74 of file flash_drv.h.

#define FUSE_BOOTRST_bp 0

Definition at line 80 of file flash_drv.h.

#define FUSE_BOOTSZ0_bp 1

Definition at line 81 of file flash_drv.h.

#define FUSE_BOOTSZ1_bp 2

Definition at line 82 of file flash_drv.h.

#define FUSE_EESAVE_bp 3

Definition at line 83 of file flash_drv.h.

#define FUSE_WDTON_bp 4

Definition at line 84 of file flash_drv.h.

#define FUSE_SPIEN_bp 5

Definition at line 85 of file flash_drv.h.

#define FUSE_JTAGEN_bp 6

Definition at line 86 of file flash_drv.h.

#define FUSE_OCDEN_bp 7

Definition at line 87 of file flash_drv.h.

## Function Documentation

U8 flash_read_sig | ( | unsigned long | adr | ) |

This macro function allows to read device IDs of the product.

Parameters:

  | add | Address of device ID to read.

Returns:
  byte Read value

U8 flash_read_fuse | ( | unsigned long | adr | ) |

This macro function allows to read a fuse byte of the product.

Parameters:

  | add | Address of fuse to read.

Returns:
  byte Read value