summaryrefslogtreecommitdiff
path: root/avr/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'avr/main.c')
-rw-r--r--avr/main.c103
1 files changed, 37 insertions, 66 deletions
diff --git a/avr/main.c b/avr/main.c
index 11c0e03..c18d888 100644
--- a/avr/main.c
+++ b/avr/main.c
@@ -1,73 +1,44 @@
/*
- Project: DS1992 memory iButton dumper
- Author: Florian Jung (flo@windfisch.org)
- Copyright: (c) 2015 by Florian Jung
- License: GNU GPL v3 (see LICENSE)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 3 as
- published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- This project is based on the code for the AVR ATtiny USB Tutorial at
- http://codeandlife.com/ by Joonas Pihlajamaa, joonas.pihlajamaa@iki.fi,
- which is in turn based on the V-USB example code by Christian Starkjohann
- (Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH)
-*/
+Project: DS1992 memory iButton dumper
+Author: Florian Jung (flo@windfisch.org)
+Copyright (c) 2015,2016, Florian Jung. All rights reserved.
+
+License: 3-Clause-BSD as follows:
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
-/* this project is designed for the USB AVR LAB board by ullihome
- * (http://www.ullihome.de/wiki/USBAVRLab/index)
- * That's a small Atmega8-powered board with software-USB and a small pinout
- * that looks like this:
- * ____ ____ ____ ____
- * | . . . . . | | o . . . . |
- * | . . . . . | or | x . . . . |
- * |___________| |___________|
- *
- * hold the DS1992 token against the pins, so that the outer ring touches the
- * "x" pin, while the inner circle touches the "o" pin.
- *
- * How to use:
- * the dumping device has three modes of operation, which are shown by the blinking
- * speed of the blue LED.
- * 1. reading mode: normal blinking
- * 2. reading mode: slooow blinking (previous operation failed)
- * 3. writing mode: fast blinking
- *
- * in either mode, the red LED flashes periodically. This means that the device
- * probed for a DS1992, but couldn't find anything on the bus. If you hold you
- * DS1992 against the pins, the flashing will turn green instead. This means that
- * the token has been read into the device's RAM.
- * You can now use `pc/a.out read` to read the contents.
- * (If both green and red leds flash, this means you've a short circuit.)
- *
- * If you execute `pc/a.out write <page> <data>`, then the device will enter
- * writing mode. The flashing red LED has the same meaning as before. If you now
- * connect the token, the page <page> (1-indexed) will be written to with <data>,
- * whenever the LED flashes green the next time.
- * After that, the device enters reading mode again. If the LED blinks really slow,
- * then there was a write error. re-execute a.out write, reconnect the token and retry.
- * Additionally, after writing you can use `a.out read` again (without connecting the
- * token for reading previously). This will output you a lot of garbage, but the first
- * byte read tells you a more detailed error code:
- * 0x01: "reset/presence pulse" failed after scratchpad write
- * 0x02: scratchpad did not verify correctly
- * 0x03: "reset/presence pulse" failed after scratchpad readback + verify
- * 0xFF: probably successful
- *
- * Note that you should read back the data after writing, just to be sure.
- * Also note that while you can read the whole memory at once, you must execute the write
- * command, and also connect the token, four times for a full write (once for each page).
- */
+3. Neither the name of the copyright holder nor the names of its contributors
+may be used to endorse or promote products derived from this software without
+specific prior written permission.
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+This project is based on the code for the AVR ATtiny USB Tutorial at
+http://codeandlife.com/ by Joonas Pihlajamaa, joonas.pihlajamaa@iki.fi,
+which is in turn based on the V-USB example code by Christian Starkjohann
+(Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH)
+
+Note that, while this file is BSD-licensed, different licensing applies for
+V-USB, and thus for the resulting binaries.
+*/
#include <avr/io.h>