Initial commit: TXW82x FPV v2.7.0.7-42229 SDK + project sources

This commit is contained in:
2026-07-06 11:30:13 +08:00
commit e76462eeb7
3451 changed files with 1415300 additions and 0 deletions

View File

@@ -0,0 +1,140 @@
#ifndef _LINUX_UNALIGNED_BYTESHIFT_H
#define _LINUX_UNALIGNED_BYTESHIFT_H
#ifdef __cplusplus
extern "C" {
#endif
static inline uint16 __get_unaligned_le16(const uint8 *p)
{
return p[0] | p[1] << 8;
}
static inline uint32 __get_unaligned_le32(const uint8 *p)
{
return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
}
static inline uint64 __get_unaligned_le64(const uint8 *p)
{
return (uint64)__get_unaligned_le32(p + 4) << 32 |
__get_unaligned_le32(p);
}
static inline void __put_unaligned_le16(uint16 val, uint8 *p)
{
*p++ = val;
*p++ = val >> 8;
}
static inline void __put_unaligned_le32(uint32 val, uint8 *p)
{
__put_unaligned_le16(val >> 16, p + 2);
__put_unaligned_le16(val, p);
}
static inline void __put_unaligned_le64(uint64 val, uint8 *p)
{
__put_unaligned_le32(val >> 32, p + 4);
__put_unaligned_le32(val, p);
}
static inline uint16 get_unaligned_le16(const void *p)
{
return __get_unaligned_le16((const uint8 *)p);
}
static inline uint32 get_unaligned_le32(const void *p)
{
return __get_unaligned_le32((const uint8 *)p);
}
static inline uint64 get_unaligned_le64(const void *p)
{
return __get_unaligned_le64((const uint8 *)p);
}
static inline void put_unaligned_le16(uint16 val, void *p)
{
__put_unaligned_le16(val, (uint8 *)p);
}
static inline void put_unaligned_le32(uint32 val, void *p)
{
__put_unaligned_le32(val, (uint8 *)p);
}
static inline void put_unaligned_le64(uint64 val, void *p)
{
__put_unaligned_le64(val, (uint8 *)p);
}
static inline uint16 __get_unaligned_be16(const uint8 *p)
{
return p[0] << 8 | p[1];
}
static inline uint32 __get_unaligned_be32(const uint8 *p)
{
return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
}
static inline uint64 __get_unaligned_be64(const uint8 *p)
{
return (uint64)__get_unaligned_be32(p) << 32 |
__get_unaligned_be32(p + 4);
}
static inline void __put_unaligned_be16(uint16 val, uint8 *p)
{
*p++ = val >> 8;
*p++ = val;
}
static inline void __put_unaligned_be32(uint32 val, uint8 *p)
{
__put_unaligned_be16(val >> 16, p);
__put_unaligned_be16(val, p + 2);
}
static inline void __put_unaligned_be64(uint64 val, uint8 *p)
{
__put_unaligned_be32(val >> 32, p);
__put_unaligned_be32(val, p + 4);
}
static inline uint16 get_unaligned_be16(const void *p)
{
return __get_unaligned_be16((const uint8 *)p);
}
static inline uint32 get_unaligned_be32(const void *p)
{
return __get_unaligned_be32((const uint8 *)p);
}
static inline uint64 get_unaligned_be64(const void *p)
{
return __get_unaligned_be64((const uint8 *)p);
}
static inline void put_unaligned_be16(uint16 val, void *p)
{
__put_unaligned_be16(val, (uint8 *)p);
}
static inline void put_unaligned_be32(uint32 val, void *p)
{
__put_unaligned_be32(val, (uint8 *)p);
}
static inline void put_unaligned_be64(uint64 val, void *p)
{
__put_unaligned_be64(val, (uint8 *)p);
}
#ifdef __cplusplus
}
#endif
#endif /* _LINUX_UNALIGNED_LE_BYTESHIFT_H */

View File

@@ -0,0 +1,45 @@
#ifndef _ARCH_CSKY_DEFS_H_
#define _ARCH_CSKY_DEFS_H_
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#ifdef __cplusplus
extern "C" {
#endif
/////////////////////////////////////////////////////////////////////////////////
#define RETURN_ADDR() __builtin_return_address(0)
#define cpu_dcache_disable() csi_dcache_clean_invalid(); csi_dcache_disable();
#define cpu_dcache_enable() csi_dcache_enable()
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
typedef unsigned long ulong;
#ifndef _SIZE_T_DECLARED
typedef unsigned int size_t;
#define _SIZE_T_DECLARED
#endif
#ifndef _SSIZE_T_DECLARED
#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
typedef int ssize_t;
#else
typedef long ssize_t;
#endif
#define _SSIZE_T_DECLARED
#endif
/////////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,29 @@
#ifndef __ARCH_CSKY_STDLIB_H_
#define __ARCH_CSKY_STDLIB_H_
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
#define os_htons(x) ((((x) & (uint16)0x00ffUL) << 8) | (((x) & (uint16)0xff00UL) >> 8))
#define os_ntohs(x) os_htons(x)
#define os_htonl(x) ((((x) & (uint32)0x000000ffUL) << 24) | \
(((x) & (uint32)0x0000ff00UL) << 8) | \
(((x) & (uint32)0x00ff0000UL) >> 8) | \
(((x) & (uint32)0xff000000UL) >> 24))
#define os_ntohl(x) os_htonl(x)
int strncasecmp(const char *s1, const char *s2, size_t n);
int strcasecmp(const char *s1, const char *s2);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,103 @@
#ifndef __ARCH_CSKY_OS_TIME_H_
#define __ARCH_CSKY_OS_TIME_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <time.h>
#include <sys/time.h>
#ifdef __NEWLIB__
#include <sys/timespec.h>
#if !defined(__time_t_defined) && !defined(_TIME_T_DECLARED)
typedef uint64 time_t;
#define __time_t_defined
#define _TIME_T_DECLARED
#endif
#endif
#ifndef _USECONDS_T_DECLARED
typedef unsigned long useconds_t; /* microseconds (unsigned) */
#define _USECONDS_T_DECLARED
#endif
#if !defined(_CLOCKID_T_DECLARED)
typedef unsigned long clockid_t;
#define __clockid_t_defined
#define _CLOCKID_T_DECLARED
#endif
#if !defined(__timer_t_defined) && !defined(_TIMER_T_DECLARED)
typedef unsigned long timer_t;
#define __timer_t_defined
#define _TIMER_T_DECLARED
#endif
#ifndef _SYS_TIMESPEC_H_
struct itimerspec {
struct timespec it_interval; /**< Timer period. */
struct timespec it_value; /**< Timer expiration. */
};
#endif
/*struct timeval */
/* Convenience macros for operations on timevals.
NOTE: `timercmp' does not work for >= or <=. */
#ifndef timerisset
#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
#endif
#ifndef timerclear
#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
#endif
#ifndef timercmp
#define timercmp(a, b, CMP) \
(((a)->tv_sec == (b)->tv_sec) ? \
((a)->tv_usec CMP (b)->tv_usec) : \
((a)->tv_sec CMP (b)->tv_sec))
#endif
#if 1 //see: posix/timer.c
#ifndef timeradd
#define timeradd(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
if ((result)->tv_usec >= 1000000) \
{ \
++(result)->tv_sec; \
(result)->tv_usec -= 1000000; \
} \
} while (0)
#endif
#ifndef timersub
#define timersub(a, b, result) \
do { \
(result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
(result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
if ((result)->tv_usec < 0) { \
--(result)->tv_sec; \
(result)->tv_usec += 1000000; \
} \
} while (0)
#endif
#endif
extern int settimeofday(const struct timeval *tv, const struct timezone *tz);
#ifdef __cplusplus
}
#endif
#endif