nkeynes@185: /** nkeynes@185: * $Id: dma.h,v 1.1 2006-07-11 01:35:23 nkeynes Exp $ nkeynes@185: * nkeynes@185: * DMA support code nkeynes@185: * nkeynes@185: * Copyright (c) 2006 Nathan Keynes. nkeynes@185: * nkeynes@185: * This program is free software; you can redistribute it and/or modify nkeynes@185: * it under the terms of the GNU General Public License as published by nkeynes@185: * the Free Software Foundation; either version 2 of the License, or nkeynes@185: * (at your option) any later version. nkeynes@185: * nkeynes@185: * This program is distributed in the hope that it will be useful, nkeynes@185: * but WITHOUT ANY WARRANTY; without even the implied warranty of nkeynes@185: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the nkeynes@185: * GNU General Public License for more details. nkeynes@185: */ nkeynes@185: nkeynes@185: #include "lib.h" nkeynes@185: nkeynes@185: /** nkeynes@185: * Setup the DMAC for a transfer. Assumes 32-byte block transfer. nkeynes@185: * Caller is responsible for making sure no-one else is using the nkeynes@185: * channel already. nkeynes@185: * nkeynes@185: * @param channel DMA channel to use, 0 to 3 nkeynes@185: * @param source source address (if a memory source) nkeynes@185: * @param dest destination address (if a memory destination) nkeynes@185: * @param length number of bytes to transfer (must be a multiple of nkeynes@185: * 32. nkeynes@185: * @param direction 0 = host to device, 1 = device to host nkeynes@185: */ nkeynes@185: void dmac_prepare_channel( int channel, uint32_t source, uint32_t dest, nkeynes@185: uint32_t length, int direction ); nkeynes@185: nkeynes@185: /** nkeynes@185: * Transfer data to the PVR via DMA. Target address should be nkeynes@185: * 0x10000000 for the TA, and 0x11000000 + VRAM address for VRAM. nkeynes@185: * nkeynes@185: * @param target Target address nkeynes@185: * @param buf Data to write (must be 32-byte aligned) nkeynes@185: * @param length Size of data to write, in bytes. nkeynes@185: * @param region Target region for VRAM writes, 0 for 64-byte region, 1 for 32-byte region. nkeynes@185: * nkeynes@185: * @return 0 on success, non-zero on failure. nkeynes@185: */ nkeynes@185: int pvr_dma_write( unsigned int target, char *buf, int length, int region );