Esempio n. 1
0
        public void WriteConfig(string configName, IHAL_CONFIG_BASE config, bool updateConfigSector)
        {
            uint hal_config_block_size = 0;

            HAL_CONFIG_BLOCK header = config.ConfigHeader;

            unsafe
            {
                hal_config_block_size = (uint)sizeof(HAL_CONFIG_BLOCK);

                header.DriverNameString = configName;
            }

            // set up the configuration data
            header.HeaderCRC = 0;
            header.DataCRC   = 0;
            header.Size      = (uint)config.Size - hal_config_block_size;
            header.Signature = version_V2;

            config.ConfigHeader = header;

            // calculate the data crc
            byte[] data = MarshalData(config);
            header.DataCRC = CRC.ComputeCRC(data, (int)hal_config_block_size, (int)(header.Size /* - hal_config_block_size*/), 0);
            // this enables the data type to update itself with the crc (required because there is no class inheritence in structs and therefore no polymorphism)
            config.ConfigHeader = header;

            // calculate the header crc
            data             = MarshalData(config);
            header.HeaderCRC = CRC.ComputeCRC(data, 2 * sizeof(UInt32), (int)hal_config_block_size - (2 * sizeof(UInt32)), seed);
            // this enables the data type to update itself with the crc (required because there is no class inheritence in structs and therefore no polymorphism)
            config.ConfigHeader = header;

            data = MarshalData(config);

            WriteConfig(configName, data, true, updateConfigSector);
        }
        public void WriteConfig(string configName, IHAL_CONFIG_BASE config, bool updateConfigSector)
        {
            uint hal_config_block_size = 0;

            HAL_CONFIG_BLOCK header = config.ConfigHeader;

            unsafe
            {
                hal_config_block_size = (uint)sizeof(HAL_CONFIG_BLOCK);

                header.DriverNameString = configName;
            }

            // set up the configuration data
            header.HeaderCRC = 0;
            header.DataCRC = 0;
            header.Size = (uint)config.Size - hal_config_block_size;
            header.Signature = c_Version_V2;

            config.ConfigHeader = header;

            // calculate the data crc 
            byte[] data = MarshalData(config);
            header.DataCRC = CRC.ComputeCRC(data, (int)hal_config_block_size, (int)(header.Size/* - hal_config_block_size*/), 0);
            // this enables the data type to update itself with the crc (required because there is no class inheritence in structs and therefore no polymorphism)
            config.ConfigHeader = header;

            // calculate the header crc
            data = MarshalData(config);
            header.HeaderCRC = CRC.ComputeCRC(data, 2 * sizeof(UInt32), (int)hal_config_block_size - (2 * sizeof(UInt32)), c_Seed);
            // this enables the data type to update itself with the crc (required because there is no class inheritence in structs and therefore no polymorphism)
            config.ConfigHeader = header;

            data = MarshalData(config);

            WriteConfig(configName, data, true, updateConfigSector);
        }
 /// <summary>
 /// The WriteConfig method is used to update or create a device configuration.  If the name of the configuration exists 
 /// on the device, then the configuration is updated.  Otherwise, a new configuration is added.
 /// </summary>
 /// <param name="configName">Unique case-sensitive name of the configuration</param>
 /// <param name="config">The configuration object to be written</param>
 public void WriteConfig(string configName, IHAL_CONFIG_BASE config)
 {
     WriteConfig(configName, config, true);
 }
Esempio n. 4
0
 public void WriteConfig(string configName, IHAL_CONFIG_BASE config)
 {
     WriteConfig(configName, config, true);
 }