1/* 2 * tiomap_io.h 3 * 4 * DSP-BIOS Bridge driver support functions for TI OMAP processors. 5 * 6 * Definitions, types and function prototypes for the io (r/w external mem). 7 * 8 * Copyright (C) 2005-2006 Texas Instruments, Inc. 9 * 10 * This package is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License version 2 as 12 * published by the Free Software Foundation. 13 * 14 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17 */ 18 19#ifndef _TIOMAP_IO_ 20#define _TIOMAP_IO_ 21 22/* 23 * Symbol that defines beginning of shared memory. 24 * For OMAP (Helen) this is the DSP Virtual base address of SDRAM. 25 * This will be used to program DSP MMU to map DSP Virt to GPP phys. 26 * (see dspMmuTlbEntry()). 27 */ 28#define SHMBASENAME "SHM_BEG" 29#define EXTBASE "EXT_BEG" 30#define EXTEND "_EXT_END" 31#define DYNEXTBASE "_DYNEXT_BEG" 32#define DYNEXTEND "_DYNEXT_END" 33#define IVAEXTMEMBASE "_IVAEXTMEM_BEG" 34#define IVAEXTMEMEND "_IVAEXTMEM_END" 35 36#define DSP_TRACESEC_BEG "_BRIDGE_TRACE_BEG" 37#define DSP_TRACESEC_END "_BRIDGE_TRACE_END" 38 39#define SYS_PUTCBEG "_SYS_PUTCBEG" 40#define SYS_PUTCEND "_SYS_PUTCEND" 41#define BRIDGE_SYS_PUTC_CURRENT "_BRIDGE_SYS_PUTC_current" 42 43#define WORDSWAP_ENABLE 0x3 /* Enable word swap */ 44 45/* 46 * ======== read_ext_dsp_data ======== 47 * Reads it from DSP External memory. The external memory for the DSP 48 * is configured by the combination of DSP MMU and shm Memory manager in the CDB 49 */ 50extern int read_ext_dsp_data(struct bridge_dev_context *dev_ctxt, 51 u8 *host_buff, u32 dsp_addr, 52 u32 ul_num_bytes, u32 mem_type); 53 54/* 55 * ======== write_dsp_data ======== 56 */ 57extern int write_dsp_data(struct bridge_dev_context *dev_context, 58 u8 *host_buff, u32 dsp_addr, 59 u32 ul_num_bytes, u32 mem_type); 60 61/* 62 * ======== write_ext_dsp_data ======== 63 * Writes to the DSP External memory for external program. 64 * The ext mem for progra is configured by the combination of DSP MMU and 65 * shm Memory manager in the CDB 66 */ 67extern int write_ext_dsp_data(struct bridge_dev_context *dev_context, 68 u8 *host_buff, u32 dsp_addr, 69 u32 ul_num_bytes, u32 mem_type, 70 bool dynamic_load); 71 72/* 73 * ======== write_ext32_bit_dsp_data ======== 74 * Writes 32 bit data to the external memory 75 */ 76extern inline void write_ext32_bit_dsp_data(const 77 struct bridge_dev_context *dev_context, 78 u32 dsp_addr, u32 val) 79{ 80 *(u32 *) dsp_addr = ((dev_context->tc_word_swap_on) ? (((val << 16) & 81 0xFFFF0000) | 82 ((val >> 16) & 83 0x0000FFFF)) : 84 val); 85} 86 87/* 88 * ======== read_ext32_bit_dsp_data ======== 89 * Reads 32 bit data from the external memory 90 */ 91extern inline u32 read_ext32_bit_dsp_data(const struct bridge_dev_context 92 *dev_context, u32 dsp_addr) 93{ 94 u32 ret; 95 ret = *(u32 *) dsp_addr; 96 97 ret = ((dev_context->tc_word_swap_on) ? (((ret << 16) 98 & 0xFFFF0000) | ((ret >> 16) & 99 0x0000FFFF)) 100 : ret); 101 return ret; 102} 103 104#endif /* _TIOMAP_IO_ */ 105