001 // Copyright (c) National Instruments 2009. All Rights Reserved.
002 // Do Not Edit... this file is generated!
003
004 package edu.wpi.first.wpilibj.fpga;
005
006 import com.ni.rio.*;
007
008 public class tWatchdog extends tSystem
009 {
010
011 public tWatchdog()
012 {
013 super();
014
015 }
016
017 protected void finalize()
018 {
019 super.finalize();
020 }
021
022 public static final int kNumSystems = 1;
023
024
025
026
027
028
029
030
031
032
033 //////////////////////////////////////////////////////////////////////////////////////////////////
034 // Accessors for Status
035 //////////////////////////////////////////////////////////////////////////////////////////////////
036 private static final int kStatus_SystemActive_BitfieldMask = 0x80000000;
037 private static final int kStatus_SystemActive_BitfieldOffset = 31;
038 private static final int kStatus_Alive_BitfieldMask = 0x40000000;
039 private static final int kStatus_Alive_BitfieldOffset = 30;
040 private static final int kStatus_SysDisableCount_BitfieldMask = 0x3FFF8000;
041 private static final int kStatus_SysDisableCount_BitfieldOffset = 15;
042 private static final int kStatus_DisableCount_BitfieldMask = 0x00007FFF;
043 private static final int kStatus_DisableCount_BitfieldOffset = 0;
044 private static final int kWatchdog_Status_Address = 0x811C;
045
046 public static int readStatus()
047 {
048
049 int result = NiFpga.readU32(m_DeviceHandle, kWatchdog_Status_Address, status);
050 int regValue = result ;
051 return (int)(regValue);
052 }
053 public static boolean readStatus_SystemActive()
054 {
055
056 int result = NiFpga.readU32(m_DeviceHandle, kWatchdog_Status_Address, status);
057 int regValue = result ;
058 int bitfieldValue = ((regValue & kStatus_SystemActive_BitfieldMask) >>> kStatus_SystemActive_BitfieldOffset);
059 return ((bitfieldValue) != 0 ? true : false);
060 }
061 public static boolean readStatus_Alive()
062 {
063
064 int result = NiFpga.readU32(m_DeviceHandle, kWatchdog_Status_Address, status);
065 int regValue = result ;
066 int bitfieldValue = ((regValue & kStatus_Alive_BitfieldMask) >>> kStatus_Alive_BitfieldOffset);
067 return ((bitfieldValue) != 0 ? true : false);
068 }
069 public static short readStatus_SysDisableCount()
070 {
071
072 int result = NiFpga.readU32(m_DeviceHandle, kWatchdog_Status_Address, status);
073 int regValue = result ;
074 int bitfieldValue = ((regValue & kStatus_SysDisableCount_BitfieldMask) >>> kStatus_SysDisableCount_BitfieldOffset);
075 return (short)((bitfieldValue) & 0x00007FFF);
076 }
077 public static short readStatus_DisableCount()
078 {
079
080 int result = NiFpga.readU32(m_DeviceHandle, kWatchdog_Status_Address, status);
081 int regValue = result ;
082 int bitfieldValue = ((regValue & kStatus_DisableCount_BitfieldMask) >>> kStatus_DisableCount_BitfieldOffset);
083 return (short)((bitfieldValue) & 0x00007FFF);
084 }
085
086 //////////////////////////////////////////////////////////////////////////////////////////////////
087 // Accessors for Kill
088 //////////////////////////////////////////////////////////////////////////////////////////////////
089 private static final int kWatchdog_Kill_Address = 0x8124;
090
091 public static void strobeKill()
092 {
093
094 NiFpga.writeU32(m_DeviceHandle, kWatchdog_Kill_Address, 1, status);
095 }
096
097 //////////////////////////////////////////////////////////////////////////////////////////////////
098 // Accessors for Feed
099 //////////////////////////////////////////////////////////////////////////////////////////////////
100 private static final int kWatchdog_Feed_Address = 0x8120;
101
102 public static void strobeFeed()
103 {
104
105 NiFpga.writeU32(m_DeviceHandle, kWatchdog_Feed_Address, 1, status);
106 }
107
108 //////////////////////////////////////////////////////////////////////////////////////////////////
109 // Accessors for Timer
110 //////////////////////////////////////////////////////////////////////////////////////////////////
111 private static final int kWatchdog_Timer_Address = 0x8128;
112
113 public static long readTimer()
114 {
115
116 return (long)((NiFpga.readU32(m_DeviceHandle, kWatchdog_Timer_Address, status)) & 0xFFFFFFFFl);
117 }
118
119 //////////////////////////////////////////////////////////////////////////////////////////////////
120 // Accessors for Expiration
121 //////////////////////////////////////////////////////////////////////////////////////////////////
122 private static final int kWatchdog_Expiration_Address = 0x812C;
123
124 public static void writeExpiration(final long value)
125 {
126
127 NiFpga.writeU32(m_DeviceHandle, kWatchdog_Expiration_Address, (int)(value), status);
128 }
129 public static long readExpiration()
130 {
131
132 return (long)((NiFpga.readU32(m_DeviceHandle, kWatchdog_Expiration_Address, status)) & 0xFFFFFFFFl);
133 }
134
135 //////////////////////////////////////////////////////////////////////////////////////////////////
136 // Accessors for Immortal
137 //////////////////////////////////////////////////////////////////////////////////////////////////
138 private static final int kWatchdog_Immortal_Address = 0x8130;
139
140 public static void writeImmortal(final boolean value)
141 {
142
143 NiFpga.writeU32(m_DeviceHandle, kWatchdog_Immortal_Address, (value ? 1 : 0), status);
144 }
145 public static boolean readImmortal()
146 {
147
148 return ((NiFpga.readU32(m_DeviceHandle, kWatchdog_Immortal_Address, status)) != 0 ? true : false);
149 }
150
151
152
153
154 }