/*******************************************************************************
 * Copyright (c) 2018-2021 Renesas Electronics Corporation. All rights reserved.
 *
 *     RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIETARY
 *
 * This software is provided as reference/sample code under the license
 * agreement between Renesas Electronics Corporation and licensee (the
 * "License Agreement") and shall be treated as specified in the License
 * Agreement.
 * These instructions, statements, and software are the confidential
 * information of Renesas Electronics Corporation. They must be used and
 * modified solely for the purpose for which it was furnished by Renesas
 * Electronics Corporation. All or part of these instructions, statements and
 * software must not be reproduced nor disclosed to any third party in any
 * form, unless permitted by the License Agreement.
 *
 * THIS SOFTWARE IS PROVIDED BY RENESAS ELEOCTRONICS CORPORATION "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
 * SATISFACTORY QUALITY, ACCURACY, TITLE AND NON-INFRINGEMENT ARE DISCLAIMED.
 * IN NO EVENT SHALL RENESAS ELECTRONICS CORPORATION BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 ******************************************************************************/

/*******************************************************************************
 * DESCRIPTION   : Log driver header
 ******************************************************************************/

#ifndef LOG_H__
#define LOG_H__

#include <stdint.h>

#define LOG_NONE        (0)
#define LOG_ERROR       (1)
#define LOG_NOTICE      (2)
#define LOG_WARNING     (3)
#define LOG_INFO        (4)
#define LOG_VERBOSE     (5)

#if LOG_LEVEL >= LOG_VERBOSE
# define VERBOSE(...)   local_printf("V:" __VA_ARGS__)
#else
# define VERBOSE(...)
#endif

#if LOG_LEVEL >= LOG_INFO
# define INFO(...)  local_printf("I:" __VA_ARGS__)
#else
# define INFO(...)
#endif

#if LOG_LEVEL >= LOG_WARNING
# define WARN(...)  local_printf("W:" __VA_ARGS__)
#else
# define WARN(...)
#endif

#if LOG_LEVEL >= LOG_ERROR
# define ERROR(...) local_printf("E:" __VA_ARGS__)
#else
# define ERROR(...)
#endif

#if LOG_LEVEL >= LOG_NOTICE
# define NOTICE(...)    local_printf("N:" __VA_ARGS__)
#else
# define NOTICE(...)
#endif

#define panic                                           \
    do {                                                \
        local_printf("P:%s\n", __func__); \
        while(1){}                                      \
    } while (0)

#define FORCE(...)  local_printf(__VA_ARGS__)

void local_printf(const char *fmt, ...);

#endif /* LOG_H__ */
