forked from M-Labs/artiq
coredevice/comm: compare software and gateware versions. Closes #97
This commit is contained in:
parent
7548229910
commit
eeb53c5aa5
|
@ -5,6 +5,7 @@ from enum import Enum
|
||||||
from fractions import Fraction
|
from fractions import Fraction
|
||||||
|
|
||||||
from artiq.language import core as core_language
|
from artiq.language import core as core_language
|
||||||
|
from artiq import __version__ as software_version
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -223,6 +224,11 @@ class CommGeneric:
|
||||||
if runtime_id != b"AROR":
|
if runtime_id != b"AROR":
|
||||||
raise UnsupportedDevice("Unsupported runtime ID: {}"
|
raise UnsupportedDevice("Unsupported runtime ID: {}"
|
||||||
.format(runtime_id))
|
.format(runtime_id))
|
||||||
|
gateware_version = self._read_chunk(self._read_length).decode("utf-8")
|
||||||
|
if gateware_version != software_version:
|
||||||
|
logger.warning("Mismatch between gateware (%s) "
|
||||||
|
"and software (%s) versions",
|
||||||
|
gateware_version, software_version)
|
||||||
|
|
||||||
def switch_clock(self, external):
|
def switch_clock(self, external):
|
||||||
self._write_header(_H2DMsgType.SWITCH_CLOCK)
|
self._write_header(_H2DMsgType.SWITCH_CLOCK)
|
||||||
|
@ -236,7 +242,7 @@ class CommGeneric:
|
||||||
|
|
||||||
self._read_header()
|
self._read_header()
|
||||||
self._read_expect(_D2HMsgType.LOG_REPLY)
|
self._read_expect(_D2HMsgType.LOG_REPLY)
|
||||||
return self._read_chunk(self._read_length).decode('utf-8')
|
return self._read_chunk(self._read_length).decode("utf-8")
|
||||||
|
|
||||||
def clear_log(self):
|
def clear_log(self):
|
||||||
self._write_empty(_H2DMsgType.LOG_CLEAR)
|
self._write_empty(_H2DMsgType.LOG_CLEAR)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <id.h>
|
||||||
|
|
||||||
#include <generated/csr.h>
|
#include <generated/csr.h>
|
||||||
|
|
||||||
|
@ -394,11 +395,17 @@ static int receive_rpc_value(const char **tag, void **slot);
|
||||||
static int process_input(void)
|
static int process_input(void)
|
||||||
{
|
{
|
||||||
switch(buffer_in.header.type) {
|
switch(buffer_in.header.type) {
|
||||||
case REMOTEMSG_TYPE_IDENT_REQUEST:
|
case REMOTEMSG_TYPE_IDENT_REQUEST: {
|
||||||
|
char version[IDENT_SIZE];
|
||||||
|
|
||||||
|
get_ident(version);
|
||||||
|
|
||||||
out_packet_start(REMOTEMSG_TYPE_IDENT_REPLY);
|
out_packet_start(REMOTEMSG_TYPE_IDENT_REPLY);
|
||||||
out_packet_chunk("AROR", 4);
|
out_packet_chunk("AROR", 4);
|
||||||
|
out_packet_chunk(version, strlen(version));
|
||||||
out_packet_finish();
|
out_packet_finish();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case REMOTEMSG_TYPE_SWITCH_CLOCK: {
|
case REMOTEMSG_TYPE_SWITCH_CLOCK: {
|
||||||
int clk = in_packet_int8();
|
int clk = in_packet_int8();
|
||||||
|
|
Loading…
Reference in New Issue