Fix whitespace

Use a consistent standard - Tabs in front for indenting, spaces after for anything else. This way everything stays nice and lined up while also letting users change there prefered indent level. Most of the new files from Haata where already in this format.
This commit is contained in:
Rowan Decker 2015-03-08 18:40:01 -07:00
parent a6fdeb47ea
commit 1392571bd7
45 changed files with 3258 additions and 3258 deletions

View file

@ -36,38 +36,38 @@ static char staging[FLASH_SECTOR_SIZE];
static enum dfu_status setup_write(size_t off, size_t len, void **buf)
{
static int last = 0;
static int last = 0;
if (len > sizeof(staging))
return (DFU_STATUS_errADDRESS);
if (len > sizeof(staging))
return (DFU_STATUS_errADDRESS);
// We only allow the last write to be less than one sector size.
if (off == 0)
last = 0;
if (last && len != 0)
return (DFU_STATUS_errADDRESS);
if (len != FLASH_SECTOR_SIZE) {
last = 1;
memset(staging, 0xff, sizeof(staging));
}
// We only allow the last write to be less than one sector size.
if (off == 0)
last = 0;
if (last && len != 0)
return (DFU_STATUS_errADDRESS);
if (len != FLASH_SECTOR_SIZE) {
last = 1;
memset(staging, 0xff, sizeof(staging));
}
*buf = staging;
return (DFU_STATUS_OK);
*buf = staging;
return (DFU_STATUS_OK);
}
static enum dfu_status finish_write( void *buf, size_t off, size_t len )
{
void *target;
if (len == 0)
return (DFU_STATUS_OK);
void *target;
if (len == 0)
return (DFU_STATUS_OK);
target = flash_get_staging_area(off + (uintptr_t)&_app_rom, FLASH_SECTOR_SIZE);
if (!target)
return (DFU_STATUS_errADDRESS);
memcpy(target, buf, len);
if (flash_program_sector(off + (uintptr_t)&_app_rom, FLASH_SECTOR_SIZE) != 0)
return (DFU_STATUS_errADDRESS);
return (DFU_STATUS_OK);
target = flash_get_staging_area(off + (uintptr_t)&_app_rom, FLASH_SECTOR_SIZE);
if (!target)
return (DFU_STATUS_errADDRESS);
memcpy(target, buf, len);
if (flash_program_sector(off + (uintptr_t)&_app_rom, FLASH_SECTOR_SIZE) != 0)
return (DFU_STATUS_errADDRESS);
return (DFU_STATUS_OK);
}
@ -75,7 +75,7 @@ static struct dfu_ctx dfu_ctx;
void init_usb_bootloader( int config )
{
dfu_init(setup_write, finish_write, &dfu_ctx);
dfu_init(setup_write, finish_write, &dfu_ctx);
}
void main()
@ -98,12 +98,12 @@ void main()
#endif
flash_prepare_flashing();
flash_prepare_flashing();
usb_init( &dfu_device );
for (;;)
usb_init( &dfu_device );
for (;;)
{
usb_poll();
}
usb_poll();
}
}