#ident "$Id: iosresclt.h,v 1.3 2006/02/09 20:16:05 orest Exp $"
/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */
#ifndef __IOS_RESCLT_H__
#define __IOS_RESCLT_H__

#include "iosrestypes.h"

/* Non-blocking API 
 * XXX - There will be minor naming and other changes to the following.
 *       No real change in functionality.
 */


typedef IOSError (*IOSIpcCb) (IOSResourceRequest *req);

/*
    path needs to be allocated in DDR
*/

#define IOS_Open    _IOS_Open
#define IOS_Close   _IOS_Close
#define IOS_Read    _IOS_Read
#define IOS_Write   _IOS_Write
#define IOS_Seek    _IOS_Seek
#define IOS_Ioctl   _IOS_Ioctl
#define IOS_Ioctlv  _IOS_Ioctlv

IOSError
IPC_Init(void);

IOSFd 
IOS_OpenAsync(
        const char *path, 
        u32         flags, 
        IOSIpcCb    cb);
IOSFd 
_IOS_Open(
        const char *path, 
        u32         flags);

IOSError 
IOS_CloseAsync(
        IOSFd     fd, 
        IOSIpcCb  cb);
IOSError 
_IOS_Close(
        IOSFd     fd);

/*
    buf needs to be allocated in DDR
*/
IOSError 
IOS_ReadAsync(
        IOSFd     fd, 
        void     *buf, 
        u32       count, 
        IOSIpcCb  cb);
IOSError
_IOS_Read(
        IOSFd     fd,
        void     *buf,
        u32       count);

/*
    buf needs to be allocated in DDR
*/
IOSError 
IOS_WriteAsync(
        IOSFd     fd, 
        void     *buf, 
        u32       count, 
        IOSIpcCb  cb);
IOSError
_IOS_Write(
        IOSFd     fd,
        void     *buf,
        u32       count);

IOSError 
IOS_SeekAsync(
        IOSFd     fd, 
        s32       offset, 
        u32       whence, 
        IOSIpcCb  cb);
IOSError
_IOS_Seek(
        IOSFd     fd,
        s32       offset,
        u32       whence);

/*
    input, output need to be allocated in DDR
*/
IOSError 
IOS_IoctlAsync(
        IOSFd     fd, 
        s32       cmd,
        void     *input, 
        u32       inputLen,
        void     *output, 
        u32       outputLen,
        IOSIpcCb  cb);
IOSError
_IOS_Ioctl(
        IOSFd     fd,
        s32       cmd,
        void     *input,
        u32       inputLen,
        void     *output,
        u32       outputLen);

/*
    vector's "input", "output" need to be allocated in shared DDR memory
*/
IOSError 
IOS_IoctlvAsync(
        IOSFd        fd, 
        s32          cmd,
        u32          readCount,
        u32          writeCount,
        IOSIoVector *vect,
        IOSIpcCb     cb);
IOSError
_IOS_Ioctlv(
        IOSFd        fd,
        s32          cmd,
        u32          readCount,
        u32          writeCount,
        IOSIoVector *vect);

#endif /* __IOS_RESCLT_H__ */
