diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-06-22 18:32:27 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-06-22 18:32:27 +0200 |
commit | e2515f6e1a7b17addda4c558a0a6ca05b4ec6e55 (patch) | |
tree | ea63b9499de4abbf7e09c3b6a6952786740be577 | |
parent | 87583e6ec5c1961ef975b873041eeada3e1e6c6d (diff) | |
download | pcitool-e2515f6e1a7b17addda4c558a0a6ca05b4ec6e55.tar.gz pcitool-e2515f6e1a7b17addda4c558a0a6ca05b4ec6e55.tar.bz2 pcitool-e2515f6e1a7b17addda4c558a0a6ca05b4ec6e55.tar.xz pcitool-e2515f6e1a7b17addda4c558a0a6ca05b4ec6e55.zip |
Keep C++ compilers happy
-rw-r--r-- | pcilib/bank.h | 8 | ||||
-rw-r--r-- | pcilib/bar.h | 9 | ||||
-rw-r--r-- | pcilib/debug.h | 10 | ||||
-rw-r--r-- | pcilib/dma.h | 7 | ||||
-rw-r--r-- | pcilib/env.h | 8 | ||||
-rw-r--r-- | pcilib/error.h | 9 | ||||
-rw-r--r-- | pcilib/event.h | 7 | ||||
-rw-r--r-- | pcilib/kmem.h | 11 | ||||
-rw-r--r-- | pcilib/model.h | 8 | ||||
-rw-r--r-- | pcilib/pci.h | 8 | ||||
-rw-r--r-- | pcilib/pcilib.h | 8 | ||||
-rw-r--r-- | pcilib/plugin.h | 8 | ||||
-rw-r--r-- | pcilib/register.h | 8 | ||||
-rw-r--r-- | pcilib/tools.h | 8 |
14 files changed, 116 insertions, 1 deletions
diff --git a/pcilib/bank.h b/pcilib/bank.h index 8b461af..a0ba9fe 100644 --- a/pcilib/bank.h +++ b/pcilib/bank.h @@ -86,6 +86,10 @@ struct pcilib_register_bank_context_s { const pcilib_register_protocol_api_description_t *api; /**< API functions */ }; +#ifdef __cplusplus +extern "C" { +#endif + // we don't copy strings, they should be statically allocated int pcilib_init_register_banks(pcilib_t *ctx); void pcilib_free_register_banks(pcilib_t *ctx); @@ -102,4 +106,8 @@ pcilib_register_protocol_t pcilib_find_register_protocol_by_addr(pcilib_t *ctx, pcilib_register_protocol_t pcilib_find_register_protocol_by_name(pcilib_t *ctx, const char *name); pcilib_register_protocol_t pcilib_find_register_protocol(pcilib_t *ctx, const char *name); +#ifdef __cplusplus +} +#endif + #endif /* _PCILIB_BANK_H */ diff --git a/pcilib/bar.h b/pcilib/bar.h index 9680fc1..9ab1cc0 100644 --- a/pcilib/bar.h +++ b/pcilib/bar.h @@ -1,7 +1,16 @@ #ifndef _PCILIB_BAR_H #define _PCILIB_BAR_H +#ifdef __cplusplus +extern "C" { +#endif + pcilib_bar_t pcilib_detect_bar(pcilib_t *ctx, uintptr_t addr, size_t size); int pcilib_detect_address(pcilib_t *ctx, pcilib_bar_t *bar, uintptr_t *addr, size_t size); + +#ifdef __cplusplus +} +#endif + #endif /* _PCILIB_BAR_H */ diff --git a/pcilib/debug.h b/pcilib/debug.h index ec10467..bc68e1c 100644 --- a/pcilib/debug.h +++ b/pcilib/debug.h @@ -40,8 +40,18 @@ typedef enum { PCILIB_DEBUG_BUFFER_MKDIR = 2 } pcilib_debug_buffer_flags_t; + +#ifdef __cplusplus +extern "C" { +#endif + void pcilib_debug_message(const char *function, const char *file, int line, pcilib_log_flags_t flags, const char *format, ...); void pcilib_debug_data_buffer(const char *function, size_t size, void *buffer, pcilib_debug_buffer_flags_t flags, const char *file, ...); +#ifdef __cplusplus +} +#endif + + #endif /* _PCILIB_DEBUG_H */ diff --git a/pcilib/dma.h b/pcilib/dma.h index 36ead8d..5736669 100644 --- a/pcilib/dma.h +++ b/pcilib/dma.h @@ -83,10 +83,17 @@ typedef struct { } pcilib_dma_description_t; +#ifdef __cplusplus +extern "C" { +#endif + const pcilib_dma_description_t *pcilib_get_dma_description(pcilib_t *ctx); pcilib_dma_engine_t pcilib_add_dma_engine(pcilib_t *ctx, pcilib_dma_engine_description_t *desc); int pcilib_get_dma_status(pcilib_t *ctx, pcilib_dma_engine_t dma, pcilib_dma_engine_status_t *status, size_t n_buffers, pcilib_dma_buffer_status_t *buffers); int pcilib_init_dma(pcilib_t *ctx); +#ifdef __cplusplus +} +#endif #endif /* _PCILIB_DMA_H */ diff --git a/pcilib/env.h b/pcilib/env.h index 4fd40f1..7cf69b9 100644 --- a/pcilib/env.h +++ b/pcilib/env.h @@ -7,6 +7,14 @@ typedef enum { PCILIB_MAX_ENV } pcilib_env_t; +#ifdef __cplusplus +extern "C" { +#endif + const char *pcilib_getenv(pcilib_env_t env, const char *var); +#ifdef __cplusplus +} +#endif + #endif /* _PCILIB_ENV_H */ diff --git a/pcilib/error.h b/pcilib/error.h index e68d102..9b5492b 100644 --- a/pcilib/error.h +++ b/pcilib/error.h @@ -31,9 +31,18 @@ enum { PCILIB_ERROR_BUSY = EBUSY } pcilib_errot_t; +#ifdef __cplusplus +extern "C" { +#endif + void pcilib_log_message(const char *file, int line, pcilib_log_flags_t flags, pcilib_log_priority_t prio, const char *msg, ...); void pcilib_log_vmessage(const char *file, int line, pcilib_log_flags_t flags, pcilib_log_priority_t prio, const char *msg, va_list va); + +#ifdef __cplusplus +} +#endif + #define pcilib_log(prio, ...) \ pcilib_log_message(__FILE__, __LINE__, PCILIB_LOG_DEFAULT, prio, __VA_ARGS__) diff --git a/pcilib/event.h b/pcilib/event.h index ca7c27f..d2b9793 100644 --- a/pcilib/event.h +++ b/pcilib/event.h @@ -89,8 +89,15 @@ typedef struct { int (*return_data)(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, void *data); } pcilib_event_api_description_t; +#ifdef __cplusplus +extern "C" { +#endif int pcilib_init_event_engine(pcilib_t *ctx); +#ifdef __cplusplus +} +#endif + #endif /* _PCILIB_EVENT_H */ diff --git a/pcilib/kmem.h b/pcilib/kmem.h index ae690fe..8299379 100644 --- a/pcilib/kmem.h +++ b/pcilib/kmem.h @@ -13,7 +13,8 @@ typedef enum { } pcilib_tristate_t; #define PCILIB_KMEM_TYPE_MASK 0xFFFF0000 -#define PCILIB_KMEM_USE(type, subtype) (((type) << 16)|(subtype)) +#define PCILIB_KMEM_USE(type, subtype) ((pcilib_kmem_use_t)(((type) << 16)|(subtype))) + typedef enum { PCILIB_KMEM_TYPE_CONSISTENT = 0x00000, @@ -95,6 +96,10 @@ struct pcilib_kmem_list_s { pcilib_kmem_buffer_t buf; // variable size, should be last item in struct }; +#ifdef __cplusplus +extern "C" { +#endif + pcilib_kmem_handle_t *pcilib_alloc_kernel_memory(pcilib_t *ctx, pcilib_kmem_type_t type, size_t nmemb, size_t size, size_t alignment, pcilib_kmem_use_t use, pcilib_kmem_flags_t flags); void pcilib_free_kernel_memory(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kmem_flags_t flags); //int pcilib_kmem_sync(pcilib_t *ctx, pcilib_kmem_handle_t *k, pcilib_kmem_sync_direction_t dir); @@ -110,4 +115,8 @@ pcilib_kmem_reuse_state_t pcilib_kmem_is_reused(pcilib_t *ctx, pcilib_kmem_handl int pcilib_clean_kernel_memory(pcilib_t *ctx, pcilib_kmem_use_t use, pcilib_kmem_flags_t flags); +#ifdef __cplusplus +} +#endif + #endif /* _PCILIB_KMEM_H */ diff --git a/pcilib/model.h b/pcilib/model.h index ab55adc..660c363 100644 --- a/pcilib/model.h +++ b/pcilib/model.h @@ -27,6 +27,14 @@ typedef struct { } pcilib_model_description_t; +#ifdef __cplusplus +extern "C" { +#endif + const pcilib_model_description_t *pcilib_get_model_description(pcilib_t *ctx); +#ifdef __cplusplus +} +#endif + #endif /* _PCILIB_MODEL_H */ diff --git a/pcilib/pci.h b/pcilib/pci.h index ce8d119..d176caf 100644 --- a/pcilib/pci.h +++ b/pcilib/pci.h @@ -75,6 +75,10 @@ struct pcilib_s { #endif /* PCILIB_FILE_IO */ }; +#ifdef __cplusplus +extern "C" { +#endif + pcilib_context_t *pcilib_get_implementation_context(pcilib_t *ctx); const pcilib_board_info_t *pcilib_get_board_info(pcilib_t *ctx); const pcilib_pcie_link_info_t *pcilib_get_pcie_link_info(pcilib_t *ctx); @@ -82,4 +86,8 @@ const pcilib_pcie_link_info_t *pcilib_get_pcie_link_info(pcilib_t *ctx); int pcilib_map_register_space(pcilib_t *ctx); int pcilib_map_data_space(pcilib_t *ctx, uintptr_t addr); +#ifdef __cplusplus +} +#endif + #endif /* _PCITOOL_PCI_H */ diff --git a/pcilib/pcilib.h b/pcilib/pcilib.h index 9710642..8a43bfb 100644 --- a/pcilib/pcilib.h +++ b/pcilib/pcilib.h @@ -129,6 +129,10 @@ typedef int (*pcilib_dma_callback_t)(void *ctx, pcilib_dma_flags_t flags, size_t typedef int (*pcilib_event_callback_t)(pcilib_event_id_t event_id, pcilib_event_info_t *info, void *user); typedef int (*pcilib_event_rawdata_callback_t)(pcilib_event_id_t event_id, pcilib_event_info_t *info, pcilib_event_flags_t flags, size_t size, void *data, void *user); +#ifdef __cplusplus +extern "C" { +#endif + int pcilib_set_logger(pcilib_log_priority_t min_prio, pcilib_logger_t logger, void *arg); @@ -236,4 +240,8 @@ int pcilib_return_data(pcilib_t *ctx, pcilib_event_id_t event_id, pcilib_event_d */ int pcilib_grab(pcilib_t *ctx, pcilib_event_t event_mask, size_t *size, void **data, pcilib_timeout_t timeout); +#ifdef __cplusplus +} +#endif + #endif /* _PCITOOL_PCILIB_H */ diff --git a/pcilib/plugin.h b/pcilib/plugin.h index 774fda5..f9ff7cf 100644 --- a/pcilib/plugin.h +++ b/pcilib/plugin.h @@ -1,10 +1,18 @@ #ifndef _PCILIB_PLUGIN_H #define _PCILIB_PLUGIN_H +#ifdef __cplusplus +extern "C" { +#endif + void *pcilib_plugin_load(const char *name); void pcilib_plugin_close(void *plug); void *pcilib_plugin_get_symbol(void *plug, const char *symbol); const pcilib_model_description_t *pcilib_get_plugin_model(pcilib_t *pcilib, void *plug, unsigned short vendor_id, unsigned short device_id, const char *model); const pcilib_model_description_t *pcilib_find_plugin_model(pcilib_t *pcilib, unsigned short vendor_id, unsigned short device_id, const char *model); +#ifdef __cplusplus +} +#endif + #endif /* _PCILIB_PLUGIN_H */ diff --git a/pcilib/register.h b/pcilib/register.h index 307e8a1..535e9d0 100644 --- a/pcilib/register.h +++ b/pcilib/register.h @@ -47,7 +47,15 @@ typedef struct { pcilib_register_bank_t bank; } pcilib_register_context_t; + +#ifdef __cplusplus +extern "C" { +#endif + int pcilib_add_registers(pcilib_t *ctx, size_t n, const pcilib_register_description_t *registers); +#ifdef __cplusplus +} +#endif #endif /* _PCILIB_REGISTER_H */ diff --git a/pcilib/tools.h b/pcilib/tools.h index 41dc071..8e91b17 100644 --- a/pcilib/tools.h +++ b/pcilib/tools.h @@ -14,6 +14,10 @@ #define min2(a, b) (((a)<(b))?(a):(b)) +#ifdef __cplusplus +extern "C" { +#endif + int pcilib_isnumber(const char *str); int pcilib_isxnumber(const char *str); int pcilib_isnumber_n(const char *str, size_t len); @@ -41,4 +45,8 @@ int pcilib_sleep_until_deadline(struct timeval *tv); int pcilib_timecmp(struct timeval *tv1, struct timeval *tv2); pcilib_timeout_t pcilib_timediff(struct timeval *tve, struct timeval *tvs); +#ifdef __cplusplus +} +#endif + #endif /* _PCITOOL_TOOS_H */ |