mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2026-08-21 07:18:22 +08:00
Start of SAMA5D3 XPlained demo.
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_DDRAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_DDRAM_end__ = 0x20FFFFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x300000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x31FFFF;
|
||||
define symbol __ICFEDIT_region_DDRAM_BUF_start__ = 0x23000000;
|
||||
define symbol __ICFEDIT_region_DDRAM_BUF_end__ = 0x23FFFFFF;
|
||||
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_startup__ = 0x200;
|
||||
define symbol __ICFEDIT_size_vectors__ = 0x200;
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x4000;
|
||||
define symbol __ICFEDIT_size_sysstack__ = 0x60;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x60;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x0;
|
||||
/*-Exports-*/
|
||||
export symbol __ICFEDIT_region_DDRAM_start__;
|
||||
export symbol __ICFEDIT_region_DDRAM_end__;
|
||||
export symbol __ICFEDIT_region_RAM_start__;
|
||||
export symbol __ICFEDIT_region_RAM_end__;
|
||||
export symbol __ICFEDIT_size_startup__;
|
||||
export symbol __ICFEDIT_size_vectors__;
|
||||
export symbol __ICFEDIT_size_cstack__;
|
||||
export symbol __ICFEDIT_size_sysstack__;
|
||||
export symbol __ICFEDIT_size_irqstack__;
|
||||
export symbol __ICFEDIT_size_heap__;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region STA_region = mem:[from __ICFEDIT_region_DDRAM_start__ size __ICFEDIT_size_startup__];
|
||||
define region DDRAM_region = mem:[from __ICFEDIT_region_DDRAM_start__+__ICFEDIT_size_startup__ to __ICFEDIT_region_DDRAM_end__];
|
||||
define region VEC_region = mem:[from __ICFEDIT_region_RAM_start__ size __ICFEDIT_size_vectors__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__+__ICFEDIT_size_vectors__ to __ICFEDIT_region_RAM_end__];
|
||||
define region DMA_BUF_region = mem:[from __ICFEDIT_region_DDRAM_BUF_start__ to __ICFEDIT_region_DDRAM_BUF_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SYS_STACK with alignment = 8, size = __ICFEDIT_size_sysstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { section .vectors };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place in STA_region { section .cstartup };
|
||||
place in VEC_region { section .vectors };
|
||||
place in DDRAM_region { readonly };
|
||||
place in DDRAM_region { readwrite };
|
||||
place in DDRAM_region { zeroinit };
|
||||
place in DMA_BUF_region {section region_dma_nocache };
|
||||
place in DDRAM_region { block IRQ_STACK, block SYS_STACK, block CSTACK, block HEAP };
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x70000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x73FFFFFF;
|
||||
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x200;
|
||||
define symbol __ICFEDIT_size_svcstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_fiqstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_undstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_abtstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x0;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
|
||||
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
|
||||
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
//initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ {section .intvec };
|
||||
|
||||
place at start of RAM_region { block RamTop with fixed order {readonly, section LOWEND}};
|
||||
place at end of RAM_region { block RamBottom with fixed order {section HIGHSTART, readwrite, section .noinit,
|
||||
block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
|
||||
block UND_STACK, block ABT_STACK, block HEAP}};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/**** start of ICF editor section. ###ICF###*/
|
||||
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0000FFFF;
|
||||
define symbol __ICFEDIT_region_SRAM0_start__ = 0x00300000;
|
||||
define symbol __ICFEDIT_region_SRAM0_end__ = 0x0030FFFF;
|
||||
define symbol __ICFEDIT_region_SRAM1_start__ = 0x00310000;
|
||||
define symbol __ICFEDIT_region_SRAM1_end__ = 0x0031FFFF;
|
||||
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x1000;
|
||||
define symbol __ICFEDIT_size_svcstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_fiqstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_undstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_abtstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x400;
|
||||
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region SRAM0 = mem:[from __ICFEDIT_region_SRAM0_start__ to __ICFEDIT_region_SRAM0_end__];
|
||||
define region SRAM1 = mem:[from __ICFEDIT_region_SRAM1_start__ to __ICFEDIT_region_SRAM1_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
|
||||
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
|
||||
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .vectors };
|
||||
|
||||
place in ROM { readonly };
|
||||
place in SRAM0 { readwrite,
|
||||
block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
|
||||
block UND_STACK, block ABT_STACK, block HEAP };
|
||||
|
||||
define exported symbol fl_ram_end = (__ICFEDIT_region_SRAM0_end__ & 0xFFFFFFF8);
|
||||
@@ -0,0 +1,38 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x300000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x31FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_vectors__ = 0x100;
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_sysstack__ = 0x60;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x60;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x0;
|
||||
/*-Exports-*/
|
||||
export symbol __ICFEDIT_region_RAM_start__;
|
||||
export symbol __ICFEDIT_region_RAM_end__;
|
||||
export symbol __ICFEDIT_size_vectors__;
|
||||
export symbol __ICFEDIT_size_cstack__;
|
||||
export symbol __ICFEDIT_size_sysstack__;
|
||||
export symbol __ICFEDIT_size_irqstack__;
|
||||
export symbol __ICFEDIT_size_heap__;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region VEC_region = mem:[from __ICFEDIT_region_RAM_start__ size __ICFEDIT_size_vectors__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__+__ICFEDIT_size_vectors__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SYS_STACK with alignment = 8, size = __ICFEDIT_size_sysstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy with packing=none { readwrite };
|
||||
do not initialize { readonly section .noinit };
|
||||
|
||||
place in VEC_region { section .vectors };
|
||||
place in RAM_region { readonly };
|
||||
place in RAM_region { section .cstartup };
|
||||
place in RAM_region { readwrite, block IRQ_STACK, block SYS_STACK, block CSTACK, block HEAP };
|
||||
+684
File diff suppressed because it is too large
Load Diff
+55
@@ -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 for ADS7843 driver.
|
||||
*/
|
||||
|
||||
#ifndef _ADS7843_
|
||||
#define _ADS7843_
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern void ADS7843_Initialize( void ) ;
|
||||
|
||||
extern void ADS7843_Reset( void ) ;
|
||||
|
||||
extern void ADS7843_GetPosition( uint32_t *px_pos, uint32_t *py_pos ) ;
|
||||
|
||||
#endif /* #ifndef _ADS7843_H */
|
||||
+250
@@ -0,0 +1,250 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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
|
||||
*------------------------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* In case of IAR EWARM use, we define an empty macro to turn useless GCC and MDK __attribute__ keyword
|
||||
*/
|
||||
#if defined __ICCARM__ || defined __CC_ARM || defined __GNUC__
|
||||
# pragma pack( 1 )
|
||||
#endif
|
||||
|
||||
/** BMP (Windows) File Header Format */
|
||||
typedef struct _BMPFileHeader
|
||||
{
|
||||
/** 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;
|
||||
} BMPFileHeader;
|
||||
|
||||
/** BMP (Windows 2.x) Header */
|
||||
typedef struct _BMP2XHeader
|
||||
{
|
||||
/** size of this header in bytes */
|
||||
uint32_t size;
|
||||
/** image width in pixels */
|
||||
uint16_t width;
|
||||
/** image height in pixels */
|
||||
uint16_t height;
|
||||
/** number of color planes */
|
||||
uint16_t planes;
|
||||
/** number of bits per pixel */
|
||||
uint16_t bitsPerPixel;
|
||||
} BMP2XHeader;
|
||||
|
||||
/** BMP (Windows 3.x) Header, 40 bytes */
|
||||
typedef struct _BMP3XHeader
|
||||
{
|
||||
/** size of this header in bytes */
|
||||
uint32_t size;
|
||||
/** image width in pixels */
|
||||
int32_t width;
|
||||
/** image height in pixels */
|
||||
int32_t height;
|
||||
/** number of color planes */
|
||||
uint16_t planes;
|
||||
/** number of bits per pixel */
|
||||
uint16_t bitsPerPixel;
|
||||
/** Compression methods used */
|
||||
uint32_t compression;
|
||||
/** Size of bitmap in bytes */
|
||||
uint32_t sizeOfBitmap;
|
||||
/** horizontal resolution in pixels per meter */
|
||||
int32_t xResolution;
|
||||
/** vertical resolution in pixels per meter */
|
||||
int32_t yResolution;
|
||||
/** number of colors in the image */
|
||||
uint32_t colorsUsed;
|
||||
/** minimum number of important colors */
|
||||
uint32_t colorsImportant;
|
||||
} BMP3XHeader;
|
||||
|
||||
/** BMP (Windows 95, V4) Header, 108 bytes */
|
||||
typedef struct _BMP4Header
|
||||
{
|
||||
/** size of this header in bytes */
|
||||
uint32_t size;
|
||||
/** image width in pixels */
|
||||
int32_t width;
|
||||
/** image height in pixels */
|
||||
int32_t height;
|
||||
/** number of color planes */
|
||||
uint16_t planes;
|
||||
/** number of bits per pixel */
|
||||
uint16_t bitsPerPixel;
|
||||
/** Compression methods used */
|
||||
uint32_t compression;
|
||||
/** Size of bitmap in bytes */
|
||||
uint32_t sizeOfBitmap;
|
||||
/** horizontal resolution in pixels per meter */
|
||||
int32_t xResolution;
|
||||
/** vertical resolution in pixels per meter */
|
||||
int32_t yResolution;
|
||||
/** number of colors in the image */
|
||||
uint32_t colorsUsed;
|
||||
/** minimum number of important colors */
|
||||
uint32_t colorsImportant;
|
||||
|
||||
/** Mask identifying bits of red component */
|
||||
uint32_t redMask;
|
||||
/** Mask identifying bits of green component */
|
||||
uint32_t greenMask;
|
||||
/** Mask identifying bits of blue component */
|
||||
uint32_t blueMask;
|
||||
/** Mask identifying bits of alpha component */
|
||||
uint32_t alphaMask;
|
||||
/** Color space type */
|
||||
uint32_t csType;
|
||||
/** X coordinate of red endpoint */
|
||||
int32_t redX;
|
||||
/** Y coordinate of red endpoint */
|
||||
int32_t redY;
|
||||
/** Z coordinate of red endpoint */
|
||||
int32_t redZ;
|
||||
/** X coordinate of green endpoint */
|
||||
int32_t greenX;
|
||||
/** Y coordinate of green endpoint */
|
||||
int32_t greenY;
|
||||
/** Z coordinate of green endpoint */
|
||||
int32_t greenZ;
|
||||
/** X coordinate of blue endpoint */
|
||||
int32_t blueX;
|
||||
/** Y coordinate of blue endpoint */
|
||||
int32_t blueY;
|
||||
/** Z coordinate of blue endpoint */
|
||||
int32_t blueZ;
|
||||
/** Gamma red coordinate scale value */
|
||||
uint32_t gammaRed;
|
||||
/** Gamma green coordinate scale value */
|
||||
uint32_t gammaGreen;
|
||||
/** Gamma blue coordinate scale value */
|
||||
uint32_t gammaBlue;
|
||||
} BMP4Header;
|
||||
|
||||
/** 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 ; // GCC
|
||||
|
||||
#if defined __ICCARM__ || defined __CC_ARM || defined __GNUC__
|
||||
# pragma pack()
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* 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,
|
||||
unsigned char bpp);
|
||||
|
||||
extern void WriteBMPheader(uint32_t* pAddressHeader,
|
||||
uint32_t bmpHSize,
|
||||
uint32_t bmpVSize,
|
||||
uint8_t bmpRgb,
|
||||
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
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2009, 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 defaultSpuriousHandler( void );
|
||||
extern void defaultFiqHandler( void );
|
||||
extern void defaultIrqHandler( void );
|
||||
extern void LowLevelInit( void ) ;
|
||||
|
||||
#endif /* BOARD_LOWLEVEL_H */
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2009, 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
|
||||
|
||||
// Micron MT47H128M16 ?16 Meg x 16 x 8 banks = 256 MBytes
|
||||
// => 2 chips used => 512 MBytes
|
||||
// data bus = 32 bits => 16 Meg x 32 x 8 Banks => 256 Meg * 16 available
|
||||
|
||||
#define DDR2_MEM8SIZE 0x20000000
|
||||
#define DDR2_MEM16SIZE 0x10000000
|
||||
#define DDR2_MEM32SIZE 0x8000000
|
||||
|
||||
#define EXT_32_LPDDR2_8BANK_16_32_SOD200_SIZE 0x20000000
|
||||
|
||||
|
||||
|
||||
//void LPDDR2_AC_TIMING(LPDDR2 * st_ddr2, unsigned int f_base);
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern void BOARD_RemapRom( void );
|
||||
extern void BOARD_RemapRam( void );
|
||||
extern void BOARD_ConfigureVddMemSel(uint8_t VddMemSel) ;
|
||||
extern void BOARD_ConfigureDdram( uint8_t device );
|
||||
extern void BOARD_ConfigureSdram( void );
|
||||
extern void BOARD_ConfigureNandFlash( uint8_t busWidth ) ;
|
||||
extern void BOARD_ConfigureNorFlash( uint8_t busWidth ) ;
|
||||
extern void BOARD_ConfigureLpDdram(void);
|
||||
#endif /* #ifndef BOARD_MEMORIES_H */
|
||||
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 */
|
||||
/**
|
||||
* \ingroup lib_board
|
||||
* \addtogroup cand_module CAN Driver
|
||||
*
|
||||
* \section Purpose
|
||||
*
|
||||
* Implement driver functions for CAN operations.
|
||||
*
|
||||
* \section cand_usage Usage
|
||||
*
|
||||
* Uses following functions for CAN operations.
|
||||
* -# Uses CAND_Handler() as peripheral interrupt handler.
|
||||
* -# Uses CAND_Init() to initialize the driver and peripheral.
|
||||
* -# Uses CAND_Activate() to enable the CAN interface. Then check
|
||||
* CAND_IsReady() to find when CAN is synchronized for data transfer.
|
||||
* -# To send a CAN message you can:
|
||||
* -# Initialize mailbox with CAND_ResetMailbox()
|
||||
* -# Start data transfer with CAND_Transfer()
|
||||
* -# You can also start CAN message by:
|
||||
* -# Initialize transfer with CAND_ConfigureTransfer(). Several
|
||||
* transfers linked to different mailbox can be initialized.
|
||||
* -# After configuration, transfers can be enabled by
|
||||
* CAND_StartTransfers() at one time.
|
||||
* -# To check if the transfer is done, CAND_IsTransferDone() is used.
|
||||
*
|
||||
* The following structs should be instanced for driver operations.
|
||||
* -# \ref sCand : Driver instance struct.
|
||||
* -# \ref sCandMbCfg : Mailbox configuration parameters list.
|
||||
* -# \ref sCandTransfer : Message transfer operation parameters list.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CAND_H_
|
||||
#define _CAND_H_
|
||||
/**@{*/
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <chip.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** \addtogroup cand_rc CAN Driver Status (Return Codes)
|
||||
* @{*/
|
||||
/** Operation success */
|
||||
#define CAND_OK 0
|
||||
/** The driver/mailbox is busy */
|
||||
#define CAND_BUSY 1
|
||||
/** General error */
|
||||
#define CAND_ERROR 0x10
|
||||
/** Bad operation because of wrong state */
|
||||
#define CAND_ERR_STATE 0x11
|
||||
/** Bad operation for parameter error */
|
||||
#define CAND_ERR_PARAM 0xFE
|
||||
/** @}*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Types
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/* CAN Driver General callback */
|
||||
//typedef void(*CandCallback)(uint8_t bEvent, void* pArg);
|
||||
|
||||
/** CAN Driver Mailbox settings */
|
||||
typedef struct _CandMbCfg {
|
||||
uint32_t dwMsgMask; /**< Message ID Mask _MAMx */
|
||||
uint8_t bMsgType; /**< Message type */
|
||||
uint8_t bTxPriority; /**< Priority for TX */
|
||||
} sCandMbCfg;
|
||||
|
||||
/** CAN Driver Transfer Parameters */
|
||||
typedef struct _CandTransfer {
|
||||
//void* fCallback; /**< Callback function when transfer finished */
|
||||
//void* pArg; /**< Callback arguments */
|
||||
|
||||
uint32_t dwMsgID; /**< Message ID _MIDx */
|
||||
uint32_t msgData[2]; /**< Message data */
|
||||
uint8_t bMailbox; /**< Mailbox used */
|
||||
uint8_t bMsgLen; /**< Message length */
|
||||
uint8_t bState; /**< Transfer state */
|
||||
uint8_t bRC; /**< Transfer return code */
|
||||
} sCandTransfer;
|
||||
|
||||
/** CAN Driver Transfer callback */
|
||||
typedef void(*CandTransferCallback)(sCandTransfer* pXfr);
|
||||
|
||||
/**
|
||||
* CAN Driver instance struct.
|
||||
*/
|
||||
typedef struct _Cand {
|
||||
Can* pHw; /**< Pointer to HW register base */
|
||||
|
||||
//CandCallback fCallback; /**< Pointer to Callback function */
|
||||
//void* pArg; /**< Pointer to Callback argument */
|
||||
|
||||
sCandTransfer *pMbs[CAN_NUM_MAILBOX]; /**< Pointer list to mailboxes */
|
||||
|
||||
uint32_t dwMck; /**< MCK for baudrate calculating */
|
||||
uint16_t wBaudrate; /**< Current working baudrate */
|
||||
|
||||
uint8_t bID; /**< Peripheral ID */
|
||||
uint8_t bState; /**< CAN states */
|
||||
} sCand;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern uint8_t CAND_Init(sCand * pCand,
|
||||
Can * pHw,uint8_t bID,
|
||||
uint16_t wBaudrate,uint32_t dwMck);
|
||||
extern void CAND_Activate(sCand * pCand);
|
||||
extern void CAND_Sleep(sCand * pCand);
|
||||
extern uint8_t CAND_IsReady(sCand * pCand);
|
||||
extern void CAND_Handler(sCand * pCand);
|
||||
extern uint8_t CAND_IsMailboxReady(sCand * pCand,uint8_t bMb);
|
||||
extern void CAND_ResetMailbox(sCand * pCand,uint8_t bMb,sCandMbCfg * pCfg);
|
||||
extern uint8_t CAND_ConfigureTransfer(sCand * pCand,
|
||||
sCandMbCfg * pCfg,
|
||||
sCandTransfer * pXfr);
|
||||
extern uint8_t CAND_Transfer(sCand * pCand,sCandTransfer * pXfr);
|
||||
extern void CAND_StartTransfers(sCand * pCand,uint32_t bmMbs);
|
||||
extern uint8_t CAND_IsTransferDone(sCandTransfer * pXfr);
|
||||
/**@}*/
|
||||
#endif /* #ifndef _CAN_H_ */
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 _CLOCK_
|
||||
#define _CLOCK_
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern void CLOCK_SetConfig( uint8_t configuration ) ;
|
||||
|
||||
extern void CLOCK_DisplayMenu( void ) ;
|
||||
|
||||
extern void CLOCK_UserChangeConfig( void ) ;
|
||||
|
||||
extern uint16_t CLOCK_GetCurrMCK( void ) ;
|
||||
|
||||
extern uint16_t CLOCK_GetCurrPCK( void ) ;
|
||||
|
||||
#endif /* #ifndef _CLOCK_ */
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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
|
||||
*
|
||||
* Implements DBG utility that uses DBGU and System tick to get byte or binary
|
||||
* stream from DBGU console.
|
||||
*/
|
||||
|
||||
#ifndef _DBG_UTIL_
|
||||
#define _DBG_UTIL_
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Global functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern uint8_t DbgReceiveByte(uint8_t * pByte,uint32_t timeOut);
|
||||
|
||||
extern uint32_t DbgReceiveBinary(uint8_t start,
|
||||
uint32_t address,
|
||||
uint32_t maxSize);
|
||||
|
||||
extern uint32_t DbgReceive1KXModem(uint8_t * pktBuffer,
|
||||
uint32_t address,
|
||||
uint32_t maxSize);
|
||||
|
||||
#endif /* _DBG_UTIL_ */
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2009, 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 _DBGU_CONSOLE_
|
||||
#define _DBGU_CONSOLE_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** Console baudrate always using 115200. */
|
||||
#define CONSOLE_BAUDRATE 115200
|
||||
|
||||
extern void DBGU_ConsoleUseDBGU(void);
|
||||
extern void DBGU_ConsoleUseUSART0(void);
|
||||
extern void DBGU_ConsoleUseUSART1(void);
|
||||
|
||||
extern void DBGU_Configure( uint32_t dwBaudrate, uint32_t dwMasterClock ) ;
|
||||
extern void DBGU_PutChar( uint8_t uc ) ;
|
||||
extern uint32_t DBGU_GetChar( void ) ;
|
||||
extern uint32_t DBGU_IsRxReady( void ) ;
|
||||
|
||||
|
||||
extern void DBGU_DumpFrame( uint8_t* pucFrame, uint32_t dwSize ) ;
|
||||
extern void DBGU_DumpMemory( uint8_t* pucBuffer, uint32_t dwSize, uint32_t dwAddress ) ;
|
||||
extern uint32_t DBGU_GetInteger( uint32_t* pdwValue ) ;
|
||||
extern uint32_t DBGU_GetIntegerMinMax( uint32_t* pdwValue, uint32_t dwMin, uint32_t dwMax ) ;
|
||||
extern uint32_t DBGU_GetHexa32( uint32_t* pdwValue ) ;
|
||||
|
||||
#endif /* _DBGU_CONSOLE_ */
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* 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 _DMAD_IF_H
|
||||
#define _DMAD_IF_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Includes
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "board.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Types
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** DMA hardware interface */
|
||||
typedef struct _DmaHardwareInterface {
|
||||
uint8_t bDmac; /**< DMA Controller number */
|
||||
uint32_t bPeriphID; /**< Peripheral ID */
|
||||
uint8_t bTransfer; /**< Transfer type 0: Tx, 1 :Rx*/
|
||||
uint8_t bIfID; /**< DMA Interface ID */
|
||||
} DmaHardwareInterface;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern uint8_t DMAIF_IsValidatedPeripherOnDma( uint8_t bDmac, uint8_t bPeriphID);
|
||||
extern uint8_t DMAIF_Get_ChannelNumber (uint8_t bDmac, uint8_t bPeriphID, uint8_t bTransfer);
|
||||
|
||||
#endif //#ifndef _DMAD_IF_H
|
||||
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2010, 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 _DMAD_H
|
||||
#define _DMAD_H
|
||||
/** \addtogroup dmad_module
|
||||
*@{
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Includes
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "board.h"
|
||||
|
||||
/** \addtogroup dmad_defines DMA Driver Defines
|
||||
@{*/
|
||||
/*----------------------------------------------------------------------------
|
||||
* Consts
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define DMAD_TRANSFER_MEMORY 0xFF /**< DMA transfer from or to memory */
|
||||
#define DMAD_ALLOC_FAILED 0xFFFF /**< Channel allocate failed */
|
||||
|
||||
#define DMAD_TRANSFER_TX 0
|
||||
#define DMAD_TRANSFER_RX 1
|
||||
/*----------------------------------------------------------------------------
|
||||
* MACRO
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** @}*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Types
|
||||
*----------------------------------------------------------------------------*/
|
||||
/** \addtogroup dmad_structs DMA Driver Structs
|
||||
@{*/
|
||||
|
||||
/** DMA status or return code */
|
||||
typedef enum _DmadStatus {
|
||||
DMAD_OK = 0, /**< Operation is sucessful */
|
||||
DMAD_BUSY, /**< Channel occupied or transfer not finished */
|
||||
DMAD_PARTIAL_DONE, /**< Partial of LLI finished (on each buffer done) */
|
||||
DMAD_ERROR, /**< Operation failed */
|
||||
DMAD_CANCELED /**< Operation canceled */
|
||||
} eDmadStatus, eDmadRC;
|
||||
|
||||
/** DMA state for channel */
|
||||
typedef enum _DmadState {
|
||||
DMAD_FREE = 0, /**< Free channel */
|
||||
DMAD_IN_USE, /**< Allocated to some peripheral */
|
||||
DMAD_IN_XFR, /**< Transferring something */
|
||||
DMAD_STALL /**< Error stall */
|
||||
} eDmadState;
|
||||
|
||||
/** DMA transfer callback */
|
||||
typedef void (*DmadTransferCallback)(uint32_t status, void* pArg);
|
||||
|
||||
/** DMA driver channel */
|
||||
typedef struct _DmadChannel {
|
||||
DmadTransferCallback fCallback; /**< Callback */
|
||||
void* pArg; /**< Callback argument */
|
||||
|
||||
uint8_t bIrqOwner; /**< Uses DMA handler or external one */
|
||||
uint8_t bSrcPeriphID; /**< HW ID for source */
|
||||
uint8_t bDstPeriphID; /**< HW ID for destination */
|
||||
uint8_t bSrcTxIfID; /**< DMA Tx Interface ID for source */
|
||||
uint8_t bSrcRxIfID; /**< DMA Rx Interface ID for source */
|
||||
uint8_t bDstTxIfID; /**< DMA Tx Interface ID for destination */
|
||||
uint8_t bDstRxIfID; /**< DMA Rx Interface ID for destination */
|
||||
|
||||
volatile uint8_t state; /**< DMA channel state */
|
||||
} sDmadChannel;
|
||||
|
||||
#if 0
|
||||
/** DMA driver controller */
|
||||
typedef struct _DmadController {
|
||||
Dmac *pHw; /**< Pointer to controler HW base */
|
||||
sDmadChannel* dmadChannels; /**< Pointer to driver channels list */
|
||||
uint8_t* dmadIfUsage; /**< AHB Interface usage counting */
|
||||
uint8_t bHwID; /**< ID for DMAC */
|
||||
uint8_t bNumChannels; /**< Number of channels for this controller */
|
||||
uint8_t bNumAHBIf; /**< Number of AHB Interface */
|
||||
uint8_t reserved;
|
||||
} sDmadController;
|
||||
#endif
|
||||
|
||||
/** DMA driver instance */
|
||||
typedef struct _Dmad {
|
||||
Dmac *pDmacs[2];
|
||||
sDmadChannel dmaChannels[2][8];
|
||||
uint8_t numControllers;
|
||||
uint8_t numChannels;
|
||||
uint8_t pollingMode;
|
||||
uint8_t pollingTimeout;
|
||||
} sDmad;
|
||||
|
||||
/** DMA driver channel ID */
|
||||
typedef struct _DmadChannelID {
|
||||
uint8_t bDmac; /**< DMA Controller number */
|
||||
uint8_t bChannel; /**< Channel number */
|
||||
} sDmadChannelID;
|
||||
|
||||
/** @}*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
/** \addtogroup dmad_functions DMA Driver Functionos
|
||||
@{*/
|
||||
extern void DMAD_Initialize( sDmad *pDmad,
|
||||
uint8_t bPollingMode );
|
||||
|
||||
extern void DMAD_Handler( sDmad *pDmad );
|
||||
|
||||
extern uint32_t DMAD_AllocateChannel( sDmad *pDmad,
|
||||
uint8_t bSrcID, uint8_t bDstID);
|
||||
extern eDmadRC DMAD_FreeChannel( sDmad *pDmad, uint32_t dwChannel );
|
||||
|
||||
extern eDmadRC DMAD_SetCallback( sDmad *pDmad, uint32_t dwChannel,
|
||||
DmadTransferCallback fCallback, void* pArg );
|
||||
|
||||
extern eDmadRC DMAD_ConfigurePIP( sDmad *pDmad, uint32_t dwChannel,
|
||||
uint32_t dwSrcPIP, uint32_t dwDstPIP );
|
||||
|
||||
extern eDmadRC DMAD_PrepareChannel( sDmad *pDmad, uint32_t dwChannel,
|
||||
uint32_t dwCfg );
|
||||
|
||||
extern eDmadRC DMAD_IsTransferDone( sDmad *pDmad, uint32_t dwChannel );
|
||||
|
||||
extern eDmadRC DMAD_StartTransfer( sDmad *pDmad, uint32_t dwChannel );
|
||||
extern eDmadRC DMAD_StartTransfers( sDmad *pDmad,
|
||||
uint8_t bDmac, uint32_t bmChannels );
|
||||
|
||||
extern eDmadRC DMAD_StopTransfer( sDmad *pDmad, uint32_t dwChannel );
|
||||
extern void DMAD_ClearAuto( sDmad *pDmad, uint32_t _dwChannel );
|
||||
extern eDmadRC DMAD_PrepareSingleTransfer( sDmad *pDmad, uint32_t dwChannel,
|
||||
sDmaTransferDescriptor *pXfrDesc );
|
||||
|
||||
extern eDmadRC DMAD_PrepareMultiTransfer( sDmad *pDmad, uint32_t dwChannel,
|
||||
sDmaTransferDescriptor *pXfrDesc );
|
||||
/** @}*/
|
||||
/**@}*/
|
||||
#endif //#ifndef _DMAD_H
|
||||
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 */
|
||||
|
||||
/** \addtogroup emacd_module
|
||||
* @{
|
||||
* Implement EMAC data transfer and PHY management functions.
|
||||
*
|
||||
* \section Usage
|
||||
* -# Implement EMAC interrupt handler, which must invoke EMACD_Handler()
|
||||
* to handle EMAC interrupt events.
|
||||
* -# Implement sEmacd instance in application.
|
||||
* -# Initialize the instance with EMACD_Init() and EMACD_InitTransfer(),
|
||||
* so that EMAC data can be transmitted/received.
|
||||
* -# Some management callbacks can be set by EMACD_SetRxCallback()
|
||||
* and EMACD_SetTxWakeupCallback().
|
||||
* -# Send ethernet packets using EMACD_Send(), EMACD_TxLoad() is used
|
||||
* to check the free space in TX queue.
|
||||
* -# Check and obtain received ethernet packets via EMACD_Poll().
|
||||
*
|
||||
* \sa \ref macb_module, \ref emac_module
|
||||
*
|
||||
* Related files:\n
|
||||
* \ref emacd.c\n
|
||||
* \ref emacd.h.\n
|
||||
*
|
||||
* \defgroup emacd_defines EMAC Driver Defines
|
||||
* \defgroup emacd_types EMAC Driver Types
|
||||
* \defgroup emacd_functions EMAC Driver Functions
|
||||
*/
|
||||
/**@}*/
|
||||
|
||||
#ifndef _EMACD_H_
|
||||
#define _EMACD_H_
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Headers
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <board.h>
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*---------------------------------------------------------------------------*/
|
||||
/** \addtogroup emacd_defines
|
||||
@{*/
|
||||
|
||||
/** \addtogroup emacd_buf_size EMACD Default Buffer Size
|
||||
@{*/
|
||||
#define EMAC_RX_UNITSIZE 128 /**< Fixed size for RX buffer */
|
||||
#define EMAC_TX_UNITSIZE 1518 /**< Size for ETH frame length */
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup emacd_rc EMACD Return Codes
|
||||
@{*/
|
||||
#define EMACD_OK 0 /**< Operation OK */
|
||||
#define EMACD_TX_BUSY 1 /**< TX in progress */
|
||||
#define EMACD_RX_NULL 1 /**< No data received */
|
||||
/** Buffer size not enough */
|
||||
#define EMACD_SIZE_TOO_SMALL 2
|
||||
/** Parameter error, TX packet invalid or RX size too small */
|
||||
#define EMACD_PARAM 3
|
||||
/** Transter is not initialized */
|
||||
#define EMACD_NOT_INITIALIZED 4
|
||||
/** @}*/
|
||||
|
||||
/** @}*/
|
||||
/*---------------------------------------------------------------------------
|
||||
* Types
|
||||
*---------------------------------------------------------------------------*/
|
||||
/** \addtogroup emacd_types
|
||||
@{*/
|
||||
|
||||
/** RX callback */
|
||||
typedef void (*fEmacdTransferCallback)(uint32_t status);
|
||||
/** Wakeup callback */
|
||||
typedef void (*fEmacdWakeupCallback)(void);
|
||||
|
||||
/**
|
||||
* EMAC driver struct.
|
||||
*/
|
||||
typedef struct _EmacDriver {
|
||||
|
||||
/** Pointer to HW register base */
|
||||
Emac *pHw;
|
||||
|
||||
/** Pointer to allocated TX buffer
|
||||
Section 3.6 of AMBA 2.0 spec states that burst should not cross
|
||||
1K Boundaries.
|
||||
Receive buffer manager writes are burst of 2 words => 3 lsb bits
|
||||
of the address shall be set to 0
|
||||
*/
|
||||
uint8_t *pTxBuffer;
|
||||
/** Pointer to allocated RX buffer */
|
||||
uint8_t *pRxBuffer;
|
||||
|
||||
/** Pointer to Rx TDs (must be 8-byte aligned) */
|
||||
sEmacRxDescriptor *pRxD;
|
||||
/** Pointer to Tx TDs (must be 8-byte aligned) */
|
||||
sEmacTxDescriptor *pTxD;
|
||||
|
||||
/** Optional callback to be invoked once a frame has been received */
|
||||
fEmacdTransferCallback fRxCb;
|
||||
/** Optional callback to be invoked once several TD have been released */
|
||||
fEmacdWakeupCallback fWakupCb;
|
||||
/** Optional callback list to be invoked once TD has been processed */
|
||||
fEmacdTransferCallback *fTxCbList;
|
||||
|
||||
/** RX TD list size */
|
||||
uint16_t wRxListSize;
|
||||
/** RX index for current processing TD */
|
||||
uint16_t wRxI;
|
||||
|
||||
/** TX TD list size */
|
||||
uint16_t wTxListSize;
|
||||
/** Circular buffer head pointer by upper layer (buffer to be sent) */
|
||||
uint16_t wTxHead;
|
||||
/** Circular buffer tail pointer incremented by handlers (buffer sent) */
|
||||
uint16_t wTxTail;
|
||||
|
||||
/** Number of free TD before wakeup callback is invoked */
|
||||
uint8_t bWakeupThreshold;
|
||||
/** HW ID */
|
||||
uint8_t bId;
|
||||
} sEmacd;
|
||||
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup emacd_functions
|
||||
@{*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* PHY Exported functions
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* EMAC Exported functions
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
extern void EMACD_Init( sEmacd *pEmacd,
|
||||
Emac *pHw, uint8_t bID,
|
||||
uint8_t bCAF, uint8_t bNBC);
|
||||
|
||||
extern uint8_t EMACD_InitTransfer( sEmacd *pEmacd,
|
||||
uint8_t *pRxBuffer, sEmacRxDescriptor *pRxD,
|
||||
uint16_t wRxSize,
|
||||
uint8_t *pTxBuffer, sEmacTxDescriptor *pTxD, fEmacdTransferCallback *pTxCb,
|
||||
uint16_t wTxSize);
|
||||
|
||||
extern void EMACD_SetRxCallback( sEmacd *pEmacd, fEmacdTransferCallback fRxCb);
|
||||
|
||||
extern uint8_t EMACD_SetTxWakeupCallback( sEmacd *pEmacd,
|
||||
fEmacdWakeupCallback fWakeup,
|
||||
uint8_t bThreshold );
|
||||
|
||||
extern void EMACD_Handler( sEmacd *pEmacd );
|
||||
|
||||
extern void EMACD_Reset( sEmacd * pEmacd );
|
||||
|
||||
extern uint8_t EMACD_Send(sEmacd * pEmacd,
|
||||
void *pBuffer,
|
||||
uint32_t size,
|
||||
fEmacdTransferCallback fTxCallback);
|
||||
|
||||
extern uint32_t EMACD_TxLoad( sEmacd *pEmacd );
|
||||
|
||||
extern uint8_t EMACD_Poll(sEmacd * pEmacd,
|
||||
uint8_t *pFrame,
|
||||
uint32_t frameSize,
|
||||
uint32_t *pRcvSize);
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif // #ifndef _EMACD_H_
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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_H
|
||||
#define _GMACB_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 {
|
||||
sGmacd *pGmacd; /**< Driver */
|
||||
/** 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
|
||||
|
||||
+198
@@ -0,0 +1,198 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 gmacd_module
|
||||
* @{
|
||||
* Implement GMAC data transfer and PHY management functions.
|
||||
*
|
||||
* \section Usage
|
||||
* -# Implement GMAC interrupt handler, which must invoke GMACD_Handler()
|
||||
* to handle GMAC interrupt events.
|
||||
* -# Implement sGmacd instance in application.
|
||||
* -# Initialize the instance with GMACD_Init() and GMACD_InitTransfer(),
|
||||
* so that GMAC data can be transmitted/received.
|
||||
* -# Some management callbacks can be set by GMACD_SetRxCallback()
|
||||
* and GMACD_SetTxWakeupCallback().
|
||||
* -# Send ethernet packets using GMACD_Send(), GMACD_TxLoad() is used
|
||||
* to check the free space in TX queue.
|
||||
* -# Check and obtain received ethernet packets via GMACD_Poll().
|
||||
*
|
||||
* \sa \ref gmacb_module, \ref gmac_module
|
||||
*
|
||||
* Related files:\n
|
||||
* \ref gmacd.c\n
|
||||
* \ref gmacd.h.\n
|
||||
*
|
||||
* \defgroup gmacd_defines GMAC Driver Defines
|
||||
* \defgroup gmacd_types GMAC Driver Types
|
||||
* \defgroup gmacd_functions GMAC Driver Functions
|
||||
*/
|
||||
/**@}*/
|
||||
|
||||
#ifndef _GMACD_H_
|
||||
#define _GMACD_H_
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Headers
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <board.h>
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*---------------------------------------------------------------------------*/
|
||||
/** \addtogroup gmacd_defines
|
||||
@{*/
|
||||
|
||||
/** \addtogroup gmacd_buf_size GMACD Default Buffer Size
|
||||
@{*/
|
||||
#define GMAC_RX_UNITSIZE 128 /**< Fixed size for RX buffer */
|
||||
#define GMAC_TX_UNITSIZE 1518 /**< Size for ETH frame length */
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup gmacd_rc GMACD Return Codes
|
||||
@{*/
|
||||
#define GMACD_OK 0 /**< Operation OK */
|
||||
#define GMACD_TX_BUSY 1 /**< TX in progress */
|
||||
#define GMACD_RX_NULL 1 /**< No data received */
|
||||
/** Buffer size not enough */
|
||||
#define GMACD_SIZE_TOO_SMALL 2
|
||||
/** Parameter error, TX packet invalid or RX size too small */
|
||||
#define GMACD_PARAM 3
|
||||
/** Transter is not initialized */
|
||||
#define GMACD_NOT_INITIALIZED 4
|
||||
/** @}*/
|
||||
|
||||
/** @}*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Types
|
||||
*---------------------------------------------------------------------------*/
|
||||
/** \addtogroup gmacd_types
|
||||
@{*/
|
||||
|
||||
/** RX callback */
|
||||
typedef void (*fGmacdTransferCallback)(uint32_t status);
|
||||
/** Wakeup callback */
|
||||
typedef void (*fGmacdWakeupCallback)(void);
|
||||
|
||||
/**
|
||||
* GMAC driver struct.
|
||||
*/
|
||||
typedef struct _GmacDriver {
|
||||
|
||||
/** Pointer to HW register base */
|
||||
Gmac *pHw;
|
||||
|
||||
uint8_t *pTxBuffer;
|
||||
/** Pointer to allocated RX buffer */
|
||||
uint8_t *pRxBuffer;
|
||||
|
||||
/** Pointer to Rx TDs (must be 8-byte aligned) */
|
||||
sGmacRxDescriptor *pRxD;
|
||||
/** Pointer to Tx TDs (must be 8-byte aligned) */
|
||||
sGmacTxDescriptor *pTxD;
|
||||
|
||||
/** Optional callback to be invoked once a frame has been received */
|
||||
fGmacdTransferCallback fRxCb;
|
||||
/** Optional callback to be invoked once several TD have been released */
|
||||
fGmacdWakeupCallback fWakupCb;
|
||||
/** Optional callback list to be invoked once TD has been processed */
|
||||
fGmacdTransferCallback *fTxCbList;
|
||||
|
||||
/** RX TD list size */
|
||||
uint16_t wRxListSize;
|
||||
/** RX index for current processing TD */
|
||||
uint16_t wRxI;
|
||||
|
||||
/** TX TD list size */
|
||||
uint16_t wTxListSize;
|
||||
/** Circular buffer head pointer by upper layer (buffer to be sent) */
|
||||
uint16_t wTxHead;
|
||||
/** Circular buffer tail pointer incremented by handlers (buffer sent) */
|
||||
uint16_t wTxTail;
|
||||
|
||||
/** Number of free TD before wakeup callback is invoked */
|
||||
uint8_t bWakeupThreshold;
|
||||
/** HW ID */
|
||||
uint8_t bId;
|
||||
} sGmacd;
|
||||
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup gmacd_functions
|
||||
@{*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* GMAC Exported functions
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
extern void GMACD_Handler(sGmacd *pGmacd );
|
||||
|
||||
extern void GMACD_Init(sGmacd *pGmacd,
|
||||
Gmac *pHw,
|
||||
uint8_t bID,
|
||||
uint8_t enableCAF,
|
||||
uint8_t enableNBC );
|
||||
|
||||
extern uint8_t GMACD_InitTransfer( sGmacd *pGmacd,
|
||||
uint8_t *pRxBuffer,
|
||||
sGmacRxDescriptor *pRxD,
|
||||
uint16_t wRxSize,
|
||||
uint8_t *pTxBuffer,
|
||||
sGmacTxDescriptor *pTxD,
|
||||
fGmacdTransferCallback *pTxCb,
|
||||
uint16_t wTxSize);
|
||||
|
||||
extern void GMACD_Reset(sGmacd *pGmacd);
|
||||
|
||||
extern uint8_t GMACD_Send(sGmacd *pGmacd,
|
||||
void *pBuffer,
|
||||
uint32_t size,
|
||||
fGmacdTransferCallback fTxCb );
|
||||
|
||||
extern uint32_t GMACD_TxLoad(sGmacd *pGmacd);
|
||||
|
||||
extern uint8_t GMACD_Poll(sGmacd * pGmacd,
|
||||
uint8_t *pFrame,
|
||||
uint32_t frameSize,
|
||||
uint32_t *pRcvSize);
|
||||
|
||||
extern void GMACD_SetRxCallback(sGmacd * pGmacd, fGmacdTransferCallback fRxCb);
|
||||
|
||||
extern uint8_t GMACD_SetTxWakeupCallback(sGmacd * pGmacd,
|
||||
fGmacdWakeupCallback fWakeup,
|
||||
uint8_t bThreshold);
|
||||
|
||||
/** @}*/
|
||||
|
||||
#endif // #ifndef _GMACD_H_
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, 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 0 // Basic Mode Control Register
|
||||
#define GMII_BMSR 1 // Basic Mode Status Register
|
||||
#define GMII_PHYID1 2 // PHY Idendifier Register 1
|
||||
#define GMII_PHYID2 3 // PHY Idendifier Register 2
|
||||
#define GMII_ANAR 4 // Auto_Negotiation Advertisement Register
|
||||
#define GMII_ANLPAR 5 // Auto_negotiation Link Partner Ability Register
|
||||
#define GMII_ANER 6 // Auto-negotiation Expansion Register
|
||||
#define GMII_ANNPR 7 // Auto-negotiation Next Page Register
|
||||
#define GMII_ANLPNPAR 8 // Auto_negotiation Link Partner Next Page Ability Register
|
||||
#define GMII_1000BTCR 9 // 1000Base-T Control
|
||||
#define GMII_1000BTSR 10 // 1000Base-T Status
|
||||
#define GMII_ERCR 11 // Extend Register - Control Register
|
||||
#define GMII_ERDWR 12 // Extend Register - Data Write Register
|
||||
#define GMII_ERDRR 13 // Extend Register - Data Read Register
|
||||
//14 reserved
|
||||
#define GMII_EMSR 15 // Extend MII Status Register
|
||||
|
||||
//Vender Specific Register
|
||||
//16 reserved
|
||||
#define GMII_RLLMR 17 // Remote Loopback, LED Mode Register
|
||||
#define GMII_LMDCDR 18 // LinkND - Cable Diagnostic Register
|
||||
#define GMII_DPPSR 19 // Digital PMA/PCS Status
|
||||
//20 reserved
|
||||
#define GMII_RXERCR 21 // RXER Counter Register
|
||||
//22-26 reserved
|
||||
#define GMII_ICSR 27 // Interrupt Control/Status Register
|
||||
#define GMII_DDC1R 28 // Digital Debug Control 1 Register
|
||||
//29-30 reserved
|
||||
#define GMII_PHYCR 31 // PHY Control Register
|
||||
|
||||
//Extend Registers
|
||||
#define GMII_CCR 256 // Common Control Register
|
||||
#define GMII_SSR 257 // Strap Status Register
|
||||
#define GMII_OMSOR 258 // Operation Mode Strap Override Register
|
||||
#define GMII_OMSSR 259 // Operation Mode Strap Status Register
|
||||
#define GMII_RCCPSR 260 // RGMII Clock and Control Pad Skew Register
|
||||
#define GMII_RRDPSR 261 // RGMII RX Data Pad Skew Register
|
||||
#define GMII_ATR 263 // Analog Test Register
|
||||
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
// PHY ID Identifier Register
|
||||
// definitions: MII_PHYID1
|
||||
#define GMII_LSB_MASK 0x3F
|
||||
#define GMII_OUI_MSB 0x0022
|
||||
#define GMII_OUI_LSB 0x05
|
||||
|
||||
// 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 0x0001
|
||||
|
||||
// Auto-negotiation Expansion Register (ANER)
|
||||
// Bit definitions: MII_ANER
|
||||
// Reserved 15 to 5 // Read as 0, ignore on write
|
||||
#define GMII_PDF (1 << 4) // Local Device Parallel Detection Fault
|
||||
#define GMII_LP_NP_ABLE (1 << 3) // Link Partner Next Page Able
|
||||
#define GMII_NP_ABLE (1 << 2) // Local Device Next Page Able
|
||||
#define GMII_PAGE_RX (1 << 1) // New Page Received
|
||||
#define GMII_LP_AN_ABLE (1 << 0) // Link Partner Auto-negotiation Able
|
||||
|
||||
// GMII_1000BTCR
|
||||
#define GMII_1000BaseT_HALF_DUPLEX (1 << 8)
|
||||
#define GMII_1000BaseT_FULL_DUPLEX (1 << 9)
|
||||
#define GMII_MARSTER_SLAVE_ENABLE (1 << 12)
|
||||
#define GMII_MARSTER_SLAVE_CONFIG (1 << 11)
|
||||
#define GMII_PORT_TYPE (1 << 10)
|
||||
|
||||
// GMII_1000BTSR
|
||||
#define GMII_LINKP_1000BaseT_HALF_DUPLEX (1 << 10)
|
||||
#define GMII_LINKP_1000BaseT_FULL_DUPLEX (1 << 11)
|
||||
|
||||
// 1 master 0 slave
|
||||
#endif // #ifndef _MII_DEFINE_H
|
||||
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, 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 _HAMMING_
|
||||
#define _HAMMING_
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Defines
|
||||
*------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* These are the possible errors when trying to verify a block of data encoded
|
||||
* using a Hamming code:
|
||||
*
|
||||
* \section Errors
|
||||
* - Hamming_ERROR_SINGLEBIT
|
||||
* - Hamming_ERROR_ECC
|
||||
* - Hamming_ERROR_MULTIPLEBITS
|
||||
*/
|
||||
|
||||
/** A single bit was incorrect but has been recovered. */
|
||||
#define Hamming_ERROR_SINGLEBIT 1
|
||||
|
||||
/** The original code has been corrupted. */
|
||||
#define Hamming_ERROR_ECC 2
|
||||
|
||||
/** Multiple bits are incorrect in the data and they cannot be corrected. */
|
||||
#define Hamming_ERROR_MULTIPLEBITS 3
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*------------------------------------------------------------------------------*/
|
||||
|
||||
extern void Hamming_Compute256x( const uint8_t* pucData, uint32_t dwSize, uint8_t* pucCode ) ;
|
||||
|
||||
extern uint8_t Hamming_Verify256x( uint8_t* pucData, uint32_t dwSize, const uint8_t* pucCode ) ;
|
||||
|
||||
#endif /* _HAMMING_ */
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/** \page
|
||||
*
|
||||
* \section Purpose
|
||||
*
|
||||
* Definition of methods for ISO7816 driver.
|
||||
*
|
||||
* \section Usage
|
||||
*
|
||||
* -# ISO7816_Init
|
||||
* -# ISO7816_IccPowerOff
|
||||
* -# ISO7816_XfrBlockTPDU_T0
|
||||
* -# ISO7816_Escape
|
||||
* -# ISO7816_RestartClock
|
||||
* -# ISO7816_StopClock
|
||||
* -# ISO7816_toAPDU
|
||||
* -# ISO7816_Datablock_ATR
|
||||
* -# ISO7816_SetDataRateandClockFrequency
|
||||
* -# ISO7816_StatusReset
|
||||
* -# ISO7816_cold_reset
|
||||
* -# ISO7816_warm_reset
|
||||
* -# ISO7816_Decode_ATR
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ISO7816_4_H
|
||||
#define ISO7816_4_H
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Constants Definition
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** Size max of Answer To Reset */
|
||||
#define ATR_SIZE_MAX 55
|
||||
|
||||
/** NULL byte to restart byte procedure */
|
||||
#define ISO_NULL_VAL 0x60
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
extern void ISO7816_Init( const Pin pPinIso7816RstMC );
|
||||
extern void ISO7816_IccPowerOff(void);
|
||||
extern uint16_t ISO7816_XfrBlockTPDU_T0(const uint8_t *pAPDU,
|
||||
uint8_t *pMessage,
|
||||
uint16_t wLength );
|
||||
extern void ISO7816_Escape( void );
|
||||
extern void ISO7816_RestartClock(void);
|
||||
extern void ISO7816_StopClock( void );
|
||||
extern void ISO7816_toAPDU( void );
|
||||
extern void ISO7816_Datablock_ATR( uint8_t* pAtr, uint8_t* pLength );
|
||||
extern void ISO7816_SetDataRateandClockFrequency( uint32_t dwClockFrequency, uint32_t dwDataRate );
|
||||
extern uint8_t ISO7816_StatusReset( void );
|
||||
extern void ISO7816_cold_reset( void );
|
||||
extern void ISO7816_warm_reset( void );
|
||||
extern void ISO7816_Decode_ATR( uint8_t* pAtr );
|
||||
|
||||
#endif /* ISO7816_4_H */
|
||||
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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
|
||||
|
||||
#endif /* #define COLOR_H */
|
||||
+108
@@ -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 */
|
||||
|
||||
/** \addtogroup lcdd_draw Drawing On LCD
|
||||
*
|
||||
* Interface for drawing function on LCD.
|
||||
*
|
||||
* \note Before drawing, <b>canvas</b> should be selected via
|
||||
* LCDD_SelectCanvas(), or created by LCDD_CreateCanvas().
|
||||
*
|
||||
* Following functions can use:
|
||||
* - Simple drawing:
|
||||
* - LCDD_Fill()
|
||||
* - LCDD_DrawPixel()
|
||||
* - LCDD_ReadPixel()
|
||||
* - LCDD_DrawLine()
|
||||
* - LCDD_DrawRectangle(), LCDD_DrawFilledRectangle()
|
||||
* - LCDD_DrawCircle(), LCDD_DrawFilledCircle()
|
||||
* - LCDD_DrawImage()
|
||||
* - String related:
|
||||
* - LCDD_DrawString()
|
||||
* - LCDD_GetStringSize()
|
||||
*
|
||||
* \sa \ref lcdd_module, \ref lcdd_font
|
||||
*/
|
||||
|
||||
#ifndef DRAW_H
|
||||
#define DRAW_H
|
||||
/** \addtogroup lcdd_draw
|
||||
*@{
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "lcd_gimp_image.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
/** \addtogroup lcdd_draw_func LCD Drawing Functions */
|
||||
/** @{*/
|
||||
extern void LCDD_Fill0( void ) ;
|
||||
|
||||
extern void LCDD_Fill( uint32_t color ) ;
|
||||
|
||||
extern void LCDD_DrawPixel( uint32_t x, uint32_t y, uint32_t c ) ;
|
||||
|
||||
extern uint32_t LCDD_ReadPixel( uint32_t x, uint32_t y ) ;
|
||||
|
||||
extern void LCDD_DrawLine( uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2, uint32_t color ) ;
|
||||
|
||||
extern void LCDD_DrawRectangle( uint32_t dwX, uint32_t dwY, uint32_t dwWidth, uint32_t dwHeight, uint32_t dwColor ) ;
|
||||
|
||||
extern void LCDD_DrawFilledRectangle( uint32_t dwX1, uint32_t dwY1, uint32_t dwX2, uint32_t dwY2, uint32_t dwColor ) ;
|
||||
|
||||
extern void LCDD_DrawCircle( uint32_t x, uint32_t y, uint32_t r, uint32_t color ) ;
|
||||
extern void LCDD_DrawFilledCircle(uint32_t dwX,uint32_t dwY,uint32_t dwR,uint32_t dwColor);
|
||||
|
||||
extern void LCDD_DrawString( uint32_t x, uint32_t y, const char *pString, uint32_t color ) ;
|
||||
|
||||
extern void LCDD_DrawStringWithBGColor( uint32_t x, uint32_t y, const char *pString, uint32_t fontColor, uint32_t bgColor ) ;
|
||||
|
||||
extern void LCDD_GetStringSize( const char *pString, uint32_t *pWidth, uint32_t *pHeight ) ;
|
||||
|
||||
extern void LCDD_DrawImage( uint32_t x, uint32_t y, const uint8_t *pImage, uint32_t width, uint32_t height ) ;
|
||||
|
||||
void LCDD_DrawGIMPImage( uint32_t dwX, uint32_t dwY, const SGIMPImage* pGIMPImage, uint32_t dwWidth, uint32_t dwHeight ) ;
|
||||
|
||||
extern void LCDD_ClearWindow( uint32_t dwX, uint32_t dwY, uint32_t dwWidth, uint32_t dwHeight, uint32_t dwColor ) ;
|
||||
/** @}*/
|
||||
/**@}*/
|
||||
#endif /* #ifndef DRAW_H */
|
||||
|
||||
+108
@@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \addtogroup lcdd_font LCD Font Drawing
|
||||
*
|
||||
* \section Purpose
|
||||
*
|
||||
* The lcd_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.
|
||||
*
|
||||
* \note Before drawing fonts, <b>canvas</b> should be selected via
|
||||
* LCDD_SelectCanvas(), or created by LCDD_CreateCanvas().
|
||||
*
|
||||
* \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.
|
||||
* -# Select or create canvas via LCDD_SelectCanvas() or LCDD_CreateCanvas().
|
||||
* -# Use the LCDD_DrawString() method defined in draw.h to display a complete
|
||||
* string.
|
||||
*
|
||||
* \sa \ref lcdd_module, \ref lcdd_draw.
|
||||
*/
|
||||
|
||||
#ifndef _LCD_FONT_
|
||||
#define _LCD_FONT_
|
||||
/** \addtogroup lcdd_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
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern const Font gFont;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
/** \addtogroup lcdd_font_func Font Functions */
|
||||
/** @{*/
|
||||
|
||||
extern void LCDD_DrawChar( uint32_t x, uint32_t y, uint8_t c, uint32_t color ) ;
|
||||
|
||||
extern void LCDD_DrawCharWithBGColor( uint32_t x, uint32_t y, uint8_t c, uint32_t fontColor, uint32_t bgColor );
|
||||
/** @}*/
|
||||
/**@}*/
|
||||
#endif /* #ifndef LCD_FONT_ */
|
||||
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 */
|
||||
|
||||
/** \addtogroup lcdd_font
|
||||
* @{
|
||||
* \addtogroup font_10x14 Font 10x14
|
||||
*/
|
||||
/**@}*/
|
||||
|
||||
#ifndef _LCD_FONT_10x14_
|
||||
#define _LCD_FONT_10x14_
|
||||
/** \addtogroup font_10x14
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
extern const uint8_t pCharset10x14[] ;
|
||||
|
||||
/** @}*/
|
||||
#endif /* #ifdef _LCD_FONT_10x14_ */
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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_
|
||||
+194
@@ -0,0 +1,194 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 */
|
||||
|
||||
/**
|
||||
* \ingroup lib_board
|
||||
* \addtogroup lcdd_module LCD Driver
|
||||
*
|
||||
* \section Purpose
|
||||
*
|
||||
* Implement driver functions for LCD control and image display.
|
||||
* - Implement basic LCD controler configuration.
|
||||
* - Implement display functions for LCD layers.
|
||||
* - Implement simple drawing functions.
|
||||
* - Implement string display functions.
|
||||
*
|
||||
* \section lcdd_base_usage Usage
|
||||
*
|
||||
* Uses following functions for LCD basic configuration and displaying:
|
||||
* -# Uses LCDD_Initialize() to initialize the controller and LCD.
|
||||
* -# LCDD_On() and LCDD_Off() is used to turn LCD ON/OFF.
|
||||
* -# LCDD_SetBacklight() is used to change LCD backlight level.
|
||||
* -# To display a image (BMP format) on LCD, LCDD_ShowBMPRotated()
|
||||
* LCDD_ShowBMPScaled() and LCDD_ShowBMP() can be used.
|
||||
* -# To change configuration for an overlay layer, the following functions
|
||||
* can use:
|
||||
* -# LCDD_EnableLayer(), LCDD_IsLayerOn(): Turn ON/OFF layer, check status.
|
||||
* -# LCDD_SetPosition(), LCDD_SetPrioty(), LCDD_EnableAlpha(),
|
||||
* LCDD_SetAlpha(), LCDD_SetColorKeying(): Change display options.
|
||||
* -# Shortcuts for layer display are as following:
|
||||
* -# LCDD_ShowBase(), LCDD_StopBase()
|
||||
* -# LCDD_ShowOvr1(), LCDD_StopOvr1()
|
||||
* -# LCDD_ShowHeo(), LCDD_StopHeo()
|
||||
* -# LCDD_ShowHcr(), LCDD_StopHcr()
|
||||
* -# Drawing supporting fucntions, for drawing canvas:
|
||||
* -# LCDD_CreateCanvas(): Create blank canvas on specified layer for
|
||||
* drawing on
|
||||
* -# LCDD_SelectCanvas(): Select a displayer as canvas to drawing on
|
||||
* -# LCDD_GetCanvas(): Get current selected canvas layer
|
||||
*
|
||||
* For LCD drawing functions, refer to \ref lcdd_draw.
|
||||
*
|
||||
* For LCD string display, refer to \ref lcdd_font.
|
||||
*
|
||||
* @{
|
||||
* \defgroup lcdd_base LCD Driver General Operations
|
||||
* @{
|
||||
* Implementation of LCD driver, Include LCD initialization,
|
||||
* LCD on/off and LCD backlight control.
|
||||
*
|
||||
* \sa \ref lcdd_base_usage "LCD Driver General Usage"
|
||||
* @}
|
||||
* \defgroup lcdd_draw LCD Driver Simple Drawing
|
||||
* @{
|
||||
* @}
|
||||
* \defgroup lcdd_font LCD Driver Font Display
|
||||
* @{
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef LCDD_H
|
||||
#define LCDD_H
|
||||
/** \addtogroup lcdd_base
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Defines
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** \addtogroup lcdd_disp_id LCD display layers IDs
|
||||
* @{
|
||||
*/
|
||||
/** LCD controller ID, no display, configuration ONLY */
|
||||
#define LCDD_CONTROLLER 0
|
||||
/** LCD base layer, display fixed size image */
|
||||
#define LCDD_BASE 1
|
||||
/** LCD Overlay 1 */
|
||||
#define LCDD_OVR1 2
|
||||
/** LCD Overlay 2 */
|
||||
#define LCDD_OVR2 4
|
||||
/** LCD HighEndOverlay, support resize */
|
||||
#define LCDD_HEO 3
|
||||
/** LCD Cursor, max size 128x128 */
|
||||
#define LCDD_CUR 6
|
||||
/** @}*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Types
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** LCD display layer information */
|
||||
typedef struct _LcddLayer {
|
||||
void* pBuffer; /**< Display image buffer */
|
||||
uint16_t wImgW; /**< Display image width */
|
||||
uint16_t wImgH; /**< Display image height */
|
||||
uint8_t bMode; /**< Image bpp (16,24,32) for RGB mode */
|
||||
uint8_t bLayer; /**< Layer ID */
|
||||
} sLCDDLayer;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern void LCDD_Initialize(void);
|
||||
|
||||
extern void LCDD_On(void);
|
||||
extern void LCDD_Off(void);
|
||||
extern void LCDD_SetBacklight (uint32_t step);
|
||||
|
||||
extern void LCDD_EnableLayer(uint8_t bLayer,uint8_t bEnDis);
|
||||
extern uint8_t LCDD_IsLayerOn(uint8_t bLayer);
|
||||
extern void LCDD_SetPosition(uint8_t bLayer,uint32_t x,uint32_t y);
|
||||
extern void LCDD_SetPrioty(uint8_t bLayer,uint8_t bPri);
|
||||
extern uint8_t LCDD_GetPrioty(uint8_t bLayer);
|
||||
extern void LCDD_EnableAlpha(uint8_t bLayer,uint8_t bEnDisLA,uint8_t bEnDisGA);
|
||||
extern void LCDD_SetAlpha(uint8_t bLayer, uint8_t bReverse, uint8_t bAlpha);
|
||||
extern uint8_t LCDD_GetAlpha(uint8_t bLayer);
|
||||
extern void LCDD_SetColorKeying(uint8_t bLayer,
|
||||
uint8_t bDstSrc,
|
||||
uint32_t dwColor,uint32_t dwMask);
|
||||
extern void LCDD_DisableColorKeying(uint8_t bLayer);
|
||||
extern void LCDD_SetCLUT(uint8_t bLayer,
|
||||
uint32_t * pCLUT,
|
||||
uint8_t bpp,uint8_t nbColors);
|
||||
|
||||
extern void LCDD_Refresh(uint8_t bLayer);
|
||||
|
||||
extern void *LCDD_ShowBMPRotated(uint8_t bLayer,
|
||||
void * pBuffer,uint8_t bpp,
|
||||
uint32_t x,uint32_t y,int32_t w,int32_t h,
|
||||
uint32_t imgW,uint32_t imgH,
|
||||
int16_t wRotate);
|
||||
extern void *LCDD_ShowBMPScaled(uint8_t bLayer,
|
||||
void * pBuffer,uint8_t bpp,
|
||||
uint32_t x,uint32_t y,int32_t w,int32_t h,
|
||||
uint32_t imgW,uint32_t imgH);
|
||||
extern void *LCDD_ShowBMP(uint8_t bLayer,
|
||||
void * pBuffer,uint8_t bpp,
|
||||
uint32_t x,uint32_t y,int32_t w,int32_t h);
|
||||
|
||||
extern void *LCDD_ShowBase(void * pBuffer, uint8_t bpp, uint8_t bScanBottomUp);
|
||||
extern void LCDD_StopBase(void);
|
||||
|
||||
extern void *LCDD_ShowOvr1(void * pBuffer, uint8_t bpp,
|
||||
uint32_t x,uint32_t y,int32_t w,int32_t h);
|
||||
extern void LCDD_StopOvr1(void);
|
||||
|
||||
extern void *LCDD_ShowHeo(void * pBuffer, uint8_t bpp,
|
||||
uint32_t x,uint32_t y,int32_t w,int32_t h,
|
||||
uint32_t memW,uint32_t memH);
|
||||
extern void LCDD_StopHeo(void);
|
||||
|
||||
extern void *LCDD_ShowHcr(void * pBuffer, uint8_t bpp,
|
||||
uint32_t x,uint32_t y,int32_t w,int32_t h);
|
||||
extern void LCDD_StopHcr(void);
|
||||
|
||||
extern sLCDDLayer *LCDD_GetCanvas(void);
|
||||
extern uint8_t LCDD_SelectCanvas(uint8_t bLayer);
|
||||
extern void *LCDD_CreateCanvas(uint8_t bLayer,
|
||||
void * pBuffer,uint8_t bBPP,
|
||||
uint16_t wX,uint16_t wY,uint16_t wW,uint16_t wH);
|
||||
extern void LCDD_Flush_CurrentCanvas(void);
|
||||
/** @}*/
|
||||
#endif /* #ifndef LCDD_H */
|
||||
|
||||
+72
@@ -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>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Global 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 */
|
||||
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 */
|
||||
|
||||
/** \addtogroup macb_module Ethernet MACB Driver
|
||||
*@{
|
||||
* Implement EMAC PHY driver, that initialize the PHY to prepare for
|
||||
* ethernet transfer.
|
||||
*
|
||||
* \section Usage
|
||||
* -# EMAC related pins and Driver should be initialized at first.
|
||||
* -# MAC address is set via EMAC_SetAddress().
|
||||
* -# Initialize MACB Driver instance by invoking MACB_Init().
|
||||
* -# Initialize PHY connected via MACB_InitPhy(), PHY address is
|
||||
* automatically adjusted by attempt to read.
|
||||
* -# Perform PHY auto negotiate through MACB_AutoNegotiate(), so
|
||||
* connection established.
|
||||
* -# Setup link speed by MACB_GetLinkSpeed() so link speed and
|
||||
* duplex mode is desided.
|
||||
* -# Now its time to send/receive ethernet packets via EMAC Driver
|
||||
* - EMACD_Poll(): Polling received packets.
|
||||
* - EMACD_Send(): Send a packet.
|
||||
*
|
||||
* \sa \ref emacd_module
|
||||
*
|
||||
* Related files:\n
|
||||
* \ref macb.h\n
|
||||
* \ref macb.c\n
|
||||
* \ref mii.h.\n
|
||||
*
|
||||
* \defgroup eth_phy_mii MII/RMII Mode for PHY connection
|
||||
* \defgroup macb_defines MACB Defines
|
||||
* \defgroup macb_structs MACB Structs
|
||||
* \defgroup macb_functions MACB Functions
|
||||
*/
|
||||
/**@}*/
|
||||
|
||||
#ifndef _MACB_H
|
||||
#define _MACB_H
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Headers
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#include <board.h>
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*---------------------------------------------------------------------------*/
|
||||
/** \addtogroup macb_defines
|
||||
@{*/
|
||||
|
||||
/** The reset length setting for external reset configuration */
|
||||
#define MACB_RESET_LENGTH 0xD
|
||||
|
||||
/** @}*/
|
||||
/*---------------------------------------------------------------------------
|
||||
* Types
|
||||
*---------------------------------------------------------------------------*/
|
||||
/** \addtogroup macb_structs
|
||||
@{*/
|
||||
|
||||
/** The DM9161 instance */
|
||||
typedef struct _Macb {
|
||||
sEmacd *pEmacd; /**< Driver */
|
||||
uint32_t retryMax; /**< The retry & timeout settings */
|
||||
uint8_t phyAddress; /**< PHY address ( pre-defined by pins on reset ) */
|
||||
uint8_t speed; /**< 100M/10M speed */
|
||||
uint8_t fullDuplex; /**< Full duplex mode */
|
||||
uint8_t RMII; /**< RMII/MII mode */
|
||||
} Macb;
|
||||
|
||||
/** @}*/
|
||||
/*---------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*---------------------------------------------------------------------------*/
|
||||
/** \addtogroup macb_functions
|
||||
@{*/
|
||||
|
||||
extern void MACB_SetupTimeout(Macb *pMacb, uint32_t toMax);
|
||||
|
||||
extern void MACB_Init(Macb *pMacb, sEmacd *pEmacd, uint8_t phyAddress);
|
||||
|
||||
extern uint8_t MACB_InitPhy(Macb *pMacb,
|
||||
uint32_t mck,
|
||||
const Pin *pResetPins,
|
||||
uint32_t nbResetPins,
|
||||
const Pin *pEmacPins,
|
||||
uint32_t nbEmacPins);
|
||||
|
||||
extern uint8_t MACB_FindValidPhy(Macb * pMacb,uint8_t addrStart);
|
||||
|
||||
extern uint8_t MACB_ResetPhy(Macb * pMacb);
|
||||
|
||||
extern uint8_t MACB_AutoNegotiate(Macb *pMacb, uint8_t rmiiMode);
|
||||
|
||||
extern uint8_t MACB_GetLinkSpeed(Macb *pMacb,
|
||||
uint8_t applySettings);
|
||||
|
||||
extern void MACB_DumpRegisters(Macb * pMacb);
|
||||
|
||||
/** @}*/
|
||||
#endif // #ifndef _MACB_H
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* 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 _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_ */
|
||||
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 */
|
||||
|
||||
/**
|
||||
* \ingroup sdmmc_hal
|
||||
* \addtogroup mcid_module MCI Driver (HAL for SD/MMC Lib)
|
||||
*
|
||||
* \section Purpose
|
||||
*
|
||||
* This driver implements SD(IO)/MMC command operations and MCI configuration
|
||||
* routines to perform SD(IO)/MMC access. It's used for upper layer
|
||||
* (\ref libsdmmc_module "SD/MMC driver") to perform SD/MMC operations.
|
||||
*
|
||||
* \section Usage
|
||||
*
|
||||
* -# MCID_Init(): Initializes a MCI driver instance and the underlying
|
||||
* peripheral.
|
||||
* -# MCID_SendCmd(): Starts a MCI transfer which described by
|
||||
* \ref sSdmmcCommand.
|
||||
* -# MCID_CancelCmd(): Cancel a pending command.
|
||||
* -# MCID_IsCmdCompleted(): Check if MCI transfer is finished.
|
||||
* -# MCID_Handler(): Interrupt handler which is called by ISR handler.
|
||||
* -# MCID_IOCtrl(): IO control function to report HW attributes to upper
|
||||
* layer driver and modify HW settings (such as clock
|
||||
* frequency, High-speed support, etc. See
|
||||
* \ref sdmmc_ioctrls).
|
||||
*
|
||||
* \sa \ref dmad_module "DMA Driver", \ref hsmci_module "HSMCI",
|
||||
* \ref libsdmmc_module "SD/MMC Library"
|
||||
*
|
||||
* Related files:\n
|
||||
* \ref mcid.h\n
|
||||
* \ref mcid_dma.c.\n
|
||||
*/
|
||||
|
||||
#ifndef MCID_H
|
||||
#define MCID_H
|
||||
/** \addtogroup mcid_module
|
||||
*@{
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "chip.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
/** \addtogroup mcid_defines MCI Driver Defines
|
||||
* @{*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Constants
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** MCI States */
|
||||
#define MCID_IDLE 0 /**< Idle */
|
||||
#define MCID_LOCKED 1 /**< Locked for specific slot */
|
||||
#define MCID_CMD 2 /**< Processing the command */
|
||||
#define MCID_ERROR 3 /**< Command error */
|
||||
|
||||
/** MCI Initialize clock 400K Hz */
|
||||
#define MCI_INITIAL_SPEED 400000
|
||||
|
||||
/** @}*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Types
|
||||
*----------------------------------------------------------------------------*/
|
||||
/** \addtogroup mcid_structs MCI Driver Data Structs
|
||||
* @{
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief MCI Driver
|
||||
*/
|
||||
typedef struct _Mcid
|
||||
{
|
||||
/** Pointer to a MCI peripheral. */
|
||||
Hsmci *pMciHw;
|
||||
/** Pointer to a DMA driver */
|
||||
sDmad *pDmad;
|
||||
/** Pointer to currently executing command. */
|
||||
void *pCmd;
|
||||
/** MCK source, Hz */
|
||||
uint32_t dwMck;
|
||||
/** DMA transfer channel */
|
||||
uint32_t dwDmaCh;
|
||||
/** DMA transferred data index (bytes) */
|
||||
uint32_t dwXfrNdx;
|
||||
/** DMA transfer size (bytes) */
|
||||
uint32_t dwXSize;
|
||||
/** MCI peripheral identifier. */
|
||||
uint8_t bID;
|
||||
/** Polling mode */
|
||||
uint8_t bPolling;
|
||||
/** Reserved */
|
||||
uint8_t reserved;
|
||||
/** state. */
|
||||
volatile uint8_t bState;
|
||||
} sMcid;
|
||||
|
||||
/** @}*/
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
/** \addtogroup mcid_functions MCI Driver Functions
|
||||
@{*/
|
||||
extern void MCID_Init(sMcid * pMcid,
|
||||
Hsmci * pMci, uint8_t bID, uint32_t dwMck,
|
||||
sDmad * pDmad,
|
||||
uint8_t bPolling);
|
||||
|
||||
extern void MCID_Reset(sMcid * pMcid);
|
||||
|
||||
extern uint32_t MCID_Lock(sMcid * pMcid, uint8_t bSlot);
|
||||
|
||||
extern uint32_t MCID_Release(sMcid * pMcid);
|
||||
|
||||
extern void MCID_Handler(sMcid * pMcid);
|
||||
|
||||
extern uint32_t MCID_SendCmd(sMcid * pMcid, void * pCmd);
|
||||
|
||||
extern uint32_t MCID_CancelCmd(sMcid * pMcid);
|
||||
|
||||
extern uint32_t MCID_IsCmdCompleted(sMcid * pMcid);
|
||||
|
||||
extern uint32_t MCID_IOCtrl(sMcid * pMcid,uint32_t bCtl,uint32_t param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/** @}*/
|
||||
/**@}*/
|
||||
#endif //#ifndef HSMCID_H
|
||||
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 _MII_DEFINE_H
|
||||
#define _MII_DEFINE_H
|
||||
/** \addtogroup eth_phy_mii
|
||||
@{*/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
/** \addtogroup mii_registers PHY registers Addresses
|
||||
@{*/
|
||||
#define MII_BMCR 0 /**< Basic Mode Control Register */
|
||||
#define MII_BMSR 1 /**< Basic Mode Status Register */
|
||||
#define MII_PHYID1 2 /**< PHY Idendifier Register 1 */
|
||||
#define MII_PHYID2 3 /**< PHY Idendifier Register 2 */
|
||||
#define MII_ANAR 4 /**< Auto_Negotiation Advertisement Register */
|
||||
#define MII_ANLPAR 5 /**< Auto_negotiation Link Partner Ability Register */
|
||||
#define MII_ANER 6 /**< Auto-negotiation Expansion Register */
|
||||
#define MII_DSCR 16 /**< Specified Configuration Register */
|
||||
#define MII_DSCSR 17 /**< Specified Configuration and Status Register */
|
||||
#define MII_10BTCSR 18 /**< 10BASE-T Configuration and Satus Register */
|
||||
#define MII_PWDOR 19 /**< Power Down Control Register */
|
||||
#define MII_CONFIGR 20 /**< Specified config Register */
|
||||
#define MII_MDINTR 21 /**< Specified Interrupt Register */
|
||||
#define MII_RECR 22 /**< Specified Receive Error Counter Register */
|
||||
#define MII_DISCR 23 /**< Specified Disconnect Counter Register */
|
||||
#define MII_RLSR 24 /**< Hardware Reset Latch State Register */
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup phy_bmcr Basic Mode Control Register (BMCR, 0)
|
||||
List Bit definitions: \ref MII_BMCR
|
||||
@{*/
|
||||
#define MII_RESET (1ul << 15) /**< 1= Software Reset; 0=Normal Operation */
|
||||
#define MII_LOOPBACK (1ul << 14) /**< 1=loopback Enabled; 0=Normal Operation */
|
||||
#define MII_SPEED_SELECT (1ul << 13) /**< 1=100Mbps; 0=10Mbps */
|
||||
#define MII_AUTONEG (1ul << 12) /**< Auto-negotiation Enable */
|
||||
#define MII_POWER_DOWN (1ul << 11) /**< 1=Power down 0=Normal operation */
|
||||
#define MII_ISOLATE (1ul << 10) /**< 1 = Isolates 0 = Normal operation */
|
||||
#define MII_RESTART_AUTONEG (1ul << 9) /**< 1 = Restart auto-negotiation 0 = Normal operation */
|
||||
#define MII_DUPLEX_MODE (1ul << 8) /**< 1 = Full duplex operation 0 = Normal operation */
|
||||
#define MII_COLLISION_TEST (1ul << 7) /**< 1 = Collision test enabled 0 = Normal operation */
|
||||
/** Reserved bits: 6 to 0, Read as 0, ignore on write */
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup phy_bmsr Basic Mode Status Register (BMSR, 1)
|
||||
List Bit definitions: \ref MII_BMSR
|
||||
@{*/
|
||||
#define MII_100BASE_T4 (1ul << 15) /**< 100BASE-T4 Capable */
|
||||
#define MII_100BASE_TX_FD (1ul << 14) /**< 100BASE-TX Full Duplex Capable */
|
||||
#define MII_100BASE_T4_HD (1ul << 13) /**< 100BASE-TX Half Duplex Capable */
|
||||
#define MII_10BASE_T_FD (1ul << 12) /**< 10BASE-T Full Duplex Capable */
|
||||
#define MII_10BASE_T_HD (1ul << 11) /**< 10BASE-T Half Duplex Capable */
|
||||
/** Reserved bits: 10 to 7, Read as 0, ignore on write */
|
||||
#define MII_MF_PREAMB_SUPPR (1ul << 6) /**< MII Frame Preamble Suppression */
|
||||
#define MII_AUTONEG_COMP (1ul << 5) /**< Auto-negotiation Complete */
|
||||
#define MII_REMOTE_FAULT (1ul << 4) /**< Remote Fault */
|
||||
#define MII_AUTONEG_ABILITY (1ul << 3) /**< Auto Configuration Ability */
|
||||
#define MII_LINK_STATUS (1ul << 2) /**< Link Status */
|
||||
#define MII_JABBER_DETECT (1ul << 1) /**< Jabber Detect */
|
||||
#define MII_EXTEND_CAPAB (1ul << 0) /**< Extended Capability */
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup phy_id PHY ID Identifier Register (PHYID, 2,3)
|
||||
List definitions: \ref MII_PHYID1, \ref MII_PHYID2
|
||||
@{*/
|
||||
#define MII_LSB_MASK 0x3F /**< Mask for PHY ID LSB */
|
||||
|
||||
#if defined(BOARD_EMAC_PHY_COMP_DM9161)
|
||||
#define MII_OUI_MSB 0x0181
|
||||
#define MII_OUI_LSB 0x2E
|
||||
//#define MII_PHYID1_OUI 0x606E // OUI: Organizationally Unique Identifier
|
||||
//#define MII_ID 0x0181b8a0
|
||||
#elif defined(BOARD_EMAC_PHY_COMP_LAN8700)
|
||||
#define MII_OUI_MSB 0x0007
|
||||
#define MII_OUI_LSB 0x30
|
||||
#elif defined(BOARD_EMAC_PHY_COMP_KSZ8051RNL)
|
||||
#define MII_OUI_MSB 0x0022
|
||||
#define MII_OUI_LSB 0x05
|
||||
#else
|
||||
#error no PHY Ethernet component defined !
|
||||
#endif
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup phy_neg Auto-negotiation (ANAR, 4; ANLPAR, 5)
|
||||
- Auto-negotiation Advertisement Register (ANAR)
|
||||
- Auto-negotiation Link Partner Ability Register (ANLPAR)
|
||||
Lists Bit definitions: \ref MII_ANAR, \ref MII_ANLPAR
|
||||
@{*/
|
||||
#define MII_NP (1ul << 15) /**< Next page Indication */
|
||||
#define MII_ACK (1ul << 14) /**< Acknowledge */
|
||||
#define MII_RF (1ul << 13) /**< Remote Fault */
|
||||
/** Reserved: 12 to 11, Write as 0, ignore on read */
|
||||
#define MII_FCS (1ul << 10) /**< Flow Control Support */
|
||||
#define MII_T4 (1ul << 9) /**< 100BASE-T4 Support */
|
||||
#define MII_TX_FDX (1ul << 8) /**< 100BASE-TX Full Duplex Support */
|
||||
#define MII_TX_HDX (1ul << 7) /**< 100BASE-TX Support */
|
||||
#define MII_10_FDX (1ul << 6) /**< 10BASE-T Full Duplex Support */
|
||||
#define MII_10_HDX (1ul << 5) /**< 10BASE-T Support */
|
||||
/** Selector: 4 to 0, Protocol Selection Bits */
|
||||
#define MII_AN_IEEE_802_3 0x0001
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup phy_neg_exp Auto-negotiation Expansion Register (ANER, 6)
|
||||
List Bit definitions: \ref MII_ANER
|
||||
@{*/
|
||||
/** Reserved: 15 to 5, Read as 0, ignore on write */
|
||||
#define MII_PDF (1ul << 4) /**< Local Device Parallel Detection Fault */
|
||||
#define MII_LP_NP_ABLE (1ul << 3) /**< Link Partner Next Page Able */
|
||||
#define MII_NP_ABLE (1ul << 2) /**< Local Device Next Page Able */
|
||||
#define MII_PAGE_RX (1ul << 1) /**< New Page Received */
|
||||
#define MII_LP_AN_ABLE (1ul << 0) /**< Link Partner Auto-negotiation Able */
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup phy_dscr Specified Configuration Register (DSCR, 16)
|
||||
List Bit definitions: \ref MII_DSCR
|
||||
@{*/
|
||||
#define MII_BP4B5B (1ul << 15) /**< Bypass 4B5B Encoding and 5B4B Decoding */
|
||||
#define MII_BP_SCR (1ul << 14) /**< Bypass Scrambler/Descrambler Function */
|
||||
#define MII_BP_ALIGN (1ul << 13) /**< Bypass Symbol Alignment Function */
|
||||
#define MII_BP_ADPOK (1ul << 12) /**< BYPASS ADPOK */
|
||||
#define MII_REPEATER (1ul << 11) /**< Repeater/Node Mode */
|
||||
#define MII_TX (1ul << 10) /**< 100BASE-TX Mode Control */
|
||||
#define MII_FEF (1ul << 9) /**< Far end Fault enable */
|
||||
#define MII_RMII_ENABLE (1ul << 8) /**< Reduced MII Enable */
|
||||
#define MII_F_LINK_100 (1ul << 7) /**< Force Good Link in 100Mbps */
|
||||
#define MII_SPLED_CTL (1ul << 6) /**< Speed LED Disable */
|
||||
#define MII_COLLED_CTL (1ul << 5) /**< Collision LED Enable */
|
||||
#define MII_RPDCTR_EN (1ul << 4) /**< Reduced Power Down Control Enable */
|
||||
#define MII_SM_RST (1ul << 3) /**< Reset State Machine */
|
||||
#define MII_MFP_SC (1ul << 2) /**< MF Preamble Suppression Control */
|
||||
#define MII_SLEEP (1ul << 1) /**< Sleep Mode */
|
||||
#define MII_RLOUT (1ul << 0) /**< Remote Loopout Control */
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup phy_dscsr Specified Configuration and Status Register (DSCSR, 17)
|
||||
List Bit definitions: \ref MII_DSCSR
|
||||
@{*/
|
||||
#define MII_100FDX (1ul << 15) /**< 100M Full Duplex Operation Mode */
|
||||
#define MII_100HDX (1ul << 14) /**< 100M Half Duplex Operation Mode */
|
||||
#define MII_10FDX (1ul << 13) /**< 10M Full Duplex Operation Mode */
|
||||
#define MII_10HDX (1ul << 12) /**< 10M Half Duplex Operation Mode */
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup phy_10btcsr 10BASE-T Configuration/Status (10BTCSR, 18)
|
||||
List Bit definitions: \ref MII_10BTCSR
|
||||
@{*/
|
||||
/** Reserved: 18 to 15, Read as 0, ignore on write */
|
||||
#define MII_LP_EN (1ul << 14) /**< Link Pulse Enable */
|
||||
#define MII_HBE (1ul << 13) /**< Heartbeat Enable */
|
||||
#define MII_SQUELCH (1ul << 12) /**< Squelch Enable */
|
||||
#define MII_JABEN (1ul << 11) /**< Jabber Enable */
|
||||
#define MII_10BT_SER (1ul << 10) /**< 10BASE-T GPSI Mode */
|
||||
/** Reserved: 9 to 1, Read as 0, ignore on write */
|
||||
#define MII_POLR (1ul << 0) /**< Polarity Reversed */
|
||||
/** @}*/
|
||||
|
||||
/** \addtogroup phy_mdintr Specified Interrupt Register (MDINTR, 21)
|
||||
List Bit definitions: \ref MII_MDINTR
|
||||
@{*/
|
||||
#define MII_INTR_PEND (1ul << 15) /**< Interrupt Pending */
|
||||
/** Reserved: 14 to 12, Reserved */
|
||||
#define MII_FDX_MASK (1ul << 11) /**< Full-duplex Interrupt Mask */
|
||||
#define MII_SPD_MASK (1ul << 10) /**< Speed Interrupt Mask */
|
||||
#define MII_LINK_MASK (1ul << 9) /**< Link Interrupt Mask */
|
||||
#define MII_INTR_MASK (1ul << 8) /**< Master Interrupt Mask */
|
||||
/** Reserved: 7 to 5, Reserved */
|
||||
#define MII_FDX_CHANGE (1ul << 4) /**< Duplex Status Change Interrupt */
|
||||
#define MII_SPD_CHANGE (1ul << 3) /**< Speed Status Change Interrupt */
|
||||
#define MII_LINK_CHANGE (1ul << 2) /**< Link Status Change Interrupt */
|
||||
/** Reserved: 1, Reserved */
|
||||
#define MII_INTR_STATUS (1ul << 0) /**< Interrupt Status */
|
||||
/** @}*/
|
||||
|
||||
/**@}*/
|
||||
#endif // #ifndef _MII_DEFINE_H
|
||||
|
||||
+75
@@ -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
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 */
|
||||
struct capture_size {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* 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
|
||||
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 ov2643_yuv_vga[];
|
||||
extern const struct ov_reg ov2643_yuv_swvga[];
|
||||
extern const struct ov_reg ov2643_yuv_uxga[];
|
||||
|
||||
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_yuv_vga[];
|
||||
extern const struct ov_reg ov9740_yuv_sxga[];
|
||||
extern const struct ov_reg ov9740_yuv_vga[];
|
||||
|
||||
#endif // #ifndef _YUV_H_
|
||||
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 QT1070 driver.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef QT1070_H
|
||||
#define QT1070_H
|
||||
|
||||
#include "board.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
/** Slave address */
|
||||
#define QT1070_SLAVE_ADDRESS 0x1B
|
||||
|
||||
/** Internal Register Address Allocation */
|
||||
|
||||
/** Chip ID register*/
|
||||
#define QT1070_CHIP_ID 0
|
||||
/** Firmware version register*/
|
||||
#define QT1070_REG_FIRMWARE_VERSION 1
|
||||
/** Detection status*/
|
||||
#define QT1070_REG_DETECTION_STATUS 2
|
||||
/** Key status*/
|
||||
#define QT1070_REG_KEY_STATUS 3
|
||||
/** Key signal */
|
||||
#define QT1070_REG_KEY0_SIGNAL_MSB 4
|
||||
#define QT1070_REG_KEY0_SIGNAL_LSB 5
|
||||
#define QT1070_REG_KEY1_SIGNAL_MSB 6
|
||||
#define QT1070_REG_KEY1_SIGNAL_LSB 7
|
||||
#define QT1070_REG_KEY2_SIGNAL_MSB 8
|
||||
#define QT1070_REG_KEY2_SIGNAL_LSB 9
|
||||
#define QT1070_REG_KEY3_SIGNAL_MSB 10
|
||||
#define QT1070_REG_KEY3_SIGNAL_LSB 11
|
||||
#define QT1070_REG_KEY4_SIGNAL_MSB 12
|
||||
#define QT1070_REG_KEY4_SIGNAL_LSB 13
|
||||
#define QT1070_REG_KEY5_SIGNAL_MSB 14
|
||||
#define QT1070_REG_KEY5_SIGNAL_LSB 15
|
||||
#define QT1070_REG_KEY6_SIGNAL_MSB 16
|
||||
#define QT1070_REG_KEY6_SIGNAL_LSB 17
|
||||
|
||||
/** Reference date */
|
||||
#define QT1070_REG_REFDATA0_MSB 18
|
||||
#define QT1070_REG_REFDATA0_LSB 19
|
||||
#define QT1070_REG_REFDATA1_MSB 20
|
||||
#define QT1070_REG_REFDATA1_LSB 21
|
||||
#define QT1070_REG_REFDATA2_MSB 22
|
||||
#define QT1070_REG_REG_REFDATA2_LSB 23
|
||||
#define QT1070_REG_REFDATA3_MSB 24
|
||||
#define QT1070_REG_REG_REFDATA3_LSB 25
|
||||
#define QT1070_REG_REFDATA4_MSB 26
|
||||
#define QT1070_REG_REFDATA4_LSB 27
|
||||
#define QT1070_REG_REFDATA5_MSB 28
|
||||
#define QT1070_REG_REFDATA5_LSB 29
|
||||
#define QT1070_REG_REFDATA6_MSB 30
|
||||
#define QT1070_REG_REFDATA6_LSB 31
|
||||
|
||||
/** Negative threshold level */
|
||||
#define QT1070_REG_NTHR_KEY0 32
|
||||
#define QT1070_REG_NTHR_KEY1 33
|
||||
#define QT1070_REG_NTHR_KEY2 34
|
||||
#define QT1070_REG_NTHR_KEY3 35
|
||||
#define QT1070_REG_NTHR_KEY4 36
|
||||
#define QT1070_REG_NTHR_KEY5 37
|
||||
#define QT1070_REG_NTHR_KEY6 38
|
||||
|
||||
/** Adjacent key suppression level */
|
||||
#define QT1070_REG_AVEAKS_KEY0 39
|
||||
#define QT1070_REG_AVEAKS_KEY1 40
|
||||
#define QT1070_REG_AVEAKS_KEY2 41
|
||||
#define QT1070_REG_AVEAKS_KEY3 42
|
||||
#define QT1070_REG_AVEAKS_KEY4 43
|
||||
#define QT1070_REG_AVEAKS_KEY5 44
|
||||
#define QT1070_REG_AVEAKS_KEY6 45
|
||||
|
||||
/** Detection interator conter for key*/
|
||||
#define QT1070_REG_DI_KEY0 46
|
||||
#define QT1070_REG_DI_KEY1 47
|
||||
#define QT1070_REG_DI_KEY2 48
|
||||
#define QT1070_REG_DI_KEY3 49
|
||||
#define QT1070_REG_DI_KEY4 50
|
||||
#define QT1070_REG_DI_KEY5 51
|
||||
#define QT1070_REG_DI_KEY6 52
|
||||
|
||||
/** Low power mode */
|
||||
#define QT1070_REG_LOWPOWER_MODE 54
|
||||
/** Maximum on duration */
|
||||
#define QT1070_REG_MAX_DURATION 55
|
||||
/** Calibrate */
|
||||
#define QT1070_REG_CALIRATE 56
|
||||
/** Reset */
|
||||
#define QT1070_REG_RESET 57
|
||||
|
||||
/** Detection Status. */
|
||||
/** This bit is set during a calibration sequence.*/
|
||||
#define QT_CALIBRATE_BIT 7
|
||||
/** This bit is set if the time to acquire all key signals exceeds 8 ms*/
|
||||
#define QT_OVERFLOW_BIT 6
|
||||
/** This bit is set if Comms mode is enabled. */
|
||||
#define QT_COMMSENABLED_BIT 5
|
||||
/** This bit is set if any keys are in detect. */
|
||||
#define QT_TOUCH_BIT 0
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern uint8_t QT1070_GetChipId(Twid *pTwid);
|
||||
extern uint8_t QT1070_GetFirmwareVersion(Twid *pTwid);
|
||||
extern uint8_t QT1070_GetDetection_Status(Twid *pTwid);
|
||||
extern uint8_t QT1070_GetKey_Status(Twid *pTwid);
|
||||
extern uint16_t QT1070_GetKey_Signal(Twid *pTwid, uint8_t key);
|
||||
extern uint16_t QT1070_GetKey_Reference(Twid *pTwid, uint8_t key);
|
||||
extern void QT1070_SetThreshold(Twid *pTwid, uint8_t key, uint8_t threshold);
|
||||
extern void QT1070_SetAveAks(Twid *pTwid, uint8_t key, uint8_t Ave, uint8_t Aks);
|
||||
extern void QT1070_SetDetectionIntegrator(Twid *pTwid, uint8_t key, uint8_t di);
|
||||
extern void QT1070_StartCalibrate(Twid *pTwid);
|
||||
extern void QT1070_StartReset(Twid *pTwid);
|
||||
#endif // QT1070_H
|
||||
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 function for gererating random number.
|
||||
*
|
||||
*------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _RAND_
|
||||
#define _RAND_
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Global Functions
|
||||
*------------------------------------------------------------------------------*/
|
||||
|
||||
extern void srand( uint32_t dwSeed ) ;
|
||||
extern uint32_t rand( void ) ;
|
||||
|
||||
#endif /* #ifndef _RAND_ */
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* 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.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 ) ;
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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
|
||||
*
|
||||
* \par Purpose
|
||||
*
|
||||
* Methods and definitions for Global time tick and wait functions.
|
||||
*
|
||||
* Defines a common and simpliest use of Time Tick, to increase tickCount
|
||||
* every 1ms, the application can get this value through GetTickCount().
|
||||
*
|
||||
* \par Usage
|
||||
*
|
||||
* -# Configure the System Tick with TimeTick_Configure() when MCK changed
|
||||
* \note
|
||||
* Must be done before any invoke of GetTickCount(), Wait() or Sleep().
|
||||
* -# Uses GetTickCount to get current tick value.
|
||||
* -# Uses Wait to wait several ms.
|
||||
* -# Uses Sleep to enter wait for interrupt mode to wait several ms.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _TIMETICK_
|
||||
#define _TIMETICK_
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Global functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern uint32_t TimeTick_Configure( uint32_t dwNew_MCK ) ;
|
||||
|
||||
extern void TimeTick_Increment( uint32_t dwInc ) ;
|
||||
|
||||
extern uint32_t GetDelayInTicks(uint32_t startTick,uint32_t endTick);
|
||||
|
||||
extern uint32_t GetTickCount( void ) ;
|
||||
|
||||
extern void Wait( volatile uint32_t dwMs ) ;
|
||||
|
||||
extern void Sleep( volatile uint32_t dwMs ) ;
|
||||
|
||||
#endif /* _TIMETICK_ */
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 */
|
||||
|
||||
/**
|
||||
* \addtogroup tsd_module TouchScreen Driver
|
||||
*
|
||||
* \section Purpose
|
||||
*
|
||||
* This unit provides a very powerful touchscreen driver which handles all the
|
||||
* complexity. This includes touchscreen calibration, retrieving measurements,
|
||||
* configuring the TSADC, etc.
|
||||
*
|
||||
* \section Usage
|
||||
*
|
||||
* -# Implement ADC interrupt handler in application, to invoke TSD_Handler()
|
||||
* to handle ADC sampling events for touchscreen monitor.
|
||||
* -# Call TSD_Initialize() to initialize ADC used for touchscreen.
|
||||
* -# Call TSD_Calibrate() to do touchscreen calibration with LCD, and enable
|
||||
* touchscreen monitor if calibration success.
|
||||
* -# Call TSD_Enable() to enable or disable touchscreen monitoring.
|
||||
* -# Declare a global TSD_PenPressed() function anywhere in your code. This
|
||||
* function will get called every time the pen is pressed on the screen.
|
||||
* -# Declare a global TSD_PenMoved() function, which will get called whenever
|
||||
* the pen stays in contact with the screen but changes position.
|
||||
* -# Declare a global TSD_PenReleased() function, which will be invoked as the
|
||||
* pen is lifted from the screen.
|
||||
*/
|
||||
|
||||
#ifndef TSD_H
|
||||
#define TSD_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Global functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern void TSD_Handler(uint32_t dwAdcStatus);
|
||||
extern void TSD_Initialize(void);
|
||||
extern void TSD_DeInitialize(void);
|
||||
extern void TSD_Enable(uint8_t bEnDis);
|
||||
extern uint8_t TSD_Calibrate(void);
|
||||
|
||||
/* calibration used functions */
|
||||
extern void TSD_GetRawMeasurement(uint32_t * pData);
|
||||
extern void TSD_WaitPenPressed(void);
|
||||
extern void TSD_WaitPenReleased(void);
|
||||
|
||||
/* callbacks */
|
||||
extern void TSD_PenPressed(uint32_t x, uint32_t y, uint32_t pressure);
|
||||
extern void TSD_PenMoved(uint32_t x, uint32_t y, uint32_t pressure);
|
||||
extern void TSD_PenReleased(uint32_t x, uint32_t y);
|
||||
|
||||
#endif //#ifndef TSD_H
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 */
|
||||
|
||||
#ifndef TSD_COM_H
|
||||
#define TSD_COM_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Global functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern void TSDCom_InterpolateMeasurement(
|
||||
const uint32_t *pData,
|
||||
uint32_t *pPoint);
|
||||
|
||||
uint8_t TSDCom_Calibrate(void);
|
||||
|
||||
uint8_t TSDCom_IsCalibrationOk(void);
|
||||
|
||||
void TSDCom_ReadCalibrateData(void *pBuffer, uint32_t size);
|
||||
void TSDCom_RestoreCalibrateData(void *pBuffer, uint32_t size);
|
||||
|
||||
#endif /* #ifndef TSD_COM_H */
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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 WAV_H
|
||||
#define WAV_H
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/* Standard WAV file header information. */
|
||||
typedef struct _WavHeader
|
||||
{
|
||||
/* Contains the letters "RIFF" in ASCII form. */
|
||||
unsigned int chunkID;
|
||||
/* Size of the rest of the chunk following this number.*/
|
||||
unsigned int chunkSize;
|
||||
/* Contains the letters "WAVE".*/
|
||||
unsigned int format;
|
||||
/* Contains the letters "fmt ".*/
|
||||
unsigned int subchunk1ID;
|
||||
/* 16 for PCM. This is the size of the rest of the Subchunk which follows this number.*/
|
||||
unsigned int subchunk1Size;
|
||||
/* PCM = 1 (i.e. Linear quantization). Values other than 1 indicate some form of compression.*/
|
||||
unsigned short audioFormat;
|
||||
/* Mono = 1, Stereo = 2, etc.*/
|
||||
unsigned short numChannels;
|
||||
/* 8000, 44100, etc.*/
|
||||
unsigned int sampleRate;
|
||||
/* SampleRate * NumChannels * BitsPerSample/8*/
|
||||
unsigned int byteRate;
|
||||
/* NumChannels * BitsPerSample/8*/
|
||||
unsigned short blockAlign;
|
||||
/* 8 bits = 8, 16 bits = 16, etc.*/
|
||||
unsigned short bitsPerSample;
|
||||
/* Contains the letters "data".*/
|
||||
unsigned int subchunk2ID;
|
||||
/* Number of bytes in the data.*/
|
||||
unsigned int subchunk2Size;
|
||||
|
||||
} WavHeader;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Exported functions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
extern unsigned char WAV_IsValid(const WavHeader *header);
|
||||
|
||||
extern void WAV_DisplayInfo(const WavHeader *header);
|
||||
|
||||
#endif //#ifndef WAV_H
|
||||
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* 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
|
||||
|
||||
|
||||
/** 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 );
|
||||
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
|
||||
|
||||
|
||||
+547
File diff suppressed because it is too large
Load Diff
+108
@@ -0,0 +1,108 @@
|
||||
// ---------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support
|
||||
// ---------------------------------------------------------
|
||||
// The software is delivered "AS IS" without warranty or
|
||||
// condition of any kind, either express, implied or
|
||||
// statutory. This includes without limitation any warranty
|
||||
// or condition with respect to merchantability or fitness
|
||||
// for any particular purpose, or against the infringements of
|
||||
// intellectual property rights of others.
|
||||
// ---------------------------------------------------------
|
||||
// File: sama5d3x-ek-sram.mac
|
||||
// User setup file for CSPY debugger.
|
||||
//
|
||||
// ---------------------------------------------------------
|
||||
|
||||
__var __tempo_var;
|
||||
__var __dummy_read;
|
||||
__var __data_test;
|
||||
__var __mac_i;
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* execUserReset() : JTAG set initially to Full Speed
|
||||
*/
|
||||
execUserReset()
|
||||
{
|
||||
// __message "------------------------------ execUserReset ---------------------------------";
|
||||
// CheckNoRemap();
|
||||
// __message "-------------------------------Set PC Reset ----------------------------------";
|
||||
// __writeMemory32(0xD3,0x98,"Register"); //* Set CPSR
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* execUserPreload() : JTAG set initially to 32kHz
|
||||
*/
|
||||
execUserPreload()
|
||||
{
|
||||
// __message "------------------------------ execUserPreload ---------------------------------";
|
||||
//__hwReset(0); //* Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz)
|
||||
|
||||
// __writeMemory32(0xD3,0x98,"Register"); //* Set CPSR
|
||||
// CheckNoRemap(); //* Set the RAM memory at 0x0020 0000 & 0x0000 0000
|
||||
Watchdog(); //* Watchdog Disable
|
||||
|
||||
//* Get the Chip ID (AT91C_DBGU_C1R & AT91C_DBGU_C2R
|
||||
// __mac_i=__readMemory32(0xFFFFEE40,"Memory");
|
||||
// __message " ---------------------------------------- Chip ID 0x",__mac_i:%X;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* CheckRemap()
|
||||
*
|
||||
* Function description
|
||||
* Check the Remap.
|
||||
*/
|
||||
|
||||
CheckNoRemap()
|
||||
{
|
||||
__tempo_var = __readMemory32(0x00000000,"Memory");
|
||||
|
||||
if (__tempo_var == 0xAA55AA55)
|
||||
{
|
||||
__data_test = 0x55AA55AA;
|
||||
}
|
||||
else
|
||||
{
|
||||
__data_test = 0xAA55AA55;
|
||||
}
|
||||
|
||||
__writeMemory32(__data_test,0x00000000,"Memory");
|
||||
|
||||
__dummy_read = __readMemory32(0x00000000,"Memory");
|
||||
|
||||
__writeMemory32(__tempo_var,0x00000000,"Memory");
|
||||
|
||||
if (__dummy_read == __data_test)
|
||||
{
|
||||
__message " ------------------------ The Remap is already done ------------------------";
|
||||
}
|
||||
else
|
||||
{
|
||||
__message " ------------------------ The Remap is not DONE ------------------------";
|
||||
__writeMemory32(0x00000001,0xFFFFED00,"Memory");
|
||||
__delay(2);
|
||||
__writeMemory32(0x00000001,0x00800000,"Memory");
|
||||
__delay(50);
|
||||
__message "------------ The Remap was executed ------------";
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* _Watchdog()
|
||||
*
|
||||
* Function description
|
||||
* Clear Watchdog
|
||||
*/
|
||||
|
||||
Watchdog()
|
||||
{
|
||||
// Watchdog Disable
|
||||
__writeMemory32(0x00008000,0xFFFFFE44,"Memory");
|
||||
__message " ------------------------ Watchdog Disable ------------------------";
|
||||
}
|
||||
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
// ---------------------------------------------------------
|
||||
// ATMEL Microcontroller Software Support
|
||||
// ---------------------------------------------------------
|
||||
// The software is delivered "AS IS" without warranty or
|
||||
// condition of any kind, either express, implied or
|
||||
// statutory. This includes without limitation any warranty
|
||||
// or condition with respect to merchantability or fitness
|
||||
// for any particular purpose, or against the infringements of
|
||||
// intellectual property rights of others.
|
||||
// ---------------------------------------------------------
|
||||
// File: sama5d3x-ek-sram.mac
|
||||
// User setup file for CSPY debugger.
|
||||
//
|
||||
// ---------------------------------------------------------
|
||||
|
||||
__var __tempo_var;
|
||||
__var __dummy_read;
|
||||
__var __data_test;
|
||||
__var __mac_i;
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* execUserReset() : JTAG set initially to Full Speed
|
||||
*/
|
||||
execUserReset()
|
||||
{
|
||||
__message "------------------------------ execUserReset ---------------------------------";
|
||||
//CheckNoRemap();
|
||||
__message "-------------------------------Set PC Reset ----------------------------------";
|
||||
__writeMemory32(0xD3,0x98,"Register"); //* Set CPSR
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* execUserPreload() : JTAG set initially to 32kHz
|
||||
*/
|
||||
execUserPreload()
|
||||
{
|
||||
__message "------------------------------ execUserPreload ---------------------------------";
|
||||
//__hwReset(0); //* Hardware Reset: CPU is automatically halted after the reset (JTAG is already configured to 32kHz)
|
||||
|
||||
__writeMemory32(0xD3,0x98,"Register"); //* Set CPSR
|
||||
//CheckNoRemap(); //* Set the RAM memory at 0x0020 0000 & 0x0000 0000
|
||||
Watchdog(); //* Watchdog Disable
|
||||
|
||||
//* Get the Chip ID (AT91C_DBGU_C1R & AT91C_DBGU_C2R
|
||||
__mac_i=__readMemory32(0xFFFFEE40,"Memory");
|
||||
__message " ---------------------------------------- Chip ID 0x",__mac_i:%X;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* CheckRemap()
|
||||
*
|
||||
* Function description
|
||||
* Check the Remap.
|
||||
*/
|
||||
|
||||
CheckNoRemap()
|
||||
{
|
||||
__tempo_var = __readMemory32(0x00000000,"Memory");
|
||||
|
||||
if (__tempo_var == 0xAA55AA55)
|
||||
{
|
||||
__data_test = 0x55AA55AA;
|
||||
}
|
||||
else
|
||||
{
|
||||
__data_test = 0xAA55AA55;
|
||||
}
|
||||
|
||||
__writeMemory32(__data_test,0x00000000,"Memory");
|
||||
|
||||
__dummy_read = __readMemory32(0x00000000,"Memory");
|
||||
|
||||
__writeMemory32(__tempo_var,0x00000000,"Memory");
|
||||
|
||||
if (__dummy_read == __data_test)
|
||||
{
|
||||
__message " ------------------------ The Remap is already done ------------------------";
|
||||
}
|
||||
else
|
||||
{
|
||||
__message " ------------------------ The Remap is not DONE ------------------------";
|
||||
__writeMemory32(0x00000001,0xFFFFED00,"Memory");
|
||||
__delay(2);
|
||||
__writeMemory32(0x00000001,0x00800000,"Memory");
|
||||
__delay(50);
|
||||
__message "------------ The Remap was executed ------------";
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
*
|
||||
* _Watchdog()
|
||||
*
|
||||
* Function description
|
||||
* Clear Watchdog
|
||||
*/
|
||||
|
||||
Watchdog()
|
||||
{
|
||||
// Watchdog Disable
|
||||
__writeMemory32(0x00008000,0xFFFFFE44,"Memory");
|
||||
__message " ------------------------ Watchdog Disable ------------------------";
|
||||
}
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_DDRAM_start__ = 0x20000000;
|
||||
define symbol __ICFEDIT_region_DDRAM_end__ = 0x20FFFFFF;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x300000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x31FFFF;
|
||||
define symbol __ICFEDIT_region_DDRAM_BUF_start__ = 0x23000000;
|
||||
define symbol __ICFEDIT_region_DDRAM_BUF_end__ = 0x23FFFFFF;
|
||||
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_startup__ = 0x200;
|
||||
define symbol __ICFEDIT_size_vectors__ = 0x200;
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x4000;
|
||||
define symbol __ICFEDIT_size_sysstack__ = 0x60;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x60;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x0;
|
||||
/*-Exports-*/
|
||||
export symbol __ICFEDIT_region_DDRAM_start__;
|
||||
export symbol __ICFEDIT_region_DDRAM_end__;
|
||||
export symbol __ICFEDIT_region_RAM_start__;
|
||||
export symbol __ICFEDIT_region_RAM_end__;
|
||||
export symbol __ICFEDIT_size_startup__;
|
||||
export symbol __ICFEDIT_size_vectors__;
|
||||
export symbol __ICFEDIT_size_cstack__;
|
||||
export symbol __ICFEDIT_size_sysstack__;
|
||||
export symbol __ICFEDIT_size_irqstack__;
|
||||
export symbol __ICFEDIT_size_heap__;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region STA_region = mem:[from __ICFEDIT_region_DDRAM_start__ size __ICFEDIT_size_startup__];
|
||||
define region DDRAM_region = mem:[from __ICFEDIT_region_DDRAM_start__+__ICFEDIT_size_startup__ to __ICFEDIT_region_DDRAM_end__];
|
||||
define region VEC_region = mem:[from __ICFEDIT_region_RAM_start__ size __ICFEDIT_size_vectors__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__+__ICFEDIT_size_vectors__ to __ICFEDIT_region_RAM_end__];
|
||||
define region DMA_BUF_region = mem:[from __ICFEDIT_region_DDRAM_BUF_start__ to __ICFEDIT_region_DDRAM_BUF_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SYS_STACK with alignment = 8, size = __ICFEDIT_size_sysstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { section .vectors };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place in STA_region { section .cstartup };
|
||||
place in VEC_region { section .vectors };
|
||||
place in DDRAM_region { readonly };
|
||||
place in DDRAM_region { readwrite };
|
||||
place in DDRAM_region { zeroinit };
|
||||
place in DMA_BUF_region {section region_dma_nocache };
|
||||
place in DDRAM_region { block IRQ_STACK, block SYS_STACK, block CSTACK, block HEAP };
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x0;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0;
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x70000000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x73FFFFFF;
|
||||
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x200;
|
||||
define symbol __ICFEDIT_size_svcstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_fiqstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_undstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_abtstack__ = 0x0;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x0;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
|
||||
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
|
||||
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
//initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ {section .intvec };
|
||||
|
||||
place at start of RAM_region { block RamTop with fixed order {readonly, section LOWEND}};
|
||||
place at end of RAM_region { block RamBottom with fixed order {section HIGHSTART, readwrite, section .noinit,
|
||||
block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
|
||||
block UND_STACK, block ABT_STACK, block HEAP}};
|
||||
|
||||
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/**** start of ICF editor section. ###ICF###*/
|
||||
|
||||
/*-Specials-*/
|
||||
define symbol __ICFEDIT_intvec_start__ = 0x000000;
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
|
||||
define symbol __ICFEDIT_region_ROM_end__ = 0x0000FFFF;
|
||||
define symbol __ICFEDIT_region_SRAM0_start__ = 0x00300000;
|
||||
define symbol __ICFEDIT_region_SRAM0_end__ = 0x0030FFFF;
|
||||
define symbol __ICFEDIT_region_SRAM1_start__ = 0x00310000;
|
||||
define symbol __ICFEDIT_region_SRAM1_end__ = 0x0031FFFF;
|
||||
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x1000;
|
||||
define symbol __ICFEDIT_size_svcstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x100;
|
||||
define symbol __ICFEDIT_size_fiqstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_undstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_abtstack__ = 0x40;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x400;
|
||||
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region ROM = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
|
||||
define region SRAM0 = mem:[from __ICFEDIT_region_SRAM0_start__ to __ICFEDIT_region_SRAM0_end__];
|
||||
define region SRAM1 = mem:[from __ICFEDIT_region_SRAM1_start__ to __ICFEDIT_region_SRAM1_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SVC_STACK with alignment = 8, size = __ICFEDIT_size_svcstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block FIQ_STACK with alignment = 8, size = __ICFEDIT_size_fiqstack__ { };
|
||||
define block UND_STACK with alignment = 8, size = __ICFEDIT_size_undstack__ { };
|
||||
define block ABT_STACK with alignment = 8, size = __ICFEDIT_size_abtstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy { readwrite };
|
||||
do not initialize { section .noinit };
|
||||
|
||||
place at address mem:__ICFEDIT_intvec_start__ { readonly section .vectors };
|
||||
|
||||
place in ROM { readonly };
|
||||
place in SRAM0 { readwrite,
|
||||
block CSTACK, block SVC_STACK, block IRQ_STACK, block FIQ_STACK,
|
||||
block UND_STACK, block ABT_STACK, block HEAP };
|
||||
|
||||
define exported symbol fl_ram_end = (__ICFEDIT_region_SRAM0_end__ & 0xFFFFFFF8);
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*###ICF### Section handled by ICF editor, don't touch! ****/
|
||||
/*-Editor annotation file-*/
|
||||
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\a_v1_0.xml" */
|
||||
/*-Memory Regions-*/
|
||||
define symbol __ICFEDIT_region_RAM_start__ = 0x300000;
|
||||
define symbol __ICFEDIT_region_RAM_end__ = 0x31FFFF;
|
||||
/*-Sizes-*/
|
||||
define symbol __ICFEDIT_size_vectors__ = 0x100;
|
||||
define symbol __ICFEDIT_size_cstack__ = 0x400;
|
||||
define symbol __ICFEDIT_size_sysstack__ = 0x60;
|
||||
define symbol __ICFEDIT_size_irqstack__ = 0x60;
|
||||
define symbol __ICFEDIT_size_heap__ = 0x0;
|
||||
/*-Exports-*/
|
||||
export symbol __ICFEDIT_region_RAM_start__;
|
||||
export symbol __ICFEDIT_region_RAM_end__;
|
||||
export symbol __ICFEDIT_size_vectors__;
|
||||
export symbol __ICFEDIT_size_cstack__;
|
||||
export symbol __ICFEDIT_size_sysstack__;
|
||||
export symbol __ICFEDIT_size_irqstack__;
|
||||
export symbol __ICFEDIT_size_heap__;
|
||||
/**** End of ICF editor section. ###ICF###*/
|
||||
|
||||
define memory mem with size = 4G;
|
||||
define region VEC_region = mem:[from __ICFEDIT_region_RAM_start__ size __ICFEDIT_size_vectors__];
|
||||
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__+__ICFEDIT_size_vectors__ to __ICFEDIT_region_RAM_end__];
|
||||
|
||||
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
|
||||
define block SYS_STACK with alignment = 8, size = __ICFEDIT_size_sysstack__ { };
|
||||
define block IRQ_STACK with alignment = 8, size = __ICFEDIT_size_irqstack__ { };
|
||||
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
|
||||
|
||||
initialize by copy with packing=none { readwrite };
|
||||
do not initialize { readonly section .noinit };
|
||||
|
||||
place in VEC_region { section .vectors };
|
||||
place in RAM_region { readonly };
|
||||
place in RAM_region { section .cstartup };
|
||||
place in RAM_region { readwrite, block IRQ_STACK, block SYS_STACK, block CSTACK, block HEAP };
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user