![]() |
ISF
2.2 rev 5
Intelligent Sensing Framework for Kinetis with Processor Expert
|
isf_devmsg.h defines the API definitions and types for the Intelligent Sensing (ISF) Device Messaging (DM) component. More...
Go to the source code of this file.
Data Structures | |
struct | dm_ChannelDescriptor_struct |
This structure is a declaration of a channel descriptor type. More... | |
struct | dm_DeviceDescriptor_struct |
This structure defines a handle for the device. More... | |
Macros | |
#define | INVALID_OFFSET (-1) |
This macro defines the invalid offset for the read and write functions. More... | |
Typedefs | |
typedef comm_Id_t | dm_ChannelId_t |
This typedef is a numeric channel identifier index into an array of channels in the system. More... | |
typedef void * | dm_ChannelConfig_ptr |
This structure defines the user-specified parameters for channel configuration. More... | |
typedef struct dm_ChannelDescriptor_struct | dm_ChannelDescriptor_t |
This structure is a declaration of a channel descriptor type. More... | |
typedef struct dm_DeviceDescriptor_struct | dm_DeviceDescriptor_t |
This structure defines a handle for the device. More... | |
Functions | |
dm_ChannelDescriptor_t * | dm_channel_get_descriptor (dm_DeviceDescriptor_t *apDeviceDescriptor) |
This function retrieves the channel descriptor from a device handle. More... | |
Initialization Routines | |
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... | |
Queries and Status | |
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... | |
Device Control Routines | |
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... | |
Channel Control Routines | |
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 Operation Routines | |
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... | |
isf_devmsg.h defines the API definitions and types for the Intelligent Sensing (ISF) Device Messaging (DM) component.
File: isf_devmsg.h
Copyright (c) 2015, Freescale Semiconductor, Inc.
Definition in file isf_devmsg.h.
#define INVALID_OFFSET (-1) |
This macro defines the invalid offset for the read and write functions.
Definition at line 67 of file isf_devmsg.h.
Referenced by i2c_master_adapter_read(), and i2c_master_adapter_write().
typedef void* dm_ChannelConfig_ptr |
This structure defines the user-specified parameters for channel configuration.
This type allows the device messaging APIs to handle a protocol-specific configuration pointer opaquely until it is passed to the specific protocol functions that use the data.
Definition at line 42 of file isf_devmsg.h.
typedef struct dm_ChannelDescriptor_struct dm_ChannelDescriptor_t |
This structure is a declaration of a channel descriptor type.
The channel descriptor contains the bus and protocol information required by the device messaging functions to safely use a channel for communications. The members are ordered to maintain natural alignment without inserting padding bytes.
typedef comm_Id_t dm_ChannelId_t |
This typedef is a numeric channel identifier index into an array of channels in the system.
Definition at line 33 of file isf_devmsg.h.
typedef struct dm_DeviceDescriptor_struct dm_DeviceDescriptor_t |
This structure defines a handle for the device.
The device handle contains the information required by the device messaging functions to address and communicate with a slave device.
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.
[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. |
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. |
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 Custom_1_fsl_Sensor_Custom_Configure(), fsl_fxas21002_i2cspi_3D_gyro_Configure(), fsl_fxls8471_i2cspi_3D_accel_Configure(), fsl_fxls8952_i2c_3D_accel_Configure(), fsl_fxos8700_i2cspi_6D_AccMag_Configure(), fsl_mag3110_i2c_3D_mag_Configure(), fsl_mma8491q_i2c_3D_accel_Configure(), fsl_mma865x_i2c_3D_accel_Configure(), fsl_mpl3115_i2c_1D_press_Configure(), fxlc95000_read(), fxlc95000_send(), fxlc95000_WriteConfig(), mma955x_read(), mma955x_send(), and mma955x_WriteConfig().
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.
[in] | apChannelDescriptor | The handle of the channel to be configured. |
[in] | apChannelConfig | The channel configuration used during initialization. |
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. |
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.
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.
[in] | apChannelDescriptor | The handle of the channel to be configured. |
[out] | apChannelConfig | The address of a channel configuration to be filled. |
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. |
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.
[in] | apDeviceDescriptor | Handle of device connected on the channel of interest. |
NULL | is returned when the specified device handle is invalid. |
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.
[in] | apChannelDescriptor | The handle of the channel to be queried. |
COMM_ERROR_NULL_PTR | is returned when a NULL pointer argument was passed into the function. |
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(), Custom_1_fsl_Sensor_Custom_Initialize(), fsl_fxas21002_i2cspi_3D_gyro_Initialize(), fsl_fxlc95000_Initialize(), fsl_fxls8471_i2cspi_3D_accel_Initialize(), fsl_fxls8952_i2c_3D_accel_Initialize(), fsl_fxos8700_i2cspi_6D_AccMag_Initialize(), fsl_mag3110_i2c_3D_mag_Initialize(), fsl_mma8491q_i2c_3D_accel_Initialize(), fsl_mma865x_i2c_3D_accel_Initialize(), fsl_mma955x_Initialize(), and fsl_mpl3115_i2c_1D_press_Initialize().
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.
[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. |
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. |
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(), Custom_1_fsl_Sensor_Custom_Initialize(), fsl_fxas21002_i2cspi_3D_gyro_Initialize(), fsl_fxlc95000_Initialize(), fsl_fxls8471_i2cspi_3D_accel_Initialize(), fsl_fxls8952_i2c_3D_accel_Initialize(), fsl_fxos8700_i2cspi_6D_AccMag_Initialize(), fsl_mag3110_i2c_3D_mag_Initialize(), fsl_mma8491q_i2c_3D_accel_Initialize(), fsl_mma865x_i2c_3D_accel_Initialize(), fsl_mma955x_Initialize(), fsl_mpl3115_i2c_1D_press_Initialize(), and isf_rli_init().
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().
[in] | apChannelDescriptor | The handle of the channel to unlock. |
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. |
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 Custom_1_fsl_Sensor_Custom_Configure(), fsl_fxas21002_i2cspi_3D_gyro_Configure(), fsl_fxls8471_i2cspi_3D_accel_Configure(), fsl_fxls8952_i2c_3D_accel_Configure(), fsl_fxos8700_i2cspi_6D_AccMag_Configure(), fsl_mag3110_i2c_3D_mag_Configure(), fsl_mma8491q_i2c_3D_accel_Configure(), fsl_mma865x_i2c_3D_accel_Configure(), fsl_mpl3115_i2c_1D_press_Configure(), fxlc95000_read(), fxlc95000_send(), fxlc95000_WriteConfig(), mma955x_read(), mma955x_send(), and mma955x_WriteConfig().
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.
[in] | apChannelDescriptor | The handle of the channel to be started. |
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. |
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(), Custom_1_fsl_Sensor_Custom_Initialize(), fsl_fxas21002_i2cspi_3D_gyro_Initialize(), fsl_fxlc95000_Initialize(), fsl_fxls8471_i2cspi_3D_accel_Initialize(), fsl_fxls8952_i2c_3D_accel_Initialize(), fsl_fxos8700_i2cspi_6D_AccMag_Initialize(), fsl_mag3110_i2c_3D_mag_Initialize(), fsl_mma8491q_i2c_3D_accel_Initialize(), fsl_mma865x_i2c_3D_accel_Initialize(), fsl_mma955x_Initialize(), fsl_mpl3115_i2c_1D_press_Initialize(), and isf_rli_init().
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.
[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. |
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. |
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.
[in] | apDeviceDescriptor | The address of the DeviceHandle to be closed. |
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. |
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.
Referenced by isf_rli_close().
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.
[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. |
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. |
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(), Custom_1_fsl_Sensor_Custom_Initialize(), fsl_fxas21002_i2cspi_3D_gyro_Initialize(), fsl_fxlc95000_Initialize(), fsl_fxls8471_i2cspi_3D_accel_Initialize(), fsl_fxls8952_i2c_3D_accel_Initialize(), fsl_fxos8700_i2cspi_6D_AccMag_Initialize(), fsl_mag3110_i2c_3D_mag_Initialize(), fsl_mma8491q_i2c_3D_accel_Initialize(), fsl_mma865x_i2c_3D_accel_Initialize(), fsl_mma955x_Initialize(), fsl_mpl3115_i2c_1D_press_Initialize(), and isf_rli_open().
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.
[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. |
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. |
Definition at line 271 of file isf_device_messaging.c.
References dm_device_readx().
Referenced by Custom_1_fsl_Sensor_Custom_Configure(), Custom_1_fsl_Sensor_Custom_EndData(), Custom_1_fsl_Sensor_Custom_Initialize(), Custom_1_fsl_Sensor_Custom_PeriodicCallback(), Custom_1_fsl_Sensor_Custom_StartData(), fsl_fxas21002_i2cspi_3D_gyro_Configure(), fsl_fxas21002_i2cspi_3D_gyro_PeriodicCallback(), fsl_fxls8952_i2c_3D_accel_Configure(), fsl_fxls8952_i2c_3D_accel_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(), fxlc95000_read(), fxlc95000_waitForCoCo(), fxls8471_CheckId(), fxls8471_GetData(), isf_rli_read(), mag3110_CheckId(), mag3110_GetData(), mag3110_SetConfig(), mma8491q_CheckId(), mma8491q_getAccelData(), mma865x_CheckId(), mma865x_GetData(), mma955x_read(), mma955x_waitForCoCo(), mpl3115_CheckId(), mpl3115_GetData(), and task_ci().
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.
[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. |
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. |
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().
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.
[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. |
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. |
Definition at line 309 of file isf_device_messaging.c.
References COMM_ERROR_NULL_PTR, and dm_device_writex().
Referenced by ci_send_packet(), Custom_1_fsl_Sensor_Custom_Configure(), Custom_1_fsl_Sensor_Custom_EndData(), Custom_1_fsl_Sensor_Custom_StartData(), fsl_fxas21002_i2cspi_3D_gyro_Configure(), fsl_fxls8952_i2c_3D_accel_Configure(), fsl_fxls8952_i2c_3D_accel_PeriodicCallback(), fsl_fxos8700_i2cspi_6D_AccMag_Configure(), fxlc95000_send(), fxlc95000_WriteConfig(), fxls8471_Reset(), fxls8471_SetConfig(), isf_rli_write(), mag3110_SetConfig(), mma865x_Reset(), mma865x_SetConfig(), mma955x_send(), mma955x_WriteConfig(), mpl3115_Reset(), and mpl3115_SetConfig().
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.
[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. |
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. |
Definition at line 328 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().