aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Hardware/EmRegs328PalmPilot.cpp
blob: 25ce2765e8223c26876c11e66aa9c88ecd01a2cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* -*- mode: C++; tab-width: 4 -*- */
/* ===================================================================== *\
	Copyright (c) 2000-2001 Palm, Inc. or its subsidiaries.
	All rights reserved.

	This file is part of the Palm OS Emulator.

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
\* ===================================================================== */

#include "EmCommon.h"
#include "EmRegs328PalmPilot.h"
#include "EmRegs328Prv.h"

#include "PalmPack.h"
#define NON_PORTABLE
	#include "328Jerry/IncsPrv/HardwareTD1.h"		// hwrTD1PortFLCDEnableOn, etc.
#undef NON_PORTABLE
#include "PalmPackPop.h"


// ---------------------------------------------------------------------------
//		¥ EmRegs328PalmPilot::GetLCDScreenOn
// ---------------------------------------------------------------------------

Bool EmRegs328PalmPilot::GetLCDScreenOn (void)
{
	return (READ_REGISTER (portFData) & hwrTD1PortFLCDEnableOn) != 0;
}


// ---------------------------------------------------------------------------
//		¥ EmRegs328PalmPilot::GetLCDBacklightOn
// ---------------------------------------------------------------------------

Bool EmRegs328PalmPilot::GetLCDBacklightOn (void)
{
	return (READ_REGISTER (portGData) & hwrTD1PortGBacklightOn) != 0;
}


// ---------------------------------------------------------------------------
//		¥ EmRegs328PalmPilot::GetLineDriverState
// ---------------------------------------------------------------------------
// Return whether or not the line drivers for the given object are open or
// closed.

Bool EmRegs328PalmPilot::GetLineDriverState (EmUARTDeviceType type)
{
	if (type == kUARTSerial)
		return (READ_REGISTER (portGData) & hwrTD1PortGSerialOn) != 0;

	if (type == kUARTIR)
		return (READ_REGISTER (portJData) & hwrTD1PortJIrOn) == 0;

	return false;
}


// ---------------------------------------------------------------------------
//		¥ EmRegs328PalmPilot::GetPortInputValue
// ---------------------------------------------------------------------------
// Return the GPIO values for the pins on the port.  These values are used
// if the select pins are high.

uint8 EmRegs328PalmPilot::GetPortInputValue (int port)
{
	uint8	result = EmRegs328::GetPortInputValue (port);

	if (port == 'M')
	{
		// Ensure that bit hwrTD1PortMDockIn is set.  If it's clear, HotSync
		// will sync via the modem instead of the serial port.

		result |= hwrTD1PortMDockIn;
	}

	return result;
}