[bsp][k230]:add gnne driver

Requirement: The BSP for the k230 platform in the RT-Thread repository does not yet have a gnne driver.
Solution: Provide gnne driver for the k230 platform in the RT-Thread repository.
- Implements mutex lock mechanism for AI2D and GNNE modules.
- Adds HARDLOCK_AI2D support in hardlock driver for mutual exclusion.
- Implements poll operation for device status monitoring.
- Updates documentation in bsp/README.md.
Signed-off-by: ChuanN-sudo <fjchuanil@gmail.com>
This commit is contained in:
Chuan
2025-12-26 21:02:37 +08:00
committed by R b b666
parent 916b212855
commit 239f371fcb
9 changed files with 545 additions and 3 deletions
+3 -3
View File
@@ -761,9 +761,9 @@ This document is based on the RT-Thread mainline repository and categorizes the
#### 🟢 K230 (RT-Smart)
| BSP Name | GPIO | UART | I2C | RTC | ADC | PWM | SDIO | HWTimer | WDT | SPI |
|----------|------|------|-----|-----|-----|-----|------|---------|-----|-----|
| [k230](k230) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| BSP Name | GPIO | UART | I2C | RTC | ADC | PWM | SDIO | HWTimer | WDT | SPI | GNNE |
|----------|------|------|-----|-----|-----|-----|------|---------|-----|-----|------|
| [k230](k230) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
#### 🟢 Xuantie (RT-Smart)
@@ -1,6 +1,10 @@
scons.args: &scons
scons_arg:
- '--strict'
devices.gnee:
<<: *scons
kconfig:
- CONFIG_BSP_USING_GNNE=y
devices.spi:
<<: *scons
kconfig:
+1
View File
@@ -1617,6 +1617,7 @@ CONFIG_PKG_ZLIB_VER="latest"
#
# Drivers Configuration
#
# CONFIG_BSP_USING_GNNE is not set
# CONFIG_BSP_USING_SPI is not set
# CONFIG_BSP_USING_I2C is not set
# CONFIG_BSP_USING_RTC is not set
+4
View File
@@ -1,4 +1,8 @@
menu "Drivers Configuration"
config BSP_USING_GNNE
bool "Enable KPU and AI2D"
default n
menuconfig BSP_USING_SPI
bool "Enable SPI"
+19
View File
@@ -0,0 +1,19 @@
# RT-Thread building script for gnne component
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('Gnne', src, depend = ['BSP_USING_GNNE'], CPPPATH = CPPPATH)
objs = [group]
list = os.listdir(cwd)
for item in list:
if os.path.isfile(os.path.join(cwd, item, 'SConscript')):
objs = objs + SConscript(os.path.join(item, 'SConscript'))
Return('objs')
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,49 @@
/* Copyright (c) 2023, Canaan Bright Sight Co., Ltd
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* NOTE: Currently untested - nncase cannot run due to missing mmz library.
* The mmz library depends on MPP driver, which relies on deprecated RT-Thread
* kernel APIs (rt_proc_entry_create, rt_dma_chan_request, etc.) that are no
* longer available in the mainline kernel. Awaiting resolution.
*/
/*
* Copyright (c) 2006-2025 RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <rtthread.h>
extern int gnne_device_init(void);
extern int ai_2d_device_init(void);
int ai_module_init(void)
{
gnne_device_init();
ai_2d_device_init();
}
INIT_COMPONENT_EXPORT(ai_module_init);
File diff suppressed because it is too large Load Diff
@@ -39,6 +39,7 @@ typedef enum k230_hardlock_type
HARDLOCK_AES = 7,
HARDLOCK_SM4 = 8,
HARDLOCK_PDMA = 9,
HARDLOCK_AI2D = 10,
HARDLOCK_MAX = 128
} hardlock_type;