Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: whitequark/glasgow
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 730ccd6f5e57
Choose a base ref
...
head repository: whitequark/glasgow
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4069c6aa9c73
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Mar 1, 2019

  1. Copy the full SHA
    d86e42c View commit details
  2. firmware: persist voltage limit on writes, not reads.

    Oops... this would have written the EEPROM on each `glasgow voltage`
    invocation.
    whitequark committed Mar 1, 2019
    Copy the full SHA
    4069c6a View commit details
Showing with 17 additions and 9 deletions.
  1. +9 −9 firmware/main.c
  2. +1 −0 software/glasgow/applet/__init__.py
  3. +7 −0 software/glasgow/cli.py
18 changes: 9 additions & 9 deletions firmware/main.c
Original file line number Diff line number Diff line change
@@ -634,21 +634,21 @@ void handle_pending_usb_setup() {
if(!iobuf_get_voltage_limit(arg_mask, (__xdata uint16_t *)EP0BUF)) {
STALL_EP0();
} else {
if(!eeprom_write(I2C_ADDR_FX2_MEM,
8 + 4 + __builtin_offsetof(struct glasgow_config, voltage_limit),
(__xdata void *)&glasgow_config.voltage_limit,
sizeof(glasgow_config.voltage_limit),
/*double_byte=*/true, /*page_size=*/8, /*timeout=*/255)) {
STALL_EP0();
} else {
SETUP_EP0_BUF(2);
}
SETUP_EP0_BUF(2);
}
} else {
SETUP_EP0_BUF(2);
while(EP0CS & _BUSY);
if(!iobuf_set_voltage_limit(arg_mask, (__xdata uint16_t *)EP0BUF)) {
latch_status_bit(ST_ERROR);
} else {
if(!eeprom_write(I2C_ADDR_FX2_MEM,
8 + 4 + __builtin_offsetof(struct glasgow_config, voltage_limit),
(__xdata void *)&glasgow_config.voltage_limit,
sizeof(glasgow_config.voltage_limit),
/*double_byte=*/true, /*page_size=*/8, /*timeout=*/255)) {
latch_status_bit(ST_ERROR);
}
}
}

1 change: 1 addition & 0 deletions software/glasgow/applet/__init__.py
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ def __init_subclass__(cls, name, **kwargs):
preview = False
help = "applet help missing"
description = "applet description missing"
required_revision = "A"

@classmethod
def add_build_arguments(cls, parser, access):
7 changes: 7 additions & 0 deletions software/glasgow/cli.py
Original file line number Diff line number Diff line change
@@ -114,6 +114,10 @@ def add_applet_arg(parser, mode, required=False):
help += " (PREVIEW QUALITY APPLET)"
description = " This applet is PREVIEW QUALITY and may CORRUPT DATA or " \
"have missing features. Use at your own risk.\n" + description
if applet.required_revision > "A":
help += " (rev{}+)".format(applet.required_revision)
description += "\n This applet requires Glasgow rev{} or later." \
.format(applet.required_revision)

p_applet = subparsers.add_parser(
applet_name, help=help, description=description,
@@ -289,6 +293,9 @@ def _applet(revision, args):
with_analyzer=hasattr(args, "trace") and args.trace)
applet = GlasgowApplet.all_applets[args.applet]()
try:
if revision < applet.required_revision:
raise GlasgowAppletError("applet requires device rev{}+, rev{} found"
.format(applet.required_revision, revision))
applet.build(target, args)
except GlasgowAppletError as e:
applet.logger.error(e)