initial commit
This commit is contained in:
36
lib/amb1_sdk/common/mbed/hal_ext/analogin_ex_api.h
Normal file
36
lib/amb1_sdk/common/mbed/hal_ext/analogin_ex_api.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef ANALOGIN_EX_API_H
|
||||
#define ANALOGIN_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
ANALOGIN_RX_DMA_COMPLETE = 0,
|
||||
}AnalogInCallback;
|
||||
|
||||
void analogin_set_user_callback(analogin_t *obj, AnalogInCallback analogin_cb, void(*analogin_callback)(void *));
|
||||
void analogin_clear_user_callback(analogin_t *obj, AnalogInCallback analogin_cb);
|
||||
uint8_t analogin_read_u16_dma (analogin_t * obj, uint16_t *buf, uint16_t length);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
104
lib/amb1_sdk/common/mbed/hal_ext/dma_api.h
Normal file
104
lib/amb1_sdk/common/mbed/hal_ext/dma_api.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file dma_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides mbed GDMA API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef MBED_GDMA_API_H
|
||||
#define MBED_GDMA_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup dma DMA
|
||||
* @ingroup hal
|
||||
* @brief dma functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
typedef struct gdma_s gdma_t;
|
||||
|
||||
typedef void (*dma_irq_handler)(uint32_t id);
|
||||
/**
|
||||
* @brief Initial the GDMA
|
||||
* @param dma_obj: the GDMA object
|
||||
* @param handler: the callback function for a DMA transfer complete.
|
||||
* @param id: the argument of the callback function.
|
||||
* @retval None
|
||||
*
|
||||
*/
|
||||
void dma_memcpy_init(gdma_t *dma_obj, dma_irq_handler handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief De-Initial the GDMA
|
||||
* @param dma_obj: the GDMA object
|
||||
* @retval None
|
||||
*
|
||||
*/
|
||||
void dma_memcpy_deinit(gdma_t *dma_obj);
|
||||
|
||||
/**
|
||||
* @brief To do a memory copy by DMA
|
||||
* @param dma_obj: the GDMA object
|
||||
* @param dst: destination memory address
|
||||
* @param src: source memory address
|
||||
* @param len: copy data length
|
||||
* @retval None
|
||||
*/
|
||||
void dma_memcpy(gdma_t *dma_obj, void *dst, void* src, uint32_t len);
|
||||
|
||||
///@}
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
|
||||
///@name Ameba1 Only
|
||||
///@{
|
||||
/**
|
||||
* @brief Initial the GDMA
|
||||
* @param dma_obj: the GDMA object
|
||||
* @param handler: the callback function for a DMA transfer complete.
|
||||
* @param id: the argument of the callback function.
|
||||
* @retval None
|
||||
*
|
||||
*/
|
||||
void dma_memcpy_aggr_init(gdma_t * dma_obj, dma_irq_handler handler, uint32_t id);
|
||||
|
||||
void dma_memcpy_aggr(gdma_t * dma_obj, PHAL_GDMA_BLOCK block_info);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/**
|
||||
* @brief To do a memory copy with multiple blocks by DMA
|
||||
* @param dma_obj: the GDMA object
|
||||
* @param phal_gdma_block: the struct contains source , destination informaiton
|
||||
* @param block_num: number of blocks to be transferred
|
||||
* @retval None
|
||||
*/
|
||||
void dma_multiblk_memcpy(gdma_t *dma_obj, phal_gdma_block_t phal_gdma_block, u8 block_num);
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BHP)"
|
||||
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // end of "#define MBED_GDMA_API_H"
|
||||
256
lib/amb1_sdk/common/mbed/hal_ext/efuse_api.h
Normal file
256
lib/amb1_sdk/common/mbed/hal_ext/efuse_api.h
Normal file
@@ -0,0 +1,256 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file efuse_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides mbed EFUSE API.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MBED_EXT_EFUSE_API_EXT_H
|
||||
#define MBED_EXT_EFUSE_API_EXT_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup efuse EFUSE
|
||||
* @ingroup hal
|
||||
* @brief efuse functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Get remaining efuse length
|
||||
* @retval : remaining efuse length
|
||||
*/
|
||||
int efuse_get_remaining_length(void);
|
||||
|
||||
/**
|
||||
* @brief Read efuse contant of specified user
|
||||
* @param data: Specified the address to save the readback data.
|
||||
* @retval none
|
||||
*/
|
||||
void efuse_mtp_read(uint8_t * data);
|
||||
|
||||
/**
|
||||
* @brief Write user's contant to efuse
|
||||
* @param data: Specified the data to be programmed.
|
||||
* @param len: Specifies the data length of programmed data.
|
||||
* @retval value:
|
||||
* - 0~32: Success
|
||||
* - -1: Failure
|
||||
*/
|
||||
int efuse_mtp_write(uint8_t *data, uint8_t len);
|
||||
|
||||
/**
|
||||
* @brief Read efuse OTP contant
|
||||
* @param address: Specifies the offset of the OTP.
|
||||
* @param len: Specifies the length of readback data.
|
||||
* @param buf: Specified the address to save the readback data.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_otp_read(u8 address, u8 len, u8 *buf);
|
||||
|
||||
/**
|
||||
* @brief Write user's contant to OTP efuse
|
||||
* @param address: Specifies the offset of the programmed OTP.
|
||||
* @param len: Specifies the data length of programmed data.
|
||||
* @param buf: Specified the data to be programmed.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_otp_write(u8 address, u8 len, u8 *buf);
|
||||
|
||||
/**
|
||||
* @brief ckeck user's contant to OTP efuse
|
||||
* @param buf: Specified the data to be programmed.
|
||||
* @param len: Specifies the data length of programmed data.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_otp_chk(u8 len, u8 *buf);
|
||||
|
||||
/**
|
||||
* @brief Disable jtag
|
||||
* @retval 0: Success
|
||||
*/
|
||||
int efuse_disable_jtag(void);
|
||||
|
||||
|
||||
///@}
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
|
||||
///@name Ameba1 Only
|
||||
///@{
|
||||
/**
|
||||
* @brief Write key1 to efuse
|
||||
* @param address: Specifies the offset of the programmed efuse.
|
||||
* @param len: Specifies the data length of programmed data.
|
||||
* @param buf: Specified the data to be programmed.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_key1_write(u8 address, u8 len, u8 *buf);
|
||||
|
||||
/**
|
||||
* @brief Write key2 to efuse
|
||||
* @param address: Specifies the offset of the programmed efuse.
|
||||
* @param len: Specifies the data length of programmed data.
|
||||
* @param buf: Specified the data to be programmed.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_key2_write(u8 address, u8 len, u8 *buf);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8711B) && (CONFIG_PLATFORM_8711B == 1)
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
/**
|
||||
* @brief Set RDP Enable.
|
||||
* @param none
|
||||
* @note can not change or read back after write.
|
||||
*/
|
||||
void efuse_rdp_enable(void);
|
||||
|
||||
/**
|
||||
* @brief Set 16B RDP key into EFUSE.
|
||||
* @param rdp_key: 16B EFUSE KEY
|
||||
* @note can not change or read back after write.
|
||||
*/
|
||||
void efuse_rdp_keyset(u8 *rdp_key);
|
||||
|
||||
/**
|
||||
* @brief Set 16B OTF key into EFUSE.
|
||||
* @param OtfKey: 16B EFUSE KEY
|
||||
* @note can not change or read back after write.
|
||||
*/
|
||||
|
||||
void efuse_otf_keyset(u8 *otf_key);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195BLP) && (CONFIG_PLATFORM_8195BLP == 1)
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/**
|
||||
* @brief Disable LP jtag
|
||||
* @retval 0: Success
|
||||
*/
|
||||
int efuse_disable_lp_jtag(void);
|
||||
|
||||
/**
|
||||
* @brief Disable HS secure jtag
|
||||
* @retval 0: Success
|
||||
*/
|
||||
int efuse_disable_sec_jtag(void);
|
||||
|
||||
/**
|
||||
* @brief Disable HS nonsecure jtag
|
||||
* @retval 0: Success
|
||||
*/
|
||||
int efuse_disable_nonsec_jtag(void);
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BLP)"
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/**
|
||||
* @brief Write secure key to efuse
|
||||
* @param buf: Specified the 32-byte security key to be programmed.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_sec_key_write(u8 *buf);
|
||||
|
||||
/**
|
||||
* @brief Write super secure key to efuse
|
||||
* @param buf: Specified the 32-byte super security key to be programmed.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_susec_key_write(u8 *buf);
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BHP)"
|
||||
|
||||
#if (defined(CONFIG_PLATFORM_8710C) && (CONFIG_PLATFORM_8710C == 1))
|
||||
///@name AmebaZII Only
|
||||
///@{
|
||||
/**
|
||||
* @brief Disable secure jtag
|
||||
* @retval 0: Success
|
||||
*/
|
||||
int efuse_disable_sec_jtag(void);
|
||||
|
||||
/**
|
||||
* @brief Disable nonsecure jtag
|
||||
* @retval 0: Success
|
||||
*/
|
||||
int efuse_disable_nonsec_jtag(void);
|
||||
|
||||
/**
|
||||
* @brief Write secure key to efuse
|
||||
* @param buf: Specified the 32-byte security key to be programmed.
|
||||
* @param key_num: select key number.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_sec_key_write(u8 *buf, u8 key_num);
|
||||
|
||||
/**
|
||||
* @brief Write super secure key to efuse
|
||||
* @param buf: Specified the 32-byte super security key to be programmed.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_susec_key_write(u8 *buf);
|
||||
|
||||
/**
|
||||
* @brief Write secure j-tag key to efuse
|
||||
* @param buf: Specified the 32-byte security key to be programmed.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_s_jtag_key_write(u8 *buf);
|
||||
|
||||
/**
|
||||
* @brief Write non-secure j-tag key to efuse
|
||||
* @param buf: Specified the 32-byte security key to be programmed.
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_ns_jtag_key_write(u8 *buf);
|
||||
|
||||
/**
|
||||
* @brief lock super secure key
|
||||
* @retval 0: Success
|
||||
* @retval -1: Failure
|
||||
*/
|
||||
int efuse_lock_susec_key(void);
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8710C)"
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MBED_EXT_EFUSE_API_EXT_H
|
||||
159
lib/amb1_sdk/common/mbed/hal_ext/ethernet_ex_api.h
Normal file
159
lib/amb1_sdk/common/mbed/hal_ext/ethernet_ex_api.h
Normal file
@@ -0,0 +1,159 @@
|
||||
/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef ETHERNET_EX_API_H
|
||||
#define ETHERNET_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup ethernet_ex ETHERNET_EX
|
||||
* @ingroup hal
|
||||
* @brief ethernet extended functions
|
||||
* @{
|
||||
*/
|
||||
#if defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/// the selection of Ethernet pinmux
|
||||
#define ETH_PIN_SEL (Eth_Pin_Sel0)
|
||||
/// the selection of the interface between MAC and PHY
|
||||
#define ETH_IF_SEL (Eth_If_Mii)
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BHP)"
|
||||
/// the size (unit: Bytes) of each Tx descriptor
|
||||
#define ETH_TX_DESC_SIZE 20 // 20 Bytes
|
||||
/// the size (unit: Bytes) of each Rx descriptor
|
||||
#define ETH_RX_DESC_SIZE 16 // 16 Bytes
|
||||
/// the size of the packet buffer
|
||||
#define ETH_PKT_BUF_SIZE 1600
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/**
|
||||
\brief Defines Ethernet Pin mux selection.
|
||||
*/
|
||||
typedef enum {
|
||||
Eth_Pin_Sel0 = EthPinSel0,
|
||||
Eth_Pin_Sel1 = EthPinSel1
|
||||
} EthPinmuxSel;
|
||||
|
||||
/**
|
||||
\brief Defines the interface between MAC and PHY.
|
||||
*/
|
||||
typedef enum {
|
||||
Eth_If_Mii = EthMiiMode,
|
||||
Eth_If_Rmii = EthRmiiMode
|
||||
} EthInterfaceSel;
|
||||
|
||||
/**
|
||||
\brief Defines the link speed.
|
||||
*/
|
||||
typedef enum {
|
||||
Eth_Spd_Auto = -1,
|
||||
Eth_Spd_10M = 0,
|
||||
Eth_Spd_100M = 1
|
||||
} EthSpeedSel;
|
||||
|
||||
/**
|
||||
\brief Defines the duplex mode.
|
||||
*/
|
||||
typedef enum {
|
||||
Eth_Duplex_Auto = -1,
|
||||
Eth_Duplex_Half = 0,
|
||||
Eth_Duplex_Full = 1
|
||||
} EthDuplexMode;
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BHP)"
|
||||
|
||||
|
||||
/**
|
||||
\brief The function type of the Ethernet MAC controller interrupt callback function.
|
||||
*/
|
||||
typedef void (*ethernet_callback)(uint32_t event, uint32_t data);
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/**
|
||||
\brief The function type of the OS task yield callback function.
|
||||
*/
|
||||
typedef void (*ethernet_task_yield)(void);
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BHP)"
|
||||
/**
|
||||
* @brief To hook a callback function for Ethernet MAC controller interrupt.
|
||||
*
|
||||
* @param[in] callback The callback function.
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
void ethernet_irq_hook(ethernet_callback callback);
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/**
|
||||
* @brief To hook a callback function to make OS do a context-switch while waiting.
|
||||
*
|
||||
* @param[in] task_yield The callback function.
|
||||
*
|
||||
* @returns void.
|
||||
*/
|
||||
void ethernet_task_yield_hook (ethernet_task_yield task_yield);
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BHP)"
|
||||
|
||||
/**
|
||||
* @brief To set the Tx/Rx descriptor number.
|
||||
*
|
||||
* @param[in] txdescCnt The specified Tx descriptor number.
|
||||
* @param[in] rxdescCnt The specified Rx descriptor number.
|
||||
*
|
||||
* @returns void.
|
||||
*/
|
||||
void ethernet_set_descnum(uint8_t txdescCnt, uint8_t rxdescCnt);
|
||||
|
||||
/**
|
||||
* @brief To set the start address of Tx/Rx descriptor ring and Tx/Rx packet buffer.
|
||||
*
|
||||
* @param[in] TxDescAddr The start address of Tx descriptor ring.
|
||||
* @param[in] RxDescAddr The start address of Rx descriptor ring.
|
||||
* @param[in] pTxPktBuf The start address of Tx packet buffer.
|
||||
* @param[in] pRxPktBuf The start address of Rx packet buffer.
|
||||
*
|
||||
* @returns void.
|
||||
*/
|
||||
void ethernet_trx_pre_setting(uint8_t *TxDescAddr, uint8_t *RxDescAddr, uint8_t *pTxPktBuf, uint8_t *pRxPktBuf);
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/**
|
||||
* @brief To set the ethernet MAC address.
|
||||
*
|
||||
* @param[in] mac The specified MAC address.
|
||||
*
|
||||
* @returns void.
|
||||
*/
|
||||
void ethernet_set_address(char *mac);
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BHP)"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // #ifndef ETHERNET_EX_API_H
|
||||
|
||||
46
lib/amb1_sdk/common/mbed/hal_ext/ex_api.h
Normal file
46
lib/amb1_sdk/common/mbed/hal_ext/ex_api.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef EX_API_H
|
||||
#define EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "serial_api.h"
|
||||
#include "spi_api.h"
|
||||
#include "dma_api.h"
|
||||
#include "flash_api.h"
|
||||
#include "gpio_ex_api.h"
|
||||
#include "gpio_irq_ex_api.h"
|
||||
#include "i2c_ex_api.h"
|
||||
#include "i2s_api.h"
|
||||
#include "serial_ex_api.h"
|
||||
#include "sleep_ex_api.h"
|
||||
#include "spi_ex_api.h"
|
||||
#include "sys_api.h"
|
||||
#include "wdt_api.h"
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
|
||||
#include "nfc_api.h"
|
||||
#include "ethernet_ex_api.h"
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
257
lib/amb1_sdk/common/mbed/hal_ext/flash_api.h
Normal file
257
lib/amb1_sdk/common/mbed/hal_ext/flash_api.h
Normal file
@@ -0,0 +1,257 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file flash_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides mbed FLASH API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MBED_EXT_FLASH_API_EXT_H
|
||||
#define MBED_EXT_FLASH_API_EXT_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup flash FLASH
|
||||
* @ingroup hal
|
||||
* @brief flash functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
typedef struct flash_s flash_t;
|
||||
|
||||
/**
|
||||
* @brief Erase flash sector
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param address: Specifies the starting address to be erased.
|
||||
* @retval none
|
||||
*/
|
||||
void flash_erase_sector(flash_t *obj, uint32_t address);
|
||||
|
||||
/**
|
||||
* @brief Erase flash block(64KB)
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param address: Specifies the starting address to be erased.LSB 16bits will be masked.
|
||||
* @retval none
|
||||
*/
|
||||
void flash_erase_block(flash_t * obj, uint32_t address);
|
||||
|
||||
/**
|
||||
* @brief Read a word from specified address
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param address: Specifies the address to read from.
|
||||
* @param data: Specified the address to save the readback data.
|
||||
* @retval 1: Success
|
||||
* @note auto mode read is ok, because we have flash cache
|
||||
*/
|
||||
int flash_read_word(flash_t *obj, uint32_t address, uint32_t * data);
|
||||
|
||||
/**
|
||||
* @brief Write a word to specified address
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param address: Specifies the address to be programmed to.
|
||||
* @param data: Specified the data to be programmed.
|
||||
* @retval 1: Success
|
||||
* @note user mode write used
|
||||
*/
|
||||
int flash_write_word(flash_t *obj, uint32_t address, uint32_t data);
|
||||
|
||||
/**
|
||||
* @brief Read a stream of data from specified address
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param address: Specifies the starting address to read from.
|
||||
* @param len: Specifies the length of the data to read.
|
||||
* @param data: Specified the address to save the readback data.
|
||||
* @retval 1: Success
|
||||
* @note auto mode is ok, because we have flash cache
|
||||
*/
|
||||
int flash_stream_read(flash_t *obj, uint32_t address, uint32_t len, uint8_t * data);
|
||||
|
||||
/**
|
||||
* @brief Write a stream of data to specified address
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param address: Specifies the starting address to write to.
|
||||
* @param len: Specifies the length of the data to write.
|
||||
* @param data: Pointer to a byte array that is to be written.
|
||||
* @retval 1: Success
|
||||
*/
|
||||
int flash_stream_write(flash_t *obj, uint32_t address, uint32_t len, uint8_t * data);
|
||||
|
||||
/**
|
||||
* @brief Control the flash chip write protect enable/disable.
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param protect: This parameter can be 1 or 0.
|
||||
* @arg 1: Protect the whole chip from being programmed/erased.
|
||||
* @arg 0: Unprotect the whole chip from being programmed/erased.
|
||||
* @retval none
|
||||
*/
|
||||
void flash_write_protect(flash_t *obj, uint32_t protect);
|
||||
|
||||
/**
|
||||
* @brief Get the value of status register1
|
||||
* @param obj: Flash object define in application software.
|
||||
* @retval : The value of status register1.
|
||||
*/
|
||||
int flash_get_status(flash_t * obj);
|
||||
|
||||
/**
|
||||
* @brief Set Status register to enable desired operation
|
||||
* @param obj: Specifies the parameter of flash object.
|
||||
* @param data: Specifies which bit users like to set.
|
||||
* ex: if users want to set the third bit, data = 0x8.
|
||||
* @retval 1: Success
|
||||
* @note Please refer to the datatsheet of flash for more details of the content of status register.
|
||||
* The block protected area and the corresponding control bits are provided in the flash datasheet.
|
||||
*/
|
||||
int flash_set_status(flash_t * obj, uint32_t data);
|
||||
|
||||
/**
|
||||
* @brief This function aims to reset the status register, please make sure the operation is appropriate.
|
||||
* @param obj: Specifies the parameter of flash object.
|
||||
* @retval none
|
||||
*/
|
||||
void flash_reset_status(flash_t * obj);
|
||||
|
||||
/**
|
||||
* @brief It is the same with flash_stream_write function which is used to write a stream of data to specified address.
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param address: Specifies the starting address to write to.
|
||||
* @param len: Specifies the length of the data to write.
|
||||
* @param data: Pointer to a byte array that is to be written.
|
||||
* @retval 1: Success
|
||||
*/
|
||||
int flash_burst_write(flash_t * obj, uint32_t address, uint32_t Length, uint8_t * data);
|
||||
|
||||
/**
|
||||
* @brief It is the same with flash_stream_read function which is used to read a stream of data from specified address
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param address: Specifies the starting address to read from.
|
||||
* @param len: Specifies the length of the data to read.
|
||||
* @param data: Specified the address to save the readback data.
|
||||
* @retval 1: Success
|
||||
*/
|
||||
int flash_burst_read(flash_t * obj, uint32_t address, uint32_t Length, uint8_t * data);
|
||||
|
||||
/**
|
||||
* @brief This function is only for Micron 128MB flash to access beyond 16MB by switching between eight 16MB-area(segment).
|
||||
* Please refer to flash datasheet for more information about memory mapping.
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param data: Specified which segment to choose.
|
||||
* @retval 1: Success
|
||||
*/
|
||||
int flash_set_extend_addr(flash_t * obj, uint32_t data);
|
||||
|
||||
/**
|
||||
* @brief This function is only for Micron 128MB flash to read from Extended Address Register, which shows the current segment.
|
||||
* Please refer to flash datasheet for more information about memory mapping.
|
||||
* @param obj: Flash object define in application software.
|
||||
* @retval : The value of current Extended Address Register.
|
||||
*/
|
||||
int flash_get_extend_addr(flash_t * obj);
|
||||
|
||||
/**
|
||||
* @brief Get flash ID (command: 0x9F).
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param buf: Pointer to a byte array to save the readback ID.
|
||||
* @param len: Specifies the length of the buf. It should be 3.
|
||||
* @retval -1: Fail.
|
||||
*/
|
||||
int flash_read_id(flash_t *obj, uint8_t *buf, uint8_t len);
|
||||
|
||||
/**
|
||||
* @brief This function is only for Winbond flash to get unique ID (command: 0x4B).
|
||||
* @param obj: Flash object define in application software.
|
||||
* @param buf: Pointer to a byte array to save the readback unique ID.
|
||||
* @param len: Specifies the length of the buf. It should be 8.
|
||||
* @retval -1: Fail.
|
||||
*/
|
||||
int flash_read_unique_id(flash_t *obj, uint8_t *buf, uint8_t len);
|
||||
|
||||
/**
|
||||
* @brief This function is only for Winbond flash to set lock mode.
|
||||
* @param mode: This parameter can be 1 or 0.
|
||||
* @arg 1: Enable individual sector / block protect feature.
|
||||
* @arg 0: Set status register 1 to enble write protect feature.
|
||||
* @retval none
|
||||
* @note But not all Winbond flash supports the function, plase refer to data sheets of the target flashes.
|
||||
*/
|
||||
void flash_set_lock_mode(uint32_t mode);
|
||||
|
||||
/**
|
||||
* @brief This function is only for Winbond flash to lock whole flash chip.
|
||||
* @param none
|
||||
* @retval none
|
||||
* @note But not all Winbond flash supports the function, plase refer to data sheets of the target flashes.
|
||||
*/
|
||||
void flash_global_lock(void);
|
||||
|
||||
/**
|
||||
* @brief This function is only for Winbond flash to unlock whole flash chip.
|
||||
* @param none
|
||||
* @retval none
|
||||
* @note But not all Winbond flash supports the function, plase refer to data sheets of the target flashes.
|
||||
*/
|
||||
void flash_global_unlock(void);
|
||||
|
||||
/**
|
||||
* @brief This function is only for Winbond flash to lock individual sector or block region, should refer to the datasheet for more details.
|
||||
* @param address
|
||||
* @retval none
|
||||
* @note But not all Winbond flash supports the function, plase refer to data sheets of the target flashes.
|
||||
*/
|
||||
void flash_individual_lock(uint32_t address);
|
||||
|
||||
/**
|
||||
* @brief This function is only for Winbond flash to unlock individual sector or block region, should refer to the datasheet for more details.
|
||||
* @param address
|
||||
* @retval none
|
||||
* @note But not all Winbond flash supports the function, plase refer to data sheets of the target flashes.
|
||||
*/
|
||||
void flash_individual_unlock(uint32_t address);
|
||||
|
||||
/**
|
||||
* @brief This function is only for Winbond flash to get the individual lock state on certain address.
|
||||
* @param address
|
||||
* @retval 1: the target sector/block is locked.
|
||||
* 0: the target sector/block is not locked.
|
||||
* @note But not all Winbond flash supports the function, plase refer to data sheets of the target flashes.
|
||||
*/
|
||||
int flash_read_individual_lock_state(uint32_t address);
|
||||
|
||||
///@}
|
||||
|
||||
#if (defined(CONFIG_PLATFORM_8711B) && (CONFIG_PLATFORM_8711B)) \
|
||||
|| (defined(CONFIG_PLATFORM_8710C) && (CONFIG_PLATFORM_8710C))
|
||||
///@name AmebaZ/AmebaZ2
|
||||
///@{
|
||||
/**
|
||||
* @brief Erase the whole flash chip
|
||||
* @param obj: Flash object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void flash_erase_chip(flash_t *obj);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
88
lib/amb1_sdk/common/mbed/hal_ext/gpio_ex_api.h
Normal file
88
lib/amb1_sdk/common/mbed/hal_ext/gpio_ex_api.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MBED_GPIO_API_H
|
||||
#define MBED_GPIO_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup gpio_ex GPIO_EX
|
||||
* @ingroup hal
|
||||
* @brief gpio extended functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Sets value to the selected output port pin.
|
||||
* @param obj: gpio object define in application software.
|
||||
* @param value: specifies the value to be written to the selected pin
|
||||
* This parameter can be one of the following values:
|
||||
* @arg 0: Pin state set to low
|
||||
* @arg 1: Pin state set to high
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_direct_write(gpio_t *obj, BOOL value) ;
|
||||
|
||||
/**
|
||||
* @brief Sets pull type to the selected pin.
|
||||
* @param obj: gpio object define in application software.
|
||||
* @param pull_type: this parameter can be one of the following values:
|
||||
* @arg PullNone: HighZ, user can input high or low use this pin
|
||||
* @arg OpenDrain(is OpenDrain output): no pull + OUT + GPIO[gpio_bit] = 0
|
||||
* @arg PullDown: pull down
|
||||
* @arg PullUp: pull up
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_pull_ctrl(gpio_t *obj, PinMode pull_type);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the GPIO device, include mode/direction/pull control registers.
|
||||
* @param obj: gpio object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_deinit(gpio_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Set GPIO direction.
|
||||
* @param obj: gpio object define in application software.
|
||||
* @param direction: this parameter can be one of the following values:
|
||||
* @arg PIN_INPUT: this pin is input
|
||||
* @arg PIN_OUTPUT: this pin is output
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_change_dir(gpio_t *obj, PinDirection direction);
|
||||
|
||||
#if (defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)) || (defined(CONFIG_PLATFORM_8195BLP) && (CONFIG_PLATFORM_8195BLP == 1))
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/**
|
||||
* @brief Sets schmitt trigger on/off control on the given GPIO pin .
|
||||
* @param pin: PinName according to pinmux spec.
|
||||
* @param ctrl The on/off control:
|
||||
* - 0: disable the schmitt trigger.
|
||||
* - 1: enable the schmitt trigger.
|
||||
* @param v_h3l1 The GPIO Group Voltage Select:
|
||||
* - 0: 1.8V.
|
||||
* - 1: 3V.
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_schmitt_ctrl(PinName pin, BOOLEAN ctrl, uint8_t v_h3l1);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195BHP || CONFIG_PLATFORM_8195BLP
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
113
lib/amb1_sdk/common/mbed/hal_ext/gpio_irq_ex_api.h
Normal file
113
lib/amb1_sdk/common/mbed/hal_ext/gpio_irq_ex_api.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MBED_GPIO_IRQ_EX_API_H
|
||||
#define MBED_GPIO_IRQ_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup gpio_irq_ex_api GPIO_IRQ_EX
|
||||
* @ingroup hal
|
||||
* @brief gpio IRQ extented functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
typedef enum {
|
||||
IRQ_LOW = 3,
|
||||
IRQ_HIGH = 4,
|
||||
IRQ_FALL_RISE = 5 // dual edge trigger, available for 8195B and 8710C
|
||||
} gpio_irq_event_ex;
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the GPIO device interrupt mode, include mode/trigger/polarity registers.
|
||||
* @param obj: gpio irq object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_irq_deinit(gpio_irq_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Sets pull type to the selected interrupt pin.
|
||||
* @param obj: gpio irq object define in application software.
|
||||
* @param pull_type: this parameter can be one of the following values:
|
||||
* @arg PullNone: HighZ, user can input high or low use this pin
|
||||
* @arg OpenDrain(is OpenDrain output): no pull + OUT + GPIO[gpio_bit] = 0
|
||||
* @arg PullDown: pull down
|
||||
* @arg PullUp: pull up
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_irq_pull_ctrl(gpio_irq_t *obj, PinMode pull_type);
|
||||
///@}
|
||||
|
||||
#if (defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)) || (defined(CONFIG_PLATFORM_8195BLP) && (CONFIG_PLATFORM_8195BLP == 1))
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
/**
|
||||
* @brief To enables or disable the debounce function of the given GPIO IRQ pin.
|
||||
* The debounce resource(circuit) is limited, not all GPIO pin
|
||||
* can has debounce function.
|
||||
*
|
||||
* @param[in] pgpio_irq_adapter The GPIO IRQ pin adapter.
|
||||
* @param[in] debounce_us The time filter for the debounce, in micro-second.
|
||||
* But the time resolution is 31.25us (1/32K) and the
|
||||
* maximum time is 512 ms.
|
||||
* @param[in] enable: this parameter can be one of the following values:
|
||||
* @arg 0 disable gpio debounce interrupt
|
||||
* @arg 1 enable gpio debounce interrupt
|
||||
* @return 0: Setting Succeed.
|
||||
* @return -1: Setting Fail.
|
||||
*/
|
||||
int gpio_irq_debounce_set (gpio_irq_t *obj, uint32_t debounce_us, u8 enable);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195BHP || CONFIG_PLATFORM_8195BLP
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8710C)
|
||||
///@name AmebaZ2 Only
|
||||
///@{
|
||||
/**
|
||||
* @brief To enables or disable the debounce function of the given GPIO IRQ pin.
|
||||
* The debounce resource(circuit) is limited, not all GPIO pin
|
||||
* can has debounce function.
|
||||
*
|
||||
* @param[in] pgpio_irq_adapter The GPIO IRQ pin adapter.
|
||||
* @param[in] debounce_us The time filter for the debounce, in micro-second.
|
||||
* But the time resolution is 31.25us (1/32K) and the
|
||||
* maximum time is 512 ms.
|
||||
* @param[in] enable: this parameter can be one of the following values:
|
||||
* @arg 0 disable gpio debounce interrupt
|
||||
* @arg 1 enable gpio debounce interrupt
|
||||
* @return 0: Setting Succeed.
|
||||
* @return -1: Setting Fail.
|
||||
*/
|
||||
int gpio_irq_debounce_set (gpio_irq_t *obj, uint32_t debounce_us, u8 enable);
|
||||
|
||||
/**
|
||||
* @brief Reads the specified gpio irq port pin.
|
||||
* @param obj: gpio irq object define in application software.
|
||||
* @retval 1: pin state is high
|
||||
* @retval 0: pin state is low
|
||||
*/
|
||||
int gpio_irq_read (gpio_irq_t *obj);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8710C
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // end of #ifndef MBED_GPIO_IRQ_EX_API_H
|
||||
78
lib/amb1_sdk/common/mbed/hal_ext/i2c_ex_api.h
Normal file
78
lib/amb1_sdk/common/mbed/hal_ext/i2c_ex_api.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file i2c_ex_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides mbed API for I2C.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef I2C_EX_API_H
|
||||
#define I2C_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup i2c_ex I2C_EX
|
||||
* @ingroup hal
|
||||
* @brief i2c extended functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
typedef enum {
|
||||
I2C_TX_COMPLETE = 0,
|
||||
I2C_RX_COMPLETE = 1,
|
||||
I2C_RD_REQ_COMMAND = 2,
|
||||
I2C_ERR_OCCURRED = 3,
|
||||
}I2CCallback;
|
||||
|
||||
/**
|
||||
* @brief Enable/Disable i2c Device
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param enable: this parameter can be one of the following values:
|
||||
* @arg 0 disable
|
||||
* @arg 1 enable
|
||||
* @retval : result
|
||||
*/
|
||||
int i2c_enable_control(i2c_t *obj, int enable);
|
||||
|
||||
/**
|
||||
* @brief Enable i2c master RESTART function
|
||||
* @param obj: i2c object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void i2c_restart_enable(i2c_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Disable i2c Master RESTART function
|
||||
* @param obj: i2c object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void i2c_restart_disable(i2c_t *obj);
|
||||
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
417
lib/amb1_sdk/common/mbed/hal_ext/i2s_api.h
Normal file
417
lib/amb1_sdk/common/mbed/hal_ext/i2s_api.h
Normal file
@@ -0,0 +1,417 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file i2s_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed I2S API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MBED_EXT_I2S_API_EXT_H
|
||||
#define MBED_EXT_I2S_API_EXT_H
|
||||
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#if !(defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)) && !(defined(CONFIG_PLATFORM_8195BLP) && (CONFIG_PLATFORM_8195BLP == 1))
|
||||
///@name Only Ameba1
|
||||
#include "ameba_soc.h"
|
||||
#endif // end of "#if !defined(CONFIG_PLATFORM_8195BHP) && !defined(CONFIG_PLATFORM_8195BLP)"
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup i2s I2S
|
||||
* @ingroup hal
|
||||
* @brief i2s functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if (defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)) || (defined(CONFIG_PLATFORM_8195BLP) && (CONFIG_PLATFORM_8195BLP == 1)) || (defined(CONFIG_PLATFORM_8721D) && (CONFIG_PLATFORM_8721D == 1))
|
||||
///@name AmebaPro and AmebaD
|
||||
///@{
|
||||
enum {
|
||||
SR_8KHZ = I2S_SR_8KHZ,
|
||||
SR_12KHZ = I2S_SR_12KHZ,
|
||||
SR_16KHZ = I2S_SR_16KHZ,
|
||||
SR_24KHZ = I2S_SR_24KHZ,
|
||||
SR_32KHZ = I2S_SR_32KHZ,
|
||||
SR_48KHZ = I2S_SR_48KHZ,
|
||||
SR_64KHZ = I2S_SR_64KHZ,
|
||||
SR_96KHZ = I2S_SR_96KHZ,
|
||||
SR_192KHZ = I2S_SR_192KHZ,
|
||||
SR_384KHZ = I2S_SR_384KHZ,
|
||||
SR_7p35KHZ = I2S_SR_7p35KHZ,
|
||||
SR_11p025KHZ = I2S_SR_11p025KHZ,
|
||||
SR_14p7KHZ = I2S_SR_14p7KHZ,
|
||||
SR_22p05KHZ = I2S_SR_22p05KHZ,
|
||||
SR_29p4KHZ = I2S_SR_29p4KHZ,
|
||||
SR_44p1KHZ = I2S_SR_44p1KHZ,
|
||||
SR_58p8KHZ = I2S_SR_58p8KHZ,
|
||||
SR_88p2KHZ = I2S_SR_88p2KHZ,
|
||||
SR_176p4KHZ = I2S_SR_176p4KHZ
|
||||
};
|
||||
|
||||
enum {
|
||||
CH_STEREO = I2S_CH_STEREO,
|
||||
CH_5p1 = I2S_CH_5p1,
|
||||
CH_MONO = I2S_CH_MONO
|
||||
};
|
||||
|
||||
enum {
|
||||
WL_16b = I2S_WL_16,
|
||||
WL_24b = I2S_WL_24,
|
||||
WL_32b = I2S_WL_32
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
enum {
|
||||
SR_8KHZ = I2S_SR_8KHZ,
|
||||
SR_16KHZ = I2S_SR_16KHZ,
|
||||
SR_24KHZ = I2S_SR_24KHZ,
|
||||
SR_32KHZ = I2S_SR_32KHZ,
|
||||
SR_48KHZ = I2S_SR_48KHZ,
|
||||
SR_96KHZ = I2S_SR_96KHZ,
|
||||
SR_7p35KHZ = I2S_SR_7p35KHZ,
|
||||
SR_14p7KHZ = I2S_SR_14p7KHZ,
|
||||
SR_22p05KHZ = I2S_SR_22p05KHZ,
|
||||
SR_29p4KHZ = I2S_SR_29p4KHZ,
|
||||
SR_44p1KHZ = I2S_SR_44p1KHZ,
|
||||
SR_88p2KHZ = I2S_SR_88p2KHZ
|
||||
};
|
||||
|
||||
enum {
|
||||
CH_STEREO = I2S_CH_STEREO,
|
||||
CH_MONO = I2S_CH_MONO
|
||||
};
|
||||
|
||||
enum {
|
||||
WL_16b = I2S_WL_16,
|
||||
WL_24b = I2S_WL_24
|
||||
};
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BHP) || defined(CONFIG_PLATFORM_8195BLP)"
|
||||
enum {
|
||||
I2S_DIR_RX = I2S_ONLY_RX, // Rx Only
|
||||
I2S_DIR_TX = I2S_ONLY_TX, // Tx Only
|
||||
I2S_DIR_TXRX = I2S_TXRX // Tx & Rx (BiDirection)
|
||||
};
|
||||
|
||||
typedef void (*i2s_irq_handler)(uint32_t id, char *pbuf);
|
||||
|
||||
typedef struct i2s_s i2s_t;
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the I2S device, include function/interrupt/I2S registers.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_deinit(i2s_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Sets page number, page size, page address.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param tx_buf: pointer to the start address of Tx page.
|
||||
* @param rx_buf: pointer to the start address of Rx page.
|
||||
* @param page_num: page number. This parameter must be set to a value in the 2~4 range
|
||||
* @param page_size: page size. This parameter must be set to a value in the 4~16384 bytes range
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_dma_buffer(i2s_t *obj, char *tx_buf, char *rx_buf, uint32_t page_num, uint32_t page_size);
|
||||
|
||||
/**
|
||||
* @brief Sets TX interrupt handler.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param handler: TX interrupt callback function.
|
||||
* @param id: TX interrupt callback function parameter.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_tx_irq_handler(i2s_t *obj, i2s_irq_handler handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Sets RX interrupt handler.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param handler: RX interrupt callback function.
|
||||
* @param id: RX interrupt callback function parameter.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_rx_irq_handler(i2s_t *obj, i2s_irq_handler handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Sets i2s data transfer direction.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param trx_type: transfer direction.
|
||||
* This parameter can be one of the following values:
|
||||
* @arg I2S_DIR_RX: Rx receive direction
|
||||
* @arg I2S_DIR_TX: Tx transmission direction
|
||||
* @arg I2S_DIR_TXRX: Tx & Rx bi-direction
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_direction(i2s_t *obj, int trx_type);
|
||||
|
||||
/**
|
||||
* @brief Sets i2s channel number, sample rate, word length.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param channel_num: this parameter can be one of the following values:
|
||||
* @arg CH_STEREO: stereo channel
|
||||
* @arg CH_MONO: mono channel
|
||||
* @param rate: this parameter can be one of the following values:
|
||||
* @arg SR_8KHZ: sample rate is 8kHz
|
||||
* @arg SR_16KHZ: sample rate is 16kHz
|
||||
* @arg SR_24KHZ: sample rate is 24kHz
|
||||
* @arg SR_32KHZ: sample rate is 32kHz
|
||||
* @arg SR_48KHZ: sample rate is 48kHz
|
||||
* @arg SR_96KHZ: sample rate is 96kHz
|
||||
* @arg SR_7p35KHZ: sample rate is 7.35kHz
|
||||
* @arg SR_14p7KHZ: sample rate is 14.7kHz
|
||||
* @arg SR_22p05KHZ: sample rate is 22.05kHz
|
||||
* @arg SR_29p4KHZ: sample rate is 29.4kHz
|
||||
* @arg SR_44p1KHZ: sample rate is 44.1kHz
|
||||
* @arg SR_88p2KHZ: sample rate is 88.2kHz
|
||||
* @param word_len: this parameter can be one of the following values:
|
||||
* @arg WL_16b: sample bit is 16 bit
|
||||
* @arg WL_24b: sample bit is 24 bit
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_param(i2s_t *obj, int channel_num, int rate, int word_len);
|
||||
|
||||
/**
|
||||
* @brief Gets current tx page address.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @retval : address of current tx page or NULL
|
||||
* @note current page own by cpu, return address of current tx page
|
||||
* @note current page own by i2s, return NULL
|
||||
*/
|
||||
int* i2s_get_tx_page(i2s_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Sets current tx page own by i2s.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param pbuf: tx buffer adderss.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_send_page(i2s_t *obj, uint32_t *pbuf);
|
||||
|
||||
/**
|
||||
* @brief Sets current rx page own by i2s.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_recv_page(i2s_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Enable i2s interrupt and function.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_enable(i2s_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Disable i2s interrupt and function.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_disable(i2s_t *obj);
|
||||
|
||||
///@}
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
|
||||
///@name Ameba1 Only
|
||||
///@{
|
||||
/**
|
||||
* @brief Initializes the I2S device, include clock/function/interrupt/I2S registers.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param sck: Serial clock PinName according to pinmux spec.
|
||||
* @param ws: Word select PinName according to pinmux spec.
|
||||
* @param sd: PinName according to pinmux spec.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_init(i2s_t *obj, PinName sck, PinName ws, PinName sd);
|
||||
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
#if (defined(CONFIG_PLATFORM_8711B) && (CONFIG_PLATFORM_8711B == 1)) || (defined(CONFIG_PLATFORM_8721D) && (CONFIG_PLATFORM_8721D == 1))
|
||||
///@name AmebaZ and AmebaD
|
||||
///@{
|
||||
/**
|
||||
* @brief Initializes the I2S device, include clock/function/interrupt/I2S registers.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param sck: Serial clock PinName according to pinmux spec.
|
||||
* @param ws: Word select PinName according to pinmux spec.
|
||||
* @param sd_tx: Tx PinName according to pinmux spec.
|
||||
* @param sd_rx: Rx PinName according to pinmux spec.
|
||||
* @param mck: Master clock PinName according to pinmux spec.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_init(i2s_t *obj, PinName sck, PinName ws, PinName sd_tx, PinName sd_rx, PinName mck);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
#if (defined(CONFIG_PLATFORM_8195BHP) && (CONFIG_PLATFORM_8195BHP == 1)) || (defined(CONFIG_PLATFORM_8195BLP) && (CONFIG_PLATFORM_8195BLP == 1))
|
||||
///@name AmebaPro Only
|
||||
///@{
|
||||
typedef enum {
|
||||
FORMAT_I2S = I2S_FORMAT_I2S,
|
||||
LEFT_JUST = I2S_FORMAT_LEFT_JUST,
|
||||
FORMAT_RIGHT_JUST = I2S_FORMAT_RIGHT_JUST
|
||||
} i2s_format;
|
||||
|
||||
typedef enum {
|
||||
I2S_MASTER = I2S_MASTER_MODE,
|
||||
I2S_SLAVE = I2S_SLAVE_MODE
|
||||
} i2s_ms_mode;
|
||||
|
||||
typedef enum {
|
||||
PAGE_0NUM = I2S_USELESS_PAGE,
|
||||
PAGE_2NUM = I2S_2PAGE,
|
||||
PAGE_3NUM = I2S_3PAGE,
|
||||
PAGE_4NUM = I2S_4PAGE
|
||||
} i2s_page_num;
|
||||
|
||||
typedef enum {
|
||||
BURST8 = I2S_BURST8,
|
||||
BURST12 = I2S_BURST12,
|
||||
BURST16 = I2S_BURST16
|
||||
} i2s_burst_size;
|
||||
|
||||
typedef enum {
|
||||
LEFT_PHASE = I2S_LEFT_PHASE,
|
||||
RIGHT_PHASE = I2S_RIGHT_PHASE
|
||||
} i2s_ws_swap;
|
||||
|
||||
typedef enum {
|
||||
NEGATIVE_EDGE = I2S_NEGATIVE_EDGE,
|
||||
POSITIVE_EDGE = I2S_POSITIVE_EDGE
|
||||
} i2s_edge_sw;
|
||||
|
||||
/**
|
||||
* @brief Initializes the I2S device, include clock/function/interrupt/I2S registers.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param sck: Serial clock PinName according to pinmux spec.
|
||||
* @param ws: Word select PinName according to pinmux spec.
|
||||
* @param sd_tx0: Tx PinName according to pinmux spec.
|
||||
* @param sd_rx: Rx PinName according to pinmux spec. This pin is not configured when set PinName "NC".
|
||||
* @param mck: Master clock PinName according to pinmux spec. This pin is not configured when set PinName "NC".
|
||||
* @param sd_tx1: Tx1 PinName according to pinmux spec. This pin is not configured when set PinName "NC".
|
||||
* @param sd_tx2: Tx2 PinName according to pinmux spec. This pin is not configured when set PinName "NC".
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_init(i2s_t *obj, PinName sck, PinName ws, PinName sd_tx0, PinName sd_rx, PinName mck, PinName sd_tx1, PinName sd_tx2);
|
||||
|
||||
/**
|
||||
* @brief Reset the I2S.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_sw_reset(i2s_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Set the I2S format.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param format: The I2S formate.
|
||||
* @FORMAT_I2S : I2S
|
||||
* @LEFT_JUST : Left Justified
|
||||
* @FORMAT_RIGHT_JUST : Right Justified
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_format(i2s_t *obj, i2s_format format);
|
||||
|
||||
/**
|
||||
* @brief Set the master or slave mode.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param ms_mode: Master or slave mode.
|
||||
* @I2S_MASTER : Master mode.
|
||||
* @I2S_SLAVE : Left Justified
|
||||
* @FORMAT_RIGHT_JUST : Right Justified
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_master(i2s_t *obj, i2s_ms_mode ms_mode);
|
||||
|
||||
/**
|
||||
* @brief Set the burst size for DMA.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param burst_size: Set the burst size.
|
||||
* @BURST8 : The burst size is 8-words.
|
||||
* @BURST12 : The burst size is 12-words.
|
||||
* @BURST16 : The burst size is 16-words.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_dma_burst_size(i2s_t *obj, i2s_burst_size burst_size);
|
||||
|
||||
/**
|
||||
* @brief Make the data do the byte switch.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param byte_swap_en: To enable or disable.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_byte_swap(i2s_t *obj, BOOL byte_swap_en);
|
||||
|
||||
/**
|
||||
* @brief Make the SCK inverse.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param sck_inv_en: To enable or disable.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_sck_inv(i2s_t *obj, BOOL sck_inv_en);
|
||||
|
||||
/**
|
||||
* @brief Control whether the first data appear in the "right" or "left" phase of WS clock.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param ws_swap: Select the right or left phase.
|
||||
* @LEFT_PHASE : Select the left phase.
|
||||
* @RIGHT_PHASE : Select the right phase.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_ws_swap(i2s_t *obj, i2s_ws_swap ws_swap);
|
||||
|
||||
/**
|
||||
* @brief Set the I2S loopback mode. Need to set the I2S direction is only TX.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param loopback_en: To enable or disable.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_loopback(i2s_t *obj, BOOL loopback_en);
|
||||
|
||||
/**
|
||||
* @brief Chose to send data at the negative edge or positive edge of SCK.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param edge_sw: Select the sending edge.
|
||||
* @NEGATIVE_EDGE : Select the negative edge.
|
||||
* @POSITIVE_EDGE : Select the positive edge.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_data_start_edge(i2s_t *obj, i2s_edge_sw edge_sw);
|
||||
|
||||
/**
|
||||
* @brief Set the I2S mute mode.
|
||||
* @param obj: i2s object define in application software.
|
||||
* @param mute_en: To enable or disable.
|
||||
* @retval none
|
||||
*/
|
||||
void i2s_set_mute(i2s_t *obj, BOOL mute_en);
|
||||
|
||||
|
||||
///@}
|
||||
#endif // end of "#if defined(CONFIG_PLATFORM_8195BHP) || defined(CONFIG_PLATFORM_8195BLP)"
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
333
lib/amb1_sdk/common/mbed/hal_ext/log_uart_api.h
Normal file
333
lib/amb1_sdk/common/mbed/hal_ext/log_uart_api.h
Normal file
@@ -0,0 +1,333 @@
|
||||
//----------------------------------------------------------------------------//
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file log_uart_api.h
|
||||
* @author
|
||||
* @version
|
||||
* @brief This file provides user interface for log uart
|
||||
* base on the functionalities provided by Realtek periphera.
|
||||
******************************************************************************
|
||||
* @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) 2016, Realtek Semiconductor Corporation. All rights reserved.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef LOG_UART_API_H
|
||||
#define LOG_UART_API_H
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
|
||||
|
||||
#include "device.h"
|
||||
#include "serial_api.h"
|
||||
#include "hal_log_uart.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup log_uart LOG_UART
|
||||
* @ingroup hal
|
||||
* @brief log_uart functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba1 Only
|
||||
///@{
|
||||
|
||||
/******************************************************
|
||||
* Type Definitions
|
||||
******************************************************/
|
||||
/** Log uart irq handler function pointer type
|
||||
*
|
||||
* @param id : The argument for log uart interrupt handler
|
||||
* @param event : The log uart interrupt indication ID. More details is shown in hal_log_uart.h
|
||||
*/
|
||||
typedef void (*loguart_irq_handler)(uint32_t id, LOG_UART_INT_ID event);
|
||||
typedef struct log_uart_s log_uart_t;
|
||||
|
||||
/******************************************************
|
||||
* Function Declarations
|
||||
******************************************************/
|
||||
/**
|
||||
* @brief Initialize Realtek log uart.
|
||||
* Initialize the required parts of the log uart.
|
||||
* i.e. baudrate, data bits, parity, etc.
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] baudrate: Baud rate of the log uart object.
|
||||
* @param[in] data_bits: Data bits of the log uart object.
|
||||
* @param[in] parity: Parity type of the log uart object
|
||||
- ParityNone, - Do not use parity
|
||||
- ParityOdd, - Use odd parity
|
||||
- ParityEven, - Use even parity
|
||||
- ParityForced1, - Use even parity, the same as ParityEven
|
||||
- ParityForced0 - Use odd parity, the same as ParityOdd
|
||||
* @param[in] stop_bits: The number of stop bits for the log uart object.
|
||||
* @return 0 if initialization is successful, -1 otherwise
|
||||
*/
|
||||
int32_t log_uart_init(log_uart_t *obj, int baudrate, int data_bits, SerialParity parity, int stop_bits);
|
||||
|
||||
/**
|
||||
* @brief Release the resources related to Realtek log uart.
|
||||
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_free(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Set the baud rate of log uart.
|
||||
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] baudrate: Baud rate of the log uart object.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_baud(log_uart_t *obj, int baudrate);
|
||||
|
||||
/**
|
||||
* @brief Set parameters for log uart.
|
||||
* including data bits, parity type and stop bits
|
||||
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] data_bits: Data bits of log uart object.
|
||||
* @param[in] parity: Parity type of the log uart object
|
||||
- ParityNone, - Do not use parity
|
||||
- ParityOdd, - Use odd parity
|
||||
- ParityEven, - Use even parity
|
||||
- ParityForced1, - Use even parity, the same as ParityEven
|
||||
- ParityForced0 - Use odd parity, the same as ParityOdd
|
||||
* @param[in] stop_bits: The number of stop bits for the log uart object.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_format(log_uart_t *obj, int data_bits, SerialParity parity, int stop_bits);
|
||||
|
||||
/**
|
||||
* @brief Set irq handler for log uart.
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] handler: The interrupt handler for log uart.
|
||||
* @param[in] id: The argument for log uart interrupt handler.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_irq_handler(log_uart_t *obj, loguart_irq_handler handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Enable/disable the specific irq indication ID.
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] irq: The log uart interrupt indication ID which will be enabled/disabled.
|
||||
* @param[in] enable: 1 enable, 0 disable
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_irq_set(log_uart_t *obj, LOG_UART_INT_ID irq, uint32_t enable);
|
||||
|
||||
/**
|
||||
* @brief Read one character from log uart.
|
||||
This function will block untill the log uart gets something to read
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return the character read from log uart
|
||||
*/
|
||||
char log_uart_getc(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Write one character to log uart.
|
||||
This function will block untill the data is successfully written to log uart
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] c: The one byte data to be written to log uart.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_putc(log_uart_t *obj, char c);
|
||||
|
||||
/**
|
||||
* @brief Check whether log uart is ready to read data
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return 1 if there is data at log uart to be read, 0 otherwise
|
||||
*/
|
||||
int log_uart_readable(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Check whether log uart is ready to write data
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return 1 if log uart is ready for writing, 0 otherwise
|
||||
*/
|
||||
int log_uart_writable(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Clear both data at log uart
|
||||
This function will clear data in both TX FIFO and RX FIFO of log uart
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_clear(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Clear TX FIFO of log uart
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_clear_tx(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Clear RX FIFO of log uart
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_clear_rx(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Set break control for log uart
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_break_set(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Clear break control for log uart
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_break_clear(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Set the handler for complete TX
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] handler: The function which is called when log uart has finished transmitting data.
|
||||
* @param[in] id: The parameter for handler.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_tx_comp_handler(log_uart_t *obj, void *handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Set the handler for complete RX
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] handler: The function which is called when log uart has finished receving data
|
||||
* @param[in] id: The parameter for handler.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_rx_comp_handler(log_uart_t *obj, void *handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Set the handler for line status
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] handler: The function which is called when log uart gets an line status indication ID.
|
||||
* @param[in] id: The parameter for handler.
|
||||
* @return None
|
||||
*/
|
||||
void log_uart_line_status_handler(log_uart_t *obj, void *handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Read data from log uart in blocking mode.
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[out] prxbuf: The buffer to store received data.
|
||||
* @param[in] len: The maximum length of data to be read
|
||||
* @param[in] timeout_ms: Blocking time in ms.
|
||||
* @return the length of received data in bytes
|
||||
*/
|
||||
int32_t log_uart_recv(log_uart_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms);
|
||||
|
||||
/**
|
||||
* @brief Send data to log uart in blocking mode
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] ptxbuf: Data buffer to be sent to log uart
|
||||
* @param[in] len: Length of data to be sent to log uart
|
||||
* @param[in] timeout_ms: Blocking time in ms.
|
||||
* @return the length of sent data in bytes
|
||||
*/
|
||||
int32_t log_uart_send(log_uart_t *obj, char *ptxbuf, uint32_t len, uint32_t timeout_ms);
|
||||
|
||||
/**
|
||||
* @brief Read data from log uart in interrupt mode(Non-blocking)
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[out] prxbuf: The buffer to store received data.
|
||||
* @param[in] len: The maximum length of data to be read
|
||||
* @return 0 if success
|
||||
*/
|
||||
int32_t log_uart_recv_stream(log_uart_t *obj, char *prxbuf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief Send data to log uart in interrupt mode(Non-blocking)
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[in] ptxbuf: Data buffer to be sent to log uart
|
||||
* @param[in] len: Length of data to be sent to log uart
|
||||
* @return 0 if success
|
||||
*/
|
||||
int32_t log_uart_send_stream(log_uart_t *obj, char *ptxbuf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief Read data from log uart with a given timeout in interrupt mode(Non-blocking)
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @param[out] prxbuf: The buffer to store received data.
|
||||
* @param[in] len: The maximum length of data to be read
|
||||
* @param[in] timeout_ms: The timeout for reading data in ms
|
||||
* @param[in] force_cs: User callback function
|
||||
* @return the length in Byte of received data before timeout, or error (< 0)
|
||||
*/
|
||||
int32_t log_uart_recv_stream_timeout(log_uart_t *obj, char *prxbuf, uint32_t len,
|
||||
uint32_t timeout_ms, void *force_cs);
|
||||
|
||||
/**
|
||||
* @brief Abort interrupt mode of sending data
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return the length of data sent to log uart.
|
||||
*/
|
||||
int32_t log_uart_send_stream_abort(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Abort interrupt mode of receiving data
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return the length of data received from log uart.
|
||||
*/
|
||||
int32_t log_uart_recv_stream_abort(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Disable log uart
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return None.
|
||||
*/
|
||||
void log_uart_disable(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Enable log uart
|
||||
* @param[in] obj: The address of log uart object.
|
||||
* @return None.
|
||||
*/
|
||||
void log_uart_enable(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Read Line-Status register
|
||||
* @return value:
|
||||
* - Bit 0: RX Data Ready
|
||||
* - Bit 1: Overrun Error
|
||||
* - Bit 2: Parity Error
|
||||
* - Bit 3: Framing Error
|
||||
* - Bit 4: Break Interrupt (received data input is held in 0 state for a longer than a full word tx time)
|
||||
* - Bit 5: TX FIFO empty (THR empty)
|
||||
* - Bit 6: TX FIFO empty (THR & TSR both empty)
|
||||
* - Bit 7: Receiver FIFO Error (parity error, framing error or break indication)
|
||||
*/
|
||||
uint8_t log_uart_raed_lsr(log_uart_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Read Modem-Status register
|
||||
* @return value:
|
||||
* - Bit 0: DCTS, The CTS line has changed its state
|
||||
* - Bit 1: DDSR, The DSR line has changed its state
|
||||
* - Bit 2: TERI, RI line has changed its state from low to high state
|
||||
* - Bit 3: DDCD, DCD line has changed its state
|
||||
* - Bit 4: Complement of the CTS input
|
||||
* - Bit 5: Complement of the DSR input
|
||||
* - Bit 6: Complement of the RI input
|
||||
* - Bit 7: Complement of the DCD input
|
||||
*/
|
||||
uint8_t log_uart_raed_msr(log_uart_t *obj);
|
||||
|
||||
///@}
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
#endif // end of "#ifndef LOG_UART_API_H"
|
||||
65
lib/amb1_sdk/common/mbed/hal_ext/nfc_api.h
Normal file
65
lib/amb1_sdk/common/mbed/hal_ext/nfc_api.h
Normal file
@@ -0,0 +1,65 @@
|
||||
/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef MBED_NFC_API_H
|
||||
#define MBED_NFC_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NFCTAGLENGTH 36 // maximum 36*4=144 bytes
|
||||
#define NFC_MAX_CACHE_PAGE_NUM 36 // maximum 36*4=144 bytes
|
||||
|
||||
typedef enum _NFC_STATUS_ {
|
||||
NFC_OK = 0,
|
||||
NFC_ERROR = -1
|
||||
}NFC_STATUS, *PNFC_STATUS;
|
||||
|
||||
typedef enum _NFC_PWR_STATUS_ {
|
||||
NFC_PWR_DISABLE = 0,
|
||||
NFC_PWR_RUNNING = 1,
|
||||
NFC_PWR_SLEEP0 = 2,
|
||||
NFC_PWR_SLEEP1 = 3,
|
||||
NFC_PWR_DOWN = 4,
|
||||
NFC_PWR_ERROR = -1
|
||||
}NFC_PWR_STATUS, *PNFC_PWR_STATUS;
|
||||
|
||||
typedef enum _NFC_EVENT_ {
|
||||
NFC_EV_READER_PRESENT = (1<<0),
|
||||
NFC_EV_READ = (1<<1),
|
||||
NFC_EV_WRITE = (1<<2),
|
||||
NFC_EV_ERR = (1<<3),
|
||||
NFC_EV_CACHE_READ = (1<<4)
|
||||
}NFC_EVENT, *PNFC_EVENT;
|
||||
|
||||
typedef struct nfctag_s nfctag_t;
|
||||
|
||||
typedef void (*nfc_read_cb)(void *arg, void *buf, unsigned int page);
|
||||
typedef void(*nfc_write_cb)(void *arg, unsigned int page, uint32_t pgdat);
|
||||
typedef void(*nfc_event_cb)(void *arg, unsigned int event);
|
||||
typedef void(*nfc_cache_read_cb)(void *arg, void *buf, unsigned int page);
|
||||
|
||||
int nfc_init(nfctag_t *obj, uint32_t *pg_init_val);
|
||||
void nfc_read(nfctag_t *obj, nfc_read_cb handler, void *arg);
|
||||
void nfc_write(nfctag_t *obj, nfc_write_cb handler, void *arg);
|
||||
void nfc_event(nfctag_t *obj, nfc_event_cb handler, void *arg, unsigned int event_mask);
|
||||
int nfc_power(nfctag_t *obj, int pwr_mode, int wake_event);
|
||||
int nfc_cache_write(nfctag_t *obj, uint32_t *tbuf, unsigned int spage, unsigned int pg_num);
|
||||
int nfc_cache_raed(nfctag_t *obj, nfc_cache_read_cb handler, void *arg, unsigned int start_pg);
|
||||
int nfc_status(nfctag_t *obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
129
lib/amb1_sdk/common/mbed/hal_ext/reset_reason_api.h
Normal file
129
lib/amb1_sdk/common/mbed/hal_ext/reset_reason_api.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file reset_reason_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed Reset Reason API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef MBED_RESET_REASON_API_H
|
||||
#define MBED_RESET_REASON_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8710C)
|
||||
/**
|
||||
* \defgroup hal_reset_reason Reset Reason HAL API
|
||||
* @{
|
||||
*/
|
||||
/** Definitions of different reset reasons
|
||||
*/
|
||||
typedef enum {
|
||||
RESET_REASON_POWER_ON, /**< Set when power is initially applied to the board. The power-on-reset circuit causes a POWER_ON reset when this occurs */
|
||||
RESET_REASON_PIN_RESET, /**< Set when a reset is triggered by the hardware pin on the board */
|
||||
RESET_REASON_BROWN_OUT, /**< Triggered when the voltage drops below the low voltage detect (LVD) threshold the system will be held in a reset until the voltage rises above the threshold */
|
||||
RESET_REASON_SOFTWARE, /**< Set during software reset, typically triggered by writing the SYSRESETREQ bit in the Application Interrupt and Reset Control register */
|
||||
RESET_REASON_WATCHDOG, /**< Set when a running watchdog timer fails to be refreshed */
|
||||
RESET_REASON_WAKE_LOW_POWER, /**< Set when waking from deep sleep mode */
|
||||
RESET_REASON_MULTIPLE, /**< Set if multiple reset reasons are set within the board. Occurs when the reset reason registers aren't cleared between resets */
|
||||
RESET_REASON_UNKNOWN /**< Unknown or unreadable reset reason **/
|
||||
} reset_reason_t;
|
||||
|
||||
/** Fetch the reset reason for the last system reset
|
||||
*
|
||||
* This function must return the contents of the system reset reason registers
|
||||
* cast to an appropriate platform independent reset reason. If multiple reset
|
||||
* reasons are set this function should return RESET_REASON_MULTIPLE. If the
|
||||
* reset reason does not match any existing platform independent value this
|
||||
* function should return RESET_REASON_PLATFORM. If no reset reason can be
|
||||
* determined this function should return RESET_REASON_UNKNOWN.
|
||||
*
|
||||
* This function is not idempotent, there is no guarantee that the system
|
||||
* reset reason will not be cleared between calls to this function altering the
|
||||
* return value between calls.
|
||||
*
|
||||
* Note: Some platforms contain reset reason registers that persist through
|
||||
* system resets. If the registers haven't been cleared before calling this
|
||||
* function multiple reasons may be set within the registers. If multiple reset
|
||||
* reasons are detected this function will return RESET_REASON_MULTIPLE.
|
||||
*
|
||||
* @return enum containing the last reset reason for the board.
|
||||
*/
|
||||
reset_reason_t hal_reset_reason_get(void);
|
||||
|
||||
/** Fetch the raw platform specific reset reason register value
|
||||
*
|
||||
* This function must return the raw contents of the system reset reason
|
||||
* registers cast to a uint32_t value. If the platform contains reset reasons
|
||||
* that span multiple registers/addresses the value should be concatenated into
|
||||
* the return type.
|
||||
*
|
||||
* This function is not idempotent, there is no guarantee that the system
|
||||
* reset reason will not be cleared between calls to this function altering the
|
||||
* return value between calls.
|
||||
*
|
||||
* @return value containing the reset reason register for the given platform.
|
||||
* If the platform contains reset reasons across multiple registers they
|
||||
* will be concatenated here.
|
||||
*/
|
||||
uint32_t hal_reset_reason_get_raw(void);
|
||||
|
||||
/** Clear the reset reason from registers
|
||||
*
|
||||
* Reset the value of the reset status registers, the reset reason will persist
|
||||
* between system resets on certain platforms so the registers should be cleared
|
||||
* before the system resets. Failing to do so may make it difficult to determine
|
||||
* the cause of any subsequent system resets.
|
||||
*/
|
||||
void hal_reset_reason_clear(void);
|
||||
|
||||
/** Set the reset reason to registers
|
||||
*
|
||||
* Set the value of the reset status registers, to let user applicatoin store
|
||||
* the reason before doing reset.
|
||||
*/
|
||||
void hal_reset_reason_set(reset_reason_t reason);
|
||||
|
||||
#endif //CONFIG_PLATFORM_8710C
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A)
|
||||
|
||||
typedef enum {
|
||||
RESET_REASON_POWER_ON, /**< Set when power is initially applied to the board. The power-on-reset circuit causes a POWER_ON reset when this occurs */
|
||||
RESET_REASON_PIN_RESET, /**< Set when a reset is triggered by the hardware pin on the board */
|
||||
RESET_REASON_BROWN_OUT, /**< Triggered when the voltage drops below the low voltage detect (LVD) threshold the system will be held in a reset until the voltage rises above the threshold */
|
||||
RESET_REASON_SOFTWARE, /**< Set during software reset, typically triggered by writing the SYSRESETREQ bit in the Application Interrupt and Reset Control register */
|
||||
RESET_REASON_WATCHDOG, /**< Set when a running watchdog timer fails to be refreshed */
|
||||
RESET_REASON_LOCKUP, /**< Set when the core is locked because of an unrecoverable exception */
|
||||
RESET_REASON_WAKE_LOW_POWER, /**< Set when waking from deep sleep mode */
|
||||
RESET_REASON_ACCESS_ERROR, /**< Umbrella value that encompasses any access related reset */
|
||||
RESET_REASON_BOOT_ERROR, /**< Umbrella value that encompasses any boot related reset */
|
||||
RESET_REASON_MULTIPLE, /**< Set if multiple reset reasons are set within the board. Occurs when the reset reason registers aren't cleared between resets */
|
||||
RESET_REASON_PLATFORM, /**< Platform specific reset reason not captured in this enum */
|
||||
RESET_REASON_UNKNOWN /**< Unknown or unreadable reset reason **/
|
||||
} reset_reason_t;
|
||||
|
||||
reset_reason_t hal_reset_reason_get(void);
|
||||
void hal_reset_reason_set(reset_reason_t reason);
|
||||
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //MBED_RESET_REASON_API_H
|
||||
220
lib/amb1_sdk/common/mbed/hal_ext/serial_ex_api.h
Normal file
220
lib/amb1_sdk/common/mbed/hal_ext/serial_ex_api.h
Normal file
@@ -0,0 +1,220 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file serial_ex_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides mbed API for UART.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef MBED_SERIAL_EX_API_H
|
||||
#define MBED_SERIAL_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup uart_ex UART_EX
|
||||
* @ingroup hal
|
||||
* @brief uart extended functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Define RX FIFO Level: RX interrupt trigger, RTS de-assert trigger
|
||||
*/
|
||||
typedef enum {
|
||||
FifoLv1Byte=0, /*!< 1-byte */
|
||||
FifoLvQuarter=1, /*!< 4-byte/8-byte(for 8195B/8710C) */
|
||||
FifoLvHalf=2, /*!< 8-byte/16-byte(for 8195B/8710C) */
|
||||
FifoLvFull=3 /*!< 14-byte/30-bytes(for 8195B/8710C) */
|
||||
} SerialFifoLevel;
|
||||
|
||||
/**
|
||||
* @brief Clear TX fifo.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_clear_tx(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Clear RX fifo.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_clear_rx(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief set TX complete handler.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param handler: TX complete callback function.
|
||||
* @param id: TX complete callback function parameter.
|
||||
* @retval none
|
||||
* @note this function is used when asynchronous API is used.
|
||||
*/
|
||||
void serial_send_comp_handler(serial_t *obj, void *handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief set RX complete handler.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param handler: RX complete callback function.
|
||||
* @param id: RX complete callback function parameter.
|
||||
* @retval none
|
||||
* @note this function is used when asynchronous API is used.
|
||||
*/
|
||||
void serial_recv_comp_handler(serial_t *obj, void *handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief recv target length data use poll mode, with time out.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param ptxbuf: buffer to be written to Tx FIFO.
|
||||
* @param len: number of data to be recv.
|
||||
* @param timeout_ms: polling time before timeout.
|
||||
* @retval : return received bytes count
|
||||
* @note this function is synchronous API.
|
||||
*/
|
||||
int32_t serial_recv_blocked(serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms);
|
||||
|
||||
/**
|
||||
* @brief send target length data use poll mode, with time out.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param ptxbuf: buffer to be written to Tx FIFO.
|
||||
* @param len: number of data to be send.
|
||||
* @param timeout_ms: polling time before timeout.
|
||||
* @retval : transmitted bytes count
|
||||
* @note this function is synchronous API.
|
||||
*/
|
||||
int32_t serial_send_blocked(serial_t *obj, char *ptxbuf, uint32_t len, uint32_t timeout_ms);
|
||||
|
||||
/**
|
||||
* @brief recv target length data use interrupt mode.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param prxbuf: buffer to save data read from UART FIFO.
|
||||
* @param len: number of data to be read.
|
||||
* @retval : HAL_Status
|
||||
* @note this function is asynchronous API.
|
||||
*/
|
||||
int32_t serial_recv_stream(serial_t *obj, char *prxbuf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief send target length data use interrupt mode.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param ptxbuf: buffer to be written to Tx FIFO.
|
||||
* @param len: number of data to be send.
|
||||
* @retval : HAL_Status
|
||||
* @note this function is asynchronous API.
|
||||
*/
|
||||
int32_t serial_send_stream(serial_t *obj, char *ptxbuf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief recv target length data use DMA mode.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param prxbuf: buffer to save data read from UART FIFO.
|
||||
* @param len: number of data to be read.
|
||||
* @retval : HAL_Status
|
||||
* @note this function is asynchronous API.
|
||||
*/
|
||||
int32_t serial_recv_stream_dma(serial_t *obj, char *prxbuf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief send target length data use DMA mode.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param ptxbuf: buffer to be written to Tx FIFO.
|
||||
* @param len: number of data to be send.
|
||||
* @retval : HAL_Status
|
||||
* @note this function is asynchronous API.
|
||||
*/
|
||||
int32_t serial_send_stream_dma(serial_t *obj, char *ptxbuf, uint32_t len);
|
||||
|
||||
/**
|
||||
* @brief stop the stream or stream_dma TX.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval : number of bytes sent before stop
|
||||
*/
|
||||
int32_t serial_send_stream_abort(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief stop the stream or stream_dma RX.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval : number of bytes received before stop
|
||||
*/
|
||||
int32_t serial_recv_stream_abort(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief disable uart clock and function.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_disable(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief enable uart clock and function.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_enable(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief recv target length data use interrupt mode.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param prxbuf: buffer to save data read from UART FIFO.
|
||||
* @param len: number of data to be recv.
|
||||
* @param timeout_ms: polling time before timeout.
|
||||
* @param force_cs: forcing context switch function.
|
||||
* @retval : the byte count received before timeout, or error(<0)
|
||||
* @note this function is asynchronous API.
|
||||
*/
|
||||
int32_t serial_recv_stream_timeout(serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms, void *force_cs);
|
||||
|
||||
/**
|
||||
* @brief recv target length data use DMA mode.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param prxbuf: buffer to save data read from UART FIFO.
|
||||
* @param len: number of data to be recv.
|
||||
* @param timeout_ms: polling time before timeout.
|
||||
* @param force_cs: forcing context switch function.
|
||||
* @retval : the byte count received before timeout, or error(<0)
|
||||
* @note this function is asynchronous API. Some parameters have changed for AmebaD.
|
||||
*/
|
||||
int32_t serial_recv_stream_dma_timeout(serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms, void *force_cs);
|
||||
|
||||
/**
|
||||
* @brief uart rx fifo level setting.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param FifoLv: @see SerialFifoLevel
|
||||
* @retval none
|
||||
*/
|
||||
void serial_rx_fifo_level(serial_t *obj, SerialFifoLevel FifoLv);
|
||||
|
||||
#if (defined(CONFIG_PLATFORM_8710C) && (CONFIG_PLATFORM_8710C == 1))
|
||||
/**
|
||||
* @brief controls the RTS signal.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param rts_state: RTS signal control value.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_rts_control(serial_t *obj, BOOLEAN rts_state);
|
||||
#endif
|
||||
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // #ifndef MBED_SERIAL_EX_API_H
|
||||
283
lib/amb1_sdk/common/mbed/hal_ext/sleep_ex_api.h
Normal file
283
lib/amb1_sdk/common/mbed/hal_ext/sleep_ex_api.h
Normal file
@@ -0,0 +1,283 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file sleep_ex_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides mbed API for SLEEP.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef MBED_SLEEP_EX_API_H
|
||||
#define MBED_SLEEP_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup sleep_ex SLEEP_EX
|
||||
* @ingroup hal
|
||||
* @brief sleep extended functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
|
||||
///@name Ameba1 Only
|
||||
///@{
|
||||
/* Sleep Eake Up event, the User application also
|
||||
need to config the peripheral to trigger wake up event */
|
||||
#define SLEEP_WAKEUP_BY_STIMER (SLP_STIMER) // wake up by system timer
|
||||
#define SLEEP_WAKEUP_BY_GTIMER (SLP_GTIMER) // wake up by General purpose timer timeout
|
||||
#define SLEEP_WAKEUP_BY_GPIO_INT (SLP_GPIO) // wake up by GPIO Port A[7:0] Interrupt
|
||||
#define SLEEP_WAKEUP_BY_WLAN (SLP_WL) // wake up by WLan event
|
||||
#define SLEEP_WAKEUP_BY_NFC (SLP_NFC) // wake up by NFC event
|
||||
#define SLEEP_WAKEUP_BY_SDIO (SLP_SDIO) // wake up by SDIO event
|
||||
#define SLEEP_WAKEUP_BY_USB (SLP_USB) // wake up by USB event
|
||||
|
||||
// Deep Standby Wakeup event
|
||||
#define STANDBY_WAKEUP_BY_STIMER (BIT0) // wake up by system timer
|
||||
#define STANDBY_WAKEUP_BY_NFC (BIT1) // wake up by NFC event
|
||||
//#define SLEEP_WAKEUP_BY_DS_TIMER (BIT2) // The timer to wakeup from Deep Sleep timer
|
||||
// Do not modify these definition, or need to modify the code also.
|
||||
#define STANDBY_WAKEUP_BY_PA5 (BIT4) // GPIO Port A[5]
|
||||
#define STANDBY_WAKEUP_BY_PC7 (BIT5) // GPIO Port C[7]
|
||||
#define STANDBY_WAKEUP_BY_PD5 (BIT6) // GPIO Port D[5]
|
||||
#define STANDBY_WAKEUP_BY_PE3 (BIT7) // GPIO Port E[3]
|
||||
|
||||
// Deep Sleep Wakeup event
|
||||
#define DSLEEP_WAKEUP_BY_TIMER (DS_TIMER33)
|
||||
#define DSLEEP_WAKEUP_BY_GPIO (DS_GPIO) // GPIO Port B[1]
|
||||
|
||||
typedef struct _SLEEP_WKUP_EVENT_ {
|
||||
u8 wakeup_event; // Wake up event: Timer, NFC, GPIO
|
||||
u8 gpio_option; // GPIO Wakeup setting: [3:0]: Pin 3~0 enable, [7:4]: pin3~0 active high/low
|
||||
u32 timer_duration; // the sleep duration and then wakeup
|
||||
} SLEEP_WAKEUP_EVENT, *PSLEEP_WAKEUP_EVENT;
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8711B) && (CONFIG_PLATFORM_8711B == 1)
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
/* Sleep Eake Up event, the User application also
|
||||
need to config the peripheral to trigger wake up event */
|
||||
#define SLEEP_WAKEUP_BY_STIMER (BIT_SYSON_WEVT_SYSTIM_MSK) // wake up by system timer
|
||||
#define SLEEP_WAKEUP_BY_GPIO_INT (BIT_SYSON_WEVT_GPIO_MSK) // wake up by GPIO Port A[31:0] Interrupt
|
||||
#define SLEEP_WAKEUP_BY_WLAN (BIT_SYSON_WEVT_WLAN_MSK) // wake up by WLan event
|
||||
#define SLEEP_WAKEUP_BY_SDIO (BIT_SYSON_WEVT_SDIO_MSK) // wake up by SDIO event
|
||||
#define SLEEP_WAKEUP_BY_USB (BIT_SYSON_WEVT_USB_MSK) // wake up by USB event
|
||||
#define SLEEP_WAKEUP_BY_GPIO (BIT_SYSON_WEVT_GPIO_DSTBY_MSK) // GPIO Port(PA_18, PA_5, PA_22, PA_23)
|
||||
#define SLEEP_WAKEUP_BY_UART (BIT_SYSON_WEVT_UART0_MSK | BIT_SYSON_WEVT_UART1_MSK) // wake up by UART event
|
||||
#define SLEEP_WAKEUP_BY_I2C (BIT_SYSON_WEVT_I2C0_MSK | BIT_SYSON_WEVT_I2C1_MSK) // wake up by I2C event
|
||||
#define SLEEP_WAKEUP_BY_RTC (BIT_SYSON_WEVT_RTC_MSK) // wake up by RTC event
|
||||
|
||||
// Deep Standby Wakeup event
|
||||
#define STANDBY_WAKEUP_BY_STIMER (BIT_SYSON_WEVT_A33_AND_A33GPIO_MSK) // wake up by 1K timer
|
||||
#define STANDBY_WAKEUP_BY_GPIO (BIT_SYSON_WEVT_GPIO_DSTBY_MSK) // GPIO Port(PA_18, PA_5, PA_22, PA_23)
|
||||
#define STANDBY_WAKEUP_BY_RTC (BIT_SYSON_WEVT_RTC_MSK) // wake up by RTC event
|
||||
|
||||
// Deep Sleep Wakeup event
|
||||
#define DSLEEP_WAKEUP_BY_TIMER BIT(0)
|
||||
#define DSLEEP_WAKEUP_BY_GPIO BIT(2) // GPIO Port(PA_18, PA_5, PA_22, PA_23)
|
||||
|
||||
typedef struct _SLEEP_WKUP_EVENT_ {
|
||||
u32 wakeup_event; // Wake up event: Timer, NFC, GPIO
|
||||
u32 gpio_option; // GPIO Wakeup setting: [3:0]: Pin 3~0 enable, [11:8]: pin3~0 active high/low
|
||||
u32 timer_duration; // the sleep duration and then wakeup
|
||||
} SLEEP_WAKEUP_EVENT, *PSLEEP_WAKEUP_EVENT;
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief To make the system entering the Clock Gated power saving.
|
||||
* This function just make the system to enter the clock gated
|
||||
* power saving mode and pending on wake up event waitting.
|
||||
* The user application need to configure the peripheral to
|
||||
* generate system wake up event, like GPIO interrupt,
|
||||
* G-Timer timeout, etc. befor entering power saving mode.
|
||||
* @param wakeup_event: A bit map of wake up event.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg SLEEP_WAKEUP_BY_STIMER
|
||||
* @arg SLEEP_WAKEUP_BY_GTIMER
|
||||
* @arg SLEEP_WAKEUP_BY_GPIO_INT
|
||||
* @arg SLEEP_WAKEUP_BY_WLAN
|
||||
* @arg SLEEP_WAKEUP_BY_SDIO
|
||||
* @arg SLEEP_WAKEUP_BY_USB
|
||||
* @arg SLEEP_WAKEUP_BY_GPIO
|
||||
* @arg SLEEP_WAKEUP_BY_UART
|
||||
* @arg SLEEP_WAKEUP_BY_I2C
|
||||
* @arg SLEEP_WAKEUP_BY_RTC
|
||||
* @arg SLEEP_WAKEUP_BY_RESETPIN
|
||||
* @param sleep_duration: the system sleep duration in ms, only valid
|
||||
* for SLEEP_WAKEUP_BY_STIMER wake up event.
|
||||
* @retval None
|
||||
*/
|
||||
void sleep_ex(uint32_t wakeup_event, uint32_t sleep_duration);
|
||||
|
||||
/**
|
||||
* @brief To make the system entering the Clock Gated power saving.
|
||||
* This function just make the system to enter the clock gated
|
||||
* power saving mode and pending on wake up event waitting.
|
||||
* The user application need to configure the peripheral to
|
||||
* generate system wake up event, like GPIO interrupt
|
||||
* , G-Timer timeout, etc. befor entering power saving mode.
|
||||
* @param wakeup_event: A bit map of wake up event.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg SLEEP_WAKEUP_BY_STIMER
|
||||
* @arg SLEEP_WAKEUP_BY_GTIMER
|
||||
* @arg SLEEP_WAKEUP_BY_GPIO_INT
|
||||
* @arg SLEEP_WAKEUP_BY_WLAN
|
||||
* @arg SLEEP_WAKEUP_BY_SDIO
|
||||
* @arg SLEEP_WAKEUP_BY_USB
|
||||
* @arg SLEEP_WAKEUP_BY_GPIO
|
||||
* @arg SLEEP_WAKEUP_BY_UART
|
||||
* @arg SLEEP_WAKEUP_BY_I2C
|
||||
* @arg SLEEP_WAKEUP_BY_RTC
|
||||
* @arg SLEEP_WAKEUP_BY_RESETPIN
|
||||
* @param sleep_duration: the system sleep duration in ms, only valid
|
||||
* for SLEEP_WAKEUP_BY_STIMER wake up event.
|
||||
* @param clk_sourec_enable: the option for SCLK on(1)/off(0)
|
||||
* @param sdr_enable: the option for turn off the SDR controller (1:off, 0:on)
|
||||
* @retval None
|
||||
*/
|
||||
void sleep_ex_selective(uint32_t wakeup_event, uint32_t sleep_duration, uint32_t clk_sourec_enable, uint32_t sdr_enable);
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
|
||||
///@name Ameba1 Only
|
||||
///@{
|
||||
/**
|
||||
* @brief To make the system entering the Deep Standby power saving.
|
||||
* The CPU, memory and part fo peripheral power is off when
|
||||
* entering deep standby power saving mode. The program needs
|
||||
* to be reload from the flash at system resume.
|
||||
* @retval None
|
||||
*/
|
||||
void deepstandby_ex(void);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8711B) && (CONFIG_PLATFORM_8711B == 1)
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
/**
|
||||
* @brief To make the system entering the Deep Standby power saving.
|
||||
* The CPU, memory and part fo peripheral power is off when
|
||||
* entering deep standby power saving mode. The program needs
|
||||
* to be reload from the flash at system resume.
|
||||
* @param sleep_duration_ms: the system sleep duration in ms, only valid
|
||||
* for STANDBY_WAKEUP_BY_STIMER wake up event.
|
||||
* @retval None
|
||||
*/
|
||||
void deepstandby_ex(uint32_t sleep_duration_ms);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
/**
|
||||
* @brief To make the system entering the Deep Sleep power saving mode.
|
||||
* The CPU, memory and peripheral power is off when entering
|
||||
* deep sleep power saving mode. The program needs to be reload
|
||||
* and all peripheral needs be re-configure when system resume.
|
||||
* @param wakeup_event: A bit map of wake up event.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg DSLEEP_WAKEUP_BY_TIMER
|
||||
* @arg DSLEEP_WAKEUP_BY_GPIO
|
||||
* @param sleep_duration: the system sleep duration in ms, only valid
|
||||
* for DSLEEP_WAKEUP_BY_TIMER wake up event.
|
||||
* @retval None
|
||||
*/
|
||||
void deepsleep_ex(uint32_t wakeup_event, uint32_t sleep_duration);
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
|
||||
///@name Ameba1 Only
|
||||
///@{
|
||||
/**
|
||||
* @brief To add a wake up event to wake up the system from the
|
||||
* deep standby power saving mode.
|
||||
* @param wakeup_event: A bit map of wake up event.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg STANDBY_WAKEUP_BY_STIMER
|
||||
* @arg STANDBY_WAKEUP_BY_GPIO
|
||||
* @arg STANDBY_WAKEUP_BY_RTC
|
||||
* @arg STANDBY_WAKEUP_BY_RESETPIN
|
||||
* @param sleep_duration_ms: the system sleep duration in ms, only valid
|
||||
* for STANDBY_WAKEUP_BY_STIMER wake up event.
|
||||
* @param gpio_option: for a GPIO pin to wake up the system by goes high or low
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg WAKEUP_BY_GPIO_NONE
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP0_LOW
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP0_HIG
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP1_LOW
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP1_HIG
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP2_LOW
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP2_HIG
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP3_LOW
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP3_HIG
|
||||
* @retval None
|
||||
*/
|
||||
void standby_wakeup_event_add(uint32_t wakeup_event, uint32_t sleep_duration_ms, uint32_t gpio_active);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8711B) && (CONFIG_PLATFORM_8711B == 1)
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
/**
|
||||
* @brief To add a wake up event to wake up the system from the
|
||||
* deep standby power saving mode.
|
||||
* @param wakeup_event: A bit map of wake up event.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg STANDBY_WAKEUP_BY_STIMER
|
||||
* @arg STANDBY_WAKEUP_BY_GPIO
|
||||
* @arg STANDBY_WAKEUP_BY_RTC
|
||||
* @arg STANDBY_WAKEUP_BY_RESETPIN
|
||||
* @param gpio_option: for a GPIO pin to wake up the system by goes high or low
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg WAKEUP_BY_GPIO_NONE
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP0_LOW
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP0_HIG
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP1_LOW
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP1_HIG
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP2_LOW
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP2_HIG
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP3_LOW
|
||||
* @arg WAKEUP_BY_GPIO_WAKEUP3_HIG
|
||||
* @retval None
|
||||
*/
|
||||
void standby_wakeup_event_add(uint32_t wakeup_event, uint32_t gpio_active);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
/**
|
||||
* @brief To delete a wake up event for wakeing up the system from the
|
||||
* deep standby power saving mode.
|
||||
* @param wakeup_event: A bit map of wake up event.
|
||||
* This parameter can be any combination of the following values:
|
||||
* @arg STANDBY_WAKEUP_BY_STIMER
|
||||
* @arg STANDBY_WAKEUP_BY_GPIO
|
||||
* @arg STANDBY_WAKEUP_BY_RTC
|
||||
* @arg STANDBY_WAKEUP_BY_RESETPIN
|
||||
* @retval None
|
||||
*/
|
||||
void standby_wakeup_event_del(uint32_t wakeup_event);
|
||||
|
||||
///@}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
//#endif
|
||||
/*\@}*/
|
||||
#endif
|
||||
144
lib/amb1_sdk/common/mbed/hal_ext/spdio_api.h
Normal file
144
lib/amb1_sdk/common/mbed/hal_ext/spdio_api.h
Normal file
@@ -0,0 +1,144 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file spdio_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed SPDIO API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef __SPDIO_API_H__
|
||||
#define __SPDIO_API_H__
|
||||
|
||||
#include <osdep_service.h>
|
||||
|
||||
/** @addtogroup spdio_api SPDIO
|
||||
* @ingroup hal
|
||||
* @brief spdio functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
#define SPDIO_API_DBG
|
||||
|
||||
#ifdef SPDIO_API_DBG
|
||||
#define SPDIO_API_PRINTK(fmt, args...) printf(fmt"\r\n",## args)
|
||||
#define _SPDIO_API_PRINTK(fmt, args...) printf(fmt,## args)
|
||||
#else
|
||||
#define SPDIO_API_PRINTK(fmt, args...)
|
||||
#define _SPDIO_API_PRINTK(fmt, args...)
|
||||
#endif
|
||||
|
||||
#define SPDIO_DMA_ALIGN_4 4
|
||||
#define SPDIO_RX_BUFSZ_ALIGN(x) ((((x-1)>>6)+1)<<6) //alignement to 64
|
||||
|
||||
#define SPDIO_RXDESC_SZ 24
|
||||
|
||||
/*Don't modify this enum table*/
|
||||
enum spdio_rx_data_t{
|
||||
SPDIO_RX_DATA_NULL = 0x00,
|
||||
SPDIO_RX_DATA_ETH = 0x83, //an ethernet packet received
|
||||
SPDIO_RX_DATA_ATCMD = 0x11, //an AT command packet received
|
||||
SPDIO_RX_DATA_USER = 0x41, //defined by user
|
||||
};
|
||||
|
||||
enum spdio_tx_data_t{
|
||||
SPDIO_TX_DATA_NULL = 0x00,
|
||||
SPDIO_TX_DATA_ETH = 0x82, //an ethernet packet sent
|
||||
SPDIO_TX_DATA_ATCMDRSP = 0x10, //an AT command response packet sent
|
||||
SPDIO_TX_DATA_USER = 0x40, // defined by user
|
||||
};
|
||||
|
||||
struct spdio_buf_t{
|
||||
void *priv; //priv data from user
|
||||
u32 buf_allocated; //The spdio buffer allocated address
|
||||
u16 size_allocated; //The actual allocated size
|
||||
u32 buf_addr; //The spdio buffer physical address, it must be 4-bytes aligned
|
||||
u16 buf_size;
|
||||
u8 type; //The type of the data which this buffer carries, spdio_rx_data_t and spdio_tx_data_t
|
||||
u8 reserved;
|
||||
};
|
||||
|
||||
struct spdio_t {
|
||||
void *priv; //not used by user
|
||||
u32 tx_bd_num; //for spdio send data to host, 2 bd for one packet, so this value must be rounded to 2
|
||||
u32 rx_bd_num; //for spdio receive data from host
|
||||
u32 rx_bd_bufsz; //buffer size = desired packet length + 24(spdio header info), must be rounded to 64
|
||||
struct spdio_buf_t *rx_buf; //buffer array for spdio receive assigned by user, rx_bd_bufsz * rx_bd_num
|
||||
|
||||
/**
|
||||
*@brief pointer to callback function defined by user,
|
||||
called by spdio when one packet receive done
|
||||
*@param priv: a pointer to spdio_t structure which is used to initilize spdio interface
|
||||
*@param pbuf: a pointer to spdio_buf_t structure which is spdio receive buffer
|
||||
*@param pdata: the actual received packet payload
|
||||
*@param size: the actual payload length
|
||||
*@param type: the received packet type, spdio_rx_data_t
|
||||
*@retval SUCCESS or FAIL
|
||||
*/
|
||||
char (*rx_done_cb)(void *priv, void* pbuf, u8 *pdata, u16 size, u8 type);
|
||||
|
||||
/**
|
||||
*@brief pointer to callback function defined by user,
|
||||
called by spdio when one packet sent done
|
||||
*@param priv: a pointer to spdio_t structure which is used to initilize spdio interface
|
||||
*@param pbuf: a pointer to spdio_buf_t structure which carries the transmit packet
|
||||
*@retval SUCCESS or FAIL
|
||||
*/
|
||||
char (*tx_done_cb)(void *priv, void* pbuf);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Gets example setting for spdio obj.
|
||||
* @param obj: a pointer to an spdio_t structure which will be initialized with an example settings
|
||||
* @retval None
|
||||
*/
|
||||
void spdio_structinit(struct spdio_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Initialize spdio interface.
|
||||
* @param obj, a pointer to a spdio_t structure which should be initialized by user,
|
||||
* and which will be used to initialize spdio interface
|
||||
* obj->tx_bd_num: spdio write bd number, needs 2 bd for one transaction
|
||||
* obj->rx_bd_num: spdio read bd number
|
||||
* obj->rx_bd_bufsz: spdio read buffer size
|
||||
* obj->rx_buf: spdio read buffer array
|
||||
* @retval None
|
||||
*/
|
||||
void spdio_init(struct spdio_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Deinitialize spdio interface.
|
||||
* @param obj: a pointer to spdio_t structure which is already initialized
|
||||
* @retval None
|
||||
*/
|
||||
void spdio_deinit(struct spdio_t *obj);
|
||||
|
||||
/**
|
||||
* @brief spdio write function.
|
||||
* @param obj: a pointer to spdio_t structure which is already initialized
|
||||
* @param pbuf: a pointer to spdio_buf_t structure which carries the payload
|
||||
* @retval SUCCESS or FAIL
|
||||
*/
|
||||
s8 spdio_tx(struct spdio_t *obj, struct spdio_buf_t *pbuf);
|
||||
|
||||
/**
|
||||
* @brief an obj which will be used to initialize sdio interface
|
||||
* so it must be initialized before calling HalSdioInit();
|
||||
*/
|
||||
extern struct spdio_t *g_spdio_priv;
|
||||
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#endif //#ifndef __SPDIO_API_H__
|
||||
244
lib/amb1_sdk/common/mbed/hal_ext/spi_ex_api.h
Normal file
244
lib/amb1_sdk/common/mbed/hal_ext/spi_ex_api.h
Normal file
@@ -0,0 +1,244 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file spi_ex_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed SPI API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef MBED_SPI_EXT_API_H
|
||||
#define MBED_SPI_EXT_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup spi_ex SPI_EX
|
||||
* @ingroup hal
|
||||
* @brief spi extended functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
#define SPI_DMA_RX_EN (1<<0)
|
||||
#define SPI_DMA_TX_EN (1<<1)
|
||||
|
||||
enum {
|
||||
SPI_SCLK_IDLE_LOW=0, // the SCLK is Low when SPI is inactive
|
||||
SPI_SCLK_IDLE_HIGH=2 // the SCLK is High when SPI is inactive
|
||||
};
|
||||
|
||||
// SPI Master mode: for continuous transfer, how the CS toggle:
|
||||
enum {
|
||||
SPI_CS_TOGGLE_EVERY_FRAME=0, // let SCPH=0 then the CS toggle every frame
|
||||
SPI_CS_TOGGLE_START_STOP=1 // let SCPH=1 the CS toggle at start and stop
|
||||
};
|
||||
|
||||
enum {
|
||||
SPI_SCLK_TOGGLE_MIDDLE=0, // Serial Clk toggle at middle of 1st data bit and latch data at 1st Clk edge
|
||||
SPI_SCLK_TOGGLE_START=1 // Serial Clk toggle at start of 1st data bit and latch data at 2nd Clk edge
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
CS_0 = 0,
|
||||
CS_1 = 1,
|
||||
CS_2 = 2,
|
||||
CS_3 = 3,
|
||||
CS_4 = 4,
|
||||
CS_5 = 5,
|
||||
CS_6 = 6,
|
||||
CS_7 = 7
|
||||
}ChipSelect;
|
||||
|
||||
|
||||
#define SPI_STATE_READY 0x00
|
||||
#define SPI_STATE_RX_BUSY (1<<1)
|
||||
#define SPI_STATE_TX_BUSY (1<<2)
|
||||
|
||||
typedef enum {
|
||||
SpiRxIrq,
|
||||
SpiTxIrq
|
||||
} SpiIrq;
|
||||
|
||||
typedef void (*spi_irq_handler)(uint32_t id, SpiIrq event);
|
||||
|
||||
/**
|
||||
* @brief Set SPI interrupt handler if needed.
|
||||
* @param obj: spi object define in application software.
|
||||
* @param handler: interrupt callback function
|
||||
* @param id: interrupt callback parameter
|
||||
* @retval none
|
||||
*/
|
||||
void spi_irq_hook(spi_t *obj, spi_irq_handler handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Set SPI interrupt bus tx done handler if needed.
|
||||
* @param obj: spi object define in application software.
|
||||
* @param handler: interrupt bus tx done callback function
|
||||
* @param id: interrupt callback parameter
|
||||
* @retval none
|
||||
*/
|
||||
void spi_bus_tx_done_irq_hook(spi_t *obj, spi_irq_handler handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Slave device to flush tx fifo.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @note : It will discard all data in both tx fifo and rx fifo
|
||||
*/
|
||||
void spi_slave_flush_fifo(spi_t * obj);
|
||||
|
||||
/**
|
||||
* @brief slave recv target length data use interrupt mode.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be read.
|
||||
* @retval : stream init status
|
||||
*/
|
||||
int32_t spi_slave_read_stream(spi_t *obj, char *rx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief slave send target length data use interrupt mode.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @param tx_buffer: buffer to be written to Tx FIFO.
|
||||
* @param length: number of data bytes to be send.
|
||||
* @retval : stream init status
|
||||
*/
|
||||
int32_t spi_slave_write_stream(spi_t *obj, char *tx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief master recv target length data use interrupt mode.
|
||||
* @param obj: spi master object define in application software.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be read.
|
||||
* @retval : stream init status
|
||||
*/
|
||||
int32_t spi_master_read_stream(spi_t *obj, char *rx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief master send target length data use interrupt mode.
|
||||
* @param obj: spi master object define in application software.
|
||||
* @param tx_buffer: buffer to be written to Tx FIFO.
|
||||
* @param length: number of data bytes to be send.
|
||||
* @retval : stream init status
|
||||
*/
|
||||
int32_t spi_master_write_stream(spi_t *obj, char *tx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief master send & recv target length data use interrupt mode.
|
||||
* @param obj: spi master object define in application software.
|
||||
* @param tx_buffer: buffer to be written to Tx FIFO.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be send & recv.
|
||||
* @retval : stream init status
|
||||
*/
|
||||
int32_t spi_master_write_read_stream(spi_t *obj, char *tx_buffer, char *rx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief slave recv target length data use interrupt mode and timeout mechanism.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be read.
|
||||
* @param timeout_ms: timeout waiting time.
|
||||
* @retval : number of bytes read already
|
||||
*/
|
||||
int32_t spi_slave_read_stream_timeout(spi_t *obj, char *rx_buffer, uint32_t length, uint32_t timeout_ms);
|
||||
|
||||
/**
|
||||
* @brief slave recv target length data use interrupt mode and stop if the spi bus is idle.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be read.
|
||||
* @retval : number of bytes read already
|
||||
*/
|
||||
int32_t spi_slave_read_stream_terminate(spi_t *obj, char *rx_buffer, uint32_t length);
|
||||
|
||||
//#ifdef CONFIG_GDMA_EN
|
||||
/**
|
||||
* @brief slave recv target length data use DMA mode.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be read.
|
||||
* @retval : stream init status
|
||||
*/
|
||||
int32_t spi_slave_read_stream_dma(spi_t *obj, char *rx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief slave send target length data use DMA mode.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @param tx_buffer: buffer to be written to Tx FIFO.
|
||||
* @param length: number of data bytes to be send.
|
||||
* @retval : stream init status
|
||||
*/
|
||||
int32_t spi_slave_write_stream_dma(spi_t *obj, char *tx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief master send & recv target length data use DMA mode.
|
||||
* @param obj: spi master object define in application software.
|
||||
* @param tx_buffer: buffer to be written to Tx FIFO.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be send & recv.
|
||||
* @retval : stream init status
|
||||
*/
|
||||
int32_t spi_master_write_read_stream_dma(spi_t * obj, char * tx_buffer, char * rx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief master recv target length data use DMA mode.
|
||||
* @param obj: spi master object define in application software.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be read.
|
||||
* @retval : stream init status
|
||||
* @note : DMA or Interrupt mode can be used to TX dummy data
|
||||
*/
|
||||
int32_t spi_master_read_stream_dma(spi_t *obj, char *rx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief master send target length data use DMA mode.
|
||||
* @param obj: spi master object define in application software.
|
||||
* @param tx_buffer: buffer to be written to Tx FIFO.
|
||||
* @param length: number of data bytes to be send.
|
||||
* @retval : stream init status
|
||||
*/
|
||||
int32_t spi_master_write_stream_dma(spi_t *obj, char *tx_buffer, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief slave recv target length data use DMA mode and timeout mechanism.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be read.
|
||||
* @param timeout_ms: timeout waiting time.
|
||||
* @retval : number of bytes read already
|
||||
*/
|
||||
int32_t spi_slave_read_stream_dma_timeout(spi_t *obj, char *rx_buffer, uint32_t length, uint32_t timeout_ms);
|
||||
|
||||
/**
|
||||
* @brief slave recv target length data use DMA mode and stop if the spi bus is idle.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @param rx_buffer: buffer to save data read from SPI FIFO.
|
||||
* @param length: number of data bytes to be read.
|
||||
* @retval : number of bytes read already
|
||||
*/
|
||||
int32_t spi_slave_read_stream_dma_terminate(spi_t * obj, char * rx_buffer, uint32_t length);
|
||||
//#endif
|
||||
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
125
lib/amb1_sdk/common/mbed/hal_ext/sys_api.h
Normal file
125
lib/amb1_sdk/common/mbed/hal_ext/sys_api.h
Normal file
@@ -0,0 +1,125 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file sys_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed system API:
|
||||
* -JTAG OFF
|
||||
* -LOGUART ON/OFF
|
||||
* -OTA image switch
|
||||
* -System Reset
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef MBED_SYS_API_H
|
||||
#define MBED_SYS_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup sys SYSTEM
|
||||
* @ingroup hal
|
||||
* @brief system functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Turn off the JTAG function
|
||||
* @retval none
|
||||
*/
|
||||
void sys_jtag_off(void);
|
||||
|
||||
/**
|
||||
* @brief switch OTA image if the othe OTA image is valid
|
||||
* @retval none
|
||||
* @note for AmebaZ, sys_clear_ota_signature is the same with sys_recover_ota_signature
|
||||
*/
|
||||
void sys_clear_ota_signature(void);
|
||||
|
||||
/**
|
||||
* @brief switch OTA image if the othe OTA image is valid
|
||||
* @retval none
|
||||
* @note for AmebaZ, sys_clear_ota_signature is the same with sys_recover_ota_signature
|
||||
*/
|
||||
void sys_recover_ota_signature(void);
|
||||
|
||||
/**
|
||||
* @brief open log uart
|
||||
* @retval none
|
||||
*/
|
||||
void sys_log_uart_on(void);
|
||||
|
||||
/**
|
||||
* @brief close log uart
|
||||
* @retval none
|
||||
*/
|
||||
void sys_log_uart_off(void);
|
||||
|
||||
/**
|
||||
* @brief store or load adc calibration parameter
|
||||
* @param write: this parameter can be one of the following values:
|
||||
* @arg 0: load adc calibration parameter offset & gain from flash system data region
|
||||
* @arg 1: store adc calibration parameter offset & gain to flash system data region
|
||||
* @param offset: pointer to adc parameter offset
|
||||
* @param gain: pointer to adc parameter gain
|
||||
* @retval none
|
||||
*/
|
||||
void sys_adc_calibration(u8 write, u16 *offset, u16 *gain);
|
||||
|
||||
/**
|
||||
* @brief system software reset
|
||||
* @retval none
|
||||
*/
|
||||
void sys_reset(void);
|
||||
|
||||
///@}
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) && (CONFIG_PLATFORM_8195A == 1)
|
||||
///@name Ameba1 Only
|
||||
///@{
|
||||
/**
|
||||
* @brief check whether is sdram power on
|
||||
* @retval 1: power on
|
||||
* 0: power off
|
||||
*/
|
||||
u8 sys_is_sdram_power_on(void);
|
||||
|
||||
/**
|
||||
* @brief sdram power off
|
||||
* @retval none
|
||||
*/
|
||||
void sys_sdram_off(void);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8711B) && (CONFIG_PLATFORM_8711B == 1)
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
/**
|
||||
* @brief vector reset
|
||||
* @retval none
|
||||
*/
|
||||
void sys_cpu_reset(void);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
84
lib/amb1_sdk/common/mbed/hal_ext/wdt_api.h
Normal file
84
lib/amb1_sdk/common/mbed/hal_ext/wdt_api.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file wdt_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed WDT API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2015, Realtek Semiconductor Corp.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This module is a confidential and proprietary property of RealTek and
|
||||
* possession or use of this module requires written permission of RealTek.
|
||||
******************************************************************************
|
||||
*/
|
||||
#ifndef MBED_WATCHDOG_API_H
|
||||
#define MBED_WATCHDOG_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup wdt WDT
|
||||
* @ingroup hal
|
||||
* @brief wdt functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
typedef void (*wdt_irq_handler)(uint32_t id);
|
||||
/**
|
||||
* @brief Initializes the watch dog, include time setting, mode register
|
||||
* @param timeout_ms: the watch-dog timer timeout value, in ms.
|
||||
* default action of timeout is to reset the whole system.
|
||||
* @retval none
|
||||
*/
|
||||
void watchdog_init(uint32_t timeout_ms);
|
||||
|
||||
/**
|
||||
* @brief Start the watchdog counting
|
||||
* @param None
|
||||
* @retval none
|
||||
*/
|
||||
void watchdog_start(void);
|
||||
|
||||
/**
|
||||
* @brief Stop the watchdog counting
|
||||
* @param None
|
||||
* @retval none
|
||||
*/
|
||||
void watchdog_stop(void);
|
||||
|
||||
/**
|
||||
* @brief Refresh the watchdog counting to prevent WDT timeout
|
||||
* @param None
|
||||
* @retval none
|
||||
*/
|
||||
void watchdog_refresh(void);
|
||||
|
||||
/**
|
||||
* @brief Switch the watchdog timer to interrupt mode and
|
||||
* register a watchdog timer timeout interrupt handler.
|
||||
* The interrupt handler will be called when the watch-dog
|
||||
* timer is timeout.
|
||||
* @param handler: the callback function for WDT timeout interrupt.
|
||||
* @param id: the parameter for the callback function
|
||||
* @retval none
|
||||
*/
|
||||
void watchdog_irq_init(wdt_irq_handler handler, uint32_t id);
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user