Skip to content

Commit

Permalink
Copy headers in to make documentation buildable
Browse files Browse the repository at this point in the history
This inflates the repository size, but should leave regular builds
unaffected as they take the normal repository and work from there.
  • Loading branch information
chrysn committed Sep 14, 2020
1 parent 475fd34 commit 4018046
Show file tree
Hide file tree
Showing 1,036 changed files with 171,865 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ keywords = ["riot", "riot-os", "iot", "bindings"]
categories = ["external-ffi-bindings", "no-std"]
license = "LGPL-2.1"

[package.metadata.docs.rs]
# See build.rs on docs.rs
default-target = "i686-unknown-linux-gnu"

[build-dependencies]
bindgen = "0.53.1"
shlex = "0.1.1"
Expand Down
15 changes: 13 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,19 @@ use std::path::PathBuf;
use serde_json::json;

fn main() {
let cflags = env::var("RIOT_CFLAGS")
.expect("Please pass in RIOT_CFLAGS; see README.md for details.");
let cflags = if let Ok(_) = std::env::var("DOCS_RS") {
// For docs.rs, we take this exemplary setup
//
// Based on the riot-examples coap build for native (aligned with Cargo.toml's
// default-target for docs.rs), paths switched over to documentation-headers/
// which is a headers-only full tree copy of RIOT current master branch 8b3d019d (except
// boards and cpu keeping only native, which makes this managable in size)
"-DDEVELHELP -Werror -Wall -Wextra -pedantic -g3 -std=gnu11 -m32 -fstack-protector-all -ffunction-sections -fdata-sections -DDEBUG_ASSERT_VERBOSE -DRIOT_APPLICATION=\"coap_demo\" -DBOARD_NATIVE=\"native\" -DRIOT_BOARD=BOARD_NATIVE -DCPU_NATIVE=\"native\" -DRIOT_CPU=CPU_NATIVE -DMCU_NATIVE=\"native\" -DRIOT_MCU=MCU_NATIVE -fno-common -Wall -Wextra -Wmissing-include-dirs -fno-delete-null-pointer-checks -fdiagnostics-color -Wstrict-prototypes -Wold-style-definition -gz -Wformat=2 -Wformat-overflow -Wformat-truncation -DSOCK_HAS_IPV6 -DSOCK_HAS_ASYNC -DSOCK_HAS_ASYNC -DSOCK_HAS_ASYNC_CTX -DRIOT_VERSION=\"2020.10-devel-1278-g8b3d01\" -DMODULE_AUTO_INIT -DMODULE_AUTO_INIT_GNRC_IPV6 -DMODULE_AUTO_INIT_GNRC_IPV6_NIB -DMODULE_AUTO_INIT_GNRC_NETIF -DMODULE_AUTO_INIT_GNRC_PKTBUF -DMODULE_AUTO_INIT_GNRC_UDP -DMODULE_AUTO_INIT_RANDOM -DMODULE_AUTO_INIT_XTIMER -DMODULE_BOARD -DMODULE_CORE -DMODULE_CORE_IDLE_THREAD -DMODULE_CORE_INIT -DMODULE_CORE_MBOX -DMODULE_CORE_MSG -DMODULE_CORE_PANIC -DMODULE_CORE_THREAD_FLAGS -DMODULE_CPU -DMODULE_DIV -DMODULE_EVENT -DMODULE_EVENT_CALLBACK -DMODULE_EVENT_TIMEOUT -DMODULE_EVTIMER -DMODULE_FMT -DMODULE_GCOAP -DMODULE_GNRC -DMODULE_GNRC_ICMPV6 -DMODULE_GNRC_ICMPV6_ECHO -DMODULE_GNRC_IPV6 -DMODULE_GNRC_IPV6_DEFAULT -DMODULE_GNRC_IPV6_HDR -DMODULE_GNRC_IPV6_NIB -DMODULE_GNRC_NDP -DMODULE_GNRC_NETAPI -DMODULE_GNRC_NETAPI_CALLBACKS -DMODULE_GNRC_NETAPI_MBOX -DMODULE_GNRC_NETDEV_DEFAULT -DMODULE_GNRC_NETIF -DMODULE_GNRC_NETIF_ETHERNET -DMODULE_GNRC_NETIF_HDR -DMODULE_GNRC_NETIF_INIT_DEVS -DMODULE_GNRC_NETIF_IPV6 -DMODULE_GNRC_NETREG -DMODULE_GNRC_NETTYPE_ICMPV6 -DMODULE_GNRC_NETTYPE_IPV6 -DMODULE_GNRC_NETTYPE_UDP -DMODULE_GNRC_PKT -DMODULE_GNRC_PKTBUF -DMODULE_GNRC_PKTBUF_STATIC -DMODULE_GNRC_SOCK -DMODULE_GNRC_SOCK_ASYNC -DMODULE_GNRC_SOCK_UDP -DMODULE_GNRC_UDP -DMODULE_ICMPV6 -DMODULE_INET_CSUM -DMODULE_IOLIST -DMODULE_IPV6_ADDR -DMODULE_IPV6_HDR -DMODULE_L2UTIL -DMODULE_LUID -DMODULE_NANOCOAP -DMODULE_NATIVE_DRIVERS -DMODULE_NETDEV_DEFAULT -DMODULE_NETDEV_ETH -DMODULE_NETDEV_REGISTER -DMODULE_NETDEV_TAP -DMODULE_NETIF -DMODULE_PERIPH -DMODULE_PERIPH_COMMON -DMODULE_PERIPH_CPUID -DMODULE_PERIPH_GPIO -DMODULE_PERIPH_GPIO_LINUX -DMODULE_PERIPH_HWRNG -DMODULE_PERIPH_INIT -DMODULE_PERIPH_INIT_CPUID -DMODULE_PERIPH_INIT_GPIO -DMODULE_PERIPH_INIT_GPIO_LINUX -DMODULE_PERIPH_INIT_HWRNG -DMODULE_PERIPH_INIT_PM -DMODULE_PERIPH_INIT_TIMER -DMODULE_PERIPH_INIT_UART -DMODULE_PERIPH_PM -DMODULE_PERIPH_TIMER -DMODULE_PERIPH_UART -DMODULE_POSIX_HEADERS -DMODULE_POSIX_INET -DMODULE_PRNG -DMODULE_PRNG_TINYMT32 -DMODULE_PS -DMODULE_RANDOM -DMODULE_SHELL -DMODULE_SHELL_COMMANDS -DMODULE_SOCK -DMODULE_SOCK_ASYNC -DMODULE_SOCK_ASYNC_EVENT -DMODULE_SOCK_UDP -DMODULE_SOCK_UTIL -DMODULE_STDIN -DMODULE_STDIO_NATIVE -DMODULE_SYS -DMODULE_TINYMT32 -DMODULE_UDP -DMODULE_XTIMER -Idocumentation-headers/core/include -Idocumentation-headers/drivers/include -Idocumentation-headers/sys/include -Idocumentation-headers/boards/native/include -DNATIVE_INCLUDES -Idocumentation-headers/boards/native/include/ -Idocumentation-headers/core/include/ -Idocumentation-headers/drivers/include/ -Idocumentation-headers/cpu/native/include -Idocumentation-headers/sys/include -Idocumentation-headers/cpu/native/include -Idocumentation-headers/sys/net/gnrc/sock/include -Idocumentation-headers/sys/posix/include -Idocumentation-headers/sys/net/sock/async/event ".to_string()
} else {
env::var("RIOT_CFLAGS")
.expect("Please pass in RIOT_CFLAGS; see README.md for details.")
.clone()
};
let cflags = shlex::split(&cflags)
.expect("Odd shell escaping in RIOT_CFLAGS");

Expand Down
203 changes: 203 additions & 0 deletions documentation-headers/boards/native/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
/*
* Copyright (C) 2013 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

/**
* @ingroup boards_native
*
* The native board uses call level hardware simulation
*
* @{
*
* @file
* @brief Basic definitions for the native board
*
* @author Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
*/

#ifndef BOARD_H
#define BOARD_H

#include <stdint.h>

/* RIOT includes */
#include <motor_driver.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef MODULE_MTD
#include "mtd_native.h"
#endif

/**
* @name LED handlers
* @{
*/
void _native_LED_GREEN_OFF(void);
void _native_LED_GREEN_ON(void);
void _native_LED_GREEN_TOGGLE(void);
void _native_LED_RED_OFF(void);
void _native_LED_RED_ON(void);
void _native_LED_RED_TOGGLE(void);

#define LED0_ON (_native_LED_RED_ON())
#define LED0_OFF (_native_LED_RED_OFF())
#define LED0_TOGGLE (_native_LED_RED_TOGGLE())
#define LED1_ON (_native_LED_GREEN_ON())
#define LED1_OFF (_native_LED_GREEN_OFF())
#define LED1_TOGGLE (_native_LED_GREEN_TOGGLE())
/** @} */

#if defined(MODULE_MTD) || DOXYGEN
/**
* @name MTD emulation configuration
* @{
*/
#ifndef MTD_PAGE_SIZE
#define MTD_PAGE_SIZE (256)
#endif
#ifndef MTD_SECTOR_SIZE
#define MTD_SECTOR_SIZE (4096)
#endif
#ifndef MTD_SECTOR_NUM
#define MTD_SECTOR_NUM (2048)
#endif
#ifndef MTD_NATIVE_FILENAME
#define MTD_NATIVE_FILENAME "MEMORY.bin"
#endif
/** @} */

/** Default MTD device */
#define MTD_0 mtd0

/** mtd flash emulation device */
extern mtd_dev_t *mtd0;
#endif

#if defined(MODULE_SPIFFS) || DOXYGEN
/**
* @name SPIFFS default configuration
* @{
*/
/* SPIFFS config flags */
#ifndef SPIFFS_READ_ONLY
#define SPIFFS_READ_ONLY (0)
#endif
#ifndef SPIFFS_SINGLETON
#define SPIFFS_SINGLETON (0)
#endif
#ifndef SPIFFS_HAL_CALLBACK_EXTRA
#define SPIFFS_HAL_CALLBACK_EXTRA (1)
#endif
#ifndef SPIFFS_CACHE
#define SPIFFS_CACHE (1)
#endif

#if SPIFFS_SINGLETON == 1
/* MTD config if singleton is used */
#ifndef SPIFFS_CFG_PHYS_SZ
#define SPIFFS_CFG_PHYS_SZ(ignore) (MTD_SECTOR_SIZE * MTD_SECTOR_NUM)
#endif
#ifndef SPIFFS_CFG_PHYS_ERASE_SZ
#define SPIFFS_CFG_PHYS_ERASE_SZ(ignore) (MTD_SECTOR_SIZE)
#endif
#ifndef SPIFFS_CFG_PHYS_ADDR
#define SPIFFS_CFG_PHYS_ADDR(ignore) (0)
#endif
#ifndef SPIFFS_CFG_LOG_PAGE_SZ
#define SPIFFS_CFG_LOG_PAGE_SZ(ignore) (MTD_PAGE_SIZE)
#endif
#ifndef SPIFFS_CFG_LOG_BLOCK_SZ
#define SPIFFS_CFG_LOG_BLOCK_SZ(ignore) (MTD_SECTOR_SIZE)
#endif
#endif

#if SPIFFS_HAL_CALLBACK_EXTRA == 0
/* Default MTD device if no callback parameter */
#ifndef SPIFFS_MTD_DEV
#define SPIFFS_MTD_DEV (MTD_0)
#endif
#endif
/** @} */
#endif

/**
* @brief Simulate QDEC on motor_set() calls
*
* @param[in] motor_driver motor driver to which motor is attached
* @param[in] motor_id motor ID on driver
* @param[in] pwm_duty_cycle Signed PWM duty_cycle to set motor speed and direction
*
* @return 0 on success
*/
void native_motor_driver_qdec_simulation( \
const motor_driver_t motor_driver, uint8_t motor_id, \
int32_t pwm_duty_cycle);

/* C++ standard do not support designated initializers */
#if !(defined __cplusplus) && (defined MODULE_PERIPH_QDEC)

/**
* @name Describe DC motors with PWM channel and GPIOs
* @{
*/
static const motor_driver_config_t motor_driver_config[] = {
{
.pwm_dev = 0,
.mode = MOTOR_DRIVER_1_DIR_BRAKE,
.mode_brake = MOTOR_BRAKE_LOW,
.pwm_mode = PWM_LEFT,
.pwm_frequency = 20000U,
.pwm_resolution = 1000U,
.nb_motors = 2,
.motors = {
{
.pwm_channel = 0,
.gpio_enable = GPIO_PIN(0, 0),
.gpio_dir0 = GPIO_PIN(0, 0),
.gpio_dir1_or_brake = GPIO_PIN(0, 0),
.gpio_dir_reverse = 0,
.gpio_enable_invert = 0,
.gpio_brake_invert = 0,
},
{
.pwm_channel = 1,
.gpio_enable = GPIO_PIN(0, 0),
.gpio_dir0 = GPIO_PIN(0, 0),
.gpio_dir1_or_brake = GPIO_PIN(0, 0),
.gpio_dir_reverse = 1,
.gpio_enable_invert = 0,
.gpio_brake_invert = 0,
},
},
.cb = native_motor_driver_qdec_simulation,
},
};

#define MOTOR_DRIVER_NUMOF ARRAY_SIZE(motor_driver_config)
/** @} */

/**
* @name ztimer configuration
* @{
*/
#define CONFIG_ZTIMER_USEC_TYPE ZTIMER_TYPE_PERIPH_TIMER
#define CONFIG_ZTIMER_USEC_DEV TIMER_DEV(0)
/* on native, anything can happen... */
#define CONFIG_ZTIMER_USEC_MIN (64)
/** @} */

#endif /* __cplusplus */

#ifdef __cplusplus
}
#endif

/** @} */
#endif /* BOARD_H */
24 changes: 24 additions & 0 deletions documentation-headers/boards/native/include/board_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (C) 2013, 2014 Ludwig Knüpfer
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/

#ifndef BOARD_INTERNAL_H
#define BOARD_INTERNAL_H

#ifdef __cplusplus
extern "C" {
#endif

extern int _native_null_out_file;
extern int _native_null_in_pipe[2];
void board_init(void);

#ifdef __cplusplus
}
#endif

#endif /* BOARD_INTERNAL_H */
80 changes: 80 additions & 0 deletions documentation-headers/build/pkg/fatfs/diskio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*-----------------------------------------------------------------------/
/ Low level disk interface modlue include file (C)ChaN, 2014 /
/-----------------------------------------------------------------------*/

#ifndef _DISKIO_DEFINED
#define _DISKIO_DEFINED

#ifdef __cplusplus
extern "C" {
#endif

#include "integer.h"


/* Status of Disk Functions */
typedef BYTE DSTATUS;

/* Results of Disk Functions */
typedef enum {
RES_OK = 0, /* 0: Successful */
RES_ERROR, /* 1: R/W Error */
RES_WRPRT, /* 2: Write Protected */
RES_NOTRDY, /* 3: Not Ready */
RES_PARERR /* 4: Invalid Parameter */
} DRESULT;


/*---------------------------------------*/
/* Prototypes for disk control functions */


DSTATUS disk_initialize (BYTE pdrv);
DSTATUS disk_status (BYTE pdrv);
DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);


/* Disk Status Bits (DSTATUS) */

#define STA_NOINIT 0x01 /* Drive not initialized */
#define STA_NODISK 0x02 /* No medium in the drive */
#define STA_PROTECT 0x04 /* Write protected */


/* Command code for disk_ioctrl fucntion */

/* Generic command (Used by FatFs) */
#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */

/* Generic command (Not used by FatFs) */
#define CTRL_POWER 5 /* Get/Set power status */
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
#define CTRL_EJECT 7 /* Eject media */
#define CTRL_FORMAT 8 /* Create physical format on the media */

/* MMC/SDC specific ioctl command */
#define MMC_GET_TYPE 10 /* Get card type */
#define MMC_GET_CSD 11 /* Get CSD */
#define MMC_GET_CID 12 /* Get CID */
#define MMC_GET_OCR 13 /* Get OCR */
#define MMC_GET_SDSTAT 14 /* Get SD status */
#define ISDIO_READ 55 /* Read data form SD iSDIO register */
#define ISDIO_WRITE 56 /* Write data to SD iSDIO register */
#define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */

/* ATA/CF specific ioctl command */
#define ATA_GET_REV 20 /* Get F/W revision */
#define ATA_GET_MODEL 21 /* Get model name */
#define ATA_GET_SN 22 /* Get serial number */

#ifdef __cplusplus
}
#endif

#endif
Loading

0 comments on commit 4018046

Please sign in to comment.