/*
 * swo_log_backend.h
 *
 * Created on: 21.04.2025
 * Author: Kilian
 *
 * SWO backend for the logging system
 */
#pragma once
#ifndef __SWO_LOG_BACKEND_H
#define __SWO_LOG_BACKEND_H

#include "log.h"
#include "stm32h7xx_hal.h"

/* SWO Backend Configuration */
#define USE_MULTIPLE_CHANNELS false // if true, each log level has its own channel (FATAL : 0, ERROR : 1, etc.)
#if !USE_MULTIPLE_CHANNELS
  #ifndef DEBUG_CHANNEL
    #define DEBUG_CHANNEL 0 // channel to output messages on
  #endif
  #define USE_CHANNEL_MASK_VARIABLE true
#endif

#if USE_CHANNEL_MASK_VARIABLE
  #define MASK_VARIABLE logging_mask // variable to store the channel mask, must be globally defined somewhere
  extern volatile uint32_t MASK_VARIABLE;
#endif

/* SWO backend API */
void swo_log_backend_init(void);
bool swo_log_is_backend_registered(void);
const log_backend_t* swo_log_get_backend(void);

#endif /* __SWO_LOG_BACKEND_H */