001 /* 002 * Copyright (c) 2011, Willem Cazander 003 * All rights reserved. 004 * 005 * Redistribution and use in source and binary forms, with or without modification, are permitted provided 006 * that the following conditions are met: 007 * 008 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the 009 * following disclaimer. 010 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and 011 * the following disclaimer in the documentation and/or other materials provided with the distribution. 012 * 013 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 014 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 015 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 016 * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 017 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 018 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 019 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 020 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 021 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 022 */ 023 024 package org.nongnu.pulsefire.device.flash.avr; 025 026 /** 027 * Stk500Command lists all tokes used in stk500 protocol definition. 028 * 029 * @author Willem Cazander 030 */ 031 public enum Stk500Command implements FlashCommandToken { 032 033 STK_OK (0x10), 034 STK_FAILED (0x11), // Not used 035 STK_UNKNOWN (0x12), // Not used 036 STK_NODEVICE (0x13), // Not used 037 STK_INSYNC (0x14), // ' ' 038 STK_NOSYNC (0x15), // Not used 039 ADC_CHANNEL_ERROR (0x16), // Not used 040 ADC_MEASURE_OK (0x17), // Not used 041 PWM_CHANNEL_ERROR (0x18), // Not used 042 PWM_ADJUST_OK (0x19), // Not used 043 CRC_EOP (0x20), // 'SPACE' 044 STK_GET_SYNC (0x30), // '0' 045 STK_GET_SIGN_ON (0x31), // '1' 046 STK_SET_PARAMETER (0x40), // '@' 047 STK_GET_PARAMETER (0x41), // 'A' 048 STK_SET_DEVICE (0x42), // 'B' 049 STK_SET_DEVICE_EXT (0x45), // 'E' 050 STK_ENTER_PROGMODE (0x50), // 'P' 051 STK_LEAVE_PROGMODE (0x51), // 'Q' 052 STK_CHIP_ERASE (0x52), // 'R' 053 STK_CHECK_AUTOINC (0x53), // 'S' 054 STK_LOAD_ADDRESS (0x55), // 'U' 055 STK_UNIVERSAL (0x56), // 'V' 056 STK_PROG_FLASH (0x60), // '`' 057 STK_PROG_DATA (0x61), // 'a' 058 STK_PROG_FUSE (0x62), // 'b' 059 STK_PROG_LOCK (0x63), // 'c' 060 STK_PROG_PAGE (0x64), // 'd' 061 STK_PROG_FUSE_EXT (0x65), // 'e' 062 STK_READ_FLASH (0x70), // 'p' 063 STK_READ_DATA (0x71), // 'q' 064 STK_READ_FUSE (0x72), // 'r' 065 STK_READ_LOCK (0x73), // 's' 066 STK_READ_PAGE (0x74), // 't' 067 STK_READ_SIGN (0x75), // 'u' 068 STK_READ_OSCCAL (0x76), // 'v' 069 STK_READ_FUSE_EXT (0x77), // 'w' 070 STK_READ_OSCCAL_EXT (0x78); // 'x' 071 072 private final Integer token; 073 private Stk500Command(Integer token) { 074 this.token = token; 075 } 076 077 public Integer getToken() { 078 return token; 079 } 080 081 static public Stk500Command valueOfToken(Integer token) { 082 for (Stk500Command c:values()) { 083 if (c.getToken().equals(token)) { 084 return c; 085 } 086 } 087 return null; 088 } 089 }