dma.h

来自「OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI」· C头文件 代码 · 共 993 行 · 第 1/4 页

H
993
字号
/*
===============================================================================
            TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION           
                                                                             
   Property of Texas Instruments 
   For  Unrestricted  Internal  Use  Only 
   Unauthorized reproduction and/or distribution is strictly prohibited.  
   This product is protected under copyright law and trade secret law 
   as an unpublished work.  
   Created 1999, (C) Copyright 1999 Texas Instruments.  All rights reserved.

   Filename       	: DMA.h

   Description    	: Header file for the SatuStar DMA Controller

   Project        	: Satustar

   Author         	: Francois Reygagne freygagn@tif.ti.com
   FUNCTIONS PROVIDED    :

     DMA_DisableChannel     : Clear the enable bit to Disable the selected channel
     DMA_EnableChannel      : Enable the selected channel
     DMA_SendEmifToEmif     : Do a single transfer from EMIF to Rhea thanks to a soft
                              request with an IT at the end of the transfer
     DMA_SendSdramToEmif    : Do a single transfer from SDRAM to EMIF                                                    with an IT at the end of the transfer 
     DMA_ConfigureRheaToEmif: Configure a transfer from a Rhea peripheral to EMIF
     DMA_ConfigureEmifToRhea: Configure a transfer from Emif to a Rhea peripheral
     DMA_SendLocalToRhea    : Do single transfer from Local Bus to Rhea peripheral
     DMA_SendEmifToLocal    : Do single transfer from Emif to Local Bus
     DMA_SendLocalToEmif    : Do single transfer from Local bus to Emif 
     DMA_SendLocalToLocal   : Do single transfer from Local bus to Local bus 
     DMA_SendSdramToLocal   : Do single transfer from Sdram to Local bus
     DMA_SendLocalToSdram   : Do single transfer from Local bus to Sdram
     DMA_BlockTransferCompleted: Determine whether the transfer is completed or not
     DMA_SetControlReg         : Setup the control register
     DMA_GetControlReg         : Get the control register value
     DMA_GetCondBitsInterrupt  : Get the conditional interruption bits
     DMA_GetNextWriteAddress   : Get the next write address
     DMA_SetPortSource         : Set the space select transfert source
     DMA_SetPortDest           : Set the space select transfert destination
     DMA_SetSourceAddress      : Set the complete source address
     DMA_SetDestAddress        : Set the complete destination address
     DMA_SetRheaSourceAddress  : Set the Rhea Bridge source address
     DMA_SetRheaDestAddress    : Set the Rhea Bridge destination address
     DMA_SetBlockCount         : Set the transfer length in bytes
     DMA_SetLcdCtrolReg        : Set LCD control register
     DMA_SetLcdTopFrame1       : Set the start address of the video ram buffer_1
     DMA_SetLcdTopFrame2       : Set the start address of the video ram buffer_2
     DMA_SetLcdBottomFrame1    : Set the bottom address of the video ram buffer_1
     DMA_SetLcdBottomFrame2    : Set the bottom address of the video ram buffer_2
===============================================================================
*/
#ifndef _DMA__HH
#define _DMA__HH

#include "top.h"
#include "rheabridge.h"


/* Total Number of channels */
#define DMA_NUMBER_OF_CHANNEL  4
/*
  DMA_ChannelId_t
*/
typedef enum {
  DMA_CHANNEL_0 = 0,
  DMA_CHANNEL_1 = 1,
  DMA_CHANNEL_2 = 2,
  DMA_CHANNEL_3 = 3,
  DMA_CHANNEL_LCD = 4
} DMA_ChannelId_t;

/*
  DMA_Priority_t
  -Priority Channel enables an urgent request when High
*/
typedef enum {
  DMA_LOW_PRIORITY = 0,
  DMA_HIGH_PRIORITY = 1
} DMA_Priority_t;


/*
  DMA_Autoinit_t
  -specifies the auto-initialization mode which
  the DMA can automatically reinitialize itself after completion 
  of block transfer: Used for the data refreshment of a LCD display
*/
typedef enum {
  DMA_AUTOINIT_DISABLE = 0,
  DMA_AUTOINIT_ENABLE = 1
} DMA_Autoinit_t;


/* 
  DMA_HalfBlockTrIE_t
  -Enable or disable the IT of half block completion
*/
typedef enum {
  DMA_DISABLE_HALF_BLOCK_TRANSFER_IT = 0,
  DMA_ENABLE_HALF_BLOCK_TRANSFER_IT = 1
} DMA_HalfBlockTrIE_t;


/*
------------------------------------------------------------------------
 NAME        : DMA_EnableChannel                                       -
 DESCRIPTION : Enable the selected channel                             -
               -For a no synchronous transfer, Initiate a DMA Transfer -
 PARAMETERS  : ChanelId = one of the four DMA channels                 -
 RETURN VALUE: None                                                    -
 LIMITATIONS : At the end of the transfer, if autoinit is active       -
               this bit is cleared by the Transfer_Completed exception -
------------------------------------------------------------------------
*/
void DMA_EnableChannel(const DMA_ChannelId_t ChannelId);


/*
---------------------------------------------------------------------
 NAME        : DMA_DisableChannel                                   -
 DESCRIPTION : Clear the enable bit to Disable the selected channel -
               -In autoinit mode, Stop the current transfer         -
               -Make DMA ignoring hard requests                     -
 PARAMETERS  : ChanelId = one of the four DMA channels              -
 RETURN VALUE: None                                                 -
 LIMITATIONS :                   -
---------------------------------------------------------------------
*/
void DMA_DisableChannel(const DMA_ChannelId_t ChannelId);

/*
----------------------------------------------------------------------
 NAME        : DMA_IsChannelEnable                                   -
 DESCRIPTION : Read ENABLE bit of DMA Channel Control Register and   -
               Indicates whether the channel is enable               -
 PARAMETERS  : None                                                  -
 RETURN VALUE: True when selected channel is Enabled otherwise False -
 LIMITATIONS : None                                                  -
----------------------------------------------------------------------
*/
boolean_t DMA_IsChannelEnable(const DMA_ChannelId_t ChannelId);



/*
---------------------------------------------------------------------------
 NAME        : DMA_SendEmifToRhea                                         -
 DESCRIPTION : Do a single transfer from EMIF to Rhea thanks to a soft   -
               request with an IT at the end of the transfer              -
 PARAMETERS  :                                                            -
   ChanelId           = one of the four DMA channels                      -
   Priority           = Priority Channel enables urgent request when High -
   SourceAddress      = 28 bits EMIF Source address for the transfer      -
   DestRheaOffset     = Destination Rhea address 11 bytes 0..2047         -
                        Corresponds to the offset into the 2 Kbytes block -
                        of the selected chip select.                      -
   DestRheaChipSelect = Chip Select strobe0: 0..27 (5 bits)               -
                        0  .. 27 for strobe 0                             -
   TransferLength     = Maximum transfer is 65535 (64ko)                  -
   AutoInitToggle     = Auto-initialization mode which the DMA can        -
                        automatically reinitialize itself.                -
   HalfBlockIE        = Half Block Interrupt Enabled or not               -
 RETURN VALUE: None                                                       -
 LIMITATIONS : The DMA use only the fast strobe 0 of Rhea bus             -
---------------------------------------------------------------------------
*/
void DMA_SendEmifToRhea
       (const DMA_ChannelId_t          ChannelId,
        const DMA_Priority_t           Priority,
        const UWORD32                  SourceAddress,
        const UWORD16                  DestRheaOffset,
        const RHEA_Strobe0ChipSelect_t DestRheaChipSelect,
        const UWORD16                  TransferLength,
		  const RHEA_Access_Size_t			MemoryRheaWidth,
        const DMA_Autoinit_t           AutoInitToggle,
        const DMA_HalfBlockTrIE_t      HalfBlockIE);

void DMA_SendRheaToEmif
       (const DMA_ChannelId_t          ChannelId,
        const DMA_Priority_t           Priority,
        const UWORD16               	SrcRheaOffset,
        const RHEA_Strobe0ChipSelect_t SrcRheaChipSelect,
        const UWORD32               	DestinationAddress,
        const UWORD16                  TransferLength,
		  const RHEA_Access_Size_t			MemoryRheaWidth,
        const DMA_Autoinit_t           AutoInitToggle,
        const DMA_HalfBlockTrIE_t      HalfBlockIE);

void DMA_SendRheaToSdram
       (const DMA_ChannelId_t          ChannelId,
        const DMA_Priority_t           Priority,
        const UWORD16               	SrcRheaOffset,
        const RHEA_Strobe0ChipSelect_t SrcRheaChipSelect,
        const UWORD32               	DestinationAddress,
        const UWORD16                  TransferLength,
		  const RHEA_Access_Size_t			MemoryRheaWidth,
        const DMA_Autoinit_t           AutoInitToggle,
        const DMA_HalfBlockTrIE_t      HalfBlockIE);

void DMA_SendSdramToRhea
       (const DMA_ChannelId_t          ChannelId,
        const DMA_Priority_t           Priority,
        const UWORD32               	SourceAddress,
        const UWORD16               	DestRheaOffset,
        const RHEA_Strobe0ChipSelect_t DestRheaChipSelect,
        const UWORD16                  TransferLength,
		  const RHEA_Access_Size_t			MemoryRheaWidth,
        const DMA_Autoinit_t           AutoInitToggle,
        const DMA_HalfBlockTrIE_t      HalfBlockIE);

void DMA_SendRheaToRhea
       (const DMA_ChannelId_t          ChannelId,
        const DMA_Priority_t           Priority,
        const UWORD16                  SrceRheaOffset,
        const RHEA_Strobe0ChipSelect_t SrceRheaChipSelect,
        const UWORD16                  DestRheaOffset,
        const RHEA_Strobe0ChipSelect_t DestRheaChipSelect,
        const UWORD16                  TransferLength,
		  const RHEA_Access_Size_t			MemoryRheaWidth,
        const DMA_Autoinit_t           AutoInitToggle,
        const DMA_HalfBlockTrIE_t      HalfBlockIE);


void DMA_ConfigureRheaToSdram
       (const DMA_ChannelId_t          ChannelId,
        const DMA_Priority_t           Priority,
        const UWORD16                  SrcRheaOffset,
        const RHEA_Strobe0ChipSelect_t SrcRheaChipSelect,
        const UWORD32                  DestinationAddress,
        const UWORD16                  TransferLength,
	const RHEA_Access_Size_t       MemoryRheaWidth,
        const DMA_Autoinit_t           AutoInitToggle,
        const DMA_HalfBlockTrIE_t      HalfBlockIE);

void DMA_ConfigureSdramToRhea
       (const DMA_ChannelId_t          ChannelId,
        const DMA_Priority_t           Priority,
        const UWORD32                  SourceAddress,
        const RHEA_Strobe0ChipSelect_t DestRheaChipSelect,
        const UWORD16                  DestRheaOffset,
        const UWORD16                  TransferLength,
	const RHEA_Access_Size_t       MemoryRheaWidth,
        const DMA_Autoinit_t           AutoInitToggle,
        const DMA_HalfBlockTrIE_t      HalfBlockIE);

/*
---------------------------------------------------------------------------
 NAME        : DMA_ConfigureRheaToEmif                                    -

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?