diff --git a/Makefile b/Makefile index 89d6a2e..2197c53 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,6 @@ #export BOARD ?= AIRSPY_DEMO #export VERSION_STRING ?= -D'VERSION_STRING="AirSpy DEMO"' -export PACKING ?= NO_PACKING export BOARD ?= AIRSPY_NOS export VERSION_STRING ?= -D'VERSION_STRING="AirSpy NOS"' diff --git a/Makefile_packing b/Makefile_packing deleted file mode 100644 index bf16ce3..0000000 --- a/Makefile_packing +++ /dev/null @@ -1,55 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -# -# Copyright 2013 Benjamin Vernoux -# -# This file is part of AirSpy (based on HackRF project). -# -# 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, 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; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -#export BOARD ?= AIRSPY_DEMO -#export VERSION_STRING ?= -D'VERSION_STRING="AirSpy DEMO"' - -export PACKING ?= USE_PACKING -export BOARD ?= AIRSPY_NOS -export VERSION_STRING ?= -D'VERSION_STRING="AirSpy NOS PACK"' - -TARGETS = airspy_m0 \ - airspy_m0s \ - airspy_rom_to_ram_packing - -all: build - -build: airspy_fw - -airspy_fw: - $(Q)for i in $(TARGETS); do \ - if [ -d $$i ]; then \ - printf " BUILD $$i\n"; \ - $(MAKE) -C $$i || exit $?; \ - fi; \ - done - -clean: - $(Q)for i in $(addprefix lib/,$(TARGETS)) \ - $(TARGETS); do \ - if [ -d $$i ]; then \ - printf " CLEAN $$i\n"; \ - $(MAKE) -C $$i clean || exit $?; \ - fi; \ - done - -.PHONY: build airspy_fw diff --git a/airspy_m0/airspy_m0.c b/airspy_m0/airspy_m0.c index 6c1b22e..805a829 100644 --- a/airspy_m0/airspy_m0.c +++ b/airspy_m0/airspy_m0.c @@ -58,11 +58,15 @@ extern uint32_t cm0_data_share; /* defined in linker script */ volatile unsigned int phase = 0; volatile uint32_t *usb_bulk_buffer_offset = (&cm4_data_share); +volatile uint32_t *usb_bulk_buffer_length = ((&cm4_data_share)+1); +volatile uint32_t *last_offset_m0 = ((&cm4_data_share)+2); volatile airspy_mcore_t *start_adchs = (airspy_mcore_t *)(&cm0_data_share); volatile airspy_mcore_t *set_samplerate = (airspy_mcore_t *)((&cm0_data_share)+1); +volatile airspy_mcore_t *set_packing = (airspy_mcore_t *)((&cm0_data_share)+2); #define get_usb_buffer_offset() (usb_bulk_buffer_offset[0]) +#define get_usb_buffer_length() (usb_bulk_buffer_length[0]) #define MASTER_TXEV_FLAG ((uint32_t *) 0x40043130) #define MASTER_TXEV_QUIT() { *MASTER_TXEV_FLAG = 0x0; } @@ -116,6 +120,20 @@ void set_samplerate_m4(uint8_t conf_num) } } +void set_packing_m4(uint8_t state) +{ + set_packing->conf = state; + set_packing->cmd = SET_PACKING_CMD; + + signal_sev(); + + while(1) + { + if(set_packing->raw == 0) + break; + } +} + void usb_configuration_changed(usb_device_t* const device) { if( device->configuration->number ) @@ -176,9 +194,9 @@ int main(void) usb_set_configuration_changed_cb(usb_configuration_changed); usb_peripheral_reset(); - + usb_device_init(0, &usb_device); - + usb_queue_init(&usb_endpoint_control_out_queue); usb_queue_init(&usb_endpoint_control_in_queue); usb_queue_init(&usb_endpoint_bulk_out_queue); @@ -191,7 +209,7 @@ int main(void) iap_cmd_res.cmd_param.command_code = IAP_CMD_READ_SERIAL_NO; iap_cmd_call(&iap_cmd_res); if(iap_cmd_res.status_res.status_ret == CMD_SUCCESS) - { + { /* Only retrieve 2 last 32bits for Serial Number */ serial_number.sn_32b[0] = iap_cmd_res.status_res.iap_result[2]; serial_number.sn_32b[1] = iap_cmd_res.status_res.iap_result[3]; @@ -208,52 +226,14 @@ int main(void) while(true) { signal_wfe(); -#ifdef USE_PACKING - switch(get_usb_buffer_offset()) - { - case 0: - if(phase == 0) - { - usb_transfer_schedule_block(&usb_endpoint_bulk_in, &usb_bulk_buffer[0x0000], 0x1800); - phase = 1; - } - break; - case 1: - if(phase == 1) - { - usb_transfer_schedule_block(&usb_endpoint_bulk_in, &usb_bulk_buffer[0x2000], 0x1800); - phase = 2; - } - break; - case 2: - if(phase == 2) - { - usb_transfer_schedule_block(&usb_endpoint_bulk_in, &usb_bulk_buffer[0x4000], 0x1800); - phase = 3; - } - break; - case 3: - if(phase == 3) - { - usb_transfer_schedule_block(&usb_endpoint_bulk_in, &usb_bulk_buffer[0x6000], 0x1800); - phase = 0; - } - break; - } -#else - if( (get_usb_buffer_offset() >= 16384) && - (phase == 1) ) - { - usb_transfer_schedule_block(&usb_endpoint_bulk_in, &usb_bulk_buffer[0x0000], 0x4000); - phase = 0; - } - if( (get_usb_buffer_offset() < 16384) && - (phase == 0) ) + uint32_t offset = get_usb_buffer_offset(); + uint32_t length = get_usb_buffer_length(); + + if(offset != *last_offset_m0) { - usb_transfer_schedule_block(&usb_endpoint_bulk_in, &usb_bulk_buffer[0x4000], 0x4000); - phase = 1; + usb_transfer_schedule_block(&usb_endpoint_bulk_in, &usb_bulk_buffer[offset], length); + *last_offset_m0 = offset; } -#endif } } diff --git a/airspy_m0/airspy_m0.h b/airspy_m0/airspy_m0.h index 295fc6c..b9ff22c 100644 --- a/airspy_m0/airspy_m0.h +++ b/airspy_m0/airspy_m0.h @@ -28,5 +28,6 @@ void ADCHS_start(uint8_t conf_num); void ADCHS_stop(uint8_t conf_num); void set_samplerate_m4(uint8_t conf_num); +void set_packing_m4(uint8_t state); #endif//__AIRSPY_M0_H__ diff --git a/airspy_m0/airspy_usb_req.c b/airspy_m0/airspy_usb_req.c index 849d2e5..7223a82 100644 --- a/airspy_m0/airspy_usb_req.c +++ b/airspy_m0/airspy_usb_req.c @@ -392,6 +392,45 @@ usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) return USB_REQUEST_STATUS_OK; } +usb_request_status_t usb_vendor_request_set_packing_command( +usb_endpoint_t* const endpoint, +const usb_transfer_stage_t stage) +{ + receiver_mode_t rx_mode; + uint8_t state; + + if( stage == USB_TRANSFER_STAGE_SETUP ) + { + if(endpoint->setup.index > (AIRSPY_CONF_NB-1)) + { + return USB_REQUEST_STATUS_STALL; + }else + { + state = endpoint->setup.index; + } + + rx_mode = get_receiver_mode(); + if(rx_mode == RECEIVER_MODE_RX) + { + ADCHS_stop(sample_rate_conf_no); + } + + set_packing_m4(state); + + if(rx_mode == RECEIVER_MODE_RX) + { + ADCHS_start(sample_rate_conf_no); + } + + endpoint->buffer[0] = 1; + usb_transfer_schedule_block(endpoint->in, &endpoint->buffer, 1); + usb_transfer_schedule_ack(endpoint->out); + return USB_REQUEST_STATUS_OK; + } + return USB_REQUEST_STATUS_OK; +} + + usb_request_status_t usb_vendor_request_set_samplerate( usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) @@ -768,17 +807,6 @@ usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) } } -usb_request_status_t usb_vendor_request_get_packing_command( -usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) -{ - if (stage == USB_TRANSFER_STAGE_SETUP) { - endpoint->buffer[0] = AIRSPY_PACKING; - usb_transfer_schedule_block(endpoint->in, &endpoint->buffer, 1); - usb_transfer_schedule_ack(endpoint->out); - } - return USB_REQUEST_STATUS_OK; -} - /* ID 1 to X corresponds to user endpoint->setup.request */ usb_request_handler_fn vendor_request_handler[AIRSPY_CMD_MAX+1]; @@ -831,7 +859,7 @@ void airspy_usb_req_init(void) vendor_request_handler[AIRSPY_GPIODIR_READ] = usb_vendor_request_gpiodir_read_command; vendor_request_handler[AIRSPY_GET_SAMPLERATES] = usb_vendor_request_get_samplerates_command; - vendor_request_handler[AIRSPY_GET_PACKING] = usb_vendor_request_get_packing_command; + vendor_request_handler[AIRSPY_SET_PACKING] = usb_vendor_request_set_packing_command; } usb_request_status_t usb_vendor_request(usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) diff --git a/airspy_m4/adchs.c b/airspy_m4/adchs.c index 4d65576..e3d054b 100644 --- a/airspy_m4/adchs.c +++ b/airspy_m4/adchs.c @@ -68,7 +68,7 @@ void ADCHS_DMA_init_stop(void) LPC_GPDMA->CONFIG = 0x00; /* Disable DMA channels, little endian */ } -void ADCHS_DMA_init(uint32_t dest_addr) +void ADCHS_DMA_init(uint32_t dest_addr, uint8_t packed) { uint32_t nb_dma_transfer; int i; @@ -97,17 +97,21 @@ void ADCHS_DMA_init(uint32_t dest_addr) (0x1 << 25) | (0x0 << 26) | (0x1 << 27) | -#ifdef USE_PACKING - (0x1UL << 31); -#else (0x0UL << 31); -#endif } -#ifndef USE_PACKING - adchs_dma_lli[(ADCHS_DMA_NUM_LLI/2)-1].control |= (0x1UL << 31); - adchs_dma_lli[i-1].control |= (0x1UL << 31); -#endif + if(packed) + { + for(i=0; iC0SRCADDR = adchs_dma_lli[0].src_addr; LPC_GPDMA->C0DESTADDR = adchs_dma_lli[0].dst_addr; diff --git a/airspy_m4/adchs.h b/airspy_m4/adchs.h index d6f6d2f..f858366 100644 --- a/airspy_m4/adchs.h +++ b/airspy_m4/adchs.h @@ -31,7 +31,7 @@ extern "C" void ADCHS_deinit(void); void ADCHS_init(void); -void ADCHS_DMA_init(uint32_t dest_addr); +void ADCHS_DMA_init(uint32_t dest_addr, uint8_t packed); void ADCHS_desc_init(uint8_t chan_num); void ADCHS_stop(uint8_t conf_num); diff --git a/airspy_m4/airspy_m4.c b/airspy_m4/airspy_m4.c index 02b3491..23accf3 100644 --- a/airspy_m4/airspy_m4.c +++ b/airspy_m4/airspy_m4.c @@ -44,32 +44,24 @@ #include "airspy_conf.h" -extern volatile uint32_t *usb_bulk_buffer_offset; - #define DEFAULT_ADCHS_CHAN (0) #undef DMA_ISR_DEBUG //#define DMA_ISR_DEBUG #define USB_DATA_TRANSFER_SIZE_BYTE (ADCHS_DATA_TRANSFER_SIZE_BYTE) -#ifdef USE_PACKING -#define USB_BULK_BUFFER_MASK ((4) - 1) -#else #define USB_BULK_BUFFER_MASK ((32768) - 1) -#endif #define get_usb_buffer_offset() (usb_bulk_buffer_offset[0]) #define set_usb_buffer_offset(val) (usb_bulk_buffer_offset[0] = val) /* Manage round robin after increment with USB_BULK_BUFFER_MASK */ #define inc_mask_usb_buffer_offset(buff_offset, inc_value) ((buff_offset+inc_value) & USB_BULK_BUFFER_MASK) -#ifdef USE_PACKING volatile uint32_t usb_bulk_buffer_offset_uint32_m4; volatile uint32_t *usb_bulk_buffer_offset_m4; +volatile uint32_t last_offset_m4; #define get_usb_buffer_offset_m4() (usb_bulk_buffer_offset_m4[0]) #define set_usb_buffer_offset_m4(val) (usb_bulk_buffer_offset_m4[0] = val) #define inc_mask_usb_buffer_offset_m4(buff_offset, inc_value) inc_mask_usb_buffer_offset(buff_offset, inc_value) -volatile unsigned int phase = 0; -#endif #define SLAVE_TXEV_FLAG ((uint32_t *) 0x40043400) #define SLAVE_TXEV_QUIT() { *SLAVE_TXEV_FLAG = 0x0; } @@ -81,11 +73,17 @@ extern uint32_t cm0_data_share; /* defined in linker script */ volatile int adchs_stopped = 0; volatile int adchs_started = 0; +volatile int use_packing = 0; + volatile uint32_t *usb_bulk_buffer_offset = &cm4_data_share; +volatile uint32_t *usb_bulk_buffer_length = ((&cm4_data_share)+1); +volatile uint32_t *last_offset_m0 = ((&cm4_data_share)+2); + uint8_t* const usb_bulk_buffer = (uint8_t*)USB_BULK_BUFFER_START; volatile airspy_mcore_t *start_adchs = (airspy_mcore_t *)(&cm0_data_share); volatile airspy_mcore_t *set_samplerate = (airspy_mcore_t *)((&cm0_data_share)+1); +volatile airspy_mcore_t *set_packing = (airspy_mcore_t *)((&cm0_data_share)+2); volatile int first_start = 0; @@ -114,7 +112,6 @@ uint32_t data_counter = 0; t_stats_adchs stat_adchs = { 0 }; #endif -#ifdef USE_PACKING /* __attribute__ ((always_inline)) static void pack(uint16_t* input, uint32_t* output, uint32_t length) { @@ -137,48 +134,52 @@ __attribute__ ((always_inline)) static void pack(uint16_t* input, uint32_t* outp __attribute__ ((always_inline)) static void pack(uint32_t* input, uint32_t* output, uint32_t length) { - register uint32_t *a0 asm("r0") = input; - register uint32_t *a1 asm("r1") = output; - register uint32_t a2 asm("r2") = length; - - asm volatile("1:\n\t" - "ldm.w %0!, {r4, r5, r6, r7}\n\t" - - "lsr r8, r4, #16\n\t" - "ubfx r3, r5, #4, #12\n\t" - "orr r8, r3, r8, lsl #8\n\t" - "orr r8, r8, r4, lsl #20\n\t" - "lsrs r3, r5, #16\n\t" - "lsls r5, r5, #28\n\t" - "orr r5, r5, r3, lsl #16\n\t" - "orr r5, r5, r6, lsr #24\n\t" - "uxth r9, r6\n\t" - "orr r9, r5, r9, lsl #4\n\t" - "lsrs r6, r6, #16\n\t" - "uxth r10, r7\n\t" - "lsl r10, r10, #12\n\t" - "orr r10, r10, r6, lsl #24\n\t" - "orr r10, r10, r7, lsr #16\n\t" - - "stm.w %1!, {r8, r9, r10}\n\t" - - "subs %2, %2, #8\n\t" - "bne 1b\n\t" - : "+r"(a0), "+r"(a1), "+r"(a2) - :: "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10"); - + register uint32_t *a0 asm("r0") = input; + register uint32_t *a1 asm("r1") = output; + register uint32_t a2 asm("r2") = length; + + asm volatile("1:\n\t" + "ldm.w %0!, {r4, r5, r6, r7}\n\t" + + "lsr r8, r4, #16\n\t" + "ubfx r3, r5, #4, #12\n\t" + "orr r8, r3, r8, lsl #8\n\t" + "orr r8, r8, r4, lsl #20\n\t" + "lsrs r3, r5, #16\n\t" + "lsls r5, r5, #28\n\t" + "orr r5, r5, r3, lsl #16\n\t" + "orr r5, r5, r6, lsr #24\n\t" + "uxth r9, r6\n\t" + "orr r9, r5, r9, lsl #4\n\t" + "lsrs r6, r6, #16\n\t" + "uxth r10, r7\n\t" + "lsl r10, r10, #12\n\t" + "orr r10, r10, r6, lsl #24\n\t" + "orr r10, r10, r7, lsr #16\n\t" + + "stm.w %1!, {r8, r9, r10}\n\t" + + "subs %2, %2, #8\n\t" + "bne 1b\n\t" + : "+r"(a0), "+r"(a1), "+r"(a2) + :: "memory", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10"); + } -#endif - static __inline__ void clr_usb_buffer_offset(void) -{ -#ifdef USE_PACKING - usb_bulk_buffer_offset[0] = 3; - usb_bulk_buffer_offset_m4[0] = 3; -#else - usb_bulk_buffer_offset[0] = 0; -#endif +{ + if(use_packing) + { + usb_bulk_buffer_offset[0] = ADCHS_DATA_TRANSFER_SIZE_BYTE / 2; + usb_bulk_buffer_offset_m4[0] = ADCHS_DATA_TRANSFER_SIZE_BYTE; + } + else + { + usb_bulk_buffer_offset[0] = ADCHS_DATA_TRANSFER_SIZE_BYTE; + } + + last_offset_m4 = 0; + *last_offset_m0 = 0; } static __inline__ uint32_t get_start_stop_adchs(void) @@ -204,6 +205,31 @@ static __inline__ void ack_samplerate(void) set_samplerate->raw = 0; } +static __inline__ uint8_t get_packing(uint8_t *packing_state) +{ + *packing_state = set_packing->conf; + return(set_packing->cmd); +} + +static __inline__ void ack_packing(void) +{ + set_packing->raw = 0; +} + +void set_packing_state(uint8_t state) +{ + if(state == 0) + { + use_packing = 0; + *usb_bulk_buffer_length = 0x4000; + } + else + { + use_packing = 1; + *usb_bulk_buffer_length = 0x1800; + } +} + void adchs_start(uint8_t chan_num) { int i; @@ -229,16 +255,12 @@ void adchs_start(uint8_t chan_num) ADCHS_init(); ADCHS_desc_init(chan_num); - ADCHS_DMA_init((uint32_t)ADCHS_DATA_BUFFER); + ADCHS_DMA_init((uint32_t)ADCHS_DATA_BUFFER, use_packing); led_on(); LPC_ADCHS->TRIGGER = 1; __asm("dsb"); -#ifdef USE_PACKING - phase = 1; -#endif - /* Enable IRQ globally */ __asm__("cpsie i"); } @@ -308,12 +330,15 @@ void dma_isr(void) { LPC_GPDMA->INTTCCLEAR |= INTTC0; /* Clear Chan0 */ -#ifdef USE_PACKING - set_usb_buffer_offset_m4( inc_mask_usb_buffer_offset_m4(get_usb_buffer_offset_m4(), 1) ); -#else - set_usb_buffer_offset( inc_mask_usb_buffer_offset(get_usb_buffer_offset(), USB_DATA_TRANSFER_SIZE_BYTE) ); - signal_sev(); -#endif + if(use_packing) + { + set_usb_buffer_offset_m4( inc_mask_usb_buffer_offset_m4(get_usb_buffer_offset_m4(), 8192)); + } + else + { + set_usb_buffer_offset( inc_mask_usb_buffer_offset(get_usb_buffer_offset(), USB_DATA_TRANSFER_SIZE_BYTE) ); + signal_sev(); + } } #ifdef DMA_ISR_DEBUG @@ -329,6 +354,8 @@ void m0core_isr(void) uint8_t adchs_conf; uint8_t adchs_start_stop_cmd; uint8_t samplerate_cmd; + uint8_t packing_cmd; + uint8_t packing_state; SLAVE_TXEV_QUIT(); @@ -338,6 +365,13 @@ void m0core_isr(void) sys_clock_samplerate(&airspy_m4_conf[adchs_conf]); ack_samplerate(); } + + packing_cmd = get_packing(&packing_state); + if(packing_cmd == SET_PACKING_CMD) + { + set_packing_state(packing_state); + ack_packing(); + } adchs_start_stop_cmd = get_start_stop_adchs(); switch(adchs_start_stop_cmd) @@ -426,9 +460,13 @@ int main(void) adchs_stop(); adchs_stopped = 1; adchs_started = 0; + + use_packing = 0; + *usb_bulk_buffer_length = 0x4000; ack_start_stop_adchs(); ack_samplerate(); + ack_packing(); /* Start M0 */ m0_startup(); @@ -444,61 +482,23 @@ int main(void) CCU1_CLK_PERIPH_CORE_CFG &= ~(1); #endif -#ifdef USE_PACKING usb_bulk_buffer_offset_m4 = &usb_bulk_buffer_offset_uint32_m4; -#endif - + while(true) { signal_wfe(); -#ifdef USE_PACKING - /* Thanks to Pierre HB9FUF for the initial packing proof-of-concept */ - /* The following expands the PoC to use 4 buffers with an improved packing routine above */ - switch(get_usb_buffer_offset_m4()) - { - case 0: - if(phase == 0) + if(use_packing) { - pack((uint32_t*) &usb_bulk_buffer[0x0000], (uint32_t*) &usb_bulk_buffer[0x0000], 0x1000); - - set_usb_buffer_offset( inc_mask_usb_buffer_offset(get_usb_buffer_offset(), 1) ); - signal_sev(); - phase = 1; - } - break; - case 1: - if(phase == 1) - { - pack((uint32_t*) &usb_bulk_buffer[0x2000], (uint32_t*) &usb_bulk_buffer[0x2000], 0x1000); - - set_usb_buffer_offset( inc_mask_usb_buffer_offset(get_usb_buffer_offset(), 1) ); - signal_sev(); - phase = 2; - } - break; - case 2: - if(phase == 2) - { - pack((uint32_t*) &usb_bulk_buffer[0x4000], (uint32_t*) &usb_bulk_buffer[0x4000], 0x1000); - - set_usb_buffer_offset( inc_mask_usb_buffer_offset(get_usb_buffer_offset(), 1) ); - signal_sev(); - phase = 3; - } - break; - case 3: - if(phase == 3) - { - pack((uint32_t*) &usb_bulk_buffer[0x6000], (uint32_t*) &usb_bulk_buffer[0x6000], 0x1000); - - set_usb_buffer_offset( inc_mask_usb_buffer_offset(get_usb_buffer_offset(), 1) ); - signal_sev(); - phase = 0; + /* Thanks to Pierre HB9FUF for the initial packing proof-of-concept */ + uint32_t offset = get_usb_buffer_offset_m4(); + if(offset != last_offset_m4) + { + pack((uint32_t*)&usb_bulk_buffer[offset], (uint32_t*)&usb_bulk_buffer[offset], 0x1000); + set_usb_buffer_offset( inc_mask_usb_buffer_offset(get_usb_buffer_offset(), 0x2000)); + signal_sev(); + last_offset_m4 = offset; + } } - break; } -#endif - - } } diff --git a/airspy_rom_to_ram_packing/Makefile b/airspy_rom_to_ram_packing/Makefile deleted file mode 100644 index 036d562..0000000 --- a/airspy_rom_to_ram_packing/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -# -# Copyright 2013/2014 Benjamin Vernoux -# -# This file is part of AirSpy (based on HackRF project). -# -# 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, 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; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -BINARY = airspy_rom_to_ram_packing - -SRC_DIR = airspy_m4 - -SRC = airspy_m4.c adchs.c airspy_m4_conf.c - -OBJ = m0_bin.o m0s_bin.o - -# Source from ../common dir -VPATH += ../common -SRC += \ - fault_handler.c \ - airspy_core.c \ - si5351c.c \ - w25q80bv.c \ - rom_iap.c \ - signal_mcu.c - -LDSCRIPT = ../common/LPC4370_M4_rom_to_ram.ld - -%.o: ../$(SRC_DIR)/%.c Makefile - @printf " CC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(CC) $(CFLAGS) -o $@ -c $< - -include ../common/Makefile_inc.mk - diff --git a/airspy_rom_to_ram_packing/dfuprog_airspy/dfu-suffix.exe b/airspy_rom_to_ram_packing/dfuprog_airspy/dfu-suffix.exe deleted file mode 100644 index 8d9af47..0000000 Binary files a/airspy_rom_to_ram_packing/dfuprog_airspy/dfu-suffix.exe and /dev/null differ diff --git a/airspy_rom_to_ram_packing/dfuprog_airspy/dfu-util.exe b/airspy_rom_to_ram_packing/dfuprog_airspy/dfu-util.exe deleted file mode 100644 index a48d669..0000000 Binary files a/airspy_rom_to_ram_packing/dfuprog_airspy/dfu-util.exe and /dev/null differ diff --git a/airspy_rom_to_ram_packing/dfuprog_airspy/dfuprog_airspy.bat b/airspy_rom_to_ram_packing/dfuprog_airspy/dfuprog_airspy.bat deleted file mode 100644 index 4d6156d..0000000 --- a/airspy_rom_to_ram_packing/dfuprog_airspy/dfuprog_airspy.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off -echo Downloading algo... -dfu-util -d 1fc9:000c -t 2048 -R -D iram_dfu_util_spiflash.bin.hdr -echo Programming ../airspy_rom_to_ram_packing.bin -lpcdfu -d 3 -e -D ../airspy_rom_to_ram_packing.bin -U -Pause diff --git a/airspy_rom_to_ram_packing/dfuprog_airspy/iram_dfu_util_spiflash.bin.hdr b/airspy_rom_to_ram_packing/dfuprog_airspy/iram_dfu_util_spiflash.bin.hdr deleted file mode 100644 index e0d158e..0000000 Binary files a/airspy_rom_to_ram_packing/dfuprog_airspy/iram_dfu_util_spiflash.bin.hdr and /dev/null differ diff --git a/airspy_rom_to_ram_packing/dfuprog_airspy/libusb-1.0.dll b/airspy_rom_to_ram_packing/dfuprog_airspy/libusb-1.0.dll deleted file mode 100644 index fd73254..0000000 Binary files a/airspy_rom_to_ram_packing/dfuprog_airspy/libusb-1.0.dll and /dev/null differ diff --git a/airspy_rom_to_ram_packing/dfuprog_airspy/lpcdfu.exe b/airspy_rom_to_ram_packing/dfuprog_airspy/lpcdfu.exe deleted file mode 100644 index bec2cdf..0000000 Binary files a/airspy_rom_to_ram_packing/dfuprog_airspy/lpcdfu.exe and /dev/null differ diff --git a/airspy_rom_to_ram_packing/m0_bin.s b/airspy_rom_to_ram_packing/m0_bin.s deleted file mode 100644 index 4dab48e..0000000 --- a/airspy_rom_to_ram_packing/m0_bin.s +++ /dev/null @@ -1,12 +0,0 @@ - - .section .rodata - - .global m0_bin - .align 4 -m0_bin: - .incbin "../airspy_m0/airspy_m0.bin" - - .global m0_bin_size - .align 4 -m0_bin_size: - .int m0_bin_size - m0_bin diff --git a/airspy_rom_to_ram_packing/m0s_bin.s b/airspy_rom_to_ram_packing/m0s_bin.s deleted file mode 100644 index 57270b0..0000000 --- a/airspy_rom_to_ram_packing/m0s_bin.s +++ /dev/null @@ -1,12 +0,0 @@ - - .section .rodata - - .global m0s_bin - .align 4 -m0s_bin: - .incbin "../airspy_m0s/airspy_m0s.bin" - - .global m0s_bin_size - .align 4 -m0s_bin_size: - .int m0s_bin_size - m0s_bin diff --git a/airspy_rom_to_ram_packing/usbprog_airspy/airspy.dll b/airspy_rom_to_ram_packing/usbprog_airspy/airspy.dll deleted file mode 100644 index fae8574..0000000 Binary files a/airspy_rom_to_ram_packing/usbprog_airspy/airspy.dll and /dev/null differ diff --git a/airspy_rom_to_ram_packing/usbprog_airspy/airspy_spiflash.bat b/airspy_rom_to_ram_packing/usbprog_airspy/airspy_spiflash.bat deleted file mode 100644 index 387c8c7..0000000 --- a/airspy_rom_to_ram_packing/usbprog_airspy/airspy_spiflash.bat +++ /dev/null @@ -1,2 +0,0 @@ -airspy_spiflash.exe -w ../airspy_rom_to_ram_packing.bin -Pause diff --git a/airspy_rom_to_ram_packing/usbprog_airspy/airspy_spiflash.exe b/airspy_rom_to_ram_packing/usbprog_airspy/airspy_spiflash.exe deleted file mode 100644 index 5feb6b8..0000000 Binary files a/airspy_rom_to_ram_packing/usbprog_airspy/airspy_spiflash.exe and /dev/null differ diff --git a/airspy_rom_to_ram_packing/usbprog_airspy/libusb-1.0.dll b/airspy_rom_to_ram_packing/usbprog_airspy/libusb-1.0.dll deleted file mode 100644 index 4bda76f..0000000 Binary files a/airspy_rom_to_ram_packing/usbprog_airspy/libusb-1.0.dll and /dev/null differ diff --git a/airspy_rom_to_ram_packing/usbprog_airspy/pthreadVCE2.dll b/airspy_rom_to_ram_packing/usbprog_airspy/pthreadVCE2.dll deleted file mode 100644 index 9d148cc..0000000 Binary files a/airspy_rom_to_ram_packing/usbprog_airspy/pthreadVCE2.dll and /dev/null differ diff --git a/common/Makefile_M0_inc.mk b/common/Makefile_M0_inc.mk index 2809cb5..6e3826f 100644 --- a/common/Makefile_M0_inc.mk +++ b/common/Makefile_M0_inc.mk @@ -25,7 +25,7 @@ # # derived primarily from Makefiles in libopencm3 -AIRSPY_OPTS = -D$(BOARD) -D$(PACKING) -DLPC43XX -DLPC43XX_M0 -DCORE_M0 -D__CORTEX_M=0 +AIRSPY_OPTS = -D$(BOARD) -DLPC43XX -DLPC43XX_M0 -DCORE_M0 -D__CORTEX_M=0 AIRSPY_OPTS += $(VERSION_STRING) diff --git a/common/Makefile_inc.mk b/common/Makefile_inc.mk index d5f5f29..1e9baf2 100644 --- a/common/Makefile_inc.mk +++ b/common/Makefile_inc.mk @@ -26,7 +26,7 @@ # derived primarily from Makefiles in libopencm3 -AIRSPY_OPTS = -D$(BOARD) -D$(PACKING) -DLPC43XX -DLPC43XX_M4 -DCORE_M4 +AIRSPY_OPTS = -D$(BOARD) -DLPC43XX -DLPC43XX_M4 -DCORE_M4 AIRSPY_OPTS += $(VERSION_STRING) diff --git a/common/airspy_commands.h b/common/airspy_commands.h index 35b844f..41eaf84 100644 --- a/common/airspy_commands.h +++ b/common/airspy_commands.h @@ -64,8 +64,8 @@ typedef enum AIRSPY_GPIO_READ = 22, AIRSPY_GPIODIR_WRITE = 23, AIRSPY_GPIODIR_READ = 24, - AIRSPY_GET_SAMPLERATES = 25, - AIRSPY_GET_PACKING = AIRSPY_CMD_MAX + AIRSPY_GET_SAMPLERATES = 25, + AIRSPY_SET_PACKING = AIRSPY_CMD_MAX } airspy_vendor_request; typedef enum diff --git a/common/airspy_conf.h b/common/airspy_conf.h index b57b582..798d85b 100644 --- a/common/airspy_conf.h +++ b/common/airspy_conf.h @@ -44,12 +44,6 @@ extern "C" #define AIRSPY_CONF_NB (2) /* Up to 256 maximum */ -#ifdef USE_PACKING -/* 0=No Packing, 1=Packing Enabled */ -#define AIRSPY_PACKING (1) -#else -#define AIRSPY_PACKING (0) -#endif /* For each configuration the index corresponds to uint32_t */ typedef struct diff --git a/common/airspy_core.c b/common/airspy_core.c index c948669..d9ec0bb 100644 --- a/common/airspy_core.c +++ b/common/airspy_core.c @@ -635,14 +635,6 @@ void cpu_clock_pll1_high_speed(const airspy_pll1_hs_t* const pt_airspy_pll1_hs_c CGU_PLL1_CTRL_DIRECT | /* DIRECT */ CGU_PLL1_CTRL_PSEL_MASK | CGU_PLL1_CTRL_MSEL_MASK | CGU_PLL1_CTRL_NSEL_MASK ); /* PSEL, MSEL, NSEL- divider ratios */ -#ifdef USE_PACKING - pll_reg |= CGU_PLL1_CTRL_CLK_SEL(CGU_SRC_GP_CLKIN) - | CGU_PLL1_CTRL_PSEL(pll1_psel) - | CGU_PLL1_CTRL_NSEL(pll1_nsel) - | CGU_PLL1_CTRL_MSEL(4) - | CGU_PLL1_CTRL_FBSEL - | CGU_PLL1_CTRL_DIRECT; -#else /* Set PLL1 to High Speed/2 */ pll_reg |= CGU_PLL1_CTRL_CLK_SEL(CGU_SRC_GP_CLKIN) | CGU_PLL1_CTRL_PSEL(pll1_psel) @@ -650,7 +642,7 @@ void cpu_clock_pll1_high_speed(const airspy_pll1_hs_t* const pt_airspy_pll1_hs_c | CGU_PLL1_CTRL_MSEL(pll1_msel) | CGU_PLL1_CTRL_FBSEL; CGU_PLL1_CTRL = pll_reg; -#endif + /* wait until stable */ while (!(CGU_PLL1_STAT & CGU_PLL1_STAT_LOCK)); diff --git a/common/airspy_core.h b/common/airspy_core.h index dc4a839..187ba18 100644 --- a/common/airspy_core.h +++ b/common/airspy_core.h @@ -181,6 +181,7 @@ typedef struct /* Multi Core order (conf/command...) */ #define SET_SAMPLERATE_CMD (1) +#define SET_PACKING_CMD (1) #define START_ADCHS_CMD (1) #define STOP_ADCHS_CMD (2)