mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-20 00:32:37 +01:00
RTL8721DA (AmebaDplus) and RTL8720E (AmebaLite) (#1718)
* amebadplus * fix + amebalite * ota, lfs, fast connect fix * Fix TCP_MSL and hostname * Readme and releaserc fix esp irq * small fixes * setting mac on amebad/1 * ameba ir * win ef * update sdk & disable rtl8720e rest ota * fix
This commit is contained in:
committed by
GitHub
parent
9e89d4f375
commit
a1501c00c4
@@ -41,26 +41,26 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* easyflash.c */
|
||||
EfErrCode easyflash_init(void);
|
||||
DllExport EfErrCode easyflash_init(void);
|
||||
|
||||
#ifdef EF_USING_ENV
|
||||
/* only supported on ef_env.c */
|
||||
size_t ef_get_env_blob(const char *key, void *value_buf, size_t buf_len, size_t *saved_value_len);
|
||||
bool ef_get_env_obj(const char *key, env_node_obj_t env);
|
||||
size_t ef_read_env_value(env_node_obj_t env, uint8_t *value_buf, size_t buf_len);
|
||||
EfErrCode ef_set_env_blob(const char *key, const void *value_buf, size_t buf_len);
|
||||
DllExport size_t ef_get_env_blob(const char *key, void *value_buf, size_t buf_len, size_t *saved_value_len);
|
||||
DllExport bool ef_get_env_obj(const char *key, env_node_obj_t env);
|
||||
DllExport size_t ef_read_env_value(env_node_obj_t env, uint8_t *value_buf, size_t buf_len);
|
||||
DllExport EfErrCode ef_set_env_blob(const char *key, const void *value_buf, size_t buf_len);
|
||||
|
||||
/* ef_env.c, ef_env_legacy_wl.c and ef_env_legacy.c */
|
||||
EfErrCode ef_load_env(void);
|
||||
void ef_print_env(void);
|
||||
char *ef_get_env(const char *key);
|
||||
EfErrCode ef_set_env(const char *key, const char *value);
|
||||
EfErrCode ef_del_env(const char *key);
|
||||
EfErrCode ef_save_env(void);
|
||||
EfErrCode ef_env_set_default(void);
|
||||
size_t ef_get_env_write_bytes(void);
|
||||
EfErrCode ef_set_and_save_env(const char *key, const char *value);
|
||||
EfErrCode ef_del_and_save_env(const char *key);
|
||||
DllExport EfErrCode ef_load_env(void);
|
||||
DllExport void ef_print_env(void);
|
||||
DllExport char *ef_get_env(const char *key);
|
||||
DllExport EfErrCode ef_set_env(const char *key, const char *value);
|
||||
DllExport EfErrCode ef_del_env(const char *key);
|
||||
DllExport EfErrCode ef_save_env(void);
|
||||
DllExport EfErrCode ef_env_set_default(void);
|
||||
DllExport size_t ef_get_env_write_bytes(void);
|
||||
DllExport EfErrCode ef_set_and_save_env(const char *key, const char *value);
|
||||
DllExport EfErrCode ef_del_and_save_env(const char *key);
|
||||
#endif
|
||||
|
||||
#ifdef EF_USING_IAP
|
||||
@@ -88,17 +88,17 @@ size_t ef_log_get_used_size(void);
|
||||
#endif
|
||||
|
||||
/* ef_utils.c */
|
||||
uint32_t ef_calc_crc32(uint32_t crc, const void *buf, size_t size);
|
||||
DllExport uint32_t ef_calc_crc32(uint32_t crc, const void *buf, size_t size);
|
||||
|
||||
/* ef_port.c */
|
||||
EfErrCode ef_port_read(uint32_t addr, uint32_t *buf, size_t size);
|
||||
EfErrCode ef_port_erase(uint32_t addr, size_t size);
|
||||
EfErrCode ef_port_write(uint32_t addr, const uint32_t *buf, size_t size);
|
||||
void ef_port_env_lock(void);
|
||||
void ef_port_env_unlock(void);
|
||||
void ef_log_debug(const char *file, const long line, const char *format, ...);
|
||||
void ef_log_info(const char *format, ...);
|
||||
void ef_print(const char *format, ...);
|
||||
DllExport EfErrCode ef_port_read(uint32_t addr, uint32_t *buf, size_t size);
|
||||
DllExport EfErrCode ef_port_erase(uint32_t addr, size_t size);
|
||||
DllExport EfErrCode ef_port_write(uint32_t addr, const uint32_t *buf, size_t size);
|
||||
DllExport void ef_port_env_lock(void);
|
||||
DllExport void ef_port_env_unlock(void);
|
||||
DllExport void ef_log_debug(const char *file, const long line, const char *format, ...);
|
||||
DllExport void ef_log_info(const char *format, ...);
|
||||
DllExport void ef_print(const char *format, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -132,10 +132,20 @@
|
||||
#define EF_START_ADDR 0xEF000
|
||||
#define ENV_AREA_SIZE 0x8000
|
||||
|
||||
#elif WINDOWS
|
||||
|
||||
#define EF_START_ADDR 0
|
||||
extern uint32_t ENV_AREA_SIZE;
|
||||
#define DllExport __declspec(dllexport)
|
||||
|
||||
#endif
|
||||
/* print debug information of flash */
|
||||
#ifdef PKG_EASYFLASH_DEBUG
|
||||
#define PRINT_DEBUG
|
||||
#endif
|
||||
|
||||
#ifndef DllExport
|
||||
#define DllExport
|
||||
#endif
|
||||
|
||||
#endif /* EF_CFG_H_ */
|
||||
|
||||
4
libraries/easyflash/ports/WinEF/.gitignore
vendored
Normal file
4
libraries/easyflash/ports/WinEF/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
.vs
|
||||
x64
|
||||
WinEF
|
||||
Release
|
||||
100
libraries/easyflash/ports/WinEF/WinEF.vcxproj
Normal file
100
libraries/easyflash/ports/WinEF/WinEF.vcxproj
Normal file
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{e827212d-b194-42be-9282-43fbdc5a4d38}</ProjectGuid>
|
||||
<RootNamespace>WinEF</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>./;../../inc;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>./;../../inc;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;WINEF_EXPORTS;_WINDOWS;_USRDLL;WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;WINEF_EXPORTS;_WINDOWS;_USRDLL;WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\easyflash.c" />
|
||||
<ClCompile Include="..\..\src\ef_env.c" />
|
||||
<ClCompile Include="..\..\src\ef_env_legacy.c" />
|
||||
<ClCompile Include="..\..\src\ef_env_legacy_wl.c" />
|
||||
<ClCompile Include="..\..\src\ef_iap.c" />
|
||||
<ClCompile Include="..\..\src\ef_log.c" />
|
||||
<ClCompile Include="..\..\src\ef_utils.c" />
|
||||
<ClCompile Include="..\ef_port.c" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
51
libraries/easyflash/ports/WinEF/WinEF.vcxproj.filters
Normal file
51
libraries/easyflash/ports/WinEF/WinEF.vcxproj.filters
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\ef_port.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\easyflash.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_env.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_env_legacy.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_env_legacy_wl.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_iap.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_log.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\ef_utils.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
17
libraries/easyflash/ports/WinEF/dllmain.cpp
Normal file
17
libraries/easyflash/ports/WinEF/dllmain.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "framework.h"
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
5
libraries/easyflash/ports/WinEF/framework.h
Normal file
5
libraries/easyflash/ports/WinEF/framework.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
@@ -30,9 +30,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#if !WINDOWS
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
#include "queue.h"
|
||||
#endif
|
||||
|
||||
#if PLATFORM_REALTEK
|
||||
|
||||
@@ -53,6 +55,43 @@ flash_t flash;
|
||||
#include <image/flash.h>
|
||||
#define QueueHandle_t xQueueHandle
|
||||
|
||||
#elif WINDOWS
|
||||
|
||||
#include "framework.h"
|
||||
|
||||
#define QueueHandle_t HANDLE
|
||||
extern QueueHandle_t ef_mutex;
|
||||
|
||||
BYTE* env_area = NULL;
|
||||
uint32_t ENV_AREA_SIZE = 0;
|
||||
|
||||
DllExport BYTE* get_env_area(void)
|
||||
{
|
||||
return env_area;
|
||||
}
|
||||
|
||||
DllExport void set_env_size(uint32_t size)
|
||||
{
|
||||
ENV_AREA_SIZE = size;
|
||||
if(env_area) free(env_area);
|
||||
env_area = malloc(size * sizeof(BYTE));
|
||||
}
|
||||
|
||||
HANDLE xSemaphoreCreateMutex()
|
||||
{
|
||||
return CreateMutex(NULL, FALSE, NULL);
|
||||
}
|
||||
|
||||
void xSemaphoreTake(HANDLE handle, int time)
|
||||
{
|
||||
WaitForSingleObject(ef_mutex, time);
|
||||
}
|
||||
|
||||
void xSemaphoreGive(HANDLE handle)
|
||||
{
|
||||
ReleaseMutex(ef_mutex);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* default ENV set for user */
|
||||
@@ -113,6 +152,9 @@ EfErrCode ef_port_read(uint32_t addr, uint32_t* buf, size_t size)
|
||||
if(res == 0) res = EF_READ_ERR;
|
||||
else res = EF_NO_ERR;
|
||||
return res;
|
||||
#elif WINDOWS
|
||||
memcpy(buf, env_area + addr, size);
|
||||
return EF_NO_ERR;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -147,6 +189,8 @@ EfErrCode ef_port_erase(uint32_t addr, size_t size)
|
||||
if(res != 0) res = EF_ERASE_ERR;
|
||||
else res = EF_NO_ERR;
|
||||
return res;
|
||||
#elif WINDOWS
|
||||
memset(env_area + addr, 0xFF, size);
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
@@ -180,6 +224,9 @@ EfErrCode ef_port_write(uint32_t addr, const uint32_t* buf, size_t size)
|
||||
if(res == 0) res = EF_WRITE_ERR;
|
||||
else res = EF_NO_ERR;
|
||||
return res;
|
||||
#elif WINDOWS
|
||||
memcpy(env_area + addr, buf, size);
|
||||
return EF_NO_ERR;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@
|
||||
#define SECTOR_SIZE EF_ERASE_MIN_SIZE
|
||||
#define SECTOR_NUM (ENV_AREA_SIZE / (EF_ERASE_MIN_SIZE))
|
||||
|
||||
#if !WINDOWS
|
||||
#if (SECTOR_NUM < 2)
|
||||
#error "The sector number must lager then or equal to 2"
|
||||
#endif
|
||||
@@ -121,6 +122,7 @@
|
||||
#if (EF_GC_EMPTY_SEC_THRESHOLD == 0 || EF_GC_EMPTY_SEC_THRESHOLD >= SECTOR_NUM)
|
||||
#error "There is at least one empty sector for GC."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SECTOR_HDR_DATA_SIZE (EF_WG_ALIGN(sizeof(struct sector_hdr_data)))
|
||||
#define SECTOR_DIRTY_OFFSET ((unsigned long)(&((struct sector_hdr_data *)0)->status_table.dirty))
|
||||
|
||||
Reference in New Issue
Block a user