Add SAMV7 (Cortex-M7) demo for Atmel Studio.

This commit is contained in:
Richard Barry 2015-06-16 12:38:35 +00:00
parent 7456c232ce
commit cfb8223232
338 changed files with 95031 additions and 7610 deletions

View File

@ -0,0 +1,236 @@
/*
FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
/******************************************************************************
* NOTE 1: This project provides two demo applications. A simple blinky
* style project, and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
* between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
* in main.c. This file implements the simply blinky style version.
*
* NOTE 2: This file only contains the source code that is specific to the
* basic demo. Generic functions, such FreeRTOS hook functions, and functions
* required to configure the hardware are defined in main.c.
******************************************************************************
*
* main_blinky() creates one queue, and two tasks. It then starts the
* scheduler.
*
* The Queue Send Task:
* The queue send task is implemented by the prvQueueSendTask() function in
* this file. prvQueueSendTask() sits in a loop that causes it to repeatedly
* block for 200 milliseconds, before sending the value 100 to the queue that
* was created within main_blinky(). Once the value is sent, the task loops
* back around to block for another 200 milliseconds...and so on.
*
* The Queue Receive Task:
* The queue receive task is implemented by the prvQueueReceiveTask() function
* in this file. prvQueueReceiveTask() sits in a loop where it repeatedly
* blocks on attempts to read data from the queue that was created within
* main_blinky(). When data is received, the task checks the value of the
* data, and if the value equals the expected 100, toggles an LED. The 'block
* time' parameter passed to the queue receive function specifies that the
* task should be held in the Blocked state indefinitely to wait for data to
* be available on the queue. The queue receive task will only leave the
* Blocked state when the queue send task writes to the queue. As the queue
* send task writes to the queue every 200 milliseconds, the queue receive
* task leaves the Blocked state every 200 milliseconds, and therefore toggles
* the LED every 200 milliseconds.
*/
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
/* Library includes. */
#include "board.h"
/* Priorities at which the tasks are created. */
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
/* The rate at which data is sent to the queue. The 200ms value is converted
to ticks using the portTICK_PERIOD_MS constant. */
#define mainQUEUE_SEND_FREQUENCY_MS ( 200 / portTICK_PERIOD_MS )
/* The number of items the queue can hold. This is 1 as the receive task
will remove items as they are added, meaning the send task should always find
the queue empty. */
#define mainQUEUE_LENGTH ( 1 )
/* The LED toggled by the Rx task. */
#define mainTASK_LED ( 0 )
/*-----------------------------------------------------------*/
/*
* Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in
* main.c.
*/
void main_blinky( void );
/*
* The tasks as described in the comments at the top of this file.
*/
static void prvQueueReceiveTask( void *pvParameters );
static void prvQueueSendTask( void *pvParameters );
/*-----------------------------------------------------------*/
/* The queue used by both tasks. */
static QueueHandle_t xQueue = NULL;
/*-----------------------------------------------------------*/
void main_blinky( void )
{
/* Create the queue. */
xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
if( xQueue != NULL )
{
/* Start the two tasks as described in the comments at the top of this
file. */
xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
NULL, /* The parameter passed to the task - not used in this case. */
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
NULL ); /* The task handle is not required, so NULL is passed. */
xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
/* Start the tasks and timer running. */
vTaskStartScheduler();
}
/* If all is well, the scheduler will now be running, and the following
line will never be reached. If the following line does execute, then
there was either insufficient FreeRTOS heap memory available for the idle
and/or timer tasks to be created, or vTaskStartScheduler() was called from
User mode. See the memory management section on the FreeRTOS web site for
more details on the FreeRTOS heap http://www.freertos.org/a00111.html. The
mode from which main() is called is set in the C start up code and must be
a privileged mode (not user mode). */
for( ;; );
}
/*-----------------------------------------------------------*/
static void prvQueueSendTask( void *pvParameters )
{
TickType_t xNextWakeTime;
const unsigned long ulValueToSend = 100UL;
/* Remove compiler warning about unused parameter. */
( void ) pvParameters;
/* Initialise xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount();
for( ;; )
{
/* Place this task in the blocked state until it is time to run again. */
vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
/* Send to the queue - causing the queue receive task to unblock and
toggle the LED. 0 is used as the block time so the sending operation
will not block - it shouldn't need to block as the queue should always
be empty at this point in the code. */
xQueueSend( xQueue, &ulValueToSend, 0U );
}
}
/*-----------------------------------------------------------*/
static void prvQueueReceiveTask( void *pvParameters )
{
unsigned long ulReceivedValue;
const unsigned long ulExpectedValue = 100UL;
/* Remove compiler warning about unused parameter. */
( void ) pvParameters;
for( ;; )
{
/* Wait until something arrives in the queue - this task will block
indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
FreeRTOSConfig.h. */
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
/* To get here something must have been received from the queue, but
is it the expected value? If it is, toggle the LED. */
if( ulReceivedValue == ulExpectedValue )
{
LED_Toggle( mainTASK_LED );
ulReceivedValue = 0U;
}
}
}
/*-----------------------------------------------------------*/

View File

@ -0,0 +1,187 @@
/*
FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
#ifndef FREERTOS_CONFIG_H
#define FREERTOS_CONFIG_H
/*-----------------------------------------------------------
* Application specific definitions.
*
* These definitions should be adjusted for your particular hardware and
* application requirements.
*
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
*
* See http://www.freertos.org/a00110.html.
*----------------------------------------------------------*/
/* For definition of BOARD_MCK. */
#ifndef __IAR_SYSTEMS_ASM__
/* Prevent chip.h being included when this file is included from the IAR
port layer assembly file. */
#include "board.h"
#endif
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configUSE_QUEUE_SETS 1
#define configUSE_IDLE_HOOK 0
#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( BOARD_MCK << 1UL )
#define configTICK_RATE_HZ ( 1000 )
#define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 130 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 46 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 10 )
#define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configQUEUE_REGISTRY_SIZE 8
#define configCHECK_FOR_STACK_OVERFLOW 2
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
/* The full demo always has tasks to run so the tick will never be turned off.
The blinky demo will use the default tickless idle implementation to turn the
tick off. */
#define configUSE_TICKLESS_IDLE 0
/* Run time stats gathering definitions. */
#define configGENERATE_RUN_TIME_STATS 0
/* This demo makes use of one or more example stats formatting functions. These
format the raw data provided by the uxTaskGetSystemState() function in to human
readable ASCII form. See the notes in the implementation of vTaskList() within
FreeRTOS/Source/tasks.c for limitations. */
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
#define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define configTIMER_QUEUE_LENGTH 5
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
/* Set the following definitions to 1 to include the API function, or zero
to exclude the API function. */
#define INCLUDE_vTaskPrioritySet 1
#define INCLUDE_uxTaskPriorityGet 1
#define INCLUDE_vTaskDelete 1
#define INCLUDE_vTaskCleanUpResources 1
#define INCLUDE_vTaskSuspend 1
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_eTaskGetState 1
#define INCLUDE_xTimerPendFunctionCall 1
/* Cortex-M specific definitions. */
#ifdef __NVIC_PRIO_BITS
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
#define configPRIO_BITS __NVIC_PRIO_BITS
#else
#define configPRIO_BITS 3 /* 7 priority levels */
#endif
/* The lowest interrupt priority that can be used in a call to a "set priority"
function. */
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x07
/* The highest interrupt priority that can be used by any interrupt service
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 4
/* Interrupt priorities used by the kernel port layer itself. These are generic
to all Cortex-M ports, and do not rely on any particular library functions. */
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
standard names. */
#define xPortPendSVHandler PendSV_Handler
#define vPortSVCHandler SVC_Handler
#define xPortSysTickHandler SysTick_Handler
#endif /* FREERTOS_CONFIG_H */

View File

@ -0,0 +1,204 @@
/*
FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
/*
* This file initialises three timers as follows:
*
* TC0 channels 0 and 1 provide the interrupts that are used with the IntQ
* standard demo tasks, which test interrupt nesting and using queues from
* interrupts. As the interrupt is shared the nesting achieved is not as deep
* as normal when this test is executed, but still worth while.
*
* TC2 channel 0 provides a much higher frequency timer that tests the nesting
* of interrupts that don't use the FreeRTOS API. For convenience, the high
* frequency timer also keeps a count of the number of time it executes, and the
* count is used as the time base for the run time stats (which can be viewed
* through the CLI).
*
* All the timers can nest with the tick interrupt - creating a maximum
* interrupt nesting depth of 3 (normally 4, if the first two timers used
* separate interrupts).
*
*/
/* Scheduler includes. */
#include "FreeRTOS.h"
/* Demo includes. */
#include "IntQueueTimer.h"
#include "IntQueue.h"
/* Library includes. */
#include "board.h"
/* The frequencies at which the first two timers expire are slightly offset to
ensure they don't remain synchronised. The frequency of the highest priority
interrupt is 20 times faster so really hammers the interrupt entry and exit
code. */
#define tmrTIMER_0_FREQUENCY ( 2000UL )
#define tmrTIMER_1_FREQUENCY ( 2003UL )
#define tmrTIMER_2_FREQUENCY ( 20000UL )
/* The channels used in TC0 for generating the three interrupts. */
#define tmrTC0_CHANNEL_0 0 /* At tmrTIMER_0_FREQUENCY */
#define tmrTC0_CHANNEL_1 1 /* At tmrTIMER_1_FREQUENCY */
#define tmrTC1_CHANNEL_0 0 /* At tmrTIMER_2_FREQUENCY */
/* The bit within the RC_SR register that indicates an RC compare. */
#define tmrRC_COMPARE ( 1UL << 4UL )
/* The high frequency interrupt given a priority above the maximum at which
interrupt safe FreeRTOS calls can be made. The priority of the lower frequency
timers must still be above the tick interrupt priority. */
#define tmrLOWER_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY
#define tmrHIGHER_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY - 1
/*-----------------------------------------------------------*/
/* For convenience the high frequency timer increments a variable that is then
used as the time base for the run time stats. */
volatile uint32_t ulHighFrequencyTimerCounts = 0;
/*-----------------------------------------------------------*/
void vInitialiseTimerForIntQueueTest( void )
{
const uint32_t ulDivider = 128UL, ulTCCLKS = 3UL;
/* Enable the TC clocks. */
PMC_EnablePeripheral( ID_TC0 );
PMC_EnablePeripheral( ID_TC1 );
/* Configure TC0 channel 0 for a tmrTIMER_0_FREQUENCY frequency and trigger
on RC compare. This is part of the IntQTimer test. */
TC_Configure( TC0, tmrTC0_CHANNEL_0, ulTCCLKS | TC_CMR_CPCTRG );
TC0->TC_CHANNEL[ tmrTC0_CHANNEL_0 ].TC_RC = ( configCPU_CLOCK_HZ / 2 ) / ( tmrTIMER_0_FREQUENCY * ulDivider );
TC0->TC_CHANNEL[ tmrTC0_CHANNEL_0 ].TC_IER = TC_IER_CPCS;
/* Configure TC0 channel 1 for a tmrTIMER_1_FREQUENCY frequency and trigger
on RC compare. This is part of the IntQTimer test. */
TC_Configure( TC0, tmrTC0_CHANNEL_1, ulTCCLKS | TC_CMR_CPCTRG );
TC0->TC_CHANNEL[ tmrTC0_CHANNEL_1 ].TC_RC = ( configCPU_CLOCK_HZ / 2 ) / ( tmrTIMER_1_FREQUENCY * ulDivider );
TC0->TC_CHANNEL[ tmrTC0_CHANNEL_1 ].TC_IER = TC_IER_CPCS;
/* Configure and enable TC0 interrupt on RC compare. */
NVIC_SetPriority( TC0_IRQn, tmrLOWER_PRIORITY );
NVIC_ClearPendingIRQ( TC0_IRQn );
NVIC_EnableIRQ( TC0_IRQn );
/* Configure TC1 channel 0 tmrTIMER_2_FREQUENCY frequency and trigger on
RC compare. This is the very high frequency timer. */
TC_Configure( TC1, tmrTC1_CHANNEL_0, ulTCCLKS | TC_CMR_CPCTRG );
TC1->TC_CHANNEL[ tmrTC1_CHANNEL_0 ].TC_RC = ( configCPU_CLOCK_HZ / 2 ) / ( tmrTIMER_2_FREQUENCY * ulDivider );
TC1->TC_CHANNEL[ tmrTC1_CHANNEL_0 ].TC_IER = TC_IER_CPCS;
/* Configure and enable TC1 interrupt on RC compare */
// NVIC_SetPriority( TC1_IRQn, tmrHIGHER_PRIORITY );
// NVIC_ClearPendingIRQ( TC1_IRQn );
// NVIC_EnableIRQ( TC1_IRQn );
TC_Start( TC0, tmrTC0_CHANNEL_0 );
TC_Start( TC0, tmrTC0_CHANNEL_1 );
// TC_Start( TC1, tmrTC1_CHANNEL_0 );
}
/*-----------------------------------------------------------*/
void TC0_Handler( void )
{
/* Read will clear the status bit. */
if( ( TC0->TC_CHANNEL[ tmrTC0_CHANNEL_0 ].TC_SR & tmrRC_COMPARE ) != 0 )
{
/* Call the IntQ test function for this channel. */
portYIELD_FROM_ISR( xFirstTimerHandler() );
}
if( ( TC0->TC_CHANNEL[ tmrTC0_CHANNEL_1 ].TC_SR & tmrRC_COMPARE ) != 0 )
{
/* Call the IntQ test function for this channel. */
portYIELD_FROM_ISR( xSecondTimerHandler() );
}
}
/*-----------------------------------------------------------*/
void TC1_Handler( void )
{
volatile uint32_t ulDummy;
/* Dummy read to clear status bit. */
ulDummy = TC1->TC_CHANNEL[ tmrTC1_CHANNEL_0 ].TC_SR;
NVIC_ClearPendingIRQ( TC1_IRQn );
/* Keep a count of the number of interrupts to use as a time base for the
run-time stats. */
ulHighFrequencyTimerCounts++;
/* Prevent compiler warnings about the variable being set but then
unused. */
( void ) ulDummy;
}

View File

@ -0,0 +1,78 @@
/*
FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
#ifndef INT_QUEUE_TIMER_H
#define INT_QUEUE_TIMER_H
void vInitialiseTimerForIntQueueTest( void );
BaseType_t xTimer0Handler( void );
BaseType_t xTimer1Handler( void );
#endif

View File

@ -0,0 +1,457 @@
/*
FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
/*
* "Reg test" tasks - These fill the registers with known values, then check
* that each register maintains its expected value for the lifetime of the
* task. Each task uses a different set of values. The reg test tasks execute
* with a very low priority, so get preempted very frequently. A register
* containing an unexpected value is indicative of an error in the context
* switching mechanism.
*/
void vRegTest1Implementation( void ) __attribute__ ((naked));
void vRegTest2Implementation( void ) __attribute__ ((naked));
void vRegTest1Implementation( void )
{
__asm volatile
(
".extern ulRegTest1LoopCounter \n"
"/* Fill the core registers with known values. */ \n"
"mov r0, #100 \n"
"mov r1, #101 \n"
"mov r2, #102 \n"
"mov r3, #103 \n"
"mov r4, #104 \n"
"mov r5, #105 \n"
"mov r6, #106 \n"
"mov r7, #107 \n"
"mov r8, #108 \n"
"mov r9, #109 \n"
"mov r10, #110 \n"
"mov r11, #111 \n"
"mov r12, #112 \n"
"/* Fill the VFP registers with known values. */ \n"
"vmov d0, r0, r1 \n"
"vmov d1, r2, r3 \n"
"vmov d2, r4, r5 \n"
"vmov d3, r6, r7 \n"
"vmov d4, r8, r9 \n"
"vmov d5, r10, r11 \n"
"vmov d6, r0, r1 \n"
"vmov d7, r2, r3 \n"
"vmov d8, r4, r5 \n"
"vmov d9, r6, r7 \n"
"vmov d10, r8, r9 \n"
"vmov d11, r10, r11 \n"
"vmov d12, r0, r1 \n"
"vmov d13, r2, r3 \n"
"vmov d14, r4, r5 \n"
"vmov d15, r6, r7 \n"
"reg1_loop: \n"
"/* Check all the VFP registers still contain the values set above. \n"
"First save registers that are clobbered by the test. */ \n"
"push { r0-r1 } \n"
"vmov r0, r1, d0 \n"
"cmp r0, #100 \n"
"bne reg1_error_loopf \n"
"cmp r1, #101 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d1 \n"
"cmp r0, #102 \n"
"bne reg1_error_loopf \n"
"cmp r1, #103 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d2 \n"
"cmp r0, #104 \n"
"bne reg1_error_loopf \n"
"cmp r1, #105 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d3 \n"
"cmp r0, #106 \n"
"bne reg1_error_loopf \n"
"cmp r1, #107 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d4 \n"
"cmp r0, #108 \n"
"bne reg1_error_loopf \n"
"cmp r1, #109 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d5 \n"
"cmp r0, #110 \n"
"bne reg1_error_loopf \n"
"cmp r1, #111 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d6 \n"
"cmp r0, #100 \n"
"bne reg1_error_loopf \n"
"cmp r1, #101 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d7 \n"
"cmp r0, #102 \n"
"bne reg1_error_loopf \n"
"cmp r1, #103 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d8 \n"
"cmp r0, #104 \n"
"bne reg1_error_loopf \n"
"cmp r1, #105 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d9 \n"
"cmp r0, #106 \n"
"bne reg1_error_loopf \n"
"cmp r1, #107 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d10 \n"
"cmp r0, #108 \n"
"bne reg1_error_loopf \n"
"cmp r1, #109 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d11 \n"
"cmp r0, #110 \n"
"bne reg1_error_loopf \n"
"cmp r1, #111 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d12 \n"
"cmp r0, #100 \n"
"bne reg1_error_loopf \n"
"cmp r1, #101 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d13 \n"
"cmp r0, #102 \n"
"bne reg1_error_loopf \n"
"cmp r1, #103 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d14 \n"
"cmp r0, #104 \n"
"bne reg1_error_loopf \n"
"cmp r1, #105 \n"
"bne reg1_error_loopf \n"
"vmov r0, r1, d15 \n"
"cmp r0, #106 \n"
"bne reg1_error_loopf \n"
"cmp r1, #107 \n"
"bne reg1_error_loopf \n"
"/* Restore the registers that were clobbered by the test. */ \n"
"pop {r0-r1} \n"
"/* VFP register test passed. Jump to the core register test. */ \n"
"b reg1_loopf_pass \n"
"reg1_error_loopf: \n"
"/* If this line is hit then a VFP register value was found to be incorrect. */ \n"
"b reg1_error_loopf \n"
"reg1_loopf_pass: \n"
"cmp r0, #100 \n"
"bne reg1_error_loop \n"
"cmp r1, #101 \n"
"bne reg1_error_loop \n"
"cmp r2, #102 \n"
"bne reg1_error_loop \n"
"cmp r3, #103 \n"
"bne reg1_error_loop \n"
"cmp r4, #104 \n"
"bne reg1_error_loop \n"
"cmp r5, #105 \n"
"bne reg1_error_loop \n"
"cmp r6, #106 \n"
"bne reg1_error_loop \n"
"cmp r7, #107 \n"
"bne reg1_error_loop \n"
"cmp r8, #108 \n"
"bne reg1_error_loop \n"
"cmp r9, #109 \n"
"bne reg1_error_loop \n"
"cmp r10, #110 \n"
"bne reg1_error_loop \n"
"cmp r11, #111 \n"
"bne reg1_error_loop \n"
"cmp r12, #112 \n"
"bne reg1_error_loop \n"
"/* Everything passed, increment the loop counter. */ \n"
"push { r0-r1 } \n"
"ldr r0, =ulRegTest1LoopCounter \n"
"ldr r1, [r0] \n"
"adds r1, r1, #1 \n"
"str r1, [r0] \n"
"pop { r0-r1 } \n"
"/* Start again. */ \n"
"b reg1_loop \n"
"reg1_error_loop: \n"
"/* If this line is hit then there was an error in a core register value. \n"
"The loop ensures the loop counter stops incrementing. */ \n"
"b reg1_error_loop \n"
"nop "
); /* __asm volatile. */
}
/*-----------------------------------------------------------*/
void vRegTest2Implementation( void )
{
__asm volatile
(
".extern ulRegTest2LoopCounter \n"
"/* Set all the core registers to known values. */ \n"
"mov r0, #-1 \n"
"mov r1, #1 \n"
"mov r2, #2 \n"
"mov r3, #3 \n"
"mov r4, #4 \n"
"mov r5, #5 \n"
"mov r6, #6 \n"
"mov r7, #7 \n"
"mov r8, #8 \n"
"mov r9, #9 \n"
"mov r10, #10 \n"
"mov r11, #11 \n"
"mov r12, #12 \n"
"/* Set all the VFP to known values. */ \n"
"vmov d0, r0, r1 \n"
"vmov d1, r2, r3 \n"
"vmov d2, r4, r5 \n"
"vmov d3, r6, r7 \n"
"vmov d4, r8, r9 \n"
"vmov d5, r10, r11 \n"
"vmov d6, r0, r1 \n"
"vmov d7, r2, r3 \n"
"vmov d8, r4, r5 \n"
"vmov d9, r6, r7 \n"
"vmov d10, r8, r9 \n"
"vmov d11, r10, r11 \n"
"vmov d12, r0, r1 \n"
"vmov d13, r2, r3 \n"
"vmov d14, r4, r5 \n"
"vmov d15, r6, r7 \n"
"reg2_loop: \n"
"/* Check all the VFP registers still contain the values set above. \n"
"First save registers that are clobbered by the test. */ \n"
"push { r0-r1 } \n"
"vmov r0, r1, d0 \n"
"cmp r0, #-1 \n"
"bne reg2_error_loopf \n"
"cmp r1, #1 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d1 \n"
"cmp r0, #2 \n"
"bne reg2_error_loopf \n"
"cmp r1, #3 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d2 \n"
"cmp r0, #4 \n"
"bne reg2_error_loopf \n"
"cmp r1, #5 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d3 \n"
"cmp r0, #6 \n"
"bne reg2_error_loopf \n"
"cmp r1, #7 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d4 \n"
"cmp r0, #8 \n"
"bne reg2_error_loopf \n"
"cmp r1, #9 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d5 \n"
"cmp r0, #10 \n"
"bne reg2_error_loopf \n"
"cmp r1, #11 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d6 \n"
"cmp r0, #-1 \n"
"bne reg2_error_loopf \n"
"cmp r1, #1 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d7 \n"
"cmp r0, #2 \n"
"bne reg2_error_loopf \n"
"cmp r1, #3 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d8 \n"
"cmp r0, #4 \n"
"bne reg2_error_loopf \n"
"cmp r1, #5 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d9 \n"
"cmp r0, #6 \n"
"bne reg2_error_loopf \n"
"cmp r1, #7 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d10 \n"
"cmp r0, #8 \n"
"bne reg2_error_loopf \n"
"cmp r1, #9 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d11 \n"
"cmp r0, #10 \n"
"bne reg2_error_loopf \n"
"cmp r1, #11 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d12 \n"
"cmp r0, #-1 \n"
"bne reg2_error_loopf \n"
"cmp r1, #1 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d13 \n"
"cmp r0, #2 \n"
"bne reg2_error_loopf \n"
"cmp r1, #3 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d14 \n"
"cmp r0, #4 \n"
"bne reg2_error_loopf \n"
"cmp r1, #5 \n"
"bne reg2_error_loopf \n"
"vmov r0, r1, d15 \n"
"cmp r0, #6 \n"
"bne reg2_error_loopf \n"
"cmp r1, #7 \n"
"bne reg2_error_loopf \n"
"/* Restore the registers that were clobbered by the test. */ \n"
"pop {r0-r1} \n"
"/* VFP register test passed. Jump to the core register test. */ \n"
"b reg2_loopf_pass \n"
"reg2_error_loopf: \n"
"/* If this line is hit then a VFP register value was found to be \n"
"incorrect. */ \n"
"b reg2_error_loopf \n"
"reg2_loopf_pass: \n"
"cmp r0, #-1 \n"
"bne reg2_error_loop \n"
"cmp r1, #1 \n"
"bne reg2_error_loop \n"
"cmp r2, #2 \n"
"bne reg2_error_loop \n"
"cmp r3, #3 \n"
"bne reg2_error_loop \n"
"cmp r4, #4 \n"
"bne reg2_error_loop \n"
"cmp r5, #5 \n"
"bne reg2_error_loop \n"
"cmp r6, #6 \n"
"bne reg2_error_loop \n"
"cmp r7, #7 \n"
"bne reg2_error_loop \n"
"cmp r8, #8 \n"
"bne reg2_error_loop \n"
"cmp r9, #9 \n"
"bne reg2_error_loop \n"
"cmp r10, #10 \n"
"bne reg2_error_loop \n"
"cmp r11, #11 \n"
"bne reg2_error_loop \n"
"cmp r12, #12 \n"
"bne reg2_error_loop \n"
"/* Increment the loop counter to indicate this test is still functioning \n"
"correctly. */ \n"
"push { r0-r1 } \n"
"ldr r0, =ulRegTest2LoopCounter \n"
"ldr r1, [r0] \n"
"adds r1, r1, #1 \n"
"str r1, [r0] \n"
"/* Yield to increase test coverage. */ \n"
"movs r0, #0x01 \n"
"ldr r1, =0xe000ed04 /*NVIC_INT_CTRL */ \n"
"lsl r0, r0, #28 /* Shift to PendSV bit */ \n"
"str r0, [r1] \n"
"dsb \n"
"pop { r0-r1 } \n"
"/* Start again. */ \n"
"b reg2_loop \n"
"reg2_error_loop: \n"
"/* If this line is hit then there was an error in a core register value. \n"
"This loop ensures the loop counter variable stops incrementing. */ \n"
"b reg2_error_loop \n"
); /* __asm volatile */
}
/*-----------------------------------------------------------*/

View File

@ -0,0 +1,432 @@
/*
FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
***************************************************************************
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
***************************************************************************
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available on the following
link: http://www.freertos.org/a00114.html
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that is more than just the market leader, it *
* is the industry's de facto standard. *
* *
* Help yourself get started quickly while simultaneously helping *
* to support the FreeRTOS project by purchasing a FreeRTOS *
* tutorial book, reference manual, or both: *
* http://www.FreeRTOS.org/Documentation *
* *
***************************************************************************
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
the FAQ page "My application does not run, what could be wrong?". Have you
defined configASSERT()?
http://www.FreeRTOS.org/support - In return for receiving this top quality
embedded software for free we request you assist our global community by
participating in the support forum.
http://www.FreeRTOS.org/training - Investing in training allows your team to
be as productive as possible as early as possible. Now you can receive
FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
Ltd, and the world's leading authority on the world's leading RTOS.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and commercial middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
/******************************************************************************
* NOTE 1: This project provides two demo applications. A simple blinky style
* project, and a more comprehensive test and demo application. The
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
* between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
* in main.c. This file implements the comprehensive test and demo version.
*
* NOTE 2: This file only contains the source code that is specific to the
* full demo. Generic functions, such FreeRTOS hook functions, and functions
* required to configure the hardware, are defined in main.c.
*
******************************************************************************
*
* main_full() creates all the demo application tasks and software timers, then
* starts the scheduler. The web documentation provides more details of the
* standard demo application tasks, which provide no particular functionality,
* but do provide a good example of how to use the FreeRTOS API.
*
* In addition to the standard demo tasks, the following tasks and tests are
* defined and/or created within this file:
*
* "Reg test" tasks - These fill both the core and floating point registers with
* known values, then check that each register maintains its expected value for
* the lifetime of the task. Each task uses a different set of values. The reg
* test tasks execute with a very low priority, so get preempted very
* frequently. A register containing an unexpected value is indicative of an
* error in the context switching mechanism.
*
* "Check" task - The check task period is initially set to three seconds. The
* task checks that all the standard demo tasks, and the register check tasks,
* are not only still executing, but are executing without reporting any errors.
* If the check task discovers that a task has either stalled, or reported an
* error, then it changes its own execution period from the initial three
* seconds, to just 200ms. The check task also toggles an LED each time it is
* called. This provides a visual indication of the system status: If the LED
* toggles every three seconds, then no issues have been discovered. If the LED
* toggles every 200ms, then an issue has been discovered with at least one
* task.
*/
/* Standard includes. */
#include <stdio.h>
/* Kernel includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "semphr.h"
/* Standard demo application includes. */
#include "flop.h"
#include "semtest.h"
#include "dynamic.h"
#include "BlockQ.h"
#include "blocktim.h"
#include "countsem.h"
#include "GenQTest.h"
#include "recmutex.h"
#include "death.h"
#include "partest.h"
#include "comtest2.h"
#include "serial.h"
#include "TimerDemo.h"
#include "QueueOverwrite.h"
#include "IntQueue.h"
#include "EventGroupsDemo.h"
#include "IntSemTest.h"
#include "TaskNotify.h"
/* Priorities for the demo application tasks. */
#define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1UL )
#define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2UL )
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainCDC_COMMAND_CONSOLE_STACK_SIZE ( configMINIMAL_STACK_SIZE * 2UL )
#define mainCOM_TEST_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
/* The initial priority used by the UART command console task. */
#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
/* The LED used by the check timer. */
#define mainCHECK_LED ( 0 )
/* A block time of zero simply means "don't block". */
#define mainDONT_BLOCK ( 0UL )
/* The period after which the check timer will expire, in ms, provided no errors
have been reported by any of the standard demo tasks. ms are converted to the
equivalent in ticks using the portTICK_PERIOD_MS constant. */
#define mainNO_ERROR_CHECK_TASK_PERIOD ( 3000UL / portTICK_PERIOD_MS )
/* The period at which the check timer will expire, in ms, if an error has been
reported in one of the standard demo tasks. ms are converted to the equivalent
in ticks using the portTICK_PERIOD_MS constant. */
#define mainERROR_CHECK_TASK_PERIOD ( 200UL / portTICK_PERIOD_MS )
/* Parameters that are passed into the register check tasks solely for the
purpose of ensuring parameters are passed into tasks correctly. */
#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )
#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )
/* The base period used by the timer test tasks. */
#define mainTIMER_TEST_PERIOD ( 50 )
/*-----------------------------------------------------------*/
/*
* Called by main() to run the full demo (as opposed to the blinky demo) when
* mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
*/
void main_full( void );
/*
* The check task, as described at the top of this file.
*/
static void prvCheckTask( void *pvParameters );
/*
* Register check tasks, and the tasks used to write over and check the contents
* of the FPU registers, as described at the top of this file. The nature of
* these files necessitates that they are written in an assembly file, but the
* entry points are kept in the C file for the convenience of checking the task
* parameter.
*/
static void prvRegTestTaskEntry1( void *pvParameters );
extern void vRegTest1Implementation( void );
static void prvRegTestTaskEntry2( void *pvParameters );
extern void vRegTest2Implementation( void );
/*-----------------------------------------------------------*/
/* The following two variables are used to communicate the status of the
register check tasks to the check task. If the variables keep incrementing,
then the register check tasks have not discovered any errors. If a variable
stops incrementing, then an error has been found. */
volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;
/*-----------------------------------------------------------*/
void main_full( void )
{
/* Start all the other standard demo/test tasks. They have no particular
functionality, but do demonstrate how to use the FreeRTOS API and test the
kernel port. */
vStartInterruptQueueTasks();
vStartDynamicPriorityTasks();
vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
vCreateBlockTimeTasks();
vStartCountingSemaphoreTasks();
vStartGenericQueueTasks( tskIDLE_PRIORITY );
vStartRecursiveMutexTasks();
vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
vStartMathTasks( mainFLOP_TASK_PRIORITY );
vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
vStartEventGroupTasks();
vStartInterruptSemaphoreTasks();
vStartTaskNotifyTask();
/* Create the register check tasks, as described at the top of this file */
xTaskCreate( prvRegTestTaskEntry1, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );
xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );
/* Create the task that performs the 'check' functionality, as described at
the top of this file. */
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
/* The set of tasks created by the following function call have to be
created last as they keep account of the number of tasks they expect to see
running. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
/* Start the scheduler. */
vTaskStartScheduler();
/* If all is well, the scheduler will now be running, and the following
line will never be reached. If the following line does execute, then
there was either insufficient FreeRTOS heap memory available for the idle
and/or timer tasks to be created, or vTaskStartScheduler() was called from
User mode. See the memory management section on the FreeRTOS web site for
more details on the FreeRTOS heap http://www.freertos.org/a00111.html. The
mode from which main() is called is set in the C start up code and must be
a privileged mode (not user mode). */
for( ;; );
}
/*-----------------------------------------------------------*/
static void prvCheckTask( void *pvParameters )
{
TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;
TickType_t xLastExecutionTime;
static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0;
unsigned long ulErrorFound = pdFALSE;
/* Just to stop compiler warnings. */
( void ) pvParameters;
/* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
works correctly. */
xLastExecutionTime = xTaskGetTickCount();
/* Cycle for ever, delaying then checking all the other tasks are still
operating without error. The onboard LED is toggled on each iteration.
If an error is detected then the delay period is decreased from
mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the
effect of increasing the rate at which the onboard LED toggles, and in so
doing gives visual feedback of the system status. */
for( ;; )
{
/* Delay until it is time to execute again. */
vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
/* Check all the demo tasks (other than the flash tasks) to ensure
that they are all still running, and that none have detected an error. */
if( xAreIntQueueTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 0UL;
}
if( xAreMathsTaskStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 1UL;
}
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 2UL;
}
if( xAreBlockingQueuesStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 3UL;
}
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 4UL;
}
if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 5UL;
}
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 6UL;
}
if( xIsCreateTaskStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 7UL;
}
if( xAreSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 8UL;
}
if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) != pdPASS )
{
ulErrorFound = 1UL << 9UL;
}
if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
{
ulErrorFound = 1UL << 10UL;
}
if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
{
ulErrorFound = 1UL << 11UL;
}
if( xAreEventGroupTasksStillRunning() != pdPASS )
{
ulErrorFound = 1UL << 12UL;
}
if( xAreInterruptSemaphoreTasksStillRunning() != pdPASS )
{
ulErrorFound = 1UL << 13UL;
}
if( xAreTaskNotificationTasksStillRunning() != pdPASS )
{
ulErrorFound = 1UL << 14UL;
}
/* Check that the register test 1 task is still running. */
if( ulLastRegTest1Value == ulRegTest1LoopCounter )
{
ulErrorFound = 1UL << 15UL;
}
ulLastRegTest1Value = ulRegTest1LoopCounter;
/* Check that the register test 2 task is still running. */
if( ulLastRegTest2Value == ulRegTest2LoopCounter )
{
ulErrorFound = 1UL << 16UL;
}
ulLastRegTest2Value = ulRegTest2LoopCounter;
/* Toggle the check LED to give an indication of the system status. If
the LED toggles every mainNO_ERROR_CHECK_TASK_PERIOD milliseconds then
everything is ok. A faster toggle indicates an error. */
LED_Toggle( mainCHECK_LED );
if( ulErrorFound != pdFALSE )
{
/* An error has been detected in one of the tasks - flash the LED
at a higher frequency to give visible feedback that something has
gone wrong (it might just be that the loop back connector required
by the comtest tasks has not been fitted). */
xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;
}
}
}
/*-----------------------------------------------------------*/
static void prvRegTestTaskEntry1( void *pvParameters )
{
/* Although the regtest task is written in assembler, its entry point is
written in C for convenience of checking the task parameter is being passed
in correctly. */
if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )
{
/* Start the part of the test that is written in assembler. */
vRegTest1Implementation();
}
/* The following line will only execute if the task parameter is found to
be incorrect. The check timer will detect that the regtest loop counter is
not being incremented and flag an error. */
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/
static void prvRegTestTaskEntry2( void *pvParameters )
{
/* Although the regtest task is written in assembler, its entry point is
written in C for convenience of checking the task parameter is being passed
in correctly. */
if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )
{
/* Start the part of the test that is written in assembler. */
vRegTest2Implementation();
}
/* The following line will only execute if the task parameter is found to
be incorrect. The check timer will detect that the regtest loop counter is
not being incremented and flag an error. */
vTaskDelete( NULL );
}
/*-----------------------------------------------------------*/

View File

@ -0,0 +1,139 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/* Section Definitions */
SECTIONS
{
.text :
{
. = ALIGN(4);
_sfixed = .;
KEEP(*(.vectors .vectors.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
*(.ARM.extab* .gnu.linkonce.armextab.*)
/* Support C constructors, and C destructors in both user code
and the C library. This also provides support for C++ code. */
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
. = ALIGN(0x4);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
. = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
. = ALIGN(4);
_efixed = .; /* End of text section */
} > rom
/* .ARM.exidx is sorted, so has to go in its own output section. */
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > rom
PROVIDE_HIDDEN (__exidx_end = .);
. = ALIGN(4);
_etext = .;
.relocate : AT (_etext)
{
. = ALIGN(4);
_srelocate = .;
*(.ramfunc .ramfunc.*);
*(.data .data.*);
. = ALIGN(4);
_erelocate = .;
} > ram
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
. = ALIGN(4);
_sbss = . ;
_szero = .;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
_ezero = .;
} > ram
/* stack section */
.stack (NOLOAD):
{
. = ALIGN(8);
_sstack = .;
. = . + STACK_SIZE;
. = ALIGN(8);
_estack = .;
} > ram
/* heap section */
.heap (NOLOAD):
{
. = ALIGN(8);
_sheap = .;
. = . + HEAP_SIZE;
. = ALIGN(8);
_eheap = .;
} > ram
. = ALIGN(4);
_end = . ;
_ram_end_ = ORIGIN(ram) + LENGTH(ram) -1 ;
}

View File

@ -0,0 +1,10 @@
SECTIONS
{
_sdram_lma = .;
sdram_region :
AT ( _sdram_lma )
{
*(sdram_region)
} >sdram
}

View File

@ -0,0 +1,139 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/* Section Definitions */
SECTIONS
{
.text :
{
. = ALIGN(4);
_sfixed = .;
KEEP(*(.vectors .vectors.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
*(.ARM.extab* .gnu.linkonce.armextab.*)
/* Support C constructors, and C destructors in both user code
and the C library. This also provides support for C++ code. */
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
. = ALIGN(0x4);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
. = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
. = ALIGN(4);
_efixed = .; /* End of text section */
} > ram
. = ALIGN(8);
_etext = .;
.relocate : AT (_etext)
{
. = ALIGN(8);
_srelocate = .;
*(.ramfunc .ramfunc.*);
*(.data .data.*);
. = ALIGN(4);
_erelocate = .;
} > ram
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
. = ALIGN(4);
_sbss = . ;
_szero = .;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
_ezero = .;
} > ram
/* stack section */
.stack (NOLOAD):
{
. = ALIGN(8);
_sstack = .;
. = . + STACK_SIZE;
. = ALIGN(8);
_estack = .;
} > ram
/* heap section */
.heap (NOLOAD):
{
. = ALIGN(8);
_sheap = .;
. = . + HEAP_SIZE;
. = ALIGN(8);
_eheap = .;
} > ram
/* .ARM.exidx is sorted, so has to go in its own output section. */
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > ram
PROVIDE_HIDDEN (__exidx_end = .);
. = ALIGN(4);
_end = . ;
_ram_end_ = ORIGIN(ram) + LENGTH(ram) -1 ;
}

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71Q21
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE ../LinkerScripts/sam_flash.ld
INCLUDE ../LinkerScripts/sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71Q21
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Atmel Studio Solution File, Format Version 11.00
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "RTOSDemo", "RTOSDemo.cproj", "{C9E51A8C-F289-47EA-9002-C417C1EEC9DA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM = Debug|ARM
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C9E51A8C-F289-47EA-9002-C417C1EEC9DA}.Debug|ARM.ActiveCfg = Debug|ARM
{C9E51A8C-F289-47EA-9002-C417C1EEC9DA}.Debug|ARM.Build.0 = Debug|ARM
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,307 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProjectVersion>6.2</ProjectVersion>
<ToolchainName>com.Atmel.ARMGCC.C</ToolchainName>
<ProjectGuid>{c9e51a8c-f289-47ea-9002-c417c1eec9da}</ProjectGuid>
<avrdevice>ATSAMV71Q21</avrdevice>
<avrdeviceseries>none</avrdeviceseries>
<OutputType>Executable</OutputType>
<Language>C</Language>
<OutputFileName>$(MSBuildProjectName)</OutputFileName>
<OutputFileExtension>.elf</OutputFileExtension>
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
<AssemblyName>RTOSDemo</AssemblyName>
<Name>RTOSDemo</Name>
<RootNamespace>RTOSDemo</RootNamespace>
<ToolchainFlavour>Native</ToolchainFlavour>
<KeepTimersRunning>true</KeepTimersRunning>
<OverrideVtor>false</OverrideVtor>
<CacheFlash>true</CacheFlash>
<ProgFlashFromRam>true</ProgFlashFromRam>
<RamSnippetAddress>0x20000000</RamSnippetAddress>
<UncachedRange />
<preserveEEPROM>true</preserveEEPROM>
<OverrideVtorValue>exception_table</OverrideVtorValue>
<BootSegment>2</BootSegment>
<eraseonlaunchrule>1</eraseonlaunchrule>
<AsfFrameworkConfig>
<framework-data xmlns="">
<options />
<configurations />
<files />
<documentation help="" />
<offline-documentation help="" />
<dependencies>
<content-extension eid="atmel.asf" uuidref="Atmel.ASF" version="3.21.0" />
</dependencies>
</framework-data>
</AsfFrameworkConfig>
<avrtool>com.atmel.avrdbg.tool.samice</avrtool>
<avrtoolinterface>SWD</avrtoolinterface>
<com_atmel_avrdbg_tool_edbg>
<ToolOptions>
<InterfaceProperties>
<SwdClock>2000000</SwdClock>
</InterfaceProperties>
<InterfaceName>SWD</InterfaceName>
</ToolOptions>
<ToolType>com.atmel.avrdbg.tool.edbg</ToolType>
<ToolNumber>ATML2407080200001813</ToolNumber>
<ToolName>EDBG</ToolName>
</com_atmel_avrdbg_tool_edbg>
<com_atmel_avrdbg_tool_samice>
<ToolOptions>
<InterfaceProperties>
<SwdClock>4000000</SwdClock>
</InterfaceProperties>
<InterfaceName>SWD</InterfaceName>
<JlinkConfigFile>C:\E\Dev\FreeRTOS\WorkingCopy\FreeRTOS\Demo\CORTEX_M7_SAMV71_Xplained_AtmelStudio\jlink.config</JlinkConfigFile>
</ToolOptions>
<ToolType>com.atmel.avrdbg.tool.samice</ToolType>
<ToolNumber>59101789</ToolNumber>
<ToolName>J-Link</ToolName>
</com_atmel_avrdbg_tool_samice>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<ToolchainSettings>
<ArmGcc>
<armgcc.common.outputfiles.hex>True</armgcc.common.outputfiles.hex>
<armgcc.common.outputfiles.lss>True</armgcc.common.outputfiles.lss>
<armgcc.common.outputfiles.eep>True</armgcc.common.outputfiles.eep>
<armgcc.common.outputfiles.bin>True</armgcc.common.outputfiles.bin>
<armgcc.common.outputfiles.srec>True</armgcc.common.outputfiles.srec>
<armgcc.compiler.general.ChangeDefaultCharTypeUnsigned>True</armgcc.compiler.general.ChangeDefaultCharTypeUnsigned>
<armgcc.compiler.symbols.DefSymbols>
<ListValues>
<Value>flash</Value>
<Value>TRACE_LEVEL=4</Value>
</ListValues>
</armgcc.compiler.symbols.DefSymbols>
<armgcc.compiler.directories.IncludePaths>
<ListValues>
<Value>../libchip_samv7/include/cmsis/CMSIS/Include</Value>
<Value>../libchip_samv7/include/samv7</Value>
<Value>../libboard_samv7-ek</Value>
<Value>../libchip_samv7</Value>
<Value>../../../Source/include</Value>
<Value>../../../Source/portable/GCC/ARM_CM7/r0p1</Value>
<Value>../../Common/include</Value>
<Value>../Full_Demo</Value>
<Value>..</Value>
<Value>%24(ToolchainDir)\..\..\CMSIS_Atmel\Device\ATMEL\samv71\include</Value>
<Value>%24(ToolchainDir)\..\..\CMSIS_Atmel</Value>
<Value>%24(ToolchainDir)\..\..\CMSIS_Atmel\CMSIS\Include</Value>
<Value>%24(ToolchainDir)\..\..\CMSIS_Atmel\Device\ATMEL</Value>
</ListValues>
</armgcc.compiler.directories.IncludePaths>
<armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</armgcc.compiler.optimization.PrepareFunctionsForGarbageCollection>
<armgcc.compiler.optimization.DebugLevel>Maximum (-g3)</armgcc.compiler.optimization.DebugLevel>
<armgcc.compiler.warnings.AllWarnings>True</armgcc.compiler.warnings.AllWarnings>
<armgcc.compiler.warnings.ExtraWarnings>True</armgcc.compiler.warnings.ExtraWarnings>
<armgcc.compiler.miscellaneous.OtherFlags>-std=gnu99 -mfpu=fpv4-sp-d16 -mfloat-abi=softfp</armgcc.compiler.miscellaneous.OtherFlags>
<armgcc.linker.optimization.GarbageCollectUnusedSections>True</armgcc.linker.optimization.GarbageCollectUnusedSections>
<armgcc.linker.memorysettings.ExternalRAM />
<armgcc.linker.miscellaneous.LinkerFlags>-T../LinkerScripts/samv71q21_flash.ld</armgcc.linker.miscellaneous.LinkerFlags>
<armgcc.assembler.debugging.DebugLevel>Default (-g)</armgcc.assembler.debugging.DebugLevel>
<armgcc.preprocessingassembler.general.IncludePaths>
<ListValues>
<Value>%24(ToolchainDir)\..\..\CMSIS_Atmel\Device\ATMEL\samv71\include</Value>
<Value>%24(ToolchainDir)\..\..\CMSIS_Atmel</Value>
<Value>%24(ToolchainDir)\..\..\CMSIS_Atmel\CMSIS\Include</Value>
<Value>%24(ToolchainDir)\..\..\CMSIS_Atmel\Device\ATMEL</Value>
</ListValues>
</armgcc.preprocessingassembler.general.IncludePaths>
<armgcc.preprocessingassembler.debugging.DebugLevel>Default (-Wa,-g)</armgcc.preprocessingassembler.debugging.DebugLevel>
</ArmGcc>
</ToolchainSettings>
<UsesExternalMakeFile>False</UsesExternalMakeFile>
<BuildTarget>all</BuildTarget>
<CleanTarget>clean</CleanTarget>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Source\event_groups.c">
<SubType>compile</SubType>
<Link>FreeRTOS_Source\event_groups.c</Link>
</Compile>
<Compile Include="..\..\Source\list.c">
<SubType>compile</SubType>
<Link>FreeRTOS_Source\list.c</Link>
</Compile>
<Compile Include="..\..\Source\portable\GCC\ARM_CM7\r0p1\port.c">
<SubType>compile</SubType>
<Link>FreeRTOS_Source\portable\port.c</Link>
</Compile>
<Compile Include="..\..\Source\portable\MemMang\heap_4.c">
<SubType>compile</SubType>
<Link>FreeRTOS_Source\portable\heap_4.c</Link>
</Compile>
<Compile Include="..\..\Source\queue.c">
<SubType>compile</SubType>
<Link>FreeRTOS_Source\queue.c</Link>
</Compile>
<Compile Include="..\..\Source\tasks.c">
<SubType>compile</SubType>
<Link>FreeRTOS_Source\tasks.c</Link>
</Compile>
<Compile Include="..\..\Source\timers.c">
<SubType>compile</SubType>
<Link>FreeRTOS_Source\timers.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\BlockQ.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\BlockQ.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\blocktim.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\blocktim.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\countsem.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\countsem.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\death.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\death.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\dynamic.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\dynamic.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\EventGroupsDemo.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\EventGroupsDemo.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\flop.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\flop.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\GenQTest.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\GenQTest.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\IntQueue.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\IntQueue.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\IntSemTest.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\IntSemTest.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\QueueOverwrite.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\QueueOverwrite.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\QueueSet.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\QueueSet.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\recmutex.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\recmutex.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\semtest.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\semtest.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\TaskNotify.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\TaskNotify.c</Link>
</Compile>
<Compile Include="..\Common\Minimal\TimerDemo.c">
<SubType>compile</SubType>
<Link>Full_Demo\Standard_Demo_Tasks\TimerDemo.c</Link>
</Compile>
<Compile Include="Blinky_Demo\main_blinky.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="FreeRTOSConfig.h">
<SubType>compile</SubType>
</Compile>
<Compile Include="Full_Demo\IntQueueTimer.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="Full_Demo\main_full.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="Full_Demo\RegTest_GCC.c">
<SubType>compile</SubType>
</Compile>
<Compile Include="libboard_samv7-ek\resources\gcc\startup_sam.c">
<SubType>compile</SubType>
<Link>Atmel_LibBoard\startup_sam.c</Link>
</Compile>
<Compile Include="libboard_samv7-ek\resources\system_sam.c">
<SubType>compile</SubType>
<Link>Atmel_LibBoard\system_sam.c</Link>
</Compile>
<Compile Include="libboard_samv7-ek\source\board_lowlevel.c">
<SubType>compile</SubType>
<Link>Atmel_LibBoard\board_lowlevel.c</Link>
</Compile>
<Compile Include="libboard_samv7-ek\source\board_memories.c">
<SubType>compile</SubType>
<Link>Atmel_LibBoard\board_memories.c</Link>
</Compile>
<Compile Include="libboard_samv7-ek\source\dbg_console.c">
<SubType>compile</SubType>
<Link>Atmel_LibBoard\dbg_console.c</Link>
</Compile>
<Compile Include="libboard_samv7-ek\source\led.c">
<SubType>compile</SubType>
<Link>Atmel_LibBoard\led.c</Link>
</Compile>
<Compile Include="libboard_samv7-ek\source\syscalls.c">
<SubType>compile</SubType>
<Link>Atmel_LibBoard\syscalls.c</Link>
</Compile>
<Compile Include="libchip_samv7\source\mpu.c">
<SubType>compile</SubType>
<Link>Atmel_LibChip\mpu.c</Link>
</Compile>
<Compile Include="libchip_samv7\source\pio.c">
<SubType>compile</SubType>
<Link>Atmel_LibChip\pio.c</Link>
</Compile>
<Compile Include="libchip_samv7\source\pio_capture.c">
<SubType>compile</SubType>
<Link>Atmel_LibChip\pio_capture.c</Link>
</Compile>
<Compile Include="libchip_samv7\source\pmc.c">
<SubType>compile</SubType>
<Link>Atmel_LibChip\pmc.c</Link>
</Compile>
<Compile Include="libchip_samv7\source\supc.c">
<SubType>compile</SubType>
<Link>Atmel_LibChip\supc.c</Link>
</Compile>
<Compile Include="libchip_samv7\source\tc.c">
<SubType>compile</SubType>
<Link>Atmel_LibChip\tc.c</Link>
</Compile>
<Compile Include="libchip_samv7\source\wdt.c">
<SubType>compile</SubType>
<Link>Atmel_LibChip\wdt.c</Link>
</Compile>
<Compile Include="main.c">
<SubType>compile</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Atmel_LibBoard" />
<Folder Include="Atmel_LibChip" />
<Folder Include="FreeRTOS_Source" />
<Folder Include="FreeRTOS_Source\portable" />
<Folder Include="Blinky_Demo" />
<Folder Include="Full_Demo" />
<Folder Include="Full_Demo\Standard_Demo_Tasks" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\Source\readme.txt">
<SubType>compile</SubType>
<Link>FreeRTOS_Source\readme.txt</Link>
</None>
</ItemGroup>
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
</Project>

View File

@ -0,0 +1,526 @@
/*
FreeRTOS V8.1.2 - Copyright (C) 2014 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that has become a de facto standard. *
* *
* Help yourself get started quickly and support the FreeRTOS *
* project by purchasing a FreeRTOS tutorial book, reference *
* manual, or both from: http://www.FreeRTOS.org/Documentation *
* *
* Thank you! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
>>! NOTE: The modification to the GPL is included to allow you to !<<
>>! distribute a combined work that includes FreeRTOS without being !<<
>>! obliged to provide the source code for proprietary components !<<
>>! outside of the FreeRTOS kernel. !<<
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. Full license text is available from the following
link: http://www.freertos.org/a00114.html
1 tab == 4 spaces!
***************************************************************************
* *
* Having a problem? Start by reading the FAQ "My application does *
* not run, what could be wrong?" *
* *
* http://www.FreeRTOS.org/FAQHelp.html *
* *
***************************************************************************
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
license and Real Time Engineers Ltd. contact details.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
#include <FreeRTOSConfig.h>
RSEG CODE:CODE(2)
thumb
EXTERN ulRegTest1LoopCounter
EXTERN ulRegTest2LoopCounter
PUBLIC vRegTest1Implementation
PUBLIC vRegTest2Implementation
PUBLIC vRegTestClearFlopRegistersToParameterValue
PUBLIC ulRegTestCheckFlopRegistersContainParameterValue
/*-----------------------------------------------------------*/
vRegTest1Implementation
/* Fill the core registers with known values. */
mov r0, #100
mov r1, #101
mov r2, #102
mov r3, #103
mov r4, #104
mov r5, #105
mov r6, #106
mov r7, #107
mov r8, #108
mov r9, #109
mov r10, #110
mov r11, #111
mov r12, #112
/* Fill the VFP registers with known values. */
vmov d0, r0, r1
vmov d1, r2, r3
vmov d2, r4, r5
vmov d3, r6, r7
vmov d4, r8, r9
vmov d5, r10, r11
vmov d6, r0, r1
vmov d7, r2, r3
vmov d8, r4, r5
vmov d9, r6, r7
vmov d10, r8, r9
vmov d11, r10, r11
vmov d12, r0, r1
vmov d13, r2, r3
vmov d14, r4, r5
vmov d15, r6, r7
reg1_loop:
/* Check all the VFP registers still contain the values set above.
First save registers that are clobbered by the test. */
push { r0-r1 }
vmov r0, r1, d0
cmp r0, #100
bne reg1_error_loopf
cmp r1, #101
bne reg1_error_loopf
vmov r0, r1, d1
cmp r0, #102
bne reg1_error_loopf
cmp r1, #103
bne reg1_error_loopf
vmov r0, r1, d2
cmp r0, #104
bne reg1_error_loopf
cmp r1, #105
bne reg1_error_loopf
vmov r0, r1, d3
cmp r0, #106
bne reg1_error_loopf
cmp r1, #107
bne reg1_error_loopf
vmov r0, r1, d4
cmp r0, #108
bne reg1_error_loopf
cmp r1, #109
bne reg1_error_loopf
vmov r0, r1, d5
cmp r0, #110
bne reg1_error_loopf
cmp r1, #111
bne reg1_error_loopf
vmov r0, r1, d6
cmp r0, #100
bne reg1_error_loopf
cmp r1, #101
bne reg1_error_loopf
vmov r0, r1, d7
cmp r0, #102
bne reg1_error_loopf
cmp r1, #103
bne reg1_error_loopf
vmov r0, r1, d8
cmp r0, #104
bne reg1_error_loopf
cmp r1, #105
bne reg1_error_loopf
vmov r0, r1, d9
cmp r0, #106
bne reg1_error_loopf
cmp r1, #107
bne reg1_error_loopf
vmov r0, r1, d10
cmp r0, #108
bne reg1_error_loopf
cmp r1, #109
bne reg1_error_loopf
vmov r0, r1, d11
cmp r0, #110
bne reg1_error_loopf
cmp r1, #111
bne reg1_error_loopf
vmov r0, r1, d12
cmp r0, #100
bne reg1_error_loopf
cmp r1, #101
bne reg1_error_loopf
vmov r0, r1, d13
cmp r0, #102
bne reg1_error_loopf
cmp r1, #103
bne reg1_error_loopf
vmov r0, r1, d14
cmp r0, #104
bne reg1_error_loopf
cmp r1, #105
bne reg1_error_loopf
vmov r0, r1, d15
cmp r0, #106
bne reg1_error_loopf
cmp r1, #107
bne reg1_error_loopf
/* Restore the registers that were clobbered by the test. */
pop {r0-r1}
/* VFP register test passed. Jump to the core register test. */
b reg1_loopf_pass
reg1_error_loopf
/* If this line is hit then a VFP register value was found to be
incorrect. */
b reg1_error_loopf
reg1_loopf_pass
cmp r0, #100
bne reg1_error_loop
cmp r1, #101
bne reg1_error_loop
cmp r2, #102
bne reg1_error_loop
cmp r3, #103
bne reg1_error_loop
cmp r4, #104
bne reg1_error_loop
cmp r5, #105
bne reg1_error_loop
cmp r6, #106
bne reg1_error_loop
cmp r7, #107
bne reg1_error_loop
cmp r8, #108
bne reg1_error_loop
cmp r9, #109
bne reg1_error_loop
cmp r10, #110
bne reg1_error_loop
cmp r11, #111
bne reg1_error_loop
cmp r12, #112
bne reg1_error_loop
/* Everything passed, increment the loop counter. */
push { r0-r1 }
ldr r0, =ulRegTest1LoopCounter
ldr r1, [r0]
adds r1, r1, #1
str r1, [r0]
pop { r0-r1 }
/* Start again. */
b reg1_loop
reg1_error_loop:
/* If this line is hit then there was an error in a core register value.
The loop ensures the loop counter stops incrementing. */
b reg1_error_loop
/*-----------------------------------------------------------*/
vRegTest2Implementation
/* Set all the core registers to known values. */
mov r0, #-1
mov r1, #1
mov r2, #2
mov r3, #3
mov r4, #4
mov r5, #5
mov r6, #6
mov r7, #7
mov r8, #8
mov r9, #9
mov r10, #10
mov r11, #11
mov r12, #12
/* Set all the VFP to known values. */
vmov d0, r0, r1
vmov d1, r2, r3
vmov d2, r4, r5
vmov d3, r6, r7
vmov d4, r8, r9
vmov d5, r10, r11
vmov d6, r0, r1
vmov d7, r2, r3
vmov d8, r4, r5
vmov d9, r6, r7
vmov d10, r8, r9
vmov d11, r10, r11
vmov d12, r0, r1
vmov d13, r2, r3
vmov d14, r4, r5
vmov d15, r6, r7
reg2_loop:
/* Check all the VFP registers still contain the values set above.
First save registers that are clobbered by the test. */
push { r0-r1 }
vmov r0, r1, d0
cmp r0, #-1
bne reg2_error_loopf
cmp r1, #1
bne reg2_error_loopf
vmov r0, r1, d1
cmp r0, #2
bne reg2_error_loopf
cmp r1, #3
bne reg2_error_loopf
vmov r0, r1, d2
cmp r0, #4
bne reg2_error_loopf
cmp r1, #5
bne reg2_error_loopf
vmov r0, r1, d3
cmp r0, #6
bne reg2_error_loopf
cmp r1, #7
bne reg2_error_loopf
vmov r0, r1, d4
cmp r0, #8
bne reg2_error_loopf
cmp r1, #9
bne reg2_error_loopf
vmov r0, r1, d5
cmp r0, #10
bne reg2_error_loopf
cmp r1, #11
bne reg2_error_loopf
vmov r0, r1, d6
cmp r0, #-1
bne reg2_error_loopf
cmp r1, #1
bne reg2_error_loopf
vmov r0, r1, d7
cmp r0, #2
bne reg2_error_loopf
cmp r1, #3
bne reg2_error_loopf
vmov r0, r1, d8
cmp r0, #4
bne reg2_error_loopf
cmp r1, #5
bne reg2_error_loopf
vmov r0, r1, d9
cmp r0, #6
bne reg2_error_loopf
cmp r1, #7
bne reg2_error_loopf
vmov r0, r1, d10
cmp r0, #8
bne reg2_error_loopf
cmp r1, #9
bne reg2_error_loopf
vmov r0, r1, d11
cmp r0, #10
bne reg2_error_loopf
cmp r1, #11
bne reg2_error_loopf
vmov r0, r1, d12
cmp r0, #-1
bne reg2_error_loopf
cmp r1, #1
bne reg2_error_loopf
vmov r0, r1, d13
cmp r0, #2
bne reg2_error_loopf
cmp r1, #3
bne reg2_error_loopf
vmov r0, r1, d14
cmp r0, #4
bne reg2_error_loopf
cmp r1, #5
bne reg2_error_loopf
vmov r0, r1, d15
cmp r0, #6
bne reg2_error_loopf
cmp r1, #7
bne reg2_error_loopf
/* Restore the registers that were clobbered by the test. */
pop {r0-r1}
/* VFP register test passed. Jump to the core register test. */
b reg2_loopf_pass
reg2_error_loopf
/* If this line is hit then a VFP register value was found to be
incorrect. */
b reg2_error_loopf
reg2_loopf_pass
cmp r0, #-1
bne reg2_error_loop
cmp r1, #1
bne reg2_error_loop
cmp r2, #2
bne reg2_error_loop
cmp r3, #3
bne reg2_error_loop
cmp r4, #4
bne reg2_error_loop
cmp r5, #5
bne reg2_error_loop
cmp r6, #6
bne reg2_error_loop
cmp r7, #7
bne reg2_error_loop
cmp r8, #8
bne reg2_error_loop
cmp r9, #9
bne reg2_error_loop
cmp r10, #10
bne reg2_error_loop
cmp r11, #11
bne reg2_error_loop
cmp r12, #12
bne reg2_error_loop
/* Increment the loop counter to indicate this test is still functioning
correctly. */
push { r0-r1 }
ldr r0, =ulRegTest2LoopCounter
ldr r1, [r0]
adds r1, r1, #1
str r1, [r0]
/* Yield to increase test coverage. */
movs r0, #0x01
ldr r1, =0xe000ed04 /*NVIC_INT_CTRL */
lsl r0, r0, #28 /* Shift to PendSV bit */
str r0, [r1]
dsb
pop { r0-r1 }
/* Start again. */
b reg2_loop
reg2_error_loop:
/* If this line is hit then there was an error in a core register value.
This loop ensures the loop counter variable stops incrementing. */
b reg2_error_loop
/*-----------------------------------------------------------*/
vRegTestClearFlopRegistersToParameterValue
/* Clobber the auto saved registers. */
vmov d0, r0, r0
vmov d1, r0, r0
vmov d2, r0, r0
vmov d3, r0, r0
vmov d4, r0, r0
vmov d5, r0, r0
vmov d6, r0, r0
vmov d7, r0, r0
bx lr
/*-----------------------------------------------------------*/
ulRegTestCheckFlopRegistersContainParameterValue
vmov r1, s0
cmp r0, r1
bne return_error
vmov r1, s1
cmp r0, r1
bne return_error
vmov r1, s2
cmp r0, r1
bne return_error
vmov r1, s3
cmp r0, r1
bne return_error
vmov r1, s4
cmp r0, r1
bne return_error
vmov r1, s5
cmp r0, r1
bne return_error
vmov r1, s6
cmp r0, r1
bne return_error
vmov r1, s7
cmp r0, r1
bne return_error
vmov r1, s8
cmp r0, r1
bne return_error
vmov r1, s9
cmp r0, r1
bne return_error
vmov r1, s10
cmp r0, r1
bne return_error
vmov r1, s11
cmp r0, r1
bne return_error
vmov r1, s12
cmp r0, r1
bne return_error
vmov r1, s13
cmp r0, r1
bne return_error
vmov r1, s14
cmp r0, r1
bne return_error
vmov r1, s15
cmp r0, r1
bne return_error
return_pass
mov r0, #1
bx lr
return_error
mov r0, #0
bx lr
END

View File

@ -0,0 +1,34 @@
[BREAKPOINTS]
ShowInfoWin = 1
EnableFlashBP = 2
BPDuringExecution = 0
[CFI]
CFISize = 0x00
CFIAddr = 0x00
[CPU]
OverrideMemMap = 0
AllowSimulation = 1
ScriptFile=""
[FLASH]
CacheExcludeSize = 0x00
CacheExcludeAddr = 0x00
MinNumBytesFlashDL = 0
SkipProgOnCRCMatch = 1
VerifyDownload = 1
AllowCaching = 1
EnableFlashDL = 2
Override = 1
Device="Unspecified"
[GENERAL]
WorkRAMSize = 0x00
WorkRAMAddr = 0x00
RAMUsageLimit = 0x00
[SWO]
SWOLogFile=""
[MEM]
RdOverrideOrMask = 0x00
RdOverrideAndMask = 0xFFFFFFFF
RdOverrideAddr = 0xFFFFFFFF
WrOverrideOrMask = 0x00
WrOverrideAndMask = 0xFFFFFFFF
WrOverrideAddr = 0xFFFFFFFF

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,761 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \page samv7_Xplained_ultra_board_desc SAM V71 Xplained Ultra - Board
* Description
*
* \section Purpose
*
* This file is dedicated to describe the SAM V71 Xplained Ultra board.
*
* \section Contents
*
* - For SAM V71 Xplained Ultra board information, see
* \subpage samv7_Xplained_ultra_board_info.
* - For operating frequency information, see \subpage samv7_Xplained_ultra_opfreq.
* - For using portable PIO definitions, see \subpage samv7_Xplained_ultra_piodef.
* - For using GMAC PIO definitions, see \subpage samv7_Xplained_ultra_gmac.
* - For using ISI definitions, see \subpage samv7_Xplained_ultra_isi.
* - For on-board memories, see \subpage samv7_Xplained_ultra_mem.
* - Several USB definitions are included here,
* see \subpage samv7_Xplained_ultra_usb.
* - For External components, see \subpage samv7_Xplained_ultra_extcomp.
* - For Individual chip definition, see \subpage samv7_Xplained_ultra_chipdef.
*
* To get more software details and the full list of parameters related to the
* SAM V71 Xplained Ultra board configuration, please have a look at the source
* file:
* \ref board.h\n
*
* \section Usage
*
* - The code for booting the board is provided by board_cstartup_xxx.c and
* board_lowlevel.c.
* - For using board PIOs, board characteristics (clock, etc.) and external
* components, see board.h.
* - For manipulating memories, see board_memories.h.
*
* This file can be used as a template and modified to fit a custom board, with
* specific PIOs usage or memory connections.
*/
/**
* \file board.h
*
* Definition of SAM V71 Xplained Ultra board characteristics, PIOs and
* external components interface.
*/
#ifndef _BOARD_H_
#define _BOARD_H_
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "chip.h"
#include "include/board_lowlevel.h"
#include "include/board_memories.h"
#include "include/led.h"
#include "include/gmii.h"
#include "include/gmacb_phy.h"
#include "include/dbg_console.h"
#include "include/bmp.h"
#include "include/lcdd.h"
#include "include/ili9488.h"
#include "include/ili9488_reg.h"
#include "include/ili9488_spi.h"
#include "include/ili9488_ebi.h"
#include "include/ili9488_dma.h"
#include "include/ili9488_spi_dma.h"
#include "include/ili9488_ebi_dma.h"
#include "include/frame_buffer.h"
#include "include/lcd_color.h"
#include "include/lcd_draw.h"
#include "include/lcd_font10x14.h"
#include "include/lcd_font.h"
#include "include/lcd_gimp_image.h"
#include "include/rtc_calib.h"
#include "include/wm8904.h"
#include "include/cs2100.h"
#include "include/s25fl1.h"
#include "include/omnivision.h"
#include "include/ovyuv.h"
#include "include/ov.h"
#include "include/iso7816_4.h"
#if defined ( __GNUC__ )
#include "include/syscalls.h"
#endif
/*----------------------------------------------------------------------------
* Definitions
*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/**
* \page samv7_Xplained_ultra_board_info "SAM V71 Xplained Ultra - Board informations"
* This page lists several definition related to the board description.
*
* \section Definitions
* - \ref BOARD_NAME
*/
/** Name of the board */
#define BOARD_NAME "SAM V71 Xplained Ultra"
#define NO_PUSHBUTTON
/*----------------------------------------------------------------------------*/
/**
* \page samv7_Xplained_ultra_opfreq "SAM V71 Xplained Ultra - Operating frequencies"
* This page lists several definition related to the board operating frequency
* (when using the initialization done by board_lowlevel.c).
*
* \section Definitions
* - \ref BOARD_MAINOSC
* - \ref BOARD_MCK
*/
/** Frequency of the board main oscillator */
#define BOARD_MAINOSC 12000000
/** Master clock frequency (when using board_lowlevel.c) */
#define BOARD_MCK 150000000
#if (BOARD_MCK==132000000 )
#define PLL_MUL 0x16
#define PLL_DIV 0x01
#else // 300MHz(PCK) and 150MHz(MCK) by default
#define PLL_MUL 0x19
#define PLL_DIV 0x01
#endif
/*----------------------------------------------------------------------------*/
/**
* \page samv7_Xplained_ultra_piodef "SAM V71 Xplained Ultra - PIO definitions"
* This pages lists all the PIOs definitions contained in board.h. The constants
* are named using the following convention: PIN_* for a constant which defines
* a single Pin instance (but may include several PIOs sharing the same
* controller), and PINS_* for a list of Pin instances.
*
* UART0
* - \ref PINS_UART0
*
* UART4
* - \ref PINS_UART4
*
* LEDs
* - \ref PIN_LED_0
* - \ref PIN_LED_1
* - \ref PINS_LEDS
*
* Push buttons
* - \ref PIN_PUSHBUTTON_0
* - \ref PIN_PUSHBUTTON_1
* - \ref PINS_PUSHBUTTONS
* - \ref PUSHBUTTON_BP0
* - \ref PUSHBUTTON_BP1
*
* PWMC
* - \ref PIN_PWMC_PWMH0
* - \ref PIN_PWMC_PWMH1
* - \ref PIN_PWM_LED0
* - \ref PIN_PWM_LED1
* - \ref CHANNEL_PWM_LED0
* - \ref CHANNEL_PWM_LED1
*
* SPI
* - \ref PIN_SPI_MISO
* - \ref PIN_SPI_MOSI
* - \ref PIN_SPI_SPCK
* - \ref PINS_SPI
*
* PCK0
* - \ref PIN_PCK0
* - \ref PIN_PCK1
* - \ref PIN_PCK2
*
* PIO PARALLEL CAPTURE
* - \ref PIN_PIODCEN1
* - \ref PIN_PIODCEN2
*
* TWI
* - \ref TWI_V3XX
* - \ref PIN_TWI_TWD0
* - \ref PIN_TWI_TWCK0
* - \ref PINS_TWI0
* - \ref PIN_TWI_TWD1
* - \ref PIN_TWI_TWCK1
* - \ref PINS_TWI1
*
* USART0
* - \ref PIN_USART0_RXD
* - \ref PIN_USART0_TXD
* - \ref PIN_USART0_CTS
* - \ref PIN_USART0_RTS
* - \ref PIN_USART0_SCK
*
* USART1
* - \ref PIN_USART1_RXD
* - \ref PIN_USART1_TXD
* - \ref PIN_USART1_CTS
* - \ref PIN_USART1_RTS
* - \ref PIN_USART1_SCK
*
* USART2
* - \ref PIN_USART2_RXD
* - \ref PIN_USART2_TXD
* - \ref PIN_USART2_CTS
* - \ref PIN_USART2_RTS
* - \ref PIN_USART2_SCK
*
* SSC
* - \ref PIN_SSC_TD
* - \ref PIN_SSC_TK
* - \ref PIN_SSC_TF
* - \ref PIN_SSC_RD
* - \ref PIN_SSC_RK
* - \ref PIN_SSC_RF
* - \ref PIN_SSC_TD
* - \ref PINS_SSC_CODEC
*
* MCAN
* - \ref PIN_MCAN0_TXD
* - \ref PIN_MCAN0_RXD
* - \ref PIN_MCAN1_TXD
* - \ref PIN_MCAN1_RXD
*/
/** SSC pin Transmitter Data (TD) */
#define PIN_SSC_TD {PIO_PD26B_TD, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SSC pin Transmitter Clock (TK) */
#define PIN_SSC_TK {PIO_PB1D_TK, PIOB, ID_PIOB, PIO_PERIPH_D, PIO_DEFAULT}
/** SSC pin Transmitter FrameSync (TF) */
#define PIN_SSC_TF {PIO_PB0D_TF, PIOB, ID_PIOB, PIO_PERIPH_D, PIO_DEFAULT}
/** SSC pin RD */
#define PIN_SSC_RD {PIO_PA10C_RD, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_DEFAULT}
/** SSC pin RK */
#define PIN_SSC_RK {PIO_PA22A_RK, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** SSC pin RF */
#define PIN_SSC_RF {PIO_PD24B_RF, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SSC pins definition for codec. */
#define PINS_SSC_CODEC \
{PIN_SSC_TD, PIN_SSC_TK, PIN_SSC_TF, PIN_SSC_RD, PIN_SSC_RK, PIN_SSC_RF}
/** UART pins (UTXD0 and URXD0) definitions, PA9,10. */
#define PINS_UART0 \
{PIO_PA9A_URXD0 | PIO_PA10A_UTXD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** UART pins (UTXD4 and URXD4) definitions, PD19,18. */
#define PINS_UART4 \
{PIO_PD18C_URXD4 | PIO_PD19C_UTXD4, PIOD, ID_PIOD, PIO_PERIPH_C, PIO_DEFAULT}
/* LED pins definitions */
#define LED_YELLOW0 0
#define LED_YELLOW1 1
/** LED #0 pin definition (YELLOW). */
#define PIN_LED_0 {PIO_PA23, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
/** LED #0 pin definition (YELLOW). */
#define PIN_LED_1 {PIO_PC9, PIOC, ID_PIOC, PIO_OUTPUT_0, PIO_DEFAULT}
/** List of all LEDs definitions. */
#define PINS_LEDS {PIN_LED_0, PIN_LED_1}
/**
* Push button #0 definition.
* Attributes = pull-up + debounce + interrupt on rising edge.
*/
#define PIN_PUSHBUTTON_0 \
{PIO_PA9, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_FALL_EDGE}
/**
* Push button #1 definition.
* Attributes = pull-up + debounce + interrupt on rising edge.
*/
#define PIN_PUSHBUTTON_1 \
{PIO_PB12, PIOB, ID_PIOB, PIO_INPUT, PIO_PULLUP | PIO_DEBOUNCE | PIO_IT_FALL_EDGE}
/** List of all push button definitions. */
#define PINS_PUSHBUTTONS {PIN_PUSHBUTTON_0, PIN_PUSHBUTTON_1}
/** Push button #0 index. */
#define PUSHBUTTON_BP0 0
/** Push button #1 index. */
#define PUSHBUTTON_BP1 1
/** PWMC PWM0 pin definition: Output High. */
#define PIN_PWMC_PWMH0 {PIO_PD20A_PWMH0, PIOD, ID_PIOD, PIO_PERIPH_A, PIO_DEFAULT}
/** PWMC PWM1 pin definition: Output High. */
#define PIN_PWMC_PWMH1 {PIO_PD21A_PWMH1, PIOD, ID_PIOD, PIO_PERIPH_A, PIO_DEFAULT}
/** PWM pins definition for LED0 */
#define PIN_PWM_LED0 PIN_PWMC_PWMH0
/** PWM pins definition for LED1 */
#define PIN_PWM_LED1 PIN_PWMC_PWMH1
/** PWM channel for LED0 */
#define CHANNEL_PWM_LED0 0
/** PWM channel for LED1 */
#define CHANNEL_PWM_LED1 1
/** SPI MISO pin definition. */
#define PIN_SPI_MISO {PIO_PD20B_SPI0_MISO, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SPI MOSI pin definition. */
#define PIN_SPI_MOSI {PIO_PD21B_SPI0_MOSI, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SPI SPCK pin definition. */
#define PIN_SPI_SPCK {PIO_PD22B_SPI0_SPCK, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SPI chip select pin definition. */
#define PIN_SPI_NPCS0 {PIO_PB2D_SPI0_NPCS0, PIOB, ID_PIOB, PIO_PERIPH_D, PIO_DEFAULT}
#define PIN_SPI_NPCS1 {PIO_PD25B_SPI0_NPCS1, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
#define PIN_SPI_NPCS3 {PIO_PD27B_SPI0_NPCS3, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** List of SPI pin definitions (MISO, MOSI & SPCK). */
#define PINS_SPI PIN_SPI_MISO, PIN_SPI_MOSI, PIN_SPI_SPCK
/** PCK0 */
#define PIN_PCK0 {PIO_PB13B_PCK0, PIOB, ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT}
/** PCK1 */
#define PIN_PCK1 {PIO_PA17B_PCK1, PIOB, ID_PIOB, PIO_PERIPH_B, PIO_DEFAULT}
/** PCK2 */
#define PIN_PCK2 {PIO_PA18B_PCK2, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
/** PIO PARALLEL CAPTURE */
/** Parallel Capture Mode Data Enable1 */
#define PIN_PIODCEN1 PIO_PA15
/** Parallel Capture Mode Data Enable2 */
#define PIN_PIODCEN2 PIO_PA16
/** TWI version 3.xx */
#define TWI_V3XX
/** TWI0 data pin */
#define PIN_TWI_TWD0 {PIO_PA3A_TWD0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** TWI0 clock pin */
#define PIN_TWI_TWCK0 {PIO_PA4A_TWCK0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** TWI0 pins */
#define PINS_TWI0 {PIN_TWI_TWD0, PIN_TWI_TWCK0}
/** TWI1 data pin */
#define PIN_TWI_TWD1 {PIO_PB4A_TWD1, PIOB, ID_PIOB, PIO_PERIPH_A, PIO_DEFAULT}
/** TWI1 clock pin */
#define PIN_TWI_TWCK1 {PIO_PB5A_TWCK1, PIOB, ID_PIOB, PIO_PERIPH_A,PIO_DEFAULT}
/** TWI1 pins */
#define PINS_TWI1 {PIN_TWI_TWD1, PIN_TWI_TWCK1}
/** USART0 pin RX */
#define PIN_USART0_RXD {PIO_PB0C_RXD0, PIOB, ID_PIOB, PIO_PERIPH_C, PIO_DEFAULT}
/** USART0 pin TX */
#define PIN_USART0_TXD {PIO_PB1C_TXD0, PIOB, ID_PIOB, PIO_PERIPH_C, PIO_DEFAULT}
/** USART0 pin CTS */
#define PIN_USART0_CTS {PIO_PB2C_CTS0, PIOB, ID_PIOB, PIO_PERIPH_C, PIO_DEFAULT}
/** USART0 pin RTS */
#define PIN_USART0_RTS {PIO_PB3C_RTS0, PIOB, ID_PIOB, PIO_PERIPH_C, PIO_DEFAULT}
/** USART0 pin SCK */
#define PIN_USART0_SCK {PIO_PB13C_SCK0, PIOB, ID_PIOB, PIO_PERIPH_C,PIO_DEFAULT}
/** USART1 pin RX */
#define PIN_USART1_RXD {PIO_PA21A_RXD1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** USART1 pin TX */
#define PIN_USART1_TXD {1<<22, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** USART1 pin CTS */
#define PIN_USART1_CTS {PIO_PA25A_CTS1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** USART1 pin RTS */
#define PIN_USART1_RTS {PIO_PA24A_RTS1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** USART1 pin ENABLE */
#define PIN_USART1_EN {PIO_PA23A_SCK1, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
/** USART1 pin SCK */
#define PIN_USART1_SCK {PIO_PA23A_SCK1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** USART2 pin RX */
#define PIN_USART2_RXD {PIO_PD15B_RXD2, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** USART2 pin TX */
#define PIN_USART2_TXD {PIO_PD16B_TXD2, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** USART2 pin CTS */
#define PIN_USART2_CTS {PIO_PD19B_CTS2, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** USART2 pin RTS */
#define PIN_USART2_RTS {PIO_PD18B_RTS2, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** USART2 pin SCK */
#define PIN_USART2_SCK {PIO_PD17B_SCK2, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/*Pins for USART0 as 7816 mode*/
/** PIN used for reset the smartcard */
#define PIN_ISO7816_RSTMC {PIO_PB2C_CTS0, PIOB, ID_PIOB, PIO_OUTPUT_0, PIO_DEFAULT}
/** Pins used for connect the smartcard */
#define PINS_ISO7816 PIN_USART0_TXD, PIN_USART0_SCK,PIN_ISO7816_RSTMC
/** MCAN0 pin Transmit Data (TXD) */
#define PIN_MCAN0_TXD {PIO_PB2A_CANTX0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** MCAN0 pin Receive Data (RXD) */
#define PIN_MCAN0_RXD {PIO_PB3A_CANRX0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** MCAN1 pin Transmit Data (TXD) */
#define PIN_MCAN1_TXD {PIO_PC14C_CANTX1, PIOC, ID_PIOC, PIO_PERIPH_C, PIO_DEFAULT}
/** MCAN1 pin Receive Data (RXD) */
#define PIN_MCAN1_RXD {PIO_PC12C_CANRX1, PIOC, ID_PIOC, PIO_PERIPH_C, PIO_DEFAULT}
/*----------------------------------------------------------------------------*/
/**
* \page samv7_Xplained_ultra_gmac "SAM V71 Xplained Ultra - GMAC"
* \section GMAC
* - \ref BOARD_GMAC_PHY_ADDR
* - \ref BOARD_GMAC_PHY_COMP_KSZ8061RNB
* - \ref BOARD_GMAC_MODE_RMII
* - \ref BOARD_GMAC_PINS
* - \ref BOARD_GMAC_RESET_PIN
*
*/
/** PHY address */
#define BOARD_GMAC_PHY_ADDR 1
/** PHY Component */
#define BOARD_GMAC_PHY_COMP_KSZ8061RNB 1
/** Board GMAC power control - ALWAYS ON */
#define BOARD_GMAC_POWER_ALWAYS_ON
/** Board GMAC work mode - RMII/MII ( 1 / 0 ) */
#define BOARD_GMAC_MODE_RMII 1
/** The PIN list of PIO for GMAC */
#define BOARD_GMAC_PINS \
{ (PIO_PD0A_GTXCK | PIO_PD1A_GTXEN | PIO_PD2A_GTX0 | PIO_PD3A_GTX1 \
| PIO_PD4A_GRXDV | PIO_PD5A_GRX0 | PIO_PD6A_GRX1 | PIO_PD7A_GRXER \
| PIO_PD8A_GMDC | PIO_PD9A_GMDIO ),PIOD, ID_PIOD, PIO_PERIPH_A, PIO_DEFAULT}, \
{PIO_PC30, PIOC, ID_PIOC, PIO_INPUT, PIO_PULLUP},\
{PIO_PA29, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
/** The PIN list of PIO for GMAC */
#define BOARD_GMAC_RESET_PIN {PIO_PC10, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_PULLUP}
/** The runtime pin configure list for GMAC */
#define BOARD_GMAC_RUN_PINS BOARD_GMAC_PINS
/*----------------------------------------------------------------------------*/
/**
* \page samv7_Xplained_ultra_isi "SAM V71 Xplained Ultra - ISI"
* This page lists all the IO definitions connected to ISI module.
* ISI
* - \ref PIN_ISI_D0
* - \ref PIN_ISI_D1
* - \ref PIN_ISI_D2
* - \ref PIN_ISI_D3
* - \ref PIN_ISI_D4
* - \ref PIN_ISI_D5
* - \ref PIN_ISI_D6
* - \ref PIN_ISI_D7
* - \ref PIN_ISI_D8
* - \ref PIN_ISI_D9
* - \ref BOARD_ISI_VSYNC
* - \ref BOARD_ISI_HSYNC
* - \ref BOARD_ISI_PCK
* - \ref BOARD_ISI_PINS
*
*/
#define PIN_ISI_D0 {PIO_PD22D_ISI_D0, PIOD, ID_PIOD, PIO_PERIPH_D, PIO_PULLUP}
#define PIN_ISI_D1 {PIO_PD21D_ISI_D1, PIOD, ID_PIOD, PIO_PERIPH_D, PIO_PULLUP}
#define PIN_ISI_D2 {PIO_PB3D_ISI_D2, PIOB, ID_PIOB, PIO_PERIPH_D, PIO_PULLUP}
#define PIN_ISI_D3 {PIO_PA9B_ISI_D3, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_PULLUP}
#define PIN_ISI_D4 {PIO_PA5B_ISI_D4, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_PULLUP}
#define PIN_ISI_D5 {PIO_PD11D_ISI_D5, PIOD, ID_PIOD, PIO_PERIPH_D, PIO_PULLUP}
#define PIN_ISI_D6 {PIO_PD12D_ISI_D6, PIOD, ID_PIOD, PIO_PERIPH_D, PIO_PULLUP}
#define PIN_ISI_D7 {PIO_PA27D_ISI_D7, PIOA, ID_PIOA, PIO_PERIPH_D, PIO_PULLUP}
#define PIN_ISI_D8 {PIO_PD27D_ISI_D8, PIOD, ID_PIOD, PIO_PERIPH_D, PIO_PULLUP}
#define PIN_ISI_D9 {PIO_PD28D_ISI_D9, PIOD, ID_PIOD, PIO_PERIPH_D, PIO_PULLUP}
#define BOARD_ISI_VSYNC {PIO_PD25D_ISI_VSYNC, PIOD, ID_PIOD, PIO_PERIPH_D, PIO_DEFAULT}
#define BOARD_ISI_HSYNC {PIO_PD24D_ISI_HSYNC, PIOD, ID_PIOD, PIO_PERIPH_D, PIO_DEFAULT}
#define BOARD_ISI_PCK {PIO_PA24D_ISI_PCK, PIOA, ID_PIOA, PIO_PERIPH_D, PIO_DEFAULT}
#define BOARD_ISI_PCK0 { PIO_PA6B_PCK0, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT }
#define BOARD_ISI_RST { 1 << 13, PIOB, ID_PIOB, PIO_OUTPUT_1, PIO_DEFAULT }
#define BOARD_ISI_PWD { 1 << 19, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT }
#define BOARD_ISI_PINS \
PIN_ISI_D0, PIN_ISI_D1, PIN_ISI_D2,PIN_ISI_D3,PIN_ISI_D4, PIN_ISI_D5,\
PIN_ISI_D6,PIN_ISI_D7,PIN_ISI_D8, PIN_ISI_D9,BOARD_ISI_VSYNC ,\
BOARD_ISI_HSYNC ,BOARD_ISI_PCK, BOARD_ISI_RST, BOARD_ISI_PWD,BOARD_ISI_PCK0
/*----------------------------------------------------------------------------*/
/**
* \page samv7_Xplained_ultra_usb "SAM V71 Xplained Ultra - USB device"
*
* \section Definitions
* - \ref BOARD_USB_BMATTRIBUTES
*
* \section vBus
* - \ref PIN_USB_VBUS
*
*/
/**
* USB attributes configuration descriptor (bus or self powered,
* remote wakeup)
*/
#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP
/** USB VBus monitoring pin definition. */
#define PIN_USB_VBUS {PIO_PC16, PIOC, ID_PIOC, PIO_INPUT, PIO_DEFAULT}
/*----------------------------------------------------------------------------*/
/**
* \page samv7_Xplained_ultra_extcomp "SAM V71 Xplained Ultra - External components"
* This page lists the definitions related to external on-board components
* located in the board.h file for the SAM V71 Xplained Ultra board.
*
* LCD
*/
/** Indicates board has an ILI9325 external component to manage LCD. */
#define BOARD_LCD_ILI9488
//#define BOARD_LCD_SPI_EXT1
#define BOARD_LCD_SPI_EXT2
/** SPI pin definition for LCD */
#if defined (BOARD_LCD_SPI_EXT1)
/** SPI MISO pin definition. */
#define LCD_SPI_MISO {PIO_PD20B_SPI0_MISO, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SPI MOSI pin definition. */
#define LCD_SPI_MOSI {PIO_PD21B_SPI0_MOSI, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SPI SPCK pin definition. */
#define LCD_SPI_SPCK {PIO_PD22B_SPI0_SPCK, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SPI chip select pin definition. */
#define LCD_SPI_NPCS {PIO_PD27B_SPI0_NPCS3, PIOD, ID_PIOD, PIO_PERIPH_B,PIO_DEFAULT}
/** SPI chip select pin definition. */
#define LCD_SPI_NPCS {PIO_PD25B_SPI0_NPCS1, PIOD, ID_PIOD, PIO_PERIPH_B,PIO_DEFAULT}
/** LCD pins definition. */
#define BOARD_SPI_LCD_PINS {LCD_SPI_MISO, LCD_SPI_MOSI, LCD_SPI_SPCK, LCD_SPI_NPCS}
/** Back-light pin definition. */
#define BOARD_SPI_LCD_BACKLIGHT_PIN \
{PIO_PA0A_PWMC0_PWMH0, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** PWMC PWM0 pin definition: Output Low. */
#define LCD_SPI_PIN_RESET {PIO_PD28, PIOD, ID_PIOD, PIO_OUTPUT_1, PIO_DEFAULT}
/** PWM channel for LED0 */
#define CHANNEL_PWM_LCD 0
#endif
/*ENDIF BOARD_LCD_SPI_EXT1 */
#if defined (BOARD_LCD_SPI_EXT2)
/** SPI MISO pin definition. */
#define LCD_SPI_MISO {PIO_PD20B_SPI0_MISO, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SPI MOSI pin definition. */
#define LCD_SPI_MOSI {PIO_PD21B_SPI0_MOSI, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SPI SPCK pin definition. */
#define LCD_SPI_SPCK {PIO_PD22B_SPI0_SPCK, PIOD, ID_PIOD, PIO_PERIPH_B, PIO_DEFAULT}
/** SPI chip select pin definition. */
#define LCD_SPI_NPCS {PIO_PD27B_SPI0_NPCS3, PIOD, ID_PIOD, PIO_PERIPH_B,PIO_DEFAULT}
/** LCD pins definition. */
#define BOARD_SPI_LCD_PINS {LCD_SPI_MISO, LCD_SPI_MOSI, LCD_SPI_SPCK, LCD_SPI_NPCS}
/** Back-light pin definition. */
#define BOARD_SPI_LCD_PIN_BACKLIGHT \
{PIO_PC19B_PWMC0_PWMH2, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT}
/** PWMC PWM0 pin definition: Output Low. */
#define LCD_SPI_PIN_RESET {PIO_PA24, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
/** LCD command/data select pin */
#define BOARD_SPI_LCD_PIN_CDS {PIO_PA6, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
/** PWM channel for LED0 */
#define CHANNEL_PWM_LCD 2
#endif
/*ENDIF BOARD_LCD_SPI_EXT2 */
/** SMC pin definition for LCD */
/** LCD data pin */
#define PIN_EBI_LCD_DATAL {0xFF, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP}
#define PIN_EBI_LCD_DATAH_0 {0x3F, PIOE, ID_PIOE, PIO_PERIPH_A, PIO_PULLUP}
#define PIN_EBI_LCD_DATAH_1 {PIO_PA15A_D14|PIO_PA16A_D15, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_PULLUP}
/** LCD WE pin */
#define PIN_EBI_LCD_NWE {PIO_PC8A_NWE, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP}
/** LCD RD pin */
#define PIN_EBI_LCD_NRD {PIO_PC11A_NRD, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_PULLUP}
/* LCD CS pin (NCS3) */
#define PIN_EBI_LCD_CS {PIO_PD19A_NCS3, PIOD, ID_PIOD, PIO_PERIPH_A, PIO_PULLUP}
/** LCD command/data select pin */
#define BOARD_EBI_LCD_PIN_CDS {PIO_PC30, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT}
/** Back-light pin definition. */
#define BOARD_EBI_LCD_PIN_BACKLIGHT {PIO_PC9B_TIOB7, PIOC, ID_PIOC, PIO_PERIPH_B, PIO_DEFAULT}
/** LCD reset pin */
#define LCD_EBI_PIN_RESET {PIO_PC13, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT}
/** LCD pins definition. */
#define BOARD_EBI_LCD_PINS \
{PIN_EBI_LCD_DATAL, PIN_EBI_LCD_DATAH_0, PIN_EBI_LCD_DATAH_1, \
PIN_EBI_LCD_NWE,PIN_EBI_LCD_NRD,PIN_EBI_LCD_CS}
/** Display width in pixels. */
#define BOARD_LCD_WIDTH 320
/** Display height in pixels. */
#define BOARD_LCD_HEIGHT 480
/*----------------------------------------------------------------------------*/
/**
* \page samv7_Xplained_ultra_mem "SAM V71 Xplained Ultra - Memories"
* This page lists definitions related to internal & external on-board memories.
* \section SDRAM
* - \ref PIN_SDRAM_D0_7
* - \ref PIN_SDRAM_D8_13
* - \ref PIN_SDRAM_D14_15
* - \ref PIN_SDRAM_A0_9
* - \ref PIN_SDRAM_SDA10
* - \ref PIN_SDRAM_CAS
* - \ref PIN_SDRAM_RAS
* - \ref PIN_SDRAM_SDCKE
* - \ref PIN_SDRAM_SDCK
* - \ref PIN_SDRAM_SDSC
* - \ref PIN_SDRAM_NBS0
* - \ref PIN_SDRAM_NBS1
* - \ref PIN_SDRAM_SDWE
* - \ref PIN_SDRAM_BA0
*
* \section SDMMC
* - \ref BOARD_MCI_PIN_CD
* - \ref BOARD_MCI_PIN_CK
* - \ref BOARD_MCI_PINS_SLOTA
* - \ref BOARD_SD_PINS
*
* \section QSPI
* - \ref PINS_QSPI_IO
* - \ref PINS_QSPI_IO3
* - \ref PINS_QSPI
*/
/** List of all SDRAM pin definitions. */
#define BOARD_SDRAM_SIZE (2*1024*1024)
#define PIN_SDRAM_D0_7 {0x000000FF, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_SDRAM_D8_13 {0x0000003F, PIOE, ID_PIOE, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_SDRAM_D14_15 {0x00018000, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_SDRAM_A0_9 {0x3FF00000, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_SDRAM_SDA10 {0x00002000, PIOD, ID_PIOD, PIO_PERIPH_C, PIO_DEFAULT}
#define PIN_SDRAM_CAS {0x00020000, PIOD, ID_PIOD, PIO_PERIPH_C, PIO_DEFAULT}
#define PIN_SDRAM_RAS {0x00010000, PIOD, ID_PIOD, PIO_PERIPH_C, PIO_DEFAULT}
#define PIN_SDRAM_SDCKE {0x00004000, PIOD, ID_PIOD, PIO_PERIPH_C, PIO_DEFAULT}
#define PIN_SDRAM_SDCK {0x00800000, PIOD, ID_PIOD, PIO_PERIPH_C, PIO_DEFAULT}
#define PIN_SDRAM_SDSC {0x00008000, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_SDRAM_NBS0 {0x00040000, PIOC, ID_PIOC, PIO_PERIPH_A, PIO_DEFAULT}
#define PIN_SDRAM_NBS1 {0x00008000, PIOD, ID_PIOD, PIO_PERIPH_C, PIO_DEFAULT}
#define PIN_SDRAM_SDWE {0x20000000, PIOD, ID_PIOD, PIO_PERIPH_C, PIO_DEFAULT}
#define PIN_SDRAM_BA0 {0x00100000, PIOA, ID_PIOA, PIO_PERIPH_C, PIO_DEFAULT}
#define BOARD_SDRAM_PINS PIN_SDRAM_D0_7, PIN_SDRAM_D8_13 , PIN_SDRAM_D14_15,\
PIN_SDRAM_A0_9, PIN_SDRAM_SDA10, PIN_SDRAM_BA0, \
PIN_SDRAM_CAS, PIN_SDRAM_RAS, PIN_SDRAM_SDCKE,PIN_SDRAM_SDCK,\
PIN_SDRAM_SDSC,PIN_SDRAM_NBS0 ,PIN_SDRAM_NBS1,PIN_SDRAM_SDWE
/** List of all MCI pin definitions. */
/** MCI0 Card detect pin definition. (PE5) */
#define BOARD_MCI_PIN_CD {PIO_PD18, PIOD, ID_PIOD, PIO_INPUT, PIO_PULLUP}
/** MCI0 Clock . */
#define BOARD_MCI_PIN_CK {PIO_PA25D_MCCK, PIOA, ID_PIOA, PIO_PERIPH_D, PIO_DEFAULT}
/** MCI0 Solt A IO pins definition. (PC4-PC13) */
#define BOARD_MCI_PINS_SLOTA \
{(PIO_PA30C_MCDA0 | PIO_PA31C_MCDA1 | PIO_PA26C_MCDA2 | PIO_PA27C_MCDA3 | PIO_PA28C_MCCDA),\
PIOA, ID_PIOA, PIO_PERIPH_C, PIO_DEFAULT}
/** MCI pins that shall be configured to access the SD card. */
#define BOARD_SD_PINS {BOARD_MCI_PINS_SLOTA, BOARD_MCI_PIN_CK}
/** MCI Card Detect pin. */
#define BOARD_SD_PIN_CD BOARD_MCI_PIN_CD
/** Total number of MCI interface */
#define BOARD_NUM_MCI 1
/** List of all SQPI pin definitions. */
#define PINS_QSPI_IO \
{(PIO_PA11A_QCS | PIO_PA13A_QIO0 | PIO_PA12A_QIO1 | PIO_PA17A_QIO2 | PIO_PA14A_QSCK),\
PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
#define PINS_QSPI_IO3 {PIO_PD31A_QIO3, PIOD, ID_PIOD, PIO_PERIPH_A, PIO_DEFAULT}
#define PINS_QSPI {PINS_QSPI_IO, PINS_QSPI_IO3}
/*----------------------------------------------------------------------------*/
/**
* \page samv7_Xplained_ultra_chipdef "SAM V71 Xplained Ultra - Individual chip definition"
* This page lists the definitions related to different chip's definition
*
* \section USART
* - \ref BOARD_PIN_USART_RXD
* - \ref BOARD_PIN_USART_TXD
* - \ref BOARD_PIN_USART_CTS
* - \ref BOARD_PIN_USART_RTS
* - \ref BOARD_PIN_USART_EN
* - \ref BOARD_USART_BASE
* - \ref BOARD_ID_USART
*/
/** Rtc */
#define BOARD_RTC_ID ID_RTC
/** TWI ID for QTouch application to use */
#define BOARD_ID_TWI_AT42 ID_TWI0
/** TWI Base for QTouch application to use */
#define BOARD_BASE_TWI_AT42 TWI0
/** TWI pins for QTouch application to use */
#define BOARD_PINS_TWI_AT42 PINS_TWI0
/** USART RX pin for application */
#define BOARD_PIN_USART_RXD PIN_USART1_RXD
/** USART TX pin for application */
#define BOARD_PIN_USART_TXD PIN_USART1_TXD
/** USART CTS pin for application */
#define BOARD_PIN_USART_CTS PIN_USART1_CTS
/** USART RTS pin for application */
#define BOARD_PIN_USART_RTS PIN_USART1_RTS
/** USART ENABLE pin for application */
#define BOARD_PIN_USART_EN PIN_USART1_EN
/** USART Base for application */
#define BOARD_USART_BASE USART1
/** USART ID for application */
#define BOARD_ID_USART ID_USART1
/*----------------------------------------------------------------------------*/
/*
* USB pins
*/
#define PINS_VBUS_EN {PIO_PC16, PIOC, ID_PIOC, PIO_OUTPUT_1, PIO_DEFAULT}
#endif /* #ifndef _BOARD_H_ */

View File

@ -0,0 +1,119 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
* \section Purpose
*
* Utility for BMP
*
*/
#ifndef BMP_H
#define BMP_H
/** BMP magic number ('BM'). */
#define BMP_TYPE 0x4D42
/** headerSize must be set to 40 */
#define BITMAPINFOHEADER 40
/*------------------------------------------------------------------------------
* Exported types
*------------------------------------------------------------------------------*/
#pragma pack( 1 )
/** BMP (Windows) Header Format */
typedef struct _BMPHeader{
/* signature, must be 4D42 hex */
uint16_t type;
/* size of BMP file in bytes (unreliable) */
uint32_t fileSize;
/* reserved, must be zero */
uint16_t reserved1;
/* reserved, must be zero */
uint16_t reserved2;
/* offset to start of image data in bytes */
uint32_t offset;
/* size of BITMAPINFOHEADER structure, must be 40 */
uint32_t headerSize;
/* image width in pixels */
uint32_t width;
/* image height in pixels */
uint32_t height;
/* number of planes in the image, must be 1 */
uint16_t planes;
/* number of bits per pixel (1, 4, 8, 16, 24, 32) */
uint16_t bits;
/* compression type (0=none, 1=RLE-8, 2=RLE-4) */
uint32_t compression;
/* size of image data in bytes (including padding) */
uint32_t imageSize;
/* horizontal resolution in pixels per meter (unreliable) */
uint32_t xresolution;
/* vertical resolution in pixels per meter (unreliable) */
uint32_t yresolution;
/* number of colors in image, or zero */
uint32_t ncolours;
/* number of important colors, or zero */
uint32_t importantcolours;
} BMPHeader;
#pragma pack()
/*------------------------------------------------------------------------------
* Exported functions
*------------------------------------------------------------------------------*/
extern uint8_t BMP_IsValid(void *file);
extern uint32_t BMP_GetFileSize(void *file);
extern uint8_t BMP_Decode(
void *file,
uint8_t *buffer,
uint32_t width,
uint32_t height,
uint8_t bpp );
extern void WriteBMPheader(
uint32_t *pAddressHeader,
uint32_t bmpHSize,
uint32_t bmpVSize,
uint8_t nbByte_Pixels );
extern void BMP_displayHeader(uint32_t* pAddressHeader);
extern void RGB565toBGR555(
uint8_t *fileSource,
uint8_t *fileDestination,
uint32_t width,
uint32_t height,
uint8_t bpp );
#endif //#ifndef BMP_H

View File

@ -0,0 +1,47 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface for the low-level initialization function.
*
*/
#ifndef BOARD_LOWLEVEL_H
#define BOARD_LOWLEVEL_H
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern void LowLevelInit( void );
extern void _SetupMemoryRegion( void );
#endif /* BOARD_LOWLEVEL_H */

View File

@ -0,0 +1,48 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface for memories configuration on board.
*
*/
#ifndef BOARD_MEMORIES_H
#define BOARD_MEMORIES_H
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern void BOARD_ConfigureSdram( void );
extern uint32_t BOARD_SdramValidation(uint32_t baseAddr, uint32_t size);
#endif /* #ifndef BOARD_MEMORIES_H */

View File

@ -0,0 +1,93 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation WM8904 driver.
*
*/
#ifndef CS2100_H
#define CS2100_H
#include "board.h"
/*----------------------------------------------------------------------------
* Definitions
*----------------------------------------------------------------------------*/
#define CS2100_SLAVE_ADDRESS 0x4E
/** ID and Rev register*/
#define CS2100_REG_ID 0x01
/** VMID control 0 register*/
#define CS2100_REG_CTRL 0x02
/** MIC Bias control 0 register*/
#define CS2100_REG_DEV_CFG1 0x03
/** Bias control 1 register*/
#define CS2100_REG_CFG 0x05
/** Power management control 0 register*/
#define CS2100_REG_32_BIT_RATIO_1 0x06
/** Power management control 0 register*/
#define CS2100_REG_32_BIT_RATIO_2 0x07
/** Power management control 0 register*/
#define CS2100_REG_32_BIT_RATIO_3 0x08
/** Power management control 0 register*/
#define CS2100_REG_32_BIT_RATIO_4 0x09
/** Power management control 2 register*/
#define CS2100_REG_FUNC_CFG1 0x16
/** Power management control 3 register*/
#define CS2100_REG_FUNC_CFG2 0x17
/** Power management control 3 register*/
#define CS2100_REG_FUNC_CFG3 0x1E
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern uint16_t CS2100_Read(
Twid *pTwid,
uint32_t device,
uint32_t regAddr);
extern void CS2100_Write(
Twid *pTwid,
uint32_t device,
uint32_t regAddr,
uint16_t data);
extern uint8_t CS2100_Init(Twid *pTwid, uint32_t device, uint32_t PCK);
#endif // CS2100_H

View File

@ -0,0 +1,53 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Include function prototype for the UART console.
*/
#ifndef _DBG_CONSOLE_
#define _DBG_CONSOLE_
#include <stdint.h>
extern void DBG_Configure( uint32_t dwBaudrate, uint32_t dwMasterClock ) ;
extern void DBG_PutChar( uint8_t uc ) ;
extern uint32_t DBG_GetChar( void ) ;
extern uint32_t DBG_IsRxReady( void ) ;
extern void DBG_DumpFrame( uint8_t* pucFrame, uint32_t dwSize ) ;
extern void DBG_DumpMemory( uint8_t* pucBuffer, uint32_t dwSize, uint32_t dwAddress ) ;
extern uint32_t DBG_GetInteger( int32_t* pdwValue ) ;
extern uint32_t DBG_GetIntegerMinMax( int32_t* pdwValue, int32_t dwMin, int32_t dwMax ) ;
extern uint32_t DBG_GetHexa32( uint32_t* pdwValue ) ;
#endif /* _DBG_CONSOLE_ */

View File

@ -0,0 +1,83 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface of frame buffer driver.
*
*/
#ifndef _FRAME_BUFFER_
#define _FRAME_BUFFER_
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern void FB_SetFrameBuffer(
LcdColor_t *pBuffer,
uint8_t ucWidth,
uint8_t ucHeight);
extern void FB_SetColor(uint32_t color);
extern uint32_t FB_DrawLine (
uint32_t dwX1,
uint32_t dwY1,
uint32_t dwX2,
uint32_t dwY2 );
extern uint32_t FB_DrawPixel( uint32_t x, uint32_t y );
extern uint32_t FB_DrawCircle( uint32_t x, uint32_t y, uint32_t r );
extern uint32_t FB_DrawFilledCircle(
uint32_t dwX,
uint32_t dwY,
uint32_t dwRadius);
extern uint32_t FB_DrawRectangle(
uint32_t dwX1,
uint32_t dwY1,
uint32_t dwX2,
uint32_t dwY2 );
extern uint32_t FB_DrawFilledRectangle(
uint32_t dwX1,
uint32_t dwY1,
uint32_t dwX2,
uint32_t dwY2 );
extern uint32_t FB_DrawPicture(
uint32_t dwX1,
uint32_t dwY1,
uint32_t dwX2,
uint32_t dwY2,
const void *pBuffer );
#endif /* #ifndef _FRAME_BUFFER_ */

View File

@ -0,0 +1,114 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/** \file */
/** \addtogroup gmacb_module Ethernet GMACB Driver
*@{
* Implement GEMAC PHY driver, that initialize the PHY to prepare for
* Ethernet transfer.
*
* \section Usage
* -# EMAC related pins and Driver should be initialized at first.
* -# Initialize GMACB Driver instance by invoking GMACB_Init().
* -# Initialize PHY connected via GMACB_InitPhy(), PHY address is
* automatically adjusted by attempt to read.
* -# Perform PHY auto negotiate through GMACB_AutoNegotiate(), so
* connection established.
*
*
* Related files:\n
* \ref gmacb.h\n
* \ref gmacb.c\n
* \ref gmii.h.\n
*
*/
/**@}*/
#ifndef _GMACB_PHY_H
#define _GMACB_PHY_H
/*---------------------------------------------------------------------------
* Headers
*---------------------------------------------------------------------------*/
#include "board.h"
/*---------------------------------------------------------------------------
* Definitions
*---------------------------------------------------------------------------*/
/** The reset length setting for external reset configuration */
#define GMACB_RESET_LENGTH 0xD
/*---------------------------------------------------------------------------
* Types
*---------------------------------------------------------------------------*/
/** The DM9161 instance */
typedef struct _GMacb {
/**< Driver */
sGmacd *pGmacd;
/** The retry & timeout settings */
uint32_t retryMax;
/** PHY address ( pre-defined by pins on reset ) */
uint8_t phyAddress;
} GMacb;
/*---------------------------------------------------------------------------
* Exported functions
*---------------------------------------------------------------------------*/
extern void GMACB_SetupTimeout(GMacb *pMacb, uint32_t toMax);
extern void GMACB_Init(GMacb *pMacb, sGmacd *pGmacd, uint8_t phyAddress);
extern uint8_t GMACB_InitPhy(
GMacb *pMacb,
uint32_t mck,
const Pin *pResetPins,
uint32_t nbResetPins,
const Pin *pEmacPins,
uint32_t nbEmacPins);
extern uint8_t GMACB_AutoNegotiate(GMacb *pMacb);
extern uint8_t GMACB_GetLinkSpeed(GMacb *pMacb, uint8_t applySettings);
extern uint8_t GMACB_Send(GMacb *pMacb, void *pBuffer, uint32_t size);
extern uint32_t GMACB_Poll(GMacb *pMacb, uint8_t *pBuffer, uint32_t size);
extern void GMACB_DumpRegisters(GMacb *pMacb);
extern uint8_t GMACB_ResetPhy(GMacb *pMacb);
#endif // #ifndef _GMACB_H

View File

@ -0,0 +1,116 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 _GMII_DEFINE_H
#define _GMII_DEFINE_H
/*---------------------------------------------------------------------------
* Definitions
*---------------------------------------------------------------------------*/
//IEEE defined Registers
#define GMII_BMCR 0x0 // Basic Mode Control Register
#define GMII_BMSR 0x1 // Basic Mode Status Register
#define GMII_PHYID1R 0x2 // PHY Identifier Register 1
#define GMII_PHYID2R 0x3 // PHY Identifier Register 2
#define GMII_ANAR 0x4 // Auto_Negotiation Advertisement Register
#define GMII_ANLPAR 0x5 // Auto_negotiation Link Partner Ability Register
#define GMII_ANER 0x6 // Auto-negotiation Expansion Register
#define GMII_ANNPR 0x7 // Auto-negotiation Next Page Register
#define GMII_ANLPNPAR 0x8 // Auto_negotiation Link Partner Next Page Ability Register
#define GMII_AFEC0R 0x11 // AFE Control 0 Register
#define GMII_AFEC3R 0x14 // AFE Control 3 Register
#define GMII_RXERCR 0x15 // RXER Counter Register
#define GMII_OMSSR 0x17 // Operation Mode Strap Status Register
#define GMII_ECR 0x18 // Expanded Control Register
#define GMII_ICSR 0x1B // Interrupt Control/Status Register
#define GMII_FC 0x1C // Function Control
#define GMII_LCSR 0x1D // LinkMD® Control/Status Register
#define GMII_PC1R 0x1E // PHY Control 1 Register
#define GMII_PC2R 0x1F // PHY Control 2 Register
// PHY ID Identifier Register
#define GMII_LSB_MASK 0x0U
// definitions: MII_PHYID1
#define GMII_OUI_MSB 0x0022
// definitions: MII_PHYID2
#define GMII_OUI_LSB 0x1572 // KSZ8061 PHY Id2
// Basic Mode Control Register (BMCR)
// Bit definitions: MII_BMCR
#define GMII_RESET (1 << 15) // 1= Software Reset; 0=Normal Operation
#define GMII_LOOPBACK (1 << 14) // 1=loopback Enabled; 0=Normal Operation
#define GMII_SPEED_SELECT_LSB (1 << 13) // 1,0=1000Mbps 0,1=100Mbps; 0,0=10Mbps
#define GMII_AUTONEG (1 << 12) // Auto-negotiation Enable
#define GMII_POWER_DOWN (1 << 11) // 1=Power down 0=Normal operation
#define GMII_ISOLATE (1 << 10) // 1 = Isolates 0 = Normal operation
#define GMII_RESTART_AUTONEG (1 << 9) // 1 = Restart auto-negotiation 0 = Normal operation
#define GMII_DUPLEX_MODE (1 << 8) // 1 = Full duplex operation 0 = Normal operation
// Reserved 7 // Read as 0, ignore on write
#define GMII_SPEED_SELECT_MSB (1 << 6) //
// Reserved 5 to 0 // Read as 0, ignore on write
// Basic Mode Status Register (BMSR)
// Bit definitions: MII_BMSR
#define GMII_100BASE_T4 (1 << 15) // 100BASE-T4 Capable
#define GMII_100BASE_TX_FD (1 << 14) // 100BASE-TX Full Duplex Capable
#define GMII_100BASE_T4_HD (1 << 13) // 100BASE-TX Half Duplex Capable
#define GMII_10BASE_T_FD (1 << 12) // 10BASE-T Full Duplex Capable
#define GMII_10BASE_T_HD (1 << 11) // 10BASE-T Half Duplex Capable
// Reserved 10 to 9 // Read as 0, ignore on write
#define GMII_EXTEND_STATUS (1 << 8) // 1 = Extend Status Information In Reg 15
// Reserved 7
#define GMII_MF_PREAMB_SUPPR (1 << 6) // MII Frame Preamble Suppression
#define GMII_AUTONEG_COMP (1 << 5) // Auto-negotiation Complete
#define GMII_REMOTE_FAULT (1 << 4) // Remote Fault
#define GMII_AUTONEG_ABILITY (1 << 3) // Auto Configuration Ability
#define GMII_LINK_STATUS (1 << 2) // Link Status
#define GMII_JABBER_DETECT (1 << 1) // Jabber Detect
#define GMII_EXTEND_CAPAB (1 << 0) // Extended Capability
// Auto-negotiation Advertisement Register (ANAR)
// Auto-negotiation Link Partner Ability Register (ANLPAR)
// Bit definitions: MII_ANAR, MII_ANLPAR
#define GMII_NP (1 << 15) // Next page Indication
// Reserved 7
#define GMII_RF (1 << 13) // Remote Fault
// Reserved 12 // Write as 0, ignore on read
#define GMII_PAUSE_MASK (3 << 11) // 0,0 = No Pause 1,0 = Asymmetric Pause(link partner)
// 0,1 = Symmetric Pause 1,1 = Symmetric&Asymmetric Pause(local device)
#define GMII_T4 (1 << 9) // 100BASE-T4 Support
#define GMII_TX_FDX (1 << 8) // 100BASE-TX Full Duplex Support
#define GMII_TX_HDX (1 << 7) // 100BASE-TX Support
#define GMII_10_FDX (1 << 6) // 10BASE-T Full Duplex Support
#define GMII_10_HDX (1 << 5) // 10BASE-T Support
// Selector 4 to 0 // Protocol Selection Bits
#define GMII_AN_IEEE_802_3 0x00001
#endif // #ifndef _MII_DEFINE_H

View File

@ -0,0 +1,107 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface of ILI9488 driver.
*
*/
#ifndef _ILI9488_H_
#define _ILI9488_H_
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdint.h>
/*----------------------------------------------------------------------------
* Definitions
*----------------------------------------------------------------------------*/
#define ILI9488_SPIMODE 0
#define ILI9488_EBIMODE 1
/* ILI9325 ID code */
#define ILI9488_DEVICE_CODE 0x9488
#define ILI9488_LCD_WIDTH 320
#define ILI9488_LCD_HEIGHT 480
#define ILI9488_SELF_TEST_OK 0xC0
/* EBI chip select for LCD */
#define SMC_EBI_LCD_CS 3
/*----------------------------------------------------------------------------
* Types
*----------------------------------------------------------------------------*/
typedef enum{
AccessInst = 0,
AccessRead,
AccessWrite
}AccessIli_t;
typedef union _union_type
{
uint32_t value;
struct{
uint8_t byte_8;
uint8_t byte_l6;
uint8_t byte_24;
uint8_t byte_32;
}byte;
struct{
uint16_t half_word_l;
uint16_t half_word_h;
}half_word;
}union_type;
typedef volatile uint8_t REG8;
typedef uint32_t LcdColor_t;
/*----------------------------------------------------------------------------
* Marcos
*----------------------------------------------------------------------------*/
/* Pixel cache used to speed up communication */
#define LCD_DATA_CACHE_SIZE BOARD_LCD_WIDTH
/*----------------------------------------------------------------------------
* Function Marcos
*----------------------------------------------------------------------------*/
#define get_0b_to_8b(x) (((union_type*)&(x))->byte.byte_8)
#define get_8b_to_16b(x) (((union_type*)&(x))->byte.byte_l6)
#define get_16b_to_24b(x) (((union_type*)&(x))->byte.byte_24)
#define get_24b_to_32b(x) (((union_type*)&(x))->byte.byte_32)
#endif /* #ifndef ILI9488 */

View File

@ -0,0 +1,94 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface of ILI9488 driver.
*
*/
#ifndef _ILI9488_DMA_H_
#define _ILI9488_DMA_H_
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdint.h>
/*------------------------------------------------------------------------------
* Definitions
*----------------------------------------------------------------------------*/
/** An unspecified error has occurred.*/
#define ILI9488_ERROR_DMA_ALLOCATE_CHANNEL 1
#define ILI9488_ERROR_DMA_CONFIGURE 2
#define ILI9488_ERROR_DMA_TRANSFER 3
#define ILI9488_ERROR_DMA_SIZE 4
#define ILI9488_SPI SPI0
#define ILI9488_SPI_ID ID_SPI0
/* EBI BASE ADDRESS for SMC LCD */
#define ILI9488_BASE_ADDRESS 0x63000000
/*------------------------------------------------------------------------------
* Types
*----------------------------------------------------------------------------*/
typedef struct _ILI9488_dma
{
/** Pointer to DMA driver */
sXdmad *xdmaD;
/** ili9488 Tx channel */
uint32_t ili9488DmaTxChannel;
/** ili9488 Rx channel */
uint32_t ili9488DmaRxChannel;
/** ili9488 Tx/Rx configure descriptor */
sXdmadCfg xdmadRxCfg,xdmadTxCfg;
/** ili9488 dma interrupt */
uint32_t xdmaInt;
/** Pointer to SPI Hardware registers */
Spi* pSpiHw ;
/** SPI Id as defined in the product datasheet */
uint8_t spiId ;
}sIli9488Dma;
typedef struct _ILI9488_ctl
{
/** ili9488 Command/Data mode */
volatile uint32_t cmdOrDataFlag;
/** ili9488 Rx done */
volatile uint32_t rxDoneFlag;
/** ili9488 Tx done */
volatile uint32_t txDoneFlag;
}sIli9488DmaCtl;
#endif /* #ifndef ILI9488_DMA */

View File

@ -0,0 +1,62 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface of ILI9488 driver.
*
*/
#ifndef _ILI9488_EBI_H_
#define _ILI9488_EBI_H_
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdint.h>
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern uint32_t ILI9488_EbiReadChipId (void);
extern uint32_t ILI9488_EbiInitialize( sXdmad * dmad );
extern void ILI9488_EbiSetPixelFormat(uint16_t format);
extern void ILI9488_EbiSetCursor(uint16_t x, uint16_t y);
extern void ILI9488_EbiSetWindow(
uint16_t dwX, uint16_t dwY, uint16_t dwWidth, uint16_t dwHeight );
extern void ILI9488_EbiSetFullWindow(void);
extern void ILI9488_EbiOn(void );
extern void ILI9488_EbiOff(void );
extern void ILI9488_EbiSetDisplayLandscape( uint8_t dwRGB, uint8_t LandscaprMode );
#endif /* #ifndef ILI9488_EBI */

View File

@ -0,0 +1,55 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface of ILI9488 driver.
*
*/
#ifndef _ILI9488_EBI_DMA_H_
#define _ILI9488_EBI_DMA_H_
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdint.h>
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern uint8_t ILI9488_EbiInitializeWithDma(sXdmad * dmad);
extern uint8_t ILI9488_EbiDmaTxTransfer( uint16_t *pTxBuffer, uint32_t wTxSize);
extern uint8_t ILI9488_EbiDmaRxTransfer( uint32_t *pRxBuffer,uint32_t wRxSize);
extern uint8_t ILI9488_EbiSendCommand(uint16_t Instr, uint16_t *pTxData,
uint32_t *pRxData, AccessIli_t ReadWrite, uint32_t size);
#endif /* #ifndef ILI9488_EBI_DMA */

View File

@ -0,0 +1,131 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 ILI9488_REG_H_INCLUDED
#define ILI9488_REG_H_INCLUDED
/* Level 1 Commands (from the display Datasheet) */
#define ILI9488_CMD_NOP 0x00
#define ILI9488_CMD_SOFTWARE_RESET 0x01
#define ILI9488_CMD_READ_DISP_ID 0x04
#define ILI9488_CMD_READ_ERROR_DSI 0x05
#define ILI9488_CMD_READ_DISP_STATUS 0x09
#define ILI9488_CMD_READ_DISP_POWER_MODE 0x0A
#define ILI9488_CMD_READ_DISP_MADCTRL 0x0B
#define ILI9488_CMD_READ_DISP_PIXEL_FORMAT 0x0C
#define ILI9488_CMD_READ_DISP_IMAGE_MODE 0x0D
#define ILI9488_CMD_READ_DISP_SIGNAL_MODE 0x0E
#define ILI9488_CMD_READ_DISP_SELF_DIAGNOSTIC 0x0F
#define ILI9488_CMD_ENTER_SLEEP_MODE 0x10
#define ILI9488_CMD_SLEEP_OUT 0x11
#define ILI9488_CMD_PARTIAL_MODE_ON 0x12
#define ILI9488_CMD_NORMAL_DISP_MODE_ON 0x13
#define ILI9488_CMD_DISP_INVERSION_OFF 0x20
#define ILI9488_CMD_DISP_INVERSION_ON 0x21
#define ILI9488_CMD_PIXEL_OFF 0x22
#define ILI9488_CMD_PIXEL_ON 0x23
#define ILI9488_CMD_DISPLAY_OFF 0x28
#define ILI9488_CMD_DISPLAY_ON 0x29
#define ILI9488_CMD_COLUMN_ADDRESS_SET 0x2A
#define ILI9488_CMD_PAGE_ADDRESS_SET 0x2B
#define ILI9488_CMD_MEMORY_WRITE 0x2C
#define ILI9488_CMD_MEMORY_READ 0x2E
#define ILI9488_CMD_PARTIAL_AREA 0x30
#define ILI9488_CMD_VERT_SCROLL_DEFINITION 0x33
#define ILI9488_CMD_TEARING_EFFECT_LINE_OFF 0x34
#define ILI9488_CMD_TEARING_EFFECT_LINE_ON 0x35
#define ILI9488_CMD_MEMORY_ACCESS_CONTROL 0x36
#define ILI9488_CMD_VERT_SCROLL_START_ADDRESS 0x37
#define ILI9488_CMD_IDLE_MODE_OFF 0x38
#define ILI9488_CMD_IDLE_MODE_ON 0x39
#define ILI9488_CMD_COLMOD_PIXEL_FORMAT_SET 0x3A
#define ILI9488_CMD_WRITE_MEMORY_CONTINUE 0x3C
#define ILI9488_CMD_READ_MEMORY_CONTINUE 0x3E
#define ILI9488_CMD_SET_TEAR_SCANLINE 0x44
#define ILI9488_CMD_GET_SCANLINE 0x45
#define ILI9488_CMD_WRITE_DISPLAY_BRIGHTNESS 0x51
#define ILI9488_CMD_READ_DISPLAY_BRIGHTNESS 0x52
#define ILI9488_CMD_WRITE_CTRL_DISPLAY 0x53
#define ILI9488_CMD_READ_CTRL_DISPLAY 0x54
#define ILI9488_CMD_WRITE_CONTENT_ADAPT_BRIGHTNESS 0x55
#define ILI9488_CMD_READ_CONTENT_ADAPT_BRIGHTNESS 0x56
#define ILI9488_CMD_WRITE_MIN_CAB_LEVEL 0x5E
#define ILI9488_CMD_READ_MIN_CAB_LEVEL 0x5F
#define ILI9488_CMD_READ_ABC_SELF_DIAG_RES 0x68
#define ILI9488_CMD_READ_ID1 0xDA
#define ILI9488_CMD_READ_ID2 0xDB
#define ILI9488_CMD_READ_ID3 0xDC
/* Level 2 Commands (from the display Datasheet) */
#define ILI9488_CMD_INTERFACE_MODE_CONTROL 0xB0
#define ILI9488_CMD_FRAME_RATE_CONTROL_NORMAL 0xB1
#define ILI9488_CMD_FRAME_RATE_CONTROL_IDLE_8COLOR 0xB2
#define ILI9488_CMD_FRAME_RATE_CONTROL_PARTIAL 0xB3
#define ILI9488_CMD_DISPLAY_INVERSION_CONTROL 0xB4
#define ILI9488_CMD_BLANKING_PORCH_CONTROL 0xB5
#define ILI9488_CMD_DISPLAY_FUNCTION_CONTROL 0xB6
#define ILI9488_CMD_ENTRY_MODE_SET 0xB7
#define ILI9488_CMD_BACKLIGHT_CONTROL_1 0xB9
#define ILI9488_CMD_BACKLIGHT_CONTROL_2 0xBA
#define ILI9488_CMD_HS_LANES_CONTROL 0xBE
#define ILI9488_CMD_POWER_CONTROL_1 0xC0
#define ILI9488_CMD_POWER_CONTROL_2 0xC1
#define ILI9488_CMD_POWER_CONTROL_NORMAL_3 0xC2
#define ILI9488_CMD_POWER_CONTROL_IDEL_4 0xC3
#define ILI9488_CMD_POWER_CONTROL_PARTIAL_5 0xC4
#define ILI9488_CMD_VCOM_CONTROL_1 0xC5
#define ILI9488_CMD_CABC_CONTROL_1 0xC6
#define ILI9488_CMD_CABC_CONTROL_2 0xC8
#define ILI9488_CMD_CABC_CONTROL_3 0xC9
#define ILI9488_CMD_CABC_CONTROL_4 0xCA
#define ILI9488_CMD_CABC_CONTROL_5 0xCB
#define ILI9488_CMD_CABC_CONTROL_6 0xCC
#define ILI9488_CMD_CABC_CONTROL_7 0xCD
#define ILI9488_CMD_CABC_CONTROL_8 0xCE
#define ILI9488_CMD_CABC_CONTROL_9 0xCF
#define ILI9488_CMD_NVMEM_WRITE 0xD0
#define ILI9488_CMD_NVMEM_PROTECTION_KEY 0xD1
#define ILI9488_CMD_NVMEM_STATUS_READ 0xD2
#define ILI9488_CMD_READ_ID4 0xD3
#define ILI9488_CMD_ADJUST_CONTROL_1 0xD7
#define ILI9488_CMD_READ_ID_VERSION 0xD8
#define ILI9488_CMD_POSITIVE_GAMMA_CORRECTION 0xE0
#define ILI9488_CMD_NEGATIVE_GAMMA_CORRECTION 0xE1
#define ILI9488_CMD_DIGITAL_GAMMA_CONTROL_1 0xE2
#define ILI9488_CMD_DIGITAL_GAMMA_CONTROL_2 0xE3
#define ILI9488_CMD_SET_IMAGE_FUNCTION 0xE9
#define ILI9488_CMD_ADJUST_CONTROL_2 0xF2
#define ILI9488_CMD_ADJUST_CONTROL_3 0xF7
#define ILI9488_CMD_ADJUST_CONTROL_4 0xF8
#define ILI9488_CMD_ADJUST_CONTROL_5 0xF9
#define ILI9488_CMD_SPI_READ_SETTINGS 0xFB
#define ILI9488_CMD_ADJUST_CONTROL_6 0xFC
#define ILI9488_CMD_ADJUST_CONTROL_7 0xFF
#endif /* ILI9488_REGS_H_INCLUDED */

View File

@ -0,0 +1,68 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface of ILI9488 driver.
*
*/
#ifndef _ILI9488_SPI_H_
#define _ILI9488_SPI_H_
/*------------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*------------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern uint32_t ILI9488_SpiReadChipId (void);
extern uint32_t ILI9488_SpiInitialize( sXdmad * dmad );
extern void ILI9488_SpiSetPixelFormat(uint8_t format);
extern void ILI9488_SpiNop(void);
extern void ILI9488_SpiWriteMemory(const uint8_t *pBuf, uint32_t size);
extern void ILI9488_SpiReadMemory( const uint8_t *pBuf, uint32_t size);
extern void ILI9488_SpiSetCursor(uint16_t x, uint16_t y);
extern void ILI9488_SpiSetWindow(
uint16_t dwX,
uint16_t dwY,
uint16_t dwWidth,
uint16_t dwHeight );
extern void ILI9488_SpiSetFullWindow(void);
extern void ILI9488_SpiOn(void );
extern void ILI9488_SpiOff(void );
extern void ILI9488_SpiSetDisplayLandscape(
uint8_t dwRGB, uint8_t LandscaprMode );
#endif /* #ifndef ILI9488_SPI */

View File

@ -0,0 +1,56 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface of ILI9488 DMA driver.
*
*/
#ifndef _ILI9488_SPI_DMA_H_
#define _ILI9488_SPI_DMA_H_
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdint.h>
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern uint8_t ILI9488_SpiInitializeWithDma(sXdmad * dmad);
extern uint8_t ILI9488_SpiDmaTxTransfer( uint8_t *pTxBuffer, uint32_t wTxSize);
extern uint8_t ILI9488_SpiDmaRxTransfer( uint32_t *pRxBuffer,uint32_t wRxSize);
extern uint8_t ILI9488_SpiSendCommand(uint8_t Instr, uint8_t* pTxData,
uint32_t* pRxData, AccessIli_t ReadWrite, uint32_t size);
#endif /* #ifndef ILI9488_SPI_DMA */

View File

@ -0,0 +1,109 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 COLOR_H
#define COLOR_H
/**
* \file
*
* RGB 24-bits color table definition.
*
*/
/*
* RGB 24 Bpp
* RGB 888
* R7R6R5R4 R3R2R1R0 G7G6G5G4 G3G2G1G0 B7B6B5B4 B3B2B1B0
*/
#define COLOR_BLACK 0x000000
#define COLOR_WHITE 0xFFFFFF
#define COLOR_BLUE 0x0000FF
#define COLOR_GREEN 0x00FF00
#define COLOR_RED 0xFF0000
#define COLOR_NAVY 0x000080
#define COLOR_DARKBLUE 0x00008B
#define COLOR_DARKGREEN 0x006400
#define COLOR_DARKCYAN 0x008B8B
#define COLOR_CYAN 0x00FFFF
#define COLOR_TURQUOISE 0x40E0D0
#define COLOR_INDIGO 0x4B0082
#define COLOR_DARKRED 0x800000
#define COLOR_OLIVE 0x808000
#define COLOR_GRAY 0x808080
#define COLOR_SKYBLUE 0x87CEEB
#define COLOR_BLUEVIOLET 0x8A2BE2
#define COLOR_LIGHTGREEN 0x90EE90
#define COLOR_DARKVIOLET 0x9400D3
#define COLOR_YELLOWGREEN 0x9ACD32
#define COLOR_BROWN 0xA52A2A
#define COLOR_DARKGRAY 0xA9A9A9
#define COLOR_SIENNA 0xA0522D
#define COLOR_LIGHTBLUE 0xADD8E6
#define COLOR_GREENYELLOW 0xADFF2F
#define COLOR_SILVER 0xC0C0C0
#define COLOR_LIGHTGREY 0xD3D3D3
#define COLOR_LIGHTCYAN 0xE0FFFF
#define COLOR_VIOLET 0xEE82EE
#define COLOR_AZUR 0xF0FFFF
#define COLOR_BEIGE 0xF5F5DC
#define COLOR_MAGENTA 0xFF00FF
#define COLOR_TOMATO 0xFF6347
#define COLOR_GOLD 0xFFD700
#define COLOR_ORANGE 0xFFA500
#define COLOR_SNOW 0xFFFAFA
#define COLOR_YELLOW 0xFFFF00
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define WHITE 0xFFFF
/* level is in [0; 31]*/
#define BLUE_LEV( level) ( (level)&BLUE )
#define GREEN_LEV(level) ( (((level)*2)<<5)&GREEN )
#define RED_LEV( level) ( ((level)<<(5+6))&RED )
#define GRAY_LEV( level) ( BLUE_LEV(level) | GREEN_LEV(level) | RED_LEV(level))
#define RGB_24_TO_RGB565(RGB) \
(((RGB >>19)<<11) | (((RGB & 0x00FC00) >>5)) | (RGB & 0x00001F))
#define RGB_24_TO_18BIT(RGB) \
(((RGB >>16)&0xFC) | (((RGB & 0x00FF00) >>10) << 10) | (RGB & 0x0000FC)<<16)
#define RGB_16_TO_18BIT(RGB) \
(((((RGB >>11)*63)/31)<<18) | (RGB & 0x00FC00) | (((RGB & 0x00001F)*63)/31))
#define BGR_TO_RGB_18BIT(RGB) \
(RGB & 0xFF0000) | ((RGB & 0x00FF00) >> 8 ) | ( (RGB & 0x0000FC) >> 16 ))
#define BGR_16_TO_18BITRGB(RGB) BGR_TO_RGB_18BIT(RGB_16_TO_18BIT(RGB))
#endif /* #define COLOR_H */

View File

@ -0,0 +1,186 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface for draw function on LCD.
*
*/
#ifndef DRAW_H
#define DRAW_H
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdint.h>
#include "lcd_gimp_image.h"
/*----------------------------------------------------------------------------
* Definitions
*----------------------------------------------------------------------------*/
/** Horizontal direction line definition */
#define DIRECTION_HLINE 0
/** Vertical direction line definition */
#define DIRECTION_VLINE 1
typedef struct _rect{
uint32_t x;
uint32_t y;
uint32_t width;
uint32_t height;
}rect;
COMPILER_PACK_SET(1)
typedef struct _rgb{
uint8_t b;
uint8_t g;
uint8_t r;
}sBGR;
COMPILER_PACK_RESET()
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern void LCDD_SetUpdateWindowSize(rect rc);
extern void LCDD_UpdateWindow(void);
extern void LCDD_UpdatePartialWindow( uint8_t* pbuf, uint32_t size);
extern void LCDD_DrawRectangleWithFill(
uint16_t* pbuf,
uint32_t dwX,
uint32_t dwY,
uint32_t dwWidth,
uint32_t dwHeight,
uint32_t dwColor);
extern uint32_t LCDD_DrawCircle(
uint16_t* pbuf,
uint32_t x,
uint32_t y,
uint32_t r,
uint32_t color);
extern uint32_t LCD_DrawFilledCircle(
uint16_t* pbuf,
uint32_t dwX,
uint32_t dwY,
uint32_t dwRadius,
uint32_t color);
extern void LCDD_DrawString(
uint16_t* pbuf,
uint32_t x,
uint32_t y,
const uint8_t *pString,
uint32_t color );
extern void LCDD_GetStringSize(
const uint8_t *pString,
uint32_t *pWidth,
uint32_t *pHeight );
extern void LCDD_BitBlt(
uint16_t* pbuf,
uint32_t dst_x,
uint32_t dst_y,
uint32_t dst_w,
uint32_t dst_h,
const LcdColor_t *src,
uint32_t src_x,
uint32_t src_y,
uint32_t src_w,
uint32_t src_h);
extern void LCDD_BitBltAlphaBlend(uint16_t* pbuf,
uint32_t dst_x,
uint32_t dst_y,
uint32_t dst_w,
uint32_t dst_h,
const LcdColor_t *src,
uint32_t src_x,
uint32_t src_y,
uint32_t src_w,
uint32_t src_h,
uint32_t alpha);
extern void LCDD_DrawImage(
uint16_t* pbuf,
uint32_t dwX,
uint32_t dwY,
const LcdColor_t *pImage,
uint32_t dwWidth,
uint32_t dwHeight );
extern void LCDD_DrawPixel(
uint16_t* pbuf,
uint32_t x,
uint32_t y,
uint32_t color );
extern void LCDD_DrawLine(
uint16_t* pbuf,
uint32_t dwX1,
uint32_t dwY1,
uint32_t dwX2,
uint32_t dwY2,
uint32_t color);
extern uint32_t LCDD_DrawLineBresenham(
uint16_t* pbuf,
uint32_t dwX1,
uint32_t dwY1,
uint32_t dwX2,
uint32_t dwY2,
uint32_t color);
extern void LCDD_DrawRectangle(
uint16_t* pbuf,
uint32_t x,
uint32_t y,
uint32_t width,
uint32_t height,
uint32_t color);
extern void LCDD_SetCavasBuffer(
void* pBuffer,
uint32_t wBufferSize);
extern void LCDD_DrawStraightLine(
uint16_t* pbuf,
uint32_t dwX1,
uint32_t dwY1,
uint32_t dwX2,
uint32_t dwY2 ,
uint32_t color );
#endif /* #ifndef DRAW_H */

View File

@ -0,0 +1,108 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface for draw font on LCD.
*
*/
/**
*
* \section Purpose
*
* The font.h files declares a font structure and a LCDD_DrawChar function
* that must be implemented by a font definition file to be used with the
* LCDD_DrawString method of draw.h.
*
* The font10x14.c implements the necessary variable and function for a 10x14
* font.
*
* \section Usage
*
* -# Declare a gFont global variable with the necessary Font information.
* -# Implement an LCDD_DrawChar function which displays the specified
* character on the LCD.
* -# Use the LCDD_DrawString method defined in draw.h to display a complete
* string.
*/
#ifndef _LCD_FONT_
#define _LCD_FONT_
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include <stdint.h>
/*----------------------------------------------------------------------------
* Types
*----------------------------------------------------------------------------*/
/** \brief Describes the font (width, height, supported characters, etc.) used by
* the LCD driver draw API.
*/
typedef struct _Font {
/* Font width in pixels. */
uint8_t width;
/* Font height in pixels. */
uint8_t height;
} Font;
/*----------------------------------------------------------------------------
* Variables
*----------------------------------------------------------------------------*/
/** Global variable describing the font being instanced. */
extern const Font gFont;
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern void LCDD_DrawChar(
uint16_t* pCanvasBuffer,
uint32_t x,
uint32_t y,
uint8_t c,
uint32_t color );
extern void LCD_DrawString(
uint16_t* pCanvasBuffer,
uint32_t dwX,
uint32_t dwY,
const uint8_t *pString,
uint32_t color );
#endif /* #ifndef LCD_FONT_ */

View File

@ -0,0 +1,45 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Font 10x14 table definition.
*
*/
#ifndef _LCD_FONT_10x14_
#define _LCD_FONT_10x14_
#include <stdint.h>
/** Char set of font 10x14 */
extern const uint8_t pCharset10x14[];
#endif /* #ifdef _LCD_FONT_10x14_ */

View File

@ -0,0 +1,42 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 _GIMP_IMAGE_
#define _GIMP_IMAGE_
#include <stdint.h>
typedef struct _SGIMPImage{
uint32_t dwWidth;
uint32_t dwHeight;
uint32_t dwBytes_per_pixel; /* 3:RGB, 4:RGBA */
uint8_t* pucPixel_data ;
} SGIMPImage ;
#endif // _GIMP_IMAGE_

View File

@ -0,0 +1,52 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface for LCD driver.
*
*/
#ifndef LCDD_H
#define LCDD_H
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern void LCDD_Initialize(uint8_t lcdMode, sXdmad * dmad, uint8_t cRotate);
extern void LCDD_On(void);
extern void LCDD_Off(void);
extern void LCDD_SetBacklight (uint32_t step);
#endif /* #ifndef LCDD_H */

View File

@ -0,0 +1,72 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* \section Purpose
*
* Small set of functions for simple and portable LED usage.
*
* \section Usage
*
* -# Configure one or more LEDs using LED_Configure and
* LED_ConfigureAll.
* -# Set, clear and toggle LEDs using LED_Set, LED_Clear and
* LED_Toggle.
*
* LEDs are numbered starting from 0; the number of LEDs depend on the
* board being used. All the functions defined here will compile properly
* regardless of whether the LED is defined or not; they will simply
* return 0 when a LED which does not exist is given as an argument.
* Also, these functions take into account how each LED is connected on to
* board; thus, \ref LED_Set might change the level on the corresponding pin
* to 0 or 1, but it will always light the LED on; same thing for the other
* methods.
*/
#ifndef _LED_
#define _LED_
#include <stdint.h>
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern uint32_t LED_Configure( uint32_t dwLed );
extern uint32_t LED_Set( uint32_t dwLed );
extern uint32_t LED_Clear( uint32_t dwLed );
extern uint32_t LED_Toggle( uint32_t dwLed );
#endif /* #ifndef LED_H */

View File

@ -0,0 +1,42 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 _MATH_
#define _MATH_
/*------------------------------------------------------------------------------
* Exported functions
*------------------------------------------------------------------------------*/
extern uint32_t min( uint32_t dwA, uint32_t dwB );
extern uint32_t absv( int32_t lValue );
extern uint32_t power( uint32_t dwX, uint32_t dwY );
#endif /* #ifndef _MATH_ */

View File

@ -0,0 +1,126 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* \section Purpose
*
* Interface for configuring and using Timer Counter (TC) peripherals.
*
* \section Usage
* -# Optionally, use TC_FindMckDivisor() to let the program find the best
* TCCLKS field value automatically.
* -# Configure a Timer Counter in the desired mode using TC_Configure().
* -# Start or stop the timer clock using TC_Start() and TC_Stop().
*/
#ifndef _MCAN_CONFIG_
#define _MCAN_CONFIG_
/*------------------------------------------------------------------------------
* Headers
*------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
* Global functions
*------------------------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif
/* Programmable Clock Source for Baud Rate is Common To Both MCAN Controllers */
#define MCAN_PROG_CLK_PRESCALER 1 /* /1 to /256 */
// select one of the following for the programmable clock source
//#define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_SLOW_CLK
//#define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_MAIN_CLK
//#define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_PLLA_CLK
//#define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_UPLL_CLK
#define MCAN_PROG_CLK_SELECT PMC_PCK_CSS_MCK
#define MCAN_PROG_CLK_FREQ_HZ \
( (float) 150000000 / (float) MCAN_PROG_CLK_PRESCALER )
#define MCAN0_BIT_RATE_BPS 500000
#define MCAN0_PROP_SEG 2
#define MCAN0_PHASE_SEG1 11
#define MCAN0_PHASE_SEG2 11
#define MCAN0_SYNC_JUMP 4
#define MCAN0_FAST_BIT_RATE_BPS 2000000
#define MCAN0_FAST_PROP_SEG 2
#define MCAN0_FAST_PHASE_SEG1 4
#define MCAN0_FAST_PHASE_SEG2 4
#define MCAN0_FAST_SYNC_JUMP 2
#define MCAN0_NMBR_STD_FLTS 8 /* 128 max filters */
#define MCAN0_NMBR_EXT_FLTS 8 /* 64 max filters */
#define MCAN0_NMBR_RX_FIFO0_ELMTS 0 /* # of elements, 64 elements max */
#define MCAN0_NMBR_RX_FIFO1_ELMTS 0 /* # of elements, 64 elements max */
#define MCAN0_NMBR_RX_DED_BUF_ELMTS 16 /* # of elements, 64 elements max */
#define MCAN0_NMBR_TX_EVT_FIFO_ELMTS 0 /* # of elements, 32 elements max */
#define MCAN0_NMBR_TX_DED_BUF_ELMTS 4 /* # of elements, 32 elements max */
#define MCAN0_NMBR_TX_FIFO_Q_ELMTS 0 /* # of elements, 32 elements max */
#define MCAN0_RX_FIFO0_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */
#define MCAN0_RX_FIFO1_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */
#define MCAN0_RX_BUF_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */
#define MCAN0_TX_BUF_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */
#define MCAN1_BIT_RATE_BPS 500000
#define MCAN1_PROP_SEG 2
#define MCAN1_PHASE_SEG1 11
#define MCAN1_PHASE_SEG2 11
#define MCAN1_SYNC_JUMP 4
#define MCAN1_FAST_BIT_RATE_BPS 2000000
#define MCAN1_FAST_PROP_SEG 2
#define MCAN1_FAST_PHASE_SEG1 4
#define MCAN1_FAST_PHASE_SEG2 4
#define MCAN1_FAST_SYNC_JUMP 2
#define MCAN1_NMBR_STD_FLTS 8 /* 128 max filters */
#define MCAN1_NMBR_EXT_FLTS 8 /* 64 max filters */
#define MCAN1_NMBR_RX_FIFO0_ELMTS 12 /* # of elements, 64 elements max */
#define MCAN1_NMBR_RX_FIFO1_ELMTS 0 /* # of elements, 64 elements max */
#define MCAN1_NMBR_RX_DED_BUF_ELMTS 4 /* # of elements, 64 elements max */
#define MCAN1_NMBR_TX_EVT_FIFO_ELMTS 0 /* # of elements, 32 elements max */
#define MCAN1_NMBR_TX_DED_BUF_ELMTS 4 /* # of elements, 32 elements max */
#define MCAN1_NMBR_TX_FIFO_Q_ELMTS 4 /* # of elements, 32 elements max */
#define MCAN1_RX_FIFO0_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */
#define MCAN1_RX_FIFO1_ELMT_SZ 8 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */
#define MCAN1_RX_BUF_ELMT_SZ 64 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */
#define MCAN1_TX_BUF_ELMT_SZ 32 /* 8, 12, 16, 20, 24, 32, 48, 64 bytes */
#ifdef __cplusplus
}
#endif
#endif /* #ifndef _MCAN_CONFIG_ */

View File

@ -0,0 +1,75 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 OMNIVISION_H
#define OMNIVISION_H
/*---------------------------------------------------------------------------
* TYPE
*---------------------------------------------------------------------------*/
/** define a structure for ovxxxx register initialization values */
struct ov_reg
{
/* Register to be written */
uint16_t reg;
/* Value to be written in the register */
uint8_t val;
};
/*---------------------------------------------------------------------------
* DEFINITAION
*---------------------------------------------------------------------------*/
#define OV_2640 0x00
#define OV_2643 0x01
#define OV_5640 0x02
#define OV_7740 0x03
#define OV_9740 0x04
#define OV_UNKNOWN 0xFF
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern uint8_t ov_init(Twid *pTwid);
extern void ov_DumpRegisters8(Twid *pTwid);
extern void ov_DumpRegisters16(Twid *pTwid);
extern uint32_t ov_write_regs8(Twid *pTwid, const struct ov_reg* pReglist);
extern uint32_t ov_write_regs16(Twid *pTwid, const struct ov_reg* pReglist);
extern uint8_t ov_read_reg8(Twid *pTwid, uint8_t reg, uint8_t *pData);
extern uint8_t ov_read_reg16(Twid *pTwid, uint16_t reg, uint8_t *pData);
extern uint8_t ov_write_reg8(Twid *pTwid, uint8_t reg, uint8_t val);
extern uint8_t ov_write_reg16(Twid *pTwid, uint16_t reg, uint8_t val);
extern void isOV5640_AF_InitDone(Twid *pTwid);
extern uint32_t ov_5640_AF_single(Twid *pTwid);
extern uint32_t ov_5640_AF_continue(Twid *pTwid);
extern uint32_t ov_5640_AFPause(Twid *pTwid);
extern uint32_t ov_5640_AFrelease(Twid *pTwid);
#endif

View File

@ -0,0 +1,52 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 OV_H
#define OV_H
/*----------------------------------------------------------------------------
* Types
*----------------------------------------------------------------------------*/
/** Captor capture size */
typedef struct {
uint32_t width;
uint32_t height;
}capture_size;
extern const capture_size ov_sizes[];
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern void ov_configure(Twid *pTwid, uint8_t type, uint32_t width, uint32_t heigth);
extern void ov_5640Afc_Firmware(Twid *pTwid);
#endif

View File

@ -0,0 +1,387 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 _YUV_H_
#define _YUV_H_
/*---------------------------------------------------------------------------
* Headers
*---------------------------------------------------------------------------*/
/** Slave address of OMNIVISION chip. */
#define OV_I2C_SENSOR_ADDRESS (0x42u >> 1) /* OV7740 -> 0x42 */
/** Register definitions. */
/* -------- OV7740_GAIN : (Address: 0x00) AGC Gain Control LSBs -------- */
#define OV7740_GAIN (0x00u)
/* -------- OV7740_BGAIN : (Address: 0x01) AWB - Blue channel gain setting -- */
#define OV7740_BLUE_GAIN (0x01u)
/* -------- OV7740_RGAIN : (Address: 0x02) AWB - Red channel gain setting --- */
#define OV7740_RED_GAIN (0x02u)
/* -------- OV7740_GGAIN : (Address: 0x03) AWB - Green channel gain setting - */
#define OV7740_GREEN_GAIN (0x03u)
/* -------- OV7740_REG04 : (Address: 0x04) Analog setting -------- */
#define OV7740_REG04 (0x04u)
/* -------- OV7740_BAVG : (Address: 0x05) B Channel Average -------- */
#define OV7740_BLUE_AVG (0x05u)
/* -------- OV7740_GAVG : (Address: 0x06) G Channel Average -------- */
#define OV7740_GREEN_AVG (0x06u)
/* -------- OV7740_RAVG : (Address: 0x07) R Channel Average -------- */
#define OV7740_RED_AVG (0x07u)
/* -------- OV7740_PIDH : (Address: 0x0a) Product ID number MSB -------- */
#define OV7740_PIDH (0x0au)
#define OV7740_PIDH_DEFAULT (0x77u << 0)
/* -------- OV7740_PIDL : (Address: 0x0b) Product ID number LSB -------- */
#define OV7740_PIDL (0x0bu)
#define OV7740_PIDL_DEFAULT (0x40u << 0)
/* -------- OV7740_REG0C : (Address: 0x0b) -------- */
#define OV7740_REG0C (0x0c)
#define OV7740_REG0C_MAX_EXPOSURE_Pos (1)
/**< \brief (OV7740_REG0C) Max exposure = frame length - limit x 2 */
#define OV7740_REG0C_MAX_EXPOSURE_Msk (0x3u << OV7740_REG0C_MAX_EXPOSURE_Pos)
#define OV7740_REG0C_MAX_EXPOSURE(value) \
((OV7740_REG0C_MAX_EXPOSURE_Msk & ((value) << OV7740_REG0C_MAX_EXPOSURE_Pos)))
/**< \brief (OV7740_REG0C) High 8-bit MSB and LSB swap */
#define OV7740_REG0C_BYTE_SWAP_Msk (0x1u << 3)
/**< \brief (OV7740_REG0C) output Y9,Y8...Y3,Y2,Y1,Y0 */
#define OV7740_REG0C_BYTE_SWAP_DISABLE (0x0u << 3)
/**< \brief (OV7740_REG0C) output Y3,Y2...Y8,Y9,Y1,Y0 */
#define OV7740_REG0C_BYTE_SWAP_ENABLE (0x1u << 3)
/**< \brief (OV7740_REG0C) YUV output, Y <-> UV swap */
#define OV7740_REG0C_YUV_SWAP_Msk (0x1u << 4)
/**< \brief (OV7740_REG0C) output YUYVYUYV */
#define OV7740_REG0C_YUV_SWAP_DISABLE (0x0u << 4)
/**< \brief (OV7740_REG0C) output UYVYUYVY */
#define OV7740_REG0C_YUV_SWAP_ENABLE (0x1u << 4)
/**< \brief (OV7740_REG0C) Mirror enable */
#define OV7740_REG0C_MIRROR_ENABLE (0x1u << 6)
/**< \brief (OV7740_REG0C) Flip enable */
#define OV7740_REG0C_FLIP_ENABLE (0x1u << 7)
/* -------- OV7740_REG0D : (Address: 0x0d) Analog setting -------- */
#define OV7740_REG0D (0x0du)
/* -------- OV7740_REG0E : (Address: 0x0e) Analog setting -------- */
/* default value: OV7740_REG0E_BLC_BOTH|OV7740_REG0E_BLC_OPTICAL */
#define OV7740_REG0E (0x0eu)
#define OV7740_REG0E_OUTPUT_Pos (0)
/**< \brief (OV7740_REG0E) Output driving capability */
#define OV7740_REG0E_OUTPUT_Msk (0x3u << OV7740_REG0E_OUTPUT_Pos)
/**< \brief (OV7740_REG0E) 1x */
#define OV7740_REG0E_OUTPUT_1X (0x0u << OV7740_REG0E_OUTPUT_Pos)
/**< \brief (OV7740_REG0E) 2x */
#define OV7740_REG0E_OUTPUT_2X (0x1u << OV7740_REG0E_OUTPUT_Pos)
/**< \brief (OV7740_REG0E) 3x */
#define OV7740_REG0E_OUTPUT_3X (0x2u << OV7740_REG0E_OUTPUT_Pos)
/**< \brief (OV7740_REG0E) 4x */
#define OV7740_REG0E_OUTPUT_4X (0x3u << OV7740_REG0E_OUTPUT_Pos)
/**< \brief (OV7740_REG0E) Sleep mode */
#define OV7740_REG0E_SLEEP_MODE (0x1u << 3)
#define OV7740_REG0E_BLC_Pos (5)
/**< \brief (OV7740_REG0E) BLC line selection */
#define OV7740_REG0E_BLC_Msk (0x3u << OV7740_REG0E_BLC_Pos)
/**< \brief (OV7740_REG0E) Select both blue line and red line as BLC line. */
#define OV7740_REG0E_BLC_BOTH0 (0x0u << OV7740_REG0E_BLC_Pos)
/**< \brief (OV7740_REG0E) Select red line as BLC line. */
#define OV7740_REG0E_BLC_RED (0x1u << OV7740_REG0E_BLC_Pos)
/**< \brief (OV7740_REG0E) Select blue line as BLC line. */
#define OV7740_REG0E_BLC_BLUE (0x2u << OV7740_REG0E_BLC_Pos)
/**< \brief (OV7740_REG0E) Select both blue line and red line as BLC line. */
#define OV7740_REG0E_BLC_BOTH (0x3u << OV7740_REG0E_BLC_Pos)
/**< \brief (OV7740_REG0E) BLC line selection */
#define OV7740_REG0E_BLC_LINE_Msk (0x1u << 7)
/**< \brief (OV7740_REG0E) Electrical BLC */
#define OV7740_REG0E_BLC_LINE_ELECTRICAL (0x0u << 7)
/**< \brief (OV7740_REG0E) Optical BLC */
#define OV7740_REG0E_BLC_LINE_OPTICAL (0x1u << 7)
/* ----- OV7740_HAEC : (Address: 0x0f) Automatic exposure control bit [15:8] - */
#define OV7740_HAEC (0x0fu)
/* -------- OV7740_AEC : (Address: 0x10) Automatic exposure control bit [7:0]- */
#define OV7740_AEC (0x10u)
/* -------- OV7740_CLK : (Address: 0x11) Clock settings -------- */
/**< \brief (OV7740_CLK) sysclk=XVCLK1 x PLLDIV / [(CLK[5:0]+1) x2 xPreDiv] */
#define OV7740_CLK (0x11u)
#define OV7740_CLK_DIVIDER_Pos (0)
/**< \brief (OV7740_CLK) Clock divider */
#define OV7740_CLK_DIVIDER_Msk (0x3fu << OV7740_CLK_DIVIDER_Pos)
#define OV7740_CLK_DIVIDER(value) \
((OV7740_CLK_DIVIDER_Msk & ((value) << OV7740_CLK_DIVIDER_Pos)))
#define OV7740_CLK_PLL_Pos (6)
/**< \brief (OV7740_CLK) PLL setting - Changing this value is not recommended */
#define OV7740_CLK_PLL_Msk (0x3u << OV7740_CLK_PLL_Pos)
#define OV7740_CLK_PLL(value) \
((OV7740_CLK_PLL_Msk & ((value) << OV7740_CLK_PLL_Pos)))
#define FRAME_RATE_60 0x00
#define FRAME_RATE_30 0x01
#define FRAME_RATE_20 0x02
#define FRAME_RATE_15 0x03
#define FRAME_RATE_10 0x05
#define FRAME_RATE_7 0x07
#define PLL_DIV_DEFAULT 0x40
#define FRAME_RATE_7_MCK_132 0x0A
#define PLL_DIV_7_MCK_132 0xC0
/* -------- OV7740_REG12 : (Address: 0x12) -------- */
#define OV7740_REG12 (0x12u)
#define OV7740_REG12_RAW_RGB (0x1u << 0)
#define OV7740_REG12_SENSOR_RAW (0x1u << 4)
#define OV7740_REG12_CC656_MODE (0x1u << 5)
#define OV7740_REG12_VSKIP (0x1u << 6)
#define OV7740_REG12_RESET (0x1u << 7)
/* -------- OV7740_REG13 : (Address: 0x13) -------- */
#define OV7740_REG13 (0x13u)
/**< \brief (OV7740_REG13) Exposure auto/manual control selection */
#define OV7740_REG13_EXPOSURE_Msk (0x01u << 0)
#define OV7740_REG13_EXPOSURE_MANUAL (0x0u << 0)
#define OV7740_REG13_EXPOSURE_AUTO (0x1u << 0)
/**< \brief (OV7740_REG13) Auto white balance control selection */
#define OV7740_REG13_WBAL_Msk (0x1u << 1)
#define OV7740_REG13_WBAL_MANUAL (0x0u << 1)
#define OV7740_REG13_WBAL_AUTO (0x1u << 1)
/**< \brief (OV7740_REG13) AGC auto/manual control selection */
#define OV7740_REG13_AGC_Msk (0x1u << 2)
#define OV7740_REG13_AGC_MANUAL (0x0u << 2)
#define OV7740_REG13_AGC_AUTO (0x1u << 2)
/**< \brief (OV7740_REG13) LAEC enable */
#define OV7740_REG13_LAEC_Msk (0x1u << 3)
#define OV7740_REG13_LAEC_DISABLE (0x0u << 3)
#define OV7740_REG13_LAEC_ENABLE (0x1u << 3)
/**< \brief (OV7740_REG13) Banding option */
#define OV7740_REG13_BANDING_OPT_Msk (0x1u << 4)
/**< \brief (OV7740_REG13) Minimum exposure is limited to 1/120 or 1/100 second
when banding filter is enabled */
#define OV7740_REG13_BANDING_OPT_LIMITED (0x0u << 4)
/**< \brief (OV7740_REG13) Minimum exposure is allowed to be less than 1/120 or
1/100 second when banding filter is enabled */
#define OV7740_REG13_BANDING_OPT_ENABLE (0x1u << 4)
/**< \brief (OV7740_REG13) Banding enable */
#define OV7740_REG13_BANDING_Mask (0x1u << 5)
#define OV7740_REG13_BANDING_DISABLE (0x0u << 5)
#define OV7740_REG13_BANDING_ENABLE (0x1u << 5)
/**< \brief (OV7740_REG13) Enable frame drop function */
#define OV7740_REG13_FRAME_DROP_Mask (0x1u << 6)
#define OV7740_REG13_FRAME_DROP_DISABLE (0x0u << 6)
#define OV7740_REG13_FRAME_DROP_ENABLE (0x1u << 6)
/**< \brief (OV7740_REG13) AEC speed selection */
#define OV7740_REG13_AEC_Mask (0x1u << 7)
/**< \brief (OV7740_REG13) Normal */
#define OV7740_REG13_AEC_NORMAL (0x0u << 7)
/**< \brief (OV7740_REG13) Faster AEC correction */
#define OV7740_REG13_AEC_FASTER (0x1u << 7)
/* -------- OV7740_REG14 : (Address: 0x14) -------- */
#define OV7740_REG14 (0x14u)
/* -------- OV7740_REG15 : (Address: 0x15) -------- */
#define OV7740_REG15 (0x15u)
#define OV7740_REG15_GAIN_Pos (0)
/**< \brief (OV7740_REG15) AGC MSBs (digital gain) (LSBs in GAIN[7:0]) */
#define OV7740_REG15_GAIN_Msk (0x3u << OV7740_REG15_GAIN_Pos)
#define OV7740_REG15_GAIN(value) \
((OV7740_REG15_GAIN_Msk & ((value) << OV7740_REG15_GAIN_Pos)))
/**< \brief (OV7740_REG15) Night mode triggering point */
#define OV7740_REG15_NIGHT_Mask (0x3u << 2)
/**< \brief (OV7740_REG15) 2x gain */
#define OV7740_REG15_NIGHT_2X_GAIN (0x0u << 2)
/**< \brief (OV7740_REG15) 4x gain */
#define OV7740_REG15_NIGHT_4X_GAIN (0x1u << 2)
/**< \brief (OV7740_REG15) 8x gain */
#define OV7740_REG15_NIGHT_8X_GAIN (0x2u << 2)
/**< \brief (OV7740_REG15) 16x gain */
#define OV7740_REG15_NIGHT_16X_GAIN (0x3u << 2)
/**< \brief (OV7740_REG15) Ceiling of inserting frames */
#define OV7740_REG15_CEIL_Mask (0x3u << 4)
/**< \brief (OV7740_REG15) Up to 0 frames */
#define OV7740_REG15_CEIL_0 (0x0u << 4)
/**< \brief (OV7740_REG15) Up to 1 frames */
#define OV7740_REG15_CEIL_1 (0x1u << 4)
/**< \brief (OV7740_REG15) Up to 2 frames */
#define OV7740_REG15_CEIL_2 (0x2u << 4)
/**< \brief (OV7740_REG15) Up to 3 frames */
#define OV7740_REG15_CEIL_3 (0x3u << 4)
/**< \brief (OV7740_REG15) Up to 7 frames */
#define OV7740_REG15_CEIL_7 (0x7u << 4)
/**< \brief (OV7740_REG15) Enable inserting frames in night mode */
#define OV7740_REG15_ENABLE_NIGHT (0x1u << 7)
/* OV7740_REG16 : (Address: 0x16) */
#define OV7740_REG16 (0x16u)
/*
* OV7740_AHSTART : (Address: 0x17) Sensor Horizontal output start point
* 8 MSBs (LSBs in REG16[1:0])
*/
#define OV7740_AHSTART (0x17u)
/*
* OV7740_AHSIZE : (Address: 0x18) Sensor Horizontal output size 8 MSBs
* (LSBs in REG16[4:3])
*/
#define OV7740_AHSIZE (0x18u)
/*
* OV7740_AVSTART : (Address: 0x19) Sensor Vertical output start point 8 MSBs
* (LSBs in REG16[2])
*/
#define OV7740_AVSTART (0x19u)
/*
* OV7740_AVSIZE : (Address: 0x1a) Sensor Vertical output size 8 MSBs
* (LSBs in REG16[5])
*/
#define OV7740_AVSIZE (0x1au)
/* -------- OV7740_PIXEL_SHIFT : (Address: 0x1b) Pixel shift -------- */
#define OV7740_PIXEL_SHIFT (0x1bu)
/* -------- OV7740_MIDH : (Address: 0x1c) Manufacturer ID Byte - High ------- */
#define OV7740_MIDH (0x1cu)
#define OV7740_MIDH_DEFAULT (0x7fu << 0)
/* -------- OV7740_MIDL : (Address: 0x1d) Manufacturer ID Byte - Low -------- */
#define OV7740_MIDL (0x1du)
#define OV7740_MIDL_DEFAULT (0xa2u << 0)
/* -------- OV7740_REG1E : (Address: 0x1e) -------- */
#define OV7740_REG1E (0x1eu)
/* -------- OV7740_REG1F : (Address: 0x1f) -------- */
#define OV7740_REG1F (0x1fu)
/* -------- OV7740_REG1E : (Address: 0x1e) -------- */
#define OV7740_REG1E (0x1eu)
/* -------- OV7740_REG20 : (Address: 0x20) -------- */
#define OV7740_REG20 (0x20u)
/* -------- OV7740_REG21 : (Address: 0x21) -------- */
#define OV7740_REG21 (0x21u)
/* OV7740_REG21 : (Address: 0x24) Luminance signal high range for AEC/AGC
* operation.
*/
#define OV7740_WPT (0x24u)
/*
* OV7740_REG21 : (Address: 0x25) Luminance signal low range for AEC/AGC
* operation
*/
#define OV7740_BPT (0x25u)
/* --- OV7740_VPT : (Address: 0x26) effective only in AEG/AGC fast mode ---- */
#define OV7740_VPT (0x26u)
/* -------- OV7740_REG27 : (Address: 0x27) -------- */
#define OV7740_REG27 (0x27u)
/**< \brief (OV7740_REG27) Black sun cancellation enable */
#define OV7740_REG27_BLACKSUN (0x1u << 7)
/* -------- OV7740_REG28 : (Address: 0x28) -------- */
#define OV7740_REG28 (0x28u)
/**< \brief (OV7740_REG28) VSYNC polarity */
#define OV7740_REG28_VSYNC_Msk (0x1u << 1)
/**< \brief (OV7740_REG28) Positive */
#define OV7740_REG28_VSYNC_POSITIVE (0x1u << 0)
/**< \brief (OV7740_REG28) Negative */
#define OV7740_REG28_VSYNC_NEGATIVE (0x1u << 1)
/**< \brief (OV7740_REG28) No VSYNC output option */
#define OV7740_REG28_VSYNC_OUTPUT_Msk (0x1u << 3)
/**< \brief (OV7740_REG28) Still output VSYNC when frame drop */
#define OV7740_REG28_VSYNC_OUTPUT_STILL (0x0u << 3)
/**< \brief (OV7740_REG28) No VSYNC output when frame drop */
#define OV7740_REG28_VSYNC_OUTPUT_NONE (0x1u << 3)
/**< \brief (OV7740_REG28) HREF polarity */
#define OV7740_REG28_HREF_Msk (0x1u << 4)
/**< \brief (OV7740_REG28) Output positive HREF */
#define OV7740_REG28_HREF_POSITIVE (0x0u << 4)
/**< \brief (OV7740_REG28) Output negative HREF for data valid */
#define OV7740_REG28_HREF_NEGATIVE (0x1u << 4)
/**< \brief (OV7740_REG28) HSYNC polarity */
#define OV7740_REG28_HSYNC_Msk (0x1u << 5)
/**< \brief (OV7740_REG28) Positive */
#define OV7740_REG28_HSYNC_POSITIVE (0x0u << 5)
/**< \brief (OV7740_REG28) Negative */
#define OV7740_REG28_HSYNC_NEGATIVE (0x1u << 5)
/**< \brief (OV7740_REG28) HREF pin output swap */
#define OV7740_REG28_HREF_OUTPUT_Msk (0x1u << 6)
/**< \brief (OV7740_REG28) HREF */
#define OV7740_REG28_HREF_OUTPUT_HREF (0x0u << 6)
/**< \brief (OV7740_REG28) HSYNC */
#define OV7740_REG28_HREF_OUTPUT_HSYNC (0x1u << 6)
/**< \brief (OV7740_REG28) Output data bit reverse option */
#define OV7740_REG28_OUTPUT_REVERSE (0x1u << 7)
/* -------- OV7740_REG65 : (Address: 0x65) -------- */
#define OV7740_REG65 (0x65u)
/**< \brief (OV7740_REG65) Output data bit swap option */
#define OV7740_REG65_BIT_SWAP_Msk (0x1u << 3)
/**< \brief (OV7740_REG65) Output DATA[9:0] */
#define OV7740_REG65_BIT_SWAP_NORMAL (0x0u << 3)
/**< \brief (OV7740_REG65) Output DATA[0:9] */
#define OV7740_REG65_BIT_SWAP_REVERSE (0x1u << 3)
/* -------- OV7740_YUV422CTRL : (Address: 0xd9) -------- */
#define OV7740_YUV422CTRL (0xd9u)
/**< \brief (OV7740_YUV422CTRL) cnv_opt */
#define OV7740_YUV422CTRL_CNV_OPT_Msk (0x1u << 0)
/**< \brief (OV7740_YUV422CTRL) Average mode */
#define OV7740_YUV422CTRL_CNV_OPT_AVERAGE (0x0u << 0)
/**< \brief (OV7740_YUV422CTRL) Drop mode */
#define OV7740_YUV422CTRL_CNV_OPT_DROP (0x1u << 0)
/**< \brief (OV7740_YUV422CTRL) v_first */
#define OV7740_YUV422CTRL_V_FIRST_Msk (0x1u << 1)
/**< \brief (OV7740_YUV422CTRL) Output line will be YUYV... */
#define OV7740_YUV422CTRL_V_FIRST_YUYV (0x0u << 1)
/**< \brief (OV7740_YUV422CTRL) Output line will be YVYU... (it will affect
definition of U/V in SDE. If it is set, all registers in SDE about U/V must be
swapped */
#define OV7740_YUV422CTRL_V_FIRST_YVYU (0x1u << 1)
#endif // #ifndef _YUV_H_

View File

@ -0,0 +1,68 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 _YUV_H_
#define _YUV_H_
/*---------------------------------------------------------------------------
* Headers
*---------------------------------------------------------------------------*/
#include <board.h>
/*---------------------------------------------------------------------------
* Exported variable
*---------------------------------------------------------------------------*/
extern const struct ov_reg ov2640_yuv_vga[];
extern const struct ov_reg ov2640_yuv_qvga[];
extern const struct ov_reg ov2643_yuv_vga[];
extern const struct ov_reg ov2643_yuv_swvga[];
extern const struct ov_reg ov2643_yuv_uxga[];
extern const struct ov_reg ov2643_yuv_qvga[];
extern const struct ov_reg ov5640_yuv_vga[];
extern const struct ov_reg ov5640_yuv_sxga[];
extern const struct ov_reg ov5640_afc[];
extern const struct ov_reg OV7740_VGA_YUV422[];
extern const struct ov_reg OV7740_QVGA_YUV422[];
extern const struct ov_reg OV7740_QVGA_RGB888[];
extern const struct ov_reg OV7740_QQVGA_YUV422[];
extern const struct ov_reg OV7740_QQVGA_RGB888[];
extern const struct ov_reg OV7740_CIF_YUV422[];
extern const struct ov_reg OV7740_TEST_PATTERN[];
extern const struct ov_reg ov9740_yuv_sxga[];
extern const struct ov_reg ov9740_yuv_vga[];
#endif // #ifndef _YUV_H_

View File

@ -0,0 +1,49 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface for Real Time Clock calibration (RTC) .
*
*/
/** RTC crystal **/
typedef struct{
int8_t Tempr;
int16_t PPM;
uint8_t NEGPPM;
uint8_t HIGHPPM;
uint16_t CORRECTION;
}RTC_PPMLookup;
extern void RTC_ClockCalibration( Rtc* pRtc, int32_t CurrentTempr);

View File

@ -0,0 +1,252 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface for the S25fl1 Serial Flash driver.
*
*/
#ifndef S25FL1_H
#define S25FL1_H
#define USE_QSPI_DMA
/*----------------------------------------------------------------------------
* Macros
*----------------------------------------------------------------------------*/
#define Size(pAt25) ((pAt25)->pDesc->size)
#define PageSize(pAt25) ((pAt25)->pDesc->pageSize)
#define BlockSize(pAt25) ((pAt25)->pDesc->blockSize)
#define Name(pAt25) ((pAt25)->pDesc->name)
#define ManId(pAt25) (((pAt25)->pDesc->jedecId) & 0xFF)
#define PageNumber(pAt25) (Size(pAt25) / PageSize(pAt25))
#define BlockNumber(pAt25) (Size(pAt25) / BlockSize(pAt25))
#define PagePerBlock(pAt25) (BlockSize(pAt25) / PageSize(pAt25))
#define BlockEraseCmd(pAt25) ((pAt25)->pDesc->blockEraseCmd)
/*----------------------------------------------------------------------------
* Local definitions
*----------------------------------------------------------------------------*/
/** Device is protected, operation cannot be carried out. */
#define ERROR_PROTECTED 1
/** Device is busy executing a command. */
#define ERROR_BUSY 2
/** There was a problem while trying to program page data. */
#define ERROR_PROGRAM 3
/** There was an SPI communication error. */
#define ERROR_SPI 4
/** Device ready/busy status bit. */
#define STATUS_RDYBSY (1 << 0)
/** Device is ready. */
#define STATUS_RDYBSY_READY (0 << 0)
/** Device is busy with internal operations. */
#define STATUS_RDYBSY_BUSY (1 << 0)
/** Write enable latch status bit. */
#define STATUS_WEL (1 << 1)
/** Device is not write enabled. */
#define STATUS_WEL_DISABLED (0 << 1)
/** Device is write enabled. */
#define STATUS_WEL_ENABLED (1 << 1)
/** Software protection status bit-field. */
#define STATUS_SWP (3 << 2)
/** All sectors are software protected. */
#define STATUS_SWP_PROTALL (3 << 2)
/** Some sectors are software protected. */
#define STATUS_SWP_PROTSOME (1 << 2)
/** No sector is software protected. */
#define STATUS_SWP_PROTNONE (0 << 2)
/** Write protect pin status bit. */
#define STATUS_WPP (1 << 4)
/** Write protect signal is not asserted. */
#define STATUS_WPP_NOTASSERTED (0 << 4)
/** Write protect signal is asserted. */
#define STATUS_WPP_ASSERTED (1 << 4)
/** Erase/program error bit. */
#define STATUS_EPE (1 << 5)
/** Erase or program operation was successful. */
#define STATUS_EPE_SUCCESS (0 << 5)
/** Erase or program error detected. */
#define STATUS_EPE_ERROR (1 << 5)
/** Sector protection registers locked bit. */
#define STATUS_SPRL (1 << 7)
/** Sector protection registers are unlocked. */
#define STATUS_SPRL_UNLOCKED (0 << 7)
/** Sector protection registers are locked. */
#define STATUS_SPRL_LOCKED (1 << 7)
/** Quad enable bit */
#define STATUS_QUAD_ENABLE (1 << 1)
/** Quad enable bit */
#define STATUS_WRAP_ENABLE (0 << 4)
/** Latency control bits */
#define STATUS_LATENCY_CTRL (0xF << 0)
#define STATUS_WRAP_BYTE (1 << 5)
#define BLOCK_PROTECT_Msk (7 << 2)
#define TOP_BTM_PROTECT_Msk (1 << 5)
#define SEC_PROTECT_Msk (1 << 6)
#define CHIP_PROTECT_Msk (0x1F << 2)
/** Read array command code. */
#define READ_ARRAY 0x0B
/** Read array (low frequency) command code. */
#define READ_ARRAY_LF 0x03
/** Fast Read array command code. */
#define READ_ARRAY_DUAL 0x3B
/** Fast Read array command code. */
#define READ_ARRAY_QUAD 0x6B
/** Fast Read array command code. */
#define READ_ARRAY_DUAL_IO 0xBB
/** Fast Read array command code. */
#define READ_ARRAY_QUAD_IO 0xEB
/** Block erase command code (4K block). */
#define BLOCK_ERASE_4K 0x20
/** Block erase command code (32K block). */
#define BLOCK_ERASE_32K 0x52
/** Block erase command code (64K block). */
#define BLOCK_ERASE_64K 0xD8
/** Chip erase command code 1. */
#define CHIP_ERASE_1 0x60
/** Chip erase command code 2. */
#define CHIP_ERASE_2 0xC7
/** Byte/page program command code. */
#define BYTE_PAGE_PROGRAM 0x02
/** Sequential program mode command code 1. */
#define SEQUENTIAL_PROGRAM_1 0xAD
/** Sequential program mode command code 2. */
#define SEQUENTIAL_PROGRAM_2 0xAF
/** Write enable command code. */
#define WRITE_ENABLE 0x06
/** Write disable command code. */
#define WRITE_DISABLE 0x04
/** Protect sector command code. */
#define PROTECT_SECTOR 0x36
/** Unprotected sector command code. */
#define UNPROTECT_SECTOR 0x39
/** Read sector protection registers command code. */
#define READ_SECTOR_PROT 0x3C
/** Read status register command code. */
#define READ_STATUS_1 0x05
/** Read status register command code. */
#define READ_STATUS_2 0x35
/** Read status register command code. */
#define READ_STATUS_3 0x33
/** Write status register command code. */
#define WRITE_STATUS 0x01
/** Read manufacturer and device ID command code. */
#define READ_JEDEC_ID 0x9F
/** Deep power-down command code. */
#define DEEP_PDOWN 0xB9
/** Resume from deep power-down command code. */
#define RES_DEEP_PDOWN 0xAB
/** Resume from deep power-down command code. */
#define SOFT_RESET_ENABLE 0x66
/** Resume from deep power-down command code. */
#define SOFT_RESET 0x99
/** Resume from deep power-down command code. */
#define WRAP_ENABLE 0x77
/** SPI Flash Manufacturer JEDEC ID */
#define ATMEL_SPI_FLASH 0x1F
#define ST_SPI_FLASH 0x20
#define WINBOND_SPI_FLASH 0xEF
#define MACRONIX_SPI_FLASH 0xC2
#define SST_SPI_FLASH 0xBF
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
uint32_t S25FL1D_ReadJedecId(void);
void S25FL1D_InitFlashInterface(uint8_t Mode);
void S25FL1D_SoftReset(void);
unsigned char S25FL1D_Unprotect(void);
unsigned char S25FL1D_Protect(uint32_t StartAddr, uint32_t Size);
void S25FL1D_QuadMode(uint8_t Enable);
void S25FL1D_EnableWrap(uint8_t ByetAlign);
void S25FL1D_SetReadLatencyControl(uint8_t Latency);
unsigned char S25FL1D_EraseChip(void);
unsigned char S25FL1D_EraseSector( unsigned int address);
unsigned char S25FL1D_Erase64KBlock( unsigned int address);
unsigned char S25FL1D_Write(
uint32_t *pData,
uint32_t size,
uint32_t address,
uint8_t Secure);
extern unsigned char S25FL1D_Read(
uint32_t *pData,
uint32_t size,
uint32_t address);
extern unsigned char S25FL1D_ReadDual(
uint32_t *pData,
uint32_t size,
uint32_t address);
extern unsigned char S25FL1D_ReadQuad(
uint32_t *pData,
uint32_t size,
uint32_t address);
extern unsigned char S25FL1D_ReadDualIO(
uint32_t *pData,
uint32_t size,
uint32_t address,
uint8_t ContMode,
uint8_t Secure);
extern unsigned char S25FL1D_ReadQuadIO(
uint32_t *pData,
uint32_t size,
uint32_t address,
uint8_t ContMode,
uint8_t Secure);
#endif // #ifndef S25FL1_H

View File

@ -0,0 +1,65 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file syscalls.h
*
* Implementation of newlib syscall.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern caddr_t _sbrk ( int incr );
extern int link( char *old, char *new );
extern int _close( int file );
extern int _fstat( int file, struct stat *st );
extern int _isatty( int file );
extern int _lseek( int file, int ptr, int dir );
extern int _read(int file, char *ptr, int len);
extern int _write( int file, char *ptr, int len );

View File

@ -0,0 +1,160 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation WM8904 driver.
*
*/
#ifndef WM8904_H
#define WM8904_H
#include "board.h"
/*----------------------------------------------------------------------------
* Definitions
*----------------------------------------------------------------------------*/
#define WM8904_CSB_STATE (0x0 << 0)
/** Slave address */
#define WM8904_SLAVE_ADDRESS 0x1a | WM8904_CSB_STATE
#define CS2100_SLAVE_ADDRESS 0x4E
/** Reset register*/
#define WM8904_REG_RESET 0x00
/** Bias control 0 register*/
#define WM8904_REG_BIAS_CTRL0 0x04
/** VMID control 0 register*/
#define WM8904_REG_VMID_CTRL0 0x05
/** MIC Bias control 0 register*/
#define WM8904_REG_MICBIAS_CTRL0 0x06
/** Bias control 1 register*/
#define WM8904_REG_BIAS_CTRL1 0x07
/** Power management control 0 register*/
#define WM8904_REG_POWER_MANG0 0x0C
/** Power management control 2 register*/
#define WM8904_REG_POWER_MANG2 0x0E
/** Power management control 3 register*/
#define WM8904_REG_POWER_MANG3 0x0F
/** Power management control 6 register*/
#define WM8904_REG_POWER_MANG6 0x12
/** Clock rate0 register*/
#define WM8904_REG_CLOCK_RATE0 0x14
/** Clock rate1 register*/
#define WM8904_REG_CLOCK_RATE1 0x15
/** Clock rate2 register*/
#define WM8904_REG_CLOCK_RATE2 0x16
/** Audio interface0 register*/
#define WM8904_REG_AUD_INF0 0x18
/** Audio interface1 register*/
#define WM8904_REG_AUD_INF1 0x19
/** Audio interface2 register*/
#define WM8904_REG_AUD_INF2 0x1A
/** Audio interface3 register*/
#define WM8904_REG_AUD_INF3 0x1B
/** ADC digital 0 register*/
#define WM8904_REG_ADC_DIG0 0x20
/** ADC digital 1 register*/
#define WM8904_REG_ADC_DIG1 0x21
/** Analogue left input 0 register*/
#define WM8904_REG_ANALOGUE_LIN0 0x2C
/** Analogue right input 0 register*/
#define WM8904_REG_ANALOGUE_RIN0 0x2D
/** Analogue left input 1 register*/
#define WM8904_REG_ANALOGUE_LIN1 0x2E
/** Analogue right input 1 register*/
#define WM8904_REG_ANALOGUE_RIN1 0x2F
/** Analogue left output 1 register*/
#define WM8904_REG_ANALOGUE_LOUT1 0x39
/** Analogue right output 1 register*/
#define WM8904_REG_ANALOGUE_ROUT1 0x3A
/** Analogue left output 2 register*/
#define WM8904_REG_ANALOGUE_LOUT2 0x3B
/** Analogue right output 2 register*/
#define WM8904_REG_ANALOGUE_ROUT2 0x3C
/** Analogue output 12 ZC register*/
#define WM8904_REG_ANALOGUE_OUT12ZC 0x3D
/** DC servo 0 register*/
#define WM8904_REG_DC_SERVO0 0x43
/** Analogue HP 0 register*/
#define WM8904_REG_ANALOGUE_HP0 0x5A
/** Charge pump 0 register*/
#define WM8904_REG_CHARGE_PUMP0 0x62
/** Class W 0 register*/
#define WM8904_REG_CLASS0 0x68
/** FLL control 1 register*/
#define WM8904_REG_FLL_CRTL1 0x74
/** FLL control 2 register*/
#define WM8904_REG_FLL_CRTL2 0x75
/** FLL control 3 register*/
#define WM8904_REG_FLL_CRTL3 0x76
/** FLL control 4 register*/
#define WM8904_REG_FLL_CRTL4 0x77
/** FLL control 5 register*/
#define WM8904_REG_FLL_CRTL5 0x78
/** DUMMY register*/
#define WM8904_REG_END 0xFF
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern uint16_t WM8904_Read(Twid *pTwid, uint32_t device, uint32_t regAddr);
extern void WM8904_Write(Twid *pTwid, uint32_t device, uint32_t regAddr,
uint16_t data);
extern uint8_t WM8904_Init(Twid *pTwid, uint32_t device, uint32_t PCK);
extern uint8_t WM8904_VolumeSet(Twid *pTwid, uint32_t device, uint16_t value);
extern void WM8904_IN2R_IN1L(Twid *pTwid, uint32_t device);
#endif // WM8904_H

View File

@ -0,0 +1,139 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/* Section Definitions */
SECTIONS
{
.text :
{
. = ALIGN(4);
_sfixed = .;
KEEP(*(.vectors .vectors.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
*(.ARM.extab* .gnu.linkonce.armextab.*)
/* Support C constructors, and C destructors in both user code
and the C library. This also provides support for C++ code. */
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
. = ALIGN(0x4);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
. = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
. = ALIGN(4);
_efixed = .; /* End of text section */
} > rom
/* .ARM.exidx is sorted, so has to go in its own output section. */
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > rom
PROVIDE_HIDDEN (__exidx_end = .);
. = ALIGN(4);
_etext = .;
.relocate : AT (_etext)
{
. = ALIGN(4);
_srelocate = .;
*(.ramfunc .ramfunc.*);
*(.data .data.*);
. = ALIGN(4);
_erelocate = .;
} > ram
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
. = ALIGN(4);
_sbss = . ;
_szero = .;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
_ezero = .;
} > ram
/* stack section */
.stack (NOLOAD):
{
. = ALIGN(8);
_sstack = .;
. = . + STACK_SIZE;
. = ALIGN(8);
_estack = .;
} > ram
/* heap section */
.heap (NOLOAD):
{
. = ALIGN(8);
_sheap = .;
. = . + HEAP_SIZE;
. = ALIGN(8);
_eheap = .;
} > ram
. = ALIGN(4);
_end = . ;
_ram_end_ = ORIGIN(ram) + LENGTH(ram) -1 ;
}

View File

@ -0,0 +1,10 @@
SECTIONS
{
_sdram_lma = .;
sdram_region :
AT ( _sdram_lma )
{
*(sdram_region)
} >sdram
}

View File

@ -0,0 +1,139 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/* Section Definitions */
SECTIONS
{
.text :
{
. = ALIGN(4);
_sfixed = .;
KEEP(*(.vectors .vectors.*))
*(.text .text.* .gnu.linkonce.t.*)
*(.glue_7t) *(.glue_7)
*(.rodata .rodata* .gnu.linkonce.r.*)
*(.ARM.extab* .gnu.linkonce.armextab.*)
/* Support C constructors, and C destructors in both user code
and the C library. This also provides support for C++ code. */
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
. = ALIGN(0x4);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
. = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
. = ALIGN(4);
_efixed = .; /* End of text section */
} > ram
. = ALIGN(8);
_etext = .;
.relocate : AT (_etext)
{
. = ALIGN(8);
_srelocate = .;
*(.ramfunc .ramfunc.*);
*(.data .data.*);
. = ALIGN(4);
_erelocate = .;
} > ram
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
. = ALIGN(4);
_sbss = . ;
_szero = .;
*(.bss .bss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
_ezero = .;
} > ram
/* stack section */
.stack (NOLOAD):
{
. = ALIGN(8);
_sstack = .;
. = . + STACK_SIZE;
. = ALIGN(8);
_estack = .;
} > ram
/* heap section */
.heap (NOLOAD):
{
. = ALIGN(8);
_sheap = .;
. = . + HEAP_SIZE;
. = ALIGN(8);
_eheap = .;
} > ram
/* .ARM.exidx is sorted, so has to go in its own output section. */
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > ram
PROVIDE_HIDDEN (__exidx_end = .);
. = ALIGN(4);
_end = . ;
_ram_end_ = ORIGIN(ram) + LENGTH(ram) -1 ;
}

View File

@ -0,0 +1,28 @@
#*************************************************
#
# Connect to J-Link and debug application in sram.
#
# define 'reset' command
define reset
# Connect to the J-Link gdb server
target remote localhost:2331
# Reset the chip to get to a known state
monitor reset
# Load the program
load
# Reset peripheral (RSTC_CR)
set *0x400E1800 = 0xA5000004
# Initializing PC and stack pointer
mon reg sp = (0x20400000)
set *0x20400004 = *0x20400004 & 0xFFFFFFFE
mon reg pc=(0x20400004)
info reg
# end of 'reset' command
end

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71J19
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00040000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_flash.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71J19
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00040000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71J20
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00080000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00080000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_flash.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71J20
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00080000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00080000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71J21
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_flash.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71J21
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71N19
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00100000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_flash.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71N19
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00100000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71N20
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00040000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_flash.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71N20
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00040000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71N21
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00080000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00040000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_flash.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71N21
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00080000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00040000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71Q19
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00080000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_flash.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71Q19
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00080000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71Q20
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00100000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_flash.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71Q20
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00100000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal FLASH on the ATSAMV71Q21
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_flash.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,53 @@
/* ---------------------------------------------------------------------------- */
/* Atmel Microcontroller Software Support */
/* SAM Software Package License */
/* ---------------------------------------------------------------------------- */
/* Copyright (c) 2014, Atmel Corporation */
/* */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without */
/* modification, are permitted provided that the following condition is met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, */
/* this list of conditions and the disclaimer below. */
/* */
/* Atmel's name may not be used to endorse or promote products derived from */
/* this software without specific prior written permission. */
/* */
/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
/* DISCLAIMED. IN NO EVENT SHALL ATMEL 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. */
/* ---------------------------------------------------------------------------- */
/*------------------------------------------------------------------------------
* Linker script for running in internal SRAM on the ATSAMV71Q21
*----------------------------------------------------------------------------*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00400000, LENGTH = 0x00200000
ram (rwx) : ORIGIN = 0x20400000, LENGTH = 0x00060000
sdram(rwx): ORIGIN = 0x70000000, LENGTH = 0x00200000
}
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : 0x2000;
/* The heapsize used by the application. NOTE: you need to adjust according to your application. */
HEAP_SIZE = DEFINED(HEAP_SIZE) ? HEAP_SIZE : 0x1000;
INCLUDE sam_sram.ld
INCLUDE sam_sdram.ld

View File

@ -0,0 +1,394 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
#include "samv71.h"
/* Initialize segments */
extern uint32_t _sfixed;
extern uint32_t _efixed;
extern uint32_t _etext;
extern uint32_t _srelocate;
extern uint32_t _erelocate;
extern uint32_t _szero;
extern uint32_t _ezero;
extern uint32_t _sstack;
extern uint32_t _estack;
/** \cond DOXYGEN_SHOULD_SKIP_THIS */
int main(void);
/** \endcond */
void __libc_init_array(void);
void LowLevelInit(void);
/* Default empty handler */
void Dummy_Handler(void);
#pragma weak NMI_Handler=Dummy_Handler
#pragma weak HardFault_Handler=Dummy_Handler
#pragma weak MemManage_Handler=Dummy_Handler
#pragma weak BusFault_Handler=Dummy_Handler
#pragma weak UsageFault_Handler=Dummy_Handler
#pragma weak SVC_Handler=Dummy_Handler
#pragma weak DebugMon_Handler=Dummy_Handler
#pragma weak PendSV_Handler=Dummy_Handler
#pragma weak SysTick_Handler=Dummy_Handler
/* Peripherals handlers */
#pragma weak SUPC_Handler=Dummy_Handler
#pragma weak RSTC_Handler=Dummy_Handler
#pragma weak RTC_Handler=Dummy_Handler
#pragma weak RTT_Handler=Dummy_Handler
#pragma weak WDT_Handler=Dummy_Handler
#pragma weak PMC_Handler=Dummy_Handler
#pragma weak EFC_Handler=Dummy_Handler
#pragma weak UART0_Handler=Dummy_Handler
#pragma weak UART1_Handler=Dummy_Handler
#pragma weak PIOA_Handler=Dummy_Handler
#pragma weak PIOB_Handler=Dummy_Handler
#ifdef _SAMV71_PIOC_INSTANCE_
#pragma weak PIOC_Handler=Dummy_Handler
#endif /* _SAM_PIOC_INSTANCE_ */
#pragma weak USART0_Handler=Dummy_Handler
#pragma weak USART1_Handler=Dummy_Handler
#pragma weak USART2_Handler=Dummy_Handler
#pragma weak PIOD_Handler=Dummy_Handler
#ifdef _SAMV71_PIOE_INSTANCE_
#pragma weak PIOE_Handler=Dummy_Handler
#endif /* _SAM_PIOE_INSTANCE_ */
#ifdef _SAMV71_HSMCI_INSTANCE_
#pragma weak HSMCI_Handler=Dummy_Handler
#endif /* _SAM_HSMCI_INSTANCE_ */
#pragma weak TWIHS0_Handler=Dummy_Handler
#pragma weak TWIHS1_Handler=Dummy_Handler
#pragma weak SPI0_Handler=Dummy_Handler
#pragma weak SSC_Handler=Dummy_Handler
#pragma weak TC0_Handler=Dummy_Handler
#pragma weak TC1_Handler=Dummy_Handler
#pragma weak TC2_Handler=Dummy_Handler
#ifdef _SAMV71_TC1_INSTANCE_
#pragma weak TC3_Handler=Dummy_Handler
#endif /* _SAM_TC1_INSTANCE_ */
#ifdef _SAMV71_TC1_INSTANCE_
#pragma weak TC4_Handler=Dummy_Handler
#endif /* _SAM_TC1_INSTANCE_ */
#ifdef _SAMV71_TC1_INSTANCE_
#pragma weak TC5_Handler=Dummy_Handler
#endif /* _SAM_TC1_INSTANCE_ */
#pragma weak AFEC0_Handler=Dummy_Handler
#ifdef _SAMV71_DACC_INSTANCE_
#pragma weak DACC_Handler=Dummy_Handler
#endif /* _SAM_DACC_INSTANCE_ */
#pragma weak PWM0_Handler=Dummy_Handler
#pragma weak ICM_Handler=Dummy_Handler
#pragma weak ACC_Handler=Dummy_Handler
#pragma weak USBHS_Handler=Dummy_Handler
#pragma weak MCAN0_Handler=Dummy_Handler
#pragma weak MCAN0_Line1_Handler=Dummy_Handler
#pragma weak MCAN1_Handler=Dummy_Handler
#pragma weak MCAN1_Line1_Handler=Dummy_Handler
#pragma weak GMAC_Handler=Dummy_Handler
#pragma weak GMACQ1_Handler=Dummy_Handler
#pragma weak GMACQ2_Handler=Dummy_Handler
#pragma weak AFEC1_Handler=Dummy_Handler
#ifdef _SAMV71_TWIHS2_INSTANCE_
#pragma weak TWIHS2_Handler=Dummy_Handler
#endif /* _SAM_TWI2_INSTANCE_ */
#pragma weak SPI1_Handler=Dummy_Handler
#pragma weak QSPI_Handler=Dummy_Handler
#pragma weak UART2_Handler=Dummy_Handler
#pragma weak UART3_Handler=Dummy_Handler
#pragma weak UART4_Handler=Dummy_Handler
#ifdef _SAMV71_TC2_INSTANCE_
#pragma weak TC6_Handler=Dummy_Handler
#endif /* _SAM_TC2_INSTANCE_ */
#ifdef _SAMV71_TC2_INSTANCE_
#pragma weak TC7_Handler=Dummy_Handler
#endif /* _SAM_TC2_INSTANCE_ */
#ifdef _SAMV71_TC2_INSTANCE_
#pragma weak TC8_Handler=Dummy_Handler
#endif /* _SAM_TC2_INSTANCE_ */
#pragma weak TC9_Handler=Dummy_Handler
#pragma weak TC10_Handler=Dummy_Handler
#pragma weak TC11_Handler=Dummy_Handler
#pragma weak MLB_Handler=Dummy_Handler
#pragma weak AES_Handler=Dummy_Handler
#pragma weak TRNG_Handler=Dummy_Handler
#pragma weak XDMAC_Handler=Dummy_Handler
#pragma weak ISI_Handler=Dummy_Handler
#pragma weak PWM1_Handler=Dummy_Handler
#pragma weak FPU_Handler=Dummy_Handler
#ifdef _SAMV71_SDRAMC_INSTANCE_
#pragma weak SDRAMC_Handler=Dummy_Handler
#endif /* _SAM_SDRAMC_INSTANCE_ */
#pragma weak RSWDT_Handler=Dummy_Handler
#pragma weak CCF_Handler=Dummy_Handler
#pragma weak CCW_Handler=Dummy_Handler
/* Exception Table */
__attribute__ ((section(".vectors")))
const DeviceVectors exception_table = {
/* Configure Initial Stack Pointer, using linker-generated symbols */
.pvStack = (void*) (&_estack),
.pfnReset_Handler = (void*) Reset_Handler,
.pfnNMI_Handler = (void*) NMI_Handler,
.pfnHardFault_Handler = (void*) HardFault_Handler,
.pfnMemManage_Handler = (void*) MemManage_Handler,
.pfnBusFault_Handler = (void*) BusFault_Handler,
.pfnUsageFault_Handler = (void*) UsageFault_Handler,
.pfnReserved1_Handler = (void*) (0UL), /* Reserved */
.pfnReserved2_Handler = (void*) (0UL), /* Reserved */
.pfnReserved3_Handler = (void*) (0UL), /* Reserved */
.pfnReserved4_Handler = (void*) (0UL), /* Reserved */
.pfnSVC_Handler = (void*) SVC_Handler,
.pfnDebugMon_Handler = (void*) DebugMon_Handler,
.pfnReserved5_Handler = (void*) (0UL), /* Reserved */
.pfnPendSV_Handler = (void*) PendSV_Handler,
.pfnSysTick_Handler = (void*) SysTick_Handler,
/* Configurable interrupts */
.pfnSUPC_Handler = (void*) SUPC_Handler, /* 0 Supply Controller */
.pfnRSTC_Handler = (void*) RSTC_Handler, /* 1 Reset Controller */
.pfnRTC_Handler = (void*) RTC_Handler, /* 2 Real Time Clock */
.pfnRTT_Handler = (void*) RTT_Handler, /* 3 Real Time Timer */
.pfnWDT_Handler = (void*) WDT_Handler, /* 4 Watchdog Timer 0 */
.pfnPMC_Handler = (void*) PMC_Handler, /* 5 Power Management Controller */
.pfnEFC_Handler = (void*) EFC_Handler, /* 6 Enhanced Embedded Flash Controller */
.pfnUART0_Handler = (void*) UART0_Handler, /* 7 UART 0 */
.pfnUART1_Handler = (void*) UART1_Handler, /* 8 UART 1 */
.pvReserved9 = (void*) (0UL), /* 9 Reserved */
.pfnPIOA_Handler = (void*) PIOA_Handler, /* 10 Parallel I/O Controller A */
.pfnPIOB_Handler = (void*) PIOB_Handler, /* 11 Parallel I/O Controller B */
#ifdef _SAMV71_PIOC_INSTANCE_
.pfnPIOC_Handler = (void*) PIOC_Handler, /* 12 Parallel I/O Controller C */
#else
.pvReserved12 = (void*) (0UL), /* 12 Reserved */
#endif /* _SAMV71_PIOC_INSTANCE_ */
.pfnUSART0_Handler = (void*) USART0_Handler, /* 13 USART 0 */
.pfnUSART1_Handler = (void*) USART1_Handler, /* 14 USART 1 */
.pfnUSART2_Handler = (void*) USART2_Handler, /* 15 USART 2 */
.pfnPIOD_Handler = (void*) PIOD_Handler, /* 16 Parallel I/O Controller D */
#ifdef _SAMV71_PIOE_INSTANCE_
.pfnPIOE_Handler = (void*) PIOE_Handler, /* 17 Parallel I/O Controller E */
#else
.pvReserved17 = (void*) (0UL), /* 17 Reserved */
#endif /* _SAMV71_PIOE_INSTANCE_ */
#ifdef _SAMV71_HSMCI_INSTANCE_
.pfnHSMCI_Handler = (void*) HSMCI_Handler, /* 18 Multimedia Card Interface */
#else
.pvReserved18 = (void*) (0UL), /* 18 Reserved */
#endif /* _SAMV71_HSMCI_INSTANCE_ */
.pfnTWIHS0_Handler = (void*) TWIHS0_Handler, /* 19 Two Wire Interface 0 HS */
.pfnTWIHS1_Handler = (void*) TWIHS1_Handler, /* 20 Two Wire Interface 1 HS */
.pfnSPI0_Handler = (void*) SPI0_Handler, /* 21 Serial Peripheral Interface 0 */
.pfnSSC_Handler = (void*) SSC_Handler, /* 22 Synchronous Serial Controller */
.pfnTC0_Handler = (void*) TC0_Handler, /* 23 Timer/Counter 0 */
.pfnTC1_Handler = (void*) TC1_Handler, /* 24 Timer/Counter 1 */
.pfnTC2_Handler = (void*) TC2_Handler, /* 25 Timer/Counter 2 */
#ifdef _SAMV71_TC1_INSTANCE_
.pfnTC3_Handler = (void*) TC3_Handler, /* 26 Timer/Counter 3 */
#else
.pvReserved26 = (void*) (0UL), /* 26 Reserved */
#endif /* _SAMV71_TC1_INSTANCE_ */
#ifdef _SAMV71_TC1_INSTANCE_
.pfnTC4_Handler = (void*) TC4_Handler, /* 27 Timer/Counter 4 */
#else
.pvReserved27 = (void*) (0UL), /* 27 Reserved */
#endif /* _SAMV71_TC1_INSTANCE_ */
#ifdef _SAMV71_TC1_INSTANCE_
.pfnTC5_Handler = (void*) TC5_Handler, /* 28 Timer/Counter 5 */
#else
.pvReserved28 = (void*) (0UL), /* 28 Reserved */
#endif /* _SAMV71_TC1_INSTANCE_ */
.pfnAFEC0_Handler = (void*) AFEC0_Handler, /* 29 Analog Front End 0 */
#ifdef _SAMV71_DACC_INSTANCE_
.pfnDACC_Handler = (void*) DACC_Handler, /* 30 Digital To Analog Converter */
#else
.pvReserved30 = (void*) (0UL), /* 30 Reserved */
#endif /* _SAMV71_DACC_INSTANCE_ */
.pfnPWM0_Handler = (void*) PWM0_Handler, /* 31 Pulse Width Modulation 0 */
.pfnICM_Handler = (void*) ICM_Handler, /* 32 Integrity Check Monitor */
.pfnACC_Handler = (void*) ACC_Handler, /* 33 Analog Comparator */
.pfnUSBHS_Handler = (void*) USBHS_Handler, /* 34 USB Host / Device Controller */
.pfnMCAN0_Handler = (void*) MCAN0_Handler, /* 35 CAN Controller 0 */
.pfnMCAN0_Line1_Handler = (void*) MCAN0_Line1_Handler, /* 36 CAN Controller 0 - Line 1 */
.pfnMCAN1_Handler = (void*) MCAN1_Handler, /* 37 CAN Controller 1 */
.pfnMCAN1_Line1_Handler = (void*) MCAN1_Line1_Handler, /* 38 CAN Controller 1 - Line 1 */
.pfnGMAC_Handler = (void*) GMAC_Handler, /* 39 Ethernet MAC */
.pfnAFEC1_Handler = (void*) AFEC1_Handler, /* 40 Analog Front End 1 */
#ifdef _SAMV71_TWIHS2_INSTANCE_
.pfnTWIHS2_Handler = (void*) TWIHS2_Handler, /* 41 Two Wire Interface 2 HS */
#else
.pvReserved41 = (void*) (0UL), /* 41 Reserved */
#endif /* _SAMV71_TWI2_INSTANCE_ */
.pfnSPI1_Handler = (void*) SPI1_Handler, /* 42 Serial Peripheral Interface 1 */
.pfnQSPI_Handler = (void*) QSPI_Handler, /* 43 Quad I/O Serial Peripheral Interface */
.pfnUART2_Handler = (void*) UART2_Handler, /* 44 UART 2 */
.pfnUART3_Handler = (void*) UART3_Handler, /* 45 UART 3 */
.pfnUART4_Handler = (void*) UART4_Handler, /* 46 UART 4 */
#ifdef _SAMV71_TC2_INSTANCE_
.pfnTC6_Handler = (void*) TC6_Handler, /* 47 Timer/Counter 6 */
#else
.pvReserved47 = (void*) (0UL), /* 47 Reserved */
#endif /* _SAMV71_TC2_INSTANCE_ */
#ifdef _SAMV71_TC2_INSTANCE_
.pfnTC7_Handler = (void*) TC7_Handler, /* 48 Timer/Counter 7 */
#else
.pvReserved48 = (void*) (0UL), /* 48 Reserved */
#endif /* _SAMV71_TC2_INSTANCE_ */
#ifdef _SAMV71_TC2_INSTANCE_
.pfnTC8_Handler = (void*) TC8_Handler, /* 49 Timer/Counter 8 */
#else
.pvReserved49 = (void*) (0UL), /* 49 Reserved */
#endif /* _SAMV71_TC2_INSTANCE_ */
.pfnTC9_Handler = (void*) TC9_Handler, /* 50 Timer/Counter 9 */
.pfnTC10_Handler = (void*) TC10_Handler, /* 51 Timer/Counter 10 */
.pfnTC11_Handler = (void*) TC11_Handler, /* 52 Timer/Counter 11 */
.pfnMLB_Handler = (void*) MLB_Handler, /* 53 MediaLB */
.pvReserved54 = (void*) (0UL), /* 54 Reserved */
.pvReserved55 = (void*) (0UL), /* 55 Reserved */
.pfnAES_Handler = (void*) AES_Handler, /* 56 AES */
.pfnTRNG_Handler = (void*) TRNG_Handler, /* 57 True Random Generator */
.pfnXDMAC_Handler = (void*) XDMAC_Handler, /* 58 DMA */
.pfnISI_Handler = (void*) ISI_Handler, /* 59 Camera Interface */
.pfnPWM1_Handler = (void*) PWM1_Handler, /* 60 Pulse Width Modulation 1 */
.pvReserved61 = (void*) (0UL), /* 61 Reserved */
#ifdef _SAMV71_SDRAMC_INSTANCE_
.pfnSDRAMC_Handler = (void*) SDRAMC_Handler, /* 62 SDRAM Controller */
#else
.pvReserved62 = (void*) (0UL), /* 62 Reserved */
#endif /* _SAMV71_SDRAMC_INSTANCE_ */
.pfnRSWDT_Handler = (void*) RSWDT_Handler /* 63 Watchdog Timer 1 */
};
#ifdef ENABLE_TCM
/** \brief TCM memory enable
The function enables TCM memories
*/
__STATIC_INLINE void TCM_Enable(void)
{
__DSB();
__ISB();
SCB->ITCMCR = (SCB_ITCMCR_EN_Msk | SCB_ITCMCR_RMW_Msk
| SCB_ITCMCR_RETEN_Msk);
SCB->DTCMCR = ( SCB_DTCMCR_EN_Msk | SCB_DTCMCR_RMW_Msk
| SCB_DTCMCR_RETEN_Msk);
__DSB();
__ISB();
}
#endif
/** \brief TCM memory Disable
The function enables TCM memories
*/
__STATIC_INLINE void TCM_Disable(void)
{
__DSB();
__ISB();
SCB->ITCMCR &= ~(uint32_t)SCB_ITCMCR_EN_Msk;
SCB->DTCMCR &= ~(uint32_t)SCB_ITCMCR_EN_Msk;
__DSB();
__ISB();
}
/**
* \brief This is the code that gets called on processor reset.
* To initialize the device, and call the main() routine.
*/
void Reset_Handler(void)
{
uint32_t *pSrc, *pDest;
/* Initialize the relocate segment */
pSrc = &_etext;
pDest = &_srelocate;
if (pSrc != pDest) {
for (; pDest < &_erelocate;) {
*pDest++ = *pSrc++;
}
}
/* Clear the zero segment */
for (pDest = &_szero; pDest < &_ezero;) {
*pDest++ = 0;
}
/* Set the vector table base address */
pSrc = (uint32_t *) & _sfixed;
SCB->VTOR = ((uint32_t) pSrc & SCB_VTOR_TBLOFF_Msk);
#ifdef ENABLE_TCM
// 32 Kb
EFC->EEFC_FCR = (EEFC_FCR_FKEY_PASSWD | EEFC_FCR_FCMD_CGPB
| EEFC_FCR_FARG(8));
EFC->EEFC_FCR = (EEFC_FCR_FKEY_PASSWD | EEFC_FCR_FCMD_SGPB
| EEFC_FCR_FARG(7));
TCM_Enable();
#else
EFC->EEFC_FCR = (EEFC_FCR_FKEY_PASSWD | EEFC_FCR_FCMD_CGPB
| EEFC_FCR_FARG(8));
EFC->EEFC_FCR = (EEFC_FCR_FKEY_PASSWD | EEFC_FCR_FCMD_CGPB
| EEFC_FCR_FARG(7));
TCM_Disable();
#endif
LowLevelInit();
/* Initialize the C library */
__libc_init_array();
/* Branch to main function */
main();
/* Infinite loop */
while (1);
}
/**
* \brief Default interrupt handler for unused IRQs.
*/
void Dummy_Handler(void)
{
while (1) {
}
}

View File

@ -0,0 +1,325 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
#include "samv71.h"
/* @cond 0 */
/**INDENT-OFF**/
#ifdef __cplusplus
extern "C" {
#endif
/**INDENT-ON**/
/* @endcond */
/* %ATMEL_SYSTEM% */
/* Clock Settings (500MHz PLL VDDIO 3.3V and VDDCORE 1.2V) */
/* Clock Settings (300MHz HCLK, 150MHz MCK)=> PRESC = 1, MDIV = 2 */
#define SYS_BOARD_OSCOUNT (CKGR_MOR_MOSCXTST(0x8U))
#define SYS_BOARD_PLLAR (CKGR_PLLAR_ONE | CKGR_PLLAR_MULA(0x18U) | \
CKGR_PLLAR_PLLACOUNT(0x3fU) | CKGR_PLLAR_DIVA(0x1U))
#define SYS_BOARD_MCKR (PMC_MCKR_PRES_CLK_1 | PMC_MCKR_CSS_PLLA_CLK \
| PMC_MCKR_MDIV_PCK_DIV2)
uint32_t SystemCoreClock = CHIP_FREQ_MAINCK_RC_4MHZ;
#define USBCLK_DIV 10
/**
* \brief Set up the Microcontroller system.
* Initialize the System and update the SystemFrequency variable.
*/
void SystemInit( void )
{
uint32_t read_MOR;
/* Set FWS according to SYS_BOARD_MCKR configuration */
EFC->EEFC_FMR = EEFC_FMR_FWS(5);
/* Before switching MAIN OSC on external crystal : enable it and don't
* disable at the same time RC OSC in case of if MAIN OSC is still using RC
* OSC
*/
read_MOR = PMC->CKGR_MOR;
/* enable external crystal - enable RC OSC */
read_MOR |= (CKGR_MOR_KEY_PASSWD |CKGR_MOR_XT32KFME);
PMC->CKGR_MOR = read_MOR;
/* Select XTAL 32k instead of internal slow RC 32k for slow clock */
if ( (SUPC->SUPC_SR & SUPC_SR_OSCSEL) != SUPC_SR_OSCSEL_CRYST )
{
SUPC->SUPC_CR = SUPC_CR_KEY_PASSWD | SUPC_CR_XTALSEL_CRYSTAL_SEL;
while( !(SUPC->SUPC_SR & SUPC_SR_OSCSEL) );
}
/* Initialize main oscillator */
if ( !(PMC->CKGR_MOR & CKGR_MOR_MOSCSEL) )
{
PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD | SYS_BOARD_OSCOUNT
| CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN;
while ( !(PMC->PMC_SR & PMC_SR_MOSCXTS) )
{
}
}
/* Switch to 3-20MHz Xtal oscillator */
PMC->CKGR_MOR = CKGR_MOR_KEY_PASSWD | SYS_BOARD_OSCOUNT
| CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTEN | CKGR_MOR_MOSCSEL;
while ( !(PMC->PMC_SR & PMC_SR_MOSCSELS) )
{
}
PMC->PMC_MCKR = (PMC->PMC_MCKR & ~(uint32_t)PMC_MCKR_CSS_Msk)
| PMC_MCKR_CSS_MAIN_CLK;
while ( !(PMC->PMC_SR & PMC_SR_MCKRDY) )
{
}
/* Initialize PLLA */
PMC->CKGR_PLLAR = SYS_BOARD_PLLAR;
while ( !(PMC->PMC_SR & PMC_SR_LOCKA) )
{
}
/* Switch to main clock */
PMC->PMC_MCKR = (SYS_BOARD_MCKR & ~PMC_MCKR_CSS_Msk) | PMC_MCKR_CSS_MAIN_CLK;
while ( !(PMC->PMC_SR & PMC_SR_MCKRDY) )
{
}
/* Switch to PLLA */
PMC->PMC_MCKR = SYS_BOARD_MCKR;
while ( !(PMC->PMC_SR & PMC_SR_MCKRDY) )
{
}
SystemCoreClock = CHIP_FREQ_CPU_MAX;
}
void SystemCoreClockUpdate( void )
{
/* Determine clock frequency according to clock register values */
switch (PMC->PMC_MCKR & (uint32_t) PMC_MCKR_CSS_Msk)
{
case PMC_MCKR_CSS_SLOW_CLK: /* Slow clock */
if ( SUPC->SUPC_SR & SUPC_SR_OSCSEL )
{
SystemCoreClock = CHIP_FREQ_XTAL_32K;
}
else
{
SystemCoreClock = CHIP_FREQ_SLCK_RC;
}
break;
case PMC_MCKR_CSS_MAIN_CLK: /* Main clock */
if ( PMC->CKGR_MOR & CKGR_MOR_MOSCSEL )
{
SystemCoreClock = CHIP_FREQ_XTAL_12M;
}
else
{
SystemCoreClock = CHIP_FREQ_MAINCK_RC_4MHZ;
switch ( PMC->CKGR_MOR & CKGR_MOR_MOSCRCF_Msk )
{
case CKGR_MOR_MOSCRCF_4_MHz:
break;
case CKGR_MOR_MOSCRCF_8_MHz:
SystemCoreClock *= 2U;
break;
case CKGR_MOR_MOSCRCF_12_MHz:
SystemCoreClock *= 3U;
break;
default:
break;
}
}
break;
case PMC_MCKR_CSS_PLLA_CLK: /* PLLA clock */
if ( PMC->CKGR_MOR & CKGR_MOR_MOSCSEL )
{
SystemCoreClock = CHIP_FREQ_XTAL_12M ;
}
else
{
SystemCoreClock = CHIP_FREQ_MAINCK_RC_4MHZ;
switch ( PMC->CKGR_MOR & CKGR_MOR_MOSCRCF_Msk )
{
case CKGR_MOR_MOSCRCF_4_MHz:
break;
case CKGR_MOR_MOSCRCF_8_MHz:
SystemCoreClock *= 2U;
break;
case CKGR_MOR_MOSCRCF_12_MHz:
SystemCoreClock *= 3U;
break;
default:
break;
}
}
if ( (uint32_t) (PMC->PMC_MCKR & (uint32_t) PMC_MCKR_CSS_Msk)
== PMC_MCKR_CSS_PLLA_CLK )
{
SystemCoreClock *= ((((PMC->CKGR_PLLAR) & CKGR_PLLAR_MULA_Msk)
>> CKGR_PLLAR_MULA_Pos) + 1U);
SystemCoreClock /= ((((PMC->CKGR_PLLAR) & CKGR_PLLAR_DIVA_Msk)
>> CKGR_PLLAR_DIVA_Pos));
}
break;
default:
break;
}
if ( (PMC->PMC_MCKR & PMC_MCKR_PRES_Msk) == PMC_MCKR_PRES_CLK_3 )
{
SystemCoreClock /= 3U;
}
else
{
SystemCoreClock >>= ((PMC->PMC_MCKR & PMC_MCKR_PRES_Msk)
>> PMC_MCKR_PRES_Pos);
}
}
/**
* Initialize flash.
*/
void system_init_flash( uint32_t ul_clk )
{
/* Set FWS for embedded Flash access according to operating frequency */
if ( ul_clk < CHIP_FREQ_FWS_0 )
{
EFC->EEFC_FMR = EEFC_FMR_FWS(0)|EEFC_FMR_CLOE;
}
else
{
if (ul_clk < CHIP_FREQ_FWS_1)
{
EFC->EEFC_FMR = EEFC_FMR_FWS(1)|EEFC_FMR_CLOE;
}
else
{
if (ul_clk < CHIP_FREQ_FWS_2)
{
EFC->EEFC_FMR = EEFC_FMR_FWS(2)|EEFC_FMR_CLOE;
}
else
{
if ( ul_clk < CHIP_FREQ_FWS_3 )
{
EFC->EEFC_FMR = EEFC_FMR_FWS(3)|EEFC_FMR_CLOE;
}
else
{
if ( ul_clk < CHIP_FREQ_FWS_4 )
{
EFC->EEFC_FMR = EEFC_FMR_FWS(4)|EEFC_FMR_CLOE;
}
else
{
EFC->EEFC_FMR = EEFC_FMR_FWS(5)|EEFC_FMR_CLOE;
}
}
}
}
}
}
/**
* \brief Enable full speed USB clock.
*
* \note The SAM3X PMC hardware interprets div as div+1. For readability the hardware div+1
* is hidden in this implementation. Use div as div effective value.
*
* \param pll_id Source of the USB clock.
* \param div Actual clock divisor. Must be superior to 0.
*/
void sysclk_enable_usb(void)
{
/* Disable FS USB clock*/
PMC->PMC_SCDR = PMC_SCDR_USBCLK;
/* Enable PLL 480 MHz */
PMC->CKGR_UCKR = CKGR_UCKR_UPLLEN | CKGR_UCKR_UPLLCOUNT(0xF);
/* Wait that PLL is considered locked by the PMC */
while( !(PMC->PMC_SR & PMC_SR_LOCKU) );
/* USB clock register: USB Clock Input is UTMI PLL */
PMC->PMC_USB = (PMC_USB_USBS | PMC_USB_USBDIV(USBCLK_DIV - 1) );
PMC->PMC_SCER = PMC_SCER_USBCLK;
}
/**
* \brief Enable full speed USB clock.
*
* \note The SAM3X PMC hardware interprets div as div+1. For readability the hardware div+1
* is hidden in this implementation. Use div as div effective value.
*
* \param pll_id Source of the USB clock.
* \param div Actual clock divisor. Must be superior to 0.
*/
void sysclk_disable_usb(void)
{
/* Disable FS USB clock*/
PMC->PMC_SCDR = PMC_SCDR_USBCLK;
/* Enable PLL 480 MHz */
PMC->CKGR_UCKR = CKGR_UCKR_UPLLEN | CKGR_UCKR_UPLLCOUNT(0xF);
/* Wait that PLL is considered locked by the PMC */
while( !(PMC->PMC_SR & PMC_SR_LOCKU) );
/* USB clock register: USB Clock Input is UTMI PLL */
PMC->PMC_USB = (PMC_USB_USBS | PMC_USB_USBDIV(USBCLK_DIV - 1) );
}
/* @cond 0 */
/**INDENT-OFF**/
#ifdef __cplusplus
}
#endif
/**INDENT-ON**/
/* @endcond */

View File

@ -0,0 +1,341 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Provides the low-level initialization function that called on chip startup.
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#if defined(ENABLE_TCM) && defined(__GNUC__)
extern char _itcm_lma, _sitcm, _eitcm;
#endif
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/* Default memory map
Address range Memory region Memory type Shareability Cache policy
0x00000000- 0x1FFFFFFF Code Normal Non-shareable WT
0x20000000- 0x3FFFFFFF SRAM Normal Non-shareable WBWA
0x40000000- 0x5FFFFFFF Peripheral Device Non-shareable -
0x60000000- 0x7FFFFFFF RAM Normal Non-shareable WBWA
0x80000000- 0x9FFFFFFF RAM Normal Non-shareable WT
0xA0000000- 0xBFFFFFFF Device Device Shareable
0xC0000000- 0xDFFFFFFF Device Device Non Shareable
0xE0000000- 0xFFFFFFFF System - -
*/
/**
* \brief Set up a memory region.
*/
void _SetupMemoryRegion( void )
{
uint32_t dwRegionBaseAddr;
uint32_t dwRegionAttr;
memory_barrier();
/***************************************************
ITCM memory region --- Normal
START_Addr:- 0x00000000UL
END_Addr:- 0x00400000UL
****************************************************/
dwRegionBaseAddr =
ITCM_START_ADDRESS |
MPU_REGION_VALID |
MPU_DEFAULT_ITCM_REGION; // 1
dwRegionAttr =
MPU_AP_PRIVILEGED_READ_WRITE |
MPU_CalMPURegionSize(ITCM_END_ADDRESS - ITCM_START_ADDRESS) |
MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/****************************************************
Internal flash memory region --- Normal read-only
(update to Strongly ordered in write accesses)
START_Addr:- 0x00400000UL
END_Addr:- 0x00600000UL
******************************************************/
dwRegionBaseAddr =
IFLASH_START_ADDRESS |
MPU_REGION_VALID |
MPU_DEFAULT_IFLASH_REGION; //2
dwRegionAttr =
MPU_AP_READONLY |
INNER_NORMAL_WB_NWA_TYPE( NON_SHAREABLE ) |
MPU_CalMPURegionSize(IFLASH_END_ADDRESS - IFLASH_START_ADDRESS) |
MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/****************************************************
DTCM memory region --- Normal
START_Addr:- 0x20000000L
END_Addr:- 0x20400000UL
******************************************************/
/* DTCM memory region */
dwRegionBaseAddr =
DTCM_START_ADDRESS |
MPU_REGION_VALID |
MPU_DEFAULT_DTCM_REGION; //3
dwRegionAttr =
MPU_AP_PRIVILEGED_READ_WRITE |
MPU_CalMPURegionSize(DTCM_END_ADDRESS - DTCM_START_ADDRESS) |
MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/****************************************************
SRAM Cacheable memory region --- Normal
START_Addr:- 0x20400000UL
END_Addr:- 0x2043FFFFUL
******************************************************/
/* SRAM memory region */
dwRegionBaseAddr =
SRAM_FIRST_START_ADDRESS |
MPU_REGION_VALID |
MPU_DEFAULT_SRAM_REGION_1; //4
dwRegionAttr =
MPU_AP_FULL_ACCESS |
INNER_NORMAL_WB_NWA_TYPE( NON_SHAREABLE ) |
MPU_CalMPURegionSize(SRAM_FIRST_END_ADDRESS - SRAM_FIRST_START_ADDRESS)
| MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/****************************************************
Internal SRAM second partition memory region --- Normal
START_Addr:- 0x20440000UL
END_Addr:- 0x2045FFFFUL
******************************************************/
/* SRAM memory region */
dwRegionBaseAddr =
SRAM_SECOND_START_ADDRESS |
MPU_REGION_VALID |
MPU_DEFAULT_SRAM_REGION_2; //5
dwRegionAttr =
MPU_AP_FULL_ACCESS |
INNER_NORMAL_WB_NWA_TYPE( NON_SHAREABLE ) |
MPU_CalMPURegionSize(SRAM_SECOND_END_ADDRESS - SRAM_SECOND_START_ADDRESS) |
MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/****************************************************
Peripheral memory region --- DEVICE Shareable
START_Addr:- 0x40000000UL
END_Addr:- 0x5FFFFFFFUL
******************************************************/
dwRegionBaseAddr =
PERIPHERALS_START_ADDRESS |
MPU_REGION_VALID |
MPU_PERIPHERALS_REGION; //6
dwRegionAttr = MPU_AP_FULL_ACCESS |
MPU_REGION_EXECUTE_NEVER |
SHAREABLE_DEVICE_TYPE |
MPU_CalMPURegionSize(PERIPHERALS_END_ADDRESS - PERIPHERALS_START_ADDRESS)
|MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/****************************************************
External EBI memory memory region --- Strongly Ordered
START_Addr:- 0x60000000UL
END_Addr:- 0x6FFFFFFFUL
******************************************************/
dwRegionBaseAddr =
EXT_EBI_START_ADDRESS |
MPU_REGION_VALID |
MPU_EXT_EBI_REGION;
dwRegionAttr =
MPU_AP_FULL_ACCESS |
/* External memory Must be defined with 'Device' or 'Strongly Ordered'
attribute for write accesses (AXI) */
STRONGLY_ORDERED_SHAREABLE_TYPE |
MPU_CalMPURegionSize(EXT_EBI_END_ADDRESS - EXT_EBI_START_ADDRESS) |
MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/****************************************************
SDRAM Cacheable memory region --- Normal
START_Addr:- 0x70000000UL
END_Addr:- 0x7FFFFFFFUL
******************************************************/
dwRegionBaseAddr =
SDRAM_START_ADDRESS |
MPU_REGION_VALID |
MPU_DEFAULT_SDRAM_REGION; //7
dwRegionAttr =
MPU_AP_FULL_ACCESS |
INNER_NORMAL_WB_RWA_TYPE( SHAREABLE ) |
MPU_CalMPURegionSize(SDRAM_END_ADDRESS - SDRAM_START_ADDRESS) |
MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/****************************************************
QSPI memory region --- Strongly ordered
START_Addr:- 0x80000000UL
END_Addr:- 0x9FFFFFFFUL
******************************************************/
dwRegionBaseAddr =
QSPI_START_ADDRESS |
MPU_REGION_VALID |
MPU_QSPIMEM_REGION; //8
dwRegionAttr =
MPU_AP_FULL_ACCESS |
STRONGLY_ORDERED_SHAREABLE_TYPE |
MPU_CalMPURegionSize(QSPI_END_ADDRESS - QSPI_START_ADDRESS) |
MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/****************************************************
USB RAM Memory region --- Device
START_Addr:- 0xA0100000UL
END_Addr:- 0xA01FFFFFUL
******************************************************/
dwRegionBaseAddr =
USBHSRAM_START_ADDRESS |
MPU_REGION_VALID |
MPU_USBHSRAM_REGION; //9
dwRegionAttr =
MPU_AP_FULL_ACCESS |
MPU_REGION_EXECUTE_NEVER |
SHAREABLE_DEVICE_TYPE |
MPU_CalMPURegionSize(USBHSRAM_END_ADDRESS - USBHSRAM_START_ADDRESS) |
MPU_REGION_ENABLE;
MPU_SetRegion( dwRegionBaseAddr, dwRegionAttr);
/* Enable the memory management fault , Bus Fault, Usage Fault exception */
SCB->SHCSR |= (SCB_SHCSR_MEMFAULTENA_Msk | SCB_SHCSR_BUSFAULTENA_Msk
| SCB_SHCSR_USGFAULTENA_Msk);
/* Enable the MPU region */
MPU_Enable( MPU_ENABLE | MPU_PRIVDEFENA);
memory_sync();
}
#ifdef ENABLE_TCM
#if defined ( __ICCARM__ ) /* IAR Ewarm */
#pragma section = "CSTACK"
#pragma section = "CSTACK_DTCM"
#define SRAM_STACK_BASE (__section_begin("CSTACK"))
#define DTCM_STACK_BASE (__section_begin("CSTACK_DTCM"))
#define SRAM_STACK_LIMIT (__section_end("CSTACK"))
#define DTCM_STACK_LIMIT (__section_end("CSTACK_DTCM"))
#elif defined (__CC_ARM) /* MDK */
extern uint32_t Image$$ARM_LIB_STACK$$Base;
extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit;
extern uint32_t Image$$DTCM_STACK$$Base;
extern uint32_t Image$$DTCM_STACK$$ZI$$Limit;
#define SRAM_STACK_BASE (&Image$$ARM_LIB_STACK$$Base)
#define DTCM_STACK_BASE (&Image$$DTCM_STACK$$Base)
#define SRAM_STACK_LIMIT (&Image$$ARM_LIB_STACK$$ZI$$Limit)
#define DTCM_STACK_LIMIT (&Image$$DTCM_STACK$$ZI$$Limit)
#elif defined ( __GNUC__ ) /* GCC */
extern char _sdtcm_stack, _edtcm_stack, _sstack, _estack;
#define SRAM_STACK_BASE ((void *)(&_sstack))
#define DTCM_STACK_BASE ((void *)(&_sdtcm_stack))
#define SRAM_STACK_LIMIT ((void *)(&_estack))
#define DTCM_STACK_LIMIT ((void *)(&_edtcm_stack))
#endif
/** \brief Change stack's location to DTCM
The function changes the stack's location from SRAM to DTCM
*/
void TCM_StackInit(void);
void TCM_StackInit(void)
{
uint32_t offset = (uint32_t)SRAM_STACK_LIMIT - (uint32_t)DTCM_STACK_LIMIT;
volatile char *dst = (volatile char *)DTCM_STACK_LIMIT;
volatile char *src = (volatile char *)SRAM_STACK_LIMIT;
/* copy code_TCM from flash to ITCM */
while(src > (volatile char *)SRAM_STACK_BASE){
*--dst = *--src;
}
__set_MSP(__get_MSP() - offset);
}
#endif
/**
* \brief Performs the low-level initialization of the chip.
*/
extern WEAK void LowLevelInit( void )
{
SystemInit();
#ifndef MPU_EXAMPLE_FEATURE
_SetupMemoryRegion();
#endif
#if defined(ENABLE_TCM) && defined(__GNUC__)
volatile char *dst = &_sitcm;
volatile char *src = &_itcm_lma;
/* copy code_TCM from flash to ITCM */
while(dst < &_eitcm){
*dst++ = *src++;
}
#endif
}

View File

@ -0,0 +1,230 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation of memories configuration on board.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
#define SDRAM_BA0 (1 << 20)
#define SDRAM_BA1 (1 << 21)
uint32_t BOARD_SdramValidation(uint32_t baseAddr, uint32_t size)
{
uint32_t i;
uint32_t ret = 1;
uint32_t *ptr32 = (uint32_t *) baseAddr;
uint16_t *ptr16 = (uint16_t *) baseAddr;
uint8_t *ptr8 = (uint8_t *) baseAddr;
/* Test for 55AA55AA/AA55AA55 pattern */
printf(" Test for 55AA55AA/AA55AA55 pattern ... \n\r");
for (i = 0; i < size ; i ++) {
if (i & 1) {
ptr32[i] = 0x55AA55AA ;
} else {
ptr32[i] = 0xAA55AA55 ;
}
memory_barrier()
}
for (i = 0; i < size ; i++) {
if (i & 1) {
if (ptr32[i] != 0x55AA55AA ) {
printf("-E- Expected:%x, read %x @ %x \n\r" ,
0xAA55AA55, (unsigned)ptr32[i], (unsigned)(baseAddr + i));
ret = 0;
}
} else {
if (ptr32[i] != 0xAA55AA55 ) {
printf("-E- Expected:%x, read %x @ %x \n\r" ,
0xAA55AA55 , (unsigned)ptr32[i], (unsigned)(baseAddr + i));
ret = 0;
}
}
}
if (!ret) return ret;
printf(" Test for BYTE accessing... \n\r");
/* Test for BYTE accessing */
for (i = 0; i < size ; i ++) {
ptr8[i] = (uint8_t)( i & 0xFF) ;
}
for (i = 0; i < size ; i++) {
if (ptr8[i] != (uint8_t)(i & 0xFF)) {
printf("-E- Expected:%x, read %x @ %x \n\r" ,
(unsigned)(i & 0xFF), ptr8[i],(unsigned)(baseAddr + i));
ret = 0;
}
}
if (!ret) return ret;
printf(" Test for WORD accessing... \n\r");
/* Test for WORD accessing */
for (i = 0; i < size / 2 ; i ++) {
ptr16[i] = (uint16_t)( i & 0xFFFF) ;
}
for (i = 0; i < size / 2 ; i++) {
if (ptr16[i] != (uint16_t)(i & 0xFFFF)) {
printf("-E- Expected:%x, read %x @ %x \n\r" ,
(unsigned)(i & 0xFFFF), ptr16[i],(unsigned)(baseAddr + i));
ret = 0;
}
}
if (!ret) return ret;
printf(" Test for DWORD accessing... \n\r");
/* Test for DWORD accessing */
for (i = 0; i < size / 4 ; i ++) {
ptr32[i] = (uint32_t)( i & 0xFFFFFFFF) ;
memory_barrier()
}
for (i = 0; i < size / 4 ; i++) {
if (ptr32[i] != (uint32_t)(i & 0xFFFFFFFF)) {
printf("-E- Expected:%x, read %x @ %x \n\r" ,
(unsigned)(i & 0xFFFFFFFF), (unsigned)ptr32[i], (unsigned)(baseAddr + i));
ret = 0;
}
}
return ret;
}
/**
* \brief Configures the EBI for SDRAM (IS42S16100E-7B) access.
*/
void BOARD_ConfigureSdram( void )
{
const Pin pinsSdram[] = {BOARD_SDRAM_PINS};
volatile uint32_t i;
volatile uint8_t *pSdram = (uint8_t *) SDRAM_CS_ADDR;
/* Configure PIO */
PIO_Configure(pinsSdram, PIO_LISTSIZE(pinsSdram));
PMC_EnablePeripheral(ID_SDRAMC);
MATRIX->CCFG_SMCNFCS = CCFG_SMCNFCS_SDRAMEN;
/* 1. SDRAM features must be set in the configuration register:
asynchronous timings (TRC, TRAS, etc.), number of columns, rows,
CAS latency, and the data bus width. */
SDRAMC->SDRAMC_CR =
SDRAMC_CR_NC_COL8 // 8 column bits
| SDRAMC_CR_NR_ROW11 // 12 row bits (4K)
| SDRAMC_CR_CAS_LATENCY3 // CAS Latency 3
| SDRAMC_CR_NB_BANK2 // 2 banks
| SDRAMC_CR_DBW // 16 bit
| SDRAMC_CR_TWR(4)
| SDRAMC_CR_TRC_TRFC(11) // 63ns min
| SDRAMC_CR_TRP(5) // Command period (PRE to ACT) 21 ns min
| SDRAMC_CR_TRCD(5) // Active Command to read/Write Command delay time 21ns min
| SDRAMC_CR_TRAS(8) // Command period (ACT to PRE) 42ns min
| SDRAMC_CR_TXSR(13U); // Exit self-refresh to active time 70ns Min
/* 2. For mobile SDRAM, temperature-compensated self refresh (TCSR), drive
strength (DS) and partial array self refresh (PASR) must be set in the
Low Power Register. */
/* 3. The SDRAM memory type must be set in the Memory Device Register.*/
SDRAMC->SDRAMC_MDR = SDRAMC_MDR_MD_SDRAM;
/* 4. A minimum pause of 200 ¦Ìs is provided to precede any signal toggle.*/
for (i = 0; i < 100000; i++);
/* 5. (1)A NOP command is issued to the SDRAM devices. The application must
set Mode to 1 in the Mode Register and perform a write access to
any SDRAM address.*/
SDRAMC->SDRAMC_MR = SDRAMC_MR_MODE_NOP;
*pSdram = 0;
for (i = 0; i < 100000; i++);
/* 6. An All Banks Precharge command is issued to the SDRAM devices.
The application must set Mode to 2 in the Mode Register and perform a write
access to any SDRAM address. */
SDRAMC->SDRAMC_MR = SDRAMC_MR_MODE_ALLBANKS_PRECHARGE;
*pSdram = 0;
for (i = 0; i < 100000; i++);
/* 7. Eight auto-refresh (CBR) cycles are provided. The application must
set the Mode to 4 in the Mode Register and perform a write access to any
SDRAM location eight times.*/
for (i = 0 ; i< 8; i++) {
SDRAMC->SDRAMC_MR = SDRAMC_MR_MODE_AUTO_REFRESH;
*pSdram = 0;
}
for (i = 0; i < 100000; i++);
/*8. A Mode Register set (MRS) cycle is issued to program the parameters of
the SDRAM devices, in particular CAS latency and burst length. The
application must set Mode to 3 in the Mode Register and perform a write
access to the SDRAM. The write address must be chosen so that BA[1:0]
are set to 0. For example, with a 16-bit 128 MB SDRAM (12 rows, 9 columns,
4 banks) bank address, the SDRAM write access should be done at the address
0x70000000.*/
SDRAMC->SDRAMC_MR = SDRAMC_MR_MODE_LOAD_MODEREG;
*pSdram = 0;
for (i = 0; i < 100000; i++);
/*9. For mobile SDRAM initialization, an Extended Mode Register set (EMRS)
cycle is issued to program the SDRAM parameters (TCSR, PASR, DS). The
application must set Mode to 5 in the Mode Register and perform a write
access to the SDRAM. The write address must be chosen so that BA[1] or BA[0]
are set to 1.
For example, with a 16-bit 128 MB SDRAM, (12 rows, 9 columns, 4 banks) bank
address the SDRAM write access should be done at the address 0x70800000 or
0x70400000. */
//SDRAMC->SDRAMC_MR = SDRAMC_MR_MODE_EXT_LOAD_MODEREG;
// *((uint8_t *)(pSdram + SDRAM_BA0)) = 0;
/* 10. The application must go into Normal Mode, setting Mode to 0 in the
Mode Register and performing a write access at any location in the SDRAM. */
SDRAMC->SDRAMC_MR = SDRAMC_MR_MODE_NORMAL;
*pSdram = 0;
for (i = 0; i < 100000; i++);
/* 11. Write the refresh rate into the count field in the SDRAMC Refresh
Timer register. (Refresh rate = delay between refresh cycles).
The SDRAM device requires a refresh every 15.625 ¦Ìs or 7.81 ¦Ìs.
With a 100 MHz frequency, the Refresh Timer Counter Register must be set
with the value 1562(15.625 ¦Ìs x 100 MHz) or 781(7.81 ¦Ìs x 100 MHz). */
// For IS42S16100E, 2048 refresh cycle every 32ms, every 15.625 ¦Ìs
/* ((32 x 10(^-3))/2048) x150 x (10^6) */
SDRAMC->SDRAMC_TR = 2343; ;
SDRAMC->SDRAMC_CFR1 |= SDRAMC_CFR1_UNAL;
/* After initialization, the SDRAM devices are fully functional. */
}

View File

@ -0,0 +1,113 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation CS2100 driver.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*----------------------------------------------------------------------------
* Type
*----------------------------------------------------------------------------*/
typedef struct {
uint16_t value;
uint8_t address;
}CS2100_PARA;
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/**
* \brief Read data from CS2100 Register.
*
* \param pTwid Pointer to twi driver structure
* \param device Twi slave address.
* \param regAddr Register address to read.
* \return value in the given register.
*/
uint16_t CS2100_Read(Twid *pTwid,
uint32_t device,
uint32_t regAddr)
{
uint16_t bitsDataRegister;
uint8_t Tdata[2]={0,0};
TWID_Read(pTwid, device, regAddr, 1, Tdata, 2, 0);
bitsDataRegister = (Tdata[0] << 8) | Tdata[1];
return bitsDataRegister;
}
/**
* \brief Write data to CS2100 Register.
*
* \param pTwid Pointer to twi driver structure
* \param device Twi slave address.
* \param regAddr Register address to write.
* \param data Data to write
*/
void CS2100_Write(Twid *pTwid,
uint32_t device,
uint32_t regAddr,
uint16_t data)
{
uint8_t tmpData[2];
tmpData[0] = (data & 0xff00) >> 8;
tmpData[1] = data & 0xff;
TWID_Write(pTwid, device, regAddr, 1, tmpData, 2, 0);
}
/**
* \brief Initialize CS2100 Clock Multiplier.
*
* \param pTwid Pointer to twi driver structure
* \param device Twi slave address.
* \param PCK Device programmable clock
*/
uint8_t CS2100_Init(Twid *pTwid, uint32_t device, uint32_t PCK)
{
uint16_t data = 0;
// Reset (write Reg@0x0 to reset)
CS2100_Write(pTwid, device, 0, 0xFFFF);
for(data = 0; data < 1000; data++);
//wait ready
while(data!=0x8904)
data = CS2100_Read(pTwid, device, 0);
return 0;
}

View File

@ -0,0 +1,548 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implements UART console.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdio.h>
#include <stdint.h>
/*----------------------------------------------------------------------------
* Definitions
*----------------------------------------------------------------------------*/
/** Console baud rate always using 115200. */
#define CONSOLE_BAUDRATE 115200
#define CONSOLE_EDBG
#if defined CONSOLE_EDBG
#define CONSOLE_ON_USART
#else
#define CONSOLE_ON_UART
#endif
#if defined CONSOLE_ON_UART
#ifdef SSC_AUDIO
/** Usart Hw interface used by the console (UART4). */
#warning Please use UART4 pins for debug consol as UART0 pins are used in SSC \
audio for SAM V71 Xplained Ultra board
#define CONSOLE_UART UART4
/** Pins description corresponding to Rxd,Txd, (UART pins) */
#define CONSOLE_PINS {PINS_UART4}
#define CONSOLE_ID ID_UART4
#else
/** Usart Hw interface used by the console (UART0). */
#define CONSOLE_UART UART0
/** Pins description corresponding to Rxd,Txd, (UART pins) */
#define CONSOLE_PINS {PINS_UART0}
#define CONSOLE_ID ID_UART0
#endif
#endif
#if defined CONSOLE_ON_USART
/** USART1 pin RX */
#define PIN_USART1_RXD_DBG \
{PIO_PA21A_RXD1, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
/** USART1 pin TX */
#define PIN_USART1_TXD_DBG \
{PIO_PB4D_TXD1, PIOB, ID_PIOB, PIO_PERIPH_D, PIO_DEFAULT}
#define PINS_USART1 PIN_USART1_TXD_DBG, PIN_USART1_RXD_DBG
/** Usart Hw interface used by the console (Usart0). */
#define CONSOLE_Usart USART1
/** Pins description corresponding to Rxd,Txd, (Usart pins) */
#define CONSOLE_PINS {PINS_USART1}
#define CONSOLE_ID ID_USART1
#endif
/*----------------------------------------------------------------------------
* Variables
*----------------------------------------------------------------------------*/
/** Is Console Initialized. */
static uint8_t _ucIsConsoleInitialized = 0;
/**
* \brief Configures an USART peripheral with the specified parameters.
*
* \param baudrate Baudrate at which the USART should operate (in Hz).
* \param masterClock Frequency of the system master clock (in Hz).
*/
extern void DBG_Configure( uint32_t baudrate, uint32_t masterClock)
{
const Pin pPins[] = CONSOLE_PINS;
#if defined CONSOLE_ON_UART
Uart *pUart = CONSOLE_UART;
/* Configure PIO */
PIO_Configure( pPins, PIO_LISTSIZE( pPins ) );
// Reset & disable receiver and transmitter, disable interrupts
pUart->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX | UART_CR_RSTSTA;
pUart->UART_IDR = 0xFFFFFFFF;
PMC_EnablePeripheral(CONSOLE_ID);
pUart->UART_BRGR = (masterClock / baudrate) / 16;
// Configure mode register
pUart->UART_MR
= (UART_MR_CHMODE_NORMAL | UART_MR_PAR_NO
| UART_MR_BRSRCCK_PERIPH_CLK);
// Enable receiver and transmitter
pUart->UART_CR = UART_CR_RXEN | UART_CR_TXEN;
#endif
#if defined CONSOLE_ON_USART
Usart *pUsart = CONSOLE_Usart;
// Disable the MATRIX registers write protection
MATRIX->MATRIX_WPMR = MATRIX_WPMR_WPKEY_PASSWD;
MATRIX->CCFG_SYSIO |= CCFG_SYSIO_SYSIO4;
PIO_Configure( pPins, PIO_LISTSIZE( pPins ) );
// Reset & disable receiver and transmitter, disable interrupts
pUsart->US_CR = US_CR_RSTRX | US_CR_RSTTX | US_CR_RSTSTA;
pUsart->US_IDR = 0xFFFFFFFF;
PMC_EnablePeripheral(CONSOLE_ID);
pUsart->US_BRGR = (masterClock / baudrate) / 16;
// Configure mode register
pUsart->US_MR
= (US_MR_USART_MODE_NORMAL | US_MR_PAR_NO| US_MR_USCLKS_MCK
| US_MR_CHRL_8_BIT);
// Enable receiver and transmitter
pUsart->US_CR = US_CR_RXEN | US_CR_TXEN;
#endif
_ucIsConsoleInitialized = 1;
/* Disable buffering for printf(). */
#if ( defined (__GNUC__) && !defined (__SAMBA__) )
setvbuf(stdout, (char *)NULL, _IONBF, 0);
#endif
}
/**
* \brief Outputs a character on the UART line.
*
* \note This function is synchronous (i.e. uses polling).
* \param c Character to send.
*/
extern void DBG_PutChar( uint8_t c )
{
#if defined CONSOLE_ON_UART
Uart *pUart=CONSOLE_UART;
if ( !_ucIsConsoleInitialized )
{
DBG_Configure(CONSOLE_BAUDRATE, BOARD_MCK);
}
// Wait for the transmitter to be ready
while ((pUart->UART_SR & UART_SR_TXEMPTY) == 0);
// Send character
pUart->UART_THR = c;
// Wait for the transfer to complete
while ((pUart->UART_SR & UART_SR_TXEMPTY) == 0);
#endif
#if defined CONSOLE_ON_USART
Usart *pUsart=CONSOLE_Usart;
if ( !_ucIsConsoleInitialized )
{
DBG_Configure(CONSOLE_BAUDRATE, BOARD_MCK);
}
// Wait for the transmitter to be ready
while ((pUsart->US_CSR & US_CSR_TXEMPTY) == 0);
// Send character
pUsart->US_THR = c;
// Wait for the transfer to complete
while ((pUsart->US_CSR & US_CSR_TXEMPTY) == 0);
#endif
}
/**
* \brief Input a character from the UART line.
*
* \note This function is synchronous
* \return character received.
*/
extern uint32_t DBG_GetChar( void )
{
#if defined CONSOLE_ON_UART
Uart *pUart= CONSOLE_UART;
if ( !_ucIsConsoleInitialized )
{
DBG_Configure(CONSOLE_BAUDRATE, BOARD_MCK);
}
while ((pUart->UART_SR & UART_SR_RXRDY) == 0);
return pUart->UART_RHR;
#endif
#if defined CONSOLE_ON_USART
Usart *pUsart= CONSOLE_Usart;
if ( !_ucIsConsoleInitialized )
{
DBG_Configure(CONSOLE_BAUDRATE, BOARD_MCK);
}
while ((pUsart->US_CSR & US_CSR_RXRDY) == 0);
return pUsart->US_RHR;
#endif
}
/**
* \brief Check if there is Input from UART line.
*
* \return true if there is Input.
*/
extern uint32_t DBG_IsRxReady( void )
{
#if defined CONSOLE_ON_UART
Uart *pUart=CONSOLE_UART;
if ( !_ucIsConsoleInitialized )
{
DBG_Configure( CONSOLE_BAUDRATE, BOARD_MCK );
}
return (pUart->UART_SR & UART_SR_RXRDY);
#endif
#if defined CONSOLE_ON_USART
Usart *pUsart=CONSOLE_Usart;
if ( !_ucIsConsoleInitialized )
{
DBG_Configure( CONSOLE_BAUDRATE, BOARD_MCK );
}
return (pUsart->US_CSR & US_CSR_RXRDY);
#endif
}
/**
* Displays the content of the given frame on the UART0.
*
* \param pucFrame Pointer to the frame to dump.
* \param dwSize Buffer size in bytes.
*/
extern void DBG_DumpFrame( uint8_t* pucFrame, uint32_t dwSize )
{
uint32_t dw;
for ( dw=0; dw < dwSize; dw++ )
{
printf( "%02X ", pucFrame[dw] );
}
printf( "\n\r" );
}
/**
* Displays the content of the given buffer on the UART0.
*
* \param pucBuffer Pointer to the buffer to dump.
* \param dwSize Buffer size in bytes.
* \param dwAddress Start address to display
*/
extern void DBG_DumpMemory( uint8_t* pucBuffer, uint32_t dwSize,
uint32_t dwAddress )
{
uint32_t i;
uint32_t j;
uint32_t dwLastLineStart;
uint8_t* pucTmp;
for (i=0; i < (dwSize / 16); i++ )
{
printf( "0x%08X: ", (unsigned int)(dwAddress + (i*16)));
pucTmp = (uint8_t*)&pucBuffer[i*16];
for (j=0; j < 4; j++)
{
printf( "%02X%02X%02X%02X ",
pucTmp[0], pucTmp[1], pucTmp[2], pucTmp[3]);
pucTmp += 4;
}
pucTmp=(uint8_t*)&pucBuffer[i*16];
for (j=0; j < 16; j++)
{
DBG_PutChar( *pucTmp++);
}
printf( "\n\r" );
}
if ( (dwSize%16) != 0 )
{
dwLastLineStart=dwSize - (dwSize%16);
printf( "0x%08X: ", (unsigned int)(dwAddress + dwLastLineStart));
for (j=dwLastLineStart; j < dwLastLineStart+16; j++)
{
if ( (j!=dwLastLineStart) && (j%4 == 0) )
{
printf( " " );
}
if ( j < dwSize )
{
printf( "%02X", pucBuffer[j] );
}
else
{
printf(" ");
}
}
printf( " " );
for (j=dwLastLineStart; j < dwSize; j++)
{
DBG_PutChar( pucBuffer[j] );
}
printf( "\n\r" );
}
}
/**
* Reads an integer
*
* \param pdwValue Pointer to a integer variable to contain the input value.
*
* \return success(1) or failure(0)
*/
extern uint32_t DBG_GetInteger( int32_t* pdwValue )
{
uint8_t ucKey;
uint8_t ucNum = 0;
int32_t dwValue = 0;
int32_t sign = 1;
while (1)
{
ucKey=DBG_GetChar();
DBG_PutChar( ucKey );
if (((ucKey == '-') || (ucKey == '+')) && (ucNum == 0))
{
if (ucKey == '-')
{
sign = -1;
}
else
{
sign = 1;
}
ucNum++;
}
else
{
if (ucKey >= '0' && ucKey <= '9')
{
dwValue = (dwValue * 10) + (ucKey - '0');
ucNum++;
}
else
{
if (ucKey == 0x0D || ucKey == ' ')
{
if ( ucNum == 0 )
{
printf("\n\rWrite a number and press ENTER or SPACE!\n\r");
return 0;
}
else
{
printf( "\n\r" );
*pdwValue = dwValue * sign;
return 1;
}
}
else
{
printf("\n\r'%c' not a number or sign(+/-)!\n\r", ucKey);
return 0;
}
}
}
}
}
/**
* Reads an integer and check the value
*
* \param pdwValue Pointer to a integer variable to contain the input value.
* \param dwMin Minimum value
* \param dwMax Maximum value
*
* \return success(1) or failure(0)
*/
extern uint32_t DBG_GetIntegerMinMax(int32_t* pdwValue, int32_t dwMin,
int32_t dwMax)
{
int32_t dwValue = 0;
if ( DBG_GetInteger( &dwValue ) == 0 )
{
return 0;
}
if ( dwValue < dwMin || dwValue > dwMax )
{
printf( "\n\rThe number have to be between %d and %d\n\r",
(int)dwMin, (int)dwMax );
return 0;
}
printf( "\n\r" );
*pdwValue = dwValue;
return 1;
}
/**
* Reads an hexadecimal number
*
* \param pdwValue Pointer to the uint32_t variable to contain the input value.
*/
extern uint32_t DBG_GetHexa32( uint32_t* pdwValue )
{
uint8_t ucKey;
uint32_t dw = 0;
uint32_t dwValue = 0;
for ( dw=0; dw < 8; dw++ )
{
ucKey = DBG_GetChar();
DBG_PutChar( ucKey );
if ( ucKey >= '0' && ucKey <= '9' )
{
dwValue = (dwValue * 16) + (ucKey - '0');
}
else
{
if ( ucKey >= 'A' && ucKey <= 'F' )
{
dwValue = (dwValue * 16) + (ucKey - 'A' + 10);
}
else
{
if ( ucKey >= 'a' && ucKey <= 'f' )
{
dwValue = (dwValue * 16) + (ucKey - 'a' + 10);
}
else
{
printf( "\n\rIt is not a hexadecimal character!\n\r" );
return 0;
}
}
}
}
printf("\n\r" );
*pdwValue = dwValue;
return 1;
}
#if defined __ICCARM__ /* IAR Ewarm 5.41+ */
/**
* \brief Outputs a character on the UART.
*
* \param c Character to output.
*
* \return The character that was output.
*/
extern WEAK signed int putchar( signed int c )
{
DBG_PutChar( c );
return c;
}
#endif // defined __ICCARM__
extern WEAK int puts(const char *ptr )
{
for (; *ptr != 0; ptr++ )
{
DBG_PutChar( *ptr );
}
return 0;
}
extern WEAK char * gets(char *ptr)
{
uint8_t ch = 0;
while (ch != '\r' )
{
ch = DBG_GetChar();
DBG_PutChar( ch );
*(ptr++) = ch;
}
*ptr = '\0';
return 0;
}

View File

@ -0,0 +1,500 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/** \file */
/*---------------------------------------------------------------------------
* Headers
*---------------------------------------------------------------------------*/
#include "board.h"
/*---------------------------------------------------------------------------
* Definitions
*---------------------------------------------------------------------------*/
/** Default max retry count */
#define GMACB_RETRY_MAX 300000
/** Default max retry count */
#define GACB_RETRY_MAX 1000000
/*---------------------------------------------------------------------------
* Local functions
*---------------------------------------------------------------------------*/
/**
* Wait PHY operation complete.
* Return 1 if the operation completed successfully.
* May be need to re-implemented to reduce CPU load.
* \param retry: the retry times, 0 to wait forever until complete.
*/
static uint8_t GMACB_WaitPhy( Gmac *pHw, uint32_t retry )
{
volatile uint32_t retry_count = 0;
while (!GMAC_IsIdle(pHw)) {
if(retry == 0) continue;
retry_count ++;
if (retry_count >= retry) {
return 0;
}
}
return 1;
}
/**
* Read PHY register.
* Return 1 if successfully, 0 if timeout.
* \param pHw HW controller address
* \param PhyAddress PHY Address
* \param Address Register Address
* \param pValue Pointer to a 32 bit location to store read data
* \param retry The retry times, 0 to wait forever until complete.
*/
static uint8_t GMACB_ReadPhy(Gmac *pHw,
uint8_t PhyAddress,
uint8_t Address,
uint32_t *pValue,
uint32_t retry)
{
GMAC_PHYMaintain(pHw, PhyAddress, Address, 1, 0);
if ( GMACB_WaitPhy(pHw, retry) == 0 ) {
TRACE_ERROR("TimeOut GMACB_ReadPhy\n\r");
return 0;
}
*pValue = GMAC_PHYData(pHw);
return 1;
}
/**
* Write PHY register
* Return 1 if successfully, 0 if timeout.
* \param pHw HW controller address
* \param PhyAddress PHY Address
* \param Address Register Address
* \param Value Data to write ( Actually 16 bit data )
* \param retry The retry times, 0 to wait forever until complete.
*/
static uint8_t GMACB_WritePhy(Gmac *pHw,
uint8_t PhyAddress,
uint8_t Address,
uint32_t Value,
uint32_t retry)
{
GMAC_PHYMaintain(pHw, PhyAddress, Address, 0, Value);
if ( GMACB_WaitPhy(pHw, retry) == 0 ) {
TRACE_ERROR("TimeOut GMACB_WritePhy\n\r");
return 0;
}
return 1;
}
/*---------------------------------------------------------------------------
* Exported functions
*---------------------------------------------------------------------------*/
/**
* \brief Find a valid PHY Address ( from 0 to 31 ).
* \param pMacb Pointer to the MACB instance
* \return 0xFF when no valid PHY Address found.
*/
static uint8_t GMACB_FindValidPhy(GMacb *pMacb)
{
sGmacd *pDrv = pMacb->pGmacd;
Gmac *pHw = pDrv->pHw;
uint32_t retryMax;
uint32_t value=0;
uint8_t rc;
uint8_t phyAddress;
uint8_t cnt;
TRACE_DEBUG("GMACB_FindValidPhy\n\r");
GMAC_EnableMdio(pHw);
phyAddress = pMacb->phyAddress;
retryMax = pMacb->retryMax;
/* Check current phyAddress */
rc = phyAddress;
if( GMACB_ReadPhy(pHw, phyAddress, GMII_PHYID1R, &value, retryMax) == 0 ) {
TRACE_ERROR("GMACB PROBLEM\n\r");
}
TRACE_DEBUG("_PHYID1 : 0x%X, addr: %d\n\r", value, phyAddress);
/* Find another one */
if (value != GMII_OUI_MSB) {
rc = 0xFF;
for(cnt = 0; cnt < 32; cnt ++) {
phyAddress = (phyAddress + 1) & 0x1F;
if( GMACB_ReadPhy(pHw, phyAddress, GMII_PHYID1R, &value, retryMax)
== 0 ){
TRACE_ERROR("MACB PROBLEM\n\r");
}
TRACE_DEBUG("_PHYID1 : 0x%X, addr: %d\n\r", value, phyAddress);
if (value == GMII_OUI_MSB) {
rc = phyAddress;
break;
}
}
}
if (rc != 0xFF) {
TRACE_INFO("** Valid PHY Found: %d\n\r", rc);
GMACB_ReadPhy(pHw, phyAddress, GMII_PHYID1R, &value, retryMax);
TRACE_DEBUG("_PHYID1R : 0x%X, addr: %d\n\r", value, phyAddress);
GMACB_ReadPhy(pHw, phyAddress, GMII_PHYID2R, &value, retryMax);
TRACE_DEBUG("_EMSR : 0x%X, addr: %d\n\r", value, phyAddress);
}
GMAC_DisableMdio(pHw);
return rc;
}
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/**
* \brief Dump all the useful registers.
* \param pMacb Pointer to the MACB instance
*/
void GMACB_DumpRegisters(GMacb *pMacb)
{
sGmacd *pDrv = pMacb->pGmacd;
Gmac *pHw = pDrv->pHw;
uint8_t phyAddress;
uint32_t retryMax;
uint32_t value;
TRACE_INFO("GMACB_DumpRegisters\n\r");
GMAC_EnableMdio(pHw);
phyAddress = pMacb->phyAddress;
retryMax = pMacb->retryMax;
TRACE_INFO("GMII MACB @ %d) Registers:\n\r", phyAddress);
GMACB_ReadPhy(pHw, phyAddress, GMII_BMCR, &value, retryMax);
TRACE_INFO(" _BMCR : 0x%X\n\r", (unsigned)value);
GMACB_ReadPhy(pHw, phyAddress, GMII_BMSR, &value, retryMax);
TRACE_INFO(" _BMSR : 0x%X\n\r", (unsigned)value);
GMACB_ReadPhy(pHw, phyAddress, GMII_PHYID1R, &value, retryMax);
TRACE_INFO(" _PHYID1 : 0x%X\n\r", (unsigned)value);
GMACB_ReadPhy(pHw, phyAddress, GMII_PHYID2R, &value, retryMax);
TRACE_INFO(" _PHYID2 : 0x%X\n\r", (unsigned)value);
GMACB_ReadPhy(pHw, phyAddress, GMII_ANAR, &value, retryMax);
TRACE_INFO(" _ANAR : 0x%X\n\r", (unsigned)value);
GMACB_ReadPhy(pHw, phyAddress, GMII_ANLPAR, &value, retryMax);
TRACE_INFO(" _ANLPAR : 0x%X\n\r", (unsigned)value);
GMACB_ReadPhy(pHw, phyAddress, GMII_ANER, &value, retryMax);
TRACE_INFO(" _ANER : 0x%X\n\r", (unsigned)value);
GMACB_ReadPhy(pHw, phyAddress, GMII_ANNPR, &value, retryMax);
TRACE_INFO(" _ANNPR : 0x%X\n\r", (unsigned)value);
GMACB_ReadPhy(pHw, phyAddress, GMII_ANLPNPAR, &value, retryMax);
TRACE_INFO(" _ANLPNPAR : 0x%X\n\r", (unsigned)value);
TRACE_INFO(" \n\r");
GMACB_ReadPhy(pHw, phyAddress, GMII_RXERCR, &value, retryMax);
TRACE_INFO(" _RXERCR : 0x%X\n\r", (unsigned)value);
GMACB_ReadPhy(pHw, phyAddress, GMII_ICSR, &value, retryMax);
TRACE_INFO(" _ICSR : 0x%X\n\r", (unsigned)value);
TRACE_INFO(" \n\r");
GMAC_DisableMdio(pHw);
}
/**
* \brief Setup the maximum timeout count of the driver.
* \param pMacb Pointer to the MACB instance
* \param toMax Timeout maximum count.
*/
void GMACB_SetupTimeout(GMacb *pMacb, uint32_t toMax)
{
pMacb->retryMax = toMax;
}
/**
* \brief Initialize the MACB instance.
* \param pMacb Pointer to the MACB instance
* \param phyAddress The PHY address used to access the PHY
*/
void GMACB_Init(GMacb *pMacb, sGmacd *pGmacd, uint8_t phyAddress)
{
pMacb->pGmacd = pGmacd;
pMacb->phyAddress = phyAddress;
/* Initialize timeout by default */
pMacb->retryMax = GMACB_RETRY_MAX;
}
/**
* \brief Issue a SW reset to reset all registers of the PHY.
* \param pMacb Pointer to the MACB instance
* \return 1 if successfully, 0 if timeout.
*/
uint8_t GMACB_ResetPhy(GMacb *pMacb)
{
sGmacd *pDrv = pMacb->pGmacd;
Gmac *pHw = pDrv->pHw;
uint32_t retryMax;
uint32_t bmcr = GMII_RESET;
uint8_t phyAddress;
uint32_t timeout = 10;
uint8_t ret = 1;
TRACE_INFO(" GMACB_ResetPhy\n\r");
phyAddress = pMacb->phyAddress;
retryMax = pMacb->retryMax;
GMAC_EnableMdio(pHw);
bmcr = GMII_RESET;
GMACB_WritePhy(pHw, phyAddress, GMII_BMCR, bmcr, retryMax);
do {
GMACB_ReadPhy(pHw, phyAddress, GMII_BMCR, &bmcr, retryMax);
timeout--;
} while ((bmcr & GMII_RESET) && timeout);
GMAC_DisableMdio(pHw);
if (!timeout) {
ret = 0;
}
return( ret );
}
/**
* \brief Do a HW initialize to the PHY ( via RSTC ) and set up clocks & PIOs
* This should be called only once to initialize the PHY pre-settings.
* The PHY address is reset status of CRS,RXD[3:0] (the emacPins' pullups).
* The COL pin is used to select MII mode on reset (pulled up for Reduced MII)
* The RXDV pin is used to select test mode on reset (pulled up for test mode)
* The above pins should be predefined for corresponding settings in resetPins
* The GMAC peripheral pins are configured after the reset done.
* \param pMacb Pointer to the MACB instance
* \param mck Main clock setting to initialize clock
* \param resetPins Pointer to list of PIOs to configure before HW RESET
* (for PHY power on reset configuration latch)
* \param nbResetPins Number of PIO items that should be configured
* \param emacPins Pointer to list of PIOs for the EMAC interface
* \param nbEmacPins Number of PIO items that should be configured
* \return 1 if RESET OK, 0 if timeout.
*/
uint8_t GMACB_InitPhy(GMacb *pMacb,
uint32_t mck,
const Pin *pResetPins,
uint32_t nbResetPins,
const Pin *pGmacPins,
uint32_t nbGmacPins)
{
sGmacd *pDrv = pMacb->pGmacd;
Gmac *pHw = pDrv->pHw;
uint8_t rc = 1;
uint8_t phy;
/* Perform RESET */
TRACE_DEBUG("RESET PHY\n\r");
if (pResetPins) {
/* Configure PINS */
PIO_Configure(pResetPins, nbResetPins);
TRACE_INFO(" Hard Reset of GMACD Phy\n\r");
PIO_Clear(pResetPins);
Wait(100);
PIO_Set(pResetPins);
}
/* Configure GMAC runtime pins */
if (rc) {
PIO_Configure(pGmacPins, nbGmacPins);
rc = GMAC_SetMdcClock(pHw, mck );
if (!rc) {
TRACE_ERROR("No Valid MDC clock\n\r");
return 0;
}
/* Check PHY Address */
phy = GMACB_FindValidPhy(pMacb);
if (phy == 0xFF) {
TRACE_ERROR("PHY Access fail\n\r");
return 0;
}
if(phy != pMacb->phyAddress) {
pMacb->phyAddress = phy;
GMACB_ResetPhy(pMacb);
}
}
else {
TRACE_ERROR("PHY Reset Timeout\n\r");
}
return rc;
}
/**
* \brief Issue a Auto Negotiation of the PHY
* \param pMacb Pointer to the MACB instance
* \return 1 if successfully, 0 if timeout.
*/
uint8_t GMACB_AutoNegotiate(GMacb *pMacb)
{
sGmacd *pDrv = pMacb->pGmacd;
Gmac *pHw = pDrv->pHw;
uint32_t retryMax;
uint32_t value;
uint32_t phyAnar;
uint32_t phyAnalpar;
uint32_t retryCount= 0;
uint8_t phyAddress;
uint8_t rc = 1;
uint32_t duplex, speed;
phyAddress = pMacb->phyAddress;
retryMax = pMacb->retryMax;
GMAC_EnableMdio(pHw);
if (!GMACB_ReadPhy(pHw,phyAddress, GMII_PHYID1R, &value, retryMax)) {
TRACE_ERROR("Pb GEMAC_ReadPhy Id1\n\r");
rc = 0;
goto AutoNegotiateExit;
}
TRACE_DEBUG("ReadPhy Id1 0x%X, address: %d\n\r", value, phyAddress);
if (!GMACB_ReadPhy(pHw,phyAddress, GMII_PHYID2R, &phyAnar, retryMax)) {
TRACE_ERROR("Pb GMACB_ReadPhy Id2\n\r");
rc = 0;
goto AutoNegotiateExit;
}
TRACE_DEBUG("ReadPhy Id2 0x%X\n\r", phyAnar);
if( ( value == GMII_OUI_MSB )
&& ( ((phyAnar)&(~GMII_LSB_MASK)) == GMII_OUI_LSB ) ) {
TRACE_DEBUG("Vendor Number Model = 0x%X\n\r", ((phyAnar>>4)&0x3F));
TRACE_DEBUG("Model Revision Number = 0x%X\n\r", (phyAnar&0xF));
} else {
TRACE_ERROR("Problem OUI value\n\r");
}
/** Set the Auto_negotiation Advertisement Register, MII advertising for
Next page 100BaseTxFD and HD, 10BaseTFD and HD, IEEE 802.3 */
rc = GMACB_ReadPhy(pHw, phyAddress, GMII_ANAR, &phyAnar, retryMax);
if (rc == 0) {
goto AutoNegotiateExit;
}
phyAnar = GMII_TX_FDX | GMII_TX_HDX |
GMII_10_FDX | GMII_10_HDX | GMII_AN_IEEE_802_3;
rc = GMACB_WritePhy(pHw,phyAddress, GMII_ANAR, phyAnar, retryMax);
if (rc == 0) {
goto AutoNegotiateExit;
}
/* Read & modify control register */
rc = GMACB_ReadPhy(pHw, phyAddress, GMII_BMCR, &value, retryMax);
if (rc == 0) {
goto AutoNegotiateExit;
}
/* Check AutoNegotiate complete */
value |= GMII_AUTONEG | GMII_RESTART_AUTONEG;
rc = GMACB_WritePhy(pHw, phyAddress, GMII_BMCR, value, retryMax);
if (rc == 0) {
goto AutoNegotiateExit;
}
TRACE_DEBUG(" _BMCR: 0x%X\n\r", value);
// Check AutoNegotiate complete
while (1) {
rc = GMACB_ReadPhy(pHw, phyAddress, GMII_BMSR, &value, retryMax);
if (rc == 0) {
TRACE_ERROR("rc==0\n\r");
goto AutoNegotiateExit;
}
/* Done successfully */
if (value & GMII_AUTONEG_COMP) {
printf("AutoNegotiate complete\n\r");
break;
}
/* Timeout check */
if (retryMax) {
if (++ retryCount >= retryMax) {
GMACB_DumpRegisters(pMacb);
TRACE_ERROR("TimeOut\n\r");
rc = 0;
goto AutoNegotiateExit;
}
}
}
/*Set local link mode */
while(1) {
rc = GMACB_ReadPhy(pHw, phyAddress, GMII_ANLPAR, &phyAnalpar, retryMax);
if (rc == 0) {
goto AutoNegotiateExit;
}
/* Set up the GMAC link speed */
if ((phyAnar & phyAnalpar) & GMII_TX_FDX) {
/* set RGMII for 1000BaseTX and Full Duplex */
duplex = GMAC_DUPLEX_FULL;
speed = GMAC_SPEED_100M;
break;
} else if ((phyAnar & phyAnalpar) & GMII_10_FDX) {
/* set RGMII for 1000BaseT and Half Duplex*/
duplex = GMAC_DUPLEX_FULL;
speed = GMAC_SPEED_10M;
break;
} else if ((phyAnar & phyAnalpar) & GMII_TX_HDX) {
/* set RGMII for 100BaseTX and half Duplex */
duplex = GMAC_DUPLEX_HALF;
speed = GMAC_SPEED_100M;
break;
} else if ((phyAnar & phyAnalpar) & GMII_10_HDX) {
// set RGMII for 10BaseT and half Duplex
duplex = GMAC_DUPLEX_HALF;
speed = GMAC_SPEED_10M;
break;
}
}
TRACE_INFO("GMAC_EnableRGMII duplex %u, speed %u\n\r",(unsigned)duplex,(unsigned)speed);
GMACB_ReadPhy(pHw,phyAddress, GMII_PC1R, &value, retryMax);
GMACB_ReadPhy(pHw,phyAddress, GMII_PC2R, &value, retryMax);
GMACB_ReadPhy(pHw,phyAddress, GMII_ICSR, &value, retryMax);
/* Set up GMAC mode */
GMAC_EnableRGMII(pHw, duplex, speed);
AutoNegotiateExit:
GMAC_DisableMdio(pHw);
return rc;
}

View File

@ -0,0 +1,369 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation of ILI9488 driver.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <string.h>
#include <stdio.h>
#ifdef BOARD_LCD_ILI9488
/*----------------------------------------------------------------------------
* Local variables
*----------------------------------------------------------------------------*/
/** Pio pins to configure. */
static const Pin ILI9488_Reset[] = {LCD_PIN_RESET};
static const Pin ILI9488_Pwm[] = {BOARD_LCD_PIN_BACKLIGHT};
/** Pins to configure for the application. */
static const Pin lcd_pins[] = BOARD_LCD_PINS;
/** Pins to configure for the application. */
static const Pin ILI9488_CDS[] = {BOARD_LCD_PIN_CDS};
/*----------------------------------------------------------------------------
* Local functions
*----------------------------------------------------------------------------*/
/**
* \brief ILI9488 Hardware Initialization for SPI/SMC LCD.
*/
static void _ILI9488_HW_Initialize(void)
{
/* Pin configurations */
PIO_Configure(ILI9488_Reset, PIO_LISTSIZE(ILI9488_Reset));
PIO_Configure(ILI9488_CDS, PIO_LISTSIZE(ILI9488_CDS));
PIO_Configure(lcd_pins, PIO_LISTSIZE(lcd_pins));
PIO_Configure(ILI9488_Pwm, PIO_LISTSIZE(ILI9488_Pwm));
#if !defined(BOARD_LCD_SMC)
/* Enable PWM peripheral clock */
PMC_EnablePeripheral(ID_PWM0);
PMC_EnablePeripheral(ILI9488_ID);
/* Set clock A and clock B */
// set for 14.11 KHz for CABC control
// mode = PWM_CLK_PREB(0x0A) | (PWM_CLK_DIVB(110)) |
// PWM_CLK_PREA(0x0A) | (PWM_CLK_DIVA(110));
PWMC_ConfigureClocks(PWM0, 14200, 0, BOARD_MCK);
/* Configure PWM channel 1 for LED0 */
PWMC_DisableChannel(PWM0, CHANNEL_PWM_LCD);
PWMC_ConfigureChannel(PWM0, CHANNEL_PWM_LCD, PWM_CMR_CPRE_CLKA,0,PWM_CMR_CPOL);
PWMC_SetPeriod(PWM0, CHANNEL_PWM_LCD, 16);
PWMC_SetDutyCycle(PWM0, CHANNEL_PWM_LCD, 8);
PWMC_EnableChannel(PWM0, CHANNEL_PWM_LCD);
SPI_Configure(ILI9488, ILI9488_ID, (SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_PCS( SMC_EBI_LCD_CS )));
SPI_ConfigureNPCS( ILI9488,
SMC_EBI_LCD_CS,
SPI_CSR_CPOL | SPI_CSR_BITS_8_BIT | SPI_DLYBS(6, BOARD_MCK) | SPI_DLYBCT(100, BOARD_MCK) |
SPI_SCBR( 20000000, BOARD_MCK) ) ;
SPI_Enable(ILI9488);
#else
PIO_Set(ILI9488_Pwm);
#endif
}
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/**
* \brief Set ILI9488 Pixel Format in SPI/SMC mode.
* \param format Format of pixel
*/
void ILI9488_SetPixelFormat(uint16_t format)
{
ILI9488_WriteReg(ILI9488_CMD_COLMOD_PIXEL_FORMAT_SET, &format, sizeof(format));
}
/**
* \brief ILI9488 issue MEMORY write command in SPI/SMC mode.
*/
void ILI9488_MemWriteCmd(void)
{
ILI9488_SendCmd(ILI9488_CMD_MEMORY_WRITE);
}
/**
* \brief ILI9488 issue MEMORY read command in SPI/SMC mode.
*/
void ILI9488_MemReadCmd(void)
{
ILI9488_SendCmd(ILI9488_CMD_MEMORY_READ);
}
/**
* \brief ILI9488 Write memory with give buffer in SPI/SMC mode.
* \Param pBuf Point to buffer to be written.
* \Param size Size of buffer in byte.
*/
void ILI9488_WriteMemory( const uint16_t *pBuf, uint32_t size)
{
ILI9488DmaTxTransfer((uint16_t *)pBuf,size);
}
/**
* \brief ILI9488 Read memory to give buffer in SPI/SMC mode.
* \Param pBuf Point to buffer to be read.
* \Param size Size of buffer in byte.
*/
void ILI9488_ReadMemory( const uint16_t *pBuf, uint32_t size)
{
uint32_t cnt;
#if !defined(BOARD_LCD_SMC)
cnt = size*3;
#else
cnt = size;
#endif
ILI9488DmaRxTransfer((uint32_t *)pBuf,cnt);
}
/**
* \brief Initialize the ILI9488 controller in SPI/SMC mode.
*/
uint32_t ILI9488_Initialize( void )
{
uint32_t chipid;
uint16_t param;
_ILI9488_HW_Initialize();
ILI9488_InitializeWithDma();
ILI9488_WriteReg(ILI9488_CMD_SOFTWARE_RESET,&param,0);
Wait(200);
ILI9488_WriteReg(ILI9488_CMD_SLEEP_OUT,&param,0);
Wait(200);
// make it tRGB and reverse the column order
param = 0x48;
ILI9488_WriteReg(ILI9488_CMD_MEMORY_ACCESS_CONTROL,&param,1);
Wait(100);
param = 0x04;
ILI9488_WriteReg(ILI9488_CMD_CABC_CONTROL_9,&param,1);
chipid = ILI9488ReadExtReg(ILI9488_CMD_READ_ID4,3);
if ( chipid != ILI9488_DEVICE_CODE )
{
printf( "Read ILI9488 chip ID (0x%04x) error, skip initialization.\r\n", (unsigned int)chipid ) ;
return 1 ;
}
#if !defined(BOARD_LCD_SMC)
ILI9488_SetPixelFormat(6);
#else
ILI9488_SetPixelFormat(5);
#endif
ILI9488_WriteReg(ILI9488_CMD_NORMAL_DISP_MODE_ON,&param,0);
ILI9488_WriteReg(ILI9488_CMD_DISPLAY_ON,&param,0);
return 0 ;
}
/**
* \brief ILI9488 configure cursor in SPI/SMC mode.
* \Param x X position.
* \Param y Y position.
*/
void ILI9488_SetCursor(uint16_t x, uint16_t y)
{
/* Set Horizontal Address Start Position */
uint32_t cnt = 0;
#if !defined(BOARD_LCD_SMC)
uint8_t buf[4];
cnt = sizeof(buf);
#else
uint16_t buf[4];
cnt = sizeof(buf)/sizeof(uint16_t);
#endif
buf[0] = get_8b_to_16b(x);
buf[1] = get_0b_to_8b(x);
x+=1;
buf[2] = get_8b_to_16b(x);
buf[3] = get_0b_to_8b(x);
ILI9488_WriteReg(ILI9488_CMD_COLUMN_ADDRESS_SET,(uint16_t*)buf,cnt);
ILI9488_SendCmd(ILI9488_CMD_NOP);
/* Set Horizontal Address End Position */
buf[0] = get_8b_to_16b(y);
buf[1] = get_0b_to_8b(y);
y+=1;
buf[2] = get_8b_to_16b(y);
buf[3] = get_0b_to_8b(y);
ILI9488_WriteReg(ILI9488_CMD_PAGE_ADDRESS_SET,(uint16_t*)buf,cnt);
ILI9488_SendCmd(ILI9488_CMD_NOP);
}
/**
* \brief ILI9488 configure window.
* \Param dwX X start position.
* \Param dwX Y start position.
* \Param dwWidth Width of window.
* \Param dwHeight Height of window.
*/
void ILI9488_SetWindow( uint16_t dwX, uint16_t dwY, uint16_t dwWidth, uint16_t dwHeight )
{
uint16_t ColStart, ColEnd, RowStart, RowEnd;
uint32_t cnt = 0;
#if !defined(BOARD_LCD_SMC)
uint8_t buf[4];
cnt = sizeof(buf);
#else
uint16_t buf[4];
cnt = sizeof(buf)/sizeof(uint16_t);
#endif
ColStart = dwX ;
ColEnd = dwWidth;
RowStart = dwY ;
RowEnd = dwHeight;
buf[0] = get_8b_to_16b(ColStart);
buf[1] = get_0b_to_8b(ColStart);
buf[2] = get_8b_to_16b(ColEnd);
buf[3] = get_0b_to_8b(ColEnd);
ILI9488_WriteReg(ILI9488_CMD_COLUMN_ADDRESS_SET, (uint16_t*)buf, cnt);
ILI9488_SendCmd(ILI9488_CMD_NOP);
/* Set Horizontal Address End Position */
buf[0] = get_8b_to_16b(RowStart);
buf[1] = get_0b_to_8b(RowStart);
buf[2] = get_8b_to_16b(RowEnd);
buf[3] = get_0b_to_8b(RowEnd);
ILI9488_WriteReg(ILI9488_CMD_PAGE_ADDRESS_SET,(uint16_t*)buf,cnt);
ILI9488_SendCmd(ILI9488_CMD_NOP);
}
/**
* \brief ILI9488 configure window with full size.
*/
void ILI9488_SetFullWindow(void)
{
uint16_t c_start,c_end,r_start,r_end;
uint32_t cnt = 0;
#if !defined(BOARD_LCD_SMC)
uint8_t buf[4];
cnt = sizeof(buf);
#else
uint16_t buf[4];
cnt = sizeof(buf)/sizeof(uint16_t);
#endif
c_start = 0 ;
c_end = ILI9488_LCD_WIDTH- 1;
r_start = 0 ;
r_end = ILI9488_LCD_HEIGHT - 1;
/* Set Horizontal Address Start Position */
buf[0] = get_8b_to_16b(c_start);
buf[1] = get_0b_to_8b(c_start);
buf[2] = get_8b_to_16b(c_end);
buf[3] = get_0b_to_8b(c_end);
ILI9488_WriteReg(ILI9488_CMD_COLUMN_ADDRESS_SET,(uint16_t*)buf,cnt);
ILI9488_SendCmd(ILI9488_CMD_NOP);
/* Set Horizontal Address End Position */
buf[0] = get_8b_to_16b(r_start);
buf[1] = get_0b_to_8b(r_start);
buf[2] = get_8b_to_16b(r_end);
buf[3] = get_0b_to_8b(r_end);
ILI9488_WriteReg(ILI9488_CMD_COLUMN_ADDRESS_SET,(uint16_t*)buf,cnt);
ILI9488_SendCmd(ILI9488_CMD_NOP);
}
/**
* \brief Turn on the ILI9488.
*/
void ILI9488_On( void )
{
ILI9488_SendCmd(ILI9488_CMD_PIXEL_OFF);
ILI9488_SendCmd(ILI9488_CMD_DISPLAY_ON);
ILI9488_SendCmd(ILI9488_CMD_NORMAL_DISP_MODE_ON);
}
/**
* \brief Turn off the ILI9488.
*/
void ILI9488_Off( void )
{
ILI9488_SendCmd(ILI9488_CMD_DISPLAY_OFF);
}
/**
* \brief ILI9488 configure landscape.
* \Param dwRGB RGB mode.
* \Param LandscaprMode Landscape Mode.
*/
void ILI9488_SetDisplayLandscape( uint8_t dwRGB, uint8_t LandscapeMode )
{
uint16_t value;
if(LandscapeMode)
{
if(dwRGB)
{
value = 0xE8;
}
else
{
value = 0xE0;
}
}
else
{
if(dwRGB)
{
value = 0x48;
}
else
{
value = 0x40;
}
}
ILI9488_WriteReg(ILI9488_CMD_MEMORY_ACCESS_CONTROL, &value, sizeof(value));
}
#endif

View File

@ -0,0 +1,469 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation of ILI9488 SPI DMA driver.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <string.h>
#include <stdio.h>
#ifdef BOARD_LCD_ILI9488
/*----------------------------------------------------------------------------
* Local variables
*----------------------------------------------------------------------------*/
/** Pins to configure for the application. */
static const Pin ILI9488_CDS[] = { BOARD_LCD_PIN_CDS};
static sIli9488Dma ili9488Dma;
static sIli9488DmaCtl ili9488DmaCtl;
/* Maximum 5 bytes data buffer */
static uint32_t paramBuf[5];
static sXdmad xDmaLcd;
void XDMAC_Handler(void)
{
XDMAD_Handler(&xDmaLcd);
}
/*----------------------------------------------------------------------------
* Local functions
*----------------------------------------------------------------------------*/
#if defined(BOARD_LCD_SMC)
/**
* \brief Configure SMC timing for static memory (LCD)
*/
static void _ILI9488_ConfigureSmc( void )
{
/* Enable peripheral clock */
PMC_EnablePeripheral( ID_SMC ) ;
/* Configure SMC, NCS3 is assigned to LCD */
SMC->SMC_CS_NUMBER[SMC_EBI_LCD_CS].SMC_SETUP = SMC_SETUP_NWE_SETUP(2)
| SMC_SETUP_NCS_WR_SETUP(0)
| SMC_SETUP_NRD_SETUP(0)
| SMC_SETUP_NCS_RD_SETUP(0);
SMC->SMC_CS_NUMBER[SMC_EBI_LCD_CS].SMC_PULSE = SMC_PULSE_NWE_PULSE(6)
| SMC_PULSE_NCS_WR_PULSE(0xA)
| SMC_PULSE_NRD_PULSE(0xA)
| SMC_PULSE_NCS_RD_PULSE(0xA);
SMC->SMC_CS_NUMBER[SMC_EBI_LCD_CS].SMC_CYCLE = SMC_CYCLE_NWE_CYCLE(0xA)
| SMC_CYCLE_NRD_CYCLE(0xA);
SMC->SMC_CS_NUMBER[SMC_EBI_LCD_CS].SMC_MODE = SMC_MODE_READ_MODE
| SMC_MODE_WRITE_MODE
| SMC_MODE_DBW_16_BIT
| SMC_MODE_EXNW_MODE_DISABLED
| SMC_MODE_TDF_CYCLES(0xF);
}
#endif
/**
* \brief ILI9488_SPI xDMA Rx callback
*/
static void _ILI9488_Rx_CB(void)
{
if(!ili9488DmaCtl.Cds)
ili9488DmaCtl.rxDone = 1;
}
/**
* \brief ILI9488_SPI xDMA Tx callback
*/
static void _ILI9488_Tx_CB(void)
{
volatile uint32_t i;
if(ili9488DmaCtl.Cds)
{
for(i = 0; i<0xF; i++);
PIO_Set(ILI9488_CDS);
ili9488DmaCtl.Cds = 0;
}
ili9488DmaCtl.txDone = 1;
}
/**
* \brief Initializes the ILI9488Dma structure and the corresponding DMA hardware.
* select value.
*/
static void _ILI9488DmaInitialize(void)
{
ili9488DmaCtl.Cds = 1;
ili9488DmaCtl.rxDone = 0;
ili9488DmaCtl.txDone = 1;
ili9488Dma.xdmaD = &xDmaLcd;
ili9488Dma.xdmaD->pXdmacs = XDMAC;
ili9488Dma.ili9488DmaTxChannel = 0;
ili9488Dma.ili9488DmaRxChannel = 0;
ili9488Dma.xdmaInt = 0;
ili9488Dma.pSpiHw = ILI9488_SPI;
ili9488Dma.spiId = ILI9488_SPI_ID;
}
/**
* \brief This function initialize the appropriate DMA channel for Rx/Tx channel of SPI or SMC
* \returns 0 if the transfer has been started successfully; otherwise returns
* ILI9488_ERROR_XX is the driver is in use, or ILI9488_ERROR_XX if the command is not
* valid.
*/
static uint8_t _ILI9488DmaConfigChannels(void)
{
uint32_t srcType,dstType;
/* Driver initialize */
XDMAD_Initialize( ili9488Dma.xdmaD, 0 );
XDMAD_FreeChannel( ili9488Dma.xdmaD, ili9488Dma.ili9488DmaTxChannel);
XDMAD_FreeChannel( ili9488Dma.xdmaD, ili9488Dma.ili9488DmaRxChannel);
#if !defined(BOARD_LCD_SMC)
srcType = XDMAD_TRANSFER_MEMORY;
dstType = ili9488Dma.spiId;
#else
srcType = XDMAD_TRANSFER_MEMORY;
dstType = XDMAD_TRANSFER_MEMORY;
#endif
/* Allocate a DMA channel for ILI9488_SPI TX. */
ili9488Dma.ili9488DmaTxChannel = XDMAD_AllocateChannel( ili9488Dma.xdmaD, srcType, dstType);
{
if ( ili9488Dma.ili9488DmaTxChannel == XDMAD_ALLOC_FAILED )
{
return ILI9488_ERROR_DMA_ALLOCATE_CHANNEL;
}
}
/* Allocate a DMA channel for ILI9488_SPI RX. */
ili9488Dma.ili9488DmaRxChannel = XDMAD_AllocateChannel( ili9488Dma.xdmaD, dstType, srcType);
{
if ( ili9488Dma.ili9488DmaRxChannel == XDMAD_ALLOC_FAILED )
{
return ILI9488_ERROR_DMA_ALLOCATE_CHANNEL;
}
}
/* Setup callbacks for ILI9488_SPI RX */
XDMAD_SetCallback(ili9488Dma.xdmaD, ili9488Dma.ili9488DmaRxChannel, (XdmadTransferCallback)_ILI9488_Rx_CB, &ili9488Dma);
if (XDMAD_PrepareChannel( ili9488Dma.xdmaD, ili9488Dma.ili9488DmaRxChannel ))
return ILI9488_ERROR_DMA_ALLOCATE_CHANNEL;
/* Setup callbacks for ILI9488_SPI TX (ignored) */
XDMAD_SetCallback(ili9488Dma.xdmaD, ili9488Dma.ili9488DmaTxChannel, (XdmadTransferCallback)_ILI9488_Tx_CB, &ili9488Dma);
if ( XDMAD_PrepareChannel( ili9488Dma.xdmaD, ili9488Dma.ili9488DmaTxChannel ))
return ILI9488_ERROR_DMA_ALLOCATE_CHANNEL;
/* Check if DMA IRQ is enable; if not Enable it */
if(!(NVIC_GetActive(XDMAC_IRQn)))
{
/* Enable interrupt */
NVIC_EnableIRQ(XDMAC_IRQn);
}
return 0;
}
/**
* \brief Configure the SPI/SMC tx/rx DMA.
* \returns 0 if the xDMA configuration successfully; otherwise returns
* ILI9488_ERROR_XXX.
*/
static uint8_t _ILI9488DmaConfigureRxTx(void)
{
uint32_t txAddress,rxAddress;
sXdmad *pXdmad;
pXdmad = ili9488Dma.xdmaD;
#if !defined(BOARD_LCD_SMC)
txAddress = (uint32_t)&ILI9488_SPI->SPI_TDR;
rxAddress = (uint32_t)&ILI9488_SPI->SPI_RDR;
ili9488Dma.xdmadExtTxCfg.mbr_cfg =
XDMAC_CC_TYPE_PER_TRAN
| XDMAC_CC_DSYNC_MEM2PER
| XDMAC_CC_DWIDTH_BYTE
| XDMAC_CC_PERID(XDMAIF_Get_ChannelNumber(ili9488Dma.spiId, XDMAD_TRANSFER_TX ));
ili9488Dma.xdmadExtRxCfg.mbr_cfg = XDMAC_CC_TYPE_PER_TRAN | XDMAC_CC_DSYNC_PER2MEM |
XDMAC_CC_PERID(XDMAIF_Get_ChannelNumber(ili9488Dma.spiId, XDMAD_TRANSFER_RX ));
#else
txAddress = rxAddress =(uint32_t)ILI9488_BASE_ADDRESS;
ili9488Dma.xdmadExtTxCfg.mbr_cfg = XDMAC_CC_DWIDTH_HALFWORD;
ili9488Dma.xdmadExtRxCfg.mbr_cfg = 0;
#endif
/* Setup DMA TX channel */
ili9488Dma.xdmadTxCfg.mbr_sa = 0;
ili9488Dma.xdmadTxCfg.mbr_da = txAddress;
ili9488Dma.xdmadTxCfg.mbr_ubc = XDMA_UBC_NVIEW_NDV0 | XDMA_UBC_NDE_FETCH_DIS| XDMA_UBC_NSEN_UPDATED ;
ili9488Dma.xdmadTxCfg.mbr_cfg =
XDMAC_CC_TYPE_MEM_TRAN
| XDMAC_CC_MBSIZE_SINGLE
| XDMAC_CC_CSIZE_CHK_1
| XDMAC_CC_SIF_AHB_IF0
| XDMAC_CC_DIF_AHB_IF1
| XDMAC_CC_SAM_INCREMENTED_AM
| XDMAC_CC_DAM_FIXED_AM;
ili9488Dma.xdmadTxCfg.mbr_cfg |= ili9488Dma.xdmadExtTxCfg.mbr_cfg;
ili9488Dma.xdmadTxCfg.mbr_bc = 0;
ili9488Dma.xdmadTxCfg.mbr_sus = 0;
ili9488Dma.xdmadTxCfg.mbr_dus = 0;
/* Setup RX DMA channel */
ili9488Dma.xdmadRxCfg.mbr_ubc = XDMA_UBC_NVIEW_NDV0 | XDMA_UBC_NDE_FETCH_DIS | XDMA_UBC_NDEN_UPDATED ;
ili9488Dma.xdmadRxCfg.mbr_da = 0;
ili9488Dma.xdmadRxCfg.mbr_sa = rxAddress;
ili9488Dma.xdmadRxCfg.mbr_cfg =
XDMAC_CC_TYPE_MEM_TRAN
| XDMAC_CC_MBSIZE_SINGLE
| XDMAC_CC_CSIZE_CHK_1
| XDMAC_CC_DWIDTH_WORD
| XDMAC_CC_SIF_AHB_IF1
| XDMAC_CC_DIF_AHB_IF0
| XDMAC_CC_SAM_FIXED_AM
| XDMAC_CC_DAM_INCREMENTED_AM;
ili9488Dma.xdmadRxCfg.mbr_cfg |= ili9488Dma.xdmadExtRxCfg.mbr_cfg;
ili9488Dma.xdmadRxCfg.mbr_bc = 0;
ili9488Dma.xdmadRxCfg.mbr_sus = 0;
ili9488Dma.xdmadRxCfg.mbr_dus =0;
/* Put all interrupts on for non LLI list setup of DMA */
ili9488Dma.xdmaInt = (XDMAC_CIE_BIE
| XDMAC_CIE_RBIE
| XDMAC_CIE_WBIE
| XDMAC_CIE_ROIE);
if (XDMAD_ConfigureTransfer( pXdmad, ili9488Dma.ili9488DmaRxChannel, &ili9488Dma.xdmadRxCfg, 0, 0, ili9488Dma.xdmaInt))
return ILI9488_ERROR_DMA_CONFIGURE;
if (XDMAD_ConfigureTransfer( pXdmad, ili9488Dma.ili9488DmaTxChannel, &ili9488Dma.xdmadTxCfg, 0, 0, ili9488Dma.xdmaInt))
return ILI9488_ERROR_DMA_CONFIGURE;
return 0;
}
/**
* \brief Update Rx/Tx DMA configuration with new buffer address and buffer size.
* \param pTxBuffer point to Tx buffer address
* \param wTxSize Tx buffer size in byte
* \param pRxBuffer point to Rx buffer address
* \param wRxSize Rx buffer size in byte
* \returns 0 if the xDMA configuration successfully; otherwise returns
* ILI9488_DMA_ERROR_XXX.
*/
static uint8_t _ILI9488DmaUpdateBuffer(uint16_t *pTxBuffer,uint32_t wTxSize, uint32_t *pRxBuffer,uint32_t wRxSize)
{
sXdmad *pXdmad;
pXdmad = ili9488Dma.xdmaD;
ili9488Dma.xdmadTxCfg.mbr_sa = (uint32_t)pTxBuffer;
ili9488Dma.xdmadTxCfg.mbr_ubc = wTxSize;
ili9488Dma.xdmadRxCfg.mbr_da = (uint32_t)pRxBuffer;
ili9488Dma.xdmadRxCfg.mbr_ubc = wRxSize;
if (XDMAD_ConfigureTransfer( pXdmad, ili9488Dma.ili9488DmaRxChannel, &ili9488Dma.xdmadRxCfg, 0, 0, ili9488Dma.xdmaInt))
return ILI9488_ERROR_DMA_CONFIGURE;
if (XDMAD_ConfigureTransfer( pXdmad, ili9488Dma.ili9488DmaTxChannel, &ili9488Dma.xdmadTxCfg, 0, 0, ili9488Dma.xdmaInt))
return ILI9488_ERROR_DMA_CONFIGURE;
return 0;
}
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/**
* \brief Initialize ILI9488 driver with DMA support.
* \returns 0 if the xDMA configuration successfully; otherwise returns
* ILI9488_DMA_ERROR_XXX.
*/
uint8_t ILI9488_InitializeWithDma(void)
{
#if defined(BOARD_LCD_SMC)
_ILI9488_ConfigureSmc();
#endif
_ILI9488DmaInitialize();
if (_ILI9488DmaConfigChannels()) return ILI9488_ERROR_DMA_ALLOCATE_CHANNEL;
if(_ILI9488DmaConfigureRxTx()) return ILI9488_ERROR_DMA_CONFIGURE;
return 0;
}
/**
* \brief Start ILI9488 DMA transfer .
* \param pTxBuffer point to Tx buffer address
* \param wTxSize Tx buffer size in byte
* \returns 0 if the xDMA configuration successfully; otherwise returns
* ILI9488_DMA_ERROR_XXX.
*/
uint8_t ILI9488DmaTxTransfer( uint16_t *pTxBuffer,uint32_t wTxSize)
{
_ILI9488DmaUpdateBuffer(pTxBuffer, wTxSize, 0, 0);
SCB_CleanInvalidateDCache();
if (XDMAD_StartTransfer( ili9488Dma.xdmaD, ili9488Dma.ili9488DmaTxChannel))
return ILI9488_ERROR_DMA_TRANSFER;
while(!ili9488DmaCtl.txDone);
ili9488DmaCtl.txDone = 0;
return 0;
}
/**
* \brief Start ILI9488 DMA Rx transfer .
* \param pRxBuffer point to Rx buffer address
* \param wRxSize Rx buffer size in byte
* \returns 0 if the xDMA transfer successfully; otherwise returns ILI9488_DMA_ERROR_XXX.
*/
uint8_t ILI9488DmaRxTransfer(uint32_t *pRxBuffer,uint32_t wRxSize)
{
uint16_t dummyTxBuffer[5];
_ILI9488DmaUpdateBuffer(dummyTxBuffer, wRxSize, pRxBuffer, wRxSize);
SCB_CleanInvalidateDCache();
if (XDMAD_StartTransfer( ili9488Dma.xdmaD, ili9488Dma.ili9488DmaRxChannel))
return ILI9488_ERROR_DMA_TRANSFER;
#if !defined(BOARD_LCD_SMC)
if (XDMAD_StartTransfer( ili9488Dma.xdmaD, ili9488Dma.ili9488DmaTxChannel))
return ILI9488_ERROR_DMA_TRANSFER;
#endif
return 0;
}
/**
* \brief ILI9488 Send command with DMA.
* \param command Command to be sent
* \returns 0 if the xDMA transfer successfully; otherwise returns ILI9488_DMA_ERROR_XXX.
*/
uint8_t ILI9488_SendCmd( uint16_t command )
{
PIO_Clear(ILI9488_CDS);
ili9488DmaCtl.Cds = 1;
return ILI9488DmaTxTransfer((uint16_t*)&command, 1 );
}
/**
* \brief ILI9488 Write register for SPI/SMC mode.
* \param command Command to be sent
* \param pTxBuffer Point to tx buffer contains parameters
* \param bufSize Size of buffer
* \returns 0 if the xDMA transfer successfully; otherwise returns ILI9488_DMA_ERROR_XXX.
*/
void ILI9488_WriteReg(uint16_t command, uint16_t* pTxBuffer, uint32_t bufSize)
{
ILI9488_SendCmd(command);
if(bufSize == 0) return;
ILI9488DmaTxTransfer(pTxBuffer,bufSize);
}
/**
* \brief ILI9488 Read registers for SPI/SMC mode.
* \param command Command to be sent
* \param size Size of parameters
* \returns register value.
*/
uint32_t ILI9488ReadReg(uint16_t cmd,uint32_t size)
{
uint32_t i;
uint32_t value = 0;
uint32_t *ptr;
uint32_t shift_cnt = size-1;
if (size > 4) return ILI9488_ERROR_DMA_SIZE;
ILI9488_SendCmd(cmd);
ILI9488DmaRxTransfer(paramBuf, size+1);
while(!ili9488DmaCtl.rxDone);
ili9488DmaCtl.rxDone = 0;
ptr = &paramBuf[1];
for(i = 1; i < size+1;i++)
{
value |= (*ptr&0xFF)<<(shift_cnt << 3);
ptr++;
shift_cnt--;
}
return value;
}
/**
* \brief ILI9488 Read Ext registers for SPI/SMC mode.
* \param command Command to be sent
* \param size Size of buffer
* \returns Ext register value.
*/
uint32_t ILI9488ReadExtReg(uint16_t cmd,uint32_t size)
{
uint32_t value=0;
#if !defined(BOARD_LCD_SMC)
uint32_t shift_cnt = size-1;
uint16_t nSpiCnt = 0x81;
uint16_t def_val = 0;
if (size > 4) return ILI9488_ERROR_DMA_SIZE;
while(size > 0)
{
ILI9488_WriteReg(ILI9488_CMD_SPI_READ_SETTINGS,&nSpiCnt,1);
ILI9488_SendCmd(cmd);
ILI9488DmaRxTransfer( paramBuf,2);
while(!ili9488DmaCtl.rxDone);
ili9488DmaCtl.rxDone = 0;
ILI9488_WriteReg(ILI9488_CMD_SPI_READ_SETTINGS,&def_val,1);
value |= (paramBuf[1]&0xFF)<<(shift_cnt << 3);
nSpiCnt++;
shift_cnt--;
size--;
}
#else
value = ILI9488ReadReg(cmd,size);
#endif
return value;
}
#endif //BOARD_LCD_ILI9488

View File

@ -0,0 +1,655 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation of draw function on LCD, Include draw text, image
* and basic shapes (line, rectangle, circle).
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdint.h>
#include <string.h>
#include <assert.h>
/*----------------------------------------------------------------------------
* Local variables
*----------------------------------------------------------------------------*/
static void* gpCanvasBuffer;
static uint32_t gwCanvasBufferSize;
static uint32_t gwCanvasMaxWidth, gwCanvasMaxHeight;
extern uint8_t ili9488_lcdMode;
/*----------------------------------------------------------------------------
* Local functions
*----------------------------------------------------------------------------*/
/*
* \brief Fill rectangle with given color
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param rc rectangle defines X and Y coordinate, width and height of windows.
* \param dwColor color to be filled.
*/
static void LCDD_FillSolidRect(uint16_t *pCanvasBuffer, rect rc, uint32_t dwColor )
{
uint32_t row, col;
uint32_t w,h;
//assert(gpCanvasBuffer!=NULL);
w = rc.x + rc.width;
w = w > gwCanvasMaxWidth ? gwCanvasMaxWidth : w;
h = rc.y + rc.height;
h = h > gwCanvasMaxHeight ? gwCanvasMaxHeight : h;
if (ili9488_lcdMode == ILI9488_SPIMODE) {
sBGR *p_buf = gpCanvasBuffer;
if(pCanvasBuffer != NULL) p_buf = (sBGR *)((uint8_t*)pCanvasBuffer);
//it'd better change to a DMA transfer
for(row = rc.y; row < h; row++) {
for(col = rc.x; col < w; col++) {
//*p_buf++ = dwColor;
p_buf[row * gwCanvasMaxWidth + col].b = dwColor&0xFF;
p_buf[row * gwCanvasMaxWidth + col].g = dwColor>>8;
p_buf[row * gwCanvasMaxWidth + col].r = dwColor>>16;
}
}
} else {
uint16_t *p_buf = gpCanvasBuffer;
if(pCanvasBuffer != NULL) p_buf = pCanvasBuffer;
//it'd better change to a DMA transfer
for(row = rc.y; row < h; row++) {
for(col = rc.x; col < w; col++) {
p_buf[row * gwCanvasMaxWidth + col] = (uint16_t)dwColor;
}
}
}
}
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/*
* \brief Update windows size.
* \param rc rectangle defines X and Y coordinate, width and height of windows.
*/
void LCDD_SetUpdateWindowSize(rect rc)
{
gwCanvasMaxWidth = rc.width + 1;
gwCanvasMaxHeight = rc.height + 1;
if (ili9488_lcdMode == ILI9488_SPIMODE) {
ILI9488_SpiSetWindow( rc.x, rc.y, rc.width, rc.height);
} else {
ILI9488_EbiSetWindow( rc.x, rc.y, rc.width, rc.height);
}
}
/*
* \brief Update windows in current canvas.
*/
void LCDD_UpdateWindow(void)
{
uint32_t size = 0;
if (ili9488_lcdMode == ILI9488_SPIMODE) {
size = gwCanvasBufferSize / (sizeof(sBGR)) *3 ;
ILI9488_SpiSendCommand(ILI9488_CMD_MEMORY_WRITE,
(uint8_t*)gpCanvasBuffer, 0, AccessWrite, size);
} else {
size = gwCanvasBufferSize / sizeof(uint16_t);
ILI9488_EbiSendCommand(ILI9488_CMD_MEMORY_WRITE,
(uint16_t*)gpCanvasBuffer, 0, AccessWrite, size);
}
}
/*
* \brief Update windows in partial canvas.
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param size Size of canvas buffer.
*/
void LCDD_UpdatePartialWindow(uint8_t* pCanvasBuffer,uint32_t size)
{
uint32_t cnt = 0;
if (ili9488_lcdMode == ILI9488_SPIMODE) {
cnt = size/sizeof(sBGR) * 3;
ILI9488_SpiSendCommand(ILI9488_CMD_MEMORY_WRITE,
(uint8_t*)pCanvasBuffer, 0, AccessWrite, cnt);
} else {
cnt = size/sizeof(uint16_t);
ILI9488_EbiSendCommand(ILI9488_CMD_MEMORY_WRITE,
(uint16_t*)pCanvasBuffer, 0, AccessWrite, cnt);
}
}
/*
* \brief Draws a rectangle with fill inside on LCD, at the given coordinates.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param x X-coordinate of upper-left rectangle corner.
* \param y Y-coordinate of upper-left rectangle corner.
* \param width Rectangle width in pixels.
* \param height Rectangle height in pixels.
* \param color Rectangle color.
*/
void LCDD_DrawRectangleWithFill(uint16_t *pCanvasBuffer, uint32_t dwX, uint32_t dwY, uint32_t dwWidth,
uint32_t dwHeight, uint32_t dwColor)
{
rect rc;
rc.x = dwX;
rc.y = dwY;
rc.width = dwWidth + 1;
rc.height = dwHeight + 1;
LCDD_FillSolidRect(pCanvasBuffer, rc , dwColor);
}
/**
* \brief Draws a circle on LCD, at the given coordinates.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param x X-coordinate of circle centre.
* \param y Y-coordinate of circle centre.
* \param r circle radius.
* \param color circle color.
*/
uint32_t LCDD_DrawCircle(uint16_t *pCanvasBuffer, uint32_t x, uint32_t y, uint32_t r, uint32_t color )
{
signed int d; /* Decision Variable */
uint32_t curX; /* Current X Value */
uint32_t curY; /* Current Y Value */
d = 3 - (r << 1);
curX = 0;
curY = r;
while (curX <= curY) {
LCDD_DrawPixel(pCanvasBuffer, x + curX, y + curY, color);
LCDD_DrawPixel(pCanvasBuffer, x + curX, y - curY, color);
LCDD_DrawPixel(pCanvasBuffer, x - curX, y + curY, color);
LCDD_DrawPixel(pCanvasBuffer, x - curX, y - curY, color);
LCDD_DrawPixel(pCanvasBuffer, x + curY, y + curX, color);
LCDD_DrawPixel(pCanvasBuffer, x + curY, y - curX, color);
LCDD_DrawPixel(pCanvasBuffer, x - curY, y + curX, color);
LCDD_DrawPixel(pCanvasBuffer, x - curY, y - curX, color);
if (d < 0) {
d += (curX << 2) + 6;
} else {
d += ((curX - curY) << 2) + 10;
curY--;
}
curX++;
}
return 0;
}
/*
* \brief Draws a circle with fill inside on LCD, at the given coordinates.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param dwX X-coordinate of upper-left rectangle corner.
* \param dwY Y-coordinate of upper-left rectangle corner.
* \param dwRadius Radius.
* \param color Rectangle color.
*/
uint32_t LCD_DrawFilledCircle(uint16_t *pCanvasBuffer, uint32_t dwX, uint32_t dwY,
uint32_t dwRadius, uint32_t color)
{
signed int d; /* Decision Variable */
uint32_t dwCurX; /* Current X Value */
uint32_t dwCurY; /* Current Y Value */
uint32_t dwXmin, dwYmin;
if (dwRadius == 0) {
return 0;
}
d = 3 - (dwRadius << 1);
dwCurX = 0;
dwCurY = dwRadius;
while ( dwCurX <= dwCurY ) {
dwXmin = (dwCurX > dwX) ? 0 : dwX-dwCurX;
dwYmin = (dwCurY > dwY) ? 0 : dwY-dwCurY;
LCDD_DrawRectangleWithFill(pCanvasBuffer, dwXmin, dwYmin,
dwX + dwCurX - dwXmin, 1 ,color);
LCDD_DrawRectangleWithFill(pCanvasBuffer, dwXmin,
dwY+dwCurY, dwX + dwCurX - dwXmin, 1,
color );
dwXmin = (dwCurY > dwX) ? 0 : dwX-dwCurY;
dwYmin = (dwCurX > dwY) ? 0 : dwY-dwCurX;
LCDD_DrawRectangleWithFill(pCanvasBuffer, dwXmin, dwYmin,
dwX + dwCurY -dwXmin , 1, color );
LCDD_DrawRectangleWithFill(pCanvasBuffer, dwXmin,
dwY + dwCurX, dwX+dwCurY - dwXmin, 1,
color );
if ( d < 0 ) {
d += (dwCurX << 2) + 6;
} else {
d += ((dwCurX - dwCurY) << 2) + 10;
dwCurY--;
}
dwCurX++;
}
return 0;
}
/**
* \brief Draws a string inside a LCD buffer, at the given coordinates.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param x X-coordinate of string top-left corner.
* \param y Y-coordinate of string top-left corner.
* \param pString String to display.
* \param color String color.
*/
void LCDD_DrawString( uint16_t* pCanvasBuffer, uint32_t x, uint32_t y,
const uint8_t *pString, uint32_t color )
{
uint32_t xorg = x;
while ( *pString != 0 ) {
if ( *pString == '\n' ) {
y += gFont.height + 2;
x = xorg;
} else {
LCDD_DrawChar(pCanvasBuffer, x, y, *pString, color );
x += gFont.width + 2;
}
pString++;
}
}
/**
* \brief Returns the width & height in pixels that a string will occupy on the
* screen if drawn using LCDD_DrawString.
*
* \param pString String.
* \param pWidth Pointer for storing the string width (optional).
* \param pHeight Pointer for storing the string height (optional).
*
* \return String width in pixels.
*/
void LCDD_GetStringSize( const uint8_t *pString, uint32_t *pWidth,
uint32_t *pHeight )
{
uint32_t width = 0;
uint32_t height = gFont.height;
while ( *pString != 0 ) {
if ( *pString == '\n' ) {
height += gFont.height + 2;
} else {
width += gFont.width + 2;
}
pString++;
}
if ( width > 0 ) {
width -= 2;
}
if ( pWidth != NULL ) {
*pWidth = width;
}
if ( pHeight != NULL ) {
*pHeight = height;
}
}
/*
* \brief Performs a bit-block transfer of the color data corresponding to a
* rectangle of pixels from the given source context into destination context.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param dst_x X-coordinate of source rectangle.
* \param dst_y Y-coordinate of source rectangle.
* \param dst_w Rectangle width in pixels of source rectangle.
* \param dst_h Rectangle height in pixels of source rectangle.
* \param src Pointer to the source device context.
* \param src_x X-coordinate of destination rectangle.
* \param src_y Y-coordinate of destination rectangle.
* \param src_w Rectangle width in pixels of destination rectangle.
* \param src_h Rectangle height in pixels of destination rectangle.
*/
void LCDD_BitBlt( uint16_t* pCanvasBuffer, uint32_t dst_x,uint32_t dst_y,uint32_t dst_w,uint32_t dst_h,
const LcdColor_t *src,
uint32_t src_x,uint32_t src_y,uint32_t src_w,uint32_t src_h)
{
uint32_t row,col;
uint32_t src_row,src_col;
//assert(gpCanvasBuffer!=NULL);
src_h = src_h;
if (ili9488_lcdMode == ILI9488_SPIMODE) {
sBGR *p_buf = gpCanvasBuffer;
if(pCanvasBuffer != NULL) p_buf = (sBGR *)((uint8_t*)pCanvasBuffer);
//it'd better change to a DMA transfer
SCB_CleanInvalidateDCache();
for(src_row = src_y,row = dst_y; row < dst_h; row++,src_row++) {
for(src_col = src_x,col = dst_x; col < dst_w; col++,src_col++) {
p_buf[row * gwCanvasMaxWidth+col].r = src[src_row*src_w + src_col]&0xFF;
p_buf[row * gwCanvasMaxWidth+col].g = src[src_row*src_w + src_col]>>8;
p_buf[row * gwCanvasMaxWidth+col].b = src[src_row*src_w + src_col]>>16;
}
memory_barrier()
}
memory_barrier()
} else {
uint16_t *p_buf = gpCanvasBuffer;
if(pCanvasBuffer != NULL) p_buf = pCanvasBuffer;
//it'd better change to a DMA transfer
SCB_CleanInvalidateDCache();
for(src_row = src_y,row = dst_y; row < dst_h; row++,src_row++) {
for(src_col = src_x, col = dst_x; col < dst_w; col++,src_col++) {
p_buf[row * gwCanvasMaxWidth+col] = src[src_row*src_w + src_col];
}
}
memory_barrier()
}
}
/*
* \brief Performs a bit-block transfer of the color data corresponding to a
* rectangle of pixels from the given source context into destination context.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param dst_x X-coordinate of source rectangle.
* \param dst_y Y-coordinate of source rectangle.
* \param dst_w Rectangle width in pixels of source rectangle.
* \param dst_h Rectangle height in pixels of source rectangle.
* \param src Pointer to the source device context.
* \param src_x X-coordinate of destination rectangle.
* \param src_y Y-coordinate of destination rectangle.
* \param src_w Rectangle width in pixels of destination rectangle.
* \param src_h Rectangle height in pixels of destination rectangle.
* \param alpha alpha value.
*/
void LCDD_BitBltAlphaBlend(uint16_t* pCanvasBuffer,
uint32_t dst_x,
uint32_t dst_y,
uint32_t dst_w,
uint32_t dst_h,
const LcdColor_t *src,
uint32_t src_x,
uint32_t src_y,
uint32_t src_w,
uint32_t src_h,
uint32_t alpha)
{
uint32_t row,col;
uint32_t src_row,src_col;
uint32_t w,h;
uint32_t dst_row;
uint32_t r,g,b;
if (ili9488_lcdMode == ILI9488_SPIMODE) {
sBGR *p_buf = gpCanvasBuffer;
if(pCanvasBuffer != NULL) p_buf = (sBGR *)((uint8_t*)pCanvasBuffer);
//it'd better change to a DMA transfer
SCB_CleanInvalidateDCache();
for(src_row = src_y,row = dst_y; row < dst_h; row++,src_row++) {
for(src_col = src_x,col = dst_x; col < dst_w; col++,src_col++) {
p_buf[row *dst_w +col].r = src[src_row*src_w + src_col]&0xFF;
p_buf[row *dst_w +col].g = src[src_row*src_w + src_col]>>8;
p_buf[row *dst_w +col].b = src[src_row*src_w + src_col]>>16;
}
}
memory_barrier()
} else {
uint16_t *p_buf = gpCanvasBuffer;
if(pCanvasBuffer != NULL) p_buf = pCanvasBuffer;
w = src_x + src_w;
h = src_y + src_h;
dst_row = dst_y;
p_buf += (dst_row*dst_w + dst_x);
src += src_y*w + src_x;
SCB_CleanInvalidateDCache();
for(src_row = src_y; src_row < h; src_row++,dst_row++) {
for(src_col = src_x; src_col < w; src_col++){
r = (p_buf[src_col] >> 11) * (255 - alpha) / 255 +
(src[src_col] >> 11) * alpha / 255;
if(r > 0x1F) r = 0x1F;
g = ((p_buf[src_col] >> 5) & 0x3F) * (255 - alpha) / 255 +
((src[src_col] >> 5) & 0x3f) * alpha / 255;
if(g > 0x3F) g = 0x3F;
b = ((p_buf[src_col]) & 0x1F) * (255 - alpha) / 255
+ ((src[src_col]) & 0x1f) * alpha / 255;
if(b > 0x1F) b = 0x1F;
p_buf[src_col] = ((r & 0x1F) << 11)|((g & 0x3F) << 5)|( b & 0x1F);
}
p_buf += dst_w;
src += w;
}
memory_barrier()
}
}
/*
* \brief Draw a raw image at given position on LCD.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param dwX X-coordinate of image start.
* \param dwY Y-coordinate of image start.
* \param pImage Image buffer.
* \param width Image width.
* \param height Image height.
*/
void LCDD_DrawImage(uint16_t* pCanvasBuffer, uint32_t dwX, uint32_t dwY,
const LcdColor_t *pImage, uint32_t dwWidth, uint32_t dwHeight )
{
/* Determine the refresh window area */
/* Horizontal and Vertical RAM Address Position (R50h, R51h, R52h, R53h) */
//CheckBoxCoordinates(&dwX, &dwY, &dwWidth, &dwHeight);
LCDD_BitBlt(pCanvasBuffer, dwX, dwY, dwWidth, dwHeight,
pImage, 0, 0, dwWidth - dwX, dwHeight - dwY);
}
/**
* \brief Draw a pixel on LCD of given color.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param x X-coordinate of pixel.
* \param y Y-coordinate of pixel.
* \param color Pixel color.
*/
void LCDD_DrawPixel(uint16_t* pCanvasBuffer, uint32_t x, uint32_t y, uint32_t color )
{
//assert(gpCanvasBuffer!=NULL);
if (ili9488_lcdMode == ILI9488_SPIMODE) {
sBGR *p_buf = gpCanvasBuffer;
if(pCanvasBuffer != NULL) p_buf = (sBGR *)((uint8_t*)pCanvasBuffer);
p_buf += y * gwCanvasMaxWidth;
p_buf += x;
p_buf->b = color&0xFF;
p_buf->g = color>>8;
p_buf->r = color>>16;
p_buf++;
memory_barrier()
} else {
uint16_t *p_buf = gpCanvasBuffer;
if(pCanvasBuffer != NULL) p_buf = pCanvasBuffer;
p_buf += y * gwCanvasMaxWidth;
p_buf += x;
*p_buf = (uint16_t)color;
}
}
/*
* \brief Draw a line on LCD, horizontal and vertical line are supported.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param dwX1 X-coordinate of line start.
* \param dwY1 Y-coordinate of line start.
* \param dwX2 X-coordinate of line end.
* \param dwY2 Y-coordinate of line end.
* \param color Pixel color.
*/
void LCDD_DrawLine(uint16_t* pCanvasBuffer, uint32_t dwX1, uint32_t dwY1,
uint32_t dwX2, uint32_t dwY2 , uint32_t color )
{
if (( dwY1 == dwY2 ) || (dwX1 == dwX2)) {
//LCDD_DrawRectangleWithFill( dwX1, dwY1, dwX2, dwY2, color );
LCDD_DrawStraightLine(pCanvasBuffer, dwX1, dwY1, dwX2, dwY2, color );
} else {
LCDD_DrawLineBresenham(pCanvasBuffer, dwX1, dwY1, dwX2, dwY2 , color);
}
}
void LCDD_DrawStraightLine(uint16_t* pCanvasBuffer, uint32_t dwX1, uint32_t dwY1,
uint32_t dwX2, uint32_t dwY2 , uint32_t color )
{
uint32_t x,y;
uint32_t tmp;
if(dwY1 > dwY2)
{
tmp = dwY1;
dwY1 = dwY2;
dwY2 = tmp;
}
if(dwX1 > dwX2)
{
tmp = dwX1;
dwX1 = dwX2;
dwX2 = tmp;
}
for(y = dwY1; y<=dwY2; y++)
{
for(x=dwX1;x<=dwX2;x++)
{
LCDD_DrawPixel(pCanvasBuffer, x , y , color);
}
}
}
/*
* \brief Draw a line on LCD, which is not horizontal or vertical.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param dwX1 X-coordinate of line start.
* \param dwY1 Y-coordinate of line start.
* \param dwX2 X-coordinate of line end.
* \param dwY2 Y-coordinate of line end.
* \param color pixel color.
*/
uint32_t LCDD_DrawLineBresenham(uint16_t* pCanvasBuffer, uint32_t dwX1,
uint32_t dwY1, uint32_t dwX2, uint32_t dwY2 , uint32_t color)
{
int dx, dy;
int i;
int xinc, yinc, cumul;
int x, y;
x = dwX1;
y = dwY1;
dx = dwX2 - dwX1;
dy = dwY2 - dwY1;
xinc = ( dx > 0 ) ? 1 : -1;
yinc = ( dy > 0 ) ? 1 : -1;
dx = ( dx > 0 ) ? dx : -dx;
dy = ( dy > 0 ) ? dy : -dy;
LCDD_DrawPixel(pCanvasBuffer, x , y , color);
if ( dx > dy ) {
cumul = dx / 2;
for ( i = 1; i <= dx; i++ ) {
x += xinc;
cumul += dy;
if ( cumul >= dx ) {
cumul -= dx;
y += yinc;
}
LCDD_DrawPixel(pCanvasBuffer, x , y , color);
}
} else {
cumul = dy / 2;
for ( i = 1; i <= dy; i++ ) {
y += yinc;
cumul += dx;
if ( cumul >= dy ) {
cumul -= dy;
x += xinc;
}
LCDD_DrawPixel(pCanvasBuffer, x , y , color);
}
}
return 0;
}
/*
* \brief Draws a rectangle on LCD, at the given coordinates.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param x X-coordinate of upper-left rectangle corner.
* \param y Y-coordinate of upper-left rectangle corner.
* \param width Rectangle width in pixels.
* \param height Rectangle height in pixels.
* \param color Rectangle color.
*/
void LCDD_DrawRectangle(uint16_t* pCanvasBuffer, uint32_t x, uint32_t y,
uint32_t width, uint32_t height, uint32_t color )
{
LCDD_DrawRectangleWithFill(pCanvasBuffer, x, y, width, 1, color);
LCDD_DrawRectangleWithFill(pCanvasBuffer, x, y, 1, height, color);
LCDD_DrawRectangleWithFill(pCanvasBuffer, x + width , y, 1, height, color);
LCDD_DrawRectangleWithFill(pCanvasBuffer, x, y + height, width, 1, color);
}
/*
* \brief Set buffer for pCanvas.
*
* \param pCanvasBuffer Pointer of external buffer.
* \param wBufferSize Size of buffer.
*/
void LCDD_SetCavasBuffer( void* pCanvasBuffer, uint32_t wBufferSize)
{
if (ili9488_lcdMode == ILI9488_SPIMODE) {
gpCanvasBuffer = (sBGR*)pCanvasBuffer;
gwCanvasBufferSize = wBufferSize;
} else {
gpCanvasBuffer = (uint16_t*)pCanvasBuffer;
gwCanvasBufferSize = wBufferSize;
}
}

View File

@ -0,0 +1,114 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation of draw font on LCD.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdint.h>
#include <assert.h>
/*----------------------------------------------------------------------------
* Local variables
*----------------------------------------------------------------------------*/
/** Global variable describing the font being instantiated. */
const Font gFont = {10, 14};
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/**
* \brief Draws an ASCII character on LCD.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param x X-coordinate of character upper-left corner.
* \param y Y-coordinate of character upper-left corner.
* \param c Character to output.
* \param color Character color.
*/
extern void LCDD_DrawChar(uint16_t* pCanvasBuffer, uint32_t x, uint32_t y,
uint8_t c, uint32_t color )
{
uint32_t row, col;
assert( (c >= 0x20) && (c <= 0x7F) );
for ( col = 0; col < 10; col++ ) {
for ( row = 0; row < 8; row++ ) {
if ( (pCharset10x14[((c - 0x20) * 20) + col * 2] >> (7 - row)) & 0x1){
LCDD_DrawPixel(pCanvasBuffer, x+col, y+row, color );
}
}
for (row = 0; row < 6; row++ ) {
if((pCharset10x14[((c - 0x20) * 20) + col * 2 + 1]
>> (7 - row)) & 0x1) {
LCDD_DrawPixel(pCanvasBuffer, x+col, y+row+8, color );
}
}
}
}
/**
* \brief Draws a string inside a LCD buffer, at the given coordinates.
* Line breaks will be honoured.
*
* \param pCanvasBuffer Pointer to dedicate canvas buffer.
* \param dwX X-coordinate of string top-left corner.
* \param dwY Y-coordinate of string top-left corner.
* \param pString String to display.
*/
extern void LCD_DrawString(uint16_t* pCanvasBuffer, uint32_t dwX, uint32_t dwY,
const uint8_t *pString, uint32_t color )
{
uint32_t dwXorg = dwX;
while ( *pString != 0 ) {
if ( *pString == '\n' ) {
dwY += gFont.height + 2;
dwX = dwXorg;
} else {
LCDD_DrawChar(pCanvasBuffer, dwX, dwY, *pString, color );
dwX += gFont.width + 2;
}
pString++;
}
}

View File

@ -0,0 +1,550 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Font 10x14 table definition.
*
*/
#include "board.h"
/**
* \var const uint8_t pCharset10x14;
* \brief Char set of font 10x14
*/
const uint8_t pCharset10x14[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xCC,
0xFF, 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0x00, 0x00,
0x00, 0x00, 0xF0, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0C, 0xC0, 0x0C, 0xC0, 0xFF, 0xFC, 0xFF, 0xFC, 0x0C, 0xC0,
0x0C, 0xC0, 0xFF, 0xFC, 0xFF, 0xFC, 0x0C, 0xC0, 0x0C, 0xC0,
0x0C, 0x60, 0x1E, 0x70, 0x3F, 0x30, 0x33, 0x30, 0xFF, 0xFC,
0xFF, 0xFC, 0x33, 0x30, 0x33, 0xF0, 0x39, 0xE0, 0x18, 0xC0,
0x60, 0x00, 0xF0, 0x0C, 0xF0, 0x3C, 0x60, 0xF0, 0x03, 0xC0,
0x0F, 0x00, 0x3C, 0x18, 0xF0, 0x3C, 0xC0, 0x3C, 0x00, 0x18,
0x3C, 0xF0, 0x7F, 0xF8, 0xC3, 0x1C, 0xC7, 0x8C, 0xCF, 0xCC,
0xDC, 0xEC, 0x78, 0x78, 0x30, 0x30, 0x00, 0xFC, 0x00, 0xCC,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0xEC, 0x00,
0xF8, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0F, 0xC0, 0x3F, 0xF0, 0x78, 0x78,
0x60, 0x18, 0xC0, 0x0C, 0xC0, 0x0C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xC0, 0x0C, 0xC0, 0x0C, 0x60, 0x18,
0x78, 0x78, 0x3F, 0xF0, 0x0F, 0xC0, 0x00, 0x00, 0x00, 0x00,
0x0C, 0x60, 0x0E, 0xE0, 0x07, 0xC0, 0x03, 0x80, 0x3F, 0xF8,
0x3F, 0xF8, 0x03, 0x80, 0x07, 0xC0, 0x0E, 0xE0, 0x0C, 0x60,
0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x3F, 0xF0,
0x3F, 0xF0, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00,
0x00, 0x44, 0x00, 0xEC, 0x00, 0xF8, 0x00, 0x70, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00,
0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00,
0x00, 0x18, 0x00, 0x3C, 0x00, 0x3C, 0x00, 0x18, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0C, 0x00, 0x3C, 0x00, 0xF0, 0x03, 0xC0,
0x0F, 0x00, 0x3C, 0x00, 0xF0, 0x00, 0xC0, 0x00, 0x00, 0x00,
0x3F, 0xF0, 0x7F, 0xF8, 0xE0, 0xFC, 0xC1, 0xCC, 0xC3, 0x8C,
0xC7, 0x0C, 0xCE, 0x0C, 0xFC, 0x1C, 0x7F, 0xF8, 0x3F, 0xF0,
0x00, 0x00, 0x00, 0x00, 0x30, 0x0C, 0x70, 0x0C, 0xFF, 0xFC,
0xFF, 0xFC, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00,
0x30, 0x0C, 0x70, 0x1C, 0xE0, 0x3C, 0xC0, 0x7C, 0xC0, 0xEC,
0xC1, 0xCC, 0xC3, 0x8C, 0xE7, 0x0C, 0x7E, 0x0C, 0x3C, 0x0C,
0x30, 0x30, 0x70, 0x38, 0xE0, 0x1C, 0xC0, 0x0C, 0xC0, 0x0C,
0xC3, 0x0C, 0xC3, 0x0C, 0xE3, 0x1C, 0x7F, 0xF8, 0x3C, 0xF0,
0x03, 0xC0, 0x07, 0xC0, 0x0E, 0xC0, 0x1C, 0xC0, 0x38, 0xC0,
0x70, 0xC0, 0xFF, 0xFC, 0xFF, 0xFC, 0x00, 0xC0, 0x00, 0xC0,
0xFC, 0x30, 0xFC, 0x38, 0xCC, 0x1C, 0xCC, 0x0C, 0xCC, 0x0C,
0xCC, 0x0C, 0xCC, 0x0C, 0xCE, 0x1C, 0xC7, 0xF8, 0xC3, 0xF0,
0x3F, 0xF0, 0x7F, 0xF8, 0xE3, 0x1C, 0xC3, 0x0C, 0xC3, 0x0C,
0xC3, 0x0C, 0xC3, 0x0C, 0xE3, 0x9C, 0x71, 0xF8, 0x30, 0xF0,
0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC3, 0xFC,
0xC7, 0xFC, 0xCE, 0x00, 0xDC, 0x00, 0xF8, 0x00, 0xF0, 0x00,
0x3C, 0xF0, 0x7F, 0xF8, 0xE7, 0x9C, 0xC3, 0x0C, 0xC3, 0x0C,
0xC3, 0x0C, 0xC3, 0x0C, 0xE7, 0x9C, 0x7F, 0xF8, 0x3C, 0xF0,
0x3C, 0x00, 0x7E, 0x00, 0xE7, 0x0C, 0xC3, 0x0C, 0xC3, 0x1C,
0xC3, 0x38, 0xC3, 0x70, 0xE7, 0xE0, 0x7F, 0xC0, 0x3F, 0x80,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x60, 0x3C, 0xF0,
0x3C, 0xF0, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x44, 0x3C, 0xEC,
0x3C, 0xF8, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x03, 0x00, 0x07, 0x80, 0x0F, 0xC0, 0x1C, 0xE0,
0x38, 0x70, 0x70, 0x38, 0xE0, 0x1C, 0xC0, 0x0C, 0x00, 0x00,
0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0,
0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0,
0x00, 0x00, 0xC0, 0x0C, 0xE0, 0x1C, 0x70, 0x38, 0x38, 0x70,
0x1C, 0xE0, 0x0F, 0xC0, 0x07, 0x80, 0x03, 0x00, 0x00, 0x00,
0x30, 0x00, 0x70, 0x00, 0xE0, 0x00, 0xC0, 0x00, 0xC1, 0xEC,
0xC3, 0xEC, 0xC3, 0x00, 0xE6, 0x00, 0x7E, 0x00, 0x3C, 0x00,
0x30, 0xF0, 0x71, 0xF8, 0xE3, 0x9C, 0xC3, 0x0C, 0xC3, 0xFC,
0xC3, 0xFC, 0xC0, 0x0C, 0xE0, 0x1C, 0x7F, 0xF8, 0x3F, 0xF0,
0x3F, 0xFC, 0x7F, 0xFC, 0xE0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xC0, 0x7F, 0xFC, 0x3F, 0xFC,
0xFF, 0xFC, 0xFF, 0xFC, 0xC3, 0x0C, 0xC3, 0x0C, 0xC3, 0x0C,
0xC3, 0x0C, 0xC3, 0x0C, 0xE7, 0x9C, 0x7F, 0xF8, 0x3C, 0xF0,
0x3F, 0xF0, 0x7F, 0xF8, 0xE0, 0x1C, 0xC0, 0x0C, 0xC0, 0x0C,
0xC0, 0x0C, 0xC0, 0x0C, 0xE0, 0x1C, 0x70, 0x38, 0x30, 0x30,
0xFF, 0xFC, 0xFF, 0xFC, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C,
0xC0, 0x0C, 0xC0, 0x0C, 0xE0, 0x1C, 0x7F, 0xF8, 0x3F, 0xF0,
0xFF, 0xFC, 0xFF, 0xFC, 0xC3, 0x0C, 0xC3, 0x0C, 0xC3, 0x0C,
0xC3, 0x0C, 0xC3, 0x0C, 0xC3, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C,
0xFF, 0xFC, 0xFF, 0xFC, 0xC3, 0x00, 0xC3, 0x00, 0xC3, 0x00,
0xC3, 0x00, 0xC3, 0x00, 0xC3, 0x00, 0xC0, 0x00, 0xC0, 0x00,
0x3F, 0xF0, 0x7F, 0xF8, 0xE0, 0x1C, 0xC0, 0x0C, 0xC0, 0x0C,
0xC3, 0x0C, 0xC3, 0x0C, 0xE3, 0x1C, 0x73, 0xF8, 0x33, 0xF0,
0xFF, 0xFC, 0xFF, 0xFC, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00,
0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0xFF, 0xFC, 0xFF, 0xFC,
0x00, 0x00, 0x00, 0x00, 0xC0, 0x0C, 0xC0, 0x0C, 0xFF, 0xFC,
0xFF, 0xFC, 0xC0, 0x0C, 0xC0, 0x0C, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x00, 0x38, 0xC0, 0x1C, 0xC0, 0x0C, 0xC0, 0x0C,
0xC0, 0x1C, 0xFF, 0xF8, 0xFF, 0xF0, 0xC0, 0x00, 0xC0, 0x00,
0xFF, 0xFC, 0xFF, 0xFC, 0x07, 0x80, 0x07, 0x80, 0x0F, 0xC0,
0x1C, 0xE0, 0x38, 0x70, 0x70, 0x38, 0xE0, 0x1C, 0xC0, 0x0C,
0xFF, 0xFC, 0xFF, 0xFC, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C,
0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C,
0xFF, 0xFC, 0xFF, 0xFC, 0x70, 0x00, 0x38, 0x00, 0x1F, 0x00,
0x1F, 0x00, 0x38, 0x00, 0x70, 0x00, 0xFF, 0xFC, 0xFF, 0xFC,
0xFF, 0xFC, 0xFF, 0xFC, 0x1C, 0x00, 0x0E, 0x00, 0x07, 0x00,
0x03, 0x80, 0x01, 0xC0, 0x00, 0xE0, 0xFF, 0xFC, 0xFF, 0xFC,
0x3F, 0xF0, 0x7F, 0xF8, 0xE0, 0x1C, 0xC0, 0x0C, 0xC0, 0x0C,
0xC0, 0x0C, 0xC0, 0x0C, 0xE0, 0x1C, 0x7F, 0xF8, 0x3F, 0xF0,
0xFF, 0xFC, 0xFF, 0xFC, 0xC3, 0x00, 0xC3, 0x00, 0xC3, 0x00,
0xC3, 0x00, 0xC3, 0x00, 0xE7, 0x00, 0x7E, 0x00, 0x3C, 0x00,
0x3F, 0xF0, 0x7F, 0xF8, 0xE0, 0x1C, 0xC0, 0x0C, 0xC0, 0xCC,
0xC0, 0xEC, 0xC0, 0x7C, 0xE0, 0x38, 0x7F, 0xFC, 0x3F, 0xEC,
0xFF, 0xFC, 0xFF, 0xFC, 0xC3, 0x00, 0xC3, 0x80, 0xC3, 0x80,
0xC3, 0xC0, 0xC3, 0xC0, 0xE7, 0x70, 0x7E, 0x3C, 0x3C, 0x1C,
0x3C, 0x18, 0x7E, 0x1C, 0xE7, 0x0C, 0xC3, 0x0C, 0xC3, 0x0C,
0xC3, 0x0C, 0xC3, 0x0C, 0xC3, 0x9C, 0xE1, 0xF8, 0x60, 0xF0,
0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xFF, 0xFC,
0xFF, 0xFC, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00,
0xFF, 0xF0, 0xFF, 0xF8, 0x00, 0x1C, 0x00, 0x0C, 0x00, 0x0C,
0x00, 0x0C, 0x00, 0x0C, 0x00, 0x1C, 0xFF, 0xF8, 0xFF, 0xF0,
0xFF, 0xC0, 0xFF, 0xE0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1C,
0x00, 0x1C, 0x00, 0x38, 0x00, 0x70, 0xFF, 0xE0, 0xFF, 0xC0,
0xFF, 0xF0, 0xFF, 0xF8, 0x00, 0x1C, 0x00, 0x3C, 0x00, 0xF8,
0x00, 0xF8, 0x00, 0x3C, 0x00, 0x1C, 0xFF, 0xF8, 0xFF, 0xF0,
0xF0, 0x3C, 0xF8, 0x7C, 0x1C, 0xE0, 0x0F, 0xC0, 0x07, 0x80,
0x07, 0x80, 0x0F, 0xC0, 0x1C, 0xE0, 0xF8, 0x7C, 0xF0, 0x3C,
0xFC, 0x00, 0xFE, 0x00, 0x07, 0x00, 0x03, 0x80, 0x01, 0xFC,
0x01, 0xFC, 0x03, 0x80, 0x07, 0x00, 0xFE, 0x00, 0xFC, 0x00,
0xC0, 0x3C, 0xC0, 0x7C, 0xC0, 0xEC, 0xC1, 0xCC, 0xC3, 0x8C,
0xC7, 0x0C, 0xCE, 0x0C, 0xDC, 0x0C, 0xF8, 0x0C, 0xF0, 0x0C,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFC, 0xC0, 0x0C,
0xC0, 0x0C, 0xC0, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x30, 0x00, 0x30, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x03, 0x00,
0x03, 0x00, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0x30, 0x00, 0x30,
0x00, 0x00, 0x00, 0x00, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C,
0xFF, 0xFC, 0xFF, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0C, 0x00, 0x1C, 0x00, 0x38, 0x00, 0x70, 0x00, 0xE0, 0x00,
0xE0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1C, 0x00, 0x0C, 0x00,
0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C,
0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x0C,
0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0xE0, 0x00, 0x70, 0x00,
0x38, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x30, 0x06, 0x78, 0x0E, 0xFC, 0x0C, 0xCC, 0x0C, 0xCC,
0x0C, 0xCC, 0x0C, 0xCC, 0x0E, 0xCC, 0x07, 0xFC, 0x03, 0xF8,
0xFF, 0xFC, 0xFF, 0xFC, 0x03, 0x0C, 0x03, 0x0C, 0x03, 0x0C,
0x03, 0x0C, 0x03, 0x0C, 0x03, 0x9C, 0x01, 0xF8, 0x00, 0xF0,
0x03, 0xF0, 0x07, 0xF8, 0x0E, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C,
0x0C, 0x0C, 0x0C, 0x0C, 0x0E, 0x1C, 0x07, 0x38, 0x03, 0x30,
0x00, 0xF0, 0x01, 0xF8, 0x03, 0x9C, 0x03, 0x0C, 0x03, 0x0C,
0x03, 0x0C, 0x03, 0x0C, 0x03, 0x0C, 0xFF, 0xFC, 0xFF, 0xFC,
0x03, 0xF0, 0x07, 0xF8, 0x0E, 0xDC, 0x0C, 0xCC, 0x0C, 0xCC,
0x0C, 0xCC, 0x0C, 0xCC, 0x0E, 0xDC, 0x07, 0xD8, 0x03, 0x90,
0x00, 0x00, 0x03, 0x00, 0x3F, 0xFC, 0x7F, 0xFC, 0xE3, 0x00,
0xE3, 0x00, 0x70, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x18, 0x07, 0x9C, 0x0F, 0xCC, 0x0C, 0xCC, 0x0C, 0xCC,
0x0C, 0xCC, 0x0C, 0xCC, 0x0C, 0xDC, 0x0F, 0xF8, 0x07, 0xF0,
0xFF, 0xFC, 0xFF, 0xFC, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00,
0x03, 0x00, 0x03, 0x80, 0x01, 0xFC, 0x00, 0xFC, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0xFC,
0x1B, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x30, 0x00, 0x38, 0x00, 0x1C, 0x00, 0x0C,
0x00, 0x0C, 0x00, 0x1C, 0xCF, 0xF8, 0xCF, 0xF0, 0x00, 0x00,
0x00, 0x00, 0xFF, 0xFC, 0xFF, 0xFC, 0x00, 0xE0, 0x01, 0xE0,
0x03, 0xF0, 0x07, 0x38, 0x0E, 0x1C, 0x0C, 0x0C, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xC0, 0x0C, 0xC0, 0x0C, 0xFF, 0xFC,
0xFF, 0xFC, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00,
0x0F, 0xFC, 0x0F, 0xFC, 0x0E, 0x00, 0x07, 0x00, 0x03, 0xC0,
0x03, 0xC0, 0x07, 0x00, 0x0E, 0x00, 0x0F, 0xFC, 0x0F, 0xFC,
0x0F, 0xFC, 0x0F, 0xFC, 0x03, 0x00, 0x07, 0x00, 0x0E, 0x00,
0x0C, 0x00, 0x0C, 0x00, 0x0E, 0x00, 0x07, 0xFC, 0x03, 0xFC,
0x03, 0xF0, 0x07, 0xF8, 0x0E, 0x1C, 0x0C, 0x0C, 0x0C, 0x0C,
0x0C, 0x0C, 0x0C, 0x0C, 0x0E, 0x1C, 0x07, 0xF8, 0x03, 0xF0,
0x0F, 0xFC, 0x0F, 0xFC, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0,
0x0C, 0xC0, 0x0C, 0xC0, 0x0F, 0xC0, 0x07, 0x80, 0x03, 0x00,
0x03, 0x00, 0x07, 0x80, 0x0F, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0,
0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0, 0x0F, 0xFC, 0x0F, 0xFC,
0x0F, 0xFC, 0x0F, 0xFC, 0x03, 0x80, 0x07, 0x00, 0x0E, 0x00,
0x0C, 0x00, 0x0C, 0x00, 0x0E, 0x00, 0x07, 0x00, 0x03, 0x00,
0x03, 0x18, 0x07, 0x9C, 0x0F, 0xCC, 0x0C, 0xCC, 0x0C, 0xCC,
0x0C, 0xCC, 0x0C, 0xCC, 0x0C, 0xFC, 0x0E, 0x78, 0x06, 0x30,
0x00, 0x00, 0x0C, 0x00, 0x0C, 0x00, 0xFF, 0xF0, 0xFF, 0xF8,
0x0C, 0x1C, 0x0C, 0x1C, 0x0C, 0x38, 0x0C, 0x30, 0x00, 0x00,
0x0F, 0xF0, 0x0F, 0xF8, 0x00, 0x1C, 0x00, 0x0C, 0x00, 0x0C,
0x00, 0x0C, 0x00, 0x0C, 0x00, 0x1C, 0x0F, 0xF8, 0x0F, 0xF0,
0x0F, 0xC0, 0x0F, 0xE0, 0x00, 0x70, 0x00, 0x38, 0x00, 0x1C,
0x00, 0x1C, 0x00, 0x38, 0x00, 0x70, 0x0F, 0xE0, 0x0F, 0xC0,
0x0F, 0xF0, 0x0F, 0xF8, 0x00, 0x1C, 0x00, 0x1C, 0x00, 0xF8,
0x00, 0xF8, 0x00, 0x1C, 0x00, 0x1C, 0x0F, 0xF8, 0x0F, 0xF0,
0x0C, 0x0C, 0x0E, 0x1C, 0x07, 0x38, 0x03, 0xF0, 0x01, 0xE0,
0x01, 0xE0, 0x03, 0xF0, 0x07, 0x38, 0x0E, 0x1C, 0x0C, 0x0C,
0x0C, 0x00, 0x0E, 0x00, 0x07, 0x0C, 0x03, 0x9C, 0x01, 0xF8,
0x01, 0xF0, 0x03, 0x80, 0x07, 0x00, 0x0E, 0x00, 0x0C, 0x00,
0x0C, 0x0C, 0x0C, 0x1C, 0x0C, 0x3C, 0x0C, 0x7C, 0x0C, 0xEC,
0x0D, 0xCC, 0x0F, 0x8C, 0x0F, 0x0C, 0x0E, 0x0C, 0x0C, 0x0C,
0x00, 0x00, 0x03, 0x00, 0x07, 0x80, 0x3F, 0xF0, 0x7C, 0xF8,
0xE0, 0x1C, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0x00, 0x00,
0x03, 0x0C, 0x03, 0x0C, 0x3F, 0xFC, 0x7F, 0xFC, 0xE3, 0x0C,
0xC3, 0x0C, 0xC0, 0x0C, 0xE0, 0x0C, 0x70, 0x0C, 0x30, 0x0C,
0x00, 0x00, 0xC0, 0x0C, 0xC0, 0x0C, 0xC0, 0x0C, 0xE0, 0x1C,
0x7C, 0xF8, 0x3F, 0xF0, 0x07, 0x80, 0x03, 0x00, 0x00, 0x00,
0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00,
0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00, 0xC0, 0x00,
0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC,
0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC, 0xFF, 0xFC
} ;
/**
* \var const uint8_t FONT6x8;
* \brief Char set of font 6x8
*/
const uint8_t FONT6x8[97][8] = {
{0x06,0x08,0x08,0x00,0x00,0x00,0x00,0x00}, // columns, rows, num_bytes_per_char
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // space 0x20
{0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00}, // !
{0x50,0x50,0x50,0x00,0x00,0x00,0x00,0x00}, // "
{0x50,0x50,0xF8,0x50,0xF8,0x50,0x50,0x00}, // #
{0x20,0x78,0xA0,0x70,0x28,0xF0,0x20,0x00}, // $
{0xC0,0xC8,0x10,0x20,0x40,0x98,0x18,0x00}, // %
{0x40,0xA0,0xA0,0x40,0xA8,0x90,0x68,0x00}, // &
{0x30,0x30,0x20,0x40,0x00,0x00,0x00,0x00}, // '
{0x10,0x20,0x40,0x40,0x40,0x20,0x10,0x00}, // (
{0x40,0x20,0x10,0x10,0x10,0x20,0x40,0x00}, // )
{0x00,0x20,0xA8,0x70,0x70,0xA8,0x20,0x00}, // *
{0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00}, // +
{0x00,0x00,0x00,0x00,0x30,0x30,0x20,0x40}, // ,
{0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00}, // -
{0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00}, // .
{0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00}, // / (forward slash)
{0x70,0x88,0x88,0xA8,0x88,0x88,0x70,0x00}, // 0 0x30
{0x20,0x60,0x20,0x20,0x20,0x20,0x70,0x00}, // 1
{0x70,0x88,0x08,0x70,0x80,0x80,0xF8,0x00}, // 2
{0xF8,0x08,0x10,0x30,0x08,0x88,0x70,0x00}, // 3
{0x10,0x30,0x50,0x90,0xF8,0x10,0x10,0x00}, // 4
{0xF8,0x80,0xF0,0x08,0x08,0x88,0x70,0x00}, // 5
{0x38,0x40,0x80,0xF0,0x88,0x88,0x70,0x00}, // 6
{0xF8,0x08,0x08,0x10,0x20,0x40,0x80,0x00}, // 7
{0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00}, // 8
{0x70,0x88,0x88,0x78,0x08,0x10,0xE0,0x00}, // 9
{0x00,0x00,0x20,0x00,0x20,0x00,0x00,0x00}, // :
{0x00,0x00,0x20,0x00,0x20,0x20,0x40,0x00}, // ;
{0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x00}, // <
{0x00,0x00,0xF8,0x00,0xF8,0x00,0x00,0x00}, // =
{0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00}, // >
{0x70,0x88,0x08,0x30,0x20,0x00,0x20,0x00}, // ?
{0x70,0x88,0xA8,0xB8,0xB0,0x80,0x78,0x00}, // @ 0x40
{0x20,0x50,0x88,0x88,0xF8,0x88,0x88,0x00}, // A
{0xF0,0x88,0x88,0xF0,0x88,0x88,0xF0,0x00}, // B
{0x70,0x88,0x80,0x80,0x80,0x88,0x70,0x00}, // C
{0xF0,0x88,0x88,0x88,0x88,0x88,0xF0,0x00}, // D
{0xF8,0x80,0x80,0xF0,0x80,0x80,0xF8,0x00}, // E
{0xF8,0x80,0x80,0xF0,0x80,0x80,0x80,0x00}, // F
{0x78,0x88,0x80,0x80,0x98,0x88,0x78,0x00}, // G
{0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x00}, // H
{0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00}, // I
{0x38,0x10,0x10,0x10,0x10,0x90,0x60,0x00}, // J
{0x88,0x90,0xA0,0xC0,0xA0,0x90,0x88,0x00}, // K
{0x80,0x80,0x80,0x80,0x80,0x80,0xF8,0x00}, // L
{0x88,0xD8,0xA8,0xA8,0xA8,0x88,0x88,0x00}, // M
{0x88,0x88,0xC8,0xA8,0x98,0x88,0x88,0x00}, // N
{0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00}, // O
{0xF0,0x88,0x88,0xF0,0x80,0x80,0x80,0x00}, // P 0x50
{0x70,0x88,0x88,0x88,0xA8,0x90,0x68,0x00}, // Q
{0xF0,0x88,0x88,0xF0,0xA0,0x90,0x88,0x00}, // R
{0x70,0x88,0x80,0x70,0x08,0x88,0x70,0x00}, // S
{0xF8,0xA8,0x20,0x20,0x20,0x20,0x20,0x00}, // T
{0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00}, // U
{0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00}, // V
{0x88,0x88,0x88,0xA8,0xA8,0xA8,0x50,0x00}, // W
{0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00}, // X
{0x88,0x88,0x50,0x20,0x20,0x20,0x20,0x00}, // Y
{0xF8,0x08,0x10,0x70,0x40,0x80,0xF8,0x00}, // Z
{0x78,0x40,0x40,0x40,0x40,0x40,0x78,0x00}, // [
{0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00}, // \ (back slash)
{0x78,0x08,0x08,0x08,0x08,0x08,0x78,0x00}, // ]
{0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00}, // ^
{0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00}, // _
{0x60,0x60,0x20,0x10,0x00,0x00,0x00,0x00}, // ` 0x60
{0x00,0x00,0x60,0x10,0x70,0x90,0x78,0x00}, // a
{0x80,0x80,0xB0,0xC8,0x88,0xC8,0xB0,0x00}, // b
{0x00,0x00,0x70,0x88,0x80,0x88,0x70,0x00}, // c
{0x08,0x08,0x68,0x98,0x88,0x98,0x68,0x00}, // d
{0x00,0x00,0x70,0x88,0xF8,0x80,0x70,0x00}, // e
{0x10,0x28,0x20,0x70,0x20,0x20,0x20,0x00}, // f
{0x00,0x00,0x70,0x98,0x98,0x68,0x08,0x70}, // g
{0x80,0x80,0xB0,0xC8,0x88,0x88,0x88,0x00}, // h
{0x20,0x00,0x60,0x20,0x20,0x20,0x70,0x00}, // i
{0x10,0x00,0x10,0x10,0x10,0x90,0x60,0x00}, // j
{0x80,0x80,0x90,0xA0,0xC0,0xA0,0x90,0x00}, // k
{0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00}, // l
{0x00,0x00,0xD0,0xA8,0xA8,0xA8,0xA8,0x00}, // m
{0x00,0x00,0xB0,0xC8,0x88,0x88,0x88,0x00}, // n
{0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00}, // o
{0x00,0x00,0xB0,0xC8,0xC8,0xB0,0x80,0x80}, // p 0x70
{0x00,0x00,0x68,0x98,0x98,0x68,0x08,0x08}, // q
{0x00,0x00,0xB0,0xC8,0x80,0x80,0x80,0x00}, // r
{0x00,0x00,0x78,0x80,0x70,0x08,0xF0,0x00}, // s
{0x20,0x20,0xF8,0x20,0x20,0x28,0x10,0x00}, // t
{0x00,0x00,0x88,0x88,0x88,0x98,0x68,0x00}, // u
{0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00}, // v
{0x00,0x00,0x88,0x88,0xA8,0xA8,0x50,0x00}, // w
{0x00,0x00,0x88,0x50,0x20,0x50,0x88,0x00}, // x
{0x00,0x00,0x88,0x88,0x78,0x08,0x88,0x70}, // y
{0x00,0x00,0xF8,0x10,0x20,0x40,0xF8,0x00}, // z
{0x10,0x20,0x20,0x40,0x20,0x20,0x10,0x00}, // {
{0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00}, // |
{0x40,0x20,0x20,0x10,0x20,0x20,0x40,0x00}, // }
{0x40,0xA8,0x10,0x00,0x00,0x00,0x00,0x00}, // ~
{0x70,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00} // DEL
};
/**
* \var const uint8_t FONT8x8;
* \brief Char set of font 8x8
*/
const uint8_t FONT8x8[97][8] = {
{0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00}, // columns, rows, num_bytes_per_char
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // space 0x20
{0x30,0x78,0x78,0x30,0x30,0x00,0x30,0x00}, // !
{0x6C,0x6C,0x6C,0x00,0x00,0x00,0x00,0x00}, // "
{0x6C,0x6C,0xFE,0x6C,0xFE,0x6C,0x6C,0x00}, // #
{0x18,0x3E,0x60,0x3C,0x06,0x7C,0x18,0x00}, // $
{0x00,0x63,0x66,0x0C,0x18,0x33,0x63,0x00}, // %
{0x1C,0x36,0x1C,0x3B,0x6E,0x66,0x3B,0x00}, // &
{0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00}, // '
{0x0C,0x18,0x30,0x30,0x30,0x18,0x0C,0x00}, // (
{0x30,0x18,0x0C,0x0C,0x0C,0x18,0x30,0x00}, // )
{0x00,0x66,0x3C,0xFF,0x3C,0x66,0x00,0x00}, // *
{0x00,0x30,0x30,0xFC,0x30,0x30,0x00,0x00}, // +
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x30}, // ,
{0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00}, // -
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00}, // .
{0x03,0x06,0x0C,0x18,0x30,0x60,0x40,0x00}, // / (forward slash)
{0x3E,0x63,0x63,0x6B,0x63,0x63,0x3E,0x00}, // 0 0x30
{0x18,0x38,0x58,0x18,0x18,0x18,0x7E,0x00}, // 1
{0x3C,0x66,0x06,0x1C,0x30,0x66,0x7E,0x00}, // 2
{0x3C,0x66,0x06,0x1C,0x06,0x66,0x3C,0x00}, // 3
{0x0E,0x1E,0x36,0x66,0x7F,0x06,0x0F,0x00}, // 4
{0x7E,0x60,0x7C,0x06,0x06,0x66,0x3C,0x00}, // 5
{0x1C,0x30,0x60,0x7C,0x66,0x66,0x3C,0x00}, // 6
{0x7E,0x66,0x06,0x0C,0x18,0x18,0x18,0x00}, // 7
{0x3C,0x66,0x66,0x3C,0x66,0x66,0x3C,0x00}, // 8
{0x3C,0x66,0x66,0x3E,0x06,0x0C,0x38,0x00}, // 9
{0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x00}, // :
{0x00,0x18,0x18,0x00,0x00,0x18,0x18,0x30}, // ;
{0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x00}, // <
{0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00}, // =
{0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x00}, // >
{0x3C,0x66,0x06,0x0C,0x18,0x00,0x18,0x00}, // ?
{0x3E,0x63,0x6F,0x69,0x6F,0x60,0x3E,0x00}, // @ 0x40
{0x18,0x3C,0x66,0x66,0x7E,0x66,0x66,0x00}, // A
{0x7E,0x33,0x33,0x3E,0x33,0x33,0x7E,0x00}, // B
{0x1E,0x33,0x60,0x60,0x60,0x33,0x1E,0x00}, // C
{0x7C,0x36,0x33,0x33,0x33,0x36,0x7C,0x00}, // D
{0x7F,0x31,0x34,0x3C,0x34,0x31,0x7F,0x00}, // E
{0x7F,0x31,0x34,0x3C,0x34,0x30,0x78,0x00}, // F
{0x1E,0x33,0x60,0x60,0x67,0x33,0x1F,0x00}, // G
{0x66,0x66,0x66,0x7E,0x66,0x66,0x66,0x00}, // H
{0x3C,0x18,0x18,0x18,0x18,0x18,0x3C,0x00}, // I
{0x0F,0x06,0x06,0x06,0x66,0x66,0x3C,0x00}, // J
{0x73,0x33,0x36,0x3C,0x36,0x33,0x73,0x00}, // K
{0x78,0x30,0x30,0x30,0x31,0x33,0x7F,0x00}, // L
{0x63,0x77,0x7F,0x7F,0x6B,0x63,0x63,0x00}, // M
{0x63,0x73,0x7B,0x6F,0x67,0x63,0x63,0x00}, // N
{0x3E,0x63,0x63,0x63,0x63,0x63,0x3E,0x00}, // O
{0x7E,0x33,0x33,0x3E,0x30,0x30,0x78,0x00}, // P 0x50
{0x3C,0x66,0x66,0x66,0x6E,0x3C,0x0E,0x00}, // Q
{0x7E,0x33,0x33,0x3E,0x36,0x33,0x73,0x00}, // R
{0x3C,0x66,0x30,0x18,0x0C,0x66,0x3C,0x00}, // S
{0x7E,0x5A,0x18,0x18,0x18,0x18,0x3C,0x00}, // T
{0x66,0x66,0x66,0x66,0x66,0x66,0x7E,0x00}, // U
{0x66,0x66,0x66,0x66,0x66,0x3C,0x18,0x00}, // V
{0x63,0x63,0x63,0x6B,0x7F,0x77,0x63,0x00}, // W
{0x63,0x63,0x36,0x1C,0x1C,0x36,0x63,0x00}, // X
{0x66,0x66,0x66,0x3C,0x18,0x18,0x3C,0x00}, // Y
{0x7F,0x63,0x46,0x0C,0x19,0x33,0x7F,0x00}, // Z
{0x3C,0x30,0x30,0x30,0x30,0x30,0x3C,0x00}, // [
{0x60,0x30,0x18,0x0C,0x06,0x03,0x01,0x00}, // \ (back slash)
{0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00}, // ]
{0x08,0x1C,0x36,0x63,0x00,0x00,0x00,0x00}, // ^
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF}, // _
{0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00}, // ` 0x60
{0x00,0x00,0x3C,0x06,0x3E,0x66,0x3B,0x00}, // a
{0x70,0x30,0x3E,0x33,0x33,0x33,0x6E,0x00}, // b
{0x00,0x00,0x3C,0x66,0x60,0x66,0x3C,0x00}, // c
{0x0E,0x06,0x3E,0x66,0x66,0x66,0x3B,0x00}, // d
{0x00,0x00,0x3C,0x66,0x7E,0x60,0x3C,0x00}, // e
{0x1C,0x36,0x30,0x78,0x30,0x30,0x78,0x00}, // f
{0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x7C}, // g
{0x70,0x30,0x36,0x3B,0x33,0x33,0x73,0x00}, // h
{0x18,0x00,0x38,0x18,0x18,0x18,0x3C,0x00}, // i
{0x06,0x00,0x06,0x06,0x06,0x66,0x66,0x3C}, // j
{0x70,0x30,0x33,0x36,0x3C,0x36,0x73,0x00}, // k
{0x38,0x18,0x18,0x18,0x18,0x18,0x3C,0x00}, // l
{0x00,0x00,0x66,0x7F,0x7F,0x6B,0x63,0x00}, // m
{0x00,0x00,0x7C,0x66,0x66,0x66,0x66,0x00}, // n
{0x00,0x00,0x3C,0x66,0x66,0x66,0x3C,0x00}, // o
{0x00,0x00,0x6E,0x33,0x33,0x3E,0x30,0x78}, // p 0x70
{0x00,0x00,0x3B,0x66,0x66,0x3E,0x06,0x0F}, // q
{0x00,0x00,0x6E,0x3B,0x33,0x30,0x78,0x00}, // r
{0x00,0x00,0x3E,0x60,0x3C,0x06,0x7C,0x00}, // s
{0x08,0x18,0x3E,0x18,0x18,0x1A,0x0C,0x00}, // t
{0x00,0x00,0x66,0x66,0x66,0x66,0x3B,0x00}, // u
{0x00,0x00,0x66,0x66,0x66,0x3C,0x18,0x00}, // v
{0x00,0x00,0x63,0x6B,0x7F,0x7F,0x36,0x00}, // w
{0x00,0x00,0x63,0x36,0x1C,0x36,0x63,0x00}, // x
{0x00,0x00,0x66,0x66,0x66,0x3E,0x06,0x7C}, // y
{0x00,0x00,0x7E,0x4C,0x18,0x32,0x7E,0x00}, // z
{0x0E,0x18,0x18,0x70,0x18,0x18,0x0E,0x00}, // {
{0x0C,0x0C,0x0C,0x00,0x0C,0x0C,0x0C,0x00}, // |
{0x70,0x18,0x18,0x0E,0x18,0x18,0x70,0x00}, // }
{0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00}, // ~
{0x1C,0x36,0x36,0x1C,0x00,0x00,0x00,0x00}// DEL
};
/**
* \var const uint8_t FONT8x16;
* \brief Char set of font 8x16
*/
const uint8_t FONT8x16[97][16] = {
{0x08,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // columns, rows, num_bytes_per_char
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // space 0x20
{0x00,0x00,0x18,0x3C,0x3C,0x3C,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00}, // !
{0x00,0x63,0x63,0x63,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // "
{0x00,0x00,0x00,0x36,0x36,0x7F,0x36,0x36,0x36,0x7F,0x36,0x36,0x00,0x00,0x00,0x00}, // #
{0x0C,0x0C,0x3E,0x63,0x61,0x60,0x3E,0x03,0x03,0x43,0x63,0x3E,0x0C,0x0C,0x00,0x00}, // $
{0x00,0x00,0x00,0x00,0x00,0x61,0x63,0x06,0x0C,0x18,0x33,0x63,0x00,0x00,0x00,0x00}, // %
{0x00,0x00,0x00,0x1C,0x36,0x36,0x1C,0x3B,0x6E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00}, // &
{0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // '
{0x00,0x00,0x0C,0x18,0x18,0x30,0x30,0x30,0x30,0x18,0x18,0x0C,0x00,0x00,0x00,0x00}, // (
{0x00,0x00,0x18,0x0C,0x0C,0x06,0x06,0x06,0x06,0x0C,0x0C,0x18,0x00,0x00,0x00,0x00}, // )
{0x00,0x00,0x00,0x00,0x42,0x66,0x3C,0xFF,0x3C,0x66,0x42,0x00,0x00,0x00,0x00,0x00}, // *
{0x00,0x00,0x00,0x00,0x18,0x18,0x18,0xFF,0x18,0x18,0x18,0x00,0x00,0x00,0x00,0x00}, // +
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00}, // ,
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // -
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00}, // .
{0x00,0x00,0x01,0x03,0x07,0x0E,0x1C,0x38,0x70,0xE0,0xC0,0x80,0x00,0x00,0x00,0x00}, // / (forward slash)
{0x00,0x00,0x3E,0x63,0x63,0x63,0x6B,0x6B,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, // 0 0x30
{0x00,0x00,0x0C,0x1C,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3F,0x00,0x00,0x00,0x00}, // 1
{0x00,0x00,0x3E,0x63,0x03,0x06,0x0C,0x18,0x30,0x61,0x63,0x7F,0x00,0x00,0x00,0x00}, // 2
{0x00,0x00,0x3E,0x63,0x03,0x03,0x1E,0x03,0x03,0x03,0x63,0x3E,0x00,0x00,0x00,0x00}, // 3
{0x00,0x00,0x06,0x0E,0x1E,0x36,0x66,0x66,0x7F,0x06,0x06,0x0F,0x00,0x00,0x00,0x00}, // 4
{0x00,0x00,0x7F,0x60,0x60,0x60,0x7E,0x03,0x03,0x63,0x73,0x3E,0x00,0x00,0x00,0x00}, // 5
{0x00,0x00,0x1C,0x30,0x60,0x60,0x7E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, // 6
{0x00,0x00,0x7F,0x63,0x03,0x06,0x06,0x0C,0x0C,0x18,0x18,0x18,0x00,0x00,0x00,0x00}, // 7
{0x00,0x00,0x3E,0x63,0x63,0x63,0x3E,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, // 8
{0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x3F,0x03,0x03,0x06,0x3C,0x00,0x00,0x00,0x00}, // 9
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00}, // :
{0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00}, // ;
{0x00,0x00,0x00,0x06,0x0C,0x18,0x30,0x60,0x30,0x18,0x0C,0x06,0x00,0x00,0x00,0x00}, // <
{0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,0x00,0x00}, // =
{0x00,0x00,0x00,0x60,0x30,0x18,0x0C,0x06,0x0C,0x18,0x30,0x60,0x00,0x00,0x00,0x00}, // >
{0x00,0x00,0x3E,0x63,0x63,0x06,0x0C,0x0C,0x0C,0x00,0x0C,0x0C,0x00,0x00,0x00,0x00}, // ?
{0x00,0x00,0x3E,0x63,0x63,0x6F,0x6B,0x6B,0x6E,0x60,0x60,0x3E,0x00,0x00,0x00,0x00}, // @ 0x40
{0x00,0x00,0x08,0x1C,0x36,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, // A
{0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x33,0x33,0x33,0x33,0x7E,0x00,0x00,0x00,0x00}, // B
{0x00,0x00,0x1E,0x33,0x61,0x60,0x60,0x60,0x60,0x61,0x33,0x1E,0x00,0x00,0x00,0x00}, // C
{0x00,0x00,0x7C,0x36,0x33,0x33,0x33,0x33,0x33,0x33,0x36,0x7C,0x00,0x00,0x00,0x00}, // D
{0x00,0x00,0x7F,0x33,0x31,0x34,0x3C,0x34,0x30,0x31,0x33,0x7F,0x00,0x00,0x00,0x00}, // E
{0x00,0x00,0x7F,0x33,0x31,0x34,0x3C,0x34,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}, // F
{0x00,0x00,0x1E,0x33,0x61,0x60,0x60,0x6F,0x63,0x63,0x37,0x1D,0x00,0x00,0x00,0x00}, // G
{0x00,0x00,0x63,0x63,0x63,0x63,0x7F,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, // H
{0x00,0x00,0x3C,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}, // I
{0x00,0x00,0x0F,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00,0x00,0x00}, // J
{0x00,0x00,0x73,0x33,0x36,0x36,0x3C,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00}, // K
{0x00,0x00,0x78,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x33,0x7F,0x00,0x00,0x00,0x00}, // L
{0x00,0x00,0x63,0x77,0x7F,0x6B,0x63,0x63,0x63,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, // M
{0x00,0x00,0x63,0x63,0x73,0x7B,0x7F,0x6F,0x67,0x63,0x63,0x63,0x00,0x00,0x00,0x00}, // N
{0x00,0x00,0x1C,0x36,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1C,0x00,0x00,0x00,0x00}, // O
{0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}, // P 0x50
{0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x63,0x6B,0x6F,0x3E,0x06,0x07,0x00,0x00}, // Q
{0x00,0x00,0x7E,0x33,0x33,0x33,0x3E,0x36,0x36,0x33,0x33,0x73,0x00,0x00,0x00,0x00}, // R
{0x00,0x00,0x3E,0x63,0x63,0x30,0x1C,0x06,0x03,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, // S
{0x00,0x00,0xFF,0xDB,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}, // T
{0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, // U
{0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63,0x63,0x36,0x1C,0x08,0x00,0x00,0x00,0x00}, // V
{0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x6B,0x6B,0x7F,0x36,0x36,0x00,0x00,0x00,0x00}, // W
{0x00,0x00,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x3C,0x66,0xC3,0xC3,0x00,0x00,0x00,0x00}, // X
{0x00,0x00,0xC3,0xC3,0xC3,0x66,0x3C,0x18,0x18,0x18,0x18,0x3C,0x00,0x00,0x00,0x00}, // Y
{0x00,0x00,0x7F,0x63,0x43,0x06,0x0C,0x18,0x30,0x61,0x63,0x7F,0x00,0x00,0x00,0x00}, // Z
{0x00,0x00,0x3C,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3C,0x00,0x00,0x00,0x00}, // [
{0x00,0x00,0x80,0xC0,0xE0,0x70,0x38,0x1C,0x0E,0x07,0x03,0x01,0x00,0x00,0x00,0x00}, // \ (back slash)
{0x00,0x00,0x3C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x3C,0x00,0x00,0x00,0x00}, // ]
{0x08,0x1C,0x36,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // ^
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00}, // _
{0x18,0x18,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // ` 0x60
{0x00,0x00,0x00,0x00,0x00,0x3C,0x46,0x06,0x3E,0x66,0x66,0x3B,0x00,0x00,0x00,0x00}, // a
{0x00,0x00,0x70,0x30,0x30,0x3C,0x36,0x33,0x33,0x33,0x33,0x6E,0x00,0x00,0x00,0x00}, // b
{0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x60,0x60,0x60,0x63,0x3E,0x00,0x00,0x00,0x00}, // c
{0x00,0x00,0x0E,0x06,0x06,0x1E,0x36,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00}, // d
{0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x7E,0x60,0x63,0x3E,0x00,0x00,0x00,0x00}, // e
{0x00,0x00,0x1C,0x36,0x32,0x30,0x7C,0x30,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}, // f
{0x00,0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x66,0x3E,0x06,0x66,0x3C,0x00,0x00}, // g
{0x00,0x00,0x70,0x30,0x30,0x36,0x3B,0x33,0x33,0x33,0x33,0x73,0x00,0x00,0x00,0x00}, // h
{0x00,0x00,0x0C,0x0C,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00}, // i
{0x00,0x00,0x06,0x06,0x00,0x0E,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3C,0x00,0x00}, // j
{0x00,0x00,0x70,0x30,0x30,0x33,0x33,0x36,0x3C,0x36,0x33,0x73,0x00,0x00,0x00,0x00}, // k
{0x00,0x00,0x1C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x0C,0x1E,0x00,0x00,0x00,0x00}, // l
{0x00,0x00,0x00,0x00,0x00,0x6E,0x7F,0x6B,0x6B,0x6B,0x6B,0x6B,0x00,0x00,0x00,0x00}, // m
{0x00,0x00,0x00,0x00,0x00,0x6E,0x33,0x33,0x33,0x33,0x33,0x33,0x00,0x00,0x00,0x00}, // n
{0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x63,0x63,0x63,0x63,0x3E,0x00,0x00,0x00,0x00}, // o
{0x00,0x00,0x00,0x00,0x00,0x6E,0x33,0x33,0x33,0x33,0x3E,0x30,0x30,0x78,0x00,0x00}, // p 0x70
{0x00,0x00,0x00,0x00,0x00,0x3B,0x66,0x66,0x66,0x66,0x3E,0x06,0x06,0x0F,0x00,0x00}, // q
{0x00,0x00,0x00,0x00,0x00,0x6E,0x3B,0x33,0x30,0x30,0x30,0x78,0x00,0x00,0x00,0x00}, // r
{0x00,0x00,0x00,0x00,0x00,0x3E,0x63,0x38,0x0E,0x03,0x63,0x3E,0x00,0x00,0x00,0x00}, // s
{0x00,0x00,0x08,0x18,0x18,0x7E,0x18,0x18,0x18,0x18,0x1B,0x0E,0x00,0x00,0x00,0x00}, // t
{0x00,0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x3B,0x00,0x00,0x00,0x00}, // u
{0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x36,0x36,0x1C,0x1C,0x08,0x00,0x00,0x00,0x00}, // v
{0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x6B,0x6B,0x7F,0x36,0x00,0x00,0x00,0x00}, // w
{0x00,0x00,0x00,0x00,0x00,0x63,0x36,0x1C,0x1C,0x1C,0x36,0x63,0x00,0x00,0x00,0x00}, // x
{0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x3F,0x03,0x06,0x3C,0x00,0x00}, // y
{0x00,0x00,0x00,0x00,0x00,0x7F,0x66,0x0C,0x18,0x30,0x63,0x7F,0x00,0x00,0x00,0x00}, // z
{0x00,0x00,0x0E,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0E,0x00,0x00,0x00,0x00}, // {
{0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00}, // |
{0x00,0x00,0x70,0x18,0x18,0x18,0x0E,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00}, // }
{0x00,0x00,0x3B,0x6E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // ~
{0x00,0x70,0xD8,0xD8,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
}; // DEL

View File

@ -0,0 +1,116 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation of LCD driver, Include LCD initialization,
* LCD on/off and LCD back-light control.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdint.h>
/*----------------------------------------------------------------------------
* Local variables
*----------------------------------------------------------------------------*/
uint8_t ili9488_lcdMode;
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/**
* \brief Turn on the LCD.
*/
void LCDD_On( void)
{
if (ili9488_lcdMode == ILI9488_SPIMODE ) {
ILI9488_SpiOn();
} else {
ILI9488_EbiOn();
}
}
/**
* \brief Turn off the LCD.
*/
void LCDD_Off( void)
{
if (ili9488_lcdMode == ILI9488_SPIMODE ) {
ILI9488_SpiOff();
} else {
ILI9488_EbiOff();
}
}
/**
* \brief Set the back-light of the LCD.
*
* \param level Back-light brightness level [1..16], 1 means maximum brightness.
*/
#if defined (BOARD_LCD_SPI_EXT1)
void LCDD_SpiSetBacklight (uint32_t level)
{
/* Ensure valid level */
level = (level < 1) ? 1 : level;
level = (level > 16) ? 16 : level;
PWMC_SetDutyCycle(PWM0, CHANNEL_PWM_LCD, level);
}
#endif
/**
* \brief Initializes the LCD controller.
* Configure SMC to access LCD controller at 64MHz MCK.
* \param lcdMode LCD_SPI or LCD_EBI mode
* \param cRotate rotate direction 0: H 1:V
*/
void LCDD_Initialize( uint8_t lcdMode, sXdmad * dmad, uint8_t cRotate)
{
ili9488_lcdMode = lcdMode;
/* Initialize LCD controller */
if (lcdMode == ILI9488_SPIMODE ) {
ILI9488_SpiInitialize(dmad) ;
ILI9488_SpiSetDisplayLandscape(1, cRotate);
} else {
ILI9488_EbiInitialize(dmad) ;
ILI9488_EbiSetDisplayLandscape(1, cRotate);
}
#if defined (BOARD_LCD_SPI_EXT1)
/* Set LCD back-light */
LCDD_SpiSetBacklight( 16 );
#endif
}

View File

@ -0,0 +1,153 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*/
/*-----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*------------------------------------------------------------------------------
* Local Variables
*----------------------------------------------------------------------------*/
#ifdef PINS_LEDS
static const Pin pinsLeds[] = {PIN_LED_0, PIN_LED_1};
static const uint32_t numLeds = PIO_LISTSIZE( pinsLeds );
#endif
/*------------------------------------------------------------------------------
* Global Functions
*----------------------------------------------------------------------------*/
/**
* Configures the pin associated with the given LED number. If the LED does
* not exist on the board, the function does nothing.
* \param led Number of the LED to configure.
* \return 1 if the LED exists and has been configured; otherwise 0.
*/
extern uint32_t LED_Configure( uint32_t dwLed )
{
#ifdef PINS_LEDS
// Check that LED exists
if ( dwLed >= numLeds) {
return 0;
}
// Configure LED
return ( PIO_Configure( &pinsLeds[dwLed], 1 ) );
#else
return 0;
#endif
}
/**
* Turns the given LED on if it exists; otherwise does nothing.
* \param led Number of the LED to turn on.
* \return 1 if the LED has been turned on; 0 otherwise.
*/
extern uint32_t LED_Set( uint32_t dwLed )
{
#ifdef PINS_LEDS
/* Check if LED exists */
if ( dwLed >= numLeds ) {
return 0;
}
/* Turn LED on */
if ( pinsLeds[dwLed].type == PIO_OUTPUT_0 ) {
PIO_Set( &pinsLeds[dwLed] );
} else {
PIO_Clear( &pinsLeds[dwLed] );
}
return 1;
#else
return 0;
#endif
}
/**
* Turns a LED off.
*
* \param led Number of the LED to turn off.
* \return 1 if the LED has been turned off; 0 otherwise.
*/
extern uint32_t LED_Clear( uint32_t dwLed )
{
#ifdef PINS_LEDS
/* Check if LED exists */
if ( dwLed >= numLeds ) {
return 0;
}
/* Turn LED off */
if ( pinsLeds[dwLed].type == PIO_OUTPUT_0 ) {
PIO_Clear( &pinsLeds[dwLed] );
} else {
PIO_Set( &pinsLeds[dwLed] );
}
return 1;
#else
return 0;
#endif
}
/**
* Toggles the current state of a LED.
*
* \param led Number of the LED to toggle.
* \return 1 if the LED has been toggled; otherwise 0.
*/
extern uint32_t LED_Toggle( uint32_t dwLed )
{
#ifdef PINS_LEDS
/* Check if LED exists */
if ( dwLed >= numLeds ) {
return 0;
}
/* Toggle LED */
if ( PIO_GetOutputDataStatus( &pinsLeds[dwLed] ) ) {
PIO_Clear( &pinsLeds[dwLed] );
} else {
PIO_Set( &pinsLeds[dwLed] );
}
return 1;
#else
return 0;
#endif
}

View File

@ -0,0 +1,87 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/*------------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*------------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/**
* Returns the minimum value between two integers.
*
* \param a First integer to compare.
* \param b Second integer to compare.
*/
extern uint32_t min( uint32_t dwA, uint32_t dwB )
{
if ( dwA < dwB ) {
return dwA ;
} else {
return dwB ;
}
}
/*------------------------------------------------------------------------------
* Returns the absolute value of an integer.
*
* \param value Integer value.
*
* \note Do not call this function "abs", problem with gcc !
*/
extern uint32_t absv( int32_t lValue )
{
if ( lValue < 0 ) {
return -lValue ;
} else {
return lValue ;
}
}
/*------------------------------------------------------------------------------
* Computes and returns x power of y.
*
* \param x Value.
* \param y Power.
*/
extern uint32_t power( uint32_t dwX, uint32_t dwY )
{
uint32_t dwResult = 1 ;
while ( dwY > 0 ) {
dwResult *= dwX ;
dwY-- ;
}
return dwResult ;
}

View File

@ -0,0 +1,429 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/** Slave address of OMNIVISION chips. */
#define OV_CAPTOR_ADDRESS_1 0x30
#define OV_CAPTOR_ADDRESS_2 0x21
#define OV_CAPTOR_ADDRESS_3 0x3c
#define OV_CAPTOR_ADDRESS_4 0x10
/** terminating list entry for register in configuration file */
#define OV_REG_TERM 0xFF
#define OV_REG_DELAY 0xFFFF
/** terminating list entry for value in configuration file */
#define OV_VAL_TERM 0xFF
static const Pin pin_ISI_RST= BOARD_ISI_RST;
static uint8_t twiSlaveAddr = OV_CAPTOR_ADDRESS_1;
/*----------------------------------------------------------------------------
* Local Functions
*----------------------------------------------------------------------------*/
static void ov_reset(void)
{
volatile uint32_t i;
PIO_Configure(&pin_ISI_RST, 1);
PIO_Clear(&pin_ISI_RST);
for(i = 0; i < 6000; i++ );
PIO_Set(&pin_ISI_RST);
for(i = 0; i<6000; i++ );
}
/**
* \brief Read PID and VER
* \param pTwid TWI interface
* \return VER | (PID<<8)
*/
static uint16_t ov_id8(Twid *pTwid)
{
uint8_t id, ver;
uint8_t status;
// OV_PID
status = ov_read_reg8(pTwid, 0x0A, &id);
if( status != 0 )
return 0;
TRACE_INFO("PID = 0x%X\n\r", id);
// OV_VER
status = ov_read_reg8(pTwid, 0x0B, &ver);
if( status != 0 )
return 0;
TRACE_INFO("VER = 0x%X\n\r", ver);
return((uint16_t)(id <<8) | ver);
}
/**
* \brief Read PID and VER
* \param pTwid TWI interface
* \return VER | (PID<<8)
*/
static uint16_t ov_id16(Twid *pTwid)
{
uint8_t id, ver;
// OV_PID
ov_read_reg16(pTwid, 0x300A, &id);
TRACE_INFO("PID = 0x%X\n\r", id);
// OV_VER
ov_read_reg16(pTwid, 0x300B, &ver);
TRACE_INFO("VER = 0x%X\n\r", ver);
return((uint16_t)(id <<8) | ver);
}
/**
* \brief Read PID and VER
* \param pTwid TWI interface
* \return VER | (PID<<8)
*/
static uint16_t ov_id(Twid *pTwid)
{
uint16_t id;
TRACE_INFO(" Try TWI address 0x%x \n\r", twiSlaveAddr);
twiSlaveAddr = OV_CAPTOR_ADDRESS_1;
id = ov_id8(pTwid);
if (id == 0) {
twiSlaveAddr = OV_CAPTOR_ADDRESS_2;
TRACE_INFO("Try TWI address 0x%x \n\r", twiSlaveAddr);
id = ov_id8(pTwid);
if (id == 0) {
twiSlaveAddr = OV_CAPTOR_ADDRESS_3;
TRACE_INFO("Try TWI address 0x%x \n\r", twiSlaveAddr);
id = ov_id16(pTwid);
if (id == 0) {
twiSlaveAddr = OV_CAPTOR_ADDRESS_4;
TRACE_INFO("Try TWI address 0x%x \n\r", twiSlaveAddr);
id = ov_id16(pTwid);
}
}
}
return id;
}
/*----------------------------------------------------------------------------
* Global Functions
*----------------------------------------------------------------------------*/
/**
* \brief Read a value from a register in an OV sensor device.
* \param pTwid TWI interface
* \param reg Register to be read
* \param pData Data read
* \return 0 if no error; otherwise TWID_ERROR_BUSY
*/
uint8_t ov_read_reg8(Twid *pTwid, uint8_t reg, uint8_t *pData)
{
uint8_t status;
status = TWID_Write( pTwid, twiSlaveAddr, 0, 0, &reg, 1, 0);
status |= TWID_Read( pTwid, twiSlaveAddr, 0, 0, pData, 1, 0);
if( status != 0 ) {
TRACE_ERROR("ov_read_reg pb\n\r");
}
return status;
}
/**
* \brief Read a value from a register in an OV sensor device.
* \param pTwid TWI interface
* \param reg Register to be read
* \param pData Data read
* \return 0 if no error; otherwise TWID_ERROR_BUSY
*/
uint8_t ov_read_reg16(Twid *pTwid, uint16_t reg, uint8_t *pData)
{
uint8_t status;
uint8_t reg8[2];
reg8[0] = reg>>8;
reg8[1] = reg & 0xff;
status = TWID_Write( pTwid, twiSlaveAddr, 0, 0, reg8, 2, 0);
status |= TWID_Read( pTwid, twiSlaveAddr, 0, 0, pData, 1, 0);
if( status != 0 ) {
TRACE_ERROR("ov_read_reg pb\n\r");
}
return status;
}
/**
* \brief Write a value to a register in an OV sensor device.
* \param pTwid TWI interface
* \param reg Register to be written
* \param pData Data written
* \return 0 if no error; otherwise TWID_ERROR_BUSY
*/
uint8_t ov_write_reg8(Twid *pTwid, uint8_t reg, uint8_t val)
{
uint8_t status;
status = TWID_Write(pTwid, twiSlaveAddr, reg, 1, &val, 1, 0);
if( status != 0 ) {
TRACE_ERROR("ov_write_reg pb\n\r");
}
return status;
}
/**
* \brief Write a value to a register in an OV sensor device.
* \param pTwid TWI interface
* \param reg Register to be written
* \param pData Data written
* \return 0 if no error; otherwise TWID_ERROR_BUSY
*/
uint8_t ov_write_reg16(Twid *pTwid, uint16_t reg, uint8_t val)
{
uint8_t status;
status = TWID_Write(pTwid, twiSlaveAddr, reg, 2, &val, 1, 0);
if( status != 0 ) {
TRACE_ERROR("ov_write_reg pb\n\r");
}
return status;
}
/**
* \brief Initialize a list of OV registers.
* The list of registers is terminated by the pair of values
* \param pTwid TWI interface
* \param pReglist Register list to be written
* \return 0 if no error; otherwise TWID_ERROR_BUSY
*/
uint32_t ov_write_regs8(Twid *pTwid, const struct ov_reg* pReglist)
{
uint32_t err;
uint32_t size=0;
const struct ov_reg *pNext = pReglist;
volatile uint32_t delay;
TRACE_DEBUG("ov_write_regs:");
while (!((pNext->reg == OV_REG_TERM) && (pNext->val == OV_VAL_TERM))) {
err = ov_write_reg8(pTwid, pNext->reg, pNext->val);
size++;
for(delay=0;delay<=10000;delay++);
if (err == TWID_ERROR_BUSY){
TRACE_ERROR("ov_write_regs: TWI ERROR\n\r");
return err;
}
pNext++;
}
TRACE_DEBUG_WP("\n\r");
return 0;
}
/**
* \brief Initialize a list of OV registers.
* The list of registers is terminated by the pair of values
* \param pTwid TWI interface
* \param pReglist Register list to be written
* \return 0 if no error; otherwise TWID_ERROR_BUSY
*/
uint32_t ov_write_regs16(Twid *pTwid, const struct ov_reg* pReglist)
{
uint32_t err = 0;
uint32_t size = 0;
const struct ov_reg *pNext = pReglist;
volatile uint32_t delay;
TRACE_DEBUG("ov_write_regs:");
while (!((pNext->reg == OV_REG_TERM) && (pNext->val == OV_VAL_TERM))) {
err = ov_write_reg16(pTwid, pNext->reg, pNext->val);
size++;
for(delay = 0;delay <= 10000; delay++);
if (err == TWID_ERROR_BUSY){
TRACE_ERROR("ov_write_regs: TWI ERROR\n\r");
return err;
}
pNext++;
}
TRACE_DEBUG_WP("\n\r");
return 0;
}
void isOV5640_AF_InitDone(Twid *pTwid)
{
uint8_t value = 0;
while(1){
ov_read_reg16(pTwid, 0x3029, &value);
if (value == 0x70)
break;
}
}
/**
* \brief AF for OV 5640
* \param pTwid TWI interface
* \return 0 if no error; otherwise TWID_ERROR_BUSY
*/
uint32_t ov_5640_AF_single(Twid *pTwid)
{
uint8_t value;
ov_write_reg16(pTwid, 0x3023, 1);
ov_write_reg16(pTwid, 0x3022, 3);
value =1;
while(1){
ov_read_reg16(pTwid, 0x3023, &value);
if (value == 0)
break;
}
return 0;
}
uint32_t ov_5640_AF_continue(Twid *pTwid)
{
uint8_t value;
ov_write_reg16(pTwid, 0x3024, 1);
ov_write_reg16(pTwid, 0x3022, 4);
value =1;
while(1){
ov_read_reg16(pTwid, 0x3023, &value);
if (value == 0)
break;
}
return 0;
}
uint32_t ov_5640_AFPause(Twid *pTwid)
{
uint8_t value;
ov_write_reg16(pTwid, 0x3023, 1);
ov_write_reg16(pTwid, 0x3022, 6);
value =1;
while(1){
ov_read_reg16(pTwid, 0x3023, &value);
if (value == 0)
break;
}
return 0;
}
uint32_t ov_5640_AFrelease(Twid *pTwid)
{
uint8_t value;
ov_write_reg16(pTwid, 0x3023, 1);
ov_write_reg16(pTwid, 0x3022, 8);
value =1;
while(1){
ov_read_reg16(pTwid, 0x3023, &value);
if (value == 0)
break;
}
return 0;
}
/**
* \brief Dump all register
* \param pTwid TWI interface
*/
void ov_DumpRegisters8(Twid *pTwid)
{
uint32_t i;
uint8_t value;
TRACE_INFO_WP("Dump all camera register\n\r");
for(i = 0; i <= 0x5C; i++) {
value = 0;
ov_read_reg8(pTwid, i, &value);
TRACE_INFO_WP("[0x%02x]=0x%02x ", i, value);
if( ((i+1)%5) == 0 ) {
TRACE_INFO_WP("\n\r");
}
}
TRACE_INFO_WP("\n\r");
}
/**
* \brief Dump all register
* \param pTwid TWI interface
*/
void ov_DumpRegisters16(Twid *pTwid)
{
uint32_t i;
uint8_t value;
TRACE_INFO_WP("Dump all camera register\n\r");
for(i = 3000; i <= 0x305C; i++) {
value = 0;
ov_read_reg16(pTwid, i, &value);
TRACE_INFO_WP("[0x%02x]=0x%02x ", i, value);
if( ((i+1)%5) == 0 ) {
TRACE_INFO_WP("\n\r");
}
}
TRACE_INFO_WP("\n\r");
}
/**
* \brief Sequence For correct operation of the sensor
* \param pTwid TWI interface
* \return OV type
*/
uint8_t ov_init(Twid *pTwid)
{
uint16_t id = 0;
uint8_t ovType;
ov_reset();
id = ov_id(pTwid);
switch (id) {
case 0x7740: case 0x7742:
ovType = OV_7740;
TRACE_INFO(" Camera Model :- OV_7740");
break;
case 0x9740: case 0x9742:
ovType = OV_9740;
TRACE_INFO(" Camera Model :- OV_9740");
break;
case 0x2642: case 0x2640:
ovType = OV_2640;
TRACE_INFO(" Camera Model :- OV_2640");
break;
case 0x2643:
ovType = OV_2643;
TRACE_INFO(" Camera Model :- OV_2643");
break;
case 0x5640:
ovType = OV_5640;
TRACE_INFO(" Camera Model :- OV_5640");
break;
default:
ovType = OV_UNKNOWN;
TRACE_INFO(" Camera Model :- UNKNOWN");
TRACE_ERROR("Can not support product ID %x \n\r", id);
break;
}
return ovType;
}

View File

@ -0,0 +1,210 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
const capture_size ov_sizes[] = {
//{width, height}
{ 160, 120 }, // QQVGA
{ 352, 288 }, // CIF
{ 320, 240 },
{ 640, 360 },
{ 640, 480 },
// SWVGA
{ 800, 600 },
/// SXGA
{1280, 960 },
{1280, 720 },
/// UXGA
{1600, 1200 },
};
/*----------------------------------------------------------------------------
* Global Functions
*----------------------------------------------------------------------------*/
/**
* \brief Configure the OV for a specified image size, pixel format,
* and frame period.
*/
void ov_configure(Twid *pTwid, uint8_t ovType, uint32_t width, uint32_t heigth)
{
const struct ov_reg *reg_conf;
uint8_t goodCaptureSize = 0;
uint8_t i;
reg_conf = ov5640_yuv_vga;
TRACE_DEBUG("ovxxx_configure\n\r");
for( i = 0; i< sizeof(ov_sizes); i++ ) {
if( ov_sizes[i].width == width ) {
if( ov_sizes[i].height != heigth ) {
TRACE_INFO("ov configure vsize not define\n\r");
} else {
goodCaptureSize = 1;
break;
}
}
}
if( goodCaptureSize == 0 ) {
TRACE_ERROR("Problem size\n\r");
while(1);
}
switch (ovType){
case OV_2640: {
// Default value
reg_conf = ov2640_yuv_qvga;
// common register initialization
switch(width) {
case 320: //VGA
printf("-I- QVGA 640 x 480\n\r");
reg_conf = ov2640_yuv_qvga;
break;
case 640: //VGA
TRACE_INFO("VGA 640 x 480\n\r");
reg_conf = ov2640_yuv_vga;
break;
default:
TRACE_DEBUG("ov2640_configure problem\n\r");
break;
}
break;
}
case OV_7740: {
// Default value
reg_conf = OV7740_VGA_YUV422;
// common register initialization
switch(width) {
case 640: //VGA
TRACE_INFO(" VGA 640 x 480\n\r");
reg_conf = OV7740_VGA_YUV422;
break;
case 352: //CIF
TRACE_INFO(" VGA 640 x 480\n\r");
reg_conf = OV7740_CIF_YUV422;
break;
case 320: //QVGA
TRACE_INFO(" QVGA 320 x 240\n\r");
reg_conf = OV7740_QVGA_YUV422;
break;
case 160: //QQVGA
TRACE_INFO(" QVGA 320 x 240\n\r");
reg_conf = OV7740_QQVGA_YUV422;
break;
default:
TRACE_DEBUG("ov7740_configure problem\n\r");
break;
}
break;
}
case OV_9740: {
// Default value
reg_conf = ov9740_yuv_vga;
// common register initialization
switch(width) {
case 640: //VGA
TRACE_INFO(" VGA 640 x 360\n\r");
reg_conf = ov9740_yuv_vga;
break;
case 1280: //VGA
TRACE_INFO(" VGA 1280 x 720\n\r");
reg_conf = ov9740_yuv_sxga;
break;
default:
TRACE_DEBUG("ov9740_configure problem\n\r");
break;
}
break;
}
case OV_2643: {
// Default value
reg_conf = ov2643_yuv_vga;
// common register initialization
switch(width) {
case 1600: //UXGA
TRACE_INFO(" UXGA 1600 x 1200 \n\r");
reg_conf = ov2643_yuv_uxga;
break;
case 800: //SWVGA
TRACE_INFO("SWVGA 800 x 600\n\r");
reg_conf = ov2643_yuv_swvga;
break;
case 640: //VGA
TRACE_INFO(" VGA 640 x 480\n\r");
reg_conf = ov2643_yuv_vga;
break;
default:
TRACE_DEBUG("ov2643_configure problem\n\r");
break;
}
break;
}
case OV_5640: {
// Default value
reg_conf = ov5640_yuv_vga;
// common register initialization
switch(width) {
case 640: //VGA
TRACE_INFO(" VGA 640 x 480\n\r");
reg_conf = ov5640_yuv_vga;
break;
case 1280: //SXGA
TRACE_INFO(" SXGA 1280 x 720\n\r");
reg_conf = ov5640_yuv_sxga;
break;
default:
TRACE_DEBUG("ov5640_configure problem\n\r");
break;
}
break;
}
}
if ((ovType == OV_5640) || (ovType == OV_9740))
ov_write_regs16(pTwid, reg_conf);
else
ov_write_regs8(pTwid, reg_conf);
}
/**
* \brief Configure the OV 5640 afc firmware.
*/
void ov_5640Afc_Firmware(Twid *pTwid)
{
const struct ov_reg *reg_conf;
reg_conf = ov5640_afc;
ov_write_regs16(pTwid, reg_conf);
}

View File

@ -0,0 +1,338 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*/
/*------------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*
* ID
*/
/*------------------------------------------------------------------------------
* Local Variables
*----------------------------------------------------------------------------*/
/* 320*240 */
const struct ov_reg ov2640_yuv_qvga[]= {
{0xff, 0x01},{0x12, 0x80},{0xff, 0x00},{0x2c, 0xff},{0x2e, 0xdf},
{0xff, 0x01},{0x3c, 0x32},{0x11, 0x00},{0x09, 0x02},{0x04, 0x28},
{0x13, 0xe5},{0x14, 0x48},{0x2c, 0x0c},{0x33, 0x78},{0x3a, 0x33},
{0x3b, 0xfb},{0x3e, 0x00},{0x43, 0x11},{0x16, 0x10},{0x39, 0x02},
{0x35, 0x88},{0x22, 0x0a},{0x37, 0x40},{0x23, 0x00},{0x34, 0xa0},
{0x36, 0x1a},{0x06, 0x02},{0x07, 0xc0},{0x0d, 0xb7},{0x0e, 0x01},
{0x4c, 0x00},{0x4a, 0x81},{0x21, 0x99},{0x24, 0x3a},{0x25, 0x32},
{0x26, 0x82},{0x5c, 0x00},{0x63, 0x00},{0x5d, 0x55},{0x5e, 0x7d},
{0x5f, 0x7d},{0x60, 0x55},{0x61, 0x70},{0x62, 0x80},{0x7c, 0x05},
{0x20, 0x80},{0x28, 0x30},{0x6c, 0x00},{0x6d, 0x80},{0x6e, 0x00},
{0x70, 0x02},{0x71, 0x94},{0x73, 0xc1},{0x3d, 0x34},{0x5a, 0x57},
{0x4f, 0xbb},{0x50, 0x9c},{0xff, 0x00},{0xe5, 0x7f},{0xf9, 0xc0},
{0x41, 0x24},{0xe0, 0x14},{0x76, 0xff},{0x33, 0xa0},{0x42, 0x20},
{0x43, 0x18},{0x4c, 0x00},{0x87, 0xd0},{0x88, 0x3f},{0xd7, 0x03},
{0xd9, 0x10},{0xd3, 0x82},{0xc8, 0x08},{0xc9, 0x80},{0x7c, 0x00},
{0x7d, 0x02},{0x7c, 0x03},{0x7d, 0x48},{0x7d, 0x48},{0x7c, 0x08},
{0x7d, 0x20},{0x7d, 0x10},{0x7d, 0x0e},{0x90, 0x00},{0x91, 0x0e},
{0x91, 0x1a},{0x91, 0x31},{0x91, 0x5a},{0x91, 0x69},{0x91, 0x75},
{0x91, 0x7e},{0x91, 0x88},{0x91, 0x8f},{0x91, 0x96},{0x91, 0xa3},
{0x91, 0xaf},{0x91, 0xc4},{0x91, 0xd7},{0x91, 0xe8},{0x91, 0x20},
{0x92, 0x00},{0x93, 0x06},{0x93, 0xe3},{0x93, 0x05},{0x93, 0x05},
{0x93, 0x00},{0x93, 0x02},{0x93, 0x00},{0x93, 0x00},{0x93, 0x00},
{0x93, 0x00},{0x93, 0x00},{0x93, 0x00},{0x93, 0x00},{0x96, 0x00},
{0x97, 0x08},{0x97, 0x19},{0x97, 0x02},{0x97, 0x0c},{0x97, 0x24},
{0x97, 0x30},{0x97, 0x28},{0x97, 0x26},{0x97, 0x02},{0x97, 0x98},
{0x97, 0x80},{0x97, 0x00},{0x97, 0x00},{0xc3, 0xed},{0xa4, 0x00},
{0xa8, 0x00},{0xc5, 0x11},{0xc6, 0x51},{0xbf, 0x80},{0xc7, 0x10},
{0xb6, 0x66},{0xb8, 0xa5},{0xb7, 0x64},{0xb9, 0x7c},{0xb3, 0xaf},
{0xb4, 0x97},{0xb5, 0xff},{0xb0, 0xc5},{0xb1, 0x94},{0xb2, 0x0f},
{0xc4, 0x5c},{0xc0, 0xc8},{0xc1, 0x96},{0x86, 0x1d},{0x50, 0x00},
{0x51, 0x90},{0x52, 0x18},{0x53, 0x00},{0x54, 0x00},{0x55, 0x88},
{0x57, 0x00},{0x5a, 0x90},{0x5b, 0x18},{0x5c, 0x05},{0xc3, 0xed},
{0x7f, 0x00},{0xda, 0x04},{0xe5, 0x1f},{0xe1, 0x67},{0xe0, 0x00},
{0xdd, 0xff},{0x05, 0x00},{0xff, 0x01},{0x11, 0x01},{0xff, 0x01},
{0x12, 0x40},{0x17, 0x11},{0x18, 0x43},{0x19, 0x00},{0x1a, 0x4b},
{0x32, 0x09},{0x4f, 0xca},{0x50, 0xa8},{0x5a, 0x23},{0x6d, 0x00},
{0x3d, 0x38},{0x39, 0x12},{0x35, 0xda},{0x22, 0x1a},{0x37, 0xc3},
{0x23, 0x00},{0x34, 0xc0},{0x36, 0x1a},{0x06, 0x88},{0x07, 0xc0},
{0x0d, 0x87},{0x0e, 0x41},{0x4c, 0x00},{0x48, 0x00},{0x5B, 0x00},
{0x42, 0x03},{0xff, 0x00},{0xe0, 0x04},{0xc0, 0x64},{0xc1, 0x4B},
{0x8c, 0x00},{0x86, 0x1D},{0xd3, 0x82},{0xe0, 0x00},{0xff, 0x00},
{0xc0, 0x64},{0xc1, 0x4B},{0x8c, 0x00}, //HSIZE 0x64*8 = 800, VSIZE 0x4b*8 = 600
{0x86, 0x3D},{0x50, 0x89}, //LP_DP, V_DIV 1, H_DIV 1
{0x51, 0xC8},{0x52, 0x96},{0x53, 0x00},{0x54, 0x00},{0x55, 0x00},
//HSIZE 0xC8(200)*4 = 800, VSIZE 0x96(150)*4 = 600
{0x5a, 0x50},{0x5b, 0x3C},{0x5c, 0x00}, //ZMOW 0x50(80)*4 = 320, ZMOH 0x3C(60)*4 = 240
{0xd3, 0x04},{0xFF, 0x00},{0xE0, 0x04},{0xE1, 0x67},{0xD7, 0x01},
{0xDA, 0x00},{0xD3, 0x82},{0xE0, 0x00},{0xFF, 0xFF}
};
const struct ov_reg ov2640_yuv_vga[]= {
{0xff, 0x01}, //dsp
{0x12, 0x80}, //reset
{0xff, 0x00}, //sensor
{0x2c, 0xff}, //?
{0x2e, 0xdf}, //ADDVSH, VSYNC msb=223
{0xff, 0x01}, //dsp
{0x3c, 0x32}, //?
{0x11, 0x00}, //clock rate off
{0x09, 0x02}, //2 capablity + standby mode
{0x04, 0x28}, //? ??????????????????????????????????
{0x13, 0xe5}, //
{0x14, 0x48}, //Auto agc
{0x2c, 0x0c}, //?
{0x33, 0x78}, //?
{0x3a, 0x33}, //?
{0x3b, 0xfb}, //?
{0x3e, 0x00}, //?
{0x43, 0x11}, //?
{0x16, 0x10}, //?
{0x39, 0x02}, //?
{0x35, 0x88}, //?
{0x22, 0x0a}, //?
{0x37, 0x40}, //?
{0x23, 0x00}, //?
{0x34, 0xa0}, //startpoint 0
{0x36, 0x1a}, //? XXXXXXXXXXXXXXXX
{0x06, 0x02}, //?
{0x07, 0xc0}, //?
{0x0d, 0xb7}, //?
{0x0e, 0x01}, //?
{0x4c, 0x00}, //?
{0x4a, 0x81}, //?
{0x21, 0x99}, //?
{0x24, 0x3a}, // Luminance high
{0x25, 0x32}, // Luminance low
//{0x24, 0x10}, // Luminance high
//{0x25, 0x03}, // Luminance low
{0x26, 0xF3}, // Fast mode large Step Range Threshold
{0x5c, 0x00}, //?
{0x63, 0x00}, //?
{0x5d, 0x55}, //zone
{0x5e, 0x7d}, //zone
{0x5f, 0x7d}, //zone
{0x60, 0x55}, //zone
{0x61, 0x70}, //Histogram low
{0x62, 0x80}, //Histogram high
{0x7c, 0x05}, //?
{0x20, 0x80}, //?
{0x28, 0x30}, //?
{0x6c, 0x00}, //?
{0x6d, 0x80}, //?
{0x6e, 0x00}, //?
{0x70, 0x02}, //?
{0x71, 0x94}, //?
{0x73, 0xc1}, //?
{0x3d, 0x34}, //?
{0x5a, 0x57}, //?
{0x4f, 0xbb}, //50Hz
{0x50, 0x9c}, //60Hz
{0xff, 0x00}, //dsp
{0xe5, 0x7f}, //?
{0xf9, 0xc0}, //MicroC reset,Boot
{0x41, 0x24}, //?
{0xe0, 0x14}, //JPEG,DVP reset
{0x76, 0xff}, //?
{0x33, 0xa0}, //?
{0x42, 0x20}, //?
{0x43, 0x18}, //?
{0x4c, 0x00}, //?
{0x87, 0xd0}, //Module Enable BPC+WPC 11010000
{0x88, 0x3f}, //?
{0xd7, 0x03}, //?
{0xd9, 0x10}, //?
{0xd3, 0x82}, //Auto mode
{0xc8, 0x08}, //?
{0xc9, 0x80}, //?
{0x7c, 0x00}, //SDE indirect register access: address
{0x7d, 0x02}, //SDE indirect register data
{0x7c, 0x03}, //
{0x7d, 0x48}, //
{0x7d, 0x48}, //
{0x7c, 0x08}, //
{0x7d, 0x20}, //
{0x7d, 0x10}, //
{0x7d, 0x0e}, //
{0x90, 0x00}, //?
{0x91, 0x0e}, //?
{0x91, 0x1a}, //?
{0x91, 0x31}, //?
{0x91, 0x5a}, //?
{0x91, 0x69}, //?
{0x91, 0x75}, //?
{0x91, 0x7e}, //?
{0x91, 0x88}, //?
{0x91, 0x8f}, //?
{0x91, 0x96}, //?
{0x91, 0xa3}, //?
{0x91, 0xaf}, //?
{0x91, 0xc4}, //?
{0x91, 0xd7}, //?
{0x91, 0xe8}, //?
{0x91, 0x20}, //?
{0x92, 0x00}, //?
{0x93, 0x06}, //?
{0x93, 0xe3}, //?
{0x93, 0x05}, //?
{0x93, 0x05}, //?
{0x93, 0x00}, //?
{0x93, 0x02}, //?
{0x93, 0x00}, //?
{0x93, 0x00}, //?
{0x93, 0x00}, //?
{0x93, 0x00}, //?
{0x93, 0x00}, //?
{0x93, 0x00}, //?
{0x93, 0x00}, //?
{0x96, 0x00}, //?
{0x97, 0x08}, //?
{0x97, 0x19}, //?
{0x97, 0x02}, //?
{0x97, 0x0c}, //?
{0x97, 0x24}, //?
{0x97, 0x30}, //?
{0x97, 0x28}, //?
{0x97, 0x26}, //?
{0x97, 0x02}, //?
{0x97, 0x98}, //?
{0x97, 0x80}, //?
{0x97, 0x00}, //?
{0x97, 0x00}, //?
{0xc3, 0xed}, //Module enable
{0xa4, 0x00}, //?
{0xa8, 0x00}, //?
{0xc5, 0x11}, //?
{0xc6, 0x51}, //?
{0xbf, 0x80}, //?
{0xc7, 0x10}, //?
{0xb6, 0x66}, //?
{0xb8, 0xa5}, //?
{0xb7, 0x64}, //?
{0xb9, 0x7c}, //?
{0xb3, 0xaf}, //?
{0xb4, 0x97}, //?
{0xb5, 0xff}, //?
{0xb0, 0xc5}, //?
{0xb1, 0x94}, //?
{0xb2, 0x0f}, //?
{0xc4, 0x5c}, //?
{0xc0, 0xc8}, // HSIZE8[7:0] 1600
{0xc1, 0x96}, // VSIZE8[7:0] 1200
{0x86, 0x1d}, //Module enable
{0x50, 0x00}, //?
{0x51, 0x90}, //H_SIZE[7:0] (real/4) 1600
{0x52, 0x18}, //V_SIZE[7:0] (real/4) 1120
{0x53, 0x00}, //OFFSET_X[7:0]
{0x54, 0x00}, //OFFSET_Y[7:0]
{0x55, 0x88}, //V_SIZE[8]=1 H_SIZE[8]
{0x57, 0x00}, //?
{0x5a, 0x90}, //OUTW
{0x5b, 0x18}, //OUTH
{0x5c, 0x05}, //OUTW8 ,OUTH8
{0xc3, 0xed}, //
{0x7f, 0x00}, //?
{0xda, 0x04}, //Image output format select ------ RAW
{0xe5, 0x1f}, //?
{0xe1, 0x67}, //?
{0xe0, 0x00}, //Reset
{0xdd, 0xff}, //?
{0x05, 0x00}, //Bypass DSP no
{0xC2, 0x08 | 0x04 | 0x02 },
{0xff, 0x01}, //Sensor
{0x11, 0x01}, //?
{0xff, 0x01}, //Sensor
{0x12, 0x40}, //Preview mode
{0x17, 0x11}, //?
{0x18, 0x43}, //?
{0x19, 0x00}, //?
{0x1a, 0x4b}, //?
{0x32, 0x09}, //?
{0x4f, 0xca}, //?
{0x50, 0xa8}, //10 101 000 V_DIVDER = 5
{0x5a, 0x23}, // OUTW 23
{0x6d, 0x00}, //?
{0x3d, 0x38}, //?
{0x39, 0x12}, //?
{0x35, 0xda}, //?
{0x22, 0x1a}, //?
{0x37, 0xc3}, //?
{0x23, 0x00}, //?
{0x34, 0xc0}, //?
{0x36, 0x1a}, //?
{0x06, 0x88}, //?
{0x07, 0xc0}, //?
{0x0d, 0x87}, //?
{0x0e, 0x41}, //?
{0x4c, 0x00}, //?
{0x48, 0x00}, //?
{0x5B, 0x00}, //OUTH
{0x42, 0x03}, //?
{0xff, 0x00}, //DSP
{0xe0, 0x04}, //Reset DVP
{0xc0, 0x64}, // HSIZE8[7:0] 400
{0xc1, 0x4B}, // VSIZE8[7:0] 300
{0x8c, 0x00}, //?
{0x86, 0x1D}, //Modle enable
{0xd3, 0x82}, //Auto mode DVP PCLK=2
{0xe0, 0x00}, //Reset
{0xff, 0x00}, //DSP
{0xc0, 0x64}, // HSIZE8[7:0] 400
{0xc1, 0x4B}, // VSIZE8[7:0] 300
{0x8c, 0x00}, //?
{0x86, 0x3D}, //?
{0x50, 0x00}, //?
{0x51, 0xC8}, //H_SIZE[7:0] (real/4) 800
{0x52, 0x96}, //V_SIZE[7:0] (real/4) 600
{0x53, 0x00}, //OFFSET
{0x54, 0x00}, //OFFSET
{0x55, 0x00}, //H_SIZE[8],V_SIZE[8]
{0x5a, 0xA0}, //OUTW[0-7] 160?
{0x5b, 0x78}, //OUTH[0-7] 120?
{0x5c, 0x00}, //OUTW8,OUTH8
{0xd3, 0x04}, //?
{0xFF, 0x00},
{0xE0, 0x04},
{0xE1, 0x67},
{0xD7, 0x01},
{0xDA, 0x00}, //Image output format select ------ YUV422
{0xD3, 0x82},
{0xE0, 0x00},
{0xFF, 0xFF}
};

View File

@ -0,0 +1,681 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*/
/*------------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*
* ID
*/
#define MANUFACTURER_ID 0x7FA2
/*------------------------------------------------------------------------------
* Local Variables
*----------------------------------------------------------------------------*/
const struct ov_reg ov2643_yuv_uxga[]= {
{0x12, 0x80},
{0xc3, 0x1f},
{0xc4, 0xff},
{0x3d, 0x48},
{0xdd, 0xa5},
{0x0e, 0xb7},
{0x10, 0x0a},
{0x11, 0x00},
{0x0f, 0x14},
{0x21, 0x25},
{0x23, 0x0c},
{0x12, 0x08},
{0x39, 0x10},
{0xcd, 0x12},
{0x13, 0xff},
{0x14, 0xa7},
{0x15, 0x42},
{0x3c, 0xa4},
{0x18, 0x60},
{0x19, 0x50},
{0x1a, 0xe2},
{0x37, 0xe8},
{0x16, 0x90},
{0x43, 0x00},
{0x40, 0xfb},
{0xa9, 0x44},
{0x2f, 0xec},
{0x35, 0x10},
{0x36, 0x10},
{0x0c, 0x00},
{0x0d, 0x00},
{0xd0, 0x93},
{0xdc, 0x2b},
{0xd9, 0x41},
{0xd3, 0x02},
{0x3d, 0x08},
{0x0c, 0x00},
{0x18, 0x2c},
{0x19, 0x24},
{0x1a, 0x71},
{0x9b, 0x69},
{0x9c, 0x7d},
{0x9d, 0x7d},
{0x9e, 0x69},
{0x35, 0x04},
{0x36, 0x04},
{0x65, 0x12},
{0x66, 0x20},
{0x67, 0x39},
{0x68, 0x4e},
{0x69, 0x62},
{0x6a, 0x74},
{0x6b, 0x85},
{0x6c, 0x92},
{0x6d, 0x9e},
{0x6e, 0xb2},
{0x6f, 0xc0},
{0x70, 0xcc},
{0x71, 0xe0},
{0x72, 0xee},
{0x73, 0xf6},
{0x74, 0x11},
{0xab, 0x20},
{0xac, 0x5b},
{0xad, 0x05},
{0xae, 0x1b},
{0xaf, 0x76},
{0xb0, 0x90},
{0xb1, 0x90},
{0xb2, 0x8c},
{0xb3, 0x04},
{0xb4, 0x98},
{0x4c, 0x03},
{0x4d, 0x30},
{0x4e, 0x02},
{0x4f, 0x5c},
{0x50, 0x56},
{0x51, 0x00},
{0x52, 0x66},
{0x53, 0x03},
{0x54, 0x30},
{0x55, 0x02},
{0x56, 0x5c},
{0x57, 0x40},
{0x58, 0x00},
{0x59, 0x66},
{0x5a, 0x03},
{0x5b, 0x20},
{0x5c, 0x02},
{0x5d, 0x5c},
{0x5e, 0x3a},
{0x5f, 0x00},
{0x60, 0x66},
{0x41, 0x1f},
{0xb5, 0x01},
{0xb6, 0x02},
{0xb9, 0x40},
{0xba, 0x28},
{0xbf, 0x0c},
{0xc0, 0x3e},
{0xa3, 0x0a},
{0xa4, 0x0f},
{0xa5, 0x09},
{0xa6, 0x16},
{0x9f, 0x0a},
{0xa0, 0x0f},
{0xa7, 0x0a},
{0xa8, 0x0f},
{0xa1, 0x10},
{0xa2, 0x04},
{0xa9, 0x04},
{0xaa, 0xa6},
{0x75, 0x6a},
{0x76, 0x11},
{0x77, 0x92},
{0x78, 0x21},
{0x79, 0xe1},
{0x7a, 0x02},
{0x7c, 0x05},
{0x7d, 0x08},
{0x7e, 0x08},
{0x7f, 0x7c},
{0x80, 0x58},
{0x81, 0x2a},
{0x82, 0xc5},
{0x83, 0x46},
{0x84, 0x3a},
{0x85, 0x54},
{0x86, 0x44},
{0x87, 0xf8},
{0x88, 0x08},
{0x89, 0x70},
{0x8a, 0xf0},
{0x8b, 0xf0},
{0x90, 0xe3},
{0x93, 0x10},
{0x94, 0x20},
{0x95, 0x10},
{0x96, 0x18},
{0x0f, 0x34},
{0x12, 0x80},
{0xc3, 0x1f},
{0xc4, 0xff},
{0x3d, 0x48},
{0xdd, 0xa5},
{0x0e, 0xb4},
{0x10, 0x0a},
{0x11, 0x00},
{0x0f, 0x14},
{0x21, 0x25},
{0x23, 0x0c},
{0x12, 0x08},
{0x39, 0x10},
{0xcd, 0x12},
{0x13, 0xff},
{0x14, 0xa7},
{0x15, 0x42},
{0x3c, 0xa4},
{0x18, 0x60},
{0x19, 0x50},
{0x1a, 0xe2},
{0x37, 0xe8},
{0x16, 0x90},
{0x43, 0x00},
{0x40, 0xfb},
{0xa9, 0x44},
{0x2f, 0xec},
{0x35, 0x10},
{0x36, 0x10},
{0x0c, 0x00},
{0x0d, 0x00},
{0xd0, 0x93},
{0xdc, 0x2b},
{0xd9, 0x41},
{0xd3, 0x02},
{0x3d, 0x08},
{0x0c, 0x00},
{0x18, 0x2c},
{0x19, 0x24},
{0x1a, 0x71},
{0x9b, 0x69},
{0x9c, 0x7d},
{0x9d, 0x7d},
{0x9e, 0x69},
{0x35, 0x04},
{0x36, 0x04},
{0x65, 0x12},
{0x66, 0x20},
{0x67, 0x39},
{0x68, 0x4e},
{0x69, 0x62},
{0x6a, 0x74},
{0x6b, 0x85},
{0x6c, 0x92},
{0x6d, 0x9e},
{0x6e, 0xb2},
{0x6f, 0xc0},
{0x70, 0xcc},
{0x71, 0xe0},
{0x72, 0xee},
{0x73, 0xf6},
{0x74, 0x11},
{0xab, 0x20},
{0xac, 0x5b},
{0xad, 0x05},
{0xae, 0x1b},
{0xaf, 0x76},
{0xb0, 0x90},
{0xb1, 0x90},
{0xb2, 0x8c},
{0xb3, 0x04},
{0xb4, 0x98},
{0x4c, 0x03},
{0x4d, 0x30},
{0x4e, 0x02},
{0x4f, 0x5c},
{0x50, 0x56},
{0x51, 0x00},
{0x52, 0x66},
{0x53, 0x03},
{0x54, 0x30},
{0x55, 0x02},
{0x56, 0x5c},
{0x57, 0x40},
{0x58, 0x00},
{0x59, 0x66},
{0x5a, 0x03},
{0x5b, 0x20},
{0x5c, 0x02},
{0x5d, 0x5c},
{0x5e, 0x3a},
{0x5f, 0x00},
{0x60, 0x66},
{0x41, 0x1f},
{0xb5, 0x01},
{0xb6, 0x02},
{0xb9, 0x40},
{0xba, 0x28},
{0xbf, 0x0c},
{0xc0, 0x3e},
{0xa3, 0x0a},
{0xa4, 0x0f},
{0xa5, 0x09},
{0xa6, 0x16},
{0x9f, 0x0a},
{0xa0, 0x0f},
{0xa7, 0x0a},
{0xa8, 0x0f},
{0xa1, 0x10},
{0xa2, 0x04},
{0xa9, 0x04},
{0xaa, 0xa6},
{0x75, 0x6a},
{0x76, 0x11},
{0x77, 0x92},
{0x78, 0x21},
{0x79, 0xe1},
{0x7a, 0x02},
{0x7c, 0x05},
{0x7d, 0x08},
{0x7e, 0x08},
{0x7f, 0x7c},
{0x80, 0x58},
{0x81, 0x2a},
{0x82, 0xc5},
{0x83, 0x46},
{0x84, 0x3a},
{0x85, 0x54},
{0x86, 0x44},
{0x87, 0xf8},
{0x88, 0x08},
{0x89, 0x70},
{0x8a, 0xf0},
{0x8b, 0xf0},
{0x90, 0xe3},
{0x93, 0x10},
{0x94, 0x20},
{0x95, 0x10},
{0x96, 0x18},
{0x0f, 0x34},
{0xFF, 0xFF}
};
const struct ov_reg ov2643_yuv_swvga[]= {
{0x12, 0x80},
{0xc3, 0x1f},
{0xc4, 0xff},
{0x3d, 0x48},
{0xdd, 0xa5},
{0x0e, 0xb4},
{0x10, 0x0a},
{0x11, 0x00},
{0x0f, 0x14},
{0x21, 0x25},
{0x23, 0x0c},
{0x12, 0x08},
{0x39, 0x10},
{0xcd, 0x12},
{0x13, 0xff},
{0x14, 0xa7},
{0x15, 0x42},
{0x3c, 0xa4},
{0x18, 0x60},
{0x19, 0x50},
{0x1a, 0xe2},
{0x37, 0xe8},
{0x16, 0x90},
{0x43, 0x00},
{0x40, 0xfb},
{0xa9, 0x44},
{0x2f, 0xec},
{0x35, 0x10},
{0x36, 0x10},
{0x0c, 0x00},
{0x0d, 0x00},
{0xd0, 0x93},
{0xdc, 0x2b},
{0xd9, 0x41},
{0xd3, 0x02},
{0x3d, 0x08},
{0x0c, 0x00},
{0x18, 0x2c},
{0x19, 0x24},
{0x1a, 0x71},
{0x9b, 0x69},
{0x9c, 0x7d},
{0x9d, 0x7d},
{0x9e, 0x69},
{0x35, 0x04},
{0x36, 0x04},
{0x65, 0x12},
{0x66, 0x20},
{0x67, 0x39},
{0x68, 0x4e},
{0x69, 0x62},
{0x6a, 0x74},
{0x6b, 0x85},
{0x6c, 0x92},
{0x6d, 0x9e},
{0x6e, 0xb2},
{0x6f, 0xc0},
{0x70, 0xcc},
{0x71, 0xe0},
{0x72, 0xee},
{0x73, 0xf6},
{0x74, 0x11},
{0xab, 0x20},
{0xac, 0x5b},
{0xad, 0x05},
{0xae, 0x1b},
{0xaf, 0x76},
{0xb0, 0x90},
{0xb1, 0x90},
{0xb2, 0x8c},
{0xb3, 0x04},
{0xb4, 0x98},
{0x4c, 0x03},
{0x4d, 0x30},
{0x4e, 0x02},
{0x4f, 0x5c},
{0x50, 0x56},
{0x51, 0x00},
{0x52, 0x66},
{0x53, 0x03},
{0x54, 0x30},
{0x55, 0x02},
{0x56, 0x5c},
{0x57, 0x40},
{0x58, 0x00},
{0x59, 0x66},
{0x5a, 0x03},
{0x5b, 0x20},
{0x5c, 0x02},
{0x5d, 0x5c},
{0x5e, 0x3a},
{0x5f, 0x00},
{0x60, 0x66},
{0x41, 0x1f},
{0xb5, 0x01},
{0xb6, 0x02},
{0xb9, 0x40},
{0xba, 0x28},
{0xbf, 0x0c},
{0xc0, 0x3e},
{0xa3, 0x0a},
{0xa4, 0x0f},
{0xa5, 0x09},
{0xa6, 0x16},
{0x9f, 0x0a},
{0xa0, 0x0f},
{0xa7, 0x0a},
{0xa8, 0x0f},
{0xa1, 0x10},
{0xa2, 0x04},
{0xa9, 0x04},
{0xaa, 0xa6},
{0x75, 0x6a},
{0x76, 0x11},
{0x77, 0x92},
{0x78, 0x21},
{0x79, 0xe1},
{0x7a, 0x02},
{0x7c, 0x05},
{0x7d, 0x08},
{0x7e, 0x08},
{0x7f, 0x7c},
{0x80, 0x58},
{0x81, 0x2a},
{0x82, 0xc5},
{0x83, 0x46},
{0x84, 0x3a},
{0x85, 0x54},
{0x86, 0x44},
{0x87, 0xf8},
{0x88, 0x08},
{0x89, 0x70},
{0x8a, 0xf0},
{0x8b, 0xf0},
{0x90, 0xe3},
{0x93, 0x10},
{0x94, 0x20},
{0x95, 0x10},
{0x96, 0x18},
{0x0f, 0x34},
{0x3d, 0x48},
{0x0e, 0xb8},
{0x20, 0x01},
{0x20, 0x01},
{0x20, 0x01},
{0x20, 0x01},
{0x20, 0x01},
{0x20, 0x01},
{0x20, 0x01},
{0x20, 0x01},
{0x21, 0x98},
{0x22, 0x00},
{0x23, 0x06},
{0x24, 0x32},
{0x25, 0x04},
{0x26, 0x25},
{0x27, 0x84},
{0x28, 0x40},
{0x29, 0x04},
{0x2a, 0xce},
{0x2b, 0x02},
{0x2c, 0x8a},
{0x12, 0x09},
{0x39, 0xd0},
{0xcd, 0x13},
{0xde, 0x7c},
{0x3d, 0x08},
{0x15, 0x42},
{0xde, 0x7c},
{0x0f, 0x24},
{0xFF, 0xFF}
};
const struct ov_reg ov2643_yuv_vga[]= {
{0x12, 0x80},
{0xc3, 0x1f},
{0xc4, 0xff},
{0x3d, 0x48},
{0xdd, 0xa5},
{0x0e, 0xb7},
{0x10, 0x0a},
{0x11, 0x00},
{0x0f, 0x14},
{0x21, 0x25},
{0x23, 0x0c},
{0x12, 0x08},
{0x39, 0x10},
{0xcd, 0x12},
{0x13, 0xff},
{0x14, 0xa7},
{0x15, 0x42},
{0x3c, 0xa4},
{0x18, 0x60},
{0x19, 0x50},
{0x1a, 0xe2},
{0x37, 0xe8},
{0x16, 0x90},
//{0x43, 0xC0},
{0x43, 0x00},
{0x40, 0xfb},
{0xa9, 0x44},
{0x2f, 0xec},
{0x35, 0x10},
{0x36, 0x10},
{0x0c, 0x00},
{0x0d, 0x00},
{0xd0, 0x93},
{0xdc, 0x2b},
{0xd9, 0x41},
{0xd3, 0x02},
{0x3d, 0x08},
{0x0c, 0x00},
{0x18, 0x2c},
{0x19, 0x24},
{0x1a, 0x71},
{0x9b, 0x69},
{0x9c, 0x7d},
{0x9d, 0x7d},
{0x9e, 0x69},
{0x35, 0x04},
{0x36, 0x04},
{0x65, 0x12},
{0x66, 0x20},
{0x67, 0x39},
{0x68, 0x4e},
{0x69, 0x62},
{0x6a, 0x74},
{0x6b, 0x85},
{0x6c, 0x92},
{0x6d, 0x9e},
{0x6e, 0xb2},
{0x6f, 0xc0},
{0x70, 0xcc},
{0x71, 0xe0},
{0x72, 0xee},
{0x73, 0xf6},
{0x74, 0x11},
{0xab, 0x20},
{0xac, 0x5b},
{0xad, 0x05},
{0xae, 0x1b},
{0xaf, 0x76},
{0xb0, 0x90},
{0xb1, 0x90},
{0xb2, 0x8c},
{0xb3, 0x04},
{0xb4, 0x98},
{0x4c, 0x03},
{0x4d, 0x30},
{0x4e, 0x02},
{0x4f, 0x5c},
{0x50, 0x56},
{0x51, 0x00},
{0x52, 0x66},
{0x53, 0x03},
{0x54, 0x30},
{0x55, 0x02},
{0x56, 0x5c},
{0x57, 0x40},
{0x58, 0x00},
{0x59, 0x66},
{0x5a, 0x03},
{0x5b, 0x20},
{0x5c, 0x02},
{0x5d, 0x5c},
{0x5e, 0x3a},
{0x5f, 0x00},
{0x60, 0x66},
{0x41, 0x1f},
{0xb5, 0x01},
{0xb6, 0x02},
{0xb9, 0x40},
{0xba, 0x28},
{0xbf, 0x0c},
{0xc0, 0x3e},
{0xa3, 0x0a},
{0xa4, 0x0f},
{0xa5, 0x09},
{0xa6, 0x16},
{0x9f, 0x0a},
{0xa0, 0x0f},
{0xa7, 0x0a},
{0xa8, 0x0f},
{0xa1, 0x10},
{0xa2, 0x04},
{0xa9, 0x04},
{0xaa, 0xa6},
{0x75, 0x6a},
{0x76, 0x11},
{0x77, 0x92},
{0x78, 0x21},
{0x79, 0xe1},
{0x7a, 0x02},
{0x7c, 0x05},
{0x7d, 0x08},
{0x7e, 0x08},
{0x7f, 0x7c},
{0x80, 0x58},
{0x81, 0x2a},
{0x82, 0xc5},
{0x83, 0x46},
{0x84, 0x3a},
{0x85, 0x54},
{0x86, 0x44},
{0x87, 0xf8},
{0x88, 0x08},
{0x89, 0x70},
{0x8a, 0xf0},
{0x8b, 0xf0},
{0x90, 0xe3},
{0x93, 0x10},
{0x94, 0x20},
{0x95, 0x10},
{0x96, 0x18},
{0x0f, 0x34},
{0x13, 0x00},
{0x3d, 0x48},
{0x0e, 0xb8},
{0x20, 0x02},
{0x21, 0x18},
{0x22, 0x00},
{0x23, 0x42},
{0x24, 0x28},
{0x25, 0x04},
{0x26, 0x1e},
{0x27, 0x04},
{0x28, 0x40},
{0x29, 0x04},
{0x2a, 0xce},
{0x2b, 0x02},
{0x2c, 0x8a},
//YUV
{0x12, 0x09},
//RGB
//{0x12, 0x05},
{0x39, 0xd0},
{0xcd, 0x13},
{0xde, 0x7c},
{0x3d, 0x08},
{0x13, 0xff},
{0x15, 0x42},
{0xFF, 0xFF}
};

View File

@ -0,0 +1,602 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2013, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*/
/*------------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*------------------------------------------------------------------------------
* Local Variables
*----------------------------------------------------------------------------*/
const struct ov_reg ov9740_yuv_vga[]={
//@@ VGA 640x360 bin YUV DVP 60FPS (Full speed)
{0x0103,0x01},
{0x3026,0x00},
{0x3027,0x00},
{0x3002,0xe8},
{0x3004,0x03},
{0x3005,0xff},
{0x3703,0x42},
{0x3704,0x10},
{0x3705,0x45},
{0x3603,0xaa},
{0x3632,0x27},
{0x3620,0x66},
{0x3621,0xc0},
{0x0202,0x03},
{0x0203,0x43},
{0x3833,0x04},
{0x3835,0x02},
{0x4702,0x04},
{0x4704,0x00},
{0x4706,0x08},
{0x3819,0x6e},
{0x3817,0x94},
{0x3a18,0x00},
{0x3a19,0x7f},
{0x5003,0xa7},
{0x3631,0x5e},
{0x3633,0x50},
{0x3630,0xd2},
{0x3604,0x0c},
{0x3601,0x40},
{0x3602,0x16},
{0x3610,0xa1},
{0x3612,0x24},
{0x034a,0x02},
{0x034b,0xd3},
{0x034c,0x02},
{0x034d,0x80},
{0x034e,0x01},
{0x034f,0x68},
{0x0202,0x01},
{0x0203,0x9e},
{0x381a,0x44},
{0x3707,0x14},
{0x3622,0x9f},
{0x5841,0x04},
{0x4002,0x45},
{0x5000,0x01},
{0x5001,0x00},
{0x3406,0x00},
{0x5000,0xff},
{0x5001,0xef},
{0x5003,0xff},
{0x4005,0x18},
{0x3503,0x10},
{0x3a11,0xa0},
{0x3a1b,0x50},
{0x3a0f,0x50},
{0x3a10,0x4c},
{0x3a1e,0x4c},
{0x3a1f,0x26},
{0x3104,0x20},
{0x0305,0x03},
{0x0307,0x5f},
{0x0303,0x01},
{0x0301,0x0a},
{0x3010,0x01},
{0x300c,0x02},
{0x0340,0x02},
{0x0341,0x08},
{0x0342,0x04},
{0x0343,0xc0},
{0x0101,0x01},
{0x3a08,0x01},
{0x3a09,0x38},
{0x3a0e,0x01},
{0x3a14,0x09},
{0x3a15,0xc0},
{0x3a0a,0x01},
{0x3a0b,0x02},
{0x3a0d,0x02},
{0x3a02,0x10},
{0x3a03,0x30},
{0x3c0a,0x9c},
{0x3c0b,0x3f},
{0x529a,0x1 },
{0x529b,0x2 },
{0x529c,0x3 },
{0x529d,0x5 },
{0x529e,0x5 },
{0x529f,0x28},
{0x52a0,0x32},
{0x52a2,0x0 },
{0x52a3,0x2 },
{0x52a4,0x0 },
{0x52a5,0x4 },
{0x52a6,0x0 },
{0x52a7,0x8 },
{0x52a8,0x0 },
{0x52a9,0x10},
{0x52aa,0x0 },
{0x52ab,0x38},
{0x52ac,0x0 },
{0x52ad,0x3c},
{0x52ae,0x0 },
{0x52af,0x4c},
{0x5842,0x02},
{0x5843,0x5e},
{0x5844,0x04},
{0x5845,0x32},
{0x5846,0x03},
{0x5847,0x29},
{0x5848,0x02},
{0x5849,0xcc},
{0x5800,0x22},
{0x5801,0x1e},
{0x5802,0x1a},
{0x5803,0x1a},
{0x5804,0x1f},
{0x5805,0x26},
{0x5806,0xe },
{0x5807,0x9 },
{0x5808,0x7 },
{0x5809,0x8 },
{0x580a,0xb },
{0x580b,0x11},
{0x580c,0x5 },
{0x580d,0x2 },
{0x580e,0x0 },
{0x580f,0x0 },
{0x5810,0x3 },
{0x5811,0x7 },
{0x5812,0x4 },
{0x5813,0x1 },
{0x5814,0x0 },
{0x5815,0x0 },
{0x5816,0x3 },
{0x5817,0x7 },
{0x5818,0xc },
{0x5819,0x8 },
{0x581a,0x6 },
{0x581b,0x6 },
{0x581c,0x9 },
{0x581d,0x10},
{0x581e,0x20},
{0x581f,0x1b},
{0x5820,0x17},
{0x5821,0x18},
{0x5822,0x1d},
{0x5823,0x23},
{0x5824,0x5b},
{0x5825,0x6e},
{0x5826,0x6e},
{0x5827,0x7e},
{0x5828,0xab},
{0x5829,0x5e},
{0x582a,0x8a},
{0x582b,0x8a},
{0x582c,0x8a},
{0x582d,0x9d},
{0x582e,0x5b},
{0x582f,0x88},
{0x5830,0x88},
{0x5831,0x98},
{0x5832,0x9a},
{0x5833,0x4e},
{0x5834,0x8a},
{0x5835,0x79},
{0x5836,0x7a},
{0x5837,0xad},
{0x5838,0x9b},
{0x5839,0x9d},
{0x583a,0xad},
{0x583b,0x8e},
{0x583c,0x5c},
{0x583e,0x08},
{0x583f,0x04},
{0x5840,0x10},
{0x5480,0x07},
{0x5481,0x16},
{0x5482,0x2c},
{0x5483,0x4d},
{0x5484,0x59},
{0x5485,0x64},
{0x5486,0x6e},
{0x5487,0x76},
{0x5488,0x7f},
{0x5489,0x86},
{0x548a,0x94},
{0x548b,0xa3},
{0x548c,0xba},
{0x548d,0xd2},
{0x548e,0xe9},
{0x548f,0x1e},
{0x5490,0x0f},
{0x5491,0xff},
{0x5492,0x0e},
{0x5493,0x34},
{0x5494,0x07},
{0x5495,0x1a},
{0x5496,0x04},
{0x5497,0x0e},
{0x5498,0x03},
{0x5499,0x82},
{0x549a,0x03},
{0x549b,0x20},
{0x549c,0x02},
{0x549d,0xd7},
{0x549e,0x02},
{0x549f,0xa5},
{0x54a0,0x02},
{0x54a1,0x75},
{0x54a2,0x02},
{0x54a3,0x55},
{0x54a4,0x02},
{0x54a5,0x1c},
{0x54a6,0x01},
{0x54a7,0xea},
{0x54a8,0x01},
{0x54a9,0xae},
{0x54aa,0x01},
{0x54ab,0x7c},
{0x54ac,0x01},
{0x54ad,0x57},
{0x5180,0xf0},
{0x5181,0x00},
{0x5182,0x41},
{0x5183,0x42},
{0x5184,0x8f},
{0x5185,0x63},
{0x5186,0xce},
{0x5187,0xa8},
{0x5188,0x17},
{0x5189,0x1f},
{0x518a,0x27},
{0x518b,0x41},
{0x518c,0x34},
{0x518d,0xf0},
{0x518e,0x10},
{0x518f,0xff},
{0x5190,0x00},
{0x5191,0xff},
{0x5192,0x00},
{0x5193,0xff},
{0x5194,0x00},
{0x5380,0x1 },
{0x5381,0x0 },
{0x5382,0x0 },
{0x5383,0x17},
{0x5384,0x0 },
{0x5385,0x1 },
{0x5386,0x0 },
{0x5387,0x0 },
{0x5388,0x0 },
{0x5389,0xad},
{0x538a,0x0 },
{0x538b,0x11},
{0x538c,0x0 },
{0x538d,0x0 },
{0x538e,0x0 },
{0x538f,0x7 },
{0x5390,0x0 },
{0x5391,0x80},
{0x5392,0x0 },
{0x5393,0xa0},
{0x5394,0x18},
{0x3c0a,0x9c},
{0x3c0b,0x3f},
{0x5501,0x14},
{0x5502,0x00},
{0x5503,0x40},
{0x5504,0x00},
{0x5505,0x80},
{0x0100,0x01},
{0xFF, 0xFF}
};
const struct ov_reg ov9740_yuv_sxga[]={
//@@ WXGA 1280x720 YUV DVP 15FPS for card reader
{0x0103, 0x01},
{0x3026, 0x00},
{0x3027, 0x00},
{0x3002, 0xe8},
{0x3004, 0x03},
{0x3005, 0xff},
{0x3406, 0x00},
{0x3603, 0xaa},
{0x3632, 0x27},
{0x3620, 0x66},
{0x3621, 0xc0},
{0x3631, 0x5e},
{0x3633, 0x50},
{0x3630, 0xd2},
{0x3604, 0x0c},
{0x3601, 0x40},
{0x3602, 0x16},
{0x3610, 0xa1},
{0x3612, 0x24},
{0x3622, 0x9f},
{0x3703, 0x42},
{0x3704, 0x10},
{0x3705, 0x45},
{0x3707, 0x14},
{0x3833, 0x04},
{0x3835, 0x03},
{0x3819, 0x6e},
{0x3817, 0x94},
{0x3503, 0x10},
{0x3a18, 0x00},
{0x3a19, 0x7f},
{0x3a11, 0xa0},
{0x3a1a, 0x05},
{0x3a1b, 0x50},
{0x3a0f, 0x50},
{0x3a10, 0x4c},
{0x3a1e, 0x4c},
{0x3a1f, 0x26},
{0x4002, 0x45},
{0x4005, 0x18},
{0x4702, 0x04},
{0x4704, 0x00},
{0x4706, 0x08},
{0x5000, 0xff},
{0x5001, 0xef},
{0x5003, 0xff},
{0x3104,0x20},
{0x0305,0x03},
{0x0307,0x4c},
{0x0303,0x01},
{0x0301,0x08},
{0x3010,0x01},
{0x300c,0x03},
{0x0340, 0x03},
{0x0341, 0x07},
{0x0342, 0x06},
{0x0343, 0x62},
{0x034b, 0xd1},
{0x034c, 0x05},
{0x034d, 0x00},
{0x034e, 0x02},
{0x034f, 0xd0},
{0x0101, 0x01},
{0x3a08, 0x00},
{0x3a09, 0xe8},
{0x3a0e, 0x03},
{0x3a14, 0x15},
{0x3a15, 0xc6},
{0x3a0a, 0x00},
{0x3a0b, 0xc0},
{0x3a0d, 0x04},
{0x3a02, 0x18},
{0x3a03, 0x20},
{0x3c0a, 0x9c},
{0x3c0b, 0x3f},
{0x529a, 0x1 },
{0x529b, 0x2 },
{0x529c, 0x3 },
{0x529d, 0x5 },
{0x529e, 0x5 },
{0x529f, 0x28},
{0x52a0, 0x32},
{0x52a2, 0x0 },
{0x52a3, 0x2 },
{0x52a4, 0x0 },
{0x52a5, 0x4 },
{0x52a6, 0x0 },
{0x52a7, 0x8 },
{0x52a8, 0x0 },
{0x52a9, 0x10},
{0x52aa, 0x0 },
{0x52ab, 0x38},
{0x52ac, 0x0 },
{0x52ad, 0x3c},
{0x52ae, 0x0 },
{0x52af, 0x4c},
{0x5842, 0x02},
{0x5843, 0x5e},
{0x5844, 0x04},
{0x5845, 0x32},
{0x5846, 0x03},
{0x5847, 0x29},
{0x5848, 0x02},
{0x5849, 0xcc},
{0x5800, 0x22},
{0x5801, 0x1e},
{0x5802, 0x1a},
{0x5803, 0x1a},
{0x5804, 0x1f},
{0x5805, 0x26},
{0x5806, 0xe },
{0x5807, 0x9 },
{0x5808, 0x7 },
{0x5809, 0x8 },
{0x580a, 0xb },
{0x580b, 0x11},
{0x580c, 0x5 },
{0x580d, 0x2 },
{0x580e, 0x0 },
{0x580f, 0x0 },
{0x5810, 0x3 },
{0x5811, 0x7 },
{0x5812, 0x4 },
{0x5813, 0x1 },
{0x5814, 0x0 },
{0x5815, 0x0 },
{0x5816, 0x3 },
{0x5817, 0x7 },
{0x5818, 0xc },
{0x5819, 0x8 },
{0x581a, 0x6 },
{0x581b, 0x6 },
{0x581c, 0x9 },
{0x581d, 0x10},
{0x581e, 0x20},
{0x581f, 0x1b},
{0x5820, 0x17},
{0x5821, 0x18},
{0x5822, 0x1d},
{0x5823, 0x23},
{0x5824, 0x5b},
{0x5825, 0x6e},
{0x5826, 0x6e},
{0x5827, 0x7e},
{0x5828, 0xab},
{0x5829, 0x5e},
{0x582a, 0x8a},
{0x582b, 0x8a},
{0x582c, 0x8a},
{0x582d, 0x9d},
{0x582e, 0x5b},
{0x582f, 0x88},
{0x5830, 0x88},
{0x5831, 0x98},
{0x5832, 0x9a},
{0x5833, 0x4e},
{0x5834, 0x8a},
{0x5835, 0x79},
{0x5836, 0x7a},
{0x5837, 0xad},
{0x5838, 0x9b},
{0x5839, 0x9d},
{0x583a, 0xad},
{0x583b, 0x8e},
{0x583c, 0x5c},
{0x583e, 0x08},
{0x583f, 0x04},
{0x5840, 0x10},
{0x5480, 0x07},
{0x5481, 0x16},
{0x5482, 0x2c},
{0x5483, 0x4d},
{0x5484, 0x59},
{0x5485, 0x64},
{0x5486, 0x6e},
{0x5487, 0x76},
{0x5488, 0x7f},
{0x5489, 0x86},
{0x548a, 0x94},
{0x548b, 0xa3},
{0x548c, 0xba},
{0x548d, 0xd2},
{0x548e, 0xe9},
{0x548f, 0x1e},
{0x5490, 0x0f},
{0x5491, 0xff},
{0x5492, 0x0e},
{0x5493, 0x34},
{0x5494, 0x07},
{0x5495, 0x1a},
{0x5496, 0x04},
{0x5497, 0x0e},
{0x5498, 0x03},
{0x5499, 0x82},
{0x549a, 0x03},
{0x549b, 0x20},
{0x549c, 0x02},
{0x549d, 0xd7},
{0x549e, 0x02},
{0x549f, 0xa5},
{0x54a0, 0x02},
{0x54a1, 0x75},
{0x54a2, 0x02},
{0x54a3, 0x55},
{0x54a4, 0x02},
{0x54a5, 0x1c},
{0x54a6, 0x01},
{0x54a7, 0xea},
{0x54a8, 0x01},
{0x54a9, 0xae},
{0x54aa, 0x01},
{0x54ab, 0x7c},
{0x54ac, 0x01},
{0x54ad, 0x57},
{0x5180, 0xf0},
{0x5181, 0x00},
{0x5182, 0x41},
{0x5183, 0x42},
{0x5184, 0x8f},
{0x5185, 0x63},
{0x5186, 0xce},
{0x5187, 0xa8},
{0x5188, 0x17},
{0x5189, 0x1f},
{0x518a, 0x27},
{0x518b, 0x41},
{0x518c, 0x34},
{0x518d, 0xf0},
{0x518e, 0x10},
{0x518f, 0xff},
{0x5190, 0x00},
{0x5191, 0xff},
{0x5192, 0x00},
{0x5193, 0xff},
{0x5194, 0x00},
{0x5380, 0x1 },
{0x5381, 0x0 },
{0x5382, 0x0 },
{0x5383, 0x17},
{0x5384, 0x0 },
{0x5385, 0x1 },
{0x5386, 0x0 },
{0x5387, 0x0 },
{0x5388, 0x0 },
{0x5389, 0xad},
{0x538a, 0x0 },
{0x538b, 0x11},
{0x538c, 0x0 },
{0x538d, 0x0 },
{0x538e, 0x0 },
{0x538f, 0x7 },
{0x5390, 0x0 },
{0x5391, 0x80},
{0x5392, 0x0 },
{0x5393, 0xa0},
{0x5394, 0x18},
{0x3c0a, 0x9c},
{0x3c0b, 0x3f},
{0x5501, 0x14},
{0x5502, 0x00},
{0x5503, 0x40},
{0x5504, 0x00},
{0x5505, 0x80},
{0x5308, 0x40},
{0x5309, 0x60},
{0x3a11, 0xd0},
{0x3a1b, 0x78},
{0x3a0f, 0x78},
{0x3a10, 0x68},
{0x3a1e, 0x68},
{0x3a1f, 0x40},
{0x0100, 0x01},
{0xFF, 0xFF}
};

View File

@ -0,0 +1,194 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Interface for Real Time Clock calibration (RTC) .
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
const RTC_PPMLookup PPM_Lookup[] =
{
/* Tmp PPM Neg Hi Correction */
{-40, -168 ,0, 1 ,22 },
{-39, -163 ,0, 1 ,23 },
{-38, -158 ,0, 1 ,24 },
{-37, -153 ,0, 1 ,25 },
{-36, -148 ,0, 1 ,25 },
{-35, -143 ,0, 1 ,26 },
{-34, -138 ,0, 1 ,27 },
{-33, -134 ,0, 1 ,28 },
{-32, -129 ,0, 1 ,29 },
{-31, -124 ,0, 1 ,31 },
{-30, -120 ,0, 1 ,32 },
{-29, -116 ,0, 1 ,33 },
{-28, -111 ,0, 1 ,34 },
{-27, -107 ,0, 1 ,36 },
{-26, -103 ,0, 1 ,37 },
{-25, -99, 0, 1 ,38 },
{-24, -95, 0, 1 ,40 },
{-23, -91, 0, 1 ,42 },
{-22, -87, 0, 1 ,44 },
{-21, -84, 0, 1 ,45 },
{-20, -80, 0, 1 ,48 },
{-19, -76, 0, 1 ,50 },
{-18, -73, 0, 1 ,53 },
{-17, -70, 0, 1 ,55 },
{-16, -66, 0, 1 ,58 },
{-15, -63, 0, 1 ,61 },
{-14, -60, 0, 1 ,64 },
{-13, -57, 0, 1 ,68 },
{-12, -54, 0, 1 ,71 },
{-11, -51, 0, 1 ,76 },
{-10, -48, 0, 1 ,80 },
{-9 ,-45 , 0, 1 ,86 },
{-8 ,-43 , 0, 1 ,90 },
{-7 ,-40 , 0, 1 ,97 },
{-6 ,-37 , 0, 1 ,105},
{-5 ,-35 , 0, 1 ,111},
{-4 ,-33 , 0, 1 ,117},
{-3 ,-30 , 0, 0 ,6 },
{-2 ,-28 , 0, 0 ,6 },
{-1 ,-26 , 0, 0 ,7 },
{0 ,-24 , 0, 0 ,7 },
{1 ,-22 , 0, 0 ,8 },
{2 ,-20 , 0, 0 ,9 },
{3 ,-18 , 0, 0 ,10 },
{4 ,-17 , 0, 0 ,10 },
{5 ,-15 , 0, 0 ,12 },
{6 ,-13 , 0, 0 ,14 },
{7 ,-12 , 0, 0 ,15 },
{8 ,-11 , 0, 0 ,17 },
{9 ,-9 , 0, 0 ,21 },
{10 ,-8 , 0, 0 ,23 },
{11 ,-7 , 0, 0 ,27 },
{12 ,-6 , 0, 0 ,32 },
{13 ,-5 , 0, 0 ,38 },
{14 ,-4 , 0, 0 ,48 },
{15 ,-3 , 0, 0 ,64 },
{16 ,-2 , 0, 0 ,97 },
{17 ,-2 , 0, 0 ,97 },
{18 ,-1 , 0, 0 ,127},
{19 ,0, 1, 0 ,0 },
{20 ,0, 1, 0 ,0 },
{21 ,0, 1, 0 ,0 },
{22 ,1, 1, 0 ,127},
{23 ,1, 1, 0 ,127},
{24 ,1, 1, 0 ,127},
{25 ,1, 1, 0 ,127},
{26 ,1, 1, 0 ,127},
{27 ,1, 1, 0 ,127},
{28 ,1, 1, 0 ,127},
{29 ,0, 1, 0 ,0 },
{30 ,0, 1, 0 ,0 },
{31 ,0, 1, 0 ,0 },
{32 ,-1, 0, 0 ,127},
{33 ,-2, 0, 0 ,97 },
{34 ,-2, 0, 0 ,97 },
{35 ,-3, 0, 0 ,64 },
{36 ,-4, 0, 0 ,48 },
{37 ,-5, 0, 0 ,38 },
{38 ,-6, 0, 0 ,32 },
{39 ,-7, 0, 0 ,27 },
{40 ,-8, 0, 0 ,23 },
{41 ,-9, 0, 0 ,21 },
{42 ,-11 , 0, 0 ,17 },
{43 ,-12 , 0, 0 ,15 },
{44 ,-13 , 0, 0 ,14 },
{45 ,-15 , 0, 0 ,12 },
{46 ,-17 , 0, 0 ,10 },
{47 ,-18 , 0, 0 ,10 },
{48 ,-20 , 0, 0 ,9 },
{49 ,-22 , 0, 0 ,8 },
{50 ,-24 , 0, 0 ,7 },
{51 ,-26 , 0, 0 ,7 },
{52 ,-28 , 0, 0 ,6 },
{53 ,-30 , 0, 0 ,6 },
{54 ,-33 , 0, 1 ,117},
{55 ,-35 , 0, 1 ,111},
{56 ,-37 , 0, 1 ,105},
{57 ,-40 , 0, 1 ,97 },
{58 ,-43 , 0, 1 ,90 },
{59 ,-45 , 0, 1 ,86 },
{60 ,-48 , 0, 1 ,80 },
{61 ,-51 , 0, 1 ,76 },
{62 ,-54 , 0, 1 ,71 },
{63 ,-57 , 0, 1 ,68 },
{64 ,-60 , 0, 1 ,64 },
{65 ,-63 , 0, 1 ,61 },
{66 ,-66 , 0, 1 ,58 },
{67 ,-70 , 0, 1 ,55 },
{68 ,-73 , 0, 1 ,53 },
{69 ,-76 , 0, 1 ,50 },
{70 ,-80 , 0, 1 ,48 },
{71 ,-84 , 0, 1 ,45 },
{72 ,-87 , 0, 1 ,44 },
{73 ,-91 , 0, 1 ,42 },
{74 ,-95 , 0, 1 ,40 },
{75 ,-99 , 0, 1 ,38 },
{76 ,-103 , 0, 1 ,37 },
{77 ,-107 , 0, 1 ,36 },
{78 ,-111 , 0, 1 ,34 },
{79 ,-116 , 0, 1 ,33 },
{80 ,-120 , 0, 1 ,32 },
{81 ,-124 , 0, 1 ,31 },
{82 ,-129 , 0, 1 ,29 },
{83 ,-134 , 0, 1 ,28 },
{84 ,-138 , 0, 1 ,27 },
{85 ,-143 , 0, 1 ,26 }
};
/**
* \brief RTC calibration for Temperature or PPM drift
*/
extern void RTC_ClockCalibration( Rtc* pRtc, int32_t CurrentTempr)
{
uint16_t i;
uint32_t MR_Reg, Size;
Size = sizeof(PPM_Lookup);
MR_Reg = 0;
for(i=0; i< Size; i++) {
if(PPM_Lookup[i].Tempr == CurrentTempr) {
MR_Reg |= RTC_MR_CORRECTION(PPM_Lookup[i].CORRECTION);
MR_Reg |= (PPM_Lookup[i].HIGHPPM << 15);
MR_Reg |= (PPM_Lookup[i].NEGPPM << 4);
pRtc->RTC_MR = MR_Reg; // update the calibration value
break;
}
}
}

View File

@ -0,0 +1,153 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2011, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file syscalls.c
*
* Implementation of newlib syscall.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
/*----------------------------------------------------------------------------
* Exported variables
*----------------------------------------------------------------------------*/
#undef errno
extern int errno;
extern int _sheap;
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
extern void _exit( int status );
extern void _kill( int pid, int sig );
extern int _getpid ( void );
extern caddr_t _sbrk ( int incr )
{
static unsigned char *heap = NULL;
unsigned char *prev_sheap;
if ( heap == NULL ) {
heap = (unsigned char *)&_sheap;
}
prev_sheap = heap;
heap += incr;
return (caddr_t) prev_sheap;
}
extern int link( char *old, char *new )
{
( void ) old;
( void ) new;
return -1;
}
extern int _close( int file )
{
( void ) file;
return -1;
}
extern int _fstat( int file, struct stat *st )
{
( void ) file;
st->st_mode = S_IFCHR;
return 0;
}
extern int _isatty( int file )
{
( void ) file;
return 1;
}
extern int _lseek( int file, int ptr, int dir )
{
( void ) file;
( void ) ptr;
( void ) dir;
return 0;
}
extern int _read(int file, char *ptr, int len)
{
( void ) file;
( void ) ptr;
( void ) len;
return 0;
}
extern int _write( int file, char *ptr, int len )
{
int iIndex;
( void ) file;
// for (; *ptr != 0; ptr++ )
for ( iIndex=0; iIndex < len; iIndex++, ptr++ ) {
DBG_PutChar( *ptr );
}
return iIndex;
}
extern void _exit( int status )
{
printf( "Exiting with status %d.\n", status );
for (;;);
}
extern void _kill( int pid, int sig )
{
( void ) pid;
( void ) sig;
return;
}
extern int _getpid ( void )
{
return -1;
}

View File

@ -0,0 +1,59 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2012, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/*------------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*------------------------------------------------------------------------------
* Internal variables
*----------------------------------------------------------------------------*/
/** Trace level can be set at applet initialization */
#if !defined(NOTRACE) && (DYN_TRACES == 1)
uint32_t dwTraceLevel = TRACE_LEVEL;
#endif
/**
* Initializes the U(S)ART Console
*
* \param dwBaudRate U(S)ART baud-rate.
* \param dwMCk Master clock frequency.
*/
extern void TRACE_CONFIGURE( uint32_t dwBaudRate, uint32_t dwMCk )
{
const Pin pinsUART0[] = { PINS_UART0 };
PIO_Configure( pinsUART0, PIO_LISTSIZE( pinsUART0 ) );
DBG_Configure( dwBaudRate, dwMCk );
}

View File

@ -0,0 +1,466 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
* ----------------------------------------------------------------------------
*/
/**
* \file
*
* Implementation WM8904 driver.
*
*/
/*----------------------------------------------------------------------------
* Headers
*----------------------------------------------------------------------------*/
#include "board.h"
/*----------------------------------------------------------------------------
* Type
*----------------------------------------------------------------------------*/
typedef struct {
uint16_t value;
uint8_t address;
}WM8904_PARA;
/*----------------------------------------------------------------------------
* Exported functions
*----------------------------------------------------------------------------*/
/**
* \brief Read data from WM8904 Register.
*
* \param pTwid Pointer to twi driver structure
* \param device Twi slave address.
* \param regAddr Register address to read.
* \return value in the given register.
*/
uint16_t WM8904_Read(Twid *pTwid,
uint32_t device,
uint32_t regAddr)
{
uint16_t bitsDataRegister;
uint8_t Tdata[2]={0,0};
TWID_Read(pTwid, device, regAddr, 1, Tdata, 2, 0);
bitsDataRegister = (Tdata[0] << 8) | Tdata[1];
return bitsDataRegister;
}
/**
* \brief Write data to WM8904 Register.
*
* \param pTwid Pointer to twi driver structure
* \param device Twi slave address.
* \param regAddr Register address to read.
* \param data Data to write
*/
void WM8904_Write(Twid *pTwid,
uint32_t device,
uint32_t regAddr,
uint16_t data)
{
uint8_t tmpData[2];
tmpData[0] = (data & 0xff00) >> 8;
tmpData[1] = data & 0xff;
TWID_Write(pTwid, device, regAddr, 1, tmpData, 2, 0);
}
static WM8904_PARA wm8904_access_slow[]=
{
{ 0x0000, 0}, /** R0 - SW Reset and ID */
{ 0x001A, 4}, /** R4 - Bias Control 0 */
{ 0x0047, 5}, /** R5 - VMID Control 0 */ /*insert_delay_ms 5*/
{ 0x0043, 5}, /** R5 - VMID Control 0 */
{ 0x000B, 4}, /** R4 - Bias Control 0 */
{ 0x0003, 0x0C}, /** R12 - Power Management 0 CC */
{ 0x0003, 0x0E}, /** R14 - Power Management 2 */
{ 0x000C, 0x12}, /** R18 - Power Management 6 */
{ 0x0000, 0x21}, /** R33 - DAC Digital 1 */
{ 0x0000, 0x3D}, /** R61 - Analogue OUT12 ZC */
{ 0x0001, 0x62}, /** R98 - Charge Pump 0 */
{ 0x0005, 0x68}, /** R104 - Class W 0 */
//FLL setting,32.768KHZ MCLK input,12.288M output.
{ 0x0000, 0x74}, /** R116 - FLL Control 1 */
{ 0x0704, 0x75}, /** R117 - FLL Control 2 */
{ 0x8000, 0x76}, /** R118 - FLL Control 3 */
{ 0x1760, 0x77}, /** R119 - FLL Control 4 */
{ 0x0005, 0x74}, /** R116 - FLL Control 1 */ /*insert_delay_ms 5*/
{ 0x0C05, 0x15}, /** R21 - Clock Rates 1 */
{ 0x845E, 0x14}, /** R20 - Clock Rates 0 */
{ 0x4006, 0x16}, /** R22 - Clock Rates 2 */
//WM8904 IIS master
//BCLK=12.288MHz/8=1.536MHz
//LRCK=1.536MHz/32=48KHz
//{ 0x0042, 0x18}, /** R24 - Audio Interface 0 */
{ 0x0042, 0x19}, /** R25 - Audio Interface 1 */
{ 0x00E8, 0x1A}, /** R26 - Audio Interface 2 */
{ 0x0820, 0x1B}, /** R27 - Audio Interface 3 */
////////////////ADC
{ 0x0003, 0x0C}, /** R12 - Power Management 0 */
{ 0x000F, 0x12}, /** R18 - Power Management 6 */ /*insert_delay_ms 5*/
{ 0x0010, 0x2C}, /** R44 - Analogue Left Input 0 */
{ 0x0010, 0x2D}, /** R45 - Analogue Right Input 0 */
{ 0x0044, 0x2E}, /** R46 - Analogue Left Input 1 */
{ 0x0044, 0x2F}, /** R47 - Analogue Right Input 1 */
{ 0x0011, 0x5A}, /** R90 - Analogue HP 0 */
{ 0x0033, 0x5A}, /** R90 - Analogue HP 0 */
{ 0x000F, 0x43}, /** R67 - DC Servo 0 */
{ 0x00F0, 0x44}, /** R68 - DC Servo 1 */ /*insert_delay_ms 100*/
{ 0x0077, 0x5A}, /** R90 - Analogue HP 0 */
{ 0x00FF, 0x5A}, /** R90 - Analogue HP 0 */
{ 0x00B9, 0x39}, /** R57 - Analogue OUT1 Left */
{ 0x00B9, 0x3A}, /** R58 - Analogue OUT1 Right */
};
static WM8904_PARA wm8904_access_main[] =
{
//{ 0x8904, 0}, /** R0 - SW Reset and ID */
//{ 0x0000, 1}, /** R1 - Revision */
//{ 0x0000, 2}, /** R2 */
//{ 0x0000, 3}, /** R3 */
{ 0x0019, 4}, /** R4 - Bias Control 0 */
{ 0x0043, 5}, /** R5 - VMID Control 0 */
//{ 0x0003, 6}, /** R6 - Mic Bias Control 0 */
//{ 0xC000, 7}, /** R7 - Mic Bias Control 1 */
//{ 0x001E, 8}, /** R8 - Analogue DAC 0 */
//{ 0xFFFF, 9}, /** R9 - mic Filter Control */
//{ 0x0001, 10}, /** R10 - Analogue ADC 0 */
//{ 0x0000, 11}, /** R11 */
{ 0x0003, 12}, /** R12 - Power Management 0 */
//{ 0x0000, 13}, /** R13 */
{ 0x0003, 14}, /** R14 - Power Management 2 */
//{ 0x0003, 15}, /** R15 - Power Management 3 */
//{ 0x0000, 16}, /** R16 */
//{ 0x0000, 17}, /** R17 */
{ 0x000F, 18}, /** R18 - Power Management 6 */
//{ 0x0000, 19}, /** R19 */
{ 0x845E, 20}, /** R20 - Clock Rates 0 */
//{ 0x3C07, 21}, /** R21 - Clock Rates 1 */
{ 0x0006, 22}, /** R22 - Clock Rates 2 */
//{ 0x0000, 23}, /** R23 */
//{ 0x1FFF, 24}, /** R24 - Audio Interface 0 */
{ 0x404A, 25}, /** R25 - Audio Interface 1 */
//{ 0x0004, 26}, /** R26 - Audio Interface 2 */
{ 0x0840, 27}, /** R27 - Audio Interface 3 */
//{ 0x0000, 28}, /** R28 */
//{ 0x0000, 29}, /** R29 */
//{ 0x00FF, 30}, /** R30 - DAC Digital Volume Left */
//{ 0x00FF, 31}, /** R31 - DAC Digital Volume Right */
//{ 0x0FFF, 32}, /** R32 - DAC Digital 0 */
{ 0x0000, 33}, /** R33 - DAC Digital 1 */
//{ 0x0000, 34}, /** R34 */
//{ 0x0000, 35}, /** R35 */
//{ 0x00FF, 36}, /** R36 - ADC Digital Volume Left */
//{ 0x00FF, 37}, /** R37 - ADC Digital Volume Right */
//{ 0x0073, 38}, /** R38 - ADC Digital 0 */
//{ 0x1800, 39}, /** R39 - Digital Microphone 0 */
//{ 0xDFEF, 40}, /** R40 - DRC 0 */
//{ 0xFFFF, 41}, /** R41 - DRC 1 */
//{ 0x003F, 42}, /** R42 - DRC 2 */
//{ 0x07FF, 43}, /** R43 - DRC 3 */
{ 0x0005, 44}, /** R44 - Analogue Left Input 0 */
{ 0x0005, 45}, /** R45 - Analogue Right Input 0 */
{ 0x0000, 46}, /** R46 - Analogue Left Input 1 */
{ 0x0000, 47}, /** R47 - Analogue Right Input 1 */
//{ 0x0000, 48}, /** R48 */
//{ 0x0000, 49}, /** R49 */
//{ 0x0000, 50}, /** R50 */
//{ 0x0000, 51}, /** R51 */
//{ 0x0000, 52}, /** R52 */
//{ 0x0000, 53}, /** R53 */
//{ 0x0000, 54}, /** R54 */
//{ 0x0000, 55}, /** R55 */
//{ 0x0000, 56}, /** R56 */
//{ 0x017F, 57}, /** R57 - Analogue OUT1 Left */
{ 0x00AD, 58}, /** R58 - Analogue OUT1 Right */
//{ 0x017F, 59}, /** R59 - Analogue OUT2 Left */
//{ 0x017F, 60}, /** R60 - Analogue OUT2 Right */
//{ 0x000F, 61}, /** R61 - Analogue OUT12 ZC */
//{ 0x0000, 62}, /** R62 */
//{ 0x0000, 63}, /** R63 */
//{ 0x0000, 64}, /** R64 */
//{ 0x0000, 65}, /** R65 */
//{ 0x0000, 66}, /** R66 */
{ 0x0003, 67}, /** R67 - DC Servo 0 */
//{ 0xFFFF, 68}, /** R68 - DC Servo 1 */
//{ 0x0F0F, 69}, /** R69 - DC Servo 2 */
//{ 0x0000, 70}, /** R70 */
//{ 0x007F, 71}, /** R71 - DC Servo 4 */
//{ 0x007F, 72}, /** R72 - DC Servo 5 */
//{ 0x00FF, 73}, /** R73 - DC Servo 6 */
//{ 0x00FF, 74}, /** R74 - DC Servo 7 */
//{ 0x00FF, 75}, /** R75 - DC Servo 8 */
//{ 0x00FF, 76}, /** R76 - DC Servo 9 */
//{ 0x0FFF, 77}, /** R77 - DC Servo Readback 0 */
//{ 0x0000, 78}, /** R78 */
//{ 0x0000, 79}, /** R79 */
//{ 0x0000, 80}, /** R80 */
//{ 0x0000, 81}, /** R81 */
//{ 0x0000, 82}, /** R82 */
//{ 0x0000, 83}, /** R83 */
//{ 0x0000, 84}, /** R84 */
//{ 0x0000, 85}, /** R85 */
//{ 0x0000, 86}, /** R86 */
//{ 0x0000, 87}, /** R87 */
//{ 0x0000, 88}, /** R88 */
//{ 0x0000, 89}, /** R89 */
{ 0x00FF, 90}, /** R90 - Analogue HP 0 */
//{ 0x0000, 91}, /** R91 */
//{ 0x0000, 92}, /** R92 */
//{ 0x0000, 93}, /** R93 */
//{ 0x00FF, 94}, /** R94 - Analogue Lineout 0 */
//{ 0x0000, 95}, /** R95 */
//{ 0x0000, 96}, /** R96 */
//{ 0x0000, 97}, /** R97 */
{ 0x0001, 98}, /** R98 - Charge Pump 0 */
//{ 0x0000, 99}, /** R99 */
//{ 0x0000, 100}, /** R100 */
//{ 0x0000, 101}, /** R101 */
//{ 0x0000, 102}, /** R102 */
//{ 0x0000, 103}, /** R103 */
{ 0x0005, 104}, /** R104 - Class W 0 */
//{ 0x0000, 105}, /** R105 */
//{ 0x0000, 106}, /** R106 */
//{ 0x0000, 107}, /** R107 */
//{ 0x011F, 108}, /** R108 - Write Sequencer 0 */
//{ 0x7FFF, 109}, /** R109 - Write Sequencer 1 */
//{ 0x4FFF, 110}, /** R110 - Write Sequencer 2 */
//{ 0x003F, 111}, /** R111 - Write Sequencer 3 */
//{ 0x03F1, 112}, /** R112 - Write Sequencer 4 */
//{ 0x0000, 113}, /** R113 */
//{ 0x0000, 114}, /** R114 */
//{ 0x0000, 115}, /** R115 */
{ 0x0004, 116}, /** R116 - FLL Control 1 */
{ 0x0704, 117}, /** R117 - FLL Control 2 */
{ 0x8000, 118}, /** R118 - FLL Control 3 */
{ 0x1760, 119}, /** R119 - FLL Control 4 */
//{ 0x001B, 120}, /** R120 - FLL Control 5 */
//{ 0x0014, 121}, /** R121 - GPIO Control 1 */
//{ 0x0010, 122}, /** R122 - GPIO Control 2 */
//{ 0x0010, 123}, /** R123 - GPIO Control 3 */
//{ 0x0000, 124}, /** R124 - GPIO Control 4 */
//{ 0x0000, 125}, /** R125 */
//{ 0x000A, 126}, /** R126 - Digital Pulls */
//{ 0x07FF, 127}, /** R127 - Interrupt Status */
//{ 0x03FF, 128}, /** R128 - Interrupt Status Mask */
//{ 0x03FF, 129}, /** R129 - Interrupt Polarity */
//{ 0x03FF, 130}, /** R130 - Interrupt Debounce */
//{ 0x0000, 131}, /** R131 */
//{ 0x0000, 132}, /** R132 */
//{ 0x0000, 133}, /** R133 */
//{ 0x0001, 134}, /** R134 - EQ1 */
//{ 0x001F, 135}, /** R135 - EQ2 */
//{ 0x001F, 136}, /** R136 - EQ3 */
//{ 0x001F, 137}, /** R137 - EQ4 */
//{ 0x001F, 138}, /** R138 - EQ5 */
//{ 0x001F, 139}, /** R139 - EQ6 */
//{ 0xFFFF, 140}, /** R140 - EQ7 */
//{ 0xFFFF, 141}, /** R141 - EQ8 */
//{ 0xFFFF, 142}, /** R142 - EQ9 */
//{ 0xFFFF, 143}, /** R143 - EQ10 */
//{ 0xFFFF, 144}, /** R144 - EQ11 */
//{ 0xFFFF, 145}, /** R145 - EQ12 */
//{ 0xFFFF, 146}, /** R146 - EQ13 */
//{ 0xFFFF, 147}, /** R147 - EQ14 */
//{ 0xFFFF, 148}, /** R148 - EQ15 */
//{ 0xFFFF, 149}, /** R149 - EQ16 */
//{ 0xFFFF, 150}, /** R150 - EQ17 */
//{ 0xFFFF, 151}, /** R151wm8523_dai - EQ18 */
//{ 0xFFFF, 152}, /** R152 - EQ19 */
//{ 0xFFFF, 153}, /** R153 - EQ20 */
//{ 0xFFFF, 154}, /** R154 - EQ21 */
//{ 0xFFFF, 155}, /** R155 - EQ22 */
//{ 0xFFFF, 156}, /** R156 - EQ23 */
//{ 0xFFFF, 157}, /** R157 - EQ24 */
//{ 0x0000, 158}, /** R158 */
//{ 0x0000, 159}, /** R159 */
//{ 0x0000, 160}, /** R160 */
//{ 0x0002, 161}, /** R161 - Control Interface Test 1 */
//{ 0x0000, 162}, /** R162 */
//{ 0x0000, 163}, /** R163 */
//{ 0x0000, 164}, /** R164 */
//{ 0x0000, 165}, /** R165 */
//{ 0x0000, 166}, /** R166 */
//{ 0x0000, 167}, /** R167 */
//{ 0x0000, 168}, /** R168 */
//{ 0x0000, 169}, /** R169 */
//{ 0x0000, 170}, /** R170 */
//{ 0x0000, 171}, /** R171 */
//{ 0x0000, 172}, /** R172 */
//{ 0x0000, 173}, /** R173 */
//{ 0x0000, 174}, /** R174 */
//{ 0x0000, 175}, /** R175 */
//{ 0x0000, 176}, /** R176 */
//{ 0x0000, 177}, /** R177 */
//{ 0x0000, 178}, /** R178 */
//{ 0x0000, 179}, /** R179 */
//{ 0x0000, 180}, /** R180 */
//{ 0x0000, 181}, /** R181 */
//{ 0x0000, 182}, /** R182 */
//{ 0x0000, 183}, /** R183 */
//{ 0x0000, 184}, /** R184 */
//{ 0x0000, 185}, /** R185 */
//{ 0x0000, 186}, /** R186 */
//{ 0x0000, 187}, /** R187 */
//{ 0x0000, 188}, /** R188 */
//{ 0x0000, 189}, /** R189 */
//{ 0x0000, 190}, /** R190 */
//{ 0x0000, 191}, /** R191 */
//{ 0x0000, 192}, /** R192 */
//{ 0x0000, 193}, /** R193 */
//{ 0x0000, 194}, /** R194 */
//{ 0x0000, 195}, /** R195 */
//{ 0x0000, 196}, /** R196 */
//{ 0x0000, 197}, /** R197 */
//{ 0x0000, 198}, /** R198 */
//{ 0x0000, 199}, /** R199 */
//{ 0x0000, 200}, /** R200 */
//{ 0x0000, 201}, /** R201 */
//{ 0x0000, 202}, /** R202 */
//{ 0x0000, 203}, /** R203 */
//{ 0x0070, 204}, /** R204 - Analogue Output Bias 0 */
//{ 0x0000, 205}, /** R205 */
//{ 0x0000, 206}, /** R206 */
//{ 0x0000, 207}, /** R207 */
//{ 0x0000, 208}, /** R208 */
//{ 0x0000, 209}, /** R209 */
//{ 0x0000, 210}, /** R210 */
//{ 0x0000, 211}, /** R211 */
//{ 0x0000, 212}, /** R212 */
//{ 0x0000, 213}, /** R213 */
//{ 0x0000, 214}, /** R214 */
//{ 0x0000, 215}, /** R215 */
//{ 0x0000, 216}, /** R216 */
//{ 0x0000, 217}, /** R217 */
//{ 0x0000, 218}, /** R218 */
//{ 0x0000, 219}, /** R219 */
//{ 0x0000, 220}, /** R220 */
//{ 0x0000, 221}, /** R221 */
//{ 0x0000, 222}, /** R222 */
//{ 0x0000, 223}, /** R223 */
//{ 0x0000, 224}, /** R224 */
//{ 0x0000, 225}, /** R225 */
//{ 0x0000, 226}, /** R226 */
//{ 0x0000, 227}, /** R227 */
//{ 0x0000, 228}, /** R228 */
//{ 0x0000, 229}, /** R229 */
//{ 0x0000, 230}, /** R230 */
//{ 0x0000, 231}, /** R231 */
//{ 0x0000, 232}, /** R232 */
//{ 0x0000, 233}, /** R233 */
//{ 0x0000, 234}, /** R234 */
//{ 0x0000, 235}, /** R235 */
//{ 0x0000, 236}, /** R236 */
//{ 0x0000, 237}, /** R237 */
//{ 0x0000, 238}, /** R238 */
//{ 0x0000, 239}, /** R239 */
//{ 0x0000, 240}, /** R240 */
//{ 0x0000, 241}, /** R241 */
//{ 0x0000, 242}, /** R242 */
//{ 0x0000, 243}, /** R243 */
//{ 0x0000, 244}, /** R244 */
//{ 0x0000, 245}, /** R245 */
//{ 0x0000, 246}, /** R246 */
//{ 0x0000, 247}, /** R247 - FLL NCO Test 0 */
//{ 0x0019, 248}, /** R248 - FLL NCO Test 1 */
{ 0x55AA, 255} /** end */
};
uint8_t WM8904_Init(Twid *pTwid, uint32_t device, uint32_t PCK)
{
uint8_t count, size;
uint16_t data = 0;
// Reset (write Reg@0x0 to reset)
WM8904_Write(pTwid, device, 0, 0xFFFF);
for(data=0;data<1000;data++);
//wait ready
while(data!=0x8904)
data=WM8904_Read(pTwid, device, 0);
if (PMC_MCKR_CSS_SLOW_CLK == PCK) {
size = sizeof(wm8904_access_slow) / 4 + 1;
for(count=0; count<size; count++) {
WM8904_Write(pTwid, device, wm8904_access_slow[count].address,
wm8904_access_slow[count].value);
if(((wm8904_access_slow[count].address==0x05)
&&(wm8904_access_slow[count].value==0x0047))
||((wm8904_access_slow[count].address==0x74)
&&(wm8904_access_slow[count].value==0x0005))
||((wm8904_access_slow[count].address==0x12)
&&(wm8904_access_slow[count].value==0x000F))) {
Wait(5);
}
if (((wm8904_access_slow[count].address==0x44)
&&(wm8904_access_slow[count].value==0x00F0))
||((wm8904_access_slow[count].address==0x3A)
&&(wm8904_access_slow[count].value==0x00B9))) {
Wait(100);
}
}
}
else if (PMC_MCKR_CSS_MAIN_CLK == PCK) {
for(count = 0; count < 255; count++) {
if(wm8904_access_main[count].address < 255) {
WM8904_Write(pTwid, device, wm8904_access_main[count].address,
wm8904_access_main[count].value);
} else {
break;
}
}
} else {
printf("W: PCK not supported! \n\r");
while(1);
}
return 0;
}
void WM8904_IN2R_IN1L(Twid *pTwid, uint32_t device)
{
//{ 0x0005, 44}, /** R44 - Analogue Left Input 0 */
//{ 0x0005, 45}, /** R45 - Analogue Right Input 0 */
//{ 0x0000, 46}, /** R46 - Analogue Left Input 1 */
//{ 0x0010, 47}, /** R47 - Analogue Right Input 1 */
WM8904_Write(pTwid, device, 0x2C, 0x0008);
WM8904_Write(pTwid, device, 0x2D, 0x0005);
WM8904_Write(pTwid, device, 0x2E, 0x0000);
WM8904_Write(pTwid, device, 0x2F, 0x0010);
}

View File

@ -0,0 +1,124 @@
/* ----------------------------------------------------------------------------
* SAM Software Package License
* ----------------------------------------------------------------------------
* Copyright (c) 2014, Atmel Corporation
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the disclaimer below.
*
* Atmel's name may not be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* DISCLAIMED. IN NO EVENT SHALL ATMEL 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 SAMS7_CHIP_H
#define SAMS7_CHIP_H
#include "compiler.h"
/*************************************************
* Memory type and its attribute
*************************************************/
#define SHAREABLE 1
#define NON_SHAREABLE 0
/*********************************************************************************************************************************************************************
* Memory Type Definition Memory TEX attribute C attribute B attribute S attribute
**********************************************************************************************************************************************************************/
#define STRONGLY_ORDERED_SHAREABLE_TYPE (( 0x00 << MPU_RASR_TEX_Pos ) | ( DISABLE << MPU_RASR_C_Pos ) | ( DISABLE << MPU_RASR_B_Pos )) // DO not care //
#define SHAREABLE_DEVICE_TYPE (( 0x00 << MPU_RASR_TEX_Pos ) | ( DISABLE << MPU_RASR_C_Pos ) | ( ENABLE << MPU_RASR_B_Pos )) // DO not care //
#define INNER_OUTER_NORMAL_WT_NWA_TYPE(x) (( 0x00 << MPU_RASR_TEX_Pos ) | ( ENABLE << MPU_RASR_C_Pos ) | ( DISABLE << MPU_RASR_B_Pos ) | ( x << MPU_RASR_S_Pos ))
#define INNER_OUTER_NORMAL_WB_NWA_TYPE(x) (( 0x00 << MPU_RASR_TEX_Pos ) | ( ENABLE << MPU_RASR_C_Pos ) | ( ENABLE << MPU_RASR_B_Pos ) | ( x << MPU_RASR_S_Pos ))
#define INNER_OUTER_NORMAL_NOCACHE_TYPE(x) (( 0x01 << MPU_RASR_TEX_Pos ) | ( DISABLE << MPU_RASR_C_Pos ) | ( DISABLE << MPU_RASR_B_Pos ) | ( x << MPU_RASR_S_Pos ))
#define INNER_OUTER_NORMAL_WB_RWA_TYPE(x) (( 0x01 << MPU_RASR_TEX_Pos ) | ( ENABLE << MPU_RASR_C_Pos ) | ( ENABLE << MPU_RASR_B_Pos ) | ( x << MPU_RASR_S_Pos ))
#define NON_SHAREABLE_DEVICE_TYPE (( 0x02 << MPU_RASR_TEX_Pos ) | ( DISABLE << MPU_RASR_C_Pos ) | ( DISABLE << MPU_RASR_B_Pos )) // DO not care //
/* Normal memory attributes with outer capability rules to Non_Cacable */
#define INNER_NORMAL_NOCACHE_TYPE(x) (( 0x04 << MPU_RASR_TEX_Pos ) | ( DISABLE << MPU_RASR_C_Pos ) | ( DISABLE << MPU_RASR_B_Pos ) | ( x << MPU_RASR_S_Pos ))
#define INNER_NORMAL_WB_RWA_TYPE(x) (( 0x04 << MPU_RASR_TEX_Pos ) | ( DISABLE << MPU_RASR_C_Pos ) | ( ENABLE << MPU_RASR_B_Pos ) | ( x << MPU_RASR_S_Pos ))
#define INNER_NORMAL_WT_NWA_TYPE(x) (( 0x04 << MPU_RASR_TEX_Pos ) | ( ENABLE << MPU_RASR_C_Pos ) | ( DISABLE << MPU_RASR_B_Pos ) | ( x << MPU_RASR_S_Pos ))
#define INNER_NORMAL_WB_NWA_TYPE(x) (( 0x04 << MPU_RASR_TEX_Pos ) | ( ENABLE << MPU_RASR_C_Pos ) | ( ENABLE << MPU_RASR_B_Pos ) | ( x << MPU_RASR_S_Pos ))
/* SCB Interrupt Control State Register Definitions */
#ifndef SCB_VTOR_TBLBASE_Pos
#define SCB_VTOR_TBLBASE_Pos 29 /*!< SCB VTOR: TBLBASE Position */
#define SCB_VTOR_TBLBASE_Msk (1UL << SCB_VTOR_TBLBASE_Pos) /*!< SCB VTOR: TBLBASE Mask */
#endif
/*
* Peripherals
*/
#include "include/acc.h"
#include "include/aes.h"
#include "include/afec.h"
#include "include/efc.h"
#include "include/pio.h"
#include "include/pio_it.h"
#include "include/efc.h"
#include "include/rstc.h"
#include "include/mpu.h"
#include "include/gmac.h"
#include "include/gmacd.h"
#include "include/video.h"
#include "include/icm.h"
#include "include/isi.h"
#include "include/exceptions.h"
#include "include/pio_capture.h"
#include "include/rtc.h"
#include "include/rtt.h"
#include "include/tc.h"
#include "include/timetick.h"
#include "include/twi.h"
#include "include/flashd.h"
#include "include/pmc.h"
#include "include/pwmc.h"
#include "include/mcan.h"
#include "include/supc.h"
#include "include/usart.h"
#include "include/uart.h"
#include "include/isi.h"
#include "include/hsmci.h"
#include "include/ssc.h"
#include "include/twi.h"
#include "include/trng.h"
#include "include/wdt.h"
#include "include/spi.h"
#include "include/qspi.h"
#include "include/trace.h"
#include "include/xdmac.h"
#include "include/xdma_hardware_interface.h"
#include "include/xdmad.h"
#include "include/mcid.h"
#include "include/twid.h"
#include "include/spi_dma.h"
#include "include/qspi_dma.h"
#include "include/uart_dma.h"
#include "include/usart_dma.h"
#include "include/twid.h"
#include "include/afe_dma.h"
#include "include/dac_dma.h"
#include "include/usbhs.h"
#define ENABLE_PERIPHERAL(dwId) PMC_EnablePeripheral( dwId )
#define DISABLE_PERIPHERAL(dwId) PMC_DisablePeripheral( dwId )
#endif /* SAMS7_CHIP_H */

Some files were not shown because too many files have changed in this diff Show More