diff --git a/esp32/main/spectfd.c b/esp32/main/spectfd.c index fae60d6a..1f8dac3b 100644 --- a/esp32/main/spectfd.c +++ b/esp32/main/spectfd.c @@ -1,8 +1,10 @@ #include "spectfd.h" #include #include +#include #define MAX_SPECT_FD 16 +#define SPECTFD_RESERVED (0) static int spectfd_map[MAX_SPECT_FD]; @@ -11,11 +13,21 @@ void spectfd__init(void) memset(spectfd_map, 0xFF, sizeof(spectfd_map)); } +static bool spectfd__is_valid_system(int index) +{ + return (spectfd_map[index]>SPECTFD_RESERVED); +} + +static bool spectfd__is_valid_system_or_reserved(int index) +{ + return (spectfd_map[index]>SPECTFD_RESERVED); +} + void spectfd__close_all(void) { unsigned i; for (i=0;i - /** * \defgrou Spectrum file descriptors * \ingroup misc @@ -16,5 +15,8 @@ void spectfd__init(void); void spectfd__close_all(void); int spectfd__spect_to_system(spectfd_t fd); spectfd_t spectfd__alloc(int systemfd); +spectfd_t spectfd__prealloc(); +void spectfd__update_systemfd(spectfd_t fd, int systemfd); +int spectfd__close(spectfd_t fd); #endif