2021-12-04 14:41:09 +08:00
|
|
|
from building import *
|
|
|
|
|
|
|
|
|
|
cwd = GetCurrentDir()
|
2022-05-21 21:33:58 +08:00
|
|
|
path = [cwd + '/common']
|
2021-12-04 14:41:09 +08:00
|
|
|
path += [cwd + '/core']
|
2022-10-06 22:55:47 +08:00
|
|
|
path += [cwd + '/class/cdc']
|
|
|
|
|
path += [cwd + '/class/msc']
|
|
|
|
|
path += [cwd + '/class/hid']
|
|
|
|
|
path += [cwd + '/class/audio']
|
|
|
|
|
path += [cwd + '/class/video']
|
|
|
|
|
path += [cwd + '/class/wireless']
|
|
|
|
|
path += [cwd + '/class/dfu']
|
2022-03-20 09:15:10 +08:00
|
|
|
src = []
|
2022-02-07 21:24:53 +08:00
|
|
|
|
2022-06-15 22:06:39 +08:00
|
|
|
CPPDEFINES = []
|
|
|
|
|
|
2021-12-04 14:41:09 +08:00
|
|
|
# USB DEVICE
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE']):
|
2023-11-15 15:18:51 +08:00
|
|
|
path += [cwd + '/osal']
|
2022-03-20 09:15:10 +08:00
|
|
|
src += Glob('core/usbd_core.c')
|
2023-11-15 15:18:51 +08:00
|
|
|
src += Glob('osal/usb_osal_rtthread.c')
|
2022-06-14 22:05:48 +08:00
|
|
|
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_HS']):
|
|
|
|
|
CPPDEFINES+=['CONFIG_USB_HS']
|
|
|
|
|
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_CDC']):
|
2021-12-04 14:41:09 +08:00
|
|
|
src += Glob('class/cdc/usbd_cdc.c')
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_HID']):
|
|
|
|
|
src += Glob('class/hid/usbd_hid.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_MSC']):
|
|
|
|
|
src += Glob('class/msc/usbd_msc.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_AUDIO']):
|
|
|
|
|
src += Glob('class/audio/usbd_audio.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_VIDEO']):
|
|
|
|
|
src += Glob('class/video/usbd_video.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_RNDIS']):
|
|
|
|
|
src += Glob('class/wireless/usbd_rndis.c')
|
2022-02-07 21:24:53 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_USING_DFU']):
|
2022-04-15 21:37:56 +08:00
|
|
|
src += Glob('class/dfu/usbd_dfu.c')
|
2022-04-15 21:38:58 +08:00
|
|
|
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_CDC_TEMPLATE']):
|
2022-03-20 09:15:10 +08:00
|
|
|
src += Glob('demo/cdc_acm_template.c')
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_HID_MOUSE_TEMPLATE']):
|
|
|
|
|
src += Glob('demo/hid_mouse_template.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_HID_KEYBOARD_TEMPLATE']):
|
|
|
|
|
src += Glob('demo/hid_keyboard_template.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_MSC_TEMPLATE']):
|
|
|
|
|
src += Glob('demo/msc_ram_template.c')
|
2023-11-15 15:18:51 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_MSC_STORAGE_TEMPLATE']):
|
|
|
|
|
src += Glob('demo/msc_storage_template.c')
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_AUDIO_V1_TEMPLATE']):
|
2022-06-14 22:05:48 +08:00
|
|
|
src += Glob('demo/audio_v1_mic_speaker_multichan_template.c')
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_AUDIO_V2_TEMPLATE']):
|
|
|
|
|
src += Glob('demo/audio_v2_mic_speaker_multichan_template.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_VIDEO_TEMPLATE']):
|
2022-06-04 22:11:29 +08:00
|
|
|
src += Glob('demo/video_static_mjpeg_template.c')
|
2022-10-06 22:55:47 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_RNDIS_TEMPLATE']):
|
|
|
|
|
src += Glob('demo/cdc_rndis_template.c')
|
2022-04-15 21:38:58 +08:00
|
|
|
|
2022-06-14 22:05:48 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_FSDEV']):
|
2022-04-15 21:37:56 +08:00
|
|
|
src += Glob('port/fsdev/usb_dc_fsdev.c')
|
2022-07-08 22:52:14 +08:00
|
|
|
|
2022-06-14 22:05:48 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_DWC2']):
|
2022-06-20 12:31:16 +08:00
|
|
|
src += Glob('port/dwc2/usb_dc_dwc2.c')
|
2022-06-14 22:05:48 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_DWC2_PORT_FS']):
|
|
|
|
|
CPPDEFINES += ['CONFIG_USB_DWC2_PORT=FS_PORT']
|
|
|
|
|
elif GetDepend(['PKG_CHERRYUSB_DEVICE_DWC2_PORT_HS']):
|
|
|
|
|
CPPDEFINES += ['CONFIG_USB_DWC2_PORT=HS_PORT']
|
2022-12-04 16:39:53 +08:00
|
|
|
if GetDepend(['SOC_SERIES_STM32F7']):
|
|
|
|
|
CPPDEFINES += ['STM32F7']
|
|
|
|
|
elif GetDepend(['SOC_SERIES_STM32H7']):
|
|
|
|
|
CPPDEFINES += ['STM32H7']
|
2022-07-08 22:52:14 +08:00
|
|
|
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_MUSB']):
|
|
|
|
|
src += Glob('port/musb/usb_dc_musb.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_MUSB_SUNXI']):
|
2022-04-15 21:38:58 +08:00
|
|
|
CPPDEFINES += ['CONFIG_USB_MUSB_SUNXI']
|
2021-12-04 14:41:09 +08:00
|
|
|
|
2022-10-16 15:57:29 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_HPM']):
|
|
|
|
|
src += Glob('port/hpm/usb_dc_hpm.c')
|
|
|
|
|
|
2022-07-08 22:52:14 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_CH32_CH32V307']):
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_HS']):
|
|
|
|
|
src += Glob('port/ch32/usb_dc_usbhs.c')
|
|
|
|
|
else:
|
|
|
|
|
src += Glob('port/ch32/usb_dc_usbfs.c')
|
|
|
|
|
|
2023-11-15 15:18:51 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_DEVICE_PUSB2']):
|
|
|
|
|
path += [cwd + '/port/pusb2/common']
|
|
|
|
|
path += [cwd + '/port/pusb2/fpusb2']
|
|
|
|
|
src += Glob('port/pusb2/fpusb2' + '/*.c')
|
|
|
|
|
src += Glob('port/pusb2/usb_dc_pusb2.c')
|
|
|
|
|
|
2022-02-07 21:24:53 +08:00
|
|
|
# USB HOST
|
2022-04-23 16:20:50 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST']):
|
2022-02-07 21:24:53 +08:00
|
|
|
path += [cwd + '/osal']
|
2022-04-23 16:20:50 +08:00
|
|
|
path += [cwd + '/class/hub']
|
|
|
|
|
src += Glob('core/usbh_core.c')
|
2022-09-09 19:24:41 +08:00
|
|
|
src += Glob('class/hub/usbh_hub.c')
|
2022-02-07 21:24:53 +08:00
|
|
|
src += Glob('osal/usb_osal_rtthread.c')
|
2022-05-22 18:27:21 +08:00
|
|
|
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_CDC']):
|
|
|
|
|
src += Glob('class/cdc/usbh_cdc_acm.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_HID']):
|
|
|
|
|
src += Glob('class/hid/usbh_hid.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_MSC']):
|
|
|
|
|
src += Glob('class/msc/usbh_msc.c')
|
2022-05-22 18:27:21 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_RNDIS']):
|
|
|
|
|
src += Glob('class/wireless/usbh_rndis.c')
|
2023-11-17 23:37:15 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_CDC_ECM']):
|
|
|
|
|
src += Glob('class/cdc/usbh_cdc_ecm.c')
|
2022-05-22 18:27:21 +08:00
|
|
|
|
2022-06-14 22:05:48 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_DWC2']):
|
2022-06-20 12:31:16 +08:00
|
|
|
src += Glob('port/dwc2/usb_hc_dwc2.c')
|
2022-07-08 22:52:14 +08:00
|
|
|
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_MUSB']):
|
2022-03-20 09:15:10 +08:00
|
|
|
src += Glob('port/musb/usb_hc_musb.c')
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_MUSB_SUNXI']):
|
2022-04-15 21:38:58 +08:00
|
|
|
CPPDEFINES += ['CONFIG_USB_MUSB_SUNXI']
|
2022-04-15 21:37:56 +08:00
|
|
|
|
2022-10-16 15:57:29 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_EHCI']):
|
|
|
|
|
src += Glob('port/ehci/usb_hc_ehci.c')
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_EHCI_HPM']):
|
|
|
|
|
src += Glob('port/ehci/usb_glue_hpm.c')
|
|
|
|
|
|
2023-11-15 15:18:51 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_XHCI']):
|
|
|
|
|
src += Glob('port/xhci/usb_hc_xhci.c')
|
|
|
|
|
src += Glob('port/xhci/xhci_dbg.c')
|
|
|
|
|
src += Glob('port/xhci/xhci.c')
|
|
|
|
|
|
|
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_PUSB2']):
|
|
|
|
|
path += [cwd + '/port/pusb2/common']
|
|
|
|
|
path += [cwd + '/port/pusb2/fpusb2']
|
|
|
|
|
src += Glob('port/pusb2/fpusb2' + '/*.c')
|
|
|
|
|
src += Glob('port/pusb2/usb_hc_pusb2.c')
|
|
|
|
|
|
2022-04-15 21:37:56 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_TEMPLATE']):
|
2022-03-20 09:15:10 +08:00
|
|
|
src += Glob('demo/usb_host.c')
|
2022-02-07 21:24:53 +08:00
|
|
|
|
2023-07-06 22:47:08 +08:00
|
|
|
if GetDepend(['PKG_CHERRYUSB_HOST_CP210X']):
|
|
|
|
|
path += [cwd + '/class/vendor/cp201x']
|
|
|
|
|
src += Glob('class/vendor/cp201x/usbh_cp210x.c')
|
|
|
|
|
src += Glob('third_party/rt-thread-4.1.1/dfs/drv_usbh_cp210x_rtt.c')
|
|
|
|
|
|
2023-09-07 12:43:30 +08:00
|
|
|
src += Glob('third_party/rt-thread-4.1.1/msh_cmd.c')
|
|
|
|
|
|
2022-02-07 21:24:53 +08:00
|
|
|
group = DefineGroup('CherryUSB', src, depend = ['PKG_USING_CHERRYUSB'], CPPPATH = path, CPPDEFINES = CPPDEFINES)
|
2021-12-04 14:41:09 +08:00
|
|
|
|
|
|
|
|
Return('group')
|
|
|
|
|
|