MKL25Z4/src/bus_pal_hardware.h
/*
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. 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.
*/
#if !defined(__BUS_PAL_HARDWARE_H__)
#define __BUS_PAL_HARDWARE_H__
#include "spi/fsl_spi.h"
#include "i2c/fsl_i2c.h"
typedef struct _i2c_user_config
{
uint8_t slaveAddress;
uint16_t baudRate_kbps;
} i2c_user_config_t;
typedef struct _spi_user_config
{
spi_clock_polarity_t polarity;
spi_clock_phase_t phase;
spi_shift_direction_t direction;
uint32_t baudRate_Bps;
uint32_t clock_Hz;
} spi_user_config_t;
void init_hardware(void);
void write_bytes_to_host(uint8_t *src, uint32_t length);
void host_start_command_rx(uint8_t *dest, uint32_t length);
void host_stop_command_rx(void);
uint32_t get_bytes_received_from_host(void);
void configure_spi_speed(uint32_t speedkhz);
void configure_spi_settings(spi_clock_polarity_t polarity, spi_clock_phase_t phase, spi_shift_direction_t direction);
void configure_i2c_address(uint8_t address);
void configure_i2c_speed(uint32_t speedkhz);
void send_spi_data(uint8_t *src, uint32_t writeLength);
void receive_spi_data(uint8_t *dest, uint32_t readLength);
status_t send_i2c_data(uint8_t *src, uint32_t writeLength);
status_t receive_i2c_data(uint8_t *dest, uint32_t readLength);
void configure_gpio(uint8_t port, uint8_t pinNum, uint8_t muxVal);
void set_gpio(uint8_t port, uint8_t pinNum, uint8_t level);
void set_fpga_clock(uint32_t clock);
#endif // __BUS_PAL_HARDWARE_H__
// EOF
spi_user_config_t::direction
spi_shift_direction_t direction
Definition: MKL25Z4/src/bus_pal_hardware.h:52
spi_clock_phase_t
spi_clock_phase_t
SPI clock phase configuration.
Definition: fsl_spi.h:65
spi_clock_polarity_t
spi_clock_polarity_t
SPI clock polarity configuration.
Definition: fsl_spi.h:58
init_hardware
void init_hardware(void)
hardware initialization
Definition: hardware_init_MK80F25615.c:49
i2c_user_config_t
user config from host for i2c
Definition: MK65F18/src/bus_pal_hardware.h:40
spi_user_config_t::phase
spi_clock_phase_t phase
Definition: MKL25Z4/src/bus_pal_hardware.h:51
spi_shift_direction_t
spi_shift_direction_t
SPI data shifter direction options.
Definition: fsl_spi.h:74
spi_user_config_t::polarity
spi_clock_polarity_t polarity
Definition: MKL25Z4/src/bus_pal_hardware.h:50
spi_user_config_t::baudRate_Bps
uint32_t baudRate_Bps
Definition: MKL25Z4/src/bus_pal_hardware.h:53
status_t
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:121
spi_user_config_t
user config from host for spi
Definition: MKL25Z4/src/bus_pal_hardware.h:48