TianoCore EDK2 master
Loading...
Searching...
No Matches
SpiHc.h File Reference

Go to the source code of this file.

Data Structures

struct  _EFI_SPI_HC_PROTOCOL
 

Macros

#define EFI_SPI_HOST_GUID
 
#define EFI_SPI_HC_PROTOCOL_GUID   EFI_SPI_HOST_GUID
 
#define HC_SUPPORTS_WRITE_ONLY_OPERATIONS   BIT0
 
#define HC_SUPPORTS_READ_ONLY_OPERATIONS   BIT1
 
#define HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS   BIT2
 
#define HC_TX_FRAME_IN_MOST_SIGNIFICANT_BITS   BIT3
 
#define HC_RX_FRAME_IN_MOST_SIGNIFICANT_BITS   BIT4
 
#define HC_SUPPORTS_2_BIT_DATA_BUS_WIDTH   BIT5
 
#define HC_SUPPORTS_4_BIT_DATA_BUS_WIDTH   BIT6
 
#define HC_SUPPORTS_8_BIT_DATA_BUS_WIDTH   BIT7
 
#define HC_TRANSFER_SIZE_INCLUDES_OPCODE   BIT8
 
#define HC_TRANSFER_SIZE_INCLUDES_ADDRESS   BIT9
 

Typedefs

typedef struct _EFI_SPI_HC_PROTOCOL EFI_SPI_HC_PROTOCOL
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_HC_PROTOCOL_CHIP_SELECT) (IN CONST EFI_SPI_HC_PROTOCOL *This, IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, IN BOOLEAN PinValue)
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_HC_PROTOCOL_CLOCK) (IN CONST EFI_SPI_HC_PROTOCOL *This, IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, IN UINT32 *ClockHz)
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_HC_PROTOCOL_TRANSACTION) (IN CONST EFI_SPI_HC_PROTOCOL *This, IN EFI_SPI_BUS_TRANSACTION *BusTransaction)
 

Variables

EFI_GUID gEfiSpiHcProtocolGuid
 

Detailed Description

This file defines the SPI Host Controller Protocol.

Copyright (c) 2017, Intel Corporation. All rights reserved.
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent

Revision Reference:
This Protocol was introduced in UEFI PI Specification 1.8 A.

Definition in file SpiHc.h.

Macro Definition Documentation

◆ EFI_SPI_HC_PROTOCOL_GUID

#define EFI_SPI_HC_PROTOCOL_GUID   EFI_SPI_HOST_GUID

EDK2-style name

Definition at line 29 of file SpiHc.h.

◆ EFI_SPI_HOST_GUID

#define EFI_SPI_HOST_GUID
Value:
{ 0xc74e5db2, 0xfa96, 0x4ae2, \
{ 0xb3, 0x99, 0x15, 0x97, 0x7f, 0xe3, 0x0, 0x2d }}

Global ID for the SPI Host Controller Protocol

Definition at line 22 of file SpiHc.h.

◆ HC_RX_FRAME_IN_MOST_SIGNIFICANT_BITS

#define HC_RX_FRAME_IN_MOST_SIGNIFICANT_BITS   BIT4

Definition at line 132 of file SpiHc.h.

◆ HC_SUPPORTS_2_BIT_DATA_BUS_WIDTH

#define HC_SUPPORTS_2_BIT_DATA_BUS_WIDTH   BIT5

Definition at line 133 of file SpiHc.h.

◆ HC_SUPPORTS_4_BIT_DATA_BUS_WIDTH

#define HC_SUPPORTS_4_BIT_DATA_BUS_WIDTH   BIT6

Definition at line 134 of file SpiHc.h.

◆ HC_SUPPORTS_8_BIT_DATA_BUS_WIDTH

#define HC_SUPPORTS_8_BIT_DATA_BUS_WIDTH   BIT7

Definition at line 135 of file SpiHc.h.

◆ HC_SUPPORTS_READ_ONLY_OPERATIONS

#define HC_SUPPORTS_READ_ONLY_OPERATIONS   BIT1

Definition at line 129 of file SpiHc.h.

◆ HC_SUPPORTS_WRITE_ONLY_OPERATIONS

#define HC_SUPPORTS_WRITE_ONLY_OPERATIONS   BIT0

Definitions of SPI Host Controller Attributes.

Definition at line 128 of file SpiHc.h.

◆ HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS

#define HC_SUPPORTS_WRITE_THEN_READ_OPERATIONS   BIT2

Definition at line 130 of file SpiHc.h.

◆ HC_TRANSFER_SIZE_INCLUDES_ADDRESS

#define HC_TRANSFER_SIZE_INCLUDES_ADDRESS   BIT9

Definition at line 137 of file SpiHc.h.

◆ HC_TRANSFER_SIZE_INCLUDES_OPCODE

#define HC_TRANSFER_SIZE_INCLUDES_OPCODE   BIT8

Definition at line 136 of file SpiHc.h.

◆ HC_TX_FRAME_IN_MOST_SIGNIFICANT_BITS

#define HC_TX_FRAME_IN_MOST_SIGNIFICANT_BITS   BIT3

Definition at line 131 of file SpiHc.h.

Typedef Documentation

◆ EFI_SPI_HC_PROTOCOL

Definition at line 31 of file SpiHc.h.

◆ EFI_SPI_HC_PROTOCOL_CHIP_SELECT

typedef EFI_STATUS(EFIAPI * EFI_SPI_HC_PROTOCOL_CHIP_SELECT) (IN CONST EFI_SPI_HC_PROTOCOL *This, IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, IN BOOLEAN PinValue)

Assert or deassert the SPI chip select.

This routine is called at TPL_NOTIFY. Update the value of the chip select line for a SPI peripheral. The SPI bus layer calls this routine either in the board layer or in the SPI controller to manipulate the chip select pin at the start and end of a SPI transaction.

Parameters
[in]ThisPointer to an EFI_SPI_HC_PROTOCOL structure.
[in]SpiPeripheralThe address of an EFI_SPI_PERIPHERAL data structure describing the SPI peripheral whose chip select pin is to be manipulated. The routine may access the ChipSelectParameter field to gain sufficient context to complete the operati on.
[in]PinValueThe value to be applied to the chip select line of the SPI peripheral.
Return values
EFI_SUCCESSThe chip select was set as requested
EFI_NOT_READYSupport for the chip select is not properly initialized
EFI_INVALID_PARAMETERThe ChipSeLect value or its contents are invalid

Definition at line 57 of file SpiHc.h.

◆ EFI_SPI_HC_PROTOCOL_CLOCK

typedef EFI_STATUS(EFIAPI * EFI_SPI_HC_PROTOCOL_CLOCK) (IN CONST EFI_SPI_HC_PROTOCOL *This, IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, IN UINT32 *ClockHz)

Set up the clock generator to produce the correct clock frequency, phase and polarity for a SPI chip.

This routine is called at TPL_NOTIFY. This routine updates the clock generator to generate the correct frequency and polarity for the SPI clock.

Parameters
[in]ThisPointer to an EFI_SPI_HC_PROTOCOL structure.
[in]SpiPeripheralPointer to a EFI_SPI_PERIPHERAL data structure from which the routine can access the ClockParameter, ClockPhase and ClockPolarity fields. The routine also has access to the names for the SPI bus and chip which can be used during debugging.
[in]ClockHzPointer to the requested clock frequency. The SPI host controller will choose a supported clock frequency which is less then or equal to this value. Specify zero to turn the clock generator off. The actual clock frequency supported by the SPI host controller will be returned.
Return values
EFI_SUCCESSThe clock was set up successfully
EFI_UNSUPPORTEDThe SPI controller was not able to support the frequency requested by ClockHz

Definition at line 90 of file SpiHc.h.

◆ EFI_SPI_HC_PROTOCOL_TRANSACTION

typedef EFI_STATUS(EFIAPI * EFI_SPI_HC_PROTOCOL_TRANSACTION) (IN CONST EFI_SPI_HC_PROTOCOL *This, IN EFI_SPI_BUS_TRANSACTION *BusTransaction)

Perform the SPI transaction on the SPI peripheral using the SPI host controller.

This routine is called at TPL_NOTIFY. This routine synchronously returns EFI_SUCCESS indicating that the asynchronous SPI transaction was started. The routine then waits for completion of the SPI transaction prior to returning the final transaction status.

Parameters
[in]ThisPointer to an EFI_SPI_HC_PROTOCOL structure.
[in]BusTransactionPointer to a EFI_SPI_BUS_ TRANSACTION containing the description of the SPI transaction to perform.
Return values
EFI_SUCCESSThe transaction completed successfully
EFI_BAD_BUFFER_SIZEThe BusTransaction->WriteBytes value is invalid, or the BusTransaction->ReadinBytes value is invalid
EFI_UNSUPPORTEDThe BusTransaction-> Transaction Type is unsupported

Definition at line 119 of file SpiHc.h.