📄 s3c4510func.pas
字号:
Unit S3C4510Func;
Interface
Uses SysUtils;
function io_access_on( port:word ):integer;
procedure io_access_off( port:word );
function test_port:integer;
function putp( tdi,tms,rp:integer ):integer;
procedure reset_jtag;
procedure test_logic_reset;
function check_id( device_id:pchar ):integer;
function id_command:integer;
procedure bypass_all;
procedure extest;
function access_bus( rw:integer; address,data:longword; rp:integer):word;
var
pin:array[0..232]of integer=
(
1, // UARXD1_IN
0, // nUADSR0_OUT
1, // UATXD0_OUT
1, // nUADTR0_IN
1, // UARXD0_IN
0, // SDA_OUT
1, // SDA_IN
0, // SCL_OUT
1, // SCL_IN
0, // P_17_ENB
0, // P_17_OUT
0, // P_17_IN
0, // P_16_ENB
0, // P_16_OUT
0, // P_16_IN
0, // P_15_ENB
0, // P_15_OUT
0, // P_15_IN
0, // P_14_ENB
0, // P_14_OUT
0, // P_14_IN
0, // P_13_ENB
0, // P_13_OUT
0, // P_13_IN
0, // P_12_ENB
0, // P_12_OUT
0, // P_12_IN
0, // P_11_ENB
0, // P_11_OUT
0, // P_11_IN
0, // P_10_ENB
0, // P_10_OUT
0, // P_10_IN
0, // P_9_ENB
0, // P_9_OUT
0, // P_9_IN
0, // P_8_ENB
0, // P_8_OUT
0, // P_8_IN
0, // P_7_ENB
0, // P_7_OUT
0, // P_7_IN
0, // P_6_ENB
0, // P_6_OUT
0, // P_6_IN
0, // P_5_ENB
0, // P_5_OUT
0, // P_5_IN
0, // P_4_ENB
0, // P_4_OUT
0, // P_4_IN
0, // P_3_ENB
0, // P_3_OUT
0, // P_3_IN
0, // P_2_ENB
0, // P_2_OUT
0, // P_2_IN
0, // P_1_ENB
0, // P_1_OUT
0, // P_1_IN
0, // P_0_ENB
0, // P_0_OUT
0, // P_0_IN
0, // D_31_OUT
0, // D_31_IN
0, // D_30_OUT
0, // D_30_IN
0, // D_29_OUT
0, // D_29_IN
0, // D_28_OUT
0, // D_28_IN
0, // D_27_OUT
0, // D_27_IN
0, // D_26_OUT
0, // D_26_IN
0, // D_25_OUT
0, // D_25_IN
0, // D_24_OUT
0, // D_24_IN
0, // D_23_OUT
0, // D_23_IN
0, // D_22_OUT
0, // D_22_IN
0, // D_21_OUT
0, // D_21_IN
0, // D_20_OUT
0, // D_20_IN
0, // D_19_OUT
0, // D_19_IN
0, // D_18_OUT
0, // D_18_IN
0, // D_17_OUT
0, // D_17_IN
0, // D_16_OUT
0, // D_16_IN
0, // D_15_OUT
0, // D_15_IN
0, // D_14_OUT
0, // D_14_IN
0, // D_13_OUT
0, // D_13_IN
0, // D_12_OUT
0, // D_12_IN
0, // D_11_OUT
0, // D_11_IN
0, // D_10_OUT
0, // D_10_IN
0, // D_9_OUT
0, // D_9_IN
0, // D_8_OUT
0, // D_8_IN
0, // D_7_OUT
0, // D_7_IN
0, // D_6_OUT
0, // D_6_IN
0, // D_5_OUT
0, // D_5_IN
0, // D_4_OUT
0, // D_4_IN
0, // D_3_OUT
0, // D_3_IN
0, // D_2_OUT
0, // D_2_IN
0, // D_1_OUT
0, // D_1_IN
0, // D_0_OUT
0, // D_0_IN
1, // D_OUT_ENB
0, // A_21_OUT
0, // A_20_OUT
0, // A_19_OUT
0, // A_18_OUT
0, // A_17_OUT
0, // A_16_OUT
0, // A_15_OUT
0, // A_14_OUT
0, // A_13_OUT
0, // A_12_OUT
0, // A_11_OUT
0, // A_10_OUT
0, // A_9_OUT
0, // A_8_OUT
0, // A_7_OUT
0, // A_6_OUT
0, // A_5_OUT
0, // A_4_OUT
0, // A_3_OUT
0, // A_2_OUT
0, // A_1_OUT
0, // A_0_OUT
0, // ExtMACK_OUT
0, // ExtMREQ_IN
1, // nWBE_3_OUT
1, // nWBE_2_OUT
1, // nWBE_1_OUT
1, // nWBE_0_OUT
1, // nDWE_OUT
1, // nCAS_3_OUT
1, // nCAS_2_OUT
1, // nCAS_1_OUT
1, // nCAS_0_OUT
1, // nRAS_3_OUT
1, // nRAS_2_OUT
1, // nRAS_1_OUT
1, // nRAS_0_OUT
1, // nRCS_5_OUT
1, // nRCS_4_OUT
1, // nRCS_3_OUT
1, // nRCS_2_OUT
1, // nRCS_1_OUT
0, // CLKSEL_IN
0, // nRESET_IN
0, // MCLK_IN
0, // MCLKO_OUT
0, // CLKOEN_IN
1, // nRCS_0_OUT
1, // B0SIZE_1_IN
1, // B0SIZE_0_IN
1, // nOE_OUT
1, // nEWAIT_IN
1, // nECS_3_OUT
1, // nECS_2_OUT
1, // nECS_1_OUT
1, // nECS_0_OUT
0, // DIS_BUS
1, // UCLK_IN
1, // TMODE_IN
0, // MDC_OUT
1, // LITTLE_IN
0, // MDIO_OE
0, // MDIO_OUT
0, // MDIO_IN
0, // TX_EN_TXEN_10M_OUT
0, // TX_CLK_TXCLK_10M_OUT
0, // TX_ERR_PCOMP_10M_OUT
0, // TXD3_OUT
0, // TXD2_OUT
0, // TXD1_LOOP10_OUT
0, // TXD0_TXD_10M_OUT
1, // COL_COL_10M_IN
1, // RX_CLK_RXCLK_10M_IN
1, // RX_ERR_IN
1, // RXD3_IN
1, // RXD2_IN
1, // RXD1_IN
1, // RXD0_RXD_10M_IN
1, // RX_DV_LINK10_IN
1, // CRS_CRS_10M_IN
0, // TXCBEN
0, // TXCB_OUT
1, // TXCB_IN
0, // nSYNCB_OUT
1, // RXCB_IN
1, // nDCDB_IN
1, // nCTSB_IN
0, // TXDB_OUT
0, // nRTSB_OUT
1, // RXDB_IN
0, // nDTRB_OUT
0, // TXCAEN
0, // TXCA_OUT
1, // TXCA_IN
0, // nSYNCA_OUT
1, // RXCA_IN
1, // nDCDA_IN
1, // nCTSA_IN
0, // TXDA_OUT
0, // nRTSA_OUT
1, // RXDA_IN
0, // nDTRA_OUT
0, // nUADSR1_OUT
0, // UATXD1_OUT
1 // nUADTR1_IN
);
Implementation
Uses Unit1,Define;
{ ----------------------------------------------------------------
* brief : get the access permition
* author: dailzh
* param: port------the parallel addr
* retval: -1--------error
0---------succeed
* modify history:
2003-12-3 Guo Jian first version
----------------------------------------------------------------- }
function io_access_on( port:word ):integer;
begin
if( false) then//ioperm( port, 3, 1 ) ) then
begin
//perror( "ioperm()" );
Result:=-1;
Exit;
end;
if( false) then//ioperm( 0x80, 1, 1 ) ) then
begin
//perror( "ioperm()" );
Result:=-1;
Exit;
end;
Result:=0;
end;
{ ----------------------------------------------------------------
* brief : release the access permition
* author: dailzh
* param: port------the parallel addr
* retval: none
* modify history:
2003-12-3 Guo Jian first version
----------------------------------------------------------------- }
procedure io_access_off( port:word );
begin
//ioperm( port, 3, 0 );
//ioperm( 0x80, 1, 0 );
end;
{ ----------------------------------------------------------------
* brief : get the valid parallel addr
* author: dailzh
* param: none
* retval: -1--------no parallel
>0-------the parallel addr
* modify history:
2003-12-3 Guo Jian first version
----------------------------------------------------------------- }
function test_port:integer;
begin
//try lpt1
if( io_access_on( LPT1 )=0 ) then
begin
OUTB( LPT1, $55 );
if( INB(LPT1) = $55 ) then
begin
Result := LPT1;
Exit;
end;
io_access_off( LPT1 );
end;
//try lpt2
if( io_access_on( LPT2 )=0 ) then
begin
OUTB( LPT2, $55 );
if( INB( LPT2 ) = $55 ) then
begin
Result := LPT2;
Exit;
end;
io_access_off( LPT2 );
end;
//try lpt3
if( io_access_on( LPT3 )=0 ) then
begin
OUTB( LPT3, $55 );
if( INB( LPT3 ) = $55 ) then
begin
Result := LPT3;
Exit;
end;
io_access_off( LPT3 );
end;
Result := -1;
end;
{ ----------------------------------------------------------------
* brief : JTAG low level operation funtion
* author: dailzh
* param: tdi-------JTAG input data
tms-------JTAG mode
rp--------read from JTAP or ignor
* retval: data read from JTAG
* hardware connection
output pin ( drive by LPT )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -