mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Add lots more protobuf machinery.
This commit is contained in:
6
.github/workflows/ccpp.yml
vendored
6
.github/workflows/ccpp.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
- name: apt
|
- name: apt
|
||||||
run: sudo apt update && sudo apt install libusb-1.0-0-dev libsqlite3-dev ninja-build
|
run: sudo apt update && sudo apt install libusb-1.0-0-dev libsqlite3-dev ninja-build protobuf-compiler
|
||||||
- name: make
|
- name: make
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
- name: brew
|
- name: brew
|
||||||
run: brew install sqlite pkg-config libusb ninja
|
run: brew install sqlite pkg-config libusb ninja protobuf
|
||||||
- name: make
|
- name: make
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
- name: pacman
|
- name: pacman
|
||||||
run: |
|
run: |
|
||||||
pacman -S --noconfirm --needed make ninja mingw-w64-i686-libusb mingw-w64-i686-sqlite3 mingw-w64-i686-zlib mingw-w64-cross-gcc zip
|
pacman -S --noconfirm --needed make ninja mingw-w64-i686-libusb mingw-w64-i686-sqlite3 mingw-w64-i686-zlib mingw-w64-cross-gcc zip protobuf mingw-w64-i686-protobuf
|
||||||
- name: build
|
- name: build
|
||||||
run: |
|
run: |
|
||||||
make CXX=/opt/bin/i686-w64-mingw32-g++.exe AR="/opt/bin/i686-w64-mingw32-ar.exe rcs"
|
make CXX=/opt/bin/i686-w64-mingw32-g++.exe AR="/opt/bin/i686-w64-mingw32-ar.exe rcs"
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -1,4 +1,4 @@
|
|||||||
PACKAGES = zlib sqlite3 libusb-1.0
|
PACKAGES = zlib sqlite3 libusb-1.0 protobuf
|
||||||
|
|
||||||
export CFLAGS = --std=c++14 -ffunction-sections -fdata-sections
|
export CFLAGS = --std=c++14 -ffunction-sections -fdata-sections
|
||||||
export LDFLAGS =
|
export LDFLAGS =
|
||||||
|
|||||||
10
arch/brother/brother.proto
Normal file
10
arch/brother/brother.proto
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
message Brother {
|
||||||
|
optional double clock_rate_us = 1 [default = 3.83];
|
||||||
|
optional double post_index_gap_ms = 2 [default = 1.0];
|
||||||
|
optional double sector_spacing_ms = 3 [default = 16.2];
|
||||||
|
optional double post_header_spacing_ms = 4 [default = 0.69];
|
||||||
|
optional string sector_skew = 5 [default = "05a3816b4927"];
|
||||||
|
}
|
||||||
|
|
||||||
24
arch/ibm/ibm.proto
Normal file
24
arch/ibm/ibm.proto
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
message IBM {
|
||||||
|
enum FmMfm {
|
||||||
|
USE_MFM = 0;
|
||||||
|
USE_FM = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
optional double track_length_ms = 1;
|
||||||
|
optional int32 sector_size_bytes = 2;
|
||||||
|
optional bool emit_iam = 3;
|
||||||
|
optional int32 start_sector_id = 4;
|
||||||
|
optional double clock_rate_khz = 5;
|
||||||
|
optional FmMfm use_fm = 6 [default = USE_MFM];
|
||||||
|
optional int32 idam_byte = 7;
|
||||||
|
optional int32 dam_byte = 8;
|
||||||
|
optional int32 gap0 = 9;
|
||||||
|
optional int32 gap1 = 10;
|
||||||
|
optional int32 gap2 = 11;
|
||||||
|
optional int32 gap3 = 12;
|
||||||
|
optional string sector_skew = 13;
|
||||||
|
optional bool swap_sizes = 14;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,31 @@
|
|||||||
syntax = "proto2";
|
syntax = "proto2";
|
||||||
|
|
||||||
|
import "arch/brother/brother.proto";
|
||||||
|
import "arch/ibm/ibm.proto";
|
||||||
|
import "lib/decoders/decoder.proto";
|
||||||
|
import "lib/imagereader/img.proto";
|
||||||
|
|
||||||
|
message DiskEncoding {
|
||||||
|
optional int32 cylinder = 1;
|
||||||
|
optional int32 head = 2;
|
||||||
|
oneof format {
|
||||||
|
IBM ibm = 3;
|
||||||
|
Brother brother = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message FileEncoding {
|
||||||
|
optional string filename = 1;
|
||||||
|
oneof format {
|
||||||
|
Img img = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
message Config {
|
message Config {
|
||||||
optional string thing = 1;
|
optional string thing = 1;
|
||||||
|
|
||||||
|
repeated DiskEncoding disk = 2;
|
||||||
|
optional FileEncoding file = 3;
|
||||||
|
optional Decoder decoder = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
9
lib/decoders/decoder.proto
Normal file
9
lib/decoders/decoder.proto
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
message Decoder {
|
||||||
|
optional double pulse_debounce_threshold = 1 [default = 0.30];
|
||||||
|
optional double bit_error_threshold = 2 [default = 0.40];
|
||||||
|
optional double clock_interval_bias = 3 [default = -0.02];
|
||||||
|
optional double minimum_clock_us = 4 [default = 0.75];
|
||||||
|
}
|
||||||
|
|
||||||
17
lib/imagereader/img.proto
Normal file
17
lib/imagereader/img.proto
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
syntax = "proto2";
|
||||||
|
|
||||||
|
message Img {
|
||||||
|
message Format {
|
||||||
|
optional int32 track = 1;
|
||||||
|
optional int32 side = 2;
|
||||||
|
|
||||||
|
optional int64 file_offset = 3;
|
||||||
|
optional int32 sector_size = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
optional int32 tracks = 1;
|
||||||
|
optional int32 heads = 2;
|
||||||
|
optional int32 sectors = 3;
|
||||||
|
repeated Format format = 4;
|
||||||
|
}
|
||||||
|
|
||||||
13
mkninja.sh
13
mkninja.sh
@@ -177,6 +177,7 @@ runtest() {
|
|||||||
buildprogram $OBJDIR/$prog \
|
buildprogram $OBJDIR/$prog \
|
||||||
lib$prog.a \
|
lib$prog.a \
|
||||||
libbackend.a \
|
libbackend.a \
|
||||||
|
libproto.a \
|
||||||
libagg.a \
|
libagg.a \
|
||||||
libfmt.a
|
libfmt.a
|
||||||
|
|
||||||
@@ -192,10 +193,15 @@ buildlibrary libfmt.a \
|
|||||||
dep/fmt/format.cc \
|
dep/fmt/format.cc \
|
||||||
dep/fmt/posix.cc \
|
dep/fmt/posix.cc \
|
||||||
|
|
||||||
buildproto libconfig.a \
|
buildproto libproto.a \
|
||||||
lib/config.proto
|
arch/brother/brother.proto \
|
||||||
|
arch/ibm/ibm.proto \
|
||||||
|
lib/config.proto \
|
||||||
|
lib/decoders/decoder.proto \
|
||||||
|
lib/imagereader/img.proto \
|
||||||
|
|
||||||
buildlibrary libbackend.a \
|
buildlibrary libbackend.a \
|
||||||
|
-I$OBJDIR/proto \
|
||||||
lib/imagereader/diskcopyimagereader.cc \
|
lib/imagereader/diskcopyimagereader.cc \
|
||||||
lib/imagereader/imagereader.cc \
|
lib/imagereader/imagereader.cc \
|
||||||
lib/imagereader/imgimagereader.cc \
|
lib/imagereader/imgimagereader.cc \
|
||||||
@@ -260,6 +266,7 @@ buildlibrary libbackend.a \
|
|||||||
lib/csvreader.cc \
|
lib/csvreader.cc \
|
||||||
|
|
||||||
buildlibrary libfrontend.a \
|
buildlibrary libfrontend.a \
|
||||||
|
-I$OBJDIR/proto \
|
||||||
src/fe-analysedriveresponse.cc \
|
src/fe-analysedriveresponse.cc \
|
||||||
src/fe-analyselayout.cc \
|
src/fe-analyselayout.cc \
|
||||||
src/fe-cwftoflux.cc \
|
src/fe-cwftoflux.cc \
|
||||||
@@ -305,6 +312,7 @@ buildlibrary libfrontend.a \
|
|||||||
buildprogram fluxengine \
|
buildprogram fluxengine \
|
||||||
libfrontend.a \
|
libfrontend.a \
|
||||||
libbackend.a \
|
libbackend.a \
|
||||||
|
libproto.a \
|
||||||
libfmt.a \
|
libfmt.a \
|
||||||
libagg.a \
|
libagg.a \
|
||||||
|
|
||||||
@@ -338,6 +346,7 @@ runtest fmmfm-test tests/fmmfm.cc
|
|||||||
runtest greaseweazle-test tests/greaseweazle.cc
|
runtest greaseweazle-test tests/greaseweazle.cc
|
||||||
runtest kryoflux-test tests/kryoflux.cc
|
runtest kryoflux-test tests/kryoflux.cc
|
||||||
runtest ldbs-test tests/ldbs.cc
|
runtest ldbs-test tests/ldbs.cc
|
||||||
|
runtest proto-test -I$OBJDIR/proto tests/proto.cc
|
||||||
|
|
||||||
# vim: sw=4 ts=4 et
|
# vim: sw=4 ts=4 et
|
||||||
|
|
||||||
|
|||||||
18
tests/proto.cc
Normal file
18
tests/proto.cc
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#include "globals.h"
|
||||||
|
#include "bytes.h"
|
||||||
|
#include "lib/config.pb.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
static void test_proto(void)
|
||||||
|
{
|
||||||
|
Config config;
|
||||||
|
config.set_thing("fnord");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, const char* argv[])
|
||||||
|
{
|
||||||
|
test_proto();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user