diff options
Diffstat (limited to '')
37 files changed, 1162 insertions, 672 deletions
diff --git a/bsps/arm/atsam/README b/bsps/arm/atsam/README index 2ebaa726c8..47aa11d2c0 100644 --- a/bsps/arm/atsam/README +++ b/bsps/arm/atsam/README @@ -59,9 +59,13 @@ Use ATSAM_CONSOLE_DEVICE_INDEX=XYZ to set the device index for /dev/console Use ATSAM_CONSOLE_USE_INTERRUPTS=XYZ to set the use interrupt driven mode for console devices (used by default). -Use ATSAM_MEMORY_TCM_SIZE=XYZ to set the size of tightly coupled memories (TCM) +Use ATSAM_MEMORY_NULL_SIZE=XYZ to set the size of NULL pointer protection area in bytes (default 0x00000000). +Use ATSAM_MEMORY_TCM_SIZE=XYZ to set the size of tightly coupled memories (TCM) +in bytes (default 0x00000000). Note: ITCM is reduced by the +ATSAM_MEMORY_NULL_SIZE. + Use ATSAM_MEMORY_INTFLASH_SIZE=XYZ to set the size of internal flash in bytes (default is derived from chip variant). diff --git a/bsps/arm/atsam/clock/systick-freq.c b/bsps/arm/atsam/clock/systick-freq.c index 060fa17c1e..33011a564d 100644 --- a/bsps/arm/atsam/clock/systick-freq.c +++ b/bsps/arm/atsam/clock/systick-freq.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp.h> diff --git a/bsps/arm/atsam/console/console.c b/bsps/arm/atsam/console/console.c index d51d2ace7d..0f82c0c0c4 100644 --- a/bsps/arm/atsam/console/console.c +++ b/bsps/arm/atsam/console/console.c @@ -1,21 +1,35 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp.h> #include <bsp/irq.h> #include <bsp/fatal.h> #include <rtems/console.h> +#include <rtems/seterr.h> #include <rtems/termiostypes.h> @@ -23,274 +37,92 @@ #include <unistd.h> +#define UART_RX_DMA_BUF_SIZE 32l + +typedef struct { + char buf[UART_RX_DMA_BUF_SIZE]; + LinkedListDescriporView3 desc; +} atsam_uart_rx_dma; + typedef struct { rtems_termios_device_context base; - Usart *regs; + Uart *regs; rtems_vector_number irq; uint32_t id; bool console; + bool is_usart; #ifdef ATSAM_CONSOLE_USE_INTERRUPTS bool transmitting; + bool rx_dma_enabled; + uint32_t rx_dma_channel; + atsam_uart_rx_dma *rx_dma; + char *volatile*rx_dma_da; + char *rx_next_read_pos; #endif -} atsam_usart_context; +} atsam_uart_context; -static atsam_usart_context atsam_usart_instances[] = { +static atsam_uart_context atsam_usart_instances[] = { { - .regs = USART0, + .regs = (Uart *)USART0, .irq = USART0_IRQn, - .id = ID_USART0 + .id = ID_USART0, + .is_usart = true, } #ifdef USART1 , { - .regs = USART1, + .regs = (Uart *)USART1, .irq = USART1_IRQn, - .id = ID_USART1 + .id = ID_USART1, + .is_usart = true, } #endif #ifdef USART2 , { - .regs = USART2, + .regs = (Uart *)USART2, .irq = USART2_IRQn, - .id = ID_USART2 + .id = ID_USART2, + .is_usart = true, } #endif }; -#ifdef ATSAM_CONSOLE_USE_INTERRUPTS -static void atsam_usart_interrupt(void *arg) -{ - rtems_termios_tty *tty = arg; - atsam_usart_context *ctx = rtems_termios_get_device_context(tty); - Usart *regs = ctx->regs; - uint32_t csr = regs->US_CSR; - - while ((csr & US_CSR_RXRDY) != 0) { - char c = (char) regs->US_RHR; - - rtems_termios_enqueue_raw_characters(tty, &c, 1); - - csr = regs->US_CSR; - } - - if (ctx->transmitting && (csr & US_CSR_TXEMPTY) != 0) { - rtems_termios_dequeue_characters(tty, 1); - } -} -#endif - -static bool atsam_usart_set_attributes( - rtems_termios_device_context *base, - const struct termios *term -) -{ - atsam_usart_context *ctx = (atsam_usart_context *) base; - Usart *regs = ctx->regs; - rtems_termios_baud_t baud; - uint32_t mr; - - baud = rtems_termios_baud_to_number(term->c_ospeed); - regs->US_BRGR = (BOARD_MCK / baud) / 16; - - if ((term->c_cflag & CREAD) != 0) { - regs->US_CR = US_CR_RXEN | US_CR_TXEN; - } else { - regs->US_CR = US_CR_TXEN; - } - - mr = US_MR_USART_MODE_NORMAL | US_MR_USCLKS_MCK; - - switch (term->c_cflag & CSIZE) { - case CS5: - mr |= US_MR_CHRL_5_BIT; - break; - case CS6: - mr |= US_MR_CHRL_6_BIT; - break; - case CS7: - mr |= US_MR_CHRL_7_BIT; - break; - default: - mr |= US_MR_CHRL_8_BIT; - break; - } - - if ((term->c_cflag & PARENB) != 0) { - if ((term->c_cflag & PARODD) != 0) { - mr |= US_MR_PAR_ODD; - } else { - mr |= US_MR_PAR_EVEN; - } - } else { - mr |= US_MR_PAR_NO; - } - - if ((term->c_cflag & CSTOPB) != 0) { - mr |= US_MR_NBSTOP_2_BIT; - } else { - mr |= US_MR_NBSTOP_1_BIT; - } - - regs->US_MR = mr; - - return true; -} - -static bool atsam_usart_first_open( - rtems_termios_tty *tty, - rtems_termios_device_context *base, - struct termios *term, - rtems_libio_open_close_args_t *args -) -{ - atsam_usart_context *ctx = (atsam_usart_context *) base; - Usart *regs = ctx->regs; -#ifdef ATSAM_CONSOLE_USE_INTERRUPTS - rtems_status_code sc; -#endif - - regs->US_CR = US_CR_RSTRX | US_CR_RSTTX | US_CR_RSTSTA; - regs->US_IDR = 0xffffffff; - - PMC_EnablePeripheral(ctx->id); - - rtems_termios_set_initial_baud(tty, ATSAM_CONSOLE_BAUD); - atsam_usart_set_attributes(base, term); - -#ifdef ATSAM_CONSOLE_USE_INTERRUPTS - regs->US_IER = US_IDR_RXRDY; - sc = rtems_interrupt_handler_install( - ctx->irq, - "USART", - RTEMS_INTERRUPT_SHARED, - atsam_usart_interrupt, - tty - ); - if (sc != RTEMS_SUCCESSFUL) { - return false; - } -#endif - - return true; -} - -static void atsam_usart_last_close( - rtems_termios_tty *tty, - rtems_termios_device_context *base, - rtems_libio_open_close_args_t *args -) -{ - atsam_usart_context *ctx = (atsam_usart_context *) base; - -#ifdef ATSAM_CONSOLE_USE_INTERRUPTS - rtems_interrupt_handler_remove(ctx->irq, atsam_usart_interrupt, tty); -#endif - - if (!ctx->console) { - PMC_DisablePeripheral(ctx->id); - } -} - -static void atsam_usart_write( - rtems_termios_device_context *base, - const char *buf, - size_t len -) -{ - atsam_usart_context *ctx = (atsam_usart_context *) base; - Usart *regs = ctx->regs; - -#ifdef ATSAM_CONSOLE_USE_INTERRUPTS - if (len > 0) { - ctx->transmitting = true; - regs->US_THR = buf[0]; - regs->US_IER = US_IDR_TXEMPTY; - } else { - ctx->transmitting = false; - regs->US_IDR = US_IDR_TXEMPTY; - } -#else - size_t i; - - for (i = 0; i < len; ++i) { - while ((regs->US_CSR & US_CSR_TXEMPTY) == 0) { - /* Wait */ - } - - regs->US_THR = buf[i]; - } -#endif -} - -#ifndef ATSAM_CONSOLE_USE_INTERRUPTS -static int atsam_usart_read(rtems_termios_device_context *base) -{ - atsam_usart_context *ctx = (atsam_usart_context *) base; - Usart *regs = ctx->regs; - - if ((regs->US_CSR & US_CSR_RXRDY) != 0) { - return (char) regs->US_RHR; - } else { - return -1; - } -} -#endif - -static const rtems_termios_device_handler atsam_usart_handler = { - .first_open = atsam_usart_first_open, - .last_close = atsam_usart_last_close, - .write = atsam_usart_write, - .set_attributes = atsam_usart_set_attributes, -#ifdef ATSAM_CONSOLE_USE_INTERRUPTS - .mode = TERMIOS_IRQ_DRIVEN -#else - .poll_read = atsam_usart_read, - .mode = TERMIOS_POLLED -#endif -}; - -typedef struct { - rtems_termios_device_context base; - Uart *regs; - rtems_vector_number irq; - uint32_t id; - bool console; -#ifdef ATSAM_CONSOLE_USE_INTERRUPTS - bool transmitting; -#endif -} atsam_uart_context; - static atsam_uart_context atsam_uart_instances[] = { { .regs = UART0, .irq = UART0_IRQn, - .id = ID_UART0 + .id = ID_UART0, + .is_usart = false, } #ifdef UART1 , { .regs = UART1, .irq = UART1_IRQn, - .id = ID_UART1 + .id = ID_UART1, + .is_usart = false, } #endif #ifdef UART2 , { .regs = UART2, .irq = UART2_IRQn, - .id = ID_UART2 + .id = ID_UART2, + .is_usart = false, } #endif #ifdef UART3 , { .regs = UART3, .irq = UART3_IRQn, - .id = ID_UART3 + .id = ID_UART3, + .is_usart = false, } #endif #ifdef UART4 , { .regs = UART4, .irq = UART4_IRQn, - .id = ID_UART4 + .id = ID_UART4, + .is_usart = false, } #endif }; @@ -303,16 +135,32 @@ static void atsam_uart_interrupt(void *arg) Uart *regs = ctx->regs; uint32_t sr = regs->UART_SR; - while ((sr & UART_SR_RXRDY) != 0) { - char c = (char) regs->UART_RHR; + if (!ctx->rx_dma_enabled) { + while ((sr & UART_SR_RXRDY) != 0) { + char c = (char) regs->UART_RHR; - rtems_termios_enqueue_raw_characters(tty, &c, 1); + rtems_termios_enqueue_raw_characters(tty, &c, 1); - sr = regs->UART_SR; + sr = regs->UART_SR; + } + } else { + while (*ctx->rx_dma_da != ctx->rx_next_read_pos) { + char c; + + c = *ctx->rx_next_read_pos; + + ++ctx->rx_next_read_pos; + if (ctx->rx_next_read_pos >= &ctx->rx_dma->buf[UART_RX_DMA_BUF_SIZE]) { + ctx->rx_next_read_pos = &ctx->rx_dma->buf[0]; + } + + rtems_termios_enqueue_raw_characters(tty, &c, 1); + } } - if (ctx->transmitting && (sr & UART_SR_TXEMPTY) != 0) { + while (ctx->transmitting && (sr & UART_SR_TXRDY) != 0) { rtems_termios_dequeue_characters(tty, 1); + sr = regs->UART_SR; } } #endif @@ -336,10 +184,31 @@ static bool atsam_uart_set_attributes( regs->UART_CR = UART_CR_TXEN; } - mr = UART_MR_FILTER_DISABLED | UART_MR_BRSRCCK_PERIPH_CLK; - - if ((term->c_cflag & CSIZE) != CS8) { - return false; + if (ctx->is_usart) { + mr = US_MR_USART_MODE_NORMAL | US_MR_USCLKS_MCK; + } else { + mr = UART_MR_FILTER_DISABLED | UART_MR_BRSRCCK_PERIPH_CLK; + } + + if (ctx->is_usart) { + switch (term->c_cflag & CSIZE) { + case CS5: + mr |= US_MR_CHRL_5_BIT; + break; + case CS6: + mr |= US_MR_CHRL_6_BIT; + break; + case CS7: + mr |= US_MR_CHRL_7_BIT; + break; + default: + mr |= US_MR_CHRL_8_BIT; + break; + } + } else { + if ((term->c_cflag & CSIZE) != CS8) { + return false; + } } if ((term->c_cflag & PARENB) != 0) { @@ -352,8 +221,16 @@ static bool atsam_uart_set_attributes( mr |= UART_MR_PAR_NO; } - if ((term->c_cflag & CSTOPB) != 0) { - return false; + if (ctx->is_usart) { + if ((term->c_cflag & CSTOPB) != 0) { + mr |= US_MR_NBSTOP_2_BIT; + } else { + mr |= US_MR_NBSTOP_1_BIT; + } + } else { + if ((term->c_cflag & CSTOPB) != 0) { + return false; + } } regs->UART_MR = mr; @@ -361,6 +238,118 @@ static bool atsam_uart_set_attributes( return true; } +static void atsam_uart_disable_rx_dma(atsam_uart_context *ctx) +{ + if (ctx->rx_dma) { + rtems_cache_coherent_free(ctx->rx_dma); + ctx->rx_dma = NULL; + } + + if (ctx->rx_dma_channel != XDMAD_ALLOC_FAILED) { + XDMAD_FreeChannel(&XDMAD_Instance, ctx->rx_dma_channel); + } + + ctx->rx_dma_enabled = false; +} + +static rtems_status_code atsam_uart_enable_rx_dma(atsam_uart_context *ctx) +{ + eXdmadRC rc; + int channel_id; + + if (ctx->rx_dma_enabled) { + return RTEMS_SUCCESSFUL; + } + + /* + * Make sure everything is in a clean default state so that the cleanup works + * in an error case. + */ + ctx->rx_dma = NULL; + ctx->rx_dma_channel = XDMAD_ALLOC_FAILED; + + ctx->rx_dma = rtems_cache_coherent_allocate(sizeof(*ctx->rx_dma), 0, 0); + if (ctx->rx_dma == NULL) { + atsam_uart_disable_rx_dma(ctx); + return RTEMS_NO_MEMORY; + } + + ctx->rx_next_read_pos = &ctx->rx_dma->buf[0]; + + ctx->rx_dma_channel = XDMAD_AllocateChannel( + &XDMAD_Instance, + XDMAD_TRANSFER_MEMORY, + ctx->id + ); + + if (ctx->rx_dma_channel == XDMAD_ALLOC_FAILED) { + atsam_uart_disable_rx_dma(ctx); + return RTEMS_IO_ERROR; + } + + rc = XDMAD_PrepareChannel(&XDMAD_Instance, ctx->rx_dma_channel); + if (rc != XDMAD_OK) { + atsam_uart_disable_rx_dma(ctx); + return RTEMS_IO_ERROR; + } + + channel_id = ctx->rx_dma_channel & 0xff; + ctx->rx_dma_da = + (char *volatile*) &XDMAD_Instance.pXdmacs->XDMAC_CHID[channel_id].XDMAC_CDA; + + ctx->rx_dma->desc.mbr_nda = (uint32_t)&ctx->rx_dma->desc; + ctx->rx_dma->desc.mbr_ubc = + 1 | + XDMA_UBC_NVIEW_NDV3 | + XDMA_UBC_NDE_FETCH_EN | + XDMA_UBC_NDEN_UPDATED | + XDMA_UBC_NSEN_UPDATED; + ctx->rx_dma->desc.mbr_sa = (uint32_t) &ctx->regs->UART_RHR; + ctx->rx_dma->desc.mbr_da = (uint32_t) &ctx->rx_dma->buf[0]; + ctx->rx_dma->desc.mbr_cfg = + XDMAC_CC_TYPE_PER_TRAN | + XDMAC_CC_MBSIZE_SINGLE | + XDMAC_CC_DSYNC_PER2MEM | + XDMAC_CC_SWREQ_HWR_CONNECTED | + XDMAC_CC_MEMSET_NORMAL_MODE | + XDMAC_CC_CSIZE_CHK_1 | + XDMAC_CC_DWIDTH_BYTE | + XDMAC_CC_SIF_AHB_IF1 | + XDMAC_CC_DIF_AHB_IF1 | + XDMAC_CC_SAM_FIXED_AM | + XDMAC_CC_DAM_UBS_AM | + XDMAC_CC_PERID(XDMAIF_Get_ChannelNumber(ctx->id, XDMAD_TRANSFER_RX)); + ctx->rx_dma->desc.mbr_bc = UART_RX_DMA_BUF_SIZE - 1; + ctx->rx_dma->desc.mbr_ds = 0; + ctx->rx_dma->desc.mbr_sus = 0; + ctx->rx_dma->desc.mbr_dus = 0; + + rc = XDMAD_ConfigureTransfer( + &XDMAD_Instance, + ctx->rx_dma_channel, + NULL, + XDMAC_CNDC_NDE_DSCR_FETCH_EN | + XDMAC_CNDC_NDVIEW_NDV3 | + XDMAC_CNDC_NDDUP_DST_PARAMS_UPDATED | + XDMAC_CNDC_NDSUP_SRC_PARAMS_UPDATED, + (uint32_t)&ctx->rx_dma->desc, + 0); + if (rc != XDMAD_OK) { + atsam_uart_disable_rx_dma(ctx); + return RTEMS_IO_ERROR; + } + + rc = XDMAD_StartTransfer(&XDMAD_Instance, ctx->rx_dma_channel); + if (rc != XDMAD_OK) { + atsam_uart_disable_rx_dma(ctx); + return RTEMS_IO_ERROR; + } + + ctx->rx_dma_enabled = true; + + return RTEMS_SUCCESSFUL; +} + static bool atsam_uart_first_open( rtems_termios_tty *tty, rtems_termios_device_context *base, @@ -386,7 +375,7 @@ static bool atsam_uart_first_open( regs->UART_IER = UART_IDR_RXRDY; sc = rtems_interrupt_handler_install( ctx->irq, - "UART", + ctx->is_usart ? "USART" : "UART", RTEMS_INTERRUPT_SHARED, atsam_uart_interrupt, tty @@ -411,6 +400,10 @@ static void atsam_uart_last_close( rtems_interrupt_handler_remove(ctx->irq, atsam_uart_interrupt, tty); #endif + if (ctx->rx_dma_enabled) { + atsam_uart_disable_rx_dma(ctx); + } + if (!ctx->console) { PMC_DisablePeripheral(ctx->id); } @@ -429,16 +422,16 @@ static void atsam_uart_write( if (len > 0) { ctx->transmitting = true; regs->UART_THR = buf[0]; - regs->UART_IER = UART_IDR_TXEMPTY; + regs->UART_IER = UART_IDR_TXRDY; } else { ctx->transmitting = false; - regs->UART_IDR = UART_IDR_TXEMPTY; + regs->UART_IDR = UART_IDR_TXRDY; } #else size_t i; for (i = 0; i < len; ++i) { - while ((regs->UART_SR & UART_SR_TXEMPTY) == 0) { + while ((regs->UART_SR & UART_SR_TXRDY) == 0) { /* Wait */ } @@ -461,13 +454,41 @@ static int atsam_uart_read(rtems_termios_device_context *base) } #endif +#ifdef ATSAM_CONSOLE_USE_INTERRUPTS +static int atsam_uart_ioctl( + rtems_termios_device_context *base, + ioctl_command_t request, + void *buffer +) +{ + atsam_uart_context *ctx = (atsam_uart_context *) base; + rtems_status_code sc; + + switch (request) { + case ATSAM_UART_ENABLE_RX_DMA: + sc = atsam_uart_enable_rx_dma(ctx); + if (sc != RTEMS_SUCCESSFUL) { + rtems_set_errno_and_return_minus_one(EIO); + } else { + ctx->rx_dma_enabled = true; + } + break; + default: + rtems_set_errno_and_return_minus_one(EINVAL); + } + + return 0; +} +#endif + static const rtems_termios_device_handler atsam_uart_handler = { .first_open = atsam_uart_first_open, .last_close = atsam_uart_last_close, .write = atsam_uart_write, .set_attributes = atsam_uart_set_attributes, #ifdef ATSAM_CONSOLE_USE_INTERRUPTS - .mode = TERMIOS_IRQ_DRIVEN + .mode = TERMIOS_IRQ_DRIVEN, + .ioctl = atsam_uart_ioctl, #else .poll_read = atsam_uart_read, .mode = TERMIOS_POLLED @@ -490,7 +511,7 @@ rtems_status_code console_initialize( usart[sizeof(usart) - 2] = (char) ('0' + i); rtems_termios_device_install( &usart[0], - &atsam_usart_handler, + &atsam_uart_handler, NULL, &atsam_usart_instances[i].base ); diff --git a/bsps/arm/atsam/console/debug-console.c b/bsps/arm/atsam/console/debug-console.c index 9ddc98bd93..cafd17e578 100644 --- a/bsps/arm/atsam/console/debug-console.c +++ b/bsps/arm/atsam/console/debug-console.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <rtems/bspIo.h> diff --git a/bsps/arm/atsam/contrib/doxygen.h b/bsps/arm/atsam/contrib/doxygen.h index ff8c9bd584..9ca6b227ed 100644 --- a/bsps/arm/atsam/contrib/doxygen.h +++ b/bsps/arm/atsam/contrib/doxygen.h @@ -1,4 +1,12 @@ /** + * @file + * + * @ingroup RTEMSImplDoxygen + * + * @brief This header file defines BSP-specific groups. + */ + +/** * @defgroup RTEMSBSPsARMAtsamContrib Contributed Code * * @ingroup RTEMSBSPsARMAtsam diff --git a/bsps/arm/atsam/contrib/libraries/libboard/source/board_lowlevel.c b/bsps/arm/atsam/contrib/libraries/libboard/source/board_lowlevel.c index cbdf41ba73..a2dd595fb5 100644 --- a/bsps/arm/atsam/contrib/libraries/libboard/source/board_lowlevel.c +++ b/bsps/arm/atsam/contrib/libraries/libboard/source/board_lowlevel.c @@ -347,6 +347,23 @@ void _SetupMemoryRegion(void) SCB->SHCSR |= (SCB_SHCSR_MEMFAULTENA_Msk | SCB_SHCSR_BUSFAULTENA_Msk | SCB_SHCSR_USGFAULTENA_Msk); +#ifdef __rtems__ + dwRegionBaseAddr = + ((uintptr_t)atsam_memory_null_begin) | + MPU_REGION_VALID | + MPU_NULL_REGION; + if (atsam_memory_null_begin != atsam_memory_itcm_end) { + dwRegionAttr = + MPU_AP_NO_ACCESS | + MPU_REGION_EXECUTE_NEVER | + MPU_CalMPURegionSize((uintptr_t)atsam_memory_null_size) | + MPU_REGION_ENABLE; + } else { + dwRegionAttr = MPU_REGION_DISABLE; + } + MPU_SetRegion(dwRegionBaseAddr, dwRegionAttr); +#endif /* __rtems__ */ + /* Enable the MPU region */ #ifndef __rtems__ MPU_Enable(MPU_ENABLE | MPU_PRIVDEFENA); diff --git a/bsps/arm/atsam/i2c/atsam_i2c_bus.c b/bsps/arm/atsam/i2c/atsam_i2c_bus.c index 4425975de8..fca48c580d 100644 --- a/bsps/arm/atsam/i2c/atsam_i2c_bus.c +++ b/bsps/arm/atsam/i2c/atsam_i2c_bus.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp/atsam-clock-config.h> @@ -33,72 +46,65 @@ static void atsam_i2c_disable_interrupts(Twihs *regs) { - regs->TWIHS_IDR = 0xFFFFFFFF; + TWI_DisableIt(regs, 0xFFFFFFFF); } -static void -atsam_i2c_set_transfer_status(transfer_desc *trans_desc, transfer_state state) +/* + * Return true if the message is done right after this. That is the case if all + * bytes are received but no stop is requested. + */ +static bool +atsam_i2c_continue_read(Twihs *regs, atsam_i2c_bus *bus) { - trans_desc->trans_state = state; -} + bool done = false; -static void -atsam_i2c_continue_read(Twihs *regs, transfer_desc *trans_desc) -{ - trans_desc->data[trans_desc->already_transferred] = TWI_ReadByte(regs); - trans_desc->already_transferred++; + *bus->current_msg_byte = TWI_ReadByte(regs); + ++bus->current_msg_byte; + --bus->current_msg_todo; /* check for transfer finish */ - if (trans_desc->already_transferred == trans_desc->data_size) { - if (trans_desc->stop_request){ + if (bus->current_msg_todo == 0) { + if (bus->stop_request){ TWI_DisableIt(regs, TWIHS_IDR_RXRDY); TWI_EnableIt(regs, TWIHS_IER_TXCOMP); - atsam_i2c_set_transfer_status(trans_desc, TX_RX_STOP_SENT); } else { - atsam_i2c_set_transfer_status(trans_desc, RX_CONT_MESSAGE_NEEDED); + done = true; } } /* Last byte? */ - else if ((trans_desc->already_transferred == (trans_desc->data_size - 1)) - && (trans_desc->stop_request)){ + else if (bus->current_msg_todo == 1 && bus->stop_request) { TWI_Stop(regs); } + + return done; } +/* + * Return true if the message is done right after this. That is the case if all + * bytes are sent but no stop is requested. + */ static bool -atsam_i2c_is_state(transfer_desc *trans_desc, transfer_state state) +atsam_i2c_continue_write(Twihs *regs, atsam_i2c_bus *bus) { - return (trans_desc->trans_state == state); -} + bool done = false; -static void -atsam_i2c_continue_write(Twihs *regs, transfer_desc *trans_desc) -{ /* Transfer finished ? */ - if (trans_desc->already_transferred == trans_desc->data_size) { + if (bus->current_msg_todo == 0) { TWI_DisableIt(regs, TWIHS_IDR_TXRDY); - if (trans_desc->stop_request){ + if (bus->stop_request){ TWI_EnableIt(regs, TWIHS_IER_TXCOMP); TWI_SendSTOPCondition(regs); - atsam_i2c_set_transfer_status(trans_desc, TX_RX_STOP_SENT); } else { - atsam_i2c_set_transfer_status(trans_desc, TX_CONT_MESSAGE_NEEDED); + done = true; } } /* Bytes remaining */ else { - TWI_WriteByte(regs, - trans_desc->data[trans_desc->already_transferred]); - trans_desc->already_transferred++; + TWI_WriteByte(regs, *bus->current_msg_byte); + ++bus->current_msg_byte; + --bus->current_msg_todo; } -} - -static void -atsam_i2c_finish_write_transfer(Twihs *regs, transfer_desc *trans_desc) -{ - TWI_ReadByte(regs); - TWI_DisableIt(regs, TWIHS_IDR_TXCOMP); - trans_desc->status = 0; + return done; } static void @@ -115,19 +121,6 @@ atsam_i2c_next_packet(atsam_i2c_bus *bus) bus->current_msg_byte = msg->buf; } -static void -atsam_i2c_set_td(atsam_i2c_bus *bus, uint32_t already_transferred, - bool stop_needed) -{ - transfer_desc *trans_desc = &bus->trans_desc; - - trans_desc->status = ASYNC_STATUS_PENDING; - trans_desc->data = bus->current_msg_byte; - trans_desc->data_size = bus->current_msg_todo; - trans_desc->already_transferred = already_transferred; - trans_desc->stop_request = stop_needed; -} - static bool atsam_i2c_set_address_size(const i2c_msg *msg) { @@ -186,6 +179,8 @@ atsam_i2c_setup_write_transfer(atsam_i2c_bus *bus, Twihs *regs, bool ctrl, { atsam_i2c_set_address_regs(regs, slave_addr, ctrl, false); TWI_WriteByte(regs, *bus->current_msg_byte); + ++bus->current_msg_byte; + --bus->current_msg_todo; TWI_EnableIt(regs, TWIHS_IER_TXRDY); } @@ -197,8 +192,8 @@ atsam_i2c_setup_transfer(atsam_i2c_bus *bus, Twihs *regs) uint32_t msg_todo = bus->msg_todo; uint16_t slave_addr; bool ten_bit_addr = false; - uint32_t already_transferred; bool stop_needed = true; + bool read; ten_bit_addr = atsam_i2c_set_address_size(msgs); @@ -206,22 +201,17 @@ atsam_i2c_setup_transfer(atsam_i2c_bus *bus, Twihs *regs) stop_needed = false; } - bus->read = (msgs->flags & I2C_M_RD) != 0; + read = (msgs->flags & I2C_M_RD) != 0; slave_addr = msgs->addr; - already_transferred = (bus->read == true) ? 0 : 1; - atsam_i2c_set_td(bus, already_transferred, stop_needed); - - transfer_desc *trans_desc = &bus->trans_desc; + bus->stop_request = stop_needed; - if (bus->read){ + if (read){ if (bus->current_msg_todo == 1){ send_stop = true; } - atsam_i2c_set_transfer_status(trans_desc, RX_SEND_DATA); atsam_i2c_setup_read_transfer(regs, ten_bit_addr, slave_addr, send_stop); } else { - atsam_i2c_set_transfer_status(trans_desc, TX_SEND_DATA); atsam_i2c_setup_write_transfer(bus, regs, ten_bit_addr, slave_addr); } @@ -233,40 +223,28 @@ atsam_i2c_interrupt(void *arg) atsam_i2c_bus *bus = arg; uint32_t irqstatus; bool done = false; - transfer_desc *trans_desc; Twihs *regs = bus->regs; /* read interrupts */ - irqstatus = regs->TWIHS_SR; + irqstatus = TWI_GetMaskedStatus(regs); - if((irqstatus & (TWIHS_SR_ARBLST | TWIHS_SR_NACK)) != 0) { + if((irqstatus & ATSAMV_I2C_IRQ_ERROR) != 0) { done = true; - } - - trans_desc = &bus->trans_desc; - - if (((irqstatus & TWIHS_SR_RXRDY) != 0) && - (atsam_i2c_is_state(trans_desc, RX_SEND_DATA))){ - /* carry on read transfer */ - atsam_i2c_continue_read(regs, trans_desc); - } else if (((irqstatus & TWIHS_SR_TXCOMP) != 0) && - (atsam_i2c_is_state(trans_desc, TX_RX_STOP_SENT))){ - atsam_i2c_finish_write_transfer(regs, trans_desc); + } else if ((irqstatus & TWIHS_SR_RXRDY) != 0) { + done = atsam_i2c_continue_read(regs, bus); + } else if ((irqstatus & TWIHS_SR_TXCOMP) != 0) { + TWI_DisableIt(regs, TWIHS_IDR_TXCOMP); done = true; - } else if (((irqstatus & TWIHS_SR_TXRDY) != 0) && - (atsam_i2c_is_state(trans_desc, TX_SEND_DATA))){ - atsam_i2c_continue_write(regs, trans_desc); - if (trans_desc->trans_state == TX_CONT_MESSAGE_NEEDED){ - done = true; - } + } else if ((irqstatus & TWIHS_SR_TXRDY) != 0) { + done = atsam_i2c_continue_write(regs, bus); } if(done){ - uint32_t err = irqstatus & ATSAMV_I2C_IRQ_ERROR; + bus->err = irqstatus & ATSAMV_I2C_IRQ_ERROR; atsam_i2c_next_packet(bus); - if (bus->msg_todo == 0 || err != 0) { + if (bus->msg_todo == 0 || bus->err != 0) { atsam_i2c_disable_interrupts(regs); rtems_binary_semaphore_post(&bus->sem); } else { @@ -291,27 +269,38 @@ atsam_i2c_transfer(i2c_bus *base, i2c_msg *msgs, uint32_t msg_count) if ((msgs[i].flags & I2C_M_RECV_LEN) != 0) { return -EINVAL; } + if (msgs[i].len == 0) { + /* Hardware doesn't support zero length messages */ + return -EINVAL; + } } bus->msgs = &msgs[0]; bus->msg_todo = msg_count; bus->current_msg_todo = msgs[0].len; bus->current_msg_byte = msgs[0].buf; + bus->err = 0; regs = bus->regs; - atsam_i2c_setup_transfer(bus, regs); + /* Start with a clean start. Enable error interrupts. */ + TWI_ConfigureMaster(bus->regs, bus->output_clock, BOARD_MCK); + TWI_EnableIt(regs, ATSAMV_I2C_IRQ_ERROR); - regs->TWIHS_IER = ATSAMV_I2C_IRQ_ERROR; + atsam_i2c_setup_transfer(bus, regs); eno = rtems_binary_semaphore_wait_timed_ticks( &bus->sem, bus->base.timeout ); - if (eno != 0) { + if (eno != 0 || bus->err != 0) { TWI_ConfigureMaster(bus->regs, bus->output_clock, BOARD_MCK); rtems_binary_semaphore_try_wait(&bus->sem); - return -ETIMEDOUT; + if (bus->err != 0) { + return -EIO; + } else { + return -ETIMEDOUT; + } } return 0; diff --git a/bsps/arm/atsam/i2c/atsam_i2c_init.c b/bsps/arm/atsam/i2c/atsam_i2c_init.c index 1c31fbe899..fb51e2f47a 100644 --- a/bsps/arm/atsam/i2c/atsam_i2c_init.c +++ b/bsps/arm/atsam/i2c/atsam_i2c_init.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp/atsam-i2c.h> diff --git a/bsps/arm/atsam/include/bsp.h b/bsps/arm/atsam/include/bsp.h index 2556f6046d..252db0d56c 100644 --- a/bsps/arm/atsam/include/bsp.h +++ b/bsps/arm/atsam/include/bsp.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -5,17 +7,28 @@ */ /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 LIBBSP_ARM_ATSAM_BSP_H @@ -33,6 +46,7 @@ #include <bspopts.h> #include <bsp/default-initial-extension.h> +#include <sys/ioccom.h> #include <rtems.h> @@ -75,6 +89,10 @@ typedef struct { uint8_t phy_addr; } if_atsam_config; +extern char atsam_memory_null_begin[]; +extern char atsam_memory_null_end[]; +extern char atsam_memory_null_size[]; + extern char atsam_memory_dtcm_begin[]; extern char atsam_memory_dtcm_end[]; extern char atsam_memory_dtcm_size[]; @@ -109,6 +127,18 @@ void atsam_rtc_get_time(rtems_time_of_day *tod); void bsp_restart( const void *const addr ); +/* + * This ioctl enables the receive DMA for an UART. The DMA can be usefull if you + * loose characters in high interrupt load situations. + * + * Disabling the DMA again is only possible by closing all file descriptors of + * that UART. + * + * Note that every UART needs one DMA channel and the system has only a limited + * amount of DMAs. So only use it if you need it. + */ +#define ATSAM_UART_ENABLE_RX_DMA _IO('d', 0) + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/bsps/arm/atsam/include/bsp/atsam-clock-config.h b/bsps/arm/atsam/include/bsp/atsam-clock-config.h index 22ca84b8e6..0e8cb25a30 100644 --- a/bsps/arm/atsam/include/bsp/atsam-clock-config.h +++ b/bsps/arm/atsam/include/bsp/atsam-clock-config.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2017 embedded brains GmbH. All rights reserved. + * Copyright (c) 2017 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 ATSAM_CLOCK_CONFIG_H diff --git a/bsps/arm/atsam/include/bsp/atsam-i2c.h b/bsps/arm/atsam/include/bsp/atsam-i2c.h index ae0fe97584..9c6ad859dd 100644 --- a/bsps/arm/atsam/include/bsp/atsam-i2c.h +++ b/bsps/arm/atsam/include/bsp/atsam-i2c.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 LIBBSP_ARM_ATSAM_ATSAM_I2C_H @@ -28,35 +41,23 @@ extern "C" { #define TWI_AMOUNT_PINS 2 -typedef enum { - TX_SEND_DATA, - TX_SEND_STOP, - TX_CONT_MESSAGE_NEEDED, - RX_SEND_DATA, - RX_SEND_STOP, - RX_CONT_MESSAGE_NEEDED, - TX_RX_STOP_SENT -}transfer_state; - -typedef struct { - uint8_t status; - uint8_t *data; - bool stop_request; - uint32_t data_size; - uint32_t already_transferred; - transfer_state trans_state; -} transfer_desc; - typedef struct { i2c_bus base; - i2c_msg *msgs; Twihs *regs; - transfer_desc trans_desc; + + /* First message and number of messages that have to be processed. */ + i2c_msg *msgs; uint32_t msg_todo; + + /* Information about the current transfer. */ + bool stop_request; uint32_t current_msg_todo; uint8_t *current_msg_byte; + + /* Error information that can be returned to the task */ + uint32_t err; + uint32_t output_clock; - bool read; rtems_binary_semaphore sem; rtems_vector_number irq; } atsam_i2c_bus; diff --git a/bsps/arm/atsam/include/bsp/atsam-spi.h b/bsps/arm/atsam/include/bsp/atsam-spi.h index 487795c0db..3ee1e56792 100644 --- a/bsps/arm/atsam/include/bsp/atsam-spi.h +++ b/bsps/arm/atsam/include/bsp/atsam-spi.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 LIBBSP_ARM_ATSAM_ATSAM_SPI_H diff --git a/bsps/arm/atsam/include/bsp/i2c.h b/bsps/arm/atsam/include/bsp/i2c.h index 1ea1204ff5..f52e31f099 100644 --- a/bsps/arm/atsam/include/bsp/i2c.h +++ b/bsps/arm/atsam/include/bsp/i2c.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 LIBBSP_ARM_ATSAM_I2C_H diff --git a/bsps/arm/atsam/include/bsp/iocopy.h b/bsps/arm/atsam/include/bsp/iocopy.h index 27e374747e..293c681478 100644 --- a/bsps/arm/atsam/include/bsp/iocopy.h +++ b/bsps/arm/atsam/include/bsp/iocopy.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2018 embedded brains GmbH. All rights reserved. + * Copyright (c) 2018 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 ATSAM_IOCOPY_H diff --git a/bsps/arm/atsam/include/bsp/irq.h b/bsps/arm/atsam/include/bsp/irq.h index e788570469..6b7352482c 100644 --- a/bsps/arm/atsam/include/bsp/irq.h +++ b/bsps/arm/atsam/include/bsp/irq.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 LIBBSP_ARM_ATSAM_ESV_70_IRQ_H diff --git a/bsps/arm/atsam/include/bsp/pin-config.h b/bsps/arm/atsam/include/bsp/pin-config.h index 8f4a61428f..3ef77f92a8 100644 --- a/bsps/arm/atsam/include/bsp/pin-config.h +++ b/bsps/arm/atsam/include/bsp/pin-config.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 LIBBSP_ARM_ATSAM_PIN_CONFIG_H diff --git a/bsps/arm/atsam/include/bsp/power.h b/bsps/arm/atsam/include/bsp/power.h index 77a8c33869..606d34b654 100644 --- a/bsps/arm/atsam/include/bsp/power.h +++ b/bsps/arm/atsam/include/bsp/power.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 LIBBSP_ARM_ATSAM_POWER_H diff --git a/bsps/arm/atsam/include/bsp/sc16is752.h b/bsps/arm/atsam/include/bsp/sc16is752.h index e27f80bf97..954858c721 100644 --- a/bsps/arm/atsam/include/bsp/sc16is752.h +++ b/bsps/arm/atsam/include/bsp/sc16is752.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 LIBBSP_ARM_ATSAM_SC16IS752_H diff --git a/bsps/arm/atsam/include/bsp/spi.h b/bsps/arm/atsam/include/bsp/spi.h index 958e629ba3..9736186962 100644 --- a/bsps/arm/atsam/include/bsp/spi.h +++ b/bsps/arm/atsam/include/bsp/spi.h @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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 LIBBSP_ARM_ATSAM_SPI_H diff --git a/bsps/arm/atsam/include/libchip/include/mpu.h b/bsps/arm/atsam/include/libchip/include/mpu.h index a5d00a681b..034ba58474 100644 --- a/bsps/arm/atsam/include/libchip/include/mpu.h +++ b/bsps/arm/atsam/include/libchip/include/mpu.h @@ -56,6 +56,7 @@ #endif #define MPU_SYSTEM_REGION (12) #ifdef __rtems__ +#define MPU_NULL_REGION (13) /* Reserve the region with highest priority for user applications */ #define MPU_USER_DEFINED_REGION (15) #endif /* __rtems__ */ diff --git a/bsps/arm/atsam/rtc/rtc-config.c b/bsps/arm/atsam/rtc/rtc-config.c index dca33668ad..775904a84d 100644 --- a/bsps/arm/atsam/rtc/rtc-config.c +++ b/bsps/arm/atsam/rtc/rtc-config.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <libchip/chip.h> diff --git a/bsps/arm/atsam/spi/atsam_spi_bus.c b/bsps/arm/atsam/spi/atsam_spi_bus.c index 53c1fe4827..322c6a9728 100644 --- a/bsps/arm/atsam/spi/atsam_spi_bus.c +++ b/bsps/arm/atsam/spi/atsam_spi_bus.c @@ -3,7 +3,7 @@ /* SAM Software Package License */ /* ---------------------------------------------------------------------------- */ /* Copyright (c) 2015, Atmel Corporation */ -/* Copyright (c) 2016, embedded brains GmbH */ +/* Copyright (c) 2016, embedded brains GmbH & Co. KG */ /* */ /* All rights reserved. */ /* */ @@ -41,8 +41,8 @@ #define MAX_SPI_FREQUENCY 50000000 typedef struct { - volatile LinkedListDescriporView0 tx_desc; - volatile LinkedListDescriporView0 rx_desc[3]; + volatile LinkedListDescriporView2 tx_desc; + volatile LinkedListDescriporView2 rx_desc[3]; uint8_t rx_bounce_head_buf[CPU_CACHE_LINE_BYTES]; uint8_t rx_bounce_tail_buf[CPU_CACHE_LINE_BYTES]; } atsam_spi_dma; @@ -67,6 +67,8 @@ typedef struct { uint32_t spi_csr[4]; } atsam_spi_bus; +static const uint32_t atsam_spi_dummy_write_data = 0xffffffff; + static void atsam_spi_wakeup_task(atsam_spi_bus *bus) { rtems_binary_semaphore_post(&bus->sem); @@ -181,14 +183,14 @@ static void atsam_spi_copy_rx_bounce_bufs( } } -static void atsam_spi_setup_rx_dma_desc( +static void atsam_spi_setup_real_rx_dma_desc( atsam_spi_bus *bus, atsam_spi_dma *dma, const uint8_t *buf, size_t n ) { - volatile LinkedListDescriporView0 *desc; + volatile LinkedListDescriporView2 *desc; uintptr_t m; uintptr_t b; uintptr_t a; @@ -202,53 +204,56 @@ static void atsam_spi_setup_rx_dma_desc( a = (b + m) & ~m; ae = e & ~m; + /* An earlier dummy read maybe has set the DAM to FIXED_AM. Reset it. */ + desc[0].mbr_cfg = + (desc[0].mbr_cfg & ~XDMAC_CC_DAM_Msk) | XDMAC_CC_DAM_INCREMENTED_AM; if (n <= m) { bus->rx_bounce_head_len = n; bus->rx_bounce_tail_len = 0; - desc[0].mbr_ta = (uint32_t) dma->rx_bounce_head_buf; - desc[0].mbr_ubc = n; + desc[0].mbr_da = (uint32_t) dma->rx_bounce_head_buf; + desc[0].mbr_ubc = n | XDMA_UBC_NVIEW_NDV2; } else { bus->rx_bounce_head_len = a - b; bus->rx_bounce_tail_len = e & m; if ((b & m) == 0) { if ((n & m) == 0) { - desc[0].mbr_ta = a; - desc[0].mbr_ubc = n; + desc[0].mbr_da = a; + desc[0].mbr_ubc = n | XDMA_UBC_NVIEW_NDV2; } else { - desc[0].mbr_ta = a; + desc[0].mbr_da = a; desc[0].mbr_ubc = (ae - a) | XDMA_UBC_NDEN_UPDATED - | XDMA_UBC_NVIEW_NDV0 + | XDMA_UBC_NVIEW_NDV2 | XDMA_UBC_NDE_FETCH_EN; - desc[1].mbr_ta = (uint32_t) dma->rx_bounce_tail_buf; - desc[1].mbr_ubc = n & m; + desc[1].mbr_da = (uint32_t) dma->rx_bounce_tail_buf; + desc[1].mbr_ubc = n & m | XDMA_UBC_NVIEW_NDV2; } } else { if ((e & m) == 0) { - desc[0].mbr_ta = (uint32_t) dma->rx_bounce_head_buf; + desc[0].mbr_da = (uint32_t) dma->rx_bounce_head_buf; desc[0].mbr_ubc = (a - b) | XDMA_UBC_NDEN_UPDATED - | XDMA_UBC_NVIEW_NDV0 + | XDMA_UBC_NVIEW_NDV2 | XDMA_UBC_NDE_FETCH_EN; - desc[1].mbr_ta = a; - desc[1].mbr_ubc = ae - a; + desc[1].mbr_da = a; + desc[1].mbr_ubc = ae - a | XDMA_UBC_NVIEW_NDV2; } else if ((ae - a) == 0) { bus->rx_bounce_head_len = n; bus->rx_bounce_tail_len = 0; - desc[0].mbr_ta = (uint32_t) dma->rx_bounce_head_buf; - desc[0].mbr_ubc = n; + desc[0].mbr_da = (uint32_t) dma->rx_bounce_head_buf; + desc[0].mbr_ubc = n | XDMA_UBC_NVIEW_NDV2; } else { - desc[0].mbr_ta = (uint32_t) dma->rx_bounce_head_buf; + desc[0].mbr_da = (uint32_t) dma->rx_bounce_head_buf; desc[0].mbr_ubc = (a - b) | XDMA_UBC_NDEN_UPDATED - | XDMA_UBC_NVIEW_NDV0 + | XDMA_UBC_NVIEW_NDV2 | XDMA_UBC_NDE_FETCH_EN; - desc[1].mbr_ta = a; + desc[1].mbr_da = a; desc[1].mbr_ubc = (ae - a) | XDMA_UBC_NDEN_UPDATED - | XDMA_UBC_NVIEW_NDV0 + | XDMA_UBC_NVIEW_NDV2 | XDMA_UBC_NDE_FETCH_EN; - desc[2].mbr_ta = (uint32_t) dma->rx_bounce_tail_buf; - desc[2].mbr_ubc = e - ae; + desc[2].mbr_da = (uint32_t) dma->rx_bounce_tail_buf; + desc[2].mbr_ubc = e - ae | XDMA_UBC_NVIEW_NDV2; } } @@ -256,19 +261,61 @@ static void atsam_spi_setup_rx_dma_desc( } } +static void atsam_spi_setup_dummy_rx_dma_desc( + atsam_spi_bus *bus, + atsam_spi_dma *dma, + size_t n +) +{ + volatile LinkedListDescriporView2 *desc; + + desc = &dma->rx_desc[0]; + + /* Avoid copying bounce buffers after receive. */ + bus->rx_bounce_head_len = 0; + bus->rx_bounce_tail_len = 0; + + /* But use one of the bounce buffers to write dummy data to. */ + desc[0].mbr_da = (uint32_t) dma->rx_bounce_head_buf; + desc[0].mbr_ubc = n | XDMA_UBC_NVIEW_NDV2; + desc[0].mbr_cfg = + (desc[0].mbr_cfg & ~XDMAC_CC_DAM_Msk) | XDMAC_CC_DAM_FIXED_AM; +} + +static void atsam_spi_setup_rx_dma_desc( + atsam_spi_bus *bus, + atsam_spi_dma *dma, + const uint8_t *buf, + size_t n +) +{ + if (buf != NULL) { + atsam_spi_setup_real_rx_dma_desc(bus, dma, buf, n); + } else { + atsam_spi_setup_dummy_rx_dma_desc(bus, dma, n); + } +} + static void atsam_spi_setup_tx_dma_desc( atsam_spi_dma *dma, const uint8_t *buf, size_t n ) { - volatile LinkedListDescriporView0 *desc; + volatile LinkedListDescriporView2 *desc; desc = &dma->tx_desc; - desc->mbr_ta = (uint32_t) buf; - desc->mbr_ubc = n; - - rtems_cache_flush_multiple_data_lines(buf, n); + desc->mbr_ubc = n | XDMA_UBC_NVIEW_NDV2; + if (buf != NULL) { + desc->mbr_sa = (uint32_t) buf; + desc->mbr_cfg = + (desc->mbr_cfg & ~XDMAC_CC_SAM_Msk) | XDMAC_CC_SAM_INCREMENTED_AM; + rtems_cache_flush_multiple_data_lines(buf, n); + } else { + desc->mbr_sa = (uint32_t)&atsam_spi_dummy_write_data; + desc->mbr_cfg = + (desc->mbr_cfg & ~XDMAC_CC_SAM_Msk) | XDMAC_CC_SAM_FIXED_AM; + } } static void atsam_spi_start_dma_transfer( @@ -296,8 +343,9 @@ static void atsam_spi_start_dma_transfer( XDMAC_SetDescriptorControl( pXdmac, bus->dma_rx_channel, - XDMAC_CNDC_NDVIEW_NDV0 | + XDMAC_CNDC_NDVIEW_NDV2 | XDMAC_CNDC_NDDUP_DST_PARAMS_UPDATED | + XDMAC_CNDC_NDSUP_SRC_PARAMS_UPDATED | XDMAC_CNDC_NDE_DSCR_FETCH_EN ); XDMAC_SetDescriptorAddr( @@ -309,7 +357,8 @@ static void atsam_spi_start_dma_transfer( XDMAC_SetDescriptorControl( pXdmac, bus->dma_tx_channel, - XDMAC_CNDC_NDVIEW_NDV0 | + XDMAC_CNDC_NDVIEW_NDV2 | + XDMAC_CNDC_NDDUP_DST_PARAMS_UPDATED | XDMAC_CNDC_NDSUP_SRC_PARAMS_UPDATED | XDMAC_CNDC_NDE_DSCR_FETCH_EN ); @@ -485,15 +534,60 @@ static void atsam_spi_init_xdma(atsam_spi_bus *bus) uint8_t channel; eXdmadRC rc; uint32_t xdma_cndc; + uint32_t tx_da; + uint32_t rx_sa; + uint32_t tx_cfg; + uint32_t rx_cfg; + + tx_da = (uint32_t)&bus->spi_regs->SPI_TDR; + rx_sa = (uint32_t)&bus->spi_regs->SPI_RDR; + + channel = XDMAIF_Get_ChannelNumber(bus->spi_id, XDMAD_TRANSFER_TX); + tx_cfg = + XDMAC_CC_TYPE_PER_TRAN | + XDMAC_CC_MBSIZE_SINGLE | + XDMAC_CC_DSYNC_MEM2PER | + XDMAC_CC_CSIZE_CHK_1 | + XDMAC_CC_DWIDTH_BYTE | + XDMAC_CC_SIF_AHB_IF1 | + XDMAC_CC_DIF_AHB_IF1 | + XDMAC_CC_SAM_INCREMENTED_AM | + XDMAC_CC_DAM_FIXED_AM | + XDMAC_CC_PERID(channel); + + channel = XDMAIF_Get_ChannelNumber(bus->spi_id, XDMAD_TRANSFER_RX); + rx_cfg = + XDMAC_CC_TYPE_PER_TRAN | + XDMAC_CC_MBSIZE_SINGLE | + XDMAC_CC_DSYNC_PER2MEM | + XDMAC_CC_CSIZE_CHK_1 | + XDMAC_CC_DWIDTH_BYTE | + XDMAC_CC_SIF_AHB_IF1 | + XDMAC_CC_DIF_AHB_IF1 | + XDMAC_CC_SAM_FIXED_AM | + XDMAC_CC_DAM_INCREMENTED_AM | + XDMAC_CC_PERID(channel); dma = rtems_cache_coherent_allocate(sizeof(*dma), 0, 0); assert(dma != NULL); bus->dma = dma; dma->tx_desc.mbr_nda = 0; + dma->tx_desc.mbr_sa = 0; + dma->tx_desc.mbr_da = tx_da; + dma->tx_desc.mbr_cfg = tx_cfg; dma->rx_desc[0].mbr_nda = (uint32_t) &dma->rx_desc[1]; + dma->rx_desc[0].mbr_sa = rx_sa; + dma->rx_desc[0].mbr_da = 0; + dma->rx_desc[0].mbr_cfg = rx_cfg; dma->rx_desc[1].mbr_nda = (uint32_t) &dma->rx_desc[2]; + dma->rx_desc[1].mbr_sa = rx_sa; + dma->rx_desc[1].mbr_da = 0; + dma->rx_desc[1].mbr_cfg = rx_cfg; dma->rx_desc[2].mbr_nda = 0; + dma->rx_desc[2].mbr_sa = rx_sa; + dma->rx_desc[2].mbr_da = 0; + dma->rx_desc[2].mbr_cfg = rx_cfg; bus->dma_tx_channel = XDMAD_AllocateChannel( &XDMAD_Instance, @@ -538,19 +632,9 @@ static void atsam_spi_init_xdma(atsam_spi_bus *bus) /* Setup RX */ memset(&cfg, 0, sizeof(cfg)); channel = XDMAIF_Get_ChannelNumber(bus->spi_id, XDMAD_TRANSFER_RX); - cfg.mbr_sa = (uint32_t)&bus->spi_regs->SPI_RDR; - cfg.mbr_cfg = - XDMAC_CC_TYPE_PER_TRAN | - XDMAC_CC_MBSIZE_SINGLE | - XDMAC_CC_DSYNC_PER2MEM | - XDMAC_CC_CSIZE_CHK_1 | - XDMAC_CC_DWIDTH_BYTE | - XDMAC_CC_SIF_AHB_IF1 | - XDMAC_CC_DIF_AHB_IF1 | - XDMAC_CC_SAM_FIXED_AM | - XDMAC_CC_DAM_INCREMENTED_AM | - XDMAC_CC_PERID(channel); - xdma_cndc = XDMAC_CNDC_NDVIEW_NDV0 | + cfg.mbr_sa = rx_sa; + cfg.mbr_cfg = rx_cfg; + xdma_cndc = XDMAC_CNDC_NDVIEW_NDV2 | XDMAC_CNDC_NDE_DSCR_FETCH_EN | XDMAC_CNDC_NDDUP_DST_PARAMS_UPDATED | XDMAC_CNDC_NDSUP_SRC_PARAMS_UNCHANGED; @@ -567,19 +651,9 @@ static void atsam_spi_init_xdma(atsam_spi_bus *bus) /* Setup TX */ memset(&cfg, 0, sizeof(cfg)); channel = XDMAIF_Get_ChannelNumber(bus->spi_id, XDMAD_TRANSFER_TX); - cfg.mbr_da = (uint32_t)&bus->spi_regs->SPI_TDR; - cfg.mbr_cfg = - XDMAC_CC_TYPE_PER_TRAN | - XDMAC_CC_MBSIZE_SINGLE | - XDMAC_CC_DSYNC_MEM2PER | - XDMAC_CC_CSIZE_CHK_1 | - XDMAC_CC_DWIDTH_BYTE | - XDMAC_CC_SIF_AHB_IF1 | - XDMAC_CC_DIF_AHB_IF1 | - XDMAC_CC_SAM_INCREMENTED_AM | - XDMAC_CC_DAM_FIXED_AM | - XDMAC_CC_PERID(channel); - xdma_cndc = XDMAC_CNDC_NDVIEW_NDV0 | + cfg.mbr_da = tx_da; + cfg.mbr_cfg = tx_cfg; + xdma_cndc = XDMAC_CNDC_NDVIEW_NDV2 | XDMAC_CNDC_NDE_DSCR_FETCH_EN | XDMAC_CNDC_NDDUP_DST_PARAMS_UNCHANGED | XDMAC_CNDC_NDSUP_SRC_PARAMS_UPDATED; diff --git a/bsps/arm/atsam/spi/atsam_spi_init.c b/bsps/arm/atsam/spi/atsam_spi_init.c index ca18f8ec35..4784ca57c6 100644 --- a/bsps/arm/atsam/spi/atsam_spi_init.c +++ b/bsps/arm/atsam/spi/atsam_spi_init.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <info@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp/atsam-spi.h> diff --git a/bsps/arm/atsam/spi/sc16is752.c b/bsps/arm/atsam/spi/sc16is752.c index 59380d5057..7038694fda 100644 --- a/bsps/arm/atsam/spi/sc16is752.c +++ b/bsps/arm/atsam/spi/sc16is752.c @@ -1,16 +1,29 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp/sc16is752.h> diff --git a/bsps/arm/atsam/start/bsp_specs b/bsps/arm/atsam/start/bsp_specs deleted file mode 100644 index e69de29bb2..0000000000 --- a/bsps/arm/atsam/start/bsp_specs +++ /dev/null diff --git a/bsps/arm/atsam/start/bspstart.c b/bsps/arm/atsam/start/bspstart.c index 3f49779797..add97473eb 100644 --- a/bsps/arm/atsam/start/bspstart.c +++ b/bsps/arm/atsam/start/bspstart.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp.h> diff --git a/bsps/arm/atsam/start/bspstarthooks.c b/bsps/arm/atsam/start/bspstarthooks.c index 6fb62c0a19..51ba3bc65c 100644 --- a/bsps/arm/atsam/start/bspstarthooks.c +++ b/bsps/arm/atsam/start/bspstarthooks.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH Huber. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp.h> @@ -93,7 +106,7 @@ static void configure_tcm(void) uintptr_t tcm_size; uint32_t itcmcr_sz; - tcm_size = (uintptr_t) atsam_memory_itcm_size; + tcm_size = (uintptr_t) atsam_memory_dtcm_size; itcmcr_sz = (SCB->ITCMCR & SCB_ITCMCR_SZ_Msk) >> SCB_ITCMCR_SZ_Pos; if (tcm_setup_and_check_if_do_efc_config(tcm_size, itcmcr_sz)) { diff --git a/bsps/arm/atsam/start/getentropy-trng.c b/bsps/arm/atsam/start/getentropy-trng.c index a7b396ac15..aa4ad5f7ad 100644 --- a/bsps/arm/atsam/start/getentropy-trng.c +++ b/bsps/arm/atsam/start/getentropy-trng.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2017 embedded brains GmbH. All rights reserved. + * Copyright (c) 2017 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <libchip/chip.h> diff --git a/bsps/arm/atsam/start/iocopy.c b/bsps/arm/atsam/start/iocopy.c index b91282dac6..fd3c44eda0 100644 --- a/bsps/arm/atsam/start/iocopy.c +++ b/bsps/arm/atsam/start/iocopy.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2018 embedded brains GmbH. All rights reserved. + * Copyright (c) 2018 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp/iocopy.h> diff --git a/bsps/arm/atsam/start/pin-config.c b/bsps/arm/atsam/start/pin-config.c index 8a18ae8df7..1a677b47b2 100644 --- a/bsps/arm/atsam/start/pin-config.c +++ b/bsps/arm/atsam/start/pin-config.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp/pin-config.h> diff --git a/bsps/arm/atsam/start/pmc-config.c b/bsps/arm/atsam/start/pmc-config.c index 41902d03dd..113f4992d8 100644 --- a/bsps/arm/atsam/start/pmc-config.c +++ b/bsps/arm/atsam/start/pmc-config.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2017 embedded brains GmbH. All rights reserved. + * Copyright (c) 2017 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp/atsam-clock-config.h> diff --git a/bsps/arm/atsam/start/power-clock.c b/bsps/arm/atsam/start/power-clock.c index e04933285e..43ced80abf 100644 --- a/bsps/arm/atsam/start/power-clock.c +++ b/bsps/arm/atsam/start/power-clock.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp.h> diff --git a/bsps/arm/atsam/start/power-rtc.c b/bsps/arm/atsam/start/power-rtc.c index 0b4a80073f..622f8664f4 100644 --- a/bsps/arm/atsam/start/power-rtc.c +++ b/bsps/arm/atsam/start/power-rtc.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp.h> diff --git a/bsps/arm/atsam/start/power-wait.c b/bsps/arm/atsam/start/power-wait.c index 8d49f6f78b..a3cb5935b1 100644 --- a/bsps/arm/atsam/start/power-wait.c +++ b/bsps/arm/atsam/start/power-wait.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2019 embedded brains GmbH + * Copyright (C) 2019 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/bsps/arm/atsam/start/power.c b/bsps/arm/atsam/start/power.c index c32dbd3c20..851b0f2ce3 100644 --- a/bsps/arm/atsam/start/power.c +++ b/bsps/arm/atsam/start/power.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bsp.h> diff --git a/bsps/arm/atsam/start/restart.c b/bsps/arm/atsam/start/restart.c index 9934fbd298..bc460ddfe2 100644 --- a/bsps/arm/atsam/start/restart.c +++ b/bsps/arm/atsam/start/restart.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2017 embedded brains GmbH. All rights reserved. + * Copyright (c) 2017 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <rtems.h> diff --git a/bsps/arm/atsam/start/sdram-config.c b/bsps/arm/atsam/start/sdram-config.c index f4244e1545..2e917eeaf1 100644 --- a/bsps/arm/atsam/start/sdram-config.c +++ b/bsps/arm/atsam/start/sdram-config.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * 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. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #include <bspopts.h> @@ -135,6 +148,13 @@ const struct BOARD_Sdram_Config BOARD_Sdram_Config = { #error Please check SDRAM settings for this frequency. #endif +#elif defined ATSAM_SDRAM_CUSTOM +/* + * Custom SDRAM defined. Provide only a dummy BOARD_Sdram_Config. This config + * won't work and is only there so that test applications can link. The + * application has to overwrite this BOARD_Sdram_Config! + */ +const struct BOARD_Sdram_Config BOARD_Sdram_Config = {}; #else #error SDRAM not supported. #endif |