Index: trunk/kernel/kern/printk.h
===================================================================
--- trunk/kernel/kern/printk.h	(revision 502)
+++ trunk/kernel/kern/printk.h	(revision 564)
@@ -28,5 +28,5 @@
 // - The printk() function displays kernel messages on the kernel terminal TXT0,
 //   using a busy waiting policy: It calls directly the relevant TXT driver,
-//   after taking the TXT0 chdev lock for exclusive access to the TXT0 terminal.
+//   after taking the TXT0 busylock for exclusive access to the TXT0 terminal.
 // - The user_printk() function displays messages on the calling thread private
 //   terminal, using a descheduling policy: it register the request in the selected
@@ -67,6 +67,6 @@
 /**********************************************************************************
  * This function displays a formatted string on the kernel terminal TXT0,
- * using a busy waiting policy: It calls directly the relevant TXT driver,
  * after taking the TXT0 lock.
+ * It uses a busy waiting policy, calling directly the relevant TXT driver,
  **********************************************************************************
  * @ format     : formatted string.
@@ -76,6 +76,6 @@
 /**********************************************************************************
  * This function displays a formatted string on the kernel terminal TXT0,
- * using a busy waiting policy: It calls directly the relevant TXT driver,
  * without taking the TXT0 lock.
+ * It uses a busy waiting policy, calling directly the relevant TXT driver,
  **********************************************************************************
  * @ format     : formatted string.
@@ -85,5 +85,7 @@
 
 /**********************************************************************************
- * Private function designed to be called by the assert macro (below)
+ * This function is called in case of kernel panic. It printt a detailed message
+ * on the TXT0 terminal after taking the TXT0 lock, and call the hal_core_sleep()
+ * function to block the calling core.  It is used by the assert macro (below).
  **********************************************************************************
  * @ file_name     : File where the assert macro was invoked
@@ -96,11 +98,10 @@
  * See assert macro documentation for information about printed information.
  *********************************************************************************/
-void __panic( const char * file_name,
-              const char * function_name,
-              uint32_t     line,
-              cycle_t      cycle,
-              const char * format,
-              ... )
-__attribute__((__noreturn__));
+void panic( const char * file_name,
+            const char * function_name,
+            uint32_t     line,
+            cycle_t      cycle,
+            const char * format,
+            ... ) __attribute__((__noreturn__));
 
 /**********************************************************************************
@@ -134,11 +135,14 @@
  * @ format        : formatted string
  *********************************************************************************/
-#define assert( expr, format, ... ) { uint32_t __line_at_expansion = __LINE__;    \
-  const volatile cycle_t __assert_cycle = hal_get_cycles();                       \
-  if ( ( expr ) == false ) {                                                      \
-    __panic( __FILE__, __FUNCTION__,                                              \
-             __line_at_expansion, __assert_cycle,                                 \
-             ( format ), ##__VA_ARGS__ );                                         \
-  }                                                                               \
+#define assert( expr, format, ... )                                               \
+{                                                                                 \
+    uint32_t __line_at_expansion = __LINE__;                                      \
+    const volatile cycle_t __assert_cycle = hal_get_cycles();                     \
+    if ( ( expr ) == false )                                                      \
+    {                                                                             \
+        panic( __FILE__, __FUNCTION__,                                            \
+               __line_at_expansion, __assert_cycle,                               \
+               ( format ), ##__VA_ARGS__ );                                       \
+    }                                                                             \
 }
 
@@ -168,249 +172,4 @@
 
 
-
-/*  deprecated march 2018 [AG]
-
-#if CONFIG_CHDEV_DEBUG
-#define chdev_dmsg(...)   if(hal_time_stamp() > CONFIG_CHDEV_DEBUG) printk(__VA_ARGS__)
-#else
-#define chdev_dmsg(...)
-#endif
-
-#if CONFIG_CLUSTER_DEBUG
-#define cluster_dmsg(...)   if(hal_time_stamp() > CONFIG_CLUSTER_DEBUG) printk(__VA_ARGS__)
-#else
-#define cluster_dmsg(...)
-#endif
-
-#if CONFIG_CONTEXT_DEBUG
-#define context_dmsg(...)   if(hal_time_stamp() > CONFIG_CONTEXT_DEBUG) printk(__VA_ARGS__)
-#else
-#define context_dmsg(...)
-#endif
-
-#if CONFIG_CORE_DEBUG
-#define core_dmsg(...)   if(hal_time_stamp() > CONFIG_CORE_DEBUG) printk(__VA_ARGS__)
-#else
-#define core_dmsg(...)
-#endif
-
-#if CONFIG_DEVFS_DEBUG
-#define devfs_dmsg(...)   if(hal_time_stamp() > CONFIG_DEVFS_DEBUG) printk(__VA_ARGS__)
-#else
-#define devfs_dmsg(...)
-#endif
-
-#if CONFIG_DMA_DEBUG
-#define dma_dmsg(...)   if(hal_time_stamp() > CONFIG_DMA_DEBUG) printk(__VA_ARGS__)
-#else
-#define dma_dmsg(...)
-#endif
-
-#if CONFIG_DQDT_DEBUG
-#define dqdt_dmsg(...)   if(hal_time_stamp() > CONFIG_DQDT_DEBUG) printk(__VA_ARGS__)
-#else
-#define dqdt_dmsg(...)
-#endif
-
-#if CONFIG_ELF_DEBUG
-#define elf_dmsg(...)   if(hal_time_stamp() > CONFIG_ELF_DEBUG) printk(__VA_ARGS__)
-#else
-#define elf_dmsg(...)
-#endif
-
-#if CONFIG_EXEC_DEBUG
-#define exec_dmsg(...)   if(hal_time_stamp() > CONFIG_EXEC_DEBUG) printk(__VA_ARGS__)
-#else
-#define exec_dmsg(...)
-#endif
-
-#if CONFIG_EXCP_DEBUG
-#define excp_dmsg(...)   if(hal_time_stamp() > CONFIG_EXCP_DEBUG) printk(__VA_ARGS__)
-#else
-#define excp_dmsg(...)
-#endif
-
-#if CONFIG_FATFS_DEBUG
-#define fatfs_dmsg(...)   if(hal_time_stamp() > CONFIG_FATFS_DEBUG) printk(__VA_ARGS__)
-#else
-#define fatfs_dmsg(...)
-#endif
-
-#if CONFIG_FBF_DEBUG
-#define fbf_dmsg(...)   if(hal_time_stamp() > CONFIG_FBF_DEBUG) printk(__VA_ARGS__)
-#else
-#define fbf_dmsg(...)
-#endif
-
-#if CONFIG_FORK_DEBUG
-#define fork_dmsg(...)   if(hal_time_stamp() > CONFIG_FORK_DEBUG) printk(__VA_ARGS__)
-#else
-#define fork_dmsg(...)
-#endif
-
-#if CONFIG_GPT_DEBUG
-#define gpt_dmsg(...)   if(hal_time_stamp() > CONFIG_GPT_DEBUG) printk(__VA_ARGS__)
-#else
-#define gpt_dmsg(...)
-#endif
-
-#if CONFIG_GRPC_DEBUG
-#define grpc_dmsg(...)   if(hal_time_stamp() > CONFIG_GRPC_DEBUG) printk(__VA_ARGS__)
-#else
-#define grpc_dmsg(...)
-#endif
-
-#if CONFIG_IDLE_DEBUG
-#define idle_dmsg(...)   if(hal_time_stamp() > CONFIG_IDLE_DEBUG) printk(__VA_ARGS__)
-#else
-#define idle_dmsg(...)
-#endif
-
-#if CONFIG_IOC_DEBUG
-#define ioc_dmsg(...)   if(hal_time_stamp() > CONFIG_IOC_DEBUG) printk(__VA_ARGS__)
-#else
-#define ioc_dmsg(...)
-#endif
-
-#if CONFIG_IRQ_DEBUG
-#define irq_dmsg(...)   if(hal_time_stamp() > CONFIG_IRQ_DEBUG) printk(__VA_ARGS__)
-#else
-#define irq_dmsg(...)
-#endif
-
-#if CONFIG_KCM_DEBUG
-#define kcm_dmsg(...)   if(hal_time_stamp() > CONFIG_KCM_DEBUG) printk(__VA_ARGS__)
-#else
-#define kcm_dmsg(...)
-#endif
-
-#if CONFIG_KHM_DEBUG
-#define khm_dmsg(...)   if(hal_time_stamp() > CONFIG_KHM_DEBUG) printk(__VA_ARGS__)
-#else
-#define khm_dmsg(...)
-#endif
-
-#if CONFIG_KILL_DEBUG
-#define kill_dmsg(...)   if(hal_time_stamp() > CONFIG_KILL_DEBUG) printk(__VA_ARGS__)
-#else
-#define kill_dmsg(...)
-#endif
-
-#if CONFIG_KINIT_DEBUG
-#define kinit_dmsg(...)   if(hal_time_stamp() > CONFIG_KINIT_DEBUG) printk(__VA_ARGS__)
-#else
-#define kinit_dmsg(...)
-#endif
-
-#if CONFIG_KMEM_DEBUG
-#define kmem_dmsg(...)   if(hal_time_stamp() > CONFIG_KMEM_DEBUG) printk(__VA_ARGS__)
-#else
-#define kmem_dmsg(...)
-#endif
-
-#if CONFIG_MAPPER_DEBUG
-#define mapper_dmsg(...)   if(hal_time_stamp() > CONFIG_MAPPER_DEBUG) printk(__VA_ARGS__)
-#else
-#define mapper_dmsg(...)
-#endif
-
-#if CONFIG_MMAP_DEBUG
-#define mmap_dmsg(...)   if(hal_time_stamp() > CONFIG_MMAP_DEBUG) printk(__VA_ARGS__)
-#else
-#define mmap_dmsg(...)
-#endif
-
-#if CONFIG_MMC_DEBUG
-#define mmc_dmsg(...)   if(hal_time_stamp() > CONFIG_MMC_DEBUG) printk(__VA_ARGS__)
-#else
-#define mmc_dmsg(...)
-#endif
-
-#if CONFIG_NIC_DEBUG
-#define nic_dmsg(...)   if(hal_time_stamp() > CONFIG_NIC_DEBUG) printk(__VA_ARGS__)
-#else
-#define nic_dmsg(...)
-#endif
-
-#if CONFIG_PIC_DEBUG
-#define pic_dmsg(...)   if(hal_time_stamp() > CONFIG_PIC_DEBUG) printk(__VA_ARGS__)
-#else
-#define pic_dmsg(...)
-#endif
-
-#if CONFIG_PPM_DEBUG
-#define ppm_dmsg(...)   if(hal_time_stamp() > CONFIG_PPM_DEBUG) printk(__VA_ARGS__)
-#else
-#define ppm_dmsg(...)
-#endif
-
-#if CONFIG_PROCESS_DEBUG
-#define process_dmsg(...)   if(hal_time_stamp() > CONFIG_PROCESS_DEBUG) printk(__VA_ARGS__)
-#else
-#define process_dmsg(...)
-#endif
-
-#if CONFIG_READ_DEBUG
-#define read_dmsg(...)   if(hal_time_stamp() > CONFIG_READ_DEBUG) printk(__VA_ARGS__)
-#else
-#define read_dmsg(...)
-#endif
-
-#if CONFIG_RPC_DEBUG
-#define rpc_dmsg(...)   if(hal_time_stamp() > CONFIG_RPC_DEBUG) printk(__VA_ARGS__)
-#else
-#define rpc_dmsg(...)
-#endif
-
-#if CONFIG_SCHED_DEBUG
-#define sched_dmsg(...)   if(hal_time_stamp() > CONFIG_SCHED_DEBUG) printk(__VA_ARGS__)
-#else
-#define sched_dmsg(...)
-#endif
-
-#if CONFIG_SIGACTION_DEBUG
-#define sigaction_dmsg(...)   if(hal_time_stamp() > CONFIG_SIGACTION_DEBUG) printk(__VA_ARGS__)
-#else
-#define sigaction_dmsg(...)
-#endif
-
-#if CONFIG_SYSCALL_DEBUG
-#define syscall_dmsg(...)   if(hal_time_stamp() > CONFIG_SYSCALL_DEBUG) printk(__VA_ARGS__)
-#else
-#define syscall_dmsg(...)
-#endif
-
-#if CONFIG_THREAD_DEBUG
-#define thread_dmsg(...)   if(hal_time_stamp() > CONFIG_THREAD_DEBUG) printk(__VA_ARGS__)
-#else
-#define thread_dmsg(...)
-#endif
-
-#if CONFIG_TXT_DEBUG
-#define txt_dmsg(...)   if(hal_time_stamp() > CONFIG_TXT_DEBUG) printk(__VA_ARGS__)
-#else
-#define txt_dmsg(...)
-#endif
-
-#if CONFIG_VFS_DEBUG
-#define vfs_dmsg(...)   if(hal_time_stamp() > CONFIG_VFS_DEBUG) printk(__VA_ARGS__)
-#else
-#define vfs_dmsg(...)
-#endif
-
-#if CONFIG_VMM_DEBUG
-#define vmm_dmsg(...)   if(hal_time_stamp() > CONFIG_VMM_DEBUG) printk(__VA_ARGS__)
-#else
-#define vmm_dmsg(...)
-#endif
-
-#if CONFIG_WRITE_DEBUG
-#define write_dmsg(...)   if(hal_time_stamp() > CONFIG_WRITE_DEBUG) printk(__VA_ARGS__)
-#else
-#define write_dmsg(...)
-#endif
-
-*/
-
 #endif  // _PRINTK_H
 
