Line 1... |
Line 1... |
/**
|
/*
|
* @file
|
* Copyright 2018 Sergey Khabarov, sergeykhbr@gmail.com
|
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved.
|
*
|
* @author Sergey Khabarov - sergeykhbr@gmail.com
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
* @brief Core API utils methods declaration.
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
*/
|
*/
|
|
|
#ifndef __DEBUGGER_API_UTILS_H__
|
#ifndef __DEBUGGER_API_UTILS_H__
|
#define __DEBUGGER_API_UTILS_H__
|
#define __DEBUGGER_API_UTILS_H__
|
|
|
#include <stdarg.h>
|
#include <stdarg.h>
|
#include "api_types.h"
|
#include <api_types.h>
|
#include "attribute.h"
|
#include <attribute.h>
|
|
|
namespace debugger {
|
namespace debugger {
|
|
|
#define LOG_ERROR 1
|
#define LOG_ERROR 1
|
|
#define LOG_IMPORTANT 2 // can be used for the autotest messages
|
#define LOG_INFO 3
|
#define LOG_INFO 3
|
#define LOG_DEBUG 4
|
#define LOG_DEBUG 4
|
|
|
#ifdef __cplusplus
|
#ifdef __cplusplus
|
extern "C" {
|
extern "C" {
|
Line 51... |
Line 61... |
#define RISCV_error(fmt, ...) \
|
#define RISCV_error(fmt, ...) \
|
RISCV_printf(getInterface(IFACE_SERVICE), LOG_ERROR, "%s:%d " fmt, \
|
RISCV_printf(getInterface(IFACE_SERVICE), LOG_ERROR, "%s:%d " fmt, \
|
__FILE__, __LINE__, __VA_ARGS__)
|
__FILE__, __LINE__, __VA_ARGS__)
|
|
|
/** Output with the information logging level */
|
/** Output with the information logging level */
|
|
#define RISCV_important(fmt, ...) \
|
|
RISCV_printf(getInterface(IFACE_SERVICE), LOG_IMPORTANT, fmt, __VA_ARGS__)
|
|
|
|
/** Output with the information logging level */
|
#define RISCV_info(fmt, ...) \
|
#define RISCV_info(fmt, ...) \
|
RISCV_printf(getInterface(IFACE_SERVICE), LOG_INFO, fmt, __VA_ARGS__)
|
RISCV_printf(getInterface(IFACE_SERVICE), LOG_INFO, fmt, __VA_ARGS__)
|
|
|
/** Output with the lower logging level */
|
/** Output with the lower logging level */
|
#define RISCV_debug(fmt, ...) \
|
#define RISCV_debug(fmt, ...) \
|
Line 67... |
Line 81... |
uint64_t RISCV_get_time_ms();
|
uint64_t RISCV_get_time_ms();
|
|
|
/** Get process ID. */
|
/** Get process ID. */
|
int RISCV_get_pid();
|
int RISCV_get_pid();
|
|
|
|
/** Memory barrier */
|
|
void RISCV_memory_barrier();
|
|
|
void RISCV_thread_create(void *data);
|
void RISCV_thread_create(void *data);
|
uint64_t RISCV_thread_id();
|
uint64_t RISCV_thread_id();
|
|
|
int RISCV_mutex_init(mutex_def *mutex);
|
int RISCV_mutex_init(mutex_def *mutex);
|
int RISCV_mutex_lock(mutex_def *mutex);
|
int RISCV_mutex_lock(mutex_def *mutex);
|
Line 84... |
Line 101... |
int RISCV_event_is_set(event_def *ev);
|
int RISCV_event_is_set(event_def *ev);
|
void RISCV_event_clear(event_def *ev);
|
void RISCV_event_clear(event_def *ev);
|
void RISCV_event_wait(event_def *ev);
|
void RISCV_event_wait(event_def *ev);
|
int RISCV_event_wait_ms(event_def *ev, int ms);
|
int RISCV_event_wait_ms(event_def *ev, int ms);
|
|
|
|
sharemem_def RISCV_memshare_create(const char *name, int sz);
|
|
void* RISCV_memshare_map(sharemem_def h, int sz);
|
|
void RISCV_memshare_unmap(void *buf);
|
|
void RISCV_memshare_delete(sharemem_def h);
|
|
|
/** Memory allocator/de-allocator */
|
/** Memory allocator/de-allocator */
|
void *RISCV_malloc(uint64_t sz);
|
void *RISCV_malloc(uint64_t sz);
|
void RISCV_free(void *p);
|
void RISCV_free(void *p);
|
|
|
/** Get absolute directory where core library is placed. */
|
/** Get absolute directory where core library is placed. */
|