/*!
* @file     Spi_Cfg.h
*
* @version  1.0.0
*
* @brief    Header file of Spi parameter configuration.
*           This file contains the used configuration parameters generated by EB tresos studio
*
* @attention
*
* Project Name      : AUTOSAR MCAL
*
* Platform          : Arm
*
* Autosar Standard  : Classic Platform 4.4.0
*
* Compiled Version  : G32A10xx_MCAL_1_0_0_01-Otc-25
*
* Copyright (C) 2026 Geehy Semiconductor
*
* You may not use this file except in compliance with the
* GEEHY COPYRIGHT NOTICE (Geehy Semiconductor Software License Agreement).
*
* The program is only for reference, which is distributed in the hope
* that it will be usefull and instructional for customers to develop
* their software. Unless required by applicable law or agreed to in
* writing, the program is distributed on an "AS IS" BASIS, WITHOUT
* ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
* See the Geehy Semiconductor Software License Agreement for the governing permissions
* and limitations under the License.
*/

#ifndef SPI_CFG_H
#define SPI_CFG_H

#ifdef __cplusplus
extern "C"{
#endif
#include "Spi_Notification.h"

/** @addtogroup G32A10xx_StdPeriphDriver
  @{
*/

/** @defgroup SPI_Driver
  * @brief SPI driver modules
  @{
*/

/** @defgroup SPI_Macros
  @{
*/
/*************************************************************************************************
*                              VENDOR ID & AUTOSAR VERSION RECORD INFO
*************************************************************************************************/
/** Vendor ID (vendorId) of the dedicated implementation of this module according to the AUTOSAR vendor list. */
#define SPI_CFG_H_VENDOR_ID                       0x00C1U
/** Module ID of this module, as defined in the BSW Module List [1]. */
#define SPI_CFG_H_MODULE_ID                       0x53U
/** Major version number of AUTOSAR release on which the appropriate implementation is based on. */
#define SPI_CFG_H_AR_RELEASE_MAJOR_VERSION        0x04U
/** Minor version number of AUTOSAR release on which the appropriate implementation is based on. */
#define SPI_CFG_H_AR_RELEASE_MINOR_VERSION        0x04U
/** Revision version number of AUTOSAR release on which the appropriate implementation is based on. */
#define SPI_CFG_H_AR_RELEASE_REVISION_VERSION     0x00U
/** Major version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define SPI_CFG_H_SW_MAJOR_VERSION                0x01U
/** Minor version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define SPI_CFG_H_SW_MINOR_VERSION                0x00U
/** Patch level version number of the vendor specific implementation of the module. The numbering is vendor specific. */
#define SPI_CFG_H_SW_PATCH_VERSION                0x00U

/***************************************************************************************************
*                                      MACRO DEFINITION
***************************************************************************************************/
/** SPI mode : MASTER or SLAVE , can only choose one */
#define SPI_SLAVE_SUPPORT                       (STD_OFF)
#define SPI_MASTER_SUPPORT                      (STD_ON)

/** Switch the asyncronous operation mode (POLLING or INTERRUPT) on or off. */
#define SPI_ASYNC_MODE_ENABLE                   (STD_ON)

/** Switch the DMA status on or off */
#define SPI_DMA_SUPPORT                         (STD_OFF)

/** The SPI Handler/Driver manages only Internal Buffers */
#define USAGE0                                   0x00u
/** The SPI Handler/Driver manages only External Buffers */
#define USAGE1                                   0x01u
/** The SPI Handler/Driver manages both buffers types */
#define USAGE2                                   0x02u
/** Selects the SPI Handler Driver Channel Buffers usage allowed and delivered. */
#define SPI_CHANNEL_BUFFERS_ALLOWED              (USAGE2)

/** Simple Synchronous SPI Handler/Driver , only for MASTER mode*/
#define LEVEL0                                   0x00u
/** Basic Asynchronous SPI Handler/Driver */
#define LEVEL1                                   0x01u
/** Enhanced (Synchronous/Asynchronous) SPI Handler/Driver */
#define LEVEL2                                   0x02u
/** Selects the SPI Handler Driver level of scalable functionality that is available and delivered. */
#define SPI_LEVEL_DELIVERED                      (LEVEL2)

/** Switches the Spi_Cancel function ON or OFF. */
#define SPI_CANCEL_API                           (STD_ON)

/** Switches the development error detection and notification on or off */
#define SPI_DEV_ERROR_DETECT                     (STD_OFF)

/** Switches the Spi_GetHWUnitStatus function ON or OFF. */
#define SPI_HW_STATUS_API                        (STD_ON)

/** Switches the Interruptible Sequences handling functionality ON or OFF. */
#define SPI_INTERRUPTIBLE_SEQ_ALLOWED            (STD_ON)

/** Switches the Spi_GetVersionInfo function ON or OFF */
#define SPI_VERSION_INFO_API                     (STD_ON)

/** Specifies whether concurrent Spi_SyncTransmit() calls for different sequences shall be configurable on or off */
#define SPI_CONCURRENT_SYNCTRANSMIT_ENABLE       (STD_ON)

/** 
*   Switch the Spi driver optimization for sequences with only one job used status is on or off.
*   If status is on, there will require additional RAM memory for internal data caching , only used for Spi_SyncTransmit.
*/
#define SPI_ONEJOBSEQ_OPTIMIZE                   (STD_OFF)

#if (STD_ON == SPI_ONEJOBSEQ_OPTIMIZE)
    #define SPI_ONEJOBSEQ_BUFFER_SIZE            (0x5u)
    #define SPI_ONEJOBSEQCHANNEL_BUFFER_SIZE     (0x5u)
#endif

/** Defines the timeout value in Spi_SyncTransmit() or Spi_AsyncTransmit(). */
#define SPI_TIMEOUT_NUMBER                       (0x20000u)

/** Defines Number of Data to Transfer once */
#define SPI_TRANS_ONCE_LENGTH                    (0x14u)

/** Max number of data to transfer for DMA */
#define SPI_MAX_ROUND_CNT_OF_DMA                 (0xFFF0u)

/** Switch the DEM Event Error report status on or off */
#define SPI_DEM_EVENT_ERROR_REPORT_DISABLED      (STD_OFF) 

/**
*   Switch the big size collection function on or off.
*   If status is on, there will allow to configure more than 256 sequences, jobs and channels.
*/
#define SPI_EXTSIZE_COLLECTION_ENABLE            (STD_ON)

/** Defines the symbolic name to identify the HW SPI Hardware microcontroller peripheral allocated to this Job. */
#define SPI0                                     ((uint8)0u)
#define SPI_HWUNITCFG_NUM                        (1u)

/** HWUnits defined information */
#define SPI0_HWUNIT_CFG                          (SPI0)

/** Channel Attributes information */
#define SPI_CHANNELCFG_0                         ((Spi_ChannelType)0)
#define SPI_CHANNELCFG_1                         ((Spi_ChannelType)1)
#define SPI_CHANNELCFG_2                         ((Spi_ChannelType)2)

/** Maximum number of supported channels */
#define SPI_CHANNELCFG_NUM                       (3u)

/** Job Attributes information */
#define SPI_JOBCFG_0                             ((Spi_JobType)0)

/** Maximum number of supported jobs */
#define SPI_JOBCFG_NUM                           (1u)

/** Sequences configured information */
#define SPI_SEQUENCECFG_0                        ((Spi_SequenceType)0)
 
/** Maximum number of supported sequences */
#define SPI_SEQCFG_NUM                           (1u)

/** SPI external devices configurations */
#define SPI_EXTERNALDEVICE_0                     ((Spi_ExternalDeviceType)0u)

#define SPI_0_OFFSET_CFG                         0u

#define SPI_CFG_FIFOSIZE                         ((uint8)2u)

/** Defines the spi data type as uint8 , uint16. */
#define SPI_ACCESS_DATATYPE_8                    1u
#define SPI_ACCESS_DATATYPE_16                   2u

/** Defines the spi Data Size Configure used. ; */
/** Defines the spi Data Size Configure used.
*   STD_ON: spi data size as 8bits.
*   STD_OFF:spi data size as 16bits
*   Note: If spi data size as 16bits, SPI_TRANS_ONCE_LENGTH must be set to an even value.
*/
#define SPI_DATASIZE_CONFIG_8                    (STD_ON) 

/**@} end of group SPI_Macros */
#ifdef __cplusplus
}
#endif

#endif /*SPI_CFG_H*/

/**@} end of group SPI_Driver */
/**@} end of group G32A10xx_StdPeriphDriver */
