diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/Pad.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/Pad.c index 9a48bf3169..142101fbd3 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/Pad.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/Pad.c @@ -1,4 +1,3 @@ -#ifdef REVD /** ****************************************************************************** * @file pad.c @@ -83,20 +82,20 @@ void fPadInit() PADREG->PADIO1.WORD = PAD_INPUT_PD_L1_PP; /* UART1 RXD */ PADREG->PADIO2.WORD = PAD_INPUT_PD_L1_PP; /* UART1 CTS */ PADREG->PADIO3.WORD = PAD_OUTPUT_PN_L1_OD; /* UART1 RTS */ - PADREG->PADIO4.WORD = PAD_UNUSED_PD_L0_PP; - PADREG->PADIO5.WORD = PAD_UNUSED_PD_L0_PP; - PADREG->PADIO6.WORD = PAD_UNUSED_PD_L0_PP; - PADREG->PADIO7.WORD = PAD_UNUSED_PD_L0_PP; + PADREG->PADIO4.WORD = PAD_UNUSED_PD_L1_PP; + PADREG->PADIO5.WORD = PAD_UNUSED_PD_L1_PP; + PADREG->PADIO6.WORD = PAD_UNUSED_PD_L1_PP; + PADREG->PADIO7.WORD = PAD_UNUSED_PD_L1_PP; PADREG->PADIO8.WORD = PAD_OUTPUT_PN_L1_OD; /* UART2 TXD */ PADREG->PADIO9.WORD = PAD_INPUT_PD_L1_PP; /* UART2 RXD */ - PADREG->PADIO10.WORD = PAD_UNUSED_PD_L0_PP; + PADREG->PADIO10.WORD = PAD_UNUSED_PD_L1_PP; PADREG->PADIO11.WORD = PAD_INPUT_PD_L1_PP; /* SWO */ PADREG->PADIO12.WORD = PAD_INPUT_PD_L1_PP; /* SWCLK */ PADREG->PADIO13.WORD = PAD_INPUT_PD_L1_PP; /* SWDIO */ PADREG->PADIO14.WORD = PAD_INPUT_PD_L1_PP; - PADREG->PADIO15.WORD = PAD_UNUSED_PD_L0_PP; - PADREG->PADIO16.WORD = PAD_UNUSED_PD_L0_PP; - PADREG->PADIO17.WORD = PAD_UNUSED_PD_L0_PP; + PADREG->PADIO15.WORD = PAD_UNUSED_PD_L1_PP; + PADREG->PADIO16.WORD = PAD_UNUSED_PD_L1_PP; + PADREG->PADIO17.WORD = PAD_UNUSED_PD_L1_PP; /** - Disable the clock for PAD peripheral device */ CLOCK_DISABLE(CLOCK_PAD); @@ -142,5 +141,4 @@ boolean fPadIOCtrl(uint8_t PadNum, uint8_t OutputDriveStrength, uint8_t OutputDr } /* Invalid parameter/s */ return False; -} -#endif /* REVD */ +} \ No newline at end of file diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/device/TOOLCHAIN_IAR/startup_NCS36510.s b/targets/TARGET_ONSEMI/TARGET_NCS36510/device/TOOLCHAIN_IAR/startup_NCS36510.s index e6ca52d23e..e3a7ab075c 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/device/TOOLCHAIN_IAR/startup_NCS36510.s +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/device/TOOLCHAIN_IAR/startup_NCS36510.s @@ -157,153 +157,153 @@ Reset_Handler BX R0 PUBWEAK NMI_Handler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) NMI_Handler B NMI_Handler ; PUBWEAK HardFault_Handler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;HardFault_Handler ; B HardFault_Handler PUBWEAK MemManage_Handler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) MemManage_Handler B MemManage_Handler PUBWEAK BusFault_Handler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) BusFault_Handler B BusFault_Handler PUBWEAK UsageFault_Handler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) UsageFault_Handler B UsageFault_Handler ; PUBWEAK vPortSVCHandler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;vPortSVCHandler ; B vPortSVCHandler PUBWEAK DebugMon_Handler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) DebugMon_Handler B DebugMon_Handler ; PUBWEAK xPortPendSVHandler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;xPortPendSVHandler ; B xPortPendSVHandler ; PUBWEAK SysTick_Handler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;SysTick_Handler ; B SysTick_Handler ; PUBWEAK fIrqTim0Handler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;fIrqTim0Handler ; B fIrqTim0Handler ; PUBWEAK fIrqTim1Handler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;fIrqTim1Handler ; B fIrqTim1Handler ; PUBWEAK fIrqTim2Handler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;fIrqTim2Handler ; B fIrqTim2Handler ; PUBWEAK fIrqUart1Handler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;fIrqUart1Handler ; B fIrqUart1Handler ; PUBWEAK fIrqSpiHandler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;fIrqSpiHandler ; B fIrqSpiHandler PUBWEAK fIrqI2CHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqI2CHandler B fIrqI2CHandler ; PUBWEAK fIrqGpioHandler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;fIrqGpioHandler ; B fIrqGpioHandler PUBWEAK fIrqRtcHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqRtcHandler B fIrqRtcHandler PUBWEAK fIrqFlashHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqFlashHandler B fIrqFlashHandler PUBWEAK fIrqMacHwHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqMacHwHandler B fIrqMacHwHandler PUBWEAK fIrqAesHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqAesHandler B fIrqAesHandler PUBWEAK fIrqAdcHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqAdcHandler B fIrqAdcHandler PUBWEAK fIrqClockCalHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqClockCalHandler B fIrqClockCalHandler ; PUBWEAK fIrqUart2Handler -; SECTION .text:CODE:REORDER(1) +; SECTION .text:CODE:REORDER:NOROOT(1) ;fIrqUart2Handler ; B fIrqUart2Handler PUBWEAK fIrqDbgPwrUpHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqDbgPwrUpHandler B fIrqDbgPwrUpHandler PUBWEAK fIrqDmaHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqDmaHandler B fIrqDmaHandler PUBWEAK fIrqUviHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqUviHandler B fIrqUviHandler PUBWEAK fIrqSpi2Handler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqSpi2Handler B fIrqSpi2Handler PUBWEAK fIrqI2c2Handler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) fIrqI2c2Handler B fIrqI2c2Handler PUBWEAK FIrqFVDDHCompHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) FIrqFVDDHCompHandler B FIrqFVDDHCompHandler PUBWEAK DEF_IRQHandler - SECTION .text:CODE:REORDER(1) + SECTION .text:CODE:REORDER:NOROOT(1) DEF_IRQHandler B DEF_IRQHandler diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/device/system_NCS36510.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/device/system_NCS36510.c index d3fa866265..f12bfb6210 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/device/system_NCS36510.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/device/system_NCS36510.c @@ -23,7 +23,7 @@ ******************************************************************************/ #include -//#include "ncs36510Init.h" /* TODO */ +#include "ncs36510Init.h" /*---------------------------------------------------------------------------- Define clocks *----------------------------------------------------------------------------*/ diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/dma_map.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/dma_map.h index 6728c46f10..db396a7df3 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/dma_map.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/dma_map.h @@ -47,19 +47,6 @@ **************************************************************************************************/ /** DMA control HW registers structure overlay */ -#ifdef REVB -typedef struct { - __IO uint32_t CONTROL; /**< Write 1 to enable DMA, write 0 to disable */ - __IO uint32_t SOURCE; /**< Address of source, read to get the number of bytes written */ - __IO uint32_t DESTINATION; /**< Address of destination, read to get the number of bytes written */ - __IO uint32_t SIZE; /**< Lenght of the entire transfer */ - __IO uint32_t STATUS; /**< To be debined */ - __IO uint32_t INT_ENABLE; /**< Enable interrupt source by writing 1. Bit 0: DMA done, Bit 1: Source Error, Bit 2: Destination Error */ - __IO uint32_t INT_CLEAR_ENABLE; /**< Clear Interrupt source by writing 1. Bit 0: DMA done, Bit 1: Source Error, Bit 2: Destination Error */ - __I uint32_t INT_STATUS; /**< Current interrupt status. Bit 0: DMA done, Bit 1: Source Error, Bit 2: Destination Error */ -} DmaReg_t, *DmaReg_pt; -#endif /* REVB */ -#ifdef REVD typedef struct { union { struct { @@ -104,5 +91,4 @@ typedef struct { __I uint32_t WORD; } INT_STATUS; /**< Interrupt status */ } DmaReg_t, *DmaReg_pt; -#endif /* REVD */ #endif /* DMA_MAP_H_ */ diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/macHw_map.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/macHw_map.h index c0c6c9f8ba..f92241a467 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/macHw_map.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/macHw_map.h @@ -131,9 +131,7 @@ typedef struct { __O uint32_t FS:1; __O uint32_t FP:1; __O uint32_t FMD:1; -#ifdef REVD __I uint32_t PC:1; -#endif /* REVD */ } BITS; __O uint32_t WORD; } CLEAR_IRQ; /**< 0x40014030 */ @@ -145,9 +143,7 @@ typedef struct { __IO uint32_t FS:1; __IO uint32_t FP:1; __IO uint32_t FM:1; -#ifdef REVD __I uint32_t PC:1; -#endif /* REVD */ } BITS; __IO uint32_t WORD; } MASK_IRQ; /**< 0x40014034 */ @@ -159,9 +155,7 @@ typedef struct { __I uint32_t FS:1; __I uint32_t FP:1; __I uint32_t FM:1; -#ifdef REVD __I uint32_t PC:1; -#endif /* REVD */ } BITS; __I uint32_t WORD; } IRQ_STATUS; /**< 0x40014038 */ @@ -202,9 +196,6 @@ typedef struct { __IO uint32_t WORD; } SLOT_OFFSET; /**< 0x40014064 */ __I uint32_t TIME_STAMP; /**< 0x40014068 */ -#ifdef REVB - __O uint32_t PAD5; /**< 0x4001406C */ -#endif /* REVB */ union { struct { __IO uint32_t CRD_SHORT_ADDRESS:16; @@ -214,17 +205,10 @@ typedef struct { __IO uint32_t PAN_COORD_ADDR_S:1; } BITS; __IO uint32_t WORD; -#ifdef REVB - } CRD_SHORT_ADDR; /**< 0x40014070 */ - __IO uint32_t CRD_LONG_ADDR_HI; /**< 0x40014074 */ - __IO uint32_t CRD_LONG_ADDR_LO; /**< 0x40014078 */ -#endif /* REVB */ -#ifdef REVD } CRD_SHORT_ADDR; /**< 0x4001406C */ __IO uint32_t CRD_LONG_ADDR_HI; /**< 0x40014070 */ __IO uint32_t CRD_LONG_ADDR_LO; /**< 0x40014074 */ __O uint32_t PAD5; /**< 0x40014078 */ -#endif /* REVD */ __O uint32_t PAD9; /**< 0x4001407C */ __O uint32_t PAD10; /**< 0x40014080 */ __O uint32_t PAD11; /**< 0x40014084 */ diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng.h new file mode 100644 index 0000000000..75439d8a52 --- /dev/null +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng.h @@ -0,0 +1,42 @@ +/** + ****************************************************************************** + * @file ncs36510_trng.h + * @brief Header file for ncs36510_trng_api.c. + * @internal + * @author ON Semiconductor. + * $Rev: $ + * $Date: $ + ****************************************************************************** + * Copyright 2016 Semiconductor Components Industries LLC (d/b/a “ON Semiconductor”). + * All rights reserved. This software and/or documentation is licensed by ON Semiconductor + * under limited terms and conditions. The terms and conditions pertaining to the software + * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf + * (“ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software”) and + * if applicable the software license agreement. Do not use this software and/or + * documentation unless you have carefully read and you agree to the limited terms and + * conditions. By using this software and/or documentation, you agree to the limited + * terms and conditions. + * + * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED + * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. + * @endinternal + * + * @ingroup TRNG header + * + */ + +#ifndef RANDOM_H_ +#define RANDOM_H_ + +#define TRNG_SLOW_MODE 0 +#define TRNG_FAST_MODE 1 + +#define TRNG_DISABLE 0 +#define TRNG_ENABLE 1 + +#define TRNG_ON_READ_EVENT 1 + +#endif /* RANDOM_H_ */ diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng_api.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng_api.c new file mode 100644 index 0000000000..d255a6eaf0 --- /dev/null +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510_trng_api.c @@ -0,0 +1,113 @@ +/** + ****************************************************************************** + * @file trng_api.c + * @brief Implementation of TRNG functionality. + * @internal + * @author ON Semiconductor. + * $Rev: $ + * $Date: $ + ****************************************************************************** + * Copyright 2016 Semiconductor Components Industries LLC (d/b/a “ON Semiconductor”). + * All rights reserved. This software and/or documentation is licensed by ON Semiconductor + * under limited terms and conditions. The terms and conditions pertaining to the software + * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf + * (“ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software”) and + * if applicable the software license agreement. Do not use this software and/or + * documentation unless you have carefully read and you agree to the limited terms and + * conditions. By using this software and/or documentation, you agree to the limited + * terms and conditions. + * + * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED + * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. + * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, + * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. + * @endinternal + * + * @ingroup TRNG + * + */ +#if DEVICE_TRNG + +/************************************************************************************************* +* * +* Header files * +* * +*************************************************************************************************/ +#include "trng_api.h" +#include "memory_map.h" +#include "ncs36510_trng.h" +#include "clock.h" +#include "wait_api.h" + +/************************************************************************************************* +* * +* Functions * +* * +*************************************************************************************************/ + + +void trng_init(trng_t *obj) +{ + /* Enable TRNG */ + CLOCK_ENABLE(CLOCK_RAND); + + /* Initialize TRNG */ + RANDREG->CONTROL.WORD = False; + + return; +} +void trng_free(trng_t *obj) +{ + /* Stop TRNG */ + RANDREG->CONTROL.WORD = False; + + /* Disable TRNG */ + CLOCK_DISABLE(CLOCK_RAND); + + return; +} + +int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_length) +{ + uint32_t MSLRandom = 0, Index, TempLen, *TempPtr = (uint32_t*)output; + + RANDREG->CONTROL.BITS.METASTABLE_LATCH_EN = TRNG_ENABLE; /* ENable MSL TRNG */ + RANDREG->CONTROL.BITS.MEATSTABLE_SPEED = TRNG_FAST_MODE; /* Meta-stable Latch TRNG Speed Control */ + RANDREG->CONTROL.BITS.MODE = TRNG_ON_READ_EVENT; /* TRNG is only updated on a read event of the TRNG register */ + + wait_us(1); /* Wait till MSL generates random number after enable for the first time */ + + TempLen = length / 4; + + for(Index = 0; Index < TempLen; Index++) + { + MSLRandom = RANDREG->METASTABLE_LATCH_VAL; + *TempPtr++ = MSLRandom ; + } + + TempLen = length % 4; + Index *= 4; + + if(TempLen-- > 0) + { + MSLRandom = RANDREG->METASTABLE_LATCH_VAL; + *(output + Index++) = (MSLRandom >> 0) & 0xFF; + if(TempLen-- > 0) + { + *(output + Index++) = (MSLRandom >> 8) & 0xFF; + if(TempLen-- > 0) + { + *(output + Index++) = (MSLRandom >> 16) & 0xFF; + } + } + } + + RANDREG->CONTROL.BITS.METASTABLE_LATCH_EN = TRNG_DISABLE; /* Disable MSL */ + + *output_length = Index; + + return 0; /* Success */ +} + +#endif /* DEVICE_TRNG */ \ No newline at end of file diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/objects.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/objects.h index b58c02c3d3..83a603caac 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/objects.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/objects.h @@ -169,7 +169,7 @@ struct spi_s { uint8_t rxWatermark; /* Receive FIFO Watermark: Defines level of TX Half Full Flag: * - Value between 1 and 15 * * (unused option in current implementation / rxWatermark fixed to 1) */ - spi_ipc7207_endian_t endian; /* Bits endianness: + spi_ipc7207_endian_t endian; /* Bits endianness: * - LITTLE_ENDIAN = LSB first * - BIG_ENDIAN = MSB first */ uint8_t samplingEdge; /* SDI sampling edge (relative to SDO sampling edge): @@ -193,6 +193,10 @@ struct i2c_s { //queue_pt rxQueue; /**< The receive queue for the device instance. */ }; +struct trng_s { + RandReg_pt membase; /**< The memory base for the device's registers. */ +}; + #ifdef __cplusplus } #endif diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/pad.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/pad.h index 26d3e5c7ec..9aa7c39045 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/pad.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/pad.h @@ -1,4 +1,3 @@ -#ifdef REVD /** ****************************************************************************** * @file pad.h @@ -84,5 +83,4 @@ extern void fPadInit(); */ extern boolean fPadIOCtrl(uint8_t, uint8_t, uint8_t, uint8_t); -#endif //_PAD_H_ -#endif /* REVD */ \ No newline at end of file +#endif //_PAD_H_ \ No newline at end of file diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/pad_map.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/pad_map.h index be718d48c0..63a99a45d5 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/pad_map.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/pad_map.h @@ -71,14 +71,12 @@ #define PAD_LOW_POWER (PAD_PULL_NONE | (PAD_DRIVE_L0<<2) | (PAD_OOUTCFG_OPENDRAIN<<5)) /** custom Power PAD configuration */ -#ifdef REVD #define PAD_OUTPUT_PN_L1_OD (PAD_PULL_NONE | (PAD_DRIVE_L1<<2) | (PAD_OOUTCFG_OPENDRAIN<<5)) #define PAD_INPUT_PD_L1_PP (PAD_PULL_DOWN | (PAD_DRIVE_L1<<2) | (PAD_OUTCFG_PUSHPULL<<5)) -#define PAD_UNUSED_PD_L0_PP (PAD_PULL_DOWN | (PAD_DRIVE_L0<<2) | (PAD_OUTCFG_PUSHPULL<<5)) +#define PAD_UNUSED_PD_L1_PP (PAD_PULL_DOWN | (PAD_DRIVE_L1<<2) | (PAD_OUTCFG_PUSHPULL<<5)) #define PAD_UART_TX (PAD_PULL_UP | (PAD_DRIVE_L1<<2) | (PAD_OUTCFG_PUSHPULL<<5)) #define PAD_UART_RX (PAD_PULL_UP | (PAD_DRIVE_L1<<2) | (PAD_OOUTCFG_OPENDRAIN<<5)) -#endif /* REVD */ /************************************************************************************************** * * diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/port_api.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/port_api.c index e0fb1c0858..4975a3697c 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/port_api.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/port_api.c @@ -24,7 +24,9 @@ * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. */ #include "gpio.h" +#include "gpio_api.h" #include "port_api.h" +#include "pinmap.h" #if DEVICE_PORTIN || DEVICE_PORTOUT diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/pwm_map.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/pwm_map.h index e567848c02..a720d0c563 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/pwm_map.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/pwm_map.h @@ -44,37 +44,6 @@ #include "architecture.h" /** Power management Control HW Structure Overlay */ -#ifdef REVB -typedef struct { - __IO uint32_t DUTYCYCLE; - union { - struct { - __IO uint32_t ENABLED :1;/**< 1 = PWM enable , 0 = PWM disable */ - __I uint32_t CURRENT :1;/**< current state of PWM enable signal */ - __O uint32_t PAD1 :6; /**< Reserved. Writes have no effect; Read as 0x00. */ - __O uint32_t RDPWMEN :1;/**< current state of pwmEnable configuration */ - __O uint32_t RDPWMOP :1;/**< current state of PWM out signal */ - __O uint32_t PAD2 :6; /**< Reserved. Writes have no effect; Read as 0x00. */ - } BITS; - __I uint32_t WORD; - } PWMOUT; - __O uint32_t DISABLE; - union { - struct { - __IO uint32_t ENABLED :1; - __O uint32_t PAD1 :7; /**< Reserved. Writes have no effect */ - __O uint32_t STATE :1; /**< current state of prescaler enable configuration. */ - __O uint32_t PAD2 :7; /**< Reserved. Writes have no effect; Read as 0x00. */ - } BITS; - __I uint32_t WORD; - } PRESCALE_EN; - - __O uint32_t PRESCALE_DIS; - -} PwmReg_t, *PwmReg_pt; -#endif /* REVB */ - -#ifdef REVD typedef struct { __IO uint32_t DUTYCYCLE; union { @@ -96,5 +65,4 @@ typedef struct { } PRESCALE_ENABLE; __O uint32_t PRESCALE_DISABLE; } PwmReg_t, *PwmReg_pt; -#endif /* REVD */ #endif /* PWM_MAP_H_ */ diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/random_map.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/random_map.h index bc33441fb5..7e25f21f89 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/random_map.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/random_map.h @@ -49,9 +49,6 @@ /** Random Number Generator Control HW Structure Overlay */ typedef struct { __IO uint32_t WR_SEED_RD_RAND; /* Seed set & random read reg - 0x40011000 */ -#ifdef REVB - __IO uint32_t MODE; -#endif /* REVB */ union { struct { __IO uint32_t MODE :1; /**PLL_TIMING.BITS.PLL_RESET_TIME = 0x1E; // 30us RFANAREG->PLL_TIMING.BITS.PLL_LOCK_TIME = 0x2F; // 47us @@ -239,29 +140,6 @@ boolean fRfAnaIoctl (uint32_t request, void *argument) RFANAREG->RX_LO_CONTROL.BITS.INT_WORD = rfLut[channel - 11][0]; // Set tx/rx vco trims -#ifdef REVB - /** REVB is requiering to adjust tx/rx vco trims each time a new 15.4 channel is used, in revB it is done - * from trims stored in flash A, it has the drawback that it is not workable when flash A is not accessible.*/ - if (channel < 19) { - RFANATRIMREG->PLL_TRIM.BITS.TX_VCO_TRIM = (TRIMREG->TX_VCO_LUT1.WORD) >> ((channel - 11) * 4); - RFANATRIMREG->PLL_TRIM.BITS.RX_VCO_TRIM = (TRIMREG->RX_VCO_LUT1.WORD) >> ((channel - 11) * 4); - } else { - RFANATRIMREG->PLL_TRIM.BITS.TX_VCO_TRIM = (TRIMREG->TX_VCO_LUT2.WORD) >> ((channel - 19) * 4); - RFANATRIMREG->PLL_TRIM.BITS.RX_VCO_TRIM = (TRIMREG->RX_VCO_LUT2.WORD) >> ((channel - 19) * 4); - } -#endif /* REVB */ -#ifdef REVC - /** REVC is requiering to adjust tx/rx vco trims each time a new 15.4 channel is used, in revB it is done - * from trims stored in dedicated registers available in digital.*/ - if (channel < 19) { - RFANATRIMREG->PLL_TRIM.BITS.TX_VCO_TRIM = (RFANATRIMREG->TX_VCO_TRIM_LUT1) >> ((channel - 11) * 4); - RFANATRIMREG->PLL_TRIM.BITS.RX_VCO_TRIM = (RFANATRIMREG->RX_VCO_TRIM_LUT1) >> ((channel - 11) * 4); - } else { - RFANATRIMREG->PLL_TRIM.BITS.TX_VCO_TRIM = (RFANATRIMREG->TX_VCO_TRIM_LUT2) >> ((channel - 19) * 4); - RFANATRIMREG->PLL_TRIM.BITS.RX_VCO_TRIM = (RFANATRIMREG->RX_VCO_TRIM_LUT2) >> ((channel - 19) * 4); - } -#endif /* REVC */ -#ifdef REVD /** REVD is requiering to adjust tx/rx vco trims each time a new 15.4 channel is used, in revB it is done * from trims stored in dedicated registers available in digital.*/ if (channel < 19) { @@ -271,7 +149,6 @@ boolean fRfAnaIoctl (uint32_t request, void *argument) RFANATRIMREG->PLL_TRIM.BITS.TX_VCO_TRIM = (RFANATRIMREG->TX_VCO_TRIM_LUT2) >> ((channel - 19) * 4); RFANATRIMREG->PLL_TRIM.BITS.RX_VCO_TRIM = (RFANATRIMREG->RX_VCO_TRIM_LUT2) >> ((channel - 19) * 4); } -#endif /* REVD */ break; case SET_TX_POWER: txPower = *(uint8_t*)argument; diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/rfAna_map.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/rfAna_map.h index 22ee1e48a6..328f6dbab8 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/rfAna_map.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/rfAna_map.h @@ -105,21 +105,11 @@ typedef struct { } PLL_TRIM; __IO uint32_t PLL_VCO_TAP_LOCATION; __IO uint32_t TX_CHAIN_TRIM; -#ifdef REVC __IO uint32_t RX_VCO_TRIM_LUT2; /** 0x40019098 */ __IO uint32_t RX_VCO_TRIM_LUT1; /** 0x4001909C */ __IO uint32_t TX_VCO_TRIM_LUT2; /** 0x400190A0 */ __IO uint32_t TX_VCO_TRIM_LUT1; /** 0x400190A4 */ __IO uint32_t ADC_OFFSET_BUF; /** 0x400190A8 */ -#endif - -#ifdef REVD - __IO uint32_t RX_VCO_TRIM_LUT2; /** 0x40019098 */ - __IO uint32_t RX_VCO_TRIM_LUT1; /** 0x4001909C */ - __IO uint32_t TX_VCO_TRIM_LUT2; /** 0x400190A0 */ - __IO uint32_t TX_VCO_TRIM_LUT1; /** 0x400190A4 */ - __IO uint32_t ADC_OFFSET_BUF; /** 0x400190A8 */ -#endif /* REVD */ } RfAnaTrimReg_t, *RfAnaTrimReg_pt; #endif /* RFANA_MAP_H_ */ diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc.c index a3e35b0b68..1bedbcc534 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc.c @@ -43,6 +43,7 @@ */ #include "rtc.h" #include "mbed_assert.h" +#include "lp_ticker_api.h" static uint16_t SubSecond; static uint64_t LastRtcTimeus; @@ -100,7 +101,7 @@ void fRtcFree(void) void fRtcSetInterrupt(uint32_t timestamp) { SubSecond = False; - uint32_t Second = False; + uint32_t Second = False, EnableInterrupt = False; uint8_t DividerAdjust = 1; if(timestamp) { @@ -110,7 +111,7 @@ void fRtcSetInterrupt(uint32_t timestamp) RTCREG->SECOND_ALARM = Second; /* Write to alarm register */ /* Enable second interrupt */ - RTCREG->CONTROL.WORD |= (True << RTC_CONTROL_SEC_CNT_INT_BIT_POS); + EnableInterrupt = True << RTC_CONTROL_SEC_CNT_INT_BIT_POS; } timestamp = timestamp - Second * RTC_SEC_TO_US; /* Take out micro second for sub second alarm */ if(timestamp > False) { @@ -129,7 +130,6 @@ void fRtcSetInterrupt(uint32_t timestamp) SubSecond = 0; } - if(SubSecond > False) { /* Second interrupt not enabled */ @@ -137,12 +137,18 @@ void fRtcSetInterrupt(uint32_t timestamp) RTCREG->SUB_SECOND_ALARM = SubSecond; /* Write to sub second alarm */ /* Enable sub second interrupt */ - while(RTCREG->STATUS.BITS.BSY_CTRL_REG_WRT == True); - RTCREG->CONTROL.WORD |= (True << RTC_CONTROL_SUBSEC_CNT_INT_BIT_POS); + EnableInterrupt |= (True << RTC_CONTROL_SUBSEC_CNT_INT_BIT_POS); } } - - while(RTCREG->STATUS.BITS.BSY_ANY_WRT == True); /* Wait for RTC to finish writing register - RTC operates on 32K clock as compared to 32M core*/ + + RTCREG->CONTROL.WORD |= EnableInterrupt; + /* Enable RTC interrupt */ + NVIC_EnableIRQ(Rtc_IRQn); + + /* Wait for RTC to finish writing register - RTC operates on 32K clock as compared to 32M core*/ + while((RTCREG->STATUS.WORD & ((True << RTC_STATUS_SUB_SEC_ALARM_WRT_BIT_POS) | + (True << RTC_STATUS_SEC_ALARM_WRT_BIT_POS) | + (True << RTC_STATUS_CONTROL_WRT_BIT_POS))) == True); } return; } @@ -150,17 +156,15 @@ void fRtcSetInterrupt(uint32_t timestamp) /* See rtc.h for details */ void fRtcDisableInterrupt(void) { - /* Disable subsec/sec interrupt */ - RTCREG->CONTROL.WORD &= ~((RTC_ALL_INTERRUPT_BIT_VAL) << RTC_CONTROL_SUBSEC_CNT_INT_BIT_POS); - while(RTCREG->STATUS.BITS.BSY_CTRL_REG_WRT == True); /* Wait for RTC to finish writing register - RTC operates on 32K clock as compared to 32M core*/ + /* Disable RTC interrupt */ + NVIC_DisableIRQ(Rtc_IRQn); } /* See rtc.h for details */ void fRtcEnableInterrupt(void) { - /* Disable subsec/sec interrupt */ - RTCREG->CONTROL.WORD |= ((RTC_ALL_INTERRUPT_BIT_VAL) << RTC_CONTROL_SUBSEC_CNT_INT_BIT_POS); - while(RTCREG->STATUS.BITS.BSY_CTRL_REG_WRT == True); /* Wait for RTC to finish writing register - RTC operates on 32K clock as compared to 32M core*/ + /* Enable RTC interrupt */ + NVIC_EnableIRQ(Rtc_IRQn); } /* See rtc.h for details */ @@ -170,7 +174,9 @@ void fRtcClearInterrupt(void) /* Clear sec & sub_sec interrupts */ RTCREG->INT_CLEAR.WORD = ((True << RTC_INT_CLR_SUB_SEC_BIT_POS) | (True << RTC_INT_CLR_SEC_BIT_POS)); - while(RTCREG->STATUS.BITS.BSY_ANY_WRT == True); /* Wait for RTC to finish writing register - RTC operates on 32K clock as compared to 32M core*/ + + while((RTCREG->STATUS.WORD & ((True << RTC_STATUS_SUB_SEC_INT_CLR_WRT_BIT_POS) | + (True << RTC_STATUS_SEC_INT_CLR_WRT_BIT_POS))) == True); /* Wait for RTC to finish writing register - RTC operates on 32K clock as compared to 32M core*/ } /* See rtc.h for details */ @@ -191,9 +197,9 @@ uint64_t fRtcRead(void) */ do { - Second = RTCREG->SECOND_COUNTER; /* Get SEC_COUNTER reg value */ - SubSecond = (RTCREG->SUB_SECOND_COUNTER - 1) & 0x7FFF; /* Get SUB_SEC_COUNTER reg value */ - } while (Second != RTCREG->SECOND_COUNTER); /* Repeat if the second has changed */ + Second = RTCREG->SECOND_COUNTER; /* Get SEC_COUNTER reg value */ + SubSecond = (RTCREG->SUB_SECOND_COUNTER - 1) & SUB_SEC_MASK; /* Get SUB_SEC_COUNTER reg value */ + } while (Second != RTCREG->SECOND_COUNTER); /* Repeat if the second has changed */ //note: casting to float removed to avoid reduction in resolution uint64_t RtcTimeus = ((uint64_t)SubSecond * RTC_SEC_TO_US / RTC_CLOCK_HZ) + ((uint64_t)Second * RTC_SEC_TO_US); @@ -208,8 +214,8 @@ uint64_t fRtcRead(void) /* See rtc.h for details */ void fRtcWrite(uint64_t RtcTimeus) { - uint32_t Second = 0; - uint16_t SubSecond = 0; + uint32_t Second = False; + uint16_t SubSecond = False; /* Stop RTC */ RTCREG->CONTROL.WORD &= ~((True << RTC_CONTROL_SUBSEC_CNT_START_BIT_POS) | (True << RTC_CONTROL_SEC_CNT_START_BIT_POS)); @@ -270,7 +276,11 @@ void fRtcHandler(void) NVIC_EnableIRQ(Rtc_IRQn); - while(RTCREG->STATUS.BITS.BSY_ANY_WRT == True); /* Wait for RTC to finish writing register - RTC operates on 32K clock as compared to 32M core*/ + /* Wait for RTC to finish writing register - RTC operates on 32K clock as compared to 32M core*/ + while((RTCREG->STATUS.WORD & ((True << RTC_STATUS_SUB_SEC_ALARM_WRT_BIT_POS) | + (True << RTC_STATUS_CONTROL_WRT_BIT_POS) | + (True << RTC_STATUS_SUB_SEC_INT_CLR_WRT_BIT_POS) | + (True << RTC_STATUS_SEC_INT_CLR_WRT_BIT_POS))) == True); lp_ticker_irq_handler(); } diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc.h index 4843975d18..d9a4dc4b2e 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc.h @@ -52,9 +52,15 @@ #define RTC_CONTROL_SUBSEC_CNT_INT_BIT_POS 2 #define RTC_CONTROL_SEC_CNT_INT_BIT_POS 3 +#define RTC_STATUS_SUB_SEC_ALARM_WRT_BIT_POS 6 +#define RTC_STATUS_SEC_ALARM_WRT_BIT_POS 7 +#define RTC_STATUS_CONTROL_WRT_BIT_POS 8 #define RTC_STATUS_SUB_SEC_INT_CLR_WRT_BIT_POS 9 #define RTC_STATUS_SEC_INT_CLR_WRT_BIT_POS 10 +#define SUB_SEC_MASK 0x7FFF + + /* FUnction pointer for call back */ typedef void (* fRtcCallBack)(void); diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc_api.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc_api.c index 15cb73c856..4b63069a2b 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc_api.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc_api.c @@ -39,8 +39,6 @@ #include "rtc.h" #include "cmsis_nvic.h" -static IRQn_Type Irq; - /* See rtc_apc.h for description */ void rtc_init(void) diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc_map.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc_map.h index 86f6325821..18ab0a4d77 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc_map.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/rtc_map.h @@ -45,72 +45,6 @@ /** Real Time Clock Control HW Structure Overlay */ typedef struct { -#ifdef REVB - /*REVD REPLACE COMPLETE MAP WITH DATA FROM DIG DESIGN SPEC */ - __IO uint32_t SECOND;/**SCR &= ~SCB_SCR_SLEEPDEEP_Msk; @@ -55,7 +55,7 @@ void sleep(void) __WFI(); } -void deepsleep(void) +void fncs36510_deepsleep(void) { /** Set SLEEPDEEP (SCR) and unset COMA to select deep sleep mode */ SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; @@ -72,7 +72,7 @@ void deepsleep(void) PMUREG->CONTROL.BITS.INT32M = 1; } -void coma(void) +void fncs36510_coma(void) { /** Set SLEEPDEEP (SCR) and set COMA to select coma mode */ SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep.h index f3f9ff1fc5..44c2019927 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep.h @@ -42,10 +42,10 @@ #include "crossbar.h" #include "clock.h" -#define SLEEP_TYPE_NONE 0 +#define SLEEP_TYPE_NONE 0 #define SLEEP_TYPE_SLEEP 1 #define SLEEP_TYPE_DEEPSLEEP 2 -#define SLEEP_TYPE_COMA 3 +#define SLEEP_TYPE_COMA 3 #define SLEEP_TYPE_DEFAULT SLEEP_TYPE_DEEPSLEEP @@ -54,6 +54,10 @@ #define SLEEP_DURATION_DEEPSLEEP_MAX 500 /* msec */ #define SLEEP_DURATION_COMA_MAX 1000000000 /* TODO 1000 sec */ -void coma(void); +void fncs36510_sleep(void); + +void fncs36510_deepsleep(void); + +void fncs36510_coma(void); #endif // SLEEP_H_ diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep_api.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep_api.c index a59dde1026..dd6680cc56 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep_api.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/sleep_api.c @@ -37,54 +37,14 @@ #include "sleep_api.h" #include "cmsis_nvic.h" -void mbed_enter_sleep(sleep_t *obj) +void sleep() { - -#ifdef SLEEP_TYPE_DEFAULT - - if(SLEEP_TYPE_DEFAULT == SLEEP_TYPE_SLEEP) { - /* Sleep mode */ - sleep(); - } else if(SLEEP_TYPE_DEFAULT == SLEEP_TYPE_DEEPSLEEP) { - /* Deep Sleep mode */ - deepsleep(); - } else { - /* Coma mode */ - coma(); - } - -#else - - if(obj->SleepType == SLEEP_TYPE_NONE) { - /* Select low power mode based on sleep duration */ - - if(obj->timeToSleep <= SLEEP_DURATION_SLEEP_MAX) { - /* Sleep mode */ - sleep(); - } else if(obj->timeToSleep <= SLEEP_DURATION_DEEPSLEEP_MAX) { - /* Deep sleep */ - deepsleep(); - } else { - /* Coma */ - coma(); - } - } else if(obj->SleepType == SLEEP_TYPE_SLEEP) { - /* Sleep mode */ - sleep(); - } else if(obj->SleepType == SLEEP_TYPE_DEEPSLEEP) { - /* Deep Sleep mode */ - deepsleep(); - } else { - /* Coma mode */ - coma(); - } - -#endif + fncs36510_sleep(); } -void mbed_exit_sleep(sleep_t *obj) +void deepsleep() { - (void)obj; + fncs36510_deepsleep(); } #endif /* DEVICE_SLEEP */ \ No newline at end of file diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/spi_api.c b/targets/TARGET_ONSEMI/TARGET_NCS36510/spi_api.c index af03986594..2d96ec0be9 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/spi_api.c +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/spi_api.c @@ -99,28 +99,28 @@ uint8_t spi_get_module(spi_t *obj) int spi_slave_receive(spi_t *obj) { - if(obj->membase->STATUS.BITS.RX_EMPTY != True){ /* if receive status is not empty */ - return True; /* Byte available to read */ - } - return False; /* Byte not available to read */ + if(obj->membase->STATUS.BITS.RX_EMPTY != True){ /* if receive status is not empty */ + return True; /* Byte available to read */ + } + return False; /* Byte not available to read */ } int spi_slave_read(spi_t *obj) { - int byte; - - while (obj->membase->STATUS.BITS.RX_EMPTY == True); /* Wait till Receive status is empty */ + int byte; + + while (obj->membase->STATUS.BITS.RX_EMPTY == True); /* Wait till Receive status is empty */ byte = obj->membase->RX_DATA; return byte; } void spi_slave_write(spi_t *obj, int value) { - while((obj->membase->STATUS.BITS.TX_FULL == True) && (obj->membase->STATUS.BITS.RX_FULL == True)); /* Wait till Tx/Rx status is full */ + while((obj->membase->STATUS.BITS.TX_FULL == True) && (obj->membase->STATUS.BITS.RX_FULL == True)); /* Wait till Tx/Rx status is full */ obj->membase->TX_DATA = value; } -#if DEVICE_SPI_ASYNCH /* TODO Not implemented yet */ +#if DEVICE_SPI_ASYNCH /* TODO Not yet implemented */ void spi_master_transfer(spi_t *obj, void *tx, size_t tx_length, void *rx, size_t rx_length, uint32_t handler, uint32_t event, DMAUsage hint) { diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/trim_map.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/trim_map.h index 79ec694534..13d5905a4f 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/trim_map.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/trim_map.h @@ -50,20 +50,15 @@ **************************************************************************************************/ /** trim register map */ -typedef struct { /**< REV B REV D */ - __I uint32_t PAD0; /**< 0x1FA0 0x1FA0 */ +typedef struct { + __I uint32_t PAD0; /**< 0x1FA0 */ __I uint32_t MAC_ADDR_LOW; /**< 0x1FA4 */ __I uint32_t MAC_ADDR_HIGH; /**< 0x1FA8 */ -#ifdef REVB - __I uint32_t TX_POWER; /**< 0x1FAC */ -#endif - __I uint32_t TRIM_32K_EXT; /**< 0x1FB0 0x1FAC */ - __I uint32_t TRIM_32M_EXT; /**< 0x1FB4 0x1FB0 */ -#ifdef REVD - __I uint32_t FVVDH_COMP_TH; /**< 0x1FB4 */ -#endif + __I uint32_t TRIM_32K_EXT; /**< 0x1FAC */ + __I uint32_t TRIM_32M_EXT; /**< 0x1FB0 */ + __I uint32_t FVVDH_COMP_TH; /**< 0x1FB4 */ union { - struct { /* Common to REV B & REV D */ + struct { __I uint32_t CHANNEL11:4; __I uint32_t CHANNEL12:4; __I uint32_t CHANNEL13:4; diff --git a/targets/TARGET_ONSEMI/TARGET_NCS36510/wdt_map.h b/targets/TARGET_ONSEMI/TARGET_NCS36510/wdt_map.h index fd63cc8220..a4ac0bcd55 100644 --- a/targets/TARGET_ONSEMI/TARGET_NCS36510/wdt_map.h +++ b/targets/TARGET_ONSEMI/TARGET_NCS36510/wdt_map.h @@ -42,100 +42,6 @@ #include "architecture.h" -#ifdef REVB -/** Watch Dog Timer Control HW Structure Overlay */ -typedef struct { - __IO uint32_t LOAD; /**< Watchdog load value */ - __I uint32_t VALUE; /**< Watchdog current value */ - union { - struct { - __IO uint32_t INT_EN :1; /**< interrupt event : 0 = disable counter and interrupt , 1 = enable counter and interrupt */ - __IO uint32_t RESET_EN :1; /**< Watchdog reset output : 0 = disable 1 = enable */ - __IO uint32_t PAD :30; /**< Reserved, read undefined, must read as zeros. */ - } BITS; - __IO uint32_t WORD; - } CONTROL; - __IO uint32_t INT_CLEAR; /**< Watchdog interrupt clear */ - __I uint32_t RAW_INT_STAT; /**< Raw interrupt status from the counter */ - __I uint32_t MASKED_INT_STAT; /**< Enabled interrupt status from the counter */ - union { - struct { - __IO uint32_t WRITE_EN :1; /**< write access to all other registers : 0 = enabled(default) , 1 = disabled */ - __IO uint32_t REG_WRITE_EN :31; /**< Enable write access to all other registers by writing 0x1ACCE551. Disable it by writing any other value.*/ - } BITS; - __IO uint32_t WORD; - } LOCK; - __I uint32_t TEST_CTRL; /**< Integration Test Mode : 0 = disable , 1 = Enable */ - union { - struct { - __IO uint32_t VAL_INT :1; /**< Value output on WDOGINT when in Integration Test Mode */ - __IO uint32_t VAL_RES :1; /**< Value output on WDOGRES when in Integration Test Mode */ - __IO uint32_t PAD:30; /**< Reserved, read undefined, must read as zeros.*/ - } BITS; - __IO uint32_t WORD; - } TEST_OUT; - union { - struct { - __IO uint32_t PART_0 :8; /**< These bits read back as 0x05 */ - __IO uint32_t PAD :24; /**< Reserved, read undefined, must read as zeros.*/ - } BITS; - __IO uint32_t WORD; - } PID_REG0; - union { - struct { - __IO uint32_t PART_1 :4; /**< These bits read back as 0x08 */ - __IO uint32_t DESIGNER_0 :4; /**< These bits read back as 0x01 */ - __IO uint32_t PAD :24; /**< Reserved, read undefined, must read as zeros.*/ - } BITS; - __IO uint32_t WORD; - } PID_REG1; - union { - struct { - __IO uint32_t DESIGNER_1 :4; /**< These bits read back as 0x4 */ - __IO uint32_t REVISION :4; /**< These bits read back as 0x0*/ - __IO uint32_t PAD :24; /**< Reserved, read undefined, must read as zeros.*/ - } BITS; - __IO uint32_t WORD; - } PID_REG2; - union { - struct { - __IO uint32_t CONFIG :8; /**< These bits read back as 0x00 */ - __IO uint32_t PAD :24; /**< Reserved, read undefined, must read as zeros.*/ - } BITS; - __IO uint32_t WORD; - } PID_REG3; - union { - struct { - __IO uint32_t ID0 :8; /**< These bits read back as 0x0D */ - __IO uint32_t PAD :24; /**< Reserved, read undefined, must read as zeros.*/ - } BITS; - __IO uint32_t WORD; - } PCELL_ID0; - union { - struct { - __IO uint32_t ID :8; /**< These bits read back as 0xF0*/ - __IO uint32_t PAD :24; /**< Reserved, read undefined, must read as zeros.*/ - } BITS; - __IO uint32_t WORD; - } PCELL_ID1; - union { - struct { - __IO uint32_t ID :8; /**< These bits read back as 0x05*/ - __IO uint32_t PAD :24; /**< Reserved, read undefined, must read as zeros.*/ - } BITS; - __IO uint32_t WORD; - } PCELL_ID2; - union { - struct { - __IO uint32_t ID :8; /**< These bits read back as 0xB1*/ - __IO uint32_t PAD :24; /**< Reserved, read undefined, must read as zeros.*/ - } BITS; - __IO uint32_t WORD; - } PCELL_ID3; -} WdtReg_t, *WdtReg_pt; -#endif /* REVB */ - -#ifdef REVD typedef struct { __IO uint32_t LOAD; /**< 0x4000A000 Contains the value from which the counter is decremented. When this register is written to the count is immediately restarted from the new value. The minimum valid value is 1. */ __I uint32_t CURRENT_VALUE; /**< 0x4000A004 Gives the current value of the decrementing counter */ @@ -157,5 +63,4 @@ typedef struct { __IO uint32_t WORD; } STATUS; /* 0x4000A014 */ } WdtReg_t, *WdtReg_pt; -#endif /* REVD */ #endif /* WDT_MAP_H_ */ diff --git a/targets/targets.json b/targets/targets.json index 6a2e01a9ed..b9d3395ece 100644 --- a/targets/targets.json +++ b/targets/targets.json @@ -2328,9 +2328,9 @@ "core": "Cortex-M3", "extra_labels": ["ONSEMI"], "post_binary_hook": {"function": "NCS36510TargetCode.ncs36510_addfib"}, - "macros": ["REVD", "CM3", "CPU_NCS36510", "TARGET_NCS36510", "LOAD_ADDRESS=0x3000"], + "macros": ["CM3", "CPU_NCS36510", "TARGET_NCS36510", "LOAD_ADDRESS=0x3000"], "supported_toolchains": ["GCC_ARM", "ARM", "IAR"], - "device_has": ["ANALOGIN", "SERIAL", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "LOWPOWERTIMER"], + "device_has": ["ANALOGIN", "SERIAL", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "LOWPOWERTIMER", "TRNG"], "device_name": "NCS36510", "release_versions": ["2", "5"] },