Annotation of hatari/src/debug/log.h, revision 1.1.1.3

1.1       root        1: /*
                      2:   Hatari - log.h
                      3:   
                      4:   This file is distributed under the GNU Public License, version 2 or at
                      5:   your option any later version. Read the file gpl.txt for details.
                      6: */
                      7: #ifndef HATARI_LOG_H
                      8: #define HATARI_LOG_H
                      9: 
                     10: #include <stdbool.h>
                     11: #include <SDL_types.h>
                     12: 
                     13: 
                     14: /* Logging
                     15:  * -------
                     16:  * Is always enabled as it's information that can be useful
                     17:  * to the Hatari users
                     18:  */
                     19: typedef enum
                     20: {
                     21: /* these present user with a dialog and log the issue */
                     22:        LOG_FATAL,      /* Hatari can't continue unless user resolves issue */
                     23:        LOG_ERROR,      /* something user did directly failed (e.g. save) */
                     24: /* these just log the issue */
                     25:        LOG_WARN,       /* something failed, but it's less serious */
                     26:        LOG_INFO,       /* user action success (e.g. TOS file load) */
                     27:        LOG_TODO,       /* functionality not yet being emulated */
                     28:        LOG_DEBUG,      /* information about internal Hatari working */
                     29:        LOG_NONE        /* invalid LOG level */
                     30: } LOGTYPE;
                     31: 
                     32: #ifndef __GNUC__
                     33: /* assuming attributes work only for GCC */
                     34: #define __attribute__(foo)
                     35: #endif
                     36: 
                     37: extern int Log_Init(void);
                     38: extern int Log_SetAlertLevel(int level);
                     39: extern void Log_UnInit(void);
                     40: extern void Log_Printf(LOGTYPE nType, const char *psFormat, ...)
                     41:        __attribute__ ((format (printf, 2, 3)));
                     42: extern void Log_AlertDlg(LOGTYPE nType, const char *psFormat, ...)
                     43:        __attribute__ ((format (printf, 2, 3)));
                     44: extern LOGTYPE Log_ParseOptions(const char *OptionStr);
                     45: extern const char* Log_SetTraceOptions(const char *OptionsStr);
                     46: extern char *Log_MatchTrace(const char *text, int state);
                     47: 
                     48: #ifndef __GNUC__
                     49: #undef __attribute__
                     50: #endif
                     51: 
                     52: 
                     53: 
                     54: /* Tracing
                     55:  * -------
                     56:  * Tracing outputs information about what happens in the emulated
                     57:  * system and slows down the emulation.  As it's intended mainly
                     58:  * just for the Hatari developers, tracing support is compiled in
                     59:  * by default.
                     60:  * 
                     61:  * Tracing can be enabled by defining ENABLE_TRACING
                     62:  * in the top level config.h
                     63:  */
                     64: #include "config.h"
                     65: 
1.1.1.2   root       66: /* Up to 64 levels when using Uint64 for HatariTraceFlags */
1.1       root       67: #define        TRACE_VIDEO_SYNC         (1<<0)
                     68: #define        TRACE_VIDEO_RES          (1<<1)
                     69: #define        TRACE_VIDEO_COLOR        (1<<2)
                     70: #define        TRACE_VIDEO_BORDER_V     (1<<3)
                     71: #define        TRACE_VIDEO_BORDER_H     (1<<4)
                     72: #define        TRACE_VIDEO_ADDR         (1<<5)
                     73: #define        TRACE_VIDEO_VBL          (1<<6)
                     74: #define        TRACE_VIDEO_HBL          (1<<7)
                     75: #define        TRACE_VIDEO_STE          (1<<8)
                     76: 
                     77: #define        TRACE_MFP_EXCEPTION      (1<<9)
                     78: #define        TRACE_MFP_START          (1<<10)
                     79: #define        TRACE_MFP_READ           (1<<11)
                     80: #define        TRACE_MFP_WRITE          (1<<12)
                     81: 
                     82: #define        TRACE_PSG_READ           (1<<13)
                     83: #define        TRACE_PSG_WRITE          (1<<14)
                     84: 
                     85: #define        TRACE_CPU_PAIRING        (1<<15)
                     86: #define        TRACE_CPU_DISASM         (1<<16)
                     87: #define        TRACE_CPU_EXCEPTION      (1<<17)
                     88: 
                     89: #define        TRACE_INT                (1<<18)
                     90: 
                     91: #define        TRACE_FDC                (1<<19)
                     92: 
                     93: #define        TRACE_IKBD_CMDS          (1<<20)
                     94: #define        TRACE_IKBD_ACIA          (1<<21)
                     95: #define        TRACE_IKBD_EXEC          (1<<22)
                     96: 
                     97: #define TRACE_BLITTER           (1<<23)
                     98: 
                     99: #define TRACE_OS_BIOS           (1<<24)
                    100: #define TRACE_OS_XBIOS          (1<<25)
                    101: #define TRACE_OS_GEMDOS         (1<<26)
                    102: #define TRACE_OS_VDI            (1<<27)
1.1.1.2   root      103: #define TRACE_OS_AES            (1<<28)
1.1       root      104: 
1.1.1.2   root      105: #define TRACE_IOMEM_RD          (1<<29)
                    106: #define TRACE_IOMEM_WR          (1<<30)
1.1       root      107: 
1.1.1.2   root      108: #define TRACE_DMASND            (1<<31)
1.1       root      109: 
1.1.1.2   root      110: #define TRACE_CROSSBAR          (1ll<<32)
                    111: #define TRACE_VIDEL             (1ll<<33)
                    112: 
                    113: #define TRACE_DSP_HOST_INTERFACE (1ll<<34)
                    114: #define TRACE_DSP_HOST_COMMAND  (1ll<<35)
                    115: #define TRACE_DSP_HOST_SSI      (1ll<<36)
                    116: #define TRACE_DSP_DISASM        (1ll<<37)
                    117: #define TRACE_DSP_DISASM_REG    (1ll<<38)
                    118: #define TRACE_DSP_DISASM_MEM    (1ll<<39)
                    119: #define TRACE_DSP_STATE                 (1ll<<40)
                    120: #define TRACE_DSP_INTERRUPT     (1ll<<41)
1.1       root      121: 
                    122: #define        TRACE_NONE               (0)
                    123: #define        TRACE_ALL                (~0)
                    124: 
                    125: 
                    126: #define        TRACE_VIDEO_ALL         ( TRACE_VIDEO_SYNC | TRACE_VIDEO_RES | TRACE_VIDEO_COLOR \
                    127:                | TRACE_VIDEO_BORDER_V | TRACE_VIDEO_BORDER_H | TRACE_VIDEO_ADDR \
                    128:                | TRACE_VIDEO_VBL | TRACE_VIDEO_HBL | TRACE_VIDEO_STE )
                    129: 
                    130: #define TRACE_MFP_ALL          ( TRACE_MFP_EXCEPTION | TRACE_MFP_START | TRACE_MFP_READ | TRACE_MFP_WRITE )
                    131: 
                    132: #define        TRACE_PSG_ALL           ( TRACE_PSG_READ | TRACE_PSG_WRITE )
                    133: 
                    134: #define        TRACE_CPU_ALL           ( TRACE_CPU_PAIRING | TRACE_CPU_DISASM | TRACE_CPU_EXCEPTION )
                    135: 
1.1.1.2   root      136: #define        TRACE_IKBD_ALL          ( TRACE_IKBD_CMDS | TRACE_IKBD_ACIA | TRACE_IKBD_EXEC )
1.1       root      137: 
1.1.1.2   root      138: #define        TRACE_OS_ALL            ( TRACE_OS_BIOS | TRACE_OS_XBIOS | TRACE_OS_GEMDOS | TRACE_OS_AES | TRACE_OS_VDI )
1.1       root      139: 
                    140: #define        TRACE_IOMEM_ALL         ( TRACE_IOMEM_RD | TRACE_IOMEM_WR )
                    141: 
1.1.1.2   root      142: #define TRACE_DSP_ALL          ( TRACE_DSP_HOST_INTERFACE | TRACE_DSP_HOST_COMMAND | TRACE_DSP_HOST_SSI | TRACE_DSP_DISASM \
                    143:                | TRACE_DSP_DISASM_REG | TRACE_DSP_DISASM_MEM | TRACE_DSP_STATE | TRACE_DSP_INTERRUPT )
1.1       root      144: 
                    145: extern FILE *TraceFile;
1.1.1.2   root      146: extern Uint64 LogTraceFlags;
1.1       root      147: 
                    148: #if ENABLE_TRACING
                    149: 
                    150: #ifndef _VCWIN_
                    151: #define        LOG_TRACE(level, args...) \
1.1.1.3 ! root      152:        if (unlikely(LogTraceFlags & level)) { fprintf(TraceFile, args); fflush(TraceFile); }
1.1       root      153: #endif
1.1.1.2   root      154: #define LOG_TRACE_LEVEL( level )       (unlikely(LogTraceFlags & level))
1.1       root      155: 
                    156: #else          /* ENABLE_TRACING */
                    157: 
                    158: #ifndef _VCWIN_
                    159: #define LOG_TRACE(level, args...)      {}
                    160: #endif
                    161: #define LOG_TRACE_LEVEL( level )       (0)
                    162: 
                    163: #endif         /* ENABLE_TRACING */
                    164: 
                    165: /* Always defined in full to avoid compiler warnings about unused variables.
                    166:  * In code it's used in such a way that it will be optimized away when tracing
                    167:  * is disabled.
                    168:  */
                    169: #ifndef _VCWIN_
                    170: #define LOG_TRACE_PRINT(args...)       fprintf(TraceFile , args)
                    171: #endif
                    172: 
                    173: 
                    174: #endif         /* HATARI_LOG_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.