From 014cfd8dbd8246fcdcf98d6e4762461be977f2cc Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 9 Sep 2018 22:44:25 +0800 Subject: [PATCH] firmware: add drtioaux routing packets --- .../firmware/libproto_artiq/drtioaux_proto.rs | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/artiq/firmware/libproto_artiq/drtioaux_proto.rs b/artiq/firmware/libproto_artiq/drtioaux_proto.rs index 2d0a24e87..babb40571 100644 --- a/artiq/firmware/libproto_artiq/drtioaux_proto.rs +++ b/artiq/firmware/libproto_artiq/drtioaux_proto.rs @@ -28,6 +28,10 @@ pub enum Packet { RtioErrorCollisionReply { channel: u16 }, RtioErrorBusyReply { channel: u16 }, + RoutingSetPath { destination: u8, hops: [u8; 32] }, + RoutingSetRank { rank: u8 }, + RoutingAck, + MonitorRequest { channel: u16, probe: u8 }, MonitorReply { value: u32 }, InjectionRequest { channel: u16, overrd: u8, value: u8 }, @@ -75,6 +79,20 @@ impl Packet { channel: reader.read_u16()? }, + 0x30 => { + let destination = reader.read_u8()?; + let mut hops = [0; 32]; + reader.read_exact(&mut hops)?; + Packet::RoutingSetPath { + destination: destination, + hops: hops + } + }, + 0x31 => Packet::RoutingSetRank { + rank: reader.read_u8()? + }, + 0x32 => Packet::RoutingAck, + 0x40 => Packet::MonitorRequest { channel: reader.read_u16()?, probe: reader.read_u8()? @@ -185,6 +203,18 @@ impl Packet { writer.write_u16(channel)?; }, + Packet::RoutingSetPath { destination, hops } => { + writer.write_u8(0x30)?; + writer.write_u8(destination)?; + writer.write_all(&hops)?; + }, + Packet::RoutingSetRank { rank } => { + writer.write_u8(0x31)?; + writer.write_u8(rank)?; + }, + Packet::RoutingAck => + writer.write_u8(0x32)?, + Packet::MonitorRequest { channel, probe } => { writer.write_u8(0x40)?; writer.write_u16(channel)?;