HW models: Use libUtil bs_create_folders_in_path
As due to codedphy we anyhow require an updated libUtil version, let's use its new APIs instead of providing our own for backwards compatibility. Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
parent
c7798a4174
commit
0da91633f2
|
@ -26,7 +26,6 @@ src/HW_models/NHW_TIMER.c
|
|||
src/HW_models/NHW_UART.c
|
||||
src/HW_models/NHW_UART_backend_fifo.c
|
||||
src/HW_models/NHW_UART_be_loopb.c
|
||||
src/HW_models/bs_compat.c
|
||||
src/HW_models/NHW_52_FICR.c
|
||||
src/HW_models/NRF_GPIOTE.c
|
||||
src/HW_models/NHW_RNG.c
|
||||
|
|
|
@ -5,7 +5,6 @@ src/HW_models/fake_timer.c
|
|||
src/HW_models/crc.c
|
||||
src/HW_models/irq_ctrl.c
|
||||
src/HW_models/bstest_ticker.c
|
||||
src/HW_models/bs_compat.c
|
||||
src/HW_models/NHW_53_FICR.c
|
||||
src/HW_models/NHW_AAR.c
|
||||
src/HW_models/NHW_AES_CCM.c
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <sys/mman.h>
|
||||
#include "bs_tracing.h"
|
||||
#include "bs_oswrap.h"
|
||||
#include "bs_compat.h"
|
||||
#include "NHW_NVM_backend.h"
|
||||
|
||||
/**
|
||||
|
@ -40,7 +39,7 @@ void nhw_nvm_initialize_data_storage(nvm_storage_state_t *st){
|
|||
|
||||
} else {
|
||||
|
||||
_bs_create_folders_in_path(st->file_path);
|
||||
bs_create_folders_in_path(st->file_path);
|
||||
st->fd = open(st->file_path, O_RDWR | O_CREAT, (mode_t)0600);
|
||||
if (st->fd == -1) {
|
||||
bs_trace_error_line("%s: Failed to open %s device file %s: %s\n",
|
||||
|
|
|
@ -81,7 +81,6 @@
|
|||
#include "bs_tracing.h"
|
||||
#include "bs_oswrap.h"
|
||||
#include "bs_utils.h"
|
||||
#include "bs_compat.h"
|
||||
#include "bs_cmd_line.h"
|
||||
#include "bs_dynargs.h"
|
||||
#include "nsi_hw_scheduler.h"
|
||||
|
@ -144,12 +143,12 @@ static void nhw_uarte_init(void) {
|
|||
raise_RTS_R(i, u_el);
|
||||
|
||||
if (u_el->Tx_log_file_name) {
|
||||
_bs_create_folders_in_path(u_el->Tx_log_file_name);
|
||||
bs_create_folders_in_path(u_el->Tx_log_file_name);
|
||||
u_el->Tx_log_file = bs_fopen(u_el->Tx_log_file_name, "w");
|
||||
fprintf(u_el->Tx_log_file, "time(microsecond),byte\n");
|
||||
}
|
||||
if (u_el->Rx_log_file_name) {
|
||||
_bs_create_folders_in_path(u_el->Rx_log_file_name);
|
||||
bs_create_folders_in_path(u_el->Rx_log_file_name);
|
||||
u_el->Rx_log_file = bs_fopen(u_el->Rx_log_file_name, "w");
|
||||
fprintf(u_el->Rx_log_file, "time(microsecond),byte\n");
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "bs_types.h"
|
||||
#include "bs_tracing.h"
|
||||
#include "bs_oswrap.h"
|
||||
#include "bs_compat.h"
|
||||
#include "bs_utils.h"
|
||||
#include "bs_cmd_line.h"
|
||||
#include "bs_dynargs.h"
|
||||
|
@ -631,8 +630,8 @@ NSI_TASK(nhw_ufifo_backend_post_cmdline, PRE_BOOT_2, 200);
|
|||
static void nhw_ufifo_create_fifos(uint inst, struct ufifo_st_t *u_el) {
|
||||
bs_trace_raw_time(9, "Creating UART%i backend FIFOs, and connecting Tx end\n", inst);
|
||||
|
||||
_bs_create_folders_in_path(u_el->fifo_Tx_path);
|
||||
_bs_create_folders_in_path(u_el->fifo_Rx_path);
|
||||
bs_create_folders_in_path(u_el->fifo_Tx_path);
|
||||
bs_create_folders_in_path(u_el->fifo_Rx_path);
|
||||
|
||||
if (pb_create_fifo_if_not_there(u_el->fifo_Tx_path) != 0) {
|
||||
bs_trace_error_line("Couldn't create UART backend Tx FIFOs\n");
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "NHW_common_types.h"
|
||||
#include "NHW_config.h"
|
||||
#include "NRF_GPIO.h"
|
||||
|
@ -23,7 +24,6 @@
|
|||
#include "nsi_hw_scheduler.h"
|
||||
#include "bs_tracing.h"
|
||||
#include "bs_oswrap.h"
|
||||
#include "bs_compat.h"
|
||||
#include "bs_cmd_line.h"
|
||||
#include "bs_dynargs.h"
|
||||
#include "nsi_hws_models_if.h"
|
||||
|
@ -146,7 +146,7 @@ static void nrf_gpio_init_output_file(void)
|
|||
return;
|
||||
}
|
||||
|
||||
_bs_create_folders_in_path(gpio_out_file_path);
|
||||
bs_create_folders_in_path(gpio_out_file_path);
|
||||
output_file_ptr = bs_fopen(gpio_out_file_path, "w");
|
||||
fprintf(output_file_ptr, "time(microsecond),port,pin,level\n");
|
||||
}
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "bs_oswrap.h"
|
||||
|
||||
/*
|
||||
* Note: This is a replica of
|
||||
* libUtilv1/bs_oswrap.c:bs_create_folders_in_path()
|
||||
* It exists here only to allow using it without requiring
|
||||
* users to update their simulator version.
|
||||
* It should be removed when libUtilv1 >= v1.12 becomes required
|
||||
* or common enough otherwise
|
||||
*
|
||||
* If missing, attempt to create all folders in a file path
|
||||
* Folders are expected to be separated by '/'
|
||||
* The path is assumed to be a path to either a folder or a file,
|
||||
* but if to a folder, it must end with a '/'.
|
||||
* The remainder of the string after '/' will be ignored
|
||||
* (assuming it is a file name)
|
||||
*/
|
||||
int _bs_create_folders_in_path(const char *path) {
|
||||
char sep='/';
|
||||
char *start = (char* )path;
|
||||
|
||||
while (*start == sep) {
|
||||
start++;
|
||||
}
|
||||
char *end_folder = strchr(start, sep);
|
||||
|
||||
while (end_folder != NULL) {
|
||||
*end_folder = 0;
|
||||
int ret = bs_createfolder(path);
|
||||
*end_folder = sep;
|
||||
if (ret != 0) {
|
||||
return 1;
|
||||
}
|
||||
end_folder = strchr(end_folder + 1, sep);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef _NRF_HW_MODEL_BS_COMPAT_H
|
||||
#define _NRF_HW_MODEL_BS_COMPAT_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
int _bs_create_folders_in_path(const char *path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue