summaryrefslogtreecommitdiffhomepage
path: root/constants.py
diff options
context:
space:
mode:
Diffstat (limited to 'constants.py')
-rwxr-xr-xconstants.py164
1 files changed, 164 insertions, 0 deletions
diff --git a/constants.py b/constants.py
new file mode 100755
index 0000000..e83a2fb
--- /dev/null
+++ b/constants.py
@@ -0,0 +1,164 @@
+"""
+ Copyright (C) 2026 Private Island Networks Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ file: constants.py
+
+"""
+
+class STATUS:
+ OK = 10
+ FORM_OK = OK
+ DONE = OK
+ NONE = OK
+ FORM_ERRORS = 20
+ FORM_DUPLICATE = 30
+
+ # pass the URL in data
+ REDIRECT = 100
+
+ UNBOUND_FORM = 0
+ CSRF_DETECTED = -1
+ ERROR_PROCESSING_PARAMS = -2
+ ERROR_SERVER = -3
+ ERROR_GENERAL = -3
+ ERROR_NO_COOKIES = -4
+ ERROR_TAMPER = -5
+
+ # DB Related
+ ERROR_DB_TOPIC_DOESNT_EXIST = -10
+ ERROR_DB_COMMENT_DOESNT_EXIST = -11
+ ERROR_DB_OBJECT_DOESNT_EXIST = -12
+
+ # Session Related
+ ERROR_SN_DATA_MISMATCH = -20
+
+ # Catch All View Problems
+ ERROR_VW_BAD_ARGS = -40
+
+ # Called an AJAX helper but the request wasn't AJAX
+ ERROR_AJAX_GETTER_CALLED_WITHOUT_AJAX = -60
+
+# Betsy Uses Static IP addressing
+BETSY_IP_ADDRESS = "192.168.5.100"
+PC_IP_ADDRESS = "192.168.5.44"
+
+
+MODE_IDLE = 0
+MODE_LIVE = 1
+MODE_FILE = 2
+
+PORT_PHY0 = 0
+PORT_PHY1 = 1
+PORT_PHY2 = 2
+PORT_PC = 10
+PORT_UNDEFINED = -1
+
+
+MSG_FORMAT_BASIC = 0
+MSG_FORMAT_CONTROLLER = 1
+MSG_FORMAT_MLE = 2
+
+# Controller Message Protocol:
+# Type: 8-bit
+# Token: 8-bit
+# Address: 16-bit
+# Data: 32-bit
+
+# Betsy Address Map
+MSG_CONTROLLER_ADDR = 0x0000
+MSG_MAC_ADDR = 0x0100
+MSG_PKT_FILTER_ADDR = 0x0200
+MSG_SWITCH_ADDR = 0x0500
+MSG_MDIO_ADDR = 0x0600
+MSG_INVALID_ADDR = 0x0700
+
+# Message Types
+MSG_TYPE_NULL = 0
+MSG_TYPE_WRITE = 1
+MSG_TYPE_READ = 2
+MSG_TYPE_NOTIFY_SUCCESS = 3
+MSG_TYPE_NOTIFY_ERROR = 4
+MSG_TYPE_NOTIFY_NOTIFY = 5
+MSG_TYPE_NOTIFY_MLE = 16
+
+MSG_TYPE_CONTROL = -1
+
+MSG_TYPE_MAP = {MSG_TYPE_NULL:"NULL",
+ MSG_TYPE_WRITE:"WRITE",
+ MSG_TYPE_READ: "READ",
+ MSG_TYPE_NOTIFY_SUCCESS:"SUCCESS",
+ MSG_TYPE_NOTIFY_ERROR:"ERROR",
+ MSG_TYPE_NOTIFY_MLE: "MLE"}
+
+BETSY_ADDR_MAP = {
+ "0000": "FW_VER",
+ "0002": "FW_INC",
+ "0010": "FPGA_TEMP",
+ "0100": "PHY0_STATUS",
+ "0104": "PHY1_STATUS",
+ "0106": "PHY1_MASK",
+ "0108": "PHY2_STATUS",
+ "010A": "PHY2_MASK"
+ }
+
+DP83867_MAP = {
+ 0x0000: ["Basic Mode Control Register (BMCR)", "0x1140"],
+ 0x0001: ["Basic Mode Status Register(BMSR)", "0x796D"],
+ 0x0002: ["PHY Identifier Register #1(PHYIDR1)", "0x0000"],
+ 0x0003: ["PHY Identifier Register #2(PHYIDR2)", "0x0000"],
+ 0x0004: ["Auto-Negotiation Advertisement Register(ANAR)", "0x0000"],
+ 0x0005: ["Auto-Negotiation Link Partner Ability Register(ANLPAR)", "0x0000"],
+ 0x0006: ["Auto-Negotiate Expansion Register(ANER)", "0x0000"],
+ 0x0007: ["Auto-Negotiation Next Page Transmit Register(ANNPTR)", "0x0000"],
+ 0x0008: ["Auto-Negotiation Next Page Receive Register(ANNPRR)", "0x0000"],
+ 0x0009: ["Configuration Register 1(CFG1)", "0x0000"],
+ 0x000A: ["Status Register 1(STS1)", "0x0000"],
+ 0x000B: ["Undefined", "0x0000"],
+ 0x000C: ["Undefined", "0x0000"],
+ 0x000D: ["Register Control Register(REGCR)", "0x0000"],
+ 0x000E: ["Address or Data Register(ADDAR)", "0x0000"],
+ 0x000F: ["1000BASE-T Status Register(1KSCR)", "0x0000"],
+ }
+
+# Lattice Certus NX SGMIICDR
+SGMII_CDR_MAP = {
+ 0x0000: ["LMMI[0]", "0x60"],
+ 0x0001: ["LMMI[1]", "0xA1"],
+ 0x0002: ["LMMI[2]", "0xD2"],
+ 0x0003: ["LMMI[3]", "0x17"],
+ 0x0004: ["LMMI[4]", "0xFF"],
+ 0x0005: ["LMMI[5]", "0x00"],
+ 0x0006: ["LMMI[6]", "0x55"],
+ 0x0007: ["LMMI[7]", "0x80"],
+ 0x0008: ["LMMI[8]", "0x20"],
+ 0x0009: ["LMMI[9]", "0x40"],
+ 0x000A: ["LMMI[A]", "0xAF"],
+ 0x000B: ["LMMI[B]", "0x7F"],
+ 0x000C: ["LMMI[C]", "0x8F"],
+ 0x000D: ["LMMI[D]", "0x00"],
+ 0x000E: ["LMMI[E]", "0x00"],
+ 0x000F: ["LMMI[F]", "0x00"],
+ }
+
+CONTROLLER_MAP = {}
+
+ML_ENGINE_MAP = {}
+
+FABRIC_MAP = {}
+
+
+
+
+

Highly Recommended Verilog Books