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
4bool FrontPanelEEPROMRead(word Address, byte *Data)
5{
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
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;
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
58
59 TRACEEXIT();
60 return (WaitTimeout != 0);
61}
byte FPWaitResponse
Definition: FrontPanelComm.c:9
bool FP_Initialize(void)
byte FPPatchPowerRestoreOption
Definition: FrontPanelComm.c:7
byte FPResponse[12]
bool HookFrontTxPacket(void)
void UnhookFrontTxPacket(void)
byte FPPatchAntiFreezeOption
Definition: FrontPanelComm.c:6
void Front_TxPacket_hooked(byte *Data)
bool FrontPanelEEPROMRead(word Address, byte *Data)
#define TRACEEXIT()
Definition: libFireBird.h:1244
#define TRACEENTER()
Definition: libFireBird.h:1243