From b6101d00ce35c875256222d46f3e5f39cb26923a Mon Sep 17 00:00:00 2001 From: Tony Date: Sat, 15 Aug 2020 19:22:08 -0500 Subject: [PATCH] Additional updates --- src/raspberrypi/gpiobus.h | 2 +- src/raspberrypi/os.h | 4 +++- src/raspberrypi/rascsi_mgr.h | 7 +++++++ src/raspberrypi/rasctl_command.h | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/raspberrypi/gpiobus.h b/src/raspberrypi/gpiobus.h index 340c958..cb4af9a 100644 --- a/src/raspberrypi/gpiobus.h +++ b/src/raspberrypi/gpiobus.h @@ -572,7 +572,7 @@ private: DWORD signals; // All bus signals -#if defined(USE_SEL_EVENT_ENABLE) && !defined(BAREMETAL) +#if defined(USE_SEL_EVENT_ENABLE) && !defined(BAREMETAL) && defined(__linux__) struct gpioevent_request selevreq; // SEL signal event request int epfd; // epoll file descriptor diff --git a/src/raspberrypi/os.h b/src/raspberrypi/os.h index a85ff10..f249cbc 100644 --- a/src/raspberrypi/os.h +++ b/src/raspberrypi/os.h @@ -61,9 +61,11 @@ #include #include #include +#ifndef __APPLE__ #include -#include #include +#endif +#include #else #include #define htonl(_x) __htonl(_x) diff --git a/src/raspberrypi/rascsi_mgr.h b/src/raspberrypi/rascsi_mgr.h index 3e19138..d8bf734 100644 --- a/src/raspberrypi/rascsi_mgr.h +++ b/src/raspberrypi/rascsi_mgr.h @@ -31,6 +31,9 @@ class Rascsi_Manager{ public: static Rascsi_Manager* GetInstance(); void MapControler(FILE *fp, Disk **map); + void AttachDevice(FILE *fp, Disk *disk, int id, int ui); + void DetachDevice(FILE *fp, Disk *disk, int id, int ui); + Disk* GetDevice(FILE *fp, int id, int ui); void ListDevice(FILE *fp); BOOL Init(); void Close(); @@ -58,5 +61,9 @@ class Rascsi_Manager{ static Rascsi_Manager *m_instance; static BOOL m_active; static BOOL m_running; + + // Any PUBLIC functions should lock this before accessing the m_ctrl + // m_disk or m_bus data structures. The Public functions could be + // called from a different thread. static std::timed_mutex m_locked; }; diff --git a/src/raspberrypi/rasctl_command.h b/src/raspberrypi/rasctl_command.h index 4c0e114..9ece6d7 100644 --- a/src/raspberrypi/rasctl_command.h +++ b/src/raspberrypi/rasctl_command.h @@ -28,8 +28,8 @@ enum rasctl_command : int { enum rasctl_dev_type : int { rasctl_dev_invalid = -1, - rasctl_dev_scsi_hd = 0, rasctl_dev_sasi_hd = 0, + rasctl_dev_scsi_hd = 1, rasctl_dev_mo = 2, rasctl_dev_cd = 3, rasctl_dev_br = 4,