diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index de622df5..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,27 +0,0 @@ -Codes are released under each license. See heading of each file for details. - -Modified BSD license: - ps2.c - ps2.h - adb.c - adb.h - -GPLv2 or later: - other codes - -PJRC's license: - print.c - print.h - pjrc/ - -GPLv2 or GPLv3 or OBJECTIVE DEVELOPMENT's commercial license: - vusb/ - - - - -This software includes following codes from other parties. - - V-USB from OBJECTIVE DEVELOPMENT - http://www.obdev.at/products/vusb/index.html - - Teensy example codes from PJRC - http://www.pjrc.com/teensy/ diff --git a/bootloader.c b/common/bootloader.c similarity index 100% rename from bootloader.c rename to common/bootloader.c diff --git a/bootloader.h b/common/bootloader.h similarity index 100% rename from bootloader.h rename to common/bootloader.h diff --git a/command.c b/common/command.c similarity index 100% rename from command.c rename to common/command.c diff --git a/command.h b/common/command.h similarity index 100% rename from command.h rename to common/command.h diff --git a/controller_teensy.h b/common/controller_teensy.h similarity index 100% rename from controller_teensy.h rename to common/controller_teensy.h diff --git a/debug.h b/common/debug.h similarity index 100% rename from debug.h rename to common/debug.h diff --git a/host.c b/common/host.c similarity index 100% rename from host.c rename to common/host.c diff --git a/host.h b/common/host.h similarity index 100% rename from host.h rename to common/host.h diff --git a/host_driver.h b/common/host_driver.h similarity index 100% rename from host_driver.h rename to common/host_driver.h diff --git a/keyboard.c b/common/keyboard.c similarity index 100% rename from keyboard.c rename to common/keyboard.c diff --git a/keyboard.h b/common/keyboard.h similarity index 100% rename from keyboard.h rename to common/keyboard.h diff --git a/keymap.h b/common/keymap.h similarity index 100% rename from keymap.h rename to common/keymap.h diff --git a/layer.c b/common/layer.c similarity index 100% rename from layer.c rename to common/layer.c diff --git a/layer.h b/common/layer.h similarity index 100% rename from layer.h rename to common/layer.h diff --git a/led.h b/common/led.h similarity index 100% rename from led.h rename to common/led.h diff --git a/matrix.h b/common/matrix.h similarity index 100% rename from matrix.h rename to common/matrix.h diff --git a/mousekey.c b/common/mousekey.c similarity index 100% rename from mousekey.c rename to common/mousekey.c diff --git a/mousekey.h b/common/mousekey.h similarity index 100% rename from mousekey.h rename to common/mousekey.h diff --git a/print.c b/common/print.c similarity index 100% rename from print.c rename to common/print.c diff --git a/print.h b/common/print.h similarity index 100% rename from print.h rename to common/print.h diff --git a/report.h b/common/report.h similarity index 100% rename from report.h rename to common/report.h diff --git a/sendchar.h b/common/sendchar.h similarity index 100% rename from sendchar.h rename to common/sendchar.h diff --git a/sendchar_null.c b/common/sendchar_null.c similarity index 100% rename from sendchar_null.c rename to common/sendchar_null.c diff --git a/sendchar_uart.c b/common/sendchar_uart.c similarity index 100% rename from sendchar_uart.c rename to common/sendchar_uart.c diff --git a/timer.c b/common/timer.c similarity index 100% rename from timer.c rename to common/timer.c diff --git a/timer.h b/common/timer.h similarity index 100% rename from timer.h rename to common/timer.h diff --git a/uart.c b/common/uart.c similarity index 100% rename from uart.c rename to common/uart.c diff --git a/uart.h b/common/uart.h similarity index 100% rename from uart.h rename to common/uart.h diff --git a/usb_keycodes.h b/common/usb_keycodes.h similarity index 100% rename from usb_keycodes.h rename to common/usb_keycodes.h diff --git a/util.c b/common/util.c similarity index 100% rename from util.c rename to common/util.c diff --git a/util.h b/common/util.h similarity index 100% rename from util.h rename to common/util.h diff --git a/COPYING.GPLv2 b/doc/COPYING.GPLv2 similarity index 100% rename from COPYING.GPLv2 rename to doc/COPYING.GPLv2 diff --git a/COPYING.GPLv3 b/doc/COPYING.GPLv3 similarity index 100% rename from COPYING.GPLv3 rename to doc/COPYING.GPLv3 diff --git a/hhkb/FUSE.txt b/doc/FUSE.txt similarity index 100% rename from hhkb/FUSE.txt rename to doc/FUSE.txt diff --git a/POWER.txt b/doc/POWER.txt similarity index 100% rename from POWER.txt rename to doc/POWER.txt diff --git a/USB_NKRO.txt b/doc/USB_NKRO.txt similarity index 100% rename from USB_NKRO.txt rename to doc/USB_NKRO.txt diff --git a/pjrc/host.c b/pjrc/host.c deleted file mode 100644 index fcf71d57..00000000 --- a/pjrc/host.c +++ /dev/null @@ -1,183 +0,0 @@ -/* -Copyright 2011 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -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 . -*/ - -#include -#include -#include "usb_keycodes.h" -#include "usb_keyboard.h" -#if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE) -#include "usb_mouse.h" -#endif -#ifdef EXTRAKEY_ENABLE -#include "usb_extra.h" -#endif -#include "debug.h" -#include "host.h" -#include "util.h" - - -#ifdef NKRO_ENABLE -bool keyboard_nkro = false; -#endif - -static report_keyboard_t report0; -static report_keyboard_t report1; -report_keyboard_t *keyboard_report = &report0; -report_keyboard_t *keyboard_report_prev = &report1; - -static inline void add_key_byte(uint8_t code); -static inline void add_key_bit(uint8_t code); - - -uint8_t host_keyboard_leds(void) -{ - return usb_keyboard_leds; -} - -/* keyboard report operations */ -void host_add_key(uint8_t key) -{ -#ifdef NKRO_ENABLE - if (keyboard_nkro) { - add_key_bit(key); - return; - } -#endif - add_key_byte(key); -} - -void host_add_mod_bit(uint8_t mod) -{ - keyboard_report->mods |= mod; -} - -void host_set_mods(uint8_t mods) -{ - keyboard_report->mods = mods; -} - -void host_add_code(uint8_t code) -{ - if (IS_MOD(code)) { - host_add_mod_bit(MOD_BIT(code)); - } else { - host_add_key(code); - } -} - -void host_swap_keyboard_report(void) -{ - uint8_t sreg = SREG; - cli(); - report_keyboard_t *tmp = keyboard_report_prev; - keyboard_report_prev = keyboard_report; - keyboard_report = tmp; - SREG = sreg; -} - -void host_clear_keyboard_report(void) -{ - keyboard_report->mods = 0; - for (int8_t i = 0; i < REPORT_KEYS; i++) { - keyboard_report->keys[i] = 0; - } -} - -uint8_t host_has_anykey(void) -{ - uint8_t cnt = 0; - for (int i = 0; i < REPORT_KEYS; i++) { - if (keyboard_report->keys[i]) - cnt++; - } - return cnt; -} - -uint8_t host_get_first_key(void) -{ -#ifdef NKRO_ENABLE - if (keyboard_nkro) { - uint8_t i = 0; - for (; i < REPORT_KEYS && !keyboard_report->keys[i]; i++) - ; - return i<<3 | biton(keyboard_report->keys[i]); - } -#endif - return keyboard_report->keys[0]; -} - - -void host_send_keyboard_report(void) -{ - usb_keyboard_send_report(keyboard_report); -} - -#if defined(MOUSEKEY_ENABLE) || defined(PS2_MOUSE_ENABLE) -void host_mouse_send(report_mouse_t *report) -{ - usb_mouse_send(report->x, report->y, report->v, report->h, report->buttons); -} -#endif - -#ifdef EXTRAKEY_ENABLE -void host_system_send(uint16_t data) -{ - usb_extra_system_send(data); -} - -void host_consumer_send(uint16_t data) -{ - static uint16_t last_data = 0; - if (data == last_data) return; - last_data = data; - - usb_extra_consumer_send(data); -} -#endif - - -static inline void add_key_byte(uint8_t code) -{ - // TODO: fix ugly code - int8_t i = 0; - int8_t empty = -1; - for (; i < REPORT_KEYS; i++) { - if (keyboard_report_prev->keys[i] == code) { - keyboard_report->keys[i] = code; - break; - } - if (empty == -1 && - keyboard_report_prev->keys[i] == 0 && - keyboard_report->keys[i] == 0) { - empty = i; - } - } - if (i == REPORT_KEYS) { - if (empty != -1) { - keyboard_report->keys[empty] = code; - } - } -} - -static inline void add_key_bit(uint8_t code) -{ - if ((code>>3) < REPORT_KEYS) { - keyboard_report->keys[code>>3] |= 1<<(code&7); - } else { - debug("add_key_bit: can't add: "); phex(code); debug("\n"); - } -} diff --git a/adb.c b/protocol/adb.c similarity index 100% rename from adb.c rename to protocol/adb.c diff --git a/adb.h b/protocol/adb.h similarity index 100% rename from adb.h rename to protocol/adb.h diff --git a/iwrap.mk b/protocol/iwrap.mk similarity index 100% rename from iwrap.mk rename to protocol/iwrap.mk diff --git a/iwrap/iWRAP.txt b/protocol/iwrap/iWRAP.txt similarity index 100% rename from iwrap/iWRAP.txt rename to protocol/iwrap/iWRAP.txt diff --git a/iwrap/iwrap.c b/protocol/iwrap/iwrap.c similarity index 100% rename from iwrap/iwrap.c rename to protocol/iwrap/iwrap.c diff --git a/iwrap/iwrap.h b/protocol/iwrap/iwrap.h similarity index 100% rename from iwrap/iwrap.h rename to protocol/iwrap/iwrap.h diff --git a/iwrap/main.c b/protocol/iwrap/main.c similarity index 100% rename from iwrap/main.c rename to protocol/iwrap/main.c diff --git a/iwrap/suart.S b/protocol/iwrap/suart.S similarity index 100% rename from iwrap/suart.S rename to protocol/iwrap/suart.S diff --git a/iwrap/suart.h b/protocol/iwrap/suart.h similarity index 100% rename from iwrap/suart.h rename to protocol/iwrap/suart.h diff --git a/iwrap/wd.h b/protocol/iwrap/wd.h similarity index 100% rename from iwrap/wd.h rename to protocol/iwrap/wd.h diff --git a/m0110.c b/protocol/m0110.c similarity index 100% rename from m0110.c rename to protocol/m0110.c diff --git a/m0110.h b/protocol/m0110.h similarity index 100% rename from m0110.h rename to protocol/m0110.h diff --git a/pjrc.mk b/protocol/pjrc.mk similarity index 100% rename from pjrc.mk rename to protocol/pjrc.mk diff --git a/pjrc/bootloader_teensy.c b/protocol/pjrc/bootloader_teensy.c similarity index 100% rename from pjrc/bootloader_teensy.c rename to protocol/pjrc/bootloader_teensy.c diff --git a/pjrc/main.c b/protocol/pjrc/main.c similarity index 100% rename from pjrc/main.c rename to protocol/pjrc/main.c diff --git a/pjrc/pjrc.c b/protocol/pjrc/pjrc.c similarity index 100% rename from pjrc/pjrc.c rename to protocol/pjrc/pjrc.c diff --git a/pjrc/pjrc.h b/protocol/pjrc/pjrc.h similarity index 100% rename from pjrc/pjrc.h rename to protocol/pjrc/pjrc.h diff --git a/pjrc/usb.c b/protocol/pjrc/usb.c similarity index 100% rename from pjrc/usb.c rename to protocol/pjrc/usb.c diff --git a/pjrc/usb.h b/protocol/pjrc/usb.h similarity index 100% rename from pjrc/usb.h rename to protocol/pjrc/usb.h diff --git a/pjrc/usb_debug.c b/protocol/pjrc/usb_debug.c similarity index 100% rename from pjrc/usb_debug.c rename to protocol/pjrc/usb_debug.c diff --git a/pjrc/usb_debug.h b/protocol/pjrc/usb_debug.h similarity index 100% rename from pjrc/usb_debug.h rename to protocol/pjrc/usb_debug.h diff --git a/pjrc/usb_extra.c b/protocol/pjrc/usb_extra.c similarity index 100% rename from pjrc/usb_extra.c rename to protocol/pjrc/usb_extra.c diff --git a/pjrc/usb_extra.h b/protocol/pjrc/usb_extra.h similarity index 100% rename from pjrc/usb_extra.h rename to protocol/pjrc/usb_extra.h diff --git a/pjrc/usb_keyboard.c b/protocol/pjrc/usb_keyboard.c similarity index 100% rename from pjrc/usb_keyboard.c rename to protocol/pjrc/usb_keyboard.c diff --git a/pjrc/usb_keyboard.h b/protocol/pjrc/usb_keyboard.h similarity index 100% rename from pjrc/usb_keyboard.h rename to protocol/pjrc/usb_keyboard.h diff --git a/pjrc/usb_mouse.c b/protocol/pjrc/usb_mouse.c similarity index 100% rename from pjrc/usb_mouse.c rename to protocol/pjrc/usb_mouse.c diff --git a/pjrc/usb_mouse.h b/protocol/pjrc/usb_mouse.h similarity index 100% rename from pjrc/usb_mouse.h rename to protocol/pjrc/usb_mouse.h diff --git a/ps2.c b/protocol/ps2.c similarity index 100% rename from ps2.c rename to protocol/ps2.c diff --git a/ps2.h b/protocol/ps2.h similarity index 100% rename from ps2.h rename to protocol/ps2.h diff --git a/ps2_mouse.c b/protocol/ps2_mouse.c similarity index 100% rename from ps2_mouse.c rename to protocol/ps2_mouse.c diff --git a/ps2_mouse.h b/protocol/ps2_mouse.h similarity index 100% rename from ps2_mouse.h rename to protocol/ps2_mouse.h diff --git a/ps2_usart.c b/protocol/ps2_usart.c similarity index 100% rename from ps2_usart.c rename to protocol/ps2_usart.c diff --git a/vusb.mk b/protocol/vusb.mk similarity index 100% rename from vusb.mk rename to protocol/vusb.mk diff --git a/vusb/bootloader_usbasp.c b/protocol/vusb/bootloader_usbasp.c similarity index 100% rename from vusb/bootloader_usbasp.c rename to protocol/vusb/bootloader_usbasp.c diff --git a/vusb/main.c b/protocol/vusb/main.c similarity index 100% rename from vusb/main.c rename to protocol/vusb/main.c diff --git a/vusb/sendchar_usart.c b/protocol/vusb/sendchar_usart.c similarity index 100% rename from vusb/sendchar_usart.c rename to protocol/vusb/sendchar_usart.c diff --git a/vusb/usbdrv/Changelog.txt b/protocol/vusb/usbdrv/Changelog.txt similarity index 100% rename from vusb/usbdrv/Changelog.txt rename to protocol/vusb/usbdrv/Changelog.txt diff --git a/vusb/usbdrv/CommercialLicense.txt b/protocol/vusb/usbdrv/CommercialLicense.txt similarity index 100% rename from vusb/usbdrv/CommercialLicense.txt rename to protocol/vusb/usbdrv/CommercialLicense.txt diff --git a/vusb/usbdrv/License.txt b/protocol/vusb/usbdrv/License.txt similarity index 100% rename from vusb/usbdrv/License.txt rename to protocol/vusb/usbdrv/License.txt diff --git a/vusb/usbdrv/Readme.txt b/protocol/vusb/usbdrv/Readme.txt similarity index 100% rename from vusb/usbdrv/Readme.txt rename to protocol/vusb/usbdrv/Readme.txt diff --git a/vusb/usbdrv/USB-ID-FAQ.txt b/protocol/vusb/usbdrv/USB-ID-FAQ.txt similarity index 100% rename from vusb/usbdrv/USB-ID-FAQ.txt rename to protocol/vusb/usbdrv/USB-ID-FAQ.txt diff --git a/vusb/usbdrv/USB-IDs-for-free.txt b/protocol/vusb/usbdrv/USB-IDs-for-free.txt similarity index 100% rename from vusb/usbdrv/USB-IDs-for-free.txt rename to protocol/vusb/usbdrv/USB-IDs-for-free.txt diff --git a/vusb/usbdrv/asmcommon.inc b/protocol/vusb/usbdrv/asmcommon.inc similarity index 100% rename from vusb/usbdrv/asmcommon.inc rename to protocol/vusb/usbdrv/asmcommon.inc diff --git a/vusb/usbdrv/oddebug.c b/protocol/vusb/usbdrv/oddebug.c similarity index 100% rename from vusb/usbdrv/oddebug.c rename to protocol/vusb/usbdrv/oddebug.c diff --git a/vusb/usbdrv/oddebug.h b/protocol/vusb/usbdrv/oddebug.h similarity index 100% rename from vusb/usbdrv/oddebug.h rename to protocol/vusb/usbdrv/oddebug.h diff --git a/vusb/usbdrv/usbconfig-prototype.h b/protocol/vusb/usbdrv/usbconfig-prototype.h similarity index 100% rename from vusb/usbdrv/usbconfig-prototype.h rename to protocol/vusb/usbdrv/usbconfig-prototype.h diff --git a/vusb/usbdrv/usbdrv.c b/protocol/vusb/usbdrv/usbdrv.c similarity index 100% rename from vusb/usbdrv/usbdrv.c rename to protocol/vusb/usbdrv/usbdrv.c diff --git a/vusb/usbdrv/usbdrv.h b/protocol/vusb/usbdrv/usbdrv.h similarity index 100% rename from vusb/usbdrv/usbdrv.h rename to protocol/vusb/usbdrv/usbdrv.h diff --git a/vusb/usbdrv/usbdrvasm.S b/protocol/vusb/usbdrv/usbdrvasm.S similarity index 100% rename from vusb/usbdrv/usbdrvasm.S rename to protocol/vusb/usbdrv/usbdrvasm.S diff --git a/vusb/usbdrv/usbdrvasm.asm b/protocol/vusb/usbdrv/usbdrvasm.asm similarity index 100% rename from vusb/usbdrv/usbdrvasm.asm rename to protocol/vusb/usbdrv/usbdrvasm.asm diff --git a/vusb/usbdrv/usbdrvasm12.inc b/protocol/vusb/usbdrv/usbdrvasm12.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm12.inc rename to protocol/vusb/usbdrv/usbdrvasm12.inc diff --git a/vusb/usbdrv/usbdrvasm128.inc b/protocol/vusb/usbdrv/usbdrvasm128.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm128.inc rename to protocol/vusb/usbdrv/usbdrvasm128.inc diff --git a/vusb/usbdrv/usbdrvasm15.inc b/protocol/vusb/usbdrv/usbdrvasm15.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm15.inc rename to protocol/vusb/usbdrv/usbdrvasm15.inc diff --git a/vusb/usbdrv/usbdrvasm16.inc b/protocol/vusb/usbdrv/usbdrvasm16.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm16.inc rename to protocol/vusb/usbdrv/usbdrvasm16.inc diff --git a/vusb/usbdrv/usbdrvasm165.inc b/protocol/vusb/usbdrv/usbdrvasm165.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm165.inc rename to protocol/vusb/usbdrv/usbdrvasm165.inc diff --git a/vusb/usbdrv/usbdrvasm18-crc.inc b/protocol/vusb/usbdrv/usbdrvasm18-crc.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm18-crc.inc rename to protocol/vusb/usbdrv/usbdrvasm18-crc.inc diff --git a/vusb/usbdrv/usbdrvasm20.inc b/protocol/vusb/usbdrv/usbdrvasm20.inc similarity index 100% rename from vusb/usbdrv/usbdrvasm20.inc rename to protocol/vusb/usbdrv/usbdrvasm20.inc diff --git a/vusb/usbdrv/usbportability.h b/protocol/vusb/usbdrv/usbportability.h similarity index 100% rename from vusb/usbdrv/usbportability.h rename to protocol/vusb/usbdrv/usbportability.h diff --git a/vusb/vusb.c b/protocol/vusb/vusb.c similarity index 100% rename from vusb/vusb.c rename to protocol/vusb/vusb.c diff --git a/vusb/vusb.h b/protocol/vusb/vusb.h similarity index 100% rename from vusb/vusb.h rename to protocol/vusb/vusb.h