|
GNU Radio 3.3.0 C++ API
|
00001 /* -------------------------------------------------------------- */ 00002 /* (C)Copyright 2001,2007, */ 00003 /* International Business Machines Corporation, */ 00004 /* Sony Computer Entertainment, Incorporated, */ 00005 /* Toshiba Corporation, */ 00006 /* */ 00007 /* All Rights Reserved. */ 00008 /* */ 00009 /* Redistribution and use in source and binary forms, with or */ 00010 /* without modification, are permitted provided that the */ 00011 /* following conditions are met: */ 00012 /* */ 00013 /* - Redistributions of source code must retain the above copyright*/ 00014 /* notice, this list of conditions and the following disclaimer. */ 00015 /* */ 00016 /* - Redistributions in binary form must reproduce the above */ 00017 /* copyright notice, this list of conditions and the following */ 00018 /* disclaimer in the documentation and/or other materials */ 00019 /* provided with the distribution. */ 00020 /* */ 00021 /* - Neither the name of IBM Corporation nor the names of its */ 00022 /* contributors may be used to endorse or promote products */ 00023 /* derived from this software without specific prior written */ 00024 /* permission. */ 00025 /* */ 00026 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND */ 00027 /* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, */ 00028 /* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 00029 /* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */ 00030 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR */ 00031 /* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ 00032 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT */ 00033 /* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */ 00034 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) */ 00035 /* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN */ 00036 /* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ 00037 /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 00038 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00039 /* -------------------------------------------------------------- */ 00040 /* PROLOG END TAG zYx */ 00041 #ifndef _SPU_READ_UNLOCK_H_ 00042 #define _SPU_READ_UNLOCK_H_ 00043 00044 #include "sync_utils.h" 00045 #include "mutex.h" 00046 #include <spu_mfcio.h> 00047 00048 00049 /** 00050 * read_unlock - release reader lock. 00051 * @ea: handle to effective address of lock variable. 00052 * 00053 * Description: Release a reader lock. The only restriction 00054 * here is that @ea must be word aligned. 00055 * 00056 * Context: This routine should be used when interrupts 00057 * do not need to be re-enabled --either because interrupts 00058 * are not being used, or because the application will take 00059 * steps to re-enable them later. 00060 */ 00061 static __inline void _read_unlock(eaddr_t ea) 00062 { 00063 DECL_MUTEX_VARS(); 00064 s32 status; 00065 00066 /* _read_unlock 00067 * 00068 * Reader locks must use PUTLLC when releasing, instead of 00069 * the more traditional PUTLLUC because of the non-exclusive 00070 * nature of the lock. The reason for this is that other 00071 * readers may have incremented the counter, and we don't 00072 * want to corrupt it by blindly issuing PUTLLUC!! 00073 */ 00074 ea64.ull = ALIGN128_EA(ea); 00075 offset = OFFSET128_EA_U32(ea); 00076 do { 00077 MFC_DMA(buf, ea64, size, tagid, MFC_GETLLAR_CMD); 00078 spu_readch(MFC_RdAtomicStat); 00079 00080 buf[offset] -= 1; 00081 MFC_DMA(buf, ea64, size, tagid, MFC_PUTLLC_CMD); 00082 status = spu_readch(MFC_RdAtomicStat); 00083 } while (status != 0); 00084 00085 } 00086 00087 00088 #endif /* _SPU_READ_UNLOCK_H_ */