initial commit

This commit is contained in:
Tautvydas Belgeras 2018-06-05 16:16:17 +03:00
commit 60a7afcc83
2528 changed files with 1001987 additions and 0 deletions

View file

@ -0,0 +1,68 @@
/*
* 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 _MONITOR_LIB_H_
#define _MONITOR_LIB_H_
VOID
DumpForOneBytes(
IN u8 *pData,
IN u8 Len
);
_LONG_CALL_
extern u32
CmdDumpByte(
IN u16 argc,
IN u8 *argv[]
);
_LONG_CALL_
extern u32
CmdDumpHalfWord(
IN u16 argc,
IN u8 *argv[]
);
_LONG_CALL_
extern u32
CmdDumpWord(
IN u16 argc,
IN u8 *argv[]
);
_LONG_CALL_
extern u32
CmdWriteByte(
IN u16 argc,
IN u8 *argv[]
);
_LONG_CALL_
extern u32
CmdWriteWord(
IN u16 argc,
IN u8 *argv[]
);
_LONG_CALL_
extern u32 CmdFlash(
IN u16 argc,
IN u8 *argv[]
);
_LONG_CALL_
extern u32 CmdEfuse(
IN u16 argc,
IN u8 *argv[]
);
#endif

View file

@ -0,0 +1,92 @@
/*
* 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 _RTK_CONSOL_H_
#define _RTK_CONSOL_H_
//Log UART
//UART_LOG_CMD_BUFLEN: only 126 bytes could be used for keeping input
// cmd, the last byte is for string end ('\0').
#define UART_LOG_CMD_BUFLEN 127
#define MAX_ARGV 10
typedef u32 (*ECHOFUNC)(IN u8*,...); //UART LOG echo-function type.
typedef struct {
u8 BufCount; //record the input cmd char number.
u8 UARTLogBuf[UART_LOG_CMD_BUFLEN]; //record the input command.
} UART_LOG_BUF, *PUART_LOG_BUF;
typedef struct {
u8 NewIdx;
u8 SeeIdx;
u8 RevdNo;
u8 EscSTS;
u8 ExecuteCmd;
u8 ExecuteEsc;
u8 BootRdy;
u8 Resvd;
PUART_LOG_BUF pTmpLogBuf;
VOID *pfINPUT;
PCOMMAND_TABLE pCmdTbl;
u32 CmdTblSz;
#ifdef CONFIG_UART_LOG_HISTORY
u32 CRSTS;
#endif
#ifdef CONFIG_UART_LOG_HISTORY
u8 (*pHistoryBuf)[UART_LOG_CMD_BUFLEN];
#endif
} UART_LOG_CTL, *PUART_LOG_CTL;
#define KB_ASCII_NUL 0x00
#define KB_ASCII_BS 0x08
#define KB_ASCII_TAB 0x09
#define KB_ASCII_LF 0x0A
#define KB_ASCII_CR 0x0D
#define KB_ASCII_ESC 0x1B
#define KB_ASCII_SP 0x20
#define KB_ASCII_BS_7F 0x7F
#define KB_ASCII_LBRKT 0x5B //[
#define KB_SPACENO_TAB 1
#ifdef CONFIG_UART_LOG_HISTORY
#define UART_LOG_HISTORY_LEN 5
#endif
#ifdef CONFIG_DEBUG_LOG
#define _ConsolePrint DiagPrintf
#else
#define _ConsolePrint
#endif
#define CONSOLE_PREFIX "<RTL8195A>"
#define CONSOLE_8195A(...) do {\
_ConsolePrint("\r"CONSOLE_PREFIX __VA_ARGS__);\
}while(0)
#define AMEBA_CONSOLE_PREFIX "#"
#define CONSOLE_AMEBA(...) do {\
_ConsolePrint("\r"AMEBA_CONSOLE_PREFIX __VA_ARGS__);\
}while(0)
_LONG_CALL_ VOID RtlConsolInit(u32 Boot, u32 TBLSz, VOID *pTBL);
_LONG_CALL_ VOID RtlConsolTaskRom(VOID *Data);
_LONG_CALL_ u32 Strtoul(const u8 *nptr, u8 **endptr, u32 base);
_LONG_CALL_ u32 GetRomCmdNum(VOID);
_LONG_CALL_ VOID UartLogCmdExecute(PUART_LOG_CTL pUartLogCtlExe);
_LONG_CALL_ VOID RtlConsolRom(u32 MaxWaitCount);
_LONG_CALL_ void LOGUART_SetBaud_FromFlash(void);
#endif //_RTK_CONSOL_H_

View 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.
*/
#ifndef _RTK_CONSOL_RAM_H_
#define _RTK_CONSOL_RAM_H_
VOID ReRegisterPlatformLogUart(VOID);
VOID RtlConsolTaskRam(VOID *Data);
#endif //_RTK_CONSOL_RAM_H_

View file

@ -0,0 +1,134 @@
/**
******************************************************************************
* @file rtl_trace.h
* @author
* @version V1.0.0
* @date 2016-05-17
* @brief This file contains all the functions for log print and mask.
******************************************************************************
* @attention
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*
* Copyright(c) 2015, Realtek Semiconductor Corporation. All rights reserved.
******************************************************************************
*/
#ifndef _RTK_TRACE_H_
#define _RTK_TRACE_H_
/** @addtogroup AmebaZ_Platform
* @{
*/
/** @defgroup Platform_Debug Debug
* @brief Platform_Debug modules
* @{
*/
/** @defgroup Platform_Debug_Log_Trace_Exported_Types Log Trace Types
* @{
*/
/** @brief Log Module Definition */
typedef enum {
MODULE_OS = 0, /**< FreeRTOS */
MODULE_BOOT = 1, /**< bootloader */
MODULE_GDMA = 2, /**< gdma */
MODULE_GPIO = 3, /**< gpio */
MODULE_TIMER = 4, /**< timer */
MODULE_I2C = 5, /**< i2c */
MODULE_I2S = 6, /**< i2s */
MODULE_PWM = 7, /**< pwm */
MODULE_SDIO = 8, /**< sdio */
MODULE_SPI = 9, /**< spi */
MODULE_FLASH = 10, /**< flash */
MODULE_UART = 11, /**< uart */
MODULE_USOC = 12, /**< usoc */
MODULE_IPSEC = 13, /**< ipsec */
MODULE_ADC = 14, /**< adc */
MODULE_EFUSE = 15, /**< efuse */
MODULE_MONIT = 16, /**< monitor */
MODULE_MISC = 17, /**< misc */
MODULE_NUMs /**< Module Number */
} MODULE_DEFINE;
/** @brief Log Level Definition */
typedef enum {
LEVEL_ERROR = 0, /**< Error */
LEVEL_WARN = 1, /**< Warning */
LEVEL_INFO = 2, /**< Information */
LEVEL_TRACE = 3, /**< Trace Data */
LEVEL_NUMs = 4 /**< Level Number */
} LEVEL_DEFINE;
/** End of Platform_Debug_Log_Trace_Exported_Types
* @}
*/
/** @defgroup Platform_Debug_Log_Trace_Functions_And_Macro Function & Macro
* @{
*/
/** @cond private */
/** @brief Debug Log mask */
extern u32 ConfigDebug[];
/** @endcond */
/**
* @brief Debug Log Mask Set.
* @param config[4] -- Print log if bit MODULE_DEFINE of config[LEVEL_DEFINE] is 1;
* @return void.
* @note Here is a MODULE_BOOT module sample to demostrate the using of LOG_MASK().
* We want to print log under ERROR level and INFO level.
* @code{.c}
* u32 debug[4];
* debug[LEVEL_ERROR] = BIT(MODULE_BOOT);
* debug[LEVEL_WARN] = 0x0;
* debug[LEVEL_INFO] = BIT(MODULE_BOOT);
* debug[LEVEL_TRACE] = 0x0;
* LOG_MASK(debug);
*
* DBG_PRINTF(MODULE_BOOT, LEVEL_INFO, "MODULE_BOOT Info.\n");
* DBG_PRINTF(MODULE_BOOT, LEVEL_ERROR, "MODULE_BOOT Error!\n");
* @endcode
*/
void LOG_MASK_MODULE(u32 module, u32 level, u32 new_status);
void LOG_MASK(u32 config[]);
void LOG_PRINTF(u32 module, u32 level, u32 line, const char*fmt, ...);
/**
* @brief DBG_PRINTF is used to print log
*/
#define RELEASE_VERSION
#ifdef RELEASE_VERSION
#define DBG_PRINTF(MODULE, LEVEL, pFormat, ...) do {\
if ((LEVEL < LEVEL_NUMs) && (MODULE < MODULE_NUMs) && (ConfigDebug[LEVEL] & BIT(MODULE))) {\
DEBUG_TRACE_DATA_SECTION static const char traceFormat[] = pFormat;\
}\
}while(0)
#else
#define DBG_PRINTF(MODULE, LEVEL, pFormat, ...) do {\
if ((LEVEL < LEVEL_NUMs) && (MODULE < MODULE_NUMs) && (ConfigDebug[LEVEL] & BIT(MODULE))) {\
static const char traceFormat[] DEBUG_TRACE_DATA_SECTION = pFormat;\
LOG_PRINTF(MODULE, LEVEL, __LINE__, traceFormat, ##__VA_ARGS__); \
}\
}while(0)
#endif
/** End of Platform_Debug_Log_Trace_Functions_And_Macro
* @}
*/
/** End of Platform_Debug
* @}
*/
/** End of AmebaZ_Platform
* @}
*/
#endif //_RTK_TRACE_H_
/******************* (C) COPYRIGHT 2016 Realtek Semiconductor *****END OF FILE****/