forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-02-17 557c24d082b6ecb9bfe5407b77ae43fa7650a5dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#include "dwl.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
/* wrapper information */
typedef struct hRK70dwl {
    RK_U32 clientType;
    int fd;                  /* decoder device file */
    int fd_mem;              /* /dev/mem for mapping */
    int fd_memalloc;         /* linear memory allocator */
    volatile RK_U32 *pRegBase;  /* IO mem base */
    RK_U32 regSize;             /* IO mem size */
    RK_U32 freeLinMem;          /* Start address of free linear memory */
    RK_U32 freeRefFrmMem;       /* Start address of free reference frame memory */
    int semid;
    int sigio_needed;
#ifdef INTERNAL_TEST
    FILE *regDump;
#endif
} hRK70dwl_t;
 
/* HW ID retriving, static implementation */
RK_U32 DWLReadAsicID(void)
{
    return 0;
}
 
/* HW configuration retrieving, static implementation */
void DWLReadAsicConfig(DWLHwConfig_t * pHwCfg)
{
 
    pHwCfg->jpegSupport = JPEG_BASELINE;
    pHwCfg->jpegESupport = JPEG_EXT_SUPPORTED;
 
}
 
/* HW fuse retrieving, static implementation */
void DWLReadAsicFuseStatus(DWLHwFuseStatus_t * pHwFuseSts)
{
}
 
/* DWL initilaization and release */
const void *DWLInit(DWLInitParam_t * param)
{
 
    hRK70dwl_t *dec_dwl;
 
    dec_dwl = (hRK70dwl_t *) malloc(sizeof(hRK70dwl_t));
 
    return dec_dwl;
}
 
RK_S32 DWLRelease(const void *instance)
{
    hRK70dwl_t *dec_dwl = (hRK70dwl_t *) instance;
    free(dec_dwl);
 
    return (DWL_OK);
}
 
/* HW sharing */
RK_S32 DWLReserveHw(const void *instance)
{
    return DWL_OK;
}
void DWLReleaseHw(const void *instance)
{
    return;
}
 
/* Frame buffers memory */
RK_S32 DWLMallocRefFrm(const void *instance, RK_U32 size, DWLLinearMem_t * info)
{
 
    return DWLMallocLinear(instance, size, info);
}
void DWLFreeRefFrm(const void *instance, DWLLinearMem_t * info)
{
 
    DWLFreeLinear(instance, info);
}
 
/* SW/HW shared memory */
RK_S32 DWLMallocLinear(const void *instance, RK_U32 size, DWLLinearMem_t * info)
{
 
    info->size = size;
    info->virtualAddress = (RK_U32 *)malloc(size);
    info->busAddress = 0x00010000;
 
    return DWL_OK;
}
 
void DWLFreeLinear(const void *instance, DWLLinearMem_t * info)
{
 
    free(info->virtualAddress);
    return;
}
 
/* D-Cache coherence */
void DWLDCacheRangeFlush(const void *instance, DWLLinearMem_t * info)
{
    return;
}  /* NOT in use */
 
void DWLDCacheRangeRefresh(const void *instance, DWLLinearMem_t * info)
{
    return;
}    /* NOT in use */
 
 
 
/* Register access */
void DWLWriteReg(const void *instance, RK_U32 offset, RK_U32 value)
{
    return;
}
 
 
RK_U32 DWLReadReg(const void *instance, RK_U32 offset)
{
    return 0;
}
 
void DWLWriteRegAll(const void *instance, const RK_U32 * table, RK_U32 size)
{
    return;
} /* NOT in use */
 
 
void DWLReadRegAll(const void *instance, RK_U32 * table, RK_U32 size)
{
    return;
}    /* NOT in use */
 
/* HW starting/stopping */
void DWLEnableHW(const void *instance, RK_U32 offset, RK_U32 value)
{
    return;
}
 
 
void DWLDisableHW(const void *instance, RK_U32 offset, RK_U32 value)
{
    return;
}
 
/* HW synchronization */
RK_S32 DWLWaitHwReady(const void *instance, RK_U32 timeout)
{
 
    return DWL_OK;
}
 
/* SW/SW shared memory */
void *DWLmalloc(RK_U32 n)
{
    return malloc(n);
}
 
 
void DWLfree(void *p)
{
    free(p);
}
 
 
void *DWLcalloc(RK_U32 n, RK_U32 s)
{
    return calloc(n, s);
}
 
void *DWLmemcpy(void *d, const void *s, RK_U32 n)
{
    return memcpy(d, s, n);
}
 
 
void *DWLmemset(void *d, RK_S32 c, RK_U32 n)
{
    return memset(d, c, n);
}