| /* |
| * Copyright (C) 2018 Synaptics Incorporated. All rights reserved. |
| * (C) Copyright Marvell Semiconductors,Inc 2006 All rightes reserved |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License version 2 as |
| * published by the Free Software Foundation. |
| * |
| * INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED "AS-IS," AND |
| * SYNAPTICS EXPRESSLY DISCLAIMS ALL EXPRESS AND IMPLIED WARRANTIES, |
| * INCLUDING ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| * A PARTICULAR PURPOSE, AND ANY WARRANTIES OF NON-INFRINGEMENT OF ANY |
| * INTELLECTUAL PROPERTY RIGHTS. IN NO EVENT SHALL SYNAPTICS BE LIABLE |
| * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE, OR |
| * CONSEQUENTIAL DAMAGES ARISING OUT OF OR IN CONNECTION WITH THE USE |
| * OF THE INFORMATION CONTAINED IN THIS DOCUMENT, HOWEVER CAUSED AND |
| * BASED ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| * NEGLIGENCE OR OTHER TORTIOUS ACTION, AND EVEN IF SYNAPTICS WAS |
| * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. IF A TRIBUNAL OF |
| * COMPETENT JURISDICTION DOES NOT PERMIT THE DISCLAIMER OF DIRECT |
| * DAMAGES OR ANY OTHER DAMAGES, SYNAPTICS' TOTAL CUMULATIVE LIABILITY |
| * TO ANY PARTY SHALL NOT EXCEED ONE HUNDRED U.S. DOLLARS. |
| */ |
| |
| #ifndef __UTIL_H__ |
| #define __UTIL_H__ |
| |
| #include <stddef.h> |
| #include <stdint.h> |
| #include "com_type.h" |
| |
| void * UtilMemSet(void *s, int c, int n); |
| void * UtilMemCpy(void *s1, const void *s2, int n); |
| int UtilMemCmp(const void *s1, const void *s2, int n); |
| void * UtilMemAllocZ(int size); |
| void UtilMemReset(void); |
| |
| void UtilHalt(void); |
| |
| //used for bitmaps that could be more than 32 bits wide |
| #define BITMASK(b) (1 << ((b) % 8)) |
| #define BITSLOT(b) ((b) / 8) |
| #define BITSET(a, b) ((a)[BITSLOT(b)] |= BITMASK(b)) |
| #define BITCLEAR(a, b) ((a)[BITSLOT(b)] &= ~BITMASK(b)) |
| #define BITTEST(a, b) ((a)[BITSLOT(b)] & BITMASK(b)) |
| #define BITNSLOTS(nb) ((nb + 8 - 1) / 8) |
| |
| #ifndef BFM_HOST_Bus_Write32 |
| #define BFM_HOST_Bus_Write32(offset, val) ((*(UNSG32*)((uintmax_t)offset))=val) |
| #endif |
| #ifndef BFM_HOST_Bus_Read32 |
| #define BFM_HOST_Bus_Read32(offset, holder) ((*(UNSG32*)(holder))=(*(UNSG32*)((uintmax_t)offset))) |
| #endif |
| #ifndef BFM_HOST_Bus_Write16 |
| #define BFM_HOST_Bus_Write16(offset, val) ((*(unsigned short*)((uintmax_t)offset))=val) |
| #endif |
| #ifndef BFM_HOST_Bus_Read16 |
| #define BFM_HOST_Bus_Read16(offset, holder) ((*(unsigned short*)(holder))=(*(unsigned short*)((uintmax_t)offset))) |
| #endif |
| #ifndef BFM_HOST_Bus_Write8 |
| #define BFM_HOST_Bus_Write8(offset, val) ((*(unsigned char*)((uintmax_t)offset))=val) |
| #endif |
| #ifndef BFM_HOST_Bus_Read8 |
| #define BFM_HOST_Bus_Read8(offset, holder) ((*(unsigned char*)(holder))=(*(unsigned char*)((uintmax_t)offset))) |
| #endif |
| |
| |
| #define CMD_BUF_SIZE 2048 |
| #define CMD_LINE_BUFFER_SIZE CMD_BUF_SIZE |
| |
| #define PROMPT "BerlinDebug>" |
| |
| void *malloc(size_t size); |
| void *calloc(size_t nmemb, size_t size); |
| |
| void free(void *ptr); |
| |
| #if 0 |
| void * UtilMemMove(void *dest, const void *src, int n); |
| #endif |
| |
| /* defined in uish.S */ |
| extern void *__user_read_heap_top(void); |
| extern void *__user_read_heap_bottom(void); |
| void __reset_cpu(unsigned int, int, int); |
| |
| /* defined in cache.S */ |
| //void flush_dcache_range(void *start, void *end); |
| //void invalidate_dcache_range(unsigned int, unsigned int); |
| int diag_i2c_vcore_control(int master_id, int volt_index); |
| void initMPGIC(void); |
| int diag_GICSetInt(int MPid, int intId, int enable); |
| unsigned berlin_delay_us(unsigned us); |
| #endif /* __UTIL_H__ */ |