Driver Use-cases and Modes

Use-cases are designed to provide specific targeted functionality for a peripheral, e.g. PWM driver for a timer peripheral, while driver modes represent a high-level configuration of the driver, e.g. polled or IRQ-based.

Driver Use-cases

Foundation Services drivers are designed to provide a specific functionality to the user. In Foundation Services terminology, this is called a use-case. This differs from traditional peripheral-centric drivers, where a driver supported all the possible ways of using a specific peripheral. For example, instead of one timer-counter driver, Foundation Services has drivers for PWM, timer, and input-capture. Use-case drivers allows the drivers to target the specific functionality the user needs, instead of making generic drivers supporting all the possible use cases of a peripheral. Use-case drivers makes code smaller, faster and easier to read.

Use-case drivers can sometimes support various peripherals, depending on the capabilities of the peripherals available on the specific device. Examples:

Atmel START allows only one use-case driver to be used per peripheral. As an example, assume that a USART peripheral can be used in USART or SPI Master mode. In this case, the user must choose whether to associate a USART driver or a SPI Master driver with the peripheral.

All peripherals offer an Init-driver. The Init-driver allows the user to statically configure the peripheral, i.e. generate code that initializes the peripheral's configuration registers according to the user's selections in Atmel START. The Init-driver does not offer any other functions in its API other than the init()-function.

The most common use-cases are covered with Basic-drivers. The Basic drivers provides an API allowing the user to perform the most typical and basic functionality associated with the use-case:

More advanced drivers may be provided:

Driver Modes

A use-case such as "USART" can be implemented using drivers with different architectures, such as:

  • USART with polled receive/transmit functions
  • USART with IRQ-driven receive/transmit functions
  • USART implemented using DMA transfer of data between peripheral registers to memory
  • USART intended for use with a Real-Time operating system

Atmel START allows the user to configure which mode the driver should use when multiple modes are available.