ContentsIndex
PreviousUpNext
Driver Common Layer
Topics | Functions | Macros | Structs, Records, Enums | Types
Description

Provides functions to control and access (read and write) to the hardware devices on LinkIt platform.

Introduction

This is the DCL (Device Control Layer) module, which provides functions to control and access the hardware devices on LinkIt platform. 

Before application tries to access a hardware device, such as GPIO, I2C, etc., it must open the device first by calling vm_dcl_open() to obtain a device handle, then access the device through the device handle (Calling the vm_dcl_close() to close the device handle). 

The application reads and writes to the device through the vm_dcl_read() and vm_dcl_write(). It can also send commands to control a device through vm_dcl_control(). 

An application can also register callback for various events from a particular device by calling vm_dcl_register_callback(). It can add multiple events to the registered callback by calling vm_dcl_add_event().

Limitation

To add multiple event to a callback, the callback has to be already registered by vm_dcl_add_event() before calling vm_dcl_add_event() to add additional events.

Group
Functions
Function 
Description 
If want to listen to multiple events, then use vm_dcl_register_callback() first to register the callback and use vm_dcl_add_event() to add additional events you want the callback to listen to. 
Closes the device, as specified by the device_handle. After the device operation completes, this function should be invoked to close the device. If the device operation involves a callback, the device should not be closed before the callback finishes. 
Sets the pin mode. 
Sends command to control the device, after the device is opened successfully by vm_dcl_open(). The command specifies what to do and the argument specifies the information needed for controlling the device by the device driver. The specific command is defined in the header file of the device driver.
The device_handle, command and argument should correlate, so that the desired operation command is sent to the desired device. The execution of vm_dcl_control() can be either synchronously or asynchronously, depending on the command and the targeted device. Refer to the command description in the specific driver documentation. 
Gets the identifier of the user. Some device may need this. Most of the time the return value of this function needs to be passed to the driver when the device do asynchronous operations. 
Opens the device. Every device must be opened with this function before it can be used. The device number passed to this function is defined in the header file of the device driver. The returned handle is the identifier of the device. The device handle is used to access the device by the other functions. 
Reads data from the device. This function may not applicable to the devices that do not transfer data. Some devices may also use vm_dcl_control() to transfer data, such as SPI. 
Registers a callback to listen to the events from a device specified by the device_handle. The callback enables an asynchronous operation between the application and the device. 
Writes data to the device. This function may not applicable to the devices that do not transfer data. Refer to the specific device driver document for details. Some devices may also use vm_dcl_control() to transfer data, such as SPI. 
Used in AP mode, it masks the I bit of the processor. This function must be used in pair with the vm_irq_restore(). The I bit mask time should not exceed 5ms. 
Used in AP mode, it restores the I bit of the processor. This function must be used in pair with vm_irq_mask(). 
Macros
Macro 
Description 
Converts PIN to ADC channel ID. 
Converts PIN to EINT ID, e.g.  
Converts PIN to PWM ID. 
Invalid handle, returned by vm_dcl_open when there is an error. 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_UART 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_UART 
Pin mux, VM_DCL_PIN_MODE_GPIO 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_SPI / VM_DCL_PIN_MODE_SDIO 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_SPI / VM_DCL_PIN_MODE_SDIO 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_SPI / VM_DCL_PIN_MODE_SDIO 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_I2C 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_I2C 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_EINT 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_EINT / VM_DCL_PIN_MODE_PWM 
Pin mux, VM_DCL_PIN_MODE_GPIO 
Pin mux, VM_DCL_PIN_MODE_GPIO 
Pin mux, VM_DCL_PIN_MODE_GPIO 
Pin mux, VM_DCL_PIN_MODE_GPIO 
Pin mux, VM_DCL_PIN_MODE_GPIO 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_PWM 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_PWM / VM_DCL_PIN_MODE_EINT 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_PWM 
Pin mux, VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_EINT / VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_EINT / VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_EINT / VM_DCL_PIN_MODE_ADC 
Pin mux, VM_DCL_PIN_MODE_EINT 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_SPI 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_SPI 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_SPI 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_SPI 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_I2C 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_I2C 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_UART 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_UART 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_UART 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_I2C 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_I2C 
Pin mux, VM_DCL_PIN_MODE_GPIO / VM_DCL_PIN_MODE_UART 
Structs, Records, Enums
Struct, Record, Enum 
Description 
The type is used for callback to transfer the data from the driver. It is the parameter type of the callback. Usually, the data sent back by the driver is wrapped in the local_parameters, and sometimes in peer_buffer. Different device driver has different specific types for these two parameters. 
This is the device number group enum. Each group device may have several devices. The specific device number please reference to the device driver. 
This is the event number group enum. Each device group may have several events. Some device may not generate the events. Refer to the device driver for the specific event number and the meaning. 
pin mux mode 
VM_DCL_STATUS is the type used to represent the status the driver returns. 
Types
Type 
Description 
A buffer type. 
Length of a buffer of VM_DCL_BUFFER type. 
The definition of the callback function used in DCL module. 
VM_DCL_CONTROL_COMMAND is the type used to represent the operations a driver needs to perform. The value of the variable of this type variable depends on specific device driver. Refer to the command enum of specific driver for detail. SIO: VM_DCL_SIO_CONTROL_COMMAND, I2C: VM_DCL_I2C_CONTROL_COMMAND, SPI: VM_DCL_SPI_CONTROL_COMMAND, ADC: VM_DCL_ADC_CONTROL_COMMAND, GPIO: VM_DCL_GPIO_CONTROL_COMMAND, PMU: VM_DCL_PMU_CONTROL_COMMAND, EINT: VM_DCL_EINT_CONTROL_COMMAND. 
VM_DCL_DEVICE is the type used to represent a specific device such as UART, I2C, GPIO and so on. Each device belongs to a specific device group. The value for a device group is defined in VM_DCL_DEVICE_GROUP. The value for a specific device is defined in the header file of that device. 
This is the event type to represent the change of a specific hardware condition, such as data transfer finished. An event is used to communicate asynchronously among the device operations. The value of each event is defined in VM_DCL_EVENT_VALUE
VM_DCL_FLAGS is the type used to represent the flags passed to the vm_dcl_open. The value of the flag depends on each specific device. 
VM_DCL_HANDLE is the type used to represent a specific device that is opened by vm_dcl_open. It is the return value of vm_dcl_open. The value will be passed to other API to tell the driver which device will respond to the corresponding operation. 
VM_DCL_OPTIONS is the type used to specify options to the read/write API. The value of the options depends on each specific device. 
Owner ID. 
Links
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.