refactor init functions

This commit is contained in:
Conor Patrick
2019-02-02 00:23:01 -05:00
parent c3bddee814
commit 4ba57ccc85
4 changed files with 276 additions and 263 deletions

View File

@@ -1,21 +1,21 @@
/*
* Copyright (C) 2018 SoloKeys, Inc. <https://solokeys.com/>
*
*
* This file is part of Solo.
*
*
* Solo 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
* (at your option) any later version.
*
*
* Solo 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 Solo. If not, see <https://www.gnu.org/licenses/>
*
*
* This code is available under licenses for commercial use.
* Please contact SoloKeys for more information.
*/
@@ -66,7 +66,7 @@
#define SKIP_BUTTON_CHECK_FAST 1
void printing_init();
void hw_init(void);
void hw_init(int lf);
// Trigger software reset
void device_reboot();

View File

@@ -23,6 +23,9 @@
#include <stdlib.h>
#include <stdint.h>
#include "stm32l4xx_ll_rcc.h"
#include "stm32l4xx.h"
#include "cbor.h"
#include "device.h"
#include "ctaphid.h"
@@ -32,9 +35,8 @@
#include "ctap.h"
#include "app.h"
#include "memory_layout.h"
#include "stm32l4xx_ll_rcc.h"
#include "init.h"
#include "stm32l4xx.h"
uint8_t REBOOT_FLAG = 0;
@@ -82,7 +84,15 @@ int main(int argc, char * argv[])
TAG_ERR
);
device_init();
// device_init();
SystemClock_Config_LF();
init_gpio();
init_millisecond_timer(1);
#if DEBUG_LEVEL > 0
init_debug_uart();
#endif
printf1(TAG_GEN,"init device\n");
t1 = millis();
@@ -118,7 +128,14 @@ int main(int argc, char * argv[])
printf1(TAG_RED,"Not authorized to boot (%08x == %08lx)\r\n", AUTH_WORD_ADDR, *(uint32_t*)AUTH_WORD_ADDR);
}
start_bootloader:
SystemClock_Config();
init_gpio();
init_millisecond_timer(0);
init_pwm();
init_rng();
usbhid_init();
printf1(TAG_GEN,"init usb\n");
ctaphid_init();