FireBirdLib - Topfield TMS PVR TAP Programming Library
FrontPanelEEPROMRead.c
Go to the documentation of this file.
1
#include <unistd.h>
2
#include "
FBLib_main.h
"
3
4
bool
FrontPanelEEPROMRead
(word Address,
byte
*Data)
5
{
6
TRACEENTER
();
7
8
byte
Buffer[20];
9
int
WaitTimeout;
10
11
if
(!
FP_Initialize
())
12
{
13
TRACEEXIT
();
14
return
FALSE;
15
}
16
17
//Cache the two options so that the FrontPanelEEPROMRead() doesn't need to communicate with the front panel
18
if
(Address == 0x01ff)
19
{
20
if
(Data) *Data =
FPPatchAntiFreezeOption
;
21
22
TRACEEXIT
();
23
return
TRUE;
24
}
25
26
if
(Address == 0x01fe)
27
{
28
if
(Data) *Data =
FPPatchPowerRestoreOption
;
29
30
TRACEEXIT
();
31
return
TRUE;
32
}
33
34
if
(!
HookFrontTxPacket
())
35
{
36
TRACEEXIT
();
37
return
FALSE;
38
}
39
40
//Read the AntiFreeze Option Byte
41
//ReadEEPROM: Query: D2 EAH EAL; Response: D1 <DTA>
42
Buffer[0] = 0xD2;
43
Buffer[1] = Address >> 8;
44
Buffer[2] = Address & 0xff;
45
FPWaitResponse
= 0xD1;
46
Front_TxPacket_hooked
(Buffer);
47
48
WaitTimeout = 100;
49
while
((
FPWaitResponse
!= 0) && WaitTimeout)
50
{
51
TAP_Delay(1);
52
WaitTimeout--;
53
}
54
55
if
(Data) *Data =
FPResponse
[1];
56
57
UnhookFrontTxPacket
();
58
59
TRACEEXIT
();
60
return
(WaitTimeout != 0);
61
}
FBLib_main.h
FPWaitResponse
byte FPWaitResponse
Definition:
FrontPanelComm.c:9
FP_Initialize
bool FP_Initialize(void)
Definition:
FrontPanelComm.c:121
FPPatchPowerRestoreOption
byte FPPatchPowerRestoreOption
Definition:
FrontPanelComm.c:7
FPResponse
byte FPResponse[12]
Definition:
FrontPanelComm.c:10
HookFrontTxPacket
bool HookFrontTxPacket(void)
Definition:
FrontPanelComm.c:92
UnhookFrontTxPacket
void UnhookFrontTxPacket(void)
Definition:
FrontPanelComm.c:73
FPPatchAntiFreezeOption
byte FPPatchAntiFreezeOption
Definition:
FrontPanelComm.c:6
Front_TxPacket_hooked
void Front_TxPacket_hooked(byte *Data)
Definition:
FrontPanelComm.c:18
FrontPanelEEPROMRead
bool FrontPanelEEPROMRead(word Address, byte *Data)
Definition:
FrontPanelEEPROMRead.c:4
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
main
FrontPanelEEPROMRead.c
Generated on Fri Apr 29 2022 13:34:01 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3