/*
 * Copyright (C) 2008 - Ruben Niederhagen
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you will find it online at
 * http://www.gnu.org/licenses/gpl.html
 */

/**
 * \file
 * \author Ruben Niederhagen (ruben@polycephaly.org)
 */


#ifndef _IOLAOS_INCLUDE_SPU_DMA_DEBUG_H_
#define _IOALOS_INCLUDE_SPU_DMA_DEBUG_H_

#include <stdint.h>

#include "../types.h"

/** \brief Check parameteris before DMS-transfer.
 *
 * If code is comlied as DEBUG version, all parameters are checked for formal correctness 
 * before the DMA-transfer is initiatied. It is checked weather local storage adress and 
 * effective address are equaly aligned and if the transfer size matches the requirements.
 *
 * \param ls Address in local as for mfc_get.
 * \param ea Effective address in main memory es for mfc_get.
 * \param size in bytes as for mfc_get.
 * \param tag Transfer tag as form mfc_get.
 * \param tid tid as for mfc_get.
 * \param rid rid as for mfc_get.
 * \param file File name of calling sourcefile.
 * \param line Linenumber in calling sourcefile.
 */
void mfc_get_debug(volatile void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, 
                   uint32_t rid, char *file, int line);


/** \brief Check parameteris before DMS-transfer.
 *
 * If code is comlied as DEBUG version, all parameters are checked for formal correctness 
 * before the DMA-transfer is initiatied. It is checked weather local storage adress and 
 * effective address are equaly aligned and if the transfer size matches the requirements.
 *
 * See mfc_get_debug().
 */
void mfc_put_debug(volatile void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid,
                   uint32_t rid, char *file, int line);


#endif /* _IOALOS_INCLUDE_SPU_DMA_DEBUG_H_ */

