1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Copyright 2020, 2023 NXP
*/
#ifndef MISC_HELPER_H
#define MISC_HELPER_H
/*===========================================================================*/
/**
@file misc_helper.h
@brief Provide miscellaneous helper functions
*/
/*===========================================================================
INCLUDE FILES
=============================================================================*/
#include "csf.h"
/*===========================================================================
STRUCTURES AND OTHER TYPEDEFS
=============================================================================*/
/** Byte string
*
* Defines the byte string struct
*/
typedef struct byte_str_s
{
uint8_t *entry;
size_t entry_bytes;
} byte_str_t;
/*===========================================================================
FUNCTION PROTOTYPES
=============================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
/** Read bytes from a file
*
* Reads an amount of bytes from an input file
*
* @param[in] filename Input file name to be read
*
* @param[out] byte_str Byte string struct to return the read data
*
* @param[in] offsets If defined,
*
* @pre @a filename and @a offsets must not be NULL
*
* @post none
*
* @returns the size of memory allocated point to by byte_str
*/
void
read_file(const char *filename, byte_str_t *byte_str, offsets_t *offsets);
#ifdef __cplusplus
}
#endif
#endif /* MISC_HELPER_H */
|