mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-07-31 12:41:06 +00:00
first commit
This commit is contained in:
parent
2ee525362e
commit
d108756e9b
792 changed files with 336059 additions and 0 deletions
44
RTL00_SDKV35a/component/common/mbed/hal_ext/dma_api.h
Normal file
44
RTL00_SDKV35a/component/common/mbed/hal_ext/dma_api.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_GDMA_API_H
|
||||
#define MBED_GDMA_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct gdma_s {
|
||||
HAL_GDMA_OBJ gdma_obj;
|
||||
uint8_t gdma_allocated;
|
||||
};
|
||||
|
||||
typedef struct gdma_s gdma_t;
|
||||
|
||||
typedef void (*dma_irq_handler)(uint32_t id);
|
||||
|
||||
void dma_memcpy_init(gdma_t *dma_obj, dma_irq_handler handler, uint32_t id);
|
||||
void dma_memcpy_deinit(gdma_t *dma_obj);
|
||||
void dma_memcpy(gdma_t *dma_obj, void *dst, void* src, uint32_t len);
|
||||
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);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // end of "#define MBED_GDMA_API_H"
|
31
RTL00_SDKV35a/component/common/mbed/hal_ext/efuse_api.h
Normal file
31
RTL00_SDKV35a/component/common/mbed/hal_ext/efuse_api.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2014, 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
|
||||
|
||||
int efuse_get_remaining_length(void);
|
||||
void efuse_mtp_read(uint8_t * data);
|
||||
int efuse_mtp_write(uint8_t *data, uint8_t len);
|
||||
int efuse_otp_read(u8 address, u8 len, u8 *buf);
|
||||
int efuse_otp_write(u8 address, u8 len, u8 *buf);
|
||||
int efuse_disable_jtag(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // MBED_EXT_EFUSE_API_EXT_H
|
|
@ -0,0 +1,48 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ETHERNET_EX_API_H
|
||||
#define ETHERNET_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define ETH_TX_DESC_SIZE 20 // 20 Bytes
|
||||
#define ETH_RX_DESC_SIZE 16 // 16 Bytes
|
||||
#define ETH_PKT_BUF_SIZE 1536
|
||||
|
||||
|
||||
typedef void (*ethernet_callback)(uint32_t event, uint32_t data);
|
||||
|
||||
void ethernet_irq_hook(ethernet_callback callback);
|
||||
/* Set the numbers of Tx/Rx descriptor */
|
||||
void ethernet_set_descnum(uint8_t txdescCnt, uint8_t rxdescCnt);
|
||||
/* Set the start address of Tx/Rx descriptor and packet buffer */
|
||||
void ethernet_trx_pre_setting(uint8_t *TxDescAddr, uint8_t *RxDescAddr, uint8_t *pTxPktBuf, uint8_t *pRxPktBuf);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // #ifndef ETHERNET_EX_API_H
|
||||
|
48
RTL00_SDKV35a/component/common/mbed/hal_ext/ex_api.h
Normal file
48
RTL00_SDKV35a/component/common/mbed/hal_ext/ex_api.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#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 "nfc_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"
|
||||
#include "ethernet_ex_api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
56
RTL00_SDKV35a/component/common/mbed/hal_ext/flash_api.h
Normal file
56
RTL00_SDKV35a/component/common/mbed/hal_ext/flash_api.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/* mbed Microcontroller Library
|
||||
*******************************************************************************
|
||||
* Copyright (c) 2014, 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
|
||||
|
||||
typedef struct flash_s flash_t;
|
||||
|
||||
/**
|
||||
* global data structure
|
||||
*/
|
||||
//extern flash_t flash;
|
||||
extern flash_t flashobj;
|
||||
extern bool fspic_isinit;
|
||||
|
||||
enum {
|
||||
FLASH_COMPLETE = 0,
|
||||
FLASH_ERROR_2 = 1,
|
||||
};
|
||||
|
||||
void flash_turnon (void);
|
||||
void flash_init (flash_t *obj);
|
||||
void flash_erase_sector (flash_t *obj, uint32_t address);
|
||||
void flash_erase_block (flash_t *obj, uint32_t address);
|
||||
int flash_read_word (flash_t *obj, uint32_t address, uint32_t * data);
|
||||
int flash_write_word (flash_t *obj, uint32_t address, uint32_t data);
|
||||
int flash_stream_read (flash_t *obj, uint32_t address, uint32_t len, uint8_t * data);
|
||||
int flash_stream_write (flash_t *obj, uint32_t address, uint32_t len, uint8_t * data);
|
||||
void flash_write_protect (flash_t *obj, uint32_t protect);
|
||||
int flash_get_status (flash_t * obj);
|
||||
int flash_set_status (flash_t * obj, uint32_t data);
|
||||
void flash_reset_status (flash_t * obj);
|
||||
int flash_burst_write (flash_t * obj, uint32_t address, uint32_t Length, uint8_t * data);
|
||||
int flash_burst_read (flash_t * obj, uint32_t address, uint32_t Length, uint8_t * data);
|
||||
int flash_set_extend_addr (flash_t * obj, uint32_t data);
|
||||
int flash_get_extend_addr (flash_t * obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
42
RTL00_SDKV35a/component/common/mbed/hal_ext/flash_eep.h
Normal file
42
RTL00_SDKV35a/component/common/mbed/hal_ext/flash_eep.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/******************************************************************************
|
||||
* FileName: flash_eep.h
|
||||
* Description: FLASH
|
||||
* Alternate SDK
|
||||
* Author: PV`
|
||||
* (c) PV` 2015
|
||||
*******************************************************************************/
|
||||
#ifndef __FLASH_EEP_H_
|
||||
#define __FLASH_EEP_H_
|
||||
|
||||
#include <basic_types.h>
|
||||
#include <FreeRTOS.h>
|
||||
#include <queue.h>
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef FLASH_SECTOR_SIZE
|
||||
#define FLASH_SECTOR_SIZE 4096
|
||||
#endif
|
||||
#define FLASH_SECTORS 256 // 1 Mbytes
|
||||
#define FLASH_CHIP_SIZE (FLASH_SECTORS * FLASH_SECTOR_SIZE)
|
||||
#define FMEMORY_SCFG_BANK_SIZE FLASH_SECTOR_SIZE // размер сектора, 4096 bytes
|
||||
#define FMEMORY_SCFG_BANKS 2 // кол-во секторов для работы 2...
|
||||
#define FMEMORY_SCFG_BASE_ADDR (FLASH_CHIP_SIZE - (FMEMORY_SCFG_BANKS*FMEMORY_SCFG_BANK_SIZE))
|
||||
//-----------------------------------------------------------------------------
|
||||
#define FLASH_EEP_ATTR
|
||||
//-----------------------------------------------------------------------------
|
||||
enum eFMEMORY_ERRORS {
|
||||
FMEM_NOT_FOUND = -1, // -1 - не найден
|
||||
FMEM_FLASH_ERR = -2, // -2 - flash rd/wr/erase error
|
||||
FMEM_ERROR = -3, // -3 - error
|
||||
FMEM_OVR_ERR = -4, // -4 - переполнение FMEMORY_SCFG_BANK_SIZE
|
||||
FMEM_MEM_ERR = -5 // -5 - heap alloc error
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// extern QueueHandle_t flash_mutex;
|
||||
sint16 flash_read_cfg(void *ptr, uint16 id, uint16 maxsize) FLASH_EEP_ATTR; // возврат: размер объекта последнего сохранения, -1 - не найден, -2 - error
|
||||
bool flash_write_cfg(void *ptr, uint16 id, uint16 size) FLASH_EEP_ATTR;
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef USE_FLASH_EEP
|
||||
#define USE_FLASH_EEP 1
|
||||
#endif
|
||||
|
||||
#endif /* __FLASH_EEP_H_ */
|
36
RTL00_SDKV35a/component/common/mbed/hal_ext/gpio_ex_api.h
Normal file
36
RTL00_SDKV35a/component/common/mbed/hal_ext/gpio_ex_api.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_GPIO_API_H
|
||||
#define MBED_GPIO_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* GPIO object */
|
||||
void gpio_direct_write(gpio_t *obj, BOOL value) ;
|
||||
void gpio_pull_ctrl(gpio_t *obj, PinMode pull_type);
|
||||
void gpio_deinit(gpio_t *obj, PinName pin);
|
||||
void gpio_change_dir(gpio_t *obj, PinDirection direction);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,40 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_GPIO_IRQ_EX_API_H
|
||||
#define MBED_GPIO_IRQ_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#if DEVICE_INTERRUPTIN
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
IRQ_LOW = 3,
|
||||
IRQ_HIGH =4
|
||||
} gpio_irq_event_ex;
|
||||
|
||||
void gpio_irq_deinit(gpio_irq_t *obj);
|
||||
void gpio_irq_pull_ctrl(gpio_irq_t *obj, PinMode pull_type);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // end of "#if DEVICE_INTERRUPTIN"
|
||||
|
||||
#endif // end of #ifndef MBED_GPIO_IRQ_EX_API_H
|
46
RTL00_SDKV35a/component/common/mbed/hal_ext/i2c_ex_api.h
Normal file
46
RTL00_SDKV35a/component/common/mbed/hal_ext/i2c_ex_api.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef I2C_EX_API_H
|
||||
#define I2C_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
I2C_TX_COMPLETE = 0,
|
||||
I2C_RX_COMPLETE = 1,
|
||||
I2C_RD_REQ_COMMAND = 2,
|
||||
I2C_ERR_OCCURRED = 3,
|
||||
}I2CCallback;
|
||||
|
||||
void i2c_set_user_callback(i2c_t *obj, I2CCallback i2ccb, void(*i2c_callback)(void *));
|
||||
void i2c_clear_user_callback(i2c_t *obj, I2CCallback i2ccb);
|
||||
int i2c_enable_control(i2c_t *obj, int enable);
|
||||
|
||||
void i2c_restart_enable(i2c_t *obj);
|
||||
void i2c_restart_disable(i2c_t *obj);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
76
RTL00_SDKV35a/component/common/mbed/hal_ext/i2s_api.h
Normal file
76
RTL00_SDKV35a/component/common/mbed/hal_ext/i2s_api.h
Normal file
|
@ -0,0 +1,76 @@
|
|||
/* 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_EXT_I2S_API_EXT_H
|
||||
#define MBED_EXT_I2S_API_EXT_H
|
||||
|
||||
#include "device.h"
|
||||
#include "rtl8195a.h"
|
||||
#include "hal_i2s.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
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_11p02KHZ = I2S_SR_11p02KHZ,
|
||||
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
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
void i2s_init(i2s_t *obj, PinName sck, PinName ws, PinName sd);
|
||||
void i2s_set_dma_buffer(i2s_t *obj, char *tx_buf, char *rx_buf,
|
||||
uint32_t page_num, uint32_t page_size);
|
||||
void i2s_tx_irq_handler(i2s_t *obj, i2s_irq_handler handler, uint32_t id);
|
||||
void i2s_rx_irq_handler(i2s_t *obj, i2s_irq_handler handler, uint32_t id);
|
||||
void i2s_set_direction(i2s_t *obj, int trx_type);
|
||||
void i2s_set_param(i2s_t *obj, int channel_num, int rate, int word_len);
|
||||
void i2s_deinit(i2s_t *obj);
|
||||
int* i2s_get_tx_page(i2s_t *obj);
|
||||
void i2s_send_page(i2s_t *obj, uint32_t *pbuf);
|
||||
void i2s_recv_page(i2s_t *obj);
|
||||
void i2s_enable(i2s_t *obj);
|
||||
void i2s_disable(i2s_t *obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
66
RTL00_SDKV35a/component/common/mbed/hal_ext/log_uart_api.h
Normal file
66
RTL00_SDKV35a/component/common/mbed/hal_ext/log_uart_api.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef LOG_UART_API_H
|
||||
#define LOG_UART_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include "serial_api.h"
|
||||
#include "hal_log_uart.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*loguart_irq_handler)(uint32_t id, LOG_UART_INT_ID event);
|
||||
|
||||
typedef struct log_uart_s log_uart_t;
|
||||
|
||||
int32_t log_uart_init (log_uart_t *obj, int baudrate, int data_bits, SerialParity parity, int stop_bits);
|
||||
void log_uart_free(log_uart_t *obj);
|
||||
void log_uart_baud(log_uart_t *obj, int baudrate);
|
||||
void log_uart_format(log_uart_t *obj, int data_bits, SerialParity parity, int stop_bits);
|
||||
void log_uart_irq_handler(log_uart_t *obj, loguart_irq_handler handler, uint32_t id);
|
||||
void log_uart_irq_set(log_uart_t *obj, LOG_UART_INT_ID irq, uint32_t enable);
|
||||
char log_uart_getc(log_uart_t *obj);
|
||||
void log_uart_putc(log_uart_t *obj, char c);
|
||||
int log_uart_readable(log_uart_t *obj);
|
||||
int log_uart_writable(log_uart_t *obj);
|
||||
void log_uart_clear(log_uart_t *obj);
|
||||
void log_uart_clear_tx(log_uart_t *obj);
|
||||
void log_uart_clear_rx(log_uart_t *obj);
|
||||
void log_uart_break_set(log_uart_t *obj);
|
||||
void log_uart_break_clear(log_uart_t *obj);
|
||||
void log_uart_tx_comp_handler(log_uart_t *obj, void *handler, uint32_t id);
|
||||
void log_uart_rx_comp_handler(log_uart_t *obj, void *handler, uint32_t id);
|
||||
void log_uart_line_status_handler(log_uart_t *obj, void *handler, uint32_t id);
|
||||
int32_t log_uart_recv (log_uart_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms);
|
||||
int32_t log_uart_send (log_uart_t *obj, char *ptxbuf, uint32_t len, uint32_t timeout_ms);
|
||||
int32_t log_uart_recv_stream (log_uart_t *obj, char *prxbuf, uint32_t len);
|
||||
int32_t log_uart_send_stream (log_uart_t *obj, char *ptxbuf, uint32_t len);
|
||||
int32_t log_uart_recv_stream_timeout (log_uart_t *obj, char *prxbuf, uint32_t len,
|
||||
uint32_t timeout_ms, void *force_cs);
|
||||
int32_t log_uart_send_stream_abort (log_uart_t *obj);
|
||||
int32_t log_uart_recv_stream_abort (log_uart_t *obj);
|
||||
void log_uart_disable (log_uart_t *obj);
|
||||
void log_uart_enable (log_uart_t *obj);
|
||||
uint8_t log_uart_raed_lsr(log_uart_t *obj);
|
||||
uint8_t log_uart_raed_msr(log_uart_t *obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // end of "#ifndef LOG_UART_API_H"
|
70
RTL00_SDKV35a/component/common/mbed/hal_ext/nfc_api.h
Normal file
70
RTL00_SDKV35a/component/common/mbed/hal_ext/nfc_api.h
Normal file
|
@ -0,0 +1,70 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#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
|
60
RTL00_SDKV35a/component/common/mbed/hal_ext/serial_ex_api.h
Normal file
60
RTL00_SDKV35a/component/common/mbed/hal_ext/serial_ex_api.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_SERIAL_EX_API_H
|
||||
#define MBED_SERIAL_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#if DEVICE_SERIAL
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Define RX FIFO Level: RX interrupt trigger, RTS de-assert trigger
|
||||
typedef enum {
|
||||
FifoLv1Byte=0, // 1-byte
|
||||
FifoLvQuarter=1, // 4-byte
|
||||
FifoLvHalf=2, // 8-byte
|
||||
FifoLvFull=3 // 14-byte
|
||||
} SerialFifoLevel;
|
||||
|
||||
void serial_clear_tx(serial_t *obj);
|
||||
void serial_clear_rx(serial_t *obj);
|
||||
void serial_send_comp_handler(serial_t *obj, void *handler, uint32_t id);
|
||||
void serial_recv_comp_handler(serial_t *obj, void *handler, uint32_t id);
|
||||
int32_t serial_recv_blocked (serial_t *obj, char *prxbuf, uint32_t len, uint32_t timeout_ms);
|
||||
int32_t serial_send_blocked (serial_t *obj, char *ptxbuf, uint32_t len, uint32_t timeout_ms);
|
||||
int32_t serial_recv_stream (serial_t *obj, char *prxbuf, uint32_t len);
|
||||
int32_t serial_send_stream (serial_t *obj, char *ptxbuf, uint32_t len);
|
||||
int32_t serial_recv_stream_dma (serial_t *obj, char *prxbuf, uint32_t len);
|
||||
int32_t serial_send_stream_dma (serial_t *obj, char *ptxbuf, uint32_t len);
|
||||
int32_t serial_send_stream_abort (serial_t *obj);
|
||||
int32_t serial_recv_stream_abort (serial_t *obj);
|
||||
void serial_disable (serial_t *obj);
|
||||
void serial_enable (serial_t *obj);
|
||||
int32_t serial_recv_stream_timeout (serial_t *obj, char *prxbuf, uint32_t \
|
||||
len, uint32_t timeout_ms, void *force_cs);
|
||||
int32_t serial_recv_stream_dma_timeout (serial_t *obj, char *prxbuf, \
|
||||
uint32_t len, uint32_t timeout_ms, void *force_cs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef MBED_SERIAL_EX_API_H
|
98
RTL00_SDKV35a/component/common/mbed/hal_ext/sleep_ex_api.h
Normal file
98
RTL00_SDKV35a/component/common/mbed/hal_ext/sleep_ex_api.h
Normal file
|
@ -0,0 +1,98 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_SLEEP_EX_API_H
|
||||
#define MBED_SLEEP_EX_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#if DEVICE_SLEEP
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* 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;
|
||||
/** Send the microcontroller to sleep
|
||||
*
|
||||
* The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
|
||||
* system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
|
||||
* dynamic power used by the processor, memory systems and buses. The processor, peripheral and
|
||||
* memory state are maintained, and the peripherals continue to work and can generate interrupts.
|
||||
*
|
||||
* The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
|
||||
*
|
||||
* @note
|
||||
* The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
|
||||
* Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
|
||||
* able to access the LocalFileSystem
|
||||
*/
|
||||
void sleep_ex(uint32_t wakeup_event, uint32_t sleep_duration);
|
||||
void sleep_ex_selective(uint32_t wakeup_event, uint32_t sleep_duration, uint32_t clk_sourec_enable, uint32_t sdr_enable);
|
||||
|
||||
void standby_wakeup_event_add(uint32_t wakeup_event, uint32_t sleep_duration_ms, uint32_t gpio_active);
|
||||
void standby_wakeup_event_del(uint32_t wakeup_event);
|
||||
void deepstandby_ex(void);
|
||||
|
||||
/** Send the microcontroller to deep sleep
|
||||
*
|
||||
* This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
|
||||
* has the same sleep features as sleep plus it powers down peripherals and clocks. All state
|
||||
* is still maintained.
|
||||
*
|
||||
* The processor can only be woken up by an external interrupt on a pin or a timer.
|
||||
*
|
||||
* @note
|
||||
* The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
|
||||
* Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
|
||||
* able to access the LocalFileSystem
|
||||
*/
|
||||
void deepsleep_ex(uint32_t wakeup_event, uint32_t sleep_duration);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
115
RTL00_SDKV35a/component/common/mbed/hal_ext/spdio_api.h
Normal file
115
RTL00_SDKV35a/component/common/mbed/hal_ext/spdio_api.h
Normal file
|
@ -0,0 +1,115 @@
|
|||
#ifndef __SPDIO_API_H__
|
||||
#define __SPDIO_API_H__
|
||||
|
||||
#include <osdep_service.h>
|
||||
|
||||
#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: rx_done_cb: 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: tx_done_cb: 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__
|
94
RTL00_SDKV35a/component/common/mbed/hal_ext/spi_ex_api.h
Normal file
94
RTL00_SDKV35a/component/common/mbed/hal_ext/spi_ex_api.h
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_SPI_EXT_API_H
|
||||
#define MBED_SPI_EXT_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#if DEVICE_SPI
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#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);
|
||||
|
||||
void spi_irq_hook(spi_t *obj, spi_irq_handler handler, uint32_t id);
|
||||
void spi_bus_tx_done_irq_hook(spi_t *obj, spi_irq_handler handler, uint32_t id);
|
||||
int32_t spi_slave_read_stream(spi_t *obj, char *rx_buffer, uint32_t length);
|
||||
int32_t spi_slave_write_stream(spi_t *obj, char *tx_buffer, uint32_t length);
|
||||
int32_t spi_master_read_stream(spi_t *obj, char *rx_buffer, uint32_t length);
|
||||
int32_t spi_master_write_stream(spi_t *obj, char *tx_buffer, uint32_t length);
|
||||
int32_t spi_master_write_read_stream(spi_t *obj, char *tx_buffer,
|
||||
char *rx_buffer, uint32_t length);
|
||||
int32_t spi_slave_read_stream_timeout(spi_t *obj, char *rx_buffer, uint32_t length, uint32_t timeout_ms);
|
||||
|
||||
#ifdef CONFIG_GDMA_EN
|
||||
int32_t spi_slave_read_stream_dma(spi_t *obj, char *rx_buffer, uint32_t length);
|
||||
int32_t spi_slave_write_stream_dma(spi_t *obj, char *tx_buffer, uint32_t length);
|
||||
int32_t spi_master_write_read_stream_dma(spi_t * obj, char * tx_buffer, char * rx_buffer, uint32_t length);
|
||||
int32_t spi_master_read_stream_dma(spi_t *obj, char *rx_buffer, uint32_t length);
|
||||
int32_t spi_master_write_stream_dma(spi_t *obj, char *tx_buffer, uint32_t length);
|
||||
int32_t spi_slave_read_stream_dma_timeout(spi_t *obj, char *rx_buffer, uint32_t length, uint32_t timeout_ms);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
52
RTL00_SDKV35a/component/common/mbed/hal_ext/sys_api.h
Normal file
52
RTL00_SDKV35a/component/common/mbed/hal_ext/sys_api.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_WATCHDOG_API_H
|
||||
#define MBED_WATCHDOG_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Turn off the JTAG function
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
*/
|
||||
void sys_jtag_off(void);
|
||||
void sys_clear_ota_signature(void);
|
||||
void sys_recover_ota_signature(void);
|
||||
void sys_log_uart_on(void);
|
||||
void sys_log_uart_off(void);
|
||||
void sys_adc_calibration(u8 write, u16 *offset, u16 *gain);
|
||||
u8 sys_is_sdram_power_on(void);
|
||||
void sys_sdram_off(void);
|
||||
|
||||
/**
|
||||
* @brief system software reset
|
||||
*
|
||||
* @return None
|
||||
*
|
||||
*/
|
||||
void sys_reset(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
61
RTL00_SDKV35a/component/common/mbed/hal_ext/wdt_api.h
Normal file
61
RTL00_SDKV35a/component/common/mbed/hal_ext/wdt_api.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2013 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_WATCHDOG_API_H
|
||||
#define MBED_WATCHDOG_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*wdt_irq_handler)(uint32_t id);
|
||||
|
||||
/** Initial the watch dog time setting
|
||||
*
|
||||
* This function will initial and enable the watchdog timer with a given timeout value.
|
||||
* When the watchdog timer timeout event is triggered, the system will be reset. User also can
|
||||
* register a callback function to handle the watchdog timer timeout event.
|
||||
*/
|
||||
void watchdog_init(uint32_t timeout_ms);
|
||||
|
||||
/** Start the watchdog counting
|
||||
*
|
||||
* This function will active the watchdog timer down counting. When the watchdog timer count down
|
||||
* to 0, a callback function will be called or the system will be reset.
|
||||
*/
|
||||
void watchdog_start(void);
|
||||
|
||||
/** Stop the watchdog counting
|
||||
*
|
||||
* This function will stop the watchdog timer down counting. If a user application aware a
|
||||
* procedure may takes too long and cause the watchdog timer timeout, the application use this
|
||||
* function to stop the watchdog timer to prevent the watchdog timer timeout.
|
||||
*/
|
||||
void watchdog_stop(void);
|
||||
|
||||
/** Refresh the watchdog counting
|
||||
*
|
||||
* This function will reload the watchdog timer counting value. Usually a application do the watchdog
|
||||
* timer reflash in the main loop to prevent the watchdog timer timeout.
|
||||
*/
|
||||
void watchdog_refresh(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue