/**************************************************************************************************/ /** * @file : main.c * @brief : Spi example source file * - Platform: Z20K14xM * - Autosar Version: 4.6.0 * @version : 1.1.0 * @author : Zhixin Semiconductor * * @note : This example contains sample code for customer evaluation purpose only. It is not * part of the production code deliverables. The example code is only tested under defined * environment with related context of the whole example project. Therefore, it is not guaranteed * that the example always works under user environment due to the diversity of hardware and * software environment. Do not use pieces copy of the example code without prior and separate * verification and validation in user environment. * * @copyright : Copyright (c) 2021-2023 Zhixin Semiconductor Ltd. All rights reserved. **************************************************************************************************/ /** @addtogroup Spi_Example * @brief Spi Example * @{ */ #ifdef __cplusplus extern "C" { #endif #include "Platform.h" #include "Mcu.h" #include "Port.h" #include "Dio.h" #include "Spi.h" #include "SchM_Spi.h" #include "Wdg.h" #include "Gpt.h" #include "SchM_Gpt.h" #include "CddSbc.h" #include "Cdd_bd18397.h" #include "app_task.h" #include "CddBoost.h" /** * @brief definition for length of spi channel */ #define SBCTEST (0U) /** * @brief definition data buffer for read and write */ uint8 Spi_Stat = 0; /** * @brief This function for sequence end notification. */ void Ex_Spi_StpSequenceEndNotification(void) { } void Ex_Spi_SbcSequenceEndNotification(void) { } void Ex_Spi_BuckSequenceEndNotification(void) { } void Ex_Spi_BoostSequenceEndNotification(void) { } /** * @brief This function for job end notification. */ void Ex_Spi_StpJobEndNotification(void) { } void Ex_Spi_SbcJobEndNotification(void) { } void Ex_Spi_BuckJobEndNotification(void) { Dio_WriteChannel(DioChannel_PTB17,STD_HIGH); } void Ex_Spi_BoostJobEndNotification(void) { } void Ex_Spi_StpJobStartNotification(void) { } void Ex_Spi_SbcJobStartNotification(void) { } void Ex_Spi_BuckJobStartNotification(void) { } void Ex_Spi_BoostJobStartNotification(void) { } /** * @brief This function for job start notification. */ void Ex_Spi_SlaveJobStartNotification(void) { } uint8 Spi_Stat_Get(void) { return Spi_Stat; } int main(void) { uint32 Delay = 0; McalLib_Init(); Mcu_Init(NULL_PTR); Mcu_InitClock(0); #if (MCU_NO_PLL == STD_OFF) while (MCU_PLL_LOCKED != Mcu_GetPllStatus()); Mcu_DistributePllClock(); #endif /* MCU_NO_PLL == STD_OFF */ /* Set mode to 0(MCU_POWERMODE_RUN), value is configured in EB */ Mcu_SetMode(0); Wdg_Init(NULL_PTR); Port_Init(NULL_PTR); Spi_Init(NULL_PTR); Spi_Stat = 1; Gpt_Init(NULL_PTR); Platform_Init(NULL_PTR); Gpt_EnableNotification(0); Gpt_StartTimer(0, 1000); InitSPI_Dev(); Delay = 1000; #if (SBCTEST) CddSbc_Init(); CddSbc_SetWdgWindowModeAnd200ms(); #endif for (;;) { Task_mananager(); if(Delay<=0) { Delay=1000; } Wdg_Service(); Delay--; } } #ifdef __cplusplus } #endif /** @} end of group Spi_Example */