Data Structures | Defines | Typedefs | Enumerations | Functions

edma.h File Reference


Detailed Description

Describes the interface to the EDMA manager.

The edma user interface library wraps file system calls to an associated kernel module (edmak.ko), which needs to be loaded in order for calls to to this library to succeed.

To install edmak.ko, enter % insmod edmak.ko on a Linux command line.

EDMA channels are allocated (requested) from within the edmak kernel driver through the EDMA_getResource() API. This request is granted by way of the kernel's request_dma() functionality (davinci_request_dma() for the DM365), so it will work in conjuntion with independent kernel DMA usage without conflict or custom kernel configuration.

EDMA registers can be mapped to a process's address by way of the API EDMA_mapBaseAddress(). The EDMA registers are memory-mapped into the calling process' user address space to allow the application to directly access the EDMA registers.

Resource allocation is tracked at the process level by way of a 'process registration' list. The initial allocator of a resource (the process that calls EDMA_getResource()) is automatically added to the registration list, and further processes can become registered for the same resource by way of the EDMA_registerResource() API (and unregister with the EDMA_unregister() API). This registration list for each resource (logical channel) allows for resource ownership tracking and cleanup on a per-process basis, so that when a process exits or dies without having explicitly freed/unregistered its resources, they get automatically unregistered (and freed when no more registered processes exist). Only when the last registered process frees a resource (either explictily, or by auto-cleanup) does a resource actually get freed back to the kernel.

Since the EDMA interface library doesn't use the GT tracing facility, there is one configuration option available for the EDMA module to control whether the debug or release interface library is used for building the application. This config parameter is named 'debug' and is of type bool, and the default value is 'false'.

The following line is an example of enabling usage of the debug interface library: var edma = xdc.useModule('ti.sdo.linuxutils.edma.EDMA'); edma.debug = true; This will enable "EDMA Debug" statements to be printed to stdout.

Go to the source code of this file.

Data Structures

struct  EDMA_requestDmaParams
 EDMAK ioctl input/output parameters. More...
struct  EDMA_releaseDmaParams
 EDMAK ioctl input parameters. More...

Defines

#define EDMA_VERSION   0x02000000U
#define EDMA_TCCANY   1001
 Values for dev_id parameter of EDMA_getResource()
#define EDMA_TCCSYMM   1005
#define EDMA_PARAMANY   1006
#define EDMA_PARAMFIXEDEXACT   1007
#define EDMA_PARAMFIXEDNOTEXACT   1008
#define EDMA_EDMAANY   1003
#define EDMA_QDMAANY   1004
#define EDMA_QDMA0   512
#define EDMA_QDMA1   EDMA_QDMA(1)
#define EDMA_QDMA2   EDMA_QDMA(2)
#define EDMA_QDMA3   EDMA_QDMA(3)
#define EDMA_QDMA4   EDMA_QDMA(4)
#define EDMA_QDMA5   EDMA_QDMA(5)
#define EDMA_QDMA6   EDMA_QDMA(6)
#define EDMA_QDMA7   EDMA_QDMA(7)
#define EDMA_QDMA(n)   (EDMA_QDMA0 + (n))
 macro used to translate from a QDMA channel # to the numerical range used by EDMA_getResource() & EDMA_freeResource() for representing a QDMA channel.
#define EDMA_QDMA2NUM(qdma)   (qdma - EDMA_QDMA0)
 macro to translate from EDMA_QDMA0 -> EDMA_QDMA7 namespace to actual QDMA number 0 -> 7.
#define EDMA_IOCMAGIC   0x0000fd00
#define EDMA_IOCCMDMASK   0x000000ff

Typedefs

typedef enum EDMA_Status EDMA_Status
 Status codes for EDMA API return values.

Enumerations

enum  EDMA_commmands {
  EDMA_IOCREQUESTDMA = 1,
  EDMA_IOCRELEASEDMA,
  EDMA_IOCGETVERSION,
  EDMA_IOCGETBASEPHYSADDR,
  EDMA_IOCREGUSER
}
 

EDMAK ioctl() commands.

More...
enum  EDMA_Status {
  EDMA_OK = 0,
  EDMA_EFAIL,
  EDMA_ENOCHANNEL,
  EDMA_ENOINIT
}
 

Status codes for EDMA API return values.

More...

Functions

int EDMA_init (void)
 EDMA initialization API.
int EDMA_exit (void)
 EDMA finalization API.
EDMA_Status EDMA_mapBaseAddress (void **pvirtAddr)
 Returns user space virtual address of EDMA base registers.
EDMA_Status EDMA_getResource (int devId, int *tcc, int *channel, int *param, int nParams)
 Returns available logical channels.
EDMA_Status EDMA_freeResource (int lch, int nParams)
 Frees previously requested logical channel.
int EDMA_getVersion (void)
 Retrieve version from EDMA driver.
EDMA_Status EDMA_registerResource (int lch)
 Registers calling process as a user of lch.
EDMA_Status EDMA_unregister (int lch, int nParams)
 Unregisters calling process as a user of lch.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Copyright 2011, Texas Instruments Incorporated