|
OpenLcbCLib 1.0 Alpha
OpenSource C Library to create OpenLcb/Lcc Nodes
|
Configuration memory write handler implementation. More...
Functions | |
| void | ProtocolConfigMemWriteHandler_initialize (const interface_protocol_config_mem_write_handler_t *interface_protocol_config_mem_write_handler) |
| Stores the callback interface. Call once at startup. | |
| void | ProtocolConfigMemWriteHandler_write_space_config_description_info (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch CDI (0xFF) write to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_space_all (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch All (0xFE) write to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_space_config_memory (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch Config (0xFD) write to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_space_acdi_manufacturer (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch ACDI-Mfg (0xFC) write to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_space_acdi_user (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch ACDI-User (0xFB) write to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_space_train_function_definition_info (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch Train FDI (0xFA) write to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_space_train_function_config_memory (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch Train Fn Config (0xF9) write to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_space_firmware (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch Firmware (0xEF) write to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_under_mask_space_config_description_info (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch CDI (0xFF) write-under-mask to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_under_mask_space_all (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch All (0xFE) write-under-mask to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_under_mask_space_config_memory (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch Config (0xFD) write-under-mask to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_under_mask_space_acdi_manufacturer (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch ACDI-Mfg (0xFC) write-under-mask to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_under_mask_space_acdi_user (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch ACDI-User (0xFB) write-under-mask to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_under_mask_space_train_function_definition_info (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch Train FDI (0xFA) write-under-mask to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_under_mask_space_train_function_config_memory (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch Train Fn Config (0xF9) write-under-mask to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_under_mask_space_firmware (openlcb_statemachine_info_t *statemachine_info) |
| Dispatch Firmware (0xEF) write-under-mask to two-phase handler. | |
| void | ProtocolConfigMemWriteHandler_write_message (openlcb_statemachine_info_t *statemachine_info, uint8_t space, uint8_t return_msg_ok, uint8_t return_msg_fail) |
| Processes a generic write message (stub) | |
| void | ProtocolConfigMemWriteHandler_write_reply_ok_message (openlcb_statemachine_info_t *statemachine_info, uint8_t space) |
| Processes a write reply OK message (stub) | |
| void | ProtocolConfigMemWriteHandler_write_reply_fail_message (openlcb_statemachine_info_t *statemachine_info, uint8_t space) |
| Processes a write reply fail message (stub) | |
| void | ProtocolConfigMemWriteHandler_write_request_config_mem (openlcb_statemachine_info_t *statemachine_info, config_mem_write_request_info_t *config_mem_write_request_info) |
| Processes a write request for Configuration Memory space. | |
| void | ProtocolConfigMemWriteHandler_write_request_acdi_user (openlcb_statemachine_info_t *statemachine_info, config_mem_write_request_info_t *config_mem_write_request_info) |
| Processes a write request for ACDI User space. | |
| void | ProtocolConfigMemWriteHandler_write_request_train_function_config_memory (openlcb_statemachine_info_t *statemachine_info, config_mem_write_request_info_t *config_mem_write_request_info) |
| Processes a write request for Train Function Configuration Memory space (0xF9) | |
Configuration memory write handler implementation.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Two-phase dispatch for write commands across all standard address spaces. Supports plain write, write-under-mask (read-modify-write), and firmware upgrade writes. Sends Datagram Received OK with reply-pending before performing the actual write operation.
| void ProtocolConfigMemWriteHandler_initialize | ( | const interface_protocol_config_mem_write_handler_t * | interface_protocol_config_mem_write_handler | ) |
Stores the callback interface. Call once at startup.
* @param interface_protocol_config_mem_write_handler Populated table. *
| void ProtocolConfigMemWriteHandler_write_space_config_description_info | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch CDI (0xFF) write to two-phase handler.
Write to CDI space (0xFF).
| void ProtocolConfigMemWriteHandler_write_space_all | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch All (0xFE) write to two-phase handler.
Write to All space (0xFE).
| void ProtocolConfigMemWriteHandler_write_space_config_memory | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch Config (0xFD) write to two-phase handler.
Write to Config space (0xFD).
| void ProtocolConfigMemWriteHandler_write_space_acdi_manufacturer | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch ACDI-Mfg (0xFC) write to two-phase handler.
Write to ACDI-Mfg space (0xFC).
| void ProtocolConfigMemWriteHandler_write_space_acdi_user | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch ACDI-User (0xFB) write to two-phase handler.
Write to ACDI-User space (0xFB).
| void ProtocolConfigMemWriteHandler_write_space_train_function_definition_info | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch Train FDI (0xFA) write to two-phase handler.
Write to Train FDI space (0xFA).
| void ProtocolConfigMemWriteHandler_write_space_train_function_config_memory | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch Train Fn Config (0xF9) write to two-phase handler.
Write to Train Fn Config space (0xF9).
| void ProtocolConfigMemWriteHandler_write_space_firmware | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch Firmware (0xEF) write to two-phase handler.
Write to Firmware space (0xEF).
| void ProtocolConfigMemWriteHandler_write_under_mask_space_config_description_info | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch CDI (0xFF) write-under-mask to two-phase handler.
Write-under-mask to CDI space (0xFF).
| void ProtocolConfigMemWriteHandler_write_under_mask_space_all | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch All (0xFE) write-under-mask to two-phase handler.
Write-under-mask to All space (0xFE).
| void ProtocolConfigMemWriteHandler_write_under_mask_space_config_memory | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch Config (0xFD) write-under-mask to two-phase handler.
Write-under-mask to Config space (0xFD).
| void ProtocolConfigMemWriteHandler_write_under_mask_space_acdi_manufacturer | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch ACDI-Mfg (0xFC) write-under-mask to two-phase handler.
Write-under-mask to ACDI-Mfg space (0xFC).
| void ProtocolConfigMemWriteHandler_write_under_mask_space_acdi_user | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch ACDI-User (0xFB) write-under-mask to two-phase handler.
Write-under-mask to ACDI-User space (0xFB).
| void ProtocolConfigMemWriteHandler_write_under_mask_space_train_function_definition_info | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch Train FDI (0xFA) write-under-mask to two-phase handler.
Write-under-mask to Train FDI space (0xFA).
| void ProtocolConfigMemWriteHandler_write_under_mask_space_train_function_config_memory | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch Train Fn Config (0xF9) write-under-mask to two-phase handler.
Write-under-mask to Train Fn Config space (0xF9).
| void ProtocolConfigMemWriteHandler_write_under_mask_space_firmware | ( | openlcb_statemachine_info_t * | statemachine_info | ) |
Dispatch Firmware (0xEF) write-under-mask to two-phase handler.
Write-under-mask to Firmware space (0xEF).
| void ProtocolConfigMemWriteHandler_write_message | ( | openlcb_statemachine_info_t * | statemachine_info, |
| uint8_t | space, | ||
| uint8_t | return_msg_ok, | ||
| uint8_t | return_msg_fail ) |
Processes a generic write message (stub)
Generic write message handler. Placeholder.
This stub provides a generic entry point for write command processing.
* @param statemachine_info Pointer to state machine context *
* @param space Address space identifier *
* @param return_msg_ok Message type for successful write response *
* @param return_msg_fail Message type for failed write response *
| void ProtocolConfigMemWriteHandler_write_reply_ok_message | ( | openlcb_statemachine_info_t * | statemachine_info, |
| uint8_t | space ) |
Processes a write reply OK message (stub)
Generic write reply OK handler. Placeholder.
This stub handles successful write response messages when acting as a configuration tool.
* @param statemachine_info Pointer to state machine context *
* @param space Address space identifier *
| void ProtocolConfigMemWriteHandler_write_reply_fail_message | ( | openlcb_statemachine_info_t * | statemachine_info, |
| uint8_t | space ) |
Processes a write reply fail message (stub)
Generic write reply fail handler. Placeholder.
This stub handles failed write response messages when acting as a configuration tool.
* @param statemachine_info Pointer to state machine context *
* @param space Address space identifier *
| void ProtocolConfigMemWriteHandler_write_request_config_mem | ( | openlcb_statemachine_info_t * | statemachine_info, |
| config_mem_write_request_info_t * | config_mem_write_request_info ) |
Processes a write request for Configuration Memory space.
Send write request targeting Config (0xFD) on another node.
Algorithm:
This function handles writes to the primary configuration data storage space. The actual write is delegated to the config_memory_write callback which can implement any storage mechanism (EEPROM, flash, RAM, etc.).
Use cases:
* @param statemachine_info Pointer to state machine context for message generation *
* @param config_mem_write_request_info Pointer to request info with address, byte count, and data buffer *
| void ProtocolConfigMemWriteHandler_write_request_acdi_user | ( | openlcb_statemachine_info_t * | statemachine_info, |
| config_mem_write_request_info_t * | config_mem_write_request_info ) |
Processes a write request for ACDI User space.
Send write request targeting ACDI-User (0xFB) on another node.
Algorithm:
This function maps fixed ACDI user addresses to SNIP data fields for user-customizable identification information. Only name and description fields are writeable.
ACDI User writeable fields:
Use cases:
* @param statemachine_info Pointer to state machine context for message generation *
* @param config_mem_write_request_info Pointer to request info with address indicating which field and data to write *
| void ProtocolConfigMemWriteHandler_write_request_train_function_config_memory | ( | openlcb_statemachine_info_t * | statemachine_info, |
| config_mem_write_request_info_t * | config_mem_write_request_info ) |
Processes a write request for Train Function Configuration Memory space (0xF9)
Write to Train Fn Config (0xF9): updates in-RAM functions[].
Algorithm:
This function writes function values into the train_state_t.functions[] array from datagram data using big-endian byte order. Function N's 16-bit value occupies byte offsets N*2 (high byte) and N*2+1 (low byte). Bulk writes spanning multiple functions are supported.
After storing the values, this fires the same on_function_changed notifier that Set Function commands use, ensuring consistent application behavior regardless of whether the function was set via Train Control command or via Memory Config write to 0xF9.
Use cases:
* @param statemachine_info Pointer to state machine context for message generation *
* @param config_mem_write_request_info Pointer to request info with address, data, and byte count *
Copyright (c) 2026 Jim Kueneman all rights reserved. See the License