diff options
| author | Cristian Maglie <c.maglie@bug.st> | 2012-10-18 15:50:09 +0200 | 
|---|---|---|
| committer | Cristian Maglie <c.maglie@bug.st> | 2012-10-18 15:50:09 +0200 | 
| commit | 6a45ba48ab1f2d0a168373a02ba7fded40a3470e (patch) | |
| tree | 163448869b4dfcbce95dc877ffff61a709fba6b6 /firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS | |
| parent | c313b54c00635f1be14a1b09617dc9b8b562e589 (diff) | |
| parent | 6d296e0faba5b9910084c307a3f93cb2653bf7f8 (diff) | |
Merged upstream arduino branch
Diffstat (limited to 'firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS')
6 files changed, 647 insertions, 0 deletions
| diff --git a/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_cpu.h b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_cpu.h new file mode 100644 index 0000000..e3ebea7 --- /dev/null +++ b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_cpu.h @@ -0,0 +1,63 @@ +/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */ + +/*This file is prepared for Doxygen automatic documentation generation.*/ +/*! \file ********************************************************************* + * + * \brief NEWLIB_ADDONS CPU include file for AVR32. + * + * - Compiler:           GNU GCC for AVR32 + * - Supported devices:  All AVR32 devices can be used. + * - AppNote: + * + * \author               Atmel Corporation: http://www.atmel.com \n + *                       Support and FAQ: http://support.atmel.no/ + * + ******************************************************************************/ + +/* 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: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an Atmel + * AVR product. + * + * 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 + * EXPRESSLY AND SPECIFICALLY 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 __AVR32_NEWLIB_ADDONS_CPU_H__ +#define __AVR32_NEWLIB_ADDONS_CPU_H__ + +#include <_ansi.h> + +_BEGIN_STD_C + +#define CPU_HZ get_cpu_hz() + +void udelay(unsigned long usec); +void set_cpu_hz(unsigned int clk_hz); +unsigned int get_cpu_hz(); + +_END_STD_C + +#endif diff --git a/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_exceptions.h b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_exceptions.h new file mode 100644 index 0000000..31caf13 --- /dev/null +++ b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_exceptions.h @@ -0,0 +1,120 @@ +/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */ + +/*This file is prepared for Doxygen automatic documentation generation.*/ +/*! \file ********************************************************************* + * + * \brief NEWLIB_ADDONS exceptions include file for AVR32. + * + * - Compiler:           GNU GCC for AVR32 + * - Supported devices:  All AVR32 devices can be used. + * - AppNote: + * + * \author               Atmel Corporation: http://www.atmel.com \n + *                       Support and FAQ: http://support.atmel.no/ + * + ******************************************************************************/ + +/* 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: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an Atmel + * AVR product. + * + * 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 + * EXPRESSLY AND SPECIFICALLY 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 __AVR32_NEWLIB_ADDONS_EXCEPTIONS_H__ +#define __AVR32_NEWLIB_ADDONS_EXCEPTIONS_H__ + +#include <_ansi.h> + +_BEGIN_STD_C + +/* + Exception vector offsets +*/ +#define EVBA_UNRECOVERABLE    0x000 +#define EVBA_TLB_MULTIPLE     0x004 +#define EVBA_BUS_ERROR_DATA   0x008 +#define EVBA_BUS_ERROR_INSTR  0x00C +#define EVBA_NMI              0x010 +#define EVBA_INSTR_ADDR       0x014 +#define EVBA_ITLB_MISS        0x050 +#define EVBA_ITLB_PROT        0x018 +#define EVBA_BREAKPOINT       0x01C +#define EVBA_ILLEGAL_OPCODE   0x020 +#define EVBA_UNIMPLEMENTED    0x024 +#define EVBA_PRIVILEGE_VIOL   0x028 +#define EVBA_FLOATING_POINT   0x02C +#define EVBA_COP_ABSENT       0x030 +#define EVBA_SCALL            0x100 +#define EVBA_DATA_ADDR_R      0x034 +#define EVBA_DATA_ADDR_W      0x038 +#define EVBA_DTLB_MISS_R      0x060 +#define EVBA_DTLB_MISS_W      0x070 +#define EVBA_DTLB_PROT_R      0x03C +#define EVBA_DTLB_PROT_W      0x040 +#define EVBA_DTLB_MODIFIED    0x044 + + +/* +   Define the form of the function used when registering exceptions. +   The function should return the address which the exception should +   return to after the exception processing. +*/ + +typedef unsigned int (*__exception_handler)(int /*evba_offset*/, int /*return address*/); + +/* +   Define the form of the function used when registering a scall handler. +*/ + +typedef void (*__scall_handler)(int /*code*/, int /*p1*/, int /*p2*/ +                                         , int /*p3*/, int /*p4*/); + +/* +   Function for registering an exception handler for the exception with +   offset given by evba_offset. +*/ +void _register_exception_handler(__exception_handler handler, int evba_offset); + +/* +   Function for registering a scall handler which can be a arbirary +   function which uses r8-r12 for parameters. +*/ +void _register_scall_handler(__scall_handler handler); + +/* +   Initialize exceptions. Must be called before registering exception handlers +   and needed to enable exceptions. 'evba' is the pointer to the exception +   vector. 'handler_table' is a pointer to an array where the pointers to +   the exception handlers are stored. This array must be at least 0x104 bytes +   and word aligned. +*/ +void init_exceptions(void *evba, void *handler_table); + +_END_STD_C + +#endif diff --git a/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_interrupts.h b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_interrupts.h new file mode 100644 index 0000000..76d81f7 --- /dev/null +++ b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_interrupts.h @@ -0,0 +1,82 @@ +/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */ + +/*This file is prepared for Doxygen automatic documentation generation.*/ +/*! \file ********************************************************************* + * + * \brief NEWLIB_ADDONS interrupts include file for AVR32. + * + * - Compiler:           GNU GCC for AVR32 + * - Supported devices:  All AVR32 devices can be used. + * - AppNote: + * + * \author               Atmel Corporation: http://www.atmel.com \n + *                       Support and FAQ: http://support.atmel.no/ + * + ******************************************************************************/ + +/* 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: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an Atmel + * AVR product. + * + * 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 + * EXPRESSLY AND SPECIFICALLY 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 __AVR32_NEWLIB_ADDONS_INTERRUPTS_H__ +#define __AVR32_NEWLIB_ADDONS_INTERRUPTS_H__ + +#include <_ansi.h> + +_BEGIN_STD_C + +#define INT_GRPS          64 +#define INT_LINES         32 +#define INTPR_BASE        (__intc_base__ + 0x0000) +#define INTREQ_BASE       (__intc_base__ + 64*4) +#define INTCAUSE_BASE     (__intc_base__ + 2*64*4) + +//Register offsets +#define INTLEVEL          30 +#define AUTOVECTOR        0 +#define AUTOVECTOR_BITS   14 + +//Priorities +#define INT0              0 +#define INT1              1 +#define INT2              2 +#define INT3              3 + + +typedef void (*__newlib_int_handler)(int /* int_grp*/, void */*user_handle*/); + +__newlib_int_handler register_interrupt(__newlib_int_handler handler, int int_grp, int line, int priority, +                                 .../* void *user_handle*/); +void init_interrupts(); +void set_interrupts_base(void *base); + +_END_STD_C + +#endif diff --git a/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_io.h b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_io.h new file mode 100644 index 0000000..a725769 --- /dev/null +++ b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_io.h @@ -0,0 +1,174 @@ +/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */ + +/*This file is prepared for Doxygen automatic documentation generation.*/ +/*! \file ********************************************************************* + * + * \brief NEWLIB_ADDONS miscellaneous macros include file for AVR32. + * + * - Compiler:           GNU GCC for AVR32 + * - Supported devices:  All AVR32 devices can be used. + * - AppNote: + * + * \author               Atmel Corporation: http://www.atmel.com \n + *                       Support and FAQ: http://support.atmel.no/ + * + ******************************************************************************/ + +/* 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: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an Atmel + * AVR product. + * + * 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 + * EXPRESSLY AND SPECIFICALLY 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 __AVR32_NEWLIB_ADDONS_IO_H__ +#define __AVR32_NEWLIB_ADDONS_IO_H__ + +#include <_ansi.h> + +_BEGIN_STD_C + +typedef char u8; +typedef unsigned int u32; + +#define __raw_writeb(v,a)       (*(volatile unsigned char  *)(a) = (v)) +#define __raw_writew(v,a)       (*(volatile unsigned short *)(a) = (v)) +#define __raw_writel(v,a)       (*(volatile unsigned int   *)(a) = (v)) + +#define __raw_readb(a)          (*(volatile unsigned char  *)(a)) +#define __raw_readw(a)          (*(volatile unsigned short *)(a)) +#define __raw_readl(a)          (*(volatile unsigned int   *)(a)) + +/* As long as I/O is only performed in P4 (or possibly P3), we're safe */ +#define writeb(v,a)		__raw_writeb(v,a) +#define writew(v,a)		__raw_writew(v,a) +#define writel(v,a)		__raw_writel(v,a) + +#define readb(a)		__raw_readb(a) +#define readw(a)		__raw_readw(a) +#define readl(a)		__raw_readl(a) + +/* Memory segments when segmentation is enabled */ +#define P0SEG		0x00000000 +#define P1SEG		0x80000000 +#define P2SEG		0xa0000000 +#define P3SEG		0xc0000000 +#define P4SEG		0xe0000000 + +/* Returns the privileged segment base of a given address */ +#define PXSEG(a)	(((unsigned long)(a)) & 0xe0000000) + +/* Returns the physical address of a PnSEG (n=1,2) address */ +#define PHYSADDR(a)	(((unsigned long)(a)) & 0x1fffffff) + +/* + * Map an address to a certain privileged segment + */ +#define P1SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P1SEG)) +#define P2SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P2SEG)) +#define P3SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG)) +#define P4SEGADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG)) + + +#define cached(addr) P1SEGADDR(addr) +#define uncached(addr) P2SEGADDR(addr) +#define physaddr(addr) PHYSADDR(addr) + +#define BF(field, value) \ +  ({ union { \ +      struct { \ +       unsigned           : 32 - field ##  _OFFSET -  field ##  _SIZE ; \ +       unsigned long __val: field ##  _SIZE ; \ +      }; \ +      unsigned long __ul; \ +     } __tmp; \ +     __tmp.__ul = 0; \ +     __tmp.__val = value; \ +     __tmp.__ul;}) + +#define BF_D(field, value) \ +  ({ union { \ +      struct { \ +       unsigned long long : 64 - field ##  _OFFSET -  field ##  _SIZE ; \ +       unsigned long long __val: field ##  _SIZE ; \ +      }; \ +      unsigned long long __ul; \ +     } __tmp; \ +     __tmp.__ul = 0; \ +     __tmp.__val = value; \ +     __tmp.__ul;}) + +#define BFINS(var, field, value) \ +  { union {\ +      struct { \ +       unsigned           : 32 - field ##  _OFFSET -  field ##  _SIZE ; \ +       unsigned long __val: field ##  _SIZE ; \ +      }; \ +      unsigned long __ul; \ +     } __tmp; \ +     __tmp.__ul = var; \ +     __tmp.__val = value; \ +     var = __tmp.__ul;} + +#define BFEXT(var, field) \ +  ({ union {\ +      struct { \ +       unsigned           : 32 - field ##  _OFFSET -  field ##  _SIZE ; \ +       unsigned long __val: field ##  _SIZE ; \ +      }; \ +      unsigned long __ul; \ +     } __tmp; \ +     __tmp.__ul = var; \ +     __tmp.__val; }) + +#define BFINS_D(var, field, value) \ +  { union {\ +      struct { \ +       unsigned long long : 64 - field ##  _OFFSET -  field ##  _SIZE ; \ +       unsigned long long __val: field ##  _SIZE ; \ +      }; \ +      unsigned long long __ul; \ +     } __tmp; \ +     __tmp.__ul = var; \ +     __tmp.__val = value; \ +     var = __tmp.__ul;} + +#define BFEXT_D(var, field) \ +  ({ union {\ +      struct { \ +       unsigned long long : 64 - field ##  _OFFSET -  field ##  _SIZE ; \ +       unsigned long long __val: field ##  _SIZE ; \ +      }; \ +      unsigned long long __ul; \ +     } __tmp; \ +     __tmp.__ul = var; \ +     __tmp.__val; }) + + +_END_STD_C + +#endif diff --git a/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_usart.h b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_usart.h new file mode 100644 index 0000000..6c4697d --- /dev/null +++ b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE/nlao_usart.h @@ -0,0 +1,208 @@ +/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */ + +/*This file is prepared for Doxygen automatic documentation generation.*/ +/*! \file ********************************************************************* + * + * \brief NEWLIB_ADDONS USART include file for AVR32. + * + * - Compiler:           GNU GCC for AVR32 + * - Supported devices:  All AVR32 devices can be used. + * - AppNote: + * + * \author               Atmel Corporation: http://www.atmel.com \n + *                       Support and FAQ: http://support.atmel.no/ + * + ******************************************************************************/ + +/* 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: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name of Atmel may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 4. This software may only be redistributed and used in connection with an Atmel + * AVR product. + * + * 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 + * EXPRESSLY AND SPECIFICALLY 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 __AVR32_NEWLIB_ADDONS_USART_H__ +#define __AVR32_NEWLIB_ADDONS_USART_H__ + +#include <_ansi.h> + +#include "nlao_io.h" + +_BEGIN_STD_C + +struct usart3 { +	volatile u32	us_cr; +	volatile u32	us_mr; +	volatile u32	us_ier; +	volatile u32	us_idr; +	volatile u32	us_imr; +	volatile u32	us_csr; +	volatile u32	us_rhr; +	volatile u32	us_thr; +	volatile u32	us_brgr; +	volatile u32	us_rtor; +	volatile u32	us_ttgr; +	volatile u32	us_reserved[5]; +	volatile u32	us_fidi; +	volatile u32	us_ner; +	volatile u32	us_xxr; +	volatile u32	us_if; +}; + +/* Register offsets */ +#define US_CR			0x0000 +#define US_MR			0x0004 +#define US_IER			0x0008 +#define US_IDR			0x000c +#define US_IMR			0x0010 +#define US_CSR			0x0014 +#define US_RHR			0x0018 +#define US_THR			0x001c +#define US_BRGR			0x0020 +#define US_RTOR			0x0024 +#define US_TTGR			0x0028 + +#define US_FIDI			0x0040 +#define US_NER			0x0044 +#define US_XXR			0x0048 +#define US_IF			0x004c + +#define US_RPR                  0x0100 +#define US_RCR                  0x0104 +#define US_TPR                  0x0108 +#define US_TCR                  0x010c +#define US_RNPR                 0x0110 +#define US_RNCR                 0x0114 +#define US_TNPR                 0x0118 +#define US_TNCR                 0x011c +#define US_PTCR                 0x0120 +#define US_PTSR                 0x0124 + + + + +/* USART3 Control Register */ +#define US_CR_RSTRX		(1 <<  2) +#define US_CR_RSTTX		(1 <<  3) +#define US_CR_RXEN		(1 <<  4) +#define US_CR_RXDIS		(1 <<  5) +#define US_CR_TXEN		(1 <<  6) +#define US_CR_TXDIS		(1 <<  7) +#define US_CR_RSTSTA		(1 <<  8) +#define US_CR_STTBRK		(1 <<  9) +#define US_CR_STPBRK		(1 << 10) + +#define US_CR_DTREN		(1 << 16) +#define US_CR_DTRDIS		(1 << 17) +#define US_CR_RTSEN		(1 << 18) +#define US_CR_RTSDIS		(1 << 19) + +/* USART3 Mode Register */ +#define US_MR_MODE		(15 <<  0) +#define US_MR_MODE_NORMAL	( 0 <<  0) +#define US_MR_MODE_HWFLOW	( 2 <<  0) +#define US_MR_CLKS		( 3 <<  4) +#define US_MR_CLKS_CLOCK	( 0 <<  4) +#define US_MR_CLKS_FDIV1	( 1 <<  4) +#define US_MR_CLKS_SLOW		( 2 <<  4) +#define US_MR_CLKS_EXT		( 3 <<  4) +#define US_MR_CHRL_5BITS	( 0 <<  6) +#define US_MR_CHRL_6BITS	( 1 <<  6) +#define US_MR_CHRL_7BITS	( 2 <<  6) +#define US_MR_CHRL_8BITS	( 3 <<  6) +#define US_MR_SYNC		( 1 <<  8) +#define US_MR_PAR_EVEN		( 0 <<  9) +#define US_MR_PAR_ODD		( 1 <<  9) +#define US_MR_PAR_SPACE		( 2 <<  9) +#define US_MR_PAR_MARK		( 3 <<  9) +#define US_MR_PAR_NONE		( 4 <<  9) +#define US_MR_PAR_MDROP		( 6 <<  9) +#define US_MR_NBSTOP_1BIT	( 0 << 12) +#define US_MR_NBSTOP_1_5BIT	( 1 << 12) +#define US_MR_NBSTOP_2BITS	( 2 << 12) +#define US_MR_OVER		( 1 << 19) +#define US_MR_OVER_X16		( 0 << 19) +#define US_MR_OVER_X8		( 1 << 19) + +/* USART3 Channel Status Register */ +#define US_CSR_RXRDY		(1 <<  0) +#define US_CSR_TXRDY		(1 <<  1) +#define US_CSR_RXBRK		(1 <<  2) +#define US_CSR_ENDRX		(1 <<  3) +#define US_CSR_ENDTX		(1 <<  4) + + +#define US_CSR_OVRE		(1 <<  5) +#define US_CSR_FRAME		(1 <<  6) +#define US_CSR_PARE		(1 <<  7) + +#define US_CSR_TXEMPTY		(1 <<  9) + +#define US_CSR_TXBUFE           (1 << 11) +#define US_CSR_RXBUFF           (1 << 12) +#define US_CSR_RIIC		(1 << 16) +#define US_CSR_DSRIC		(1 << 17) +#define US_CSR_DCDIC		(1 << 18) +#define US_CSR_CTSIC		(1 << 19) +#define US_CSR_RI		(1 << 20) +#define US_CSR_DSR		(1 << 21) +#define US_CSR_DCD		(1 << 22) +#define US_CSR_CTS		(1 << 23) + +/* USART3 Baud Rate Generator Register */ +#define US_BRGR_CD_OFFSET	0 +#define US_BRGR_FP_OFFSET	16 + +#define US_BRGR_CD_SIZE		16 +#define US_BRGR_FP_SIZE		3 + +#define US_BRGR_CD		(0xFFFF <<  0) +#define US_BRGR_FP		(     7 << 16) + +/*USART3 PDC Transfer Control Register */ +#define US_PTCR_RXTEN           (1 << 0) +#define US_PTCR_RXTDIS          (1 << 1) +#define US_PTCR_TXTEN           (1 << 8) +#define US_PTCR_TXTDIS          (1 << 9) + +/*USART3 PDC Transfer Status Register */ +#define US_PTSR_RXTEN           (1 << 0) +#define US_PTSR_TXTEN           (1 << 8) + + +int usart_init(int baudrate); +void usart_putc(char c); +void usart_puts(const char *s); +int usart_getc(void); +int usart_tstc(void); +void usart_setbrg(int baudrate, int cpu_clock); +void set_usart_base(void *usart_base); + + +_END_STD_C + +#endif /* MERLIN_USART3_H */ diff --git a/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/libnewlib_addons-at32ucr2-speed_opt.a b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/libnewlib_addons-at32ucr2-speed_opt.aBinary files differ new file mode 100644 index 0000000..aa673ec --- /dev/null +++ b/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/libnewlib_addons-at32ucr2-speed_opt.a | 
