add camera driver and examples for edu-riscv64
This commit is contained in:
@@ -54,6 +54,7 @@ enum BusType_e
|
||||
TYPE_SERIAL_BUS,
|
||||
TYPE_ADC_BUS,
|
||||
TYPE_DAC_BUS,
|
||||
TYPE_CAMERA_BUS,
|
||||
TYPE_BUS_END,
|
||||
};
|
||||
|
||||
@@ -80,6 +81,7 @@ enum DevType
|
||||
TYPE_SERIAL_DEV,
|
||||
TYPE_ADC_DEV,
|
||||
TYPE_DAC_DEV,
|
||||
TYPE_CAMERA_DEV,
|
||||
TYPE_DEV_END,
|
||||
};
|
||||
|
||||
@@ -106,6 +108,7 @@ enum DriverType_e
|
||||
TYPE_SERIAL_DRV,
|
||||
TYPE_ADC_DRV,
|
||||
TYPE_DAC_DRV,
|
||||
TYPE_CAMERA_DRV,
|
||||
TYPE_DRV_END,
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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_camera.h
|
||||
* @brief define camera bus and drv function using bus driver framework
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-11-16
|
||||
*/
|
||||
|
||||
#ifndef BUS_CAMERA_H
|
||||
#define BUS_CAMERA_H
|
||||
|
||||
#include <bus.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
struct CameraDriver
|
||||
{
|
||||
struct Driver driver;
|
||||
|
||||
uint32 (*configure) (void *drv, struct BusConfigureInfo *configure_info);
|
||||
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
struct CameraBus
|
||||
{
|
||||
struct Bus bus;
|
||||
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
/*Register the CAMERA bus*/
|
||||
int CameraBusInit(struct CameraBus *camera_bus, const char *bus_name);
|
||||
|
||||
/*Register the CAMERA driver*/
|
||||
int CameraDriverInit(struct CameraDriver *camera_driver, const char *driver_name);
|
||||
|
||||
/*Release the CAMERA device*/
|
||||
int CameraReleaseBus(struct CameraBus *camera_bus);
|
||||
|
||||
/*Register the CAMERA driver to the CAMERA bus*/
|
||||
int CameraDriverAttachToBus(const char *drv_name, const char *bus_name);
|
||||
|
||||
/*Register the driver, manage with the double linklist*/
|
||||
int CameraDriverRegister(struct Driver *driver);
|
||||
|
||||
/*Find the register driver*/
|
||||
DriverType CameraDriverFind(const char *drv_name, enum DriverType_e drv_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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_camera.h
|
||||
* @brief define camera dev function using bus driver framework
|
||||
* @version 1.0
|
||||
* @author AIIT XUOS Lab
|
||||
* @date 2021-04-24
|
||||
*/
|
||||
|
||||
#ifndef DEV_CAMERA_H
|
||||
#define DEV_CAMERA_H
|
||||
|
||||
#include <bus.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
struct CameraDataStandard
|
||||
{
|
||||
uint16 addr;
|
||||
uint16 flags;
|
||||
uint16 len;
|
||||
uint16 retries;
|
||||
uint8 *buf;
|
||||
|
||||
struct CameraDataStandard *next;
|
||||
};
|
||||
|
||||
struct CameraDevDone
|
||||
{
|
||||
uint32 (*dev_open) (void *camera_device);
|
||||
uint32 (*dev_close) (void *camera_device);
|
||||
uint32 (*dev_write) (void *camera_device, struct BusBlockWriteParam *msg);
|
||||
uint32 (*dev_read) (void *camera_device, struct BusBlockReadParam *msg);
|
||||
};
|
||||
|
||||
struct CameraHardwareDevice
|
||||
{
|
||||
struct HardwareDev haldev;
|
||||
const struct CameraDevDone *camera_dev_done;
|
||||
};
|
||||
|
||||
/*Register the CAMERA device*/
|
||||
int CameraDeviceRegister(struct CameraHardwareDevice *camera_device, void *camera_param, const char *device_name);
|
||||
|
||||
/*Register the CAMERA device to the CAMERA bus*/
|
||||
int CameraDeviceAttachToBus(const char *dev_name, const char *bus_name);
|
||||
|
||||
/*Find the register CAMERA device*/
|
||||
HardwareDevType CameraDeviceFind(const char *dev_name, enum DevType dev_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -104,4 +104,9 @@ HardwareDevType ObtainConsole(void);
|
||||
#include <dev_dac.h>
|
||||
#endif
|
||||
|
||||
#ifdef RESOURCES_CAMERA
|
||||
#include <bus_camera.h>
|
||||
#include <dev_camera.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user