mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-02 08:40:33 +08:00
first console project
This commit is contained in:
1 parent
0fe8fccfbd
commit
abcac46fcf
76 files changed
+21199
-13707
No files matched your search
@@ -54,6 +54,7 @@ CONFIG_RT_USING_MEMPOOL=y
|
||||
# CONFIG_RT_USING_NOHEAP is not set
|
||||
CONFIG_RT_USING_SMALL_MEM=y
|
||||
# CONFIG_RT_USING_SLAB is not set
|
||||
# CONFIG_RT_USING_USERHEAP is not set
|
||||
# CONFIG_RT_USING_MEMTRACE is not set
|
||||
CONFIG_RT_USING_HEAP=y
|
||||
|
||||
@@ -63,9 +64,7 @@ CONFIG_RT_USING_HEAP=y
|
||||
CONFIG_RT_USING_DEVICE=y
|
||||
# CONFIG_RT_USING_DEVICE_OPS is not set
|
||||
# CONFIG_RT_USING_INTERRUPT_INFO is not set
|
||||
CONFIG_RT_USING_CONSOLE=y
|
||||
CONFIG_RT_CONSOLEBUF_SIZE=128
|
||||
CONFIG_RT_CONSOLE_DEVICE_NAME="uart0"
|
||||
# CONFIG_RT_USING_CONSOLE is not set
|
||||
CONFIG_RT_VER_NUM=0x40003
|
||||
# CONFIG_RT_USING_CPU_FFS is not set
|
||||
# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
|
||||
@@ -73,10 +72,8 @@ CONFIG_RT_VER_NUM=0x40003
|
||||
#
|
||||
# RT-Thread Components
|
||||
#
|
||||
CONFIG_RT_USING_COMPONENTS_INIT=y
|
||||
CONFIG_RT_USING_USER_MAIN=y
|
||||
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
|
||||
CONFIG_RT_MAIN_THREAD_PRIORITY=10
|
||||
# CONFIG_RT_USING_COMPONENTS_INIT is not set
|
||||
# CONFIG_RT_USING_USER_MAIN is not set
|
||||
|
||||
#
|
||||
# C++ features
|
||||
@@ -86,21 +83,7 @@ CONFIG_RT_MAIN_THREAD_PRIORITY=10
|
||||
#
|
||||
# Command shell
|
||||
#
|
||||
CONFIG_RT_USING_FINSH=y
|
||||
CONFIG_FINSH_THREAD_NAME="tshell"
|
||||
CONFIG_FINSH_USING_HISTORY=y
|
||||
CONFIG_FINSH_HISTORY_LINES=5
|
||||
CONFIG_FINSH_USING_SYMTAB=y
|
||||
CONFIG_FINSH_USING_DESCRIPTION=y
|
||||
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
|
||||
CONFIG_FINSH_THREAD_PRIORITY=20
|
||||
CONFIG_FINSH_THREAD_STACK_SIZE=4096
|
||||
CONFIG_FINSH_CMD_SIZE=80
|
||||
# CONFIG_FINSH_USING_AUTH is not set
|
||||
CONFIG_FINSH_USING_MSH=y
|
||||
CONFIG_FINSH_USING_MSH_DEFAULT=y
|
||||
CONFIG_FINSH_USING_MSH_ONLY=y
|
||||
CONFIG_FINSH_ARG_MAX=10
|
||||
# CONFIG_RT_USING_FINSH is not set
|
||||
|
||||
#
|
||||
# Device virtual file system
|
||||
@@ -297,6 +280,8 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_WAVPLAYER is not set
|
||||
# CONFIG_PKG_USING_TJPGD is not set
|
||||
# CONFIG_PKG_USING_HELIX is not set
|
||||
# CONFIG_PKG_USING_AZUREGUIX is not set
|
||||
# CONFIG_PKG_USING_TOUCHGFX2RTT is not set
|
||||
|
||||
#
|
||||
# tools packages
|
||||
@@ -311,6 +296,7 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_ADBD is not set
|
||||
# CONFIG_PKG_USING_COREMARK is not set
|
||||
# CONFIG_PKG_USING_DHRYSTONE is not set
|
||||
# CONFIG_PKG_USING_MEMORYPERF is not set
|
||||
# CONFIG_PKG_USING_NR_MICRO_SHELL is not set
|
||||
# CONFIG_PKG_USING_CHINESE_FONT_LIBRARY is not set
|
||||
# CONFIG_PKG_USING_LUNAR_CALENDAR is not set
|
||||
@@ -318,6 +304,8 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_GPS_RMC is not set
|
||||
# CONFIG_PKG_USING_URLENCODE is not set
|
||||
# CONFIG_PKG_USING_UMCN is not set
|
||||
# CONFIG_PKG_USING_LWRB2RTT is not set
|
||||
# CONFIG_PKG_USING_CPU_USAGE is not set
|
||||
|
||||
#
|
||||
# system packages
|
||||
@@ -344,10 +332,16 @@ CONFIG_RT_USING_LIBC=y
|
||||
# CONFIG_PKG_USING_RAMDISK is not set
|
||||
# CONFIG_PKG_USING_MININI is not set
|
||||
# CONFIG_PKG_USING_QBOOT is not set
|
||||
|
||||
#
|
||||
# Micrium: Micrium software products porting for RT-Thread
|
||||
#
|
||||
# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set
|
||||
# CONFIG_PKG_USING_UCOSII_WRAPPER is not set
|
||||
# CONFIG_PKG_USING_UC_CRC is not set
|
||||
# CONFIG_PKG_USING_UC_CLK is not set
|
||||
# CONFIG_PKG_USING_UC_COMMON is not set
|
||||
# CONFIG_PKG_USING_UC_MODBUS is not set
|
||||
# CONFIG_PKG_USING_PPOOL is not set
|
||||
|
||||
#
|
||||
@@ -407,6 +401,10 @@ CONFIG_PKG_NRFX_VER="v2.1.0"
|
||||
# CONFIG_PKG_USING_WK2124 is not set
|
||||
# CONFIG_PKG_USING_LY68L6400 is not set
|
||||
# CONFIG_PKG_USING_DM9051 is not set
|
||||
# CONFIG_PKG_USING_SSD1306 is not set
|
||||
# CONFIG_PKG_USING_QKEY is not set
|
||||
# CONFIG_PKG_USING_RS485 is not set
|
||||
# CONFIG_PKG_USING_BSAL is not set
|
||||
|
||||
#
|
||||
# miscellaneous packages
|
||||
@@ -416,6 +414,7 @@ CONFIG_PKG_NRFX_VER="v2.1.0"
|
||||
# CONFIG_PKG_USING_FASTLZ is not set
|
||||
# CONFIG_PKG_USING_MINILZO is not set
|
||||
# CONFIG_PKG_USING_QUICKLZ is not set
|
||||
# CONFIG_PKG_USING_LZMA is not set
|
||||
# CONFIG_PKG_USING_MULTIBUTTON is not set
|
||||
# CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
|
||||
# CONFIG_PKG_USING_CANFESTIVAL is not set
|
||||
@@ -436,63 +435,33 @@ CONFIG_PKG_NRFX_VER="v2.1.0"
|
||||
# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
|
||||
# CONFIG_PKG_USING_HELLO is not set
|
||||
# CONFIG_PKG_USING_VI is not set
|
||||
# CONFIG_PKG_USING_KI is not set
|
||||
# CONFIG_PKG_USING_NNOM is not set
|
||||
# CONFIG_PKG_USING_LIBANN is not set
|
||||
# CONFIG_PKG_USING_ELAPACK is not set
|
||||
# CONFIG_PKG_USING_ARMv7M_DWT is not set
|
||||
# CONFIG_PKG_USING_VT100 is not set
|
||||
# CONFIG_PKG_USING_TETRIS is not set
|
||||
# CONFIG_PKG_USING_ULAPACK is not set
|
||||
# CONFIG_PKG_USING_UKAL is not set
|
||||
# CONFIG_PKG_USING_CRCLIB is not set
|
||||
|
||||
#
|
||||
# games: games run on RT-Thread console
|
||||
#
|
||||
# CONFIG_PKG_USING_THREES is not set
|
||||
# CONFIG_PKG_USING_2048 is not set
|
||||
# CONFIG_PKG_USING_SNAKE is not set
|
||||
# CONFIG_PKG_USING_TETRIS is not set
|
||||
# CONFIG_PKG_USING_LWGPS is not set
|
||||
# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set
|
||||
|
||||
#
|
||||
# Hardware Drivers Config
|
||||
#
|
||||
CONFIG_SOC_NRF52840=y
|
||||
CONFIG_NRFX_CLOCK_ENABLED=1
|
||||
CONFIG_NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY=7
|
||||
CONFIG_NRFX_CLOCK_CONFIG_LF_SRC=1
|
||||
CONFIG_SOC_NORDIC=y
|
||||
|
||||
#
|
||||
# Onboard Peripheral Drivers
|
||||
#
|
||||
CONFIG_BSP_USING_JLINK_TO_USART=y
|
||||
# CONFIG_BSP_USING_QSPI_FLASH is not set
|
||||
CONFIG_SOC_MAXIM=y
|
||||
|
||||
#
|
||||
# On-chip Peripheral Drivers
|
||||
#
|
||||
CONFIG_BSP_USING_GPIO=y
|
||||
CONFIG_NRFX_GPIOTE_ENABLED=1
|
||||
# CONFIG_BSP_USING_SAADC is not set
|
||||
# CONFIG_BSP_USING_PWM is not set
|
||||
CONFIG_BSP_USING_UART=y
|
||||
CONFIG_NRFX_USING_UART=y
|
||||
# CONFIG_NRFX_USING_UARTE is not set
|
||||
CONFIG_NRFX_UART_ENABLED=1
|
||||
CONFIG_BSP_USING_UART0=y
|
||||
CONFIG_NRFX_UART0_ENABLED=1
|
||||
CONFIG_BSP_UART0_RX_PIN=8
|
||||
CONFIG_BSP_UART0_TX_PIN=6
|
||||
# CONFIG_BSP_USING_SPI is not set
|
||||
# CONFIG_BSP_USING_ON_CHIP_FLASH is not set
|
||||
|
||||
#
|
||||
# On-chip flash config
|
||||
#
|
||||
CONFIG_MCU_FLASH_START_ADDRESS=0x00000000
|
||||
CONFIG_MCU_FLASH_SIZE_KB=1024
|
||||
CONFIG_MCU_SRAM_START_ADDRESS=0x20000000
|
||||
CONFIG_MCU_SRAM_SIZE_KB=256
|
||||
CONFIG_MCU_FLASH_PAGE_SIZE=0x1000
|
||||
# CONFIG_BSP_USING_WDT is not set
|
||||
# CONFIG_BSP_USING_ONCHIP_RTC is not set
|
||||
CONFIG_BLE_STACK_USING_NULL=y
|
||||
# CONFIG_BSP_USING_SOFTDEVICE is not set
|
||||
# CONFIG_BSP_USING_NIMBLE is not set
|
||||
@@ -48,10 +48,10 @@ print(SDK_LIB)
|
||||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
|
||||
|
||||
# include drivers
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
|
||||
#objs.extend(SConscript(os.path.join(libraries_path_prefix, 'drivers', 'SConscript')))
|
||||
|
||||
# include cmsis
|
||||
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'cmsis', 'SConscript')))
|
||||
#objs.extend(SConscript(os.path.join(libraries_path_prefix, 'cmsis', 'SConscript')))
|
||||
|
||||
# make a building
|
||||
DoBuilding(TARGET, objs)
|
||||
@@ -13,19 +13,24 @@
|
||||
#include <rtdevice.h>
|
||||
#define DK_BOARD_LED_1 13
|
||||
#define DK_BOARD_LED_2 14
|
||||
#include "gpio.h"
|
||||
|
||||
const gpio_cfg_t led_pin[] = {
|
||||
{PORT_0, PIN_13, GPIO_FUNC_OUT, GPIO_PAD_NONE},
|
||||
};
|
||||
int main(void)
|
||||
{
|
||||
int count = 1;
|
||||
rt_pin_mode(DK_BOARD_LED_1, PIN_MODE_OUTPUT);
|
||||
|
||||
GPIO_Config(&led_pin[0]);
|
||||
//rt_pin_mode(DK_BOARD_LED_1, PIN_MODE_OUTPUT);
|
||||
GPIO_OutSet(&led_pin[0]);
|
||||
while (count++)
|
||||
{
|
||||
rt_pin_write(DK_BOARD_LED_1, PIN_HIGH);
|
||||
//rt_pin_write(DK_BOARD_LED_1, PIN_HIGH);
|
||||
rt_thread_mdelay(500);
|
||||
|
||||
rt_pin_write(DK_BOARD_LED_1, PIN_LOW);
|
||||
rt_thread_mdelay(500);
|
||||
GPIO_OutToggle(&led_pin[0]);
|
||||
//rt_pin_write(DK_BOARD_LED_1, PIN_LOW);
|
||||
//rt_thread_mdelay(500);
|
||||
}
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2018, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2018.10.30 SummerGift first version
|
||||
* 2019.03.05 whj4674672 add stm32h7
|
||||
* 2020-10-14 Dozingfiretruck Porting for stm32wbxx
|
||||
*/
|
||||
|
||||
#ifndef __DRV_USART_H__
|
||||
#define __DRV_USART_H__
|
||||
|
||||
int rt_hw_usart_init(void);
|
||||
|
||||
#endif /* __DRV_USART_H__ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -10,11 +10,12 @@
|
||||
*/
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include <nrfx_systick.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include "board.h"
|
||||
#include "drv_uart.h"
|
||||
#include <nrfx_clock.h>
|
||||
#include "mxc_sys.h"
|
||||
#ifdef RT_USING_SERIAL
|
||||
#include "drv_usart.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is the timer interrupt service routine.
|
||||
@@ -31,63 +32,49 @@ void SysTick_Handler(void)
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
static void clk_event_handler(nrfx_clock_evt_type_t event){}
|
||||
|
||||
void SysTick_Configuration(void)
|
||||
{
|
||||
nrfx_clock_init(clk_event_handler);
|
||||
nrfx_clock_enable();
|
||||
nrfx_clock_lfclk_start();
|
||||
/* Set interrupt priority */
|
||||
NVIC_SetPriority(SysTick_IRQn, 0xf);
|
||||
|
||||
/* Configure SysTick to interrupt at the requested rate. */
|
||||
nrf_systick_load_set(SystemCoreClock / RT_TICK_PER_SECOND);
|
||||
nrf_systick_val_clear();
|
||||
nrf_systick_csr_set(NRF_SYSTICK_CSR_CLKSOURCE_CPU | NRF_SYSTICK_CSR_TICKINT_ENABLE
|
||||
| NRF_SYSTICK_CSR_ENABLE);
|
||||
uint32_t error;
|
||||
error = SYS_SysTick_Config(SYS_SysTick_GetFreq()/RT_TICK_PER_SECOND, 1, MXC_TMR0);
|
||||
|
||||
if (error != E_NO_ERROR) {
|
||||
printf("ERROR: Ticks is not valid");
|
||||
}
|
||||
}
|
||||
|
||||
mxc_uart_regs_t *ConsoleUART = MXC_UART_GET_UART(1);
|
||||
|
||||
const sys_cfg_uart_t console_uart_sys_cfg = {
|
||||
MAP_A,
|
||||
UART_FLOW_DISABLE,
|
||||
};
|
||||
|
||||
|
||||
void rt_hw_board_init(void)
|
||||
{
|
||||
rt_hw_interrupt_enable(0);
|
||||
// rt_hw_interrupt_enable(0);
|
||||
// sd_power_dcdc_mode_set(NRF_POWER_DCDC_ENABLE);
|
||||
/* Activate deep sleep mode */
|
||||
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
|
||||
|
||||
SysTick_Configuration();
|
||||
|
||||
#if defined(RT_USING_HEAP)
|
||||
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
|
||||
rt_system_heap_init((void *)(0x20000000+16*1024), (void *)(0x20000000+64*1024));
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RT_USING_SERIAL
|
||||
rt_hw_uart_init();
|
||||
rt_hw_usart_init();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RT_USING_CONSOLE
|
||||
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RT_USING_COMPONENTS_INIT
|
||||
rt_components_board_init();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BSP_USING_SOFTDEVICE
|
||||
extern uint32_t Image$$RW_IRAM1$$Base;
|
||||
uint32_t const *const m_ram_start = &Image$$RW_IRAM1$$Base;
|
||||
if ((uint32_t)m_ram_start == 0x20000000)
|
||||
{
|
||||
rt_kprintf("\r\n using softdevice the RAM couldn't be %p,please use the templete from package\r\n", m_ram_start);
|
||||
while (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_kprintf("\r\n using softdevice the RAM at %p\r\n", m_ram_start);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rthw.h>
|
||||
#include "nrf.h"
|
||||
|
||||
#define MCU_FLASH_SIZE MCU_FLASH_SIZE_KB*1024
|
||||
#define MCU_FLASH_END_ADDRESS ((uint32_t)(MCU_FLASH_START_ADDRESS + MCU_FLASH_SIZE))
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
; *** Scatter-Loading Description File generated by uVision ***
|
||||
; *************************************************************
|
||||
|
||||
LR_IROM1 0x00000000 0x100000 { ; load region size_region
|
||||
ER_IROM1 0x00000000 0x100000 { ; load address = execution address
|
||||
LR_IROM1 0x00000000 0x00040000 { ; load region size_region
|
||||
ER_IROM1 0x00000000 0x00040000 { ; load address = execution address
|
||||
*.o (RESET, +First)
|
||||
*(InRoot$$Sections)
|
||||
.ANY (+RO)
|
||||
.ANY (+XO)
|
||||
}
|
||||
RW_IRAM1 0x20000000 0x40000 { ; RW data
|
||||
RW_IRAM1 0x20000000 0x00018000 { ; RW data
|
||||
.ANY (+RW +ZI)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2017 - 2019, Nordic Semiconductor ASA
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Nordic
|
||||
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||
* such product, must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* 4. This software, with or without modification, must only be used with a
|
||||
* Nordic Semiconductor ASA integrated circuit.
|
||||
*
|
||||
* 5. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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 NRFX_CONFIG_H__
|
||||
#define NRFX_CONFIG_H__
|
||||
|
||||
// TODO - temporary redirection
|
||||
#include <sdk_config.h>
|
||||
|
||||
#endif // NRFX_CONFIG_H__
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - 2020, Nordic Semiconductor ASA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* 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 HOLDER 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 NRFX_LOG_H__
|
||||
#define NRFX_LOG_H__
|
||||
|
||||
// THIS IS A TEMPLATE FILE.
|
||||
// It should be copied to a suitable location within the host environment into
|
||||
// which nrfx is integrated, and the following macros should be provided with
|
||||
// appropriate implementations.
|
||||
// And this comment should be removed from the customized file.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup nrfx_log nrfx_log.h
|
||||
* @{
|
||||
* @ingroup nrfx
|
||||
*
|
||||
* @brief This file contains macros that should be implemented according to
|
||||
* the needs of the host environment into which @em nrfx is integrated.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a message with the severity level ERROR.
|
||||
*
|
||||
* @param format printf-style format string, optionally followed by arguments
|
||||
* to be formatted and inserted in the resulting string.
|
||||
*/
|
||||
#define NRFX_LOG_ERROR(format, ...)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a message with the severity level WARNING.
|
||||
*
|
||||
* @param format printf-style format string, optionally followed by arguments
|
||||
* to be formatted and inserted in the resulting string.
|
||||
*/
|
||||
#define NRFX_LOG_WARNING(format, ...)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a message with the severity level INFO.
|
||||
*
|
||||
* @param format printf-style format string, optionally followed by arguments
|
||||
* to be formatted and inserted in the resulting string.
|
||||
*/
|
||||
#define NRFX_LOG_INFO(format, ...)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a message with the severity level DEBUG.
|
||||
*
|
||||
* @param format printf-style format string, optionally followed by arguments
|
||||
* to be formatted and inserted in the resulting string.
|
||||
*/
|
||||
#define NRFX_LOG_DEBUG(format, ...)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a memory dump with the severity level ERROR.
|
||||
*
|
||||
* @param[in] p_memory Pointer to the memory region to be dumped.
|
||||
* @param[in] length Length of the memory region in bytes.
|
||||
*/
|
||||
#define NRFX_LOG_HEXDUMP_ERROR(p_memory, length)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a memory dump with the severity level WARNING.
|
||||
*
|
||||
* @param[in] p_memory Pointer to the memory region to be dumped.
|
||||
* @param[in] length Length of the memory region in bytes.
|
||||
*/
|
||||
#define NRFX_LOG_HEXDUMP_WARNING(p_memory, length)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a memory dump with the severity level INFO.
|
||||
*
|
||||
* @param[in] p_memory Pointer to the memory region to be dumped.
|
||||
* @param[in] length Length of the memory region in bytes.
|
||||
*/
|
||||
#define NRFX_LOG_HEXDUMP_INFO(p_memory, length)
|
||||
|
||||
/**
|
||||
* @brief Macro for logging a memory dump with the severity level DEBUG.
|
||||
*
|
||||
* @param[in] p_memory Pointer to the memory region to be dumped.
|
||||
* @param[in] length Length of the memory region in bytes.
|
||||
*/
|
||||
#define NRFX_LOG_HEXDUMP_DEBUG(p_memory, length)
|
||||
|
||||
|
||||
/**
|
||||
* @brief Macro for getting the textual representation of a given error code.
|
||||
*
|
||||
* @param[in] error_code Error code.
|
||||
*
|
||||
* @return String containing the textual representation of the error code.
|
||||
*/
|
||||
#define NRFX_LOG_ERROR_STRING_GET(error_code)
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NRFX_LOG_H__
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,32 @@
|
||||
#ifndef RT_CONFIG_H__
|
||||
#define RT_CONFIG_H__
|
||||
|
||||
#define RT_USING_USER_MAIN
|
||||
#define RT_TICK_PER_SECOND 1000
|
||||
#define BSP_USING_UART1
|
||||
#define BSP_USING_UART0
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
|
||||
#define RT_USING_DEVICE
|
||||
#define RT_USING_CONSOLE
|
||||
#define RT_CONSOLEBUF_SIZE 256
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart1"
|
||||
|
||||
#define RT_USING_FINSH
|
||||
#define FINSH_THREAD_NAME "tshell"
|
||||
#define FINSH_USING_HISTORY
|
||||
#define FINSH_HISTORY_LINES 5
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
#define FINSH_THREAD_PRIORITY 20
|
||||
#define FINSH_THREAD_STACK_SIZE 4096
|
||||
#define FINSH_CMD_SIZE 80
|
||||
#define FINSH_USING_MSH
|
||||
#define FINSH_USING_MSH_DEFAULT
|
||||
#define FINSH_USING_MSH_ONLY
|
||||
#define FINSH_ARG_MAX 10
|
||||
|
||||
|
||||
/* Automatically generated file; DO NOT EDIT. */
|
||||
/* RT-Thread Configuration */
|
||||
|
||||
@@ -10,7 +36,8 @@
|
||||
#define RT_ALIGN_SIZE 4
|
||||
#define RT_THREAD_PRIORITY_32
|
||||
#define RT_THREAD_PRIORITY_MAX 32
|
||||
#define RT_TICK_PER_SECOND 100
|
||||
|
||||
|
||||
#define RT_USING_OVERFLOW_CHECK
|
||||
#define RT_USING_HOOK
|
||||
#define RT_USING_IDLE_HOOK
|
||||
@@ -38,36 +65,16 @@
|
||||
/* Kernel Device Object */
|
||||
|
||||
#define RT_USING_DEVICE
|
||||
#define RT_USING_CONSOLE
|
||||
#define RT_CONSOLEBUF_SIZE 128
|
||||
#define RT_CONSOLE_DEVICE_NAME "uart0"
|
||||
#define RT_VER_NUM 0x40003
|
||||
|
||||
/* RT-Thread Components */
|
||||
|
||||
#define RT_USING_COMPONENTS_INIT
|
||||
#define RT_USING_USER_MAIN
|
||||
#define RT_MAIN_THREAD_STACK_SIZE 2048
|
||||
#define RT_MAIN_THREAD_PRIORITY 10
|
||||
|
||||
/* C++ features */
|
||||
|
||||
|
||||
/* Command shell */
|
||||
|
||||
#define RT_USING_FINSH
|
||||
#define FINSH_THREAD_NAME "tshell"
|
||||
#define FINSH_USING_HISTORY
|
||||
#define FINSH_HISTORY_LINES 5
|
||||
#define FINSH_USING_SYMTAB
|
||||
#define FINSH_USING_DESCRIPTION
|
||||
#define FINSH_THREAD_PRIORITY 20
|
||||
#define FINSH_THREAD_STACK_SIZE 4096
|
||||
#define FINSH_CMD_SIZE 80
|
||||
#define FINSH_USING_MSH
|
||||
#define FINSH_USING_MSH_DEFAULT
|
||||
#define FINSH_USING_MSH_ONLY
|
||||
#define FINSH_ARG_MAX 10
|
||||
|
||||
/* Device virtual file system */
|
||||
|
||||
@@ -138,6 +145,9 @@
|
||||
/* system packages */
|
||||
|
||||
|
||||
/* Micrium: Micrium software products porting for RT-Thread */
|
||||
|
||||
|
||||
/* peripheral libraries and drivers */
|
||||
|
||||
#define PKG_USING_NRFX
|
||||
@@ -149,37 +159,15 @@
|
||||
/* samples: kernel and components samples */
|
||||
|
||||
|
||||
/* games: games run on RT-Thread console */
|
||||
|
||||
|
||||
/* Hardware Drivers Config */
|
||||
|
||||
#define SOC_NRF52840
|
||||
#define NRFX_CLOCK_ENABLED 1
|
||||
#define NRFX_CLOCK_DEFAULT_CONFIG_IRQ_PRIORITY 7
|
||||
#define NRFX_CLOCK_CONFIG_LF_SRC 1
|
||||
#define SOC_NORDIC
|
||||
|
||||
/* Onboard Peripheral Drivers */
|
||||
|
||||
#define BSP_USING_JLINK_TO_USART
|
||||
#define SOC_MAXIM
|
||||
|
||||
/* On-chip Peripheral Drivers */
|
||||
|
||||
#define BSP_USING_GPIO
|
||||
#define NRFX_GPIOTE_ENABLED 1
|
||||
#define BSP_USING_UART
|
||||
#define NRFX_USING_UART
|
||||
#define NRFX_UART_ENABLED 1
|
||||
#define BSP_USING_UART0
|
||||
#define NRFX_UART0_ENABLED 1
|
||||
#define BSP_UART0_RX_PIN 8
|
||||
#define BSP_UART0_TX_PIN 6
|
||||
|
||||
/* On-chip flash config */
|
||||
|
||||
#define MCU_FLASH_START_ADDRESS 0x00000000
|
||||
#define MCU_FLASH_SIZE_KB 1024
|
||||
#define MCU_SRAM_START_ADDRESS 0x20000000
|
||||
#define MCU_SRAM_SIZE_KB 256
|
||||
#define MCU_FLASH_PAGE_SIZE 0x1000
|
||||
#define BLE_STACK_USING_NULL
|
||||
|
||||
#endif
|
||||
@@ -77,7 +77,7 @@
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<IsCurrentTarget>1</IsCurrentTarget>
|
||||
</OPTFL>
|
||||
<CpuCode>5</CpuCode>
|
||||
<CpuCode>255</CpuCode>
|
||||
<DebugOpt>
|
||||
<uSim>0</uSim>
|
||||
<uTrg>1</uTrg>
|
||||
@@ -103,7 +103,7 @@
|
||||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>4</nTsel>
|
||||
<nTsel>3</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
<sDlgDll></sDlgDll>
|
||||
@@ -114,18 +114,18 @@
|
||||
<tDlgDll></tDlgDll>
|
||||
<tDlgPa></tDlgPa>
|
||||
<tIfile></tIfile>
|
||||
<pMon>Segger\JL2CM3.dll</pMon>
|
||||
<pMon>BIN\CMSIS_AGDI.dll</pMon>
|
||||
</DebugOpt>
|
||||
<TargetDriverDllRegistry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>JL2CM3</Key>
|
||||
<Name>-U683349164 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC4000 -FN2 -FF0nrf52xxx.flm -FS00 -FL0200000 -FP0($$Device:nRF52840_xxAA$Flash\nrf52xxx.flm) -FF1nrf52xxx_uicr.flm -FS110001000 -FL11000 -FP1($$Device:nRF52840_xxAA$Flash\nrf52xxx_uicr.flm)</Name>
|
||||
<Key>CMSIS_AGDI</Key>
|
||||
<Name>-X"CMSIS-DAP" -U04440000e28e0cd70000000000000000 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0MAX32660.FLM -FS00 -FL040000 -FP0($$Device:MAX32660$Flash\MAX32660.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>UL2CM3</Key>
|
||||
<Name>UL2CM3(-S0 -C0 -P0 ) -FN2 -FC4000 -FD20000000 -FF0nrf52xxx -FF1nrf52xxx_uicr -FL0200000 -FL11000 -FS00 -FS110001000 -FP0($$Device:nRF52840_xxAA$Flash\nrf52xxx.flm) -FP1($$Device:nRF52840_xxAA$Flash\nrf52xxx_uicr.flm)</Name>
|
||||
<Name>UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0MAX32660 -FL040000 -FS00 -FP0($$Device:MAX32660$Flash\MAX32660.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
</TargetDriverDllRegistry>
|
||||
<Breakpoint/>
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>nRF52840_xxAA</Device>
|
||||
<Vendor>Nordic Semiconductor</Vendor>
|
||||
<PackID>NordicSemiconductor.nRF_DeviceFamilyPack.8.32.1</PackID>
|
||||
<PackURL>http://developer.nordicsemi.com/nRF5_SDK/pieces/nRF_DeviceFamilyPack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x40000) IROM(0x00000000,0x100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
|
||||
<Device>MAX32660</Device>
|
||||
<Vendor>Maxim</Vendor>
|
||||
<PackID>Maxim.MAX32660.1.2.0</PackID>
|
||||
<PackURL>http://www.mxim.net/microcontroller/pack/</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x00018000) IROM(0x00000000,0x00040000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
<StartupFile></StartupFile>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC4000 -FN2 -FF0nrf52xxx -FS00 -FL0200000 -FF1nrf52xxx_uicr -FS110001000 -FL11000 -FP0($$Device:nRF52840_xxAA$Flash\nrf52xxx.flm) -FP1($$Device:nRF52840_xxAA$Flash\nrf52xxx_uicr.flm))</FlashDriverDll>
|
||||
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0MAX32660 -FS00 -FL040000 -FP0($$Device:MAX32660$Flash\MAX32660.FLM))</FlashDriverDll>
|
||||
<DeviceId>0</DeviceId>
|
||||
<RegisterFile>$$Device:nRF52840_xxAA$Device\Include\nrf.h</RegisterFile>
|
||||
<RegisterFile>$$Device:MAX32660$Libraries\Device\Maxim\MAX32660\Include\max32660.h</RegisterFile>
|
||||
<MemoryEnv></MemoryEnv>
|
||||
<Cmp></Cmp>
|
||||
<Asm></Asm>
|
||||
@@ -33,7 +33,7 @@
|
||||
<SLE66CMisc></SLE66CMisc>
|
||||
<SLE66AMisc></SLE66AMisc>
|
||||
<SLE66LinkerMisc></SLE66LinkerMisc>
|
||||
<SFDFile>$$Device:nRF52840_xxAA$SVD\nrf52840.svd</SFDFile>
|
||||
<SFDFile>$$Device:MAX32660$SVD\MAX32660\max32660.svd</SFDFile>
|
||||
<bCustSvd>0</bCustSvd>
|
||||
<UseEnv>0</UseEnv>
|
||||
<BinPath></BinPath>
|
||||
@@ -110,11 +110,11 @@
|
||||
</CommonProperty>
|
||||
<DllOption>
|
||||
<SimDllName>SARMCM3.DLL</SimDllName>
|
||||
<SimDllArguments> -MPU</SimDllArguments>
|
||||
<SimDllArguments> </SimDllArguments>
|
||||
<SimDlgDll>DCM.DLL</SimDlgDll>
|
||||
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
|
||||
<TargetDllName>SARMCM3.DLL</TargetDllName>
|
||||
<TargetDllArguments> -MPU</TargetDllArguments>
|
||||
<TargetDllArguments></TargetDllArguments>
|
||||
<TargetDlgDll>TCM.DLL</TargetDlgDll>
|
||||
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
|
||||
</DllOption>
|
||||
@@ -245,12 +245,12 @@
|
||||
<IRAM>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
<Size>0x18000</Size>
|
||||
</IRAM>
|
||||
<IROM>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x100000</Size>
|
||||
<Size>0x40000</Size>
|
||||
</IROM>
|
||||
<XRAM>
|
||||
<Type>0</Type>
|
||||
@@ -275,7 +275,7 @@
|
||||
<OCR_RVCT4>
|
||||
<Type>1</Type>
|
||||
<StartAddress>0x0</StartAddress>
|
||||
<Size>0x100000</Size>
|
||||
<Size>0x40000</Size>
|
||||
</OCR_RVCT4>
|
||||
<OCR_RVCT5>
|
||||
<Type>1</Type>
|
||||
@@ -300,7 +300,7 @@
|
||||
<OCR_RVCT9>
|
||||
<Type>0</Type>
|
||||
<StartAddress>0x20000000</StartAddress>
|
||||
<Size>0x40000</Size>
|
||||
<Size>0x18000</Size>
|
||||
</OCR_RVCT9>
|
||||
<OCR_RVCT10>
|
||||
<Type>0</Type>
|
||||
@@ -315,7 +315,7 @@
|
||||
<Optim>1</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
<OneElfS>0</OneElfS>
|
||||
<Strict>0</Strict>
|
||||
<EnumInt>0</EnumInt>
|
||||
<PlainCh>0</PlainCh>
|
||||
@@ -336,7 +336,7 @@
|
||||
<v6Rtti>0</v6Rtti>
|
||||
<VariousControls>
|
||||
<MiscControls>--reduce_paths</MiscControls>
|
||||
<Define>BLE_STACK_SUPPORT_REQD NRF_SD_BLE_API_VERSION=4 S140 SOFTDEVICE_PRESENT SWI_DISABLE0 CONFIG_GPIO_AS_PINRESET NRF52 NRF52832_XXAA NRF52_PAN_12 NRF52_PAN_15 NRF52_PAN_20 NRF52_PAN_31 NRF52_PAN_36 NRF52_PAN_51 NRF52_PAN_54 NRF52_PAN_55 NRF52_PAN_58 NRF52_PAN_64 NRF52_PAN_74</Define>
|
||||
<Define></Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath></IncludePath>
|
||||
</VariousControls>
|
||||
@@ -372,7 +372,7 @@
|
||||
<ScatterFile></ScatterFile>
|
||||
<IncludeLibs></IncludeLibs>
|
||||
<IncludeLibsPath></IncludeLibsPath>
|
||||
<Misc>--diag_suppress 6330</Misc>
|
||||
<Misc></Misc>
|
||||
<LinkerInputFile></LinkerInputFile>
|
||||
<DisabledWarnings></DisabledWarnings>
|
||||
</LDads>
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
/*
|
||||
* Auto generated Run-Time-Environment Component Configuration File
|
||||
* *** Do not modify ! ***
|
||||
*
|
||||
* Project: 'Hello_World'
|
||||
* Target: 'Debug'
|
||||
*/
|
||||
|
||||
#ifndef RTE_COMPONENTS_H
|
||||
#define RTE_COMPONENTS_H
|
||||
|
||||
|
||||
/*
|
||||
* Define the Device Header File:
|
||||
*/
|
||||
#define CMSIS_device_header "max32660.h"
|
||||
|
||||
#define BOARD EvKit_V1 /* Target Board */
|
||||
#define RTE_USING_FINSH
|
||||
#define TARGET 32660 /* Target Device Part Number */
|
||||
#define TARGET_REV 0x4131 /* Target Device Revision Number */
|
||||
|
||||
#endif /* RTE_COMPONENTS_H */
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,39 @@
|
||||
/**************************************************************************//**
|
||||
* @file cmsis_version.h
|
||||
* @brief CMSIS Core(M) Version definitions
|
||||
* @version V5.0.4
|
||||
* @date 23. July 2019
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright (c) 2009-2019 ARM Limited. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if defined ( __ICCARM__ )
|
||||
#pragma system_include /* treat file as system include file for MISRA check */
|
||||
#elif defined (__clang__)
|
||||
#pragma clang system_header /* treat file as system include file */
|
||||
#endif
|
||||
|
||||
#ifndef __CMSIS_VERSION_H
|
||||
#define __CMSIS_VERSION_H
|
||||
|
||||
/* CMSIS Version definitions */
|
||||
#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
|
||||
#define __CM_CMSIS_VERSION_SUB ( 4U) /*!< [15:0] CMSIS Core(M) sub version */
|
||||
#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
|
||||
__CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @file mxc_config.h
|
||||
* @brief Top-level include file for device configuration.
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-08-09 18:45:02 -0500 (Thu, 09 Aug 2018) $
|
||||
* $Revision: 36818 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _MXC_CONFIG_H
|
||||
#define _MXC_CONFIG_H
|
||||
|
||||
#if !defined __GNUC__
|
||||
#include "RTE_Components.h"
|
||||
#endif /* not __GNUC__ */
|
||||
|
||||
#include "mxc_device.h"
|
||||
#include "mxc_errors.h"
|
||||
#include "mxc_pins.h"
|
||||
|
||||
#endif /* _CONFIG_H */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,167 @@
|
||||
/**
|
||||
* @file system_max32660.c
|
||||
* @brief System-level initialization implementation file
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
* $Revision: 40072 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "max32660.h"
|
||||
#include "gcr_regs.h"
|
||||
#include "pwrseq_regs.h"
|
||||
#include "tmr_regs.h"
|
||||
#include "wdt_regs.h"
|
||||
#include "mxc_sys.h"
|
||||
|
||||
extern void (* const __isr_vector[])(void);
|
||||
uint32_t SystemCoreClock = HIRC96_FREQ;
|
||||
|
||||
__weak void SystemCoreClockUpdate(void)
|
||||
{
|
||||
uint32_t base_freq, div, clk_src,ovr;
|
||||
|
||||
// Get the clock source and frequency
|
||||
clk_src = (MXC_GCR->clkcn & MXC_F_GCR_CLKCN_CLKSEL);
|
||||
|
||||
if (clk_src == MXC_S_GCR_CLKCN_CLKSEL_HFXIN) {
|
||||
base_freq = HFX_FREQ;
|
||||
} else {
|
||||
if (clk_src == MXC_S_GCR_CLKCN_CLKSEL_NANORING) {
|
||||
base_freq = NANORING_FREQ;
|
||||
} else {
|
||||
ovr = (MXC_PWRSEQ->lp_ctrl & MXC_F_PWRSEQ_LP_CTRL_OVR);
|
||||
if (ovr == MXC_S_PWRSEQ_LP_CTRL_OVR_0_9V) {
|
||||
base_freq = HIRC96_FREQ/4;
|
||||
} else {
|
||||
if (ovr == MXC_S_PWRSEQ_LP_CTRL_OVR_1_0V) {
|
||||
base_freq = HIRC96_FREQ/2;
|
||||
} else {
|
||||
base_freq = HIRC96_FREQ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the clock divider
|
||||
div = (MXC_GCR->clkcn & MXC_F_GCR_CLKCN_PSC) >> MXC_F_GCR_CLKCN_PSC_POS;
|
||||
|
||||
SystemCoreClock = base_freq >> div;
|
||||
}
|
||||
|
||||
/* This function is called before C runtime initialization and can be
|
||||
* implemented by the application for early initializations. If a value other
|
||||
* than '0' is returned, the C runtime initialization will be skipped.
|
||||
*
|
||||
* You may over-ride this function in your program by defining a custom
|
||||
* PreInit(), but care should be taken to reproduce the initilization steps
|
||||
* or a non-functional system may result.
|
||||
*/
|
||||
__weak int PreInit(void)
|
||||
{
|
||||
/* Do nothing */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function can be implemented by the application to initialize the board */
|
||||
__weak int Board_Init(void)
|
||||
{
|
||||
/* Do nothing */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This function is called just before control is transferred to main().
|
||||
*
|
||||
* You may over-ride this function in your program by defining a custom
|
||||
* SystemInit(), but care should be taken to reproduce the initialization
|
||||
* steps or a non-functional system may result.
|
||||
*/
|
||||
__weak void SystemInit(void)
|
||||
{
|
||||
/* Configure the interrupt controller to use the application vector table in */
|
||||
/* the application space */
|
||||
/* IAR & Keil must set vector table after all memory initialization. */
|
||||
SCB->VTOR = (unsigned long)__isr_vector;
|
||||
|
||||
MXC_WDT0->ctrl &= ~MXC_F_WDT_CTRL_WDT_EN; /* Turn off watchdog. Application can re-enable as needed. */
|
||||
|
||||
/* Enable FPU on Cortex-M4, which occupies coprocessor slots 10 & 11 */
|
||||
/* Grant full access, per "Table B3-24 CPACR bit assignments". */
|
||||
/* DDI0403D "ARMv7-M Architecture Reference Manual" */
|
||||
SCB->CPACR |= SCB_CPACR_CP10_Msk | SCB_CPACR_CP11_Msk;
|
||||
__DSB();
|
||||
__ISB();
|
||||
|
||||
/* Switch system clock to HIRC */
|
||||
SYS_Clock_Select(SYS_CLOCK_HIRC, MXC_TMR0);
|
||||
|
||||
/* Disable clocks to peripherals by default to reduce power */
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_DMA);
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_SPI17Y);
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_SPIMSS);
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_UART0);
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_UART1);
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_I2C0);
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_T0);
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_T1);
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_T2);
|
||||
SYS_ClockDisable(SYS_PERIPH_CLOCK_I2C1);
|
||||
|
||||
Board_Init();
|
||||
}
|
||||
|
||||
#if defined ( __CC_ARM )
|
||||
/* Global variable initialization does not occur until post scatterload in Keil tools.*/
|
||||
|
||||
/* External function called after our post scatterload function implementation. */
|
||||
extern void $Super$$__main_after_scatterload(void);
|
||||
|
||||
/**
|
||||
* @brief Initialization function for SystemCoreClock and Board_Init.
|
||||
* @details $Sub$$__main_after_scatterload is called during system startup in the Keil
|
||||
* toolset. Global variable and static variable space must be set up by the compiler
|
||||
* prior to using these memory spaces. Setting up the SystemCoreClock and Board_Init
|
||||
* require global memory for variable storage and are called from this function in
|
||||
* the Keil tool chain.
|
||||
*/
|
||||
void $Sub$$__main_after_scatterload(void)
|
||||
{
|
||||
SystemInit();
|
||||
$Super$$__main_after_scatterload();
|
||||
}
|
||||
#endif /* __CC_ARM */
|
||||
@@ -0,0 +1,93 @@
|
||||
/**
|
||||
* @file system_max32660.h
|
||||
* @brief System-specific header file
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
* $Revision: 40072 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _SYSTEM_MAX32660_H_
|
||||
#define _SYSTEM_MAX32660_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Define clocks
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef HFX_FREQ
|
||||
#define HFX_FREQ 32768
|
||||
#endif
|
||||
|
||||
#ifndef NANORING_FREQ
|
||||
#define NANORING_FREQ 8000
|
||||
#endif
|
||||
|
||||
#ifndef HIRC96_FREQ
|
||||
#define HIRC96_FREQ 96000000
|
||||
#endif
|
||||
|
||||
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
|
||||
#ifndef PeripheralClock
|
||||
#define PeripheralClock (SystemCoreClock /2) /*!< Peripheral Clock Frequency */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize the system
|
||||
*
|
||||
* @brief Setup the microcontroller system.
|
||||
* Initialize the System and update the SystemCoreClock variable.
|
||||
*/
|
||||
void SystemInit(void);
|
||||
|
||||
/*
|
||||
* Update SystemCoreClock variable
|
||||
*
|
||||
* @brief Updates the SystemCoreClock with current core Clock
|
||||
* retrieved from cpu registers.
|
||||
*/
|
||||
void SystemCoreClockUpdate(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYSTEM_MAX32660_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,200 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Flash Controler driver.
|
||||
* @details This driver can be used to operate on the embedded flash memory.
|
||||
*/
|
||||
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2019-06-05 16:53:29 -0500 (Wed, 05 Jun 2019) $
|
||||
* $Revision: 43696 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
#ifndef _FLC_H_
|
||||
#define _FLC_H_
|
||||
|
||||
/* **** Includes **** */
|
||||
#include "flc_regs.h"
|
||||
#include "mxc_sys.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup flc Flash Controller
|
||||
* @ingroup periphlibs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/***** Definitions *****/
|
||||
|
||||
/// Bit mask that can be used to find the starting address of a page in flash
|
||||
#define MXC_FLASH_PAGE_MASK ~(MXC_FLASH_PAGE_SIZE - 1)
|
||||
|
||||
/// Calculate the address of a page in flash from the page number
|
||||
#define MXC_FLASH_PAGE_ADDR(page) (MXC_FLASH_MEM_BASE + ((unsigned long)page * MXC_FLASH_PAGE_SIZE))
|
||||
|
||||
/***** Function Prototypes *****/
|
||||
|
||||
/**
|
||||
* @brief Initializes the flash controller for erase/write operations
|
||||
* @param sys_cfg Reserved for future use. Use NULL as this parameter's value.
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int FLC_Init(const sys_cfg_flc_t *sys_cfg);
|
||||
|
||||
/**
|
||||
* @brief Checks if Flash controller is busy.
|
||||
* @details Reading or executing from flash is not possible if flash is busy
|
||||
* with an erase or write operation.
|
||||
* @return If non-zero, flash operation is in progress
|
||||
*/
|
||||
int FLC_Busy(void);
|
||||
|
||||
/**
|
||||
* @brief Erases the entire flash array.
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int FLC_MassErase(void);
|
||||
|
||||
/**
|
||||
* @brief Erases the page of flash at the specified address.
|
||||
* @param address Any address within the page to erase.
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int FLC_PageErase(uint32_t address);
|
||||
|
||||
/**
|
||||
* @brief Page erase from start to end address.
|
||||
* @note All data within the selected pages will be erased.
|
||||
* @param start Any address within the first page to erase.
|
||||
* @param end Any address within the last page to erase.
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int FLC_Erase(uint32_t start, uint32_t end);
|
||||
|
||||
/**
|
||||
* @brief Erase from start to end address. Restoring any flash page contents outside the given range.
|
||||
* @param start Starting address to erase, inclusive.
|
||||
* @param end Ending address to erase, exclusive.
|
||||
* @param buffer Data buffer to restore data in beginning and ending pages.
|
||||
* @param length Length of given buffer.
|
||||
*
|
||||
* @note Buffer should be appropriate size to store all of the data remaining in the
|
||||
* first and last pages. length should be greater than or equal to
|
||||
* (start % MXC_FLASH_PAGE_SIZE) and ((MXC_FLASH_PAGE_SIZE - (end % MXC_FLASH_PAGE_SIZE)) % MXC_FLASH_PAGE_SIZE).
|
||||
*
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int FLC_BufferErase(uint32_t start, uint32_t end, uint8_t *buffer, unsigned length);
|
||||
|
||||
/**
|
||||
* @brief Writes the specified 32-bit value to flash.
|
||||
* @param address 32-bit aligned address in flash to write.
|
||||
* @param data value to be written to flash.
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if
|
||||
* unsuccessful.
|
||||
*/
|
||||
int FLC_Write32(uint32_t address, uint32_t data);
|
||||
|
||||
/**
|
||||
* @brief Writes the specified 128-bits of data to flash.
|
||||
* @param address 128-bit aligned address in flash to write.
|
||||
* @param data pointer to data to be written to flash.
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if
|
||||
* unsuccessful.
|
||||
*/
|
||||
int FLC_Write128(uint32_t address, uint32_t *data);
|
||||
|
||||
/**
|
||||
* @brief Writes data to flash.
|
||||
* @param address Address in flash to start writing from.
|
||||
* @param length Number of bytes to be written.
|
||||
* @param buffer Pointer to data to be written to flash.
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if
|
||||
* unsuccessful.
|
||||
*/
|
||||
int FLC_Write(uint32_t address, uint32_t length, uint8_t *buffer);
|
||||
|
||||
/**
|
||||
* @brief Enable flash interrupts
|
||||
* @param mask Interrupts to enable
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if
|
||||
* unsuccessful.
|
||||
*/
|
||||
int FLC_EnableInt(uint32_t mask);
|
||||
|
||||
/**
|
||||
* @brief Disable flash interrupts
|
||||
* @param mask Interrupts to disable
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if
|
||||
* unsuccessful.
|
||||
*/
|
||||
int FLC_DisableInt(uint32_t mask);
|
||||
|
||||
/**
|
||||
* @brief Retrieve flash interrupt flags
|
||||
* @return Mask of active flags.
|
||||
*/
|
||||
int FLC_GetFlags(void);
|
||||
|
||||
/**
|
||||
* @brief Clear flash interrupt flags
|
||||
* @note Provide the bit position to clear, even if the flag is write-0-to-clear
|
||||
* @param mask Mask of flags to clear
|
||||
* @return #E_NO_ERROR if successful, @ref MXC_Error_Codes "error" if
|
||||
* unsuccessful.
|
||||
*/
|
||||
int FLC_ClearFlags(uint32_t mask);
|
||||
|
||||
/**
|
||||
* @brief Unlock info block
|
||||
*
|
||||
* @return #E_NO_ERROR If function is successful.
|
||||
*/
|
||||
int FLC_UnlockInfoBlock(void);
|
||||
|
||||
/**
|
||||
* @brief Lock info block
|
||||
*
|
||||
* @return #E_NO_ERROR If function is successful.
|
||||
*/
|
||||
int FLC_LockInfoBlock(void);
|
||||
/**@} end of group flc */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FLC_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,179 @@
|
||||
/**
|
||||
* @file i2s.h
|
||||
* @brief I2S (Inter-Integrated Sound) driver function prototypes and data types.
|
||||
*/
|
||||
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
* $Revision: 40072 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
#ifndef _I2S_H_
|
||||
#define _I2S_H_
|
||||
|
||||
/* **** Includes **** */
|
||||
#include "mxc_config.h"
|
||||
#include "dma.h"
|
||||
#include "spimss_regs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup i2s Inter-Integrated Sound (I2S)
|
||||
* @ingroup spi
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* **** Definitions **** */
|
||||
|
||||
/** @brief I2S audio directions */
|
||||
typedef enum {
|
||||
AUDIO_OUT = 1,
|
||||
AUDIO_IN = 2,
|
||||
} i2s_direction_t;
|
||||
|
||||
/** @brief I2S Configuration Struct */
|
||||
typedef struct {
|
||||
uint8_t left_justify;
|
||||
uint8_t mono_audio;
|
||||
i2s_direction_t audio_direction;
|
||||
unsigned int sample_rate;
|
||||
unsigned int start_immediately;
|
||||
void *dma_src_addr;
|
||||
void *dma_dst_addr;
|
||||
unsigned int dma_cnt;
|
||||
unsigned int dma_reload_en;
|
||||
} i2s_cfg_t;
|
||||
|
||||
/* **** Function Prototypes **** */
|
||||
|
||||
/**
|
||||
* @brief Initialize I2S resources
|
||||
* @param cfg I2S Configuration Struct
|
||||
* @param dma_ctz_cb Optional function to be called when the DMA completes
|
||||
a transfer. Set to NULL if unused.
|
||||
* @param sys_cfg_i2s System configuration object
|
||||
* @details This initialization is required before using the I2S driver functions.
|
||||
* @return \c #E_NO_ERROR if successful
|
||||
*/
|
||||
int I2S_Init(const i2s_cfg_t *cfg, void (*dma_ctz_cb)(int, int), const sys_cfg_i2s_t* sys_cfg_i2s);
|
||||
|
||||
/**
|
||||
* @brief Release I2S
|
||||
* @details De-configures the I2S protocol and stops DMA request
|
||||
* @return \c #E_BAD_PARAM if DMA cannot be stopped, #E_NO_ERROR otherwise
|
||||
*/
|
||||
int I2S_Shutdown(void);
|
||||
|
||||
/**
|
||||
* @brief Mute I2S Output
|
||||
* @details Sets I2S data to zero, continues sending clock and accessing DMA
|
||||
* @return \c #E_NO_ERROR
|
||||
*/
|
||||
int I2S_Mute(void);
|
||||
|
||||
/**
|
||||
* @brief Unmute I2S Output
|
||||
* @details Restores I2S data
|
||||
* @return \c #E_NO_ERROR
|
||||
*/
|
||||
int I2S_Unmute(void);
|
||||
|
||||
/**
|
||||
* @brief Pause I2S Output
|
||||
* @details Similar to mute, but stops FIFO and DMA access, clocks continue
|
||||
* @return \c #E_NO_ERROR
|
||||
*/
|
||||
int I2S_Pause(void);
|
||||
|
||||
/**
|
||||
* @brief Unpause I2S Output
|
||||
* @details Similar to mute, but restarts FIFO and DMA access
|
||||
* @return \c #E_NO_ERROR
|
||||
*/
|
||||
int I2S_Unpause(void);
|
||||
|
||||
/**
|
||||
* @brief Stops I2S Output
|
||||
* @details Similar to pause, but also halts clock
|
||||
* @return \c #E_NO_ERROR
|
||||
*/
|
||||
int I2S_Stop(void);
|
||||
|
||||
/**
|
||||
* @brief Starts I2S Output
|
||||
* @details Starts I2S Output, automatically called by configure if requested
|
||||
* @return \c #E_NO_ERROR
|
||||
*/
|
||||
int I2S_Start(void);
|
||||
|
||||
/**
|
||||
* @brief Clears DMA Interrupt Flags
|
||||
* @details Clears the DMA Interrupt flags, should be called at the end of a dma_ctz_cb
|
||||
* @return \c #E_NO_ERROR
|
||||
*/
|
||||
int I2S_DMA_ClearFlags(void);
|
||||
|
||||
/**
|
||||
* @brief Set DMA Addr (Source or Dest) and bytes to transfer
|
||||
* @param src_addr The address to read data from (Audio Out)
|
||||
* @param dst_addr The address to write data to (Audio In)
|
||||
* @param count The length of the transfer in bytes
|
||||
* @details Sets the address to read/write data in memory and the length of
|
||||
* the transfer. The unused addr parameter is ignored.
|
||||
* @return \c #E_NO_ERROR
|
||||
*/
|
||||
int I2S_DMA_SetAddrCnt(void *src_addr, void *dst_addr, unsigned int count);
|
||||
|
||||
/**
|
||||
* @brief Sets the DMA reload address and count
|
||||
* @param src_addr The address to read data from (Audio Out)
|
||||
* @param dst_addr The address to write data to (Audio In)
|
||||
* @param count The length of the transfer in bytes
|
||||
* @details If DMA reload is enabled, when the DMA has transfered $count bytes
|
||||
* (a CTZ event occurs) the src, dst, and count registers will be
|
||||
* set to these. The DMA reload flag clears after a reload occurs.
|
||||
* @return \c #E_NO_ERROR
|
||||
*/
|
||||
int I2S_DMA_SetReload(void *src_addr, void *dst_addr, unsigned int count);
|
||||
/**@} end of group i2s */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _I2S_H_ */
|
||||
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* @file icc.h
|
||||
* @brief Instruction Controller Cache(ICC) function prototypes and data types.
|
||||
*/
|
||||
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
* $Revision: 40072 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _ICC_H_
|
||||
#define _ICC_H_
|
||||
|
||||
/* **** Includes **** */
|
||||
#include <stdint.h>
|
||||
#include "icc_regs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup icc Internal Cache Controller (ICC)
|
||||
* @ingroup periphlibs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Enumeration type for the Cache ID Register
|
||||
*/
|
||||
typedef enum {
|
||||
ICC_CACHE_ID_RELNUM, // Identifies the RTL release version
|
||||
ICC_CACHE_ID_PARTNUM, // Specifies the value of C_ID Port Number
|
||||
ICC_CACHE_ID_CCHID // Specifies the value of Cache ID
|
||||
} icc_cache_id_t;
|
||||
|
||||
/**
|
||||
* @brief Reads the data from the Cache Id Register.
|
||||
* @param cid Enumeration type for Cache Id Register.
|
||||
* @retval Returns the contents of Cache Id Register.
|
||||
*/
|
||||
int ICC_ID(icc_cache_id_t cid);
|
||||
|
||||
/**
|
||||
* @brief Enable the instruction cache controller.
|
||||
*/
|
||||
void ICC_Enable(void);
|
||||
|
||||
/**
|
||||
* @brief Disable the instruction cache controller.
|
||||
*/
|
||||
void ICC_Disable(void);
|
||||
|
||||
/**
|
||||
* @brief Flush the instruction cache controller.
|
||||
*/
|
||||
void ICC_Flush(void);
|
||||
|
||||
/**@} end of group icc */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ICC_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,113 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Assertion checks for debugging.
|
||||
*/
|
||||
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
*
|
||||
* $Date: 2018-08-09 18:45:02 -0500 (Thu, 09 Aug 2018) $
|
||||
* $Revision: 36818 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _MXC_ASSERT_H_
|
||||
#define _MXC_ASSERT_H_
|
||||
|
||||
/* **** Includes **** */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup syscfg
|
||||
* @defgroup mxc_assertions Assertion Checks for Debugging
|
||||
* @brief Assertion checks for debugging.
|
||||
* @{
|
||||
*/
|
||||
/* **** Definitions **** */
|
||||
/**
|
||||
* @note To use debug assertions, the symbol @c MXC_ASSERT_ENABLE must be
|
||||
* defined.
|
||||
*/
|
||||
///@cond
|
||||
#ifdef MXC_ASSERT_ENABLE
|
||||
/**
|
||||
* Macro that checks the expression for true and generates an assertion.
|
||||
* @note To use debug assertions, the symbol @c MXC_ASSERT_ENABLE must be
|
||||
* defined.
|
||||
*/
|
||||
#define MXC_ASSERT(expr) \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
mxc_assert(#expr, __FILE__, __LINE__); \
|
||||
}
|
||||
/**
|
||||
* Macro that generates an assertion with the message "FAIL".
|
||||
* @note To use debug assertions, the symbol @c MXC_ASSERT_ENABLE must be
|
||||
* defined.
|
||||
*/
|
||||
#define MXC_ASSERT_FAIL() mxc_assert("FAIL", __FILE__, __LINE__);
|
||||
#else
|
||||
#define MXC_ASSERT(expr)
|
||||
#define MXC_ASSERT_FAIL()
|
||||
#endif
|
||||
///@endcond
|
||||
/* **** Globals **** */
|
||||
|
||||
/* **** Function Prototypes **** */
|
||||
|
||||
/**
|
||||
* @brief Assert an error when the given expression fails during debugging.
|
||||
* @param expr String with the expression that failed the assertion.
|
||||
* @param file File containing the failed assertion.
|
||||
* @param line Line number for the failed assertion.
|
||||
* @note This is defined as a weak function and can be overridden at the
|
||||
* application layer to print the debugging information.
|
||||
* @code
|
||||
* printf("%s, file: %s, line %d\n", expr, file, line);
|
||||
* @endcode
|
||||
* @note To use debug assertions, the symbol @c MXC_ASSERT_ENABLE must be
|
||||
* defined.
|
||||
*/
|
||||
void mxc_assert(const char *expr, const char *file, int line);
|
||||
|
||||
/**@} end of group MXC_Assertions*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MXC_ASSERT_H_ */
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* @file mxc_config.h
|
||||
* @brief Top-level include file for device configuration.
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-08-09 18:45:02 -0500 (Thu, 09 Aug 2018) $
|
||||
* $Revision: 36818 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _MXC_CONFIG_H
|
||||
#define _MXC_CONFIG_H
|
||||
|
||||
#if !defined __GNUC__
|
||||
#include "RTE_Components.h"
|
||||
#endif /* not __GNUC__ */
|
||||
|
||||
#include "mxc_device.h"
|
||||
#include "mxc_errors.h"
|
||||
#include "mxc_pins.h"
|
||||
|
||||
#endif /* _CONFIG_H */
|
||||
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Asynchronous delay routines based on the SysTick Timer.
|
||||
*/
|
||||
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-11-05 09:52:05 -0600 (Mon, 05 Nov 2018) $
|
||||
* $Revision: 38934 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _DELAY_H_
|
||||
#define _DELAY_H_
|
||||
|
||||
/**
|
||||
* @defgroup MXC_delay Delay Utility Functions
|
||||
* @ingroup devicelibs
|
||||
* @brief Asynchronous delay routines based on the SysTick Timer
|
||||
* @{
|
||||
*/
|
||||
|
||||
/***** Definitions *****/
|
||||
/**
|
||||
* Macro used to specify a microsecond timing parameter in seconds.
|
||||
* \code
|
||||
* x = SEC(3) // 3 seconds -> x = 3,000,000
|
||||
* \endcode
|
||||
*/
|
||||
#define MXC_DELAY_SEC(s) (((unsigned long)s) * 1000000UL)
|
||||
/**
|
||||
* Macro used to specify a microsecond timing parameter in milliseconds.
|
||||
* \code
|
||||
* x = MSEC(3) // 3ms -> x = 3,000
|
||||
* \endcode
|
||||
*/
|
||||
#define MXC_DELAY_MSEC(ms) (ms * 1000UL)
|
||||
/**
|
||||
* Macro used to specify a microsecond timing parameter.
|
||||
* \code
|
||||
* x = USEC(3) // 3us -> x = 3
|
||||
* \endcode
|
||||
*/
|
||||
#define MXC_DELAY_USEC(us) (us)
|
||||
|
||||
/***** Function Prototypes *****/
|
||||
|
||||
/**
|
||||
* @brief Blocks and delays for the specified number of microseconds.
|
||||
* @details Uses the SysTick to create the requested delay. If the SysTick is
|
||||
* running, the current settings will be used. If the SysTick is not
|
||||
* running, it will be started.
|
||||
* @param us microseconds to delay
|
||||
* @return #E_NO_ERROR if no errors, @ref MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int mxc_delay(unsigned long us);
|
||||
|
||||
/**
|
||||
* @brief Starts a non-blocking delay for the specified number of
|
||||
* microseconds.
|
||||
* @details Uses the SysTick to time the requested delay. If the SysTick is
|
||||
* running, the current settings will be used. If the SysTick is not
|
||||
* running, it will be started.
|
||||
* @note mxc_delay_handler() must be called from the SysTick interrupt service
|
||||
* routine or at a rate greater than the SysTick overflow rate.
|
||||
* @param us microseconds to delay
|
||||
* @return #E_NO_ERROR if no errors, #E_BUSY if currently servicing another
|
||||
* delay request.
|
||||
*/
|
||||
int mxc_delay_start(unsigned long us);
|
||||
|
||||
/**
|
||||
* @brief Returns the status of a non-blocking delay request
|
||||
* @pre Start the asynchronous delay by calling mxc_delay_start().
|
||||
* @return #E_BUSY until the requested delay time has expired.
|
||||
*/
|
||||
int mxc_delay_check(void);
|
||||
|
||||
/**
|
||||
* @brief Stops an asynchronous delay previously started.
|
||||
* @pre Start the asynchronous delay by calling mxc_delay_start().
|
||||
*/
|
||||
void mxc_delay_stop(void);
|
||||
|
||||
/**
|
||||
* @brief Processes the delay interrupt.
|
||||
* @details This function must be called from the SysTick IRQ or polled at a
|
||||
* rate greater than the SysTick overflow rate.
|
||||
*/
|
||||
void mxc_delay_handler(void);
|
||||
|
||||
/**@} end of group MXC_delay */
|
||||
|
||||
#endif /* _DELAY_H_ */
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief List of common error return codes for Maxim Integrated libraries.
|
||||
*/
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-08-09 18:45:02 -0500 (Thu, 09 Aug 2018) $
|
||||
* $Revision: 36818 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _MXC_ERRORS_H_
|
||||
#define _MXC_ERRORS_H_
|
||||
|
||||
/**
|
||||
* @ingroup syscfg
|
||||
* @defgroup MXC_Error_Codes Error Codes
|
||||
* @brief A list of common error codes used by the API.
|
||||
* @note A Negative Error Convention is used to avoid conflict with
|
||||
* positive, Non-Error, returns.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** No Error */
|
||||
#define E_NO_ERROR 0
|
||||
/** No Error, success */
|
||||
#define E_SUCCESS 0
|
||||
/** Pointer is NULL */
|
||||
#define E_NULL_PTR -1
|
||||
/** No such device */
|
||||
#define E_NO_DEVICE -2
|
||||
/** Parameter not acceptable */
|
||||
#define E_BAD_PARAM -3
|
||||
/** Value not valid or allowed */
|
||||
#define E_INVALID -4
|
||||
/** Module not initialized */
|
||||
#define E_UNINITIALIZED -5
|
||||
/** Busy now, try again later */
|
||||
#define E_BUSY -6
|
||||
/** Operation not allowed in current state */
|
||||
#define E_BAD_STATE -7
|
||||
/** Generic error */
|
||||
#define E_UNKNOWN -8
|
||||
/** General communications error */
|
||||
#define E_COMM_ERR -9
|
||||
/** Operation timed out */
|
||||
#define E_TIME_OUT -10
|
||||
/** Expected response did not occur */
|
||||
#define E_NO_RESPONSE -11
|
||||
/** Operations resulted in unexpected overflow */
|
||||
#define E_OVERFLOW -12
|
||||
/** Operations resulted in unexpected underflow */
|
||||
#define E_UNDERFLOW -13
|
||||
/** Data or resource not available at this time */
|
||||
#define E_NONE_AVAIL -14
|
||||
/** Event was shutdown */
|
||||
#define E_SHUTDOWN -15
|
||||
/** Event was aborted */
|
||||
#define E_ABORT -16
|
||||
/** The requested operation is not supported */
|
||||
#define E_NOT_SUPPORTED -17
|
||||
/**@} end of MXC_Error_Codes group */
|
||||
|
||||
#endif /* _MXC_ERRORS_H_ */
|
||||
@@ -0,0 +1,94 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Exclusive access lock utility functions.
|
||||
*/
|
||||
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-08-09 18:45:02 -0500 (Thu, 09 Aug 2018) $
|
||||
* $Revision: 36818 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _MXC_LOCK_H_
|
||||
#define _MXC_LOCK_H_
|
||||
|
||||
/* **** Includes **** */
|
||||
#include "mxc_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup syscfg
|
||||
* @defgroup mxc_lock_utilities Exclusive Access Locks
|
||||
* @brief Lock functions to obtain and release a variable for exclusive
|
||||
* access. These functions are marked interrupt safe if they are
|
||||
* interrupt safe.
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* **** Definitions **** */
|
||||
|
||||
/* **** Globals **** */
|
||||
|
||||
/* **** Function Prototypes **** */
|
||||
|
||||
/**
|
||||
* @brief Attempts to acquire the lock.
|
||||
* @details This in an interrupt safe function that can be used as a mutex.
|
||||
* The lock variable must remain in scope until the lock is
|
||||
* released. Will not block if another thread has already acquired
|
||||
* the lock.
|
||||
* @param lock Pointer to variable that is used for the lock.
|
||||
* @param value Value to be place in the lock. Can not be 0.
|
||||
*
|
||||
* @return #E_NO_ERROR if everything successful, #E_BUSY if lock is taken.
|
||||
*/
|
||||
int mxc_get_lock(uint32_t *lock, uint32_t value);
|
||||
|
||||
/**
|
||||
* @brief Free the given lock.
|
||||
* @param[in,out] lock Pointer to the variable used for the lock. When the lock
|
||||
* is free, the value pointed to by @p lock is set to zero.
|
||||
*/
|
||||
void mxc_free_lock(uint32_t *lock);
|
||||
|
||||
/**@} end of group mxc_lock_utilities */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MXC_LOCK_H_ */
|
||||
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* @file mxc_pins.h
|
||||
* @brief This file contains constant pin configurations for the peripherals.
|
||||
*/
|
||||
|
||||
/* *****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-08-09 18:45:02 -0500 (Thu, 09 Aug 2018) $
|
||||
* $Revision: 36818 $
|
||||
*
|
||||
**************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _MXC_PINS_H_
|
||||
#define _MXC_PINS_H_
|
||||
|
||||
/* **** Includes **** */
|
||||
#include "gpio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* **** Global Variables **** */
|
||||
|
||||
// Predefined GPIO Configurations
|
||||
|
||||
/***** @brief TIMER pins *****/
|
||||
extern const gpio_cfg_t gpio_cfg_tmr0;
|
||||
|
||||
/***** @brief UART pins *****/
|
||||
extern const gpio_cfg_t gpio_cfg_uart0rtscts;
|
||||
extern const gpio_cfg_t gpio_cfg_uart0a;
|
||||
extern const gpio_cfg_t gpio_cfg_uart1rtscts;
|
||||
extern const gpio_cfg_t gpio_cfg_uart1a;
|
||||
extern const gpio_cfg_t gpio_cfg_uart1b;
|
||||
extern const gpio_cfg_t gpio_cfg_uart1c;
|
||||
extern const gpio_cfg_t gpio_cfg_uart2;
|
||||
|
||||
/***** @brief I2C pins *****/
|
||||
extern const gpio_cfg_t gpio_cfg_i2c0;
|
||||
extern const gpio_cfg_t gpio_cfg_i2c1;
|
||||
|
||||
/***** @brief SPI/I2S pins *****/
|
||||
extern const gpio_cfg_t gpio_cfg_spi17y; // SPI0A
|
||||
extern const gpio_cfg_t gpio_cfg_spimss1a; // SPI1A
|
||||
extern const gpio_cfg_t gpio_cfg_spimss1b; // SPI1B
|
||||
extern const gpio_cfg_t gpio_cfg_i2s1a; // same port as SPI1A
|
||||
extern const gpio_cfg_t gpio_cfg_i2s1b; // same port as SPI1B
|
||||
|
||||
/***** @brief SWD pins *****/
|
||||
extern const gpio_cfg_t gpio_cfg_swd;
|
||||
|
||||
/***** @brief RTC pins *****/
|
||||
extern const gpio_cfg_t gpio_cfg_rtc;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MXC_PINS_H_ */
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @file nvic_table.h
|
||||
* @brief Interrupt vector table manipulation functions.
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2020-04-20 15:48:35 -0500 (Mon, 20 Apr 2020) $
|
||||
* $Revision: 53144 $
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _NVIC_TABLE_H
|
||||
#define _NVIC_TABLE_H
|
||||
|
||||
#include "mxc_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup syscfg
|
||||
* @defgroup nvic NVIC Table
|
||||
* @brief functions handling the nvic table.
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Set an IRQ hander callback function. If the IRQ table is in
|
||||
* flash, this will copy it to RAM and set NVIC to RAM based table.
|
||||
*
|
||||
* @param irqn ARM external IRQ number
|
||||
* @param irq_callback Function to be called at IRQ context
|
||||
*
|
||||
*/
|
||||
void NVIC_SetVector(IRQn_Type irqn, void (*irq_callback)(void));
|
||||
|
||||
/**
|
||||
* @brief Copy NVIC vector table to RAM and set NVIC to RAM based table.
|
||||
*
|
||||
*/
|
||||
void NVIC_SetRAM(void);
|
||||
|
||||
/**
|
||||
* @brief Get Interrupt Vector
|
||||
* @details Reads an interrupt vector from interrupt vector table. The
|
||||
* interrupt number can be positive to specify a device specific
|
||||
* interrupt, or negative to specify a processor exception.
|
||||
* @param[in] IRQn Interrupt number.
|
||||
* @return Address of interrupt handler function
|
||||
*/
|
||||
uint32_t NVIC_GetVector(IRQn_Type IRQn);
|
||||
|
||||
/**@} end of group nvic */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _NVIC_TABLE_H */
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,197 @@
|
||||
/**
|
||||
* @file spimss.h
|
||||
* @brief Serial Peripheral Interface (SPIMSS) function prototypes and data types.
|
||||
*/
|
||||
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
* $Revision: 40072 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _SPIMSS_H_
|
||||
#define _SPIMSS_H_
|
||||
|
||||
/* **** Includes **** */
|
||||
#include "mxc_config.h"
|
||||
#include "mxc_sys.h"
|
||||
#include "spimss_regs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup spimss SPIMSS
|
||||
* @ingroup spi
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* **** Definitions **** */
|
||||
|
||||
|
||||
/**
|
||||
* @brief Enumeration type for setting the number data lines to use for communication.
|
||||
*/
|
||||
typedef enum { // ONLY FOR COMPATIBILITY FOR CONSOLIDATION WITH SPY17, NOT USED OR NEEDED
|
||||
DUMMY_1, /**< NOT USED */
|
||||
DUMMY_2, /**< NOT USED */
|
||||
DUMMY_3, /**< NOT USED */
|
||||
} spimss_width_t;
|
||||
|
||||
/**
|
||||
* @brief Structure type representing a SPI Master Transaction request.
|
||||
*/
|
||||
typedef struct spimss_req spimss_req_t;
|
||||
|
||||
/**
|
||||
* @brief Callback function type used in asynchronous SPI Master communication requests.
|
||||
* @details The function declaration for the SPI Master callback is:
|
||||
* @code
|
||||
* void callback(spi_req_t * req, int error_code);
|
||||
* @endcode
|
||||
* | | |
|
||||
* | -----: | :----------------------------------------- |
|
||||
* | \p req | Pointer to a #spi_req object representing the active SPI Master active transaction. |
|
||||
* | \p error_code | An error code if the active transaction had a failure or #E_NO_ERROR if successful. |
|
||||
* @note Callback will execute in interrupt context
|
||||
* @addtogroup spi_async
|
||||
*/
|
||||
typedef void (*spimss_callback_fn)(spimss_req_t * req, int error_code);
|
||||
|
||||
/**
|
||||
* @brief Structure definition for an SPI Master Transaction request.
|
||||
* @note When using this structure for an asynchronous operation, the
|
||||
* structure must remain allocated until the callback is completed.
|
||||
* @addtogroup spi_async
|
||||
*/
|
||||
struct spimss_req {
|
||||
uint8_t ssel; /**< Not Used*/
|
||||
uint8_t deass; /**< Not Used*/
|
||||
const void *tx_data; /**< Pointer to a buffer to transmit data from. NULL if undesired. */
|
||||
void *rx_data; /**< Pointer to a buffer to store data received. NULL if undesired.*/
|
||||
spimss_width_t width; /**< Not Used */
|
||||
unsigned len; /**< Number of transfer units to send from the \p tx_data buffer. */
|
||||
unsigned bits; /**< Number of bits in transfer unit (e.g. 8 for byte, 16 for short) */
|
||||
unsigned rx_num; /**< Number of bytes actually read into the \p rx_data buffer. */
|
||||
unsigned tx_num; /**< Number of bytes actually sent from the \p tx_data buffer */
|
||||
spimss_callback_fn callback; /**< Callback function if desired, NULL otherwise */
|
||||
};
|
||||
|
||||
/* **** Function Prototypes **** */
|
||||
|
||||
/**
|
||||
* @brief Initialize the spi.
|
||||
* @param spi Pointer to spi module to initialize.
|
||||
* @param mode SPI mode for clock phase and polarity.
|
||||
* @param freq Desired clock frequency.
|
||||
* @param sys_cfg System configuration object
|
||||
*
|
||||
* @return \c #E_NO_ERROR if successful, appropriate error otherwise
|
||||
*/
|
||||
int SPIMSS_Init(mxc_spimss_regs_t *spi, unsigned mode, unsigned freq, const sys_cfg_spimss_t* sys_cfg);
|
||||
|
||||
/**
|
||||
* @brief Shutdown SPI module.
|
||||
* @param spi Pointer to SPI regs.
|
||||
*
|
||||
* @return \c #E_NO_ERROR if successful, appropriate error otherwise
|
||||
*/
|
||||
int SPIMSS_Shutdown(mxc_spimss_regs_t *spi);
|
||||
|
||||
/**
|
||||
* @brief Execute a master transaction.
|
||||
* @param spi Pointer to spi module.
|
||||
* @param req Pointer to spi request
|
||||
*
|
||||
* @return \c #E_NO_ERROR if successful, @ref
|
||||
* MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int SPIMSS_MasterTrans(mxc_spimss_regs_t *spi, spimss_req_t *req);
|
||||
|
||||
/**
|
||||
* @brief Execute SPI transaction based on interrupt handler
|
||||
* @param spi The spi
|
||||
*
|
||||
*/
|
||||
void SPIMSS_Handler(mxc_spimss_regs_t *spi);
|
||||
|
||||
/**
|
||||
* @brief Execute a slave transaction.
|
||||
* @param spi Pointer to spi module.
|
||||
* @param req Pointer to spi request
|
||||
*
|
||||
* @return \c #E_NO_ERROR if successful, @ref
|
||||
* MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int SPIMSS_SlaveTrans(mxc_spimss_regs_t *spi, spimss_req_t *req);
|
||||
|
||||
/**
|
||||
* @brief Asynchronously read/write SPI Master data
|
||||
*
|
||||
* @param spi Pointer to spi module
|
||||
* @param req Pointer to spi request
|
||||
*
|
||||
* @return \c #E_NO_ERROR if successful, @ref
|
||||
* MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int SPIMSS_MasterTransAsync(mxc_spimss_regs_t *spi, spimss_req_t *req);
|
||||
|
||||
/**
|
||||
* @brief Asynchronously read/write SPI Slave data
|
||||
*
|
||||
* @param spi Pointer to spi module
|
||||
* @param req Pointer to spi request
|
||||
*
|
||||
* @return \c #E_NO_ERROR if successful, @ref
|
||||
* MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int SPIMSS_SlaveTransAsync(mxc_spimss_regs_t *spi, spimss_req_t *req);
|
||||
|
||||
/**
|
||||
* @brief Aborts an Asynchronous request
|
||||
*
|
||||
* @param req Pointer to spi request
|
||||
* @return \c #E_NO_ERROR if successful, @ref
|
||||
* MXC_Error_Codes "error" if unsuccessful.
|
||||
*/
|
||||
int SPIMSS_AbortAsync(spimss_req_t *req);
|
||||
|
||||
/**@} end of group spimss */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SPIMSS_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* @file tmr_utils.h
|
||||
* @brief Timer utility function declarations
|
||||
*/
|
||||
/* *****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-10-17 14:16:30 -0500 (Wed, 17 Oct 2018) $
|
||||
* $Revision: 38560 $
|
||||
*
|
||||
**************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _TMR_UTILS_H
|
||||
#define _TMR_UTILS_H
|
||||
|
||||
/***** Includes *****/
|
||||
#include "mxc_config.h"
|
||||
#include "tmr_regs.h"
|
||||
#include "mxc_sys.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup tmr
|
||||
* @defgroup tmr_utils Timer Utility Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* **** Definitions **** */
|
||||
|
||||
/** @def Macro to convert the parameter \p s from seconds to micro-seconds. */
|
||||
#define SEC(s) (((unsigned long)s) * 1000000UL)
|
||||
|
||||
/** @def Macro to convert the parameter \p ms from milli-seconds to micro-seconds. */
|
||||
#define MSEC(ms) (ms * 1000UL)
|
||||
|
||||
/** @def Macro to convert the parameter \p us to micro-seconds. */
|
||||
#define USEC(us) (us)
|
||||
|
||||
/* **** Globals **** */
|
||||
|
||||
/* **** Function Prototypes **** */
|
||||
|
||||
/**
|
||||
* @brief Delays for the specified number of microseconds.
|
||||
* @param tmr Which Timer instance to use
|
||||
* @param us Number of microseconds to delay.
|
||||
* @param sys_cfg System configuration object, identical to TMR_Init()
|
||||
*/
|
||||
void TMR_Delay(mxc_tmr_regs_t *tmr, unsigned long us, const sys_cfg_tmr_t *sys_cfg);
|
||||
|
||||
/**
|
||||
* @brief Start the timeout time for the specified number of microseconds.
|
||||
* @param tmr Which Timer instance to use
|
||||
* @param us Number of microseconds in the timeout.
|
||||
* @param sys_cfg System configuration object, identical to TMR_Init()
|
||||
*/
|
||||
void TMR_TO_Start(mxc_tmr_regs_t *tmr, unsigned long us, const sys_cfg_tmr_t *sys_cfg);
|
||||
|
||||
/**
|
||||
* @brief Check if the timeout has occurred.
|
||||
* @param tmr Which Timer instance to use
|
||||
* @return #E_NO_ERROR if the timeout has not occurred, #E_TIME_OUT if it has.
|
||||
*/
|
||||
int TMR_TO_Check(mxc_tmr_regs_t *tmr);
|
||||
|
||||
/**
|
||||
* @brief Stops the timer for the timeout.
|
||||
* @param tmr Which Timer instance to use
|
||||
*/
|
||||
void TMR_TO_Stop(mxc_tmr_regs_t *tmr);
|
||||
|
||||
/**
|
||||
* @brief Clears the timeout flag.
|
||||
* @param tmr Which Timer instance to use
|
||||
*/
|
||||
void TMR_TO_Clear(mxc_tmr_regs_t *tmr);
|
||||
|
||||
/**
|
||||
* @brief Get the number of microseconds elapsed since TMR_TO_Start().
|
||||
* @param tmr Which Timer instance to use
|
||||
* @return Number of microseconds since TMR_TO_Start().
|
||||
*/
|
||||
unsigned int TMR_TO_Elapsed(mxc_tmr_regs_t *tmr);
|
||||
|
||||
/**
|
||||
* @brief Get the number of microseconds remaining in the timeout.
|
||||
* @param tmr Which Timer instance to use
|
||||
* @return Number of microseconds until timeout.
|
||||
*/
|
||||
unsigned int TMR_TO_Remaining(mxc_tmr_regs_t *tmr);
|
||||
|
||||
/**
|
||||
* @brief Start the stopwatch.
|
||||
* @note This function does not handle overflows
|
||||
* @param tmr Which Timer to use
|
||||
* @param sys_cfg System configuration object, identical to TMR_Init()
|
||||
*/
|
||||
void TMR_SW_Start(mxc_tmr_regs_t *tmr, const sys_cfg_tmr_t *sys_cfg);
|
||||
|
||||
/**
|
||||
* @brief Stop the stopwatch and return the number of microseconds that
|
||||
* have elapsed.
|
||||
* @note This function does not handle overflows
|
||||
* @param tmr Which Timer instance to use
|
||||
* @return Number of microseconds since TMR_SW_Start().
|
||||
*/
|
||||
unsigned int TMR_SW_Stop(mxc_tmr_regs_t *tmr);
|
||||
|
||||
/**@} end of defgroup tmr_utils*/
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TMR_UTILS_H */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,166 @@
|
||||
/**
|
||||
* @file wdt.h
|
||||
* @brief Watchdog timer (WDT) function prototypes and data types.
|
||||
*/
|
||||
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2020-04-20 15:06:58 -0500 (Mon, 20 Apr 2020) $
|
||||
* $Revision: 53142 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _WDT_H_
|
||||
#define _WDT_H_
|
||||
|
||||
/* **** Includes **** */
|
||||
#include <stdint.h>
|
||||
#include "mxc_config.h"
|
||||
#include "mxc_sys.h"
|
||||
#include "wdt_regs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup wdt Watchdog Timer (WDT)
|
||||
* @ingroup periphlibs
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* **** Definitions **** */
|
||||
|
||||
/** @brief Watchdog period enumeration.
|
||||
Used to configure the period of the watchdog interrupt */
|
||||
typedef enum {
|
||||
WDT_PERIOD_2_31 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW31, /**< Period 2^31 */
|
||||
WDT_PERIOD_2_30 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW30, /**< Period 2^30 */
|
||||
WDT_PERIOD_2_29 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW29, /**< Period 2^29 */
|
||||
WDT_PERIOD_2_28 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW28, /**< Period 2^28 */
|
||||
WDT_PERIOD_2_27 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW27, /**< Period 2^27 */
|
||||
WDT_PERIOD_2_26 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW26, /**< Period 2^26 */
|
||||
WDT_PERIOD_2_25 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW25, /**< Period 2^25 */
|
||||
WDT_PERIOD_2_24 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW24, /**< Period 2^24 */
|
||||
WDT_PERIOD_2_23 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW23, /**< Period 2^23 */
|
||||
WDT_PERIOD_2_22 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW22, /**< Period 2^22 */
|
||||
WDT_PERIOD_2_21 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW21, /**< Period 2^21 */
|
||||
WDT_PERIOD_2_20 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW20, /**< Period 2^20 */
|
||||
WDT_PERIOD_2_19 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW19, /**< Period 2^19 */
|
||||
WDT_PERIOD_2_18 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW18, /**< Period 2^18 */
|
||||
WDT_PERIOD_2_17 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW17, /**< Period 2^17 */
|
||||
WDT_PERIOD_2_16 = MXC_S_WDT_CTRL_INT_PERIOD_WDT2POW16, /**< Period 2^16 */
|
||||
} wdt_period_t;
|
||||
|
||||
/* **** Function Prototypes **** */
|
||||
|
||||
/**
|
||||
* @brief Initialize the Watchdog Timer
|
||||
* @param wdt Pointer to the watchdog registers
|
||||
* @param sys_cfg The system configuration object
|
||||
*/
|
||||
int WDT_Init(mxc_wdt_regs_t* wdt, sys_cfg_wdt_t sys_cfg);
|
||||
/**
|
||||
* @brief Set the period of the watchdog interrupt.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
* @param period Enumeration of the desired watchdog period.
|
||||
*/
|
||||
void WDT_SetIntPeriod(mxc_wdt_regs_t* wdt, wdt_period_t period);
|
||||
|
||||
/**
|
||||
* @brief Set the period of the watchdog reset.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
* @param period Enumeration of the desired watchdog period.
|
||||
*/
|
||||
void WDT_SetResetPeriod(mxc_wdt_regs_t* wdt, wdt_period_t period);
|
||||
|
||||
/**
|
||||
* @brief Enable the watchdog timer.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
* @param enable 1 to enable the timer, 0 to disable.
|
||||
*/
|
||||
void WDT_Enable(mxc_wdt_regs_t* wdt, int enable);
|
||||
|
||||
/**
|
||||
* @brief Enable the watchdog interrupt.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
* @param enable 1 to enable the interrupt, 0 to disable.
|
||||
*/
|
||||
void WDT_EnableInt(mxc_wdt_regs_t* wdt, int enable);
|
||||
|
||||
/**
|
||||
* @brief Enable the watchdog reset.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
* @param enable 1 to enable the reset, 0 to disable.
|
||||
*/
|
||||
void WDT_EnableReset(mxc_wdt_regs_t* wdt, int enable);
|
||||
|
||||
/**
|
||||
* @brief Reset the watchdog timer.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
*/
|
||||
void WDT_ResetTimer(mxc_wdt_regs_t* wdt);
|
||||
|
||||
/**
|
||||
* @brief Get the status of the reset flag.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
* @returns 1 if the previous reset was caused by the watchdog, 0 otherwise.
|
||||
*/
|
||||
int WDT_GetResetFlag(mxc_wdt_regs_t* wdt);
|
||||
|
||||
/**
|
||||
* @brief Clears the reset flag.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
*/
|
||||
void WDT_ClearResetFlag(mxc_wdt_regs_t* wdt);
|
||||
|
||||
/**
|
||||
* @brief Get the status of the interrupt flag.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
* @returns 1 if the interrupt is pending, 0 otherwise.
|
||||
*/
|
||||
int WDT_GetIntFlag(mxc_wdt_regs_t* wdt);
|
||||
|
||||
/**
|
||||
* @brief Clears the interrupt flag.
|
||||
* @param wdt Pointer to watchdog registers.
|
||||
*/
|
||||
void WDT_ClearIntFlag(mxc_wdt_regs_t* wdt);
|
||||
|
||||
/**@} end of group wdt */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _WDT_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,84 @@
|
||||
/* *****************************************************************************
|
||||
* Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
* $Revision: 40072 $
|
||||
*
|
||||
**************************************************************************** */
|
||||
|
||||
/* **** Includes **** */
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "mxc_config.h"
|
||||
#include "mxc_errors.h"
|
||||
#include "icc_regs.h"
|
||||
#include "icc.h"
|
||||
|
||||
static int ICC_Ready(void)
|
||||
{
|
||||
return (MXC_ICC->cache_ctrl & MXC_F_ICC_CACHE_CTRL_CACHE_RDY);
|
||||
}
|
||||
|
||||
int ICC_ID(icc_cache_id_t cid)
|
||||
{
|
||||
switch (cid) {
|
||||
case ICC_CACHE_ID_RELNUM:
|
||||
return ((MXC_ICC->cache_id & MXC_F_ICC_CACHE_ID_RELNUM) >> MXC_F_ICC_CACHE_ID_RELNUM_POS);
|
||||
case ICC_CACHE_ID_PARTNUM:
|
||||
return ((MXC_ICC->cache_id & MXC_F_ICC_CACHE_ID_PARTNUM) >> MXC_F_ICC_CACHE_ID_PARTNUM_POS);
|
||||
case ICC_CACHE_ID_CCHID:
|
||||
return ((MXC_ICC->cache_id & MXC_F_ICC_CACHE_ID_CCHID) >> MXC_F_ICC_CACHE_ID_CCHID_POS);
|
||||
default:
|
||||
return E_BAD_PARAM;
|
||||
}
|
||||
}
|
||||
|
||||
void ICC_Enable(void)
|
||||
{
|
||||
// Invalidate cache and wait until ready
|
||||
MXC_ICC->invalidate = 1;
|
||||
while (!(ICC_Ready()));
|
||||
|
||||
// Enable Cache
|
||||
MXC_ICC->cache_ctrl |= MXC_F_ICC_CACHE_CTRL_CACHE_EN;
|
||||
}
|
||||
|
||||
void ICC_Disable(void)
|
||||
{
|
||||
// Disable Cache
|
||||
MXC_ICC->cache_ctrl &= ~MXC_F_ICC_CACHE_CTRL_CACHE_EN;
|
||||
}
|
||||
|
||||
void ICC_Flush(void)
|
||||
{
|
||||
ICC_Disable();
|
||||
ICC_Enable();
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,50 @@
|
||||
/* *****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-08-09 18:45:02 -0500 (Thu, 09 Aug 2018) $
|
||||
* $Revision: 36818 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* **** Includes **** */
|
||||
#include "mxc_config.h"
|
||||
|
||||
/* **** Definitions **** */
|
||||
|
||||
/* **** Globals *****/
|
||||
|
||||
/* **** Functions **** */
|
||||
|
||||
/* ************************************************************************** */
|
||||
__weak void mxc_assert(const char *expr, const char *file, int line)
|
||||
{
|
||||
while (1) {}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
/* *****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Id: mxc_delay.c 36202 2018-07-16 21:06:02Z michael.bayern $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* **** Includes **** */
|
||||
#include <stdint.h>
|
||||
#include "mxc_config.h"
|
||||
#include "mxc_delay.h"
|
||||
|
||||
/* **** File Scope Variables **** */
|
||||
static uint32_t ctrl_save;
|
||||
static volatile uint64_t compare_value = 0;
|
||||
static volatile uint64_t curr_value;
|
||||
static volatile uint32_t reload;
|
||||
|
||||
static void mxc_delay_init(unsigned long us);
|
||||
extern void SysTick_Handler(void);
|
||||
|
||||
/* ************************************************************************** */
|
||||
__weak void SysTick_Handler(void)
|
||||
{
|
||||
mxc_delay_handler();
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void mxc_delay_handler(void)
|
||||
{
|
||||
// Check and clear overflow flag
|
||||
if (SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) {
|
||||
// Is a delay in progress?
|
||||
if(compare_value != 0) {
|
||||
curr_value += reload;
|
||||
if(curr_value >= compare_value) {
|
||||
mxc_delay_stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
static void mxc_delay_init(unsigned long us)
|
||||
{
|
||||
uint32_t starttick, ticks;
|
||||
|
||||
// Record the current tick value and clear the overflow flag
|
||||
starttick = SysTick->VAL;
|
||||
|
||||
// Save the state of control register (and clear the overflow flag)
|
||||
ctrl_save = SysTick->CTRL & ~SysTick_CTRL_COUNTFLAG_Msk;
|
||||
|
||||
// If the SysTick is not running, configure and start it
|
||||
if (!(SysTick->CTRL & SysTick_CTRL_ENABLE_Msk)) {
|
||||
SysTick->LOAD = SysTick_LOAD_RELOAD_Msk;
|
||||
SysTick->VAL = SysTick_VAL_CURRENT_Msk;
|
||||
SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk;
|
||||
starttick = SysTick_VAL_CURRENT_Msk;
|
||||
reload = SysTick_LOAD_RELOAD_Msk + 1;
|
||||
} else {
|
||||
reload = SysTick->LOAD + 1; // get the current reload value
|
||||
}
|
||||
|
||||
// Calculate the total number of ticks to delay
|
||||
ticks = (uint32_t)(((uint64_t)us * (uint64_t)SystemCoreClock) / 1000000);
|
||||
|
||||
compare_value = ticks + (reload - starttick);
|
||||
curr_value = 0;
|
||||
|
||||
if (!(SysTick->CTRL & SysTick_CTRL_ENABLE_Msk)) {
|
||||
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
int mxc_delay_start(unsigned long us)
|
||||
{
|
||||
// Check if timeout currently ongoing
|
||||
if (compare_value != 0) {
|
||||
return E_BUSY;
|
||||
}
|
||||
|
||||
// Check if there is nothing to do
|
||||
if (us == 0) {
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
// Calculate the necessary delay and start the timer
|
||||
mxc_delay_init(us);
|
||||
|
||||
// Enable SysTick interrupt if necessary
|
||||
if (compare_value != 0) {
|
||||
SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk;
|
||||
}
|
||||
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
int mxc_delay_check(void)
|
||||
{
|
||||
// Check if timeout currently ongoing
|
||||
if (compare_value == 0) {
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
if((curr_value + (reload - SysTick->VAL)) >= compare_value) {
|
||||
mxc_delay_stop();
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
return E_BUSY;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void mxc_delay_stop(void)
|
||||
{
|
||||
SysTick->CTRL = ctrl_save;
|
||||
compare_value = 0;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
int mxc_delay(unsigned long us)
|
||||
{
|
||||
// Check if timeout currently ongoing
|
||||
if (compare_value != 0) {
|
||||
return E_BUSY;
|
||||
}
|
||||
|
||||
// Check if there is nothing to do
|
||||
if (us == 0) {
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
// Calculate the necessary delay and start the timer
|
||||
mxc_delay_init(us);
|
||||
|
||||
// Wait until the total number of ticks exceeds the compare value.
|
||||
while ((curr_value + (reload - SysTick->VAL)) < compare_value) {
|
||||
// If SysTick interrupts are enabled, COUNTFLAG will never be set here and
|
||||
// curr_value will be incremented in the ISR. If SysTick interrupts are
|
||||
// disabled, curr_value is incremented here.
|
||||
if (SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) {
|
||||
curr_value += reload;
|
||||
}
|
||||
}
|
||||
|
||||
mxc_delay_stop();
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/* ****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
* $Revision: 40072 $
|
||||
*
|
||||
*************************************************************************** */
|
||||
|
||||
/* Define to prevent redundant inclusion */
|
||||
#ifndef _MXC_LOCK_H_
|
||||
#define _MXC_LOCK_H_
|
||||
|
||||
/* **** Includes **** */
|
||||
#include "mxc_config.h"
|
||||
#include "mxc_lock.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined ( __ICCARM__ )
|
||||
#define MXC_LOCK_CAST unsigned int volatile *
|
||||
#else
|
||||
#define MXC_LOCK_CAST volatile unsigned long *
|
||||
#endif
|
||||
|
||||
/* ************************************************************************** */
|
||||
int mxc_get_lock(uint32_t *lock, uint32_t value)
|
||||
{
|
||||
do {
|
||||
|
||||
// Return if the lock is taken by a different thread
|
||||
if(__LDREXW((MXC_LOCK_CAST)lock) != 0) {
|
||||
return E_BUSY;
|
||||
}
|
||||
|
||||
// Attempt to take the lock
|
||||
} while(__STREXW(value, (MXC_LOCK_CAST)lock) != 0);
|
||||
|
||||
// Do not start any other memory access until memory barrier is complete
|
||||
__DMB();
|
||||
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void mxc_free_lock(uint32_t *lock)
|
||||
{
|
||||
// Ensure memory operations complete before releasing lock
|
||||
__DMB();
|
||||
*lock = 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _MXC_LOCK_H_ */
|
||||
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @file mxc_pins.c
|
||||
* @brief This file contains constant pin configurations for the peripherals.
|
||||
*/
|
||||
|
||||
/* *****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
* $Revision: 40072 $
|
||||
*
|
||||
**************************************************************************** */
|
||||
|
||||
/* **** Includes **** */
|
||||
#include "gpio.h"
|
||||
#include "mxc_config.h"
|
||||
|
||||
/**
|
||||
* @ingroup MXC_pins
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* **** TIMER pins **** */
|
||||
const gpio_cfg_t gpio_cfg_tmr0 = { PORT_0, PIN_3, GPIO_FUNC_ALT3, GPIO_PAD_NONE };
|
||||
|
||||
/* **** UART pins **** */
|
||||
const gpio_cfg_t gpio_cfg_uart0rtscts = { PORT_0, (PIN_6 | PIN_7), GPIO_FUNC_ALT2, GPIO_PAD_NONE };
|
||||
const gpio_cfg_t gpio_cfg_uart0a = { PORT_0, (PIN_4 | PIN_5), GPIO_FUNC_ALT2, GPIO_PAD_NONE };
|
||||
const gpio_cfg_t gpio_cfg_uart1rtscts = { PORT_0, (PIN_12 | PIN_13), GPIO_FUNC_ALT2, GPIO_PAD_NONE };
|
||||
const gpio_cfg_t gpio_cfg_uart1a = { PORT_0, (PIN_10 | PIN_11), GPIO_FUNC_ALT2, GPIO_PAD_NONE };
|
||||
const gpio_cfg_t gpio_cfg_uart1b = { PORT_0, (PIN_0 | PIN_1), GPIO_FUNC_ALT3, GPIO_PAD_NONE };
|
||||
const gpio_cfg_t gpio_cfg_uart1c = { PORT_0, (PIN_6 | PIN_7), GPIO_FUNC_ALT3, GPIO_PAD_NONE };
|
||||
|
||||
/* **** I2C pins **** */
|
||||
const gpio_cfg_t gpio_cfg_i2c0 = { PORT_0, (PIN_8 | PIN_9), GPIO_FUNC_ALT1, GPIO_PAD_PULL_UP };
|
||||
const gpio_cfg_t gpio_cfg_i2c1 = { PORT_0, (PIN_2 | PIN_3), GPIO_FUNC_ALT1, GPIO_PAD_PULL_UP };
|
||||
|
||||
/* **** SPI/I2S pins **** */
|
||||
const gpio_cfg_t gpio_cfg_spi17y = { PORT_0, (PIN_4 | PIN_5 | PIN_6 | PIN_7), GPIO_FUNC_ALT1, GPIO_PAD_NONE }; // SPI0A
|
||||
const gpio_cfg_t gpio_cfg_spimss1a = { PORT_0, (PIN_10 | PIN_11 | PIN_12 | PIN_13) , GPIO_FUNC_ALT1, GPIO_PAD_NONE }; // SPI1A
|
||||
const gpio_cfg_t gpio_cfg_spimss1b = { PORT_0, (PIN_0 | PIN_1 | PIN_2 | PIN_3 ) , GPIO_FUNC_ALT2, GPIO_PAD_NONE }; // SPI1B
|
||||
const gpio_cfg_t gpio_cfg_i2s1a = { PORT_0, (PIN_10 | PIN_11 | PIN_12 | PIN_13) , GPIO_FUNC_ALT1, GPIO_PAD_NONE }; // same port as SPI1A
|
||||
const gpio_cfg_t gpio_cfg_i2s1b = { PORT_0, (PIN_0 | PIN_1 | PIN_2 | PIN_3 ) , GPIO_FUNC_ALT2, GPIO_PAD_NONE }; // same port as SPI1B
|
||||
|
||||
/* **** SWD pins **** */
|
||||
const gpio_cfg_t gpio_cfg_swd = { PORT_0, (PIN_0 | PIN_1 | PIN_2 | PIN_3 ) , GPIO_FUNC_ALT1, GPIO_PAD_NONE };
|
||||
|
||||
/* **** RTC pins **** */
|
||||
const gpio_cfg_t gpio_cfg_rtc = { PORT_0, PIN_2, GPIO_FUNC_ALT3, GPIO_PAD_NONE };
|
||||
|
||||
/**@} end of ingroup MXC_pins*/
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,84 @@
|
||||
/* *****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2019-06-05 16:53:29 -0500 (Wed, 05 Jun 2019) $
|
||||
* $Revision: 43696 $
|
||||
*
|
||||
**************************************************************************** */
|
||||
|
||||
|
||||
#include "mxc_config.h"
|
||||
#include <string.h>
|
||||
#include "nvic_table.h"
|
||||
|
||||
#if !defined (NVIC_USER_IRQ_OFFSET)
|
||||
#define NVIC_USER_IRQ_OFFSET 16 /**! Offset for device specific IRQs */
|
||||
#endif
|
||||
|
||||
/* RAM vector_table needs to be aligned with the size of the vector table */
|
||||
#if defined ( __ICCARM__ )
|
||||
#pragma data_alignment = 512
|
||||
#else
|
||||
__attribute__((aligned(512)))
|
||||
#endif
|
||||
static void (*ramVectorTable[MXC_IRQ_COUNT])(void);
|
||||
|
||||
void NVIC_SetRAM(void)
|
||||
{
|
||||
#if defined (__ICCARM__)
|
||||
extern void (* const __isr_vector[])(void);
|
||||
#else
|
||||
/* should be defined in starup_<device>.S */
|
||||
extern uint32_t __isr_vector[97];
|
||||
#endif
|
||||
|
||||
memcpy(&ramVectorTable, &__isr_vector, sizeof(ramVectorTable));
|
||||
SCB->VTOR = (uint32_t)&ramVectorTable;
|
||||
}
|
||||
|
||||
void NVIC_SetVector(IRQn_Type irqn, void(*irq_handler)(void))
|
||||
{
|
||||
int index = irqn + 16; /* offset for externals */
|
||||
|
||||
/* If not copied, do copy */
|
||||
if (SCB->VTOR != (uint32_t)&ramVectorTable) {
|
||||
NVIC_SetRAM();
|
||||
}
|
||||
|
||||
ramVectorTable[index] = irq_handler;
|
||||
NVIC_EnableIRQ(irqn);
|
||||
}
|
||||
|
||||
uint32_t NVIC_GetVector(IRQn_Type irqn)
|
||||
{
|
||||
uint32_t *vectors = (uint32_t *)SCB->VTOR;
|
||||
return vectors[(int32_t)irqn + NVIC_USER_IRQ_OFFSET];
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,168 @@
|
||||
/* *****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-10-17 14:16:30 -0500 (Wed, 17 Oct 2018) $
|
||||
* $Revision: 38560 $
|
||||
*
|
||||
**************************************************************************** */
|
||||
|
||||
/* **** Includes **** */
|
||||
#include <stddef.h>
|
||||
#include "mxc_assert.h"
|
||||
#include "tmr.h"
|
||||
#include "tmr_utils.h"
|
||||
|
||||
/* **** Definitions **** */
|
||||
|
||||
/* **** Globals **** */
|
||||
|
||||
/* **** Functions **** */
|
||||
|
||||
/* ************************************************************************** */
|
||||
void TMR_Delay(mxc_tmr_regs_t *tmr, unsigned long us, const sys_cfg_tmr_t *sys_cfg)
|
||||
{
|
||||
// Return immediately if delay is 0
|
||||
if (!us) {
|
||||
return;
|
||||
}
|
||||
|
||||
TMR_TO_Start(tmr, us, sys_cfg);
|
||||
|
||||
while (TMR_TO_Check(tmr) != E_TIME_OUT) {}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void TMR_TO_Start(mxc_tmr_regs_t *tmr, unsigned long us, const sys_cfg_tmr_t *sys_cfg)
|
||||
{
|
||||
uint64_t ticks;
|
||||
int clk_shift = 0;
|
||||
|
||||
ticks = (uint64_t)us * (uint64_t)PeripheralClock / (uint64_t)1000000;
|
||||
while (ticks > 0xFFFFFFFFUL) {
|
||||
ticks >>= 1;
|
||||
++clk_shift;
|
||||
}
|
||||
tmr_pres_t prescale = (tmr_pres_t)(clk_shift << MXC_F_TMR_CN_PRES_POS);
|
||||
|
||||
TMR_Init(tmr, prescale, sys_cfg);
|
||||
|
||||
// Initialize the timer in one-shot mode
|
||||
tmr_cfg_t cfg;
|
||||
cfg.mode = TMR_MODE_ONESHOT;
|
||||
cfg.cmp_cnt = ticks;
|
||||
cfg.pol = 0;
|
||||
|
||||
TMR_Disable(tmr);
|
||||
TMR_Config(tmr, &cfg);
|
||||
|
||||
TMR_IntClear(tmr);
|
||||
TMR_Enable(tmr);
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
int TMR_TO_Check(mxc_tmr_regs_t *tmr)
|
||||
{
|
||||
if (TMR_IntStatus(tmr)) {
|
||||
return E_TIME_OUT;
|
||||
}
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void TMR_TO_Stop(mxc_tmr_regs_t *tmr)
|
||||
{
|
||||
TMR_Disable(tmr);
|
||||
TMR_SetCount(tmr, 0x0);
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void TMR_TO_Clear(mxc_tmr_regs_t *tmr)
|
||||
{
|
||||
TMR_IntClear(tmr);
|
||||
TMR_SetCount(tmr, 0x0);
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
unsigned int TMR_TO_Elapsed(mxc_tmr_regs_t *tmr)
|
||||
{
|
||||
uint32_t elapsed;
|
||||
tmr_unit_t units;
|
||||
|
||||
TMR_GetTime(tmr, TMR_GetCount(tmr), &elapsed, &units);
|
||||
|
||||
switch (units) {
|
||||
case TMR_UNIT_NANOSEC:
|
||||
default:
|
||||
return (elapsed / 1000);
|
||||
case TMR_UNIT_MICROSEC:
|
||||
return (elapsed);
|
||||
case TMR_UNIT_MILLISEC:
|
||||
return (elapsed * 1000);
|
||||
case TMR_UNIT_SEC:
|
||||
return (elapsed * 1000000);
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
unsigned int TMR_TO_Remaining(mxc_tmr_regs_t *tmr)
|
||||
{
|
||||
uint32_t remaining_ticks, remaining_time;
|
||||
tmr_unit_t units;
|
||||
|
||||
remaining_ticks = TMR_GetCompare(tmr) - TMR_GetCount(tmr);
|
||||
TMR_GetTime(tmr, remaining_ticks, &remaining_time, &units);
|
||||
|
||||
switch (units) {
|
||||
case TMR_UNIT_NANOSEC:
|
||||
default:
|
||||
return (remaining_time / 1000);
|
||||
case TMR_UNIT_MICROSEC:
|
||||
return (remaining_time);
|
||||
case TMR_UNIT_MILLISEC:
|
||||
return (remaining_time * 1000);
|
||||
case TMR_UNIT_SEC:
|
||||
return (remaining_time * 1000000);
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void TMR_SW_Start(mxc_tmr_regs_t *tmr, const sys_cfg_tmr_t *sys_cfg)
|
||||
{
|
||||
TMR_TO_Start(tmr, 0xFFFFFFFF, sys_cfg);
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
unsigned int TMR_SW_Stop(mxc_tmr_regs_t *tmr)
|
||||
{
|
||||
unsigned int elapsed = TMR_TO_Elapsed(tmr);
|
||||
TMR_TO_Stop(tmr);
|
||||
return elapsed;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,129 @@
|
||||
/* *****************************************************************************
|
||||
* Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
*
|
||||
* 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 MAXIM INTEGRATED 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.
|
||||
*
|
||||
* Except as contained in this notice, the name of Maxim Integrated
|
||||
* Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
* Products, Inc. Branding Policy.
|
||||
*
|
||||
* The mere transfer of this software does not imply any licenses
|
||||
* of trade secrets, proprietary technology, copyrights, patents,
|
||||
* trademarks, maskwork rights, or any other form of intellectual
|
||||
* property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
* ownership rights.
|
||||
*
|
||||
* $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
* $Revision: 40072 $
|
||||
*
|
||||
**************************************************************************** */
|
||||
|
||||
/* **** Includes **** */
|
||||
#include "mxc_config.h"
|
||||
#include "mxc_errors.h"
|
||||
#include "mxc_assert.h"
|
||||
#include "mxc_sys.h"
|
||||
#include "wdt.h"
|
||||
|
||||
/* **** Definitions **** */
|
||||
|
||||
/* **** Globals **** */
|
||||
|
||||
/* **** Functions **** */
|
||||
|
||||
/* ************************************************************************** */
|
||||
int WDT_Init(mxc_wdt_regs_t* wdt, sys_cfg_wdt_t sys_cfg)
|
||||
{
|
||||
SYS_WDT_Init(wdt, sys_cfg);
|
||||
|
||||
return E_NO_ERROR;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void WDT_SetIntPeriod(mxc_wdt_regs_t* wdt, wdt_period_t period)
|
||||
{
|
||||
MXC_SETFIELD(wdt->ctrl, MXC_F_WDT_CTRL_INT_PERIOD, period);
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void WDT_SetResetPeriod(mxc_wdt_regs_t* wdt, wdt_period_t period)
|
||||
{
|
||||
MXC_SETFIELD(wdt->ctrl, MXC_F_WDT_CTRL_RST_PERIOD, (period << (MXC_F_WDT_CTRL_RST_PERIOD_POS - MXC_F_WDT_CTRL_INT_PERIOD_POS)));
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void WDT_Enable(mxc_wdt_regs_t* wdt, int enable)
|
||||
{
|
||||
if (enable) {
|
||||
wdt->ctrl |= MXC_F_WDT_CTRL_WDT_EN;
|
||||
} else {
|
||||
wdt->ctrl &= ~(MXC_F_WDT_CTRL_WDT_EN);
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void WDT_EnableInt(mxc_wdt_regs_t* wdt, int enable)
|
||||
{
|
||||
if (enable) {
|
||||
wdt->ctrl |= MXC_F_WDT_CTRL_INT_EN;
|
||||
} else {
|
||||
wdt->ctrl &= ~(MXC_F_WDT_CTRL_INT_EN);
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void WDT_EnableReset(mxc_wdt_regs_t* wdt, int enable)
|
||||
{
|
||||
if (enable) {
|
||||
wdt->ctrl |= MXC_F_WDT_CTRL_RST_EN;
|
||||
} else {
|
||||
wdt->ctrl &= ~(MXC_F_WDT_CTRL_RST_EN);
|
||||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void WDT_ResetTimer(mxc_wdt_regs_t* wdt)
|
||||
{
|
||||
wdt->rst = 0x00A5;
|
||||
wdt->rst = 0x005A;
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
int WDT_GetResetFlag(mxc_wdt_regs_t* wdt)
|
||||
{
|
||||
return !!(wdt->ctrl & MXC_F_WDT_CTRL_RST_FLAG);
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void WDT_ClearResetFlag(mxc_wdt_regs_t* wdt)
|
||||
{
|
||||
wdt->ctrl &= ~(MXC_F_WDT_CTRL_RST_FLAG);
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
int WDT_GetIntFlag(mxc_wdt_regs_t* wdt)
|
||||
{
|
||||
return !!(wdt->ctrl & MXC_F_WDT_CTRL_INT_FLAG);
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
void WDT_ClearIntFlag(mxc_wdt_regs_t* wdt)
|
||||
{
|
||||
wdt->ctrl &= ~(MXC_F_WDT_CTRL_INT_FLAG);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
|
||||
#
|
||||
# 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 MAXIM INTEGRATED 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.
|
||||
#
|
||||
# Except as contained in this notice, the name of Maxim Integrated
|
||||
# Products, Inc. shall not be used except as stated in the Maxim Integrated
|
||||
# Products, Inc. Branding Policy.
|
||||
#
|
||||
# The mere transfer of this software does not imply any licenses
|
||||
# of trade secrets, proprietary technology, copyrights, patents,
|
||||
# trademarks, maskwork rights, or any other form of intellectual
|
||||
# property whatsoever. Maxim Integrated Products, Inc. retains all
|
||||
# ownership rights.
|
||||
#
|
||||
# $Date: 2018-12-18 15:37:22 -0600 (Tue, 18 Dec 2018) $
|
||||
# $Revision: 40072 $
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
################################################################################
|
||||
# This file can be included in a project makefile to build the library for the
|
||||
# project.
|
||||
################################################################################
|
||||
|
||||
ifeq "$(PERIPH_DRIVER_DIR)" ""
|
||||
$(error "PERIPH_DRIVER_DIR must be specified")
|
||||
endif
|
||||
|
||||
# Specify the build directory if not defined by the project
|
||||
ifeq "$(BUILD_DIR)" ""
|
||||
PERIPH_DRIVER_BUILD_DIR=$(CURDIR)/build/PeriphDriver
|
||||
else
|
||||
PERIPH_DRIVER_BUILD_DIR=$(BUILD_DIR)/PeriphDriver
|
||||
endif
|
||||
|
||||
# Export paths needed by the peripheral driver makefile. Since the makefile to
|
||||
# build the library will execute in a different directory, paths must be
|
||||
# specified absolutely
|
||||
PERIPH_DRIVER_BUILD_DIR := ${abspath ${PERIPH_DRIVER_BUILD_DIR}}
|
||||
export TOOL_DIR := ${abspath ${TOOL_DIR}}
|
||||
export CMSIS_ROOT := ${abspath ${CMSIS_ROOT}}
|
||||
|
||||
# Export other variables needed by the peripheral driver makefile
|
||||
export TARGET
|
||||
export COMPILER
|
||||
export TARGET_MAKEFILE
|
||||
export PROJ_CFLAGS
|
||||
export PROJ_LDFLAGS
|
||||
export MXC_OPTIMIZE_CFLAGS
|
||||
|
||||
# Add to library list
|
||||
LIBS += ${PERIPH_DRIVER_BUILD_DIR}/PeriphDriver.a
|
||||
|
||||
# Add to include directory list
|
||||
IPATH += ${PERIPH_DRIVER_DIR}/Include
|
||||
|
||||
# Add rule to build the Driver Library
|
||||
${PERIPH_DRIVER_BUILD_DIR}/PeriphDriver.a: FORCE
|
||||
$(MAKE) -C ${PERIPH_DRIVER_DIR} lib BUILD_DIR=${PERIPH_DRIVER_BUILD_DIR}
|
||||
|
||||
Reference in new issue
Block a user