mirror of
https://github.com/OpenAMP/libmetal.git
synced 2026-02-06 11:54:24 +08:00
Add file header on missing .c and *h files to display brief in documentation. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
47 lines
888 B
C
47 lines
888 B
C
/*
|
|
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
/**
|
|
* @file init.c
|
|
* @brief Libmetal initialization.
|
|
*/
|
|
|
|
#include <string.h>
|
|
#include <metal/sys.h>
|
|
|
|
int metal_init(const struct metal_init_params *params)
|
|
{
|
|
int error = 0;
|
|
|
|
if (_metal.common.ref_count++ != 0)
|
|
return 0;
|
|
|
|
memset(&_metal, 0, sizeof(_metal));
|
|
|
|
_metal.common.log_handler = params->log_handler;
|
|
_metal.common.log_level = params->log_level;
|
|
|
|
metal_list_init(&_metal.common.bus_list);
|
|
metal_list_init(&_metal.common.generic_shmem_list);
|
|
metal_list_init(&_metal.common.generic_device_list);
|
|
|
|
error = metal_sys_init(params);
|
|
if (error)
|
|
return error;
|
|
|
|
++_metal.common.ref_count;
|
|
return error;
|
|
}
|
|
|
|
void metal_finish(void)
|
|
{
|
|
if (--_metal.common.ref_count != 0)
|
|
return;
|
|
|
|
metal_sys_finish();
|
|
memset(&_metal, 0, sizeof(_metal));
|
|
}
|