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
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
/*
****************************************************************************
PROJECT : VOWE driver
FILE : $Id: r_vowe_api.h 15479 2018-01-11 14:04:31Z florian.zimmermann $
============================================================================
DESCRIPTION
Driver for the VOWE(Video Output Warping Engine) macro
============================================================================
C O P Y R I G H T
============================================================================
Copyright (c) 2013 - 2014
by
Renesas Electronics (Europe) GmbH.
Arcadiastrasse 10
D-40472 Duesseldorf
Germany
All rights reserved.
============================================================================
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.
****************************************************************************
*/
/***************************************************************************
Title: VOWE Driver API
VOWE (Video Output Warping Engine) driver API
VOWE driver controls VOWE H/W macro and accesses following registers.
* VOWE H/W macro. (D1x UM section 39)
* VOWEMAC & VOWEMMC. (D1x UM section 37.11)
VOWE driver also controls VDCE driver via VOWE support functions.
An application using VOWE driver should include the following header files.
* r_typedefs.h
* r_vowe_api.h
*/
#ifndef R_VOWE_API_H_
#define R_VOWE_API_H_
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
Section: Global defines
*/
/***************************************************************************
Group: Constants
*/
/***************************************************************************
Constants: API Version
This constant is the value which shows the version information of the VOWE driver.
It refers at the <R_VOWE_VersionStringGet> function.
Values:
R_VOWE_VERSION_HI - This constant is the high byte of the version information.
It is major version information.
R_VOWE_VERSION_LO - This constant is the low byte of the version information.
It is miner version information.
High and Low number of the API version
*/
#define R_VOWE_VERSION_HI 1
#define R_VOWE_VERSION_LO 15
/***************************************************************************
Constants: Interrupt Factor
This definition describes the factor of callback.
Values:
R_VOWE_FACTOR_NON - This definition specifies no factor.
R_VOWE_FACTOR_TRA - This definition specifies the TRA occurred. It means that
the warping correction processing was complete.
R_VOWE_FACTOR_IER - This definition specifies the IER occurred. It means that
VOWE H/W macro processed tha invalid display list (DL).
R_VOWE_FACTOR_STOP - This definition specifies the the stop command finished and
the state is in the Idle state.
*/
#define R_VOWE_FACTOR_NON (0x00000000uL)
#define R_VOWE_FACTOR_TRA (0x00000001uL)
#define R_VOWE_FACTOR_IER (0x00000002uL)
#define R_VOWE_FACTOR_STOP (0x00000008uL)
/***************************************************************************
Constants: Pixel size
This definition describes the pixel size.
Values:
R_VOWE_SIZE_OF_ARGB8888 - This definition specifies the pixel size of ARGB8888 format.
R_VOWE_SIZE_OF_RGB565 - This definition specifies the pixel size of RGB565 format.
*/
#define R_VOWE_SIZE_OF_ARGB8888 (4)
#define R_VOWE_SIZE_OF_RGB565 (2)
/***************************************************************************
Section: Global Types
*/
/***************************************************************************
Group: Enumerations and Types
*/
/***************************************************************************
Enum: r_vowe_Error_t
Description:
This type describes the error code of the VOWE driver.
Values:
R_VOWE_ERR_OK - No error has occurred.
R_VOWE_ERR_NG - The error out of the assumption.
R_VOWE_ERR_PARAM_INCORRECT - A parameter provided to a function is incorrect.
( It excludes the outside of the range )
R_VOWE_ERR_RANGE_UNIT - The unit-number error.
R_VOWE_ERR_RANGE_PARAM - The parameter error in the range.
R_VOWE_ERR_NOT_ACCEPTABLE - A function was called in an incorrect state.
R_VOWE_ERR_FATAL_OS - Fatal error has occurred at OS interface.
R_VOWE_ERR_FATAL_HW - Fatal error has occurred at H/W.
R_VOWE_ERR_SYS_VDCE - The error has occurred at the driver support function
of VDCE driver.
R_VOWE_ERR_SYS_INTC - The error has occurred at the driver support function
of INTC (interrupt contoroller).
*/
typedef enum
{
R_VOWE_ERR_OK = 0,
R_VOWE_ERR_NG,
R_VOWE_ERR_PARAM_INCORRECT,
R_VOWE_ERR_RANGE_UNIT,
R_VOWE_ERR_RANGE_PARAM,
R_VOWE_ERR_NOT_ACCEPTABLE,
R_VOWE_ERR_FATAL_OS,
R_VOWE_ERR_FATAL_HW,
R_VOWE_ERR_SYS_VDCE,
R_VOWE_ERR_SYS_INTC
} r_vowe_Error_t;
/***************************************************************************
Typedef: r_vowe_SourceConfig_t
Description:
This type describes the structure of the source image information.
Struct members:
LineStartPos - This member specifies the start position of source image.
In the detail of LineStartPosition, refer to VOWE of H/W manual.
(1 <= LineStartPos <= 1,019)
SourceWidth - This member specifies the source image width (pixel).
(4 <= SourceWidth <= 1,280)
SourceHeight - This member specifies the source image height (pixel).
(5 <= SourceHeight <= 1,024)
*/
typedef struct
{
uint32_t LineStartPos;
uint32_t SourceWidth;
uint32_t SourceHeight;
} r_vowe_SourceConfig_t;
/***************************************************************************
Typedef: r_vowe_DisplayList_t
Description:
This type describes the structure of the display list information.
Struct members:
DspList - This is a pointer to the top address of the display list (DL).
The address must be a multiple of 8 bytes.
Size - This member specifies the size of display list.
*/
typedef struct
{
uint32_t * DspList;
uint32_t Size;
} r_vowe_DisplayList_t;
/***************************************************************************
Enum: r_vowe_BufferMode_t
Description:
This type describes the work buffer mode.
Values:
R_VOWE_FRAME_BUFFER_MODE - This member specifies the frame buffer mode.
If using the WorkBuffferAddr of <r_vowe_DestConfig_t>
as the frame buffer, specify this mode.
R_VOWE_RING_BUFFER_MODE - This member specifies the ring buffer mode.
If using the WorkBuffferAddr of <r_vowe_DestConfig_t>
as the ring buffer, specify this mode.
*/
typedef enum
{
R_VOWE_FRAME_BUFFER_MODE = 0,
R_VOWE_RING_BUFFER_MODE
} r_vowe_BufferMode_t;
/***************************************************************************
Enum: r_vowe_ColorFormat_t
Description:
This type describes the color format.
Values:
R_VOWE_FORMAT_ARGB8888 - This member specifies the ARGB8888 format.
R_VOWE_FORMAT_RGB565 - This member specifies the RGB565 format.
*/
typedef enum
{
R_VOWE_FORMAT_ARGB8888 = 0,
R_VOWE_FORMAT_RGB565
} r_vowe_ColorFormat_t;
/***************************************************************************
Enum: r_vowe_DestMode_t
Description:
This type describes the destination mode.
Values:
R_VOWE_DEST_MODE_NORMAL - This member specifies the NORMAL mode.
R_VOWE_DEST_MODE_SCREEN_SHOTS - This member specifies the SCREEN SHOTS mode.
A distortion image by VOWE is not output to
LCD panel. A distortion image data is only
extracted by the frame buffer.
*/
typedef enum
{
R_VOWE_DEST_MODE_NORMAL = 0,
R_VOWE_DEST_MODE_SCREEN_SHOTS
} r_vowe_DestMode_t;
/***************************************************************************
Typedef: r_vowe_DestConfig_t
Description:
This type describes the structure of the destination buffer settings information.
The application must allocate the work buffer to set to WorkBufferAddr of this structure.
The top address of work buffer must be a multiple of 1024 bytes. Allocate the work buffer
at the following size.
* In case of the frame buffer mode (<R_VOWE_FRAME_BUFFER_MODE>)
(code)
Work buffer size (byte) = stride * source height * pixel size * 2
stride = ((source width + (128 - 1)) / 128) * 128
pixle size:
- R_VOWE_FORMAT_ARGB8888: 4 bytes
- R_VOWE_FORMAT_RGB565: 2 bytes.
(end)
* In case of the ring buffer mode (<R_VOWE_RING_BUFFER_MODE>)
Work buffer size (byte) is 2 exponentiations.
ex) The example with the work buffer size which can be chosen
(code)
: :
256 kbyte : 0x40000
128 kbyte : 0x20000
64 kbyte : 0x10000
32 kbyte : 0x08000
: :
(end)
Struct members:
WorkBufferMode - This member specifeis the work buffer mode. See <r_vowe_BufferMode_t>.
WorkBufferAddr - This is a pointer to the top address of the work buffer.
WorkBufferSize - This member specifies the work buffer size.
ColorFormat - This member specifies the color format of output image.
See <r_vowe_ColorFormat_t>.
DitherMode - This member specifies the dither mode. If this member is setted true (R_TRUE),
dither is ON. If this member is setted false (R_FALSE), dither is OFF.
Note that if ColorFormat is <R_VOWE_FORMAT_ARGB8888>, this member is ignored.
RingBufferDelay - This member specifies the number of output delay lines of VDCE.
Note that if WorkBufferMode is <R_VOWE_FRAME_BUFFER_MODE>, this member
is ignored.
(1 <= RingBufferDelay <= 255)
> Recommended Delay:
> RingBufferDelay = 16 + VerticalScreenTiming->BackPorch + Vertical Distortion Distance
BackPorch is the time after the Sync Pulse.
> Vertical Blanking Pulse:
> ___________
> ____________| |___________
> Front Porch SyncWidth BACK PORCH
DestMode - This member specifies the destination mode.
See <r_vowe_DestMode_t>.
Note:
In addition to the memory area occupied by the work buffer, the next 512 bytes of memory must
be readable by the VDCE H/W. VDCE will neither use or modify the data in this area, so it may
be used by any other purpose.
Please be careful when you assign the work buffer at the end of VRAM, SDRAM or other memory
area.
For details consult the D1x H/W User-manual (section: 38.6.1.2 (6) Restriction).
*/
typedef struct
{
r_vowe_BufferMode_t WorkBufferMode;
uint8_t* WorkBufferAddr;
uint32_t WorkBufferSize;
r_vowe_ColorFormat_t ColorFormat;
uint32_t DitherMode;
uint32_t RingBufferDelay;
r_vowe_DestMode_t DestMode;
} r_vowe_DestConfig_t;
/***************************************************************************
Typedef: r_vowe_CallbackFunction_t
Description:
This type describes to callback function.
and error.
Struct members:
Unit - The parameter specifies the instance number.
Factor - This parameter is the interrupt factor.
CallbackParam - This parameter is the CallbackParam which is specified the <R_VOWE_Open>
function.
*/
typedef void (*r_vowe_CallbackFunction_t)(
const uint32_t Unit,
const uint32_t Factor,
const uint32_t CallbackParam);
/***************************************************************************
Section: Global API functions
*/
/***************************************************************************
Function: R_VOWE_Init
Description:
This function initializes the VOWE driver.
<R_VOWE_Init> function shall be the first call and should be executed only one time
without an intervening <R_VOWE_DeInit> function.
If the function successfully execute, the return code will be <R_VOWE_ERR_OK> and
the state will be in the Initialize state.
Note that this function can't call from interrupt handler.
Parameter:
Unit - The parameter specifies the instance number.
Return value:
R_VOWE_ERR_OK - No error has occurred.
R_VOWE_ERR_RANGE_UNIT - The unit-number error.
R_VOWE_ERR_NOT_ACCEPTABLE - A function was called in an incorrect state.
R_VOWE_ERR_FATAL_OS - Fatal error has occurred at OS interface.
See <r_vowe_Error_t>.
*/
r_vowe_Error_t R_VOWE_Init(const uint32_t Unit);
/***************************************************************************
Function: R_VOWE_DeInit
Description:
This function de-initializes theVOWE driver.
<R_VOWE_DeInit> function should be the last call after all VOWE driver related
resources have been released.
If the function successfully execute, the return code will be <R_VOWE_ERR_OK> and
the state will be in the Uninitialize state.
Note that this function can't call from interrupt handler.
Parameter:
Unit - The parameter specifies the instance number.
Return value:
R_VOWE_ERR_OK - No error has occurred.
R_VOWE_ERR_RANGE_UNIT - The unit-number error.
R_VOWE_ERR_NOT_ACCEPTABLE - A function was called in an incorrect state.
R_VOWE_ERR_FATAL_OS - Fatal error has occurred at OS interface.
See <r_vowe_Error_t>.
*/
r_vowe_Error_t R_VOWE_DeInit(const uint32_t Unit);
/***************************************************************************
Function: R_VOWE_Open
Description:
This function opens the VOWE driver.
This functions sets the source image information, the display list (DL) information,
the destination buffer information and the callback function information.
If the function successfully execute, the return code will be <R_VOWE_ERR_OK> and the
state will be in the Idle state.
Note that this function can't call from interrupt handler.
Parameter:
Unit - The parameter specifies the instance number.
SourceConfig - The parameter specifies the source image information.
See <r_vowe_SourceConfig_t>.
DisplayList - The parameter specifies the display list information.
See <r_vowe_DisplayList_t>.
DestConfig - The parameter specifies the the destination buffer informatiom.
See <r_vowe_DestConfig_t>.
CallbackFunc - This parameter specifies the callback function that will be called when
the warping correction processing is finished or the error occurred.
If the callback function unnecessary, sets NULL (R_NULL).
See <r_vowe_CallbackFunction_t>.
CallbackParam - This parameter specifies the value which is passed the callback function.
Use is freedom of an application layer. If that's unnecessary, set 0.
Return value:
R_VOWE_ERR_OK - No error has occurred.
R_VOWE_ERR_PARAM_INCORRECT - A parameter provided to a function is incorrect.
R_VOWE_ERR_RANGE_UNIT - The unit-number error.
R_VOWE_ERR_NOT_ACCEPTABLE - A function was called in an incorrect state.
R_VOWE_ERR_FATAL_OS - Fatal error has occurred at OS interface.
See <r_vowe_Error_t>.
*/
r_vowe_Error_t R_VOWE_Open(
const uint32_t Unit,
const r_vowe_SourceConfig_t * const SourceConfig,
const r_vowe_DisplayList_t * const DisplayList,
const r_vowe_DestConfig_t * const DestConfig,
const r_vowe_CallbackFunction_t CallbackFunc,
const uint32_t CallbackParam);
/***************************************************************************
Function: R_VOWE_Close
Description:
This function closes the VOWE driver.
If the function successfully execute, the return code will be <R_VOWE_ERR_OK> and the
state will be in the Initialize state.
Note that this function can't call from interrupt handler.
Parameter:
Unit - The parameter specifies the instance number.
Return value:
R_VOWE_ERR_OK - No error has occurred.
R_VOWE_ERR_RANGE_UNIT - The unit-number error.
R_VOWE_ERR_NOT_ACCEPTABLE - A function was called in an incorrect state.
R_VOWE_ERR_FATAL_OS - Fatal error has occurred at OS interface.
See <r_vowe_Error_t>.
*/
r_vowe_Error_t R_VOWE_Close(const uint32_t Unit);
/***************************************************************************
Function: R_VOWE_Start
Description:
This function starts the warping correction.
If the function successfully execute, the return code will be <R_VOWE_ERR_OK> and
the state will be in the Execution state.
Note that this function can't call from interrupt handler.
Parameter:
Unit - The parameter specifies the instance number.
ContinuousMode - The parameter specifies the continuouse mode or one-shot mode.
If ContinuousMode is R_TURE, this driver processes the warping correction
processing every time the VSYNC interrupt occurs. The warping correction
processing is done until the <R_VOWE_Stop> function can be called.
If ContinuousMode is false (R_FALSE), this driver processes the warping correction
processing only once when VSYNC interrupt occurrs and this driver transfers
automatically to the Idle state. It does not need to call the <R_VOWE_Stop>
function.
Return value:
R_VOWE_ERR_OK - No error has occurred.
R_VOWE_ERR_PARAM_INCORRECT - A parameter provided to a function is incorrect.
R_VOWE_ERR_RANGE_UNIT - The unit-number error.
R_VOWE_ERR_NOT_ACCEPTABLE - A function was called in an incorrect state.
R_VOWE_ERR_FATAL_OS - Fatal error has occurred at OS interface.
See <r_vowe_Error_t>.
*/
r_vowe_Error_t R_VOWE_Start(const uint32_t Unit, const uint32_t ContinuousMode);
/***************************************************************************
Function: R_VOWE_Stop
Description:
This function stops the warping correction.
If the function successfully execute, the return code will be <R_VOWE_ERR_OK>. Whrn the warping
correction processing stops, the callback function is called with <R_VOWE_FACTOR_STOP> and
the state is in the Idle state.
Note that this function can't call from interrupt handler.
Note that when a callback function is not called with <R_VOWE_FACTOR_STOP> during
2 VSYNC period after <R_VOWE_Stop> fuction execution, reset a system.
Parameter:
Unit - The parameter specifies the instance number.
Return value:
R_VOWE_ERR_OK - No error has occurred.
R_VOWE_ERR_RANGE_UNIT - The unit-number error.
R_VOWE_ERR_NOT_ACCEPTABLE - A function was called in an incorrect state.
R_VOWE_ERR_FATAL_OS - Fatal error has occurred at OS interface.
See <r_vowe_Error_t>.
*/
r_vowe_Error_t R_VOWE_Stop(const uint32_t Unit);
/***************************************************************************
Function: R_VOWE_DLChange
Description:
This function changes the display list (DL).
If the function successfully execute, the return code will be <R_VOWE_ERR_OK> and
the new display list (DL) is reflected when <R_VOWE_Start> function is called.
Note that this function can't call from interrupt handler.
Parameter:
Unit - The parameter specifies the instance number.
DisplayList - The parameter specifies the information of the display list.
See <r_vowe_DisplayList_t>.
Return value:
R_VOWE_ERR_OK - No error has occurred.
R_VOWE_ERR_PARAM_INCORRECT - A parameter provided to a function is incorrect.
R_VOWE_ERR_RANGE_UNIT - The unit-number error.
R_VOWE_ERR_NOT_ACCEPTABLE - A function was called in an incorrect state.
R_VOWE_ERR_FATAL_OS - Fatal error has occurred at OS interface.
See <r_vowe_Error_t>.
*/
r_vowe_Error_t R_VOWE_DLChange(const uint32_t Unit,
const r_vowe_DisplayList_t * const DisplayList );
/***************************************************************************
Function: R_VOWE_VersionStringGet
Description:
This fucntion returns the version string of this VOWE driver.
Return value:
the version string of this VOWE driver
*/
const uint8_t *R_VOWE_VersionStringGet(void);
/***************************************************************************
Function: R_VOWE_MacroVersionGet
Description:
This function returns the major and minor version of the H/W macro.
Parameter:
Major - This is a pointer to major version.
Minor - This is a pointer to minor version.
Return value:
R_VOWE_ERR_OK - No error has occurred.
R_VOWE_ERR_PARAM_INCORRECT - A parameter provided to a function is incorrect.
R_VOWE_ERR_RANGE_UNIT - The unit-number error.
See <r_vowe_Error_t>.
*/
r_vowe_Error_t R_VOWE_MacroVersionGet(uint32_t *const Major,
uint32_t *const Minor);
/****************************************************************************
Function: R_VOWE_Isr0
Description:
This function is called from ISR (Interrupt Service Routines) and processes
the interrupt factor.
It depends on the CPU which is loaded into the device for ISR.
Parameter:
Unit - The parameter specifies the instance number.
Return value:
None.
*/
void R_VOWE_Isr0(uint32_t Unit);
#ifdef __cplusplus
}
#endif
#endif /* R_VOWE_API_H_ */