Microchip® Advanced Software Framework

sam/applications/sam_tcm/main.c File Reference

Main application of SAM TCM Demo.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#include "asf.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Macros

#define BUFF_SIZE   0x1000
 Support and FAQ: visit Microchip Support More...
 
#define DTCM_STACK_BASE   ((void *)(&_sdtcm_stack))
 
#define DTCM_STACK_LIMIT   ((void *)(&_edtcm_stack))
 
#define GET_CYCLE_COUNTER(x)   x=DWT->CYCCNT;
 
#define RESET_CYCLE_COUNTER()
 
#define SRAM_STACK_BASE   ((void *)(&_sstack))
 
#define SRAM_STACK_LIMIT   ((void *)(&_estack))
 

Functions

static void configure_console (void)
 Configure UART console. More...
 
int main (void)
 Application entry point for TCM example. More...
 
static uint32_t normal_memcpy (uint8_t *pDest, uint8_t *pSrc, uint16_t len)
 
static uint32_t recursive (uint32_t n)
 
static uint32_t stack_test (uint32_t n)
 
static uint32_t tcm_memcpy (uint8_t *pDest, uint8_t *pSrc, uint16_t len)
 
static void tcm_stackinit (void)
 Change stack's location to DTCM. More...
 

Variables

char _edtcm_stack
 
char _estack
 
char _sdtcm_stack
 
char _sstack
 
static uint32_t cyclecounter
 
uint8_t destbuff [3 *BUFF_SIZE]
 
const char * pBuffer
 
uint8_t srcbuff [BUFF_SIZE]
 
uint8_t tcm_destbuff [3 *BUFF_SIZE]
 
uint8_t tcm_srcbuff [BUFF_SIZE]
 

#define BUFF_SIZE   0x1000

Support and FAQ: visit Microchip Support

Referenced by iperf_tcp_task(), iperf_udp_send(), and main().

#define DTCM_STACK_BASE   ((void *)(&_sdtcm_stack))
#define DTCM_STACK_LIMIT   ((void *)(&_edtcm_stack))

Referenced by tcm_stackinit().

#define GET_CYCLE_COUNTER (   x)    x=DWT->CYCCNT;
#define RESET_CYCLE_COUNTER ( )
Value:
do { \
CoreDebug->DEMCR = CoreDebug_DEMCR_TRCENA_Msk; \
__DSB(); DWT->LAR = 0xC5ACCE55; __DSB(); \
DWT->CTRL &= ~DWT_CTRL_CYCCNTENA_Msk; \
DWT->CYCCNT = 0; \
DWT->CTRL = DWT_CTRL_CYCCNTENA_Msk; \
}while(0)

Referenced by main(), normal_memcpy(), stack_test(), and tcm_memcpy().

#define SRAM_STACK_BASE   ((void *)(&_sstack))

Referenced by tcm_stackinit().

#define SRAM_STACK_LIMIT   ((void *)(&_estack))

Referenced by tcm_stackinit().

static void configure_console ( void  )
static

Configure UART console.

References uart_rs232_options::baudrate, stdio_serial_init(), and sysclk_enable_peripheral_clock().

Referenced by main().

int main ( void  )

Application entry point for TCM example.

Returns
Unused (ANSI-C compatibility).

References board_init(), BOARD_NAME, BUFF_SIZE, configure_console(), normal_memcpy(), RESET_CYCLE_COUNTER, stack_test(), sysclk_init(), tcm_memcpy(), and tcm_stackinit().

static uint32_t normal_memcpy ( uint8_t *  pDest,
uint8_t *  pSrc,
uint16_t  len 
)
static

References cyclecounter, GET_CYCLE_COUNTER, and RESET_CYCLE_COUNTER.

Referenced by main().

static uint32_t recursive ( uint32_t  n)
static

Referenced by stack_test().

static uint32_t stack_test ( uint32_t  n)
static
static uint32_t tcm_memcpy ( uint8_t *  pDest,
uint8_t *  pSrc,
uint16_t  len 
)
static

References cyclecounter, GET_CYCLE_COUNTER, and RESET_CYCLE_COUNTER.

Referenced by main().

static void tcm_stackinit ( void  )
static

Change stack's location to DTCM.

The function changes the stack's location from SRAM to DTCM

References DTCM_STACK_LIMIT, SRAM_STACK_BASE, and SRAM_STACK_LIMIT.

Referenced by main().

char _edtcm_stack
char _estack
char _sdtcm_stack
char _sstack
uint32_t cyclecounter
static
uint8_t destbuff[3 *BUFF_SIZE]
const char* pBuffer
Initial value:
= "The ARM architecture is defined in a hierarchical manner,\
where the features are described in Chapter A2\
Application Level Programmers?Model at the application level,\
with underlying system support. What features are available and how they are \
supported is defined in the architecture profiles, making the system \
level support profile specific. Deprecated features can be found in an \
appendix to this manual. See page. As stated in Privileged execution on page \
A2-13, programs can execute in a privileged or unprivileged manner. System \
level support requires privileged access, allowing it the access permissions \
to configure and control the resources. This is typically supported by an \
operating system, which provides system services to the applications, either \
transparently, or through application initiated service calls. The operating \
system is also responsible for servicing interrupts and other system events, \
making exceptions a key component of the system level programmers?model."
uint8_t srcbuff[BUFF_SIZE]
uint8_t tcm_destbuff[3 *BUFF_SIZE]
uint8_t tcm_srcbuff[BUFF_SIZE]