Skip to content

Commit

Permalink
[syterkit] Compatible with cpluspplus
Browse files Browse the repository at this point in the history
  • Loading branch information
YuzukiTsuru committed Jan 1, 2024
1 parent 4bd0ab6 commit 7fb7096
Show file tree
Hide file tree
Showing 35 changed files with 472 additions and 187 deletions.
8 changes: 8 additions & 0 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include <stdint.h>
#include <types.h>

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))

#define ALIGN(size, align) (((size) + (align) -1) & (~((align) -1)))
Expand Down Expand Up @@ -40,4 +44,8 @@ int raise(int signum);

void show_banner(void);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif// __COMMON_H__
7 changes: 7 additions & 0 deletions include/ctype.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#ifndef __CTYPE_H__
#define __CTYPE_H__

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

/**
* Check if the given character is alphanumeric.
*
Expand Down Expand Up @@ -131,5 +135,8 @@ int tolower(int c);
*/
int toupper(int c);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif /* __CTYPE_H__ */
8 changes: 7 additions & 1 deletion include/drivers/pmu/axp.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

#include "reg-axp.h"

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

/**
* Structure describing a voltage step of the power domain.
*/
Expand Down Expand Up @@ -75,6 +79,8 @@ int pmu_axp1530_set_vol(sunxi_i2c_t *i2c_dev, char *name, int set_vol, int onoff
*/
void pmu_axp1530_dump(sunxi_i2c_t *i2c_dev);


#ifdef __cplusplus
}
#endif // __cplusplus

#endif // __G_AXP_H__
9 changes: 9 additions & 0 deletions include/drivers/pmu/reg-axp.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
#include <stdint.h>
#include <types.h>

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

#include "reg-axp1530.h"

#ifdef __cplusplus
}
#endif // __cplusplus


#endif// __G_REG_AXP_H__
8 changes: 8 additions & 0 deletions include/drivers/reg/reg-dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

#include <reg-ncat.h>

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

#define SUNXI_DMA_CHANNEL_BASE (SUNXI_DMA_BASE + 0x100)
#define DMA_AUTO_GATE_REG (SUNXI_DMA_BASE + 0x28)

Expand Down Expand Up @@ -58,4 +62,8 @@
#define DMA_PKG_END_INT (1 << 1)
#define DMA_QUEUE_END_INT (1 << 2)

#ifdef __cplusplus
}
#endif // __cplusplus

#endif// __REG_DMA_H__
8 changes: 8 additions & 0 deletions include/drivers/reg/reg-ncat.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#ifndef __G_REG_NCAT_H__
#define __G_REG_NCAT_H__

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

#if defined(CONFIG_CHIP_SUN8IW21)
#include <sun8iw21/reg/reg-ncat.h>
#elif defined(CONFIG_CHIP_SUN8IW20)
Expand All @@ -13,4 +17,8 @@
#error "Unsupported chip"
#endif

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // __G_REG_NCAT_H__
8 changes: 8 additions & 0 deletions include/drivers/sys-clk.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef __SYS_CLK_H__
#define __SYS_CLK_H__

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

#if defined(CONFIG_CHIP_SUN8IW21)
#include <sun8iw21/sys-clk.h>
#elif defined(CONFIG_CHIP_SUN8IW20)
Expand All @@ -11,4 +15,8 @@
#error "Unsupported chip"
#endif

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // __SYS_CLK_H__
7 changes: 7 additions & 0 deletions include/drivers/sys-dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

#include "reg-dma.h"

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

typedef struct {
uint32_t volatile config;
uint32_t volatile source_addr;
Expand Down Expand Up @@ -174,5 +178,8 @@ int dma_querystatus(uint32_t hdma);
*/
int dma_test(uint32_t *src_addr, uint32_t *dst_addr);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif /* _SUNXI_DMA_H */
8 changes: 8 additions & 0 deletions include/drivers/sys-dram.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#ifndef __SYS_DRAM_H__
#define __SYS_DRAM_H__

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

#if defined(CONFIG_CHIP_SUN8IW21)
#include <sun8iw21/sys-dram.h>
#elif defined(CONFIG_CHIP_SUN8IW20)
Expand All @@ -13,4 +17,8 @@
#error "Unsupported chip"
#endif

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // __SYS_DRAM_H__
7 changes: 7 additions & 0 deletions include/drivers/sys-gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

#include "log.h"

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

enum {
GPIO_INPUT = 0,
GPIO_OUTPUT = 1,
Expand Down Expand Up @@ -92,5 +96,8 @@ int sunxi_gpio_read(gpio_t pin);
*/
void sunxi_gpio_set_pull(gpio_t pin, enum gpio_pull_t pull);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif// __SYS_GPIO_H__
8 changes: 8 additions & 0 deletions include/drivers/sys-i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include <stdint.h>
#include <types.h>

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

typedef struct {
uint32_t base;
uint8_t id;
Expand Down Expand Up @@ -110,4 +114,8 @@ int sunxi_i2c_read(sunxi_i2c_t *i2c_dev, uint8_t addr, uint32_t reg, uint8_t *da
* F8h No relevant status information or no interrupt
*-----------------------------------------------------------------------------*/

#ifdef __cplusplus
}
#endif // __cplusplus

#endif// __SYS_I2C_H__
8 changes: 8 additions & 0 deletions include/drivers/sys-rproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#ifndef __G_SYS_RPROC_H__
#define __G_SYS_RPROC_H__

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

#if defined(CONFIG_CHIP_SUN8IW21)
#include <sun8iw21/sys-rproc.h>
#elif defined(CONFIG_CHIP_SUN8IW20)
Expand All @@ -11,4 +15,8 @@
#error "Unsupported chip"
#endif

#ifdef __cplusplus
}
#endif // __cplusplus

#endif// __G_SYS_RPROC_H__
7 changes: 7 additions & 0 deletions include/drivers/sys-rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

#include "log.h"

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

#define EFEX_FLAG (0x5AA5A55A)
#define RTC_FEL_INDEX 2
#define RTC_BOOT_INDEX 6
Expand Down Expand Up @@ -72,5 +76,8 @@ int rtc_set_bootmode_flag(uint8_t flag);
*/
int rtc_get_bootmode_flag(void);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif// __SYS_RTC_H__
7 changes: 7 additions & 0 deletions include/drivers/sys-sdcard.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

#include "log.h"

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

enum {
/* Class 1 */
MMC_GO_IDLE_STATE = 0,
Expand Down Expand Up @@ -213,5 +217,8 @@ int sdmmc_init(sdmmc_pdata_t *data, sdhci_t *hci);
*/
uint64_t sdmmc_blk_read(sdmmc_pdata_t *data, uint8_t *buf, uint64_t blkno, uint64_t blkcnt);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif /* __SDCARD_H__ */
8 changes: 8 additions & 0 deletions include/drivers/sys-sdhci.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#ifndef __G_SDHCI_H__
#define __G_SDHCI_H__

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

#if defined(CONFIG_CHIP_SUN8IW21)
#include <sun8iw21/sys-sdhci.h>
#elif defined(CONFIG_CHIP_SUN8IW20)
Expand All @@ -13,4 +17,8 @@
# error "Unsupported chip"
#endif

#ifdef __cplusplus
}
#endif // __cplusplus

#endif /* __G_SDHCI_H__ */
8 changes: 8 additions & 0 deletions include/drivers/sys-sid.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#ifndef _SYS_SID_H_
#define _SYS_SID_H_

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

#if defined(CONFIG_CHIP_SUN8IW21)
#include <sun8iw21/sys-sid.h>
#elif defined(CONFIG_CHIP_SUN8IW20)
Expand All @@ -13,4 +17,8 @@
#error "Unsupported chip"
#endif

#ifdef __cplusplus
}
#endif // __cplusplus

#endif// _SYS_SID_H_
8 changes: 8 additions & 0 deletions include/drivers/sys-spi-nand.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

#include "log.h"

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

typedef struct {
uint8_t mfr;
uint16_t dev;
Expand Down Expand Up @@ -53,4 +57,8 @@ int spi_nand_detect(sunxi_spi_t *spi);
*/
uint32_t spi_nand_read(sunxi_spi_t *spi, uint8_t *buf, uint32_t addr,uint32_t rxlen);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // __SYS_SPI_NAND_H__
7 changes: 7 additions & 0 deletions include/drivers/sys-spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@

#include "log.h"

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

typedef enum {
SPI_IO_SINGLE = 0x00,
SPI_IO_DUAL_RX,
Expand Down Expand Up @@ -62,5 +66,8 @@ void sunxi_spi_disable(sunxi_spi_t *spi);
*/
int sunxi_spi_transfer(sunxi_spi_t *spi, spi_io_mode_t mode, void *txbuf, uint32_t txlen, void *rxbuf, uint32_t rxlen);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif
7 changes: 7 additions & 0 deletions include/drivers/sys-uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
#include <types.h>
#include <sys-gpio.h>

#ifdef __cplusplus
extern "C" {
#endif// __cplusplus

typedef struct {
uint32_t base;
uint8_t id;
Expand Down Expand Up @@ -42,5 +46,8 @@ int sunxi_serial_tstc(void *arg);
*/
char sunxi_serial_getc(void *arg);

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // __SYS_UART_H__
Loading

0 comments on commit 7fb7096

Please sign in to comment.