1 #ifndef VIDDEC_FW_DEBUG_H
2 #define VIDDEC_FW_DEBUG_H
3
4 //#define SWAP_BYTE(x,y,z) (( ( (x)>>(8*y))& 0xFF) << (8*z))
5 #define SWAP_BYTE(x,y,z) (( ( (x) >> ((y) << 3))& 0xFF) << ((z) << 3))
6 #define SWAP_WORD(x) ( SWAP_BYTE((x),0,3) | SWAP_BYTE((x),1,2) |SWAP_BYTE((x),2,1) |SWAP_BYTE((x),3,0))
7
8 #ifndef VBP
9
10 #ifndef HOST_ONLY
11 #define _OSAL_IO_MEMMAP_H /* to prevent errors when including sven_devh.h */
12 #define _OSAL_ASSERT_H /* to prevent errors when including sven_devh.h */
13 #endif
14 #include <stdint.h>
15 #include "viddec_debug.h"
16 #include "sven_devh.h"
17 #include "auto_eas/gen4_gv.h"
18
19 #ifdef HOST_ONLY
20 #define DUMP_TO_MEM(x) DEB("0x%.08X ",x);
21 #define WRITE_SVEN(event, p1, p2, p3, p4, p5, p6) DEB("Sven evnt=0x%.8X p1=%d p2=%d p3=%d p4=%d p5=%d p6=%d\n",event, p1, p2, p3, p4, p5, p6)
22 #define read_ret(x)
23 #define read_fp(x)
24 #define read_sp(x)
25 #define read_wim(x)
26 #define read_psr(x)
27 #else
28 extern uint32_t dump_ptr;
29 /* Macros for Dumping data to DDR */
30 #define DUMP_TO_MEM(x) ((volatile unsigned int *)0x8F000000)[dump_ptr++] = SWAP_WORD(x);
31 #define read_ret(x) asm("mov %%i7, %0\n":"=r" (x))
32 #define read_fp(x) asm("mov %%i6, %0\n":"=r" (x))
33 #define read_sp(x) asm("mov %%sp, %0\n":"=r" (x))
34 #define read_wim(x) asm("mov %%wim, %0\n":"=r" (x))
35 #define read_psr(x) asm("mov %%psr, %0\n":"=r" (x))
36 #define WRITE_SVEN(event, p1, p2, p3, p4, p5, p6) devh_SVEN_WriteModuleEvent( NULL, event, p1, p2, p3, p4, p5, p6)
37 #endif
38
39 #else // VBP is defined
40
41 #include <stdint.h>
42 #include "viddec_debug.h"
43 #define DUMP_TO_MEM(x)
44 #define WRITE_SVEN(event, p1, p2, p3, p4, p5, p6)
45 #define read_ret(x)
46 #define read_fp(x)
47 #define read_sp(x)
48 #define read_wim(x)
49 #define read_psr(x)
50
51
52 #endif
53
DEBUG_WRITE(uint32_t p1,uint32_t p2,uint32_t p3,uint32_t p4,uint32_t p5,uint32_t p6)54 static inline void DEBUG_WRITE(uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4, uint32_t p5, uint32_t p6)
55 {
56 //uint32_t temp;
57 DUMP_TO_MEM(0xCACAFEED);
58 DUMP_TO_MEM(p1);
59 DUMP_TO_MEM(p2);
60 DUMP_TO_MEM(p3);
61 DUMP_TO_MEM(p4);
62 DUMP_TO_MEM(p5);
63 DUMP_TO_MEM(p6);
64 DUMP_TO_MEM(0xCACA0000);
65 //temp = dump_ptr;
66 //DUMP_TO_MEM(temp);
67 }
DUMP_SPARC_REG(void)68 static inline void DUMP_SPARC_REG(void)
69 {
70 uint32_t ret1, fp, sp, wim, psr;
71 read_ret(ret1);
72 read_fp(fp);
73 read_sp(sp);
74 read_wim(wim);
75 read_psr(psr);
76 //crash = (uint32_t *)0x1000bf0c;
77 //DEBUG_WRITE(sp, wim, fp, ret1, (*crash), 0xFED);
78 DEBUG_WRITE(sp, wim, fp, ret1, psr, 0xFFFFFFFF);
79 }
80 #endif
81