Replace custom Hm01b0Video with the upstream version The version from the current master now supports multiple frames Change-Id: Ic8464581e26d0ee967684b860ebd0cb13020ca0a
diff --git a/hps.resc b/hps.resc index 9272f88..77adae0 100644 --- a/hps.resc +++ b/hps.resc
@@ -15,10 +15,16 @@ include @sim/config/shodan_infrastructure/AddressRangeStub.cs include @sim/config/shodan_infrastructure/CamCtrl.cs include @sim/config/shodan_infrastructure/DoubleBufferDMA.cs -include @sim/config/shodan_infrastructure/Hm01b0Video.cs machine LoadPlatformDescription @sim/config/platforms/hps.repl +cam_i2c.camera AddFrame "../../out/springbok_iree/quant_models/hps_0_quant_input" +cam_i2c.camera AddFrame "../../out/springbok_iree/quant_models/hps_1_quant_input" +cam_i2c.camera AddFrame "../../out/springbok_iree/quant_models/hps_2_quant_input" +cam_i2c.camera AddFrame "../../out/springbok_iree/quant_models/hps_3_quant_input" +cam_i2c.camera AddFrame "../../out/springbok_iree/quant_models/hps_4_quant_input" +cam_i2c.camera AddFrame "../../out/springbok_iree/quant_models/hps_5_quant_input" + $term_port?=3456 emulation CreateServerSocketTerminal $term_port "term" false connector Connect uart5 term
diff --git a/platforms/hps.repl b/platforms/hps.repl index 1b28780..23d5a5b 100644 --- a/platforms/hps.repl +++ b/platforms/hps.repl
@@ -6,7 +6,7 @@ isp: Sensors.DoubleBufferDMA @ sysbus 0x54060000 IRQ -> smc_plic@17 -camera: Sensors.Hm01b0Video @ {isp; cam_i2c 0x24} +camera: Sensors.HiMaxHM01B0 @ {isp; cam_i2c 0x24} // TODO(jesionowski): Temporary piece of flash for the finch app. Tock kernel // assumes that the app needs to be relocated from flash. This must be removed
diff --git a/shodan_infrastructure/Hm01b0Video.cs b/shodan_infrastructure/Hm01b0Video.cs deleted file mode 100644 index 959e762..0000000 --- a/shodan_infrastructure/Hm01b0Video.cs +++ /dev/null
@@ -1,107 +0,0 @@ -// -// Copyright (c) 2022 Google LLC -// -// This file is licensed under the MIT License. -// Full license text is available in 'licenses/MIT.txt'. -// - -using System; -using System.IO; -using Antmicro.Renode.Exceptions; -using Antmicro.Renode.Logging; -using Antmicro.Renode.Peripherals.Sensor; -using Antmicro.Renode.Peripherals.I2C; - -namespace Antmicro.Renode.Peripherals.Sensors -{ - public class Hm01b0Video : I2CPeripheralBase<HiMaxHM01B0.Registers>, ICPIPeripheral, ISensor - { - public Hm01b0Video() : base(16) - { - imageData = new byte[0]; - imageIdx = 0; - LoadFrame(); - } - - public void Reset() - { - base.Reset(); - imageIdx = 0; - LoadFrame(); - } - - void LoadFrame() - { - var filename = frames[imageIdx]; - try - { - imageData = File.ReadAllBytes(filename); - - this.NoisyLog("Loaded {0} bytes of image data to buffer", imageData.Length); - } - catch(Exception e) - { - throw new RecoverableException($"Could not load image {filename}: {(e.Message)}"); - } - } - - public byte[] ReadFrame() - { - var ret = imageData; - - imageIdx += 1; - if(imageIdx == frames.Length) { - imageIdx = 0; - } - LoadFrame(); - - return ret; - } - - protected override void DefineRegisters() - { - } - - private byte[] imageData; - private uint imageIdx; - private string[] frames = { - "../../out/springbok_iree/quant_models/hps_0_quant_input", - "../../out/springbok_iree/quant_models/hps_1_quant_input", - "../../out/springbok_iree/quant_models/hps_2_quant_input", - "../../out/springbok_iree/quant_models/hps_3_quant_input", - "../../out/springbok_iree/quant_models/hps_4_quant_input", - "../../out/springbok_iree/quant_models/hps_5_quant_input", - }; - - // based on https://github.com/sparkfun/SparkFun_Apollo3_AmbiqSuite_BSPs/blob/master/common/third_party/hm01b0/HM01B0.h - public enum Registers - { - ModelIdHigh = 0x0000, - ModelIdLow = 0x0001, - SiliconRevision = 0x0002, - FrameCount = 0x0005, - PixelOrder = 0x0006, - - ModeSelect = 0x0100, - ImageOrientation = 0x0101, - SoftwareReset = 0x0103, - GRP_ParamHold = 0x0104, - - IntegrationHigh = 0x0202, - IntegrationLow = 0x0203, - AnalogGain = 0x0205, - DigitalGainHigh = 0x020E, - DigitalGainLow = 0x020F, - - AE_TargetMean = 0x2101, - AE_MinMean = 0x2102, - ConvergeInThreshold = 0x2103, - ConvergeOutThreshold = 0x2104, - - I2C_IdSelection = 0x3400, - I2C_Id = 0x3401, - - PMU_ProgrammableFrameCount = 0x3020, - } - } -}