rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * kal_ex_api.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * Maui_Software |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * This file provides KAL public API prototypes |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================ |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | * removed! |
| 60 | * removed! |
| 61 | * |
| 62 | * removed! |
| 63 | * removed! |
| 64 | * removed! |
| 65 | * |
| 66 | * removed! |
| 67 | * removed! |
| 68 | * removed! |
| 69 | * |
| 70 | * removed! |
| 71 | * removed! |
| 72 | * removed! |
| 73 | * removed! |
| 74 | * |
| 75 | * removed! |
| 76 | * removed! |
| 77 | * removed! |
| 78 | * |
| 79 | * removed! |
| 80 | * removed! |
| 81 | * removed! |
| 82 | * |
| 83 | * removed! |
| 84 | * removed! |
| 85 | * removed! |
| 86 | * |
| 87 | * removed! |
| 88 | * removed! |
| 89 | * |
| 90 | * removed! |
| 91 | * removed! |
| 92 | * |
| 93 | * removed! |
| 94 | * removed! |
| 95 | * |
| 96 | * removed! |
| 97 | * removed! |
| 98 | * removed! |
| 99 | * |
| 100 | * removed! |
| 101 | * removed! |
| 102 | * removed! |
| 103 | * |
| 104 | * removed! |
| 105 | * removed! |
| 106 | * removed! |
| 107 | * |
| 108 | * removed! |
| 109 | * removed! |
| 110 | * removed! |
| 111 | * |
| 112 | * removed! |
| 113 | * removed! |
| 114 | * removed! |
| 115 | * |
| 116 | * removed! |
| 117 | * removed! |
| 118 | * removed! |
| 119 | * |
| 120 | * removed! |
| 121 | * removed! |
| 122 | * removed! |
| 123 | * removed! |
| 124 | * removed! |
| 125 | * |
| 126 | * removed! |
| 127 | * removed! |
| 128 | * removed! |
| 129 | * |
| 130 | * removed! |
| 131 | * removed! |
| 132 | * removed! |
| 133 | * |
| 134 | ****************************************************************************/ |
| 135 | |
| 136 | #ifndef _KAL_EX_API_H |
| 137 | #define _KAL_EX_API_H |
| 138 | |
| 139 | /******************************************************************************* |
| 140 | * Common Header File Include |
| 141 | *******************************************************************************/ |
| 142 | #ifndef GEN_FOR_PC |
| 143 | #include <stdio.h> |
| 144 | #include <string.h> |
| 145 | #endif |
| 146 | |
| 147 | #include "kal_general_types.h" |
| 148 | #include "kal_public_defs.h" |
| 149 | |
| 150 | #ifdef __cplusplus |
| 151 | extern "C" { |
| 152 | #endif |
| 153 | |
| 154 | /* DOM-NOT_FOR_SDK-BEGIN */ |
| 155 | /******************************************************************************* |
| 156 | * Category 9 : Error Handling |
| 157 | *******************************************************************************/ |
| 158 | |
| 159 | |
| 160 | /* |
| 161 | * These functions has been duplicated to several files - .\bootloader\src\bl_portingfunc.c |
| 162 | * If there's any modification to these functions, please remember to update above file. |
| 163 | * If you need to duplicate these functions, please update above file list. |
| 164 | */ |
| 165 | #if defined(__UBL__) |
| 166 | extern void kal_assert_fail(char* expr, char* file, kal_uint32 line, kal_bool isext, kal_uint32 ex1, kal_uint32 ex2, kal_uint32 ex3, ASSERT_DUMP_PARAM_T *dump_param); |
| 167 | #else /* __UBL__ */ |
| 168 | #if !defined(__MTK_TARGET__) |
| 169 | #if defined(__clang_analyzer__) |
| 170 | extern void kal_assert_fail(char* expr, char* file, kal_uint32 line, kal_bool isext, kal_uint32 ex1, kal_uint32 ex2, kal_uint32 ex3, ASSERT_DUMP_PARAM_T *dump_param) __attribute__((__noreturn__)); |
| 171 | #else /* __clang_analyzer__ */ |
| 172 | extern void kal_assert_fail(char* expr, char* file, kal_uint32 line, kal_bool isext, kal_uint32 ex1, kal_uint32 ex2, kal_uint32 ex3, ASSERT_DUMP_PARAM_T *dump_param); |
| 173 | #endif /* __clang_analyzer__ */ |
| 174 | #endif /* __MTK_TARGET__ */ |
| 175 | #endif /* __UBL__ */ |
| 176 | |
| 177 | /* |
| 178 | * Error Handling |
| 179 | */ |
| 180 | /* NOTE: Module Controlled ASSERT Interface, it will be removed from next release. */ |
| 181 | #if defined(__DEBUG_ASSERT_SUPPORT__) |
| 182 | #define DEBUG_ASSERT(expr) ASSERT(expr) |
| 183 | #define DEBUG_EXT_ASSERT1(expr, e1) EXT_ASSERT1(expr, e1) |
| 184 | #define DEBUG_EXT_ASSERT2(expr, e1, e2) EXT_ASSERT3(expr, e1, e2) |
| 185 | #define DEBUG_EXT_ASSERT3(expr, e1, e2, e3) EXT_ASSERT3(expr, e1, e2, e3) |
| 186 | #else |
| 187 | #define DEBUG_ASSERT(expr) do {if(!(expr)) {} } while (0) |
| 188 | #define DEBUG_EXT_ASSERT1(expr, e1) do {if(!(expr)) {(void)(e1);} } while (0) |
| 189 | #define DEBUG_EXT_ASSERT2(expr, e1, e2) do {if(!(expr)) {(void)(e1);(void)(e2);} } while (0) |
| 190 | #define DEBUG_EXT_ASSERT3(expr, e1, e2, e3) do {if(!(expr)) {(void)(e1);(void)(e2);(void)(e3);} } while (0) |
| 191 | #endif |
| 192 | |
| 193 | /* NOTE : ASSERT() , EXT_ASSERT() is public , |
| 194 | * While EXT_ASSERT_DUMP() is auxiliary |
| 195 | */ |
| 196 | |
| 197 | #if !defined(__COSIM_BYPASS_DRV__) || defined(__ESL_ENABLE_BREAK__) |
| 198 | #if defined(__MTK_TARGET__) && !defined(__UBL__) |
| 199 | #if defined(__MIPS_IA__) || defined(__MIPS_I7200__) |
| 200 | |
| 201 | #if _MIPS_SIM == _ABIP32 |
| 202 | #define EX_MIPS_GPR_R2 "$t4" |
| 203 | #define EX_MIPS_GPR_R3 "$t5" |
| 204 | #elif _MIPS_SIM == _ABIO32 |
| 205 | #define EX_MIPS_GPR_R2 "$v0" |
| 206 | #define EX_MIPS_GPR_R3 "$v1" |
| 207 | #endif |
| 208 | |
| 209 | #if defined(__KAL_ASSERT_LEVEL4__) |
| 210 | #define ASSERT(expr) \ |
| 211 | do { \ |
| 212 | if(!(expr)) { \ |
| 213 | register const kal_char *_expr __asm__ ("$a0") = #expr; \ |
| 214 | register const kal_char *_file __asm__ ("$a1") = __FILE__; \ |
| 215 | register long _line __asm__ ("$a2") = __LINE__; \ |
| 216 | __asm__ __volatile__( \ |
| 217 | ".set push \n" \ |
| 218 | ".set noreorder \n" \ |
| 219 | ".set noat \n" \ |
| 220 | "break %3 \n" \ |
| 221 | ".set pop \n" \ |
| 222 | : \ |
| 223 | : "r" ((_expr)), "r" ((_file)), "r" ((_line)), \ |
| 224 | "K" (ASSERT_LINE) \ |
| 225 | : ); \ |
| 226 | __builtin_unreachable (); \ |
| 227 | } \ |
| 228 | } while (0) |
| 229 | #define EXT_ASSERT1(expr, e1) \ |
| 230 | do { \ |
| 231 | if(!(expr)) { \ |
| 232 | register const kal_char *_expr __asm__ ("$a0") = #expr; \ |
| 233 | register const kal_char *_file __asm__ ("$a1") = __FILE__; \ |
| 234 | register long _line __asm__ ("$a2") = __LINE__; \ |
| 235 | register long _e1 __asm__ ("$a3") = e1; \ |
| 236 | __asm__ __volatile__( \ |
| 237 | ".set push \n" \ |
| 238 | ".set noreorder \n" \ |
| 239 | ".set noat \n" \ |
| 240 | "break %4 \n" \ |
| 241 | ".set pop \n" \ |
| 242 | : \ |
| 243 | : "r" ((_expr)), "r" ((_file)), "r" ((_line)), \ |
| 244 | "r" ((_e1)), "K" (ASSERT_EXT1) \ |
| 245 | : ); \ |
| 246 | __builtin_unreachable (); \ |
| 247 | } \ |
| 248 | } while (0) |
| 249 | #define EXT_ASSERT2(expr, e1, e2) \ |
| 250 | do { \ |
| 251 | if(!(expr)) { \ |
| 252 | register const kal_char *_expr __asm__ ("$a0") = #expr; \ |
| 253 | register const kal_char *_file __asm__ ("$a1") = __FILE__; \ |
| 254 | register long _line __asm__ ("$a2") = __LINE__; \ |
| 255 | register long _e1 __asm__ ("$a3") = e1; \ |
| 256 | register long _e2 __asm__ (EX_MIPS_GPR_R2) = e2; \ |
| 257 | __asm__ __volatile__( \ |
| 258 | ".set push \n" \ |
| 259 | ".set noreorder \n" \ |
| 260 | ".set noat \n" \ |
| 261 | "break %5 \n" \ |
| 262 | ".set pop \n" \ |
| 263 | : \ |
| 264 | : "r" ((_expr)), "r" ((_file)), "r" ((_line)), \ |
| 265 | "r" ((_e1)), "r" ((_e2)), "K" (ASSERT_EXT2) \ |
| 266 | : ); \ |
| 267 | __builtin_unreachable (); \ |
| 268 | } \ |
| 269 | } while (0) |
| 270 | #define EXT_ASSERT3(expr, e1, e2, e3) \ |
| 271 | do { \ |
| 272 | if(!(expr)) { \ |
| 273 | register const kal_char *_expr __asm__ ("$a0") = #expr; \ |
| 274 | register const kal_char *_file __asm__ ("$a1") = __FILE__; \ |
| 275 | register long _line __asm__ ("$a2") = __LINE__; \ |
| 276 | register long _e1 __asm__ ("$a3") = e1; \ |
| 277 | register long _e2 __asm__ (EX_MIPS_GPR_R2) = e2; \ |
| 278 | register long _e3 __asm__ (EX_MIPS_GPR_R3) = e3; \ |
| 279 | __asm__ __volatile__( \ |
| 280 | ".set push \n" \ |
| 281 | ".set noreorder \n" \ |
| 282 | ".set noat \n" \ |
| 283 | "break %6 \n" \ |
| 284 | ".set pop \n" \ |
| 285 | : \ |
| 286 | : "r" ((_expr)), "r" ((_file)), "r" ((_line)), \ |
| 287 | "r" ((_e1)), "r" ((_e2)), "r" ((_e3)), "K" (ASSERT_EXT3) \ |
| 288 | : ); \ |
| 289 | __builtin_unreachable (); \ |
| 290 | } \ |
| 291 | } while (0) |
| 292 | #define EXT_ASSERT(expr, e1, e2, e3) EXT_ASSERT3(expr, e1, e2, e3) |
| 293 | #define EXT_ASSERT_DUMP(expr, param) \ |
| 294 | do { \ |
| 295 | if(!(expr)) { \ |
| 296 | register const kal_char *_expr __asm__ ("$a0") = #expr; \ |
| 297 | register const kal_char *_file __asm__ ("$a1") = __FILE__; \ |
| 298 | register long _line __asm__ ("$a2") = __LINE__; \ |
| 299 | register void *_param __asm__ ("$a3") = (void*)param; \ |
| 300 | __asm__ __volatile__( \ |
| 301 | ".set push \n" \ |
| 302 | ".set noreorder \n" \ |
| 303 | ".set noat \n" \ |
| 304 | "break %4 \n" \ |
| 305 | ".set pop \n" \ |
| 306 | : \ |
| 307 | : "r" ((_expr)), "r" ((_file)), "r" ((_line)), \ |
| 308 | "r" ((_param)), "K" (ASSERT_EXT_DUMP) \ |
| 309 | : ); \ |
| 310 | __builtin_unreachable (); \ |
| 311 | } \ |
| 312 | } while (0) |
| 313 | |
| 314 | #define CUSTOM_ASSERT(TYPE, expr, dispatch_arg) \ |
| 315 | do { \ |
| 316 | if(!(expr)) { \ |
| 317 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 318 | register const kal_char *_expr __asm__ ("$a0") = #expr; \ |
| 319 | register const kal_char *_file __asm__ ("$a1") = __FILE__; \ |
| 320 | register long _line __asm__ ("$a2") = __LINE__; \ |
| 321 | register kal_uint32 __dispatch_arg __asm__ ("$a3") = _dispatch_arg; \ |
| 322 | __asm__ __volatile__( \ |
| 323 | ".set push \n" \ |
| 324 | ".set noreorder \n" \ |
| 325 | ".set noat \n" \ |
| 326 | "break %4 \n" \ |
| 327 | ".set pop \n" \ |
| 328 | : \ |
| 329 | : "r" ((_expr)), "r" ((_file)), "r" ((_line)), \ |
| 330 | "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE) \ |
| 331 | : ); \ |
| 332 | __builtin_unreachable (); \ |
| 333 | } \ |
| 334 | } while (0) |
| 335 | #define CUSTOM_ASSERT_EXT1(TYPE, expr, dispatch_arg, e1) \ |
| 336 | do { \ |
| 337 | if(!(expr)) { \ |
| 338 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 339 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 340 | register const kal_char *_expr __asm__ ("$a0") = #expr; \ |
| 341 | register const kal_char *_file __asm__ ("$a1") = __FILE__; \ |
| 342 | register long _line __asm__ ("$a2") = __LINE__; \ |
| 343 | register kal_uint32 __dispatch_arg __asm__ ("$a3") = _dispatch_arg; \ |
| 344 | register kal_uint32 __e1 __asm__ (EX_MIPS_GPR_R2) = _e1; \ |
| 345 | __asm__ __volatile__( \ |
| 346 | ".set push \n" \ |
| 347 | ".set noreorder \n" \ |
| 348 | ".set noat \n" \ |
| 349 | "break %5 \n" \ |
| 350 | ".set pop \n" \ |
| 351 | : \ |
| 352 | : "r" ((_expr)), "r" ((_file)), "r" ((_line)), \ |
| 353 | "r" ((__dispatch_arg)), "r" ((__e1)), "K" (ASSERT_CUS_##TYPE##_EXT1) \ |
| 354 | : ); \ |
| 355 | __builtin_unreachable (); \ |
| 356 | } \ |
| 357 | } while (0) |
| 358 | #define CUSTOM_ASSERT_EXT2(TYPE, expr, dispatch_arg, e1, e2) \ |
| 359 | do { \ |
| 360 | if(!(expr)) { \ |
| 361 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 362 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 363 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 364 | register const kal_char *_expr __asm__ ("$a0") = #expr; \ |
| 365 | register const kal_char *_file __asm__ ("$a1") = __FILE__; \ |
| 366 | register long _line __asm__ ("$a2") = __LINE__; \ |
| 367 | register kal_uint32 __dispatch_arg __asm__ ("$a3") = _dispatch_arg; \ |
| 368 | register kal_uint32 __e1 __asm__ (EX_MIPS_GPR_R2) = _e1; \ |
| 369 | register kal_uint32 __e2 __asm__ (EX_MIPS_GPR_R3) = _e2; \ |
| 370 | __asm__ __volatile__( \ |
| 371 | ".set push \n" \ |
| 372 | ".set noreorder \n" \ |
| 373 | ".set noat \n" \ |
| 374 | "break %6 \n" \ |
| 375 | ".set pop \n" \ |
| 376 | : \ |
| 377 | : "r" ((_expr)), "r" ((_file)), "r" ((_line)), \ |
| 378 | "r" ((__dispatch_arg)), "r" ((__e1)), "r" ((__e2)), "K" (ASSERT_CUS_##TYPE##_EXT2) \ |
| 379 | : ); \ |
| 380 | __builtin_unreachable (); \ |
| 381 | } \ |
| 382 | } while (0) |
| 383 | /* NOTE: at assert level 4, e3 argument is ignore due to shortage of regs */ |
| 384 | #define CUSTOM_ASSERT_EXT3(TYPE, expr, dispatch_arg, e1, e2, e3) \ |
| 385 | do { \ |
| 386 | if(!(expr)) { \ |
| 387 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 388 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 389 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 390 | register const kal_char *_expr __asm__ ("$a0") = #expr; \ |
| 391 | register const kal_char *_file __asm__ ("$a1") = __FILE__; \ |
| 392 | register long _line __asm__ ("$a2") = __LINE__; \ |
| 393 | register kal_uint32 __dispatch_arg __asm__ ("$a3") = _dispatch_arg; \ |
| 394 | register kal_uint32 __e1 __asm__ (EX_MIPS_GPR_R2) = _e1; \ |
| 395 | register kal_uint32 __e2 __asm__ (EX_MIPS_GPR_R3) = _e2; \ |
| 396 | __asm__ __volatile__( \ |
| 397 | ".set push \n" \ |
| 398 | ".set noreorder \n" \ |
| 399 | ".set noat \n" \ |
| 400 | "break %6 \n" \ |
| 401 | ".set pop \n" \ |
| 402 | : \ |
| 403 | : "r" ((_expr)), "r" ((_file)), "r" ((_line)), \ |
| 404 | "r" ((__dispatch_arg)), "r" ((__e1)), "r" ((__e2)), "K" (ASSERT_CUS_##TYPE##_EXT3) \ |
| 405 | : ); \ |
| 406 | __builtin_unreachable (); \ |
| 407 | } \ |
| 408 | } while (0) |
| 409 | |
| 410 | #define CUSTOM_ASSERT_ADDR(expr, dispatch_arg) CUSTOM_ASSERT(ADDR, expr, dispatch_arg) |
| 411 | #define CUSTOM_ASSERT_ADDR_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(ADDR, expr, dispatch_arg, e1) |
| 412 | #define CUSTOM_ASSERT_ADDR_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(ADDR, expr, dispatch_arg, e1, e2) |
| 413 | #define CUSTOM_ASSERT_ADDR_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(ADDR, expr, dispatch_arg, e1, e2, e3) |
| 414 | |
| 415 | #define CUSTOM_ASSERT_MODID(expr, dispatch_arg) CUSTOM_ASSERT(MODID, expr, dispatch_arg) |
| 416 | #define CUSTOM_ASSERT_MODID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MODID, expr, dispatch_arg, e1) |
| 417 | #define CUSTOM_ASSERT_MODID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MODID, expr, dispatch_arg, e1, e2) |
| 418 | #define CUSTOM_ASSERT_MODID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MODID, expr, dispatch_arg, e1, e2, e3) |
| 419 | |
| 420 | #define CUSTOM_ASSERT_MOFID(expr, dispatch_arg) CUSTOM_ASSERT(MOFID, expr, dispatch_arg) |
| 421 | #define CUSTOM_ASSERT_MOFID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MOFID, expr, dispatch_arg, e1) |
| 422 | #define CUSTOM_ASSERT_MOFID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MOFID, expr, dispatch_arg, e1, e2) |
| 423 | #define CUSTOM_ASSERT_MOFID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MOFID, expr, dispatch_arg, e1, e2, e3) |
| 424 | |
| 425 | #elif defined(__KAL_ASSERT_LEVEL3__) |
| 426 | #define ASSERT(expr) \ |
| 427 | do { \ |
| 428 | if(!(expr)) { \ |
| 429 | register const kal_char *_file __asm__ ("$a0") = __FILE__; \ |
| 430 | register long _line __asm__ ("$a1") = __LINE__; \ |
| 431 | __asm__ __volatile__( \ |
| 432 | ".set push \n" \ |
| 433 | ".set noreorder \n" \ |
| 434 | ".set noat \n" \ |
| 435 | "break %2 \n" \ |
| 436 | ".set pop \n" \ |
| 437 | : \ |
| 438 | : "r" ((_file)), "r" ((_line)), "K" (ASSERT_LINE) \ |
| 439 | : ); \ |
| 440 | __builtin_unreachable (); \ |
| 441 | } \ |
| 442 | } while (0) |
| 443 | #define EXT_ASSERT1(expr, e1) \ |
| 444 | do { \ |
| 445 | if(!(expr)) { \ |
| 446 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 447 | register const kal_char *_file __asm__ ("$a0") = __FILE__; \ |
| 448 | register long _line __asm__ ("$a1") = __LINE__; \ |
| 449 | register kal_uint32 __e1 __asm__ ("$a2") = _e1; \ |
| 450 | __asm__ __volatile__( \ |
| 451 | ".set push \n" \ |
| 452 | ".set noreorder \n" \ |
| 453 | ".set noat \n" \ |
| 454 | "break %3 \n" \ |
| 455 | ".set pop \n" \ |
| 456 | : \ |
| 457 | : "r" ((_file)), "r" ((_line)), "r" ((__e1)), "K" (ASSERT_EXT1) \ |
| 458 | : ); \ |
| 459 | __builtin_unreachable (); \ |
| 460 | } \ |
| 461 | } while (0) |
| 462 | #define EXT_ASSERT2(expr, e1, e2) \ |
| 463 | do { \ |
| 464 | if(!(expr)) { \ |
| 465 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 466 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 467 | register const kal_char *_file __asm__ ("$a0") = __FILE__; \ |
| 468 | register long _line __asm__ ("$a1") = __LINE__; \ |
| 469 | register kal_uint32 __e1 __asm__ ("$a2") = _e1; \ |
| 470 | register kal_uint32 __e2 __asm__ ("$a3") = _e2; \ |
| 471 | __asm__ __volatile__( \ |
| 472 | ".set push \n" \ |
| 473 | ".set noreorder \n" \ |
| 474 | ".set noat \n" \ |
| 475 | "break %4 \n" \ |
| 476 | ".set pop \n" \ |
| 477 | : \ |
| 478 | : "r" ((_file)), "r" ((_line)), \ |
| 479 | "r" ((__e1)), "r" ((__e2)), "K" (ASSERT_EXT2) \ |
| 480 | : ); \ |
| 481 | __builtin_unreachable (); \ |
| 482 | } \ |
| 483 | } while (0) |
| 484 | #define EXT_ASSERT3(expr, e1, e2, e3) \ |
| 485 | do { \ |
| 486 | if(!(expr)) { \ |
| 487 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 488 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 489 | kal_uint32 _e3 = (kal_uint32)(e3); \ |
| 490 | register const kal_char *_file __asm__ ("$a0") = __FILE__; \ |
| 491 | register long _line __asm__ ("$a1") = __LINE__; \ |
| 492 | register kal_uint32 __e1 __asm__ ("$a2") = _e1; \ |
| 493 | register kal_uint32 __e2 __asm__ ("$a3") = _e2; \ |
| 494 | register kal_uint32 __e3 __asm__ (EX_MIPS_GPR_R2) = _e3; \ |
| 495 | __asm__ __volatile__( \ |
| 496 | ".set push \n" \ |
| 497 | ".set noreorder \n" \ |
| 498 | ".set noat \n" \ |
| 499 | "break %5 \n" \ |
| 500 | ".set pop \n" \ |
| 501 | : \ |
| 502 | : "r" ((_file)), "r" ((_line)), \ |
| 503 | "r" ((__e1)), "r" ((__e2)), "r" ((__e3)), "K" (ASSERT_EXT3) \ |
| 504 | : ); \ |
| 505 | __builtin_unreachable (); \ |
| 506 | } \ |
| 507 | } while (0) |
| 508 | #define EXT_ASSERT(expr, e1, e2, e3) EXT_ASSERT3(expr, e1, e2, e3) |
| 509 | #define EXT_ASSERT_DUMP(expr, param) \ |
| 510 | do { \ |
| 511 | if(!(expr)) { \ |
| 512 | kal_uint32 _param = (kal_uint32)(param); \ |
| 513 | register const kal_char *_file __asm__ ("$a0") = __FILE__; \ |
| 514 | register long _line __asm__ ("$a1") = __LINE__; \ |
| 515 | register kal_uint32 __param __asm__ ("$a2") = _param; \ |
| 516 | __asm__ __volatile__( \ |
| 517 | ".set push \n" \ |
| 518 | ".set noreorder \n" \ |
| 519 | ".set noat \n" \ |
| 520 | "break %3 \n" \ |
| 521 | ".set pop \n" \ |
| 522 | : \ |
| 523 | : "r" ((_file)), "r" ((_line)), \ |
| 524 | "r" ((__param)), "K" (ASSERT_EXT_DUMP) \ |
| 525 | : ); \ |
| 526 | __builtin_unreachable (); \ |
| 527 | } \ |
| 528 | } while (0) |
| 529 | |
| 530 | #define CUSTOM_ASSERT(TYPE, expr, dispatch_arg) \ |
| 531 | do { \ |
| 532 | if(!(expr)) { \ |
| 533 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 534 | register const kal_char *_file __asm__ ("$a0") = __FILE__; \ |
| 535 | register long _line __asm__ ("$a1") = __LINE__; \ |
| 536 | register kal_uint32 __dispatch_arg __asm__ ("$a2") = _dispatch_arg; \ |
| 537 | __asm__ __volatile__( \ |
| 538 | ".set push \n" \ |
| 539 | ".set noreorder \n" \ |
| 540 | ".set noat \n" \ |
| 541 | "break %3 \n" \ |
| 542 | ".set pop \n" \ |
| 543 | : \ |
| 544 | : "r" ((_file)), "r" ((_line)), "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE) \ |
| 545 | : ); \ |
| 546 | __builtin_unreachable (); \ |
| 547 | } \ |
| 548 | } while (0) |
| 549 | #define CUSTOM_ASSERT_EXT1(TYPE, expr, dispatch_arg, e1) \ |
| 550 | do { \ |
| 551 | if(!(expr)) { \ |
| 552 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 553 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 554 | register const kal_char *_file __asm__ ("$a0") = __FILE__; \ |
| 555 | register long _line __asm__ ("$a1") = __LINE__; \ |
| 556 | register kal_uint32 __dispatch_arg __asm__ ("$a2") = _dispatch_arg; \ |
| 557 | register kal_uint32 __e1 __asm__ ("$a3") = _e1; \ |
| 558 | __asm__ __volatile__( \ |
| 559 | ".set push \n" \ |
| 560 | ".set noreorder \n" \ |
| 561 | ".set noat \n" \ |
| 562 | "break %4 \n" \ |
| 563 | ".set pop \n" \ |
| 564 | : \ |
| 565 | : "r" ((_file)), "r" ((_line)), \ |
| 566 | "r" ((__dispatch_arg)), "r" ((__e1)), "K" (ASSERT_CUS_##TYPE##_EXT1) \ |
| 567 | : ); \ |
| 568 | __builtin_unreachable (); \ |
| 569 | } \ |
| 570 | } while (0) |
| 571 | #define CUSTOM_ASSERT_EXT2(TYPE, expr, dispatch_arg, e1, e2) \ |
| 572 | do { \ |
| 573 | if(!(expr)) { \ |
| 574 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 575 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 576 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 577 | register const kal_char *_file __asm__ ("$a0") = __FILE__; \ |
| 578 | register long _line __asm__ ("$a1") = __LINE__; \ |
| 579 | register kal_uint32 __dispatch_arg __asm__ ("$a2") = _dispatch_arg; \ |
| 580 | register kal_uint32 __e1 __asm__ ("$a3") = _e1; \ |
| 581 | register kal_uint32 __e2 __asm__ (EX_MIPS_GPR_R2) = _e2; \ |
| 582 | __asm__ __volatile__( \ |
| 583 | ".set push \n" \ |
| 584 | ".set noreorder \n" \ |
| 585 | ".set noat \n" \ |
| 586 | "break %5 \n" \ |
| 587 | ".set pop \n" \ |
| 588 | : \ |
| 589 | : "r" ((_file)), "r" ((_line)), \ |
| 590 | "r" ((__dispatch_arg)), "r" ((__e1)), "r" ((__e2)), "K" (ASSERT_CUS_##TYPE##_EXT2) \ |
| 591 | : ); \ |
| 592 | __builtin_unreachable (); \ |
| 593 | } \ |
| 594 | } while (0) |
| 595 | #define CUSTOM_ASSERT_EXT3(TYPE, expr, dispatch_arg, e1, e2, e3) \ |
| 596 | do { \ |
| 597 | if(!(expr)) { \ |
| 598 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 599 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 600 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 601 | kal_uint32 _e3 = (kal_uint32)(e3); \ |
| 602 | register const kal_char *_file __asm__ ("$a0") = __FILE__; \ |
| 603 | register long _line __asm__ ("$a1") = __LINE__; \ |
| 604 | register kal_uint32 __dispatch_arg __asm__ ("$a2") = _dispatch_arg; \ |
| 605 | register kal_uint32 __e1 __asm__ ("$a3") = _e1; \ |
| 606 | register kal_uint32 __e2 __asm__ (EX_MIPS_GPR_R2) = _e2; \ |
| 607 | register kal_uint32 __e3 __asm__ (EX_MIPS_GPR_R3) = _e3; \ |
| 608 | __asm__ __volatile__( \ |
| 609 | ".set push \n" \ |
| 610 | ".set noreorder \n" \ |
| 611 | ".set noat \n" \ |
| 612 | "break %6 \n" \ |
| 613 | ".set pop \n" \ |
| 614 | : \ |
| 615 | : "r" ((_file)), "r" ((_line)), \ |
| 616 | "r" ((__dispatch_arg)), "r" ((__e1)), "r" ((__e2)), "r" ((__e3)), "K" (ASSERT_CUS_##TYPE##_EXT3) \ |
| 617 | : ); \ |
| 618 | __builtin_unreachable (); \ |
| 619 | } \ |
| 620 | } while (0) |
| 621 | |
| 622 | #define CUSTOM_ASSERT_ADDR(expr, dispatch_arg) CUSTOM_ASSERT(ADDR, expr, dispatch_arg) |
| 623 | #define CUSTOM_ASSERT_ADDR_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(ADDR, expr, dispatch_arg, e1) |
| 624 | #define CUSTOM_ASSERT_ADDR_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(ADDR, expr, dispatch_arg, e1, e2) |
| 625 | #define CUSTOM_ASSERT_ADDR_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(ADDR, expr, dispatch_arg, e1, e2, e3) |
| 626 | |
| 627 | #define CUSTOM_ASSERT_MODID(expr, dispatch_arg) CUSTOM_ASSERT(MODID, expr, dispatch_arg) |
| 628 | #define CUSTOM_ASSERT_MODID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MODID, expr, dispatch_arg, e1) |
| 629 | #define CUSTOM_ASSERT_MODID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MODID, expr, dispatch_arg, e1, e2) |
| 630 | #define CUSTOM_ASSERT_MODID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MODID, expr, dispatch_arg, e1, e2, e3) |
| 631 | |
| 632 | #define CUSTOM_ASSERT_MOFID(expr, dispatch_arg) CUSTOM_ASSERT(MOFID, expr, dispatch_arg) |
| 633 | #define CUSTOM_ASSERT_MOFID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MOFID, expr, dispatch_arg, e1) |
| 634 | #define CUSTOM_ASSERT_MOFID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MOFID, expr, dispatch_arg, e1, e2) |
| 635 | #define CUSTOM_ASSERT_MOFID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MOFID, expr, dispatch_arg, e1, e2, e3) |
| 636 | |
| 637 | #elif defined(__KAL_ASSERT_LEVEL2__) |
| 638 | #define ASSERT(expr) \ |
| 639 | do { \ |
| 640 | if(!(expr)) { \ |
| 641 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 642 | __asm__ __volatile__( \ |
| 643 | ".set push \n" \ |
| 644 | ".set noreorder \n" \ |
| 645 | ".set noat \n" \ |
| 646 | "break %1 \n" \ |
| 647 | ".set pop \n" \ |
| 648 | : \ |
| 649 | : "r" ((_line)), "K" (ASSERT_LINE) \ |
| 650 | : ); \ |
| 651 | __builtin_unreachable (); \ |
| 652 | } \ |
| 653 | } while (0) |
| 654 | #define EXT_ASSERT1(expr, e1) \ |
| 655 | do { \ |
| 656 | if(!(expr)) { \ |
| 657 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 658 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 659 | register long __e1 __asm__ ("$a1") = _e1; \ |
| 660 | __asm__ __volatile__( \ |
| 661 | ".set push \n" \ |
| 662 | ".set noreorder \n" \ |
| 663 | ".set noat \n" \ |
| 664 | "break %2 \n" \ |
| 665 | ".set pop \n" \ |
| 666 | : \ |
| 667 | : "r" ((_line)), "r" ((__e1)), "K" (ASSERT_EXT1) \ |
| 668 | : ); \ |
| 669 | __builtin_unreachable (); \ |
| 670 | } \ |
| 671 | } while (0) |
| 672 | #define EXT_ASSERT2(expr, e1, e2) \ |
| 673 | do { \ |
| 674 | if(!(expr)) { \ |
| 675 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 676 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 677 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 678 | register long __e1 __asm__ ("$a1") = _e1; \ |
| 679 | register long __e2 __asm__ ("$a2") = _e2; \ |
| 680 | __asm__ __volatile__( \ |
| 681 | ".set push \n" \ |
| 682 | ".set noreorder \n" \ |
| 683 | ".set noat \n" \ |
| 684 | "break %3 \n" \ |
| 685 | ".set pop \n" \ |
| 686 | : \ |
| 687 | : "r" ((_line)), \ |
| 688 | "r" ((__e1)), "r" ((__e2)), "K" (ASSERT_EXT2) \ |
| 689 | : ); \ |
| 690 | __builtin_unreachable (); \ |
| 691 | } \ |
| 692 | } while (0) |
| 693 | #define EXT_ASSERT3(expr, e1, e2, e3) \ |
| 694 | do { \ |
| 695 | if(!(expr)) { \ |
| 696 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 697 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 698 | kal_uint32 _e3 = (kal_uint32)(e3); \ |
| 699 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 700 | register long __e1 __asm__ ("$a1") = _e1; \ |
| 701 | register long __e2 __asm__ ("$a2") = _e2; \ |
| 702 | register long __e3 __asm__ ("$a3") = _e3; \ |
| 703 | __asm__ __volatile__( \ |
| 704 | ".set push \n" \ |
| 705 | ".set noreorder \n" \ |
| 706 | ".set noat \n" \ |
| 707 | "break %4 \n" \ |
| 708 | ".set pop \n" \ |
| 709 | : \ |
| 710 | : "r" ((_line)), \ |
| 711 | "r" ((__e1)), "r" ((__e2)), "r" ((__e3)), "K" (ASSERT_EXT3) \ |
| 712 | : ); \ |
| 713 | __builtin_unreachable (); \ |
| 714 | } \ |
| 715 | } while (0) |
| 716 | #define EXT_ASSERT(expr, e1, e2, e3) EXT_ASSERT3(expr, e1, e2, e3) |
| 717 | #define EXT_ASSERT_DUMP(expr, param) \ |
| 718 | do { \ |
| 719 | if(!(expr)) { \ |
| 720 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 721 | register void *_param __asm__ ("$a1") = (void*)param; \ |
| 722 | __asm__ __volatile__( \ |
| 723 | ".set push \n" \ |
| 724 | ".set noreorder \n" \ |
| 725 | ".set noat \n" \ |
| 726 | "break %2 \n" \ |
| 727 | ".set pop \n" \ |
| 728 | : \ |
| 729 | : "r" ((_line)), \ |
| 730 | "r" ((_param)), "K" (ASSERT_EXT_DUMP) \ |
| 731 | : ); \ |
| 732 | __builtin_unreachable (); \ |
| 733 | } \ |
| 734 | } while (0) |
| 735 | #define CUSTOM_ASSERT(TYPE, expr, dispatch_arg) \ |
| 736 | do { \ |
| 737 | if(!(expr)) { \ |
| 738 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 739 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 740 | register kal_uint32 __dispatch_arg __asm__ ("$a1") = _dispatch_arg; \ |
| 741 | __asm__ __volatile__( \ |
| 742 | ".set push \n" \ |
| 743 | ".set noreorder \n" \ |
| 744 | ".set noat \n" \ |
| 745 | "break %2 \n" \ |
| 746 | ".set pop \n" \ |
| 747 | : \ |
| 748 | : "r" ((_line)), "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE) \ |
| 749 | : ); \ |
| 750 | __builtin_unreachable (); \ |
| 751 | } \ |
| 752 | } while (0) |
| 753 | #define CUSTOM_ASSERT_EXT1(TYPE, expr, dispatch_arg, e1) \ |
| 754 | do { \ |
| 755 | if(!(expr)) { \ |
| 756 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 757 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 758 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 759 | register kal_uint32 __dispatch_arg __asm__ ("$a1") = _dispatch_arg; \ |
| 760 | register kal_uint32 __e1 __asm__ ("$a2") = _e1; \ |
| 761 | __asm__ __volatile__( \ |
| 762 | ".set push \n" \ |
| 763 | ".set noreorder \n" \ |
| 764 | ".set noat \n" \ |
| 765 | "break %3 \n" \ |
| 766 | ".set pop \n" \ |
| 767 | : \ |
| 768 | : "r" ((_line)), \ |
| 769 | "r" ((__dispatch_arg)), "r" ((__e1)), "K" (ASSERT_CUS_##TYPE##_EXT1) \ |
| 770 | : ); \ |
| 771 | __builtin_unreachable (); \ |
| 772 | } \ |
| 773 | } while (0) |
| 774 | #define CUSTOM_ASSERT_EXT2(TYPE, expr, dispatch_arg, e1, e2) \ |
| 775 | do { \ |
| 776 | if(!(expr)) { \ |
| 777 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 778 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 779 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 780 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 781 | register kal_uint32 __dispatch_arg __asm__ ("$a1") = _dispatch_arg; \ |
| 782 | register kal_uint32 __e1 __asm__ ("$a2") = _e1; \ |
| 783 | register kal_uint32 __e2 __asm__ ("$a3") = _e2; \ |
| 784 | __asm__ __volatile__( \ |
| 785 | ".set push \n" \ |
| 786 | ".set noreorder \n" \ |
| 787 | ".set noat \n" \ |
| 788 | "break %4 \n" \ |
| 789 | ".set pop \n" \ |
| 790 | : \ |
| 791 | : "r" ((_line)), \ |
| 792 | "r" ((__dispatch_arg)), "r" ((__e1)), "r" ((__e2)), "K" (ASSERT_CUS_##TYPE##_EXT2) \ |
| 793 | : ); \ |
| 794 | __builtin_unreachable (); \ |
| 795 | } \ |
| 796 | } while (0) |
| 797 | #define CUSTOM_ASSERT_EXT3(TYPE, expr, dispatch_arg, e1, e2, e3) \ |
| 798 | do { \ |
| 799 | if(!(expr)) { \ |
| 800 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 801 | kal_uint32 _e1 = (kal_uint32)(e1); \ |
| 802 | kal_uint32 _e2 = (kal_uint32)(e2); \ |
| 803 | kal_uint32 _e3 = (kal_uint32)(e3); \ |
| 804 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 805 | register kal_uint32 __dispatch_arg __asm__ ("$a1") = _dispatch_arg; \ |
| 806 | register kal_uint32 __e1 __asm__ ("$a2") = _e1; \ |
| 807 | register kal_uint32 __e2 __asm__ ("$a3") = _e2; \ |
| 808 | register kal_uint32 __e3 __asm__ (EX_MIPS_GPR_R2) = _e3; \ |
| 809 | __asm__ __volatile__( \ |
| 810 | ".set push \n" \ |
| 811 | ".set noreorder \n" \ |
| 812 | ".set noat \n" \ |
| 813 | "break %5 \n" \ |
| 814 | ".set pop \n" \ |
| 815 | : \ |
| 816 | : "r" ((_line)), \ |
| 817 | "r" ((__dispatch_arg)), "r" ((__e1)), "r" ((__e2)), "r" ((__e3)), "K" (ASSERT_CUS_##TYPE##_EXT3) \ |
| 818 | : ); \ |
| 819 | __builtin_unreachable (); \ |
| 820 | } \ |
| 821 | } while (0) |
| 822 | |
| 823 | #define CUSTOM_ASSERT_ADDR(expr, dispatch_arg) CUSTOM_ASSERT(ADDR, expr, dispatch_arg) |
| 824 | #define CUSTOM_ASSERT_ADDR_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(ADDR, expr, dispatch_arg, e1) |
| 825 | #define CUSTOM_ASSERT_ADDR_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(ADDR, expr, dispatch_arg, e1, e2) |
| 826 | #define CUSTOM_ASSERT_ADDR_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(ADDR, expr, dispatch_arg, e1, e2, e3) |
| 827 | |
| 828 | #define CUSTOM_ASSERT_MODID(expr, dispatch_arg) CUSTOM_ASSERT(MODID, expr, dispatch_arg) |
| 829 | #define CUSTOM_ASSERT_MODID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MODID, expr, dispatch_arg, e1) |
| 830 | #define CUSTOM_ASSERT_MODID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MODID, expr, dispatch_arg, e1, e2) |
| 831 | #define CUSTOM_ASSERT_MODID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MODID, expr, dispatch_arg, e1, e2, e3) |
| 832 | |
| 833 | #define CUSTOM_ASSERT_MOFID(expr, dispatch_arg) CUSTOM_ASSERT(MOFID, expr, dispatch_arg) |
| 834 | #define CUSTOM_ASSERT_MOFID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MOFID, expr, dispatch_arg, e1) |
| 835 | #define CUSTOM_ASSERT_MOFID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MOFID, expr, dispatch_arg, e1, e2) |
| 836 | #define CUSTOM_ASSERT_MOFID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MOFID, expr, dispatch_arg, e1, e2, e3) |
| 837 | |
| 838 | #elif defined(__KAL_ASSERT_LEVEL1__) |
| 839 | #define ASSERT(expr) \ |
| 840 | do { \ |
| 841 | if(!(expr)) { \ |
| 842 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 843 | __asm__ __volatile__( \ |
| 844 | ".set push \n" \ |
| 845 | ".set noreorder \n" \ |
| 846 | ".set noat \n" \ |
| 847 | "break %1 \n" \ |
| 848 | ".set pop \n" \ |
| 849 | : \ |
| 850 | : "r" ((_line)), "K" (ASSERT_LINE) \ |
| 851 | : ); \ |
| 852 | __builtin_unreachable (); \ |
| 853 | } \ |
| 854 | } while (0) |
| 855 | #define EXT_ASSERT1(expr, e1) \ |
| 856 | do { \ |
| 857 | if(!(expr)) { \ |
| 858 | (void)(e1); \ |
| 859 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 860 | __asm__ __volatile__( \ |
| 861 | ".set push \n" \ |
| 862 | ".set noreorder \n" \ |
| 863 | ".set noat \n" \ |
| 864 | "break %1 \n" \ |
| 865 | ".set pop \n" \ |
| 866 | : \ |
| 867 | : "r" ((_line)), "K" (ASSERT_EXT1) \ |
| 868 | : ); \ |
| 869 | __builtin_unreachable (); \ |
| 870 | } \ |
| 871 | } while (0) |
| 872 | #define EXT_ASSERT2(expr, e1, e2) \ |
| 873 | do { \ |
| 874 | if(!(expr)) { \ |
| 875 | (void)(e1); \ |
| 876 | (void)(e2); \ |
| 877 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 878 | __asm__ __volatile__( \ |
| 879 | ".set push \n" \ |
| 880 | ".set noreorder \n" \ |
| 881 | ".set noat \n" \ |
| 882 | "break %1 \n" \ |
| 883 | ".set pop \n" \ |
| 884 | : \ |
| 885 | : "r" ((_line)), "K" (ASSERT_EXT2) \ |
| 886 | : ); \ |
| 887 | __builtin_unreachable (); \ |
| 888 | } \ |
| 889 | } while (0) |
| 890 | #define EXT_ASSERT3(expr, e1, e2, e3) \ |
| 891 | do { \ |
| 892 | if(!(expr)) { \ |
| 893 | (void)(e1); \ |
| 894 | (void)(e2); \ |
| 895 | (void)(e3); \ |
| 896 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 897 | __asm__ __volatile__( \ |
| 898 | ".set push \n" \ |
| 899 | ".set noreorder \n" \ |
| 900 | ".set noat \n" \ |
| 901 | "break %1 \n" \ |
| 902 | ".set pop \n" \ |
| 903 | : \ |
| 904 | : "r" ((_line)), "K" (ASSERT_EXT3) \ |
| 905 | : ); \ |
| 906 | __builtin_unreachable (); \ |
| 907 | } \ |
| 908 | } while (0) |
| 909 | #define EXT_ASSERT(expr, e1, e2, e3) EXT_ASSERT3(expr, e1, e2, e3) |
| 910 | #define EXT_ASSERT_DUMP(expr, param) \ |
| 911 | do { \ |
| 912 | if(!(expr)) { \ |
| 913 | (void)(param); \ |
| 914 | register long _line __asm__ ("$a0") = __LINE__; \ |
| 915 | __asm__ __volatile__( \ |
| 916 | ".set push \n" \ |
| 917 | ".set noreorder \n" \ |
| 918 | ".set noat \n" \ |
| 919 | "break %1 \n" \ |
| 920 | ".set pop \n" \ |
| 921 | : \ |
| 922 | : "r" ((_line)), "K" (ASSERT_EXT_DUMP) \ |
| 923 | : ); \ |
| 924 | __builtin_unreachable (); \ |
| 925 | } \ |
| 926 | } while (0) |
| 927 | #define CUSTOM_ASSERT(TYPE, expr, dispatch_arg) \ |
| 928 | do { \ |
| 929 | if(!(expr)) { \ |
| 930 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 931 | register kal_uint32 __dispatch_arg __asm__ ("$a0") = _dispatch_arg; \ |
| 932 | __asm__ __volatile__( \ |
| 933 | ".set push \n" \ |
| 934 | ".set noreorder \n" \ |
| 935 | ".set noat \n" \ |
| 936 | "break %1 \n" \ |
| 937 | ".set pop \n" \ |
| 938 | : \ |
| 939 | : "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE) \ |
| 940 | : ); \ |
| 941 | __builtin_unreachable (); \ |
| 942 | } \ |
| 943 | } while (0) |
| 944 | #define CUSTOM_ASSERT_EXT1(TYPE, expr, dispatch_arg, e1) \ |
| 945 | do { \ |
| 946 | if(!(expr)) { \ |
| 947 | (void)(e1); \ |
| 948 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 949 | register kal_uint32 __dispatch_arg __asm__ ("$a0") = _dispatch_arg; \ |
| 950 | __asm__ __volatile__( \ |
| 951 | ".set push \n" \ |
| 952 | ".set noreorder \n" \ |
| 953 | ".set noat \n" \ |
| 954 | "break %1 \n" \ |
| 955 | ".set pop \n" \ |
| 956 | : \ |
| 957 | : "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE##_EXT1) \ |
| 958 | : ); \ |
| 959 | __builtin_unreachable (); \ |
| 960 | } \ |
| 961 | } while (0) |
| 962 | #define CUSTOM_ASSERT_EXT2(TYPE, expr, dispatch_arg, e1, e2) \ |
| 963 | do { \ |
| 964 | if(!(expr)) { \ |
| 965 | (void)(e1); \ |
| 966 | (void)(e2); \ |
| 967 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 968 | register kal_uint32 __dispatch_arg __asm__ ("$a0") = _dispatch_arg; \ |
| 969 | __asm__ __volatile__( \ |
| 970 | ".set push \n" \ |
| 971 | ".set noreorder \n" \ |
| 972 | ".set noat \n" \ |
| 973 | "break %1 \n" \ |
| 974 | ".set pop \n" \ |
| 975 | : \ |
| 976 | : "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE##_EXT2) \ |
| 977 | : ); \ |
| 978 | __builtin_unreachable (); \ |
| 979 | } \ |
| 980 | } while (0) |
| 981 | #define CUSTOM_ASSERT_EXT3(TYPE, expr, dispatch_arg, e1, e2, e3) \ |
| 982 | do { \ |
| 983 | if(!(expr)) { \ |
| 984 | (void)(e1); \ |
| 985 | (void)(e2); \ |
| 986 | (void)(e3); \ |
| 987 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 988 | register kal_uint32 __dispatch_arg __asm__ ("$a0") = _dispatch_arg; \ |
| 989 | __asm__ __volatile__( \ |
| 990 | ".set push \n" \ |
| 991 | ".set noreorder \n" \ |
| 992 | ".set noat \n" \ |
| 993 | "break %1 \n" \ |
| 994 | ".set pop \n" \ |
| 995 | : \ |
| 996 | : "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE##_EXT3) \ |
| 997 | : ); \ |
| 998 | __builtin_unreachable (); \ |
| 999 | } \ |
| 1000 | } while (0) |
| 1001 | |
| 1002 | #define CUSTOM_ASSERT_ADDR(expr, dispatch_arg) CUSTOM_ASSERT(ADDR, expr, dispatch_arg) |
| 1003 | #define CUSTOM_ASSERT_ADDR_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(ADDR, expr, dispatch_arg, e1) |
| 1004 | #define CUSTOM_ASSERT_ADDR_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(ADDR, expr, dispatch_arg, e1, e2) |
| 1005 | #define CUSTOM_ASSERT_ADDR_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(ADDR, expr, dispatch_arg, e1, e2, e3) |
| 1006 | |
| 1007 | #define CUSTOM_ASSERT_MODID(expr, dispatch_arg) CUSTOM_ASSERT(MODID, expr, dispatch_arg) |
| 1008 | #define CUSTOM_ASSERT_MODID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MODID, expr, dispatch_arg, e1) |
| 1009 | #define CUSTOM_ASSERT_MODID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MODID, expr, dispatch_arg, e1, e2) |
| 1010 | #define CUSTOM_ASSERT_MODID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MODID, expr, dispatch_arg, e1, e2, e3) |
| 1011 | |
| 1012 | #define CUSTOM_ASSERT_MOFID(expr, dispatch_arg) CUSTOM_ASSERT(MOFID, expr, dispatch_arg) |
| 1013 | #define CUSTOM_ASSERT_MOFID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MOFID, expr, dispatch_arg, e1) |
| 1014 | #define CUSTOM_ASSERT_MOFID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MOFID, expr, dispatch_arg, e1, e2) |
| 1015 | #define CUSTOM_ASSERT_MOFID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MOFID, expr, dispatch_arg, e1, e2, e3) |
| 1016 | |
| 1017 | #else /* __KAL_ASSERT_LEVEL0__*/ |
| 1018 | #define ASSERT(expr) do {if(!(expr)) {} } while (0) |
| 1019 | #define EXT_ASSERT1(expr, e1) \ |
| 1020 | do { \ |
| 1021 | if(!(expr)) { \ |
| 1022 | (void)(e1); \ |
| 1023 | __asm__ __volatile__( \ |
| 1024 | ".set push \n" \ |
| 1025 | ".set noreorder \n" \ |
| 1026 | ".set noat \n" \ |
| 1027 | "break %0 \n" \ |
| 1028 | ".set pop \n" \ |
| 1029 | : \ |
| 1030 | : "K" (ASSERT_EXT1) \ |
| 1031 | : ); \ |
| 1032 | __builtin_unreachable (); \ |
| 1033 | } \ |
| 1034 | } while (0) |
| 1035 | #define EXT_ASSERT2(expr, e1, e2) \ |
| 1036 | do { \ |
| 1037 | if(!(expr)) { \ |
| 1038 | (void)(e1); \ |
| 1039 | (void)(e2); \ |
| 1040 | __asm__ __volatile__( \ |
| 1041 | ".set push \n" \ |
| 1042 | ".set noreorder \n" \ |
| 1043 | ".set noat \n" \ |
| 1044 | "break %0 \n" \ |
| 1045 | ".set pop \n" \ |
| 1046 | : \ |
| 1047 | : "K" (ASSERT_EXT2) \ |
| 1048 | : ); \ |
| 1049 | __builtin_unreachable (); \ |
| 1050 | } \ |
| 1051 | } while (0) |
| 1052 | #define EXT_ASSERT3(expr, e1, e2, e3) \ |
| 1053 | do { \ |
| 1054 | if(!(expr)) { \ |
| 1055 | (void)(e1); \ |
| 1056 | (void)(e2); \ |
| 1057 | (void)(e3); \ |
| 1058 | __asm__ __volatile__( \ |
| 1059 | ".set push \n" \ |
| 1060 | ".set noreorder \n" \ |
| 1061 | ".set noat \n" \ |
| 1062 | "break %0 \n" \ |
| 1063 | ".set pop \n" \ |
| 1064 | : \ |
| 1065 | : "K" (ASSERT_EXT3) \ |
| 1066 | : ); \ |
| 1067 | __builtin_unreachable (); \ |
| 1068 | } \ |
| 1069 | } while (0) |
| 1070 | #define EXT_ASSERT(expr, e1, e2, e3) EXT_ASSERT3(expr, e1, e2, e3) |
| 1071 | #define EXT_ASSERT_DUMP(expr, param) \ |
| 1072 | do { \ |
| 1073 | if(!(expr)) { \ |
| 1074 | (void)(param); \ |
| 1075 | __asm__ __volatile__( \ |
| 1076 | ".set push \n" \ |
| 1077 | ".set noreorder \n" \ |
| 1078 | ".set noat \n" \ |
| 1079 | "break %0 \n" \ |
| 1080 | ".set pop \n" \ |
| 1081 | : \ |
| 1082 | : "K" (ASSERT_EXT_DUMP) \ |
| 1083 | : ); \ |
| 1084 | __builtin_unreachable (); \ |
| 1085 | } \ |
| 1086 | } while (0) |
| 1087 | #define CUSTOM_ASSERT(TYPE, expr, dispatch_arg) \ |
| 1088 | do { \ |
| 1089 | if(!(expr)) { \ |
| 1090 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 1091 | register kal_uint32 __dispatch_arg __asm__ ("$a0") = _dispatch_arg; \ |
| 1092 | __asm__ __volatile__( \ |
| 1093 | ".set push \n" \ |
| 1094 | ".set noreorder \n" \ |
| 1095 | ".set noat \n" \ |
| 1096 | "break %1 \n" \ |
| 1097 | ".set pop \n" \ |
| 1098 | : \ |
| 1099 | : "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE) \ |
| 1100 | : ); \ |
| 1101 | __builtin_unreachable (); \ |
| 1102 | } \ |
| 1103 | } while (0) |
| 1104 | #define CUSTOM_ASSERT_EXT1(TYPE, expr, dispatch_arg, e1) \ |
| 1105 | do { \ |
| 1106 | if(!(expr)) { \ |
| 1107 | (void)(e1); \ |
| 1108 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 1109 | register kal_uint32 __dispatch_arg __asm__ ("$a0") = _dispatch_arg; \ |
| 1110 | __asm__ __volatile__( \ |
| 1111 | ".set push \n" \ |
| 1112 | ".set noreorder \n" \ |
| 1113 | ".set noat \n" \ |
| 1114 | "break %1 \n" \ |
| 1115 | ".set pop \n" \ |
| 1116 | : \ |
| 1117 | : "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE##_EXT1) \ |
| 1118 | : ); \ |
| 1119 | __builtin_unreachable (); \ |
| 1120 | } \ |
| 1121 | } while (0) |
| 1122 | #define CUSTOM_ASSERT_EXT2(TYPE, expr, dispatch_arg, e1, e2) \ |
| 1123 | do { \ |
| 1124 | if(!(expr)) { \ |
| 1125 | (void)(e1); \ |
| 1126 | (void)(e2); \ |
| 1127 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 1128 | register kal_uint32 __dispatch_arg __asm__ ("$a0") = _dispatch_arg; \ |
| 1129 | __asm__ __volatile__( \ |
| 1130 | ".set push \n" \ |
| 1131 | ".set noreorder \n" \ |
| 1132 | ".set noat \n" \ |
| 1133 | "break %1 \n" \ |
| 1134 | ".set pop \n" \ |
| 1135 | : \ |
| 1136 | : "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE##_EXT2) \ |
| 1137 | : ); \ |
| 1138 | __builtin_unreachable (); \ |
| 1139 | } \ |
| 1140 | } while (0) |
| 1141 | #define CUSTOM_ASSERT_EXT3(TYPE, expr, dispatch_arg, e1, e2, e3) \ |
| 1142 | do { \ |
| 1143 | if(!(expr)) { \ |
| 1144 | (void)(e1); \ |
| 1145 | (void)(e2); \ |
| 1146 | (void)(e3); \ |
| 1147 | kal_uint32 _dispatch_arg = (kal_uint32)(dispatch_arg); \ |
| 1148 | register kal_uint32 __dispatch_arg __asm__ ("$a0") = _dispatch_arg; \ |
| 1149 | __asm__ __volatile__( \ |
| 1150 | ".set push \n" \ |
| 1151 | ".set noreorder \n" \ |
| 1152 | ".set noat \n" \ |
| 1153 | "break %1 \n" \ |
| 1154 | ".set pop \n" \ |
| 1155 | : \ |
| 1156 | : "r" ((__dispatch_arg)), "K" (ASSERT_CUS_##TYPE##_EXT3) \ |
| 1157 | : ); \ |
| 1158 | __builtin_unreachable (); \ |
| 1159 | } \ |
| 1160 | } while (0) |
| 1161 | |
| 1162 | #define CUSTOM_ASSERT_ADDR(expr, dispatch_arg) CUSTOM_ASSERT(ADDR, expr, dispatch_arg) |
| 1163 | #define CUSTOM_ASSERT_ADDR_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(ADDR, expr, dispatch_arg, e1) |
| 1164 | #define CUSTOM_ASSERT_ADDR_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(ADDR, expr, dispatch_arg, e1, e2) |
| 1165 | #define CUSTOM_ASSERT_ADDR_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(ADDR, expr, dispatch_arg, e1, e2, e3) |
| 1166 | |
| 1167 | #define CUSTOM_ASSERT_MODID(expr, dispatch_arg) CUSTOM_ASSERT(MODID, expr, dispatch_arg) |
| 1168 | #define CUSTOM_ASSERT_MODID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MODID, expr, dispatch_arg, e1) |
| 1169 | #define CUSTOM_ASSERT_MODID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MODID, expr, dispatch_arg, e1, e2) |
| 1170 | #define CUSTOM_ASSERT_MODID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MODID, expr, dispatch_arg, e1, e2, e3) |
| 1171 | |
| 1172 | #define CUSTOM_ASSERT_MOFID(expr, dispatch_arg) CUSTOM_ASSERT(MOFID, expr, dispatch_arg) |
| 1173 | #define CUSTOM_ASSERT_MOFID_EXT1(expr, dispatch_arg, e1) CUSTOM_ASSERT_EXT1(MOFID, expr, dispatch_arg, e1) |
| 1174 | #define CUSTOM_ASSERT_MOFID_EXT2(expr, dispatch_arg, e1, e2) CUSTOM_ASSERT_EXT2(MOFID, expr, dispatch_arg, e1, e2) |
| 1175 | #define CUSTOM_ASSERT_MOFID_EXT3(expr, dispatch_arg, e1, e2, e3) CUSTOM_ASSERT_EXT3(MOFID, expr, dispatch_arg, e1, e2, e3) |
| 1176 | |
| 1177 | #endif /* __KAL_ASSERT_LEVEL__*/ |
| 1178 | |
| 1179 | #else /* __MIPS_IA__ || __MIPS_I7200__ */ |
| 1180 | #error "Unsupported CPU type in assertion" |
| 1181 | #endif /* __MIPS_IA__ || __MIPS_I7200__ */ |
| 1182 | |
| 1183 | #else /* __MTK_TARGET__ && !__UBL__ */ |
| 1184 | |
| 1185 | /* align to the highest assert level in MoDIS, no shrinking requirement */ |
| 1186 | #define ASSERT(expr) do {if(!(expr)) kal_assert_fail((kal_char *)#expr, (kal_char *)__FILE__, __LINE__, KAL_FALSE, 0, 0, 0, NULL); } while (0) |
| 1187 | #define EXT_ASSERT3(expr, e1, e2, e3) do {if(!(expr)) kal_assert_fail((kal_char *)#expr, (kal_char *)__FILE__, __LINE__, KAL_TRUE, (e1), (e2), (e3), NULL); } while (0) |
| 1188 | #define EXT_ASSERT2(expr, e1, e2) EXT_ASSERT3(expr, e1, e2, 0) |
| 1189 | #define EXT_ASSERT1(expr, e1) EXT_ASSERT3(expr, e1, 0, 0) |
| 1190 | #define EXT_ASSERT(expr, e1, e2, e3) EXT_ASSERT3(expr, e1, e2, e3) |
| 1191 | #define EXT_ASSERT_DUMP(expr, param) do {if(!(expr)) kal_assert_fail((kal_char *)#expr, (kal_char *)__FILE__, __LINE__, KAL_TRUE, 0, 0, 0, (param)); } while (0) |
| 1192 | |
| 1193 | #endif /* __MTK_TARGET__ && !__UBL__ */ |
| 1194 | #else /* !__COSIM_BYPASS_DRV__ || __ESL_ENABLE_BREAK__ */ |
| 1195 | extern void MDM_ASSERT(kal_uint32 e1, kal_uint32 e2, kal_uint32 e3); //extern MDM_ASSERT API in init_trc_api.h |
| 1196 | #define ASSERT(expr) do {if(!(expr)) {MDM_ASSERT(0, 0, 0); __builtin_unreachable();} } while (0) |
| 1197 | #define EXT_ASSERT3(expr, e1, e2, e3) do {if(!(expr)) {MDM_ASSERT((kal_uint32)e1, (kal_uint32)e2, (kal_uint32)e3); __builtin_unreachable();} } while (0) |
| 1198 | #define EXT_ASSERT2(expr, e1, e2) EXT_ASSERT3(expr, e1, e2, 0) |
| 1199 | #define EXT_ASSERT1(expr, e1) EXT_ASSERT3(expr, e1, 0, 0) |
| 1200 | #define EXT_ASSERT(expr, e1, e2, e3) EXT_ASSERT3(expr, e1, e2, e3) |
| 1201 | #define EXT_ASSERT_DUMP(expr, param) EXT_ASSERT3(expr, param, 0, 0) |
| 1202 | #endif /* !__COSIM_BYPASS_DRV__ || __ESL_ENABLE_BREAK__ */ |
| 1203 | |
| 1204 | |
| 1205 | /* DOM-NOT_FOR_SDK-END */ |
| 1206 | |
| 1207 | #ifdef __BUILD_DOM__ |
| 1208 | /******************************************************************************* |
| 1209 | * <GROUP Functions> |
| 1210 | * |
| 1211 | * FUNCTION |
| 1212 | * ASSERT |
| 1213 | * DESCRIPTION |
| 1214 | * assert the condition is true, otherwise enter system exception handling. |
| 1215 | * PARAMETERS |
| 1216 | * expr: [IN] the condition to be evaluated |
| 1217 | * RETURNS |
| 1218 | * N/A |
| 1219 | * NOTE |
| 1220 | * (1)The assertion only takes effect when DEBUG_KAL is defined. |
| 1221 | * (2)No matter DEBUG_KAL is defined or not, the expr will be evaluated. |
| 1222 | * SEE ALSO |
| 1223 | * EXT_ASSERT EXT_ASSERT_DUMP |
| 1224 | ******************************************************************************/ |
| 1225 | #define ASSERT(expr) __ASSERT(expr) |
| 1226 | /******************************************************************************* |
| 1227 | * <GROUP Functions> |
| 1228 | * |
| 1229 | * FUNCTION |
| 1230 | * EXT_ASSERT |
| 1231 | * DESCRIPTION |
| 1232 | * external assert the condition is true, otherwise enter system exception handling. |
| 1233 | * PARAMETERS |
| 1234 | * expr: [IN] the condition to be evaluated. |
| 1235 | * e1: [IN] first extra expression recorded. |
| 1236 | * e2: [IN] second extra expression recorded. |
| 1237 | * e3: [IN] third extra expression recorded. |
| 1238 | * RETURNS |
| 1239 | * N/A |
| 1240 | * NOTE |
| 1241 | * (1)The assertion takes effect all the time, both DEBUG_KAL and RELEASE_KAL. |
| 1242 | * SEE ALSO |
| 1243 | * ASSERT EXT_ASSERT_DUMP |
| 1244 | ******************************************************************************/ |
| 1245 | #define EXT_ASSERT(expr, e1, e2, e3) __EXT_ASSERT(expr, e1, e2, e3) |
| 1246 | #endif /*__BUILD_DOM__*/ |
| 1247 | |
| 1248 | /* DOM-NOT_FOR_SDK-BEGIN */ |
| 1249 | |
| 1250 | #ifdef __cplusplus |
| 1251 | } |
| 1252 | #endif |
| 1253 | |
| 1254 | #endif /* _KAL_EX_API_H */ |