This commit is contained in:
刘可亮 2025-08-14 15:13:29 +08:00
parent a88a7ec3f9
commit b3676b7ab2
269 changed files with 15271 additions and 1521 deletions

View File

@ -1,3 +1,48 @@
# V1.3.0 #
## 新增 ##
- USB
- 支持MTP功能
- 支持指定EP地址
- MPP支持AAC raw data的解码
- Display支持AiPQ工具的接口自动识别功能
- PBP支持预定义IO的状态
- SPI支持用户态动态调整SPI的clock频率
- LVGL
- 新增控件lyrics_effect歌词特效、aic_canvas、aic_player
- 增加aishoot_demo
- RTP支持作为普通ADC使用
- WiFiaic8800增加monitor功能
- 增加歌词特效的功能,支持以视频播放作为背景
- 新增方案双系统双显、aishoot
- 新增示例test_battery、http-wificonfig
- 新增器件:
- NANDPY25Q128HA、XCSP1AAPK-IT
- 屏幕nv3051、gh8555bc
## 优化 ##
- LVGL V9
- 优化软件绘图的stride处理
- 优化FreeType的多线程访问
- MPP优化视频播放的文件切换流程
- SPL
- 使用硬件Gzip解压Kernel
- 优化Boot logo的兼容处理
- Boot优化SPI的delay参数配置流程
- Display优化Vsync的处理流程
- SPI完善工作模式的容错处理
- NAND
- 优化OOB layout的处理流程
- 优化ECC的获取接口
- 完善Boot中的BBT处理流程
- winbond兼容3Byte ID的型号
- NOR优化擦写的容错处理
## 修改 ##
- SPLdemo88_nor配置默认打开Falcon模式
# V1.2.9 #
## 新增 ##

View File

@ -1 +1 @@
51249f6af42675458ef777ac49830c844c4266dc
52b44675ba49987bdf12cb3e81239d515b908877

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dl/mtpfs/mtpfs-1.0.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
22f3e30f76abdbaa773d16010976a269ff49b5ec
7150ec57051b1b395bba363863bb0869d7db4b97

View File

@ -12,6 +12,7 @@ source package/artinchip/aicp-dec/Config.in
source package/artinchip/aic-mem/Config.in
source package/artinchip/wifimanager/Config.in
source package/artinchip/p2p_auto/Config.in
source package/artinchip/http-wificonfig/Config.in
menu "Sample code"
source package/artinchip/test-mtop/Config.in
@ -25,6 +26,7 @@ menu "Sample code"
source package/artinchip/test-libmad/Config.in
source package/artinchip/test-clock/Config.in
source package/artinchip/test-keyadc/Config.in
source package/artinchip/test-battery/Config.in
source package/artinchip/reg-dump/Config.in
source package/artinchip/test-gpio/Config.in
source package/artinchip/test-can/Config.in

View File

@ -0,0 +1,4 @@
config BR2_PACKAGE_HTTP_WIFICONFIG
bool "Enable artinchip http-wificonfig"
default n

View File

@ -0,0 +1,9 @@
HTTP_WIFICONFIG_VERSION =
HTTP_WIFICONFIG_ENABLE_TARBALL = NO
HTTP_WIFICONFIG_ENABLE_PATCH = NO
HTTP_WIFICONFIG_INSTALL_STAGING = YES
HTTP_WIFICONFIG_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
HTTP_WIFICONFIG_DEPENDENCIES += wifimanager
$(eval $(cmake-package))

View File

@ -84,6 +84,8 @@ else
LVGL_UI_CONF_OPTS += -DUSE_FREETYPE=no
endif
LVGL_UI_CONF_OPTS += -DBUILD_DIR=$(BUILD_DIR)
ifeq ($(BR2_PACKAGE_AIC_MEM),y)
LVGL_UI_DEPENDENCIES += aic-mem
LVGL_UI_CONF_OPTS += -DUSE_AIC_MEM=yes

View File

@ -0,0 +1,9 @@
menuconfig BR2_PACKAGE_TEST_BATTERY
bool "test-battery"
default n
if BR2_PACKAGE_TEST_BATTERY
config BR2_PACKAGE_TEST_BATTERY_USE_PREBUILT
bool "use prebuilt binary instead of building from source"
default n
endif

View File

@ -0,0 +1,8 @@
TEST_BATTERY_VERSION =
TEST_BATTERY_ENABLE_TARBALL = NO
TEST_BATTERY_ENABLE_PATCH = NO
TEST_BATTERY_DEPENDENCIES += test-common
TEST_BATTERY_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/usr/local
$(eval $(cmake-package))

View File

@ -67,7 +67,95 @@ endif # BR2_TARGET_USERFS1_TYPE_EXT4
if BR2_TARGET_USERFS1_TYPE_UBIFS
if BR2_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS1_UBI_DEVICE_SPI_NAND_2K_128K
bool
config BR2_TARGET_USERFS1_UBI_DEVICE_SPI_NAND_4K_256K
bool
choice
prompt "ubi parameter select"
default BR2_TARGET_USERFS1_UBI_PARAM_ALL_SPI_NAND
config BR2_TARGET_USERFS1_UBI_PARAM_ALL_SPI_NAND
bool "spi-nand all type support"
select BR2_TARGET_USERFS1_UBI_DEVICE_SPI_NAND_2K_128K
select BR2_TARGET_USERFS1_UBI_DEVICE_SPI_NAND_4K_256K
config BR2_TARGET_USERFS1_UBI_PARAM_SPI_NAND_2K_128K
bool "spi-nand page:2k block:128k"
select BR2_TARGET_USERFS1_UBI_DEVICE_SPI_NAND_2K_128K
config BR2_TARGET_USERFS1_UBI_PARAM_SPI_NAND_4K_256K
bool "spi-nand page:4k block:256k"
select BR2_TARGET_USERFS1_UBI_DEVICE_SPI_NAND_4K_256K
config BR2_TARGET_USERFS1_UBI_PARAM_USER_CUSTOM
bool "user custom"
endchoice
config BR2_TARGET_USERFS1_TYPE_UBI
bool "ubi image containing an ubifs userfs1 filesystem"
default y
help
Build an ubi image from the ubifs one (with ubinize).
if BR2_TARGET_USERFS1_TYPE_UBI
if BR2_TARGET_USERFS1_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS1_UBI_PEBSIZE
hex "physical eraseblock size"
default 0x20000
help
Tells ubinize the physical eraseblock (PEB) size of the
flash chip the ubi image is created for. The value provided
here is passed to the -p/--peb-size option of ubinize.
config BR2_TARGET_USERFS1_UBI_SUBSIZE
int "sub-page size"
default 512
help
Tells ubinize that the flash supports sub-pages and the
sub-page size. Use 0 if sub-pages are not supported on flash
chip.
The value provided here is passed to the -s/--sub-page-size
option of ubinize.
endif
config BR2_TARGET_USERFS1_UBI_USE_CUSTOM_CONFIG
bool "Use custom config file"
help
Select this option to use a custom ubinize configuration file,
rather than the default configuration used by Buildroot (which
defines a single dynamic volume marked as auto-resize).
Passing a custom ubinize configuration file allows you to
create several volumes, specify volume types, etc.
As a convenience, buildroot replaces the string
"BR2_USERFS1_UBIFS_PATH" with the path to the built ubifs file.
So the volume defined for the root filesystem can specify the
image path as: image=BR2_USERFS1_UBIFS_PATH
Buildroot also replaces the string "BINARIES_DIR" with the
value of $(BINARIES_DIR), so that it is possible to reference
other build artefacts (e.g. to include the kernel in a UBI
volume).
config BR2_TARGET_USERFS1_UBI_CUSTOM_CONFIG_FILE
string "Configuration file path"
depends on BR2_TARGET_USERFS1_UBI_USE_CUSTOM_CONFIG
help
Path to the ubinize configuration file.
config BR2_TARGET_USERFS1_UBI_OPTS
string "Additional ubinize options"
help
Any additional ubinize options you may want to include.
endif # BR2_TARGET_USERFS1_TYPE_UBI
if BR2_TARGET_USERFS1_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS1_UBIFS_LEBSIZE
hex "logical eraseblock size"
default 0x1f800
@ -90,7 +178,7 @@ config BR2_TARGET_USERFS1_UBIFS_MAXLEBCNT
here is passed to the -c/--max-leb-cnt option of mkfs.ubifs.
endif
if !BR2_UBI_PARAM_USER_CUSTOM
if !BR2_TARGET_USERFS1_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS1_UBIFS_MAX_SIZE
hex "ubifs size(Should be aligned to MB)"
default 0x1000000

View File

@ -67,7 +67,95 @@ endif # BR2_TARGET_USERFS2_TYPE_EXT4
if BR2_TARGET_USERFS2_TYPE_UBIFS
if BR2_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS2_UBI_DEVICE_SPI_NAND_2K_128K
bool
config BR2_TARGET_USERFS2_UBI_DEVICE_SPI_NAND_4K_256K
bool
choice
prompt "ubi parameter select"
default BR2_TARGET_USERFS2_UBI_PARAM_ALL_SPI_NAND
config BR2_TARGET_USERFS2_UBI_PARAM_ALL_SPI_NAND
bool "spi-nand all type support"
select BR2_TARGET_USERFS2_UBI_DEVICE_SPI_NAND_2K_128K
select BR2_TARGET_USERFS2_UBI_DEVICE_SPI_NAND_4K_256K
config BR2_TARGET_USERFS2_UBI_PARAM_SPI_NAND_2K_128K
bool "spi-nand page:2k block:128k"
select BR2_TARGET_USERFS2_UBI_DEVICE_SPI_NAND_2K_128K
config BR2_TARGET_USERFS2_UBI_PARAM_SPI_NAND_4K_256K
bool "spi-nand page:4k block:256k"
select BR2_TARGET_USERFS2_UBI_DEVICE_SPI_NAND_4K_256K
config BR2_TARGET_USERFS2_UBI_PARAM_USER_CUSTOM
bool "user custom"
endchoice
config BR2_TARGET_USERFS2_TYPE_UBI
bool "ubi image containing an ubifs userfs2 filesystem"
default y
help
Build an ubi image from the ubifs one (with ubinize).
if BR2_TARGET_USERFS2_TYPE_UBI
if BR2_TARGET_USERFS2_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS2_UBI_PEBSIZE
hex "physical eraseblock size"
default 0x20000
help
Tells ubinize the physical eraseblock (PEB) size of the
flash chip the ubi image is created for. The value provided
here is passed to the -p/--peb-size option of ubinize.
config BR2_TARGET_USERFS2_UBI_SUBSIZE
int "sub-page size"
default 512
help
Tells ubinize that the flash supports sub-pages and the
sub-page size. Use 0 if sub-pages are not supported on flash
chip.
The value provided here is passed to the -s/--sub-page-size
option of ubinize.
endif
config BR2_TARGET_USERFS2_UBI_USE_CUSTOM_CONFIG
bool "Use custom config file"
help
Select this option to use a custom ubinize configuration file,
rather than the default configuration used by Buildroot (which
defines a single dynamic volume marked as auto-resize).
Passing a custom ubinize configuration file allows you to
create several volumes, specify volume types, etc.
As a convenience, buildroot replaces the string
"BR2_USERFS2_UBIFS_PATH" with the path to the built ubifs file.
So the volume defined for the root filesystem can specify the
image path as: image=BR2_USERFS2_UBIFS_PATH
Buildroot also replaces the string "BINARIES_DIR" with the
value of $(BINARIES_DIR), so that it is possible to reference
other build artefacts (e.g. to include the kernel in a UBI
volume).
config BR2_TARGET_USERFS2_UBI_CUSTOM_CONFIG_FILE
string "Configuration file path"
depends on BR2_TARGET_USERFS2_UBI_USE_CUSTOM_CONFIG
help
Path to the ubinize configuration file.
config BR2_TARGET_USERFS2_UBI_OPTS
string "Additional ubinize options"
help
Any additional ubinize options you may want to include.
endif # BR2_TARGET_USERFS2_TYPE_UBI
if BR2_TARGET_USERFS2_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS2_UBIFS_LEBSIZE
hex "logical eraseblock size"
default 0x1f800
@ -90,7 +178,7 @@ config BR2_TARGET_USERFS2_UBIFS_MAXLEBCNT
here is passed to the -c/--max-leb-cnt option of mkfs.ubifs.
endif
if !BR2_UBI_PARAM_USER_CUSTOM
if !BR2_TARGET_USERFS2_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS2_UBIFS_MAX_SIZE
hex "ubifs size(Should be aligned to MB)"
default 0x1000000

View File

@ -67,7 +67,95 @@ endif # BR2_TARGET_USERFS3_TYPE_EXT4
if BR2_TARGET_USERFS3_TYPE_UBIFS
if BR2_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS3_UBI_DEVICE_SPI_NAND_2K_128K
bool
config BR2_TARGET_USERFS3_UBI_DEVICE_SPI_NAND_4K_256K
bool
choice
prompt "ubi parameter select"
default BR2_TARGET_USERFS3_UBI_PARAM_ALL_SPI_NAND
config BR2_TARGET_USERFS3_UBI_PARAM_ALL_SPI_NAND
bool "spi-nand all type support"
select BR2_TARGET_USERFS3_UBI_DEVICE_SPI_NAND_2K_128K
select BR2_TARGET_USERFS3_UBI_DEVICE_SPI_NAND_4K_256K
config BR2_TARGET_USERFS3_UBI_PARAM_SPI_NAND_2K_128K
bool "spi-nand page:2k block:128k"
select BR2_TARGET_USERFS3_UBI_DEVICE_SPI_NAND_2K_128K
config BR2_TARGET_USERFS3_UBI_PARAM_SPI_NAND_4K_256K
bool "spi-nand page:4k block:256k"
select BR2_TARGET_USERFS3_UBI_DEVICE_SPI_NAND_4K_256K
config BR2_TARGET_USERFS3_UBI_PARAM_USER_CUSTOM
bool "user custom"
endchoice
config BR2_TARGET_USERFS3_TYPE_UBI
bool "ubi image containing an ubifs userfs3 filesystem"
default y
help
Build an ubi image from the ubifs one (with ubinize).
if BR2_TARGET_USERFS3_TYPE_UBI
if BR2_TARGET_USERFS3_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS3_UBI_PEBSIZE
hex "physical eraseblock size"
default 0x20000
help
Tells ubinize the physical eraseblock (PEB) size of the
flash chip the ubi image is created for. The value provided
here is passed to the -p/--peb-size option of ubinize.
config BR2_TARGET_USERFS3_UBI_SUBSIZE
int "sub-page size"
default 512
help
Tells ubinize that the flash supports sub-pages and the
sub-page size. Use 0 if sub-pages are not supported on flash
chip.
The value provided here is passed to the -s/--sub-page-size
option of ubinize.
endif
config BR2_TARGET_USERFS3_UBI_USE_CUSTOM_CONFIG
bool "Use custom config file"
help
Select this option to use a custom ubinize configuration file,
rather than the default configuration used by Buildroot (which
defines a single dynamic volume marked as auto-resize).
Passing a custom ubinize configuration file allows you to
create several volumes, specify volume types, etc.
As a convenience, buildroot replaces the string
"BR2_USERFS3_UBIFS_PATH" with the path to the built ubifs file.
So the volume defined for the root filesystem can specify the
image path as: image=BR2_USERFS3_UBIFS_PATH
Buildroot also replaces the string "BINARIES_DIR" with the
value of $(BINARIES_DIR), so that it is possible to reference
other build artefacts (e.g. to include the kernel in a UBI
volume).
config BR2_TARGET_USERFS3_UBI_CUSTOM_CONFIG_FILE
string "Configuration file path"
depends on BR2_TARGET_USERFS3_UBI_USE_CUSTOM_CONFIG
help
Path to the ubinize configuration file.
config BR2_TARGET_USERFS3_UBI_OPTS
string "Additional ubinize options"
help
Any additional ubinize options you may want to include.
endif # BR2_TARGET_USERFS3_TYPE_UBI
if BR2_TARGET_USERFS3_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS3_UBIFS_LEBSIZE
hex "logical eraseblock size"
default 0x1f800
@ -90,7 +178,7 @@ config BR2_TARGET_USERFS3_UBIFS_MAXLEBCNT
here is passed to the -c/--max-leb-cnt option of mkfs.ubifs.
endif
if !BR2_UBI_PARAM_USER_CUSTOM
if !BR2_TARGET_USERFS3_UBI_PARAM_USER_CUSTOM
config BR2_TARGET_USERFS3_UBIFS_MAX_SIZE
hex "ubifs size(Should be aligned to MB)"
default 0x1000000

View File

@ -0,0 +1,8 @@
[ubifs]
mode=ubi
vol_id=0
vol_type=dynamic
vol_name=userfs1
vol_alignment=1
vol_flags=autoresize
image=BR2_USERFS1_UBIFS_PATH

View File

@ -0,0 +1,8 @@
[ubifs]
mode=ubi
vol_id=0
vol_type=dynamic
vol_name=userfs2
vol_alignment=1
vol_flags=autoresize
image=BR2_USERFS2_UBIFS_PATH

View File

@ -0,0 +1,8 @@
[ubifs]
mode=ubi
vol_id=0
vol_type=dynamic
vol_name=userfs3
vol_alignment=1
vol_flags=autoresize
image=BR2_USERFS3_UBIFS_PATH

View File

@ -175,6 +175,62 @@ endif
USERFS_$(1)_UBIFS_CMD = $$(foreach MKCMD, $$(MK_UBIFS_$(1)_CMD), $$(call $$(MKCMD))$$(sep))
######## UBI commands ########
ifeq ($$(BR2_TARGET_USERFS$(1)_UBI_PARAM_USER_CUSTOM),y)
USERFS_$(1)_UBI_UBINIZE_OPTS_CUSTOM = -m $$(BR2_TARGET_USERFS$(1)_UBIFS_MINIOSIZE)
USERFS_$(1)_UBI_UBINIZE_OPTS_CUSTOM += -p $$(BR2_TARGET_USERFS$(1)_UBI_PEBSIZE)
ifneq ($$(BR2_TARGET_USERFS$(1)_UBI_SUBSIZE),0)
USERFS_$(1)_UBI_UBINIZE_OPTS_CUSTOM += -s $$(BR2_TARGET_USERFS$(1)_UBI_SUBSIZE)
endif
USERFS_$(1)_UBI_UBINIZE_OPTS_CUSTOM += $$(call qstrip, $$(BR2_TARGET_USERFS$(1)_UBI_OPTS))
MK_USERFS_$(1)_UBI_HOOK += MK_USERFS_$(1)_UBI_CMD_CUSTOM
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_UBI_DEVICE_SPI_NAND_2K_128K),y)
USERFS_$(1)_UBI_UBINIZE_OPTS_2K_128K = -m 0x800 -p 0x20000
USERFS_$(1)_UBI_UBINIZE_OPTS_2K_128K += $$(call qstrip, $$(BR2_TARGET_USERFS$(1)_UBI_OPTS))
MK_USERFS_$(1)_UBI_HOOK += MK_USERFS_$(1)_UBI_CMD_2K_128K
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_UBI_DEVICE_SPI_NAND_4K_256K),y)
USERFS_$(1)_UBI_UBINIZE_OPTS_4K_256K = -m 0x1000 -p 0x40000
USERFS_$(1)_UBI_UBINIZE_OPTS_4K_256K += $$(call qstrip, $$(BR2_TARGET_USERFS$(1)_UBI_OPTS))
MK_USERFS_$(1)_UBI_HOOK += MK_USERFS_$(1)_UBI_CMD_4K_256K
endif
USERFS_$(1)_UBI_DEPENDENCIES = userfs$(1)-ubifs
ifeq ($$(BR2_TARGET_USERFS$(1)_UBI_USE_CUSTOM_CONFIG),y)
USERFS_$(1)_UBI_UBINIZE_CONFIG_FILE_PATH = $$(call qstrip,$$(BR2_TARGET_USERFS$(1)_UBI_CUSTOM_CONFIG_FILE))
else
USERFS_$(1)_UBI_UBINIZE_CONFIG_FILE_PATH = package/fs/userfs/ubinize.cfg.userfs$(1)
endif
MK_USERFS_$(1)_UBI_CMD_CUSTOM = \
sed 's;userfs$(1);$$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME));;s;BR2_USERFS$(1)_UBIFS_PATH;$@fs;;s;BINARIES_DIR;$(BINARIES_DIR);' \
$$(USERFS_$(1)_UBI_UBINIZE_CONFIG_FILE_PATH) > $(BUILD_DIR)/ubinize.custom.cfg \
rm $(BUILD_DIR)/ubinize.custom.cfg
MK_USERFS_$(1)_UBI_CMD_2K_128K = \
sed 's;userfs$(1);$$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME));;s;BR2_USERFS$(1)_UBIFS_PATH;$$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME))_page_2k_block_128k.ubifs;;s;BINARIES_DIR;$(BINARIES_DIR);' \
$$(USERFS_$(1)_UBI_UBINIZE_CONFIG_FILE_PATH) > $(BUILD_DIR)/ubinize.2k_128k.cfg; \
$(HOST_DIR)/sbin/ubinize \
-o $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME))_page_2k_block_128k.ubi \
$$(USERFS_$(1)_UBI_UBINIZE_OPTS_2K_128K) \
$(BUILD_DIR)/ubinize.2k_128k.cfg
MK_USERFS_$(1)_UBI_CMD_4K_256K = \
sed 's;userfs$(1);$$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME));;s;BR2_USERFS$(1)_UBIFS_PATH;$$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET_USERFS$(1)_NAME))_page_4k_block_256k.ubifs;;s;BINARIES_DIR;$(BINARIES_DIR);' \
$$(USERFS_$(1)_UBI_UBINIZE_CONFIG_FILE_PATH) > $(BUILD_DIR)/ubinize.4k_256k.cfg; \
$(HOST_DIR)/sbin/ubinize \
-o $$(BINARIES_DIR)/$$(call qstrip,$$(BR2_TARGET _USERFS$(1)_NAME))_page_4k_block_256k.ubi \
$$(USERFS_$(1)_UBI_UBINIZE_OPTS_4K_256K) \
$(BUILD_DIR)/ubinize.4k_256k.cfg
USERFS_$(1)_UBI_CMD = $$(foreach MKCMD, $$(MK_USERFS_$(1)_UBI_HOOK), $$(call $$(MKCMD))$$(sep))
######## JFFS2 commands ########
USERFS_$(1)_JFFS2_OPTS = -e $$(BR2_TARGET_USERFS$(1)_JFFS2_EBSIZE) --with-xattr
USERFS_$(1)_JFFS2_SUMTOOL_OPTS = -e $$(BR2_TARGET_USERFS$(1)_JFFS2_EBSIZE)
@ -291,6 +347,10 @@ ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_UBIFS),y)
$$(call PRINTF,$$(USERFS_$(1)_UBIFS_CMD)) >> $$(FAKEROOT_SCRIPT)
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_UBI),y)
$$(call PRINTF,$$(USERFS_$(1)_UBI_CMD)) >> $$(FAKEROOT_SCRIPT)
endif
ifeq ($$(BR2_TARGET_USERFS$(1)_TYPE_JFFS2),y)
$$(call PRINTF,$$(USERFS_$(1)_JFFS2_CMD)) >> $$(FAKEROOT_SCRIPT)
endif

View File

@ -144,5 +144,12 @@ menu "Third-party packages"
source package/third-party/live555/Config.in
source package/third-party/rtl8733bs_bt_fw/Config.in
source package/third-party/rtl8733bu_bt_fw/Config.in
comment "************************ MTP Tools *************************"
source package/third-party/libfuse/Config.in
source package/third-party/libiconv/Config.in
source package/third-party/libusb/Config.in
source package/third-party/mtpfs/Config.in
source package/third-party/umtprd/Config.in
source package/third-party/libmtp/Config.in
endmenu

View File

@ -1,4 +1,4 @@
AIC8800_FW_VERSION = 1.0
AIC8800_FW_VERSION = 2.0
AIC8800_FW_SOURCE = aic8800_fw-$(AIC8800_FW_VERSION).tar.gz
AIC8800_FW_SITE = aic8800_fw
AIC8800_FW_ENABLE_TARBALL = YES

View File

@ -17,6 +17,7 @@ comment "gdb/gdbserver >= 8.x needs a toolchain w/ C++, gcc >= 4.8"
menuconfig BR2_PACKAGE_GDB
bool "gdb"
select BR2_PACKAGE_HOST_GDB
depends on BR2_TOOLCHAIN_HAS_THREADS && BR2_TOOLCHAIN_HAS_THREADS_DEBUG
depends on BR2_PACKAGE_GDB_ARCH_SUPPORTS
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
@ -60,6 +61,7 @@ config BR2_PACKAGE_GDB_SERVER
config BR2_PACKAGE_GDB_DEBUGGER
bool "full debugger"
default y
depends on BR2_USE_WCHAR
depends on !BR2_sh
select BR2_PACKAGE_GMP

View File

@ -45,7 +45,7 @@ config BR2_PACKAGE_HOST_GDB_SIM
choice
prompt "GDB debugger Version"
default BR2_GDB_VERSION_15
default BR2_GDB_VERSION_14
depends on !BR2_arc
help
Select the version of gdb you wish to use.

View File

@ -0,0 +1,22 @@
Fix build on the AArch64 platform
Upstream-Status: Submitted
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -88,12 +88,7 @@
#ifndef _LINUX_FUSE_H
#define _LINUX_FUSE_H
-#include <sys/types.h>
-#define __u64 uint64_t
-#define __s64 int64_t
-#define __u32 uint32_t
-#define __s32 int32_t
-#define __u16 uint16_t
+#include <linux/types.h>
/*
* Version negotiation:

View File

@ -0,0 +1,64 @@
From 5a43d0f724c56f8836f3f92411e0de1b5f82db32 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Sat, 24 Jul 2021 22:02:45 +0100
Subject: [PATCH] util/ulockmgr_server.c: conditionally define closefrom (fix
glibc-2.34+)
closefrom(3) has joined us in glibc-land from *BSD and Solaris. Since
it's available in glibc 2.34+, we want to detect it and only define our
fallback if the libc doesn't provide it.
Bug: https://bugs.gentoo.org/803923
Signed-off-by: Sam James <sam@gentoo.org>
[Retrieved from:
https://github.com/libfuse/libfuse/commit/5a43d0f724c56f8836f3f92411e0de1b5f82db32]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
configure.ac | 1 +
util/ulockmgr_server.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/configure.ac b/configure.ac
index 9946a0efa..a2d481aa9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,7 @@ fi
AC_CHECK_FUNCS([fork setxattr fdatasync splice vmsplice utimensat])
AC_CHECK_FUNCS([posix_fallocate])
+AC_CHECK_FUNCS([closefrom])
AC_CHECK_MEMBERS([struct stat.st_atim])
AC_CHECK_MEMBERS([struct stat.st_atimespec])
diff --git a/util/ulockmgr_server.c b/util/ulockmgr_server.c
index 273c7d923..a04dac5c6 100644
--- a/util/ulockmgr_server.c
+++ b/util/ulockmgr_server.c
@@ -22,6 +22,10 @@
#include <sys/socket.h>
#include <sys/wait.h>
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
struct message {
unsigned intr : 1;
unsigned nofd : 1;
@@ -124,6 +128,7 @@ static int receive_message(int sock, void *buf, size_t buflen, int *fdp,
return res;
}
+#if !defined(HAVE_CLOSEFROM)
static int closefrom(int minfd)
{
DIR *dir = opendir("/proc/self/fd");
@@ -141,6 +146,7 @@ static int closefrom(int minfd)
}
return 0;
}
+#endif
static void send_reply(int cfd, struct message *msg)
{

14
package/third-party/libfuse/Config.in vendored Normal file
View File

@ -0,0 +1,14 @@
config BR2_PACKAGE_LIBFUSE
bool "libfuse"
# Really doesn't like static, see fuse/lib/fuse.c
depends on !BR2_STATIC_LIBS
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_MMU # fork()
help
FUSE (Filesystem in UserSpacE)
https://github.com/libfuse/libfuse
comment "libfuse needs a toolchain w/ threads, dynamic library"
depends on BR2_USE_MMU
depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS

View File

@ -0,0 +1,6 @@
# Locally calculated after checking pgp signature
sha256 d0e69d5d608cc22ff4843791ad097f554dd32540ddc9bed7638cc6fea7c1b4b5 fuse-2.9.9.tar.gz
# Hash for license files:
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.LIB

48
package/third-party/libfuse/libfuse.mk vendored Normal file
View File

@ -0,0 +1,48 @@
################################################################################
#
# libfuse
#
################################################################################
LIBFUSE_VERSION = 2.9.9
LIBFUSE_SOURCE = fuse-$(LIBFUSE_VERSION).tar.gz
LIBFUSE_SITE = https://github.com/libfuse/libfuse/releases/download/fuse-$(LIBFUSE_VERSION)
LIBFUSE_LICENSE = GPL-2.0, LGPL-2.1
LIBFUSE_LICENSE_FILES = COPYING COPYING.LIB
LIBFUSE_CPE_ID_VALID = YES
LIBFUSE_INSTALL_STAGING = YES
# We're patching configure.ac
LIBFUSE_AUTORECONF = YES
# add host-gettext for AM_ICONV macro
LIBFUSE_DEPENDENCIES = \
host-gettext \
$(if $(BR2_PACKAGE_LIBICONV),libiconv)
LIBFUSE_CONF_OPTS = \
--disable-example \
--enable-lib \
--enable-util \
UDEV_RULES_PATH=/lib/udev/rules.d
ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
define LIBFUSE_INSTALL_UDEV
mkdir -p $(TARGET_DIR)/lib/udev/rules.d
cp $(STAGING_DIR)/lib/udev/rules.d/*-fuse.rules $(TARGET_DIR)/lib/udev/rules.d
endef
LIBFUSE_POST_INSTALL_TARGET_HOOKS += LIBFUSE_INSTALL_UDEV
endif
define LIBFUSE_INSTALL_TARGET_CMDS
cp -dpf $(STAGING_DIR)/usr/bin/fusermount $(TARGET_DIR)/usr/bin/
cp -dpf $(STAGING_DIR)/usr/lib/libfuse.so* $(TARGET_DIR)/usr/lib/
endef
define LIBFUSE_DEVICES
/dev/fuse c 666 0 0 10 229 0 0 -
endef
define LIBFUSE_PERMISSIONS
/usr/bin/fusermount f 4755 0 0 - - - - -
endef
$(eval $(autotools-package))

29
package/third-party/libiconv/Config.in vendored Normal file
View File

@ -0,0 +1,29 @@
config BR2_PACKAGE_LIBICONV
bool "libiconv"
depends on !BR2_ENABLE_LOCALE
help
unicode conversion library
http://ftp.gnu.org/pub/gnu/libiconv
if BR2_PACKAGE_LIBICONV
config BR2_PACKAGE_LIBICONV_EXTRA_ENCODINGS
bool "extra encodings"
help
Provide support for a few extra encodings:
European languages
CP{437,737,775,852,853,855,857,858,860,861,863,865,869,1125}
Semitic languages
CP864
Japanese
EUC-JISX0213, Shift_JISX0213, ISO-2022-JP-3
Chinese
BIG5-2003 (experimental)
Turkmen
TDS565
Platform specifics
ATARIST, RISCOS-LATIN1
endif

View File

@ -0,0 +1,6 @@
# Locally calculated after checking pgp signature
3b08f5f4f9b4eb82f151a7040bfd6fe6c6fb922efe4b1659c66ea933276965e8 libiconv-1.18.tar.gz
# Hash for license files:
sha256 8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903 COPYING
sha256 56bdea73b6145ef6ac5259b3da390b981d840c24cb03b8e1cbc678de7ecfa18d COPYING.LIB

View File

@ -0,0 +1,33 @@
################################################################################
#
# libiconv
#
################################################################################
LIBICONV_VERSION = 1.18
LIBICONV_SOURCE = libiconv-$(LIBICONV_VERSION).tar.gz
LIBICONV_SITE = $(BR2_GNU_MIRROR)/libiconv
LIBICONV_INSTALL_STAGING = YES
LIBICONV_LICENSE = GPL-3.0+ (iconv program), LGPL-2.0+ (library)
LIBICONV_LICENSE_FILES = COPYING COPYING.LIB
ifeq ($(BR2_PACKAGE_LIBICONV_EXTRA_ENCODINGS),y)
LIBICONV_CONF_OPTS += --enable-extra-encodings
endif
# Don't build the preloadable library, as we don't need it (it's only
# for LD_PRELOAD to replace glibc's iconv, but we never build libiconv
# when glibc is used). And it causes problems for static only builds.
# define LIBICONV_DISABLE_PRELOAD
# $(SED) '/preload/d' $(@D)/Makefile.in
# endef
# LIBICONV_PRE_CONFIGURE_HOOKS += LIBICONV_DISABLE_PRELOAD
$(eval $(autotools-package))
# Configurations where the toolchain supports locales and the libiconv
# package is enabled are incorrect, because the toolchain already
# provides libiconv functionality, and having both confuses packages.
ifeq ($(BR2_PACKAGE_LIBICONV)$(BR2_ENABLE_LOCALE),yy)
$(error Libiconv should never be enabled when the toolchain supports locales. Report this failure to Buildroot developers)
endif

4
package/third-party/libmtp/Config.in vendored Normal file
View File

@ -0,0 +1,4 @@
config BR2_PACKAGE_LIBMTP
bool "libmtp"
default n

18
package/third-party/libmtp/libmtp.mk vendored Normal file
View File

@ -0,0 +1,18 @@
################################################################################
#
# libmtp
#
################################################################################
LIBMTP_VERSION = 1.1.22
LIBMTP_SOURCE = libmtp-$(LIBMTP_VERSION).tar.gz
LIBMTP_SITE = https://sourceforge.net/projects/libmtp/files/libmtp/$(LIBMTP_VERSION)
LIBMTP_SHA256 = c3fcf411aea9cb9643590cbc9df99fa5fe30adcac695024442973d76fa5f87bc
LIBMTP_LICENSE = LGPL-2.1+
LIBMTP_LICENSE_FILES = COPYING
LIBMTP_INSTALL_STAGING = YES
LIBMTP_DEPENDENCIES = host-pkgconf libusb
LIBMTP_PRE_CONFIGURE_HOOKS += LIBMTP_REMOVE_HOTPLUG_INSTALL_HOOK
$(eval $(autotools-package))

19
package/third-party/libusb/Config.in vendored Normal file
View File

@ -0,0 +1,19 @@
config BR2_PACKAGE_LIBUSB
bool "libusb"
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # _Thread_local
help
Userspace library for accessing USB devices
http://libusb.info/
if BR2_PACKAGE_LIBUSB
config BR2_PACKAGE_LIBUSB_EXAMPLES
bool "build libusb examples"
endif
comment "libusb needs a toolchain w/ threads, gcc >= 4.9"
depends on !BR2_TOOLCHAIN_HAS_THREADS || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_4_9

View File

@ -0,0 +1,3 @@
# Locally computed:
sha256 db11c06e958a82dac52cf3c65cb4dd2c3f339c8a988665110e0d24d19312ad8d libusb-1.0.23.tar.bz2
sha256 5df07007198989c622f5d41de8d703e7bef3d0e79d62e24332ee739a452af62a COPYING

38
package/third-party/libusb/libusb.mk vendored Normal file
View File

@ -0,0 +1,38 @@
################################################################################
#
# libusb
#
################################################################################
LIBUSB_VERSION_MAJOR = 1.0
LIBUSB_VERSION = $(LIBUSB_VERSION_MAJOR).23
LIBUSB_SOURCE = libusb-$(LIBUSB_VERSION).tar.bz2
LIBUSB_SITE = https://github.com/libusb/libusb/releases/download/v$(LIBUSB_VERSION)
LIBUSB_LICENSE = LGPL-2.1+
LIBUSB_LICENSE_FILES = COPYING
LIBUSB_CPE_ID_VENDOR = libusb
LIBUSB_DEPENDENCIES = host-pkgconf
LIBUSB_INSTALL_STAGING = YES
# Avoid the discovery of udev for the host variant
HOST_LIBUSB_CONF_OPTS = --disable-udev
HOST_LIBUSB_DEPENDENCIES = host-pkgconf
ifeq ($(BR2_PACKAGE_HAS_UDEV),y)
LIBUSB_DEPENDENCIES += udev
else
LIBUSB_CONF_OPTS += --disable-udev
endif
ifeq ($(BR2_PACKAGE_LIBUSB_EXAMPLES),y)
LIBUSB_CONF_OPTS += --enable-examples-build
define LIBUSB_INSTALL_TARGET_EXAMPLES
$(foreach example,listdevs xusb fxload hotplugtest testlibusb dpfp dpfp_threaded sam3u_benchmark,
$(INSTALL) -D -m0755 $(@D)/examples/$(example) $(TARGET_DIR)/usr/bin/$(example)
)
endef
LIBUSB_POST_INSTALL_TARGET_HOOKS += LIBUSB_INSTALL_TARGET_EXAMPLES
endif
$(eval $(autotools-package))
$(eval $(host-autotools-package))

3
package/third-party/mtpfs/Config.in vendored Normal file
View File

@ -0,0 +1,3 @@
config BR2_PACKAGE_MTPFS
bool "mtpfs"
default n

1
package/third-party/mtpfs/mtpfs.hash vendored Normal file
View File

@ -0,0 +1 @@
sha256 5f3854644bfeaa3f0391cc13251c60d19a4cdf8dab09415450a5881e3cd7891b mtpfs-1.0.tar.gz

47
package/third-party/mtpfs/mtpfs.mk vendored Normal file
View File

@ -0,0 +1,47 @@
################################################################################
#
# mtpfs
#
################################################################################
MTPFS_VERSION = 1.0
MTPFS_SOURCE = mtpfs-$(MTPFS_VERSION).tar.gz
MTPFS_SITE = https://github.com/cjd/mtpfs/archive/refs/tags/v$(MTPFS_VERSION).tar.gz
MTPFS_LICENSE = LGPL-2.1+
MTPFS_LICENSE_FILES = COPYING
MTPFS_DEPENDENCIES = host-automake host-autoconf host-libtool libmtp libfuse
MTPFS_SUBDIR = mtpfs-$(MTPFS_VERSION)
define MTPFS_CONFIGURE_CMDS
cd $(@D) && \
chmod +x autogen.sh && \
./autogen.sh && \
./configure \
--prefix=/usr \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \
--disable-static \
--enable-shared \
--disable-dependency-tracking \
--disable-mad \
--disable-id3tag \
$(DISABLE_NLS) \
$(TARGET_CONFIGURE_OPTS)
endef
define MTPFS_BUILD_CMDS
$(MAKE) -C $(@D) \
$(TARGET_CONFIGURE_OPTS)
endef
define MTPFS_INSTALL_STAGING_CMDS
$(MAKE) -C $(@D) install \
DESTDIR=$(STAGING_DIR)
endef
define MTPFS_INSTALL_TARGET_CMDS
$(MAKE) -C $(@D) install \
DESTDIR=$(TARGET_DIR)
endef
$(eval $(generic-package))

View File

@ -6,7 +6,7 @@ RTL8733BS_BT_FW_ENABLE_PATCH = NO
RTL8733BS_BT_FW_INSTALL_STAGING = YES
RTL8733BS_BT_FW_DEPENDENCIES = linux
RTL8733BS_BT_FW_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/lib/firmware
RTL8733BS_BT_FW_CONF_OPTS += -DCMAKE_INSTALL_PREFIX=/lib/firmware/rtlbt
$(eval $(cmake-package))

View File

@ -15,6 +15,8 @@ else
MOD_INFO_FILE="/etc/config/.module.csv"
fi
CMU_VER=V1
RUN_TIME=`date +%Y-%m-%d_%H-%M`
COLOR_BEGIN="\033["
@ -104,6 +106,30 @@ lm_exit()
cd / > /dev/null
}
# $1 - the current CLK status
parse_clk_status()
{
CLK_STATUS=$1
if [ "$CMU_VER" == "V1" ]; then
if [ "${CLK_STATUS:6:1}" == "3" ] \
|| [ "${CLK_STATUS:6:1}" == "1" ] \
|| [ "${CLK_STATUS:7:1}" == "1" ]; then
return 1
else
return 0
fi
else
if [ "${CLK_STATUS:5:1}" == "3" ] \
|| [ "${CLK_STATUS:5:1}" == "1" ] \
|| [ "${CLK_STATUS:3:1}" == "1" ]; then
return 1
else
return 0
fi
fi
}
clk_is_enable()
{
CLK_STATUS="-"
@ -118,9 +144,8 @@ clk_is_enable()
CLK_STATUS="0x0"
return 0
else
if [ "${CLK_STATUS:6:1}" == "3" ] \
|| [ "${CLK_STATUS:6:1}" == "1" ] \
|| [ "${CLK_STATUS:7:1}" == "1" ]; then
parse_clk_status $CLK_STATUS
if [ $? -eq 1 ]; then
MOD_ENABLE="Yes"
ENABLE_CNT=$(expr $ENABLE_CNT + 1)
return 1
@ -157,6 +182,24 @@ disable_mod_clk()
fi
}
# $1 - CMU base address
# $2 - version offset
check_cmu_ver()
{
hex_add $1 $2
readl $SUM
CUR_IP_VER=$(echo ${REG_VAL:7:1})
if [ "$CUR_IP_VER" = "1" ] || [ "$CUR_IP_VER" = "2" ]; then
CMU_VER=V1
else
CMU_VER=V2
fi
if [ "x$AIC_VERBOSE" = "xon" ]; then
printf "CMU Version: %s [%s]\n" $CMU_VER $REG_VAL
fi
}
show_mod_version()
{
VER_INFO="-"
@ -226,10 +269,6 @@ check_one_module()
INFO_STR=$2
MOD_NAME=$(echo $INFO_STR | awk -F ',' '{printf $1}')
if [ "x$AIC_VERBOSE" = "xon" ]; then
printf "%-3s %-15s ...\n" $NUM ${MOD_NAME}
fi
if [ "${MOD_NAME:0:1}" == "#" ]; then
# The module is commented out
printf "%-3s %-15s can not access!\n" $NUM ${MOD_NAME:1}
@ -242,10 +281,18 @@ check_one_module()
TEST_REG_OFFSET=$(echo $INFO_STR | awk -F ',' '{printf $5}')
EXPECT_VAL=$(echo $INFO_STR | awk -F ',' '{printf $6}' | tr -d '\r')
if [ "$MOD_NAME" = "CMU" ]; then
check_cmu_ver $MOD_BASE $VER_REG
fi
MOD_ENABLE="-"
clk_is_enable
show_mod_version
if [ "x$AIC_VERBOSE" = "xon" ]; then
printf "%-3s %-15s, Enable: %s\n" "$NUM" "$MOD_NAME" "$MOD_ENABLE"
fi
if [ ! "x$PROBE_TEST" == "xprobe" ]; then
if [ "$MOD_ENABLE" == "Yes" ]; then
printf "%-3s %-15s %-11s %-10s %-11s\n" \
@ -303,7 +350,10 @@ while read line; do
INDEX=$(expr $INDEX + 1)
continue
fi
# echo $line
if [ "x$AIC_VERBOSE" = "xon" ]; then
echo $line
fi
TOTAL_CNT=$(expr $TOTAL_CNT + 1)
check_one_module $INDEX "$line"

11
package/third-party/umtprd/Config.in vendored Normal file
View File

@ -0,0 +1,11 @@
config BR2_PACKAGE_UMTPRD
bool "umtprd"
depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15
help
Lightweight USB MTP responder daemon for GNU/Linux
https://github.com/viveris/uMTP-Responder
comment "umtprd needs a toolchain w/ threads, headers >= 3.15"
depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15

View File

@ -0,0 +1,3 @@
# Locally computed
sha256 51af5453987a2c63dc6a4e6d1505ceba83c23484d6c2db6c3caaed96ffbde295 uMTP-1.6.8.tar.gz
sha256 8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903 LICENSE

25
package/third-party/umtprd/umtprd.mk vendored Normal file
View File

@ -0,0 +1,25 @@
################################################################################
#
# umtprd
#
################################################################################
UMTPRD_VERSION = 1.6.8
UMTPRD_SITE = https://github.com/viveris/uMTP-Responder/archive
UMTPRD_LICENSE = GPL-3.0+
UMTPRD_LICENSE_FILES = LICENSE
define UMTPRD_BUILD_CMDS
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
endef
define UMTPRD_INSTALL_TARGET_CMDS
rm -f $(TARGET_DIR)/etc/init.d/S90adbd
$(INSTALL) -d -m 0777 $(TARGET_DIR)/etc/umtprd
$(INSTALL) -m 0777 $(@D)/$(MTP_UMTP_SUBDIR)/conf/umtprd.conf $(TARGET_DIR)/etc/umtprd/
$(INSTALL) -m 0777 $(@D)/$(MTP_UMTP_SUBDIR)/conf/umtprd-ffs.sh $(TARGET_DIR)/usr/sbin/umtprd-ffs.sh
$(INSTALL) -D -m 0755 $(@D)/umtprd $(TARGET_DIR)/usr/sbin/umtprd
endef
$(eval $(generic-package))

View File

@ -0,0 +1,57 @@
From 913667571f4c1810e0d20a999440bda612448ee6 Mon Sep 17 00:00:00 2001
From: matteo <duanmt@artinchip.com>
Date: Wed, 9 Jul 2025 10:10:44 +0800
Subject: [PATCH] media-ctl: Export mediactl lib for test-vin
Signed-off-by: matteo <duanmt@artinchip.com>
---
utils/media-ctl/meson.build | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/utils/media-ctl/meson.build b/utils/media-ctl/meson.build
index 3a7b0c9..06cacf1 100644
--- a/utils/media-ctl/meson.build
+++ b/utils/media-ctl/meson.build
@@ -3,6 +3,10 @@ libmediactl_sources = files(
'mediactl-priv.h',
)
+libmediactl_api = files(
+ 'mediactl.h',
+)
+
libmediactl_deps = [
dep_libudev,
]
@@ -10,18 +14,28 @@ libmediactl_deps = [
libmediactl = static_library('mediactl',
libmediactl_sources,
dependencies : libmediactl_deps,
+ install : true,
include_directories : v4l2_utils_incdir)
+install_headers(libmediactl_api)
+
dep_libmediactl = declare_dependency(link_with : libmediactl)
libv4l2subdev_sources = files('libv4l2subdev.c')
libv4l2subdev_sources += media_bus_format_names_h
libv4l2subdev_sources += media_bus_format_codes_h
+libv4l2subdev_api = files(
+ 'v4l2subdev.h',
+)
+
libv4l2subdev = static_library('v4l2subdev',
libv4l2subdev_sources,
+ install : true,
include_directories : v4l2_utils_incdir)
+install_headers(libv4l2subdev_api)
+
dep_libv4l2subdev = declare_dependency(link_with : libv4l2subdev)
media_ctl_sources = files(
--
2.25.1

View File

@ -4,7 +4,7 @@
#
################################################################################
V4L_UTILS_VERSION = 1.28.1
V4L_UTILS_SOURCE = v4l-tuils-$(V4L_UTILS_VERSION).tar.xz
V4L_UTILS_SOURCE = v4l-utils-$(V4L_UTILS_VERSION).tar.xz
V4L_UTILS_SITE = http://git.linuxtv.org/v4l-utils.git
V4L_UTILS_LICENSE = LGPL-2.0+
V4L_UTILS_LICENSE_FILES = COPYING COPYING.libdvbv5 COPYING.libv4l

View File

@ -1 +1 @@
cf7de4a44043abb6f09877fc51d08d2f2dfdf951
30d7903266f387ed5aa2aaca418d67a60314e851

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
a9c6b2ffe35593c619b6b0a7081c639e7b56fdef
273153a27c1814593a63b668b3dadae031d05311

View File

@ -1,12 +1,11 @@
/*
* Copyright (C) 2020-2024 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* author: <jun.ma@artinchip.com>
* Desc: aac_decoder
* Author: <jun.ma@artinchip.com>
* Desc: aac_decoder
*/
#include <string.h>
#include <pthread.h>
#include <unistd.h>
@ -20,6 +19,10 @@
#include "audio_decoder.h"
#include "faad.h"
#define ADTS_AAC (0)
#define LATM_AAC (1)
#define AAC (2)
struct aac_audio_decoder
{
struct aic_audio_decoder decoder;
@ -32,6 +35,7 @@ struct aac_audio_decoder
int bits_per_sample;
int frame_id;
int frame_count;
int aac_type;
};
int __aac_decode_init(struct aic_audio_decoder *decoder, struct aic_audio_decode_config *config)
@ -43,7 +47,7 @@ int __aac_decode_init(struct aic_audio_decoder *decoder, struct aic_audio_decode
aac_decoder->aac_handle = NeAACDecOpen();
aac_cfg = NeAACDecGetCurrentConfiguration(aac_decoder->aac_handle);
logd("defObjectType:%d,defSampleRate:%lu,"\
logi("defObjectType:%d,defSampleRate:%lu,"\
"dontUpSampleImplicitSBR:%d,downMatrix:%d,"\
"outputFormat:%d,useOldADTSFormat:%d\n"
,aac_cfg->defObjectType,aac_cfg->defSampleRate
@ -67,6 +71,17 @@ int __aac_decode_destroy(struct aic_audio_decoder *decoder)
return 0;
}
static int check_aac_type(unsigned char* buf, int len)
{
if (buf[0]==0xff && (buf[1]&0xf0)==0xf0)
return ADTS_AAC;
if ((buf[0]&0xff) == 0x56 && (buf[1]&0xe0) == 0xe0)
return LATM_AAC;
return AAC;
}
int __aac_decode_frame(struct aic_audio_decoder *decoder)
{
s32 ret = 0;
@ -88,23 +103,39 @@ int __aac_decode_frame(struct aic_audio_decoder *decoder)
if (aac_decoder->aac_handle_init_flag == 0) {
aac_decoder->curr_packet = audio_pm_dequeue_ready_packet(aac_decoder->decoder.pm);
ret = NeAACDecInit2(aac_decoder->aac_handle, aac_decoder->curr_packet->data, aac_decoder->curr_packet->size, &samplerate, &channels);
if (ret < 0) {
aac_decoder->aac_type = check_aac_type(aac_decoder->curr_packet->data, aac_decoder->curr_packet->size);
if (aac_decoder->aac_type == AAC) {
ret = NeAACDecInit2(aac_decoder->aac_handle, aac_decoder->curr_packet->data,
aac_decoder->curr_packet->size, &samplerate, &channels);
audio_pm_enqueue_empty_packet(aac_decoder->decoder.pm, aac_decoder->curr_packet);
} else {
ret = NeAACDecInit(aac_decoder->aac_handle, aac_decoder->curr_packet->data,
aac_decoder->curr_packet->size, &samplerate, &channels);
// we should decode raw data for this packet
audio_pm_reclaim_ready_packet(aac_decoder->decoder.pm, aac_decoder->curr_packet);
}
if (ret < 0) {
loge("NeAACDecInit error\n");
return DEC_ERR_NOT_SUPPORT;
}
aac_decoder->aac_handle_init_flag = 1;
audio_pm_enqueue_empty_packet(aac_decoder->decoder.pm, aac_decoder->curr_packet);
return DEC_OK;
}
aac_decoder->curr_packet = audio_pm_dequeue_ready_packet(aac_decoder->decoder.pm);
memset(&frame_info, 0x00, sizeof(NeAACDecFrameInfo));
pcm_data = NeAACDecDecode(aac_decoder->aac_handle, &frame_info, aac_decoder->curr_packet->data, aac_decoder->curr_packet->size);
u8* buf = aac_decoder->curr_packet->data;
int size = aac_decoder->curr_packet->size;
pcm_data = NeAACDecDecode(aac_decoder->aac_handle, &frame_info, buf, size);
if (frame_info.error && !aac_decoder->decoder.fm) {
loge("decoder fail !!!\n");
loge("decoder fail, frame_info.error: %d\n", frame_info.error);
audio_pm_enqueue_empty_packet(aac_decoder->decoder.pm, aac_decoder->curr_packet);
return DEC_ERR_NULL_PTR;
}
@ -114,7 +145,7 @@ int __aac_decode_frame(struct aic_audio_decoder *decoder)
return DEC_OK;
}
logd("channels:%d,error:%d,header_type:%d,"\
logi("channels:%d,error:%d,header_type:%d,"\
"num_back_channels:%d,num_front_channels:%d,num_lfe_channels:%d,num_side_channels:%d,"\
"object_type:%d,ps:%d,samplerate:%lu,samples:%lu,sbr:%d,"\
"bytesconsumed:%lu,packet_size:%d,channel_position[0]:%d,channel_position[1]:%d\n"
@ -165,6 +196,7 @@ int __aac_decode_frame(struct aic_audio_decoder *decoder)
frame->pts = aac_decoder->curr_packet->pts;
frame->bits_per_sample = aac_decoder->bits_per_sample;
frame->id = aac_decoder->frame_id++;
if (frame_info.error == 0) {
memcpy(frame->data, pcm_data, pcm_data_size);
} else {
@ -183,7 +215,7 @@ int __aac_decode_frame(struct aic_audio_decoder *decoder)
,frame->pts,frame->sample_rate,frame->id,frame->size);
if (audio_fm_decoder_put_frame(aac_decoder->decoder.fm, frame) != 0) {
loge("plese check code,why!!!\n");
loge("please check code, why!!!\n");
return DEC_ERR_NULL_PTR;
}
return DEC_OK;
@ -193,6 +225,7 @@ int __aac_decode_control(struct aic_audio_decoder *decoder, int cmd, void *param
{
return 0;
}
int __aac_decode_reset(struct aic_audio_decoder *decoder)
{
struct aac_audio_decoder *aac_decoder = (struct aac_audio_decoder *)decoder;

View File

@ -91,7 +91,7 @@ add_library(mm_base SHARED
${BASE_AUDIO_RENDER}
)
target_link_libraries(mm_base mpp_base asound)
target_link_libraries(mm_base mpp_base mpp_ge asound)
if (RTSP_DEMUXER)
target_link_libraries(mm_base BasicUsageEnvironment groupsock liveMedia UsageEnvironment)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@ -13,7 +13,7 @@
#include "mpp_dec_type.h"
#ifdef __cplusplus
extern "C"{
extern "C" {
#endif /* __cplusplus */
struct aic_video_render {
@ -25,6 +25,7 @@ struct aic_video_render {
s32 (*get_dis_rect)(struct aic_video_render *render,struct mpp_rect *rect);
s32 (*set_on_off)(struct aic_video_render *render,s32 on_off);
s32 (*get_on_off)(struct aic_video_render *render,s32 *on_off);
s32 (*rend_last_frame)(struct aic_video_render *render, s32 enable);
};
@ -58,6 +59,10 @@ struct aic_video_render {
on_off) \
((struct aic_video_render*)render)->get_on_off(render,on_off)
#define aic_video_render_rend_last_frame( \
render, \
enable) \
((struct aic_video_render *)render)->rend_last_frame(render, enable)
s32 aic_video_render_create(struct aic_video_render **render);
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@ -19,6 +19,8 @@
#include "mpp_log.h"
#include "mpp_list.h"
#include "aic_render.h"
#include "dma_allocator.h"
#include "mpp_ge.h"
#define DEV_FB "/dev/fb0"
@ -41,6 +43,15 @@ struct aic_fb_video_render {
struct mpp_list dma_list;
};
struct aic_fb_video_render_last_frame {
struct aicfb_layer_data layer;
struct mpp_frame frame;
s32 enable;
s32 dma_fd;
};
static struct aic_fb_video_render_last_frame g_last_frame = {0};
static s32 fb_video_render_init(struct aic_video_render *render,s32 layer,s32 dev_id)
{
struct aic_fb_video_render *fb_render = (struct aic_fb_video_render*)render;
@ -52,8 +63,10 @@ static s32 fb_video_render_init(struct aic_video_render *render,s32 layer,s32 de
fb_render->layer.layer_id = layer;
ioctl(fb_render->fd, AICFB_GET_LAYER_CONFIG, &fb_render->layer);
fb_render->layer.enable = 0;
ioctl(fb_render->fd, AICFB_UPDATE_LAYER_CONFIG, &fb_render->layer);
if (!g_last_frame.enable) {
fb_render->layer.enable = 0;
ioctl(fb_render->fd, AICFB_UPDATE_LAYER_CONFIG, &fb_render->layer);
}
return 0;
}
@ -64,9 +77,11 @@ static s32 fb_video_render_destroy(struct aic_video_render *render)
struct dma_buf_info dmabuf_fd[3];
int i = 0;
fb_render->layer.enable = 0;
if (ioctl(fb_render->fd, AICFB_UPDATE_LAYER_CONFIG, &fb_render->layer) < 0)
loge("fb ioctl() AICFB_UPDATE_LAYER_CONFIG failed!");
if (!g_last_frame.enable) {
fb_render->layer.enable = 0;
if (ioctl(fb_render->fd, AICFB_UPDATE_LAYER_CONFIG, &fb_render->layer) < 0)
loge("fb ioctl() AICFB_UPDATE_LAYER_CONFIG failed!");
}
if (!mpp_list_empty(&fb_render->dma_list)) {
struct frame_dma_buf_info_list *dma_buf_node = NULL,*dma_buf_node1 = NULL;
@ -94,26 +109,26 @@ static s32 fb_video_render_destroy(struct aic_video_render *render)
static s32 get_component_num(enum mpp_pixel_format format)
{
int component_num = 0;
if (format == MPP_FMT_ARGB_8888) {
component_num = 1;
} else if (format == MPP_FMT_RGBA_8888) {
component_num = 1;
} else if (format == MPP_FMT_RGB_888) {
component_num = 1;
} else if (format == MPP_FMT_YUV420P) {
component_num = 3;
} else if (format == MPP_FMT_NV12 || format == MPP_FMT_NV21) {
component_num = 2;
} else if (format == MPP_FMT_YUV444P) {
component_num = 3;
} else if (format == MPP_FMT_YUV422P) {
component_num = 3;
} else if (format == MPP_FMT_YUV400) {
component_num = 1;
} else {
loge("no support picture foramt %d, default argb8888", format);
}
return component_num;
if (format == MPP_FMT_ARGB_8888) {
component_num = 1;
} else if (format == MPP_FMT_RGBA_8888) {
component_num = 1;
} else if (format == MPP_FMT_RGB_888) {
component_num = 1;
} else if (format == MPP_FMT_YUV420P) {
component_num = 3;
} else if (format == MPP_FMT_NV12 || format == MPP_FMT_NV21) {
component_num = 2;
} else if (format == MPP_FMT_YUV444P) {
component_num = 3;
} else if (format == MPP_FMT_YUV422P) {
component_num = 3;
} else if (format == MPP_FMT_YUV400) {
component_num = 1;
} else {
loge("no support picture foramt %d, default argb8888", format);
}
return component_num;
}
static s32 fb_video_render_rend(struct aic_video_render *render,struct mpp_frame *frame_info)
@ -250,6 +265,161 @@ static s32 fb_video_render_get_on_off(struct aic_video_render *render,s32 *enabl
return 0;
}
static int fb_video_render_last_frame_alloc(struct mpp_frame *frame)
{
int dma_fd = -1;
if (frame == NULL) {
loge("frame is null\n");
return -1;
}
dma_fd = dmabuf_device_open();
if (dma_fd < 0) {
loge("dmabuf_device_open error dma_fd:%d \n", dma_fd);
return -1;
}
if (mpp_buf_alloc(dma_fd, &frame->buf) < 0) {
loge("mpp_buf_alloc frame buf error dma_fd.\n");
dmabuf_device_close(dma_fd);
return -1;
}
return dma_fd;
}
static s32 fb_video_render_last_frame_free(struct mpp_frame* frame, int dma_fd)
{
if (frame == NULL || dma_fd <= 0) {
loge("frame free error frame:%p, dma_fd:%d.\n", frame, dma_fd);
return -1;
}
mpp_buf_free(&frame->buf);
dmabuf_device_close(dma_fd);
return 0;
}
static s32 fb_video_render_last_frame_copy(struct mpp_buf *src_buf, struct mpp_frame *dest_frame)
{
s32 ret = 0;
struct mpp_ge *ge = NULL;
struct ge_bitblt blt;
int i = 0;
int comp_num = 0;
ge = mpp_ge_open();
if (!ge) {
printf("open ge device error\n");
return -1;
}
comp_num = get_component_num(src_buf->format);
memset(&blt, 0, sizeof(struct ge_bitblt));
memcpy(&blt.src_buf, src_buf, sizeof(struct mpp_buf));
memcpy(&blt.dst_buf, &dest_frame->buf, sizeof(struct mpp_buf));
for (i = 0; i < comp_num; i++) {
mpp_ge_add_dmabuf(ge, src_buf->fd[i]);
mpp_ge_add_dmabuf(ge, dest_frame->buf.fd[i]);
}
ret = mpp_ge_bitblt(ge, &blt);
if (ret < 0) {
printf("ge bitblt fail\n");
goto exit;
}
ret = mpp_ge_emit(ge);
if (ret < 0) {
printf("ge emit fail\n");
goto exit;
}
ret = mpp_ge_sync(ge);
if (ret < 0) {
printf("ge sync fail\n");
}
exit:
for (i = 0; i < comp_num; i++) {
mpp_ge_rm_dmabuf(ge, src_buf->fd[i]);
mpp_ge_rm_dmabuf(ge, dest_frame->buf.fd[i]);
}
if (ge)
mpp_ge_close(ge);
return ret;
}
static s32 fb_video_render_rend_last_frame(struct aic_video_render *render, s32 enable)
{
s32 ret = 0;
struct mpp_frame cur_frame;
struct aic_fb_video_render *fb_render = (struct aic_fb_video_render *)render;
if (fb_render == NULL) {
loge("fb_render is not initialization!");
return -1;
}
if (enable) {
/*step1: malloc empty for last frame*/
memcpy(&cur_frame.buf, &fb_render->layer.buf, sizeof(struct mpp_buf));
/*the first frame need malloc buf for last frame*/
if (!g_last_frame.enable) {
logi("%s:alloc last frame firsttime, enable:%d.\n", __func__, enable);
memset(&g_last_frame.frame, 0, sizeof(struct mpp_frame));
g_last_frame.dma_fd = fb_video_render_last_frame_alloc(&cur_frame);
if (g_last_frame.dma_fd < 0) {
loge("fb_video_render_last_frame_alloc failed.\n");
return -1;
}
memcpy(&g_last_frame.frame, &cur_frame, sizeof(struct mpp_frame));
} else {
/*the frame resolution changed need realloc buf for last frame*/
if ((g_last_frame.frame.buf.size.height != cur_frame.buf.size.height) ||
(g_last_frame.frame.buf.size.width != cur_frame.buf.size.width)) {
logi("free last frame and alloc next frame.\n");
fb_video_render_last_frame_free(&g_last_frame.frame, g_last_frame.dma_fd);
g_last_frame.dma_fd = fb_video_render_last_frame_alloc(&cur_frame);
if (g_last_frame.dma_fd < 0) {
loge("fb_video_render_last_frame_alloc failed.\n");
return -1;
}
memcpy(&g_last_frame.frame, &cur_frame, sizeof(struct mpp_frame));
}
}
logi("fb_video_render_last_frame_copy.\n");
/*step2: copy frame data to last frame*/
fb_video_render_last_frame_copy(&fb_render->layer.buf, &g_last_frame.frame);
/*step3: display last frame*/
fb_video_render_rend(render, &g_last_frame.frame);
} else {
if (g_last_frame.enable) {
logi("%s:reclaim the final last frame, enable:%d.\n", __func__, enable);
/*reclaim the end last frame*/
ret = fb_video_render_last_frame_free(&g_last_frame.frame, g_last_frame.dma_fd);
if (ret) {
loge("fb_video_render_last_frame_free error %d.", ret);
return ret;
}
memset(&g_last_frame.frame, 0, sizeof(struct mpp_frame));
}
}
g_last_frame.enable = enable;
return ret;
}
s32 aic_video_render_create(struct aic_video_render **render)
{
struct aic_fb_video_render * fb_render;
@ -270,6 +440,7 @@ s32 aic_video_render_create(struct aic_video_render **render)
fb_render->base.set_on_off = fb_video_render_set_on_off;
fb_render->base.get_on_off = fb_video_render_get_on_off;
fb_render->base.get_screen_size = get_screen_size;
fb_render->base.rend_last_frame = fb_video_render_rend_last_frame;
*render = &fb_render->base;
return 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@ -59,6 +59,7 @@ typedef enum MM_INDEX_TYPE {
MM_INDEX_VENDOR_AUDIO_RENDER_VOLUME,
MM_INDEX_VENDOR_DEMUXER_SKIP_TRACK,
MM_INDEX_VENDOR_VIDEO_RENDER_CAPTURE,
MM_INDEX_VENDOR_VIDEO_RENDER_KEEP_LAST_FRAME,
MM_INDEX_VENDOR_MUXER_RECORD_FILE_INFO,
} MM_INDEX_TYPE;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@ -125,11 +125,11 @@ static int mm_video_render_free_dma_buffer(struct mpp_frame* p_frame,int dma_fd)
if (p_frame->buf.fd[0] > 0) {
dmabuf_free(p_frame->buf.fd[0]);
}
if (p_frame->buf.fd[0] > 0) {
dmabuf_free(p_frame->buf.fd[0]);
if (p_frame->buf.fd[1] > 0) {
dmabuf_free(p_frame->buf.fd[1]);
}
if (p_frame->buf.fd[0] > 0) {
dmabuf_free(p_frame->buf.fd[0]);
if (p_frame->buf.fd[2] > 0) {
dmabuf_free(p_frame->buf.fd[2]);
}
dmabuf_device_close(dma_fd);
return 0;
@ -1211,6 +1211,17 @@ static s32 mm_video_render_set_parameter(mm_handle h_component,
((mm_config_rect *)p_param)->height;
p_video_render_data->dis_rect_change = MM_TRUE;
break;
case MM_INDEX_VENDOR_VIDEO_RENDER_KEEP_LAST_FRAME:
if (!p_video_render_data->render) {
loge("video render is not initialization!!!\n");
return MM_ERROR_INSUFFICIENT_RESOURCES;
}
error = aic_video_render_rend_last_frame(p_video_render_data->render,
(s32)(((mm_param_u32 *)p_param)->u32));
if (error != 0)
loge("aic_video_render_rend_last_frame error %d!!!\n", error);
break;
default:
break;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@ -68,6 +68,7 @@ struct aic_player {
s32 rotation_angle;
s8 mute;
s8 seeking;
s8 video_render_keep_last_frame;
};
@ -940,6 +941,13 @@ s32 aic_player_stop(struct aic_player *player)
if (player->media_info.has_video) {
if (player->video_render_handle) {
mm_param_u32 params;
params.u32 = (u32)player->video_render_keep_last_frame;
if (MM_ERROR_NONE != mm_set_parameter(player->video_render_handle,
MM_INDEX_VENDOR_VIDEO_RENDER_KEEP_LAST_FRAME,
&params)) {
loge("set video render keep last frame failed.\n");
}
mm_free_handle(player->video_render_handle);
player->video_render_handle = NULL;
}
@ -1200,3 +1208,22 @@ s32 aic_player_get_rotation(struct aic_player *player)
return rotation.rotation;
}
s32 aic_player_control(struct aic_player *player, enum aic_player_command cmd, void *data)
{
s32 ret = 0;
switch (cmd) {
case AIC_PLAYER_CMD_SET_VIDEO_RENDER_KEEP_LAST_FRAME: {
if (!data) {
loge("video render set last frame data is null\n");
return -1;
}
player->video_render_keep_last_frame = *(s8 *)data;
break;
}
default:
return -1;
}
return ret;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@ -30,6 +30,9 @@ enum aic_player_event {
AIC_PLAYER_EVENT_DEMUXER_FORMAT_NOT_DETECTED
};
enum aic_player_command {
AIC_PLAYER_CMD_SET_VIDEO_RENDER_KEEP_LAST_FRAME,
};
// now do not support setting nWidth and nHeight,just only support setting pFilePath
struct aic_capture_info {
s8 *file_path;
@ -108,6 +111,8 @@ s32 aic_player_set_rotation(struct aic_player *player, int rotation_angle);
s32 aic_player_get_rotation(struct aic_player *player);
s32 aic_player_control(struct aic_player *player, enum aic_player_command cmd, void *data);
#ifdef __cplusplus
#if __cplusplus
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 ArtInChip Technology Co. Ltd
* Copyright (C) 2020-2025 ArtInChip Technology Co. Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
@ -392,6 +392,34 @@ static int process_command(struct video_player_ctx *player_ctx,char cmd)
return ret;
}
static int player_demo_prepare_stop(struct video_player_ctx *ctx, int force_stop,
int loop_time, int file_num)
{
int enable = 0;
/*force stop need set render delay disable*/
if (force_stop && (ctx->loop_time > 1 || ctx->files.file_num > 1)) {
enable = 0;
aic_player_control(ctx->player, AIC_PLAYER_CMD_SET_VIDEO_RENDER_KEEP_LAST_FRAME, &enable);
return 0;
}
/*check the final play file then set render delay disable*/
if ((ctx->loop_time > 1) && (ctx->files.file_num > 1)) {
if ((loop_time == ctx->loop_time - 1) && (file_num == ctx->files.file_num -1)) {
enable = 0;
aic_player_control(ctx->player, AIC_PLAYER_CMD_SET_VIDEO_RENDER_KEEP_LAST_FRAME, &enable);
}
} else if ((ctx->loop_time > 1) && (loop_time == ctx->loop_time - 1)) {
enable = 0;
aic_player_control(ctx->player, AIC_PLAYER_CMD_SET_VIDEO_RENDER_KEEP_LAST_FRAME, &enable);
} else if ((ctx->files.file_num > 1) && (file_num == ctx->files.file_num - 1)) {
enable = 0;
aic_player_control(ctx->player, AIC_PLAYER_CMD_SET_VIDEO_RENDER_KEEP_LAST_FRAME, &enable);
}
return 0;
}
int main(int argc,char*argv[])
{
int ret = 0;
@ -400,6 +428,7 @@ int main(int argc,char*argv[])
char buffer[BUFFER_LEN];
int flag;
static int fd_dev;
int enable = 0;
struct aicfb_alpha_config alpha_bak = {0};
struct aicfb_alpha_config alpha = {0};
struct video_player_ctx *ctx = NULL;
@ -441,6 +470,10 @@ int main(int argc,char*argv[])
flag = fcntl(STDIN_FILENO,F_GETFL);
flag |= O_NONBLOCK;
fcntl(STDIN_FILENO,F_SETFL,flag);
if (ctx->loop_time > 1 || ctx->files.file_num > 1) {
enable = 1;
aic_player_control(ctx->player, AIC_PLAYER_CMD_SET_VIDEO_RENDER_KEEP_LAST_FRAME, &enable);
}
for(i = 0;i < ctx->loop_time; i++) {
for(j = 0; j < ctx->files.file_num; j++) {
@ -448,11 +481,13 @@ int main(int argc,char*argv[])
ctx->player_end = 0;
if (aic_player_set_uri(ctx->player,ctx->files.file_path[j])) {
loge("aic_player_prepare error!!!!\n");
player_demo_prepare_stop(ctx, 0, i, j);
aic_player_stop(ctx->player);
continue;
}
if (aic_player_prepare_sync(ctx->player)) {
player_demo_prepare_stop(ctx, 0, i, j);
loge("aic_player_prepare error!!!!\n");
aic_player_stop(ctx->player);
continue;
@ -460,6 +495,7 @@ int main(int argc,char*argv[])
if (start_play(ctx) != 0) {
loge("start_play error!!!!\n");
player_demo_prepare_stop(ctx, 0, i, j);
aic_player_stop(ctx->player);
continue;
}
@ -467,6 +503,7 @@ int main(int argc,char*argv[])
while(1) {
if (ctx->player_end == 1) {
logd("play file:%s end!!!!\n",ctx->files.file_path[j]);
player_demo_prepare_stop(ctx, 0, i, j);
ret = aic_player_stop(ctx->player);
ctx->player_end = 0;
break;
@ -478,9 +515,11 @@ int main(int argc,char*argv[])
aic_player_stop(ctx->player);
break;
} else if (buffer[0] == 'd') {// down
player_demo_prepare_stop(ctx, 0, i, j);
aic_player_stop(ctx->player);
break;
} else if (buffer[0] == 'e') {// end
player_demo_prepare_stop(ctx, 1, i, j);
aic_player_stop(ctx->player);
goto _EXIT_;
}

View File

@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
# include_directories(include)
# Install
# install directories
add_executable(http_wificonfig http.c)
target_link_libraries(http_wificonfig wifimanager wpa_client)
if(NOT CMAKE_INSTALL_PREFIX)
message(FATAL_ERROR "ERROR: CMAKE_INSTALL_PREFIX is not defined.")
endif()
include(GNUInstallDirs)
install(TARGETS http_wificonfig DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY html DESTINATION ${TARGET_DIR}/var/http_wificonfig)
install(FILES config/hostapd.conf DESTINATION ${TARGET_DIR}/etc/http_wificonfig)
install(FILES config/udhcpd.conf DESTINATION ${TARGET_DIR}/etc/http_wificonfig)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
start 192.168.1.2
end 169.168.1.254
interface wlan1

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>config fail</title>
<!-- <style>
body {
background-image: url('aic.jpg');
background-size: cover;
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.login-container {
background-color: rgba(255, 255, 255, 0.6);
padding: 30px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
.login-container h2 {
text-align: center;
margin-bottom: 20px;
}
.form-group {
margin-bottom: 15px;
}
</style> -->
</head>
<body>
<script>alert('SSID or PASSWORD error! reconfigure again'); window.location='/index.html';</script>
</body>
</html>

View File

@ -0,0 +1,105 @@
<!DOCTYPE html>
<html>
<head>
<title>http-wificonfig</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background-image: url('Aicast.jpg');
background-size: cover;
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.login-container {
background-color: rgba(255, 255, 255, 0.8);
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
max-width: 300px;
width: 90%;
box-sizing: border-box;
}
.login-container h2 {
text-align: center;
margin-bottom: 20px;
font-size: 1.5em;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-size: 1em;
}
.form-group input {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
box-sizing: border-box;
font-size: 1em;
}
.submit-btn {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1em;
}
.submit-btn:hover {
background-color: #45a049;
}
@media (max-width: 600px) {
.login-container {
padding: 15px;
}
.login-container h2 {
font-size: 1.2em;
margin-bottom: 15px;
}
.form-group label, .form-group input, .submit-btn {
font-size: 0.9em;
}
}
</style>
</head>
<body>
<div class="login-container">
<h2>WIFI CONFIGURATION</h2>
<form action="result.html" method="post">
<div class="form-group">
<label for="ssid">SSID:</label>
<input type="text" id="ssid" name="ssid" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
</div>
<div class="show-password">
<input type="checkbox" id="showPassword"> Show Password
</div>
<button type="submit" class="submit-btn">Config</button>
</form>
</div>
<script>
const showPasswordCheckbox = document.getElementById('showPassword');
const passwordInput = document.getElementById('password');
showPasswordCheckbox.addEventListener('change', function() {
if (this.checked) {
passwordInput.type = 'text';
} else {
passwordInput.type = 'password';
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>WiFi sucess</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: Arial, sans-serif;
background-image: url('Aicast.jpg');
background-size: cover;
background-attachment: fixed;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
padding: 20px;
box-sizing: border-box;
}
.result-container {
background-color: rgba(255, 255, 255, 0.9);
padding: 30px 40px;
border-radius: 10px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
text-align: center;
max-width: 500px;
width: 100%;
}
.success-message {
color: #4CAF50;
font-size: 2em;
margin-bottom: 20px;
text-transform: uppercase;
letter-spacing: 1px;
}
.countdown {
color: #333;
font-size: 1.5em;
margin: 10px 0;
}
@media (max-width: 600px) {
.result-container {
padding: 20px;
}
.success-message {
font-size: 1.5em;
}
.countdown {
font-size: 1.2em;
}
}
</style>
</head>
<body>
<div class="result-container">
<div class="success-message">WiFi Configure Sucess</div>
<div class="countdown" id="countdown">Will be closed after <span id="seconds">10</span> Second </div>
</div>
<script>
let countdown = 10;
const countdownElement = document.getElementById('countdown');
const secondsElement = document.getElementById('seconds');
const interval = setInterval(() => {
countdown--;
secondsElement.textContent = countdown;
if (countdown <= 0) {
clearInterval(interval);
// window.location.href = 'https://example.com';
countdownElement.textContent = "Wifi configuration has been closed";
}
}, 1000);
</script>
</body>
</html>

View File

@ -0,0 +1,660 @@
// SPDX-License-Identifier: Apache-2.0
/*
* Copyright (C) 2025 Artinchip Technology Co., Ltd.
* Authors: wulv <lv.wu@artinchip.com>
*/
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include "wifimanager.h"
#define SERVER_STRING "Server: artinchiphttpd/0.1.0\r\n"
#define SERVER_PORT 80
#define HTML_DEFAULT "/var/http_wificonfig/html/"
#define WIFI_CONNECT_TIMEOUT_S 15
struct stat st;
static int get_line(int sock, char *buff, int size);
static void handle_get(int sock, char *url);
static int handle_post(int sock, char *url);
int do_http(int sock);
void not_found(int sock);
void responce_headers(int sock, FILE *file);
void responce_bodys(int sock, FILE *file);
void unimplement(int sock);
void do_responce(int sock, const char *path);
enum
{
HTTP_WIFICONFIG_ERROR = 0,
HTTP_WIFICONFIG_WARNING,
HTTP_WIFICONFIG_INFO,
HTTP_WIFICONFIG_DEBUG,
};
static int debug_level = HTTP_WIFICONFIG_INFO;
void http_wificonfig_debug(int level, const char *fmt, ...)
{
va_list args;
if (level > debug_level)
return;
va_start(args, fmt);
printf("[http_wificonfig]: ");
vprintf(fmt, args);
va_end(args);
}
static int get_line(int sock, char *buff, int size)
{
int count = 0;
char ch = '\0';
int len = 0;
while (count < size - 1 && ch != '\n')
{
len = read(sock, &ch, 1);
if (len == 1)
{
if (ch == '\r')
{
continue;
}
else if (ch == '\n')
{
break;
}
buff[count] = ch;
count++;
}
else if (len == -1)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "read error\n");
count = -1;
break;
}
else
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "client error\n");
count = -1;
break;
}
}
if (count >= 0)
buff[count] = '\0';
return count;
}
static void handle_get(int sock, char *url)
{
int len = 0;
char buff[512];
char path[128];
snprintf(path, 127, HTML_DEFAULT "%s", url);
http_wificonfig_debug(HTTP_WIFICONFIG_DEBUG, "method: GET \n ");
do
{
len = get_line(sock, buff, sizeof(buff));
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "%s\n", buff);
} while (len > 0);
if (stat(path, &st) == -1)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "The file: %s is not exist!\n", path);
not_found(sock);
}
else
{
do_responce(sock, path);
}
}
static void bad_request(int client)
{
char buf[128];
snprintf(buf, 127, "HTTP/1.0 400 BAD REQUEST\r\n");
send(client, buf, sizeof(buf), 0);
snprintf(buf, 127, "Content-type: text/html\r\n");
send(client, buf, sizeof(buf), 0);
snprintf(buf, 127, "\r\n");
send(client, buf, sizeof(buf), 0);
snprintf(buf, 127, "<P>Your browser sent a bad request, ");
send(client, buf, sizeof(buf), 0);
snprintf(buf, 127, "such as a POST without a Content-Length.\r\n");
send(client, buf, sizeof(buf), 0);
}
static int hex_to_char(char c)
{
if (c >= '0' && c <= '9')
return c - '0';
if (c >= 'A' && c <= 'F')
return c - 'A' + 10;
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
return -1;
}
static char *url_decode(const char *str)
{
if (str == NULL)
return NULL;
size_t len = strlen(str);
char *decoded = (char *)malloc(len + 1);
if (decoded == NULL)
return NULL;
size_t i = 0, j = 0;
while (str[i] != '\0')
{
if (str[i] == '%' && str[i + 1] != '\0' && str[i + 2] != '\0')
{
int high = hex_to_char(str[i + 1]);
int low = hex_to_char(str[i + 2]);
if (high != -1 && low != -1)
{
decoded[j++] = (char)((high << 4) | low);
i += 3;
continue;
}
else
{
decoded[j++] = str[i++];
}
}
else
{
decoded[j++] = str[i++];
}
}
decoded[j] = '\0';
return decoded;
}
static int parse_wificonfig_info(char *buff, char *ssid, char *password)
{
char *ptr = NULL;
int i;
char *decode = NULL;
decode = url_decode(buff);
if (!decode)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "decode error\n");
return -1;
}
ptr = strstr(decode, "ssid=");
if (ptr == NULL)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "Can't get ssid info\n");
free(decode);
return -1;
}
ptr += 5;
for (i = 0; *ptr != '&' && i < 64; i++)
{
ssid[i] = *ptr;
ptr++;
}
ssid[i] = '\0';
ptr = strstr(ptr, "password=");
if (ptr == NULL)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "Can't get password info\n");
free(decode);
return -1;
}
ptr += 9;
for (i = 0; *ptr != '\0' && i < 64; i++)
{
password[i] = *ptr;
ptr++;
}
password[i] = '\0';
http_wificonfig_debug(HTTP_WIFICONFIG_INFO, "ssid = %s\n password = %s\n", ssid, password);
free(decode);
return 0;
}
static int handle_post(int sock, char *url)
{
int len = 0;
char buff[128];
char *ptr = NULL;
char ssid[32];
char password[64];
int content_length = -1;
int ret = 0;
http_wificonfig_debug(HTTP_WIFICONFIG_INFO, "method: POST \n ");
do
{
len = get_line(sock, buff, sizeof(buff));
if (len < 0)
return 0;
if (len == 0 && content_length != -1)
{
http_wificonfig_debug(HTTP_WIFICONFIG_DEBUG, "content_length == %d\n", content_length);
len = recv(sock, buff, content_length, 0);
if (len <= 0)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "recv post request body filed\n");
content_length = -1;
}
else
{
buff[content_length] = '\0';
}
http_wificonfig_debug(HTTP_WIFICONFIG_DEBUG, "POST:body: %s\n", buff);
break;
}
http_wificonfig_debug(HTTP_WIFICONFIG_DEBUG, "%s\n", buff);
ptr = strstr(buff, "Content-Length:");
if (ptr != NULL)
{
content_length = atoi(&(ptr[16]));
}
} while (len > 0);
if (content_length == -1)
{
bad_request(sock);
return 0;
}
ret = parse_wificonfig_info(buff, ssid, password);
if (ret != 0)
{
bad_request(sock);
return 0;
}
wifi_status_t status;
memset(&status, 0, sizeof(wifi_status_t));
int timeout = WIFI_CONNECT_TIMEOUT_S;
char new_path[64];
wifimanager_connect(ssid, password);
do
{
sleep(1);
wifimanager_get_status(&status);
if (status.state == WIFI_STATE_GOT_IP || status.state == WIFI_STATE_CONNECTED)
break;
} while (timeout-- > 0);
if (timeout > 0)
snprintf(new_path, 63, HTML_DEFAULT "success_%s", url);
else
snprintf(new_path, 63, HTML_DEFAULT "fail_%s", url);
http_wificonfig_debug(HTTP_WIFICONFIG_DEBUG, "path:%s\n", new_path);
if (stat(new_path, &st) == -1)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "The file: %s is not exist!\n", new_path);
not_found(sock);
}
do_responce(sock, new_path);
if (timeout > 0)
{
sleep(10);
system("killall hostapd");
system("killall udhcpd");
return 1;
}
return 0;
}
int do_http(int sock)
{
int len = 0;
char buff[512];
char url[256];
char method[64];
char path[256];
len = get_line(sock, buff, sizeof(buff));
int i = 0, j = 0;
if (len > 0)
{
while (!isspace(buff[j]) && i < sizeof(method) - 1)
{
method[i] = buff[j];
i++;
j++;
}
method[i] = '\0';
http_wificonfig_debug(HTTP_WIFICONFIG_DEBUG, "request method:%s\n", method);
}
while (isspace(buff[j++])) {}
i = 0;
while (!isspace(buff[j]) && i < sizeof(url) - 1)
{
url[i] = buff[j];
i++;
j++;
}
url[i] = '\0';
char *p = strchr(url, '?');
if (p)
*p = '\0';
if (url[0] == '\0' || url[0] == '/')
strcat(url, "index.html");
http_wificonfig_debug(HTTP_WIFICONFIG_INFO, "actual url:%s\n", url);
if (strncasecmp(method, "GET", i) == 0)
{
handle_get(sock, url);
}
else if (strncasecmp(method, "POST", i) == 0)
{
return handle_post(sock, url);
}
else
{
fprintf(stderr, "warning! other request:%s\n !", method);
do
{
len = get_line(sock, buff, sizeof(buff));
http_wificonfig_debug(HTTP_WIFICONFIG_DEBUG, "read:%s\n", buff);
} while (len > 0);
unimplement(sock);
}
return 0;
}
/**********************************************************************/
/* Give a client a 404 not found status message. */
/**********************************************************************/
void not_found(int sock)
{
char buf[128];
snprintf(buf, 127, "HTTP/1.0 404 NOT FOUND\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, SERVER_STRING);
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "Content-Type: text/html\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "<HTML><TITLE>Not Found</TITLE>\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "<BODY><P>The server could not fulfill\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "your request because the resource specified\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "is unavailable or nonexistent.\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "</BODY></HTML>\r\n");
send(sock, buf, strlen(buf), 0);
}
void responce_headers(int sock, FILE *file)
{
struct stat st1;
char buff[1024] = {0};
char temp[64];
const char *head = "HTTP/1.0 200 OK\r\nServer:ArtInChip Private Server\r\nContent-Type: text/html\r\nConnection: Close\r\n";
strcpy(buff, head);
int fd = fileno(file);
fstat(fd, &st1);
int size = st1.st_size;
snprintf(temp, 63, "Content-Length:%d\r\n\r\n", size);
strcat(buff, temp);
write(sock, buff, strlen(buff));
http_wificonfig_debug(HTTP_WIFICONFIG_DEBUG, "%s\n", buff);
}
void responce_bodys(int sock, FILE *file)
{
fseek(file, 0, SEEK_END);
long fileSize = ftell(file);
rewind(file);
char *buffer = (char *)malloc(fileSize);
if (buffer == NULL)
{
perror("Failed to allocate memory");
return;
}
fread(buffer, 1, fileSize, file);
write(sock, buffer, fileSize);
free(buffer);
}
void unimplement(int sock)
{
char buf[128];
snprintf(buf, 127, "HTTP/1.0 501 Method Not Implemented\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, SERVER_STRING);
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "Content-Type: text/html\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "<HTML><HEAD><TITLE>Method Not Implemented\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "</TITLE></HEAD>\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "<BODY><P>HTTP request method not supported.\r\n");
send(sock, buf, strlen(buf), 0);
snprintf(buf, 127, "</BODY></HTML>\r\n");
send(sock, buf, strlen(buf), 0);
}
void do_responce(int sock, const char *path)
{
FILE *resource = NULL;
resource = fopen(path, "r");
if (resource == NULL)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "open file %s\n error!\n", path);
not_found(sock);
return;
}
responce_headers(sock, resource);
responce_bodys(sock, resource);
fclose(resource);
}
static const char *wifistate2string(wifistate_t state)
{
switch (state)
{
case WIFI_STATE_GOT_IP:
return "WIFI_STATE_GOT_IP";
case WIFI_STATE_CONNECTING:
return "WIFI_STATE_CONNECTING";
case WIFI_STATE_DHCPC_REQUEST:
return "WIFI_STATE_DHCPC_REQUEST";
case WIFI_STATE_DISCONNECTED:
return "WIFI_STATE_DISCONNECTED";
case WIFI_STATE_CONNECTED:
return "WIFI_STATE_CONNECTED";
default:
return "WIFI_STATE_ERROR";
}
}
static const char *disconn_reason2string(wifimanager_disconn_reason_t reason)
{
switch (reason)
{
case AUTO_DISCONNECT:
return "wpa auto disconnect";
case ACTIVE_DISCONNECT:
return "active disconnect";
case KEYMT_NO_SUPPORT:
return "keymt is not supported";
case CMD_OR_PARAMS_ERROR:
return "wpas command error";
case IS_CONNECTTING:
return "wifi is still connecting";
case CONNECT_TIMEOUT:
return "connect timeout";
case REQUEST_IP_TIMEOUT:
return "request ip address timeout";
case WPA_TERMINATING:
return "wpa_supplicant is closed";
case AP_ASSOC_REJECT:
return "AP assoc reject";
case NETWORK_NOT_FOUND:
return "can't search such ssid";
case PASSWORD_INCORRECT:
return "incorrect password";
default:
return "other reason";
}
}
static void print_scan_result(char *result)
{
http_wificonfig_debug(HTTP_WIFICONFIG_INFO, "%s\n", result);
}
static void print_stat_change(wifistate_t stat, wifimanager_disconn_reason_t reason)
{
http_wificonfig_debug(HTTP_WIFICONFIG_INFO, "%s\n", wifistate2string(stat));
if (stat == WIFI_STATE_DISCONNECTED)
http_wificonfig_debug(HTTP_WIFICONFIG_INFO, "disconnect reason: %s\n", disconn_reason2string(reason));
}
int main(int argc, char *argv[])
{
int server_sock = -1;
struct sockaddr_in server_addr;
int ret;
int on = 1;
wifimanager_cb_t cb = {
.scan_result_cb = print_scan_result,
.stat_change_cb = print_stat_change,
};
bzero(&server_addr, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
server_addr.sin_port = htons(SERVER_PORT);
server_sock = socket(AF_INET, SOCK_STREAM, 0);
if (server_sock < 0)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "socket failed\n");
return -1;
}
if ((setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &on, sizeof(on))) < 0)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "setsockopt failed\n");
close(server_sock);
return -1;
}
if (bind(server_sock, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "bind failed\n");
close(server_sock);
return -1;
}
if (listen(server_sock, 5) < 0)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "listen failed\n");
close(server_sock);
return -1;
}
wifimanager_init(&cb);
system("hostapd -d /etc/http_wificonfig/hostapd.conf -B");
// sleep(1);
system("ifconfig wlan1 192.168.1.1");
system("udhcpd /etc/http_wificonfig/udhcpd.conf");
while (1)
{
struct sockaddr_in client_addr;
int client_sock;
char buff[64];
int client_length = sizeof(client_addr);
client_sock = accept(server_sock, (struct sockaddr *)&client_addr, &client_length);
if (client_sock == -1)
{
http_wificonfig_debug(HTTP_WIFICONFIG_ERROR, "accept error\n");
close(server_sock);
return -1;
}
http_wificonfig_debug(HTTP_WIFICONFIG_INFO, "client ip:%s\t port:%d\n ",
inet_ntop(AF_INET, &client_addr.sin_addr.s_addr, buff, sizeof(buff)),
ntohs(client_addr.sin_port));
ret = do_http(client_sock);
close(client_sock);
/* wifi configration success, exit! */
if (ret)
{
close(server_sock);
break;
}
}
return 0;
}

View File

@ -11,6 +11,7 @@ if(DEFINED LVGL_FBDEV)
if(${LVGL_FBDEV} STREQUAL "yes")
set(APP_FOLDER ${DEMO_FOLDER}/base_demo)
#set(APP_FOLDER ${DEMO_FOLDER}/hub_demo)
#set(APP_FOLDER ${DEMO_FOLDER}/lyrics_demo)
endif()
endif()
@ -47,6 +48,10 @@ add_compile_options(-Wall)
add_definitions(-DLV_USE_CONF_CUSTOM)
if(DEFINED BUILD_DIR)
message(NOTICE ${BUILD_DIR})
endif()
# set custom config path, used by lvgl library
set(LV_CONF_CUSTOM_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${APP_FOLDER})
@ -59,6 +64,12 @@ include(GNUInstallDirs)
### build lvgl library
add_subdirectory(${LVGL_LIB_PATH}/lvgl)
option(BUILD_LYRICS_LIBS "Build lyrics_effect library" OFF)
option(BUILD_RELEASE_LIBS "Release lyrics_effect library" OFF)
### build aic widget library
add_subdirectory(aic_widgets)
# lvgl HAL source
set(LVGL_DRIVER_PATH fbdev)
@ -105,6 +116,16 @@ add_executable(${APP_OUT_NAME} ${APP_SOURCE_FILES})
target_link_libraries(${APP_OUT_NAME} lvgl)
target_link_libraries(${APP_OUT_NAME} lvgl_examples)
target_link_libraries(${APP_OUT_NAME} lvgl_demos)
target_link_libraries(${APP_OUT_NAME} aic_widgets)
if(DEFINED LVGL_V_9)
if(${LVGL_V_9} STREQUAL "yes" AND BUILD_LYRICS_LIBS)
if(BUILD_RELEASE_LIBS)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/aic_widgets/lyrics_effect)
endif()
target_link_libraries(${APP_OUT_NAME} lyrics_effect)
endif()
endif()
if(DEFINED LVGL_FBDEV)
if(${LVGL_FBDEV} STREQUAL "yes")

View File

@ -0,0 +1,226 @@
/*
* Copyright (c) 2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Zequan Liang <zequan.liang@artinchip.com>
*/
#include "aic_ui.h"
#include "lvgl.h"
#include "lv_aic_player.h"
#define CHECK_CONDITION_RETURN_VOID(confition, ...) \
if (confition) { __VA_ARGS__; return; }
static bool g_del_player = false;
static bool g_playing = false;
static void print_del(void)
{
printf("lv_aic_player have been deleted\n");
}
static void scale_player_cb(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * player = lv_event_get_user_data(e);
lv_obj_t * slider = lv_event_get_current_target(e);
if (code == LV_EVENT_VALUE_CHANGED) {
CHECK_CONDITION_RETURN_VOID(g_del_player, print_del());
int32_t value = lv_slider_get_value(slider);
lv_aic_player_set_scale(player, value);
}
}
static void rotate_player_cb(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * player = lv_event_get_user_data(e);
lv_obj_t * slider = lv_event_get_current_target(e);
if (code == LV_EVENT_VALUE_CHANGED) {
CHECK_CONDITION_RETURN_VOID(g_del_player, print_del());
int32_t value = lv_slider_get_value(slider);
lv_aic_player_set_rotation(player, value);
}
}
static void start_button_handler(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * player = lv_event_get_user_data(e);
if (code == LV_EVENT_CLICKED) {
CHECK_CONDITION_RETURN_VOID(g_del_player, print_del());
lv_aic_player_set_cmd(player, LV_AIC_PLAYER_CMD_START, NULL);
g_playing = true;
}
}
static void pause_button_handler(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * player= lv_event_get_user_data(e);
if (code == LV_EVENT_CLICKED) {
CHECK_CONDITION_RETURN_VOID(g_del_player, print_del());
lv_aic_player_set_cmd(player, LV_AIC_PLAYER_CMD_PAUSE, NULL);
g_playing = false;
}
}
static void resume_button_handler(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * player= lv_event_get_user_data(e);
if (code == LV_EVENT_CLICKED) {
CHECK_CONDITION_RETURN_VOID(g_del_player, print_del());
lv_aic_player_set_cmd(player, LV_AIC_PLAYER_CMD_RESUME, NULL);
}
}
static void seek_button_handler(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * player= lv_event_get_user_data(e);
if (code == LV_EVENT_CLICKED) {
CHECK_CONDITION_RETURN_VOID(g_del_player, print_del());
u64 seek = 0;
lv_aic_player_set_cmd(player, LV_AIC_PLAYER_CMD_SET_PLAY_TIME, &seek);
}
}
static void auto_restart_button_handler(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * player = lv_event_get_user_data(e);
lv_obj_t * btn = lv_event_get_current_target(e);
if (code == LV_EVENT_CLICKED) {
CHECK_CONDITION_RETURN_VOID(g_del_player, print_del());
lv_aic_player_set_auto_restart(player, true);
lv_obj_clear_flag(btn, LV_OBJ_FLAG_CLICKABLE);
lv_obj_set_style_bg_color(btn, lv_color_black(), 0);
}
}
static void del_button_handler(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * player= lv_event_get_user_data(e);
if (code == LV_EVENT_CLICKED) {
CHECK_CONDITION_RETURN_VOID(g_del_player, print_del());
lv_obj_del(player);
g_del_player = true;
}
}
static void next_button_handler(lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * player= lv_event_get_user_data(e);
static int cur_video = 0;
if (code == LV_EVENT_CLICKED) {
CHECK_CONDITION_RETURN_VOID(g_del_player, print_del());
if (cur_video == 0)
lv_aic_player_set_src(player, LVGL_PATH(cartoon_mjpeg.mp4));
else
lv_aic_player_set_src(player, LVGL_PATH(elevator_mjpeg.mp4));
if (g_playing)
lv_aic_player_set_cmd(player, LV_AIC_PLAYER_CMD_START, NULL);
cur_video = cur_video == 0 ? 1 :0;
}
}
static void move_player_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t *obj = lv_event_get_target(e);
/* LV_OBJ_FLAG_USER_4 flag is used to record whether there is movement and the click event will not be triggered if there is movement */
if (LV_EVENT_PRESSED == code)
lv_obj_clear_flag(obj, LV_OBJ_FLAG_USER_4);
if (code == LV_EVENT_PRESSING) {
if (lv_obj_has_flag(obj, LV_OBJ_FLAG_USER_4) == false) lv_obj_set_style_opa(obj, LV_OPA_100, 0);
lv_indev_t *indev = lv_indev_get_act();
if (indev == NULL) return;
lv_indev_type_t indev_type = lv_indev_get_type(indev);
if (indev_type != LV_INDEV_TYPE_POINTER) return;
lv_point_t vect;
lv_indev_get_vect(indev, &vect);
lv_coord_t x = lv_obj_get_x_aligned(obj) + vect.x;
lv_coord_t y = lv_obj_get_y_aligned(obj) + vect.y;
/* after moving it will not trigger click */
lv_obj_add_flag(obj, LV_OBJ_FLAG_USER_4);
lv_obj_set_pos(obj, x, y);
}
}
static lv_obj_t *common_btn(lv_obj_t *parent, char *desc, lv_event_cb_t event_cb, void *event_user_data)
{
lv_obj_t *btn = lv_btn_create(parent);
lv_obj_t *label = lv_label_create(btn);
lv_label_set_text(label, desc);
lv_obj_center(label);
lv_obj_add_event_cb(btn, event_cb, LV_EVENT_CLICKED, event_user_data);
return btn;
}
void ui_init(void)
{
lv_obj_t *player = lv_aic_player_create(lv_scr_act());
lv_aic_player_set_src(player, LVGL_PATH(elevator_mjpeg.mp4));
lv_obj_center(player);
lv_obj_set_pos(player, 0, 0);
lv_obj_set_style_bg_color(player, lv_color_hex(0x0), 0);
lv_obj_add_flag(player, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event_cb(player, move_player_cb, LV_EVENT_ALL, NULL);
lv_obj_t *scale_slider = lv_slider_create(lv_scr_act());
lv_slider_set_range(scale_slider, 64, 512);
lv_slider_set_value(scale_slider, 256, LV_ANIM_OFF);
lv_obj_set_size(scale_slider, LV_HOR_RES * 0.03, LV_VER_RES * 0.8);
lv_obj_align(scale_slider, LV_ALIGN_RIGHT_MID, -LV_HOR_RES * 0.02, 0);
lv_obj_add_event_cb(scale_slider, scale_player_cb, LV_EVENT_ALL, player);
lv_obj_t *rotate_slider = lv_slider_create(lv_scr_act());
lv_slider_set_range(rotate_slider, 0, 3600);
lv_slider_set_value(rotate_slider, 0, LV_ANIM_OFF);
lv_obj_set_size(rotate_slider, LV_HOR_RES * 0.03, LV_VER_RES * 0.8);
lv_obj_align(rotate_slider, LV_ALIGN_LEFT_MID, LV_HOR_RES * 0.02, 0);
lv_obj_add_event_cb(rotate_slider, rotate_player_cb, LV_EVENT_ALL, player);
lv_obj_t *btn_container = lv_obj_create(lv_scr_act());
lv_obj_set_style_bg_opa(btn_container, LV_OPA_0, 0);
lv_obj_set_style_border_opa(btn_container, LV_OPA_0, 0);
lv_obj_set_scroll_dir(btn_container, LV_SCROLLBAR_MODE_OFF);
lv_obj_set_scroll_snap_x(btn_container, LV_SCROLL_SNAP_START);
lv_obj_set_size(btn_container, LV_HOR_RES * 0.8, LV_VER_RES * 0.4);
lv_obj_set_align(btn_container, LV_ALIGN_TOP_MID);
lv_obj_set_flex_flow(btn_container, LV_FLEX_FLOW_ROW_WRAP);
lv_obj_set_flex_align(btn_container, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
common_btn(btn_container, "Start", start_button_handler, player);
common_btn(btn_container, "Pause", pause_button_handler, player);
common_btn(btn_container, "Resume", resume_button_handler, player);
common_btn(btn_container, "Seek", seek_button_handler, player);
common_btn(btn_container, "Auto Restart", auto_restart_button_handler, player);
common_btn(btn_container, "del", del_button_handler, player);
common_btn(btn_container, "next", next_button_handler, player);
lv_obj_t *label = lv_label_create(lv_scr_act());
lv_label_set_text(label, "Video Test");
lv_obj_align(label, LV_ALIGN_BOTTOM_MID, -LV_VER_RES * 0.1, 0);
}

View File

@ -0,0 +1,19 @@
/*
* Copyright (C) 2025 ArtInChip Technology Co., Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*
* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
/* code end */
#endif /* LV_CONF_CUSTOM_H */

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

View File

@ -0,0 +1,93 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <fcntl.h>
#include "artinchip/sample_base.h"
#include <sys/time.h>
#include <sys/stat.h>
#include <linux/input.h>
#include "battery.h"
bool file_exists(const char *path)
{
struct stat st;
return (path && stat(path, &st) == 0);
}
bool change_working_dir(const char *dir)
{
char path[MAX_PATH_LEN] = {0};
if (chdir(dir) != 0)
return false;
return (getcwd(path, sizeof(path)) != NULL);
}
int read_int_from_file(const char *filename)
{
FILE *f = fopen(filename, "r");
if (!f) {
ERR("Failed to open %s: %s\n", filename, strerror(errno));
return -1;
}
char buf[GPAI_CHAN_NUM] = {0};
int ret = fread(buf, 1, sizeof(buf) - 1, f);
fclose(f);
if (ret <= 0) {
ERR("fread() returned %d: %s\n", ret, strerror(errno));
return -1;
}
return atoi(buf);
}
static int calculate_battery_level(int adc_val)
{
for (size_t i = 0; i < sizeof(battery_levels)/sizeof(battery_levels[0]); i++) {
if (adc_val >= battery_levels[i].adc_val) {
printf("Current ADC value: %d, battery level: %d%%\n",
adc_val, battery_levels[i].level);
return battery_levels[i].level;
}
}
return 0;
}
int check_battery_level()
{
char path[MAX_PATH_LEN] = {0};
if (!file_exists("/tmp/gpai")) {
system("ln -sf /sys/devices/platform/soc/*.gpai/iio:device0 /tmp/gpai");
}
if (!change_working_dir("/tmp/gpai")) {
ERR("Failed to change to /tmp/gpai directory\n");
return -1;
}
snprintf(path, sizeof(path), "in_voltage%d_raw", ADC_CHAN);
int adc_val = read_int_from_file(path);
if (adc_val < 0) {
return -1;
}
return calculate_battery_level(adc_val);
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#include "artinchip/sample_base.h"
#define GPAI_CHAN_NUM 8
#define MAX_PATH_LEN 128
#define ADC_CHAN 7
static const struct battery_level {
int adc_val;
int level;
} battery_levels[] = {
{2330, 100},
{2291, 75},
{2234, 50},
{2177, 25},
{0, 0}
};
int check_battery_level();

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#include "custom.h"
#include "battery.h"
screen_t *scr;
static void timer_battery_callback(lv_timer_t *tmr)
{
int level = check_battery_level();
switch (level) {
case 0:
lv_img_set_src(scr->image_battery, LVGL_IMAGE_PATH(battery_1.png));
break;
case 25:
lv_img_set_src(scr->image_battery, LVGL_IMAGE_PATH(battery_1.png));
break;
case 50:
lv_img_set_src(scr->image_battery, LVGL_IMAGE_PATH(battery_2.png));
break;
case 75:
lv_img_set_src(scr->image_battery, LVGL_IMAGE_PATH(battery_3.png));
break;
case 100:
lv_img_set_src(scr->image_battery, LVGL_IMAGE_PATH(battery_4.png));
break;
default:
lv_img_set_src(scr->image_battery, LVGL_IMAGE_PATH(battery_1.png));
}
return;
}
void custom_init(ui_manager_t *ui)
{
/* Add your codes here */
scr = screen_get(ui);
lv_timer_create(timer_battery_callback, 5000, 0);
}

View File

@ -0,0 +1,24 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#ifndef CUSTOM_CODE
#define CUSTOM_CODE
#ifdef __cplusplus
extern "C" {
#endif
#include "ui_objects.h"
#include "aic_ui.h"
#include "ui_util.h"
void custom_init(ui_manager_t *ui);
#ifdef __cplusplus
}
#endif
#endif /* CUSTOM_CODE */

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
/* lv_conf_custom.h for custom lv_conf.h file
* example :
* #undef LV_USE_LOG
* #define LV_USE_LOG 1
*/
#ifndef LV_CONF_CUSTOM_H
#define LV_CONF_CUSTOM_H
/* code begin */
#undef LV_USE_FREETYPE
#define LV_USE_FREETYPE 1
#undef LV_COLOR_DEPTH
#define LV_COLOR_DEPTH 32
/* code end */
#endif /* LV_CONF_CUSTOM_H */

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#include "ui_objects.h"
#include "aic_ui.h"
#include "ui_util.h"
void screen_create(ui_manager_t *ui)
{
screen_t *scr = screen_get(ui);
if (!ui->auto_del && scr->obj)
return;
// Init scr->obj
scr->obj = lv_obj_create(NULL);
lv_obj_set_scrollbar_mode(scr->obj, LV_SCROLLBAR_MODE_OFF);
// Set style of scr->obj
lv_obj_set_style_bg_color(scr->obj, lv_color_hex(0xfcfcfc), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(scr->obj, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
// Init scr->image_descrip
scr->image_descrip = lv_img_create(scr->obj);
lv_img_set_src(scr->image_descrip, LVGL_IMAGE_PATH(description.png));
lv_img_set_pivot(scr->image_descrip, 50, 50);
lv_img_set_angle(scr->image_descrip, 0);
lv_obj_set_style_img_opa(scr->image_descrip, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_pos(scr->image_descrip, 0, 0);
// Init scr->image_battery
scr->image_battery = lv_img_create(scr->obj);
lv_img_set_src(scr->image_battery, LVGL_IMAGE_PATH(battery_3.png));
lv_img_set_pivot(scr->image_battery, 50, 50);
lv_img_set_angle(scr->image_battery, 0);
lv_obj_set_style_img_opa(scr->image_battery, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_pos(scr->image_battery, 545, 8);
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#include "ui_init.h"
#include "ui_util.h"
#include "aic_ui.h"
#include "custom/custom.h"
ui_manager_t ui_manager;
void ui_init(void)
{
// auto delete screen
ui_manager_init(&ui_manager, true);
screen_create(&ui_manager);
lv_scr_load(screen_get(&ui_manager)->obj);
// custom code
custom_init(&ui_manager);
}

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#ifndef _UI_INIT_H
#define _UI_INIT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "ui_objects.h"
void ui_init(void);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif // _UI_INIT_H

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#ifndef _UI_OBJECTS
#define _UI_OBJECTS
#ifdef __cplusplus
extern "C" {
#endif
#include "lvgl.h"
#include "lv_conf_custom.h"
typedef struct {
lv_obj_t *obj;
lv_obj_t *image_descrip;
lv_obj_t *image_battery;
} screen_t;
typedef struct {
bool auto_del;
screen_t screen;
} ui_manager_t;
static inline void ui_manager_init(ui_manager_t *ui, bool auto_del)
{
memset(ui, 0 , sizeof(ui_manager_t));
ui->auto_del = auto_del;
}
static inline screen_t *screen_get(ui_manager_t *ui)
{
return &ui->screen;
}
void screen_create(ui_manager_t *ui);
extern ui_manager_t ui_manager;
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif // _UI_OBJECTS

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#include <stdio.h>
#include "ui_util.h"
bool screen_is_loading(lv_obj_t *scr)
{
#if LVGL_VERSION_MAJOR == 8
lv_obj_t *act_scr = lv_scr_act();
lv_disp_t *d = lv_obj_get_disp(scr);
if (d->prev_scr == NULL && (d->scr_to_load == NULL || d->scr_to_load == act_scr))
return false;
else
return true;
#else
return false;
#endif
}
void ui_style_init(lv_style_t *style)
{
if (style->prop_cnt >= 1)
lv_style_reset(style);
else
lv_style_init(style);
}
lv_font_t *ui_font_init(char *path, int size) {
#if LVGL_VERSION_MAJOR == 8
static lv_ft_info_t info;
info.name = path;
info.weight = size;
info.style = FT_FONT_STYLE_NORMAL;
info.mem = NULL;
if (!lv_ft_font_init(&info))
return NULL;
return info.font;
#else
lv_font_t *font = lv_freetype_font_create(path,
LV_FREETYPE_FONT_RENDER_MODE_BITMAP,
size,
LV_FREETYPE_FONT_STYLE_NORMAL);
return font;
#endif //LVGL_VERSION_MAJOR
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2024-2025, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: haidong.pan <haidong.pan@artinchip.com>
*/
#ifndef _UI_UTIL_H
#define _UI_UTIL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lvgl.h"
bool screen_is_loading(lv_obj_t *scr);
void ui_style_init(lv_style_t * style);
lv_font_t *ui_font_init(char *path, int size);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif // _UI_UTIL_H

View File

@ -0,0 +1 @@
仅包含常用3700个汉字

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Some files were not shown because too many files have changed in this diff Show More