soc/software/libXX/YY.h: adding extern C (required to link with cpp code)

This commit is contained in:
Gwenhael Goavec-Merou 2023-01-24 07:05:05 +01:00
parent 5c922320a0
commit 1eabc36c84
16 changed files with 128 additions and 0 deletions

View File

@ -1,6 +1,10 @@
#ifndef __MEMTEST_H #ifndef __MEMTEST_H
#define __MEMTEST_H #define __MEMTEST_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h> #include <stdbool.h>
#include <generated/csr.h> #include <generated/csr.h>
@ -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); void memspeed(unsigned int *addr, unsigned long size, bool read_only, bool random);
int memtest(unsigned int *addr, unsigned long maxsize); int memtest(unsigned int *addr, unsigned long maxsize);
#ifdef __cplusplus
}
#endif
#endif /* __MEMTEST_H */ #endif /* __MEMTEST_H */

View File

@ -2,6 +2,10 @@
#ifndef __PROGRSS_H #ifndef __PROGRSS_H
#define __PROGRSS_H #define __PROGRSS_H
#ifdef __cplusplus
extern "C" {
#endif
/* Initialize a progress bar. If max > 0 a one line progress /* Initialize a progress bar. If max > 0 a one line progress
* bar is printed where 'max' corresponds to 100%. If max == 0 * bar is printed where 'max' corresponds to 100%. If max == 0
* a multi line progress bar is printed. * a multi line progress bar is printed.
@ -13,4 +17,8 @@ void init_progression_bar(int max);
*/ */
void show_progress(int now); void show_progress(int now);
#ifdef __cplusplus
}
#endif
#endif /* __PROGRSS_H */ #endif /* __PROGRSS_H */

View File

@ -1,9 +1,17 @@
#ifndef __SPIFLASH_H #ifndef __SPIFLASH_H
#define __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 write_to_flash_page(unsigned int addr, const unsigned char *c, unsigned int len);
void erase_flash_sector(unsigned int addr); void erase_flash_sector(unsigned int addr);
void erase_flash(void); void erase_flash(void);
void write_to_flash(unsigned int addr, const unsigned char *c, unsigned int len); void write_to_flash(unsigned int addr, const unsigned char *c, unsigned int len);
#ifdef __cplusplus
}
#endif
#endif /* __SPIFLASH_H */ #endif /* __SPIFLASH_H */

View File

@ -4,9 +4,17 @@
#ifndef __SDRAM_BIST_H #ifndef __SDRAM_BIST_H
#define __SDRAM_BIST_H #define __SDRAM_BIST_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
void sdram_bist(uint32_t burst_length, uint32_t random); void sdram_bist(uint32_t burst_length, uint32_t random);
int sdram_hw_test(uint64_t origin, uint64_t size, uint64_t burst_length); int sdram_hw_test(uint64_t origin, uint64_t size, uint64_t burst_length);
#ifdef __cplusplus
}
#endif
#endif /* __SDRAM_BIST_H */ #endif /* __SDRAM_BIST_H */

View File

@ -1,6 +1,10 @@
#ifndef __SDRAM_H #ifndef __SDRAM_H
#define __SDRAM_H #define __SDRAM_H
#ifdef __cplusplus
extern "C" {
#endif
#include <generated/csr.h> #include <generated/csr.h>
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
@ -53,4 +57,8 @@ int sdram_init(void);
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
void sdram_debug(void); void sdram_debug(void);
#ifdef __cplusplus
}
#endif
#endif /* __SDRAM_H */ #endif /* __SDRAM_H */

View File

@ -1,6 +1,10 @@
#ifndef __SDRAM_DBG_H #ifndef __SDRAM_DBG_H
#define __SDRAM_DBG_H #define __SDRAM_DBG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <generated/csr.h> #include <generated/csr.h>
#ifdef CSR_SDRAM_BASE #ifdef CSR_SDRAM_BASE
@ -54,4 +58,8 @@ int readback_compare(struct readback *readback, struct readback *other, int verb
#endif /* CSR_SDRAM_BASE */ #endif /* CSR_SDRAM_BASE */
#ifdef __cplusplus
}
#endif
#endif /* __SDRAM_DBG_H */ #endif /* __SDRAM_DBG_H */

View File

@ -4,6 +4,10 @@
#ifndef __SDRAM_SPD_H #ifndef __SDRAM_SPD_H
#define __SDRAM_SPD_H #define __SDRAM_SPD_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <libbase/i2c.h> #include <libbase/i2c.h>
@ -34,4 +38,8 @@
bool sdram_read_spd(uint8_t spd, uint16_t addr, uint8_t *buf, uint16_t len, bool send_stop); 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 */ #endif /* __SDRAM_SPD_H */

View File

@ -4,6 +4,10 @@
#ifndef __SDRAM_UTILS_H #ifndef __SDRAM_UTILS_H
#define __SDRAM_UTILS_H #define __SDRAM_UTILS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
void print_size(uint64_t size); 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); uint64_t sdram_get_supported_memory(void);
#ifdef __cplusplus
}
#endif
#endif /* __SDRAM_UTILS_H */ #endif /* __SDRAM_UTILS_H */

View File

@ -23,6 +23,10 @@
#ifndef __INET_H #ifndef __INET_H
#define __INET_H #define __INET_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
static __inline uint16_t __bswap_16(uint16_t __x) 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; return u.c ? bswap_16(n) : n;
} }
#ifdef __cplusplus
}
#endif
#endif /* __INET_H */ #endif /* __INET_H */

View File

@ -1,6 +1,10 @@
#ifndef __MDIO_H #ifndef __MDIO_H
#define __MDIO_H #define __MDIO_H
#ifdef __cplusplus
extern "C" {
#endif
#define MDIO_CLK 0x01 #define MDIO_CLK 0x01
#define MDIO_OE 0x02 #define MDIO_OE 0x02
#define MDIO_DO 0x04 #define MDIO_DO 0x04
@ -16,4 +20,8 @@
void mdio_write(int phyadr, int reg, int val); void mdio_write(int phyadr, int reg, int val);
int mdio_read(int phyadr, int reg); int mdio_read(int phyadr, int reg);
#ifdef __cplusplus
}
#endif
#endif /* __MDIO_H */ #endif /* __MDIO_H */

View File

@ -1,6 +1,10 @@
#ifndef __TFTP_H #ifndef __TFTP_H
#define __TFTP_H #define __TFTP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
int tftp_get(uint32_t ip, uint16_t server_port, const char *filename, 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, int tftp_put(uint32_t ip, uint16_t server_port, const char *filename,
const void *buffer, int size); const void *buffer, int size);
#ifdef __cplusplus
}
#endif
#endif /* __TFTP_H */ #endif /* __TFTP_H */

View File

@ -1,6 +1,10 @@
#ifndef __UDP_H #ifndef __UDP_H
#define __UDP_H #define __UDP_H
#ifdef __cplusplus
extern "C" {
#endif
#define ETHMAC_EV_SRAM_WRITER 0x1 #define ETHMAC_EV_SRAM_WRITER 0x1
#define ETHMAC_EV_SRAM_READER 0x1 #define ETHMAC_EV_SRAM_READER 0x1
@ -22,4 +26,8 @@ void udp_service(void);
void eth_init(void); void eth_init(void);
void eth_mode(void); void eth_mode(void);
#ifdef __cplusplus
}
#endif
#endif /* __UDP_H */ #endif /* __UDP_H */

View File

@ -4,6 +4,10 @@
#ifndef __SATA_H #ifndef __SATA_H
#define __SATA_H #define __SATA_H
#ifdef __cplusplus
extern "C" {
#endif
#include <generated/csr.h> #include <generated/csr.h>
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
@ -29,4 +33,8 @@ void sata_write(uint32_t sector, uint32_t count, uint8_t* buf);
#endif #endif
#ifdef __cplusplus
}
#endif
#endif /* __SATA_H */ #endif /* __SATA_H */

View File

@ -4,6 +4,10 @@
#ifndef __SDCARD_H #ifndef __SDCARD_H
#define __SDCARD_H #define __SDCARD_H
#ifdef __cplusplus
extern "C" {
#endif
#include <generated/csr.h> #include <generated/csr.h>
#define CLKGEN_STATUS_BUSY 0x1 #define CLKGEN_STATUS_BUSY 0x1
@ -107,4 +111,8 @@ void fatfs_set_ops_sdcard(void);
#endif /* CSR_SDCORE_BASE */ #endif /* CSR_SDCORE_BASE */
#ifdef __cplusplus
}
#endif
#endif /* __SDCARD_H */ #endif /* __SDCARD_H */

View File

@ -5,6 +5,10 @@
#ifndef __SPISDCARD_H #ifndef __SPISDCARD_H
#define __SPISDCARD_H #define __SPISDCARD_H
#ifdef __cplusplus
extern "C" {
#endif
#include <generated/csr.h> #include <generated/csr.h>
#ifdef CSR_SPISDCARD_BASE #ifdef CSR_SPISDCARD_BASE
@ -54,4 +58,8 @@ void fatfs_set_ops_spisdcard(void);
#endif /* CSR_SPISDCARD_BASE */ #endif /* CSR_SPISDCARD_BASE */
#ifdef __cplusplus
}
#endif
#endif /* __SPISDCARD_H */ #endif /* __SPISDCARD_H */

View File

@ -1,6 +1,10 @@
#ifndef __LITESPI_FLASH_H #ifndef __LITESPI_FLASH_H
#define __LITESPI_FLASH_H #define __LITESPI_FLASH_H
#ifdef __cplusplus
extern "C" {
#endif
#define SPI_FLASH_BLOCK_SIZE 256 #define SPI_FLASH_BLOCK_SIZE 256
#define CRC32_ERASED_FLASH 0xFEA8A821 #define CRC32_ERASED_FLASH 0xFEA8A821
@ -9,4 +13,8 @@ void spiflash_dummy_bits_setup(unsigned int dummy_bits);
void spiflash_memspeed(void); void spiflash_memspeed(void);
void spiflash_init(void); void spiflash_init(void);
#ifdef __cplusplus
}
#endif
#endif /* __LITESPI_FLASH_H */ #endif /* __LITESPI_FLASH_H */