icE1usb fw: Add support for the ICE1USB_DEV_GET_FW_BUILD control request

This was already defined but not implemented

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Change-Id: Id65734153c92ef87bc9ecf967447e9bf11804f24
This commit is contained in:
Sylvain Munaut 2022-01-12 14:12:31 +01:00
parent caf8cf94e1
commit 2c33f6d5bb
4 changed files with 13 additions and 2 deletions

View File

@ -10,11 +10,12 @@ ICEPROG = iceprog
DFU_UTIL = dfu-util
TAG_PREFIX = icE1usb-fw
GITVER = $(shell git describe --match '$(TAG_PREFIX)*')
GITVER = $(shell git describe --match '$(TAG_PREFIX)*' --dirty)
TARGET = $(GITVER)
BOARD_DEFINE=BOARD_$(shell echo $(BOARD) | tr a-z\- A-Z_)
CFLAGS=-Wall -Wextra -Wno-unused-parameter -Os -march=rv32i -mabi=ilp32 -ffreestanding -flto -nostartfiles -fomit-frame-pointer -Wl,--gc-section --specs=nano.specs -D$(BOARD_DEFINE) -I. -I../common
CFLAGS += -DBUILD_INFO="\"$(GITVER) built $(shell date) on $(shell hostname)\""
NO2USB_FW_VERSION=0
include ../../../gateware/cores/no2usb/fw/fw.mk

View File

@ -69,7 +69,7 @@ void main()
/* Init console IO */
console_init();
puts("Booting App image..\n");
printf("\n\nBooting %s\n", fw_build_str);
/* LED */
led_init();

View File

@ -6,6 +6,7 @@
*/
#include <stdint.h>
#include <string.h>
#include <no2usb/usb.h>
#include <no2usb/usb_proto.h>
@ -16,6 +17,9 @@
#include "ice1usb_proto.h"
const char *fw_build_str = BUILD_INFO;
static enum usb_fnd_resp
_usb_dev_ctrl_req(struct usb_ctrl_req *req, struct usb_xfer *xfer)
{
@ -29,6 +33,10 @@ _usb_dev_ctrl_req(struct usb_ctrl_req *req, struct usb_xfer *xfer)
xfer->data[0] = (1 << ICE1USB_DEV_CAP_GPSDO);
xfer->len = 1;
break;
case ICE1USB_DEV_GET_FW_BUILD:
xfer->data = (void*) fw_build_str;
xfer->len = strlen(fw_build_str);
break;
default:
return USB_FND_ERROR;
}

View File

@ -7,4 +7,6 @@
#pragma once
extern const char *fw_build_str;
void usb_dev_init(void);