unit NMRAnetAppDefines;
// ******************************************************************************
//
// * Copyright:
// (c) Mustangpeak Software 2012.
//
// The contents of this file are subject to the GNU GPL v3 licence/ you maynot use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.gnu.org/licenses/gpl.html
//
// * Revision History:
// 2012-02-01: Created
//
// * Description:
// Implements program specific information such as Consumer/Producer EventIDs,
// Buffer allocation sizes, CDI and ACDI Information, Protocol Support IDs, vNode
// counts, etc.
//
// AppDefines for the Mustangpeak Command Station
//
// ******************************************************************************
uses
NMRAnetDefinesShared;
{$I Options.inc}
// **************************************************************************************************************************************************************
// Virtual Nodes
// **************************************************************************************************************************************************************
const
MAX_NODE_COUNT = 57; // The number of Physical and vNodes this physical node support. Note that these nodes are defined as the Node ID defined + 1 up to VIRTUAL_NODE_COUNT past that
// If the lower bits of this node are $0300 then the first Virtual Node is $0301 and the last is $0309 if the VIRTUAL_NODE_COUNT = 9
// It also MUST fall within the lower 3 byte boundry (this is due to the way I have defined HI/LO as 3 byte) so the max virtual nodes is 4095 with a base
// physical node starting at $0000;
// **************************************************************************************************************************************************************
// Buffer Pool Allocation
// **************************************************************************************************************************************************************
const
MAX_BASE_BUFFER_POOL = 2*MAX_NODE_COUNT; // Number of Base Buffers to allocate for Messages , JMRI Interleaves all the nodes so we need a Buffer for every Node <;^(
MAX_DATAGRAM_BUFFER_POOL = 2; // Number of Datagram Buffers to allocate for Messages
// **************************************************************************************************************************************************************
// Memory Configuration Protocol Supported Options
// **************************************************************************************************************************************************************
const
MEMORY_CONFIG_OPTIONS: TMemConfigurationOptions = (
MCO_UNALIGNED_READS or MCO_ACDI_MFG_READS or MCO_ACDI_USER_READS or MCO_ACDI_USER_WRITES or MCO_UNALIGNED_WRITES, // MemoryConfigOptions
MCWL_ONE_BYTE or MCWL_TWO_BYTE or MCWL_FOUR_BYTE or MCWL_64_BYTE or MCWL_ARBITRARY_BYTE, // MemoryConfigWriteLength
MSI_CDI, // MemoryConfigHighestSpace
MSI_FDI // MemoryConfigLowestSpace
);
// **************************************************************************************************************************************************************
// CDI Memory ($FF) Space Implementation
// **************************************************************************************************************************************************************
const
MAX_CDI_ARRAY = 3235;
CDI_ARRAY: array[0..MAX_CDI_ARRAY-1] of byte = (
$3C, $3F, $78, $6D, $6C, $20, $76, $65, $72, $73, $69, $6F, $6E, $3D, $22, $31, $2E, $30, $22, $20, $65, $6E, $63, $6F, $64, $69, $6E, $67, $3D, $22, $75, $74, $66, $2D, $38, $22, $3F, $3E, //
$3C, $3F, $78, $6D, $6C, $2D, $73, $74, $79, $6C, $65, $73, $68, $65, $65, $74, $20, $74, $79, $70, $65, $3D, $27, $74, $65, $78, $74, $2F, $78, $73, $6C, $27, $20, $68, $72, $65, $66, $3D, $27, $68, $74, $74, $70, $3A, $2F, $2F, $6F, $70, $65, $6E, $6C, $63, $62, $2E, $6F, $72, $67, $2F, $74, $72, $75, $6E, $6B, $2F, $70, $72, $6F, $74, $6F, $74, $79, $70, $65, $73, $2F, $78, $6D, $6C, $2F, $78, $73, $6C, $74, $2F, $63, $64, $69, $2E, $78, $73, $6C, $27, $3F, $3E, //
$3C, $63, $64, $69, $20, $78, $6D, $6C, $6E, $73, $3A, $78, $73, $69, $3D, $22, $68, $74, $74, $70, $3A, $2F, $2F, $77, $77, $77, $2E, $77, $33, $2E, $6F, $72, $67, $2F, $32, $30, $30, $31, $2F, $58, $4D, $4C, $53, $63, $68, $65, $6D, $61, $2D, $69, $6E, $73, $74, $61, $6E, $63, $65, $22, $20, $78, $73, $69, $3A, $6E, $6F, $4E, $61, $6D, $65, $73, $70, $61, $63, $65, $53, $63, $68, $65, $6D, $61, $4C, $6F, $63, $61, $74, $69, $6F, $6E, $3D, $22, $68, $74, $74, $70, $3A, $2F, $2F, $6F, $70, $65, $6E, $6C, $63, $62, $2E, $6F, $72, $67, $2F, $74, $72, $75, $6E, $6B, $2F, $70, $72, $6F, $74, $6F, $74, $79, $70, $65, $73, $2F, $78, $6D, $6C, $2F, $73, $63, $68, $65, $6D, $61, $2F, $63, $64, $69, $2E, $78, $73, $64, $22, $3E, //
$3C, $69, $64, $65, $6E, $74, $69, $66, $69, $63, $61, $74, $69, $6F, $6E, $3E, //
$3C, $6D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $3E, $4D, $75, $73, $74, $61, $6E, $67, $70, $65, $61, $6B, $3C, $2F, $6D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $3E, // Mustangpeak
$3C, $6D, $6F, $64, $65, $6C, $3E, $43, $53, $31, $30, $30, $3C, $2F, $6D, $6F, $64, $65, $6C, $3E, // CS100
$3C, $68, $61, $72, $64, $77, $61, $72, $65, $56, $65, $72, $73, $69, $6F, $6E, $3E, $31, $2E, $30, $3C, $2F, $68, $61, $72, $64, $77, $61, $72, $65, $56, $65, $72, $73, $69, $6F, $6E, $3E, // 1.0
$3C, $73, $6F, $66, $74, $77, $61, $72, $65, $56, $65, $72, $73, $69, $6F, $6E, $3E, $30, $2E, $32, $3C, $2F, $73, $6F, $66, $74, $77, $61, $72, $65, $56, $65, $72, $73, $69, $6F, $6E, $3E, // 0.2
$3C, $6D, $61, $70, $3E, //
$3C, $2F, $69, $64, $65, $6E, $74, $69, $66, $69, $63, $61, $74, $69, $6F, $6E, $3E, //
$3C, $61, $63, $64, $69, $20, $66, $69, $78, $65, $64, $3D, $22, $31, $22, $20, $76, $61, $72, $3D, $22, $31, $22, $20, $2F, $3E, //
$3C, $73, $65, $67, $6D, $65, $6E, $74, $20, $6F, $72, $69, $67, $69, $6E, $3D, $22, $30, $22, $20, $73, $70, $61, $63, $65, $3D, $22, $32, $35, $33, $22, $3E, //
$3C, $67, $72, $6F, $75, $70, $20, $6F, $66, $66, $73, $65, $74, $3D, $22, $31, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $44, $61, $74, $61, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Data
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $41, $64, $64, $20, $79, $6F, $75, $72, $20, $6F, $77, $6E, $20, $75, $6E, $69, $71, $75, $65, $20, $6E, $6F, $64, $65, $20, $69, $6E, $66, $6F, $20, $68, $65, $72, $65, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Add your own unique node info here
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $32, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $4E, $61, $6D, $65, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Name
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $34, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $44, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Description
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $2F, $67, $72, $6F, $75, $70, $3E, //
$3C, $67, $72, $6F, $75, $70, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $43, $6F, $6D, $6D, $61, $6E, $64, $20, $53, $74, $61, $74, $69, $6F, $6E, $20, $4F, $70, $74, $69, $6F, $6E, $73, $3C, $2F, $6E, $61, $6D, $65, $3E, // Command Station Options
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $43, $6F, $6E, $66, $69, $67, $75, $72, $61, $74, $69, $6F, $6E, $20, $6F, $70, $74, $69, $6F, $6E, $73, $20, $66, $6F, $72, $20, $74, $68, $65, $20, $4C, $43, $42, $72, $69, $63, $6B, $73, $20, $43, $6F, $6D, $6D, $61, $6E, $64, $20, $53, $74, $61, $74, $69, $6F, $6E, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Configuration options for the LCBricks Command Station
$3C, $69, $6E, $74, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $50, $72, $6F, $67, $72, $61, $6D, $6D, $69, $6E, $67, $20, $4D, $6F, $64, $65, $3C, $2F, $6E, $61, $6D, $65, $3E, // Programming Mode
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $53, $65, $6C, $65, $63, $74, $73, $20, $74, $68, $65, $20, $50, $72, $6F, $67, $72, $61, $6D, $6D, $69, $6E, $67, $20, $4D, $6F, $64, $65, $20, $74, $68, $65, $20, $43, $6F, $6D, $6D, $61, $6E, $64, $20, $53, $74, $61, $74, $69, $6F, $6E, $20, $77, $69, $6C, $6C, $20, $75, $73, $65, $20, $74, $6F, $20, $77, $72, $69, $74, $65, $20, $43, $56, $27, $73, $20, $74, $6F, $20, $74, $68, $65, $20, $64, $65, $63, $6F, $64, $65, $72, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Selects the Programming Mode the Command Station will use to write CV's to the decoder
$3C, $6D, $61, $70, $3E, //
$3C, $2F, $69, $6E, $74, $3E, //
$3C, $69, $6E, $74, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $44, $43, $43, $20, $42, $75, $73, $20, $4D, $6F, $64, $65, $3C, $2F, $6E, $61, $6D, $65, $3E, // DCC Bus Mode
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $53, $65, $6C, $65, $63, $74, $20, $69, $66, $20, $74, $68, $69, $73, $20, $43, $6F, $6D, $6D, $61, $6E, $64, $20, $53, $74, $61, $74, $69, $6F, $6E, $20, $69, $73, $20, $74, $68, $65, $20, $64, $72, $69, $76, $65, $72, $20, $6F, $72, $20, $72, $65, $63, $65, $69, $76, $65, $72, $20, $6F, $66, $20, $74, $68, $65, $20, $44, $43, $43, $20, $62, $75, $73, $20, $73, $69, $67, $6E, $61, $6C, $20, $28, $44, $61, $6D, $61, $67, $65, $20, $6D, $61, $79, $20, $6F, $63, $63, $75, $72, $20, $69, $66, $20, $6D, $6F, $72, $65, $20, $74, $68, $61, $6E, $20, $6F, $6E, $65, $20, $43, $6F, $6D, $6D, $61, $6E, $64, $20, $53, $74, $61, $74, $69, $6F, $6E, $20, $69, $73, $20, $73, $65, $6C, $65, $63, $74, $65, $64, $20, $74, $6F, $20, $62, $65, $20, $61, $20, $64, $72, $69, $76, $65, $72, $20, $6F, $6E, $20, $74, $68, $65, $20, $44, $43, $43, $20, $62, $75, $73, $29, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Select if this Command Station is the driver or receiver of the DCC bus signal (Damage may occur if more than one Command Station is selected to be a driver on the DCC bus)
$3C, $6D, $61, $70, $3E, //
$3C, $2F, $69, $6E, $74, $3E, //
$3C, $69, $6E, $74, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $4F, $75, $74, $70, $75, $74, $20, $4D, $6F, $64, $65, $3C, $2F, $6E, $61, $6D, $65, $3E, // Output Mode
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $53, $65, $6C, $65, $63, $74, $20, $69, $66, $20, $74, $68, $69, $73, $20, $43, $6F, $6D, $6D, $61, $6E, $64, $20, $53, $74, $61, $74, $69, $6F, $6E, $20, $69, $73, $20, $61, $20, $4D, $61, $69, $6E, $20, $4C, $69, $6E, $65, $20, $4E, $6F, $64, $65, $20, $6F, $72, $20, $61, $20, $50, $72, $6F, $67, $72, $61, $6D, $6D, $69, $6E, $67, $20, $54, $72, $61, $63, $6B, $20, $4E, $6F, $64, $65, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Select if this Command Station is a Main Line Node or a Programming Track Node
$3C, $6D, $61, $70, $3E, //
$3C, $2F, $69, $6E, $74, $3E, //
$3C, $2F, $67, $72, $6F, $75, $70, $3E, //
$3C, $2F, $73, $65, $67, $6D, $65, $6E, $74, $3E, //
$3C, $73, $65, $67, $6D, $65, $6E, $74, $20, $6F, $72, $69, $67, $69, $6E, $3D, $22, $30, $22, $20, $73, $70, $61, $63, $65, $3D, $22, $32, $35, $32, $22, $3E, //
$3C, $67, $72, $6F, $75, $70, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $4D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $20, $49, $6E, $66, $6F, $72, $6D, $61, $74, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Manufacturer Information
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $4D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $2D, $70, $72, $6F, $76, $69, $64, $65, $64, $20, $66, $69, $78, $65, $64, $20, $6E, $6F, $64, $65, $20, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Manufacturer-provided fixed node description
$3C, $69, $6E, $74, $20, $73, $69, $7A, $65, $3D, $22, $31, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $56, $65, $72, $73, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Version
$3C, $2F, $69, $6E, $74, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $31, $32, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $4D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $20, $4E, $61, $6D, $65, $3C, $2F, $6E, $61, $6D, $65, $3E, // Manufacturer Name
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $36, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $4D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $20, $49, $6E, $66, $6F, $3C, $2F, $6E, $61, $6D, $65, $3E, // Manufacturer Info
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $34, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $48, $61, $72, $64, $77, $61, $72, $65, $20, $56, $65, $72, $73, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Hardware Version
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $34, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $53, $6F, $66, $74, $77, $61, $72, $65, $20, $56, $65, $72, $73, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Software Version
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $2F, $67, $72, $6F, $75, $70, $3E, //
$3C, $2F, $73, $65, $67, $6D, $65, $6E, $74, $3E, //
$3C, $73, $65, $67, $6D, $65, $6E, $74, $20, $6F, $72, $69, $67, $69, $6E, $3D, $22, $30, $22, $20, $73, $70, $61, $63, $65, $3D, $22, $32, $35, $31, $22, $3E, //
$3C, $67, $72, $6F, $75, $70, $20, $6F, $66, $66, $73, $65, $74, $3D, $22, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $44, $61, $74, $61, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Data
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $41, $64, $64, $20, $79, $6F, $75, $72, $20, $6F, $77, $6E, $20, $75, $6E, $69, $71, $75, $65, $20, $6E, $6F, $64, $65, $20, $69, $6E, $66, $6F, $20, $68, $65, $72, $65, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Add your own unique node info here
$3C, $69, $6E, $74, $20, $73, $69, $7A, $65, $3D, $22, $31, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $56, $65, $72, $73, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Version
$3C, $2F, $69, $6E, $74, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $32, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $4E, $61, $6D, $65, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Name
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $34, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $44, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Description
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $2F, $67, $72, $6F, $75, $70, $3E, //
$3C, $2F, $73, $65, $67, $6D, $65, $6E, $74, $3E, //
$3C, $2F, $63, $64, $69, $3E, $00 //
);
const
MAX_CDI_ARRAY_VNODE = 1640;
CDI_ARRAY_VNODE: array[0..MAX_CDI_ARRAY_VNODE-1] of byte = (
$3C, $3F, $78, $6D, $6C, $20, $76, $65, $72, $73, $69, $6F, $6E, $3D, $22, $31, $2E, $30, $22, $20, $65, $6E, $63, $6F, $64, $69, $6E, $67, $3D, $22, $75, $74, $66, $2D, $38, $22, $3F, $3E, //
$3C, $3F, $78, $6D, $6C, $2D, $73, $74, $79, $6C, $65, $73, $68, $65, $65, $74, $20, $74, $79, $70, $65, $3D, $27, $74, $65, $78, $74, $2F, $78, $73, $6C, $27, $20, $68, $72, $65, $66, $3D, $27, $68, $74, $74, $70, $3A, $2F, $2F, $6F, $70, $65, $6E, $6C, $63, $62, $2E, $6F, $72, $67, $2F, $74, $72, $75, $6E, $6B, $2F, $70, $72, $6F, $74, $6F, $74, $79, $70, $65, $73, $2F, $78, $6D, $6C, $2F, $78, $73, $6C, $74, $2F, $63, $64, $69, $2E, $78, $73, $6C, $27, $3F, $3E, //
$3C, $63, $64, $69, $20, $78, $6D, $6C, $6E, $73, $3A, $78, $73, $69, $3D, $22, $68, $74, $74, $70, $3A, $2F, $2F, $77, $77, $77, $2E, $77, $33, $2E, $6F, $72, $67, $2F, $32, $30, $30, $31, $2F, $58, $4D, $4C, $53, $63, $68, $65, $6D, $61, $2D, $69, $6E, $73, $74, $61, $6E, $63, $65, $22, $20, $78, $73, $69, $3A, $6E, $6F, $4E, $61, $6D, $65, $73, $70, $61, $63, $65, $53, $63, $68, $65, $6D, $61, $4C, $6F, $63, $61, $74, $69, $6F, $6E, $3D, $22, $68, $74, $74, $70, $3A, $2F, $2F, $6F, $70, $65, $6E, $6C, $63, $62, $2E, $6F, $72, $67, $2F, $74, $72, $75, $6E, $6B, $2F, $70, $72, $6F, $74, $6F, $74, $79, $70, $65, $73, $2F, $78, $6D, $6C, $2F, $73, $63, $68, $65, $6D, $61, $2F, $63, $64, $69, $2E, $78, $73, $64, $22, $3E, //
$3C, $69, $64, $65, $6E, $74, $69, $66, $69, $63, $61, $74, $69, $6F, $6E, $3E, //
$3C, $6D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $3E, $4D, $75, $73, $74, $61, $6E, $67, $70, $65, $61, $6B, $3C, $2F, $6D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $3E, // Mustangpeak
$3C, $6D, $6F, $64, $65, $6C, $3E, $50, $4E, $31, $30, $30, $3C, $2F, $6D, $6F, $64, $65, $6C, $3E, // PN100
$3C, $68, $61, $72, $64, $77, $61, $72, $65, $56, $65, $72, $73, $69, $6F, $6E, $3E, $31, $2E, $30, $3C, $2F, $68, $61, $72, $64, $77, $61, $72, $65, $56, $65, $72, $73, $69, $6F, $6E, $3E, // 1.0
$3C, $73, $6F, $66, $74, $77, $61, $72, $65, $56, $65, $72, $73, $69, $6F, $6E, $3E, $30, $2E, $32, $3C, $2F, $73, $6F, $66, $74, $77, $61, $72, $65, $56, $65, $72, $73, $69, $6F, $6E, $3E, // 0.2
$3C, $6D, $61, $70, $3E, //
$3C, $2F, $69, $64, $65, $6E, $74, $69, $66, $69, $63, $61, $74, $69, $6F, $6E, $3E, //
$3C, $61, $63, $64, $69, $20, $66, $69, $78, $65, $64, $3D, $22, $31, $22, $20, $76, $61, $72, $3D, $22, $31, $22, $20, $2F, $3E, //
$3C, $73, $65, $67, $6D, $65, $6E, $74, $20, $6F, $72, $69, $67, $69, $6E, $3D, $22, $30, $22, $20, $73, $70, $61, $63, $65, $3D, $22, $32, $35, $33, $22, $3E, //
$3C, $67, $72, $6F, $75, $70, $20, $6F, $66, $66, $73, $65, $74, $3D, $22, $31, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $44, $61, $74, $61, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Data
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $41, $64, $64, $20, $79, $6F, $75, $72, $20, $6F, $77, $6E, $20, $75, $6E, $69, $71, $75, $65, $20, $6E, $6F, $64, $65, $20, $69, $6E, $66, $6F, $20, $68, $65, $72, $65, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Add your own unique node info here
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $32, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $4E, $61, $6D, $65, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Name
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $34, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $44, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $60, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Description`
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $2F, $67, $72, $6F, $75, $70, $3E, //
$3C, $2F, $73, $65, $67, $6D, $65, $6E, $74, $3E, //
$3C, $73, $65, $67, $6D, $65, $6E, $74, $20, $6F, $72, $69, $67, $69, $6E, $3D, $22, $30, $22, $20, $73, $70, $61, $63, $65, $3D, $22, $32, $35, $32, $22, $3E, //
$3C, $67, $72, $6F, $75, $70, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $4D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $20, $49, $6E, $66, $6F, $72, $6D, $61, $74, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Manufacturer Information
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $4D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $2D, $70, $72, $6F, $76, $69, $64, $65, $64, $20, $66, $69, $78, $65, $64, $20, $6E, $6F, $64, $65, $20, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Manufacturer-provided fixed node description
$3C, $69, $6E, $74, $20, $73, $69, $7A, $65, $3D, $22, $31, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $56, $65, $72, $73, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Version
$3C, $2F, $69, $6E, $74, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $31, $32, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $4D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $20, $4E, $61, $6D, $65, $3C, $2F, $6E, $61, $6D, $65, $3E, // Manufacturer Name
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $36, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $4D, $61, $6E, $75, $66, $61, $63, $74, $75, $72, $65, $72, $20, $49, $6E, $66, $6F, $3C, $2F, $6E, $61, $6D, $65, $3E, // Manufacturer Info
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $34, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $48, $61, $72, $64, $77, $61, $72, $65, $20, $56, $65, $72, $73, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Hardware Version
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $34, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $53, $6F, $66, $74, $77, $61, $72, $65, $20, $56, $65, $72, $73, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Software Version
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $2F, $67, $72, $6F, $75, $70, $3E, //
$3C, $2F, $73, $65, $67, $6D, $65, $6E, $74, $3E, //
$3C, $73, $65, $67, $6D, $65, $6E, $74, $20, $6F, $72, $69, $67, $69, $6E, $3D, $22, $30, $22, $20, $73, $70, $61, $63, $65, $3D, $22, $32, $35, $31, $22, $3E, //
$3C, $67, $72, $6F, $75, $70, $20, $6F, $66, $66, $73, $65, $74, $3D, $22, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $44, $61, $74, $61, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Data
$3C, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, $41, $64, $64, $20, $79, $6F, $75, $72, $20, $6F, $77, $6E, $20, $75, $6E, $69, $71, $75, $65, $20, $6E, $6F, $64, $65, $20, $69, $6E, $66, $6F, $20, $68, $65, $72, $65, $3C, $2F, $64, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3E, // Add your own unique node info here
$3C, $69, $6E, $74, $20, $73, $69, $7A, $65, $3D, $22, $31, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $56, $65, $72, $73, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // Version
$3C, $2F, $69, $6E, $74, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $32, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $4E, $61, $6D, $65, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Name
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $73, $74, $72, $69, $6E, $67, $20, $73, $69, $7A, $65, $3D, $22, $34, $30, $22, $3E, //
$3C, $6E, $61, $6D, $65, $3E, $55, $73, $65, $72, $20, $44, $65, $73, $63, $72, $69, $70, $74, $69, $6F, $6E, $3C, $2F, $6E, $61, $6D, $65, $3E, // User Description
$3C, $2F, $73, $74, $72, $69, $6E, $67, $3E, //
$3C, $2F, $67, $72, $6F, $75, $70, $3E, //
$3C, $2F, $73, $65, $67, $6D, $65, $6E, $74, $3E, //
$3C, $2F, $63, $64, $69, $3E, $00 //
);
MAX_FDI_ADDRESS_SPACE_SIZE = 2048;
OFFSET_FDI_DATA = 256; // First 256 bytes in a vNode is for other configuration data
// **************************************************************************************************************************************************************
// All Memory ($FE) Implementation
// **************************************************************************************************************************************************************
type TAllMap = record
LowMem,
HighMem: Word;
end;
const
ALL_MAP: TAllMap = (
$0000, // Lowest Address in the MCU memory the Memory Confguration Protocol can access (NOT USED TODAY, REPLY ASSUMES $00 IS THE LOWEST ADDRESS)
$7FFF // Highest Address in the MCU memory the Memory Confguration Protocol can access
);
// **************************************************************************************************************************************************************
// Configuration Memory ($FD) Implementation
// **************************************************************************************************************************************************************
const
MAX_USER_NAME = 20;
MAX_USER_DESC = 40;
MAX_USER_CONFIG_DATA = MAX_USER_NAME + MAX_USER_DESC;
// **************************************************************************************************************************************************************
// ACDI Mfg Memory ($FC) Implementation
// *****************************************************************************************************************************************************************
const
ACDI_MFG_VERSION = 1;
const
MAX_ACDI_MFG_ARRAY = 26;
ACDI_MFG_STRINGS: array[0..MAX_ACDI_MFG_ARRAY - 1] of byte = (
$4D,$75,$73,$74,$61,$6E,$67,$70,$65,$61,$6B,$00, // Mustangpeak
$43,$53,$31,$30,$30,$00, // CS100
$30,$2E,$31,$00, // 0.1
$30,$2E,$33,$00 // 0.3
);
const
MAX_ACDI_MFG_ARRAY_VNODE = 26;
ACDI_MFG_STRINGS_VNODE: array[0..MAX_ACDI_MFG_ARRAY_VNODE - 1] of byte = (
$4D,$75,$73,$74,$61,$6E,$67,$70,$65,$61,$6B,$00, // Mustangpeak
$56,$4E,$31,$30,$30,$00, // VN100
$30,$2E,$31,$00, // 0.1
$30,$2E,$39,$00 // 0.9
);
// **************************************************************************************************************************************************************
// ACDI User Memory ($FB) Implementation
//
// See the Config Data area
// **************************************************************************************************************************************************************
const
ACDI_USER_VERSION = 1;
// **************************************************************************************************************************************************************
// Protocol Identification Protocol (PIP)
// **************************************************************************************************************************************************************
const
PIV_SUPPORTED_PROTOCOL_COUNT = 8; // UPDATE THIS IF ADDING OR SUBTRACTING SUPPORTED PROTOCOLS
PIV_SUPPORTED_PROTOCOLS: array[0..PIV_SUPPORTED_PROTOCOL_COUNT-1] of TPIVProtocolValueArray = ( // Look at the PIV_xxxx constants for more Protocols
($80, $00, $00, $00, $00, $00), // Protocol
($40, $00, $00, $00, $00, $00), // Datagram Protocol
($04, $00, $00, $00, $00, $00), // Producer Consumer Protocol
($10, $00, $00, $00, $00, $00), // Memory Configruation Protocol
($00, $08, $00, $00, $00, $00), // CDI Protocol
($00, $10, $00, $00, $00, $00), // SNIP Protocol
($00, $40, $00, $00, $00, $00), // ACDI Protocol
($00, $01, $00, $00, $00, $00) // DCC Command Station Protocol
);
PIV_VNODE_SUPPORTED_PROTOCOL_COUNT = 9; // UPDATE THIS IF ADDING OR SUBTRACTING SUPPORTED PROTOCOLS
PIV_VNODE_SUPPORTED_PROTOCOLS: array[0..PIV_VNODE_SUPPORTED_PROTOCOL_COUNT-1] of TPIVProtocolValueArray = ( // Look at the PIV_xxxx constants for more Protocols
($80, $00, $00, $00, $00, $00), // Protocol
($40, $00, $00, $00, $00, $00), // Datagram Protocol
($04, $00, $00, $00, $00, $00), // Producer Consumer Protocol
($10, $00, $00, $00, $00, $00), // Memory Configruation Protocol
($00, $08, $00, $00, $00, $00), // CDI Protocol
($00, $10, $00, $00, $00, $00), // SNIP Protocol
($00, $40, $00, $00, $00, $00), // ACDI Protocol
($00, $04, $00, $00, $00, $00), // Traction Protocol
($00, $02, $00, $00, $00, $00) // Function Description Protocol (FDI)
);
// **************************************************************************************************************************************************************
// Events Flags for Physical AND Virtual Nodes (consumed and produced)
// **************************************************************************************************************************************************************
MAX_EVENTS_CONSUMED_BIT_BYTES = 1; // Set to the number of BYTES required to hold the max number of Events Consumed between Physical and Virtual MULTIPLIED by 2 (2 bits for each Event, 0=do nothing; 1=respond set; 2= respond clear; 3= respond unknown)
MAX_EVENTS_PRODUCED_BIT_BYTES = 1; // Set to the number of BYTES required to hold the max number of Events Produced between Physical and Virtual MULTIPLIED by 2 (2 bits for each Event, 0=do nothing; 1=respond set; 2= respond clear; 3= respond unknown)
// **************************************************************************************************************************************************************
// Events for Physical Node (consumed and produced)
// **************************************************************************************************************************************************************
// Set the number of Events that are Consumed and Produced by this Node
{$IFDEF SUPPORT_AT_LEAST_ONE_CONSUMED_EVENT}MAX_SUPPORTED_EVENTS_CONSUMED = 1;{$ELSE}MAX_SUPPORTED_EVENTS_CONSUMED = 0;{$ENDIF}
{$IFDEF SUPPORT_AT_LEAST_ONE_PRODUCED_EVENT}MAX_SUPPORTED_EVENTS_PRODUCED = 2;{$ELSE}MAX_SUPPORTED_EVENTS_PRODUCED = 0;{$ENDIF}
// Defined the Values of the Events that are Consumed and Produced by this Node
{$IFDEF SUPPORT_AT_LEAST_ONE_CONSUMED_EVENT}
SUPPORTED_EVENTS_CONSUMED: array[0..MAX_SUPPORTED_EVENTS_CONSUMED-1] of TEventID = (
($01, $01, $00, $00, $00, $00, $FF, $FF) // EVENT_EMERGENCY_STOP
);
SUPPORTED_EVENTS_CONSUMED_MASKS: array[0..MAX_EVENTS_CONSUMED_BIT_BYTES-1] of Byte = (
%00000011 // One Event Supported (remember 2 bits for each Event)
);
{$ENDIF}
{$IFDEF SUPPORT_AT_LEAST_ONE_PRODUCED_EVENT}
SUPPORTED_EVENTS_PRODUCED: array[0..MAX_SUPPORTED_EVENTS_PRODUCED-1] of TEventID = (
($01, $01, $00, $00, $00, $00, $04, $01), // I am a Command Station
($01, $01, $00, $00, $00, $00, $FF, $FF) // EVENT_EMERGENCY_STOP
);
SUPPORTED_EVENTS_PRODUCED_MASKS: array[0..MAX_EVENTS_PRODUCED_BIT_BYTES-1] of Byte = (
%00001111 // Two Events Supported (remember 2 bits for each Event)
);
{$ENDIF}
// **************************************************************************************************************************************************************
// Events for Virtual Nodes (consumed and produced)
// **************************************************************************************************************************************************************
// Set the number of Events that are Consumed and Produced by this Node
{$IFDEF SUPPORT_AT_LEAST_ONE_VNODE_CONSUMED_EVENT}MAX_VNODE_SUPPORTED_EVENTS_CONSUMED = 1;{$ELSE}MAX_VNODE_SUPPORTED_EVENTS_CONSUMED = 0;{$ENDIF}
{$IFDEF SUPPORT_AT_LEAST_ONE_VNODE_PRODUCED_EVENT}MAX_VNODE_SUPPORTED_EVENTS_PRODUCED = 3;{$ELSE}MAX_VNODE_SUPPORTED_EVENTS_PRODUCED = 0;{$ENDIF}
// Defined the Values of the Events that are Consumed and Produced by this Node
{$IFDEF SUPPORT_AT_LEAST_ONE_VNODE_CONSUMED_EVENT}
SUPPORTED_VNODE_EVENTS_CONSUMED: array[0..MAX_VNODE_SUPPORTED_EVENTS_CONSUMED-1] of TEventID = (
($01, $01, $00, $00, $00, $00, $FF, $FF) // EVENT_EMERGENCY_STOP
);
SUPPORTED_VNODE_EVENTS_CONSUMED_MASKS: array[0..MAX_EVENTS_CONSUMED_BIT_BYTES-1] of Byte = (
%00000011 // One Events Supported (remember 2 bits for each Event)
);
{$ENDIF}
{$IFDEF SUPPORT_AT_LEAST_ONE_VNODE_PRODUCED_EVENT}
SUPPORTED_VNODE_EVENTS_PRODUCED: array[0..MAX_VNODE_SUPPORTED_EVENTS_PRODUCED-1] of TEventID = (
($01, $01, $00, $00, $00, $00, $03, $03), // EVENT_TRAIN
($01, $01, $00, $00, $00, $00, $03, $04), // EVENT_TRAIN_DCC_IDLE
($01, $01, $00, $00, $00, $00, $03, $05) // EVENT_TRAIN_DCC_INUSE
);
SUPPORTED_VNODE_EVENTS_PRODUCED_MASKS: array[0..MAX_EVENTS_PRODUCED_BIT_BYTES-1] of Byte = (
%00111111 // Threee Events Supported (remember 2 bits for each Event)
);
{$ENDIF}
EVENT_TRAIN_INDEX = 0; // Shortcuts to identify these special Event
EVENT_TRAIN_DCC_IDLE_INDEX = 1;
EVENT_TRAIN_DCC_INUSE_INDEX = 2;
end.