mirror of
https://github.com/dgoodlad/rtl8710-sdk.git
synced 2025-07-31 12:41:06 +00:00
Import required parts of ameba sdk 4.0b
This commit is contained in:
parent
2d21e45bba
commit
7319ca1482
737 changed files with 304718 additions and 0 deletions
81
vendor/sdk/component/common/mbed/hal/analogin_api.h
vendored
Normal file
81
vendor/sdk/component/common/mbed/hal/analogin_api.h
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file analogin_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed Analog_in API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_ANALOGIN_API_H
|
||||
#define MBED_ANALOGIN_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup analog_in ANALOG_IN
|
||||
* @ingroup hal
|
||||
* @brief analog_in functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
typedef struct analogin_s analogin_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initializes the ADC device, include clock/function/ADC registers.
|
||||
* @param obj: adc object define in application software.
|
||||
* @param pin: adc PinName according to pinmux spec.
|
||||
* @retval none
|
||||
*/
|
||||
void analogin_init(analogin_t *obj, PinName pin);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the ADC device, include clock/function/ADC registers.
|
||||
* @param obj: adc object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void analogin_deinit(analogin_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Reads data from the specified adc channel fifo.
|
||||
* @param obj: adc object define in application software.
|
||||
* @retval : adc channel data(float)
|
||||
*/
|
||||
float analogin_read(analogin_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Reads data from the specified adc channel fifo.
|
||||
* @param obj: adc object define in application software.
|
||||
* @retval : 16bit adc channel data(int)
|
||||
*/
|
||||
uint16_t analogin_read_u16(analogin_t *obj);
|
||||
|
||||
///@}
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//MBED_ANALOGIN_API_H
|
||||
96
vendor/sdk/component/common/mbed/hal/analogout_api.h
vendored
Normal file
96
vendor/sdk/component/common/mbed/hal/analogout_api.h
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file analogout_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed Analog_out API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_ANALOGOUT_API_H
|
||||
#define MBED_ANALOGOUT_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup analog_out ANALOG_OUT
|
||||
* @ingroup hal
|
||||
* @brief analog_out functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if CONFIG_PLATFORM_8195A
|
||||
///@name Ameba1 Only
|
||||
///@{
|
||||
|
||||
typedef struct dac_s dac_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize DAC
|
||||
* @param obj: dac object define in application software.
|
||||
* @param pin: dac PinName according to pinmux spec.
|
||||
* @retval none
|
||||
*/
|
||||
void analogout_init(dac_t *obj, PinName pin);
|
||||
|
||||
/**
|
||||
* @brief Free DAC
|
||||
* @param obj: dac object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void analogout_free(dac_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Execute analog output
|
||||
* @para obj: dac object define in application software.
|
||||
* @para value: analog ratio value, should be transfered to register value.
|
||||
* @retval none
|
||||
* @note This function is mainly to execute analog output and the value is a ratio.
|
||||
* The upper/lower bound of DAC register input value is defined by
|
||||
* DAC_XXXXX_FULL_SCALE. The parameter "value" of this function should be
|
||||
* transfered to register value.
|
||||
*/
|
||||
void analogout_write(dac_t *obj, float value);
|
||||
|
||||
/**
|
||||
* @brief Execute analog output 16bit
|
||||
* @para obj: dac object define in application software.
|
||||
* @para value: analog ratio value, should be transfered to register value.
|
||||
* @retval none
|
||||
* @note The register value of DAC input is a format of 2's complement.
|
||||
* The most maximum value of positive value drives DAC to output a voltage about 3.3V.
|
||||
* The most mimimum value of negative value drives DAC to output a voltage about 0.
|
||||
* And the middle value of 0x000 will drive DAC to output a voltage of half of max voltage.
|
||||
*/
|
||||
void analogout_write_u16(dac_t *obj, uint16_t value);
|
||||
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//MBED_ANALOGOUT_API_H
|
||||
80
vendor/sdk/component/common/mbed/hal/can_api.h
vendored
Normal file
80
vendor/sdk/component/common/mbed/hal/can_api.h
vendored
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/* 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_CAN_API_H
|
||||
#define MBED_CAN_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#if DEVICE_CAN
|
||||
|
||||
#include "PinNames.h"
|
||||
#include "PeripheralNames.h"
|
||||
#include "can_helper.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
IRQ_RX,
|
||||
IRQ_TX,
|
||||
IRQ_ERROR,
|
||||
IRQ_OVERRUN,
|
||||
IRQ_WAKEUP,
|
||||
IRQ_PASSIVE,
|
||||
IRQ_ARB,
|
||||
IRQ_BUS,
|
||||
IRQ_READY
|
||||
} CanIrqType;
|
||||
|
||||
|
||||
typedef enum {
|
||||
MODE_RESET,
|
||||
MODE_NORMAL,
|
||||
MODE_SILENT,
|
||||
MODE_TEST_GLOBAL,
|
||||
MODE_TEST_LOCAL,
|
||||
MODE_TEST_SILENT
|
||||
} CanMode;
|
||||
|
||||
typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
|
||||
|
||||
typedef struct can_s can_t;
|
||||
|
||||
void can_init (can_t *obj, PinName rd, PinName td);
|
||||
void can_free (can_t *obj);
|
||||
int can_frequency(can_t *obj, int hz);
|
||||
|
||||
void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id);
|
||||
void can_irq_free (can_t *obj);
|
||||
void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable);
|
||||
|
||||
int can_write (can_t *obj, CAN_Message, int cc);
|
||||
int can_read (can_t *obj, CAN_Message *msg, int handle);
|
||||
int can_mode (can_t *obj, CanMode mode);
|
||||
int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle);
|
||||
void can_reset (can_t *obj);
|
||||
unsigned char can_rderror (can_t *obj);
|
||||
unsigned char can_tderror (can_t *obj);
|
||||
void can_monitor (can_t *obj, int silent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // MBED_CAN_API_H
|
||||
|
||||
#endif
|
||||
178
vendor/sdk/component/common/mbed/hal/dct_api.h
vendored
Normal file
178
vendor/sdk/component/common/mbed/hal/dct_api.h
vendored
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file timer_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed I2C API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifndef __RTK_DCT_H__
|
||||
#define __RTK_DCT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup dct DCT
|
||||
* @ingroup hal
|
||||
* @brief dct functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
enum{
|
||||
DCT_SUCCESS = 0,
|
||||
DCT_ERR = -1,
|
||||
DCT_ERR_CRC = -2,
|
||||
DCT_ERR_NO_SPACE = -3,
|
||||
DCT_ERR_NO_MEMORY = -4,
|
||||
DCT_ERR_FLASH_RW = -5,
|
||||
DCT_ERR_NOT_FIND = -6,
|
||||
DCT_ERR_INVALID = -7,
|
||||
DCT_ERR_SIZE_OVER = -8,
|
||||
DCT_ERR_MODULE_BUSY = -9,
|
||||
};
|
||||
|
||||
enum{
|
||||
DCT_MODULE_STATE_INIT = 0xFFFFFFFF,
|
||||
DCT_MODULE_STATE_VALID = 0xFFFFFFFE,
|
||||
DCT_MODULE_STATE_DELETING = 0xFFFFFFFC,
|
||||
DCT_MODULE_STATE_DELETED = 0xFFFFFFF8,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initialize device configuration table.
|
||||
* @param none
|
||||
* @retval 32 bit
|
||||
*/
|
||||
int32_t dct_init(void);
|
||||
|
||||
/**
|
||||
* @brief Deinitialize device configuration table.
|
||||
* @retval none
|
||||
*/
|
||||
void dct_deinit(void);
|
||||
|
||||
/**
|
||||
* @brief Register module in DCT.
|
||||
* @param module_name : module name
|
||||
* @retval 0 : SUCCESS
|
||||
* @retval <0 : ERROR
|
||||
*/
|
||||
int32_t dct_register_module(char *module_name);
|
||||
|
||||
/**
|
||||
* @brief Unregister and delete module in DCT.
|
||||
* @param module_name : module name
|
||||
* @retval 0 : SUCCESS
|
||||
* @retval <0 : ERROR
|
||||
*/
|
||||
int32_t dct_unregister_module(char *module_name);
|
||||
|
||||
/**
|
||||
* @brief Open module in DCT.
|
||||
* @param dct_handle : setup module informations in dct handler
|
||||
* @param module_name : module name
|
||||
* @retval 0 : SUCCESS
|
||||
* @retval <0 : ERROR
|
||||
*/
|
||||
int32_t dct_open_module(dct_handle_t *dct_handle, char *module_name);
|
||||
|
||||
/**
|
||||
* @brief Close module in DCT.
|
||||
* @param dct_handle : dct handler
|
||||
* @retval 0 : SUCCESS
|
||||
* @retval <0 : ERROR
|
||||
*/
|
||||
int32_t dct_close_module(dct_handle_t *dct_handle);
|
||||
|
||||
/**
|
||||
* @brief Write variable name and value in opened module.
|
||||
* @param dct_handle : dct handler
|
||||
* @param variable_name : variable name which you want to store in module
|
||||
* @param variable_value : variable value which you want to store in module
|
||||
* @retval 0 : SUCCESS
|
||||
* @retval <0 : ERROR
|
||||
*/
|
||||
int32_t dct_set_variable(dct_handle_t *dct_handle, char *variable_name, char *variable_value);
|
||||
|
||||
/**
|
||||
* @brief Read value of variable name in opened module.
|
||||
* @param dct_handle : dct handler
|
||||
* @param variable_name : variable name which you want to get from module
|
||||
* @param buffer : read variable value
|
||||
* @param buffer_size : the buffer size
|
||||
* @retval 0 : SUCCESS
|
||||
* @retval <0 : ERROR
|
||||
*/
|
||||
int32_t dct_get_variable(dct_handle_t *dct_handle, char *variable_name, char *buffer, uint16_t buffer_size);
|
||||
|
||||
/**
|
||||
* @brief Delete variable name and value in opened module.
|
||||
* @param dct_handle : dct handler
|
||||
* @param variable_name : variable name which you want to delete in module
|
||||
* @retval 0 : SUCCESS
|
||||
* @retval <0 : ERROR
|
||||
*/
|
||||
int32_t dct_delete_variable(dct_handle_t *dct_handle, char *variable_name);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif/* MBED_TIMER_API_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
63
vendor/sdk/component/common/mbed/hal/ethernet_api.h
vendored
Normal file
63
vendor/sdk/component/common/mbed/hal/ethernet_api.h
vendored
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
/* 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_ETHERNET_API_H
|
||||
#define MBED_ETHERNET_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#if DEVICE_ETHERNET
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Connection constants
|
||||
|
||||
int ethernet_init(void);
|
||||
void ethernet_free(void);
|
||||
|
||||
// write size bytes from data to ethernet buffer
|
||||
// return num bytes written
|
||||
// or -1 if size is too big
|
||||
int ethernet_write(const char *data, int size);
|
||||
|
||||
// send ethernet write buffer, returning the packet size sent
|
||||
int ethernet_send(void);
|
||||
|
||||
// recieve from ethernet buffer, returning packet size, or 0 if no packet
|
||||
int ethernet_receive(void);
|
||||
|
||||
// read size bytes in to data, return actual num bytes read (0..size)
|
||||
// if data == NULL, throw the bytes away
|
||||
int ethernet_read(char *data, int size);
|
||||
|
||||
// get the ethernet address
|
||||
void ethernet_address(char *mac);
|
||||
|
||||
// see if the link is up
|
||||
int ethernet_link(void);
|
||||
|
||||
// force link settings
|
||||
void ethernet_set_link(int speed, int duplex);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
109
vendor/sdk/component/common/mbed/hal/gpio_api.h
vendored
Normal file
109
vendor/sdk/component/common/mbed/hal/gpio_api.h
vendored
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file gpio_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed GPIO API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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
|
||||
|
||||
/** @addtogroup gpio GPIO
|
||||
* @ingroup hal
|
||||
* @brief gpio functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Initializes the GPIO device, include mode/direction/pull control registers.
|
||||
* @param obj: gpio object define in application software.
|
||||
* @param pin: PinName according to pinmux spec.
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_init(gpio_t *obj, PinName pin);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the given pin as GPIO.
|
||||
* @param pin: PinName according to pinmux spec.
|
||||
* @retval : The given pin with GPIO function
|
||||
*/
|
||||
uint32_t gpio_set(PinName pin);
|
||||
|
||||
/**
|
||||
* @brief Set GPIO mode.
|
||||
* @param obj: gpio object define in application software.
|
||||
* @param mode: 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_mode(gpio_t *obj, PinMode mode);
|
||||
|
||||
/**
|
||||
* @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_dir(gpio_t *obj, PinDirection direction);
|
||||
|
||||
/**
|
||||
* @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_write(gpio_t *obj, int value);
|
||||
|
||||
/**
|
||||
* @brief Reads the specified gpio port pin.
|
||||
* @param obj: gpio object define in application software.
|
||||
* @retval 1: pin state is high
|
||||
* @retval 0: pin state is low
|
||||
*/
|
||||
int gpio_read(gpio_t *obj);
|
||||
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif//MBED_GPIO_API_H
|
||||
121
vendor/sdk/component/common/mbed/hal/gpio_irq_api.h
vendored
Normal file
121
vendor/sdk/component/common/mbed/hal/gpio_irq_api.h
vendored
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file gpio_irq_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed GPIO IRQ API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_API_H
|
||||
#define MBED_GPIO_IRQ_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup gpio_irq_api GPIO_IRQ
|
||||
* @ingroup hal
|
||||
* @brief gpio IRQ functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
typedef enum {
|
||||
IRQ_NONE,
|
||||
IRQ_RISE,
|
||||
IRQ_FALL
|
||||
} gpio_irq_event;
|
||||
|
||||
typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
|
||||
|
||||
/**
|
||||
* @brief Initializes the GPIO device interrupt mode, include mode/trigger/polarity registers.
|
||||
* @param obj: gpio irq object define in application software.
|
||||
* @param pin: PinName according to pinmux spec.
|
||||
* @param handler: Interrupt handler to be assigned to the specified pin.
|
||||
* @param id: handler id.
|
||||
* @retval none
|
||||
* @note this API only works for Port A pins
|
||||
*/
|
||||
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the GPIO device interrupt mode, include mode/trigger/polarity registers.
|
||||
* @param obj: gpio irq object define in application software.
|
||||
* @retval none
|
||||
* @note this API only works for Port A pins
|
||||
*/
|
||||
void gpio_irq_free(gpio_irq_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Enable/Disable gpio interrupt.
|
||||
* @param obj: gpio irq object define in application software.
|
||||
* @param event: gpio interrupt event, this parameter can be one of the following values:
|
||||
* @arg IRQ_RISE: rising edge interrupt event
|
||||
* @arg IRQ_FALL: falling edge interrupt event
|
||||
* @arg IRQ_LOW: low level interrupt event
|
||||
* @arg IRQ_HIGH: high level interrupt event
|
||||
* @arg IRQ_NONE: no interrupt event
|
||||
* @param enable: this parameter can be one of the following values:
|
||||
* @arg 0 disable gpio interrupt
|
||||
* @arg 1 enable gpio interrupt
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
|
||||
|
||||
/**
|
||||
* @brief Enable gpio interrupt.
|
||||
* @param obj: gpio irq object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_irq_enable(gpio_irq_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Disable gpio interrupt.
|
||||
* @param obj: gpio irq object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_irq_disable(gpio_irq_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Enable the specified gpio interrupt event.
|
||||
* @param obj: gpio irq object define in application software.
|
||||
* @param event: gpio interrupt event, this parameter can be one of the following values:
|
||||
* @arg IRQ_RISE: rising edge interrupt event
|
||||
* @arg IRQ_FALL: falling edge interrupt event
|
||||
* @arg IRQ_LOW: low level interrupt event
|
||||
* @arg IRQ_HIGH: high level interrupt event
|
||||
* @arg IRQ_NONE: no interrupt event
|
||||
* @retval none
|
||||
*/
|
||||
void gpio_irq_set_event(gpio_irq_t *obj, gpio_irq_event event);
|
||||
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
212
vendor/sdk/component/common/mbed/hal/i2c_api.h
vendored
Normal file
212
vendor/sdk/component/common/mbed/hal/i2c_api.h
vendored
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file i2c_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed I2C API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_I2C_API_H
|
||||
#define MBED_I2C_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup i2c I2C
|
||||
* @ingroup hal
|
||||
* @brief I2C functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
typedef struct i2c_s i2c_t;
|
||||
|
||||
enum {
|
||||
I2C_ERROR_NO_SLAVE = -1,
|
||||
I2C_ERROR_BUS_BUSY = -2
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Initializes the I2C device, include clock/function/I2C registers.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param sda: SDA PinName according to pinmux spec.
|
||||
* @param scl: SCL PinName according to pinmux spec.
|
||||
* @retval none
|
||||
*/
|
||||
void i2c_init(i2c_t *obj, PinName sda, PinName scl);
|
||||
|
||||
/**
|
||||
* @brief Set i2c frequency.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param hz: i2c clock(unit is Hz).
|
||||
* @retval none
|
||||
*/
|
||||
void i2c_frequency(i2c_t *obj, int hz);
|
||||
|
||||
/**
|
||||
* @brief Start i2c device.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @retval 0
|
||||
*/
|
||||
int i2c_start(i2c_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Stop i2c device.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @retval 0
|
||||
*/
|
||||
int i2c_stop(i2c_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the I2C device
|
||||
* @param obj: i2c object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void i2c_reset(i2c_t *obj);
|
||||
|
||||
/**
|
||||
* @brief I2C master receive single byte.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param last: hold the received data.
|
||||
* @retval : the received data.
|
||||
*/
|
||||
int i2c_byte_read(i2c_t *obj, int last);
|
||||
|
||||
/**
|
||||
* @brief I2C master send single byte.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param data: the data to be sent.
|
||||
* @retval : result.
|
||||
*/
|
||||
int i2c_byte_write(i2c_t *obj, int data);
|
||||
|
||||
/**
|
||||
* @brief Set i2c device to be slave.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param enable_slave: enable slave function, this parameter can be one of the following values:
|
||||
* @arg 0 disable
|
||||
* @arg 1 enable
|
||||
* @retval none
|
||||
*/
|
||||
void i2c_slave_mode(i2c_t *obj, int enable_slave);
|
||||
|
||||
/**
|
||||
* @brief Get i2c slave state.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @retval : the state of i2c slave.
|
||||
*/
|
||||
int i2c_slave_receive(i2c_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Set i2c slave address.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param idx: i2c index, this parameter can be one of the following values:
|
||||
* @arg 0 I2C0 Device
|
||||
* @arg 1 I2C1 Device
|
||||
* @param address: slave address.
|
||||
* @param mask: the mask of address
|
||||
* @retval none
|
||||
*/
|
||||
void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask);
|
||||
/**
|
||||
* @brief I2C master read in poll mode.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param address: slave address which will be transmitted.
|
||||
* @param data: point to the buffer to hold the received data.
|
||||
* @param length: the length of data that to be received.
|
||||
* @param stop: specifies whether a STOP is issued after all the bytes are received.
|
||||
* @retval : the length of data received.
|
||||
*/
|
||||
int i2c_read(i2c_t *obj, int address, char *data, int length, int stop);
|
||||
|
||||
/**
|
||||
* @brief I2C master write in poll mode.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param address: slave address which will be transmitted.
|
||||
* @param data: point to the data to be sent.
|
||||
* @param length: the length of data that to be sent.
|
||||
* @param stop: specifies whether a STOP is issued after all the bytes are sent.
|
||||
* @retval : the length of data send.
|
||||
*/
|
||||
int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop);
|
||||
|
||||
/**
|
||||
* @brief I2C slave read in poll mode.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param data: point to the buffer to hold the received data.
|
||||
* @param length: the length of data that to be received.
|
||||
* @retval : the length of data received.
|
||||
*/
|
||||
int i2c_slave_read(i2c_t *obj, char *data, int length);
|
||||
|
||||
/**
|
||||
* @brief I2C slave write in poll mode.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param data: point to the data to be sent.
|
||||
* @param length: the length of data that to be sent.
|
||||
* @retval 0: FAIL
|
||||
* @retval 1: SUCCESS
|
||||
*/
|
||||
int i2c_slave_write(i2c_t *obj, const char *data, int length);
|
||||
|
||||
/**
|
||||
* @brief Set/clear i2c slave RD_REQ interrupt mask.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param set: set or clear for read request.
|
||||
* @retval 1: SUCCESS
|
||||
*/
|
||||
int i2c_slave_set_for_rd_req(i2c_t *obj, int set);
|
||||
|
||||
/**
|
||||
* @brief Set/clear i2c slave NAK or ACK data part in transfer.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param set_nak: set or clear for data NAK.
|
||||
* @retval 1: SUCCESS
|
||||
*/
|
||||
int i2c_slave_set_for_data_nak(i2c_t *obj, int set_nak);
|
||||
///@}
|
||||
|
||||
#if CONFIG_PLATFORM_8711B
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
/**
|
||||
* @brief I2C master send data and read data in poll mode.
|
||||
* @param obj: i2c object define in application software.
|
||||
* @param address: slave address which will be transmitted.
|
||||
* @param pWriteBuf: point to the data to be sent.
|
||||
* @param Writelen: the length of data that to be sent.
|
||||
* @param pReadBuf: point to the buffer to hold the received data.
|
||||
* @param Readlen: the length of data that to be received.
|
||||
* @retval the length of data received.
|
||||
*/
|
||||
int i2c_repeatread(i2c_t *obj, int address, u8 *pWriteBuf, int Writelen, u8 *pReadBuf, int Readlen) ;
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif/* MBED_I2C_API_H */
|
||||
43
vendor/sdk/component/common/mbed/hal/pinmap.h
vendored
Normal file
43
vendor/sdk/component/common/mbed/hal/pinmap.h
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/* 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_PINMAP_H
|
||||
#define MBED_PINMAP_H
|
||||
|
||||
#include "PinNames.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PinName pin;
|
||||
int peripheral;
|
||||
int function;
|
||||
} PinMap;
|
||||
|
||||
void pin_function(PinName pin, int function);
|
||||
void pin_mode (PinName pin, PinMode mode);
|
||||
|
||||
uint32_t pinmap_peripheral(PinName pin, const PinMap* map);
|
||||
uint32_t pinmap_merge (uint32_t a, uint32_t b);
|
||||
void pinmap_pinout (PinName pin, const PinMap *map);
|
||||
uint32_t pinmap_find_peripheral(PinName pin, const PinMap* map);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
116
vendor/sdk/component/common/mbed/hal/port_api.h
vendored
Normal file
116
vendor/sdk/component/common/mbed/hal/port_api.h
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file port_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed GPIO PORT API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_PORTMAP_H
|
||||
#define MBED_PORTMAP_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup port PORT
|
||||
* @ingroup hal
|
||||
* @brief port functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
typedef struct port_s port_t;
|
||||
|
||||
/**
|
||||
* @brief Initializes the GPIO device port, include data direction registers.
|
||||
* @param obj: gpio port object define in application software.
|
||||
* @param port: PortName according to pinmux spec, this parameter can be one of the following values:
|
||||
* @arg PortA: port A, has 32 pins
|
||||
* @arg PortB: port B, has 7 pins
|
||||
* @param mask: One bit one gpio pin, select one or multiple pins of the specified port.
|
||||
* @param dir: gpio port direction, this parameter can be one of the following values:
|
||||
* @arg PIN_INPUT: port pins are input
|
||||
* @arg PIN_OUTPUT: port pins are output
|
||||
* @retval none
|
||||
*/
|
||||
void port_init(port_t *obj, PortName port, int mask, PinDirection dir);
|
||||
|
||||
/**
|
||||
* @brief Get GPIO port pin name
|
||||
* @param port: PortName according to pinmux spec, this parameter can be one of the following values:
|
||||
* @arg PortA: port number is A, has 32 pins
|
||||
* @arg PortB: port number is B, has 7 pins
|
||||
* @param pin_n: pin number.
|
||||
* @retval none
|
||||
* @note pin_n must be set to a value in the 0~31 range when PortA
|
||||
* @note pin_n must be set to a value in the 0~6 range when PortB
|
||||
*/
|
||||
PinName port_pin(PortName port, int pin_n);
|
||||
|
||||
/**
|
||||
* @brief Configure GPIO port pins pull up/pull down.
|
||||
* @param obj: gpio port object define in application software.
|
||||
* @param mode: this parameter can be one of the following values:
|
||||
* @arg PullNone: HighZ
|
||||
* @arg OpenDrain(is OpenDrain output): no pull + OUT + GPIO[gpio_bit] = 0
|
||||
* @arg PullDown: pull down
|
||||
* @arg PullUp: pull up
|
||||
* @retval none
|
||||
*/
|
||||
void port_mode(port_t *obj, PinMode mode);
|
||||
|
||||
/**
|
||||
* @brief Set GPIO port pins data direction.
|
||||
* @param obj: gpio port object define in application software.
|
||||
* @param dir: this parameter can be one of the following values:
|
||||
* @arg PIN_INPUT: port pins are input
|
||||
* @arg PIN_OUTPUT: port pins are output
|
||||
* @retval none
|
||||
*/
|
||||
void port_dir(port_t *obj, PinDirection dir);
|
||||
|
||||
/**
|
||||
* @brief Sets value to the selected port pins.
|
||||
* @param obj: gpio port object define in application software.
|
||||
* @param value: One bit one gpio pin, set value to one or multiple pins of the specified port.
|
||||
* @retval none
|
||||
* @note corresponding bit is 1, pin state set to high; corresponding bit is 0, pin state set to low
|
||||
*/
|
||||
void port_write(port_t *obj, int value);
|
||||
|
||||
/**
|
||||
* @brief Reads the specified gpio port pins.
|
||||
* @param obj: gpio port object define in application software.
|
||||
* @retval : state of the specified gpio port pins
|
||||
* @note corresponding bit is 1, pin state is high; corresponding bit is 0, pin state is low
|
||||
*/
|
||||
int port_read(port_t *obj);
|
||||
|
||||
///@}
|
||||
/*\@}*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
135
vendor/sdk/component/common/mbed/hal/pwmout_api.h
vendored
Normal file
135
vendor/sdk/component/common/mbed/hal/pwmout_api.h
vendored
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file pwmout_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides mbed pwm API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_PWMOUT_API_H
|
||||
#define MBED_PWMOUT_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup pwm PWM
|
||||
* @ingroup hal
|
||||
* @brief pwm functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
typedef struct pwmout_s pwmout_t;
|
||||
/**
|
||||
* @brief Initializes the PWM function/registers of the specified pin with default parameters.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @param pin: the pinname of specified channel to be set.
|
||||
* @retval none
|
||||
* @note
|
||||
* - default period: 1638us
|
||||
* - default pulse width: 102us
|
||||
* - default duty cycle: 6.227%
|
||||
*/
|
||||
void pwmout_init(pwmout_t* obj, PinName pin);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the PWM device of the specified channel.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @retval none
|
||||
* @note If all channels are released, TIM5 will also be disabled.
|
||||
*/
|
||||
void pwmout_free(pwmout_t* obj);
|
||||
|
||||
/**
|
||||
* @brief Set the duty cycle of the specified channel.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @param percent: The duty cycle value to be set.
|
||||
* @retval none
|
||||
*/
|
||||
void pwmout_write(pwmout_t* obj, float percent);
|
||||
|
||||
/**
|
||||
* @brief Get the duty cycle value of the specified channel.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @retval : the duty cycle value of the specified channel.
|
||||
*/
|
||||
float pwmout_read(pwmout_t* obj);
|
||||
|
||||
/**
|
||||
* @brief Set the period of the specified channel in seconds.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @param seconds: The period value to be set in seconds.
|
||||
* @retval none
|
||||
*/
|
||||
void pwmout_period(pwmout_t* obj, float seconds);
|
||||
|
||||
/**
|
||||
* @brief Set the period of the specified channel in millseconds.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @param ms: The period value to be set in millseconds.
|
||||
* @retval none
|
||||
*/
|
||||
void pwmout_period_ms(pwmout_t* obj, int ms);
|
||||
|
||||
/**
|
||||
* @brief Set the period of the specified channel in microseconds.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @param us: The period value to be set in microseconds.
|
||||
* @retval none
|
||||
*/
|
||||
void pwmout_period_us(pwmout_t* obj, int us);
|
||||
|
||||
/**
|
||||
* @brief Set the pulse width of the specified channel in seconds.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @param seconds: The pulse width value to be set in seconds.
|
||||
* @retval none
|
||||
*/
|
||||
void pwmout_pulsewidth(pwmout_t* obj, float seconds);
|
||||
|
||||
/**
|
||||
* @brief Set the pulse width of the specified channel in milliseconds.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @param ms: The pulse width value to be set in milliseconds.
|
||||
* @retval none
|
||||
*/
|
||||
void pwmout_pulsewidth_ms(pwmout_t* obj, int ms);
|
||||
|
||||
/**
|
||||
* @brief Set the pulse width of the specified channel in microseconds.
|
||||
* @param obj: PWM object define in application software.
|
||||
* @param us: The pulse width value to be set in microseconds.
|
||||
* @retval none
|
||||
*/
|
||||
void pwmout_pulsewidth_us(pwmout_t* obj, int us);
|
||||
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
126
vendor/sdk/component/common/mbed/hal/rtc_api.h
vendored
Normal file
126
vendor/sdk/component/common/mbed/hal/rtc_api.h
vendored
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file rtc_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides mbed RTC API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_RTC_API_H
|
||||
#define MBED_RTC_API_H
|
||||
|
||||
#include "device.h"
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup rtc RTC
|
||||
* @ingroup hal
|
||||
* @brief rtc functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if CONFIG_PLATFORM_8711B
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
typedef void (*alarm_irq_handler)(void);
|
||||
|
||||
struct alarm_s {
|
||||
uint32_t yday;//which day of the year
|
||||
uint32_t hour;
|
||||
uint32_t min;
|
||||
uint32_t sec;
|
||||
};
|
||||
|
||||
typedef struct alarm_s alarm_t;
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
/**
|
||||
* @brief Initializes the RTC device, include clock, RTC registers and function.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
void rtc_init(void);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the RTC device.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
void rtc_free(void);
|
||||
|
||||
/**
|
||||
* @brief This function tells whether RTC is enabled or not.
|
||||
* @param none
|
||||
* @retval 1: RTC is enable.
|
||||
* @retval 0: RTC is disable.
|
||||
*/
|
||||
int rtc_isenabled(void);
|
||||
|
||||
/**
|
||||
* @brief Get current timestamp in seconds from RTC.
|
||||
* @param none
|
||||
* @retval : The current timestamp in seconds which is calculated from 1970.1.1 00:00:00.
|
||||
*/
|
||||
time_t rtc_read(void);
|
||||
|
||||
/**
|
||||
* @brief Set the specified timestamp in seconds to RTC.
|
||||
* @param t: Seconds from 1970.1.1 00:00:00 to specified data and time which is to be set.
|
||||
* @retval none
|
||||
*/
|
||||
void rtc_write(time_t t);
|
||||
|
||||
///@}
|
||||
|
||||
#if CONFIG_PLATFORM_8711B
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
/**
|
||||
* @brief Set the specified RTC Alarm and interrupt.
|
||||
* @param alarm: alarm object define in application software.
|
||||
* @param alarmHandler: alarm interrupt callback function.
|
||||
* @retval status:
|
||||
* - 1: success
|
||||
* - Others: failure
|
||||
*/
|
||||
u32 rtc_set_alarm(alarm_t *alrm, alarm_irq_handler alarmHandler);
|
||||
|
||||
/**
|
||||
* @brief Disable RTC Alarm and function.
|
||||
* @param none
|
||||
* @retval none
|
||||
*/
|
||||
void rtc_disable_alarm(void);
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
224
vendor/sdk/component/common/mbed/hal/serial_api.h
vendored
Normal file
224
vendor/sdk/component/common/mbed/hal/serial_api.h
vendored
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file serial_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides mbed API for UART.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_API_H
|
||||
#define MBED_SERIAL_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup uart UART
|
||||
* @ingroup hal
|
||||
* @brief uart functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
|
||||
/**
|
||||
* @brief UART Parity mode
|
||||
* used by serial_format
|
||||
*/
|
||||
typedef enum {
|
||||
ParityNone = 0, /*!<parity disable */
|
||||
ParityOdd = 1, /*!<odd parity enable */
|
||||
ParityEven = 2, /*!<even paroty enable */
|
||||
ParityForced1 = 3, /*!<same action with ParityOdd */
|
||||
ParityForced0 = 4 /*!<same action with ParityEven */
|
||||
} SerialParity;
|
||||
|
||||
/**
|
||||
* @brief UART Interrupt enable/disable
|
||||
* used by serial_irq_set
|
||||
*/
|
||||
typedef enum {
|
||||
RxIrq, /*!<RX IRQ enable/disable */
|
||||
TxIrq /*!<TX IRQ enable/disable */
|
||||
} SerialIrq;
|
||||
|
||||
/**
|
||||
* @brief UART FlowControl mode
|
||||
* used by serial_set_flow_control
|
||||
*/
|
||||
typedef enum {
|
||||
FlowControlNone, /*!<none RTS/CTS */
|
||||
FlowControlRTS, /*!<RTS enable */
|
||||
FlowControlCTS, /*!<CTS enable */
|
||||
FlowControlRTSCTS /*!<RTS/CTS enable */
|
||||
} FlowControl;
|
||||
|
||||
typedef void (*uart_irq_handler)(uint32_t id, SerialIrq event);
|
||||
|
||||
typedef struct serial_s serial_t;
|
||||
|
||||
/**
|
||||
* @brief Initializes the UART device, include clock/function/interrupt/UART registers.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param tx: Tx PinName according to pinmux spec.
|
||||
* @param rx: Rx PinName according to pinmux spec.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_init(serial_t *obj, PinName tx, PinName rx);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the UART device, include clock/function/interrupt/UART registers.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_free(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Set UART device baudrate.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param baudrate: Baud Rate Val, like 115200 (unit is HZ).
|
||||
* @retval none
|
||||
*/
|
||||
void serial_baud(serial_t *obj, int baudrate);
|
||||
|
||||
/**
|
||||
* @brief Set UART format.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param data_bits: data bits, this parameter can be one of the following values:
|
||||
* @arg 7
|
||||
* @arg 8
|
||||
* @param parity: this parameter can be one of the following values:
|
||||
* @arg ParityNone
|
||||
* @arg ParityOdd
|
||||
* @arg ParityEven
|
||||
* @arg ParityForced1: same action with ParityOdd
|
||||
* @arg ParityForced0: same action with ParityEven
|
||||
* @param stop_bits: this parameter can be one of the following values:
|
||||
* @arg 2
|
||||
* @arg 1
|
||||
* @retval none
|
||||
*/
|
||||
void serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits);
|
||||
|
||||
/**
|
||||
* @brief Set UART interrupt hander if needed.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param handler: interrupt callback function
|
||||
* @param id: interrupt callback parameter
|
||||
* @retval none
|
||||
*/
|
||||
void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id);
|
||||
|
||||
/**
|
||||
* @brief Enable/Disable UART interrupt.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param irq: Tx or Rx interrupt, this parameter can be one of the following values:
|
||||
* @arg RxIrq
|
||||
* @arg TxIrq
|
||||
* @param enable: this parameter can be one of the following values:
|
||||
* @arg 0 disable
|
||||
* @arg 1 enable
|
||||
* @retval none
|
||||
*/
|
||||
void serial_irq_set(serial_t *obj, SerialIrq irq, uint32_t enable);
|
||||
|
||||
/**
|
||||
* @brief get one byte from UART.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval : received character
|
||||
* @note this function is asynchronous API.
|
||||
*/
|
||||
int serial_getc(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief send one byte use UART.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param c: the data to transmit.
|
||||
* @retval none
|
||||
* @note this function is asynchronous API.
|
||||
*/
|
||||
void serial_putc(serial_t *obj, int c);
|
||||
|
||||
/**
|
||||
* @brief check if there is data in rx fifo.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval 1: TRUE
|
||||
* @retval 0: FALSE
|
||||
*/
|
||||
int serial_readable(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief check if write data to tx fifo is permitted.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval 1: TRUE
|
||||
* @retval 0: FALSE
|
||||
*/
|
||||
int serial_writable(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Clear Rx fifo.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_clear(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief enable UART break contol function.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_break_set(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief disable UART break contol function.
|
||||
* @param obj: uart object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_break_clear(serial_t *obj);
|
||||
|
||||
/**
|
||||
* @brief set tx pinmux.
|
||||
* @param tx: Tx PinName according to pinmux spec.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_pinout_tx(PinName tx);
|
||||
|
||||
/**
|
||||
* @brief uart autoflow contol setting.
|
||||
* @param obj: uart object define in application software.
|
||||
* @param type: autoflow control type.
|
||||
* @param rxflow: RTS pin.
|
||||
* @param txflow: CTS pin.
|
||||
* @retval none
|
||||
*/
|
||||
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow);
|
||||
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
85
vendor/sdk/component/common/mbed/hal/sleep_api.h
vendored
Normal file
85
vendor/sdk/component/common/mbed/hal/sleep_api.h
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file sleep_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed SLEEP API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_API_H
|
||||
#define MBED_SLEEP_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** @addtogroup sleep SLEEP
|
||||
* @ingroup hal
|
||||
* @brief sleep functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
/** 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.
|
||||
*
|
||||
* @retval None
|
||||
* @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(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 watchdog timer.
|
||||
*
|
||||
* @retval None
|
||||
* @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(void);
|
||||
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
165
vendor/sdk/component/common/mbed/hal/spi_api.h
vendored
Normal file
165
vendor/sdk/component/common/mbed/hal/spi_api.h
vendored
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file spi_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed SPI API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_API_H
|
||||
#define MBED_SPI_API_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup spi SPI
|
||||
* @ingroup hal
|
||||
* @brief spi functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
#if CONFIG_PLATFORM_8711B
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
typedef enum {
|
||||
MBED_SPI0 = 0xF0, /*!< means SPI0 */
|
||||
MBED_SPI1 = 0xF1, /*!< means SPI1 */
|
||||
} MBED_SPI_IDX;
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
|
||||
typedef struct spi_s spi_t;
|
||||
|
||||
/**
|
||||
* @brief Initializes the SPI device, include clock/function/interrupt/SPI registers.
|
||||
* @param obj: spi object define in application software.
|
||||
* @param mosi: MOSI PinName according to pinmux spec.
|
||||
* @param miso: MISO PinName according to pinmux spec.
|
||||
* @param sclk: SCLK PinName according to pinmux spec.
|
||||
* @param ssel: CS PinName according to pinmux spec.
|
||||
* @retval none
|
||||
* @note must set obj->spi_index to MBED_SPI0 or MBED_SPI1 before using spi_init
|
||||
*/
|
||||
void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the SPI device, include interrupt/DMA/DISABLE SPI.
|
||||
* @param obj: spi object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void spi_free(spi_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Set SPI format,include DFS/Phase/Polarity.
|
||||
* @param obj: spi object define in application software.
|
||||
* @param bits: data frame size, 4-16 supported.
|
||||
* @param mode: this parameter can be one of the following values:
|
||||
* @arg 0 : [Polarity,Phase]=[0,0]
|
||||
* @arg 1 : [Polarity,Phase]=[0,1]
|
||||
* @arg 2 : [Polarity,Phase]=[1,0]
|
||||
* @arg 3 : [Polarity,Phase]=[1,1]
|
||||
* @param slave: this parameter can be one of the following values:
|
||||
* @arg 0 : indicates role-master
|
||||
* @arg 1 : indicates role-slave
|
||||
* @retval none
|
||||
*/
|
||||
void spi_format(spi_t *obj, int bits, int mode, int slave);
|
||||
|
||||
/**
|
||||
* @brief Set SPI baudrate.
|
||||
* @param obj: spi master object define in application software.
|
||||
* @param hz: baudrate for SPI bus
|
||||
* @retval none
|
||||
* @note "hz" should be less or equal to half of the SPI IpClk
|
||||
*/
|
||||
void spi_frequency(spi_t *obj, int hz);
|
||||
|
||||
/**
|
||||
* @brief Master send one frame use SPI.
|
||||
* @param obj: spi master object define in application software.
|
||||
* @param value: the data to transmit.
|
||||
* @retval : data received from slave
|
||||
*/
|
||||
int spi_master_write(spi_t *obj, int value);
|
||||
|
||||
/**
|
||||
* @brief Get slave readable && busy state.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @retval : slave Readable && Busy State
|
||||
*/
|
||||
int spi_slave_receive(spi_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Slave receive one frame use SPI.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @retval : data received from master
|
||||
*/
|
||||
int spi_slave_read(spi_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Slave send one frame use SPI.
|
||||
* @param obj: spi slave object define in application software.
|
||||
* @param value: the data to transmit.
|
||||
* @retval none
|
||||
*/
|
||||
void spi_slave_write(spi_t *obj, int value);
|
||||
|
||||
/**
|
||||
* @brief Get SPI busy state.
|
||||
* @param obj: spi object define in application software.
|
||||
* @retval : current busy state
|
||||
*/
|
||||
int spi_busy(spi_t *obj);
|
||||
|
||||
/**
|
||||
* @brief SPI device to flush rx fifo.
|
||||
* @param obj: spi object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void spi_flush_rx_fifo(spi_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Open SPI device clock.
|
||||
* @param obj: spi object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void spi_enable(spi_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Close SPI device clock.
|
||||
* @param obj: spi object define in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void spi_disable(spi_t *obj);
|
||||
///@}
|
||||
|
||||
/*\@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
157
vendor/sdk/component/common/mbed/hal/timer_api.h
vendored
Normal file
157
vendor/sdk/component/common/mbed/hal/timer_api.h
vendored
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
/** mbed Microcontroller Library
|
||||
******************************************************************************
|
||||
* @file timer_api.h
|
||||
* @author
|
||||
* @version V1.0.0
|
||||
* @brief This file provides following mbed I2C API
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* 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_EXT_TIMER_API_EXT_H
|
||||
#define MBED_EXT_TIMER_API_EXT_H
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/** @addtogroup timer TIMER
|
||||
* @ingroup hal
|
||||
* @brief timer functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
///@name Ameba Common
|
||||
///@{
|
||||
typedef struct gtimer_s gtimer_t;
|
||||
typedef void (*gtimer_irq_handler)(uint32_t id);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Initializes the timer, including clock/function/timer registers.
|
||||
* @param obj: gtimer object defined in application software.
|
||||
* @param tid: the timer struct ID defined in gtimer structure.
|
||||
* @retval none
|
||||
*/
|
||||
void gtimer_init (gtimer_t *obj, uint32_t tid);
|
||||
|
||||
/**
|
||||
* @brief Deinitializes the timer, including clock/function/timer registers.
|
||||
* @param obj: gtimer object defined in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void gtimer_deinit (gtimer_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Read current timer tick in Gtimer clock(0~32768).
|
||||
* @param obj: gtimer object defined in application software.
|
||||
* @retval 32 bit tick time
|
||||
*/
|
||||
uint32_t gtimer_read_tick (gtimer_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Read current timer tick in microsecond.
|
||||
* @param obj: gtimer object defined in application software.
|
||||
* @retval 64 bit tick time
|
||||
*/
|
||||
uint64_t gtimer_read_us (gtimer_t *obj);
|
||||
|
||||
/**
|
||||
* @brief Reload timer
|
||||
* @param obj: gtimer object defined in application software.
|
||||
* @param duration_us: the time in microsecond of gtimer to reload.
|
||||
* @retval none
|
||||
*/
|
||||
void gtimer_reload (gtimer_t *obj, uint32_t duration_us);
|
||||
/**
|
||||
* @brief Start the timer
|
||||
* @param obj: gtimer object defined in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void gtimer_start (gtimer_t *obj);
|
||||
/**
|
||||
* @brief Set up a shout timer, including clock/function/timer registers.
|
||||
* @param obj: gtimer object defined in application software.
|
||||
* @param duration_us: the period in microsecond of gtimer.
|
||||
* @param handler: The Pointer to the function that program runs into when timer is up.
|
||||
* @param hid: the timer struct ID defined in gtimer structure.
|
||||
* @retval none
|
||||
*/
|
||||
void gtimer_start_one_shout (gtimer_t *obj, uint32_t duration_us, void* handler, uint32_t hid);
|
||||
/**
|
||||
* @brief Set up a periodic timer, including clock/function/timer registers.
|
||||
* @param obj: gtimer object defined in application software.
|
||||
* @param duration_us: the period in microsecond of gtimer.
|
||||
* @param handler: The Pointer to function that program runs into when timer is up.
|
||||
* @param hid: the timer struct ID defined in gtimer structure.
|
||||
* @retval none
|
||||
*/
|
||||
void gtimer_start_periodical (gtimer_t *obj, uint32_t duration_us, void* handler, uint32_t hid);
|
||||
|
||||
/**
|
||||
* @brief Stop the timer, including clock/function/timer registers.
|
||||
* @param obj: gtimer object defined in application software.
|
||||
* @retval none
|
||||
*/
|
||||
void gtimer_stop (gtimer_t *obj);
|
||||
|
||||
|
||||
#if CONFIG_PLATFORM_8195A
|
||||
///@name Ameba Only
|
||||
///@{
|
||||
|
||||
|
||||
enum {
|
||||
TIMER0 = 2,
|
||||
TIMER1 = 3,
|
||||
TIMER2 = 4,
|
||||
TIMER3 = 5,
|
||||
TIMER4 = 0,
|
||||
|
||||
GTIMER_MAX = 5
|
||||
};
|
||||
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8195A
|
||||
|
||||
|
||||
|
||||
#if CONFIG_PLATFORM_8711B
|
||||
///@name AmebaZ Only
|
||||
///@{
|
||||
|
||||
enum {
|
||||
TIMER0 = 0,
|
||||
TIMER1 = 1,
|
||||
TIMER2 = 2,
|
||||
TIMER3 = 3,
|
||||
|
||||
GTIMER_MAX = 4
|
||||
};
|
||||
|
||||
///@}
|
||||
#endif //CONFIG_PLATFORM_8711B
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif/* MBED_TIMER_API_H */
|
||||
51
vendor/sdk/component/common/mbed/hal/us_ticker_api.h
vendored
Normal file
51
vendor/sdk/component/common/mbed/hal/us_ticker_api.h
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* 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_US_TICKER_API_H
|
||||
#define MBED_US_TICKER_API_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef uint64_t timestamp_t;
|
||||
|
||||
uint32_t us_ticker_read(void);
|
||||
|
||||
typedef void (*ticker_event_handler)(uint32_t id);
|
||||
void us_ticker_set_handler(ticker_event_handler handler);
|
||||
|
||||
typedef struct ticker_event_s {
|
||||
timestamp_t timestamp;
|
||||
uint32_t id;
|
||||
struct ticker_event_s *next;
|
||||
} ticker_event_t;
|
||||
|
||||
void us_ticker_init(void);
|
||||
void us_ticker_set_interrupt(timestamp_t timestamp);
|
||||
void us_ticker_disable_interrupt(void);
|
||||
void us_ticker_clear_interrupt(void);
|
||||
void us_ticker_irq_handler(void);
|
||||
|
||||
void us_ticker_insert_event(ticker_event_t *obj, timestamp_t timestamp, uint32_t id);
|
||||
void us_ticker_remove_event(ticker_event_t *obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue