Skip to content

Commit

Permalink
Minor cleanup (Tab to Space)
Browse files Browse the repository at this point in the history
  • Loading branch information
bvernoux committed Jul 13, 2015
1 parent 8c4f247 commit e4d9137
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 72 deletions.
30 changes: 15 additions & 15 deletions airspy_m0/airspy_m0.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void set_packing_m4(uint8_t state)
while(1)
{
if(set_packing->raw == 0)
break;
break;
}
}

Expand Down Expand Up @@ -194,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);
Expand All @@ -209,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];
Expand All @@ -222,18 +222,18 @@ int main(void)
nvic_enable_irq(NVIC_M4CORE_IRQ);

usb_run(&usb_device);

while(true)
{
signal_wfe();
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[offset], length);
*last_offset_m0 = offset;
}
}

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[offset], length);
*last_offset_m0 = offset;
}
}
}
8 changes: 4 additions & 4 deletions airspy_m4/adchs.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ void ADCHS_DMA_init(uint32_t dest_addr, uint8_t packed)

if(packed)
{
for(i=0; i<ADCHS_DMA_NUM_LLI; i++)
{
adchs_dma_lli[i].control |= (0x1UL << 31);
}
for(i=0; i<ADCHS_DMA_NUM_LLI; i++)
{
adchs_dma_lli[i].control |= (0x1UL << 31);
}
}
else
{
Expand Down
106 changes: 53 additions & 53 deletions airspy_m4/airspy_m4.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,44 +134,44 @@ __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");
}

static __inline__ void clr_usb_buffer_offset(void)
{
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;
usb_bulk_buffer_offset_m4[0] = ADCHS_DATA_TRANSFER_SIZE_BYTE;
}
else
{
Expand Down Expand Up @@ -330,15 +330,15 @@ void dma_isr(void)
{
LPC_GPDMA->INTTCCLEAR |= INTTC0; /* Clear Chan0 */

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();
}
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
Expand Down Expand Up @@ -369,8 +369,8 @@ void m0core_isr(void)
packing_cmd = get_packing(&packing_state);
if(packing_cmd == SET_PACKING_CMD)
{
set_packing_state(packing_state);
ack_packing();
set_packing_state(packing_state);
ack_packing();
}

adchs_start_stop_cmd = get_start_stop_adchs();
Expand Down Expand Up @@ -490,15 +490,15 @@ int main(void)

if(use_packing)
{
/* 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;
}
}
}
/* 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;
}
}
}
}

0 comments on commit e4d9137

Please sign in to comment.