mirror of
https://github.com/sengeiou/realtek_ameba_mp_sdk.git
synced 2026-07-14 15:35:40 +00:00
ameba micropython sdk first commit
This commit is contained in:
commit
8508ee6139
5619 changed files with 1874619 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* 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_
|
||||
|
||||
_LONG_CALL_ extern u32 cmd_dump_word(u16 argc, u8 *argv[]);
|
||||
_LONG_CALL_ extern u32 cmd_write_word(u16 argc, u8 *argv[]);
|
||||
_LONG_CALL_ extern u32 cmd_flash(u16 argc, u8 *argv[]);
|
||||
_LONG_CALL_ extern u32 cmd_efuse(u16 argc, u8 *argv[]);
|
||||
_LONG_CALL_ u32 cmd_rom_table(void** PTable);
|
||||
|
||||
#define CmdDumpWord cmd_dump_word
|
||||
#define CmdWriteWord cmd_write_word
|
||||
#endif
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @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.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
u32 LOG_PRINTF_BUFFER(const char *fmt);
|
||||
u32 LOG_PRINTF_BUFFER_INIT(u32 thread_init);
|
||||
u32 LOG_BUFF_SUSPEND(void);
|
||||
u32 LOG_BUFF_RESUME(void);
|
||||
|
||||
#define LOG_BUFFER_NUM 6
|
||||
#define LOG_BUFFER_SIZE 512
|
||||
typedef struct {
|
||||
char buffer[LOG_BUFFER_SIZE];
|
||||
/* please define member after buffer */
|
||||
} log_buffer_t;
|
||||
extern log_buffer_t log_buffer[];
|
||||
|
||||
typedef u32 (*DIAG_PRINT_BUF_FUNC)(const char *fmt);
|
||||
|
||||
extern DIAG_PRINT_BUF_FUNC ConfigDebugBufferGet;
|
||||
/******************* (C) COPYRIGHT 2016 Realtek Semiconductor *****END OF FILE****/
|
||||
122
sdk/component/soc/realtek/amebad/app/monitor/include/shell.h
Normal file
122
sdk/component/soc/realtek/amebad/app/monitor/include/shell.h
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* 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 16
|
||||
|
||||
typedef u32 (*ECHOFUNC)(IN u8*,...); //UART LOG echo-function type.
|
||||
typedef u32 (*monitor_cmd_handler)(u16 argc, u8* argv[]);
|
||||
|
||||
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 _COMMAND_TABLE_ {
|
||||
const u8* cmd;
|
||||
u16 ArgvCnt;
|
||||
u32 (*func)(u16 argc, u8* argv[]);
|
||||
const u8* msg;
|
||||
}COMMAND_TABLE, *PCOMMAND_TABLE;
|
||||
|
||||
|
||||
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;
|
||||
u32 CRSTS;
|
||||
#ifdef CONFIG_UART_LOG_HISTORY
|
||||
u8 (*pHistoryBuf)[UART_LOG_CMD_BUFLEN];
|
||||
#endif
|
||||
|
||||
void (*GiveSema)(void);
|
||||
u32 shell_task_rdy;
|
||||
} 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 AMEBA_CONSOLE_PREFIX "#"
|
||||
#define CONSOLE_AMEBA(...) do {\
|
||||
_ConsolePrint("\r" AMEBA_CONSOLE_PREFIX __VA_ARGS__);\
|
||||
}while(0)
|
||||
|
||||
_LONG_CALL_ VOID shell_init_rom(u32 TBLSz, VOID *pTBL);
|
||||
_LONG_CALL_ VOID shell_task_rom(VOID *Data);
|
||||
_LONG_CALL_ VOID shell_rom(u32 MaxWaitCount);
|
||||
_LONG_CALL_ void shell_uart_irq_rom(void * Data);
|
||||
|
||||
_LONG_CALL_
|
||||
extern VOID
|
||||
shell_cmd_history(
|
||||
IN u8 RevData,
|
||||
IN UART_LOG_CTL *prvUartLogCtl,
|
||||
IN u8 EchoFlag
|
||||
);
|
||||
_LONG_CALL_
|
||||
extern u8
|
||||
shell_cmd_chk(
|
||||
IN u8 RevData,
|
||||
IN UART_LOG_CTL *prvUartLogCtl,
|
||||
IN u8 EchoFlag
|
||||
);
|
||||
|
||||
_LONG_CALL_
|
||||
extern VOID
|
||||
shell_array_init(
|
||||
IN u8 *pArrayToInit,
|
||||
IN u8 ArrayLen,
|
||||
IN u8 InitValue
|
||||
);
|
||||
extern u8** shell_get_argv(const u8 *string);
|
||||
extern u8 shell_get_argc(const u8 *string);
|
||||
|
||||
VOID shell_init_ram(VOID);
|
||||
void shell_switch_ipc_int(VOID *Data, u32 IrqStatus, u32 ChanNum);
|
||||
|
||||
#define RtlConsolTaskRom shell_task_rom
|
||||
|
||||
extern u32 shell_recv_all_data_onetime;
|
||||
extern u32 shell_interrupt_on;
|
||||
#endif //_RTK_CONSOL_H_
|
||||
18
sdk/component/soc/realtek/amebad/app/touch_key/touch_key.h
Normal file
18
sdk/component/soc/realtek/amebad/app/touch_key/touch_key.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* 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 _TOUCH_KEY_H_
|
||||
#define _TOUCH_KEY_H_
|
||||
|
||||
void app_hp_jack_init(void);
|
||||
void app_captouch_init(void);
|
||||
void app_keyscan_init(u8 reset_status);
|
||||
|
||||
#endif /* _RCU_STIMULI_H_ */
|
||||
|
||||
82
sdk/component/soc/realtek/amebad/app/xmodem/xmodem_rom.h
Normal file
82
sdk/component/soc/realtek/amebad/app/xmodem/xmodem_rom.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
X-Modem Header File
|
||||
|
||||
1999/09/03 sprite, support Xmode Tx & Rx
|
||||
*/
|
||||
|
||||
#ifndef _XMODE_H_
|
||||
#define _XMODE_H_
|
||||
|
||||
#include <basic_types.h>
|
||||
|
||||
/*****************
|
||||
* X-Modem status
|
||||
*****************/
|
||||
#define XMODEM_OK 1
|
||||
#define XMODEM_CANCEL 2
|
||||
#define XMODEM_ACK 3
|
||||
#define XMODEM_NAK 4
|
||||
#define XMODEM_COMPLETE 5
|
||||
#define XMODEM_NO_SESSION 6
|
||||
#define XMODEM_ABORT 7
|
||||
#define XMODEM_TIMEOUT 8
|
||||
|
||||
/****************************
|
||||
* flow control character
|
||||
****************************/
|
||||
#define SOH 0x01 /* Start of header */
|
||||
#define STX 0x02 /* Start of header XModem-1K */
|
||||
#define EOT 0x04 /* End of transmission */
|
||||
#define ACK 0x06 /* Acknowledge */
|
||||
#define NAK 0x15 /* Not acknowledge */
|
||||
#define CAN 0x18 /* Cancel */
|
||||
#define ESC 0x1b /* User Break */
|
||||
#define BAUDSET 0x05 /* Part of shakehands, added by Realtek*/
|
||||
#define BAUDCHK 0x07 /* Part of shakehands, added by Realtek*/
|
||||
#define XMERASE 0x17 /* Erase Flash, added by Realtek*/
|
||||
#define XMREAD 0x19 /* Read Flash, added by Realtek*/
|
||||
#define XMREADV2 0x20 /* Read Flash, added by Realtek*/
|
||||
#define RXSTATUS 0x21 /* Read Status Register, added by Realtek*/
|
||||
#define TXSTATUS 0x26 /* Write Status Register, added by Realtek, AZ ACUT ROM not support*/
|
||||
#define XM_CHECKSUM 0x27 /* check flash write checksum: AZ ACUT ROM not support */
|
||||
#define XM_TXREG 0x29 /* Write REG or RAM, AZ ACUT ROM not support */
|
||||
#define XM_RXREG 0x31 /* Read REG or RAM, AZ ACUT ROM not support */
|
||||
#define XM_ROMVER 0x33 /* read rom code version(02/03/04...): AZ ACUT ROM not support */
|
||||
|
||||
/****************************
|
||||
* Xmode paramters
|
||||
****************************/
|
||||
#define FRAME_SIZE 132 /* X-modem structure */
|
||||
#define FRAME_SIZE_1K 1028 /* X-modem structure */
|
||||
#define XM_BUFFER_SIZE 1024 /* X-modem buffer */
|
||||
#define WAIT_FRAME_TIME (830 * 1000) /* 1 sec, wait frame timeout, AmebaZ SMIC: (2500 * 10000), AmebaZ UMC: (2500 * 1000)*/
|
||||
#define WAIT_CHAR_TIME (415 * 1000) /* 0.5 sec, wait char timeout AmebaZ SMIC: (1250 * 10000), AmebaZ UMC: (1250 * 1000)*/
|
||||
#define WAIT_HANDSHAKE_TIME (1660 * 1000) /* 2 sec, handshake timeout AmebaZ SMIC: (2500 * 10000), AmebaZ UMC: (1250 * 1000)*/
|
||||
#define XMODEM_READ_MAXRETRANS 25
|
||||
|
||||
/***********************
|
||||
* frame structure
|
||||
***********************/
|
||||
typedef struct
|
||||
{
|
||||
unsigned char soh;
|
||||
unsigned char recordNo;
|
||||
unsigned char recordNoInverted;
|
||||
unsigned char buffer[XM_BUFFER_SIZE];
|
||||
unsigned char CRC;
|
||||
} XMODEM_FRAME;
|
||||
|
||||
typedef struct _XMODEM_CTRL_ {
|
||||
u16 currentFrame; /* current frame number */
|
||||
u16 expected;
|
||||
s32 rFinish;
|
||||
u32 total_frame;
|
||||
}XMODEM_CTRL, *PXMODEM_CTRL;
|
||||
|
||||
u32 xmodem_img_rxbuffer(u32 baud_rate);
|
||||
|
||||
/* wll define in section header later */
|
||||
#define FWU_DATA_SECTION
|
||||
|
||||
#endif /* _XMODE_H_ */
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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 _XMPORT_UART_H_
|
||||
#define _XMPORT_UART_H_
|
||||
|
||||
struct _xmodem_uart_map {
|
||||
void (*xmodem_uart_init)(u8 uart_idx, u8 pin_mux, u32 baud_rate);
|
||||
void (*xmodem_uart_deinit)(void);
|
||||
void (*xmodem_uart_port_init)(u8 uart_idx, u8 pin_mux, u32 baud_rate);
|
||||
void (*xmodem_uart_port_deinit)(u8 uart_idx);
|
||||
char (*xmodem_uart_readable)(void);
|
||||
char (*xmodem_uart_writable)(void);
|
||||
char (*xmodem_uart_getc)(void);
|
||||
void (*xmodem_uart_putc)(char c);
|
||||
void (*xmodem_uart_putdata)(u8* buf, u32 cnt);
|
||||
char (*xmodem_uart_getc_to)(char *pch, u32 timeout);
|
||||
void (*xmodem_uart_clean_rx)(void);
|
||||
};
|
||||
|
||||
extern UART_TypeDef* xmodem_uartx;
|
||||
|
||||
_LONG_CALL_ void xmodem_uart_init(u8 uart_idx, u8 pin_mux, u32 baud_rate);
|
||||
_LONG_CALL_ void xmodem_uart_deinit(void) ;
|
||||
_LONG_CALL_ void xmodem_uart_port_init(u8 uart_idx, u8 pin_mux, u32 baud_rate);
|
||||
_LONG_CALL_ void xmodem_uart_port_deinit(u8 uart_idx);
|
||||
_LONG_CALL_ char xmodem_uart_readable(void) ;
|
||||
_LONG_CALL_ char xmodem_uart_writable(void) ;
|
||||
_LONG_CALL_ char xmodem_uart_getc(void) ;
|
||||
_LONG_CALL_ void xmodem_uart_putc(char c) ;
|
||||
_LONG_CALL_ void xmodem_uart_putdata(u8* buf, u32 cnt) ;
|
||||
_LONG_CALL_ char xmodem_uart_getc_to(char *pch, u32 timeout);
|
||||
_LONG_CALL_ void xmodem_uart_clean_rx(void);
|
||||
|
||||
#endif // end of "#define _XMPORT_UART_H_"
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* 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 _FW_UPDATE_ROM_H_
|
||||
#define _FW_UPDATE_ROM_H_
|
||||
|
||||
#include "ameba_soc.h"
|
||||
|
||||
#define BOOT_UART_IDX 0
|
||||
#define BOOT_UART_PIN_MUX 1
|
||||
#define BOOT_UART_BAUD_RATE 38400
|
||||
#define BOOT_UART_MAX_IMG_SZ (32*1024*1024) // 32M
|
||||
|
||||
extern VOID xmodem_img_write(char *ptr, unsigned int wr_offset, unsigned int frame_size);
|
||||
extern VOID xmodem_img_download(u8 uart_idx);
|
||||
|
||||
#endif // end of "#define _FW_UPDATE_ROM_H_"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue