mirror of
https://github.com/eggman/ameba-gcc-sample-rtos.git
synced 2024-11-21 11:24:15 +00:00
add mbed api hgeder files
This commit is contained in:
parent
724cc50ce8
commit
e33b01a6e7
20 changed files with 1281 additions and 3 deletions
10
Makefile
10
Makefile
|
@ -13,18 +13,22 @@ SIZE = $(CROSS_COMPILE)size
|
||||||
|
|
||||||
vpath %.c ./src
|
vpath %.c ./src
|
||||||
|
|
||||||
INCLUDES = -Isdk/component/soc/realtek/8195a/fwlib/rtl8195a
|
INCLUDES = -Isdk/component/soc/realtek/8195a/cmsis/device
|
||||||
|
INCLUDES += -Isdk/component/soc/realtek/8195a/fwlib/rtl8195a
|
||||||
INCLUDES += -Isdk/component/soc/realtek/8195a/fwlib
|
INCLUDES += -Isdk/component/soc/realtek/8195a/fwlib
|
||||||
INCLUDES += -Isdk/component/soc/realtek/common/bsp
|
INCLUDES += -Isdk/component/soc/realtek/common/bsp
|
||||||
INCLUDES += -Isdk/component/soc/realtek/8195a/cmsis
|
INCLUDES += -Isdk/component/soc/realtek/8195a/cmsis
|
||||||
INCLUDES += -Isdk/component/soc/realtek/8195a/cmsis/device/
|
INCLUDES += -Isdk/component/soc/realtek/8195a/cmsis/device
|
||||||
INCLUDES += -Isdk/component/os/freertos
|
INCLUDES += -Isdk/component/os/freertos
|
||||||
INCLUDES += -Isdk/component/os/freertos/freertos_v8.1.2/Source/include
|
INCLUDES += -Isdk/component/os/freertos/freertos_v8.1.2/Source/include
|
||||||
INCLUDES += -Isdk/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3
|
INCLUDES += -Isdk/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3
|
||||||
INCLUDES += -Isdk/component/common/drivers/wlan/realtek/include
|
|
||||||
INCLUDES += -Isdk/component/common/api/wifi
|
INCLUDES += -Isdk/component/common/api/wifi
|
||||||
|
INCLUDES += -Isdk/component/common/drivers/wlan/realtek/include
|
||||||
INCLUDES += -Isdk/component/common/drivers/wlan/realtek/src/osdep
|
INCLUDES += -Isdk/component/common/drivers/wlan/realtek/src/osdep
|
||||||
INCLUDES += -Isdk/component/common/drivers/sdio/realtek/sdio_host/inc
|
INCLUDES += -Isdk/component/common/drivers/sdio/realtek/sdio_host/inc
|
||||||
|
INCLUDES += -Isdk/component/common/mbed/hal
|
||||||
|
INCLUDES += -Isdk/component/common/mbed/hal_ext
|
||||||
|
INCLUDES += -Isdk/component/common/mbed/targets/hal/rtl8195a
|
||||||
INCLUDES += -Isdk/project/realtek_ameba1_va0_example/inc
|
INCLUDES += -Isdk/project/realtek_ameba1_va0_example/inc
|
||||||
|
|
||||||
OUTPUT_PATH=build
|
OUTPUT_PATH=build
|
||||||
|
|
51
sdk/component/common/mbed/hal/gpio_api.h
Normal file
51
sdk/component/common/mbed/hal/gpio_api.h
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_GPIO_API_H
|
||||||
|
#define MBED_GPIO_API_H
|
||||||
|
|
||||||
|
#include "device.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Set the given pin as GPIO
|
||||||
|
* @param pin The pin to be set as GPIO
|
||||||
|
* @return The GPIO port mask for this pin
|
||||||
|
**/
|
||||||
|
uint32_t gpio_set(PinName pin);
|
||||||
|
|
||||||
|
/* GPIO object */
|
||||||
|
void gpio_init(gpio_t *obj, PinName pin);
|
||||||
|
|
||||||
|
void gpio_mode (gpio_t *obj, PinMode mode);
|
||||||
|
void gpio_dir (gpio_t *obj, PinDirection direction);
|
||||||
|
|
||||||
|
void gpio_write(gpio_t *obj, int value);
|
||||||
|
int gpio_read (gpio_t *obj);
|
||||||
|
|
||||||
|
// the following set of functions are generic and are implemented in the common gpio.c file
|
||||||
|
void gpio_init_in(gpio_t* gpio, PinName pin);
|
||||||
|
void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode);
|
||||||
|
void gpio_init_out(gpio_t* gpio, PinName pin);
|
||||||
|
void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value);
|
||||||
|
void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
47
sdk/component/common/mbed/hal/gpio_irq_api.h
Normal file
47
sdk/component/common/mbed/hal/gpio_irq_api.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/* 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_API_H
|
||||||
|
#define MBED_GPIO_IRQ_API_H
|
||||||
|
|
||||||
|
#include "device.h"
|
||||||
|
|
||||||
|
#if DEVICE_INTERRUPTIN
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
IRQ_NONE,
|
||||||
|
IRQ_RISE,
|
||||||
|
IRQ_FALL
|
||||||
|
} gpio_irq_event;
|
||||||
|
|
||||||
|
typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
|
||||||
|
|
||||||
|
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
|
||||||
|
void gpio_irq_free(gpio_irq_t *obj);
|
||||||
|
void gpio_irq_set (gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
|
||||||
|
void gpio_irq_enable(gpio_irq_t *obj);
|
||||||
|
void gpio_irq_disable(gpio_irq_t *obj);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
58
sdk/component/common/mbed/hal/i2c_api.h
Normal file
58
sdk/component/common/mbed/hal/i2c_api.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/* 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_I2C_API_H
|
||||||
|
#define MBED_I2C_API_H
|
||||||
|
|
||||||
|
#include "device.h"
|
||||||
|
|
||||||
|
#if DEVICE_I2C
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct i2c_s i2c_t;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
I2C_ERROR_NO_SLAVE = -1,
|
||||||
|
I2C_ERROR_BUS_BUSY = -2
|
||||||
|
};
|
||||||
|
|
||||||
|
void i2c_init (i2c_t *obj, PinName sda, PinName scl);
|
||||||
|
void i2c_frequency (i2c_t *obj, int hz);
|
||||||
|
int i2c_start (i2c_t *obj);
|
||||||
|
int i2c_stop (i2c_t *obj);
|
||||||
|
int i2c_read (i2c_t *obj, int address, char *data, int length, int stop);
|
||||||
|
int i2c_write (i2c_t *obj, int address, const char *data, int length, int stop);
|
||||||
|
void i2c_reset (i2c_t *obj);
|
||||||
|
int i2c_byte_read (i2c_t *obj, int last);
|
||||||
|
int i2c_byte_write (i2c_t *obj, int data);
|
||||||
|
|
||||||
|
#if DEVICE_I2CSLAVE
|
||||||
|
void i2c_slave_mode (i2c_t *obj, int enable_slave);
|
||||||
|
int i2c_slave_receive(i2c_t *obj);
|
||||||
|
int i2c_slave_read (i2c_t *obj, char *data, int length);
|
||||||
|
int i2c_slave_write (i2c_t *obj, const char *data, int length);
|
||||||
|
void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
49
sdk/component/common/mbed/hal/pwmout_api.h
Normal file
49
sdk/component/common/mbed/hal/pwmout_api.h
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/* 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_PWMOUT_API_H
|
||||||
|
#define MBED_PWMOUT_API_H
|
||||||
|
|
||||||
|
#include "device.h"
|
||||||
|
|
||||||
|
#if DEVICE_PWMOUT
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct pwmout_s pwmout_t;
|
||||||
|
|
||||||
|
void pwmout_init (pwmout_t* obj, PinName pin);
|
||||||
|
void pwmout_free (pwmout_t* obj);
|
||||||
|
|
||||||
|
void pwmout_write (pwmout_t* obj, float percent);
|
||||||
|
float pwmout_read (pwmout_t* obj);
|
||||||
|
|
||||||
|
void pwmout_period (pwmout_t* obj, float seconds);
|
||||||
|
void pwmout_period_ms (pwmout_t* obj, int ms);
|
||||||
|
void pwmout_period_us (pwmout_t* obj, int us);
|
||||||
|
|
||||||
|
void pwmout_pulsewidth (pwmout_t* obj, float seconds);
|
||||||
|
void pwmout_pulsewidth_ms(pwmout_t* obj, int ms);
|
||||||
|
void pwmout_pulsewidth_us(pwmout_t* obj, int us);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
78
sdk/component/common/mbed/hal/serial_api.h
Normal file
78
sdk/component/common/mbed/hal/serial_api.h
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
/* 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_API_H
|
||||||
|
#define MBED_SERIAL_API_H
|
||||||
|
|
||||||
|
#include "device.h"
|
||||||
|
|
||||||
|
#if DEVICE_SERIAL
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ParityNone = 0,
|
||||||
|
ParityOdd = 1,
|
||||||
|
ParityEven = 2,
|
||||||
|
ParityForced1 = 3,
|
||||||
|
ParityForced0 = 4
|
||||||
|
} SerialParity;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
RxIrq,
|
||||||
|
TxIrq
|
||||||
|
} SerialIrq;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FlowControlNone,
|
||||||
|
FlowControlRTS,
|
||||||
|
FlowControlCTS,
|
||||||
|
FlowControlRTSCTS
|
||||||
|
} FlowControl;
|
||||||
|
|
||||||
|
typedef void (*uart_irq_handler)(uint32_t id, SerialIrq event);
|
||||||
|
|
||||||
|
typedef struct serial_s serial_t;
|
||||||
|
|
||||||
|
void serial_init (serial_t *obj, PinName tx, PinName rx);
|
||||||
|
void serial_free (serial_t *obj);
|
||||||
|
void serial_baud (serial_t *obj, int baudrate);
|
||||||
|
void serial_format (serial_t *obj, int data_bits, SerialParity parity, int stop_bits);
|
||||||
|
|
||||||
|
void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id);
|
||||||
|
void serial_irq_set (serial_t *obj, SerialIrq irq, uint32_t enable);
|
||||||
|
|
||||||
|
int serial_getc (serial_t *obj);
|
||||||
|
void serial_putc (serial_t *obj, int c);
|
||||||
|
int serial_readable (serial_t *obj);
|
||||||
|
int serial_writable (serial_t *obj);
|
||||||
|
void serial_clear (serial_t *obj);
|
||||||
|
|
||||||
|
void serial_break_set (serial_t *obj);
|
||||||
|
void serial_break_clear(serial_t *obj);
|
||||||
|
|
||||||
|
void serial_pinout_tx(PinName tx);
|
||||||
|
|
||||||
|
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
45
sdk/component/common/mbed/hal/spi_api.h
Normal file
45
sdk/component/common/mbed/hal/spi_api.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/* 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_API_H
|
||||||
|
#define MBED_SPI_API_H
|
||||||
|
|
||||||
|
#include "device.h"
|
||||||
|
|
||||||
|
#if DEVICE_SPI
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct spi_s spi_t;
|
||||||
|
|
||||||
|
void spi_init (spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel);
|
||||||
|
void spi_free (spi_t *obj);
|
||||||
|
void spi_format (spi_t *obj, int bits, int mode, int slave);
|
||||||
|
void spi_frequency (spi_t *obj, int hz);
|
||||||
|
int spi_master_write (spi_t *obj, int value);
|
||||||
|
int spi_slave_receive(spi_t *obj);
|
||||||
|
int spi_slave_read (spi_t *obj);
|
||||||
|
void spi_slave_write (spi_t *obj, int value);
|
||||||
|
int spi_busy (spi_t *obj);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
33
sdk/component/common/mbed/hal_ext/gpio_ex_api.h
Normal file
33
sdk/component/common/mbed/hal_ext/gpio_ex_api.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/* 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_deinit(gpio_t *obj, PinName pin);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
40
sdk/component/common/mbed/hal_ext/gpio_irq_ex_api.h
Normal file
40
sdk/component/common/mbed/hal_ext/gpio_irq_ex_api.h
Normal file
|
@ -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);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // end of "#if DEVICE_INTERRUPTIN"
|
||||||
|
|
||||||
|
#endif // end of #ifndef MBED_GPIO_IRQ_EX_API_H
|
89
sdk/component/common/mbed/hal_ext/spi_ex_api.h
Normal file
89
sdk/component/common/mbed/hal_ext/spi_ex_api.h
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/* 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);
|
||||||
|
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);
|
||||||
|
#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_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);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
100
sdk/component/common/mbed/targets/hal/rtl8195a/PeripheralNames.h
Normal file
100
sdk/component/common/mbed/targets/hal/rtl8195a/PeripheralNames.h
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
/* 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_PERIPHERALNAMES_H
|
||||||
|
#define MBED_PERIPHERALNAMES_H
|
||||||
|
|
||||||
|
#include "cmsis.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
typedef enum {
|
||||||
|
UART_1 = (int)USART1_BASE,
|
||||||
|
UART_2 = (int)USART2_BASE,
|
||||||
|
UART_3 = (int)USART3_BASE,
|
||||||
|
UART_4 = (int)UART4_BASE,
|
||||||
|
UART_5 = (int)UART5_BASE,
|
||||||
|
UART_6 = (int)USART6_BASE
|
||||||
|
} UARTName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ADC0_0 = 0,
|
||||||
|
ADC0_1,
|
||||||
|
ADC0_2,
|
||||||
|
ADC0_3,
|
||||||
|
ADC0_4,
|
||||||
|
ADC0_5,
|
||||||
|
ADC0_6,
|
||||||
|
ADC0_7,
|
||||||
|
ADC0_8,
|
||||||
|
ADC0_9,
|
||||||
|
ADC0_10,
|
||||||
|
ADC0_11,
|
||||||
|
ADC0_12,
|
||||||
|
ADC0_13,
|
||||||
|
ADC0_14,
|
||||||
|
ADC0_15
|
||||||
|
} ADCName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DAC_0 = 0,
|
||||||
|
DAC_1
|
||||||
|
} DACName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SPI_1 = (int)SPI1_BASE,
|
||||||
|
SPI_2 = (int)SPI2_BASE,
|
||||||
|
SPI_3 = (int)SPI3_BASE,
|
||||||
|
} SPIName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
I2C_1 = (int)I2C1_BASE,
|
||||||
|
I2C_2 = (int)I2C2_BASE,
|
||||||
|
I2C_3 = (int)I2C3_BASE
|
||||||
|
} I2CName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PWM_1 = 1,
|
||||||
|
PWM_2,
|
||||||
|
PWM_3,
|
||||||
|
PWM_4,
|
||||||
|
PWM_5,
|
||||||
|
PWM_6
|
||||||
|
} PWMName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CAN_1 = (int)CAN1_BASE,
|
||||||
|
CAN_2 = (int)CAN2_BASE
|
||||||
|
} CANName;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define STDIO_UART_TX PA_6
|
||||||
|
#define STDIO_UART_RX PA_7
|
||||||
|
#define STDIO_UART UART0
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
DAC_0 = 0,
|
||||||
|
DAC_1
|
||||||
|
} DACName;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
215
sdk/component/common/mbed/targets/hal/rtl8195a/PinNames.h
Normal file
215
sdk/component/common/mbed/targets/hal/rtl8195a/PinNames.h
Normal file
|
@ -0,0 +1,215 @@
|
||||||
|
|
||||||
|
#ifndef _PINNAMES_H_
|
||||||
|
#define _PINNAMES_H_
|
||||||
|
|
||||||
|
#include "cmsis.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PORT_A = 0,
|
||||||
|
PORT_B = 1,
|
||||||
|
PORT_C = 2,
|
||||||
|
PORT_D = 3,
|
||||||
|
PORT_E = 4,
|
||||||
|
PORT_F = 5,
|
||||||
|
PORT_G = 6,
|
||||||
|
PORT_H = 7,
|
||||||
|
PORT_I = 8,
|
||||||
|
PORT_J = 9,
|
||||||
|
PORT_K = 10,
|
||||||
|
|
||||||
|
PORT_V = 11,
|
||||||
|
PORT_U = 12,
|
||||||
|
PORT_MAX
|
||||||
|
} GPIO_PORT;
|
||||||
|
|
||||||
|
#define RTL_PIN_PERI(FUN, IDX, SEL) ((int)(((FUN) << 8) | ((IDX)<<4) | (SEL)))
|
||||||
|
#define RTL_PIN_FUNC(FUN, SEL) ((int)(((FUN) << 7) | (SEL)))
|
||||||
|
#define RTL_GET_PERI_SEL(peri) ((int)((peri)&0x0F))
|
||||||
|
#define RTL_GET_PERI_IDX(peri) ((int)(((peri) >> 4)&0x0F))
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PIN_INPUT=0,
|
||||||
|
PIN_OUTPUT
|
||||||
|
} PinDirection;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PA_0 = (PORT_A<<4|0),
|
||||||
|
PA_1 = (PORT_A<<4|1),
|
||||||
|
PA_2 = (PORT_A<<4|2),
|
||||||
|
PA_3 = (PORT_A<<4|3),
|
||||||
|
PA_4 = (PORT_A<<4|4),
|
||||||
|
PA_5 = (PORT_A<<4|5),
|
||||||
|
PA_6 = (PORT_A<<4|6),
|
||||||
|
PA_7 = (PORT_A<<4|7),
|
||||||
|
|
||||||
|
PB_0 = (PORT_B<<4|0),
|
||||||
|
PB_1 = (PORT_B<<4|1),
|
||||||
|
PB_2 = (PORT_B<<4|2),
|
||||||
|
PB_3 = (PORT_B<<4|3),
|
||||||
|
PB_4 = (PORT_B<<4|4),
|
||||||
|
PB_5 = (PORT_B<<4|5),
|
||||||
|
PB_6 = (PORT_B<<4|6),
|
||||||
|
PB_7 = (PORT_B<<4|7),
|
||||||
|
|
||||||
|
PC_0 = (PORT_C<<4|0),
|
||||||
|
PC_1 = (PORT_C<<4|1),
|
||||||
|
PC_2 = (PORT_C<<4|2),
|
||||||
|
PC_3 = (PORT_C<<4|3),
|
||||||
|
PC_4 = (PORT_C<<4|4),
|
||||||
|
PC_5 = (PORT_C<<4|5),
|
||||||
|
PC_6 = (PORT_C<<4|6),
|
||||||
|
PC_7 = (PORT_C<<4|7),
|
||||||
|
PC_8 = (PORT_C<<4|8),
|
||||||
|
PC_9 = (PORT_C<<4|9),
|
||||||
|
|
||||||
|
PD_0 = (PORT_D<<4|0),
|
||||||
|
PD_1 = (PORT_D<<4|1),
|
||||||
|
PD_2 = (PORT_D<<4|2),
|
||||||
|
PD_3 = (PORT_D<<4|3),
|
||||||
|
PD_4 = (PORT_D<<4|4),
|
||||||
|
PD_5 = (PORT_D<<4|5),
|
||||||
|
PD_6 = (PORT_D<<4|6),
|
||||||
|
PD_7 = (PORT_D<<4|7),
|
||||||
|
PD_8 = (PORT_D<<4|8),
|
||||||
|
PD_9 = (PORT_D<<4|9),
|
||||||
|
|
||||||
|
PE_0 = (PORT_E<<4|0),
|
||||||
|
PE_1 = (PORT_E<<4|1),
|
||||||
|
PE_2 = (PORT_E<<4|2),
|
||||||
|
PE_3 = (PORT_E<<4|3),
|
||||||
|
PE_4 = (PORT_E<<4|4),
|
||||||
|
PE_5 = (PORT_E<<4|5),
|
||||||
|
PE_6 = (PORT_E<<4|6),
|
||||||
|
PE_7 = (PORT_E<<4|7),
|
||||||
|
PE_8 = (PORT_E<<4|8),
|
||||||
|
PE_9 = (PORT_E<<4|9),
|
||||||
|
PE_A = (PORT_E<<4|10),
|
||||||
|
|
||||||
|
PF_0 = (PORT_F<<4|0),
|
||||||
|
PF_1 = (PORT_F<<4|1),
|
||||||
|
PF_2 = (PORT_F<<4|2),
|
||||||
|
PF_3 = (PORT_F<<4|3),
|
||||||
|
PF_4 = (PORT_F<<4|4),
|
||||||
|
PF_5 = (PORT_F<<4|5),
|
||||||
|
// PF_6 = (PORT_F<<4|6),
|
||||||
|
// PF_7 = (PORT_F<<4|7),
|
||||||
|
|
||||||
|
PG_0 = (PORT_G<<4|0),
|
||||||
|
PG_1 = (PORT_G<<4|1),
|
||||||
|
PG_2 = (PORT_G<<4|2),
|
||||||
|
PG_3 = (PORT_G<<4|3),
|
||||||
|
PG_4 = (PORT_G<<4|4),
|
||||||
|
PG_5 = (PORT_G<<4|5),
|
||||||
|
PG_6 = (PORT_G<<4|6),
|
||||||
|
PG_7 = (PORT_G<<4|7),
|
||||||
|
|
||||||
|
PH_0 = (PORT_H<<4|0),
|
||||||
|
PH_1 = (PORT_H<<4|1),
|
||||||
|
PH_2 = (PORT_H<<4|2),
|
||||||
|
PH_3 = (PORT_H<<4|3),
|
||||||
|
PH_4 = (PORT_H<<4|4),
|
||||||
|
PH_5 = (PORT_H<<4|5),
|
||||||
|
PH_6 = (PORT_H<<4|6),
|
||||||
|
PH_7 = (PORT_H<<4|7),
|
||||||
|
|
||||||
|
PI_0 = (PORT_I<<4|0),
|
||||||
|
PI_1 = (PORT_I<<4|1),
|
||||||
|
PI_2 = (PORT_I<<4|2),
|
||||||
|
PI_3 = (PORT_I<<4|3),
|
||||||
|
PI_4 = (PORT_I<<4|4),
|
||||||
|
PI_5 = (PORT_I<<4|5),
|
||||||
|
PI_6 = (PORT_I<<4|6),
|
||||||
|
PI_7 = (PORT_I<<4|7),
|
||||||
|
|
||||||
|
PJ_0 = (PORT_J<<4|0),
|
||||||
|
PJ_1 = (PORT_J<<4|1),
|
||||||
|
PJ_2 = (PORT_J<<4|2),
|
||||||
|
PJ_3 = (PORT_J<<4|3),
|
||||||
|
PJ_4 = (PORT_J<<4|4),
|
||||||
|
PJ_5 = (PORT_J<<4|5),
|
||||||
|
PJ_6 = (PORT_J<<4|6),
|
||||||
|
// PJ_7 = (PORT_J<<4|7),
|
||||||
|
|
||||||
|
PK_0 = (PORT_K<<4|0),
|
||||||
|
PK_1 = (PORT_K<<4|1),
|
||||||
|
PK_2 = (PORT_K<<4|2),
|
||||||
|
PK_3 = (PORT_K<<4|3),
|
||||||
|
PK_4 = (PORT_K<<4|4),
|
||||||
|
PK_5 = (PORT_K<<4|5),
|
||||||
|
PK_6 = (PORT_K<<4|6),
|
||||||
|
// PK_7 = (PORT_K<<4|7),
|
||||||
|
|
||||||
|
AD_1 = (PORT_V<<4|1),
|
||||||
|
AD_2 = (PORT_V<<4|2),
|
||||||
|
AD_3 = (PORT_V<<4|3),
|
||||||
|
|
||||||
|
DA_0 = (PORT_U<<4|0),
|
||||||
|
DA_1 = (PORT_U<<4|1),
|
||||||
|
// Arduino connector namings
|
||||||
|
/*
|
||||||
|
A0 = PA_0,
|
||||||
|
A1 = PA_1,
|
||||||
|
A2 = PA_4,
|
||||||
|
A3 = PB_0,
|
||||||
|
A4 = PC_1,
|
||||||
|
A5 = PC_0,
|
||||||
|
D0 = PA_3,
|
||||||
|
D1 = PA_2,
|
||||||
|
D2 = PA_10,
|
||||||
|
D3 = PB_3,
|
||||||
|
D4 = PB_5,
|
||||||
|
D5 = PB_4,
|
||||||
|
D6 = PB_10,
|
||||||
|
D7 = PA_8,
|
||||||
|
D8 = PA_9,
|
||||||
|
D9 = PC_7,
|
||||||
|
D10 = PB_6,
|
||||||
|
D11 = PA_7,
|
||||||
|
D12 = PA_6,
|
||||||
|
D13 = PA_5,
|
||||||
|
D14 = PB_9,
|
||||||
|
D15 = PB_8,
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Generic signals namings
|
||||||
|
LED1 = PB_4,
|
||||||
|
LED2 = PB_5,
|
||||||
|
LED3 = PB_6,
|
||||||
|
LED4 = PB_7,
|
||||||
|
USER_BUTTON = PA_3,
|
||||||
|
SERIAL_TX = PA_7,
|
||||||
|
SERIAL_RX = PA_6,
|
||||||
|
USBTX = PA_7,
|
||||||
|
USBRX = PA_6,
|
||||||
|
I2C_SCL = PC_5,
|
||||||
|
I2C_SDA = PC_4,
|
||||||
|
SPI_MOSI = PC_2,
|
||||||
|
SPI_MISO = PC_3,
|
||||||
|
SPI_SCK = PC_1,
|
||||||
|
SPI_CS = PC_0,
|
||||||
|
PWM_OUT = PD_4,
|
||||||
|
|
||||||
|
// Not connected
|
||||||
|
NC = (uint32_t)0xFFFFFFFF
|
||||||
|
} PinName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PullNone = 0,
|
||||||
|
PullUp = 1,
|
||||||
|
PullDown = 2,
|
||||||
|
OpenDrain = 3,
|
||||||
|
PullDefault = PullNone
|
||||||
|
} PinMode;
|
||||||
|
|
||||||
|
#define PORT_NUM(pin) (((uint32_t)(pin) >> 4) & 0xF)
|
||||||
|
#define PIN_NUM(pin) ((uint32_t)(pin) & 0xF)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
38
sdk/component/common/mbed/targets/hal/rtl8195a/PortNames.h
Normal file
38
sdk/component/common/mbed/targets/hal/rtl8195a/PortNames.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/* 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_PORTNAMES_H
|
||||||
|
#define MBED_PORTNAMES_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PortA = 0,
|
||||||
|
PortB = 1,
|
||||||
|
PortC = 2,
|
||||||
|
PortD = 3,
|
||||||
|
PortE = 4,
|
||||||
|
PortF = 5,
|
||||||
|
PortG = 6,
|
||||||
|
PortH = 7,
|
||||||
|
PortI = 8
|
||||||
|
} PortName;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
48
sdk/component/common/mbed/targets/hal/rtl8195a/device.h
Normal file
48
sdk/component/common/mbed/targets/hal/rtl8195a/device.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 MBED_DEVICE_H
|
||||||
|
#define MBED_DEVICE_H
|
||||||
|
|
||||||
|
#define DEVICE_PORTIN 1
|
||||||
|
#define DEVICE_PORTOUT 1
|
||||||
|
#define DEVICE_PORTINOUT 1
|
||||||
|
|
||||||
|
#define DEVICE_INTERRUPTIN 1
|
||||||
|
|
||||||
|
#define DEVICE_ANALOGIN 1
|
||||||
|
#define DEVICE_ANALOGOUT 1
|
||||||
|
|
||||||
|
#define DEVICE_SERIAL 1
|
||||||
|
|
||||||
|
#define DEVICE_I2C 1
|
||||||
|
#define DEVICE_I2CSLAVE 1
|
||||||
|
|
||||||
|
#define DEVICE_SPI 1
|
||||||
|
#define DEVICE_SPISLAVE 1
|
||||||
|
|
||||||
|
#define DEVICE_CAN 0
|
||||||
|
|
||||||
|
#define DEVICE_RTC 1
|
||||||
|
|
||||||
|
#define DEVICE_ETHERNET 0
|
||||||
|
|
||||||
|
#define DEVICE_PWMOUT 1
|
||||||
|
|
||||||
|
#define DEVICE_SLEEP 1
|
||||||
|
|
||||||
|
#include "objects.h"
|
||||||
|
|
||||||
|
#endif
|
39
sdk/component/common/mbed/targets/hal/rtl8195a/gpio_object.h
Normal file
39
sdk/component/common/mbed/targets/hal/rtl8195a/gpio_object.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/* 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_OBJECT_H
|
||||||
|
#define MBED_GPIO_OBJECT_H
|
||||||
|
|
||||||
|
#include "mbed_assert.h"
|
||||||
|
|
||||||
|
#include "basic_types.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PinName pin;
|
||||||
|
uint32_t mask;
|
||||||
|
|
||||||
|
uint32_t reg_out_offset;
|
||||||
|
uint32_t reg_dir_offset;
|
||||||
|
} gpio_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
200
sdk/component/common/mbed/targets/hal/rtl8195a/objects.h
Normal file
200
sdk/component/common/mbed/targets/hal/rtl8195a/objects.h
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
/* 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_OBJECTS_H
|
||||||
|
#define MBED_OBJECTS_H
|
||||||
|
|
||||||
|
#include "cmsis.h"
|
||||||
|
#include "PortNames.h"
|
||||||
|
#include "PeripheralNames.h"
|
||||||
|
#include "PinNames.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_GPIO_EN
|
||||||
|
struct gpio_irq_s {
|
||||||
|
PinName pin;
|
||||||
|
uint32_t event;
|
||||||
|
HAL_GPIO_PIN hal_pin;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct gpio_irq_s gpio_irq_t;
|
||||||
|
|
||||||
|
struct gpio_s {
|
||||||
|
PinName pin;
|
||||||
|
PinMode mode;
|
||||||
|
PinDirection direction;
|
||||||
|
HAL_GPIO_PIN hal_pin;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct gpio_s gpio_t;
|
||||||
|
|
||||||
|
struct port_s {
|
||||||
|
PortName port;
|
||||||
|
uint32_t mask;
|
||||||
|
PinDirection direction;
|
||||||
|
uint8_t *pin_def;
|
||||||
|
};
|
||||||
|
#endif // end of "#ifdef CONFIG_GPIO_EN"
|
||||||
|
|
||||||
|
#ifdef CONFIG_UART_EN
|
||||||
|
struct serial_s {
|
||||||
|
HAL_RUART_OP hal_uart_op;
|
||||||
|
HAL_RUART_ADAPTER hal_uart_adp;
|
||||||
|
#ifdef CONFIG_GDMA_EN
|
||||||
|
UART_DMA_CONFIG uart_gdma_cfg;
|
||||||
|
HAL_GDMA_ADAPTER uart_gdma_adp_tx;
|
||||||
|
HAL_GDMA_ADAPTER uart_gdma_adp_rx;
|
||||||
|
#endif
|
||||||
|
uint32_t tx_len;
|
||||||
|
uint32_t rx_len;
|
||||||
|
};
|
||||||
|
#endif // end of "#ifdef CONFIG_UART_EN"
|
||||||
|
|
||||||
|
struct log_uart_s {
|
||||||
|
HAL_LOG_UART_ADAPTER log_hal_uart;
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPI_COM_EN
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_PWM_EN
|
||||||
|
struct pwmout_s {
|
||||||
|
uint8_t pwm_idx;
|
||||||
|
uint8_t pin_sel;
|
||||||
|
uint32_t period;
|
||||||
|
uint32_t pulse;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2C_EN
|
||||||
|
struct i2c_s {
|
||||||
|
SAL_I2C_MNGT_ADPT SalI2CMngtAdpt;
|
||||||
|
SAL_I2C_HND_PRIV SalI2CHndPriv;
|
||||||
|
HAL_I2C_INIT_DAT HalI2CInitData;
|
||||||
|
HAL_I2C_OP HalI2COp;
|
||||||
|
IRQ_HANDLE I2CIrqHandleDat;
|
||||||
|
HAL_GDMA_ADAPTER HalI2CTxGdmaAdpt;
|
||||||
|
HAL_GDMA_ADAPTER HalI2CRxGdmaAdpt;
|
||||||
|
HAL_GDMA_OP HalI2CGdmaOp;
|
||||||
|
IRQ_HANDLE I2CTxGdmaIrqHandleDat;
|
||||||
|
IRQ_HANDLE I2CRxGdmaIrqHandleDat;
|
||||||
|
SAL_I2C_USER_CB SalI2CUserCB;
|
||||||
|
SAL_I2C_USERCB_ADPT SalI2CUserCBAdpt[SAL_USER_CB_NUM];
|
||||||
|
SAL_I2C_DMA_USER_DEF SalI2CDmaUserDef;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
struct flash_s
|
||||||
|
{
|
||||||
|
SPIC_INIT_PARA SpicInitPara;
|
||||||
|
u32 Length;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_ADC_EN
|
||||||
|
struct analogin_s {
|
||||||
|
SAL_ADC_MNGT_ADPT SalADCMngtAdpt;
|
||||||
|
SAL_ADC_HND_PRIV SalADCHndPriv;
|
||||||
|
HAL_ADC_INIT_DAT HalADCInitData;
|
||||||
|
HAL_ADC_OP HalADCOp;
|
||||||
|
IRQ_HANDLE ADCIrqHandleDat;
|
||||||
|
HAL_GDMA_ADAPTER HalADCGdmaAdpt;
|
||||||
|
HAL_GDMA_OP HalADCGdmaOp;
|
||||||
|
IRQ_HANDLE ADCGdmaIrqHandleDat;
|
||||||
|
SAL_ADC_USER_CB SalADCUserCB;
|
||||||
|
SAL_ADC_USERCB_ADPT SalADCUserCBAdpt[SAL_ADC_USER_CB_NUM];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
struct i2c_s {
|
||||||
|
I2C_Type *i2c;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct spi_s {
|
||||||
|
SPI_Type *spi;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_NFC_EN
|
||||||
|
struct nfctag_s {
|
||||||
|
NFC_ADAPTER NFCAdapter;
|
||||||
|
void *nfc_rd_cb; // read callback function
|
||||||
|
void *rd_cb_arg;
|
||||||
|
void *nfc_wr_cb; // write callback function
|
||||||
|
void *wr_cb_arg;
|
||||||
|
void *nfc_ev_cb; // event callback function
|
||||||
|
void *ev_cb_arg;
|
||||||
|
void *nfc_cache_rd_cb; // cache read callback function
|
||||||
|
void *cache_read_cb_arg;
|
||||||
|
unsigned int event_mask;
|
||||||
|
int pwr_status;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_TIMER_EN
|
||||||
|
struct gtimer_s {
|
||||||
|
TIMER_ADAPTER hal_gtimer_adp;
|
||||||
|
void *handler;
|
||||||
|
u32 hid;
|
||||||
|
u8 timer_id;
|
||||||
|
u8 is_periodcal;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_I2S_EN
|
||||||
|
struct i2s_s {
|
||||||
|
HAL_I2S_ADAPTER I2SAdapter;
|
||||||
|
HAL_I2S_INIT_DAT InitDat;
|
||||||
|
u8 sampling_rate;
|
||||||
|
u8 channel_num;
|
||||||
|
u8 word_length;
|
||||||
|
u8 direction;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_DAC_EN
|
||||||
|
/** \file objects.h
|
||||||
|
* \brief A Documented file.
|
||||||
|
*
|
||||||
|
* A documented file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** \struct dac_s objects.h "rtl8195a/objects.h"
|
||||||
|
* \brief This is a dac_s structure.
|
||||||
|
*
|
||||||
|
* For analogout APIs, a pointer to dac_s is used as an input paras.
|
||||||
|
* A DAC initial data structure is the major element of dac_s.
|
||||||
|
*/
|
||||||
|
struct dac_s {
|
||||||
|
HAL_DAC_INIT_DAT DACpara;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
37
sdk/component/common/mbed/targets/hal/rtl8195a/timer_api.h
Normal file
37
sdk/component/common/mbed/targets/hal/rtl8195a/timer_api.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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_TIMER_API_EXT_H
|
||||||
|
#define MBED_EXT_TIMER_API_EXT_H
|
||||||
|
|
||||||
|
#include "device.h"
|
||||||
|
//#include "rtl8195a.h"
|
||||||
|
|
||||||
|
typedef void (*gtimer_irq_handler)(uint32_t id);
|
||||||
|
|
||||||
|
typedef struct gtimer_s gtimer_t;
|
||||||
|
enum {
|
||||||
|
TIMER0 = 2, // GTimer 2, share with PWM_3
|
||||||
|
TIMER1 = 3, // GTimer 3, share with PWM_0
|
||||||
|
TIMER2 = 4, // GTimer 4, share with PWM_1
|
||||||
|
TIMER3 = 5, // GTimer 5, share with PWM_2
|
||||||
|
TIMER4 = 0, // GTimer 0, share with software-RTC functions
|
||||||
|
|
||||||
|
GTIMER_MAX = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
void gtimer_init (gtimer_t *obj, uint32_t tid);
|
||||||
|
void gtimer_deinit (gtimer_t *obj);
|
||||||
|
uint32_t gtimer_read_tick (gtimer_t *obj);
|
||||||
|
uint64_t gtimer_read_us (gtimer_t *obj);
|
||||||
|
void gtimer_reload (gtimer_t *obj, uint32_t duration_us);
|
||||||
|
void gtimer_start (gtimer_t *obj);
|
||||||
|
void gtimer_start_one_shout (gtimer_t *obj, uint32_t duration_us, void* handler, uint32_t hid);
|
||||||
|
void gtimer_start_periodical (gtimer_t *obj, uint32_t duration_us, void* handler, uint32_t hid);
|
||||||
|
void gtimer_stop (gtimer_t *obj);
|
||||||
|
|
||||||
|
#endif
|
38
sdk/component/soc/realtek/8195a/cmsis/device/cmsis.h
Normal file
38
sdk/component/soc/realtek/8195a/cmsis/device/cmsis.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* A generic CMSIS include header
|
||||||
|
*******************************************************************************
|
||||||
|
* Copyright (c) 2014, STMicroelectronics
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MBED_CMSIS_H
|
||||||
|
#define MBED_CMSIS_H
|
||||||
|
|
||||||
|
#include "rtl8195a.h"
|
||||||
|
#include "cmsis_nvic.h"
|
||||||
|
|
||||||
|
#endif
|
54
sdk/component/soc/realtek/8195a/cmsis/device/cmsis_nvic.h
Normal file
54
sdk/component/soc/realtek/8195a/cmsis/device/cmsis_nvic.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* CMSIS-style functionality to support dynamic vectors
|
||||||
|
*******************************************************************************
|
||||||
|
* Copyright (c) 2014, STMicroelectronics
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
* 3. Neither the name of STMicroelectronics nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef MBED_CMSIS_NVIC_H
|
||||||
|
#define MBED_CMSIS_NVIC_H
|
||||||
|
|
||||||
|
// CORE: 64 vectors = 64 bytes from 0x00 to 0x3F
|
||||||
|
// MCU Peripherals: 85 vectors = 340 bytes from 0x40 to ...
|
||||||
|
// Total: 128 vectors = 512 bytes (0x200) to be reserved in RAM
|
||||||
|
#define NVIC_NUM_VECTORS 128
|
||||||
|
#define NVIC_USER_IRQ_OFFSET 64
|
||||||
|
|
||||||
|
#include "cmsis.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector);
|
||||||
|
uint32_t NVIC_GetVector(IRQn_Type IRQn);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
15
sdk/component/soc/realtek/8195a/cmsis/device/rand.h
Normal file
15
sdk/component/soc/realtek/8195a/cmsis/device/rand.h
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
/*
|
||||||
|
* Routines to access hardware
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 Realtek Semiconductor Corp.
|
||||||
|
*
|
||||||
|
* This module is a confidential and proprietary property of RealTek and
|
||||||
|
* possession or use of this module requires written permission of RealTek.
|
||||||
|
*/
|
||||||
|
|
||||||
|
u32
|
||||||
|
Rand (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue