DF-4199 / dm_services.h
/* * dm_services.h — userspace harness stub (DF-4198 pattern). * dcn_calc_auto.c is pure arithmetic and uses nothing from the real * dm_services.h directly, but the REAL header chain pulled in by the REAL * dcn_calcs.h (-> ../dml/display_mode_lib.h -> dml_common_defs.h) needs: * - DC_LOG_* sinks * - ASSERT / BREAK_TO_DEBUGGER / ASSERT_CRITICAL (os_types.h semantics on * a non-CONFIG_DEBUG_KERNEL_DC build: WARN_ON, i.e. NON-FATAL) */ #ifndef __HARNESS_DM_SERVICES_H__ #define __HARNESS_DM_SERVICES_H__ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <stdint.h> struct dal_logger; /* opaque; display_mode_lib.h only stores it */ /* linux-compat bits needed by the REAL inc/bw_fixed.h inlines (u64 math) */ typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; #define BUILD_BUG_ON(cond) do { } while (0) static inline u64 div64_u64_rem(u64 dividend, u64 divisor, u64 *remainder) { *remainder = divisor ? dividend % divisor : 0; return divisor ? dividend / divisor : 0; } #define __always_inline inline extern unsigned long g_assert_count; extern unsigned long g_dtrace_count; #define DC_LOG_DML(str, ...) do { g_dtrace_count++; } while (0) #define DC_LOG_DC(str, ...) do { g_dtrace_count++; } while (0) #define DC_LOG_SURFACE(str, ...) do { g_dtrace_count++; } while (0) #define DC_LOG_SYNC(str, ...) do { g_dtrace_count++; } while (0) #define DC_LOG_DETECTION(str, ...) do { g_dtrace_count++; } while (0) /* os_types.h, non-CONFIG_DEBUG_KERNEL_DC build: ASSERT is WARN_ON => the * kernel keeps running; only a console warning. Harness mirrors that. */ #define ASSERT(expr) do { \ if (!(expr)) { \ g_assert_count++; \ fprintf(stderr, "ASSERT-WARN (%s:%d): %s\n", __FILE__, __LINE__, #expr); \ } \ } while (0) #define ASSERT_CRITICAL(expr) ASSERT(expr) #define BREAK_TO_DEBUGGER() ASSERT(0) #endif |