97 lines
2.7 KiB
C
97 lines
2.7 KiB
C
#ifndef IVEC_MCAL_COMMON_H
|
|
#define IVEC_MCAL_COMMON_H
|
|
|
|
#include "..\utils\utils.h"
|
|
#include "ti_msp_dl_config.h"
|
|
/*
|
|
* File: ivec_mcal_common.h
|
|
* Description: Header file for IVEC MCAL common functionalities.
|
|
* Definitions for SPI and UART pins, error codes, logging macros, and configurations.
|
|
*/
|
|
|
|
#include<inttypes.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <stdbool.h>
|
|
//#include "ql_log.h"
|
|
//#include "ql_osi_def.h"
|
|
//#include "quec_pin_index.h"
|
|
|
|
#define SPI_PORT1 0
|
|
#define SPI_PORT2 1
|
|
#define UART_PORT2 1
|
|
#define UART_PORT3 0
|
|
|
|
|
|
#if(SPI_PORT1)
|
|
//SPI_1 PINS
|
|
#define mcalDEFAULT_SPI1_CS_PIN QUEC_PIN_SPI1_CS
|
|
#define mcalDEFAULT_SPI1_CLK_PIN QUEC_PIN_SPI1_CLK
|
|
#define mcalDEFAULT_SPI1_DO_PIN QUEC_PIN_SPI1_MOSI
|
|
#define mcalDEFAULT_SPI1_DI_PIN QUEC_PIN_SPI1_MISO
|
|
#define mcalDEFAULT_SPI1_FUNC QUEC_PIN_SPI1_FUNC
|
|
#elif(SPI_PORT2)
|
|
//SPI_2 PINS
|
|
#define mcalDEFAULT_SPI2_CS_PIN QUEC_PIN_SPI2_CS
|
|
#define mcalDEFAULT_SPI2_CLK_PIN QUEC_PIN_SPI2_CLK
|
|
#define mcalDEFAULT_SPI2_DO_PIN QUEC_PIN_SPI2_MOSI
|
|
#define mcalDEFAULT_SPI2_DI_PIN QUEC_PIN_SPI2_MISO
|
|
#define mcalDEFAULT_SPI2_FUNC QUEC_PIN_SPI2_FUNC
|
|
#endif
|
|
|
|
#if(UART_PORT2)
|
|
//UART_2 PINS
|
|
#define mcalDEFAULT_UART2_RXD_PIN QUEC_PIN_DNAME_KEYIN_4
|
|
#define mcalDEFAULT_UART2_TXD_PIN QUEC_PIN_DNAME_KEYIN_5
|
|
#define mcalDEFAULT_UART2_PIN_FUNC 3
|
|
#elif(UART_PORT3)
|
|
//UART_3 PINS
|
|
#define mcalDEFAULT_UART3_RXD_PIN QUEC_PIN_DNAME_KEYOUT_4
|
|
#define mcalDEFAULT_UART3_TXD_PIN QUEC_PIN_DNAME_KEYOUT_5
|
|
#define mcalDEFAULT_UART2_PIN_FUNC 4
|
|
#endif
|
|
|
|
// Enum for common MCAL error codes
|
|
typedef enum
|
|
{
|
|
//common
|
|
commonMCAL_SUCCESS = 0,
|
|
commonMCAL_INVALID_PARAM = -7,
|
|
commonMCAL_FAIL = -6,
|
|
commonMCAL_INIT_FAIL = -5,
|
|
commonMCAL_DEINIT_FAIL,
|
|
commonMCAL_CONFIG_FAIL,
|
|
commonMCAL_READ_FAIL,
|
|
commonMCAL_WRITE_FAIL,
|
|
commonMCAL_ALREADY_INIT=-20,
|
|
commonMCAL_ALREADY_DEINIT,
|
|
commonMCAL_NOT_IMPLEMENTED
|
|
}IVEC_McalCommonErr_e;
|
|
|
|
// Enable/disable logging
|
|
#define MCAL_LOG_ENABLE 1
|
|
#if MCAL_LOG_ENABLE==0
|
|
#define IVEC_MCAL_LOG(LOG_STRING, msg ,...) QL_LOG(QL_LOG_LEVEL_INFO, LOG_STRING, msg, ##__VA_ARGS__)
|
|
#else
|
|
#define IVEC_MCAL_LOG(LOG_STRING,msg, ...)
|
|
#endif
|
|
|
|
// Enable/disable MCAL function entry logs
|
|
#if 0
|
|
#define IVEC_MCAL_FUNC_ENTRY(LOG_STRING,...) QL_LOG(QL_LOG_LEVEL_INFO, LOG_STRING, "MCAL Entry", ##__VA_ARGS__)
|
|
#else
|
|
#define IVEC_MCAL_FUNC_ENTRY(LOG_STRING)
|
|
#endif
|
|
// Enable/disable MCAL function exit logs
|
|
#if 0
|
|
#define IVEC_MCAL_FUNC_EXIT(LOG_STRING,...) QL_LOG(QL_LOG_LEVEL_INFO, LOG_STRING, "MCAL Exit", ##__VA_ARGS__)
|
|
#else
|
|
#define IVEC_MCAL_FUNC_EXIT(LOG_STRING,...)
|
|
#endif
|
|
|
|
#define IVEC_QL_GNSS_PDP_PROFILE 5
|
|
|
|
|
|
#endif /* IVEC_MCAL_COMMON_H */
|