Search
lxdream.org :: lxdream/test/dma.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/dma.h
changeset 185:6755a04c447f
next561:533f6b478071
author nkeynes
date Sun Aug 06 06:13:51 2006 +0000 (17 years ago)
permissions -rw-r--r--
last change First pass at implementing the tile clip. Reasonably accurate wrt basic
understanding of how its supposed to work, not so accurate wrt actual
hardware behaviour
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/test/dma.h Sun Aug 06 06:13:51 2006 +0000
1.3 @@ -0,0 +1,47 @@
1.4 +/**
1.5 + * $Id: dma.h,v 1.1 2006-07-11 01:35:23 nkeynes Exp $
1.6 + *
1.7 + * DMA support code
1.8 + *
1.9 + * Copyright (c) 2006 Nathan Keynes.
1.10 + *
1.11 + * This program is free software; you can redistribute it and/or modify
1.12 + * it under the terms of the GNU General Public License as published by
1.13 + * the Free Software Foundation; either version 2 of the License, or
1.14 + * (at your option) any later version.
1.15 + *
1.16 + * This program is distributed in the hope that it will be useful,
1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 + * GNU General Public License for more details.
1.20 + */
1.21 +
1.22 +#include "lib.h"
1.23 +
1.24 +/**
1.25 + * Setup the DMAC for a transfer. Assumes 32-byte block transfer.
1.26 + * Caller is responsible for making sure no-one else is using the
1.27 + * channel already.
1.28 + *
1.29 + * @param channel DMA channel to use, 0 to 3
1.30 + * @param source source address (if a memory source)
1.31 + * @param dest destination address (if a memory destination)
1.32 + * @param length number of bytes to transfer (must be a multiple of
1.33 + * 32.
1.34 + * @param direction 0 = host to device, 1 = device to host
1.35 + */
1.36 +void dmac_prepare_channel( int channel, uint32_t source, uint32_t dest,
1.37 + uint32_t length, int direction );
1.38 +
1.39 +/**
1.40 + * Transfer data to the PVR via DMA. Target address should be
1.41 + * 0x10000000 for the TA, and 0x11000000 + VRAM address for VRAM.
1.42 + *
1.43 + * @param target Target address
1.44 + * @param buf Data to write (must be 32-byte aligned)
1.45 + * @param length Size of data to write, in bytes.
1.46 + * @param region Target region for VRAM writes, 0 for 64-byte region, 1 for 32-byte region.
1.47 + *
1.48 + * @return 0 on success, non-zero on failure.
1.49 + */
1.50 +int pvr_dma_write( unsigned int target, char *buf, int length, int region );
.