Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53eb0bac5f | ||
|
|
5c9f701adc |
7 changed files with 186 additions and 141 deletions
49
.github/workflows/ci.yml
vendored
49
.github/workflows/ci.yml
vendored
|
|
@ -1,49 +0,0 @@
|
|||
name: CI
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set environment variables
|
||||
id: vars
|
||||
run: |
|
||||
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||
|
||||
- name: Dependency packages (apt)
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt -y install git gcc-arm-none-eabi python3-pip srecord stm32flash zip unzip wget
|
||||
|
||||
- name: Dependency packages (pip)
|
||||
run: python3 -m pip install --user crcmod intelhex
|
||||
|
||||
- name: Build dist
|
||||
run: |
|
||||
export VER=${{ steps.vars.outputs.sha_short }}
|
||||
make -j4 dist VER=$VER
|
||||
mkdir -p _cidist
|
||||
mv out/flashfloppy-$VER .
|
||||
rm flashfloppy-$VER/RELEASE_NOTES
|
||||
git rev-parse HEAD >flashfloppy-$VER/COMMIT
|
||||
zip -r flashfloppy-$VER.zip flashfloppy-$VER
|
||||
mv flashfloppy-$VER.zip _cidist/
|
||||
|
||||
- name: Build debug dist
|
||||
run: |
|
||||
export VER=${{ steps.vars.outputs.sha_short }}-debug
|
||||
make -j4 dist VER=$VER level=debug
|
||||
mv out/flashfloppy-$VER .
|
||||
rm flashfloppy-$VER/RELEASE_NOTES
|
||||
git rev-parse HEAD >flashfloppy-$VER/COMMIT
|
||||
echo debug >>flashfloppy-$VER/COMMIT
|
||||
zip -r flashfloppy-$VER.zip flashfloppy-$VER
|
||||
mv flashfloppy-$VER.zip _cidist/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: FlashFloppy.CI.${{ steps.vars.outputs.sha_short }}
|
||||
path: _cidist
|
||||
55
.github/workflows/release.yml
vendored
55
.github/workflows/release.yml
vendored
|
|
@ -1,55 +0,0 @@
|
|||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*'
|
||||
|
||||
name: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set environment variables
|
||||
id: vars
|
||||
run: |
|
||||
echo "::set-output name=ver::$(echo ${{ github.ref }} | sed -e's#.*/v##')"
|
||||
|
||||
- name: Dependency packages (apt)
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt -y install git gcc-arm-none-eabi python3-pip srecord stm32flash zip unzip wget
|
||||
|
||||
- name: Dependency packages (pip)
|
||||
run: python3 -m pip install --user crcmod intelhex
|
||||
|
||||
- name: Build release
|
||||
run: |
|
||||
export VER=${{ steps.vars.outputs.ver }}
|
||||
make -j4 dist VER=$VER
|
||||
mv out/flashfloppy-$VER.zip .
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: FlashFloppy ${{ steps.vars.outputs.ver }}
|
||||
body: "[**Release Notes:**](https://github.com/keirf/flashfloppy/blob/stable-v3/RELEASE_NOTES)"
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload Release Asset
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: flashfloppy-${{ steps.vars.outputs.ver }}.zip
|
||||
asset_name: flashfloppy-${{ steps.vars.outputs.ver }}.zip
|
||||
asset_content_type: application/zip
|
||||
7
Makefile
7
Makefile
|
|
@ -15,21 +15,14 @@ export ROOT := $(CURDIR)
|
|||
prod-%: FORCE
|
||||
$(MAKE) target mcu=$* target=bootloader level=prod
|
||||
$(MAKE) target mcu=$* target=floppy level=prod
|
||||
$(MAKE) target mcu=$* target=quickdisk level=prod
|
||||
$(MAKE) target mcu=$* target=bl_update level=prod
|
||||
$(MAKE) target mcu=$* target=io_test level=prod
|
||||
|
||||
debug-%: FORCE
|
||||
$(MAKE) target mcu=$* target=bootloader level=debug
|
||||
$(MAKE) target mcu=$* target=floppy level=debug
|
||||
$(MAKE) target mcu=$* target=quickdisk level=debug
|
||||
$(MAKE) target mcu=$* target=bl_update level=debug
|
||||
$(MAKE) target mcu=$* target=io_test level=debug
|
||||
|
||||
logfile-%: FORCE
|
||||
$(MAKE) target mcu=$* target=bootloader level=logfile
|
||||
$(MAKE) target mcu=$* target=floppy level=logfile
|
||||
$(MAKE) target mcu=$* target=quickdisk level=logfile
|
||||
|
||||
all-%: FORCE prod-% debug-% logfile-% ;
|
||||
|
||||
|
|
|
|||
|
|
@ -551,7 +551,7 @@ bool_t lcd_init(void)
|
|||
: ((a&~1) == OLED_ADDR);
|
||||
|
||||
if (is_oled_display) {
|
||||
oled_height = (ff_cfg.display_type & DISPLAY_oled_64) ? 64 : 32;
|
||||
oled_height = 64;//(ff_cfg.display_type & DISPLAY_oled_64) ? 64 : 32;
|
||||
lcd_columns = (ff_cfg.oled_font == FONT_8x16) ? 16
|
||||
: (ff_cfg.display_type & DISPLAY_narrower) ? 16
|
||||
: (ff_cfg.display_type & DISPLAY_narrow) ? 18 : 21;
|
||||
|
|
@ -963,7 +963,7 @@ static void oled_init(void)
|
|||
p += oled_queue_cmds(p, dynamic_cmds, dc - dynamic_cmds);
|
||||
|
||||
/* Display is right-way-up, or rotated. */
|
||||
cmds = (ff_cfg.display_type & DISPLAY_rotate) ? rot_cmds : norot_cmds;
|
||||
cmds = 1 ? rot_cmds : norot_cmds; //(ff_cfg.display_type & DISPLAY_rotate) ? rot_cmds : norot_cmds;
|
||||
p += oled_queue_cmds(p, cmds, sizeof(rot_cmds));
|
||||
|
||||
/* Start off the I2C transaction. */
|
||||
|
|
|
|||
65
src/floppy.c
65
src/floppy.c
|
|
@ -291,20 +291,21 @@ void floppy_init(void)
|
|||
|
||||
board_floppy_init();
|
||||
|
||||
if (0) {
|
||||
timer_init(&drv->step.timer, drive_step_timer, drv);
|
||||
timer_init(&drv->motor.timer, motor_spinup_timer, drv);
|
||||
timer_init(&drv->chgrst_timer, chgrst_timer, drv);
|
||||
|
||||
}
|
||||
drive_configure_output_pin(pin_02);
|
||||
drive_configure_output_pin(pin_08);
|
||||
drive_configure_output_pin(pin_26);
|
||||
drive_configure_output_pin(pin_28);
|
||||
drive_configure_output_pin(pin_34);
|
||||
|
||||
if (0) {
|
||||
drive_change_output(drv, outp_dskchg, TRUE);
|
||||
drive_change_output(drv, outp_wrprot, TRUE);
|
||||
drive_change_output(drv, outp_trk0, TRUE);
|
||||
|
||||
floppy_init_irqs();
|
||||
|
||||
IRQx_set_prio(FLOPPY_SOFTIRQ, FLOPPY_SOFTIRQ_PRI);
|
||||
|
|
@ -315,6 +316,66 @@ void floppy_init(void)
|
|||
|
||||
motor_chgrst_eject(drv);
|
||||
}
|
||||
}
|
||||
|
||||
void tone(int hz, int ms)
|
||||
{
|
||||
int us_delay = 1000000 / hz;
|
||||
int h = us_delay / 4;
|
||||
int l = us_delay - h;
|
||||
int n = (ms*1000) / us_delay;
|
||||
while (n--) {
|
||||
gpio_write_pin(gpiob, pin_28, O_TRUE);
|
||||
delay_us(h);
|
||||
gpio_write_pin(gpiob, pin_28, O_FALSE);
|
||||
delay_us(l);
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int get_inputs(void)
|
||||
{
|
||||
unsigned int x = 0;
|
||||
x |= !gpio_read_pin(gpiob, 4); /* 32(16), side */
|
||||
x <<= 1;
|
||||
x |= !gpio_read_pin(gpiob, 9); /* 24(12), wgate */
|
||||
x <<= 1;
|
||||
x |= !gpio_read_pin(gpioa, 8); /* 22(11), wdata */
|
||||
x <<= 1;
|
||||
x |= !gpio_read_pin(gpioa, 1); /* 20(10), step */
|
||||
x <<= 1;
|
||||
x |= !gpio_read_pin(gpiob, 0); /* 18(9), dir */
|
||||
x <<= 1;
|
||||
x |= !gpio_read_pin(gpioa, 0); /* 10(5), sela */
|
||||
return x;
|
||||
}
|
||||
|
||||
int floppy_test(void)
|
||||
{
|
||||
int pins[] = { pin_02, pin_08, pin_26, pin_28, pin_rdata+16, pin_34 };
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < 10; j++) {
|
||||
for (i = 0; i < ARRAY_SIZE(pins); i++) {
|
||||
int pin = pins[i];
|
||||
GPIO _gp = (pin < 16) ? gpiob : gpioa;
|
||||
pin &= 15;
|
||||
gpio_write_pin(_gp, pin, O_TRUE);
|
||||
delay_ms(1);
|
||||
if (get_inputs() != m(i)) {
|
||||
gpio_write_pin(_gp, pin, O_FALSE);
|
||||
goto error;
|
||||
}
|
||||
gpio_write_pin(_gp, pin, O_FALSE);
|
||||
delay_ms(1);
|
||||
if (get_inputs() != 0)
|
||||
goto error;
|
||||
}}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
void floppy_insert(unsigned int unit, struct slot *slot)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,13 +84,6 @@ static void reset_to_main_fw(void)
|
|||
system_reset();
|
||||
}
|
||||
|
||||
static bool_t main_fw_requested(void)
|
||||
{
|
||||
bool_t req = (*(volatile uint32_t *)_ebss == MAIN_FW_KEY);
|
||||
*(volatile uint32_t *)_ebss = 0;
|
||||
return req;
|
||||
}
|
||||
|
||||
static bool_t fw_update_requested(void)
|
||||
{
|
||||
bool_t requested;
|
||||
|
|
@ -384,11 +377,11 @@ int main(void)
|
|||
|
||||
update_requested = fw_update_requested();
|
||||
|
||||
if (main_fw_requested() && !update_requested) {
|
||||
if (1) {//main_fw_requested() && !update_requested) {
|
||||
/* Check for, and jump to, the main firmware. */
|
||||
uint32_t sp = *(uint32_t *)FIRMWARE_START;
|
||||
uint32_t pc = *(uint32_t *)(FIRMWARE_START + 4);
|
||||
if (sp != ~0u) { /* only if firmware is apparently not erased */
|
||||
if (1) {//sp != ~0u) { /* only if firmware is apparently not erased */
|
||||
asm volatile (
|
||||
"mov sp,%0 ; blx %1"
|
||||
:: "r" (sp), "r" (pc));
|
||||
|
|
@ -436,6 +429,8 @@ int main(void)
|
|||
usbh_msc_init();
|
||||
usbh_msc_buffer_set(USBH_Cfg_Rx_Buffer);
|
||||
|
||||
for (;;); /* XXX */
|
||||
|
||||
/* Wait for buttons to be pressed. */
|
||||
wait_buttons(LOW);
|
||||
|
||||
|
|
|
|||
134
src/main.c
134
src/main.c
|
|
@ -593,6 +593,7 @@ static void button_timer_fn(void *unused)
|
|||
b |= rb;
|
||||
rb = 0;
|
||||
|
||||
if (0) {
|
||||
switch (display_type) {
|
||||
case DT_LCD_OLED:
|
||||
b = lcd_handle_backlight(b);
|
||||
|
|
@ -600,7 +601,7 @@ static void button_timer_fn(void *unused)
|
|||
case DT_LED_7SEG:
|
||||
b = led_handle_display(b);
|
||||
break;
|
||||
}
|
||||
}}
|
||||
|
||||
/* Latch final button state and reset the timer. */
|
||||
buttons = b;
|
||||
|
|
@ -3097,6 +3098,61 @@ static void handle_errors(FRESULT fres)
|
|||
system_reset();
|
||||
}
|
||||
|
||||
static void pstr(const char *s)
|
||||
{
|
||||
switch (display_type) {
|
||||
case DT_LED_7SEG:
|
||||
led_7seg_write_string(s);
|
||||
break;
|
||||
case DT_LCD_OLED:
|
||||
lcd_write(9, 0, 0, s);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int test_jp(void)
|
||||
{
|
||||
gpio_configure_pin(gpioa, 5, GPI_pull_up); /* JA */
|
||||
gpio_configure_pin(gpioa, 2, GPI_pull_up); /* JB */
|
||||
gpio_configure_pin(gpiob, 1, GPI_pull_up); /* JC */
|
||||
delay_ms(1);
|
||||
if (!gpio_read_pin(gpioa, 5) ||
|
||||
!gpio_read_pin(gpioa, 2) ||
|
||||
!gpio_read_pin(gpiob, 1))
|
||||
goto error;
|
||||
|
||||
gpio_configure_pin(gpioa, 5, GPO_pushpull(_2MHz, LOW));
|
||||
delay_ms(1);
|
||||
if (!gpio_read_pin(gpioa, 2) ||
|
||||
!gpio_read_pin(gpiob, 1))
|
||||
goto error;
|
||||
gpio_configure_pin(gpioa, 5, GPI_pull_up); /* JA */
|
||||
|
||||
gpio_configure_pin(gpioa, 2, GPO_pushpull(_2MHz, LOW));
|
||||
delay_ms(1);
|
||||
if (!gpio_read_pin(gpioa, 5) ||
|
||||
!gpio_read_pin(gpiob, 1))
|
||||
goto error;
|
||||
gpio_configure_pin(gpioa, 2, GPI_pull_up); /* JB */
|
||||
|
||||
gpio_configure_pin(gpiob, 1, GPO_pushpull(_2MHz, LOW));
|
||||
delay_ms(1);
|
||||
if (!gpio_read_pin(gpioa, 5) ||
|
||||
!gpio_read_pin(gpioa, 2))
|
||||
goto error;
|
||||
gpio_configure_pin(gpiob, 1, GPI_pull_up); /* JA */
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
gpio_configure_pin(gpioa, 5, GPI_pull_up); /* JA */
|
||||
gpio_configure_pin(gpioa, 2, GPI_pull_up); /* JB */
|
||||
gpio_configure_pin(gpiob, 1, GPI_pull_up); /* JC */
|
||||
return -1;
|
||||
}
|
||||
|
||||
void tone(int hz, int ms);
|
||||
int floppy_test(void);
|
||||
int main(void)
|
||||
{
|
||||
static const char * const board_name[] = {
|
||||
|
|
@ -3106,6 +3162,7 @@ int main(void)
|
|||
};
|
||||
|
||||
FRESULT fres;
|
||||
int i = 888, b;
|
||||
|
||||
/* Relocate DATA. Initialise BSS. */
|
||||
if (_sdat != _ldat)
|
||||
|
|
@ -3120,14 +3177,14 @@ int main(void)
|
|||
console_crash_on_input();
|
||||
delay_ms(200); /* 5v settle */
|
||||
|
||||
printk("\n** FlashFloppy %s\n", fw_ver);
|
||||
printk("\n** 435 Test %s\n", fw_ver);
|
||||
printk("** Keir Fraser <keir.xen@gmail.com>\n");
|
||||
printk("** github:keirf/flashfloppy\n\n");
|
||||
|
||||
printk("Build: %s %s\n", build_date, build_time);
|
||||
printk("Board: %s\n", board_name[board_id]);
|
||||
|
||||
speaker_init();
|
||||
// speaker_init();
|
||||
|
||||
flash_ff_cfg_read();
|
||||
|
||||
|
|
@ -3135,20 +3192,6 @@ int main(void)
|
|||
|
||||
display_init();
|
||||
|
||||
while (floppy_ribbon_is_reversed()) {
|
||||
printk("** Error: Ribbon cable upside down?\n");
|
||||
switch (display_type) {
|
||||
case DT_LED_7SEG:
|
||||
led_7seg_write_string("RIB");
|
||||
break;
|
||||
case DT_LCD_OLED:
|
||||
lcd_write(0, 0, -1, "Ribbon Cable May");
|
||||
lcd_write(0, 1, -1, "Be Upside Down? ");
|
||||
lcd_on();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
usbh_msc_init();
|
||||
|
||||
rotary = board_get_rotary();
|
||||
|
|
@ -3156,6 +3199,63 @@ int main(void)
|
|||
timer_init(&button_timer, button_timer_fn, NULL);
|
||||
timer_set(&button_timer, time_now());
|
||||
|
||||
switch (display_type) {
|
||||
case DT_LED_7SEG:
|
||||
led_7seg_write_string("PIN");
|
||||
break;
|
||||
case DT_LCD_OLED:
|
||||
lcd_write(0, 0, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
lcd_write(0, 1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
lcd_write(0, 3, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
lcd_write(7, 0, 0, " PIN ");
|
||||
lcd_on();
|
||||
break;
|
||||
}
|
||||
|
||||
tone(2000, 200);
|
||||
if (floppy_test() != 0) {
|
||||
tone(50, 1000);
|
||||
for (;;);
|
||||
}
|
||||
|
||||
tone(3000, 200);
|
||||
pstr("JP ");
|
||||
if (test_jp() != 0) {
|
||||
tone(50, 1000);
|
||||
for (;;);
|
||||
}
|
||||
|
||||
tone(4000, 200);
|
||||
pstr("USB");
|
||||
|
||||
arena_init();
|
||||
usbh_msc_buffer_set(arena_alloc(512));
|
||||
while ((f_mount(&fatfs, "", 1) != FR_OK))
|
||||
usbh_msc_process();
|
||||
|
||||
tone(6000, 200);
|
||||
for (;;) {
|
||||
|
||||
switch (display_type) {
|
||||
case DT_LED_7SEG:
|
||||
led_7seg_write_decimal(i);
|
||||
break;
|
||||
case DT_LCD_OLED: {
|
||||
char msg[6];
|
||||
snprintf(msg, sizeof(msg), "%d", i);
|
||||
lcd_write(9, 0, 0, msg);
|
||||
break;
|
||||
} }
|
||||
while (!(b = buttons));
|
||||
tone(4000, 50);
|
||||
if (b & B_LEFT) i--;
|
||||
if (b & B_RIGHT) i++;
|
||||
if (b & B_SELECT) i += 100;
|
||||
if (i > 999) i -= 1000;
|
||||
if (i < 0) i += 1000;
|
||||
while (buttons) ;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
|
||||
banner();
|
||||
|
|
|
|||
Loading…
Reference in a new issue