From 4379bf266586bb723bc6eb668dd5d5bc7e9ff56f Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 30 Jun 2015 05:25:51 +0200 Subject: upgraded to new lufa version of avr-utils --- software/hhd70dongle.old/Makefile | 6 +-- software/hhd70dongle/Makefile | 6 +-- software/idm-test/Makefile | 10 +++-- software/idm-test/idm-test.c | 85 ++++++++++++++++++++++++--------------- software/rda1846dongle/Makefile | 6 +-- 5 files changed, 67 insertions(+), 46 deletions(-) diff --git a/software/hhd70dongle.old/Makefile b/software/hhd70dongle.old/Makefile index 2b38b9f..83833e1 100644 --- a/software/hhd70dongle.old/Makefile +++ b/software/hhd70dongle.old/Makefile @@ -37,7 +37,7 @@ RESET_FUNC := ./reset.sh EXTERNAL_LIBS := lufa SPREADAVR_PATH := ../../contrib/avr-utils -LUFA_PATH := $(SPREADAVR_PATH)/contrib/LUFA-120219 +LUFA_PATH := $(SPREADAVR_PATH)/contrib/lufa-LUFA-140928 LUFA_OPTS = -D USB_DEVICE_ONLY LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0 LUFA_OPTS += -D ORDERED_EP_CONFIG @@ -47,8 +47,8 @@ LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT -LUFA_OPTS += -D USB_MANUFACTURER="L\"mur.sat\"" -D USB_MANUFACTURER_LEN=7 -LUFA_OPTS += -D USB_PRODUCT="L\"HHD70 usb dongle\"" -D USB_PRODUCT_LEN=16 +LUFA_OPTS += -D USB_MANUFACTURER="L\"mur.sat\"" +LUFA_OPTS += -D USB_PRODUCT="L\"HHD70 usb dongle\"" LUFA_COMPONENTS := USB USBCLASS diff --git a/software/hhd70dongle/Makefile b/software/hhd70dongle/Makefile index 843e405..db4bd7f 100644 --- a/software/hhd70dongle/Makefile +++ b/software/hhd70dongle/Makefile @@ -37,7 +37,7 @@ RESET_FUNC := ./reset.sh EXTERNAL_LIBS := lufa SPREADAVR_PATH := ../../contrib/avr-utils -LUFA_PATH := $(SPREADAVR_PATH)/contrib/LUFA-120219 +LUFA_PATH := $(SPREADAVR_PATH)/contrib/lufa-LUFA-140928 LUFA_OPTS = -D USB_DEVICE_ONLY LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0 LUFA_OPTS += -D ORDERED_EP_CONFIG @@ -47,8 +47,8 @@ LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT -LUFA_OPTS += -D USB_MANUFACTURER="L\"mur.sat\"" -D USB_MANUFACTURER_LEN=7 -LUFA_OPTS += -D USB_PRODUCT="L\"HHD70 usb dongle\"" -D USB_PRODUCT_LEN=16 +LUFA_OPTS += -D USB_MANUFACTURER="L\"mur.sat\"" +LUFA_OPTS += -D USB_PRODUCT="L\"HHD70 usb dongle\"" LUFA_COMPONENTS := USB USBCLASS SPI diff --git a/software/idm-test/Makefile b/software/idm-test/Makefile index 25dc1ad..f4090a1 100644 --- a/software/idm-test/Makefile +++ b/software/idm-test/Makefile @@ -24,9 +24,11 @@ NAME := idm-test BOARD_TYPE := teensy2 OBJ := $(NAME).o LIBS := util led lufa-descriptor-usbserial + EXTERNAL_LIBS := lufa +SPREADAVR_PATH := ../../contrib/avr-utils -LUFA_PATH := ../../contrib/LUFA-120219 +LUFA_PATH := $(SPREADAVR_PATH)/contrib/lufa-LUFA-140928 LUFA_OPTS = -D USB_DEVICE_ONLY LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0 LUFA_OPTS += -D ORDERED_EP_CONFIG @@ -36,9 +38,9 @@ LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT -LUFA_OPTS += -D USB_MANUFACTURER="L\"mur.sat\"" -D USB_MANUFACTURER_LEN=7 -LUFA_OPTS += -D USB_PRODUCT="L\"idm-test\"" -D USB_PRODUCT_LEN=8 +LUFA_OPTS += -D USB_MANUFACTURER="L\"mur.sat\"" +LUFA_OPTS += -D USB_PRODUCT="L\"idm-test\"" LUFA_COMPONENTS := USB USBCLASS -include ../avr.include.mk +include $(SPREADAVR_PATH)/include.mk diff --git a/software/idm-test/idm-test.c b/software/idm-test/idm-test.c index 85e101f..033cf34 100644 --- a/software/idm-test/idm-test.c +++ b/software/idm-test/idm-test.c @@ -1,23 +1,33 @@ /* - * spreadspace avr utils * + * mur.sat * - * Copyright (C) 2012 Christian Pointner + * Somewhen in the year 20xx, mur.at will have a nano satellite launched + * into a low earth orbit (310 km above the surface of our planet). The + * satellite itself is a TubeSat personal satellite kit, developed and + * launched by interorbital systems. mur.sat is a joint venture of mur.at, + * ESC im Labor and realraum. * - * This file is part of spreadspace avr utils. + * Please visit the project hompage at sat.mur.at for further information. * - * spreadspace avr utils is free software: you can redistribute it and/or modify + * + * Copyright (C) 2013-2015 Christian Pointner + * + * This file is part of mur.sat. + * + * mur.sat 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 3 of the License, or * any later version. * - * spreadspace avr utils is distributed in the hope that it will be useful, + * mur.sat 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 spreadspace avr utils. If not, see . + * along with mur.sat. If not, see . + * */ @@ -31,7 +41,7 @@ /* LUFA Library - Copyright (C) Dean Camera, 2012. + Copyright (C) Dean Camera, 2014. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org @@ -53,19 +63,25 @@ USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = { .Config = { - .ControlInterfaceNumber = 0, - - .DataINEndpointNumber = CDC_TX_EPNUM, - .DataINEndpointSize = CDC_TXRX_EPSIZE, - .DataINEndpointDoubleBank = false, - - .DataOUTEndpointNumber = CDC_RX_EPNUM, - .DataOUTEndpointSize = CDC_TXRX_EPSIZE, - .DataOUTEndpointDoubleBank = false, - - .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM, - .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, - .NotificationEndpointDoubleBank = false, + .ControlInterfaceNumber = INTERFACE_ID_CDC_CCI, + .DataINEndpoint = + { + .Address = CDC_TX_EPADDR, + .Size = CDC_TXRX_EPSIZE, + .Banks = 1, + }, + .DataOUTEndpoint = + { + .Address = CDC_RX_EPADDR, + .Size = CDC_TXRX_EPSIZE, + .Banks = 1, + }, + .NotificationEndpoint = + { + .Address = CDC_NOTIFICATION_EPADDR, + .Size = CDC_NOTIFICATION_EPSIZE, + .Banks = 1, + }, }, }; @@ -104,9 +120,7 @@ void SetupHardware(void) led_init(); USB_Init(); - TCCR0B = (1 << CS02); - - SPI_Init(SPI_SPEED_FCPU_DIV_8 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST | + SPI_Init(SPI_SPEED_FCPU_DIV_8 | SPI_MODE_MASTER | SPI_ORDER_MSB_FIRST | SPI_SCK_LEAD_RISING | SPI_SAMPLE_LEADING); SPI_CS_DDR |= (1< (uint8_t)(sizeof(SPItoUSB_Buffer_Data) * .75))) { - TIFR0 |= (1 << TOV0); - while (BufferCount--) { - if(CDC_Device_SendByte(&VirtualSerial_CDC_Interface, - RingBuffer_Peek(&SPItoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError) - break; - - RingBuffer_Remove(&SPItoUSB_Buffer); + if (BufferCount) { + Endpoint_SelectEndpoint(VirtualSerial_CDC_Interface.Config.DataINEndpoint.Address); + if (Endpoint_IsINReady()) { + uint8_t BytesToSend = MIN(BufferCount, (CDC_TXRX_EPSIZE - 1)); + + while (BytesToSend--) { + if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface, + RingBuffer_Peek(&SPItoUSB_Buffer)) != ENDPOINT_READYWAIT_NoError) { + break; + } + + RingBuffer_Remove(&SPItoUSB_Buffer); + } } } diff --git a/software/rda1846dongle/Makefile b/software/rda1846dongle/Makefile index d5c21de..9cd0983 100644 --- a/software/rda1846dongle/Makefile +++ b/software/rda1846dongle/Makefile @@ -38,7 +38,7 @@ RESET_PARAM := /dev/ttyACM0 EXTERNAL_LIBS := lufa SPREADAVR_PATH := ../../contrib/avr-utils -LUFA_PATH := $(SPREADAVR_PATH)/contrib/LUFA-120219 +LUFA_PATH := $(SPREADAVR_PATH)/contrib/lufa-LUFA-140928 LUFA_OPTS = -D USB_DEVICE_ONLY LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0 LUFA_OPTS += -D ORDERED_EP_CONFIG @@ -48,8 +48,8 @@ LUFA_OPTS += -D USE_FLASH_DESCRIPTORS LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT -LUFA_OPTS += -D USB_MANUFACTURER="L\"mur.sat\"" -D USB_MANUFACTURER_LEN=7 -LUFA_OPTS += -D USB_PRODUCT="L\"RDA1846 usb dongle\"" -D USB_PRODUCT_LEN=18 +LUFA_OPTS += -D USB_MANUFACTURER="L\"mur.sat\"" +LUFA_OPTS += -D USB_PRODUCT="L\"RDA1846 usb dongle\"" LUFA_COMPONENTS := USB USBCLASS TWI -- cgit v1.2.3