int ssl_configure(GLOBAL_OPTIONS *global) { /* configure global SSL settings */ #ifdef USE_FIPS if(FIPS_mode()!=global->option.fips) { RAND_set_rand_method(NULL); /* reset RAND methods */ if(!FIPS_mode_set(global->option.fips)) { ERR_load_crypto_strings(); sslerror("FIPS_mode_set"); return 1; } } s_log(LOG_NOTICE, "FIPS mode %s", global->option.fips ? "enabled" : "disabled"); #endif /* USE_FIPS */ #ifndef OPENSSL_NO_COMP if(compression_init(global)) return 1; #endif /* OPENSSL_NO_COMP */ if(prng_init(global)) return 1; s_log(LOG_DEBUG, "PRNG seeded successfully"); return 0; /* SUCCESS */ }
/** @brief Function for main application entry. */ int main(void) { TaskHandle_t compress_task_handle; TimerHandle_t spi_timer_handle; uint32_t err_code; err_code = nrf_drv_clock_init(); APP_ERROR_CHECK(err_code); // Setup bsp module. //bsp_configuration(); //uart initialization const app_uart_comm_params_t comm_params = { RX_PIN_NUMBER, TX_PIN_NUMBER, RTS_PIN_NUMBER, CTS_PIN_NUMBER, APP_UART_FLOW_CONTROL_ENABLED, false, UART_BAUDRATE_BAUDRATE_Baud38400 }; APP_UART_FIFO_INIT(&comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_error_handle, APP_IRQ_PRIORITY_LOW, err_code); APP_ERROR_CHECK(err_code); //nrf_drv_gpiote_out_config_t config = GPIOTE_CONFIG_OUT_TASK_HIGH; //config.init_state = true; //err_code = nrf_drv_gpiote_out_init(20, &config); //while(app_uart_put(65) != NRF_SUCCESS); //printf("1 ms = %d\n", pdMS_TO_TICKS(1)); intan_setup(); //while(app_uart_put(65) != NRF_SUCCESS); compression_init(); uesb_config_t uesb_config = UESB_DEFAULT_CONFIG; uesb_config.event_handler = uesb_event_handler; if (uesb_init(&uesb_config)!= UESB_SUCCESS) { printf("ESB init messed up\r\n"); } tx_payload.length = UESB_CORE_MAX_PAYLOAD_LENGTH; tx_payload.pipe = 0; while(app_uart_put(66) != NRF_SUCCESS); //printf("yo\n"); UNUSED_VARIABLE(xTaskCreate(compress_task, "c_task", configMINIMAL_STACK_SIZE + 200, NULL, 1, &compress_task_handle)); if(compress_task_handle == NULL) { printf("compression task init messed up\r\n"); } while(app_uart_put(67) != NRF_SUCCESS); //Test read intan company ID timer //spi_timer_handle = xTimerCreate("s_timer", 1, pdTRUE, NULL, spi_intan_id_handler); // Sample timer spi_timer_handle = xTimerCreate("s_timer", 1, pdTRUE, NULL, spi_data_collection_evt_handler); // LED1 timer creation if(spi_timer_handle == NULL) { printf("SPI timer init messed up\r\n"); } while(app_uart_put(68) != NRF_SUCCESS); if(xTimerStart(spi_timer_handle, 0) != pdPASS) { printf("Timer could not be started\r\n"); } while(app_uart_put(69) != NRF_SUCCESS); /* Activate deep sleep mode */ SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // Start FreeRTOS scheduler. vTaskStartScheduler(); //timers_init(); //while(app_uart_put(67) != NRF_SUCCESS); //data_collection_timers_start(); //while(app_uart_put(68) != NRF_SUCCESS); for (;;) { printf("Messed up\r\n"); //power_manage(); /*if (m_transfer_completed) { //while(app_uart_put(72) != NRF_SUCCESS); m_transfer_completed = false; intan_convert(m_tx_data_spi, m_rx_data_spi,intan_convert_channel); //while(app_uart_put(73) != NRF_SUCCESS); intan_convert_channel ++; intan_convert_channel = intan_convert_channel % 32; //print m_rx_data_spi results switch_state(); //while(app_uart_put(74) != NRF_SUCCESS); //for (int i; i< RX_MSG_LENGTH; i++){ // while(app_uart_put(m_rx_data_spi[i]) != NRF_SUCCESS); //} nrf_delay_ms(DELAY_MS); //while(app_uart_put(75) != NRF_SUCCESS); }*/ //while(app_uart_put(76) != NRF_SUCCESS); } }