
/*
 *
 *     Module Name: spi_master_mmu.c
 *	       Version: 1.00
 *   Original Date: 07/21/04	
 *	        Author: Li Zhen
 *	      Language: Ansi C
 * Compile Options:
 * Compile defines:
 *	     Libraries:
 *    Link Options:
 *
 *    Entry Points:  
 *
 *  Copyright (c) Digi International Inc., All Rights Reserved
 *  
 *  This software contains proprietary and confidential information of Digi
 *  International Inc.  By accepting transfer of this copy, Recipient agrees
 *  to retain this software in confidence, to prevent disclosure to others,
 *  and to make no use of this software other than that for which it was
 *  delivered.  This is an unpublished copyrighted work of Digi International
 *  Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
 *  prohibited.
 *  
 *  Restricted Rights Legend
 * 
 *  Use, duplication, or disclosure by the Government is subject to
 *  restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
 *  Technical Data and Computer Software clause at DFARS 252.227-7031 or
 *  subparagraphs (c)(1) and (2) of the Commercial Computer Software -
 *  Restricted Rights at 48 CFR 52.227-19, as applicable.
 * 
 *  Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
 *
 * Description.
 * =======================================================================
 *  This file contains the ported mmu code for spi master driver. Doing so to reduce
 *  the SPI boot loader's size.
 *
 *
 *
 * Edit Date/Ver   Edit Description
 * ==============  =======================================================
 *
 */

#include <string.h>             /* for strlen */


/*
 * Do not attempt to trace registers before the C library is
 * setup.  The global variables used by the trace library will
 * be in an undefined state until after the C library has
 * initilized the data segement.
 */
#ifdef NA_REG_TRACE_ENABLED
#ifdef _REG_DEF_H
#error Trace code compiled into init code.
#endif
#undef NA_REG_TRACE_ENABLED
#endif

#include <string.h>             /* for strlen */
#include <gpio.h>
#include <ncc_init.h>
#include <gpio_def.h>
#include "bsp_drivers.h"
#include "sysClock.h"           /* for NAgetSysOscFreq */

#include "mcpll.h"
#include "reg_def.h"
#include "appconf_api.h"
#include <blerror.h>            /*for error condition */
#include <nammu.h>
#include <nainvalidate.h>

extern void *(*spiNAVaToUncachedVa) (const void *);
extern void (*spiNABeforeDMA) (na_dma_operation_t, const void *, const void *, unsigned long);

extern int (*spiNAVaToPhys) (const void *virtual_address, physical_address_t * physical_address);
extern void (*spiNAAfterDMA) (na_dma_operation_t, const void *, const void *, unsigned long);

static void *local_spiNAVaToUncachedVa (const void *p1)
{
    return (NAVaToUncachedVa (p1));
}
static void local_spiNABeforeDMA (na_dma_operation_t p1, const void *p2, const void *p3, unsigned long p4)
{
    NABeforeDMA (p1, p2, p3, p4);
}
static void local_spiNAAfterDMA (na_dma_operation_t p1, const void *p2, const void *p3, unsigned long p4)
{
    NAAfterDMA (p1, p2, p3, p4);
}
static int local_spiNAVaToPhys (const void *p1, physical_address_t * p2)
{
    return (NAVaToPhys (p1, p2));
}

void simplespi_mmu_init (void)
{
    spiNAVaToUncachedVa = local_spiNAVaToUncachedVa;
    spiNABeforeDMA = local_spiNABeforeDMA;
    spiNAVaToPhys = local_spiNAVaToPhys;
    spiNAAfterDMA = local_spiNAAfterDMA;
}

