diff --git a/sdk/userspace/include/fpga_mgmt.h b/sdk/userspace/include/fpga_mgmt.h index 57ad437c7..c2a66dd00 100644 --- a/sdk/userspace/include/fpga_mgmt.h +++ b/sdk/userspace/include/fpga_mgmt.h @@ -20,6 +20,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * Initialize the fpga_mgmt library. * Calls fpga_pci_init. @@ -158,3 +162,7 @@ int fpga_mgmt_set_vDIP(int slot_id, uint16_t value); * @returns 0 on success, non-zero on error */ int fpga_mgmt_get_vDIP_status(int slot_id, uint16_t *value); + +#ifdef __cplusplus +} +#endif diff --git a/sdk/userspace/include/fpga_pci.h b/sdk/userspace/include/fpga_pci.h index b36b3260e..3541dff0a 100644 --- a/sdk/userspace/include/fpga_pci.h +++ b/sdk/userspace/include/fpga_pci.h @@ -19,6 +19,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** * FPGA_PCI_BARS_MAX: * -compile time tunable via mkall_fpga_mgmt_tools.sh, with the below default. @@ -203,3 +207,7 @@ int fpga_pci_rescan_slot_app_pfs(int slot_id); */ int fpga_pci_get_address(pci_bar_handle_t handle, uint64_t offset, uint64_t dword_len, void **ptr); + +#ifdef __cplusplus +} +#endif diff --git a/sdk/userspace/include/utils/io.h b/sdk/userspace/include/utils/io.h index b1776f1cf..b029956b1 100644 --- a/sdk/userspace/include/utils/io.h +++ b/sdk/userspace/include/utils/io.h @@ -23,6 +23,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /** * Set up epoll. * @@ -200,3 +204,7 @@ int string_to_uint(unsigned int *num, const char *str); * @returns How many files are open in a given process, -1 on error. */ int number_of_open_files(pid_t pid); + +#ifdef __cplusplus +} +#endif diff --git a/sdk/userspace/include/utils/lcd.h b/sdk/userspace/include/utils/lcd.h index 038928cfe..006c56248 100644 --- a/sdk/userspace/include/utils/lcd.h +++ b/sdk/userspace/include/utils/lcd.h @@ -31,6 +31,10 @@ /** PCI device format string */ #define PCI_DEV_FMT "%04x:%02x:%02x.%d" +#ifdef __cplusplus +extern "C" { +#endif + /** * Sleep for some milliseconds. * @@ -42,9 +46,13 @@ static inline int msleep(uint64_t ms) { struct timespec sleep_time = { - .tv_sec = ms / MS_PER_SECOND, - .tv_nsec = (ms % MS_PER_SECOND) * NS_PER_MS + .tv_sec = (time_t)(ms / MS_PER_SECOND), + .tv_nsec = (long)((ms % MS_PER_SECOND) * NS_PER_MS) }; return clock_nanosleep(CLOCK_MONOTONIC, 0, &sleep_time, NULL); } + +#ifdef __cplusplus +} +#endif diff --git a/sdk/userspace/include/utils/log.h b/sdk/userspace/include/utils/log.h index 60cec19aa..09149785c 100644 --- a/sdk/userspace/include/utils/log.h +++ b/sdk/userspace/include/utils/log.h @@ -40,6 +40,10 @@ enum { LOGGER_FLAGS_SERIALIZE = (1u << 0), }; +#ifdef __cplusplus +extern "C" { +#endif + /** Logger. */ struct logger { /** Name (for debugging). */ @@ -174,3 +178,7 @@ static inline __printf(1, 2) void log_dummy(const char *fmt, ...) extern const struct logger logger_stdout; extern const struct logger logger_kmsg; extern const struct logger *logger_default; + +#ifdef __cplusplus +} +#endif