Changeset 564 for trunk/kernel/kern/printk.h
- Timestamp:
- Oct 4, 2018, 11:47:36 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/printk.h
r502 r564 28 28 // - The printk() function displays kernel messages on the kernel terminal TXT0, 29 29 // using a busy waiting policy: It calls directly the relevant TXT driver, 30 // after taking the TXT0 chdevlock for exclusive access to the TXT0 terminal.30 // after taking the TXT0 busylock for exclusive access to the TXT0 terminal. 31 31 // - The user_printk() function displays messages on the calling thread private 32 32 // terminal, using a descheduling policy: it register the request in the selected … … 67 67 /********************************************************************************** 68 68 * This function displays a formatted string on the kernel terminal TXT0, 69 * using a busy waiting policy: It calls directly the relevant TXT driver,70 69 * after taking the TXT0 lock. 70 * It uses a busy waiting policy, calling directly the relevant TXT driver, 71 71 ********************************************************************************** 72 72 * @ format : formatted string. … … 76 76 /********************************************************************************** 77 77 * This function displays a formatted string on the kernel terminal TXT0, 78 * using a busy waiting policy: It calls directly the relevant TXT driver,79 78 * without taking the TXT0 lock. 79 * It uses a busy waiting policy, calling directly the relevant TXT driver, 80 80 ********************************************************************************** 81 81 * @ format : formatted string. … … 85 85 86 86 /********************************************************************************** 87 * Private function designed to be called by the assert macro (below) 87 * This function is called in case of kernel panic. It printt a detailed message 88 * on the TXT0 terminal after taking the TXT0 lock, and call the hal_core_sleep() 89 * function to block the calling core. It is used by the assert macro (below). 88 90 ********************************************************************************** 89 91 * @ file_name : File where the assert macro was invoked … … 96 98 * See assert macro documentation for information about printed information. 97 99 *********************************************************************************/ 98 void __panic( const char * file_name, 99 const char * function_name, 100 uint32_t line, 101 cycle_t cycle, 102 const char * format, 103 ... ) 104 __attribute__((__noreturn__)); 100 void panic( const char * file_name, 101 const char * function_name, 102 uint32_t line, 103 cycle_t cycle, 104 const char * format, 105 ... ) __attribute__((__noreturn__)); 105 106 106 107 /********************************************************************************** … … 134 135 * @ format : formatted string 135 136 *********************************************************************************/ 136 #define assert( expr, format, ... ) { uint32_t __line_at_expansion = __LINE__; \ 137 const volatile cycle_t __assert_cycle = hal_get_cycles(); \ 138 if ( ( expr ) == false ) { \ 139 __panic( __FILE__, __FUNCTION__, \ 140 __line_at_expansion, __assert_cycle, \ 141 ( format ), ##__VA_ARGS__ ); \ 142 } \ 137 #define assert( expr, format, ... ) \ 138 { \ 139 uint32_t __line_at_expansion = __LINE__; \ 140 const volatile cycle_t __assert_cycle = hal_get_cycles(); \ 141 if ( ( expr ) == false ) \ 142 { \ 143 panic( __FILE__, __FUNCTION__, \ 144 __line_at_expansion, __assert_cycle, \ 145 ( format ), ##__VA_ARGS__ ); \ 146 } \ 143 147 } 144 148 … … 168 172 169 173 170 171 /* deprecated march 2018 [AG]172 173 #if CONFIG_CHDEV_DEBUG174 #define chdev_dmsg(...) if(hal_time_stamp() > CONFIG_CHDEV_DEBUG) printk(__VA_ARGS__)175 #else176 #define chdev_dmsg(...)177 #endif178 179 #if CONFIG_CLUSTER_DEBUG180 #define cluster_dmsg(...) if(hal_time_stamp() > CONFIG_CLUSTER_DEBUG) printk(__VA_ARGS__)181 #else182 #define cluster_dmsg(...)183 #endif184 185 #if CONFIG_CONTEXT_DEBUG186 #define context_dmsg(...) if(hal_time_stamp() > CONFIG_CONTEXT_DEBUG) printk(__VA_ARGS__)187 #else188 #define context_dmsg(...)189 #endif190 191 #if CONFIG_CORE_DEBUG192 #define core_dmsg(...) if(hal_time_stamp() > CONFIG_CORE_DEBUG) printk(__VA_ARGS__)193 #else194 #define core_dmsg(...)195 #endif196 197 #if CONFIG_DEVFS_DEBUG198 #define devfs_dmsg(...) if(hal_time_stamp() > CONFIG_DEVFS_DEBUG) printk(__VA_ARGS__)199 #else200 #define devfs_dmsg(...)201 #endif202 203 #if CONFIG_DMA_DEBUG204 #define dma_dmsg(...) if(hal_time_stamp() > CONFIG_DMA_DEBUG) printk(__VA_ARGS__)205 #else206 #define dma_dmsg(...)207 #endif208 209 #if CONFIG_DQDT_DEBUG210 #define dqdt_dmsg(...) if(hal_time_stamp() > CONFIG_DQDT_DEBUG) printk(__VA_ARGS__)211 #else212 #define dqdt_dmsg(...)213 #endif214 215 #if CONFIG_ELF_DEBUG216 #define elf_dmsg(...) if(hal_time_stamp() > CONFIG_ELF_DEBUG) printk(__VA_ARGS__)217 #else218 #define elf_dmsg(...)219 #endif220 221 #if CONFIG_EXEC_DEBUG222 #define exec_dmsg(...) if(hal_time_stamp() > CONFIG_EXEC_DEBUG) printk(__VA_ARGS__)223 #else224 #define exec_dmsg(...)225 #endif226 227 #if CONFIG_EXCP_DEBUG228 #define excp_dmsg(...) if(hal_time_stamp() > CONFIG_EXCP_DEBUG) printk(__VA_ARGS__)229 #else230 #define excp_dmsg(...)231 #endif232 233 #if CONFIG_FATFS_DEBUG234 #define fatfs_dmsg(...) if(hal_time_stamp() > CONFIG_FATFS_DEBUG) printk(__VA_ARGS__)235 #else236 #define fatfs_dmsg(...)237 #endif238 239 #if CONFIG_FBF_DEBUG240 #define fbf_dmsg(...) if(hal_time_stamp() > CONFIG_FBF_DEBUG) printk(__VA_ARGS__)241 #else242 #define fbf_dmsg(...)243 #endif244 245 #if CONFIG_FORK_DEBUG246 #define fork_dmsg(...) if(hal_time_stamp() > CONFIG_FORK_DEBUG) printk(__VA_ARGS__)247 #else248 #define fork_dmsg(...)249 #endif250 251 #if CONFIG_GPT_DEBUG252 #define gpt_dmsg(...) if(hal_time_stamp() > CONFIG_GPT_DEBUG) printk(__VA_ARGS__)253 #else254 #define gpt_dmsg(...)255 #endif256 257 #if CONFIG_GRPC_DEBUG258 #define grpc_dmsg(...) if(hal_time_stamp() > CONFIG_GRPC_DEBUG) printk(__VA_ARGS__)259 #else260 #define grpc_dmsg(...)261 #endif262 263 #if CONFIG_IDLE_DEBUG264 #define idle_dmsg(...) if(hal_time_stamp() > CONFIG_IDLE_DEBUG) printk(__VA_ARGS__)265 #else266 #define idle_dmsg(...)267 #endif268 269 #if CONFIG_IOC_DEBUG270 #define ioc_dmsg(...) if(hal_time_stamp() > CONFIG_IOC_DEBUG) printk(__VA_ARGS__)271 #else272 #define ioc_dmsg(...)273 #endif274 275 #if CONFIG_IRQ_DEBUG276 #define irq_dmsg(...) if(hal_time_stamp() > CONFIG_IRQ_DEBUG) printk(__VA_ARGS__)277 #else278 #define irq_dmsg(...)279 #endif280 281 #if CONFIG_KCM_DEBUG282 #define kcm_dmsg(...) if(hal_time_stamp() > CONFIG_KCM_DEBUG) printk(__VA_ARGS__)283 #else284 #define kcm_dmsg(...)285 #endif286 287 #if CONFIG_KHM_DEBUG288 #define khm_dmsg(...) if(hal_time_stamp() > CONFIG_KHM_DEBUG) printk(__VA_ARGS__)289 #else290 #define khm_dmsg(...)291 #endif292 293 #if CONFIG_KILL_DEBUG294 #define kill_dmsg(...) if(hal_time_stamp() > CONFIG_KILL_DEBUG) printk(__VA_ARGS__)295 #else296 #define kill_dmsg(...)297 #endif298 299 #if CONFIG_KINIT_DEBUG300 #define kinit_dmsg(...) if(hal_time_stamp() > CONFIG_KINIT_DEBUG) printk(__VA_ARGS__)301 #else302 #define kinit_dmsg(...)303 #endif304 305 #if CONFIG_KMEM_DEBUG306 #define kmem_dmsg(...) if(hal_time_stamp() > CONFIG_KMEM_DEBUG) printk(__VA_ARGS__)307 #else308 #define kmem_dmsg(...)309 #endif310 311 #if CONFIG_MAPPER_DEBUG312 #define mapper_dmsg(...) if(hal_time_stamp() > CONFIG_MAPPER_DEBUG) printk(__VA_ARGS__)313 #else314 #define mapper_dmsg(...)315 #endif316 317 #if CONFIG_MMAP_DEBUG318 #define mmap_dmsg(...) if(hal_time_stamp() > CONFIG_MMAP_DEBUG) printk(__VA_ARGS__)319 #else320 #define mmap_dmsg(...)321 #endif322 323 #if CONFIG_MMC_DEBUG324 #define mmc_dmsg(...) if(hal_time_stamp() > CONFIG_MMC_DEBUG) printk(__VA_ARGS__)325 #else326 #define mmc_dmsg(...)327 #endif328 329 #if CONFIG_NIC_DEBUG330 #define nic_dmsg(...) if(hal_time_stamp() > CONFIG_NIC_DEBUG) printk(__VA_ARGS__)331 #else332 #define nic_dmsg(...)333 #endif334 335 #if CONFIG_PIC_DEBUG336 #define pic_dmsg(...) if(hal_time_stamp() > CONFIG_PIC_DEBUG) printk(__VA_ARGS__)337 #else338 #define pic_dmsg(...)339 #endif340 341 #if CONFIG_PPM_DEBUG342 #define ppm_dmsg(...) if(hal_time_stamp() > CONFIG_PPM_DEBUG) printk(__VA_ARGS__)343 #else344 #define ppm_dmsg(...)345 #endif346 347 #if CONFIG_PROCESS_DEBUG348 #define process_dmsg(...) if(hal_time_stamp() > CONFIG_PROCESS_DEBUG) printk(__VA_ARGS__)349 #else350 #define process_dmsg(...)351 #endif352 353 #if CONFIG_READ_DEBUG354 #define read_dmsg(...) if(hal_time_stamp() > CONFIG_READ_DEBUG) printk(__VA_ARGS__)355 #else356 #define read_dmsg(...)357 #endif358 359 #if CONFIG_RPC_DEBUG360 #define rpc_dmsg(...) if(hal_time_stamp() > CONFIG_RPC_DEBUG) printk(__VA_ARGS__)361 #else362 #define rpc_dmsg(...)363 #endif364 365 #if CONFIG_SCHED_DEBUG366 #define sched_dmsg(...) if(hal_time_stamp() > CONFIG_SCHED_DEBUG) printk(__VA_ARGS__)367 #else368 #define sched_dmsg(...)369 #endif370 371 #if CONFIG_SIGACTION_DEBUG372 #define sigaction_dmsg(...) if(hal_time_stamp() > CONFIG_SIGACTION_DEBUG) printk(__VA_ARGS__)373 #else374 #define sigaction_dmsg(...)375 #endif376 377 #if CONFIG_SYSCALL_DEBUG378 #define syscall_dmsg(...) if(hal_time_stamp() > CONFIG_SYSCALL_DEBUG) printk(__VA_ARGS__)379 #else380 #define syscall_dmsg(...)381 #endif382 383 #if CONFIG_THREAD_DEBUG384 #define thread_dmsg(...) if(hal_time_stamp() > CONFIG_THREAD_DEBUG) printk(__VA_ARGS__)385 #else386 #define thread_dmsg(...)387 #endif388 389 #if CONFIG_TXT_DEBUG390 #define txt_dmsg(...) if(hal_time_stamp() > CONFIG_TXT_DEBUG) printk(__VA_ARGS__)391 #else392 #define txt_dmsg(...)393 #endif394 395 #if CONFIG_VFS_DEBUG396 #define vfs_dmsg(...) if(hal_time_stamp() > CONFIG_VFS_DEBUG) printk(__VA_ARGS__)397 #else398 #define vfs_dmsg(...)399 #endif400 401 #if CONFIG_VMM_DEBUG402 #define vmm_dmsg(...) if(hal_time_stamp() > CONFIG_VMM_DEBUG) printk(__VA_ARGS__)403 #else404 #define vmm_dmsg(...)405 #endif406 407 #if CONFIG_WRITE_DEBUG408 #define write_dmsg(...) if(hal_time_stamp() > CONFIG_WRITE_DEBUG) printk(__VA_ARGS__)409 #else410 #define write_dmsg(...)411 #endif412 413 */414 415 174 #endif // _PRINTK_H 416 175
Note: See TracChangeset
for help on using the changeset viewer.