diff options
| author | tmk <nobody@nowhere> | 2013-11-08 05:19:37 +0900 |
|---|---|---|
| committer | tmk <nobody@nowhere> | 2013-11-08 05:19:37 +0900 |
| commit | 821578293c79c5612f9b77e447295f2947fd6c3d (patch) | |
| tree | ded44cc3a9299b952f4ef26c169d74dff1100168 | |
| parent | c531a185a48a2084c20cc17c40e8274bc27fd734 (diff) | |
| download | qmk_firmware-821578293c79c5612f9b77e447295f2947fd6c3d.tar.gz qmk_firmware-821578293c79c5612f9b77e447295f2947fd6c3d.zip | |
Remove tentative files from blargg
| -rw-r--r-- | converter/adb_usb/Makefile.blargg | 131 | ||||
| -rw-r--r-- | converter/adb_usb/adb_blargg.c | 216 | ||||
| -rw-r--r-- | converter/adb_usb/adb_blargg.h | 38 |
3 files changed, 0 insertions, 385 deletions
diff --git a/converter/adb_usb/Makefile.blargg b/converter/adb_usb/Makefile.blargg deleted file mode 100644 index edce82d69..000000000 --- a/converter/adb_usb/Makefile.blargg +++ /dev/null | |||
| @@ -1,131 +0,0 @@ | |||
| 1 | #---------------------------------------------------------------------------- | ||
| 2 | # On command line: | ||
| 3 | # | ||
| 4 | # make all = Make software. | ||
| 5 | # | ||
| 6 | # make clean = Clean out built project files. | ||
| 7 | # | ||
| 8 | # make coff = Convert ELF to AVR COFF. | ||
| 9 | # | ||
| 10 | # make extcoff = Convert ELF to AVR Extended COFF. | ||
| 11 | # | ||
| 12 | # make program = Download the hex file to the device. | ||
| 13 | # Please customize your programmer settings(PROGRAM_CMD) | ||
| 14 | # | ||
| 15 | # make teensy = Download the hex file to the device, using teensy_loader_cli. | ||
| 16 | # (must have teensy_loader_cli installed). | ||
| 17 | # | ||
| 18 | # make dfu = Download the hex file to the device, using dfu-programmer (must | ||
| 19 | # have dfu-programmer installed). | ||
| 20 | # | ||
| 21 | # make flip = Download the hex file to the device, using Atmel FLIP (must | ||
| 22 | # have Atmel FLIP installed). | ||
| 23 | # | ||
| 24 | # make dfu-ee = Download the eeprom file to the device, using dfu-programmer | ||
| 25 | # (must have dfu-programmer installed). | ||
| 26 | # | ||
| 27 | # make flip-ee = Download the eeprom file to the device, using Atmel FLIP | ||
| 28 | # (must have Atmel FLIP installed). | ||
| 29 | # | ||
| 30 | # make debug = Start either simulavr or avarice as specified for debugging, | ||
| 31 | # with avr-gdb or avr-insight as the front end for debugging. | ||
| 32 | # | ||
| 33 | # make filename.s = Just compile filename.c into the assembler code only. | ||
| 34 | # | ||
| 35 | # make filename.i = Create a preprocessed source file for use in submitting | ||
| 36 | # bug reports to the GCC project. | ||
| 37 | # | ||
| 38 | # To rebuild project do "make clean" then "make all". | ||
| 39 | #---------------------------------------------------------------------------- | ||
| 40 | |||
| 41 | # Target file name (without extension). | ||
| 42 | TARGET = adb_usb_blargg | ||
| 43 | |||
| 44 | # Directory common source filess exist | ||
| 45 | TOP_DIR = ../.. | ||
| 46 | |||
| 47 | # Directory keyboard dependent files exist | ||
| 48 | TARGET_DIR = . | ||
| 49 | |||
| 50 | # project specific files | ||
| 51 | SRC = keymap.c \ | ||
| 52 | matrix.c \ | ||
| 53 | led.c \ | ||
| 54 | adb_blargg.c | ||
| 55 | |||
| 56 | CONFIG_H = config.h | ||
| 57 | |||
| 58 | |||
| 59 | # MCU name | ||
| 60 | #MCU = at90usb1287 | ||
| 61 | MCU = atmega32u4 | ||
| 62 | |||
| 63 | # Processor frequency. | ||
| 64 | # This will define a symbol, F_CPU, in all source code files equal to the | ||
| 65 | # processor frequency in Hz. You can then use this symbol in your source code to | ||
| 66 | # calculate timings. Do NOT tack on a 'UL' at the end, this will be done | ||
| 67 | # automatically to create a 32-bit value in your source code. | ||
| 68 | # | ||
| 69 | # This will be an integer division of F_USB below, as it is sourced by | ||
| 70 | # F_USB after it has run through any CPU prescalers. Note that this value | ||
| 71 | # does not *change* the processor frequency - it should merely be updated to | ||
| 72 | # reflect the processor speed set externally so that the code can use accurate | ||
| 73 | # software delays. | ||
| 74 | F_CPU = 16000000 | ||
| 75 | |||
| 76 | |||
| 77 | # | ||
| 78 | # LUFA specific | ||
| 79 | # | ||
| 80 | # Target architecture (see library "Board Types" documentation). | ||
| 81 | ARCH = AVR8 | ||
| 82 | |||
| 83 | # Input clock frequency. | ||
| 84 | # This will define a symbol, F_USB, in all source code files equal to the | ||
| 85 | # input clock frequency (before any prescaling is performed) in Hz. This value may | ||
| 86 | # differ from F_CPU if prescaling is used on the latter, and is required as the | ||
| 87 | # raw input clock is fed directly to the PLL sections of the AVR for high speed | ||
| 88 | # clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' | ||
| 89 | # at the end, this will be done automatically to create a 32-bit value in your | ||
| 90 | # source code. | ||
| 91 | # | ||
| 92 | # If no clock division is performed on the input clock inside the AVR (via the | ||
| 93 | # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. | ||
| 94 | F_USB = $(F_CPU) | ||
| 95 | |||
| 96 | # Interrupt driven control endpoint task(+60) | ||
| 97 | #OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT | ||
| 98 | |||
| 99 | |||
| 100 | # Boot Section Size in *bytes* | ||
| 101 | # Teensy halfKay 512 | ||
| 102 | # Teensy++ halfKay 1024 | ||
| 103 | # Atmel DFU loader 4096 | ||
| 104 | # LUFA bootloader 4096 | ||
| 105 | # USBaspLoader 2048 | ||
| 106 | OPT_DEFS += -DBOOTLOADER_SIZE=4096 | ||
| 107 | |||
| 108 | |||
| 109 | # Build Options | ||
| 110 | # comment out to disable the options. | ||
| 111 | # | ||
| 112 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) | ||
| 113 | MOUSEKEY_ENABLE = yes # Mouse keys(+4700) | ||
| 114 | EXTRAKEY_ENABLE = yes # Audio control and System control(+450) | ||
| 115 | CONSOLE_ENABLE = yes # Console for debug(+400) | ||
| 116 | COMMAND_ENABLE = yes # Commands for debug and configuration | ||
| 117 | #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend | ||
| 118 | #NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA | ||
| 119 | |||
| 120 | |||
| 121 | # Optimize size but this may cause error "relocation truncated to fit" | ||
| 122 | #EXTRALDFLAGS = -Wl,--relax | ||
| 123 | |||
| 124 | # Search Path | ||
| 125 | VPATH += $(TARGET_DIR) | ||
| 126 | VPATH += $(TOP_DIR) | ||
| 127 | |||
| 128 | include $(TOP_DIR)/protocol/lufa.mk | ||
| 129 | include $(TOP_DIR)/protocol.mk | ||
| 130 | include $(TOP_DIR)/common.mk | ||
| 131 | include $(TOP_DIR)/rules.mk | ||
diff --git a/converter/adb_usb/adb_blargg.c b/converter/adb_usb/adb_blargg.c deleted file mode 100644 index 963758c53..000000000 --- a/converter/adb_usb/adb_blargg.c +++ /dev/null | |||
| @@ -1,216 +0,0 @@ | |||
| 1 | // Bit-banged implementation without any use of interrupts. | ||
| 2 | // Data pin must have external 1K pull-up resistor. | ||
| 3 | // Operates data pin as open-collector output. | ||
| 4 | |||
| 5 | #include "adb_blargg.h" | ||
| 6 | |||
| 7 | #ifdef HAVE_CONFIG_H | ||
| 8 | #include "config.h" | ||
| 9 | #endif | ||
| 10 | |||
| 11 | #include <avr/io.h> | ||
| 12 | #include <avr/interrupt.h> | ||
| 13 | #include <util/delay.h> | ||
| 14 | |||
| 15 | // Copyright 2011 Jun WAKO <wakojun@gmail.com> | ||
| 16 | // Copyright 2013 Shay Green <gblargg@gmail.com> | ||
| 17 | // See bottom of file for license | ||
| 18 | |||
| 19 | typedef uint8_t byte; | ||
| 20 | |||
| 21 | // Make loop iteration take us total, including cyc overhead of loop logic | ||
| 22 | #define delay_loop_usec( us, cyc ) \ | ||
| 23 | __builtin_avr_delay_cycles( (unsigned long) (F_CPU / 1e6 * (us) + 0.5) - (cyc) ) | ||
| 24 | |||
| 25 | #if !defined(ADB_PORT) || \ | ||
| 26 | !defined(ADB_PIN) || \ | ||
| 27 | !defined(ADB_DDR) || \ | ||
| 28 | !defined(ADB_DATA_BIT) | ||
| 29 | #error | ||
| 30 | #endif | ||
| 31 | |||
| 32 | enum { data_mask = 1<<ADB_DATA_BIT }; | ||
| 33 | |||
| 34 | enum { adb_cmd_read = 0x2C }; | ||
| 35 | enum { adb_cmd_write = 0x28 }; | ||
| 36 | |||
| 37 | // gcc is very unreliable for inlining, so use macros | ||
| 38 | #define data_lo() (ADB_DDR |= data_mask) | ||
| 39 | #define data_hi() (ADB_DDR &= ~data_mask) | ||
| 40 | #define data_in() (ADB_PIN & data_mask) | ||
| 41 | |||
| 42 | static void place_bit( byte bit ) | ||
| 43 | { | ||
| 44 | // 100 us bit cell time | ||
| 45 | data_lo(); | ||
| 46 | _delay_us( 35 ); | ||
| 47 | |||
| 48 | // Difference between a 0 and 1 bit is just this 30us portion in the middle | ||
| 49 | if ( bit ) | ||
| 50 | data_hi(); | ||
| 51 | _delay_us( 30 ); | ||
| 52 | |||
| 53 | data_hi(); | ||
| 54 | _delay_us( 35 ); | ||
| 55 | } | ||
| 56 | |||
| 57 | static void place_bit0( void ) { place_bit( 0 ); } | ||
| 58 | static void place_bit1( void ) { place_bit( 1 ); } | ||
| 59 | |||
| 60 | static void send_byte( byte data ) | ||
| 61 | { | ||
| 62 | for ( byte n = 8; n; n-- ) | ||
| 63 | { | ||
| 64 | place_bit( data & 0x80 ); | ||
| 65 | data <<= 1; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | static void command( byte cmd ) | ||
| 70 | { | ||
| 71 | data_lo(); | ||
| 72 | _delay_us( 800 ); | ||
| 73 | place_bit1(); | ||
| 74 | send_byte( cmd ); | ||
| 75 | place_bit0(); | ||
| 76 | } | ||
| 77 | |||
| 78 | void adb_host_init( void ) | ||
| 79 | { | ||
| 80 | // Always keep port output 0, then just toggle DDR to be GND or leave it floating (high). | ||
| 81 | ADB_DDR &= ~data_mask; | ||
| 82 | ADB_PORT &= ~data_mask; | ||
| 83 | |||
| 84 | #ifdef ADB_PSW_BIT | ||
| 85 | // Weak pull-up | ||
| 86 | ADB_PORT |= (1<<ADB_PSW_BIT); | ||
| 87 | ADB_DDR &= ~(1<<ADB_PSW_BIT); | ||
| 88 | #endif | ||
| 89 | } | ||
| 90 | |||
| 91 | bool adb_host_psw( void ) | ||
| 92 | { | ||
| 93 | #ifdef ADB_PSW_BIT | ||
| 94 | return (ADB_PIN & (1<<ADB_PSW_BIT)) != 0; | ||
| 95 | #else | ||
| 96 | return true; | ||
| 97 | #endif | ||
| 98 | } | ||
| 99 | |||
| 100 | // Waits while data == val, or until us timeout expires. Returns remaining time, | ||
| 101 | // zero if timed out. | ||
| 102 | static byte while_data( byte us, byte data ) | ||
| 103 | { | ||
| 104 | while ( data_in() == data ) | ||
| 105 | { | ||
| 106 | delay_loop_usec( 1 /* us period */, 7 /* cycles loop overhead */ ); | ||
| 107 | if ( !--us ) | ||
| 108 | break; | ||
| 109 | } | ||
| 110 | return us; | ||
| 111 | } | ||
| 112 | |||
| 113 | static byte while_lo( byte us ) { return while_data( us, 0 ); } | ||
| 114 | static byte while_hi( byte us ) { return while_data( us, data_mask ); } | ||
| 115 | |||
| 116 | static uint16_t adb_host_talk( byte cmd ) | ||
| 117 | { | ||
| 118 | command( cmd ); | ||
| 119 | _delay_us( 5 ); | ||
| 120 | if ( !while_hi( 260 - 5 ) ) // avg 160 | ||
| 121 | return adb_host_nothing; | ||
| 122 | |||
| 123 | // Receive start bit and 16 data bits. | ||
| 124 | // Doing them all in loop allows consistent error checking | ||
| 125 | uint16_t data = 0; | ||
| 126 | byte n = 17; | ||
| 127 | do | ||
| 128 | { | ||
| 129 | data <<= 1; | ||
| 130 | enum { timeout = 130 }; // maximum bit cell time | ||
| 131 | |||
| 132 | byte lo = while_lo( timeout ); | ||
| 133 | if ( !lo ) | ||
| 134 | goto error; // timeout | ||
| 135 | |||
| 136 | byte hi = while_hi( lo ); | ||
| 137 | if ( !hi ) | ||
| 138 | goto error; // timeout | ||
| 139 | |||
| 140 | if ( timeout-lo < lo-hi ) | ||
| 141 | data |= 1; | ||
| 142 | else if ( n == 17 ) | ||
| 143 | goto error; // start bit is wrong | ||
| 144 | } | ||
| 145 | while ( --n ); | ||
| 146 | |||
| 147 | // duration must be split in two due to 255 limit | ||
| 148 | if ( !while_lo( 255 ) && !while_lo( 351 - 255 ) ) | ||
| 149 | goto error; | ||
| 150 | |||
| 151 | if ( while_hi( 91 ) ) | ||
| 152 | goto error; | ||
| 153 | |||
| 154 | return data; | ||
| 155 | |||
| 156 | error: | ||
| 157 | return adb_host_error; | ||
| 158 | } | ||
| 159 | |||
| 160 | uint16_t adb_host_kbd_recv( void ) | ||
| 161 | { | ||
| 162 | return adb_host_talk( adb_cmd_read + 0 ); | ||
| 163 | } | ||
| 164 | |||
| 165 | uint16_t adb_host_kbd_modifiers( void ) | ||
| 166 | { | ||
| 167 | return adb_host_talk( adb_cmd_read + 2 ); | ||
| 168 | } | ||
| 169 | |||
| 170 | void adb_host_listen( byte cmd, byte data_h, byte data_l ) | ||
| 171 | { | ||
| 172 | command( cmd ); | ||
| 173 | _delay_us( 200 ); | ||
| 174 | |||
| 175 | place_bit1(); | ||
| 176 | send_byte( data_h ); | ||
| 177 | send_byte( data_l ); | ||
| 178 | place_bit0(); | ||
| 179 | } | ||
| 180 | |||
| 181 | void adb_host_kbd_led( byte led ) | ||
| 182 | { | ||
| 183 | adb_host_listen( adb_cmd_write + 2, 0, led & 0x07 ); | ||
| 184 | } | ||
| 185 | |||
| 186 | /* This software is licensed with a Modified BSD License. | ||
| 187 | All of this is supposed to be Free Software, Open Source, DFSG-free, | ||
| 188 | GPL-compatible, and OK to use in both free and proprietary applications. | ||
| 189 | Additions and corrections to this file are welcome. | ||
| 190 | |||
| 191 | Redistribution and use in source and binary forms, with or without | ||
| 192 | modification, are permitted provided that the following conditions are met: | ||
| 193 | |||
| 194 | * Redistributions of source code must retain the above copyright | ||
| 195 | notice, this list of conditions and the following disclaimer. | ||
| 196 | |||
| 197 | * Redistributions in binary form must reproduce the above copyright | ||
| 198 | notice, this list of conditions and the following disclaimer in | ||
| 199 | the documentation and/or other materials provided with the | ||
| 200 | distribution. | ||
| 201 | |||
| 202 | * Neither the name of the copyright holders nor the names of | ||
| 203 | contributors may be used to endorse or promote products derived | ||
| 204 | from this software without specific prior written permission. | ||
| 205 | |||
| 206 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| 207 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 208 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 209 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
| 210 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 211 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 212 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 213 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 214 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 215 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 216 | POSSIBILITY OF SUCH DAMAGE. */ | ||
diff --git a/converter/adb_usb/adb_blargg.h b/converter/adb_usb/adb_blargg.h deleted file mode 100644 index 2542cb549..000000000 --- a/converter/adb_usb/adb_blargg.h +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | // Basic support for ADB keyboard | ||
| 2 | |||
| 3 | #ifndef ADB_BLARGG_H | ||
| 4 | #define ADB_BLARGG_H | ||
| 5 | |||
| 6 | #include <stdint.h> | ||
| 7 | #include <stdbool.h> | ||
| 8 | |||
| 9 | // Sets up ADB bus. Doesn't send anything to keyboard. | ||
| 10 | void adb_host_init( void ); | ||
| 11 | |||
| 12 | // Receives key press event from keyboard. | ||
| 13 | // 0xKKFF: one key changed state | ||
| 14 | // 0xKKKK: two keys changed state | ||
| 15 | enum { adb_host_nothing = 0 }; // no keys changed state | ||
| 16 | enum { adb_host_error = 0xFFFE }; // receive error | ||
| 17 | uint16_t adb_host_kbd_recv( void ); | ||
| 18 | |||
| 19 | // Current state of keyboard modifiers and a few other keys | ||
| 20 | // Returns adb_host_nothing if keyboard didn't respond. | ||
| 21 | // Returns adb_host_error if error receiving. | ||
| 22 | uint16_t adb_host_kbd_modifiers( void ); | ||
| 23 | |||
| 24 | // Sends command and two bytes of data to keyboard | ||
| 25 | void adb_host_listen( uint8_t cmd, uint8_t data_h, uint8_t data_l ); | ||
| 26 | |||
| 27 | // Sets keyboard LEDs. Note that bits are inverted here, so 1 means off, 0 means on. | ||
| 28 | void adb_host_kbd_led( uint8_t led ); | ||
| 29 | |||
| 30 | // State of power switch (false = pressed), or true if unsupported | ||
| 31 | bool adb_host_psw( void ); | ||
| 32 | |||
| 33 | |||
| 34 | // Legacy support | ||
| 35 | #define ADB_POWER 0x7F | ||
| 36 | #define ADB_CAPS 0x39 | ||
| 37 | |||
| 38 | #endif | ||
