chore: migrate project into clean repository

This commit is contained in:
yuuux
2026-08-13 16:50:52 +08:00
commit d1d25a09e7
27405 changed files with 9422808 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
#pragma once
// 这是一个模拟的lisa_log.h文件,用于测试mac_manager.c
#include <stdio.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
#define LISA_LOGI(tag, fmt, ...) printf("[I][%s] " fmt "\n", tag, ##__VA_ARGS__)
#define LISA_LOGE(tag, fmt, ...) printf("[E][%s] " fmt "\n", tag, ##__VA_ARGS__)
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,30 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "mock_task.h"
#include <time.h>
DEFINE_FAKE_VALUE_FUNC(unsigned int, xTaskGetTickCount);
static unsigned int custom_xTaskGetTickCount(void)
{
return (unsigned int)time(NULL);
}
void mock_task_init(void)
{
RESET_FAKE(xTaskGetTickCount);
xTaskGetTickCount_fake.custom_fake = custom_xTaskGetTickCount;
}
void mock_task_reset(void)
{
mock_task_init();
}

View File

@@ -0,0 +1,24 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "task.h"
#include "fff.h"
#ifdef __cplusplus
extern "C" {
#endif
DECLARE_FAKE_VALUE_FUNC(unsigned int, xTaskGetTickCount);
void mock_task_init(void);
void mock_task_reset(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,16 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
unsigned int xTaskGetTickCount(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
void efuse_init(void);
uint64_t efuse_read_uuid(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,21 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "mock_Driver_EFUSE.h"
DEFINE_FAKE_VOID_FUNC(efuse_init);
DEFINE_FAKE_VALUE_FUNC(uint64_t, efuse_read_uuid);
void mock_driver_efuse_init(void)
{
RESET_FAKE(efuse_init);
RESET_FAKE(efuse_read_uuid);
}
void mock_driver_efuse_reset(void)
{
mock_driver_efuse_init();
}

View File

@@ -0,0 +1,23 @@
#ifndef MOCK_DRIVER_EFUSE_H
#define MOCK_DRIVER_EFUSE_H
#include "Driver_EFUSE.h"
#include "fff.h"
#ifdef __cplusplus
extern "C" {
#endif
DECLARE_FAKE_VOID_FUNC(efuse_init);
DECLARE_FAKE_VALUE_FUNC(uint64_t, efuse_read_uuid);
void mock_driver_efuse_init(void);
void mock_driver_efuse_reset(void);
#ifdef __cplusplus
}
#endif
#endif /* MOCK_DRIVER_EFUSE_H */

View File

@@ -0,0 +1,24 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
void lisa_kv_free(void *value);
int lisa_kv_get_blob(const char *key, uint8_t **data, int *len);
int lisa_kv_set_blob(const char *key, uint8_t *data, int len);
int lisa_kv_del(const char *key);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,74 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "mock_lisa_kv.h"
#include <stdlib.h>
#include <string.h>
DEFINE_FAKE_VOID_FUNC(lisa_kv_free, void *);
DEFINE_FAKE_VALUE_FUNC(int, lisa_kv_get_blob, const char *, uint8_t **, int *);
DEFINE_FAKE_VALUE_FUNC(int, lisa_kv_set_blob, const char *, uint8_t *, int);
DEFINE_FAKE_VALUE_FUNC(int, lisa_kv_del, const char *);
uint8_t *saved_data = NULL;
int saved_len = 0;
int mem_lisa_kv_get_blob(const char *key, uint8_t **data, int *len)
{
uint8_t *got_data = malloc(saved_len);
memcpy(got_data, saved_data, saved_len);
*data = got_data;
*len = saved_len;
return 0;
}
int mem_lisa_kv_set_blob(const char *key, uint8_t *data, int len)
{
saved_data = malloc(len);
memcpy(saved_data, data, len);
saved_len = len;
return 0;
}
void mem_lisa_kv_free(void *value)
{
if (value == NULL) {
return;
}
free(value);
}
int mem_lisa_kv_del(const char *key)
{
if (saved_data) {
free(saved_data);
}
saved_data = NULL;
saved_len = 0;
return 0;
}
void mock_lisa_kv_init(void)
{
RESET_FAKE(lisa_kv_free);
RESET_FAKE(lisa_kv_get_blob);
RESET_FAKE(lisa_kv_set_blob);
RESET_FAKE(lisa_kv_del);
lisa_kv_get_blob_fake.custom_fake = mem_lisa_kv_get_blob;
lisa_kv_set_blob_fake.custom_fake = mem_lisa_kv_set_blob;
lisa_kv_free_fake.custom_fake = mem_lisa_kv_free;
lisa_kv_del_fake.custom_fake = mem_lisa_kv_del;
}
void mock_lisa_kv_reset(void)
{
mock_lisa_kv_init();
mem_lisa_kv_del("mac");
}

View File

@@ -0,0 +1,28 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "lisa_kv.h"
#include "fff.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
DECLARE_FAKE_VOID_FUNC(lisa_kv_free, void *);
DECLARE_FAKE_VALUE_FUNC(int, lisa_kv_get_blob, const char *, uint8_t **, int *);
DECLARE_FAKE_VALUE_FUNC(int, lisa_kv_set_blob, const char *, uint8_t *, int);
DECLARE_FAKE_VALUE_FUNC(int, lisa_kv_del, const char *);
void mock_lisa_kv_init(void);
void mock_lisa_kv_reset(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,36 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "mock_sysheap.h"
#include <stdlib.h>
DEFINE_FAKE_VALUE_FUNC(void *, exram_malloc, int, size_t);
DEFINE_FAKE_VOID_FUNC(exram_free, void *);
static void *mock_exram_malloc(int heap_id, size_t size)
{
return malloc(size);
}
static void mock_exram_free(void *ptr)
{
free(ptr);
}
void mock_sysheap_init(void)
{
RESET_FAKE(exram_malloc);
RESET_FAKE(exram_free);
exram_malloc_fake.custom_fake = mock_exram_malloc;
exram_free_fake.custom_fake = mock_exram_free;
}
void mock_sysheap_reset(void)
{
mock_sysheap_init();
}

View File

@@ -0,0 +1,25 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include "sysheap.h"
#include "fff.h"
#ifdef __cplusplus
extern "C" {
#endif
DECLARE_FAKE_VALUE_FUNC(void *, exram_malloc, int, size_t);
DECLARE_FAKE_VOID_FUNC(exram_free, void *);
void mock_sysheap_init(void);
void mock_sysheap_reset(void);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,22 @@
/**
* Copyright (c) 2025, LISTENAI
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
void *exram_malloc(int heap_id, size_t size);
void exram_free(void *ptr);
#ifdef __cplusplus
}
#endif