/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_DCOPY_DEVICE_H
#define _SYS_DCOPY_DEVICE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* private command state. Space for this structure should be allocated during
* (*cb_cmd_alloc). The DMA driver must set dp_private in dcopy_cmd_t to point
* to the memory it allocated. Other than pr_device_cmd_private, the DMA driver
* should not touch any of the fields in this structure. pr_device_cmd_private
* is a private pointer for the DMA engine to use.
*/
struct dcopy_cmd_priv_s {
/*
* we only init the state used to track a command which blocks when it
* actually blocks. pr_block_init tells us when we need to clean it
* up during a cmd_free.
*/
/* dcopy_poll blocking state */
/* back pointer to the command */
/* shortcut to the channel we're on */
/* DMA driver private pointer */
void *pr_device_cmd_private;
};
/* cb_version */
#define DCOPY_DEVICECB_V0 0
typedef struct dcopy_device_chaninfo_s {
typedef struct dcopy_device_cb_s {
int cb_version;
int cb_res1;
dcopy_cmd_t *cmd);
/*
* status
*/
/*
* if dcopy_device_unregister() returns DCOPY_PENDING, dcopy will
* call this routine when all the channels are no longer being
* used and have been free'd up. e.g. it's safe for the DMA driver
* to detach.
* status = DCOPY_SUCCESS || DCOPY_FAILURE
*/
typedef struct dcopy_device_info_s {
/* dcopy_device_notify() status */
#define DCOPY_COMPLETION 0
/*
* dcopy_device_register()
* register the DMA device with dcopy.
* return status => DCOPY_FAILURE, DCOPY_SUCCESS
*/
/*
* dcopy_device_unregister()
* try to unregister the DMA device with dcopy. If the DMA engines are
* still being used by upper layer modules, DCOPY_PENDING will be returned.
* return status => DCOPY_FAILURE, DCOPY_SUCCESS, DCOPY_PENDING
* if DCOPY_PENDING, (*cb_unregister_complete)() will be called when
* completed.
*/
/*
* dcopy_device_channel_notify()
* Notify dcopy of an event.
* dcopy_handle_t handle => what was passed into (*cb_alloc)()
* status => DCOPY_COMPLETION
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DCOPY_DEVICE_H */