mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Apollo3 and artemis code review changes, remvoe dead code, add missing spdx identifiers, fix style
							parent
							
								
									68d59d3781
								
							
						
					
					
						commit
						e97ebc033a
					
				| 
						 | 
				
			
			@ -36,12 +36,6 @@
 | 
			
		|||
 | 
			
		||||
#define PRINT_DEBUG_HCI 0
 | 
			
		||||
 | 
			
		||||
#if PRINT_DEBUG_HCI
 | 
			
		||||
#include "mbed.h"
 | 
			
		||||
DigitalOut debugGPIO(D28, 0);
 | 
			
		||||
DigitalOut debugGPIO2(D25, 0);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
using namespace ble;
 | 
			
		||||
 | 
			
		||||
#ifndef USE_AMBIQ_DRIVER
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,6 +43,7 @@
 | 
			
		|||
// This is part of revision 2.3.2 of the AmbiqSuite Development Package.
 | 
			
		||||
//
 | 
			
		||||
//*****************************************************************************
 | 
			
		||||
// SPDX-License-Identifier: BSD-3-Clause
 | 
			
		||||
#ifndef HCI_DRV_APOLLO3_H
 | 
			
		||||
#define HCI_DRV_APOLLO3_H
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,24 +1,25 @@
 | 
			
		|||
/*
 | 
			
		||||
Copyright (c) 2019 SparkFun Electronics
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
*/
 | 
			
		||||
 * Copyright (c) 2019-2020 SparkFun Electronics
 | 
			
		||||
 * SPDX-License-Identifier: MIT
 | 
			
		||||
 *
 | 
			
		||||
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
 * of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
 * in the Software without restriction, including without limitation the rights
 | 
			
		||||
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
 * copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
 * furnished to do so, subject to the following conditions:
 | 
			
		||||
 *
 | 
			
		||||
 * The above copyright notice and this permission notice shall be included in
 | 
			
		||||
 * all copies or substantial portions of the Software.
 | 
			
		||||
 *
 | 
			
		||||
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
 * SOFTWARE.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef MBED_PINNAMES_H
 | 
			
		||||
#define MBED_PINNAMES_H
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,7 +45,7 @@ typedef enum
 | 
			
		|||
    D6 = 6,
 | 
			
		||||
    D7 = 7,
 | 
			
		||||
    D8 = 8,
 | 
			
		||||
    D9 = 9
 | 
			
		||||
    D9 = 9,
 | 
			
		||||
    D10 = 10,
 | 
			
		||||
    D11 = 11,
 | 
			
		||||
    D12 = 12,
 | 
			
		||||
| 
						 | 
				
			
			@ -95,10 +95,19 @@ typedef enum
 | 
			
		|||
    A34 = D34,
 | 
			
		||||
    A35 = D35,
 | 
			
		||||
 | 
			
		||||
    LED1 = D1,
 | 
			
		||||
    SERIAL_TX = 48,
 | 
			
		||||
    SERIAL_RX = 49,
 | 
			
		||||
    USBTX = SERIAL_TX,
 | 
			
		||||
    USBRX = SERIAL_RX,
 | 
			
		||||
 | 
			
		||||
    // Not connected
 | 
			
		||||
    NC = NC_VAL
 | 
			
		||||
} PinName;
 | 
			
		||||
 | 
			
		||||
#define STDIO_UART_TX USBTX
 | 
			
		||||
#define STDIO_UART_RX USBRX
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -188,7 +188,4 @@ SECTIONS
 | 
			
		|||
  __StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
 | 
			
		||||
  PROVIDE(__stack = __StackTop);
 | 
			
		||||
  PROVIDE(_sstack = __StackTop);
 | 
			
		||||
  /* Check if data + heap + stack exceeds RAM limit*/
 | 
			
		||||
  /*ASSERT(1, "region RAM overflowed with stack")*/
 | 
			
		||||
  /* test test test */
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ void gpio_mode(gpio_t *obj, PinMode mode)
 | 
			
		|||
{
 | 
			
		||||
    MBED_ASSERT(gpio_is_connected(obj));
 | 
			
		||||
    MBED_ASSERT(mode < (PinMode)PinModeElements);
 | 
			
		||||
    am_hal_gpio_pincfg_allow_t pinConfigBools;
 | 
			
		||||
    am_hal_gpio_pincfg_allow_t pinConfigBools = {0};
 | 
			
		||||
 | 
			
		||||
    obj->cfg.uFuncSel = AP3_PINCFG_FUNCSEL_GPIO; // gpio
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -164,7 +164,7 @@ void gpio_dir(gpio_t *obj, PinDirection direction)
 | 
			
		|||
{
 | 
			
		||||
    MBED_ASSERT(gpio_is_connected(obj));
 | 
			
		||||
    MBED_ASSERT(direction < (PinDirection)PIN_DIR_ELEMENTS);
 | 
			
		||||
    am_hal_gpio_pincfg_allow_t pinConfigBools;
 | 
			
		||||
    am_hal_gpio_pincfg_allow_t pinConfigBools= {0};
 | 
			
		||||
 | 
			
		||||
    if (direction == (PinDirection)PIN_INPUT) {
 | 
			
		||||
        obj->cfg.eGPInput = AM_HAL_GPIO_PIN_INPUT_ENABLE;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,10 +57,6 @@ void pinmap_config(PinName pin, const PinMap *map)
 | 
			
		|||
 | 
			
		||||
void pin_function(PinName pin, int function)
 | 
			
		||||
{
 | 
			
		||||
    // am_hal_gpio_pincfg_t cfg = {0};
 | 
			
		||||
    // cfg.uFuncSel = function;
 | 
			
		||||
    // am_hal_gpio_pinconfig((uint32_t)(pin), cfg); // apply configuration
 | 
			
		||||
 | 
			
		||||
#define PADREG_FLD_FNSEL_S 3
 | 
			
		||||
 | 
			
		||||
    uint32_t ui32Padreg;
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +91,7 @@ void pin_function(PinName pin, int function)
 | 
			
		|||
    // Get the new values into their rightful bit positions.
 | 
			
		||||
    ui32Padreg <<= ui32PadShft;
 | 
			
		||||
 | 
			
		||||
    AM_CRITICAL_BEGIN
 | 
			
		||||
    core_util_critical_section_enter();
 | 
			
		||||
 | 
			
		||||
    GPIO->PADKEY = GPIO_PADKEY_PADKEY_Key;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -103,15 +99,30 @@ void pin_function(PinName pin, int function)
 | 
			
		|||
 | 
			
		||||
    GPIO->PADKEY = 0;
 | 
			
		||||
 | 
			
		||||
    AM_CRITICAL_END
 | 
			
		||||
    core_util_critical_section_exit();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//pin_mode should not be utilized by apollo3 hal, but is provided to complete the pinmap API
 | 
			
		||||
//Use pinmap_config for apollo3 target insted of pinmap_pinout, this will have better hal verification of settings
 | 
			
		||||
//if this function does not provide sufficient functionality, try pinmap_config or gpio_mode
 | 
			
		||||
void pin_mode(PinName pin, PinMode mode)
 | 
			
		||||
{
 | 
			
		||||
    MBED_ASSERT(0);
 | 
			
		||||
    // gpio_t obj = {
 | 
			
		||||
    //     .pad = (ap3_gpio_pad_t)pin,
 | 
			
		||||
    //     .cfg = {0},
 | 
			
		||||
    // };
 | 
			
		||||
    // gpio_mode(gpio_t * obj, PinMode mode)
 | 
			
		||||
    am_hal_gpio_pincfg_t bfGpioCfg = {0};
 | 
			
		||||
    am_hal_gpio_pincfg_allow_t sAllowableChanges = {0};
 | 
			
		||||
 | 
			
		||||
    if (mode & (PinMode)PullNone) {
 | 
			
		||||
        bfGpioCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_NONE;
 | 
			
		||||
        sAllowableChanges.ePullup = true;
 | 
			
		||||
    }
 | 
			
		||||
    if (mode & (PinMode)PullUp) {
 | 
			
		||||
        bfGpioCfg.ePullup = AM_HAL_GPIO_PIN_PULLUP_WEAK;
 | 
			
		||||
        sAllowableChanges.ePullup = true;
 | 
			
		||||
    }
 | 
			
		||||
    if (mode & (PinMode)PullDown) {
 | 
			
		||||
        bfGpioCfg.ePullup = AM_HAL_GPIO_PIN_PULLDOWN;
 | 
			
		||||
        sAllowableChanges.ePullup = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ap3_hal_gpio_pinconfig_partial(pin, bfGpioCfg, sAllowableChanges);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6831,8 +6831,9 @@
 | 
			
		|||
        "components": [
 | 
			
		||||
            "FLASHIAP"
 | 
			
		||||
        ],
 | 
			
		||||
        "macros": ["CORDIO_ZERO_COPY_HCI",
 | 
			
		||||
                    "USE_AMBIQ_DRIVER"
 | 
			
		||||
        "macros": [
 | 
			
		||||
            "CORDIO_ZERO_COPY_HCI",
 | 
			
		||||
            "USE_AMBIQ_DRIVER"
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
    "AMA3B1KK": {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue