From 3acfca1e34f2bda98ff04089537ff4ec94e63612 Mon Sep 17 00:00:00 2001 From: xj Date: Thu, 13 Jun 2024 00:08:58 -0700 Subject: [PATCH] Add comments --- .../drivers/usb/components/mem/usb_mem.c | 10 ++++++++++ .../drivers/usb/components/mem/usb_mem.h | 16 ++++++++++++++++ .../drivers/usb/components/osal/usb_osal.c | 8 ++++++++ 3 files changed, 34 insertions(+) diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/mem/usb_mem.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/mem/usb_mem.c index 555fe685f..54e47f614 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/mem/usb_mem.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/mem/usb_mem.c @@ -1,6 +1,16 @@ #include #include "usb_mem.h" +/************************************************* +File name: usb_mem.c +Description: support usb memory management +Others: take CherryUSB v0.1.2/CherryUSB/port/xhci/usb_hc_xhci.c for references + https://github.com/cherry-embedded/CherryUSB/blob/v0.10.2/port/xhci/usb_hc_xhci.c +History: +1. Date: 2024-06-12 +Author: AIIT XUOS Lab +Modification: re-develop usb_hc_malloc, usb_hc_malloc_align and usb_hc_free functions +*************************************************/ void *usb_hc_malloc(size_t size){ diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/mem/usb_mem.h b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/mem/usb_mem.h index 95e7c12ec..b47417473 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/mem/usb_mem.h +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/mem/usb_mem.h @@ -2,7 +2,23 @@ * Copyright (c) 2022, sakumisu * * SPDX-License-Identifier: Apache-2.0 + * + * */ + + +/************************************************* +File name: usb_mem.h +Description: support usb memory management +Others: take CherryUSB v0.10.2/CherryUSB/cherryusb_config_template.h for references + https://github.com/cherry-embedded/CherryUSB/blob/v0.10.2/cherryusb_config_template.h +History: +1. Date: 2024-06-12 +Author: AIIT XUOS Lab +Modification: Use usb_malloc, usb_free and usb_align functions +*************************************************/ + + #ifndef USB_MEM_H_ #define USB_MEM_H_ diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/osal/usb_osal.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/osal/usb_osal.c index e19c77368..caa94e5ef 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/osal/usb_osal.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/osal/usb_osal.c @@ -6,6 +6,7 @@ #include "usb_osal.h" #include "libserial.h" +#include "syscall.h" #include "usyscall.h" @@ -17,6 +18,13 @@ usb_osal_thread_t usb_osal_thread_create(const char *name, uint32_t stack_size, return (usb_osal_thread_t)ret; } +void usb_osal_thread_delete(usb_osal_thread_t thread){ + int thread_id; + thread_id = (int)thread; + + kill(thread_id); +} + usb_osal_sem_t usb_osal_sem_create(uint32_t initial_count){