From a27354c9021a8423ef8c7d2bffad49cbf639eec1 Mon Sep 17 00:00:00 2001 From: Roman Yeryomin Date: Thu, 13 Sep 2012 00:40:35 +0300 Subject: Add realtek target files Signed-off-by: Roman Yeryomin --- .../realtek/files/drivers/net/rtl819x/rtl_glue.c | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 target/linux/realtek/files/drivers/net/rtl819x/rtl_glue.c (limited to 'target/linux/realtek/files/drivers/net/rtl819x/rtl_glue.c') diff --git a/target/linux/realtek/files/drivers/net/rtl819x/rtl_glue.c b/target/linux/realtek/files/drivers/net/rtl819x/rtl_glue.c new file mode 100644 index 000000000..00c631a2b --- /dev/null +++ b/target/linux/realtek/files/drivers/net/rtl819x/rtl_glue.c @@ -0,0 +1,99 @@ +/* +* Copyright c Realtek Semiconductor Corporation, 2002 +* All rights reserved. +* +* Program : Implementation of Glue Functions of Model Code +* Abstract : +* Author : Louis Yung-Chieh Lo (yjlou@realtek.com.tw) +* $Id: rtl_glue.c,v 1.5 2008/04/11 10:12:38 bo_zhao Exp $ +*/ + +#include +#include + +#if 0 +int rtl_down_interruptible(struct semaphore * sem) +{ + //return 0; + return down_interruptible(sem); +} + +void rtl_up(struct semaphore * sem) +{ + up(sem); +} + +int32 rtlglue_drvMutexLock(void) +{ +#if 0 + spinlock_t lockForCC = SPIN_LOCK_UNLOCKED; + int flagsForCC; + int needLock; + + spin_lock_irqsave(&lockForCC,flagsForCC); + + needLock = (int_cc >= 1)?FALSE:TRUE; + int_cc ++; + + if ( needLock == TRUE ) + { + uint32 dummy; + saveGimr = READ_MEM32( GIMR ); + +#if defined (CONFIG_RTK_VOIP_DRIVERS_PCM865xC) + WRITE_MEM32( GIMR, 0x00080000 ); /* Note: DO NOT disable PCM interrupt because users might be already on the phone call at this time + ==> Keep PCM interrupt enable for RTK VoIP applications + ==> RTL865xC, bit19: PCM_IE + */ +#elif defined (CONFIG_RTK_VOIP_DRIVERS_PCM8651) + WRITE_MEM32( GIMR, 0x00040000 ); /* RTL865xB, bit18: PCM_IE */ +#else + WRITE_MEM32( GIMR, 0 ); +#endif + /* + For RLX5181, LW/SW for external IPs (ex. GIMR) would be slow because one + CMD queue is implement. + + So, we would always read GIMR back before calling to + make sure GIMR has be set before spin-unlock. + */ + dummy = READ_MEM32( GIMR ); + + } + + spin_unlock_irqrestore(&lockForCC, flagsForCC); +#endif + return 0; +} + +int32 rtlglue_drvMutexUnlock(void) +{ +#if 0 + spinlock_t lockForCC = SPIN_LOCK_UNLOCKED; + int flagsForCC; + int needUnlock; + + spin_lock_irqsave(&lockForCC,flagsForCC); + + int_cc--; + needUnlock = ( int_cc==0 )?TRUE:FALSE; + + if ( needUnlock == TRUE ) + { + WRITE_MEM32( GIMR, saveGimr ); + /* + For RLX5181, LW/SW for external IPs (ex. GIMR) would be slow because one + CMD queue is implement. + + So, we would always read GIMR back before calling to + make sure GIMR has be set before spin-unlock. + */ + saveGimr = READ_MEM32( GIMR ); + } + + spin_unlock_irqrestore(&lockForCC, flagsForCC); +#endif + return 0; +} +#endif + -- cgit v1.2.3