/*
 * SPDX-FileCopyrightText: Copyright (c) 2020-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
 *
 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
 * property and proprietary rights in and to this material, related
 * documentation and any modifications thereto. Any use, reproduction,
 * disclosure or distribution of this material and related documentation
 * without an express license agreement from NVIDIA CORPORATION or
 * its affiliates is strictly prohibited.
 */

#ifndef GPIO__GPIO_ERROR_H
#define GPIO__GPIO_ERROR_H
#define FSP__GPIO__GPIO_ERROR_H   1

/* Compiler headers */

/* Early FSP headers */
#include <misc/ct-assert.h>               // for CT_ASSERT

/* Hardware headers */

/* Late FSP headers */
// IWYU pragma: no_include "base/module-id.h"
#include <base/module-id.h>               // IWYU pragma: export
#include <misc/macros.h>                  // for START_RFD_BLOCK, END_RFD_BLOCK, INLINE_RFD

/*
 * Compile-time check for FSP header files
 *   Each FSP header file contains a signature unique to that file, and the
 *   FSP project.  The CT_ASSERT macro (contained in misc/ct-assert.h) can
 *   check for this signature.  If it does not exist, then the build will
 *   abort.
 *
 *   This is a trap for projects which have their own include files of the
 *   same names, but different contents.  This trap ensures that only the
 *   files from the FSP project, are built into the FSP source code.
 */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
START_RFD_BLOCK(MISRA, DEVIATE, Rule_1_2, "Approval: Bug 200531996, DR: SWE-FSP-009-SWSADR.docx",
                MISRA, DEVIATE, Rule_2_3, "Approval:  On-file, DR: SWE-FSP-010-SWSADR.docx",
                MISRA, DEVIATE, Directive_4_9, "Approval: Bug 200531995, DR: SWE-FSP-012-SWSADR.docx")
CT_ASSERT(FSP__BASE__MODULE_ID_H, "Header file missing or invalid.")
CT_ASSERT(FSP__MISC__MACROS_H, "Header file missing or invalid.")
END_RFD_BLOCK(MISRA, DEVIATE, Rule_1_2, "Approval: Bug 200531996, DR: SWE-FSP-009-SWSADR.docx",
              MISRA, DEVIATE, Rule_2_3, "Approval:  On-file, DR: SWE-FSP-010-SWSADR.docx",
              MISRA, DEVIATE, Directive_4_9, "Approval: Bug 200531995, DR: SWE-FSP-012-SWSADR.docx")
#endif

/**
 * @defgroup GPIO_Errors GPIO error macros
 * @brief Define GPIO specific error codes.
 * @{
 */
/** Error returned for invalid IRQ number */
#define E_GPIO_INVALID_GPIO_IRQ           MODULE_ERROR(GPIO, 1UL)
/** Error returned for invalid/NULL IRQ handler */
#define E_GPIO_INVALID_IRQ_HANDLER        MODULE_ERROR(GPIO, 2UL)
/** Error returned for invalid IRQ type */
#define E_GPIO_INVALID_IRQ_TYPE           MODULE_ERROR(GPIO, 3UL)
/** Error returned for invalid IRQ level */
#define E_GPIO_INVALID_IRQ_LEVEL          MODULE_ERROR(GPIO, 4UL)
/** Error returned for invalid GPIO number */
#define E_GPIO_INVALID_GPIO               MODULE_ERROR(GPIO, 5UL)
/** Error returned for invalid controller ID value */
#define E_GPIO_INVALID_GPIO_CTRL_ID       MODULE_ERROR(GPIO, 6UL)
/** Error returned for invalid/NULL controller data */
#define E_GPIO_INVALID_CTRL_DATA          MODULE_ERROR(GPIO, 7UL)
/** Error returned for NULL input parameters */
#define E_GPIO_NULL_INPUT_PARAMETER       MODULE_ERROR(GPIO, 8UL)
/** Error returned if the request is forbidden for the current state of the GPIO */
#define E_GPIO_INVALID_CFQ_REQ            MODULE_ERROR(GPIO, 9UL)
/** @} */
#endif  /* GPIO__GPIO_ERRORS_H */

