edma.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011, 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    0x02000000U
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 
00165 #define EDMA_IOCMAGIC                   0x0000fd00
00166 #define EDMA_IOCCMDMASK                 0x000000ff
00167 
00171 struct EDMA_requestDmaParams {
00172     int dev_id;                                   
00173     int eventq_no;                                
00174     int tcc;                                      
00175     int param;                                    
00176     int nParam;
00177     int channel;                                  
00178 };
00179 
00183 struct EDMA_releaseDmaParams {
00184     int channel;
00185     int nParam;
00186 };
00187 
00191 typedef enum EDMA_Status {
00192     EDMA_OK = 0,        
00193     EDMA_EFAIL,         
00194     EDMA_ENOCHANNEL,    
00195     EDMA_ENOINIT        
00196 } EDMA_Status;
00197 
00198 
00202 int EDMA_init(void);
00203 
00207 int EDMA_exit(void);
00208 
00214 EDMA_Status EDMA_mapBaseAddress(void **pvirtAddr);
00215 
00251 EDMA_Status EDMA_getResource(int devId, int *tcc, int *channel, int *param,
00252                              int nParams);
00253 
00270 EDMA_Status EDMA_freeResource(int lch, int nParams);
00271 
00279 int EDMA_getVersion(void);
00280 
00296 EDMA_Status EDMA_registerResource(int lch);
00297 
00313 EDMA_Status EDMA_unregister(int lch, int nParams);
00314 
00317 #if defined (__cplusplus)
00318 }
00319 #endif
00320 
00321 #endif
00322 /*
00323  *  @(#) ti.sdo.linuxutils.edma; 1, 0, 0,96; 12-9-2011 16:56:41; /db/atree/library/trees/linuxutils/linuxutils-j06x/src/ xlibrary
00324 
00325  */
00326 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2011, Texas Instruments Incorporated