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

Go to the source code of this file.

Data Structures

struct  _EFI_SPI_PART
 
struct  _EFI_SPI_BUS
 
struct  _EFI_SPI_PERIPHERAL
 
struct  _EFI_SPI_CONFIGURATION_PROTOCOL
 

Macros

#define EFI_SPI_CONFIGURATION_GUID
 
#define Hz(Frequency)   (Frequency)
 
#define KHz(Frequency)   (1000 * Hz (Frequency))
 
#define MHz(Frequency)   (1000 * KHz (Frequency))
 
#define SPI_PART_SUPPORTS_2_BIT_DATA_BUS_WIDTH   BIT0
 
#define SPI_PART_SUPPORTS_4_BIT_DATA_BUS_WIDTH   BIT1
 
#define SPI_PART_SUPPORTS_8_BIT_DATA_BUS_WIDTH   BIT2
 

Typedefs

typedef struct _EFI_SPI_PERIPHERAL EFI_SPI_PERIPHERAL
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_CHIP_SELECT) (IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, IN BOOLEAN PinValue)
 
typedef EFI_STATUS(EFIAPI * EFI_SPI_CLOCK) (IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, IN UINT32 *ClockHz)
 
typedef struct _EFI_SPI_PART EFI_SPI_PART
 
typedef struct _EFI_SPI_BUS EFI_SPI_BUS
 
typedef struct _EFI_SPI_CONFIGURATION_PROTOCOL EFI_SPI_CONFIGURATION_PROTOCOL
 

Variables

EFI_GUID gEfiSpiConfigurationProtocolGuid
 

Detailed Description

This file defines the SPI Configuration 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 SpiConfiguration.h.

Macro Definition Documentation

◆ EFI_SPI_CONFIGURATION_GUID

#define EFI_SPI_CONFIGURATION_GUID
Value:
{ 0x85a6d3e6, 0xb65b, 0x4afc, \
{ 0xb3, 0x8f, 0xc6, 0xd5, 0x4a, 0xf6, 0xdd, 0xc8 }}

Global ID for the SPI Configuration Protocol

Definition at line 19 of file SpiConfiguration.h.

◆ Hz

#define Hz (   Frequency)    (Frequency)

Macros to easily specify frequencies in hertz, kilohertz and megahertz.

Definition at line 26 of file SpiConfiguration.h.

◆ KHz

#define KHz (   Frequency)    (1000 * Hz (Frequency))

Definition at line 27 of file SpiConfiguration.h.

◆ MHz

#define MHz (   Frequency)    (1000 * KHz (Frequency))

Definition at line 28 of file SpiConfiguration.h.

◆ SPI_PART_SUPPORTS_2_BIT_DATA_BUS_WIDTH

#define SPI_PART_SUPPORTS_2_BIT_DATA_BUS_WIDTH   BIT0

Definitions of SPI Part Attributes.

Definition at line 175 of file SpiConfiguration.h.

◆ SPI_PART_SUPPORTS_4_BIT_DATA_BUS_WIDTH

#define SPI_PART_SUPPORTS_4_BIT_DATA_BUS_WIDTH   BIT1

Definition at line 176 of file SpiConfiguration.h.

◆ SPI_PART_SUPPORTS_8_BIT_DATA_BUS_WIDTH

#define SPI_PART_SUPPORTS_8_BIT_DATA_BUS_WIDTH   BIT2

Definition at line 177 of file SpiConfiguration.h.

Typedef Documentation

◆ EFI_SPI_BUS

typedef struct _EFI_SPI_BUS EFI_SPI_BUS

The EFI_SPI_BUS data structure provides the connection details between the physical SPI bus and the EFI_SPI_HC_PROTOCOL instance which controls that SPI bus. This data structure also describes the details of how the clock is generated for that SPI bus. Finally this data structure provides the list of physical SPI devices which are attached to the SPI bus.

◆ EFI_SPI_CHIP_SELECT

typedef EFI_STATUS(EFIAPI * EFI_SPI_CHIP_SELECT) (IN CONST EFI_SPI_PERIPHERAL *SpiPeripheral, IN BOOLEAN PinValue)

Manipulate the chip select for a SPI device.

This routine must be called at or below 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]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 operation.
[in]PinValueThe value to be applied to the chip select line of the SPI peripheral.
Return values
EFI_SUCCESSThe chip select was set successfully
EFI_NOT_READYSupport for the chip select is not properly initialized
EFI_INVALID_PARAMETERThe SpiPeripheral->ChipSelectParameter value is invalid

Definition at line 57 of file SpiConfiguration.h.

◆ EFI_SPI_CLOCK

typedef EFI_STATUS(EFIAPI * EFI_SPI_CLOCK) (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 must be called at or below TPL_NOTIFY. This routine updates the clock generator to generate the correct frequency and polarity for the SPI clock.

Parameters
[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 clock generator 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 clock generator 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 88 of file SpiConfiguration.h.

◆ EFI_SPI_CONFIGURATION_PROTOCOL

Describe the details of the board's SPI busses to the SPI driver stack. The board layer uses the EFI_SPI_CONFIGURATION_PROTOCOL to expose the data tables which describe the board's SPI busses, The SPI bus layer uses these tables to configure the clock, chip select and manage the SPI transactions on the SPI controllers.

◆ EFI_SPI_PART

typedef struct _EFI_SPI_PART EFI_SPI_PART

The EFI_SPI_PART data structure provides a description of a SPI part which is independent of the use on the board. This data is available directly from the part's datasheet and may be provided by the vendor.

◆ EFI_SPI_PERIPHERAL

Definition at line 30 of file SpiConfiguration.h.