sdma.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2009, Texas Instruments Incorporated
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * *  Redistributions of source code must retain the above copyright
00010  *    notice, this list of conditions and the following disclaimer.
00011  *
00012  * *  Redistributions in binary form must reproduce the above copyright
00013  *    notice, this list of conditions and the following disclaimer in the
00014  *    documentation and/or other materials provided with the distribution.
00015  *
00016  * *  Neither the name of Texas Instruments Incorporated nor the names of
00017  *    its contributors may be used to endorse or promote products derived
00018  *    from this software without specific prior written permission.
00019  *
00020  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00021  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00022  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00023  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00024  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00026  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00027  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00028  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00029  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00030  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031  *
00032  */
00033 
00085 #ifndef ti_sdo_linuxutils_sdma_interface_sdma_
00086 #define ti_sdo_linuxutils_sdma_interface_sdma_
00087 
00088 #if defined (__cplusplus)
00089 extern "C" {
00090 #endif
00091 
00094 
00095 #define SDMA_VERSION    0x01000000U
00096 
00100 typedef enum {
00101     SDMA_IOCREQUESTDMA = 1,
00102     SDMA_IOCRELEASEDMA,
00103     SDMA_IOCWAITFORCOMPLETION,
00104     SDMA_IOCGETVERSION
00105 } SDMA_commmands;
00106 
00117 struct SDMA_transferState {
00118     volatile int transferCompleted;    
00119     volatile int checkPending;         
00120 };
00121 
00125 union SDMA_requestDmaParams {
00126     struct SDMA_transferState *ptransferState;    
00127     int channel;                                  
00128 };
00129 
00146 typedef struct SDMA_ChannelDescriptor {
00147     int chanNum;            
00148     unsigned int * addr;    
00149     struct SDMA_transferState transferState;    
00150 } SDMA_ChannelDescriptor;
00151 
00155 typedef enum SDMA_Status {
00156     SDMA_OK = 0,        
00157     SDMA_EFAIL,         
00158     SDMA_ENOCHANNEL,    
00159     SDMA_ENOINIT        
00160 } SDMA_Status;
00161 
00162 
00166 int SDMA_init(void);
00167 
00171 int SDMA_exit(void);
00172 
00193 SDMA_Status SDMA_getChannels(int numChannels,
00194         SDMA_ChannelDescriptor chanArray[]);
00195 
00206 SDMA_Status SDMA_freeChannels(int numChannels,
00207         SDMA_ChannelDescriptor chanArray[]);
00208 
00225 SDMA_Status SDMA_wait(SDMA_ChannelDescriptor * channel);
00226 
00240 SDMA_Status SDMA_check(SDMA_ChannelDescriptor * channel, int *pcompleted);
00241 
00249 int SDMA_getVersion(void);
00250 
00253 #if defined (__cplusplus)
00254 }
00255 #endif
00256 
00257 #endif
00258 /*
00259  *  @(#) ti.sdo.linuxutils.sdma; 1, 0, 0,68; 6-11-2009 17:59:38; /db/atree/library/trees/linuxutils/linuxutils-e02x/src/
00260  */
00261 

Copyright 2009, Texas Instruments Incorporated