Skip to content
Snippets Groups Projects
Commit 8daedc35 authored by schneider's avatar schneider
Browse files

chore(sdk): copy evkit board to card10 board

parent bc6e2b0d
No related branches found
No related tags found
No related merge requests found
/*******************************************************************************
* 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-08-29 19:57:14 +0000 (Wed, 29 Aug 2018) $
* $Revision: 37501 $
*
******************************************************************************/
/**
* @file board.h
* @brief Board support package API.
*/
#include <stdio.h>
#include "spixfc.h"
#ifndef _BOARD_H
#define _BOARD_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef CONSOLE_UART
#define CONSOLE_UART 1 /// UART instance to use for console
#endif
#ifndef CONSOLE_BAUD
#define CONSOLE_BAUD 115200 /// Console baud rate
#endif
#define LED_OFF 1 /// Inactive state of LEDs
#define LED_ON 0 /// Active state of LEDs
#define MX25_SPI MXC_SPIXFC
#define MX25_SSEL 0
// #define SPI_CHAR_BITS 8
/**
* \brief Initialize the BSP and board interfaces.
* \returns #E_NO_ERROR if everything is successful
*/
int Board_Init(void);
/**
* \brief Initialize or reinitialize the console. This may be necessary if the
* system clock rate is changed.
* \returns #E_NO_ERROR if everything is successful
*/
int Console_Init(void);
/**
* \brief Attempt to prepare the console for sleep.
* \returns #E_NO_ERROR if ready to sleep, #E_BUSY if not ready for sleep.
*/
int Console_PrepForSleep(void);
/**
* @brief Initialize or reinitialize the console. This may be necessary if the
* system clock rate is changed.
* @returns #E_NO_ERROR if everything is successful
*/
int Console_Shutdown(void);
/**
* \brief Initialize the SPI peripheral to use for MX25
* \returns #E_NO_ERROR if everything is successful
*/
int MX25_Board_Init(void);
/**
* \brief Translation function to implement SPI Read transaction
* @param read Pointer to where master will store data.
* @param len Number of characters to send.
* @param deassert Deassert slave select at the end of the transaction.
* @param width spi_width_t for how many data lines to use
* \returns #E_NO_ERROR if successful, !=0 otherwise
*/
int MX25_Board_Read(uint8_t* read, unsigned len, unsigned deassert, spixfc_width_t width);
/**
* \brief Translation function to implement SPI Write transaction
* @param write Pointer to data master will write.
* @param len Number of characters to send.
* @param deassert Deassert slave select at the end of the transaction.
* @param width spi_width_t for how many data lines to use
* \returns #E_NO_ERROR if successful, !=0 otherwise
*/
int MX25_Board_Write(const uint8_t* write, unsigned len, unsigned deassert, spixfc_width_t width);
/**
* \brief Send clocks on SCLK.
* @param len Number of characters to send.
* @param deassert Deassert slave select at the end of the transaction.
* \returns #E_NO_ERROR if successful, !=0 otherwise
*/
int MX25_Clock(unsigned len, unsigned deassert);;
#ifdef __cplusplus
}
#endif
#endif /* _BOARD_H */
/*******************************************************************************
* Copyright (C) 2015 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-03 19:30:05 +0000 (Mon, 03 Dec 2018) $
* $Revision: 39561 $
*
******************************************************************************/
#include <stdio.h>
#include "mxc_config.h"
#include "mxc_sys.h"
#include "mxc_assert.h"
#include "board.h"
#include "uart.h"
#include "gpio.h"
#include "mxc_pins.h"
#include "led.h"
#include "pb.h"
#include "spixfc.h"
/***** Global Variables *****/
mxc_uart_regs_t * ConsoleUart = MXC_UART_GET_UART(CONSOLE_UART);
extern uint32_t SystemCoreClock;
const gpio_cfg_t pb_pin[] = {
{PORT_1, PIN_6, GPIO_FUNC_IN, GPIO_PAD_PULL_UP},
{PORT_1, PIN_7, GPIO_FUNC_IN, GPIO_PAD_PULL_UP},
};
const unsigned int num_pbs = (sizeof(pb_pin) / sizeof(gpio_cfg_t));
const gpio_cfg_t led_pin[] = {
{PORT_1, PIN_14, GPIO_FUNC_OUT, GPIO_PAD_NONE},
{PORT_1, PIN_15, GPIO_FUNC_OUT, GPIO_PAD_NONE},
};
const unsigned int num_leds = (sizeof(led_pin) / sizeof(gpio_cfg_t));
/***** File Scope Variables *****/
const uart_cfg_t uart_cfg = {
.parity = UART_PARITY_DISABLE,
.size = UART_DATA_SIZE_8_BITS,
.stop = UART_STOP_1,
.flow = UART_FLOW_CTRL_DIS,
.pol = UART_FLOW_POL_DIS,
.baud = CONSOLE_BAUD,
.clksel = UART_CLKSEL_SYSTEM
};
const sys_cfg_uart_t uart_sys_cfg = {
.map = MAP_A,
.flow = Disable
};
const sys_cfg_spixfc_t spixfc_sys_cfg = NULL; // There is no special system configuration parameters for SPIXC
const spixfc_cfg_t mx25_spixfc_cfg = {
0, //mode
0, //ssel_pol
10000000 //baud
};
/******************************************************************************/
void mxc_assert(const char *expr, const char *file, int line)
{
printf("MXC_ASSERT %s #%d: (%s)\n", file, line, expr);
while (1);
}
/******************************************************************************/
int Board_Init(void)
{
int err;
if ((err = Console_Init()) != E_NO_ERROR) {
MXC_ASSERT_FAIL();
return err;
}
if ((err = PB_Init()) != E_NO_ERROR) {
MXC_ASSERT_FAIL();
return err;
}
if ((err = LED_Init()) != E_NO_ERROR) {
MXC_ASSERT_FAIL();
return err;
}
return E_NO_ERROR;
}
/******************************************************************************/
int Console_Init(void)
{
int err;
if ((err = UART_Init(ConsoleUart, &uart_cfg, &uart_sys_cfg)) != E_NO_ERROR) {
return err;
}
return E_NO_ERROR;
}
/******************************************************************************/
int Console_Shutdown(void)
{
int err;
if ((err = UART_Shutdown(ConsoleUart)) != E_NO_ERROR) {
return err;
}
return E_NO_ERROR;
}
/******************************************************************************/
void NMI_Handler(void)
{
__NOP();
}
/******************************************************************************/
int MX25_Board_Init(void)
{
return SPIXFC_Init(MX25_SPI, &mx25_spixfc_cfg, &spixfc_sys_cfg);
}
/******************************************************************************/
int MX25_Board_Read(uint8_t* read, unsigned len, unsigned deassert, spixfc_width_t width)
{
spixfc_req_t req = {MX25_SSEL,deassert,0,NULL,read, width,len,0,0,NULL};
return SPIXFC_Trans(MX25_SPI, &req);
}
/******************************************************************************/
int MX25_Board_Write(const uint8_t* write, unsigned len, unsigned deassert, spixfc_width_t width)
{
spixfc_req_t req = {MX25_SSEL,deassert,0,write,NULL, width,len,0,0,NULL};
return SPIXFC_Trans(MX25_SPI, &req);
}
/******************************************************************************/
int MX25_Clock(unsigned len, unsigned deassert)
{
return SPIXFC_Clocks(MX25_SPI, len, MX25_SSEL, deassert);
}
OLIMEX-ARM-USB-OCD-H SWD, interface/ftdi/olimex-arm-usb-ocd-h.cfg -f interface/ftdi/olimex-arm-jtag-swd.cfg
OLIMEX-ARM-USB-TINY-H SWD, interface/ftdi/olimex-arm-usb-tiny-h.cfg -f interface/ftdi/olimex-arm-jtag-swd.cfg
MAX32625_PICO, interface/cmsis-dap.cfg
CMSIS-DAP, interface/cmsis-dap.cfg
\ No newline at end of file
################################################################################
# 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-08-10 14:36:39 +0000 (Fri, 10 Aug 2018) $
# $Revision: 36825 $
#
###############################################################################
ifeq "$(BOARD_DIR)" ""
$(error BOARD_DIR must be set)
endif
# PROJ_CFLAGS+=-DRO_FREQ=46000000
# PROJ_CFLAGS+=-DCRYPTO_FREQ=46000000
#PROJ_CFLAGS+=-DPeripheralClock=60000000
# Source files for this test (add path to VPATH below)
SRCS += board.c
SRCS += stdio.c
SRCS += led.c
SRCS += mx25.c
SRCS += pb.c
# Where to find BSP source files
VPATH += $(BOARD_DIR)/Source
VPATH += $(BOARD_DIR)/../Source
# Where to find BSP header files
IPATH += $(BOARD_DIR)/Include
IPATH += $(BOARD_DIR)/../Include
ADC
AES
BLE_beacon
BLE_datc
BLE_dats
BLE_fit
BLE_scanner
CRC
DES
DMA
DualCore
Flash
FreeRTOSDemo
GPIO
Hello_World
HTMR
I2C
ICC
LCD
LP
MAA
OWM
Pulse_Train
RTC
SDHC_FAT
SDHC_Raw
Semaphore
SPI
SPIXF
SPIXR
TMR
TRNG
UART
USB_CDCACM
USB_CompositeDevice
USB_HIDKeyboard
USB_MassStorage
Watchdog
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment