sync upstream

This commit is contained in:
Wang_Weigen
2022-01-18 14:55:00 +08:00
85 changed files with 10364 additions and 1099 deletions
+6
View File
@@ -52,6 +52,8 @@ enum BusType_e
TYPE_PIN_BUS,
TYPE_RTC_BUS,
TYPE_SERIAL_BUS,
TYPE_ADC_BUS,
TYPE_DAC_BUS,
TYPE_BUS_END,
};
@@ -76,6 +78,8 @@ enum DevType
TYPE_PIN_DEV,
TYPE_RTC_DEV,
TYPE_SERIAL_DEV,
TYPE_ADC_DEV,
TYPE_DAC_DEV,
TYPE_DEV_END,
};
@@ -100,6 +104,8 @@ enum DriverType_e
TYPE_PIN_DRV,
TYPE_RTC_DRV,
TYPE_SERIAL_DRV,
TYPE_ADC_DRV,
TYPE_DAC_DRV,
TYPE_DRV_END,
};
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file bus_adc.h
* @brief define adc bus and drv function using bus driver framework
* @version 1.1
* @author AIIT XUOS Lab
* @date 2021-12-28
*/
#ifndef BUS_ADC_H
#define BUS_ADC_H
#include <bus.h>
#ifdef __cplusplus
extern "C" {
#endif
struct AdcDriver
{
struct Driver driver;
uint32 (*configure) (void *drv, struct BusConfigureInfo *configure_info);
void *private_data;
};
struct AdcBus
{
struct Bus bus;
void *private_data;
};
/*Register the ADC bus*/
int AdcBusInit(struct AdcBus *adc_bus, const char *bus_name);
/*Register the ADC driver*/
int AdcDriverInit(struct AdcDriver *adc_driver, const char *driver_name);
/*Release the ADC device*/
int AdcReleaseBus(struct AdcBus *adc_bus);
/*Register the ADC driver to the ADC bus*/
int AdcDriverAttachToBus(const char *drv_name, const char *bus_name);
/*Register the driver, manage with the double linklist*/
int AdcDriverRegister(struct Driver *driver);
/*Find the register driver*/
DriverType AdcDriverFind(const char *drv_name, enum DriverType_e drv_type);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file bus_dac.h
* @brief define dac bus and drv function using bus driver framework
* @version 2.0
* @author AIIT XUOS Lab
* @date 2022-1-11
*/
#ifndef BUS_DAC_H
#define BUS_DAC_H
#include <bus.h>
#ifdef __cplusplus
extern "C" {
#endif
struct DacDriver
{
struct Driver driver;
uint32 (*configure) (void *drv, struct BusConfigureInfo *configure_info);
void *private_data;
};
struct DacBus
{
struct Bus bus;
void *private_data;
};
/*Register the DAC bus*/
int DacBusInit(struct DacBus *dac_bus, const char *bus_name);
/*Register the DAC driver*/
int DacDriverInit(struct DacDriver *dac_driver, const char *driver_name);
/*Release the DAC device*/
int DacReleaseBus(struct DacBus *dac_bus);
/*Register the DAC driver to the DAC bus*/
int DacDriverAttachToBus(const char *drv_name, const char *bus_name);
/*Register the driver, manage with the double linklist*/
int DacDriverRegister(struct Driver *driver);
/*Find the register driver*/
DriverType DacDriverFind(const char *drv_name, enum DriverType_e drv_type);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file dev_adc.h
* @brief define adc dev function using bus driver framework
* @version 1.1
* @author AIIT XUOS Lab
* @date 2021-12-28
*/
#ifndef DEV_ADC_H
#define DEV_ADC_H
#include <bus.h>
#ifdef __cplusplus
extern "C" {
#endif
struct AdcHardwareDevice;
struct AdcDevDone
{
uint32 (*open) (void *dev);
uint32 (*close) (void *dev);
uint32 (*write) (void *dev,struct BusBlockWriteParam *write_param);
uint32 (*read) (void *dev, struct BusBlockReadParam *read_param);
};
struct AdcHardwareDevice
{
struct HardwareDev haldev;
const struct AdcDevDone *adc_dev_done;
void *private_data;
};
/*Register the ADC device*/
int AdcDeviceRegister(struct AdcHardwareDevice *adc_device, void *adc_param, const char *device_name);
/*Register the ADC device to the ADC bus*/
int AdcDeviceAttachToBus(const char *dev_name, const char *bus_name);
/*Find the register ADC device*/
HardwareDevType AdcDeviceFind(const char *dev_name, enum DevType dev_type);
#ifdef __cplusplus
}
#endif
#endif
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2020 AIIT XUOS Lab
* XiUOS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
/**
* @file dev_dac.h
* @brief define dac dev function using bus driver framework
* @version 2.0
* @author AIIT XUOS Lab
* @date 2022-1-11
*/
#ifndef DEV_DAC_H
#define DEV_DAC_H
#include <bus.h>
#ifdef __cplusplus
extern "C" {
#endif
struct DacHardwareDevice;
struct DacDevDone
{
uint32 (*open) (void *dev);
uint32 (*close) (void *dev);
uint32 (*write) (void *dev,struct BusBlockWriteParam *write_param);
uint32 (*read) (void *dev, struct BusBlockReadParam *read_param);
};
struct DacHardwareDevice
{
struct HardwareDev haldev;
const struct DacDevDone *dac_dev_done;
void *private_data;
};
/*Register the DAC device*/
int DacDeviceRegister(struct DacHardwareDevice *dac_device, void *dac_param, const char *device_name);
/*Register the DAC device to the DAC bus*/
int DacDeviceAttachToBus(const char *dev_name, const char *bus_name);
/*Find the register DAC device*/
HardwareDevType DacDeviceFind(const char *dev_name, enum DevType dev_type);
#ifdef __cplusplus
}
#endif
#endif
@@ -94,4 +94,14 @@ HardwareDevType ObtainConsole(void);
#include <dev_hwtimer.h>
#endif
#ifdef RESOURCES_ADC
#include <bus_adc.h>
#include <dev_adc.h>
#endif
#ifdef RESOURCES_DAC
#include <bus_dac.h>
#include <dev_dac.h>
#endif
#endif