diff --git a/components/drivers/include/drivers/mtd.h b/components/drivers/include/drivers/mtd.h new file mode 100644 index 0000000000..7fcb28c3a2 --- /dev/null +++ b/components/drivers/include/drivers/mtd.h @@ -0,0 +1,18 @@ +#ifndef __MTD_H__ +#define __MTD_H__ + +struct rt_mtd_device +{ + const struct rt_mtd_driver_ops* ops; +}; + +struct rt_mtd_driver_ops +{ + rt_uint32_t (*read_id) (rt_mtd_device* device); + rt_err_t (*read_page) (rt_mtd_device* device, rt_uint32_t page, rt_uint8_t *data, rt_uint8_t *spare); + rt_err_t (*write_page) (rt_mtd_device* device, rt_uint32_t page, rt_uint8_t *data, rt_uint8_t *spare); + + rt_err_t (*erase_block)(rt_mtd_device* device, rt_uint32_t block); +}; + +#endif diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h new file mode 100644 index 0000000000..41ce642556 --- /dev/null +++ b/components/drivers/include/rtdevice.h @@ -0,0 +1,22 @@ +#ifndef __RT_DEVICE_H__ +#define __RT_DEVICE_H__ + +#include + +#ifdef RT_USING_SPI +#include "drivers/spi.h" +#endif + +#ifdef RT_USING_MTD +#include "drivers/mtd.h" +#endif + +#ifdef RT_USING_USB_DEVICE +#include "drivers/usb_device.h" +#endif + +#ifdef RT_USING_USB_HOST +#include "drivers/usb_host.h" +#endif + +#endif diff --git a/components/drivers/mtd/SConscript b/components/drivers/mtd/SConscript new file mode 100644 index 0000000000..6671d42b8f --- /dev/null +++ b/components/drivers/mtd/SConscript @@ -0,0 +1,8 @@ +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd + '/../include'] +group = DefineGroup('Drivers', src, depend = ['RT_USING_MTD'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/drivers/spi/SConscript b/components/drivers/spi/SConscript new file mode 100644 index 0000000000..930ebbee84 --- /dev/null +++ b/components/drivers/spi/SConscript @@ -0,0 +1,8 @@ +from building import * + +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd + '/../include'] +group = DefineGroup('Drivers', src, depend = ['RT_USING_SPI'], CPPPATH = CPPPATH) + +Return('group') diff --git a/components/drivers/usb/SConscript b/components/drivers/usb/SConscript index 5a6486ef44..ecc8102c05 100644 --- a/components/drivers/usb/SConscript +++ b/components/drivers/usb/SConscript @@ -4,6 +4,6 @@ from building import * cwd = GetCurrentDir() src = Glob('*.c') CPPPATH = [cwd] -group = DefineGroup('USB', src, depend = ['RT_USING_USB_DEVICE'], CPPPATH = CPPPATH) +group = DefineGroup('Drivers', src, depend = ['RT_USING_USB_DEVICE'], CPPPATH = CPPPATH) Return('group')