mirror of
https://github.com/rtlduino/RTL8710AF_GCC.git
synced 2026-07-01 00:55:39 +00:00
motify compile link error
motify compile link error
This commit is contained in:
parent
923914edae
commit
03e74a8e50
5418 changed files with 1367914 additions and 206149 deletions
|
|
@ -1,44 +1,44 @@
|
|||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "diag.h"
|
||||
#include "main.h"
|
||||
#include "ethernet_api.h"
|
||||
#include <example_entry.h>
|
||||
|
||||
extern void console_init(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Main program.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void main(void)
|
||||
{
|
||||
if ( rtl_cryptoEngine_init() != 0 ) {
|
||||
DiagPrintf("crypto engine init failed\r\n");
|
||||
}
|
||||
|
||||
/* Initialize log uart and at command service */
|
||||
console_init();
|
||||
|
||||
/* pre-processor of application example */
|
||||
pre_example_entry();
|
||||
|
||||
/* wlan intialization */
|
||||
#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
|
||||
wlan_network();
|
||||
#endif
|
||||
ethernet_mii_init();// init ethernet driver
|
||||
/* Execute application example */
|
||||
example_entry();
|
||||
|
||||
/*Enable Schedule, Start Kernel*/
|
||||
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
|
||||
#ifdef PLATFORM_FREERTOS
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
#else
|
||||
RtlConsolTaskRom(NULL);
|
||||
#endif
|
||||
}
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "diag.h"
|
||||
#include "main.h"
|
||||
#include "ethernet_api.h"
|
||||
#include <example_entry.h>
|
||||
|
||||
extern void console_init(void);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Main program.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void main(void)
|
||||
{
|
||||
if ( rtl_cryptoEngine_init() != 0 ) {
|
||||
DiagPrintf("crypto engine init failed\r\n");
|
||||
}
|
||||
|
||||
/* Initialize log uart and at command service */
|
||||
console_init();
|
||||
|
||||
/* pre-processor of application example */
|
||||
pre_example_entry();
|
||||
|
||||
/* wlan intialization */
|
||||
#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
|
||||
wlan_network();
|
||||
#endif
|
||||
ethernet_mii_init();// init ethernet driver
|
||||
/* Execute application example */
|
||||
example_entry();
|
||||
|
||||
/*Enable Schedule, Start Kernel*/
|
||||
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
|
||||
#ifdef PLATFORM_FREERTOS
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
#else
|
||||
RtlConsolTaskRom(NULL);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
Example Description
|
||||
|
||||
This example describes how to use GPIO read/write mbed api to generate a pulse and to measure the pulse width.
|
||||
|
||||
Requirement Components:
|
||||
a wire
|
||||
|
||||
Pin name PC_4 and PC_5 map to GPIOC_4 and GPIOC_5:
|
||||
- PC_4 as the interrupt GPIO pin with no pull (High-Z).
|
||||
- PC_5 as output to generate a pulse.
|
||||
- Use a wire to connect PC_4 and PC_5
|
||||
|
||||
In this example, the UART consol will print out the measured width (in us) of the pulse which generated by PC_5.
|
||||
Example Description
|
||||
|
||||
This example describes how to use GPIO read/write mbed api to generate a pulse and to measure the pulse width.
|
||||
|
||||
Requirement Components:
|
||||
a wire
|
||||
|
||||
Pin name PC_4 and PC_5 map to GPIOC_4 and GPIOC_5:
|
||||
- PC_4 as the interrupt GPIO pin with no pull (High-Z).
|
||||
- PC_5 as output to generate a pulse.
|
||||
- Use a wire to connect PC_4 and PC_5
|
||||
|
||||
In this example, the UART consol will print out the measured width (in us) of the pulse which generated by PC_5.
|
||||
|
|
|
|||
|
|
@ -1,73 +1,73 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "gpio_api.h" // mbed
|
||||
#include "gpio_irq_api.h" // mbed
|
||||
#include "diag.h"
|
||||
#include "us_ticker_api.h"
|
||||
#include "main.h"
|
||||
|
||||
#define GPIO_OUT_PIN PC_5
|
||||
#define GPIO_IRQ_PIN PC_4
|
||||
|
||||
gpio_t gpio_out;
|
||||
gpio_irq_t gpio_irq;
|
||||
volatile char irq_rise;
|
||||
|
||||
|
||||
void gpio_demo_irq_handler (uint32_t id, gpio_irq_event event)
|
||||
{
|
||||
static unsigned int rise_time;
|
||||
static unsigned int fall_time;
|
||||
|
||||
if (irq_rise) {
|
||||
rise_time = us_ticker_read();
|
||||
// Changed as Falling Edge Trigger
|
||||
gpio_irq_set_event(&gpio_irq, IRQ_FALL);
|
||||
irq_rise = 0;
|
||||
} else {
|
||||
fall_time = us_ticker_read();
|
||||
// Changed as Rising Edge Trigger
|
||||
gpio_irq_set_event(&gpio_irq, IRQ_RISE);
|
||||
irq_rise = 1;
|
||||
|
||||
DBG_8195A("%d\n", (fall_time-rise_time));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Main program.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void main(void)
|
||||
{
|
||||
|
||||
// Init LED control pin
|
||||
gpio_init(&gpio_out, GPIO_OUT_PIN);
|
||||
gpio_dir(&gpio_out, PIN_OUTPUT); // Direction: Output
|
||||
gpio_mode(&gpio_out, PullNone); // No pull
|
||||
gpio_write(&gpio_out, 0);
|
||||
|
||||
// Initial Push Button pin as interrupt source
|
||||
gpio_irq_init(&gpio_irq, GPIO_IRQ_PIN, gpio_demo_irq_handler, (uint32_t)(&gpio_irq));
|
||||
gpio_irq_set(&gpio_irq, IRQ_RISE, 1); // Falling Edge Trigger
|
||||
irq_rise = 1;
|
||||
gpio_irq_pull_ctrl(&gpio_irq, PullNone);
|
||||
gpio_irq_enable(&gpio_irq);
|
||||
|
||||
while(1) {
|
||||
wait_ms(500);
|
||||
gpio_write(&gpio_out, 1);
|
||||
wait_us(1000);
|
||||
gpio_write(&gpio_out, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "gpio_api.h" // mbed
|
||||
#include "gpio_irq_api.h" // mbed
|
||||
#include "diag.h"
|
||||
#include "us_ticker_api.h"
|
||||
#include "main.h"
|
||||
|
||||
#define GPIO_OUT_PIN PC_5
|
||||
#define GPIO_IRQ_PIN PC_4
|
||||
|
||||
gpio_t gpio_out;
|
||||
gpio_irq_t gpio_irq;
|
||||
volatile char irq_rise;
|
||||
|
||||
|
||||
void gpio_demo_irq_handler (uint32_t id, gpio_irq_event event)
|
||||
{
|
||||
static unsigned int rise_time;
|
||||
static unsigned int fall_time;
|
||||
|
||||
if (irq_rise) {
|
||||
rise_time = us_ticker_read();
|
||||
// Changed as Falling Edge Trigger
|
||||
gpio_irq_set_event(&gpio_irq, IRQ_FALL);
|
||||
irq_rise = 0;
|
||||
} else {
|
||||
fall_time = us_ticker_read();
|
||||
// Changed as Rising Edge Trigger
|
||||
gpio_irq_set_event(&gpio_irq, IRQ_RISE);
|
||||
irq_rise = 1;
|
||||
|
||||
DBG_8195A("%d\n", (fall_time-rise_time));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Main program.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void main(void)
|
||||
{
|
||||
|
||||
// Init LED control pin
|
||||
gpio_init(&gpio_out, GPIO_OUT_PIN);
|
||||
gpio_dir(&gpio_out, PIN_OUTPUT); // Direction: Output
|
||||
gpio_mode(&gpio_out, PullNone); // No pull
|
||||
gpio_write(&gpio_out, 0);
|
||||
|
||||
// Initial Push Button pin as interrupt source
|
||||
gpio_irq_init(&gpio_irq, GPIO_IRQ_PIN, gpio_demo_irq_handler, (uint32_t)(&gpio_irq));
|
||||
gpio_irq_set(&gpio_irq, IRQ_RISE, 1); // Falling Edge Trigger
|
||||
irq_rise = 1;
|
||||
gpio_irq_pull_ctrl(&gpio_irq, PullNone);
|
||||
gpio_irq_enable(&gpio_irq);
|
||||
|
||||
while(1) {
|
||||
wait_ms(500);
|
||||
gpio_write(&gpio_out, 1);
|
||||
wait_us(1000);
|
||||
gpio_write(&gpio_out, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,40 +1,40 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "log_uart_api.h"
|
||||
|
||||
log_uart_t uobj;
|
||||
|
||||
void uart_send_string(log_uart_t *uobj, char *pstr)
|
||||
{
|
||||
unsigned int i=0;
|
||||
|
||||
while (*(pstr+i) != 0) {
|
||||
log_uart_putc(uobj, *(pstr+i));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// sample text
|
||||
char rc;
|
||||
// Initial Log UART: BaudRate=115200, 8-bits, No Parity, 1 Stop bit
|
||||
log_uart_init(&uobj, 38400, 8, ParityNone, 1);
|
||||
|
||||
uart_send_string(&uobj, "UART API Demo...\r\n");
|
||||
uart_send_string(&uobj, "Hello World!!\r\n");
|
||||
while(1){
|
||||
uart_send_string(&uobj, "\r\n8195a$");
|
||||
rc = log_uart_getc(&uobj);
|
||||
log_uart_putc(&uobj, rc);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "log_uart_api.h"
|
||||
|
||||
log_uart_t uobj;
|
||||
|
||||
void uart_send_string(log_uart_t *uobj, char *pstr)
|
||||
{
|
||||
unsigned int i=0;
|
||||
|
||||
while (*(pstr+i) != 0) {
|
||||
log_uart_putc(uobj, *(pstr+i));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// sample text
|
||||
char rc;
|
||||
// Initial Log UART: BaudRate=115200, 8-bits, No Parity, 1 Stop bit
|
||||
log_uart_init(&uobj, 38400, 8, ParityNone, 1);
|
||||
|
||||
uart_send_string(&uobj, "UART API Demo...\r\n");
|
||||
uart_send_string(&uobj, "Hello World!!\r\n");
|
||||
while(1){
|
||||
uart_send_string(&uobj, "\r\n8195a$");
|
||||
rc = log_uart_getc(&uobj);
|
||||
log_uart_putc(&uobj, rc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +1,46 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "log_uart_api.h"
|
||||
|
||||
char buf[100]="Hello World!!\r\n";;
|
||||
log_uart_t uobj;
|
||||
|
||||
int uart_scan (char *buf)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<100;i++) {
|
||||
*(buf+i) = log_uart_getc(&uobj);
|
||||
if ((*(buf+i) == 0x0A) || (*(buf+i) == 0x0D)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
log_uart_init(&uobj, 38400, 8, ParityNone, 1);
|
||||
log_uart_send(&uobj, buf, _strlen(buf), 100);
|
||||
|
||||
while (1) {
|
||||
// ret = log_uart_recv(&uobj, buf, 100, 2000);
|
||||
ret = uart_scan(buf);
|
||||
log_uart_send(&uobj, buf, ret, 1000);
|
||||
log_uart_putc(&uobj, 0x0A);
|
||||
log_uart_putc(&uobj, 0x0D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "log_uart_api.h"
|
||||
|
||||
char buf[100]="Hello World!!\r\n";;
|
||||
log_uart_t uobj;
|
||||
|
||||
int uart_scan (char *buf)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<100;i++) {
|
||||
*(buf+i) = log_uart_getc(&uobj);
|
||||
if ((*(buf+i) == 0x0A) || (*(buf+i) == 0x0D)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
log_uart_init(&uobj, 38400, 8, ParityNone, 1);
|
||||
log_uart_send(&uobj, buf, _strlen(buf), 100);
|
||||
|
||||
while (1) {
|
||||
// ret = log_uart_recv(&uobj, buf, 100, 2000);
|
||||
ret = uart_scan(buf);
|
||||
log_uart_send(&uobj, buf, ret, 1000);
|
||||
log_uart_putc(&uobj, 0x0A);
|
||||
log_uart_putc(&uobj, 0x0D);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,81 +1,81 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "log_uart_api.h"
|
||||
|
||||
#define BUF_SZ (1024*3)
|
||||
|
||||
extern void wait_ms(int ms);
|
||||
|
||||
char buf[BUF_SZ]="Hello World!!\r\n";;
|
||||
volatile uint32_t tx_busy=0;
|
||||
volatile uint32_t rx_busy=0;
|
||||
log_uart_t uobj;
|
||||
|
||||
void uart_tx_done(uint32_t id)
|
||||
{
|
||||
log_uart_t *uobj = (void*)id;
|
||||
tx_busy = 0;
|
||||
}
|
||||
|
||||
void uart_rx_done(uint32_t id)
|
||||
{
|
||||
log_uart_t *uobj = (void*)id;
|
||||
rx_busy = 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
int timeout;
|
||||
|
||||
log_uart_init(&uobj, 38400, 8, ParityNone, 1);
|
||||
|
||||
log_uart_tx_comp_handler(&uobj, (void*)uart_tx_done, (uint32_t) &uobj);
|
||||
log_uart_rx_comp_handler(&uobj, (void*)uart_rx_done, (uint32_t) &uobj);
|
||||
|
||||
log_uart_send(&uobj, buf, _strlen(buf), 100);
|
||||
|
||||
while (1) {
|
||||
rx_busy = 1;
|
||||
log_uart_recv_stream(&uobj, buf, BUF_SZ);
|
||||
timeout = 2000;
|
||||
ret = BUF_SZ;
|
||||
while (rx_busy) {
|
||||
wait_ms(1);
|
||||
timeout--;
|
||||
if (timeout == 0) {
|
||||
// return value is the bytes received
|
||||
ret = log_uart_recv_stream_abort(&uobj);
|
||||
rx_busy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret > 0) {
|
||||
buf[ret] = 0; // end of string
|
||||
tx_busy = 1;
|
||||
log_uart_send_stream(&uobj, buf, ret);
|
||||
timeout = 2000;
|
||||
while (tx_busy) {
|
||||
wait_ms(1);
|
||||
timeout--;
|
||||
if (timeout == 0) {
|
||||
tx_busy = 0;
|
||||
// return value is the bytes transmitted
|
||||
ret = log_uart_send_stream_abort(&uobj);
|
||||
}
|
||||
}
|
||||
log_uart_putc(&uobj, 0x0d);
|
||||
log_uart_putc(&uobj, 0x0a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "log_uart_api.h"
|
||||
|
||||
#define BUF_SZ (1024*3)
|
||||
|
||||
extern void wait_ms(int ms);
|
||||
|
||||
char buf[BUF_SZ]="Hello World!!\r\n";;
|
||||
volatile uint32_t tx_busy=0;
|
||||
volatile uint32_t rx_busy=0;
|
||||
log_uart_t uobj;
|
||||
|
||||
void uart_tx_done(uint32_t id)
|
||||
{
|
||||
log_uart_t *uobj = (void*)id;
|
||||
tx_busy = 0;
|
||||
}
|
||||
|
||||
void uart_rx_done(uint32_t id)
|
||||
{
|
||||
log_uart_t *uobj = (void*)id;
|
||||
rx_busy = 0;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
int timeout;
|
||||
|
||||
log_uart_init(&uobj, 38400, 8, ParityNone, 1);
|
||||
|
||||
log_uart_tx_comp_handler(&uobj, (void*)uart_tx_done, (uint32_t) &uobj);
|
||||
log_uart_rx_comp_handler(&uobj, (void*)uart_rx_done, (uint32_t) &uobj);
|
||||
|
||||
log_uart_send(&uobj, buf, _strlen(buf), 100);
|
||||
|
||||
while (1) {
|
||||
rx_busy = 1;
|
||||
log_uart_recv_stream(&uobj, buf, BUF_SZ);
|
||||
timeout = 2000;
|
||||
ret = BUF_SZ;
|
||||
while (rx_busy) {
|
||||
wait_ms(1);
|
||||
timeout--;
|
||||
if (timeout == 0) {
|
||||
// return value is the bytes received
|
||||
ret = log_uart_recv_stream_abort(&uobj);
|
||||
rx_busy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret > 0) {
|
||||
buf[ret] = 0; // end of string
|
||||
tx_busy = 1;
|
||||
log_uart_send_stream(&uobj, buf, ret);
|
||||
timeout = 2000;
|
||||
while (tx_busy) {
|
||||
wait_ms(1);
|
||||
timeout--;
|
||||
if (timeout == 0) {
|
||||
tx_busy = 0;
|
||||
// return value is the bytes transmitted
|
||||
ret = log_uart_send_stream_abort(&uobj);
|
||||
}
|
||||
}
|
||||
log_uart_putc(&uobj, 0x0d);
|
||||
log_uart_putc(&uobj, 0x0a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
Example Description
|
||||
|
||||
This example demo the function of Auto Flow control.
|
||||
Please connect 2 board to run this example.
|
||||
|
||||
|
||||
Required Components:
|
||||
2 EV boards
|
||||
|
||||
Connect to 2 borads
|
||||
|
||||
Board1 Board2
|
||||
PA6 <-----> PA7
|
||||
PA7 <-----> PA6
|
||||
PA5 <-----> PA3
|
||||
PA3 <-----> PA5
|
||||
GND <-----> GND
|
||||
|
||||
This example shows:
|
||||
The first powered board will be the TX side, the othse one will be the RX side.
|
||||
The RX side will make some delay every 16-bytes received, by this way we can trigger the flow control mechanism.
|
||||
|
||||
Example Description
|
||||
|
||||
This example demo the function of Auto Flow control.
|
||||
Please connect 2 board to run this example.
|
||||
|
||||
|
||||
Required Components:
|
||||
2 EV boards
|
||||
|
||||
Connect to 2 borads
|
||||
|
||||
Board1 Board2
|
||||
PA6 <-----> PA7
|
||||
PA7 <-----> PA6
|
||||
PA5 <-----> PA3
|
||||
PA3 <-----> PA5
|
||||
GND <-----> GND
|
||||
|
||||
This example shows:
|
||||
The first powered board will be the TX side, the othse one will be the RX side.
|
||||
The RX side will make some delay every 16-bytes received, by this way we can trigger the flow control mechanism.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,123 +1,123 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// This example demo the function of Auto Flow control
|
||||
// Please connect 2 board to run this example.
|
||||
// Board1 <-----> Board2
|
||||
// PA6 <-----> PA7
|
||||
// PA7 <-----> PA6
|
||||
// PA5 <-----> PA3
|
||||
// PA3 <-----> PA5
|
||||
// GND <-----> GND
|
||||
|
||||
// The first started board will be the TX side, the othse one will be the RX side
|
||||
// The RX side will make some delay every 16-bytes received,
|
||||
// by this way we can trigger the flow control mechanism.
|
||||
|
||||
#include "device.h"
|
||||
#include "serial_api.h"
|
||||
#include "main.h"
|
||||
|
||||
#define UART_TX PA_7
|
||||
#define UART_RX PA_6
|
||||
|
||||
void uart_send_string(serial_t *sobj, char *pstr)
|
||||
{
|
||||
unsigned int i=0;
|
||||
|
||||
while (*(pstr+i) != 0) {
|
||||
serial_putc(sobj, *(pstr+i));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#define UART_BUF_SIZE 1000
|
||||
|
||||
serial_t sobj;
|
||||
unsigned char buffer[UART_BUF_SIZE];
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// sample text
|
||||
char rc;
|
||||
int i,j;
|
||||
int rx_side=0;
|
||||
|
||||
// mbed uart test
|
||||
HAL_GPIO_PullCtrl(UART_RX, PullUp);
|
||||
serial_init(&sobj,UART_TX,UART_RX);
|
||||
serial_baud(&sobj,38400);
|
||||
serial_format(&sobj, 8, ParityNone, 1);
|
||||
serial_set_flow_control(&sobj, FlowControlNone, 0, 0); // Pin assignment is ignored
|
||||
|
||||
for (i=0;i<1000;i++) {
|
||||
// Tide Break
|
||||
DBG_8195A("Wait peer ready...\r\n");
|
||||
serial_putc(&sobj, i+1);
|
||||
if (serial_readable(&sobj)) {
|
||||
rc = serial_getc(&sobj);
|
||||
if (rc > i) {
|
||||
rx_side = 1;
|
||||
} else {
|
||||
rx_side = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
wait_ms(100);
|
||||
}
|
||||
|
||||
serial_clear_rx(&sobj);
|
||||
// Enable flow control
|
||||
serial_set_flow_control(&sobj, FlowControlRTSCTS, 0, 0); // Pin assignment is ignored
|
||||
|
||||
if (rx_side) {
|
||||
DBG_8195A("UART Flow Control: RX ==>\r\n");
|
||||
_memset(buffer, 0, UART_BUF_SIZE);
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (1) {
|
||||
if (serial_readable(&sobj)) {
|
||||
buffer[i] = serial_getc(&sobj);
|
||||
i++;
|
||||
if (i == UART_BUF_SIZE) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((i&0xf) == 0) {
|
||||
// Make some delay to cause the RX FIFO full and then trigger flow controll
|
||||
wait_ms(100);
|
||||
DBG_8195A("UART RX got %d bytes\r\n", i);
|
||||
}
|
||||
j=0;
|
||||
} else {
|
||||
wait_ms(10);
|
||||
j++;
|
||||
if (j== 1000) {
|
||||
DBG_8195A("UART RX Failed, Got %d bytes\r\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
DBG_8195A("UART Flow Control: TX ==>\r\n");
|
||||
wait_ms(500);
|
||||
for (i=0;i<UART_BUF_SIZE;i++) {
|
||||
buffer[i] = 0x30 + (i%10);
|
||||
}
|
||||
|
||||
for (i=0;i<UART_BUF_SIZE;i++) {
|
||||
serial_putc(&sobj, buffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
DBG_8195A("UART Flow Control Test Done!\r\n");
|
||||
while (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// This example demo the function of Auto Flow control
|
||||
// Please connect 2 board to run this example.
|
||||
// Board1 <-----> Board2
|
||||
// PA6 <-----> PA7
|
||||
// PA7 <-----> PA6
|
||||
// PA5 <-----> PA3
|
||||
// PA3 <-----> PA5
|
||||
// GND <-----> GND
|
||||
|
||||
// The first started board will be the TX side, the othse one will be the RX side
|
||||
// The RX side will make some delay every 16-bytes received,
|
||||
// by this way we can trigger the flow control mechanism.
|
||||
|
||||
#include "device.h"
|
||||
#include "serial_api.h"
|
||||
#include "main.h"
|
||||
|
||||
#define UART_TX PA_7
|
||||
#define UART_RX PA_6
|
||||
|
||||
void uart_send_string(serial_t *sobj, char *pstr)
|
||||
{
|
||||
unsigned int i=0;
|
||||
|
||||
while (*(pstr+i) != 0) {
|
||||
serial_putc(sobj, *(pstr+i));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#define UART_BUF_SIZE 1000
|
||||
|
||||
serial_t sobj;
|
||||
unsigned char buffer[UART_BUF_SIZE];
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// sample text
|
||||
char rc;
|
||||
int i,j;
|
||||
int rx_side=0;
|
||||
|
||||
// mbed uart test
|
||||
HAL_GPIO_PullCtrl(UART_RX, PullUp);
|
||||
serial_init(&sobj,UART_TX,UART_RX);
|
||||
serial_baud(&sobj,38400);
|
||||
serial_format(&sobj, 8, ParityNone, 1);
|
||||
serial_set_flow_control(&sobj, FlowControlNone, 0, 0); // Pin assignment is ignored
|
||||
|
||||
for (i=0;i<1000;i++) {
|
||||
// Tide Break
|
||||
DBG_8195A("Wait peer ready...\r\n");
|
||||
serial_putc(&sobj, i+1);
|
||||
if (serial_readable(&sobj)) {
|
||||
rc = serial_getc(&sobj);
|
||||
if (rc > i) {
|
||||
rx_side = 1;
|
||||
} else {
|
||||
rx_side = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
wait_ms(100);
|
||||
}
|
||||
|
||||
serial_clear_rx(&sobj);
|
||||
// Enable flow control
|
||||
serial_set_flow_control(&sobj, FlowControlRTSCTS, 0, 0); // Pin assignment is ignored
|
||||
|
||||
if (rx_side) {
|
||||
DBG_8195A("UART Flow Control: RX ==>\r\n");
|
||||
_memset(buffer, 0, UART_BUF_SIZE);
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (1) {
|
||||
if (serial_readable(&sobj)) {
|
||||
buffer[i] = serial_getc(&sobj);
|
||||
i++;
|
||||
if (i == UART_BUF_SIZE) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((i&0xf) == 0) {
|
||||
// Make some delay to cause the RX FIFO full and then trigger flow controll
|
||||
wait_ms(100);
|
||||
DBG_8195A("UART RX got %d bytes\r\n", i);
|
||||
}
|
||||
j=0;
|
||||
} else {
|
||||
wait_ms(10);
|
||||
j++;
|
||||
if (j== 1000) {
|
||||
DBG_8195A("UART RX Failed, Got %d bytes\r\n", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
DBG_8195A("UART Flow Control: TX ==>\r\n");
|
||||
wait_ms(500);
|
||||
for (i=0;i<UART_BUF_SIZE;i++) {
|
||||
buffer[i] = 0x30 + (i%10);
|
||||
}
|
||||
|
||||
for (i=0;i<UART_BUF_SIZE;i++) {
|
||||
serial_putc(&sobj, buffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
DBG_8195A("UART Flow Control Test Done!\r\n");
|
||||
while (1);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue