source: soft/giet_vm/giet_libs/libsrl/srl_log.h

Last change on this file was 258, checked in by alain, 11 years ago

This is a major release, including a deep restructuration of code.
The main evolutions are

  • use of the Tsar preloader to load the GIET boot-loader from disk
  • introduction of a FAT32 file system library,
  • use of this fat32 library by the boot-loader to load the map.bin data structure, and the various .elf files
  • reorganisation of drivers (one file per peripheral).
  • introduction of drivers for new peripherals: vci_chbuf_dma and vci_multi_ahci.
  • introduction of a new physical memory allocator in the boot code.

This release has been tested on the tsar_generic_iob architecture,
for the two following mappings: 4c_1p_iob_four.xml and 4c_1p_iob_sort.xml

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1/*
2 * This file is part of DSX, development environment for static
3 * SoC applications.
4 *
5 * This file is distributed under the terms of the GNU General Public
6 * License.
7 *
8 * Copyright (c) 2006, Nicolas Pouillon, <nipo@ssji.net>
9 *     Laboratoire d'informatique de Paris 6 / ASIM, France
10 *
11 *  $Id$
12 */
13
14#ifndef SRL_LOG_H_
15#define SRL_LOG_H_
16
17/**
18 * @file
19 * @module{SRL}
20 * @short Debug messages
21 */
22
23#include "stdio.h"
24#include "giet_config.h"
25#include "srl_hw_helpers.h"
26
27/** @internal */
28enum __srl_verbosity {
29    VERB_NONE,
30    VERB_TRACE,
31    VERB_DEBUG,
32    VERB_MAX,
33};
34
35
36void _srl_log(const char *);
37void _srl_log_printf(const char *, ...);
38
39#define GET_VERB_(x,y) x##y
40#define GET_VERB(x) GET_VERB_(VERB_,x)
41
42/**
43   @this prints a message if the current verbosity is sufficient.
44
45   @param l Minimal verbosity of the message
46   @param c Message to print
47 */
48#define srl_log( l, c ) do {                                                                               \
49                if (GET_VERB(l) <= GET_VERB(CONFIG_SRL_VERBOSITY)) {               \
50            giet_tty_printf(c);                                             \
51                }                                                                                                                          \
52        } while (0)
53
54/**
55   @this prints a message if the current verbosity is sufficient.
56
57   @param l Minimal verbosity of the message
58   @param c Message to print, with a printf-like syntax
59 */
60#define srl_log_printf( l, ... ) do {                                   \
61                if (GET_VERB(l) <= GET_VERB(CONFIG_SRL_VERBOSITY)) {                \
62            giet_tty_printf(__VA_ARGS__);                                    \
63                }                                                                                                                           \
64        } while (0)
65
66/**
67   @this is the same as @ref #assert.
68    TODO change the location?
69 */
70#define srl_assert(expr)                                                                                                \
71    do {                                                                                                                                \
72        if ( ! (expr) ) {                                                                                               \
73            srl_log_printf(NONE, "assertion (%s) failed on %s:%d !\n",  \
74                                                   #expr, __FILE__, __LINE__ );                                 \
75            srl_abort();                                                                                                        \
76        }                                                                                                                               \
77    } while(0)
78
79#endif
Note: See TracBrowser for help on using the repository browser.