From 1eabc36c84fc15f11339d00a52290779564e517a Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Tue, 24 Jan 2023 07:05:05 +0100 Subject: [PATCH] soc/software/libXX/YY.h: adding extern C (required to link with cpp code) --- litex/soc/software/libbase/memtest.h | 8 ++++++++ litex/soc/software/libbase/progress.h | 8 ++++++++ litex/soc/software/libbase/spiflash.h | 8 ++++++++ litex/soc/software/liblitedram/bist.h | 8 ++++++++ litex/soc/software/liblitedram/sdram.h | 8 ++++++++ litex/soc/software/liblitedram/sdram_dbg.h | 8 ++++++++ litex/soc/software/liblitedram/sdram_spd.h | 8 ++++++++ litex/soc/software/liblitedram/utils.h | 8 ++++++++ litex/soc/software/libliteeth/inet.h | 8 ++++++++ litex/soc/software/libliteeth/mdio.h | 8 ++++++++ litex/soc/software/libliteeth/tftp.h | 8 ++++++++ litex/soc/software/libliteeth/udp.h | 8 ++++++++ litex/soc/software/liblitesata/sata.h | 8 ++++++++ litex/soc/software/liblitesdcard/sdcard.h | 8 ++++++++ litex/soc/software/liblitesdcard/spisdcard.h | 8 ++++++++ litex/soc/software/liblitespi/spiflash.h | 8 ++++++++ 16 files changed, 128 insertions(+) diff --git a/litex/soc/software/libbase/memtest.h b/litex/soc/software/libbase/memtest.h index 230598ce8..955ed80c7 100644 --- a/litex/soc/software/libbase/memtest.h +++ b/litex/soc/software/libbase/memtest.h @@ -1,6 +1,10 @@ #ifndef __MEMTEST_H #define __MEMTEST_H +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -33,4 +37,8 @@ int memtest_data(unsigned int *addr, unsigned long size, int random, struct memt void memspeed(unsigned int *addr, unsigned long size, bool read_only, bool random); int memtest(unsigned int *addr, unsigned long maxsize); +#ifdef __cplusplus +} +#endif + #endif /* __MEMTEST_H */ diff --git a/litex/soc/software/libbase/progress.h b/litex/soc/software/libbase/progress.h index 75aa9c4f8..6214ae5c7 100644 --- a/litex/soc/software/libbase/progress.h +++ b/litex/soc/software/libbase/progress.h @@ -2,6 +2,10 @@ #ifndef __PROGRSS_H #define __PROGRSS_H +#ifdef __cplusplus +extern "C" { +#endif + /* Initialize a progress bar. If max > 0 a one line progress * bar is printed where 'max' corresponds to 100%. If max == 0 * a multi line progress bar is printed. @@ -13,4 +17,8 @@ void init_progression_bar(int max); */ void show_progress(int now); +#ifdef __cplusplus +} +#endif + #endif /* __PROGRSS_H */ diff --git a/litex/soc/software/libbase/spiflash.h b/litex/soc/software/libbase/spiflash.h index 7d6171bde..67b0d0e78 100644 --- a/litex/soc/software/libbase/spiflash.h +++ b/litex/soc/software/libbase/spiflash.h @@ -1,9 +1,17 @@ #ifndef __SPIFLASH_H #define __SPIFLASH_H +#ifdef __cplusplus +extern "C" { +#endif + void write_to_flash_page(unsigned int addr, const unsigned char *c, unsigned int len); void erase_flash_sector(unsigned int addr); void erase_flash(void); void write_to_flash(unsigned int addr, const unsigned char *c, unsigned int len); +#ifdef __cplusplus +} +#endif + #endif /* __SPIFLASH_H */ diff --git a/litex/soc/software/liblitedram/bist.h b/litex/soc/software/liblitedram/bist.h index ab4c676ec..00b53bcd8 100644 --- a/litex/soc/software/liblitedram/bist.h +++ b/litex/soc/software/liblitedram/bist.h @@ -4,9 +4,17 @@ #ifndef __SDRAM_BIST_H #define __SDRAM_BIST_H +#ifdef __cplusplus +extern "C" { +#endif + #include void sdram_bist(uint32_t burst_length, uint32_t random); int sdram_hw_test(uint64_t origin, uint64_t size, uint64_t burst_length); +#ifdef __cplusplus +} +#endif + #endif /* __SDRAM_BIST_H */ diff --git a/litex/soc/software/liblitedram/sdram.h b/litex/soc/software/liblitedram/sdram.h index d8df2b2c1..8344d3ce8 100644 --- a/litex/soc/software/liblitedram/sdram.h +++ b/litex/soc/software/liblitedram/sdram.h @@ -1,6 +1,10 @@ #ifndef __SDRAM_H #define __SDRAM_H +#ifdef __cplusplus +extern "C" { +#endif + #include /*-----------------------------------------------------------------------*/ @@ -53,4 +57,8 @@ int sdram_init(void); /*-----------------------------------------------------------------------*/ void sdram_debug(void); +#ifdef __cplusplus +} +#endif + #endif /* __SDRAM_H */ diff --git a/litex/soc/software/liblitedram/sdram_dbg.h b/litex/soc/software/liblitedram/sdram_dbg.h index 830ef9320..fd22c21ab 100644 --- a/litex/soc/software/liblitedram/sdram_dbg.h +++ b/litex/soc/software/liblitedram/sdram_dbg.h @@ -1,6 +1,10 @@ #ifndef __SDRAM_DBG_H #define __SDRAM_DBG_H +#ifdef __cplusplus +extern "C" { +#endif + #include #ifdef CSR_SDRAM_BASE @@ -54,4 +58,8 @@ int readback_compare(struct readback *readback, struct readback *other, int verb #endif /* CSR_SDRAM_BASE */ +#ifdef __cplusplus +} +#endif + #endif /* __SDRAM_DBG_H */ diff --git a/litex/soc/software/liblitedram/sdram_spd.h b/litex/soc/software/liblitedram/sdram_spd.h index 28a680135..cfe06f93e 100644 --- a/litex/soc/software/liblitedram/sdram_spd.h +++ b/litex/soc/software/liblitedram/sdram_spd.h @@ -4,6 +4,10 @@ #ifndef __SDRAM_SPD_H #define __SDRAM_SPD_H +#ifdef __cplusplus +extern "C" { +#endif + #include #include #include @@ -34,4 +38,8 @@ bool sdram_read_spd(uint8_t spd, uint16_t addr, uint8_t *buf, uint16_t len, bool send_stop); +#ifdef __cplusplus +} +#endif + #endif /* __SDRAM_SPD_H */ diff --git a/litex/soc/software/liblitedram/utils.h b/litex/soc/software/liblitedram/utils.h index 09ff07091..b80a3198a 100644 --- a/litex/soc/software/liblitedram/utils.h +++ b/litex/soc/software/liblitedram/utils.h @@ -4,6 +4,10 @@ #ifndef __SDRAM_UTILS_H #define __SDRAM_UTILS_H +#ifdef __cplusplus +extern "C" { +#endif + #include void print_size(uint64_t size); @@ -11,4 +15,8 @@ void print_progress(const char * header, uint64_t origin, uint64_t size); uint64_t sdram_get_supported_memory(void); +#ifdef __cplusplus +} +#endif + #endif /* __SDRAM_UTILS_H */ diff --git a/litex/soc/software/libliteeth/inet.h b/litex/soc/software/libliteeth/inet.h index dbe8c7b6b..f64ee212c 100644 --- a/litex/soc/software/libliteeth/inet.h +++ b/litex/soc/software/libliteeth/inet.h @@ -23,6 +23,10 @@ #ifndef __INET_H #define __INET_H +#ifdef __cplusplus +extern "C" { +#endif + #include static __inline uint16_t __bswap_16(uint16_t __x) @@ -68,4 +72,8 @@ static uint16_t ntohs(uint16_t n) return u.c ? bswap_16(n) : n; } +#ifdef __cplusplus +} +#endif + #endif /* __INET_H */ diff --git a/litex/soc/software/libliteeth/mdio.h b/litex/soc/software/libliteeth/mdio.h index bffa5a635..b751e0b99 100644 --- a/litex/soc/software/libliteeth/mdio.h +++ b/litex/soc/software/libliteeth/mdio.h @@ -1,6 +1,10 @@ #ifndef __MDIO_H #define __MDIO_H +#ifdef __cplusplus +extern "C" { +#endif + #define MDIO_CLK 0x01 #define MDIO_OE 0x02 #define MDIO_DO 0x04 @@ -16,4 +20,8 @@ void mdio_write(int phyadr, int reg, int val); int mdio_read(int phyadr, int reg); +#ifdef __cplusplus +} +#endif + #endif /* __MDIO_H */ diff --git a/litex/soc/software/libliteeth/tftp.h b/litex/soc/software/libliteeth/tftp.h index 788731ba0..22dd44c55 100644 --- a/litex/soc/software/libliteeth/tftp.h +++ b/litex/soc/software/libliteeth/tftp.h @@ -1,6 +1,10 @@ #ifndef __TFTP_H #define __TFTP_H +#ifdef __cplusplus +extern "C" { +#endif + #include int tftp_get(uint32_t ip, uint16_t server_port, const char *filename, @@ -8,5 +12,9 @@ int tftp_get(uint32_t ip, uint16_t server_port, const char *filename, int tftp_put(uint32_t ip, uint16_t server_port, const char *filename, const void *buffer, int size); +#ifdef __cplusplus +} +#endif + #endif /* __TFTP_H */ diff --git a/litex/soc/software/libliteeth/udp.h b/litex/soc/software/libliteeth/udp.h index 5691acf0b..854065179 100644 --- a/litex/soc/software/libliteeth/udp.h +++ b/litex/soc/software/libliteeth/udp.h @@ -1,6 +1,10 @@ #ifndef __UDP_H #define __UDP_H +#ifdef __cplusplus +extern "C" { +#endif + #define ETHMAC_EV_SRAM_WRITER 0x1 #define ETHMAC_EV_SRAM_READER 0x1 @@ -22,4 +26,8 @@ void udp_service(void); void eth_init(void); void eth_mode(void); +#ifdef __cplusplus +} +#endif + #endif /* __UDP_H */ diff --git a/litex/soc/software/liblitesata/sata.h b/litex/soc/software/liblitesata/sata.h index bc7845702..122168b2f 100644 --- a/litex/soc/software/liblitesata/sata.h +++ b/litex/soc/software/liblitesata/sata.h @@ -4,6 +4,10 @@ #ifndef __SATA_H #define __SATA_H +#ifdef __cplusplus +extern "C" { +#endif + #include /*-----------------------------------------------------------------------*/ @@ -29,4 +33,8 @@ void sata_write(uint32_t sector, uint32_t count, uint8_t* buf); #endif +#ifdef __cplusplus +} +#endif + #endif /* __SATA_H */ diff --git a/litex/soc/software/liblitesdcard/sdcard.h b/litex/soc/software/liblitesdcard/sdcard.h index eb0663211..d8aa74b9b 100644 --- a/litex/soc/software/liblitesdcard/sdcard.h +++ b/litex/soc/software/liblitesdcard/sdcard.h @@ -4,6 +4,10 @@ #ifndef __SDCARD_H #define __SDCARD_H +#ifdef __cplusplus +extern "C" { +#endif + #include #define CLKGEN_STATUS_BUSY 0x1 @@ -107,4 +111,8 @@ void fatfs_set_ops_sdcard(void); #endif /* CSR_SDCORE_BASE */ +#ifdef __cplusplus +} +#endif + #endif /* __SDCARD_H */ diff --git a/litex/soc/software/liblitesdcard/spisdcard.h b/litex/soc/software/liblitesdcard/spisdcard.h index deda3eb21..53c3ae682 100644 --- a/litex/soc/software/liblitesdcard/spisdcard.h +++ b/litex/soc/software/liblitesdcard/spisdcard.h @@ -5,6 +5,10 @@ #ifndef __SPISDCARD_H #define __SPISDCARD_H +#ifdef __cplusplus +extern "C" { +#endif + #include #ifdef CSR_SPISDCARD_BASE @@ -54,4 +58,8 @@ void fatfs_set_ops_spisdcard(void); #endif /* CSR_SPISDCARD_BASE */ +#ifdef __cplusplus +} +#endif + #endif /* __SPISDCARD_H */ diff --git a/litex/soc/software/liblitespi/spiflash.h b/litex/soc/software/liblitespi/spiflash.h index e76a7d2a2..5b6c04c8c 100644 --- a/litex/soc/software/liblitespi/spiflash.h +++ b/litex/soc/software/liblitespi/spiflash.h @@ -1,6 +1,10 @@ #ifndef __LITESPI_FLASH_H #define __LITESPI_FLASH_H +#ifdef __cplusplus +extern "C" { +#endif + #define SPI_FLASH_BLOCK_SIZE 256 #define CRC32_ERASED_FLASH 0xFEA8A821 @@ -9,4 +13,8 @@ void spiflash_dummy_bits_setup(unsigned int dummy_bits); void spiflash_memspeed(void); void spiflash_init(void); +#ifdef __cplusplus +} +#endif + #endif /* __LITESPI_FLASH_H */