| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2008, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: breg_mem_opt.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/13 $ |
|---|
| 12 | * $brcm_Date: 9/24/08 7:32p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/basemodules/reg/breg_mem_opt.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/13 9/24/08 7:32p vsilyaev |
|---|
| 21 | * PR 46950: Use unified declaration of BREG handle for debug and release |
|---|
| 22 | * builds |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/12 7/21/06 11:27a vsilyaev |
|---|
| 25 | * PR 22695: Changes to make BREG_MEM compatible between debug and release |
|---|
| 26 | * builds |
|---|
| 27 | * |
|---|
| 28 | * Hydra_Software_Devel/10 8/30/04 7:05p brianlee |
|---|
| 29 | * PR 12172: Fixed warning |
|---|
| 30 | * |
|---|
| 31 | * Hydra_Software_Devel/BCM7042/1 8/30/04 7:03p vsilyaev |
|---|
| 32 | * PR 12172: Fixed warning |
|---|
| 33 | * |
|---|
| 34 | * Hydra_Software_Devel/9 8/10/04 10:40a vsilyaev |
|---|
| 35 | * PR 12172: Unified type of the BREG_Handle, it removes space for |
|---|
| 36 | * different compiler behaviour in debug and release builds |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/8 9/19/03 8:56a marcusk |
|---|
| 39 | * Added volatile to typecasts to ensure compiler does not optimize |
|---|
| 40 | * register reads and writes. |
|---|
| 41 | * |
|---|
| 42 | * Hydra_Software_Devel/7 9/17/03 3:32p marcusk |
|---|
| 43 | * Fixed compiler warning for win32. |
|---|
| 44 | * |
|---|
| 45 | * Hydra_Software_Devel/6 9/16/03 10:13a frusso |
|---|
| 46 | * Fixed name mismatch in BREG_Open |
|---|
| 47 | * |
|---|
| 48 | * Hydra_Software_Devel/5 9/15/03 6:08p marcusk |
|---|
| 49 | * Updated to use void * as register base address. |
|---|
| 50 | * |
|---|
| 51 | * Hydra_Software_Devel/4 5/30/03 12:03p marcusk |
|---|
| 52 | * Changed CreateRegHandle/DestroyRegHandle to Open/Close to be more |
|---|
| 53 | * consistant. |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/3 3/7/03 9:24a marcusk |
|---|
| 56 | * Minor cleanup. |
|---|
| 57 | * |
|---|
| 58 | * Hydra_Software_Devel/2 3/5/03 4:18p marcusk |
|---|
| 59 | * Fixed minor issues (got it to compile). |
|---|
| 60 | * |
|---|
| 61 | * Hydra_Software_Devel/1 3/5/03 3:33p marcusk |
|---|
| 62 | * Initial version. |
|---|
| 63 | * |
|---|
| 64 | ***************************************************************************/ |
|---|
| 65 | #ifndef BREG_MEM_OPT_H |
|---|
| 66 | #define BREG_MEM_OPT_H |
|---|
| 67 | |
|---|
| 68 | #if BDBG_DEBUG_BUILD == 1 |
|---|
| 69 | #error breg_mem_opt.h should only be included for release builds!! |
|---|
| 70 | #endif |
|---|
| 71 | |
|---|
| 72 | |
|---|
| 73 | #define BREG_Write32(RegHandle, reg, data) (*((volatile uint32_t *)((uintptr_t)((RegHandle)->BaseAddr)+(reg)))=data) |
|---|
| 74 | #define BREG_Write16(RegHandle, reg, data) (*((volatile uint16_t *)((uintptr_t)((RegHandle)->BaseAddr)+(reg)))=data) |
|---|
| 75 | #define BREG_Write8(RegHandle, reg, data) (*((volatile uint8_t *)((uintptr_t)((RegHandle)->BaseAddr)+(reg)))=data) |
|---|
| 76 | |
|---|
| 77 | #define BREG_Read32(RegHandle, reg) (*((volatile uint32_t *)((uintptr_t)((RegHandle)->BaseAddr)+(reg)))) |
|---|
| 78 | #define BREG_Read16(RegHandle, reg) (*((volatile uint16_t *)((uintptr_t)((RegHandle)->BaseAddr)+(reg)))) |
|---|
| 79 | #define BREG_Read8(RegHandle, reg) (*((volatile uint8_t *)((uintptr_t)((RegHandle)->BaseAddr)+(reg)))) |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | #endif |
|---|
| 83 | /* End of File */ |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | |
|---|