diff --git a/src/userland/scisi/compile_flags.txt b/src/userland/scisi/compile_flags.txt new file mode 100644 index 0000000..f084bb0 --- /dev/null +++ b/src/userland/scisi/compile_flags.txt @@ -0,0 +1,6 @@ +clang +-Iinclude +-I../../include +-fms-extensions +-Wno-microsoft-anon-tag +-Wno-incompatible-library-redeclaration diff --git a/src/userland/scisi/compile_flags.txt b/src/userland/scisi/compile_flags.txt new file mode 100644 index 0000000..f084bb0 --- /dev/null +++ b/src/userland/scisi/compile_flags.txt @@ -0,0 +1,6 @@ +clang +-Iinclude +-I../../include +-fms-extensions +-Wno-microsoft-anon-tag +-Wno-incompatible-library-redeclaration diff --git a/src/userland/scisi/include/scisi.h b/src/userland/scisi/include/scisi.h new file mode 100644 index 0000000..7faddb1 --- /dev/null +++ b/src/userland/scisi/include/scisi.h @@ -0,0 +1,12 @@ +#ifndef SCISI_H +#define SCISI_H + +#include + +typedef struct { + uint32_t in, out; + uint32_t serviceId, id; + uint32_t inFunction, outFunction; +} ScisiDevice; + +#endif \ No newline at end of file diff --git a/src/userland/scisi/compile_flags.txt b/src/userland/scisi/compile_flags.txt new file mode 100644 index 0000000..f084bb0 --- /dev/null +++ b/src/userland/scisi/compile_flags.txt @@ -0,0 +1,6 @@ +clang +-Iinclude +-I../../include +-fms-extensions +-Wno-microsoft-anon-tag +-Wno-incompatible-library-redeclaration diff --git a/src/userland/scisi/include/scisi.h b/src/userland/scisi/include/scisi.h new file mode 100644 index 0000000..7faddb1 --- /dev/null +++ b/src/userland/scisi/include/scisi.h @@ -0,0 +1,12 @@ +#ifndef SCISI_H +#define SCISI_H + +#include + +typedef struct { + uint32_t in, out; + uint32_t serviceId, id; + uint32_t inFunction, outFunction; +} ScisiDevice; + +#endif \ No newline at end of file diff --git a/src/userland/scisi/main.c b/src/userland/scisi/main.c index f2e8ee8..9ac7c4e 100644 --- a/src/userland/scisi/main.c +++ b/src/userland/scisi/main.c @@ -1,7 +1,22 @@ #include +#include + +ListElement *devices = NULL; int32_t registerDevice(uint32_t in, uint32_t out, uint32_t serviceName, uint32_t serviceId) { - printf("registering a new SCISI device...\n"); + ScisiDevice *device = malloc(sizeof(ScisiDevice)); + device->serviceId = serviceId; + device->id = listCount(devices); + device->in = in; + device->out = out; + device->inFunction = getFunction(serviceId, "scisi_in"); + device->outFunction = getFunction(serviceId, "scisi_out"); + listAdd(&devices, device); + printf("registering a new SCISI device (in: %x, out: %x)\n", in, out); + request(device->serviceId, device->outFunction, device->out, 0); + request(device->serviceId, device->inFunction, device->in, 0); + return 0; + } int32_t main() { diff --git a/src/userland/scisi/compile_flags.txt b/src/userland/scisi/compile_flags.txt new file mode 100644 index 0000000..f084bb0 --- /dev/null +++ b/src/userland/scisi/compile_flags.txt @@ -0,0 +1,6 @@ +clang +-Iinclude +-I../../include +-fms-extensions +-Wno-microsoft-anon-tag +-Wno-incompatible-library-redeclaration diff --git a/src/userland/scisi/include/scisi.h b/src/userland/scisi/include/scisi.h new file mode 100644 index 0000000..7faddb1 --- /dev/null +++ b/src/userland/scisi/include/scisi.h @@ -0,0 +1,12 @@ +#ifndef SCISI_H +#define SCISI_H + +#include + +typedef struct { + uint32_t in, out; + uint32_t serviceId, id; + uint32_t inFunction, outFunction; +} ScisiDevice; + +#endif \ No newline at end of file diff --git a/src/userland/scisi/main.c b/src/userland/scisi/main.c index f2e8ee8..9ac7c4e 100644 --- a/src/userland/scisi/main.c +++ b/src/userland/scisi/main.c @@ -1,7 +1,22 @@ #include +#include + +ListElement *devices = NULL; int32_t registerDevice(uint32_t in, uint32_t out, uint32_t serviceName, uint32_t serviceId) { - printf("registering a new SCISI device...\n"); + ScisiDevice *device = malloc(sizeof(ScisiDevice)); + device->serviceId = serviceId; + device->id = listCount(devices); + device->in = in; + device->out = out; + device->inFunction = getFunction(serviceId, "scisi_in"); + device->outFunction = getFunction(serviceId, "scisi_out"); + listAdd(&devices, device); + printf("registering a new SCISI device (in: %x, out: %x)\n", in, out); + request(device->serviceId, device->outFunction, device->out, 0); + request(device->serviceId, device->inFunction, device->in, 0); + return 0; + } int32_t main() { diff --git a/src/userland/usbStorage/main.c b/src/userland/usbStorage/main.c index 19b6e3a..91655ae 100644 --- a/src/userland/usbStorage/main.c +++ b/src/userland/usbStorage/main.c @@ -33,6 +33,20 @@ REQUEST(registerScisi, "scisi", "register"); ListElement *devices; +uint32_t in(uint32_t in) { + StorageDevice *device = listGet(devices, in & 0xFFFF); + uint16_t endpoint = in >> 16; + printf("reading from device %i (usb device %i, endpoint %i, id %x)...\n", device->id, device->deviceId, endpoint, in); + return 0; +} + +uint32_t out(uint32_t out) { + StorageDevice *device = listGet(devices, out & 0xFFFF); + uint16_t endpoint = out >> 16; + printf("writing to device %i (usb device %i, endpoint %i, id %x)...\n", device->id, device->deviceId, endpoint, out); + return 0; +} + void setup(uint32_t in, uint32_t out, uint32_t serviceName, uint32_t serviceId) { uint32_t getType = getFunction(serviceId, "get_type"); UsbInterfaceType typeIn = { .value = request(serviceId, getType, in, 0) }; @@ -77,10 +91,12 @@ device->id = listCount(devices); listAdd(&devices, device); if (subClass == SCISI_Transparent && protocol == BulkOnly) { - registerScisi(device->id, 0); + registerScisi(device->id | (in & 0xFFFF0000), device->id | (out & 0xFFFF0000)); } } int32_t main() { createFunction("setup", (void *) setup); + createFunction("scisi_in", (void *) in); + createFunction("scisi_out", (void *) out); } \ No newline at end of file