initial commit
This commit is contained in:
178
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/diag.h
Normal file
178
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/diag.h
Normal file
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* Routines to access hardware
|
||||
*
|
||||
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*/
|
||||
|
||||
#ifndef _DIAG_H_
|
||||
#define _DIAG_H_
|
||||
|
||||
#include "platform_autoconf.h"
|
||||
#include "basic_types.h"
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
#include "rtl_trace.h"
|
||||
|
||||
extern u32 ConfigDebugClose;
|
||||
extern u32 ConfigDebugErr;
|
||||
extern u32 ConfigDebugInfo;
|
||||
extern u32 ConfigDebugWarn;
|
||||
|
||||
extern u32 CfgSysDebugErr;
|
||||
extern u32 CfgSysDebugInfo;
|
||||
extern u32 CfgSysDebugWarn;
|
||||
|
||||
#define DBG_ERR_MSG_ON(x) (ConfigDebugErr |= (x))
|
||||
#define DBG_WARN_MSG_ON(x) (ConfigDebugWarn |= (x))
|
||||
#define DBG_INFO_MSG_ON(x) (ConfigDebugInfo |= (x))
|
||||
|
||||
#define DBG_ERR_MSG_OFF(x) (ConfigDebugErr &= ~(x))
|
||||
#define DBG_WARN_MSG_OFF(x) (ConfigDebugWarn &= ~(x))
|
||||
#define DBG_INFO_MSG_OFF(x) (ConfigDebugInfo &= ~(x))
|
||||
|
||||
// Define debug group
|
||||
#define _DBG_BOOT_ 0x00000001
|
||||
#define _DBG_GDMA_ 0x00000002
|
||||
#define _DBG_GPIO_ 0x00000004
|
||||
#define _DBG_TIMER_ 0x00000008
|
||||
#define _DBG_I2C_ 0x00000010
|
||||
#define _DBG_I2S_ 0x00000020
|
||||
#define _DBG_PWM_ 0x00000200
|
||||
#define _DBG_SDIO_ 0x00000400
|
||||
#define _DBG_SSI_ 0x00000800
|
||||
#define _DBG_SPI_FLASH_ 0x00001000
|
||||
#define _DBG_UART_ 0x00004000
|
||||
#define _DBG_USB_OTG_ 0x00008000
|
||||
#define _DBG_USB_CORE_ 0x00010000
|
||||
#define _DBG_CRYPTO_ 0x00020000
|
||||
#define _DBG_ADC_ 0x00040000
|
||||
#define _DBG_USOC_ 0x00080000
|
||||
#define _DBG_EFUSE_ 0x00100000
|
||||
#define _DBG_MONIT_ 0x00200000
|
||||
#define _DBG_MISC_ 0x40000000
|
||||
#define _DBG_FAULT_ 0x80000000
|
||||
|
||||
extern _LONG_CALL_ u32 DiagPrintf(const char *fmt, ...);
|
||||
u32 DiagSPrintf(u8 *buf, const char *fmt, ...);
|
||||
int prvDiagPrintf(const char *fmt, ...);
|
||||
int prvDiagSPrintf(char *buf, const char *fmt, ...);
|
||||
|
||||
#define _DbgDump DiagPrintf
|
||||
|
||||
#define DRIVER_PREFIX "RTL8195A[Driver]: "
|
||||
#define HAL_PREFIX "RTL8195A[HAL]: "
|
||||
|
||||
#define SDIO_WARN_PREFIX "[SDIO Wrn]"
|
||||
#define SDIO_INFO_PREFIX "[SDIO Inf]"
|
||||
#define UART_WARN_PREFIX "[UART Wrn]"
|
||||
#define USB_INFO_PREFIX "[USB Inf]"
|
||||
#define EFUSE_INFO_PREFIX "[EFUSE Inf] "
|
||||
|
||||
//#ifdef
|
||||
#define CONFIG_DEBUG_ERROR 1
|
||||
#define CONFIG_DEBUG_WARN 1
|
||||
#define CONFIG_DEBUG_INFO 1
|
||||
|
||||
#ifndef likely
|
||||
#define likely(x) (x)
|
||||
#define unlikely(x) (x)
|
||||
#endif
|
||||
|
||||
// =============================================================
|
||||
|
||||
#if CONFIG_DEBUG_WARN // if Build-In Debug Warring Message
|
||||
#define DBG_SDIO_WARN(...) do {\
|
||||
if (unlikely(ConfigDebugWarn & _DBG_SDIO_)) \
|
||||
_DbgDump("\r"SDIO_WARN_PREFIX __VA_ARGS__);\
|
||||
}while(0)
|
||||
|
||||
#define DBG_UART_WARN(...) do {\
|
||||
if (unlikely(ConfigDebugWarn & _DBG_UART_)) \
|
||||
_DbgDump("\r"UART_WARN_PREFIX __VA_ARGS__);\
|
||||
}while(0)
|
||||
#else // else of "#if CONFIG_DEBUG_WARN"
|
||||
#define DBG_SDIO_WARN(...)
|
||||
#define DBG_UART_WARN(...)
|
||||
#endif // end of else of "#if CONFIG_DEBUG_WARN"
|
||||
|
||||
// =============================================================
|
||||
|
||||
#if CONFIG_DEBUG_INFO // if Build-In Debug Information Message
|
||||
#define DBG_SDIO_INFO(...) do {\
|
||||
if (unlikely(ConfigDebugInfo & _DBG_SDIO_)) \
|
||||
_DbgDump("\r"SDIO_INFO_PREFIX __VA_ARGS__);\
|
||||
}while(0)
|
||||
|
||||
#define DBG_EFUSE_INFO(...) do {\
|
||||
if (likely(ConfigDebugInfo & _DBG_EFUSE_)) \
|
||||
_DbgDump("\r"EFUSE_INFO_PREFIX __VA_ARGS__);\
|
||||
}while(0)
|
||||
|
||||
#else // else of "#if CONFIG_DEBUG_INFO"
|
||||
#define DBG_SDIO_INFO(...)
|
||||
#define DBG_EFUSE_INFO(...)
|
||||
#endif // end of else of "#if CONFIG_DEBUG_INFO"
|
||||
|
||||
#ifdef CONFIG_DEBUG_LOG
|
||||
#define DBG_8195A_HAL(...) do {\
|
||||
if (unlikely(ConfigDebugErr & (_DBG_MISC_))) \
|
||||
_DbgDump("\r"HAL_PREFIX __VA_ARGS__);\
|
||||
}while(0)
|
||||
|
||||
#define DBG_8195A_USOC(...) do {\
|
||||
if (unlikely(ConfigDebugErr & _DBG_USOC_)) \
|
||||
_DbgDump("\r"USB_INFO_PREFIX __VA_ARGS__);\
|
||||
}while(0)
|
||||
|
||||
#define DBG_8195A(...) do {\
|
||||
if (unlikely(ConfigDebugErr & _DBG_MISC_)) \
|
||||
_DbgDump("\r" __VA_ARGS__);\
|
||||
}while(0)
|
||||
|
||||
#define MONITOR_LOG(...) do {\
|
||||
if (unlikely(ConfigDebugErr & _DBG_MONIT_)) \
|
||||
_DbgDump( __VA_ARGS__);\
|
||||
}while(0)
|
||||
|
||||
#else // else of "#if CONFIG_DEBUG_LOG"
|
||||
#define DBG_8195A_HAL(...)
|
||||
#define DBG_8195A(...)
|
||||
#define MONITOR_LOG(...)
|
||||
#define DBG_8195A_USOC(...)
|
||||
|
||||
#define DBG_SDIO_WARN(...)
|
||||
#define DBG_UART_WARN(...)
|
||||
|
||||
#define DBG_SDIO_INFO(...)
|
||||
#define DBG_EFUSE_INFO(...)
|
||||
|
||||
#endif
|
||||
|
||||
#define ANSI_COLOR_GREEN "\x1b[32m"
|
||||
#define ANSI_COLOR_CYAN "\x1b[36m"
|
||||
#define ANSI_COLOR_YELLOW "\x1b[33m"
|
||||
#define ANSI_COLOR_MAGENTA "\x1b[35m"
|
||||
#define ANSI_COLOR_RED "\x1b[31m"
|
||||
#define ANSI_COLOR_BLUE "\x1b[34m"
|
||||
#define ANSI_COLOR_RESET "\x1b[0m"
|
||||
|
||||
typedef enum {
|
||||
DBG_CFG_ERR=0,
|
||||
DBG_CFG_WARN=1,
|
||||
DBG_CFG_INFO=2
|
||||
} DBG_CFG_TYPE;
|
||||
|
||||
typedef struct {
|
||||
u8 cmd_name[16];
|
||||
u32 cmd_type;
|
||||
} DBG_CFG_CMD;
|
||||
|
||||
typedef enum _CONSOLE_OP_STAGE_ {
|
||||
ROM_STAGE = 0,
|
||||
RAM_STAGE = 1
|
||||
}CONSOLE_OP_STAGE;
|
||||
|
||||
#endif //_DIAG_H_
|
||||
22
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/memproc.h
Normal file
22
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/memproc.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Routines to access hardware
|
||||
*
|
||||
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*/
|
||||
|
||||
#ifndef _MEM_PROC_H_
|
||||
#define _MEM_PROC_H_
|
||||
|
||||
#include <basic_types.h>
|
||||
|
||||
/* change name from hal_misc.h */
|
||||
extern _LONG_CALL_ void *_memset( void *s, int c, SIZE_T n );
|
||||
extern _LONG_CALL_ void *_memcpy( void *s1, const void *s2, SIZE_T n );
|
||||
extern _LONG_CALL_ int _memcmp( const void *av, const void *bv, SIZE_T len );
|
||||
|
||||
|
||||
|
||||
#endif //_MEM_PROC_H_
|
||||
15
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/rand.h
Normal file
15
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/rand.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Routines to access hardware
|
||||
*
|
||||
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*/
|
||||
|
||||
u32
|
||||
Rand (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
109
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/strproc.h
Normal file
109
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/strproc.h
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Routines to access hardware
|
||||
*
|
||||
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*/
|
||||
|
||||
#ifndef _STRPROC_H_
|
||||
#define _STRPROC_H_
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
#include "va_list.h"
|
||||
|
||||
#ifndef isprint
|
||||
#define in_range(c, lo, up) ((u8)c >= lo && (u8)c <= up)
|
||||
#define isprint(c) in_range(c, 0x20, 0x7f)
|
||||
#define isdigit(c) in_range(c, '0', '9')
|
||||
#define isxdigit(c) (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
|
||||
#define islower(c) in_range(c, 'a', 'z')
|
||||
#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v' || c == ',')
|
||||
#endif
|
||||
|
||||
extern _LONG_CALL_ SIZE_T _strlen(const char *s);
|
||||
extern _LONG_CALL_ int _strcmp(const char *cs, const char *ct);
|
||||
extern _LONG_CALL_ char *_strncpy(char *dest, const char *src, size_t count);
|
||||
extern _LONG_CALL_ char *_strcpy(char *dest, const char *src);
|
||||
extern _LONG_CALL_ size_t _strlen(const char *s);
|
||||
extern _LONG_CALL_ size_t _strnlen(const char *s, size_t count);
|
||||
extern _LONG_CALL_ int _strncmp(const char *cs, const char *ct, size_t count);
|
||||
extern _LONG_CALL_ int _sscanf(const char *buf, const char *fmt, ...);
|
||||
extern _LONG_CALL_ char *_strsep(char **s, const char *ct);
|
||||
extern _LONG_CALL_ char *skip_spaces(const char *str);
|
||||
extern _LONG_CALL_ int skip_atoi(const char **s);
|
||||
extern _LONG_CALL_ int _vsscanf(const char *buf, const char *fmt, va_list args);
|
||||
extern _LONG_CALL_ unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base);
|
||||
extern _LONG_CALL_ long simple_strtol(const char *cp, char **endp, unsigned int base);
|
||||
extern _LONG_CALL_ long long simple_strtoll(const char *cp, char **endp, unsigned int base);
|
||||
extern _LONG_CALL_ unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
|
||||
extern _LONG_CALL_ const char *_parse_integer_fixup_radix(const char *s, unsigned int *base);
|
||||
extern _LONG_CALL_ unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long *p);
|
||||
extern _LONG_CALL_ u64 div_u64(u64 dividend, u32 divisor);
|
||||
extern _LONG_CALL_ s64 div_s64(s64 dividend, s32 divisor);
|
||||
extern _LONG_CALL_ u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder);
|
||||
extern _LONG_CALL_ s64 div_s64_rem(s64 dividend, s32 divisor, s32 *remainder);
|
||||
extern _LONG_CALL_ char *_strpbrk(const char *cs, const char *ct);
|
||||
extern _LONG_CALL_ char *_strchr(const char *s, int c);
|
||||
|
||||
|
||||
extern _LONG_CALL_ VOID
|
||||
prvStrCpy(
|
||||
IN u8 *pDES,
|
||||
IN const u8 *pSRC
|
||||
);
|
||||
|
||||
extern _LONG_CALL_ u32
|
||||
prvStrLen(
|
||||
IN const u8 *pSRC
|
||||
);
|
||||
|
||||
extern _LONG_CALL_ u8
|
||||
prvStrCmp(
|
||||
IN const u8 *string1,
|
||||
IN const u8 *string2
|
||||
);
|
||||
|
||||
extern _LONG_CALL_ u8*
|
||||
StrUpr(
|
||||
IN u8 *string
|
||||
);
|
||||
|
||||
extern _LONG_CALL_ int prvAtoi(
|
||||
IN const char * s
|
||||
);
|
||||
|
||||
extern _LONG_CALL_ char * prvStrStr(
|
||||
IN const char * str1,
|
||||
IN const char * str2
|
||||
);
|
||||
|
||||
extern _LONG_CALL_ char* prvStrtok(
|
||||
IN char *str,
|
||||
IN const char* delim
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Fast implementation of tolower() for internal usage. Do not use in your
|
||||
* code.
|
||||
*/
|
||||
static inline char _tolower(const char c)
|
||||
{
|
||||
return c | 0x20;
|
||||
}
|
||||
|
||||
/* Fast check for octal digit */
|
||||
static inline int isodigit(const char c)
|
||||
{
|
||||
return c >= '0' && c <= '7';
|
||||
}
|
||||
#ifndef strtoul
|
||||
#define strtoul(str, endp, base) Strtoul(str, endp, base)
|
||||
#endif
|
||||
#ifndef strtol
|
||||
#define strtol(str, endp, base) simple_strtol(str, endp, base)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
37
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/va_list.h
Normal file
37
lib/amb1_sdk/soc/realtek/8711b/swlib/rtl_lib/va_list.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Routines to access hardware
|
||||
*
|
||||
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*/
|
||||
|
||||
#ifndef _VA_LIST_H_
|
||||
#define _VA_LIST_H_
|
||||
|
||||
#include "platform_autoconf.h"
|
||||
#include "basic_types.h"
|
||||
|
||||
#ifndef va_arg //this part is adapted from linux (Linux/include/acpi/platform/acenv.h)
|
||||
|
||||
typedef s32 acpi_native_int;//this definition is in (Linux/include/acpi/actypes.h)
|
||||
|
||||
#ifndef _VALIST
|
||||
#define _VALIST
|
||||
typedef char *va_list;
|
||||
#endif /* _VALIST */
|
||||
|
||||
/* Storage alignment properties */
|
||||
#define _AUPBND (sizeof (acpi_native_int) - 1)
|
||||
#define _ADNBND (sizeof (acpi_native_int) - 1)
|
||||
|
||||
/* Variable argument list macro definitions */
|
||||
#define _bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
|
||||
#define va_arg(ap, T) (*(T *)(((ap) += (_bnd (T, _AUPBND))) - (_bnd (T,_ADNBND))))
|
||||
#define va_end(ap) (ap = (va_list) NULL)
|
||||
#define va_start(ap, A) (void) ((ap) = (((char *) &(A)) + (_bnd (A,_AUPBND))))
|
||||
|
||||
#endif /* va_arg */
|
||||
|
||||
#endif //_VA_LIST_H_
|
||||
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
* rtl_lib.h
|
||||
*
|
||||
* Definitions for RTL library functions
|
||||
*/
|
||||
|
||||
#ifndef _RTL_LIB_ROM_H_
|
||||
#define _RTL_LIB_ROM_H_
|
||||
|
||||
|
||||
#include <basic_types.h>
|
||||
#include <diag.h>
|
||||
|
||||
#include <reent.h>
|
||||
|
||||
#include "../libc/rom/string/rom_libc_string.h"
|
||||
#include "../libgloss/rtl8195a/rom/rom_libgloss_retarget.h"
|
||||
|
||||
#ifndef _PTR
|
||||
#define _PTR void *
|
||||
#endif
|
||||
|
||||
#ifndef _AND
|
||||
#define _AND ,
|
||||
#endif
|
||||
|
||||
#ifndef _NOARGS
|
||||
#define _NOARGS void
|
||||
#endif
|
||||
|
||||
#ifndef _CONST
|
||||
#define _CONST const
|
||||
#endif
|
||||
|
||||
#ifndef _VOLATILE
|
||||
#define _VOLATILE volatile
|
||||
#endif
|
||||
|
||||
#ifndef _SIGNED
|
||||
#define _SIGNED signed
|
||||
#endif
|
||||
|
||||
#ifndef _DOTS
|
||||
#define _DOTS , ...
|
||||
#endif
|
||||
|
||||
#ifndef _VOID
|
||||
#define _VOID void
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// RTL library functions in ROM
|
||||
//
|
||||
|
||||
#define __rtl_memset __rtl_memset_v1_00
|
||||
#define __rtl_memchr __rtl_memchr_v1_00
|
||||
#define __rtl_memmove __rtl_memmove_v1_00
|
||||
#define __rtl_strcmp __rtl_strcmp_v1_00
|
||||
#define __rtl_memcpy __rtl_memcpy_v1_00
|
||||
|
||||
|
||||
|
||||
extern _LONG_CALL_ void * __rtl_memset_v1_00(void * m , int c , size_t n);
|
||||
extern _LONG_CALL_ void * __rtl_memchr_v1_00(const void * src_void , int c , size_t length);
|
||||
extern _LONG_CALL_ void * __rtl_memmove_v1_00( void * dst_void , const void * src_void , size_t length);
|
||||
extern _LONG_CALL_ int __rtl_strcmp_v1_00(const char *s1 , const char *s2);
|
||||
extern _LONG_CALL_ void * __rtl_memcpy_v1_00(void * __restrict dst0 , const void * __restrict src0 , size_t len0);
|
||||
|
||||
|
||||
//
|
||||
// rtl eabi functions
|
||||
//
|
||||
|
||||
#define __rtl_itod __rtl_itod_v1_00
|
||||
#define __rtl_dtoi __rtl_dtoi_v1_00
|
||||
#define __rtl_uitof __rtl_uitof_v1_00
|
||||
#define __rtl_uitod __rtl_uitod_v1_00
|
||||
|
||||
|
||||
|
||||
#define __rtl_dcmpeq __rtl_dcmpeq_v1_00
|
||||
#define __rtl_dcmplt __rtl_dcmplt_v1_00
|
||||
#define __rtl_dcmpgt __rtl_dcmpgt_v1_00
|
||||
|
||||
|
||||
#define __rtl_dadd __rtl_dadd_v1_00
|
||||
#define __rtl_dsub __rtl_dsub_v1_00
|
||||
#define __rtl_dmul __rtl_dmul_v1_00
|
||||
#define __rtl_ddiv __rtl_ddiv_v1_00
|
||||
|
||||
extern _LONG_CALL_ double __rtl_itod_v1_00(int lval);
|
||||
extern _LONG_CALL_ int __rtl_dtoi_v1_00(double d);
|
||||
extern _LONG_CALL_ float __rtl_uitof_v1_00(unsigned int lval);
|
||||
extern _LONG_CALL_ double __rtl_uitod_v1_00(unsigned int lval);
|
||||
|
||||
|
||||
extern _LONG_CALL_ int __rtl_dcmpeq_v1_00(double a, double b);
|
||||
extern _LONG_CALL_ int __rtl_dcmplt_v1_00(double a, double b);
|
||||
extern _LONG_CALL_ int __rtl_dcmpgt_v1_00(double a, double b);
|
||||
|
||||
|
||||
extern _LONG_CALL_ double __rtl_dadd_v1_00(double a, double b);
|
||||
extern _LONG_CALL_ double __rtl_dsub_v1_00(double a, double b);
|
||||
extern _LONG_CALL_ double __rtl_dmul_v1_00(double a, double b);
|
||||
extern _LONG_CALL_ double __rtl_ddiv_v1_00(double a, double b);
|
||||
|
||||
|
||||
//
|
||||
// mprec
|
||||
//
|
||||
|
||||
#include <reent.h>
|
||||
|
||||
|
||||
typedef struct _Bigint _Bigint;
|
||||
|
||||
|
||||
#define __rtl_Balloc __rtl_Balloc_v1_00
|
||||
#define __rtl_Bfree __rtl_Bfree_v1_00
|
||||
#define __rtl_d2b __rtl_d2b_v1_00
|
||||
#define __rtl_i2b __rtl_i2b_v1_00
|
||||
#define __rtl_pow5mult __rtl_pow5mult_v1_00
|
||||
#define __rtl_multadd __rtl_multadd_v1_00
|
||||
#define __rtl_mult __rtl_mult_v1_00
|
||||
#define __rtl_hi0bits __rtl_hi0bits_v1_00
|
||||
#define __rtl_lshift __rtl_lshift_v1_00
|
||||
#define __rtl_cmp __rtl_cmp_v1_00
|
||||
#define __rtl_diff __rtl_diff_v1_00
|
||||
|
||||
|
||||
extern _LONG_CALL_ _Bigint * __rtl_Balloc_v1_00(struct _reent *ptr, int k);
|
||||
|
||||
extern _LONG_CALL_ void __rtl_Bfree_v1_00(struct _reent *ptr, _Bigint * v);
|
||||
|
||||
extern _LONG_CALL_ _Bigint * __rtl_d2b_v1_00(struct _reent * ptr, double _d, int *e, int *bits);
|
||||
extern _LONG_CALL_ _Bigint * __rtl_i2b_v1_00(struct _reent *ptr, int i );
|
||||
extern _LONG_CALL_ _Bigint * __rtl_pow5mult_v1_00(struct _reent * ptr, _Bigint *b, int k);
|
||||
extern _LONG_CALL_ _Bigint * __rtl_multadd_v1_00(struct _reent *ptr, _Bigint * b, int m, int a);
|
||||
extern _LONG_CALL_ _Bigint * __rtl_mult_v1_00(struct _reent *ptr, _Bigint *a, _Bigint *b);
|
||||
extern _LONG_CALL_ int __rtl_hi0bits_v1_00(register __ULong x);
|
||||
extern _LONG_CALL_ _Bigint *__rtl_lshift_v1_00(struct _reent *ptr, _Bigint *b, int k);
|
||||
extern _LONG_CALL_ int __rtl_cmp_v1_00(_Bigint *a, _Bigint *b);
|
||||
extern _LONG_CALL_ _Bigint *__rtl_diff_v1_00(struct _reent* ptr, _Bigint *a, _Bigint *b);
|
||||
|
||||
//
|
||||
// dtoa
|
||||
//
|
||||
|
||||
#define __rtl_dtoa_r __rtl_dtoa_r_v1_00
|
||||
|
||||
extern char * __rtl_dtoa_r_v1_00(struct _reent *ptr, double _d, int mode, int ndigits, int *decpt, int *sign, char **rve);
|
||||
|
||||
//
|
||||
// mallocr
|
||||
//
|
||||
#include <sys/config.h>
|
||||
#include <reent.h>
|
||||
|
||||
|
||||
|
||||
#define __rom_mallocr_init __rom_mallocr_init_v1_00
|
||||
|
||||
#define __rtl_calloc_r __rtl_calloc_r_v1_00
|
||||
#define __rtl_cfree_r __rtl_cfree_r_v1_00
|
||||
#define __rtl_malloc_r __rtl_malloc_r_v1_00
|
||||
#define __rtl_free_r __rtl_free_r_v1_00
|
||||
#define __rtl_realloc_r __rtl_realloc_r_v1_00
|
||||
#define __rtl_memalign_r __rtl_memalign_r_v1_00
|
||||
#define __rtl_valloc_r __rtl_valloc_r_v1_00
|
||||
#define __rtl_pvalloc_r __rtl_pvalloc_r_v1_00
|
||||
|
||||
|
||||
extern _LONG_CALL_ void __rom_mallocr_init_v1_00(void);
|
||||
|
||||
|
||||
#define RARG struct _reent *reent_ptr,
|
||||
extern _LONG_CALL_ void* __rtl_calloc_r_v1_00(RARG size_t n, size_t elem_size);
|
||||
extern _LONG_CALL_ void __rtl_cfree_r_v1_00(void *mem);
|
||||
extern _LONG_CALL_ void* __rtl_malloc_r_v1_00(RARG size_t bytes);
|
||||
extern _LONG_CALL_ void __rtl_free_r_v1_00(RARG void* mem);
|
||||
extern _LONG_CALL_ void* __rtl_realloc_r_v1_00(RARG void* oldmem, size_t bytes);
|
||||
extern _LONG_CALL_ void* __rtl_memalign_r_v1_00(RARG size_t alignment, size_t bytes);
|
||||
extern _LONG_CALL_ void* __rtl_valloc_r_v1_00(RARG size_t bytes);
|
||||
extern _LONG_CALL_ void* __rtl_pvalloc_r_v1_00(RARG size_t bytes);
|
||||
|
||||
|
||||
//
|
||||
// stdio
|
||||
//
|
||||
extern int __rtl_errno;
|
||||
|
||||
#ifndef _READ_WRITE_RETURN_TYPE
|
||||
#define _READ_WRITE_RETURN_TYPE _ssize_t
|
||||
#endif
|
||||
|
||||
#ifndef _READ_WRITE_BUFSIZE_TYPE
|
||||
#define _READ_WRITE_BUFSIZE_TYPE int
|
||||
#endif
|
||||
|
||||
#define __rtl_sread __rtl_sread_v1_00
|
||||
#define __rtl_swrite __rtl_swrite_v1_00
|
||||
#define __rtl_seofread __rtl_seofread_v1_00
|
||||
#define __rtl_sseek __rtl_sseek_v1_00
|
||||
#define __rtl_sclose __rtl_sclose_v1_00
|
||||
#define __rtl_sbrk_r __rtl_sbrk_r_v1_00
|
||||
|
||||
extern _LONG_CALL_ _READ_WRITE_RETURN_TYPE __rtl_sread_v1_00(
|
||||
struct _reent *ptr,
|
||||
void *cookie,
|
||||
char *buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE n);
|
||||
|
||||
extern _LONG_CALL_ _READ_WRITE_RETURN_TYPE __rtl_swrite_v1_00(
|
||||
struct _reent *ptr,
|
||||
void *cookie,
|
||||
char const *buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE n);
|
||||
|
||||
extern _LONG_CALL_ _READ_WRITE_RETURN_TYPE __rtl_seofread_v1_00(
|
||||
struct _reent *_ptr,
|
||||
_PTR cookie,
|
||||
char *buf,
|
||||
_READ_WRITE_BUFSIZE_TYPE len);
|
||||
|
||||
extern _LONG_CALL_ _fpos_t __rtl_sseek_v1_00(
|
||||
struct _reent *ptr _AND
|
||||
void *cookie _AND
|
||||
_fpos_t offset _AND
|
||||
int whence);
|
||||
|
||||
extern _LONG_CALL_ int __rtl_sclose_v1_00(
|
||||
struct _reent *ptr _AND
|
||||
void *cookie);
|
||||
|
||||
extern _LONG_CALL_ void * __rtl_sbrk_r_v1_00(
|
||||
struct _reent *ptr,
|
||||
ptrdiff_t incr);
|
||||
|
||||
//
|
||||
// vfprintf
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define __rtl_fflush_r __rtl_fflush_r_v1_00
|
||||
#define __rtl_vfprintf_r __rtl_vfprintf_r_v1_00
|
||||
|
||||
extern _LONG_CALL_ int __rtl_fflush_r_v1_00(struct _reent *ptr, register FILE * fp);
|
||||
extern _LONG_CALL_ int __rtl_vfprintf_r_v1_00(struct _reent *, FILE *, const char *, va_list);
|
||||
|
||||
|
||||
#endif /* _RTL_LIB_ROM_H_ */
|
||||
144
lib/amb1_sdk/soc/realtek/8711b/swlib/std_lib/include/rtl_lib.h
Normal file
144
lib/amb1_sdk/soc/realtek/8711b/swlib/std_lib/include/rtl_lib.h
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* rtl_lib.h
|
||||
*
|
||||
* Definitions for RTL library functions
|
||||
*/
|
||||
|
||||
#ifndef _RTL_LIB_H_
|
||||
#define _RTL_LIB_H_
|
||||
|
||||
|
||||
#include <basic_types.h>
|
||||
#include <diag.h>
|
||||
#include <va_list.h>
|
||||
|
||||
extern int __rtl_errno;
|
||||
|
||||
|
||||
void init_rom_libgloss_ram_map(void);
|
||||
|
||||
|
||||
//
|
||||
// RTL library functions for Libc::stdio
|
||||
//
|
||||
|
||||
extern int rtl_printf(IN const char* fmt, ...);
|
||||
extern int rtl_vprintf(const char *fmt, va_list ap);
|
||||
extern int rtl_sprintf(char* str, const char* fmt, ...);
|
||||
extern int rtl_snprintf(char* str, size_t size, const char* fmt, ...);
|
||||
extern int rtl_vsnprintf(char *str, size_t size, const char *fmt, va_list ap);
|
||||
|
||||
//
|
||||
// RTL library functions for string
|
||||
//
|
||||
|
||||
extern void * rtl_memchr(const void * src_void , int c , size_t length);
|
||||
extern int rtl_memcmp(const void * m1 , const void * m2 , size_t n);
|
||||
extern void * rtl_memcpy(void * dst0 , const void * src0 , size_t len0);
|
||||
extern void * rtl_memmove( void * dst_void , const void * src_void , size_t length);
|
||||
extern void * rtl_memset(void * m , int c , size_t n);
|
||||
extern char * rtl_strcat(char * s1 , const char * s2);
|
||||
extern char * rtl_strchr(const char *s1 , int i);
|
||||
extern int rtl_strcmp(const char *s1 , const char *s2);
|
||||
extern char* rtl_strcpy(char *dst0 , const char *src0);
|
||||
extern size_t rtl_strlen(const char *str);
|
||||
extern char * rtl_strncat(char * s1 , const char * s2 , size_t n);
|
||||
extern int rtl_strncmp(const char *s1 , const char *s2 , size_t n);
|
||||
extern char * rtl_strncpy(char * dst0 , const char * src0 , size_t count);
|
||||
extern char * rtl_strstr(const char *searchee , const char *lookfor);
|
||||
extern char * rtl_strsep(char **source_ptr , const char *delim);
|
||||
extern char * rtl_strtok(char * s , const char * delim);
|
||||
|
||||
//
|
||||
// RTL library functions for math
|
||||
//
|
||||
|
||||
|
||||
extern double rtl_fabs(double);
|
||||
extern float rtl_fabsf(float a);
|
||||
extern float rtl_cos_f32(float a);
|
||||
extern float rtl_sin_f32(float a);
|
||||
|
||||
extern float rtl_fadd(float a, float b);
|
||||
extern float rtl_fsub(float a, float b);
|
||||
extern float rtl_fmul(float a, float b);
|
||||
extern float rtl_fdiv(float a, float b);
|
||||
|
||||
extern int rtl_fcmplt(float a, float b);
|
||||
extern int rtl_fcmpgt(float a, float b);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// RTL eabi functions
|
||||
|
||||
extern double rtl_ftod(float f);
|
||||
|
||||
extern double rtl_ddiv(double a, double b);
|
||||
|
||||
|
||||
//
|
||||
// Macro Library Functions
|
||||
//
|
||||
|
||||
typedef union
|
||||
{
|
||||
float value;
|
||||
u32 word;
|
||||
} ieee_float_shape_type;
|
||||
|
||||
/* Get a 32 bit int from a float. */
|
||||
|
||||
#define GET_FLOAT_WORD(i,d) \
|
||||
do { \
|
||||
ieee_float_shape_type gf_u; \
|
||||
gf_u.value = (d); \
|
||||
(i) = gf_u.word; \
|
||||
} while (0)
|
||||
|
||||
/* Set a float from a 32 bit int. */
|
||||
|
||||
#define SET_FLOAT_WORD(d,i) \
|
||||
do { \
|
||||
ieee_float_shape_type sf_u; \
|
||||
sf_u.word = (i); \
|
||||
(d) = sf_u.value; \
|
||||
} while (0)
|
||||
|
||||
static inline
|
||||
float rtl_nanf(void)
|
||||
{
|
||||
float x;
|
||||
|
||||
SET_FLOAT_WORD(x,0x7fc00000);
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Library Test functions
|
||||
//
|
||||
|
||||
extern int rtl_sscanf_patch_test(void);
|
||||
extern int rtl_lib_test(IN u16 argc, IN u8 *argv[]);
|
||||
extern int rtl_math_test(IN u16 argc, IN u8 *argv[]);
|
||||
extern int rtl_string_test(IN u16 argc, IN u8 *argv[]);
|
||||
|
||||
|
||||
//
|
||||
// Macro functions
|
||||
//
|
||||
|
||||
#undef dbg_printf
|
||||
#define dbg_printf(fmt, args...) \
|
||||
rtl_printf("%s():%d : " fmt "\n", __FUNCTION__, __LINE__, ##args);
|
||||
|
||||
|
||||
#undef err_printf
|
||||
#define err_printf(fmt, args...) \
|
||||
rtl_printf("%s():%d : " fmt "\n", __FUNCTION__, __LINE__, ##args);
|
||||
|
||||
|
||||
#endif /* _RTL_LIB_H_ */
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* rom_libc_string.h
|
||||
*
|
||||
* Definitions for standard library - libc functions.
|
||||
*/
|
||||
#ifndef _ROM_LIBC_STRING_H_
|
||||
#define _ROM_LIBC_STRING_H_
|
||||
|
||||
#include <basic_types.h>
|
||||
|
||||
#define __rtl_memchr __rtl_memchr_v1_00
|
||||
#define __rtl_memcmp __rtl_memcmp_v1_00
|
||||
#define __rtl_memcpy __rtl_memcpy_v1_00
|
||||
#define __rtl_memmove __rtl_memmove_v1_00
|
||||
#define __rtl_memset __rtl_memset_v1_00
|
||||
#define __rtl_strcat __rtl_strcat_v1_00
|
||||
#define __rtl_strchr __rtl_strchr_v1_00
|
||||
#define __rtl_strcmp __rtl_strcmp_v1_00
|
||||
#define __rtl_strcpy __rtl_strcpy_v1_00
|
||||
#define __rtl_strlen __rtl_strlen_v1_00
|
||||
#define __rtl_strncat __rtl_strncat_v1_00
|
||||
#define __rtl_strncmp __rtl_strncmp_v1_00
|
||||
#define __rtl_strncpy __rtl_strncpy_v1_00
|
||||
#define __rtl_strstr __rtl_strstr_v1_00
|
||||
#define __rtl_strsep __rtl_strsep_v1_00
|
||||
#define __rtl_strtok __rtl_strtok_v1_00
|
||||
|
||||
#define __rtl_critical_factorization __rtl_critical_factorization_v1_00
|
||||
#define __rtl_two_way_short_needle __rtl_two_way_short_needle_v1_00
|
||||
#define __rtl_two_way_long_needle __rtl_two_way_long_needle_v1_00
|
||||
|
||||
extern _LONG_CALL_ void * __rtl_memchr_v1_00(const void * src_void , int c , size_t length);
|
||||
extern _LONG_CALL_ int __rtl_memcmp_v1_00(const void * m1 , const void * m2 , size_t n);
|
||||
extern _LONG_CALL_ void * __rtl_memcpy_v1_00(void * __restrict dst0 , const void * __restrict src0 , size_t len0);
|
||||
extern _LONG_CALL_ void * __rtl_memmove_v1_00( void * dst_void , const void * src_void , size_t length);
|
||||
extern _LONG_CALL_ void * __rtl_memset_v1_00(void * m , int c , size_t n);
|
||||
extern _LONG_CALL_ char * __rtl_strcat_v1_00(char *__restrict s1 , const char *__restrict s2);
|
||||
extern _LONG_CALL_ char * __rtl_strchr_v1_00(const char *s1 , int i);
|
||||
extern _LONG_CALL_ int __rtl_strcmp_v1_00(const char *s1 , const char *s2);
|
||||
extern _LONG_CALL_ char* __rtl_strcpy_v1_00(char *dst0 , const char *src0);
|
||||
extern _LONG_CALL_ size_t __rtl_strlen_v1_00(const char *str);
|
||||
extern _LONG_CALL_ char * __rtl_strncat_v1_00(char *__restrict s1 , const char *__restrict s2 , size_t n);
|
||||
extern _LONG_CALL_ int __rtl_strncmp_v1_00(const char *s1 , const char *s2 , size_t n);
|
||||
extern _LONG_CALL_ char * __rtl_strncpy_v1_00(char *__restrict dst0 , const char *__restrict src0 , size_t count);
|
||||
extern _LONG_CALL_ char * __rtl_strstr_v1_00(const char *searchee , const char *lookfor);
|
||||
extern _LONG_CALL_ char * __rtl_strsep_v1_00(register char **source_ptr , register const char *delim);
|
||||
extern _LONG_CALL_ char * __rtl_strtok_v1_00(register char *__restrict s , register const char *__restrict delim);
|
||||
|
||||
#endif /* _ROM_LIBC_STRING_H_ */
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef ROM_LIBGLOSS_RETARGET_H
|
||||
#define ROM_LIBGLOSS_RETARGET_H
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <basic_types.h>
|
||||
|
||||
#define __rtl_close __rtl_close_v1_00
|
||||
#define __rtl_fstat __rtl_fstat_v1_00
|
||||
#define __rtl_isatty __rtl_isatty_v1_00
|
||||
#define __rtl_lseek __rtl_lseek_v1_00
|
||||
#define __rtl_open __rtl_open_v1_00
|
||||
#define __rtl_read __rtl_read_v1_00
|
||||
#define __rtl_write __rtl_write_v1_00
|
||||
#define __rtl_sbrk __rtl_sbrk_v1_00
|
||||
|
||||
extern _LONG_CALL_ int __rtl_close_v1_00(int fildes);
|
||||
extern _LONG_CALL_ int __rtl_fstat_v1_00(int fildes , struct stat *st);
|
||||
extern _LONG_CALL_ int __rtl_isatty_v1_00(int file);
|
||||
extern _LONG_CALL_ int __rtl_lseek_v1_00(int file , int ptr , int dir);
|
||||
extern _LONG_CALL_ int __rtl_open_v1_00(char *file , int flags , int mode);
|
||||
extern _LONG_CALL_ int __rtl_read_v1_00(int file , char *ptr , int len);
|
||||
extern _LONG_CALL_ int __rtl_write_v1_00(int file , const char *ptr , int len);
|
||||
extern _LONG_CALL_ void* __rtl_sbrk_v1_00(int incr);
|
||||
|
||||
|
||||
struct _rom_libgloss_ram_map {
|
||||
int (*libgloss_close)(int fildes);
|
||||
int (*libgloss_fstat)(int fildes , struct stat *st);
|
||||
int (*libgloss_isatty)(int file);
|
||||
int (*libgloss_lseek)(int file , int ptr , int dir);
|
||||
int (*libgloss_open)(char *file , int flags , int mode);
|
||||
int (*libgloss_read)(int file , char *ptr , int len);
|
||||
int (*libgloss_write)(int file , const char *ptr , int len);
|
||||
void* (*libgloss_sbrk)(int incr);
|
||||
};
|
||||
|
||||
#endif /* ROM_LIBGLOSS_RETARGET_H */
|
||||
Reference in New Issue
Block a user