//---------------------------------------------------------------------------
//#include <vcl.h>
#include <windows.h>
#include <stdio.h>
#pragma hdrstop
#include "PC_OS.h"
#include "testsuite_dll.h"
#include "dwdptest.h"
#pragma argsused
int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
{
return 1;
}
#define CAPTURED_PICTURE_FILE "c://test.jpg"
#define MAX_SEG_SIZE 128
#define ASSERT(condition) return (condition)?RES_PASS:RES_FAIL;
//#define FILENAME_MAX 1000
#define VRAM_SIZE 128*200*2
#define MAX_SEG_SIZE 128
#define TitleMsg "Display test"
char *(*pDWD_get_last_error)(void);
bool TargetSystem;
bool RunTestCase;
int TestStep;
int TestResult;
char FileName[FILENAME_MAX];
unsigned char vram_buf[VRAM_SIZE];
unsigned char rgb_buf[VRAM_SIZE];
static int LCD_left = 0;
static int LCD_top = 0;
static int LCD_right = 127;
static int LCD_bottom = 100;
static int jpg_size;
bool DLL_Initialise(void* hinst)
{
GetModuleFileName((HINSTANCE)hinst, FileName, FILENAME_MAX);
// Enable this line if a configuration form is included with the testsuite
// Application->CreateForm(__classid(TtemplateTestsuiteConfigurationForm), &templateTestsuiteConfigurationForm);
return true;
}
//---------------------------------------------------------------------------
void DLL_Release()
{
}
//---------------------------------------------------------------------------
void DLL_LocateFunctions(bool OnTarget)
{
TargetSystem = OnTarget;
//pDWD_get_last_error = (char* (*)(void))FindFunction("_DWD_get_last_error");
}
//---------------------------------------------------------------------------
void DLL_TerminateRequested()
{
//StopProcess();
}
//---------------------------------------------------------------------------
int TC_check_camera_id()
{
unsigned int input[255], output[255];
unsigned short len;
unsigned int id;
char buf[50];
input[0]=253; // For camera
len=200 * sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_get_hw_capabilities, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
id=output[len/4-1];
memcpy(buf,idstring[id],sizeof(buf));
//sprintf(buf, "res code=%d, length=%d, id=%d", output[0], len, id);
::MessageBox(NULL,(const char*)buf, "camera id", 0);
ASSERT(output[0] == dwd_ok);
}
int TC_start_preview_cif()
{
unsigned int input[255], output[255];
unsigned short len;
// First switch off display standby
input[0]=0xFA; // hardware id
input[1]=0x2E; // left
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_llc_txi, 8, (unsigned char*)input, &len, (unsigned char*)output, 0);
// Switch display on
input[0]=0xFA; // hardware id
input[1]=0x51; // left
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_llc_txi, 8, (unsigned char*)input, &len, (unsigned char*)output, 0);
// First set image format
input[0]=0x03; // CIF format
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_cam_set_image_format, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
if(output[0] != dwd_ok)
{
return RES_FAIL;
}
// enable preview
input[0]=0xFA; // hardware id
input[1]=LCD_left; // left
input[2]=LCD_top; // top
input[3]=LCD_right; // right
input[4]=LCD_bottom; // bottom
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_cam_enable, 20, (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_start_preview_vga()
{
unsigned int input[255], output[255];
unsigned short len;
#if 0
// First switch off display standby
input[0]=0xFA; // hardware id
input[1]=0x2E; // left
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_llc_txi, 8, (unsigned char*)input, &len, (unsigned char*)output, 0);
// Switch display on
input[0]=0xFA; // hardware id
input[1]=0x51; // left
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_llc_txi, 8, (unsigned char*)input, &len, (unsigned char*)output, 0);
#endif
// First set image format
input[0]=0x00; // VGA format
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_cam_set_image_format, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
if(output[0] != dwd_ok)
{
return RES_FAIL;
}
// enable preview
input[0]=0xFA; // hardware id
input[1]=LCD_left; // left
input[2]=LCD_top; // top
input[3]=LCD_right; // right
input[4]=LCD_bottom; // bottom
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_cam_enable, 20, (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_stop_preview()
{
unsigned int input[255], output[255];
unsigned short len;
input[0]=0xFA;
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_cam_disable, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_capture_picture()
{
unsigned int count;
unsigned int input[255], output[255];
unsigned short len;
FILE *fp;
unsigned long size, i;
char buf[80];
// take snapshot
input[0]=0xFA; // hardware id
len=sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_cam_capture, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
if(output[0] != dwd_ok)
return RES_FAIL;
#if 0
// get picture size
count=1;
while(count < 1000)
{
input[0]=0;
len=8;
DWD_gdd_generic(atctst_gdd_cam_get_picture_size, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
if(output[0] == dwd_ok && output[1] > 0)
{
size=output[1];
sprintf(buf, "size=%d",output[1]);
::MessageBox(NULL,(const char*)buf, "size", 0);
break;
}
count++;
}
if(count == 1000)
{
return RES_FAIL;
}
// Open file
fp=fopen("c://TC_capture_picture.jpg", "wb");
if(fp == NULL)
return RES_FAIL;
// load picture data
for(i=0; i< size;)
{
input[0]=i;
if(i + MAX_SEG_SIZE < size)
{
input[1]=MAX_SEG_SIZE;
}
else
{
input[1]=size - i;
}
len=MAX_SEG_SIZE + 4;
DWD_gdd_generic(305, 8, (unsigned char*)input, &len, (unsigned char*)output, 0);
fwrite(&output[1], 1, input[1], fp);
i+=input[1];
}
fclose(fp);
::MessageBox(NULL,"Capture Finished!", "Message!", 0);
#endif
return RES_PASS;
}
int TC_get_picture_size()
{
unsigned int count;
unsigned int input[255], output[255];
unsigned short len;
FILE *fp;
unsigned long i;
char buf[80];
// get picture size
count=1;
while(count < 1000)
{
input[0]=0;
len=8;
DWD_gdd_generic(atctst_gdd_cam_get_picture_size, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
if(output[0] == dwd_ok && output[1] > 0)
{
jpg_size=output[1];
sprintf(buf, "output[0]=%d, output[1]=%d,output[2]=%d",output[0],output[1],output[2]);
::MessageBox(NULL,(const char*)buf, "size", 0);
break;
}
count++;
}
if(count == 1000)
{
return RES_FAIL;
}
return RES_PASS;
}
int TC_get_picture_data()
{
unsigned int count;
unsigned int input[255], output[255];
unsigned short len;
FILE *fp;
unsigned long i;
char buf[80];
// Open file
fp=fopen("c://TC_capture_picture.jpg", "wb");
if(fp == NULL)
return RES_FAIL;
jpg_size=jpg_size * 2;
// load picture data
for(i=0; i< jpg_size;)
{
input[0]=i;
if(i + MAX_SEG_SIZE < jpg_size)
{
input[1]=MAX_SEG_SIZE;
}
else
{
input[1]=jpg_size - i;
}
len=MAX_SEG_SIZE + 4;
DWD_gdd_generic(305, 8, (unsigned char*)input, &len, (unsigned char*)output, 0);
fwrite(&output[1], 1, input[1], fp);
i+=input[1];
}
fclose(fp);
return RES_PASS;
}
int TC_decode_test()
{
unsigned int count;
unsigned int input[255], output[255];
unsigned short len;
input[0]= 0;
len = 4;
DWD_gdd_generic(306, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
return RES_PASS;
}
int TC_decode_to_lcd()
{
unsigned int count;
unsigned int input[255], output[255];
unsigned short len;
input[0]= 0;
len = 4;
DWD_gdd_generic(307, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
return RES_PASS;
}
#if 0
int TC_read_display_ram()
{
unsigned int count,j;
unsigned int input[255], output[255];
unsigned short len;
FILE *fp;
unsigned long size = 128*160*2, i;
char buf[80];
// Open file
fp=fopen("c://test1.565", "wb");
if(fp == NULL)
return RES_FAIL;
//Read data from memory
for(i=0; i< size;)
{
input[0]=i;
if(i + MAX_SEG_SIZE < size)
{
input[1]=MAX_SEG_SIZE;
}
else
{
input[1]=size - i;
}
len=MAX_SEG_SIZE + 4;
DWD_gdd_generic(303, 8, (unsigned char*)input, &len, (unsigned char*)output, 0);
fwrite(&output[1], 1, input[1], fp);
i+=input[1];
}
fclose(fp);
return RES_PASS;
}
static void convertBMP_RGB24_to_RGB16(unsigned char *vram_out, Graphics::TBitmap *pBitmap)
{
unsigned char *ptr1 = vram_out;
unsigned char *ptr2;
for (int y = 0; y < pBitmap->Height; y++)
{
ptr2 = (unsigned char *)pBitmap->ScanLine[y];
for (int i=0; i < pBitmap->Width; i++)
{
int16 a = ((ptr2[i*3+2]<<8)&0xF800)|((ptr2[i*3+1]<<3)&0x07E0)|((ptr2[i*3]>>3)&0x001F);
memcpy(ptr1,(unsigned char *)&a,2);
ptr1+=2;
}
}
}
static void change_endianess(unsigned char *vram_out, unsigned char *vram_in,unsigned int16 num_pix)
{
unsigned int16 i,pix_hi, pix_low;
unsigned char *vramptr;
vramptr = (unsigned char *)vram_out;
for(i=0;i<num_pix;i++)
{
pix_low= *vram_in;
vram_in++;
pix_hi=*vram_in;
vram_in++;
*vramptr=pix_hi;
vramptr++;
*vramptr=pix_low;
vramptr++;
}
}
static unsigned int min(unsigned int a, unsigned int b)
{
return ( (a < b) ? a : b);
}
static int TC_lcd_test_BMP_image(AnsiString fileName,unsigned int min_width, unsigned int min_height)
{
unsigned int output_width;
unsigned int output_height;
unsigned int startx, starty, size, addroffset, i, j;
unsigned int input[255], output[255];
unsigned short len;
FILE *fp;
char tempstr[50];
//gdd_result_type res;
TPixelFormat format;
int result = RES_PASS;
Graphics::TBitmap *Bitmap1 = new Graphics::TBitmap();
if (FileExists(fileName))
{
Bitmap1->LoadFromFile(fileName);
output_width = min_width;
output_height = min(min_height,Bitmap1->Height);
memset(vram_buf, 0x00, sizeof(vram_buf));
if (Bitmap1->Width!= min_width)
{
::MessageBox(NULL,"Width should be equal 128", TitleMsg, 0);
Bitmap1->ReleaseHandle();
delete Bitmap1;
return RES_FAIL;
}
if (Bitmap1->PixelFormat != pf24bit)
{
//AddLogLine(clBlack, LOG_LEVEL_1, "IMAGE Is not BMP 24 BIT!!!...");
result = RES_FAIL;
}
else
{
convertBMP_RGB24_to_RGB16(vram_buf,Bitmap1);
change_endianess(rgb_buf,vram_buf,output_width*output_height); //not Change endian
// show RGB on target
// AddLogLine(clBlack, LOG_LEVEL_1, "Sending RGB to target...");
startx = 0;
starty = 0;
addroffset = 0;
for (i=0; i<output_width*output_height*2/MAX_SEG_SIZE;i++)
{
input[0]=startx;
input[1]=starty;
input[2]=addroffset;
input[3]=MAX_SEG_SIZE;
// for (j=0;j<32;j++)
// input[j+4]= 0x1F001F00;
memcpy((char *)(void *)(input+4), rgb_buf+addroffset, MAX_SEG_SIZE);
// memcpy((char *)(void *)(input+4), vram_buf+addroffset, MAX_SEG_SIZE); //not Change endian
//sprintf(tempstr, "startx=%d, starty=%d", startx, starty);
// ::MessageBox(NULL,tempstr, "display testsuite", 0);
len = 4;
DWD_gdd_generic(300, MAX_SEG_SIZE+4*4, (unsigned char*)input, &len, (unsigned char*)output, 0);
if (output[0] != dwd_ok)
break;
if (startx==0)
startx = startx + MAX_SEG_SIZE/2;
else
startx = 0;
if (startx==0)
starty++;
addroffset = addroffset + MAX_SEG_SIZE;
} // for (i=0; i<output_width*output_height*2/MAX_SEG_SIZE;i++)
//When transfer is finished, then notify mobile phone to update data
input[0]=output_width - 1;
input[1]=output_height - 1;
//input[1]=1 - 1;
input[2]=0;
input[3]=0;
DWD_gdd_generic(300, 4*4, (unsigned char*)input, &len, (unsigned char*)output, 0);
} //else
} //if (Bitmap1->PixelFormat != pf24bit)
else
{
//AddLogLine(clBlack, LOG_LEVEL_1, "Cannot open file!!!...");
result = RES_FAIL;
}
Bitmap1->ReleaseHandle();
delete Bitmap1;
return result;
}
int TC_show_bitmap_file()
{
AnsiString BitMap;
//gdd_result_type res;
TPixelFormat format;
int result = RES_PASS;
Dialogs::TOpenDialog *OpenDialog1 = new Dialogs::TOpenDialog(NULL);
OpenDialog1->Filter = "BMP files (*.bmp)|*.bmp";
if (OpenDialog1->Execute())
{
if (FileExists(OpenDialog1->FileName))
BitMap = OpenDialog1->FileName;
if (BitMap.IsEmpty())
{
result = RES_FAIL;
}
else
{
TC_lcd_test_BMP_image(BitMap.c_str(),128,160);
}
}
delete OpenDialog1;
return result;
}
#endif
int TC_display_id()
{
unsigned int input[255], output[255];
unsigned short len;
unsigned int id;
char buf[250];
input[0]=250;
len=200 * sizeof(unsigned int);
DWD_gdd_generic(atctst_gdd_get_hw_capabilities, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
id=output[10];
memcpy(buf,idstring[id],sizeof(buf));
::MessageBox(NULL,(const char*)buf, "display id", 0);
ASSERT(output[0] == dwd_ok);
}
int TC_set_contrast_100()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 100;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_contrast, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_set_contrast_120()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 120;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_contrast, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_set_contrast_144()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 144;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_contrast, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_set_contrast_166()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 166;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_contrast, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_set_contrast_180()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 180;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_contrast, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_set_contrast_200()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 200;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_contrast, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_set_contrast_220()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 220;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_contrast, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_set_contrast_240()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 240;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_contrast, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_set_contrast_255()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 255;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_contrast, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_init()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 250;//hw_id;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_init, sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_reinit()
{
unsigned int input[255], output[255];
unsigned short len;
input[0]=1; //start
len = 4;
DWD_gdd_generic(301, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_stop_reinit()
{
unsigned int input[255], output[255];
unsigned short len;
input[0]=0; //stop
len = 4;
DWD_gdd_generic(301, 4, (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_standby_on()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 250;//hw_id;
input[1] = 0;//hw_id;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_power_save_mode, 2*sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_standby_off()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 250;//hw_id;
input[1] = 1;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_power_save_mode, 2*sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_standby_on_off()
{
unsigned int input[255], output[255];
unsigned short len;
int dll_handle = 0;
DWD_lcd_backlight_init(dll_handle);
for (int i=0; i<50;i++)
{
input[0] = 250;//hw_id;
input[1] = 0; //standby on
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_power_save_mode, 2*sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
if (output[0]!=dwd_ok)
{
return RES_FAIL;
}
DWD_set_lcd_backlight(0, 0, FALSE, 0,dll_handle);
Sleep(2000);
input[0] = 250;//hw_id;
input[1] = 1; //standby off
len=0;
DWD_gdd_generic(atctst_gdd_lcd_set_power_save_mode, 2*sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
if (output[0]!=dwd_ok)
{
return RES_FAIL;
}
//Sleep(100);
DWD_set_lcd_backlight(0, 1, FALSE, 250,dll_handle);
Sleep(2000);
}
return RES_PASS;
}
int TC_backlight_on_off()
{
int dll_handle = 0;
DWD_lcd_backlight_init(dll_handle);
for (int i=0; i<50;i++)
{
DWD_set_lcd_backlight(0, 1, FALSE, 250,dll_handle);
Sleep(2000);
DWD_set_lcd_backlight(0, 0, FALSE, 0,dll_handle);
Sleep(2000);
}
return RES_PASS;
}
int TC_shutdown()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 250;//hw_id;
len=0;
DWD_gdd_generic(atctst_gdd_lcd_shutdown, sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_display_backlight_on_50()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_lcd_backlight_init(dll_handle))
DWD_set_lcd_backlight(0, // lcd_tp (0=MAIN)
1, // action (0=OFF, 1=ON)
FALSE, // fade
50, // intensity
dll_handle);
return result;
}
int TC_display_backlight_on_100()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_lcd_backlight_init(dll_handle))
DWD_set_lcd_backlight(0, // lcd_tp (0=MAIN)
1, // action (0=OFF, 1=ON)
FALSE, // fade
100, // intensity
dll_handle);
return result;
}
int TC_display_backlight_on_150()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_lcd_backlight_init(dll_handle))
DWD_set_lcd_backlight(0, // lcd_tp (0=MAIN)
1, // action (0=OFF, 1=ON)
FALSE, // fade
150, // intensity
dll_handle);
return result;
}
int TC_display_backlight_on_200()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_lcd_backlight_init(dll_handle))
DWD_set_lcd_backlight(0, // lcd_tp (0=MAIN)
1, // action (0=OFF, 1=ON)
FALSE, // fade
200, // intensity
dll_handle);
return result;
}
int TC_display_backlight_on_250()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_lcd_backlight_init(dll_handle))
DWD_set_lcd_backlight(0, // lcd_tp (0=MAIN)
1, // action (0=OFF, 1=ON)
FALSE, // fade
250, // intensity
dll_handle);
return result;
}
int TC_display_backlight_CONTINUOUS_on_250()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_lcd_backlight_init(dll_handle))
DWD_set_lcd_backlight(0, // lcd_tp (0=MAIN)
2, // action (2 CONTINUOUS on)
FALSE, // fade
250, // intensity
dll_handle);
return result;
}
int TC_display_backlight_off()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_lcd_backlight_init(dll_handle))
DWD_set_lcd_backlight(0, // lcd_tp (0=MAIN)
0, // action (0=OFF, 1=ON)
FALSE, // fade
0, // intensity
dll_handle);
return result;
}
int TC_key_backlight_on_50()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_keypad_backlight_init(dll_handle))
DWD_set_keypad_backlight(1,FALSE,50,dll_handle);
return result;
}
int TC_key_backlight_on_100()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_keypad_backlight_init(dll_handle))
DWD_set_keypad_backlight(1,FALSE,100,dll_handle);
return result;
}
int TC_key_backlight_on_150()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_keypad_backlight_init(dll_handle))
DWD_set_keypad_backlight(1,FALSE,150,dll_handle);
return result;
}
int TC_key_backlight_on_200()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_keypad_backlight_init(dll_handle))
DWD_set_keypad_backlight(1,FALSE,200,dll_handle);
return result;
}
int TC_key_backlight_on_250()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_keypad_backlight_init(dll_handle))
DWD_set_keypad_backlight(1,FALSE,250,dll_handle);
return result;
}
int TC_key_backlight_off()
{
int dll_handle = 0;
int result = RES_PASS;
if (DWD_keypad_backlight_init(dll_handle))
DWD_set_keypad_backlight(0,FALSE,0,dll_handle);
return result;
}
int TC_cam_set_zoom_1()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 1;
len=4;
DWD_gdd_generic(304, 1 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_cam_set_zoom_2()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 2;
len=4;
DWD_gdd_generic(304, 1 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_cam_set_zoom_3()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 3;
len=4;
DWD_gdd_generic(304, 1 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_cam_set_zoom_4()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 4;
len=4;
DWD_gdd_generic(304, 1 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_cam_set_zoom_5()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 5;
len=4;
DWD_gdd_generic(304, 1 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_cam_set_image_fmt_premium()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 0;
len=4;
LCD_left = 0;
LCD_top = 30;
LCD_right = 127;
LCD_bottom = 125;
DWD_gdd_generic(atctst_gdd_cam_set_image_format, 1 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_cam_set_image_fmt_high()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 1;
len=4;
LCD_left = 0;
LCD_top = 30;
LCD_right = 127;
LCD_bottom = 125;
DWD_gdd_generic(atctst_gdd_cam_set_image_format, 1 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_cam_set_image_fmt_medium()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 2;
len=4;
LCD_left = 0;
LCD_top = 30;
LCD_right = 127;
LCD_bottom = 99;
DWD_gdd_generic(atctst_gdd_cam_set_image_format, 1 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_cam_set_image_fmt_wallpaper()
{
unsigned int input[255], output[255];
unsigned short len;
input[0] = 3;
len=4;
LCD_left = 32;
LCD_top = 30;
LCD_right = 95;
LCD_bottom = 109;
DWD_gdd_generic(atctst_gdd_cam_set_image_format, 1 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_test_pattern_1()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 1;
len=4;
DWD_gdd_generic(atctst_gdd_lcd_test_image_start, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_test_pattern_3()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 3;
len=4;
DWD_gdd_generic(atctst_gdd_lcd_test_image_start, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_test_pattern_4()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 4;
len=4;
DWD_gdd_generic(atctst_gdd_lcd_test_image_start, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_test_pattern_8()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 8;
len=4;
DWD_gdd_generic(atctst_gdd_lcd_test_image_start, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_test_pattern_9()
{
unsigned int input[255], output[255];
unsigned short len;
// unsigned int id;
// char buf[80];
input[0] = 250;//hw_id;
input[1] = 9;
len=4;
DWD_gdd_generic(atctst_gdd_lcd_test_image_start, 2 * sizeof(int32), (unsigned char*)input, &len, (unsigned char*)output, 0);
ASSERT(output[0] == dwd_ok);
}
int TC_power_down_0()
{
int result = DWD_set_power_down_mode(0, 109, 0);
if (result==TRUE)
return RES_PASS;
else
return RES_FAIL;
}
int TC_power_down_1()
{
int result = DWD_set_power_down_mode(1, 109, 0);
if (result==TRUE)
return RES_PASS;
else
return RES_FAIL;
}
int TC_in_line_mode()
{
int result = DWD_set_test_mode(dwd_in_line_mode, 0, 0);
if (result==TRUE)
return RES_PASS;
else
return RES_FAIL;
}
int TC_calib_mode()
{
int result = DWD_set_test_mode(dwd_calib_mode, 0, 0);
if (result==TRUE)
return RES_PASS;
else
return RES_FAIL;
}
int TC_mmi_mode()
{
int result = DWD_set_test_mode(dwd_mmi_mode, 0, 0);
if (result==TRUE)
return RES_PASS;
else
return RES_FAIL;
}
int TC_get_eep_value()
{
int data;
char temp[20];
int result = DWD_get_dynamic_parm_xx("eep_static.lcd_parms.contrast_ctrl_reg",2, (void *)&data, 0);
sprintf(temp, "%d", data);
::MessageBox(NULL,(const char*)temp, "eep value", 0);
if (result==TRUE)
return RES_PASS;
else
return RES_FAIL;
}
void AddTestCases(void)
{
AddTestSuite("Display test", NULL);
AddTestCase("Display id", NULL, "");
AddTestCase("Display id", TC_display_id, "TC_display_id");
AddTestCase("Contrast test", NULL, "");
AddTestCase("Set_contrast_100", TC_set_contrast_100, "TC_set_contrast_100");
AddTestCase("Set_contrast_120", TC_set_contrast_120, "TC_set_contrast_120");
AddTestCase("Set_contrast_144", TC_set_contrast_144, "TC_set_contrast_144");
AddTestCase("Set_contrast_166", TC_set_contrast_166, "TC_set_contrast_166");
AddTestCase("Set_contrast_180", TC_set_contrast_180, "TC_set_contrast_180");
AddTestCase("Set_contrast_200", TC_set_contrast_200, "TC_set_contrast_200");
AddTestCase("Set_contrast_220", TC_set_contrast_220, "TC_set_contrast_220");
AddTestCase("Set_contrast_240", TC_set_contrast_240, "TC_set_contrast_240");
AddTestCase("Set_contrast_255", TC_set_contrast_255, "TC_set_contrast_255");
AddTestCase("Sequence test", NULL, "");
AddTestCase("Init", TC_init, "TC_init");
AddTestCase("ReInit", TC_reinit, "TC_reinit");
AddTestCase("Stop ReInit", TC_stop_reinit, "TC_stop_reinit");
//AddTestCase("Display on", TC_display_on, "TC_display_on");
//AddTestCase("Display off", TC_display_off, "TC_display_off");
AddTestCase("Standby on", TC_standby_on, "TC_standby_on");
AddTestCase("Standby off", TC_standby_off, "TC_standby_off");
AddTestCase("Shut down", TC_shutdown, "TC_shutdown");
AddTestCase("Test standby on off", TC_standby_on_off, "TC_standby_on_off");
AddTestCase("Test backlight on off", TC_backlight_on_off, "TC_backlight_on_off");
AddTestCase("Test pattern", NULL, "");
AddTestCase("Test pattern 1", TC_test_pattern_1, "TC_test_pattern_1");
AddTestCase("Test pattern 3", TC_test_pattern_3, "TC_test_pattern_3");
AddTestCase("Test pattern 4", TC_test_pattern_4, "TC_test_pattern_4");
AddTestCase("Test pattern 8", TC_test_pattern_8, "TC_test_pattern_8");
AddTestCase("Test pattern 9", TC_test_pattern_9, "TC_test_pattern_9");
#if 0
AddTestCase("Data transfer", NULL, "");
AddTestCase("Read_display_ram", TC_read_display_ram, "TC_read_display_ram");
AddTestCase("Show_bitmap_file", TC_show_bitmap_file, "TC_show_bitmap_file");
AddTestCase("Get eep value", TC_get_eep_value, "TC_get_eep_value");
#endif
AddTestSuite("Camera test", NULL);
AddTestCase("Camera test", NULL, "");
AddTestCase("Check camera id", TC_check_camera_id, "TC_check_camera_id");
AddTestCase("Start preview mode CIF", TC_start_preview_cif, "TC_start_preview_cif");
AddTestCase("Start preview mode VGA", TC_start_preview_vga, "TC_start_preview_vga");
AddTestCase("Stop preview mode", TC_stop_preview, "TC_stop_preview");
AddTestCase("Capture picture", TC_capture_picture, "TC_capture_picture");
AddTestCase("Get picture size", TC_get_picture_size, "TC_get_picture_size");
AddTestCase("Get picture data", TC_get_picture_data, "TC_get_picture_data");
AddTestCase("Decode raw data to LCD", TC_decode_test, "TC_decode_test");
AddTestCase("Decode camera data to LCD", TC_decode_test, "TC_decode_to_lcd");
AddTestCase("Image Format", NULL, "");
AddTestCase("Premium", TC_cam_set_image_fmt_premium, "TC_cam_set_image_fmt_premium");
AddTestCase("High", TC_cam_set_image_fmt_high, "TC_cam_set_image_fmt_high");
AddTestCase("Medium", TC_cam_set_image_fmt_medium, "TC_cam_set_image_fmt_medium");
AddTestCase("Wallpaper", TC_cam_set_image_fmt_wallpaper, "TC_cam_set_image_fmt_wallpaper");
AddTestCase("Zoom", NULL, "");
AddTestCase("Set Zoom Level 1", TC_cam_set_zoom_1, "TC_cam_set_zoom_1");
AddTestCase("Set Zoom Level 2", TC_cam_set_zoom_2, "TC_cam_set_zoom_2");
AddTestCase("Set Zoom Level 3", TC_cam_set_zoom_3, "TC_cam_set_zoom_3");
AddTestCase("Set Zoom Level 4", TC_cam_set_zoom_4, "TC_cam_set_zoom_4");
AddTestCase("Set Zoom Level 5", TC_cam_set_zoom_5, "TC_cam_set_zoom_5");
AddTestSuite("Backlight", NULL);
AddTestCase("Display backlight", NULL, "");
AddTestCase("Display backlight on 50", TC_display_backlight_on_50, "TC_display_backlight_on_50");
AddTestCase("Display backlight on 100", TC_display_backlight_on_100, "TC_display_backlight_on_100");
AddTestCase("Display backlight on 150", TC_display_backlight_on_150, "TC_display_backlight_on_150");
AddTestCase("Display backlight on 200", TC_display_backlight_on_200, "TC_display_backlight_on_200");
AddTestCase("Display backlight on 250", TC_display_backlight_on_250, "TC_display_backlight_on_250");
AddTestCase("Display backlight CONTINUOUS on 250", TC_display_backlight_on_250, "TC_display_backlight_CONTINUOUS_on_250");
AddTestCase("Display backlight off", TC_display_backlight_off, "TC_display_backlight_off");
AddTestCase("Key backlight", NULL, "");
AddTestCase("Key backlight on 50", TC_key_backlight_on_50, "TC_key_backlight_on_50");
AddTestCase("Key backlight on 100", TC_key_backlight_on_100, "TC_key_backlight_on_100");
AddTestCase("Key backlight on 150", TC_key_backlight_on_150, "TC_key_backlight_on_150");
AddTestCase("Key backlight on 200", TC_key_backlight_on_200, "TC_key_backlight_on_200");
AddTestCase("Key backlight on 250", TC_key_backlight_on_250, "TC_key_backlight_on_250");
AddTestCase("Key backlight off", TC_key_backlight_off, "TC_key_backlight_off");
AddTestSuite("System test", NULL);
AddTestCase("Power down", NULL, "");
AddTestCase("Power down--restore non-signalling operation", TC_power_down_0, "TC_power_down_0");
AddTestCase("Power down--power off after command", TC_power_down_1, "TC_power_down_1");
AddTestCase("Test mode", NULL, "");
AddTestCase("In line mode", TC_in_line_mode, "TC_in_line_mode");
AddTestCase("Calib mode", TC_calib_mode, "TC_calib_mode");
AddTestCase("MMI mode", TC_mmi_mode, "TC_mmi_mode");
}
void Pre_Run_TC(void)
{
TestStep = 0;
RunTestCase = true;
TestResult = RES_INCONCLUSIVE;
}
void Post_Run_TC(void)
{
RunTestCase = false;
}
void Stop_Run_TC(void)
{
RunTestCase = false;
}
int GetVersionNumber()
{
return VERSION;
}
char *GetModuleName()
{
return MODULE_NAME;
}
char *GetGenericFunctionName()
{
return GENERIC_FUNCTION_NAME;
}
// If this function is exported, then the TestSystem will show a menu item to active the configuration form.
bool TS_Configuration(void)
{
// do nothing
return true;
}
// Functions used to communicate with the system being tested
// Function for adding configuration data to Report
void LogConfigData(void)
{
// do nothing
}
//---------------------------------------------------------------------------