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
 
 Critical Section HAL functions
 
 Flash HAL API
 
 GPIO HAL functions
 
 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
 
 Port HAL functions
 
 Pwmout hal functions
 
 RTC hal
 
 Serial TX Events Macros
 
 Serial RX Events Macros
 
 Serial Configuration Functions
 
 Asynchronous Serial Hardware Abstraction Layer
 
 sleep hal requirements
 
 SPI Configuration Functions
 
 Synchronous SPI Hardware Abstraction Layer
 
 Asynchronous SPI Hardware Abstraction Layer
 
 Ticker HAL functions
 
 TRNG hal functions
 
 Microsecond Ticker
 

Data Structures

struct  buffer_s
 
struct  CAN_Message
 Holder for single CAN message. More...
 
struct  crc_mbed_config
 
struct  i2c_t
 
struct  PinMap
 
struct  serial_t
 
struct  spi_t
 
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. Storage blocks combine to make up the address map of a storage controller. More...
 
struct  _ARM_STORAGE_SECURITY_FEATURES
 
struct  _ARM_STORAGE_INFO
 Storage information. This contains device-metadata. It is the return value from calling GetInfo() on the storage driver. 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
 
struct  ticker_event_s
 
struct  ticker_info_t
 
struct  ticker_interface_t
 
struct  ticker_event_queue_t
 
struct  ticker_data_t
 

Macros

#define DMA_ERROR_OUT_OF_CHANNELS   (-1)
 
#define MBED_FLASH_INVALID_SIZE   0xFFFFFFFF
 
#define SERIAL_EVENT_TX_SHIFT   (2)
 
#define SERIAL_EVENT_RX_SHIFT   (8)
 
#define SERIAL_EVENT_TX_MASK   (0x00FC)
 
#define SERIAL_EVENT_RX_MASK   (0x3F00)
 
#define SERIAL_EVENT_ERROR   (1 << 1)
 
#define SERIAL_RESERVED_CHAR_MATCH   (255)
 
#define SPI_EVENT_ERROR   (1 << 1)
 
#define SPI_EVENT_COMPLETE   (1 << 2)
 
#define SPI_EVENT_RX_OVERFLOW   (1 << 3)
 
#define SPI_EVENT_ALL   (SPI_EVENT_ERROR | SPI_EVENT_COMPLETE | SPI_EVENT_RX_OVERFLOW)
 
#define SPI_EVENT_INTERNAL_TRANSFER_COMPLETE   (1 << 30)
 
#define SPI_FILL_WORD   (0xFFFF)
 
#define SPI_FILL_CHAR   (0xFF)
 
#define ARM_DRIVER_VERSION_MAJOR_MINOR(major, minor)   (((major) << 8) | (minor))
 
#define ARM_DRIVER_OK   0
 Operation succeeded.
 
#define ARM_DRIVER_ERROR   -1
 Unspecified error.
 
#define ARM_DRIVER_ERROR_BUSY   -2
 Driver is busy.
 
#define ARM_DRIVER_ERROR_TIMEOUT   -3
 Timeout occurred.
 
#define ARM_DRIVER_ERROR_UNSUPPORTED   -4
 Operation not supported.
 
#define ARM_DRIVER_ERROR_PARAMETER   -5
 Parameter error.
 
#define ARM_DRIVER_ERROR_SPECIFIC   -6
 Start of driver specific errors.
 
#define ARM_STORAGE_API_VERSION   ARM_DRIVER_VERSION_MAJOR_MINOR(1,00) /* API version */
 
#define _ARM_Driver_Storage_(n)    Driver_Storage##n
 
#define ARM_Driver_Storage_(n)   _ARM_Driver_Storage_(n)
 
#define ARM_STORAGE_INVALID_OFFSET   (0xFFFFFFFFFFFFFFFFULL)
 address space). A storage block may never start at this address. More...
 
#define ARM_STORAGE_INVALID_ADDRESS   (0xFFFFFFFFUL)
 Refer to memory-mapped storage, i.e. < ARM_DRIVER_STORAGE::ResolveAddress(). More...
 
#define ARM_STORAGE_ERROR_NOT_ERASABLE   (ARM_DRIVER_ERROR_SPECIFIC - 1)
 Part (or all) of the range provided to Erase() isn't erasable.
 
#define ARM_STORAGE_ERROR_NOT_PROGRAMMABLE   (ARM_DRIVER_ERROR_SPECIFIC - 2)
 Part (or all) of the range provided to ProgramData() isn't programmable.
 
#define ARM_STORAGE_ERROR_PROTECTED   (ARM_DRIVER_ERROR_SPECIFIC - 3)
 Part (or all) of the range to Erase() or ProgramData() is protected.
 
#define ARM_STORAGE_ERROR_RUNTIME_OR_INTEGRITY_FAILURE   (ARM_DRIVER_ERROR_SPECIFIC - 4)
 Runtime or sanity-check failure.
 
#define ARM_STORAGE_VALID_BLOCK(BLK)   (((BLK)->addr != ARM_STORAGE_INVALID_OFFSET) && ((BLK)->size != 0))
 
#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.
 
#define ARM_STORAGE_PROGRAMMABILITY_WORM   (0x2)
 write-once-read-only-memory (WORM).
 
#define ARM_STORAGE_PROGRAMMABILITY_ERASABLE   (0x3)
 re-programmable based on erase. Supports multiple writes.
 
#define ARM_RETENTION_WHILE_DEVICE_ACTIVE   (0x0)
 Data is retained only during device activity. More...
 
#define ARM_RETENTION_ACROSS_SLEEP   (0x1)
 Data is retained across processor sleep.
 
#define ARM_RETENTION_ACROSS_DEEP_SLEEP   (0x2)
 Data is retained across processor deep-sleep.
 
#define ARM_RETENTION_BATTERY_BACKED   (0x3)
 Data is battery-backed. Device can be powered off.
 
#define ARM_RETENTION_NVM   (0x4)
 Data is retained in non-volatile memory.
 
#define ARM_STORAGE_PROGRAM_CYCLES_INFINITE   (0UL)
 

Typedefs

typedef struct analogin_s analogin_t
 
typedef struct dac_s dac_t
 
typedef struct buffer_s buffer_t
 
typedef void(* can_irq_handler) (uint32_t id, CanIrqType type)
 
typedef struct can_s can_t
 
typedef enum CANFormat CANFormat
 
typedef enum CANType CANType
 
typedef struct CAN_Message CAN_Message
 
typedef enum crc_polynomial crc_polynomial_t
 
typedef struct crc_mbed_config crc_mbed_config_t
 
typedef struct flash_s flash_t
 
typedef struct gpio_irq_s gpio_irq_t
 
typedef void(* gpio_irq_handler) (uint32_t id, gpio_irq_event event)
 
typedef struct port_s port_t
 
typedef struct pwmout_s pwmout_t
 
typedef void(* uart_irq_handler) (uint32_t id, SerialIrq event)
 
typedef struct _ARM_DRIVER_VERSION ARM_DRIVER_VERSION
 Driver Version.
 
typedef enum _ARM_POWER_STATE ARM_POWER_STATE
 General power states.
 
typedef struct _ARM_STORAGE_BLOCK_ATTRIBUTES ARM_STORAGE_BLOCK_ATTRIBUTES
 Attributes of the storage range within a storage block.
 
typedef struct _ARM_STORAGE_BLOCK ARM_STORAGE_BLOCK
 A storage block is a range of memory with uniform attributes. Storage blocks combine to make up the address map of a storage controller.
 
typedef struct _ARM_STORAGE_SECURITY_FEATURES ARM_STORAGE_SECURITY_FEATURES
 
typedef struct _ARM_STORAGE_INFO ARM_STORAGE_INFO
 Storage information. This contains device-metadata. It is the return value from calling GetInfo() on the storage driver. More...
 
typedef struct _ARM_STORAGE_STATUS ARM_STORAGE_STATUS
 Operating status of the storage controller.
 
typedef struct _ARM_STORAGE_CAPABILITIES ARM_STORAGE_CAPABILITIES
 Storage Driver API Capabilities. More...
 
typedef enum _ARM_STORAGE_OPERATION ARM_STORAGE_OPERATION
 
typedef void(* ARM_Storage_Callback_t) (int32_t status, ARM_STORAGE_OPERATION operation)
 
typedef struct _ARM_DRIVER_STORAGE ARM_DRIVER_STORAGE
 
typedef uint32_t timestamp_t
 
typedef uint64_t us_timestamp_t
 
typedef struct ticker_event_s ticker_event_t
 
typedef void(* ticker_event_handler) (uint32_t id)
 
typedef struct trng_s trng_t
 

Enumerations

enum  CanIrqType {
  IRQ_RX, IRQ_TX, IRQ_ERROR, IRQ_OVERRUN,
  IRQ_WAKEUP, IRQ_PASSIVE, IRQ_ARB, IRQ_BUS,
  IRQ_READY
}
 
enum  CanMode {
  MODE_RESET, MODE_NORMAL, MODE_SILENT, MODE_TEST_LOCAL,
  MODE_TEST_GLOBAL, MODE_TEST_SILENT
}
 
enum  CANFormat { CANStandard = 0, CANExtended = 1, CANAny = 2 }
 Values that represent CAN Format.
 
enum  CANType { CANData = 0, CANRemote = 1 }
 Values that represent CAN Type.
 
enum  crc_polynomial {
  POLY_OTHER = 0, POLY_8BIT_CCITT = 0x07, POLY_7BIT_SD = 0x9, POLY_16BIT_CCITT = 0x1021,
  POLY_16BIT_IBM = 0x8005, POLY_32BIT_ANSI = 0x04C11DB7
}
 
enum  DMAUsage {
  DMA_USAGE_NEVER, DMA_USAGE_OPPORTUNISTIC, DMA_USAGE_ALWAYS, DMA_USAGE_TEMPORARY_ALLOCATED,
  DMA_USAGE_ALLOCATED
}
 
enum  gpio_irq_event { IRQ_NONE, IRQ_RISE, IRQ_FALL }
 
enum  { I2C_ERROR_NO_SLAVE = -1, I2C_ERROR_BUS_BUSY = -2 }
 
enum  SerialParity {
  ParityNone = 0, ParityOdd = 1, ParityEven = 2, ParityForced1 = 3,
  ParityForced0 = 4
}
 
enum  SerialIrq { RxIrq, TxIrq }
 
enum  FlowControl { FlowControlNone, FlowControlRTS, FlowControlCTS, FlowControlRTSCTS }
 
enum  _ARM_POWER_STATE { ARM_POWER_OFF, ARM_POWER_LOW, ARM_POWER_FULL }
 General power states. More...
 
enum  _ARM_STORAGE_OPERATION {
  ARM_STORAGE_OPERATION_GET_VERSION, ARM_STORAGE_OPERATION_GET_CAPABILITIES, ARM_STORAGE_OPERATION_INITIALIZE, ARM_STORAGE_OPERATION_UNINITIALIZE,
  ARM_STORAGE_OPERATION_POWER_CONTROL, ARM_STORAGE_OPERATION_READ_DATA, ARM_STORAGE_OPERATION_PROGRAM_DATA, ARM_STORAGE_OPERATION_ERASE,
  ARM_STORAGE_OPERATION_ERASE_ALL, ARM_STORAGE_OPERATION_GET_STATUS, ARM_STORAGE_OPERATION_GET_INFO, ARM_STORAGE_OPERATION_RESOLVE_ADDRESS,
  ARM_STORAGE_OPERATION_GET_NEXT_BLOCK, ARM_STORAGE_OPERATION_GET_BLOCK
}
 

Functions

void can_init (can_t *obj, PinName rd, PinName td)
 
void can_init_freq (can_t *obj, PinName rd, PinName td, int hz)
 
void can_free (can_t *obj)
 
int can_frequency (can_t *obj, int hz)
 
void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id)
 
void can_irq_free (can_t *obj)
 
void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable)
 
int can_write (can_t *obj, CAN_Message, int cc)
 
int can_read (can_t *obj, CAN_Message *msg, int handle)
 
int can_mode (can_t *obj, CanMode mode)
 
int can_filter (can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle)
 
void can_reset (can_t *obj)
 
unsigned char can_rderror (can_t *obj)
 
unsigned char can_tderror (can_t *obj)
 
void can_monitor (can_t *obj, int silent)
 
void dma_init (void)
 
int dma_channel_allocate (uint32_t capabilities)
 
int dma_channel_free (int channelid)
 
int ethernet_init (void)
 
void ethernet_free (void)
 
int ethernet_write (const char *data, int size)
 
int ethernet_send (void)
 
int ethernet_receive (void)
 
int ethernet_read (char *data, int size)
 
void ethernet_address (char *mac)
 
int ethernet_link (void)
 
void ethernet_set_link (int speed, int duplex)
 
void pin_function (PinName pin, int function)
 
void pin_mode (PinName pin, PinMode mode)
 
uint32_t pinmap_peripheral (PinName pin, const PinMap *map)
 
uint32_t pinmap_function (PinName pin, const PinMap *map)
 
uint32_t pinmap_merge (uint32_t a, uint32_t b)
 
void pinmap_pinout (PinName pin, const PinMap *map)
 
uint32_t pinmap_find_peripheral (PinName pin, const PinMap *map)
 
uint32_t pinmap_find_function (PinName pin, const PinMap *map)
 

Detailed Description

Macro Definition Documentation

#define ARM_RETENTION_WHILE_DEVICE_ACTIVE   (0x0)

Data is retained only during device activity.

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.

#define ARM_STORAGE_INVALID_ADDRESS   (0xFFFFFFFFUL)

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

Invalid address within the processor's memory address space.

#define ARM_STORAGE_INVALID_OFFSET   (0xFFFFFFFFFFFFFFFFULL)

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

Invalid address (relative to a storage controller's

#define ARM_STORAGE_PROGRAM_CYCLES_INFINITE   (0UL)

Infinite or unknown endurance for reprogramming.

#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.

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

The check for a valid ARM_STORAGE_BLOCK.

Typedef Documentation

typedef struct analogin_s analogin_t

Analogin hal structure. analogin_s is declared in the target's hal

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 }
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.

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.

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

typedef struct gpio_irq_s gpio_irq_t

GPIO IRQ HAL structure. gpio_irq_s is declared in the target's HAL

typedef struct port_s port_t

Port HAL structure. port_s is declared in the target's HAL

typedef struct pwmout_s pwmout_t

Pwmout hal structure. pwmout_s is declared in the target's hal

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.

typedef struct trng_s trng_t

TRNG HAL structure. trng_s is declared in the target's HAL

typedef uint64_t us_timestamp_t

A us timestamp stored in a 64 bit integer. Can store timestamp up to 584810 years.

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.

Command opcodes for Storage. Completion callbacks use these codes to refer to completing commands. Refer to ARM_Storage_Callback_t.

CRC Polynomial value

Different polynomial values supported

GPIO IRQ events

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.