IO Device:F75113 under Linux(32bit & 64bit)

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
Line 24: Line 24:
5. WDT is not run because MB not have F75113 and WDT_RST-
5. WDT is not run because MB not have F75113 and WDT_RST-
-
== How to compile code ==
 
- 
-
If the next picture appears
 
- 
-
[[Image:t3.jpg]]
 
- 
-
MB no LPC or the drive placement is wrong
 
- 
-
Drive the location for the next picture
 
- 
-
[[Image:F75113v2.0folder.jpg]]
 
== F75113 GPIO Picture ==
== F75113 GPIO Picture ==
Line 43: Line 32:
=== GPIO Status Register Write ===
=== GPIO Status Register Write ===
-
SETINT2PROC ProcAdd;
+
init_fintek_sio(eSIO_TYPE_F81866, 0 ,&sio_data)
-
char *endptr;
+
ActiveSIO(sio_data.ic_port, sio_data.key);
-
char Numbers[] = "0x20";
+
CHECK_RET(_EnableGPIO(0x06 , eGPIO_Mode_Enable));
-
char Value[] = "0xF0";
+
CHECK_RET(_SetGpioOutputEnableIdx( 0x06 , eGPIO_Direction_Out));
-
ProcAdd = (SETINT2PROC) GetProcAddress(hinstLib, "GPIO_LPC_W");
+
CHECK_RET(_SetGpioDriveEnable( 0x06 , eGPIO_Drive_Mode_OpenDrain));
-
if (NULL != ProcAdd)
+
CHECK_RET(_SetGpioOutputDataIdx( 0x06 , 1));
-
{
+
DeactiveSIO(sio_data.ic_port);
-
if (! (*ProcAdd)( strtol(Numbers, &endptr, 16), strtol(Value, &endptr, 16)))
+
-
{
+
-
ShowMessage("Write Fail");
+
-
}
+
-
}
+
=== GPIO Status Register Read ===
=== GPIO Status Register Read ===
-
GETINT2PROC ProcAdd1;
+
init_fintek_sio(eSIO_TYPE_F81866, 0 ,&sio_data)
-
int datatest;
+
ActiveSIO(sio_data.ic_port, sio_data.key);
-
char NRtest[] = "0x22";
+
CHECK_RET(_EnableGPIO(0x06 , eGPIO_Mode_Enable));
-
ProcAdd1 = (GETINT2PROC) GetProcAddress(hinstLib, "GPIO_LPC_R");
+
CHECK_RET(_SetGpioOutputEnableIdx( 0x06 , eGPIO_Direction_In));
-
if (NULL != ProcAdd1)
+
CHECK_RET(_GetGpioInputDataIdx( 0x06 , &data));
-
{
+
DeactiveSIO(sio_data.ic_port);
-
if (! (*ProcAdd1)( strtol(NRtest, &endptr, 16), &datatest))
+
-
{
+
-
ShowMessage("Read Fail");
+
-
}
+
-
}
+
=== GPIO Comparison ===
=== GPIO Comparison ===
-
 
+
-
+
CHECK_RET(_GetGpioInputDataIdx (0x10,&BDIO_data));
-
if( data == 0xF0 )
+
if((BDIO_data == 1) & (BDIO_startvalue_data == 0) )
{
{
-
((CStatic *)GetDlgItem(IDC_LED_DO0))->SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_Green)));
+
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton2), TRUE);
-
((CStatic *)GetDlgItem(IDC_LED_DO1))->SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_Green)));
+
-
((CStatic *)GetDlgItem(IDC_LED_DO2))->SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_Green)));
+
-
((CStatic *)GetDlgItem(IDC_LED_DO3))->SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_Green)));
+
-
if( data2 == 0x01 )
+
-
{
+
-
((CStatic *)GetDlgItem(IDC_LED_DI0))->SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_Green)));
+
-
((CStatic *)GetDlgItem(IDC_LED_DI1))->SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_Red)));
+
-
((CStatic *)GetDlgItem(IDC_LED_DI2))->SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_Red)));
+
-
((CStatic *)GetDlgItem(IDC_LED_DI4))->SetBitmap(::LoadBitmap(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_BITMAP_Red)));
+
-
}
+
-
.....
+
}
}
 +
 +
=== F75113 driver delete ===
=== F75113 driver delete ===
-
char N9[] = "0x10";
+
on_window1_destory (GtKObject *object,
-
char V9[] = "0x00";
+
gpointer user_data)
-
ProcAdd = (SETINT2PROC) GetProcAddress(hinstLib, "GPIO_LPC_W");
+
{
-
if (NULL != ProcAdd)
+
sFintek_sio_data sio_data;
-
{
+
DeactiveSIO(sio_data.ic_port);
-
if (! (*ProcAdd)( strtol(N9, &endptr, 16), strtol(V9, &endptr, 16)))
+
gtk_main_quit();
-
{
+
}
-
ShowMessage("Write Fail");
+
-
}
+
-
}
+
-
if (hinstLib != NULL)
+
-
{
+
-
FreeLibrary(hinstLib);
+
-
}
+

Revision as of 17:14, 18 September 2017

Contents

The Sample code source you can download from

Source file: F75113v2.0_src.rar

Binary file: F75113v2.0_bin_x86.rar

Binary file: F75113v2.0_bin_x64.rar

We do the demo test with a test tool which DIx connect to DOx with Relay. 

How to use this Demo Application

Image:F75113_linux.jpg

1. Press the "Start" button to test CIO1 function

2. Press the "Start" button to test CIO2 function

3. Press the "Start" button to test CIO3 function

4. Press the "Start" button to test CIO4 function

5. WDT is not run because MB not have F75113 and WDT_RST-

F75113 GPIO Picture

Image:t5.jpg

Introduction

GPIO Status Register Write

init_fintek_sio(eSIO_TYPE_F81866, 0 ,&sio_data)
ActiveSIO(sio_data.ic_port, sio_data.key);
CHECK_RET(_EnableGPIO(0x06 , eGPIO_Mode_Enable));
CHECK_RET(_SetGpioOutputEnableIdx( 0x06 , eGPIO_Direction_Out));
CHECK_RET(_SetGpioDriveEnable( 0x06 , eGPIO_Drive_Mode_OpenDrain));
CHECK_RET(_SetGpioOutputDataIdx( 0x06 , 1));
DeactiveSIO(sio_data.ic_port);

GPIO Status Register Read

init_fintek_sio(eSIO_TYPE_F81866, 0 ,&sio_data)
ActiveSIO(sio_data.ic_port, sio_data.key);
CHECK_RET(_EnableGPIO(0x06 , eGPIO_Mode_Enable));
CHECK_RET(_SetGpioOutputEnableIdx( 0x06 , eGPIO_Direction_In));
CHECK_RET(_GetGpioInputDataIdx( 0x06 , &data));
DeactiveSIO(sio_data.ic_port);

GPIO Comparison

 CHECK_RET(_GetGpioInputDataIdx (0x10,&BDIO_data));
 if((BDIO_data == 1) & (BDIO_startvalue_data == 0) )
 {
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbutton2), TRUE);
 }

 

F75113 driver delete

 on_window1_destory         (GtKObject    *object,
                           gpointer      user_data)
 {
    sFintek_sio_data sio_data;
    DeactiveSIO(sio_data.ic_port);
    gtk_main_quit();
 }
Personal tools