1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/testyuv.c Mon Jan 15 08:30:50 2007 +0000
1.5 + * $Id: testyuv.c,v 1.1 2007-01-15 08:30:50 nkeynes Exp $
1.7 + * Renderer test cases
1.9 + * Copyright (c) 2006 Nathan Keynes.
1.11 + * This program is free software; you can redistribute it and/or modify
1.12 + * it under the terms of the GNU General Public License as published by
1.13 + * the Free Software Foundation; either version 2 of the License, or
1.14 + * (at your option) any later version.
1.16 + * This program is distributed in the hope that it will be useful,
1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 + * GNU General Public License for more details.
1.23 +#include "testdata.h"
1.28 +#define PVR_BASE 0xA05F8000
1.29 +#define PVR_RESET (PVR_BASE+0x008)
1.30 +#define YUV_ADDR (PVR_BASE+0x148)
1.31 +#define YUV_CONFIG (PVR_BASE+0x14C)
1.32 +#define YUV_STATUS (PVR_BASE+0x150)
1.33 +#define DISPLAY_MODE (PVR_BASE+0x044)
1.34 +#define DISPLAY_ADDR1 (PVR_BASE+0x050)
1.35 +#define DISPLAY_ADDR2 (PVR_BASE+0x054)
1.36 +#define DISPLAY_SIZE (PVR_BASE+0x05C)
1.47 +} test_yuv_poly = { { 0x8084000A, 0xE0000000, 0x2083242D, 0, 0, 0, 0, 0 },
1.48 + { { 0xE0000000, 0.0, 0.0, 0.2, 0.0, 0.0, 0xFFFFFFFF, 0 },
1.49 + { 0xE0000000, 640.0, 0.0, 0.2, 0.625, 0.0, 0xFFFFFFFF, 0 },
1.50 + { 0xE0000000, 0.0, 480.0, 0.2, 0.0, 0.9375, 0xFFFFFFFF, 0 },
1.51 + { 0xF0000000, 640.0, 480.0, 0.2, 0.625, 0.9375, 0xFFFFFFFF, 0 } },
1.52 + { 0,0,0,0,0,0,0,0 } };
1.54 +int test_yuv( test_data_t test_case )
1.58 + char *p = DMA_ALIGN(&tabuf);
1.61 + test_data_block_t input = get_test_data(test_case, "input");
1.62 + if( input == NULL ) {
1.63 + fprintf( stderr, "Skipping test '%s' - no input\n", test_case->test_name );
1.67 + memset( (void *)(0xA5000000), 0xFE, 512000 );
1.72 + fprintf( stdout, "Writing %d bytes\n", input->length );
1.73 + long_write( YUV_CONFIG, 0x00001D14 );
1.74 + long_write( YUV_ADDR, 0x00000000 );
1.76 + uint32_t status1 = long_read( YUV_STATUS );
1.77 + if( pvr_dma_write( 0x10800000, input->data, input->length, 0 ) != 0 ) {
1.80 + uint32_t timeus = timer_gettime_us();
1.81 + uint32_t status2 = long_read( YUV_STATUS );
1.83 + /* Render the thing */
1.84 + memcpy( p, &test_yuv_poly, sizeof(test_yuv_poly) );
1.85 + if( pvr_dma_write( 0x10000000, p, sizeof(test_yuv_poly) ) != 0 ) {
1.92 +int main( int argc, char *argv[] )
1.94 + int test_cases = 0;
1.95 + int test_failures = 0;
1.96 + test_data_t test_data = load_test_dataset(stdin);
1.97 + test_data_t test_case = test_data;
1.102 + while( test_case != NULL ) {
1.104 + int result = test_yuv(test_case);
1.105 + if( result != 0 ) {
1.108 + test_case = test_case->next;
1.110 + free_test_dataset(test_data);
1.111 + if( test_failures != 0 ) {
1.112 + fprintf( stderr, "%d/%d test failures!\n", test_failures, test_cases );
1.115 + fprintf( stderr, "%d tests OK\n", test_cases );