![]() |
|
|||
0001 /***********************license start*************** 0002 * Author: Cavium Networks 0003 * 0004 * Contact: support@caviumnetworks.com 0005 * This file is part of the OCTEON SDK 0006 * 0007 * Copyright (c) 2003-2008 Cavium Networks 0008 * 0009 * This file is free software; you can redistribute it and/or modify 0010 * it under the terms of the GNU General Public License, Version 2, as 0011 * published by the Free Software Foundation. 0012 * 0013 * This file is distributed in the hope that it will be useful, but 0014 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 0015 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 0016 * NONINFRINGEMENT. See the GNU General Public License for more 0017 * details. 0018 * 0019 * You should have received a copy of the GNU General Public License 0020 * along with this file; if not, write to the Free Software 0021 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0022 * or visit http://www.gnu.org/licenses/. 0023 * 0024 * This file may also be available under a different license from Cavium. 0025 * Contact Cavium Networks for more information 0026 ***********************license end**************************************/ 0027 0028 /** 0029 * 0030 * This file provides support for the processor local scratch memory. 0031 * Scratch memory is byte addressable - all addresses are byte addresses. 0032 * 0033 */ 0034 0035 #ifndef __CVMX_SCRATCH_H__ 0036 #define __CVMX_SCRATCH_H__ 0037 0038 /* 0039 * Note: This define must be a long, not a long long in order to 0040 * compile without warnings for both 32bit and 64bit. 0041 */ 0042 #define CVMX_SCRATCH_BASE (-32768l) /* 0xffffffffffff8000 */ 0043 0044 /** 0045 * Reads an 8 bit value from the processor local scratchpad memory. 0046 * 0047 * @address: byte address to read from 0048 * 0049 * Returns value read 0050 */ 0051 static inline uint8_t cvmx_scratch_read8(uint64_t address) 0052 { 0053 return *CASTPTR(volatile uint8_t, CVMX_SCRATCH_BASE + address); 0054 } 0055 0056 /** 0057 * Reads a 16 bit value from the processor local scratchpad memory. 0058 * 0059 * @address: byte address to read from 0060 * 0061 * Returns value read 0062 */ 0063 static inline uint16_t cvmx_scratch_read16(uint64_t address) 0064 { 0065 return *CASTPTR(volatile uint16_t, CVMX_SCRATCH_BASE + address); 0066 } 0067 0068 /** 0069 * Reads a 32 bit value from the processor local scratchpad memory. 0070 * 0071 * @address: byte address to read from 0072 * 0073 * Returns value read 0074 */ 0075 static inline uint32_t cvmx_scratch_read32(uint64_t address) 0076 { 0077 return *CASTPTR(volatile uint32_t, CVMX_SCRATCH_BASE + address); 0078 } 0079 0080 /** 0081 * Reads a 64 bit value from the processor local scratchpad memory. 0082 * 0083 * @address: byte address to read from 0084 * 0085 * Returns value read 0086 */ 0087 static inline uint64_t cvmx_scratch_read64(uint64_t address) 0088 { 0089 return *CASTPTR(volatile uint64_t, CVMX_SCRATCH_BASE + address); 0090 } 0091 0092 /** 0093 * Writes an 8 bit value to the processor local scratchpad memory. 0094 * 0095 * @address: byte address to write to 0096 * @value: value to write 0097 */ 0098 static inline void cvmx_scratch_write8(uint64_t address, uint64_t value) 0099 { 0100 *CASTPTR(volatile uint8_t, CVMX_SCRATCH_BASE + address) = 0101 (uint8_t) value; 0102 } 0103 0104 /** 0105 * Writes a 32 bit value to the processor local scratchpad memory. 0106 * 0107 * @address: byte address to write to 0108 * @value: value to write 0109 */ 0110 static inline void cvmx_scratch_write16(uint64_t address, uint64_t value) 0111 { 0112 *CASTPTR(volatile uint16_t, CVMX_SCRATCH_BASE + address) = 0113 (uint16_t) value; 0114 } 0115 0116 /** 0117 * Writes a 16 bit value to the processor local scratchpad memory. 0118 * 0119 * @address: byte address to write to 0120 * @value: value to write 0121 */ 0122 static inline void cvmx_scratch_write32(uint64_t address, uint64_t value) 0123 { 0124 *CASTPTR(volatile uint32_t, CVMX_SCRATCH_BASE + address) = 0125 (uint32_t) value; 0126 } 0127 0128 /** 0129 * Writes a 64 bit value to the processor local scratchpad memory. 0130 * 0131 * @address: byte address to write to 0132 * @value: value to write 0133 */ 0134 static inline void cvmx_scratch_write64(uint64_t address, uint64_t value) 0135 { 0136 *CASTPTR(volatile uint64_t, CVMX_SCRATCH_BASE + address) = value; 0137 } 0138 0139 #endif /* __CVMX_SCRATCH_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |