From c1c00f2b3aff8c03d2507b7f3af39748d6bf05df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Thu, 20 Jul 2017 00:32:37 +0200 Subject: [PATCH] Replace tabs with spaces. --- left/src/bootloader.c | 16 +++--- right/src/buspal/command.c | 110 ++++++++++++++++++------------------- 2 files changed, 63 insertions(+), 63 deletions(-) diff --git a/left/src/bootloader.c b/left/src/bootloader.c index 8019521..7be6eba 100644 --- a/left/src/bootloader.c +++ b/left/src/bootloader.c @@ -3,7 +3,7 @@ /* bits for enabledPeripherals */ #define ENABLE_PERIPHERAL_UART (1<<0) #define ENABLE_PERIPHERAL_I2C (1<<1) -#define ENABLE_PERIPHERAL_SPI (1<<2) +#define ENABLE_PERIPHERAL_SPI (1<<2) #define ENABLE_PERIPHERAL_CAN (1<<3) #define ENABLE_PERIPHERAL_USB_HID (1<<4) #define ENABLE_PERIPHERAL_USB_MSC (1<<7) @@ -18,13 +18,13 @@ __attribute__((used, section(".BootloaderConfig"))) const bootloader_config_t Bo }; void JumpToBootloader(void) { - uint32_t runBootloaderAddress; - void (*runBootloader)(void *arg); + uint32_t runBootloaderAddress; + void (*runBootloader)(void *arg); - /* Read the function address from the ROM API tree. */ - runBootloaderAddress = **(uint32_t **)(0x1c00001c); - runBootloader = (void (*)(void * arg))runBootloaderAddress; + /* Read the function address from the ROM API tree. */ + runBootloaderAddress = **(uint32_t **)(0x1c00001c); + runBootloader = (void (*)(void * arg))runBootloaderAddress; - /* Start the bootloader. */ - runBootloader(NULL); + /* Start the bootloader. */ + runBootloader(NULL); } diff --git a/right/src/buspal/command.c b/right/src/buspal/command.c index aab7bdf..4fa8a66 100644 --- a/right/src/buspal/command.c +++ b/right/src/buspal/command.c @@ -37,14 +37,14 @@ static int WaitForStartByte(uint8_t *buf, size_t *nofRead) uint8_t tmp; int cntr = 128; /* max retries */ - microseconds_delay(1000); /* initial delay of 1 ms, see errata of KL03Z ROM Bootloader */ + microseconds_delay(1000); /* initial delay of 1 ms, see errata of KL03Z ROM Bootloader */ while(cntr>0) { peripheral_read(&tmp, 1); /* read one byte */ if (tmp==kFramingPacketStartByte) { /* start of frame? */ - *buf = tmp; /* store byte read */ - *nofRead = 1; /* return number of bytes read */ + *buf = tmp; /* store byte read */ + *nofRead = 1; /* return number of bytes read */ return 1; /* ok */ } microseconds_delay(500); /* just wait for some time until the next retry */ @@ -164,20 +164,20 @@ static void finalize_data_phase(status_t status) if (status == kStatus_Success) { #if FIXED_BUSPAL_BOOTLOADER - int res; - size_t offset; + int res; + size_t offset; - status = kStatus_Success; /* default */ - res = WaitForStartByte(rxBuf, &offset); - if (res==1 && offset==1) - { - /* read remaining bytes */ + status = kStatus_Success; /* default */ + res = WaitForStartByte(rxBuf, &offset); + if (res==1 && offset==1) + { + /* read remaining bytes */ if (peripheral_read(rxBuf+offset, sizeof(framing_data_packet_t)-offset) != kStatus_Success) { - status = kStatus_Fail; + status = kStatus_Fail; } - } - if (kStatus_Success!=kStatus_Success) + } + if (kStatus_Success!=kStatus_Success) #else // receiving framing packet header if (peripheral_read(rxBuf, sizeof(framing_data_packet_t)) != kStatus_Success) @@ -205,9 +205,9 @@ static void finalize_data_phase(status_t status) sync.header.packetType = kFramingPacketType_Ack; } - #if FIXED_BUSPAL_BOOTLOADER - microseconds_delay(1000); - #endif + #if FIXED_BUSPAL_BOOTLOADER + microseconds_delay(1000); + #endif // send Ack/Nak back to peripheral peripheral_write((uint8_t *)&sync, sizeof(framing_sync_packet_t)); } @@ -376,23 +376,23 @@ static status_t handle_data_write(bool *hasMoreData) do { #if FIXED_BUSPAL_BOOTLOADER - int res; - size_t offset; + int res; + size_t offset; - status = kStatus_Success; /* default */ - res = WaitForStartByte((uint8_t *)&sync.header, &offset); - if (res==1 && offset==1) - { /* success! read remaining byte */ - if (peripheral_read((uint8_t *)&sync.header+offset, 2-offset) != kStatus_Success) - { - status = kStatus_Fail; - } - } - else - { - status = kStatus_Fail; - } - if (status != kStatus_Success) + status = kStatus_Success; /* default */ + res = WaitForStartByte((uint8_t *)&sync.header, &offset); + if (res==1 && offset==1) + { /* success! read remaining byte */ + if (peripheral_read((uint8_t *)&sync.header+offset, 2-offset) != kStatus_Success) + { + status = kStatus_Fail; + } + } + else + { + status = kStatus_Fail; + } + if (status != kStatus_Success) #else if (peripheral_read((uint8_t *)&sync.header, 2) != kStatus_Success) #endif @@ -563,11 +563,11 @@ static status_t handle_command_internal(uint8_t *packet, uint32_t packetLength) do { #if FIXED_BUSPAL_BOOTLOADER - size_t offset; - int res; + size_t offset; + int res; - res = WaitForStartByte(&sync.header.startByte, &offset); - if (res!=1 || offset!=1) + res = WaitForStartByte(&sync.header.startByte, &offset); + if (res!=1 || offset!=1) #else if (peripheral_read((uint8_t *)&sync.header.startByte, 1) != kStatus_Success) #endif @@ -590,24 +590,24 @@ static status_t handle_command_internal(uint8_t *packet, uint32_t packetLength) else { #if FIXED_BUSPAL_BOOTLOADER - size_t offset; - int res; + size_t offset; + int res; - status = kStatus_Success; /* set default */ - res = WaitForStartByte(rxBuf, &offset); - if (res==1 && offset==1) - { - /* read remaining bytes */ - if (peripheral_read(rxBuf+offset, sizeof(framing_data_packet_t)-offset) != kStatus_Success) - { - status = kStatus_Fail; - } - } - else - { + status = kStatus_Success; /* set default */ + res = WaitForStartByte(rxBuf, &offset); + if (res==1 && offset==1) + { + /* read remaining bytes */ + if (peripheral_read(rxBuf+offset, sizeof(framing_data_packet_t)-offset) != kStatus_Success) + { + status = kStatus_Fail; + } + } + else + { status = kStatus_Fail; - } - if (status!=kStatus_Success) + } + if (status!=kStatus_Success) #else // receiving framing packet header if (peripheral_read(rxBuf, sizeof(framing_data_packet_t)) != kStatus_Success) @@ -629,9 +629,9 @@ static status_t handle_command_internal(uint8_t *packet, uint32_t packetLength) } // send Ack/Nak back to peripheral - #if FIXED_BUSPAL_BOOTLOADER - microseconds_delay(1000); - #endif + #if FIXED_BUSPAL_BOOTLOADER + microseconds_delay(1000); + #endif peripheral_write((uint8_t *)&sync, sizeof(framing_sync_packet_t)); } }