From fce40c6175abf5442b04ff06524bcb49d753b9c6 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Mon, 26 Oct 2020 01:11:00 +0000 Subject: [PATCH] Add FreeBSD skeleton. --- CMakeLists.txt | 2 +- freebsd/CMakeLists.txt | 12 ++++++++ freebsd/ata.c | 66 ++++++++++++++++++++++++++++++++++++++++++ freebsd/device.c | 36 +++++++++++++++++++++++ freebsd/freebsd.h | 27 +++++++++++++++++ freebsd/ieee1394.c | 31 ++++++++++++++++++++ freebsd/list_devices.c | 26 +++++++++++++++++ freebsd/pcmcia.c | 26 +++++++++++++++++ freebsd/scsi.c | 36 +++++++++++++++++++++++ freebsd/sdhci.c | 52 +++++++++++++++++++++++++++++++++ freebsd/usb.c | 33 +++++++++++++++++++++ 11 files changed, 346 insertions(+), 1 deletion(-) create mode 100644 freebsd/CMakeLists.txt create mode 100644 freebsd/ata.c create mode 100644 freebsd/device.c create mode 100644 freebsd/freebsd.h create mode 100644 freebsd/ieee1394.c create mode 100644 freebsd/list_devices.c create mode 100644 freebsd/pcmcia.c create mode 100644 freebsd/scsi.c create mode 100644 freebsd/sdhci.c create mode 100644 freebsd/usb.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 09bfd59..652fcdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ else () endif () -set(AARU_PORTS "linux;wii;win32" CACHE STRING "List of ports to build") +set(AARU_PORTS "linux;wii;win32;freebsd" CACHE STRING "List of ports to build") foreach (PORT IN LISTS AARU_PORTS) add_subdirectory(${PORT}) endforeach (PORT) diff --git a/freebsd/CMakeLists.txt b/freebsd/CMakeLists.txt new file mode 100644 index 0000000..c8530c2 --- /dev/null +++ b/freebsd/CMakeLists.txt @@ -0,0 +1,12 @@ +project(aaruremote-fbsd C) + +if (NOT "${CMAKE_SYSTEM}" MATCHES "FreeBSD") + return() +endif () + +set(PLATFORM_SOURCES list_devices.c freebsd.h device.c scsi.c usb.c ieee1394.c pcmcia.c ata.c sdhci.c ../unix/hello.c + ../unix/network.c ../unix/unix.c ../unix/unix.h) + +add_executable(aaruremote ${PLATFORM_SOURCES}) + +target_link_libraries(aaruremote aaruremotecore) \ No newline at end of file diff --git a/freebsd/ata.c b/freebsd/ata.c new file mode 100644 index 0000000..7bb02f8 --- /dev/null +++ b/freebsd/ata.c @@ -0,0 +1,66 @@ +/* + * This file is part of the Aaru Remote Server. + * Copyright (c) 2019-2020 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "../aaruremote.h" +#include "freebsd.h" + +int32_t SendAtaChsCommand(void* device_ctx, + AtaRegistersChs registers, + AtaErrorRegistersChs* error_registers, + uint8_t protocol, + uint8_t transfer_register, + char* buffer, + uint32_t timeout, + uint8_t transfer_blocks, + uint32_t* duration, + uint32_t* sense, + uint32_t* buf_len) +{ + return -1; +} + +int32_t SendAtaLba28Command(void* device_ctx, + AtaRegistersLba28 registers, + AtaErrorRegistersLba28* error_registers, + uint8_t protocol, + uint8_t transfer_register, + char* buffer, + uint32_t timeout, + uint8_t transfer_blocks, + uint32_t* duration, + uint32_t* sense, + uint32_t* buf_len) +{ + return -1; +} + +int32_t SendAtaLba48Command(void* device_ctx, + AtaRegistersLba48 registers, + AtaErrorRegistersLba48* error_registers, + uint8_t protocol, + uint8_t transfer_register, + char* buffer, + uint32_t timeout, + uint8_t transfer_blocks, + uint32_t* duration, + uint32_t* sense, + uint32_t* buf_len) +{ + return -1; +} \ No newline at end of file diff --git a/freebsd/device.c b/freebsd/device.c new file mode 100644 index 0000000..948178d --- /dev/null +++ b/freebsd/device.c @@ -0,0 +1,36 @@ +/* + * This file is part of the Aaru Remote Server. + * Copyright (c) 2019-2020 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "../aaruremote.h" +#include "freebsd.h" + +void* DeviceOpen(const char* device_path) +{ + return NULL; +} + +void DeviceClose(void* device_ctx) +{ + return; +} + +int32_t GetDeviceType(void* device_ctx) +{ + return -1; +} diff --git a/freebsd/freebsd.h b/freebsd/freebsd.h new file mode 100644 index 0000000..e75f7ea --- /dev/null +++ b/freebsd/freebsd.h @@ -0,0 +1,27 @@ +/* + * This file is part of the Aaru Remote Server. + * Copyright (c) 2019-2020 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef AARUREMOTE_FREEBSD_FREEBSD_H_ +#define AARUREMOTE_FREEBSD_FREEBSD_H_ + +typedef struct +{ + int fd; + char device_path[4096]; +} DeviceContext; + +#endif // AARUREMOTE_FREEBSD_FREEBSD_H_ diff --git a/freebsd/ieee1394.c b/freebsd/ieee1394.c new file mode 100644 index 0000000..d2b61d6 --- /dev/null +++ b/freebsd/ieee1394.c @@ -0,0 +1,31 @@ +/* + * This file is part of the Aaru Remote Server. + * Copyright (c) 2019-2020 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "../aaruremote.h" +#include "freebsd.h" + +uint8_t GetFireWireData(void* device_ctx, + uint32_t* id_model, + uint32_t* id_vendor, + uint64_t* guid, + char* vendor, + char* model) +{ + return 0; +} diff --git a/freebsd/list_devices.c b/freebsd/list_devices.c new file mode 100644 index 0000000..3f0df42 --- /dev/null +++ b/freebsd/list_devices.c @@ -0,0 +1,26 @@ +/* + * This file is part of the Aaru Remote Server. + * Copyright (c) 2019-2020 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "../aaruremote.h" +#include "freebsd.h" + +DeviceInfoList* ListDevices() +{ + return NULL; +} \ No newline at end of file diff --git a/freebsd/pcmcia.c b/freebsd/pcmcia.c new file mode 100644 index 0000000..fdddcbf --- /dev/null +++ b/freebsd/pcmcia.c @@ -0,0 +1,26 @@ +/* + * This file is part of the Aaru Remote Server. + * Copyright (c) 2019-2020 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "../aaruremote.h" +#include "freebsd.h" + +uint8_t GetPcmciaData(void* device_ctx, uint16_t* cis_len, char* cis) +{ + return 0; +} diff --git a/freebsd/scsi.c b/freebsd/scsi.c new file mode 100644 index 0000000..c011fb9 --- /dev/null +++ b/freebsd/scsi.c @@ -0,0 +1,36 @@ +/* + * This file is part of the Aaru Remote Server. + * Copyright (c) 2019-2020 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "../aaruremote.h" +#include "freebsd.h" + +int32_t SendScsiCommand(void* device_ctx, + char* cdb, + char* buffer, + char** sense_buffer, + uint32_t timeout, + int32_t direction, + uint32_t* duration, + uint32_t* sense, + uint32_t cdb_len, + uint32_t* buf_len, + uint32_t* sense_len) +{ + return -1; +} \ No newline at end of file diff --git a/freebsd/sdhci.c b/freebsd/sdhci.c new file mode 100644 index 0000000..daff553 --- /dev/null +++ b/freebsd/sdhci.c @@ -0,0 +1,52 @@ +/* + * This file is part of the Aaru Remote Server. + * Copyright (c) 2019-2020 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "../aaruremote.h" +#include "freebsd.h" + +int32_t SendSdhciCommand(void* device_ctx, + uint8_t command, + uint8_t write, + uint8_t application, + uint32_t flags, + uint32_t argument, + uint32_t block_size, + uint32_t blocks, + char* buffer, + uint32_t buf_len, + uint32_t timeout, + uint32_t* response, + uint32_t* duration, + uint32_t* sense) +{ + return 0; +} + +int32_t GetSdhciRegisters(void* device_ctx, + char** csd, + char** cid, + char** ocr, + char** scr, + uint32_t* csd_len, + uint32_t* cid_len, + uint32_t* ocr_len, + uint32_t* scr_len) +{ + return 0; +} \ No newline at end of file diff --git a/freebsd/usb.c b/freebsd/usb.c new file mode 100644 index 0000000..01c0bea --- /dev/null +++ b/freebsd/usb.c @@ -0,0 +1,33 @@ +/* + * This file is part of the Aaru Remote Server. + * Copyright (c) 2019-2020 Natalia Portillo. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include + +#include "../aaruremote.h" +#include "freebsd.h" + +uint8_t GetUsbData(void* device_ctx, + uint16_t* desc_len, + char* descriptors, + uint16_t* id_vendor, + uint16_t* id_product, + char* manufacturer, + char* product, + char* serial) +{ + return -1; +}