avrtarget.h

Go to the documentation of this file.
00001 #ifndef _DEV_AVRTARGET_H_
00002 #define _DEV_AVRTARGET_H_
00003 
00004 /*
00005  * Copyright (C) 2007 by egnite Software GmbH. All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. Neither the name of the copyright holders nor the names of
00017  *    contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
00021  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00022  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00023  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
00024  * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00025  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00026  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00027  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00028  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00030  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00031  * SUCH DAMAGE.
00032  *
00033  * For additional information see http://www.ethernut.de/
00034  */
00035 
00036 #include <cfg/progif.h>
00037 
00052 #ifndef AVRTARGET_PAGESIZE
00053 
00058 #define AVRTARGET_PAGESIZE      128
00059 #endif
00060 
00061 /*
00062  * AVR target device signatures.
00063  */
00064 #define AVRSIGNATURE_MEGA8      0x001E9307UL
00065 #define AVRSIGNATURE_MEGA168    0x001E9406UL
00066 #define AVRSIGNATURE_MEGA103    0x001E9701UL
00067 #define AVRSIGNATURE_MEGA128    0x001E9702UL
00068 #define AVRSIGNATURE_MEGA1280   0x001E9703UL
00069 #define AVRSIGNATURE_MEGA1281   0x001E9704UL
00070 #define AVRSIGNATURE_90CAN128   0x001E9781UL
00071 #define AVRSIGNATURE_MEGA2560   0x001E9801UL
00072 #define AVRSIGNATURE_MEGA2561   0x001E9802UL
00073 
00074 /*
00075  * AVR device programming commands.
00076  */
00077 #define AVRCMD_PROG_ENABLE              0xAC530000UL
00078 #define AVRCMD_CHIP_ERASE               0xAC800000UL
00079 #define AVRCMD_READ_PROG_MEM_LO         0x20000000UL
00080 #define AVRCMD_READ_PROG_MEM_HI         0x28000000UL
00081 #define AVRCMD_LOAD_PROG_MEM_PAGE_LO    0x40000000UL
00082 #define AVRCMD_LOAD_PROG_MEM_PAGE_HI    0x48000000UL
00083 #define AVRCMD_WRITE_PROG_MEM_PAGE      0x4c000000UL
00084 #define AVRCMD_READ_EEPROM_MEM          0xA0000000UL
00085 #define AVRCMD_WRITE_EEPROM_MEM         0xC0000000UL
00086 #define AVRCMD_LOAD_EEPROM_MEM_PAGE     0xC1000000UL
00087 #define AVRCMD_WRITE_EEPROM_MEM_PAGE    0xC2000000UL
00088 #define AVRCMD_READ_LOCK_BITS           0x58000000UL
00089 #define AVRCMD_WRITE_LOCK_BITS          0xACE00000UL
00090 #define AVRCMD_READ_SIGNATURE_BYTE      0x30000000UL
00091 #define AVRCMD_WRITE_FUSE_BITS          0xACA00000UL
00092 #define AVRCMD_WRITE_FUSE_HI_BITS       0xACA80000UL
00093 #define AVRCMD_WRITE_FUSE_EXT_BITS      0xACA40000UL
00094 #define AVRCMD_READ_FUSE_BITS           0x50000000UL
00095 #define AVRCMD_READ_FUSE_HI_BITS        0x58080000UL
00096 #define AVRCMD_READ_FUSE_EXT_BITS       0x50080000UL
00097 #define AVRCMD_READ_CALIBRATION_BYTE    0x38000000UL
00098 #define AVRCMD_POLL_READY               0xF0000000UL
00099 
00100 __BEGIN_DECLS
00101 /* Prototypes */
00102 extern int AvrTargetInit(void);
00103 extern void AvrTargetSelect(ureg_t act);
00104 extern void AvrTargetReset(ureg_t on);
00105 extern u_long AvrTargetCmd(u_long cmd);
00106 extern u_long AvrTargetSignature(void);
00107 extern u_long AvrTargetFusesRead(void);
00108 extern u_long AvrTargetFusesWriteSafe(u_long fuses);
00109 extern int AvrTargetProgEnable(void);
00110 extern int AvrTargetPollReady(u_int tmo);
00111 extern int AvrTargetChipErase(void);
00112 extern void AvrTargetPageLoad(u_long page, CONST u_char * data);
00113 extern int AvrTargetPageWrite(u_long page);
00114 extern int AvrTargetPageVerify(u_long page, CONST u_char * data);
00115 
00116 __END_DECLS
00117 /* End of prototypes */
00118 #endif

© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/