2020-03-03 04:58:57 +03:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
// Licensed under the MIT license.
|
|
|
|
|
|
|
|
#ifndef HOST_IRQ_CONTROL_H_
|
|
|
|
#define HOST_IRQ_CONTROL_H_
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "status/rot_status.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* API for controlling the processing of host IRQs.
|
|
|
|
*/
|
|
|
|
struct host_irq_control {
|
|
|
|
/**
|
|
|
|
* Enable or disable the IRQ that indicates when a host processor has left the reset state.
|
|
|
|
*
|
|
|
|
* @param control The API for the IRQs to update.
|
|
|
|
* @param enable true to enable the IRQ or false to disable it.
|
|
|
|
*
|
|
|
|
* @return 0 if the IRQ was updated successfully or an error code.
|
|
|
|
*/
|
2023-05-17 06:47:18 +03:00
|
|
|
int (*enable_exit_reset) (const struct host_irq_control *control, bool enable);
|
2020-03-03 04:58:57 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable or disable the IRQ that indicates when SPI chip selects have been asserted by the
|
|
|
|
* host.
|
|
|
|
*
|
|
|
|
* @param control The API for the IRQs to update.
|
|
|
|
* @param enable true to enable the IRQs or false to disable them.
|
|
|
|
*
|
|
|
|
* @return 0 if the IRQs were updated successfully or an error code.
|
|
|
|
*/
|
2023-05-17 06:47:18 +03:00
|
|
|
int (*enable_chip_selects) (const struct host_irq_control *control, bool enable);
|
2020-03-03 04:58:57 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Enable or disable IRQ notifications for enabled interrupts.
|
|
|
|
*
|
|
|
|
* This call cannot fail, but it will have no effect if the API instance is null.
|
|
|
|
*
|
|
|
|
* @param control The API for the IRQs to update.
|
|
|
|
* @param enable true to enable IRQ notifications or false to disable them.
|
|
|
|
*/
|
2023-05-17 06:47:18 +03:00
|
|
|
void (*enable_notifications) (const struct host_irq_control *control, bool enable);
|
2020-03-03 04:58:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define HOST_IRQ_CTRL_ERROR(code) ROT_ERROR (ROT_MODULE_HOST_IRQ_CTRL, code)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Error codes that can be generated by an IRQ control driver.
|
|
|
|
*/
|
|
|
|
enum {
|
2020-05-12 03:36:57 +03:00
|
|
|
HOST_IRQ_CTRL_INVALID_ARGUMENT = HOST_IRQ_CTRL_ERROR (0x00), /**< Input parameter is null or not valid. */
|
|
|
|
HOST_IRQ_CTRL_NO_MEMORY = HOST_IRQ_CTRL_ERROR (0x01), /**< Memory allocation failed. */
|
|
|
|
HOST_IRQ_CTRL_EXIT_RESET_FAILED = HOST_IRQ_CTRL_ERROR (0x02), /**< Exit reset IRQ has not been enabled/disabled. */
|
|
|
|
HOST_IRQ_CTRL_CHIP_SEL_FAILED = HOST_IRQ_CTRL_ERROR (0x03), /**< Chip select IRQs have not been enabled/disabled. */
|
|
|
|
HOST_IRQ_CTRL_IRQ_NOT_SUPPORTED = HOST_IRQ_CTRL_ERROR (0x04), /**< The type of IRQ is not supported by the driver. */
|
2020-03-03 04:58:57 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-05-16 08:19:56 +03:00
|
|
|
#endif /* HOST_IRQ_CONTROL_H_ */
|