diff --git a/include/gint/bfile.h b/include/gint/bfile.h index 37603e8..4478e6d 100644 --- a/include/gint/bfile.h +++ b/include/gint/bfile.h @@ -9,6 +9,10 @@ #ifndef GINT_BFILE #define GINT_BFILE +#ifdef __cplusplus +extern "C" { +#endif + #include /* BFile_Remove(): Remove a file @@ -137,4 +141,8 @@ int BFile_FindNext(int shandle, uint16_t *foundfile, Return 0 on success or negative value on error. */ int BFile_FindClose(int shandle); +#ifdef __cplusplus +} +#endif + #endif /* GINT_BFILE */ diff --git a/include/gint/clock.h b/include/gint/clock.h index f02afc1..c70a9b7 100644 --- a/include/gint/clock.h +++ b/include/gint/clock.h @@ -5,6 +5,10 @@ #ifndef GINT_CLOCK #define GINT_CLOCK +#ifdef __cplusplus +extern "C" { +#endif + #include /* This header used to expose the sleep() function; include to ensure this is still the case */ @@ -72,4 +76,8 @@ void sleep_us_spin(uint64_t delay_us); /* sleep_ms(): Sleep for a fixed duration in milliseconds */ #define sleep_ms(delay_ms) sleep_us((delay_ms) * 1000ull) +#ifdef __cplusplus +} +#endif + #endif /* GINT_CLOCK */ diff --git a/include/gint/cpu.h b/include/gint/cpu.h index ffad918..3be2717 100644 --- a/include/gint/cpu.h +++ b/include/gint/cpu.h @@ -5,6 +5,10 @@ #ifndef GINT_CPU #define GINT_CPU +#ifdef __cplusplus +extern "C" { +#endif + #include //--- @@ -117,4 +121,8 @@ void sleep_unblock(void); configure(), this is reset to 0. */ void cpu_configure_VBR(uint32_t VBR); +#ifdef __cplusplus +} +#endif + #endif /* GINT_CPU */ diff --git a/include/gint/defs/call.h b/include/gint/defs/call.h index 930371c..c17b5e9 100644 --- a/include/gint/defs/call.h +++ b/include/gint/defs/call.h @@ -11,6 +11,10 @@ #ifndef GINT_DEFS_CALL #define GINT_DEFS_CALL +#ifdef __cplusplus +extern "C" { +#endif + /* gint_call_arg_t: All types of arguments allowed in an indirect call Because a function call cannot be easily pieced together, there are @@ -195,4 +199,8 @@ static GINLINE gint_call_t GINT_CALL_INC_STOP(int volatile *pointer) return GINT_CALL(GINT_CALL_INC_STOP_function, pointer); } +#ifdef __cplusplus +} +#endif + #endif /* GINT_DEFS_CALL */ diff --git a/include/gint/display-cg.h b/include/gint/display-cg.h index ae60cb3..fd7a3cf 100644 --- a/include/gint/display-cg.h +++ b/include/gint/display-cg.h @@ -13,6 +13,10 @@ #ifdef FXCG50 +#ifdef __cplusplus +extern "C" { +#endif + #include /* Dimensions of the VRAM */ @@ -123,6 +127,10 @@ void dsetvram(uint16_t *main, uint16_t *secondary); Returns the VRAM buffer addresses used to render on fx-CG 50. */ void dgetvram(uint16_t **main, uint16_t **secondary); +#ifdef __cplusplus +} +#endif + #endif /* FXCG50 */ #endif /* GINT_DISPLAY_CG */ diff --git a/include/gint/display-fx.h b/include/gint/display-fx.h index 81672e6..7c7d7db 100644 --- a/include/gint/display-fx.h +++ b/include/gint/display-fx.h @@ -11,6 +11,10 @@ #ifdef FX9860G +#ifdef __cplusplus +extern "C" { +#endif + #include /* Dimensions of the VRAM */ @@ -83,6 +87,10 @@ typedef struct } GPACKED(4) bopti_image_t; +#ifdef __cplusplus +} +#endif + #endif /* FX9860G */ #endif /* GINT_DISPLAY_FX */ diff --git a/include/gint/display.h b/include/gint/display.h index 8b21e3e..d9342b4 100644 --- a/include/gint/display.h +++ b/include/gint/display.h @@ -9,6 +9,10 @@ #ifndef GINT_DISPLAY #define GINT_DISPLAY +#ifdef __cplusplus +extern "C" { +#endif + #include /* Platform-specific functions include VRAM management and the definition of @@ -398,4 +402,8 @@ enum { void dsubimage(int x, int y, bopti_image_t const *image, int left, int top, int width, int height, int flags); +#ifdef __cplusplus +} +#endif + #endif /* GINT_DISPLAY */ diff --git a/include/gint/dma.h b/include/gint/dma.h index ee36918..6e2f9e0 100644 --- a/include/gint/dma.h +++ b/include/gint/dma.h @@ -5,6 +5,10 @@ #ifndef GINT_DMA #define GINT_DMA +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -117,4 +121,8 @@ void *dma_memset(void *dst, uint32_t pattern, size_t size); void *dma_memcpy(void * __restrict dst, const void * __restrict src, size_t size); +#ifdef __cplusplus +} +#endif + #endif /* GINT_DMA */ diff --git a/include/gint/drivers.h b/include/gint/drivers.h index f21b672..e739489 100644 --- a/include/gint/drivers.h +++ b/include/gint/drivers.h @@ -5,6 +5,10 @@ #ifndef GINT_DRIVERS #define GINT_DRIVERS +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -300,4 +304,8 @@ void gint_world_switch_in(gint_world_t world_os, gint_world_t world_addin); /* Switch from a gint-managed world to the OS world */ void gint_world_switch_out(gint_world_t world_addin, gint_world_t world_os); +#ifdef __cplusplus +} +#endif + #endif /* GINT_DRIVERS */ diff --git a/include/gint/drivers/iokbd.h b/include/gint/drivers/iokbd.h index e6b59d6..01ad31b 100644 --- a/include/gint/drivers/iokbd.h +++ b/include/gint/drivers/iokbd.h @@ -7,6 +7,10 @@ #ifndef GINT_DRIVERS_IOKBD #define GINT_DRIVERS_IOKBD +#ifdef __cplusplus +extern "C" { +#endif + #include /* iokbd_scan() - scan ports A/B/M to generate 12 rows of key data @@ -14,4 +18,8 @@ @scan 12-byte buffer filled with row data */ void iokbd_scan(uint8_t *scan); +#ifdef __cplusplus +} +#endif + #endif /* GINT_DRIVERS_IOKBD */ diff --git a/include/gint/drivers/keydev.h b/include/gint/drivers/keydev.h index 4d95824..604a154 100644 --- a/include/gint/drivers/keydev.h +++ b/include/gint/drivers/keydev.h @@ -2,11 +2,15 @@ // gint:keydev - Kernel's keyboard input devices //--- -#include - #ifndef GINT_KEYDEV #define GINT_KEYDEV +#ifdef __cplusplus +extern "C" { +#endif + +#include + /* Size of the buffer event queue */ #define KEYBOARD_QUEUE_SIZE 32 @@ -261,4 +265,8 @@ void keydev_set_transform(keydev_t *d, keydev_transform_t tr); /* keydev_read(): Retrieve the next transformed event */ key_event_t keydev_read(keydev_t *d); +#ifdef __cplusplus +} +#endif + #endif /* GINT_KEYDEV */ diff --git a/include/gint/drivers/r61524.h b/include/gint/drivers/r61524.h index 3a93b4e..c1b0ec9 100644 --- a/include/gint/drivers/r61524.h +++ b/include/gint/drivers/r61524.h @@ -8,6 +8,10 @@ #ifndef GINT_DRIVERS_R61524 #define GINT_DRIVERS_R61524 +#ifdef __cplusplus +extern "C" { +#endif + #include enum { @@ -43,4 +47,8 @@ void r61524_display(uint16_t *vram, int start, int height, int method); void r61524_win_get(uint16_t *HSA, uint16_t *HEA, uint16_t *VSA,uint16_t *VEA); void r61524_win_set(uint16_t HSA, uint16_t HEA, uint16_t VSA, uint16_t VEA); +#ifdef __cplusplus +} +#endif + #endif /* GINT_DRIVERS_R61524 */ diff --git a/include/gint/drivers/states.h b/include/gint/drivers/states.h index 4f72d90..d30151c 100644 --- a/include/gint/drivers/states.h +++ b/include/gint/drivers/states.h @@ -9,6 +9,10 @@ #ifndef GINT_DRIVERS_STATES #define GINT_DRIVERS_STATES +#ifdef __cplusplus +extern "C" { +#endif + #include /* Clock Pulse Generator (see cpg/cpg.c) */ @@ -91,4 +95,8 @@ typedef struct { uint16_t DCPCFG, DCPMAXP, DCPCTR; } usb_state_t; +#ifdef __cplusplus +} +#endif + #endif /* GINT_DRIVERS_STATES */ diff --git a/include/gint/drivers/t6k11.h b/include/gint/drivers/t6k11.h index a177fa6..91e1449 100644 --- a/include/gint/drivers/t6k11.h +++ b/include/gint/drivers/t6k11.h @@ -7,6 +7,10 @@ #ifndef GINT_DRIVERS_T6K11 #define GINT_DRIVERS_T6K11 +#ifdef __cplusplus +extern "C" { +#endif + #include /* t6k11_display() - send vram data to the LCD device @@ -51,4 +55,8 @@ void t6k11_contrast(int contrast); @setting Requested backlight setting */ void t6k11_backlight(int setting); +#ifdef __cplusplus +} +#endif + #endif /* GINT_DRIVERS_T6K11 */ diff --git a/include/gint/exc.h b/include/gint/exc.h index f3ef7bc..8def6ae 100644 --- a/include/gint/exc.h +++ b/include/gint/exc.h @@ -9,6 +9,10 @@ #ifndef GINT_EXC #define GINT_EXC +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -64,4 +68,8 @@ void gint_exc_catch(int (*handler)(uint32_t code)); @instructions Number of instructions to skip (usually only one) */ void gint_exc_skip(int instructions); +#ifdef __cplusplus +} +#endif + #endif /* GINT_EXC */ diff --git a/include/gint/gint.h b/include/gint/gint.h index eec83ef..ddbbc6c 100644 --- a/include/gint/gint.h +++ b/include/gint/gint.h @@ -5,6 +5,10 @@ #ifndef GINT_GINT #define GINT_GINT +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -89,4 +93,8 @@ static GINLINE void *gint_inthandler(int code, void const *h, size_t size) { Returns the return value of the callback. */ extern int (*gint_inth_callback)(gint_call_t const *call); +#ifdef __cplusplus +} +#endif + #endif /* GINT_GINT */ diff --git a/include/gint/gray.h b/include/gint/gray.h index bff4c0f..8296b21 100644 --- a/include/gint/gray.h +++ b/include/gint/gray.h @@ -5,6 +5,10 @@ #ifndef GINT_GRAY #define GINT_GRAY +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -148,4 +152,8 @@ void dgray_getvram(uint32_t **light, uint32_t **dark); These pointers can be used to make screen captures. */ void dgray_getscreen(uint32_t **light, uint32_t **dark); +#ifdef __cplusplus +} +#endif + #endif /* GINT_GRAY */ diff --git a/include/gint/hardware.h b/include/gint/hardware.h index 0f5258b..60aa1dc 100644 --- a/include/gint/hardware.h +++ b/include/gint/hardware.h @@ -14,6 +14,10 @@ #ifndef GINT_HARDWARE #define GINT_HARDWARE +#ifdef __cplusplus +extern "C" { +#endif + /* For compatibility with ASM, include the following bits only in C code */ #ifndef CPP_ASM @@ -114,4 +118,8 @@ void hw_detect(void); /* The keyboard uses a KEYSC-based scan method. This is only possible on SH4 */ #define HWKBD_KSI 0x04 +#ifdef __cplusplus +} +#endif + #endif /* GINT_HARDWARE */ diff --git a/include/gint/intc.h b/include/gint/intc.h index 2f6c994..9b117f0 100644 --- a/include/gint/intc.h +++ b/include/gint/intc.h @@ -5,6 +5,10 @@ #ifndef GINT_INTC #define GINT_INTC +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -131,4 +135,8 @@ void *intc_handler(int event_code, void const *handler, size_t size); Returns true on success, false if the event code is invalid. */ bool intc_handler_function(int event_code, gint_call_t function); +#ifdef __cplusplus +} +#endif + #endif /* GINT_INTC */ diff --git a/include/gint/keyboard.h b/include/gint/keyboard.h index cbed81f..8dbfa4a 100644 --- a/include/gint/keyboard.h +++ b/include/gint/keyboard.h @@ -5,6 +5,10 @@ #ifndef GINT_KEYBOARD #define GINT_KEYBOARD +#ifdef __cplusplus +extern "C" { +#endif + /* Keyboard, key events, keydown() and getkey() gint's keyboard driver regularly scans the keyboard matrix and produces *key @@ -329,4 +333,8 @@ int keycode_function(int keycode); returns 7 for KEY_7) and -1 for other keys. */ int keycode_digit(int keycode); +#ifdef __cplusplus +} +#endif + #endif /* GINT_KEYBOARD */ diff --git a/include/gint/keycodes.h b/include/gint/keycodes.h index 5e46f3d..d3fdd48 100644 --- a/include/gint/keycodes.h +++ b/include/gint/keycodes.h @@ -5,6 +5,10 @@ #ifndef GINT_KEYCODES #define GINT_KEYCODES +#ifdef __cplusplus +extern "C" { +#endif + /* Raw matrix codes */ enum { KEY_F1 = 0x91, @@ -83,4 +87,8 @@ enum { KEY_MINUS = KEY_SUB, }; +#ifdef __cplusplus +} +#endif + #endif /* GINT_KEYCODES */ diff --git a/include/gint/kmalloc.h b/include/gint/kmalloc.h index c58723a..6483ce5 100644 --- a/include/gint/kmalloc.h +++ b/include/gint/kmalloc.h @@ -5,6 +5,10 @@ #ifndef GINT_KMALLOC #define GINT_KMALLOC +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -164,4 +168,8 @@ int kmallocdbg_sequence_length(kmalloc_arena_t *a); #endif /* GINT_KMALLOC_DEBUG */ +#ifdef __cplusplus +} +#endif + #endif /* GINT_KMALLOC */ diff --git a/include/gint/mmu.h b/include/gint/mmu.h index 0412f2d..d85dc41 100644 --- a/include/gint/mmu.h +++ b/include/gint/mmu.h @@ -5,6 +5,10 @@ #ifndef GINT_MMU #define GINT_MMU +#ifdef __cplusplus +extern "C" { +#endif + #include //--- @@ -94,4 +98,8 @@ void utlb_mapped_memory(uint32_t *rom, uint32_t *ram); /* utlb_translate(): Get the physical address for a virtual page */ uint32_t utlb_translate(uint32_t page, uint32_t *size); +#ifdef __cplusplus +} +#endif + #endif /* GINT_MMU */ diff --git a/include/gint/mpu/cpg.h b/include/gint/mpu/cpg.h index d43d099..e6eec28 100644 --- a/include/gint/mpu/cpg.h +++ b/include/gint/mpu/cpg.h @@ -5,6 +5,10 @@ #ifndef GINT_MPU_CPG #define GINT_MPU_CPG +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -110,4 +114,8 @@ typedef volatile struct #define SH7305_CPG (*((sh7305_cpg_t *)0xa4150000)) +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_CPG */ diff --git a/include/gint/mpu/dma.h b/include/gint/mpu/dma.h index f3d3cf8..c5594b7 100644 --- a/include/gint/mpu/dma.h +++ b/include/gint/mpu/dma.h @@ -9,6 +9,10 @@ #ifndef GINT_MPU_DMA #define GINT_MPU_DMA +#ifdef __cplusplus +extern "C" { +#endif + #include //--- @@ -86,4 +90,8 @@ typedef volatile struct #define SH7305_DMA (*((sh7305_dma_t *)0xfe008020)) +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_DMA */ diff --git a/include/gint/mpu/intc.h b/include/gint/mpu/intc.h index d605e95..87a0844 100644 --- a/include/gint/mpu/intc.h +++ b/include/gint/mpu/intc.h @@ -12,6 +12,10 @@ #ifndef GINT_MPU_INTC #define GINT_MPU_INTC +#ifdef __cplusplus +extern "C" { +#endif + #include //--- @@ -297,4 +301,8 @@ typedef struct extern sh7705_intc_t SH7705_INTC; extern sh7305_intc_t SH7305_INTC; +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_INTC */ diff --git a/include/gint/mpu/mmu.h b/include/gint/mpu/mmu.h index 1acc214..7642a28 100644 --- a/include/gint/mpu/mmu.h +++ b/include/gint/mpu/mmu.h @@ -8,6 +8,10 @@ #ifndef GINT_MPU_MMU #define GINT_MPU_MMU +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -152,4 +156,8 @@ typedef volatile struct #define SH7305_MMU (*(sh7305_mmu_t *)0xff000000) +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_MMU */ diff --git a/include/gint/mpu/pfc.h b/include/gint/mpu/pfc.h index d77df9e..a1c3fe0 100644 --- a/include/gint/mpu/pfc.h +++ b/include/gint/mpu/pfc.h @@ -8,6 +8,10 @@ #ifndef GINT_MPU_PFC #define GINT_MPU_PFC +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -75,4 +79,8 @@ typedef volatile struct // TODO: Document the SH7305 Pin Function Controller //--- +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_PFC */ diff --git a/include/gint/mpu/power.h b/include/gint/mpu/power.h index 59c4e5d..abe76d1 100644 --- a/include/gint/mpu/power.h +++ b/include/gint/mpu/power.h @@ -5,6 +5,10 @@ #ifndef GINT_MPU_POWER #define GINT_MPU_POWER +#ifdef __cplusplus +extern "C" { +#endif + #include //--- @@ -103,4 +107,8 @@ typedef volatile struct #define SH7305_POWER (*((sh7305_power_t *)0xa4150020)) +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_POWER */ diff --git a/include/gint/mpu/rtc.h b/include/gint/mpu/rtc.h index ae8307f..fcb1cfa 100644 --- a/include/gint/mpu/rtc.h +++ b/include/gint/mpu/rtc.h @@ -5,6 +5,10 @@ #ifndef GINT_MPU_RTC #define GINT_MPU_RTC +#ifdef __cplusplus +extern "C" { +#endif + #include //--- @@ -75,4 +79,8 @@ typedef volatile struct #define SH7705_RTC (*((rtc_t *)0xfffffec0)) #define SH7305_RTC (*((rtc_t *)0xa413fec0)) +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_RTC */ diff --git a/include/gint/mpu/spu.h b/include/gint/mpu/spu.h index aed6f87..f282daa 100644 --- a/include/gint/mpu/spu.h +++ b/include/gint/mpu/spu.h @@ -5,6 +5,10 @@ #ifndef GINT_MPU_SPU #define GINT_MPU_SPU +#ifdef __cplusplus +extern "C" { +#endif + #include typedef volatile struct @@ -94,4 +98,8 @@ typedef volatile struct #define SH7305_DSP0 (*(spu_dsp_t *)0xfe2ffd00) #define SH7305_DSP1 (*(spu_dsp_t *)0xfe3ffd00) +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_SPU */ diff --git a/include/gint/mpu/tmu.h b/include/gint/mpu/tmu.h index 5d3de58..0d20753 100644 --- a/include/gint/mpu/tmu.h +++ b/include/gint/mpu/tmu.h @@ -9,6 +9,10 @@ #ifndef GINT_MPU_TMU #define GINT_MPU_TMU +#ifdef __cplusplus +extern "C" { +#endif + #include //--- @@ -101,4 +105,8 @@ typedef volatile struct typedef volatile etmu_t sh7305_etmu_t[6]; #define SH7305_ETMU (*(sh7305_etmu_t *)0xa44d0030) +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_TMU */ diff --git a/include/gint/mpu/usb.h b/include/gint/mpu/usb.h index 2f77cff..bcab0b8 100644 --- a/include/gint/mpu/usb.h +++ b/include/gint/mpu/usb.h @@ -5,6 +5,10 @@ #ifndef GINT_MPU_USB #define GINT_MPU_USB +#ifdef __cplusplus +extern "C" { +#endif + #include typedef volatile struct @@ -437,4 +441,8 @@ typedef volatile word_union(sh7305_usb_uponcr_t, #define SH7305_USB (*(sh7305_usb_t *)0xa4d80000) #define SH7305_USB_UPONCR (*(sh7305_usb_uponcr_t *)0xa40501d4) +#ifdef __cplusplus +} +#endif + #endif /* GINT_MPU_USB */ diff --git a/include/gint/rtc.h b/include/gint/rtc.h index df84925..7ea8162 100644 --- a/include/gint/rtc.h +++ b/include/gint/rtc.h @@ -5,6 +5,10 @@ #ifndef GINT_RTC #define GINT_RTC +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -96,4 +100,8 @@ int rtc_start_timer(int frequency, timer_callback_t callback, ...); __attribute__((deprecated("Use rtc_periodic_disable() instead"))) void rtc_stop_timer(void); +#ifdef __cplusplus +} +#endif + #endif /* GINT_RTC */ diff --git a/include/gint/timer.h b/include/gint/timer.h index 7864ce8..da010bc 100644 --- a/include/gint/timer.h +++ b/include/gint/timer.h @@ -5,6 +5,10 @@ #ifndef GINT_TIMER #define GINT_TIMER +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -236,4 +240,8 @@ int timer_setup(int timer, uint64_t delay_us, timer_callback_t callback, ...); Use GINT_CALL_SET_STOP() with timer_configure() instead. */ int timer_timeout(volatile void *arg); +#ifdef __cplusplus +} +#endif + #endif /* GINT_TIMER */ diff --git a/include/gint/usb-ff-bulk.h b/include/gint/usb-ff-bulk.h index 621c715..b5ea8fc 100644 --- a/include/gint/usb-ff-bulk.h +++ b/include/gint/usb-ff-bulk.h @@ -5,6 +5,10 @@ #ifndef GINT_USB_FF_BULK #define GINT_USB_FF_BULK +#ifdef __cplusplus +extern "C" { +#endif + #include /* The bulk transfer interface with class code 0xff provides a very simple @@ -164,4 +168,8 @@ void usb_fxlink_screenshot_gray(bool onscreen); and size allow, and 1 byte otherwise. If size is 0, strlen(text) is used. */ void usb_fxlink_text(char const *text, int size); +#ifdef __cplusplus +} +#endif + #endif /* GINT_USB_FF_BULK */ diff --git a/include/gint/usb.h b/include/gint/usb.h index 9a8eae3..bb7f798 100644 --- a/include/gint/usb.h +++ b/include/gint/usb.h @@ -5,6 +5,10 @@ #ifndef GINT_USB #define GINT_USB +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -376,4 +380,8 @@ uint16_t usb_dc_string(uint16_t const *literal, size_t len); This is mostly used by the driver to answer GET_DESCRIPTOR requests. */ usb_dc_string_t *usb_dc_string_get(uint16_t id); +#ifdef __cplusplus +} +#endif + #endif /* GINT_USB */