| ISF 2.1 Intelligent Sensing Framework for Kinetis with Processor Expert

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Variables
isf_device_messaging.c File Reference

isf_device_messaging.c implements device messaging interfaces. More...

`#include "isf_devmsg.h"`
`#include "isf_protocol_adapter.h"`
`#include "isf_sysconf_types.h"`
Include dependency graph for isf_device_messaging.c:

Go to the source code of this file.

## Functions
Channel
isf_status_t | dm_channel_init (dm_ChannelId_t aChannelId, dm_ChannelDescriptor_t *apChannelDescriptor)
| This function initializes a channel. More...
isf_status_t | dm_channel_configure (dm_ChannelDescriptor_t *apChannelDescriptor, dm_ChannelConfig_ptr apChannelConfig)
| This function reconfigures an already initialized channel. More...
comm_State_t | dm_channel_get_state (dm_ChannelDescriptor_t *apChannelDescriptor)
| This function returns the channel state. More...
isf_status_t | dm_channel_get_config (dm_ChannelDescriptor_t *apChannelDescriptor, dm_ChannelConfig_ptr apChannelConfig)
| This function returns the current channel configuration. More...
isf_status_t | dm_channel_start (dm_ChannelDescriptor_t *apChannelDescriptor)
| This function starts a channel. More...
isf_status_t | dm_channel_stop (dm_ChannelDescriptor_t *apChannelDescriptor, isf_duration_t aTimeout)
| This function stops a channel. More...
isf_status_t | dm_channel_acquire_lock (dm_ChannelDescriptor_t *apChannelDescriptor, isf_duration_t aTimeout)
| This function locks the channel for exclusive access. More...
isf_status_t | dm_channel_release_lock (dm_ChannelDescriptor_t *apChannelDescriptor)
| This function releases exclusive channel access. More...
Device
dm_ChannelDescriptor_t * | dm_channel_get_descriptor (dm_DeviceDescriptor_t *apDeviceDescriptor)
| This function retrieves the channel descriptor from a device handle. More...
isf_status_t | dm_device_open (dm_ChannelDescriptor_t *apChannelDescriptor, void *apDevice, dm_DeviceDescriptor_t *apDeviceDescriptor)
| This function creates a device handle for a device at a specified channel address. More...
isf_status_t | dm_device_close (dm_DeviceDescriptor_t *apDeviceDescriptor)
| This function closes a device. More...
isf_status_t | dm_device_read (dm_DeviceDescriptor_t *apDeviceDescriptor, int32 aOffset, uint8 *apReadBuffer, uint32 aBuffsize, uint32 aNbyteRead)
| This function reads from a device. More...
isf_status_t | dm_device_readx (dm_DeviceDescriptor_t *apDeviceDescriptor, int32 aOffset, uint8 *apReadBuffer, uint32 aBuffsize, uint32 aNbyteRead, comm_Flags_t aFlags)
| This function reads from a device with extended behavior. More...
isf_status_t | dm_device_write (dm_DeviceDescriptor_t *apDeviceDescriptor, int32 aOffset, uint8 *apWriteBuffer, uint32 aBuffsize, uint32 aNbyteWrite)
| This function writes to a device. More...
isf_status_t | dm_device_writex (dm_DeviceDescriptor_t *apDeviceDescriptor, int32 aOffset, uint8 *apWriteBuffer, uint32 aBuffsize, uint32 aNbyteWrite, comm_Flags_t aFlags)
| This function writes data to a device with extended write behavior. More...

## Variables
const protocol_t | PROTOCOL []
| Lookup table to find protocol-specific functions and properties. Indexed by sys_protocolType_t. More...
const sys_channelDescriptor_t | gSys_ConfiguredChannelList []
const uint8 | gSys_NumChannels

## Detailed Description

isf_device_messaging.c implements device messaging interfaces.

File: isf_device_messaging.c

Copyright (c) 2012-2014, Freescale Semiconductor, Inc.

Definition in file isf_device_messaging.c.

## Function Documentation

isf_status_t dm_channel_acquire_lock | ( | dm_ChannelDescriptor_t * | apChannelDescriptor,
|  | isf_duration_t | aTimeout
| ) |  |

This function locks the channel for exclusive access.

dm_channel_acquire_lock() serializes multi-client access. Each channel user must acquire a lock prior to sending device messages. While holding the channel lock, no other clients may perform any channel operations. Therefore, it is important to release the lock with dm_channel_release_lock() as soon as practical.

Parameters

  [in] | apChannelDescriptor | The handle of the channel to be started.
  [in] | aTimeout | The time to wait for the lock before returning without the lock. The timeout parameter may be set to zero to wait for calls that fail to return without acquiring the lock, or wait as long as necessary for the lock to be acquired.

Returns
  dm_channel_acquire_lock() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the channel lock is acquired.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.
  COMM_ERROR_TIME_OUT | is returned when the request could not be fulfilled in the specified timeout period.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.

Constraints:
  The following constraints must be observed when using this function:
  - The actual time spent in the call may be longer than the specified timeout due to the granularity of the timer used.
  - A valid device handle should be passed into the function.
  - apChannelDescriptor must be valid. A valid channel descriptor is created when dm_channel_init() returns successfully.

Reentrant: Yes

Link Libraries:
  None

Definition at line 174 of file isf_device_messaging.c.

References dm_ChannelDescriptor_struct::busHandle, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnAcquireLock, and dm_ChannelDescriptor_struct::pProtocol.

Referenced by fsl_fxas21002_i2cspi_3D_gyro_Configure(), fsl_fxls8471_i2cspi_3D_accel_Configure(), fsl_fxos8700_i2cspi_6D_AccMag_Configure(), fsl_mag3110_i2c_3D_mag_Configure(), fsl_mma865x_i2c_3D_accel_Configure(), and fsl_mpl3115_i2c_1D_press_Configure().

Here is the caller graph for this function:

isf_status_t dm_channel_configure | ( | dm_ChannelDescriptor_t * | apChannelDescriptor,
|  | dm_ChannelConfig_ptr | apChannelConfig
| ) |  |

This function reconfigures an already initialized channel.

A channel may be reconfigured after initialization. Calls to dm_channel_configure() after initialization will override any previous configuration values and must be made while the channel state is COMM_STATE_STOPPED. The typical usage involves retrieving the current configuration using dm_channel_get_config(), making modifications to the returned configuration, and then calling dm_channel_configure() with the updated configuration. The channel is implicitly locked during the configuration.

Parameters

  [in] | apChannelDescriptor | The handle of the channel to be configured.
  [in] | apChannelConfig | The channel configuration used during initialization.

Returns
  dm_channel_configure() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the channel was reconfigured successfully.
  COMM_ERROR_STOP | is returned when the channel was not STOPPED.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_TIME_OUT | is returned when the request could not be fulfilled in the specified timeout period.

Constraints:
  The following constraints must be observed when using this function:
  - apChannelDescriptor must be valid. A valid channel descriptor is created when the dm_channel_init() function call is successfully returned.

Reentrant: Yes

Link Libraries:
  None

Definition at line 80 of file isf_device_messaging.c.

References dm_ChannelDescriptor_struct::busHandle, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnConfigure, and dm_ChannelDescriptor_struct::pProtocol.

Referenced by fsl_fxls8471_i2cspi_3D_accel_Initialize().

Here is the caller graph for this function:

isf_status_t dm_channel_get_config | ( | dm_ChannelDescriptor_t * | apChannelDescriptor,
|  | dm_ChannelConfig_ptr | apChannelConfig
| ) |  |

This function returns the current channel configuration.

A channel may be queried for the current configuration.

Parameters

  [in] | apChannelDescriptor | The handle of the channel to be configured.
  [out] | apChannelConfig | The address of a channel configuration to be filled.

Returns
  dm_channel_get_config() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the channel configuration is retrieved successfully.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.

Constraints:
  The following constraints must be observed when using this function:
  - apChannelDescriptor must be valid. A valid channel descriptor is created when the dm_channel_init() function call returns successfully.

Reentrant: Yes

Link Libraries:
  None

Definition at line 118 of file isf_device_messaging.c.

References dm_ChannelDescriptor_struct::busHandle, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnGetConfig, and dm_ChannelDescriptor_struct::pProtocol.

dm_ChannelDescriptor_t* dm_channel_get_descriptor | ( | dm_DeviceDescriptor_t * | apDeviceDescriptor | ) |

This function retrieves the channel descriptor from a device handle.

dm_channel_get_descriptor() returns the channel descriptor associated with the channel on which the device resides.

Parameters

  [in] | apDeviceDescriptor | Handle of device connected on the channel of interest.

Returns
  dm_channel_get_descriptor() returns a value of type dm_ChannelDescriptor_t which is pointer to an object.

Return values

  NULL | is returned when the specified device handle is invalid.

Constraints:
  None

Constraints:
  The following constraints must be observed when using this function:
  - apDeviceDescriptor must be valid. A valid device handle is created when the dm_device_open() returns successfully.

Reentrant: Yes

Link Libraries:
  isf_core.lib

Definition at line 214 of file isf_device_messaging.c.

References dm_DeviceDescriptor_struct::pChannelDescriptor.

comm_State_t dm_channel_get_state | ( | dm_ChannelDescriptor_t * | apChannelDescriptor | ) |

This function returns the channel state.

A channel may be queried for its current state.

Parameters

  [in] | apChannelDescriptor | The handle of the channel to be queried.

Returns
  dm_channel_get_state() returns a value of type comm_State_t indicating the current state of the channel.

Return values

  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.

Constraints:
  The following constraints must be observed when using this function:
  - apChannelDescriptor must be valid. A valid channel descriptor is created when dm_channel_init() function call returns successfully.

Reentrant: Yes

Link Libraries:
  None

Definition at line 100 of file isf_device_messaging.c.

References dm_ChannelDescriptor_struct::busHandle, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnGetState, and dm_ChannelDescriptor_struct::pProtocol.

Referenced by ci_init(), fsl_fxas21002_i2cspi_3D_gyro_Initialize(), fsl_fxls8471_i2cspi_3D_accel_Initialize(), fsl_fxos8700_i2cspi_6D_AccMag_Initialize(), fsl_mag3110_i2c_3D_mag_Initialize(), fsl_mma865x_i2c_3D_accel_Initialize(), and fsl_mpl3115_i2c_1D_press_Initialize().

Here is the caller graph for this function:

isf_status_t dm_channel_init | ( | dm_ChannelId_t | aChannelId,
|  | dm_ChannelDescriptor_t * | apChannelDescriptor
| ) |  |

This function initializes a channel.

A channel must be initialized prior to use. Initialization creates the channel and initializes the data structures required to manage the channel. The channel is implicitly locked during the initialization.

Parameters

  [in] | aChannelId | The ID of the channel to initialize. This is an index into the array of known channels that can be used.
  [out] | apChannelDescriptor | The address of the channel descriptor structure to be initialized.

Returns
  dm_channel_init() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the channel initialized successfully and the apChannelDescriptor structure reference has been populated with initialized channel data.
  COMM_ERROR_NOEXIST | is returned when the supplied channel identifier does not exist.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_INIT | is returned when the channel could not be initialized.

Reentrant: Yes

Link Libraries:
  None

Definition at line 48 of file isf_device_messaging.c.

References dm_ChannelDescriptor_struct::busHandle, COMM_ERROR_NOEXIST, COMM_ERROR_NULL_PTR, COMM_STATE_INIT, protocol_t::fnConfigure, protocol_t::fnGetState, protocol_t::fnInit, gSys_NumChannels, sys_channelDescriptor_t::pConfig, dm_ChannelDescriptor_struct::pProtocol, sys_channelDescriptor_t::protocolInstanceId, and sys_channelDescriptor_t::protocolType.

Referenced by ci_init(), fsl_fxas21002_i2cspi_3D_gyro_Initialize(), fsl_fxls8471_i2cspi_3D_accel_Initialize(), fsl_fxos8700_i2cspi_6D_AccMag_Initialize(), fsl_mag3110_i2c_3D_mag_Initialize(), fsl_mma865x_i2c_3D_accel_Initialize(), fsl_mpl3115_i2c_1D_press_Initialize(), and isf_rli_init().

Here is the caller graph for this function:

isf_status_t dm_channel_release_lock | ( | dm_ChannelDescriptor_t * | apChannelDescriptor | ) |

This function releases exclusive channel access.

dm_channel_release_lock() is used to relinquish exclusive access on a paricular channel. It is the inverse of dm_channel_acquire_lock().

Parameters

  [in] | apChannelDescriptor | The handle of the channel to unlock.

Returns
  dm_channel_release_lock() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the channel released successfully.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.
  COMM_ERROR_LOCK | is returned when no lock was held on the specified channel.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.

Reentrant: Yes

Link Libraries:
  None

Definition at line 191 of file isf_device_messaging.c.

References dm_ChannelDescriptor_struct::busHandle, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnReleaseLock, and dm_ChannelDescriptor_struct::pProtocol.

Referenced by fsl_fxas21002_i2cspi_3D_gyro_Configure(), fsl_fxls8471_i2cspi_3D_accel_Configure(), fsl_fxos8700_i2cspi_6D_AccMag_Configure(), fsl_mag3110_i2c_3D_mag_Configure(), fsl_mma865x_i2c_3D_accel_Configure(), and fsl_mpl3115_i2c_1D_press_Configure().

Here is the caller graph for this function:

isf_status_t dm_channel_start | ( | dm_ChannelDescriptor_t * | apChannelDescriptor | ) |

This function starts a channel.

dm_channel_start() enables communications with an initialized channel. This call enables the hardware peripherals associated with the channel. The channel is implicitly locked during the start operation.

Parameters

  [in] | apChannelDescriptor | The handle of the channel to be started.

Returns
  dm_channel_start() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the channel was started successfully.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_TIME_OUT | is returned when the request could not be fulfilled in the specified timeout period.

Constraints:
  The following constraints must be observed when using this function:
  - apDeviceDescriptor must be valid. A valid device handle is created when the dm_device_open() function call returns successfully.

Reentrant: Yes

Link Libraries:
  None

Definition at line 137 of file isf_device_messaging.c.

References dm_ChannelDescriptor_struct::busHandle, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnStart, and dm_ChannelDescriptor_struct::pProtocol.

Referenced by ci_init(), fsl_fxas21002_i2cspi_3D_gyro_Initialize(), fsl_fxls8471_i2cspi_3D_accel_Initialize(), fsl_fxos8700_i2cspi_6D_AccMag_Initialize(), fsl_mag3110_i2c_3D_mag_Initialize(), fsl_mma865x_i2c_3D_accel_Initialize(), fsl_mpl3115_i2c_1D_press_Initialize(), and isf_rli_init().

Here is the caller graph for this function:

isf_status_t dm_channel_stop | ( | dm_ChannelDescriptor_t * | apChannelDescriptor,
|  | isf_duration_t | aTimeout
| ) |  |

This function stops a channel.

dm_channel_stop() disables an initialized channel and stops communications with the channel. This call disables the hardware peripherals associated with the channel. The channel is implicitly locked during the stop operation.

Parameters

  [in] | apChannelDescriptor | The handle of the channel to be stopped.
  [in] | aTimeout | The time to wait for the channel to stop before returning a failure. The timeout parameter may be set to zero to never return without stopping the channel, i.e. wait as long as required for the channel to stop.

Returns
  dm_channel_stop() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the channel is successfully stopped.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_TIME_OUT | is returned when the request could not be fulfilled in the specified timeout period.

Reentrant: Yes

Link Libraries:
  None

Definition at line 155 of file isf_device_messaging.c.

References dm_ChannelDescriptor_struct::busHandle, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnStop, and dm_ChannelDescriptor_struct::pProtocol.

isf_status_t dm_device_close | ( | dm_DeviceDescriptor_t * | apDeviceDescriptor | ) |

This function closes a device.

The dm_device_close() function is used when no further communication with the device is needed. A closed device should not be passed to dm_device_read() or dm_device_write(). The channel is implicitly locked during the close operation.

Parameters

  [in] | apDeviceDescriptor | The address of the DeviceHandle to be closed.

Returns
  dm_device_open() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the device changes to closed.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.

Constraints:
  The following constraints must be observed when using this function:
  - apDeviceDescriptor must be valid. A valid device handle is created when the dm_device_open() function call returns successfully.

Reentrant: Yes

Link Libraries:
  None

Definition at line 252 of file isf_device_messaging.c.

References COMM_ERROR_NULL_PTR, protocol_t::fnDisEndPoint, dm_DeviceDescriptor_struct::pChannelDescriptor, dm_DeviceDescriptor_struct::pEndpointHandle, and dm_ChannelDescriptor_struct::pProtocol.

isf_status_t dm_device_open | ( | dm_ChannelDescriptor_t * | apChannelDescriptor,
|  | void * | apDevice,
|  | dm_DeviceDescriptor_t * | apDeviceDescriptor
| ) |  |

This function creates a device handle for a device at a specified channel address.

The dm_device_open() function may be used to get a handle to a device at a known channel address. The channel is implicity locked during the open.

Parameters

  [in] | apChannelDescriptor | The handle of the channel to be opened.
  [in] | apDevice | The known information of a device.
  [out] | apDeviceDescriptor | The address of a DeviceHandle to be filled. dm_device_open() fills the provided device handle structure with valid data when a device is found at the specified address.

Returns
  dm_channel_configure() returns a value of type isf_status_t indicating the success or failure of the function call.

Return values

  ISF_SUCCESS | is returned when the device is located and a valid handle is returned.
  COMM_ERROR_NOEXIST | is returned when a device does not exist at the specified address.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.
  COMM_ERROR_STOP | is returned when the channel has not been started.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_TIME_OUT | is returned when the request could not be fulfilled in the specified timeout period.

Constraints:
  The following constraints must be observed when using this function:
  - apChannelDescriptor must be valid. A valid channel descriptor is created when the dm_channel_init() function call returns successfully.

Reentrant: Yes

Link Libraries:
  None

Definition at line 227 of file isf_device_messaging.c.

References dm_ChannelDescriptor_struct::busHandle, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnGetEndPointAt, ISF_SUCCESS, dm_DeviceDescriptor_struct::pChannelDescriptor, dm_DeviceDescriptor_struct::pEndpointHandle, and dm_ChannelDescriptor_struct::pProtocol.

Referenced by ci_init(), fsl_fxas21002_i2cspi_3D_gyro_Initialize(), fsl_fxls8471_i2cspi_3D_accel_Initialize(), fsl_fxos8700_i2cspi_6D_AccMag_Initialize(), fsl_mag3110_i2c_3D_mag_Initialize(), fsl_mma865x_i2c_3D_accel_Initialize(), fsl_mpl3115_i2c_1D_press_Initialize(), and isf_rli_open().

Here is the caller graph for this function:

isf_status_t dm_device_read | ( | dm_DeviceDescriptor_t * | apDeviceDescriptor,
|  | int32 | aOffset,
|  | uint8 * | apReadBuffer,
|  | uint32 | aBuffsize,
|  | uint32 | aNbyteRead
| ) |  |

This function reads from a device.

dm_device_read() reads data from the specified device. The supplied command is sent to the device triggering the device to return some data. Any data returned by the device is read and placed in the provided read buffer. Note that if the command sent does not trigger the device to return data, the dm_device_read() simply returns 0 bytes read. The device is implicitly locked during the read.

Parameters

  [in] | apDeviceDescriptor | The handle to the device from which to read.
  [in] | aOffset | The offset/sub address from which the read is performed.
  [in] | apReadBuffer | The Buffer address where any returned data is placed.
  [in] | aBuffsize | The size of the buffer.
  [in] | aNbyteRead | The number of bytes to read.

Returns
  dm_device_read() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when data from the device was read successfully.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.
  COMM_ERROR_BUF_SIZE | is returned when the provided buffer is too small to hold all the data or the number of bytes read is zero.
  COMM_ERROR_NO_ACK | is returned when no acknowledgement was received from the device.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_TIME_OUT | is returned when the request could not be fulfilled in the specified timeout period.
  COMM_ERROR_LOCK | is returned when a lock could not be acquired properly.
  COMM_ERROR_DEV_CLOSED | is returned when the read is invoked on a closed device.

Reentrant: Yes

Link Libraries:
  None

Definition at line 271 of file isf_device_messaging.c.

References dm_device_readx().

Referenced by fsl_fxas21002_i2cspi_3D_gyro_Configure(), fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback(), fsl_fxos8700_i2cspi_6D_AccMag_Configure(), fsl_fxos8700_i2cspi_6D_AccMag_PeriodicCallback(), fsl_mag3110_i2c_3D_mag_Configure(), fsl_mag3110_i2c_3D_mag_PeriodicCallback(), fxls8471_CheckId(), fxls8471_GetData(), isf_rli_read(), mag3110_CheckId(), mag3110_GetData(), mag3110_SetConfig(), mma865x_CheckId(), mma865x_GetData(), mpl3115_CheckId(), mpl3115_GetData(), mpl3115_ReadRegisters(), and task_ci().

Here is the call graph for this function:

Here is the caller graph for this function:

isf_status_t dm_device_readx | ( | dm_DeviceDescriptor_t * | apDeviceDescriptor,
|  | int32 | aOffset,
|  | uint8 * | apReadBuffer,
|  | uint32 | aBuffsize,
|  | uint32 | aNbyteRead,
|  | comm_Flags_t | aFlags
| ) |  |

This function reads from a device with extended behavior.

dm_device_readx() reads data from the specified device. The supplied command is sent to the device which may trigger the device to return some data. Any data returned by the device is read and placed in the provided read buffer. dm_device_readx() modifies the basic behavior of the read command by passing a set of bit flags to the underlying protocol interface. To successfully use the extended behavior, it is necessary to understand the underlying protocol being used and to pass the appropriate flag values. The device is implicitly locked during the extension read.

Parameters

  [in] | apDeviceDescriptor | The handle to the device from which to read.
  [in] | aOffset | The offset/sub address from which the read is performed.
  [in] | apReadBuffer | The Buffer address where any returned data is placed.
  [in] | aBuffsize | The size of the buffer.
  [in] | aNbyteRead | The number of bytes to read.
  [in] | aFlags | A set of bit flags controlling the behavior of the write.

Returns
  dm_device_readx() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the device was read successfully.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.
  COMM_ERROR_BUF_SIZE | The provided buffer is too small to hold all the data or the number of bytes to read is zero.
  COMM_ERROR_NO_ACK | is returned when no acknowledgement was received from the device.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_TIME_OUT | is returned when the request could not be fulfilled in the specified timeout period.
  COMM_ERROR_LOCK | is returned when a lock could not be acquired properly.
  COMM_ERROR_DEV_CLOSED | is returned when the read is invoked on a closed device.

Constraints:
  The following constraints must be observed when using this function:
  - apDeviceDescriptor must be valid. A valid device handle is created when the dm_device_open() returns successfully.

Reentrant: Yes

Link Libraries:
  None

Definition at line 284 of file isf_device_messaging.c.

References COMM_ERROR_DEV_CLOSED, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnRead, dm_DeviceDescriptor_struct::pChannelDescriptor, dm_DeviceDescriptor_struct::pEndpointHandle, and dm_ChannelDescriptor_struct::pProtocol.

Referenced by dm_device_read().

Here is the caller graph for this function:

isf_status_t dm_device_write | ( | dm_DeviceDescriptor_t * | apDeviceDescriptor,
|  | int32 | aOffset,
|  | uint8 * | apWriteBuffer,
|  | uint32 | aBuffsize,
|  | uint32 | aNbyteWrite
| ) |  |

This function writes to a device.

dm_device_write() writes data to the specified device. The device is implicitly locked during the write.

Parameters

  [in] | apDeviceDescriptor | The handle of the device to which to write.
  [in] | aOffset | The offset/sub address to which the write is performed.
  [in] | apWriteBuffer | The Buffer address where any write data is placed.
  [in] | aBuffsize | The size of the buffer.
  [in] | aNbyteWrite | The number of bytes to write.

Returns
  dm_device_write() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the device was written successfully.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.
  COMM_ERROR_STOP | is returned when the write is invoked on a stopped channel.
  COMM_ERROR_NO_ACK | is returned when no acknowledgement was received from the device.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_TIME_OUT | is returned when the request could not be fulfilled in the specified timeout period.
  COMM_ERROR_LOCK | is returned when a lock could not be acquired properly.
  COMM_ERROR_DEV_CLOSED | is returned when the write is invoked on a closed device.

Constraints:
  The following constraints must be observed when using this function:
  - apDeviceDescriptor must be valid. A valid device handle is created when the dm_device_open() returns successfully.

Reentrant: Yes

Link Libraries:
  None

Definition at line 309 of file isf_device_messaging.c.

References dm_device_writex().

Referenced by ci_send_packet(), fsl_fxas21002_i2cspi_3D_gyro_Configure(), fsl_fxos8700_i2cspi_6D_AccMag_Configure(), fxls8471_Reset(), fxls8471_SetConfig(), isf_rli_write(), mag3110_SetConfig(), mma865x_Reset(), mma865x_SetConfig(), mpl3115_Reset(), and mpl3115_SetConfig().

Here is the call graph for this function:

Here is the caller graph for this function:

isf_status_t dm_device_writex | ( | dm_DeviceDescriptor_t * | apDeviceDescriptor,
|  | int32 | aOffset,
|  | uint8 * | apWriteBuffer,
|  | uint32 | aBuffsize,
|  | uint32 | aNbyteWrite,
|  | comm_Flags_t | aFlags
| ) |  |

This function writes data to a device with extended write behavior.

dm_device_writex() writes data to the specified device. This function modifies the basic behaviour of the write command by passing a set of bit flags to the underlying protocol interface. To successfully use the extended behavior, it is necessary to understand the underlying protocol used and to pass the appropriate flag values. As an example, if it is known that the underlying device is an I2C bus, it is possible to set the appropriate flag values to explicitly control the RepeatedStart behavior at the conclusion of the dm_device_write() call. The device is implicitly locked during the extension write.

Parameters

  [in] | apDeviceDescriptor | The handle of the device to which to write.
  [in] | aOffset | The offset/sub address to which the write is performed.
  [in] | apWriteBuffer | The Buffer address where any write data is placed.
  [in] | aBuffsize | The size of the buffer.
  [in] | aNbyteWrite | The number of bytes to write..
  [in] | aFlags | A set of bit flags controlling the behavior of the write.

Returns
  dm_device_writex() returns a value of type isf_status_t indicating whether the operation was successful or unsuccessful.

Return values

  ISF_SUCCESS | is returned when the data was successfully written to the device.
  COMM_ERROR_INIT | is returned when the channel handle refers to a non-initialized channel.
  COMM_ERROR_NO_ACK | is returned when no acknowledgement was received from the device.
  COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function.
  COMM_ERROR_TIME_OUT | is returned when the request could not be fulfilled in the specified timeout period.
  COMM_ERROR_LOCK | is returned when a lock could not be acquired properly.
  COMM_ERROR_DEV_CLOSED | is returned when the write is invoked on a closed device.

Constraints:
  The following constraints must be observed when using this function:
  - apDeviceDescriptor must be valid. A valid device handle is created when the dm_device_open() function returns successfully.

Reentrant: Yes

Link Libraries:
  isf_core.lib

Definition at line 324 of file isf_device_messaging.c.

References COMM_ERROR_DEV_CLOSED, COMM_ERROR_INIT, COMM_ERROR_NULL_PTR, protocol_t::fnWrite, dm_DeviceDescriptor_struct::pChannelDescriptor, dm_DeviceDescriptor_struct::pEndpointHandle, and dm_ChannelDescriptor_struct::pProtocol.

Referenced by dm_device_write().

Here is the caller graph for this function:

## Variable Documentation

const sys_channelDescriptor_t gSys_ConfiguredChannelList[]

Definition at line 105 of file isf_sysconf_comms.c.

const uint8 gSys_NumChannels

Definition at line 133 of file isf_sysconf_comms.c.

Referenced by dm_channel_init().

const protocol_t PROTOCOL[]

Lookup table to find protocol-specific functions and properties. Indexed by sys_protocolType_t.

This table contains one entry for each type of supported protocol.

Definition at line 23 of file isf_dm_protocol.c.

- © Freescale Semiconductor, Inc. 2015. All Rights Reserved.