Search
lxdream.org :: lxdream/test/dma.h
lxdream 0.9.1
released Jun 29
Download Now
filename test/dma.h
changeset 812:8cc61d5ea1f8
prev561:533f6b478071
author nkeynes
date Fri May 29 18:47:05 2015 +1000 (7 years ago)
permissions -rw-r--r--
last change Fix test case
file annotate diff log raw
nkeynes@185
     1
/**
nkeynes@561
     2
 * $Id$
nkeynes@185
     3
 * 
nkeynes@185
     4
 * DMA support code
nkeynes@185
     5
 *
nkeynes@185
     6
 * Copyright (c) 2006 Nathan Keynes.
nkeynes@185
     7
 *
nkeynes@185
     8
 * This program is free software; you can redistribute it and/or modify
nkeynes@185
     9
 * it under the terms of the GNU General Public License as published by
nkeynes@185
    10
 * the Free Software Foundation; either version 2 of the License, or
nkeynes@185
    11
 * (at your option) any later version.
nkeynes@185
    12
 *
nkeynes@185
    13
 * This program is distributed in the hope that it will be useful,
nkeynes@185
    14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
nkeynes@185
    15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
nkeynes@185
    16
 * GNU General Public License for more details.
nkeynes@185
    17
 */
nkeynes@185
    18
nkeynes@185
    19
#include "lib.h"
nkeynes@185
    20
nkeynes@185
    21
/**
nkeynes@185
    22
 * Setup the DMAC for a transfer. Assumes 32-byte block transfer.
nkeynes@185
    23
 * Caller is responsible for making sure no-one else is using the
nkeynes@185
    24
 * channel already. 
nkeynes@185
    25
 *
nkeynes@185
    26
 * @param channel DMA channel to use, 0 to 3
nkeynes@185
    27
 * @param source source address (if a memory source)
nkeynes@185
    28
 * @param dest   destination address (if a memory destination)
nkeynes@185
    29
 * @param length number of bytes to transfer (must be a multiple of
nkeynes@185
    30
 *               32.
nkeynes@185
    31
 * @param direction 0 = host to device, 1 = device to host
nkeynes@185
    32
 */
nkeynes@185
    33
void dmac_prepare_channel( int channel, uint32_t source, uint32_t dest,
nkeynes@185
    34
			   uint32_t length, int direction );
nkeynes@185
    35
nkeynes@185
    36
/**
nkeynes@185
    37
 * Transfer data to the PVR via DMA. Target address should be
nkeynes@185
    38
 * 0x10000000 for the TA, and 0x11000000 + VRAM address for VRAM.
nkeynes@185
    39
 *
nkeynes@185
    40
 * @param target Target address
nkeynes@185
    41
 * @param buf    Data to write (must be 32-byte aligned)
nkeynes@185
    42
 * @param length Size of data to write, in bytes.
nkeynes@185
    43
 * @param region Target region for VRAM writes, 0 for 64-byte region, 1 for 32-byte region.
nkeynes@185
    44
 *
nkeynes@185
    45
 * @return 0 on success, non-zero on failure.
nkeynes@185
    46
 */
nkeynes@185
    47
int pvr_dma_write( unsigned int target, char *buf, int length, int region );
nkeynes@812
    48
nkeynes@812
    49
/**
nkeynes@812
    50
 * Transfer TA data to the PVR via SORT-DMA.
nkeynes@812
    51
  *
nkeynes@812
    52
 * @param sorttable Start address of the sort table
nkeynes@812
    53
 * @param tablelen  Size of the sort table (in bytes)
nkeynes@812
    54
 * @param data      Start address of the TA data (polygons)
nkeynes@812
    55
 * @param datalen   Size of the polygon data block (in bytes)
nkeynes@812
    56
 * @param bitwidth  
nkeynes@812
    57
 * @param datasize
nkeynes@812
    58
 * @param region Target region for VRAM writes, 0 for 64-byte region, 1 for 32-byte region.
nkeynes@812
    59
 *
nkeynes@812
    60
 * @return 0 on success, non-zero on failure.
nkeynes@812
    61
 */
nkeynes@812
    62
int sort_dma_write( char *sorttable, int tablelen, char *data, int datalen, int bitwidth, int datasize );
nkeynes@812
    63
nkeynes@812
    64
int aica_dma_write( uint32_t aica_addr, char *data, uint32_t size );
nkeynes@812
    65
int aica_dma_read( char *data, uint32_t aica_addr, uint32_t size );
.