69 lines
1.8 KiB
C
69 lines
1.8 KiB
C
/*
|
|
* Copyright (c) 2022, sakumisu
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#ifndef CHERRYUSB_CONFIG_H
|
|
#define CHERRYUSB_CONFIG_H
|
|
|
|
#define CHERRYUSB_VERSION 0x010200
|
|
#define CHERRYUSB_VERSION_STR "v1.2.0"
|
|
|
|
/* ================ USB common Configuration ================ */
|
|
|
|
#define CONFIG_USB_PRINTF(...) printf(__VA_ARGS__)
|
|
|
|
#define usb_malloc(size) malloc(size)
|
|
#define usb_free(ptr) free(ptr)
|
|
|
|
#ifndef CONFIG_USB_DBG_LEVEL
|
|
#define CONFIG_USB_DBG_LEVEL USB_DBG_INFO
|
|
#endif
|
|
|
|
/* Enable print with color */
|
|
#define CONFIG_USB_PRINTF_COLOR_ENABLE
|
|
|
|
/* data align size when use dma */
|
|
#ifndef CONFIG_USB_ALIGN_SIZE
|
|
#define CONFIG_USB_ALIGN_SIZE 4
|
|
#endif
|
|
|
|
/* attribute data into no cache ram */
|
|
#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable")))
|
|
|
|
/* ================= USB Device Stack Configuration ================ */
|
|
|
|
/* Ep0 in and out transfer buffer */
|
|
#ifndef CONFIG_USBDEV_REQUEST_BUFFER_LEN
|
|
#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256
|
|
#endif
|
|
|
|
/* Setup packet log for debug */
|
|
// #define CONFIG_USBDEV_SETUP_LOG_PRINT
|
|
|
|
/* Send ep0 in data from user buffer instead of copying into ep0 reqdata
|
|
* Please note that user buffer must be aligned with CONFIG_USB_ALIGN_SIZE
|
|
*/
|
|
// #define CONFIG_USBDEV_EP0_INDATA_NO_COPY
|
|
|
|
/* Check if the input descriptor is correct */
|
|
// #define CONFIG_USBDEV_DESC_CHECK
|
|
|
|
/* Enable test mode */
|
|
// #define CONFIG_USBDEV_TEST_MODE
|
|
|
|
/* ================ USB Device Port Configuration ================*/
|
|
|
|
#ifndef CONFIG_USBDEV_MAX_BUS
|
|
#define CONFIG_USBDEV_MAX_BUS 1 // for now, bus num must be 1 except hpm ip
|
|
#endif
|
|
|
|
#ifndef CONFIG_USBDEV_EP_NUM
|
|
#define CONFIG_USBDEV_EP_NUM 8
|
|
#endif
|
|
|
|
/* ---------------- FSDEV Configuration ---------------- */
|
|
#define CONFIG_USBDEV_FSDEV_PMA_ACCESS 1 // maybe 1 or 2, many chips may have a difference
|
|
|
|
#endif
|