edma.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 
00089 #ifndef ti_sdo_linuxutils_edma_interface_edma_
00090 #define ti_sdo_linuxutils_edma_interface_edma_
00091 
00092 #if defined (__cplusplus)
00093 extern "C" {
00094 #endif
00095 
00098 
00099 #define EDMA_VERSION    0x01100000U
00100 
00104 /*
00105  * To make implementation easier, we're matching the values below to
00106  * similar values in the kernel header file include/asm/arch/edma.h.
00107  * However, we're not tied to the LSP #defines since we translate from
00108  * our #defines below to the LSP #defines in the kernel module edmak.ko.
00109  * What this means is that we are free to change the ones below, but must
00110  * be sure to not clash with EDMA channel numbers directly
00111  * (0 -> (EDMA_NUM_DMACH - 1)).
00112  */
00113 #define EDMA_TCCANY             1001
00114 #define EDMA_TCCSYMM            1005
00115 #define EDMA_PARAMANY           1006
00116 #define EDMA_PARAMFIXEDEXACT    1007
00117 #define EDMA_PARAMFIXEDNOTEXACT 1008
00118 #define EDMA_EDMAANY            1003
00119 #define EDMA_QDMAANY            1004
00120 #define EDMA_QDMA0              512     /* should be > all arch's # PaRAM */
00121 
00122 #define EDMA_QDMA1    EDMA_QDMA(1)
00123 #define EDMA_QDMA2    EDMA_QDMA(2)
00124 #define EDMA_QDMA3    EDMA_QDMA(3)
00125 #define EDMA_QDMA4    EDMA_QDMA(4)
00126 #define EDMA_QDMA5    EDMA_QDMA(5)
00127 #define EDMA_QDMA6    EDMA_QDMA(6)
00128 #define EDMA_QDMA7    EDMA_QDMA(7)
00129 
00137 #define EDMA_QDMA(n)  (EDMA_QDMA0 + (n))
00138 
00152 #define EDMA_QDMA2NUM(qdma)  (qdma - EDMA_QDMA0)
00153 
00157 typedef enum {
00158     EDMA_IOCREQUESTDMA = 1,
00159     EDMA_IOCRELEASEDMA,
00160     EDMA_IOCGETVERSION,
00161     EDMA_IOCGETBASEPHYSADDR,
00162     EDMA_IOCREGUSER
00163 } EDMA_commmands;
00164 
00168 struct EDMA_requestDmaParams {
00169     int dev_id;                                   
00170     int eventq_no;                                
00171     int tcc;                                      
00172     int param;                                    
00173     int nParam;
00174     int channel;                                  
00175 };
00176 
00180 struct EDMA_releaseDmaParams {
00181     int channel;
00182     int nParam;
00183 };
00184 
00188 typedef enum EDMA_Status {
00189     EDMA_OK = 0,        
00190     EDMA_EFAIL,         
00191     EDMA_ENOCHANNEL,    
00192     EDMA_ENOINIT        
00193 } EDMA_Status;
00194 
00195 
00199 int EDMA_init(void);
00200 
00204 int EDMA_exit(void);
00205 
00211 EDMA_Status EDMA_mapBaseAddress(void **pvirtAddr);
00212 
00248 EDMA_Status EDMA_getResource(int devId, int *tcc, int *channel, int *param,
00249                              int nParams);
00250 
00267 EDMA_Status EDMA_freeResource(int lch, int nParams);
00268 
00276 int EDMA_getVersion(void);
00277 
00293 EDMA_Status EDMA_registerResource(int lch);
00294 
00310 EDMA_Status EDMA_unregister(int lch, int nParams);
00311 
00314 #if defined (__cplusplus)
00315 }
00316 #endif
00317 
00318 #endif
00319 /*
00320  *  @(#) ti.sdo.linuxutils.edma; 1, 0, 0,65; 6-11-2009 17:58:12; /db/atree/library/trees/linuxutils/linuxutils-e02x/src/
00321  */
00322 

Copyright 2009, Texas Instruments Incorporated