Mistake on this page?
Report an issue in GitHub or email us
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
Hal

Modules

 Analogin hal functions
 
 Analogout hal functions
 
 Hardware CRC
 The Hardware CRC HAL API provides a low-level interface to the Hardware CRC module of a target platform.
 
 Critical Section HAL functions
 
 Flash HAL API
 
 GPIO HAL functions
 

Defined behavior


 
 GPIO IRQ HAL functions
 
 I2C Events Macros
 
 I2C Configuration Functions
 
 Synchronous I2C Hardware Abstraction Layer for slave
 
 Asynchronous I2C Hardware Abstraction Layer
 
 Instrumented Trace Macrocell HAL API
 
 Low Power Ticker
 Low level interface to the low power ticker of a target.
 
 MPU hal
 The MPU hal provides a simple MPU API to enhance device security by preventing execution from ram.
 
 Port HAL functions
 
 Pwmout hal functions
 
 QSPI HAL
 
 RTC hal
 The RTC hal provides a low level interface to the Real Time Counter (RTC) of a target.
 
 Serial TX Events Macros
 
 Serial RX Events Macros
 
 Serial Configuration Functions
 
 Asynchronous Serial Hardware Abstraction Layer
 
 sleep hal requirements
 Low level interface to the sleep mode of a target.
 
 Serial Peripheral Interface
 

Behaviours

Defined Behaviours


 
 spi hal tests
 The SPI tests to check the implementation against the defined behavior.
 
 Asynchronous SPI Hardware Abstraction Layer
 
 SPM HAL API
 The HAL functions for PSA SPM.
 
 Ticker HAL functions
 
 TRNG hal functions
 
 Microsecond Ticker
 Low level interface to the microsecond ticker of a target.
 
 Watchdog HAL API
 Low-level interface to the Independent Watchdog Timer of a target.
 

Data Structures

struct  buffer_s
 Generic buffer structure. More...
 
struct  CAN_Message
 Holder for single CAN message. More...
 
struct  crc_mbed_config
 
struct  i2c_t
 Asynch I2C HAL structure. More...
 
class  LowPowerTickerWrapper
 
struct  PinMap
 
struct  PinList
 
struct  serial_t
 Asynch serial HAL structure. More...
 
struct  spi_capabilities_t
 Describes the capabilities of a SPI peripherals. More...
 
struct  _spi_async_event_t
 Event data reported to interrupt's callback. More...
 
struct  _ARM_DRIVER_VERSION
 Driver Version. More...
 
struct  _ARM_STORAGE_BLOCK_ATTRIBUTES
 Attributes of the storage range within a storage block. More...
 
struct  _ARM_STORAGE_BLOCK
 A storage block is a range of memory with uniform attributes. More...
 
struct  _ARM_STORAGE_SECURITY_FEATURES
 Device Data Security Protection Features. More...
 
struct  _ARM_STORAGE_INFO
 Storage information. More...
 
struct  _ARM_STORAGE_STATUS
 Operating status of the storage controller. More...
 
struct  _ARM_STORAGE_CAPABILITIES
 Storage Driver API Capabilities. More...
 
struct  _ARM_DRIVER_STORAGE
 This is the set of operations constituting the Storage driver. More...
 
struct  ticker_event_s
 Ticker's event structure. More...
 
struct  ticker_info_t
 Information about the ticker implementation. More...
 
struct  ticker_interface_t
 Ticker's interface structure - required API for a ticker. More...
 
struct  ticker_event_queue_t
 Ticker's event queue structure. More...
 
struct  ticker_data_t
 Ticker's data structure. More...
 

Macros

#define ARM_DRIVER_OK   0
 Operation succeeded. More...
 
#define ARM_DRIVER_ERROR   -1
 Unspecified error. More...
 
#define ARM_DRIVER_ERROR_BUSY   -2
 Driver is busy. More...
 
#define ARM_DRIVER_ERROR_TIMEOUT   -3
 Timeout occurred. More...
 
#define ARM_DRIVER_ERROR_UNSUPPORTED   -4
 Operation not supported. More...
 
#define ARM_DRIVER_ERROR_PARAMETER   -5
 Parameter error. More...
 
#define ARM_DRIVER_ERROR_SPECIFIC   -6
 Start of driver specific errors. More...
 
#define ARM_STORAGE_INVALID_OFFSET   (0xFFFFFFFFFFFFFFFFULL)
 Invalid address (relative to a storage controller's. More...
 
#define ARM_STORAGE_INVALID_ADDRESS   (0xFFFFFFFFUL)
 Invalid address within the processor's memory address space. More...
 
#define ARM_STORAGE_ERROR_NOT_ERASABLE   (ARM_DRIVER_ERROR_SPECIFIC - 1)
 Part (or all) of the range provided to Erase() isn't erasable. More...
 
#define ARM_STORAGE_ERROR_NOT_PROGRAMMABLE   (ARM_DRIVER_ERROR_SPECIFIC - 2)
 Part (or all) of the range provided to ProgramData() isn't programmable. More...
 
#define ARM_STORAGE_ERROR_PROTECTED   (ARM_DRIVER_ERROR_SPECIFIC - 3)
 Part (or all) of the range to Erase() or ProgramData() is protected. More...
 
#define ARM_STORAGE_ERROR_RUNTIME_OR_INTEGRITY_FAILURE   (ARM_DRIVER_ERROR_SPECIFIC - 4)
 Runtime or sanity-check failure. More...
 
#define ARM_STORAGE_VALID_BLOCK(BLK)   (((BLK)->addr != ARM_STORAGE_INVALID_OFFSET) && ((BLK)->size != 0))
 The check for a valid ARM_STORAGE_BLOCK. More...
 
#define ARM_STORAGE_PROGRAMMABILITY_RAM   (0x0)
 Values for encoding storage memory-types with respect to programmability. More...
 
#define ARM_STORAGE_PROGRAMMABILITY_ROM   (0x1)
 Read-only memory. More...
 
#define ARM_STORAGE_PROGRAMMABILITY_WORM   (0x2)
 write-once-read-only-memory (WORM). More...
 
#define ARM_STORAGE_PROGRAMMABILITY_ERASABLE   (0x3)
 re-programmable based on erase. Supports multiple writes. More...
 
#define ARM_RETENTION_WHILE_DEVICE_ACTIVE   (0x0)
 Values for encoding data-retention levels for storage blocks. More...
 
#define ARM_RETENTION_ACROSS_SLEEP   (0x1)
 Data is retained across processor sleep. More...
 
#define ARM_RETENTION_ACROSS_DEEP_SLEEP   (0x2)
 Data is retained across processor deep-sleep. More...
 
#define ARM_RETENTION_BATTERY_BACKED   (0x3)
 Data is battery-backed. Device can be powered off. More...
 
#define ARM_RETENTION_NVM   (0x4)
 Data is retained in non-volatile memory. More...
 
#define ARM_STORAGE_PROGRAM_CYCLES_INFINITE   (0UL)
 Infinite or unknown endurance for reprogramming. More...
 

Typedefs

typedef struct analogin_s analogin_t
 Analogin hal structure. More...
 
typedef struct dac_s dac_t
 Analogout hal structure. More...
 
typedef struct buffer_s buffer_t
 Generic buffer structure. More...
 
typedef enum crc_polynomial crc_polynomial_t
 CRC Polynomial value. More...
 
typedef struct gpio_irq_s gpio_irq_t
 GPIO IRQ HAL structure. More...
 
typedef struct port_s port_t
 Port HAL structure. More...
 
typedef struct pwmout_s pwmout_t
 Pwmout hal structure. More...
 
typedef enum _spi_mode_t spi_mode_t
 SPI modes. More...
 
typedef enum _spi_bit_ordering_t spi_bit_ordering_t
 SPI bit ordering. More...
 
typedef struct _spi_async_event_t spi_async_event_t
 Event data reported to interrupt's callback. More...
 
typedef void(* spi_async_handler_f) (spi_t *obj, void *ctx, spi_async_event_t *event)
 Interrupt callback signature. More...
 
typedef struct _ARM_DRIVER_VERSION ARM_DRIVER_VERSION
 Driver Version. More...
 
typedef enum _ARM_POWER_STATE ARM_POWER_STATE
 General power states. More...
 
typedef struct _ARM_STORAGE_BLOCK_ATTRIBUTES ARM_STORAGE_BLOCK_ATTRIBUTES
 Attributes of the storage range within a storage block. More...
 
typedef struct _ARM_STORAGE_BLOCK ARM_STORAGE_BLOCK
 A storage block is a range of memory with uniform attributes. More...
 
typedef struct _ARM_STORAGE_SECURITY_FEATURES ARM_STORAGE_SECURITY_FEATURES
 Device Data Security Protection Features. More...
 
typedef struct _ARM_STORAGE_INFO ARM_STORAGE_INFO
 Storage information. More...
 
typedef struct _ARM_STORAGE_STATUS ARM_STORAGE_STATUS
 Operating status of the storage controller. More...
 
typedef struct _ARM_STORAGE_CAPABILITIES ARM_STORAGE_CAPABILITIES
 Storage Driver API Capabilities. More...
 
typedef enum _ARM_STORAGE_OPERATION ARM_STORAGE_OPERATION
 Command opcodes for Storage. More...
 
typedef void(* ARM_Storage_Callback_t) (int32_t status, ARM_STORAGE_OPERATION operation)
 Declaration of the callback-type for command completion. More...
 
typedef struct _ARM_DRIVER_STORAGE ARM_DRIVER_STORAGE
 This is the set of operations constituting the Storage driver. More...
 
typedef uint32_t timestamp_t
 Legacy format representing a timestamp in us. More...
 
typedef uint64_t us_timestamp_t
 A us timestamp stored in a 64 bit integer. More...
 
typedef struct ticker_event_s ticker_event_t
 Ticker's event structure. More...
 
typedef struct trng_s trng_t
 TRNG HAL structure. More...
 

Enumerations

Functions

const PinMapcan_rd_pinmap (void)
 Get the pins that support CAN RD. More...
 
const PinMapcan_td_pinmap (void)
 Get the pins that support CAN TD. More...
 
void lp_ticker_wrapper_irq_handler (ticker_irq_handler_type handler)
 Interrupt handler for the wrapped lp ticker. More...
 
const ticker_data_tget_lp_ticker_wrapper_data (const ticker_data_t *data)
 Get wrapped lp ticker data. More...
 
void lp_ticker_wrapper_suspend (void)
 Suspend the wrapper layer code. More...
 
void lp_ticker_wrapper_resume (void)
 Resume the wrapper layer code. More...
 
bool pinmap_find_peripheral_pins (const PinList *whitelist, const PinList *blacklist, int per, const PinMap *const *maps, PinName **pins, uint32_t count)
 Find a combination of pins suitable for use given the constraints. More...
 
bool pinmap_list_has_pin (const PinList *list, PinName pin)
 Check if the pin is in the list. More...
 
const PinListpinmap_restricted_pins (void)
 Get the pin list of pins to avoid during testing. More...
 
SPIName spi_get_module (PinName mosi, PinName miso, PinName mclk)
 Returns a variant of the SPIName enum uniquely identifying a SPI peripheral of the device. More...
 
void spi_get_capabilities (SPIName name, PinName ssel, bool slave, spi_capabilities_t *cap)
 Fills the given spi_capabilities_t structure with the capabilities of the given peripheral. More...
 
void spi_init (spi_t *obj, bool is_slave, PinName mosi, PinName miso, PinName mclk, PinName ssel)
 Initialized a spi peripheral. More...
 
void spi_format (spi_t *obj, uint8_t bits, spi_mode_t mode, spi_bit_ordering_t bit_ordering)
 Configure the format to be used by the SPI peripheral. More...
 
uint32_t spi_frequency (spi_t *obj, uint32_t hz)
 Set the frequency target. More...
 
uint32_t spi_transfer (spi_t *obj, const void *tx, uint32_t tx_len, void *rx, uint32_t rx_len, const void *fill_symbol)
 Transfer data blocking until the end of the operation. More...
 
const PinMapspi_master_mosi_pinmap (void)
 Get the pins that support SPI MOSI. More...
 
const PinMapspi_master_miso_pinmap (void)
 Get the pins that support SPI MISO. More...
 
const PinMapspi_master_clk_pinmap (void)
 Get the pins that support SPI CLK. More...
 
const PinMapspi_master_cs_pinmap (void)
 Get the pins that support SPI CS. More...
 
const PinMapspi_slave_mosi_pinmap (void)
 Get the pins that support SPI MOSI. More...
 
const PinMapspi_slave_miso_pinmap (void)
 Get the pins that support SPI MISO. More...
 
const PinMapspi_slave_clk_pinmap (void)
 Get the pins that support SPI CLK. More...
 
const PinMapspi_slave_cs_pinmap (void)
 Get the pins that support SPI CS. More...
 
USBPhyget_usb_phy ()
 Return a the USBPhy instance for this hardware. More...
 

Detailed Description

Macro Definition Documentation

#define ARM_DRIVER_ERROR   -1

Unspecified error.

Definition at line 42 of file Driver_Common.h.

#define ARM_DRIVER_ERROR_BUSY   -2

Driver is busy.

Definition at line 43 of file Driver_Common.h.

#define ARM_DRIVER_ERROR_PARAMETER   -5

Parameter error.

Definition at line 46 of file Driver_Common.h.

#define ARM_DRIVER_ERROR_SPECIFIC   -6

Start of driver specific errors.

Definition at line 47 of file Driver_Common.h.

#define ARM_DRIVER_ERROR_TIMEOUT   -3

Timeout occurred.

Definition at line 44 of file Driver_Common.h.

#define ARM_DRIVER_ERROR_UNSUPPORTED   -4

Operation not supported.

Definition at line 45 of file Driver_Common.h.

#define ARM_DRIVER_OK   0

Operation succeeded.

Definition at line 41 of file Driver_Common.h.

#define ARM_RETENTION_ACROSS_DEEP_SLEEP   (0x2)

Data is retained across processor deep-sleep.

Definition at line 115 of file Driver_Storage.h.

#define ARM_RETENTION_ACROSS_SLEEP   (0x1)

Data is retained across processor sleep.

Definition at line 114 of file Driver_Storage.h.

#define ARM_RETENTION_BATTERY_BACKED   (0x3)

Data is battery-backed. Device can be powered off.

Definition at line 116 of file Driver_Storage.h.

#define ARM_RETENTION_NVM   (0x4)

Data is retained in non-volatile memory.

Definition at line 117 of file Driver_Storage.h.

#define ARM_RETENTION_WHILE_DEVICE_ACTIVE   (0x0)

Values for encoding data-retention levels for storage blocks.

Please ensure that the maximum of the following retention types doesn't exceed 16; we encode this in a 4-bit field within ARM_STORAGE_INFO::retention_level.Data is retained only during device activity.

Definition at line 113 of file Driver_Storage.h.

#define ARM_STORAGE_ERROR_NOT_ERASABLE   (ARM_DRIVER_ERROR_SPECIFIC - 1)

Part (or all) of the range provided to Erase() isn't erasable.

Definition at line 47 of file Driver_Storage.h.

#define ARM_STORAGE_ERROR_NOT_PROGRAMMABLE   (ARM_DRIVER_ERROR_SPECIFIC - 2)

Part (or all) of the range provided to ProgramData() isn't programmable.

Definition at line 48 of file Driver_Storage.h.

#define ARM_STORAGE_ERROR_PROTECTED   (ARM_DRIVER_ERROR_SPECIFIC - 3)

Part (or all) of the range to Erase() or ProgramData() is protected.

Definition at line 49 of file Driver_Storage.h.

#define ARM_STORAGE_ERROR_RUNTIME_OR_INTEGRITY_FAILURE   (ARM_DRIVER_ERROR_SPECIFIC - 4)

Runtime or sanity-check failure.

Definition at line 50 of file Driver_Storage.h.

#define ARM_STORAGE_INVALID_ADDRESS   (0xFFFFFFFFUL)

Invalid address within the processor's memory address space.

Refer to memory-mapped storage, i.e. < ARM_DRIVER_STORAGE::ResolveAddress().

Definition at line 43 of file Driver_Storage.h.

#define ARM_STORAGE_INVALID_OFFSET   (0xFFFFFFFFFFFFFFFFULL)

Invalid address (relative to a storage controller's.

address space). A storage block may never start at this address.

Definition at line 40 of file Driver_Storage.h.

#define ARM_STORAGE_PROGRAM_CYCLES_INFINITE   (0UL)

Infinite or unknown endurance for reprogramming.

Definition at line 141 of file Driver_Storage.h.

#define ARM_STORAGE_PROGRAMMABILITY_ERASABLE   (0x3)

re-programmable based on erase. Supports multiple writes.

Definition at line 105 of file Driver_Storage.h.

#define ARM_STORAGE_PROGRAMMABILITY_RAM   (0x0)

Values for encoding storage memory-types with respect to programmability.

Please ensure that the maximum of the following memory types doesn't exceed 16; we encode this in a 4-bit field within ARM_STORAGE_INFO::programmability.

Definition at line 102 of file Driver_Storage.h.

#define ARM_STORAGE_PROGRAMMABILITY_ROM   (0x1)

Read-only memory.

Definition at line 103 of file Driver_Storage.h.

#define ARM_STORAGE_PROGRAMMABILITY_WORM   (0x2)

write-once-read-only-memory (WORM).

Definition at line 104 of file Driver_Storage.h.

#define ARM_STORAGE_VALID_BLOCK (   BLK)    (((BLK)->addr != ARM_STORAGE_INVALID_OFFSET) && ((BLK)->size != 0))

The check for a valid ARM_STORAGE_BLOCK.

Definition at line 94 of file Driver_Storage.h.

Typedef Documentation

typedef struct analogin_s analogin_t

Analogin hal structure.

analogin_s is declared in the target's hal

Definition at line 34 of file analogin_api.h.

This is the set of operations constituting the Storage driver.

Their implementation is platform-specific, and needs to be supplied by the porting effort.

Some APIs within ARM_DRIVER_STORAGE will always operate synchronously: GetVersion, GetCapabilities, GetStatus, GetInfo, ResolveAddress, GetNextBlock, and GetBlock. This means that control returns to the caller with a relevant status code only after the completion of the operation (or the discovery of a failure condition).

The remainder of the APIs: Initialize, Uninitialize, PowerControl, ReadData, ProgramData, Erase, EraseAll, can function asynchronously if the underlying controller supports it–i.e. if ARM_STORAGE_CAPABILITIES::asynchronous_ops is set. In the case of asynchronous operation, the invocation returns early (with ARM_DRIVER_OK) and results in a completion callback later. If ARM_STORAGE_CAPABILITIES::asynchronous_ops is not set, then all such APIs execute synchronously, and control returns to the caller with a status code only after the completion of the operation (or the discovery of a failure condition).

If ARM_STORAGE_CAPABILITIES::asynchronous_ops is set, a storage driver may still choose to execute asynchronous operations in a synchronous manner. If so, the driver returns a positive value to indicate successful synchronous completion (or an error code in case of failure) and no further invocation of completion callback should be expected. The expected return value for synchronous completion of such asynchronous operations varies depending on the operation. For operations involving data access, it often equals the amount of data transferred or affected. For non data-transfer operations, such as EraseAll or Initialize, it is usually 1.

Here's a code snippet to suggest how asynchronous APIs might be used by callers to handle both synchronous and asynchronous execution by the underlying storage driver:

1 ASSERT(ARM_DRIVER_OK == 0); // this is a precondition; it doesn't need to be put in code
2 int32_t returnValue = drv->asynchronousAPI(...);
3 if (returnValue < ARM_DRIVER_OK) {
4  // handle error.
5 } else if (returnValue == ARM_DRIVER_OK) {
6  ASSERT(drv->GetCapabilities().asynchronous_ops == 1);
7  // handle early return from asynchronous execution; remainder of the work is done in the callback handler.
8 } else {
9  ASSERT(returnValue == EXPECTED_RETURN_VALUE_FOR_SYNCHRONOUS_COMPLETION);
10  // handle synchronous completion.
11 }

Driver Version.

General power states.

A storage block is a range of memory with uniform attributes.

Storage blocks combine to make up the address map of a storage controller.

Attributes of the storage range within a storage block.

typedef void(* ARM_Storage_Callback_t) (int32_t status, ARM_STORAGE_OPERATION operation)

Declaration of the callback-type for command completion.

Parameters
[in]statusA code to indicate the status of the completed operation. For data transfer operations, the status field is overloaded in case of success to return the count of items successfully transferred; this can be done safely because error codes are negative values.
[in]operationThe command op-code. This value isn't essential for the callback in the presence of the command instance-id, but it is expected that this information could be a quick and useful filter.

Definition at line 242 of file Driver_Storage.h.

Storage Driver API Capabilities.

This data structure is designed to fit within a single word so that it can be fetched cheaply using a call to driver->GetCapabilities().

Storage information.

This contains device-metadata. It is the return value from calling GetInfo() on the storage driver.

These fields serve a different purpose than the ones contained in ARM_STORAGE_CAPABILITIES, which is another structure containing device-level metadata. ARM_STORAGE_CAPABILITIES describes the API capabilities, whereas ARM_STORAGE_INFO describes the device. Furthermore ARM_STORAGE_CAPABILITIES fits within a single word, and is designed to be passed around by value; ARM_STORAGE_INFO, on the other hand, contains metadata which doesn't fit into a single word and requires the use of pointers to be moved around.

Command opcodes for Storage.

Completion callbacks use these codes to refer to completing commands. Refer to ARM_Storage_Callback_t.

Device Data Security Protection Features.

Applicable mostly to EXTERNAL_NVM.

Operating status of the storage controller.

typedef struct buffer_s buffer_t

Generic buffer structure.

CRC Polynomial value.

Different polynomial values supported

typedef struct dac_s dac_t

Analogout hal structure.

dac_s is declared in the target's hal

Definition at line 34 of file analogout_api.h.

typedef struct gpio_irq_s gpio_irq_t

GPIO IRQ HAL structure.

gpio_irq_s is declared in the target's HAL

Definition at line 41 of file gpio_irq_api.h.

typedef struct port_s port_t

Port HAL structure.

port_s is declared in the target's HAL

Definition at line 33 of file port_api.h.

typedef struct pwmout_s pwmout_t

Pwmout hal structure.

pwmout_s is declared in the target's hal

Definition at line 34 of file pwmout_api.h.

Event data reported to interrupt's callback.

typedef void(* spi_async_handler_f) (spi_t *obj, void *ctx, spi_async_event_t *event)

Interrupt callback signature.

Definition at line 192 of file spi_api.h.

SPI bit ordering.

typedef enum _spi_mode_t spi_mode_t

SPI modes.

Ticker's event structure.

typedef uint32_t timestamp_t

Legacy format representing a timestamp in us.

Given it is modeled as a 32 bit integer, this type can represent timestamp up to 4294 seconds (71 minutes). Prefer using us_timestamp_t which store timestamp as 64 bits integer.

Definition at line 33 of file ticker_api.h.

typedef struct trng_s trng_t

TRNG HAL structure.

trng_s is declared in the target's HAL

Definition at line 30 of file trng_api.h.

typedef uint64_t us_timestamp_t

A us timestamp stored in a 64 bit integer.

Can store timestamp up to 584810 years.

Definition at line 39 of file ticker_api.h.

Enumeration Type Documentation

General power states.

Enumerator
ARM_POWER_OFF 

Power off: no operation possible.

ARM_POWER_LOW 

Low Power mode: retain state, detect and signal wake-up events.

ARM_POWER_FULL 

Power on: full operation at maximum performance.

Definition at line 52 of file Driver_Common.h.

Command opcodes for Storage.

Completion callbacks use these codes to refer to completing commands. Refer to ARM_Storage_Callback_t.

Definition at line 211 of file Driver_Storage.h.

SPI bit ordering.

Definition at line 176 of file spi_api.h.

SPI modes.

Definition at line 166 of file spi_api.h.

enum CANFormat

Values that represent CAN Format.

Definition at line 35 of file can_helper.h.

enum CANType

Values that represent CAN Type.

Definition at line 48 of file can_helper.h.

CRC Polynomial value.

Different polynomial values supported

Enumerator
POLY_OTHER 

Custom polynomial.

POLY_8BIT_CCITT 

x8+x2+x+1

POLY_7BIT_SD 

x7+x3+1

POLY_16BIT_CCITT 

x16+x12+x5+1

POLY_16BIT_IBM 

x16+x15+x2+1

POLY_32BIT_ANSI 

x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1

POLY_32BIT_REV_ANSI 

x31+x30+x29+x27+x26+x24+x23+x21+x20+x19+x15+x9+x8+x5

Definition at line 30 of file crc_api.h.

GPIO IRQ events.

Definition at line 33 of file gpio_irq_api.h.

Function Documentation

const PinMap* can_rd_pinmap ( void  )

Get the pins that support CAN RD.

Return a PinMap array of pins that support CAN RD. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
const PinMap* can_td_pinmap ( void  )

Get the pins that support CAN TD.

Return a PinMap array of pins that support CAN TD. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
const ticker_data_t* get_lp_ticker_wrapper_data ( const ticker_data_t data)

Get wrapped lp ticker data.

Parameters
datahardware low power ticker object
Returns
wrapped low power ticker object
USBPhy* get_usb_phy ( )

Return a the USBPhy instance for this hardware.

For details on adding support for a USBPhy see the specification in USBPhy.h.

Returns
A pointer to a USBPhy instance
Note
Calling this function on platforms without a USBPhy will result in an error
void lp_ticker_wrapper_irq_handler ( ticker_irq_handler_type  handler)

Interrupt handler for the wrapped lp ticker.

Parameters
handlerthe function which would normally be called by the lp ticker handler when it is not wrapped
void lp_ticker_wrapper_resume ( void  )

Resume the wrapper layer code.

Resume operation of the wrapper layer. Interrupts will be filtered as normal and the microsecond timer will be used for interrupts scheduled too quickly back-to-back.

void lp_ticker_wrapper_suspend ( void  )

Suspend the wrapper layer code.

Pass through all interrupts to the low power ticker and stop using the microsecond ticker.

Warning
: Make sure to suspend the LP ticker first (call ticker_suspend()), otherwise the behavior is undefined.
bool pinmap_find_peripheral_pins ( const PinList whitelist,
const PinList blacklist,
int  per,
const PinMap *const *  maps,
PinName **  pins,
uint32_t  count 
)

Find a combination of pins suitable for use given the constraints.

This function finds pins which meet these specific properties:

  • The pin is part of the form factor
  • The pin is not in the restricted list
  • The pin is contained within the respective pinmap
  • The pin belongs to the given peripheral
  • Each pin found is distinct; in the example below mosi and miso will never be assigned the same pin

Example:

1 #include "mbed.h"
2 #include "pinmap.h"
3 
4 int main()
5 {
6  int per = spi_master_cs_pinmap()->peripheral;
7  const PinList *pins_ff = pinmap_ff_default_pins();
8  const PinList *pins_avoid = pinmap_restricted_pins();
9  PinName mosi = NC;
10  PinName miso = NC;
11  PinName sclk = NC;
12  PinName ssel = NC;
13  const PinMap *maps[] = {
14  spi_master_mosi_pinmap(),
15  spi_master_miso_pinmap(),
16  spi_master_clk_pinmap(),
17  spi_master_cs_pinmap()
18  };
19  PinName *pins[] = {
20  &mosi,
21  &miso,
22  &sclk,
23  &ssel
24  };
25  if (pinmap_find_peripheral_pins(pins_ff, pins_avoid, per, maps, pins, sizeof(maps) / sizeof(maps[0]))) {
26  printf("Found SPI pins to test instance %i with:\n"
27  " mosi=%s\n"
28  " miso=%s\n"
29  " sclk=%s\n"
30  " ssel=%s\n", per,
31  pinmap_ff_default_pin_to_string(mosi),
32  pinmap_ff_default_pin_to_string(miso),
33  pinmap_ff_default_pin_to_string(sclk),
34  pinmap_ff_default_pin_to_string(ssel));
35  } else {
36  printf("Could not find SPI combination to test %i\n", per);
37  }
38  return 0;
39 }
Parameters
whitelistList of pins to choose from
blacklistList of pins which cannot be used
perPeripheral to which the pins belong
mapsAn array of pin maps to select from
pinsAn array of pins to find. Pins already set to a value will be left unchanged. Only pins initialized to NC will be updated by this function
countThe size of maps and pins
Returns
true if a suitable combination of pins was found and written to the pins array, otherwise false
bool pinmap_list_has_pin ( const PinList list,
PinName  pin 
)

Check if the pin is in the list.

Parameters
listpin list to check
pinpin to check for in the list
Returns
true if the pin is in the list, false otherwise
const PinList* pinmap_restricted_pins ( void  )

Get the pin list of pins to avoid during testing.

The restricted pin list is used to indicate to testing that a pin should be skipped due to some caveat about it. For example, using USBRX and USBTX during tests will interfere with the test runner and should be avoided.

Targets should override the weak implementation of this function if they have additional pins which should be skipped during testing.

Returns
Pointer to a pin list of pins to avoid
void spi_format ( spi_t *  obj,
uint8_t  bits,
spi_mode_t  mode,
spi_bit_ordering_t  bit_ordering 
)

Configure the format to be used by the SPI peripheral.

Parameters
objSPI peripheral.
bitsNumber of bits per symbol.
modeSPI mode to use.
bit_orderingSPI bit ordering.
uint32_t spi_frequency ( spi_t *  obj,
uint32_t  hz 
)

Set the frequency target.

This function tries to acheive the closest frequency possible prefering a value lower than the target.

Parameters
objSPI peripheral.
hzTarget frequency in herz.
void spi_get_capabilities ( SPIName  name,
PinName  ssel,
bool  slave,
spi_capabilities_t cap 
)

Fills the given spi_capabilities_t structure with the capabilities of the given peripheral.

SPIName spi_get_module ( PinName  mosi,
PinName  miso,
PinName  mclk 
)

Returns a variant of the SPIName enum uniquely identifying a SPI peripheral of the device.

void spi_init ( spi_t *  obj,
bool  is_slave,
PinName  mosi,
PinName  miso,
PinName  mclk,
PinName  ssel 
)

Initialized a spi peripheral.

Parameters
objSPI peripheral.
is_slaveTrue if the peripheral is used as a slave.
mosiMaster Out Slave In pin.
misoMaster In Slave Out pin.
mclkClock pin.
sselSlave Select pin.
const PinMap* spi_master_clk_pinmap ( void  )

Get the pins that support SPI CLK.

Return a PinMap array of pins that support SPI CLK in master mode. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
const PinMap* spi_master_cs_pinmap ( void  )

Get the pins that support SPI CS.

Return a PinMap array of pins that support SPI CS in master mode. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
const PinMap* spi_master_miso_pinmap ( void  )

Get the pins that support SPI MISO.

Return a PinMap array of pins that support SPI MISO in master mode. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
const PinMap* spi_master_mosi_pinmap ( void  )

Get the pins that support SPI MOSI.

Return a PinMap array of pins that support SPI MOSI in master mode. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
const PinMap* spi_slave_clk_pinmap ( void  )

Get the pins that support SPI CLK.

Return a PinMap array of pins that support SPI CLK in slave mode. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
const PinMap* spi_slave_cs_pinmap ( void  )

Get the pins that support SPI CS.

Return a PinMap array of pins that support SPI CS in slave mode. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
const PinMap* spi_slave_miso_pinmap ( void  )

Get the pins that support SPI MISO.

Return a PinMap array of pins that support SPI MISO in slave mode. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
const PinMap* spi_slave_mosi_pinmap ( void  )

Get the pins that support SPI MOSI.

Return a PinMap array of pins that support SPI MOSI in slave mode. The array is terminated with {NC, NC, 0}.

Returns
PinMap array
uint32_t spi_transfer ( spi_t *  obj,
const void *  tx,
uint32_t  tx_len,
void *  rx,
uint32_t  rx_len,
const void *  fill_symbol 
)

Transfer data blocking until the end of the operation.

Parameters
objSPI periheral.
txBuffer so send.
tx_lenNumber of symbol in tx.
rxBuffer to store received symbols.
rx_lenNumber of symbol to store in rx.
fill_symbolSymbol to send if tx_len is less than rx_len.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.