Ignore:
Timestamp:
Apr 26, 2017, 2:11:56 PM (5 years ago)
Author:
alain
Message:

Introduce the chdev_t structure in place of the device_t structure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/printk.h

    r1 r5  
    2424///////////////////////////////////////////////////////////////////////////////////
    2525// The printk.c and printk.h files define the functions used by the kernel
    26 // to display messages on the kernel text terminal, using a busy waiting
    27 // policy if required : these functions does not use the TXT kernel thread,
    28 // and does not deschedule if TXT peripheral is not available.
    29 // These functions use the generic TXT device to call the proper implementation
     26// to display messages on a text terminal.
     27// Two access modes are supported:
     28// - The printk() function displays kernel messages on the kernel terminal TXT0,
     29//   using a busy waiting policy: It calls directly the relevant TXT driver,
     30//   after taking the TXT0 chdev lock for exclusive access to the TXT0 terminal.
     31// - The user_printk() function displays messages on the calling thread private
     32//   terminal, using a descheduling policy: it register the request in the selected
     33//   TXT chdev waiting queue and deschedule. The calling thread is reactivated by
     34//   the IRQ signaling completion.
     35// Both functions use the generic TXT device to call the proper implementation
    3036// dependant TXT driver.
     37// Finally these files define a set of conditionnal trace <***_dmsg> for debug.
    3138///////////////////////////////////////////////////////////////////////////////////
    3239
     
    3441#define _PRINTK_H
    3542
    36 ///////////////////////////////////////////////////////////////////////////////////
    37 //       Access functions to kernel terminal TTY0
    38 ///////////////////////////////////////////////////////////////////////////////////
    39 
     43#include <hal_types.h>
     44#include <stdarg.h>
     45
     46
     47/**********************************************************************************
     48 * This function displays a formated string on the kernel terminal TXT0,
     49 * using a busy waiting policy: It calls directly the relevant TXT driver,
     50 * after taking the TXT0 chdev lock for exclusive access to the TXT0 terminal.
     51 **********************************************************************************
     52 * @ format     : formated string.
     53 *********************************************************************************/
    4054extern void         printk( char* format, ... );
    4155
    42 extern void         nolock_printk( char* format, ... );
    43 
     56/**********************************************************************************
     57 * Display a formated string on the calling thread private terminal, using a
     58 * descheduling policy: it register the request in the selected TXT chdev waiting
     59 * queue and deschedule. IT is reactivated by the IRQ signaling completion.
     60 * Not fully implemented yet ( use TXT0 in deschedling mode ).
     61 **********************************************************************************
     62 * @ format     : formated string.
     63 *********************************************************************************/
    4464extern void         user_printk( char* format, ... );
    4565
     66/**********************************************************************************
     67 * This function displaya "PANIC" message and force the calling core in
     68 * sleeping mode if a Boolean condition is false.
     69 * These functions are actually used to debug the kernel...
     70 **********************************************************************************
     71 * @ condition     : condition that must be true.
     72 * @ function_name : name of the calling function.
     73 * @ string        : error message if condition is false.
     74 *********************************************************************************/
     75inline void assert( bool_t       condition,
     76                    const char * function_name,
     77                    char       * string );
     78
    4679///////////////////////////////////////////////////////////////////////////////////
    4780//       Conditionnal debug macros
    4881///////////////////////////////////////////////////////////////////////////////////
    4982
     83#if CONFIG_CONTEXT_DEBUG
     84#define context_dmsg(...)   printk(__VA_ARGS__)
     85#else
     86#define context_dmsg(...)
     87#endif
     88
    5089#if CONFIG_CORE_DEBUG
    51 #define core_dmsg(...)   printk(__VA__ARGS__)
     90#define core_dmsg(...)   printk(__VA_ARGS__)
    5291#else
    5392#define core_dmsg(...)
     
    5594
    5695#if CONFIG_DQDT_DEBUG
    57 #define dqdt_dmsg(...)   printk(__VA__ARGS__)
     96#define dma_dmsg(...)   printk(__VA_ARGS__)
     97#else
     98#define dma_dmsg(...)
     99#endif
     100
     101#if CONFIG_DQDT_DEBUG
     102#define dqdt_dmsg(...)   printk(__VA_ARGS__)
    58103#else
    59104#define dqdt_dmsg(...)
     
    61106
    62107#if CONFIG_ELF_DEBUG
    63 #define elf_dmsg(...)   printk(__VA__ARGS__)
     108#define elf_dmsg(...)   printk(__VA_ARGS__)
    64109#else
    65110#define elf_dmsg(...)
    66111#endif
    67112
     113#if CONFIG_EXEC_DEBUG
     114#define exec_dmsg(...)   printk(__VA_ARGS__)
     115#else
     116#define exec_dmsg(...)
     117#endif
     118
     119#if CONFIG_FBF_DEBUG
     120#define fbf_dmsg(...)   printk(__VA_ARGS__)
     121#else
     122#define fbf_dmsg(...)
     123#endif
     124
    68125#if CONFIG_FORK_DEBUG
    69 #define fork_dmsg(...)   printk(__VA__ARGS__)
     126#define fork_dmsg(...)   printk(__VA_ARGS__)
    70127#else
    71128#define fork_dmsg(...)
    72129#endif
    73130
    74 #if CONFIG_EXEC_DEBUG
    75 #define exec_dmsg(...)   printk(__VA__ARGS__)
    76 #else
    77 #define exec_dmsg(...)
    78 #endif
    79 
    80131#if CONFIG_ICU_DEBUG
    81 #define icu_dmsg(...)   printk(__VA__ARGS__)
     132#define icu_dmsg(...)   printk(__VA_ARGS__)
    82133#else
    83134#define icu_dmsg(...)
     
    85136
    86137#if CONFIG_IOC_DEBUG
    87 #define ioc_dmsg(...)   printk(__VA__ARGS__)
     138#define ioc_dmsg(...)   printk(__VA_ARGS__)
    88139#else
    89140#define ioc_dmsg(...)
     141#endif
     142
     143#if CONFIG_KCM_DEBUG
     144#define kcm_dmsg(...) printk(__VA_ARGS__)
     145#else
     146#define kcm_dmsg(...)
     147#endif
     148
     149#if CONFIG_KHM_DEBUG
     150#define khm_dmsg(...) printk(__VA_ARGS__)
     151#else
     152#define khm_dmsg(...)
    90153#endif
    91154
     
    102165#endif
    103166
     167#if CONFIG_MAPPER_DEBUG
     168#define mapper_dmsg(...)   printk(__VA_ARGS__)
     169#else
     170#define mapper_dmsg(...)
     171#endif
     172
    104173#if CONFIG_MMC_DEBUG
    105 #define mmc_dmsg(...)   printk(__VA__ARGS__)
     174#define mmc_dmsg(...)   printk(__VA_ARGS__)
    106175#else
    107176#define mmc_dmsg(...)
     
    109178
    110179#if CONFIG_NIC_DEBUG
    111 #define nic_dmsg(...)   printk(__VA__ARGS__)
     180#define nic_dmsg(...)   printk(__VA_ARGS__)
    112181#else
    113182#define nic_dmsg(...)
     
    115184
    116185#if CONFIG_PIC_DEBUG
    117 #define pic_dmsg(...)   printk(__VA__ARGS__)
     186#define pic_dmsg(...)   printk(__VA_ARGS__)
    118187#else
    119188#define pic_dmsg(...)
    120189#endif
    121190
     191#if CONFIG_PPM_DEBUG
     192#define ppm_dmsg(...)   printk(__VA_ARGS__)
     193#else
     194#define ppm_dmsg(...)
     195#endif
     196
    122197#if CONFIG_PROCESS_DEBUG
    123 #define process_dmsg(...)   printk(__VA__ARGS__)
     198#define process_dmsg(...)   printk(__VA_ARGS__)
    124199#else
    125200#define process_dmsg(...)
     
    127202
    128203#if CONFIG_RPC_DEBUG
    129 #define rpc_dmsg(...)   printk(__VA__ARGS__)
     204#define rpc_dmsg(...)   printk(__VA_ARGS__)
    130205#else
    131206#define rpc_dmsg(...)
     
    133208
    134209#if CONFIG_SCHED_DEBUG
    135 #define sched_dmsg(...)   printk(__VA__ARGS__)
     210#define sched_dmsg(...)   printk(__VA_ARGS__)
    136211#else
    137212#define sched_dmsg(...)
     
    139214
    140215#if CONFIG_THREAD_DEBUG
    141 #define thread_dmsg(...)   printk(__VA__ARGS__)
     216#define thread_dmsg(...)   printk(__VA_ARGS__)
    142217#else
    143218#define thread_dmsg(...)
     
    145220
    146221#if CONFIG_TXT_DEBUG
    147 #define txt_dmsg(...)   printk(__VA__ARGS__)
     222#define txt_dmsg(...)   printk(__VA_ARGS__)
    148223#else
    149224#define txt_dmsg(...)
     
    151226
    152227#if CONFIG_VFS_DEBUG
    153 #define vfs_dmsg(...)   printk(__VA__ARGS__)
     228#define vfs_dmsg(...)   printk(__VA_ARGS__)
    154229#else
    155230#define vfs_dmsg(...)
     
    157232
    158233#if CONFIG_VMM_DEBUG
    159 #define vmm_dmsg(...)   printk(__VA__ARGS__)
     234#define vmm_dmsg(...)   printk(__VA_ARGS__)
    160235#else
    161236#define vmm_dmsg(...)
Note: See TracChangeset for help on using the changeset viewer.