code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
#ifndef PCA9544_H
#define PCA9544_H
#ifdef __cplusplus
extern "C" {
#endif
/* ===== System include ===== */
#include "aos/hal/i2c.h"
/* ===== Default Configuration Based on BSP ===== */
#ifdef HAAS_I2C
#define I2C_PORT 1
#define I2C_ADDR_W_8BIT 8
#define I2C_BR_100K 100000
#endif
/* ===== MACRO Definition ===== */
... | YifuLiu/AliOS-Things | components/drivers/external_device/pca9544/include/pca9544.h | C | apache-2.0 | 4,671 |
#ifndef PCA9544_I2C_DRV_H
#define PCA9544_I2C_DRV_H
#ifdef __cplusplus
extern "C" {
#endif
/* ===== System include ===== */
#include "aos/hal/i2c.h"
/* ===== API Lists ===== */
/**********************************************************
* @fun pca9544_i2c_init
* @breif pca9544 i2c initialization
* @param i2c... | YifuLiu/AliOS-Things | components/drivers/external_device/pca9544/internal/pca9544_i2c_drv.h | C | apache-2.0 | 3,658 |
#include <stdio.h>
#include <stdlib.h>
#include "pca9544.h"
#include "pca9544_i2c_drv.h"
static PCA9544_DEV_CFG_T g_pca9544_dev_cfg;
static i2c_dev_t g_pca9544_i2c_cfg;
/**********************************************************
* @fun PCA9544_init
* @breif pca9544 initialization
* @param i2c:the poi... | YifuLiu/AliOS-Things | components/drivers/external_device/pca9544/src/pca9544.c | C | apache-2.0 | 8,309 |
#include "pca9544_i2c_drv.h"
#include <aos/errno.h>
#include <stddef.h>
#include <stdint.h>
#include <vfsdev/i2c_dev.h>
#define I2C_PORT_MAX 4
static int g_i2c_fd[I2C_PORT_MAX] = { -1, -1, -1, -1 };
/**********************************************************
* @fun pca9544_i2c_init
* @breif pca9544 i2c initial... | YifuLiu/AliOS-Things | components/drivers/external_device/pca9544/src/pca9544_i2c_drv.c | C | apache-2.0 | 8,018 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
#include "sh1106.h"
static void example_sh1106_init(int argc, char **argv)
{
printf("sh1106 init test begin ...\r\n");
sh1106_init();
printf("sh1106 init test end !!!\r\n");
return;
}
static ... | YifuLiu/AliOS-Things | components/drivers/external_device/sh1106/example/sh1106_example.c | C | apache-2.0 | 984 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _OLED_FONT_H
#define _OELD_FONT_H
// 常用ASCII表
// 偏移量32
// ASCII字符集:
// !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
// PC2LCD2002取模方式设置:阴码+逐列式+顺向+C51格式
// 总共:3个字符集(12*12、16*16和24*24),用户可以自行新增其他分辨率的字... | YifuLiu/AliOS-Things | components/drivers/external_device/sh1106/include/font.h | C | apache-2.0 | 44,511 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef __ICON_H__
#define __ICON_H__
#include <stdio.h>
typedef struct {
uint8_t *p_icon_data;
uint16_t width;
uint16_t height;
uint8_t *p_icon_mask;
} icon_t;
// 由于不同扫描方式得到的结果不一样 有的可能是一维数组有的可能是二维
// 很麻烦做抽象 先统一使用列行式吧 可以搞一个枚举 根据不同扫描方式
// ... | YifuLiu/AliOS-Things | components/drivers/external_device/sh1106/include/icon.h | C | apache-2.0 | 568 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef SENSORS_SH1106_H
#define SENSORS_SH1106_H
#include "font.h"
#include "icon.h"
uint8_t sh1106_init(void);
void OLED_Refresh_GRAM(void);
void OLED_Clear(void);
void OLED_Full(void);
void OLED_DrawPoint(int16_t x, int16_t y, uint8_t mode);
void OLED... | YifuLiu/AliOS-Things | components/drivers/external_device/sh1106/include/sh1106.h | C | apache-2.0 | 1,271 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _SH1106_HDCONFIG_H
#define _SH1106_HDCONFIG_H
#if USE_SOFT_SPI == 1
#ifdef BOARD_HAASEDUK1
#define OLED_CLK_PIN HAL_IOMUX_PIN_P3_7
#define OLED_SDA_PIN HAL_IOMUX_PIN_P3_5
#define OLED_RES_PIN HAL_IOMUX_PIN_P3_6
#define OLED_DC_PIN HAL_... | YifuLiu/AliOS-Things | components/drivers/external_device/sh1106/include/sh1106_hdconfig.h | C | apache-2.0 | 649 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include "sh1106.h"
#include "aos/hal/gpio.h"
#include "aos/hal/spi.h"
#include "hal_iomux_haas1000.h"
#include "ulog/ulog.h"
#include "sh1106_hdconfig.h"
#include <math.h>
#include <stdio.h>
#include <time.h>
#if USE_SOFT_SPI == 1
#include <sys/ioctl.h>... | YifuLiu/AliOS-Things | components/drivers/external_device/sh1106/src/sh1106.c | C | apache-2.0 | 21,733 |
#ifdef AOS_COMP_CLI
#include "aos/cli.h"
#endif
// example based on haaseduk1
#include "hal_iomux_haas1000.h"
#include "st7789.h"
st7789_dev_t my_st7789 = {0};
// 硬件初始化
static void example_st7789_hw_init(int argc, char **argv)
{
st7789_init();
return;
}
// 绘画随机矩形
static void example_st7789_draw_ract(int arg... | YifuLiu/AliOS-Things | components/drivers/external_device/st7789/example/st7789_example.c | C | apache-2.0 | 1,159 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#include <stdio.h>
#define ST7789_HEIGHT 240
#define ST7789_WIDTH 320
typedef struct _st7789_dev_t {
int spi_port;
int spi_freq;
int gpio_dc_id;
int gpio_reset_id;
int gpio_bgl_id;
// int screen_width;
// int screen_h... | YifuLiu/AliOS-Things | components/drivers/external_device/st7789/include/st7789.h | C | apache-2.0 | 1,420 |
/*
* Copyright (C) 2015-2020 Alibaba Group Holding Limited
*/
#include "st7789.h"
#include "aos/hal/gpio.h"
#include "aos/hal/spi.h"
#include "hal_iomux_haas1000.h"
#include <stdio.h>
#define ST7789_HEIGHT 240
#define ST7789_WIDTH 320
#define ST7789_DC_PIN HAL_GPIO_PIN_P0_4
#define ST7789_RESET_PIN HAL_GP... | YifuLiu/AliOS-Things | components/drivers/external_device/st7789/src/st7789.c | C | apache-2.0 | 11,605 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <sys/ioctl.h>
#include <stdlib.h>
#include <fcntl.h>
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
#include "aos/vfs.h"
#include <drivers/u_ld.h>
#include <vfsdev/adc_dev.h>
#include <drivers/char/u_device.h>
void vfs_adc_handler (void *arg) {
... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/example/adc_example.c | C | apache-2.0 | 1,722 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include <aos/adc.h>
#include <aos/kernel.h>
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
/*TESTCASE1: Get ADC raw data, and then convert it into voltage. */
static int aos_adc_test_raw_data(uint32_t id, uint32_t channel)
{
int ret;
... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/example/aos_adc_example.c | C | apache-2.0 | 2,699 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#ifndef AOS_ADC_H
#define AOS_ADC_H
#ifdef AOS_KERNEL_BUILD
#include <aos/device.h>
#else
#include <stdint.h>
#endif
/**
* @defgroup adc_api ADC
* @ingroup driver_api
* @brief AOS API for ADC.
* @{
*/
typedef enum {
AOS_ADC_MODE_SINGLE, /**< 单次采样... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/include/aos/adc.h | C | apache-2.0 | 3,893 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#ifndef AOS_ADC_CORE_H
#define AOS_ADC_CORE_H
#include <aos/device_core.h>
#include <aos/adc.h>
/** @defgroup driver_api driver
* @ingroup aos_components
* @{
*/
/** @} */
/**
* @defgroup aos_adc_driver ADC驱动操作
* @ingroup driver_api
* 给ADC驱动提供ADC设备注... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/include/aos/adc_core.h | C | apache-2.0 | 2,398 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#ifndef _AOS_ADC_CSI_H
#define _AOS_ADC_CSI_H
#include <aos/adc_core.h>
#include <drv/adc.h>
typedef struct {
aos_adc_t aos_adc; /* aos adc device */
csi_adc_t csi_adc; /* csi adc device */
} aos_adc_csi_t;
#ifdef __cplusplus
extern "C" {
#endif
/... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/include/aos/adc_csi.h | C | apache-2.0 | 867 |
/**
* @file adc.h
* @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#ifndef HAL_ADC_H
#define HAL_ADC_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup hal_adc ADC
* ADC hal API.
*
* @{
*/
#include <stdint.h>
/* Define the wait forever timeout macro */
#define HAL_WAIT_FOREVER 0... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/include/aos/hal/adc.h | C | apache-2.0 | 1,827 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _IO_ADC_H_
#define _IO_ADC_H_
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup driver_api driver
* @ingroup aos_components
* @{
*/
/**
* @}
*/
/** @defgroup adc_device_api adc
* @ingroup driver_api
* @{
*/
... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/include/vfsdev/adc_dev.h | C | apache-2.0 | 974 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#include <aos/adc_core.h>
#ifdef AOS_COMP_DEVFS
#include <stdio.h>
#include <inttypes.h>
#endif
#define AOS_ADC_CHECK_NULL(x) \
do { \
if ((x) == NULL) { \
return -EINVAL; \
} \
} while (0)
aos_status_t aos_adc_get(aos_adc... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/src/adc.c | C | apache-2.0 | 9,008 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#include <errno.h>
#include <stdbool.h>
#include <aos/adc_core.h>
#include <aos/adc_csi.h>
static void adc_csi_unregister(aos_adc_t *adc)
{
aos_adc_csi_t *aos_csi_adc = aos_container_of(adc, aos_adc_csi_t, aos_adc);
csi_adc_uninit(&(aos_csi_adc->csi_... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/src/adc_csi.c | C | apache-2.0 | 3,538 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <poll.h>
#include <aos/hal/adc.h>
#include <vfsdev/adc_dev.h>
#include <devicevfs/devicevfs.h>
#ifdef CONFIG_ADC_NUM
#define PLATFORM_ADC_NUM CONFIG_ADC_NUM
#else
#define PLATFORM_ADC_NUM 4
#endif
#if (PLATFORM_ADC_NUM > 0)
// ADC device nod... | YifuLiu/AliOS-Things | components/drivers/peripheral/adc/src/adc_dev.c | C | apache-2.0 | 6,113 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <epoll.h>
#include <poll.h>
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
#include <aos/vfs.h>
#include <aos/hal/flash.h>
#include <vfsdev/flash_dev.h>
#include <drivers... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/example/flash_example.c | C | apache-2.0 | 4,400 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <stdint.h>
#include <aos/kernel.h>
#include <aos/cli.h>
#include <aos/mtd.h>
static void mtd_unit_test(int argc, char *argv[])
{
ssize_t count;
aos_mtd_t *mtd;
aos_status_t ret;
char buf[64] = "mtd test.";
... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/example/mtd_example.c | C | apache-2.0 | 1,717 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_FLASH_H
#define AOS_FLASH_H
#ifdef AOS_KERNEL_BUILD
#include <aos/device.h>
#else
#include <stdint.h>
#endif
/**
* @defgroup flash_api Flash
* @ingroup driver_api
* @brief AOS API for flash.
* @{
*/
#define AOS_FLASH_F_TYPE_MASK ... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/flash.h | C | apache-2.0 | 5,471 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_FLASH_CORE_H
#define AOS_FLASH_CORE_H
#include <aos/device_core.h>
#include <aos/flash.h>
struct aos_flash_ops;
typedef struct {
aos_dev_t dev;
/* must be initialized before registration */
const struct aos_flash_ops *ops;
... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/flash_core.h | C | apache-2.0 | 1,625 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_FLASHPART_H
#define AOS_FLASHPART_H
#ifdef AOS_KERNEL_BUILD
#include <aos/device.h>
#else
#include <stdint.h>
#endif
#include <aos/flash.h>
/**
* @defgroup flashpart_api Flash Partition
* @ingroup driver_api
* @brief AOS API for flash par... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/flashpart.h | C | apache-2.0 | 6,540 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_FLASHPART_CORE_H
#define AOS_FLASHPART_CORE_H
#include <aos/device_core.h>
#include <aos/flashpart.h>
typedef struct {
aos_dev_t dev;
aos_flash_ref_t flash_ref;
aos_flash_info_t flash_info;
/* must be initialized before regi... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/flashpart_core.h | C | apache-2.0 | 847 |
/*
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
*/
#ifndef AOS_HAL_FLASH_H
#define AOS_HAL_FLASH_H
typedef enum {
HAL_PARTITION_ERROR = -1,
HAL_PARTITION_BOOTLOADER,
HAL_PARTITION_APPLICATION,
HAL_PARTITION_ATE,
HAL_PARTITION_OTA_TEMP,
HAL_PARTITION_RF_FIRMWARE,
HAL_PARTITION_... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/hal/flash.h | C | apache-2.0 | 8,615 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
/**
* This file is created to support Linux style use of mtd device.
* Currently only part definitions of linux's mtd-api.h are supported.
*/
#ifndef __AOS_MTD_ABI_H
#define __AOS_MTD_ABI_H
#include <stdint.h>
struct erase_info_user {
uint32_t s... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/mtd-abi.h | C | apache-2.0 | 679 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef __AOS_MTD_H
#define __AOS_MTD_H
#include <stddef.h>
#include <stdint.h>
#include <aos/kernel.h>
#include <aos/device_core.h>
#define MTD_TYPE_NOR 1
#define MTD_TYPE_NAND 2
#define MTD_DEVICE_NAME_PREFIX "mtdblock"
#define MTD_DEVICE_NAME_FORMAT... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/mtd.h | C | apache-2.0 | 7,995 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __AOS_MTDNAND_H
#define __AOS_MTDNAND_H
#include <aos/mtd.h>
/* Status bits */
#define NAND_STATUS_FAIL 0x01
#define NAND_STATUS_FAIL_N1 0x02
#define NAND_STATUS_WP 0x80
typedef enum {
NAND_CMD_PAGE... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/mtdnand.h | C | apache-2.0 | 2,967 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef __AOS_MTDNOR_H
#define __AOS_MTDNOR_H
#include <aos/mtd.h>
int aos_mtd_nor_init(aos_mtd_t *nor, int blksize, int sector_size);
#endif /*__AOS_MTDNOR_H*/
| YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/mtdnor.h | C | apache-2.0 | 229 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdint.h>
#ifndef __AOS_PART_H
#define __AOS_PART_H
typedef struct {
const char *partition_name; /* vendor custom partition name */
const char *partition_name_std; /* standard partition name */
uint32_t partition_star... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/aos/mtdpart.h | C | apache-2.0 | 603 |
/*
* Copyright ( C) 2015-2020 Alibaba Group Holding Limited
*/
#ifndef _IO_FLASH_H_
#define _IO_FLASH_H_
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup flash_device_api flash
* @ingroup driver_api
* @{
*/
/* Flash设备IOCTL命令 */
#define IOC_FLASH_BASE 'F'
#define IOC_FLASH_ERASE_FLASH (IOC_FLASH_BASE ... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/include/vfsdev/flash_dev.h | C | apache-2.0 | 1,175 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#include <aos/flash_core.h>
aos_status_t aos_flash_get(aos_flash_ref_t *ref, uint32_t id)
{
return aos_dev_get(ref, AOS_DEV_TYPE_FLASH, id);
}
void aos_flash_put(aos_flash_ref_t *ref)
{
aos_dev_put(ref);
}
aos_status_t aos_flash_get_info(aos_fl... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/src/flash.c | C | apache-2.0 | 12,071 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <aos/hal/flash.h>
#include <vfsdev/flash_dev.h>
#include <devicevfs/devicevfs.h>
#define PLATFORM_FLASH_NUM HAL_PARTITION_MAX
// FLASH device node will be named with "/dev/flash<x>", where <x> is flash port id
#define FLASH_DEV_NAME_FORMAT "fla... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/src/flash_dev.c | C | apache-2.0 | 9,357 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#include <aos/flashpart_core.h>
#ifdef AOS_COMP_DEVFS
#include <stdio.h>
#include <inttypes.h>
#endif
aos_status_t aos_flashpart_get(aos_flashpart_ref_t *ref, uint32_t id)
{
return aos_dev_get(ref, AOS_DEV_TYPE_FLASHPART, id);
}
void aos_flashpart_p... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/src/flashpart.c | C | apache-2.0 | 16,304 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <aos/mtd.h>
#include <aos/mtdpart.h>
#define AOS_MTD_PART_NAME_TYPE_STD 0 /* AliOS Things standard partition name. */
#define AOS_MTD_PART_NAME_TYPE_VENDOR 1 /* Vendor partition name.... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/src/mtd.c | C | apache-2.0 | 11,754 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <aos/mtdnand.h>
#define MTDTONAND(x) ((aos_nand_t *)(x))
#define NOTALIGNED(x) ((x & (chip->page_size - 1)) != 0)
#ifndef min
#define min(a, b) ... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/src/mtdnand.c | C | apache-2.0 | 14,182 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <aos/mtdnor.h>
#include <drv/spiflash.h>
static int _nor_erase(aos_mtd_t *mtd, off_t addr, size_t len)
{
(void) mtd;
return csi_spiflash_erase(NULL, addr, len);
}
static int _nor_read(aos_mtd_t *mtd, off_t from, struct mtd_io_desc *des... | YifuLiu/AliOS-Things | components/drivers/peripheral/flash/src/mtdnor.c | C | apache-2.0 | 1,112 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdlib.h>
#include <fcntl.h>
#include <poll.h>
#include <sys/ioctl.h>
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
#include "aos/vfs.h"
#include <vfsdev/gpio_dev.h>
#include <drivers/char/u_device.h>
#include <drivers/u_ld.h>
int vfs_gpio_test... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/example/gpio_example.c | C | apache-2.0 | 1,923 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_GPIO_H
#define AOS_GPIO_H
#ifdef AOS_KERNEL_BUILD
#include <aos/device.h>
#else
#include <stdint.h>
#endif
/**
* @defgroup gpio_api GPIO Pin
* @ingroup driver_api
* @brief AOS API for GPIO pin.
* @{
*/
#define AOS_GPIO_DIR_MASK ... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/include/aos/gpio.h | C | apache-2.0 | 7,628 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_GPIO_CORE_H
#define AOS_GPIO_CORE_H
#include <aos/device_core.h>
#include <aos/gpioc.h>
#include <aos/gpio.h>
typedef struct {
aos_dev_t dev;
aos_gpioc_ref_t gpioc_ref;
/* must be initialized before registration */
uint32_t ... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/include/aos/gpio_core.h | C | apache-2.0 | 666 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_GPIOC_H
#define AOS_GPIOC_H
#include <aos/device.h>
#include <aos/gpio.h>
/**
* @defgroup gpioc_api GPIO Controller
* @ingroup driver_api
* @brief AOS API for GPIO controller.
* @{
*/
typedef aos_dev_ref_t aos_gpioc_ref_t;
#ifdef __cp... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/include/aos/gpioc.h | C | apache-2.0 | 5,143 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_GPIOC_CORE_H
#define AOS_GPIOC_CORE_H
#include <aos/device_core.h>
#include <aos/gpioc.h>
struct aos_gpioc_ops;
struct aos_gpioc_pin;
typedef struct {
aos_dev_t dev;
aos_spinlock_t lock;
/* must be initialized before registrati... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/include/aos/gpioc_core.h | C | apache-2.0 | 3,890 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_GPIOC_CSI_H
#define AOS_GPIOC_CSI_H
#include <aos/gpioc_core.h>
#include <drv/gpio.h>
#define AOS_GPIOC_CSI_MAX_NUM_PINS (sizeof(uint32_t) * 8)
typedef struct {
aos_gpioc_t gpioc;
aos_gpioc_pin_t pins[AOS_GPIOC_CSI_MAX_NUM_PINS... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/include/aos/gpioc_csi.h | C | apache-2.0 | 959 |
/**
* @file gpio.h
* @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#ifndef HAL_GPIO_H
#define HAL_GPIO_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup hal_gpio GPIO
* gpio hal API.
*
* @{
*/
#include <stdint.h>
typedef enum {
ANALOG_MODE,
/* 触发中断 */
IRQ_MODE,
... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/include/aos/hal/gpio.h | C | apache-2.0 | 4,694 |
/*
* Copyright ( C) 2015-2020 Alibaba Group Holding Limited
*/
#ifndef _IO_GPIO_H_
#define _IO_GPIO_H_
#define IOC_GPIO_BASE 'G'
#define IOC_GPIO_SET IOC_GPIO_BASE + 1
#define IOC_GPIO_GET IOC_GPIO_BASE + 2
#define IOC_GPIO_SET_IRQ IOC_GPIO_BASE + 3
enum GPIO_IO_BITS {
GPIO_IO_INPUT_BIT = 0, // Input
GPIO_... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/include/vfsdev/gpio_dev.h | C | apache-2.0 | 2,925 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#include <aos/gpio_core.h>
#ifdef AOS_COMP_DEVFS
#include <stdio.h>
#include <inttypes.h>
#endif
aos_status_t aos_gpio_get(aos_gpio_ref_t *ref, uint32_t id)
{
return aos_dev_get(ref, AOS_DEV_TYPE_GPIO, id);
}
void aos_gpio_put(aos_gpio_ref_t *ref)
{... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/src/gpio.c | C | apache-2.0 | 10,827 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <poll.h>
#include <drivers/u_ld.h>
#include <aos/hal/gpio.h>
#include <vfsdev/gpio_dev.h>
#include <devicevfs/devicevfs.h>
#ifdef CONFIG_GPIO_NUM
#define PLATFORM_GPIO_NUM CONFIG_GPIO_NUM
#else
#define PLATFORM_GPIO_NUM 40
#endif
#if (PLATFOR... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/src/gpio_dev.c | C | apache-2.0 | 8,539 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#include <aos/gpioc_core.h>
#ifndef AOS_CONFIG_GPIO_IRQ_TASK_DEFAULT_PRIO
#define AOS_CONFIG_GPIO_IRQ_TASK_DEFAULT_PRIO 30
#endif
#ifndef AOS_CONFIG_GPIO_IRQ_TASK_STACK_SIZE
#define AOS_CONFIG_GPIO_IRQ_TASK_STACK_SIZE 4096
#endif
aos_status_t aos_... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/src/gpioc.c | C | apache-2.0 | 28,258 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#include <aos/gpioc_csi.h>
static void gpioc_csi_unregister(aos_gpioc_t *gpioc)
{
aos_gpioc_csi_t *gpioc_csi;
gpioc_csi = aos_container_of(gpioc, aos_gpioc_csi_t, gpioc);
(void)csi_gpio_detach_callback(&gpioc_csi->csi_gpio);
(void)csi_gp... | YifuLiu/AliOS-Things | components/drivers/peripheral/gpio/src/gpioc_csi.c | C | apache-2.0 | 9,390 |
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <aos/errno.h>
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
#include <drivers/u_ld.h>
#include <vfsdev/i2c_dev.h>
#include <aos/driver/i2c.h>
static int32_t vfs_i2c_test(int32_t port, int32_t slave_addr, char *tx_buffer, uint32_t tx_cnt, char *rx_buffe... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/example/i2c_example.c | C | apache-2.0 | 12,622 |
/**
* @file i2c.h
* @copyright Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _AOS_I2C_H
#define _AOS_I2C_H
#ifdef __cplusplus
extern "C" {
#endif
#include <aos/kernel.h>
/** @addtogroup aos_i2c_device I2C
* aos i2c API.
*
* @{
*/
/* Define the wait forever timeout macro */
#ifndef AOS_... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/include/aos/driver/i2c.h | C | apache-2.0 | 6,873 |
/**
* @file i2c.h
* @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#ifndef HAL_I2C_H
#define HAL_I2C_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup hal_i2c I2C
* i2c hal API.
*
* @{
*/
#include <stdint.h>
/* Define the wait forever timeout macro */
#ifndef HAL_WAIT_FOREVER
#... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/include/aos/hal/i2c.h | C | apache-2.0 | 5,408 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_I2C_H
#define AOS_I2C_H
#ifdef AOS_KERNEL_BUILD
#include <aos/device.h>
#else
#include <stdint.h>
#endif
/**
* @defgroup i2c_api I2C Master
* @ingroup driver_api
* @brief AOS API for I2C master.
* @{
*/
#define AOS_I2C_F_ADDR_10 ... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/include/aos/i2c.h | C | apache-2.0 | 2,667 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_I2C_CORE_H
#define AOS_I2C_CORE_H
#include <aos/device_core.h>
#include <aos/i2c.h>
#define AOS_I2C_XF_MSG_HEAD ((uint32_t)0x1 << 0)
#define AOS_I2C_XF_MSG_TAIL ((uint32_t)0x1 << 1)
#define AOS_I2C_XF_SEQ_HEAD ((uint32_t)0x1 << 2... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/include/aos/i2c_core.h | C | apache-2.0 | 2,374 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _IO_I2C_H_
#define _IO_I2C_H_
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup i2c_device_api
* @ingroup driver_api
* @{
*/
/* I2C VFS IOCTL CMD宏定义 */
#define IOC_I2C_BASE 'I'
#define IOC_I2C_SET_FREQ IOC_I2C_BASE + 1 /**< 设定I2C频率cm... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/include/vfsdev/i2c_dev.h | C | apache-2.0 | 2,414 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#include <aos/i2c_core.h>
#ifdef AOS_COMP_DEVFS
#include <stdio.h>
#include <inttypes.h>
#endif
#define XFER_TIMEOUT 1000
#define EVENT_XFER_COMPLETE ((uint32_t)1 << 0)
#define EVENT_XFER_ERROR ((uint32_t)1 << 1)
aos_status_t aos_... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/src/i2c.c | C | apache-2.0 | 13,204 |
#include <aos/list.h>
#include <drv/iic.h>
#include <devicevfs/devicevfs.h>
#include <drivers/ddkc_log.h>
#include "i2c_core.h"
static dlist_t g_i2c_controller_list;
static aos_mutex_t g_i2c_controller_lock;
static i2c_master_dev_t *find_i2c_controller(uint32_t id) {
dlist_t *head = &g_i2c_controller_list;
... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/src/i2c_core.c | C | apache-2.0 | 25,517 |
/**
* @file i2c_core.h
* @copyright Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _I2C_CORE_H
#define _I2C_CORE_H
#ifdef __cplusplus
extern "C" {
#endif
#include "aos/driver/i2c.h"
#include <aos/list.h>
#include <aos/kernel.h>
#define AOS_I2C_MAGIC 0x12c12c12
/* This struct define i2c main han... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/src/i2c_core.h | C | apache-2.0 | 2,562 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <poll.h>
#include <aos/driver/i2c.h>
#include <vfsdev/i2c_dev.h>
#include <devicevfs/devicevfs.h>
#ifdef CONFIG_I2C_NUM
#define PLATFORM_I2C_NUM CONFIG_I2C_NUM
#else
#define PLATFORM_I2C_NUM 4
#endif
#if (PLATFORM_I2C_NUM > 0)
// I2C device no... | YifuLiu/AliOS-Things | components/drivers/peripheral/i2c/src/i2c_dev.c | C | apache-2.0 | 13,336 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#include <stdint.h>
#include <aos/pwm.h>
#include <aos/kernel.h>
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
void aos_pwm_cli_help(void)
{
printf("help:\r\n");
printf("period[ns]\r\n");
printf("duty[ns]\r\n");
printf("duration[s]\r\n");
... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/example/aos_pwm_example.c | C | apache-2.0 | 2,034 |
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <fcntl.h>
#include <aos/errno.h>
#include <aos/kernel.h>
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
#include <vfsdev/pwm_dev.h>
int vfs_pwm_test(int channel, int freq, unsigned int period_s)
{
int ret =... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/example/pwm_example.c | C | apache-2.0 | 2,009 |
/**
* @file pwm.h
* @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#ifndef HAL_PWM_H
#define HAL_PWM_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup hal_pwm PWM
* pwm hal API.
*
* @{
*/
#include <stdint.h>
typedef struct {
float duty_cycle; /**< the pwm duty_cycle */
... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/include/aos/hal/pwm.h | C | apache-2.0 | 1,597 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#ifndef AOS_PWM_H
#define AOS_PWM_H
#ifdef AOS_KERNEL_BUILD
#include <aos/device.h>
#else
#include <stdint.h>
#endif
/**
* @defgroup pwm_api PWM
* @ingroup driver_api
* @brief AOS API for PWM.
* @{
*/
typedef enum {
AOS_PWM_POLARITY_NORMAL,
AOS... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/include/aos/pwm.h | C | apache-2.0 | 1,875 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#ifndef AOS_PWM_CORE_H
#define AOS_PWM_CORE_H
#include <aos/device_core.h>
#include <aos/pwm.h>
/** @defgroup driver_api driver
* @ingroup aos_components
* @{
*/
/** @} */
/**
* @defgroup aos_pwm_driver PWM驱动操作
* @ingroup driver_api
* 给PWM驱动提供PWM设备注... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/include/aos/pwm_core.h | C | apache-2.0 | 1,655 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#ifndef _AOS_PWM_CSI_H
#define _AOS_PWM_CSI_H
#include <aos/pwm_core.h>
#include <drv/pwm.h>
typedef struct {
aos_pwm_t aos_pwm; /* aos pwm device */
csi_pwm_t csi_pwm; /* csi pwm device */
} aos_pwm_csi_t;
#ifdef __cplusplus
extern "C" {
#endif
/... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/include/aos/pwm_csi.h | C | apache-2.0 | 867 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _IO_PWM_H_
#define _IO_PWM_H_
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/** @defgroup pwm_device_api
* @ingroup driver_api
* PWM设备节点API定义,主要是ioctl函数所用的命令id定义说明
*
* @{
*/
#define IOC_PWM_BASE 'T'
#define IOC_PWM_ON IOC... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/include/vfsdev/pwm_dev.h | C | apache-2.0 | 711 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <aos/pwm_core.h>
#ifdef AOS_COMP_DEVFS
#include <inttypes.h>
#endif
#define AOS_MAX_PERIOD (1000000000U)
#define AOS_PWM_CHECK_NULL(x) \
do { \
if ((x) == NULL) { \
return -EINVAL; \
} \
} while ... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/src/pwm.c | C | apache-2.0 | 5,492 |
/*
* Copyright (C) 2021 Alibaba Group Holding Limited
*/
#include <errno.h>
#include <stdbool.h>
#include <aos/pwm_core.h>
#include <aos/pwm_csi.h>
static void pwm_csi_unregister(aos_pwm_t *pwm)
{
aos_pwm_csi_t *aos_csi_pwm = aos_container_of(pwm, aos_pwm_csi_t, aos_pwm);
csi_pwm_uninit(&(aos_csi_pwm->csi_... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/src/pwm_csi.c | C | apache-2.0 | 1,723 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <poll.h>
#include <aos/hal/pwm.h>
#include <vfsdev/pwm_dev.h>
#include <devicevfs/devicevfs.h>
#ifdef CONFIG_PWM_NUM
#define PLATFORM_PWM_NUM CONFIG_PWM_NUM
#else
#define PLATFORM_PWM_NUM 4
#endif
#if (PLATFORM_PWM_NUM > 0)
// PWM device node... | YifuLiu/AliOS-Things | components/drivers/peripheral/pwm/src/pwm_dev.c | C | apache-2.0 | 7,757 |
/*
* Copyright (C) 2021-2022 Alibaba Group Holding Limited
*/
#ifndef AOS_RTC_H
#define AOS_RTC_H
#ifdef AOS_KERNEL_BUILD
#include <aos/device.h>
#else
#include <stdint.h>
#endif
/**
* @defgroup rtc_api RTC
* @ingroup driver_api
* @brief AOS API for RTC.
* @{
*/
typedef struct {
uint64_t year : 22;... | YifuLiu/AliOS-Things | components/drivers/peripheral/rtc/include/aos/rtc.h | C | apache-2.0 | 1,884 |
/*
* Copyright (C) 2021-2022 Alibaba Group Holding Limited
*/
#ifndef AOS_RTC_CORE_H
#define AOS_RTC_CORE_H
#include <aos/device_core.h>
#include <aos/rtc.h>
struct aos_rtc_ops;
typedef struct {
aos_dev_t dev;
/* must be initialized before registration */
const struct aos_rtc_ops *ops;
} aos_rtc_t;
... | YifuLiu/AliOS-Things | components/drivers/peripheral/rtc/include/aos/rtc_core.h | C | apache-2.0 | 897 |
/*
* Copyright (C) 2021-2022 Alibaba Group Holding Limited
*/
#include <aos/rtc_core.h>
#ifdef AOS_COMP_DEVFS
#include <stdio.h>
#include <inttypes.h>
#endif
aos_status_t aos_rtc_get(aos_rtc_ref_t *ref, uint32_t id)
{
return aos_dev_get(ref, AOS_DEV_TYPE_RTC, id);
}
void aos_rtc_put(aos_rtc_ref_t *ref)
{
a... | YifuLiu/AliOS-Things | components/drivers/peripheral/rtc/src/rtc.c | C | apache-2.0 | 5,649 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <poll.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <epoll.h>
#include "aos/vfs.h"
#include <vfsdev/spi_dev.h>
#include <drivers/char/u_device.h>
#include <drivers/u_ld.h>
#if AOS_COMP_CLI
#include "... | YifuLiu/AliOS-Things | components/drivers/peripheral/spi/example/spi_example.c | C | apache-2.0 | 2,499 |
/**
* @file spi.h
* @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#ifndef HAL_SPI_H
#define HAL_SPI_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup hal_spi SPI
* spi hal API.
*
* @{
*/
#include <stdint.h>
/* Define the wait forever timeout macro */
#define HAL_WAIT_FOREVER 0... | YifuLiu/AliOS-Things | components/drivers/peripheral/spi/include/aos/hal/spi.h | C | apache-2.0 | 5,299 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_SPI_H
#define AOS_SPI_H
#ifdef AOS_KERNEL_BUILD
#include <aos/device.h>
#else
#include <stdint.h>
#endif
/**
* @defgroup spi_api SPI Master
* @ingroup driver_api
* @brief AOS API for SPI master.
* @{
*/
#define AOS_SPI_F_MODE_0 ... | YifuLiu/AliOS-Things | components/drivers/peripheral/spi/include/aos/spi.h | C | apache-2.0 | 3,989 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_SPI_CORE_H
#define AOS_SPI_CORE_H
#include <aos/device_core.h>
#include <aos/spi.h>
#define AOS_SPI_XF_MSG_HEAD ((uint32_t)0x1 << 0)
#define AOS_SPI_XF_MSG_TAIL ((uint32_t)0x1 << 1)
#define AOS_SPI_XF_SEQ_HEAD ((uint32_t)0x1 << 2... | YifuLiu/AliOS-Things | components/drivers/peripheral/spi/include/aos/spi_core.h | C | apache-2.0 | 2,789 |
/*
* Copyright ( C) 2015-2020 Alibaba Group Holding Limited
*/
#ifndef _IO_SPI_H_
#define _IO_SPI_H_
#define IOC_SPI_BASE 'S'
#define IOC_SPI_SET_CFLAG IOC_SPI_BASE + 1
#define IOC_SPI_SET_FREQ IOC_SPI_BASE + 2
#define IOC_SPI_SEND_RECV IOC_SPI_BASE + 3
#define IOC_SPI_SEND_AND_RECV IOC_SPI_BASE + 4
#define IOC_... | YifuLiu/AliOS-Things | components/drivers/peripheral/spi/include/vfsdev/spi_dev.h | C | apache-2.0 | 2,338 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#include <aos/spi_core.h>
#ifdef AOS_COMP_DEVFS
#include <stdio.h>
#include <inttypes.h>
#endif
#define XFER_TIMEOUT 1000
#define EVENT_XFER_COMPLETE ((uint32_t)1 << 0)
#define EVENT_XFER_ERROR ((uint32_t)1 << 1)
aos_status_t aos_... | YifuLiu/AliOS-Things | components/drivers/peripheral/spi/src/spi.c | C | apache-2.0 | 15,432 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <poll.h>
#include <aos/hal/spi.h>
#include <vfsdev/spi_dev.h>
#include <devicevfs/devicevfs.h>
#ifdef CONFIG_SPI_NUM
#define PLATFORM_SPI_NUM CONFIG_SPI_NUM
#else
#define PLATFORM_SPI_NUM 4
#endif
#if (PLATFORM_SPI_NUM > 0)
// SPI device node... | YifuLiu/AliOS-Things | components/drivers/peripheral/spi/src/spi_dev.c | C | apache-2.0 | 16,352 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <stdlib.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "aos/vfs.h"
#include <vfsdev/timer_dev.h>
#include <drivers/char/u_device.h>
#include <drivers/u_ld.h>
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
void vfs_timer_handler (void *arg... | YifuLiu/AliOS-Things | components/drivers/peripheral/timer/example/timer_example.c | C | apache-2.0 | 3,285 |
/**
* @file timer.h
* @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#ifndef HAL_TIMER_H
#define HAL_TIMER_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup hal_timer TIMER
* timer hal API.
*
* @{
*/
#include <stdint.h>
#define TIMER_RELOAD_AUTO 1 /**< timer reload automatic *... | YifuLiu/AliOS-Things | components/drivers/peripheral/timer/include/aos/hal/timer.h | C | apache-2.0 | 1,972 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _IO_TIMER_H_
#define _IO_TIMER_H_
#include <stdbool.h>
#define IOC_TIMER_BASE 'T'
#define IOC_TIMER_IRQP_SET IOC_TIMER_BASE + 1 // set timer parameters
#define IOC_TIMER_IRQP_GET IOC_TIMER_BASE + 2 // get timer parameters
#define IOC_TIMER_CONTR... | YifuLiu/AliOS-Things | components/drivers/peripheral/timer/include/vfsdev/timer_dev.h | C | apache-2.0 | 720 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <poll.h>
#include <aos/hal/timer.h>
#include <vfsdev/timer_dev.h>
#include <devicevfs/devicevfs.h>
#ifdef CONFIG_TIMER_NUM
#define PLATFORM_TIMER_NUM CONFIG_TIMER_NUM
#else
#define PLATFORM_TIMER_NUM 4
#endif
#if (PLATFORM_TIMER_NUM > 0)
// T... | YifuLiu/AliOS-Things | components/drivers/peripheral/timer/src/timer_dev.c | C | apache-2.0 | 9,208 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <fcntl.h>
#include <sys/ioctl.h>
#include "aos/vfs.h"
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
#include <drivers/u_ld.h>
#include <drivers/ddkc_log.h>
#include <vfsdev/uart_dev.h>
#include <drivers/char/u_device.h>
static void uart_read_test... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/example/uart_example.c | C | apache-2.0 | 5,626 |
/**
* @file uart.h
* @copyright Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#ifndef HAL_UART_H
#define HAL_UART_H
#ifdef __cplusplus
extern "C" {
#endif
/** @addtogroup hal_uart UART
* uart hal API.
*
* @{
*/
#include <stdint.h>
/* Define the wait forever timeout macro */
#define HAL_WAIT_FOR... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/include/aos/hal/uart.h | C | apache-2.0 | 5,706 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_TTY_H
#define AOS_TTY_H
#include <termios.h>
#include <aos/device.h>
/**
* @defgroup tty_api TTY
* @ingroup driver_api
* @brief AOS API for TTY.
* @{
*/
typedef aos_dev_ref_t aos_tty_ref_t;
#ifdef __cplusplus
extern "C" {
#endif
/**
... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/include/aos/tty.h | C | apache-2.0 | 2,646 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_TTY_CORE_H
#define AOS_TTY_CORE_H
#include <aos/device_core.h>
#include <aos/tty.h>
#define AOS_TTY_F_UNIQUE_REF ((uint32_t)1 << 0)
#ifndef AOS_CONFIG_TTY_RX_BUF_SIZE
#define AOS_CONFIG_TTY_RX_BUF_SIZE 1024
#endif
#ifndef AO... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/include/aos/tty_core.h | C | apache-2.0 | 1,672 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_TTY_CSI_H
#define AOS_TTY_CSI_H
#include <aos/tty_core.h>
#include <drv/uart.h>
typedef struct {
aos_tty_t tty;
csi_uart_t csi_uart;
tcflag_t mode;
aos_event_t event;
aos_sem_t rx_sem;
aos_sem_t tx_sem;
aos_task_t... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/include/aos/tty_csi.h | C | apache-2.0 | 578 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#ifndef AOS_UART_H
#define AOS_UART_H
#include <aos/tty.h>
/**
* @defgroup uart_api UART
* @ingroup driver_api
* @brief AOS API for UART.
* @{
*/
typedef aos_tty_ref_t aos_uart_ref_t;
typedef enum {
AOS_UART_PARITY_NONE,
AOS_UART_PARITY_O... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/include/aos/uart.h | C | apache-2.0 | 4,879 |
/*
* Copyright ( C) 2015-2020 Alibaba Group Holding Limited
*/
#ifndef _IO_UART_H_
#define _IO_UART_H_
#define IOC_UART_BASE 'U'
#define IOC_UART_SET_CFLAG IOC_UART_BASE + 1
#define IOC_UART_GET_CFLAG IOC_UART_BASE + 2
#define IOC_UART_DMA_CTL IOC_UART_BASE + 3
#define IOC_UART_TRX_CTL IOC_UART_BASE + 4 // disable ... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/include/vfsdev/uart_dev.h | C | apache-2.0 | 1,759 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#include <aos/tty_core.h>
#ifdef AOS_COMP_DEVFS
#include <stdio.h>
#include <inttypes.h>
#endif
#define STA_TX_EN ((uint32_t)1 << 0) /* reserved for XON/XOFF flow control */
#define RW_BUDGET 64
#define RX_COUNT_THRESHOLD ... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/src/tty.c | C | apache-2.0 | 29,268 |
/*
* Copyright (C) 2020-2021 Alibaba Group Holding Limited
*/
#include <aos/tty_csi.h>
#define RX_BUF_SIZE 256
#define TX_BUF_SIZE 256
#define RX_TASK_STACK_SIZE 4096
#define TX_TASK_STACK_SIZE 4096
#define RX_TASK_PRIO 30
#define TX_TASK_PRIO 30
#define EVENT... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/src/tty_csi.c | C | apache-2.0 | 9,649 |
/*
* Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#include <poll.h>
#include <aos/hal/uart.h>
#include <vfsdev/uart_dev.h>
#include <devicevfs/devicevfs.h>
#ifdef CONFIG_UART_NUM
#define PLATFORM_UART_NUM CONFIG_UART_NUM
#else
#define PLATFORM_UART_NUM 4
#endif
#define SYS_LOG_UART_PORT 0
#if (PLATFOR... | YifuLiu/AliOS-Things | components/drivers/peripheral/uart/src/uart_dev.c | C | apache-2.0 | 16,896 |
#include <stdint.h>
#include <stdio.h>
#include <aos/errno.h>
#if AOS_COMP_CLI
#include "aos/cli.h"
#endif
#include <vfsdev/wdg_dev.h>
#include <aos/driver/wdg.h>
int vfs_wdg_test(int count, int period)
{
int ret = 0;
int fd = 0;
fd = open("/dev/wdg0", 0);
printf("open wdg %s, fd:%d\r\n", fd >= 0 ? "s... | YifuLiu/AliOS-Things | components/drivers/peripheral/watchdog/example/wdg_example.c | C | apache-2.0 | 3,166 |
/**
* @file wdg.h
* @copyright Copyright (C) 2015-2021 Alibaba Group Holding Limited
*/
#ifndef _AOS_WDG_H
#define _AOS_WDG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <aos/kernel.h>
/** @addtogroup aos_wdg_device I2C
* aos watchdog API.
*
* @{
*/
typedef uint32_t* wdg_dev_handle_t;
/**
* start a ... | YifuLiu/AliOS-Things | components/drivers/peripheral/watchdog/include/aos/driver/wdg.h | C | apache-2.0 | 2,328 |