1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2020 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _BOARD_H_
10 #define _BOARD_H_
11 
12 #include "clock_config.h"
13 #include "fsl_clock.h"
14 /*******************************************************************************
15  * Definitions
16  ******************************************************************************/
17 /*! @brief The board name */
18 #define BOARD_NAME        "MCIMX7ULP-EVK"
19 #define MANUFACTURER_NAME "NXP"
20 
21 /* The UART to use for debug messages. */
22 #define BOARD_DEBUG_UART_TYPE        kSerialPort_Uart
23 #define BOARD_DEBUG_UART_BAUDRATE    115200u
24 #define BOARD_DEBUG_UART_BASEADDR    LPUART0_BASE
25 #define BOARD_DEBUG_UART_INSTANCE    0U
26 #define BOARD_DEBUG_UART_CLK_FREQ    CLOCK_GetIpFreq(kCLOCK_Lpuart0)
27 #define BOARD_DEBUG_UART_PCC_ADDRESS kCLOCK_Lpuart0
28 #define BOARD_DEBUG_UART_CLKSRC      kCLOCK_IpSrcSystem
29 #define BOARD_UART_IRQ               LPUART0_IRQn
30 #define BOARD_UART_IRQ_HANDLER       LPUART0_IRQHandler
31 
32 /* @Brief Board accelerator sensor configuration */
33 #define BOARD_ACCEL_I2C_BASEADDR   LPI2C3
34 #define BOARD_ACCEL_I2C_CLOCK_FREQ CLOCK_GetIpFreq(kCLOCK_Lpi2c3)
35 
36 #define BOARD_CODEC_I2C_BASEADDR   LPI2C0
37 #define BOARD_CODEC_I2C_CLOCK_FREQ CLOCK_GetIpFreq(kCLOCK_Lpi2c0)
38 #define BOARD_CODEC_I2C_INSTANCE   0U
39 
40 #define BOARD_VOLP_GPIO        GPIOA
41 #define BOARD_VOLP_PORT        PORTA
42 #define BOARD_VOLP_GPIO_PIN    3U
43 #define BOARD_VOLP_IRQ         PCTLA_IRQn
44 #define BOARD_VOLP_IRQ_HANDLER PCTLA_IRQHandler
45 #define BOARD_VOLP_NAME        "VOL+"
46 
47 #define BOARD_VOLM_GPIO        GPIOA
48 #define BOARD_VOLM_PORT        PORTA
49 #define BOARD_VOLM_GPIO_PIN    13U
50 #define BOARD_VOLM_IRQ         PCTLA_IRQn
51 #define BOARD_VOLM_IRQ_HANDLER PCTLA_IRQHandler
52 #define BOARD_VOLM_NAME        "VOL-"
53 
54 #define VDEV0_VRING_BASE (0x9FF00000U)
55 #define VDEV1_VRING_BASE (0x9FF10000U)
56 
57 #if defined(__cplusplus)
58 extern "C" {
59 #endif /* __cplusplus */
60 
61 /*******************************************************************************
62  * API
63  ******************************************************************************/
64 
65 void BOARD_InitDebugConsole(void);
66 #if defined(SDK_I2C_BASED_COMPONENT_USED) && SDK_I2C_BASED_COMPONENT_USED
67 void BOARD_LPI2C_Init(LPI2C_Type *base, uint32_t clkSrc_Hz);
68 status_t BOARD_LPI2C_Send(LPI2C_Type *base,
69                           uint8_t deviceAddress,
70                           uint32_t subAddress,
71                           uint8_t subaddressSize,
72                           uint8_t *txBuff,
73                           uint8_t txBuffSize);
74 status_t BOARD_LPI2C_Receive(LPI2C_Type *base,
75                              uint8_t deviceAddress,
76                              uint32_t subAddress,
77                              uint8_t subaddressSize,
78                              uint8_t *rxBuff,
79                              uint8_t rxBuffSize);
80 void BOARD_Accel_I2C_Init(void);
81 status_t BOARD_Accel_I2C_Send(uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint32_t txBuff);
82 status_t BOARD_Accel_I2C_Receive(
83     uint8_t deviceAddress, uint32_t subAddress, uint8_t subaddressSize, uint8_t *rxBuff, uint8_t rxBuffSize);
84 void BOARD_Codec_I2C_Init(void);
85 status_t BOARD_Codec_I2C_Send(
86     uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, const uint8_t *txBuff, uint8_t txBuffSize);
87 status_t BOARD_Codec_I2C_Receive(
88     uint8_t deviceAddress, uint32_t subAddress, uint8_t subAddressSize, uint8_t *rxBuff, uint8_t rxBuffSize);
89 #endif /* SDK_I2C_BASED_COMPONENT_USED */
90 #if defined(__cplusplus)
91 }
92 #endif /* __cplusplus */
93 
94 #endif /* _BOARD_H_ */
95