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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
/*
****************************************************************************
PROJECT : JCUA driver
FILE : $Id: r_jcua_sys.h 14751 2017-09-25 04:27:33Z shinya.tomari $
============================================================================
DESCRIPTION
JCUA support functions
============================================================================
C O P Y R I G H T
============================================================================
Copyright (c) 2013 - 2017
by
Renesas Electronics (Europe) GmbH.
Arcadiastrasse 10
D-40472 Duesseldorf
Germany
All rights reserved.
============================================================================
Purpose: only for testing, not for mass production
DISCLAIMER
LICENSEE has read, understood and accepted the terms and conditions defined in
the license agreement, especially the usage rights. In any case, it is
LICENSEE's responsibility to make sure that any user of the software complies
with the terms and conditions of the signed license agreement.
SAMPLE CODE is not part of the licensed software, as such it must not be used in
mass-production applications. It can only be used for evaluation and
demonstration purposes at customer's premises listed in the signed license
agreement.
****************************************************************************
*/
/***************************************************************************
Title: JCUA Driver support functions
JCUA (JPEG Codec Unit A) driver support functions
The generic JCUA driver uses these functions. They have to be implemented
within the driver library for a concrete device. (e.g. D1L, D1M)
Support functions are functions that are not part of the driver itself
but they must be provided to integrate the driver on a particular board.
*/
#ifndef R_JCUA_SYS_H
#define R_JCUA_SYS_H
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
Section: Global Functions
*/
/***************************************************************************
Group: JCUA driver Basic interface functions
*/
/***************************************************************************
Function: R_JCUA_Sys_Init
Description:
This function initializes environment-dependent part.
This function is called from <R_JCUA_Init>.
This function executes the following processing.
* Bus reset for JCUA H/W macro (refer to OPC(Operating Precautions) item #12 "JCUA reset operation").
> -> JCCMD.BRST must not be used. (JCU macro internal reset not sufficent)
> -> JCSWRST.JCUA0RES must be used instead. (JCU macro external reset)
> Refer to D1x UM section 44.6 "Software Reset Processing".
> Use the following software reset procedure to reset the JCUA unit:
> 0. Wait for 30us.
> 1. Set JCSWRST.JCUA0RES bit to 1, to generate the software reset condition.
> 2. Read JCSWRST.JCUA0RES bit until bit is set to 1, to wait for software reset is active.
> 3. Set JCSWRST.JCUA0RES bit to 0, to release software reset condition.
> By this sequennce all JCUA registers with exception of the JCSWRST register are initialized by a software reset.
* Enable interrupt for JCUA H/W macro.
> Call R_JCUA_Sys_InterruptEnable(Unit)
Customizing Points:
It is NOT necessary to modify this function in general use-case.
But this function is using the TICK driver or OSTM driver for wait process.
If you don't want to use TICK driver or OSTM driver, please modify wait process.
Parameter:
Unit - Instance number.
Return value:
R_JCUA_ERR_OK - No error has occurred.
R_JCUA_ERR_RANGE_UNIT - Unit number is out of range.
R_JCUA_ERR_FATAL_HW - Fatal error has occurred at H/W.
See <r_jcua_Error_t>.
*/
r_jcua_Error_t R_JCUA_Sys_Init(const uint32_t Unit);
/***************************************************************************
Function: R_JCUA_Sys_DeInit
Description:
This function de-initializes environment-dependent part.
This function is called from <R_JCUA_DeInit>.
This function executes the following processing.
* Disable interrupt for JCUA H/W macro.
> Call R_JCUA_Sys_InterruptDisable(Unit)
* Close the H/W timer for the wait process. (if necessary)
Customizing Points:
It is NOT necessary to modify this function in general use-case.
But this function is using the TICK driver or OSTM driver for wait process.
If you don't want to use TICK driver or OSTM driver, please modify wait process.
Parameter:
Unit - Instance number.
Return value:
R_JCUA_ERR_OK - No error has occurred.
R_JCUA_ERR_RANGE_UNIT - Unit number is out of range.
R_JCUA_ERR_FATAL_HW - Fatal error has occurred at H/W.
See <r_jcua_Error_t>.
*/
r_jcua_Error_t R_JCUA_Sys_DeInit(const uint32_t Unit);
/***************************************************************************
Function: R_JCUA_Sys_InterruptEnable
Description:
This function is enable interrupt request.
This function is called from <R_JCUA_DecoderStart> and <R_JCUA_DecoderContinue>.
This function executes the following processing.
* Enables the JEDI and JDTI interrupt.
Customizing Points:
It is NOT necessary to modify this function in general use-case.
Parameter:
Unit - Instance number.
Return value:
None.
*/
void R_JCUA_Sys_InterruptEnable(const uint32_t Unit);
/***************************************************************************
Function: R_JCUA_Sys_InterruptDisable
Description:
This function is disable interrupt request.
This function is called from several JCUA APIs.
This function executes the following processing.
* Disables the JEDI and JDTI interrupt.
Customizing Points:
It is NOT necessary to modify this function in general use-case.
Parameter:
Unit - Instance number.
Return value:
None.
*/
void R_JCUA_Sys_InterruptDisable(const uint32_t Unit);
/***************************************************************************
Function: R_JCUA_Sys_BaseAddrGet
Description:
This function gives back the base address of JCUA H/W macro's register.
This function is called from several JCUA APIs.
This function executes the following processing.
* Returns the base address of JCUA H/W macro's register.
Customizing Points:
It is NOT necessary to modify this function in general use-case.
Parameter:
Unit - Instance number.
Return value:
uint32_t - base address of macro instance (Unit).
*/
uint32_t R_JCUA_Sys_BaseAddrGet(const uint32_t Unit);
/***************************************************************************
Function: R_JCUA_Sys_TimerStart
Description:
This function starts timeout measurement.
This function is called from <R_JCUA_DecoderStart> and <R_JCUA_IsrStop>.
This function executes the following processing.
* Starts the timer for timeout measurement.
* Calls <R_JCUA_IsrTimeOut> calllback function when timeout occurs. (This process is executed
by loc_OstmCallback.)
Note:
Please note that this function is called from <R_JCUA_IsrStop>.
This may be called from ISR depending on the system.
Customizing Points:
It is NOT necessary to modify this function in general use-case.
But this function is using the OSTM driver for timeout measurement.
If you don't want to use OSTM driver, please modify timeout measurement process.
Parameter:
Unit - Instance number.
IsHeader - The parameter specified the decoding part.
R_TRUE : JPEG Header part
R_FALSE : JPEG Image data part
Return value:
R_JCUA_ERR_OK - No error has occurred.
R_JCUA_ERR_RANGE_UNIT - Unit number is out of range.
R_JCUA_ERR_PARAM_INCORRECT - A parameter is incorrect.
R_JCUA_ERR_FATAL_HW - Fatal error has occurred at H/W.
See <r_jcua_Error_t>.
*/
r_jcua_Error_t R_JCUA_Sys_TimerStart(const uint32_t Unit, const uint32_t IsHeader);
/***************************************************************************
Function: R_JCUA_Sys_TimerStop
Description:
This function stops timeout measurement.
This function is called from <R_JCUA_IsrFinish> and <R_JCUA_IsrStop>.
This function executes the following processing.
* Stops the timer for timeout measurement.
Note:
Please note that this function is called from <R_JCUA_IsrFinish> and <R_JCUA_IsrStop>.
These may be called from ISR depending on the system.
Customizing Points:
It is NOT necessary to modify this function in general use-case.
But this function is using the OSTM driver for timeout measurement.
If you don't want to use OSTM driver, please modify timeout measurement process.
Parameter:
Unit - Instance number.
Return value:
R_JCUA_ERR_OK - No error has occurred.
R_JCUA_ERR_RANGE_UNIT - Unit number is out of range.
R_JCUA_ERR_FATAL_HW - Fatal error has occurred at H/W.
See <r_jcua_Error_t>.
*/
r_jcua_Error_t R_JCUA_Sys_TimerStop(const uint32_t Unit);
/***************************************************************************
Function: R_JCUA_Sys_TimerPause
Description:
This function suspends timeout measurement (pause).
This function stores the remaining counter until timeout.
This function is called from <R_JCUA_IsrFinish>.
This function executes the following processing.
* Pauses the timer for timeout measurement.
Note:
Please note that this function is called from <R_JCUA_IsrFinish>.
This may be called from ISR depending on the system.
Customizing Points:
It is NOT necessary to modify this function in general use-case.
But this function is using the OSTM driver for timeout measurement.
If you don't want to use OSTM driver, please modify timeout measurement process.
Parameter:
Unit - Instance number.
Return value:
R_JCUA_ERR_OK - No error has occurred.
R_JCUA_ERR_RANGE_UNIT - Unit number is out of range.
R_JCUA_ERR_FATAL_HW - Fatal error has occurred at H/W.
See <r_jcua_Error_t>.
*/
r_jcua_Error_t R_JCUA_Sys_TimerPause(const uint32_t Unit);
/***************************************************************************
Function: R_JCUA_Sys_TimerResume
Description:
This function resumes timeout measurement.
The timeout value is the remaining count value stored at <R_JCUA_Sys_TimerPause>.
This function is called from <R_JCUA_DecoderContinue>.
This function executes the following processing.
* Resumes the timer for timeout measurement.
Customizing Points:
It is NOT necessary to modify this function in general use-case.
But this function is using the OSTM driver for timeout measurement.
If you don't want to use OSTM driver, please modify timeout measurement process.
Parameter:
Unit - Instance number.
Return value:
R_JCUA_ERR_OK - No error has occurred.
R_JCUA_ERR_RANGE_UNIT - Unit number is out of range.
R_JCUA_ERR_FATAL_HW - Fatal error has occurred at H/W.
See <r_jcua_Error_t>.
*/
r_jcua_Error_t R_JCUA_Sys_TimerResume(const uint32_t Unit);
/***************************************************************************
Group: JCUA driver OS interface functions
*/
/***************************************************************************
Function: R_JCUA_Sys_Lock
Description:
This function locks the JCUA driver access to the specified unit from other threads.
This function is called from several JCUA APIs.
This function is empty as default.
Customizing Points:
Please implement the lock process by mutex or semaphore if JCUA API is called from
multi-thread.
Parameter:
Unit - Instance number.
Return value:
R_JCUA_ERR_OK - No error has occurred.
R_JCUA_ERR_RANGE_UNIT - Unit number is out of range.
R_JCUA_ERR_FATAL_OS - Fatal error has occurred at OS interface.
See <r_jcua_Error_t>.
*/
r_jcua_Error_t R_JCUA_Sys_Lock(const uint32_t Unit);
/***************************************************************************
Function: R_JCUA_Sys_Unlock
Description:
This function unlocks the JCUA driver access to the specified unit from other threads.
This function is called from several JCUA APIs.
This function is empty as default.
Customizing Points:
Please implement the unlock process depending on <R_JCUA_Sys_Lock>.
Parameter:
Unit - Instance number.
Return value:
R_JCUA_ERR_OK - No error has occurred.
R_JCUA_ERR_RANGE_UNIT - Unit number is out of range.
R_JCUA_ERR_FATAL_OS - Fatal error has occurred at OS interface.
See <r_jcua_Error_t>.
*/
r_jcua_Error_t R_JCUA_Sys_Unlock(const uint32_t Unit);
#ifdef __cplusplus
}
#endif
#endif /* R_JCUA_SYS_H */