2 * $Id: testyuv.c,v 1.1 2007-01-15 08:30:50 nkeynes Exp $
6 * Copyright (c) 2006 Nathan Keynes.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
25 #define PVR_BASE 0xA05F8000
26 #define PVR_RESET (PVR_BASE+0x008)
27 #define YUV_ADDR (PVR_BASE+0x148)
28 #define YUV_CONFIG (PVR_BASE+0x14C)
29 #define YUV_STATUS (PVR_BASE+0x150)
30 #define DISPLAY_MODE (PVR_BASE+0x044)
31 #define DISPLAY_ADDR1 (PVR_BASE+0x050)
32 #define DISPLAY_ADDR2 (PVR_BASE+0x054)
33 #define DISPLAY_SIZE (PVR_BASE+0x05C)
44 } test_yuv_poly = { { 0x8084000A, 0xE0000000, 0x2083242D, 0, 0, 0, 0, 0 },
45 { { 0xE0000000, 0.0, 0.0, 0.2, 0.0, 0.0, 0xFFFFFFFF, 0 },
46 { 0xE0000000, 640.0, 0.0, 0.2, 0.625, 0.0, 0xFFFFFFFF, 0 },
47 { 0xE0000000, 0.0, 480.0, 0.2, 0.0, 0.9375, 0xFFFFFFFF, 0 },
48 { 0xF0000000, 640.0, 480.0, 0.2, 0.625, 0.9375, 0xFFFFFFFF, 0 } },
49 { 0,0,0,0,0,0,0,0 } };
51 int test_yuv( test_data_t test_case )
55 char *p = DMA_ALIGN(&tabuf);
58 test_data_block_t input = get_test_data(test_case, "input");
60 fprintf( stderr, "Skipping test '%s' - no input\n", test_case->test_name );
64 memset( (void *)(0xA5000000), 0xFE, 512000 );
69 fprintf( stdout, "Writing %d bytes\n", input->length );
70 long_write( YUV_CONFIG, 0x00001D14 );
71 long_write( YUV_ADDR, 0x00000000 );
73 uint32_t status1 = long_read( YUV_STATUS );
74 if( pvr_dma_write( 0x10800000, input->data, input->length, 0 ) != 0 ) {
77 uint32_t timeus = timer_gettime_us();
78 uint32_t status2 = long_read( YUV_STATUS );
80 /* Render the thing */
81 memcpy( p, &test_yuv_poly, sizeof(test_yuv_poly) );
82 if( pvr_dma_write( 0x10000000, p, sizeof(test_yuv_poly) ) != 0 ) {
89 int main( int argc, char *argv[] )
92 int test_failures = 0;
93 test_data_t test_data = load_test_dataset(stdin);
94 test_data_t test_case = test_data;
99 while( test_case != NULL ) {
101 int result = test_yuv(test_case);
105 test_case = test_case->next;
107 free_test_dataset(test_data);
108 if( test_failures != 0 ) {
109 fprintf( stderr, "%d/%d test failures!\n", test_failures, test_cases );
112 fprintf( stderr, "%d tests OK\n", test_cases );
.