| 1 | /* |
|---|
| 2 | |
|---|
| 3 | Driver APIs for MxL201RF Tuner |
|---|
| 4 | |
|---|
| 5 | Copyright, Maxlinear, Inc. |
|---|
| 6 | All Rights Reserved |
|---|
| 7 | |
|---|
| 8 | File Name: MxL_User_Define.c |
|---|
| 9 | |
|---|
| 10 | */ |
|---|
| 11 | |
|---|
| 12 | #include "UserDefinedIIC.h" |
|---|
| 13 | #include "MxL_User_Define.h" |
|---|
| 14 | #include "MxL201RF_Common.h" |
|---|
| 15 | |
|---|
| 16 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// |
|---|
| 17 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// |
|---|
| 18 | // // |
|---|
| 19 | // I2C Functions (implement by customer) // |
|---|
| 20 | // // |
|---|
| 21 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// |
|---|
| 22 | //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++// |
|---|
| 23 | |
|---|
| 24 | /****************************************************************************** |
|---|
| 25 | ** |
|---|
| 26 | ** Name: MxL_I2C_Write |
|---|
| 27 | ** |
|---|
| 28 | ** Description: I2C write operations |
|---|
| 29 | ** |
|---|
| 30 | ** Parameters: |
|---|
| 31 | ** DeviceAddr - MxL201RF Device address |
|---|
| 32 | ** pArray - Write data array pointer |
|---|
| 33 | ** count - total number of array |
|---|
| 34 | ** |
|---|
| 35 | ** Returns: 0 if success |
|---|
| 36 | ** |
|---|
| 37 | ** Revision History: |
|---|
| 38 | ** |
|---|
| 39 | ** SCR Date Author Description |
|---|
| 40 | ** ------------------------------------------------------------------------- |
|---|
| 41 | ** N/A 12-16-2007 khuang initial release. |
|---|
| 42 | ** |
|---|
| 43 | ******************************************************************************/ |
|---|
| 44 | UINT32 MxL_I2C_Write(UINT8 DeviceAddr, UINT8* pArray, UINT32 count) |
|---|
| 45 | { |
|---|
| 46 | MxL_ERR_MSG Status = MxL_OK; |
|---|
| 47 | |
|---|
| 48 | // user defined...csm 20120308 |
|---|
| 49 | /* |
|---|
| 50 | unsigned char TempAddr,TempData; |
|---|
| 51 | int len = 0; |
|---|
| 52 | |
|---|
| 53 | if(count <=1 ){//AIC AC ¡Æ©¡¢¯i. |
|---|
| 54 | //S, DevID+W, ACK, AIC(OxFF), ACK, P |
|---|
| 55 | TempAddr = pArray[0]; |
|---|
| 56 | Status = MxL201_I2cWrite((DeviceAddr<<1),TempAddr,0x00,count); |
|---|
| 57 | } |
|---|
| 58 | else{//(count > 1) AC ¡Æ©¡¢¯i. |
|---|
| 59 | for(len=0;len<count/2;len++) |
|---|
| 60 | { |
|---|
| 61 | TempAddr = pArray[len]; |
|---|
| 62 | TempData = pArray[len+1]; |
|---|
| 63 | len++; |
|---|
| 64 | Status = MxL201_I2cWrite((DeviceAddr<<1),TempAddr,TempData,count); |
|---|
| 65 | } |
|---|
| 66 | } |
|---|
| 67 | */ |
|---|
| 68 | Status = MxL201_I2cWrite((DeviceAddr<<1),pArray, count); |
|---|
| 69 | |
|---|
| 70 | return Status; |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | /****************************************************************************** |
|---|
| 74 | ** |
|---|
| 75 | ** Name: MxL_I2C_Read |
|---|
| 76 | ** |
|---|
| 77 | ** Description: I2C read operations |
|---|
| 78 | ** |
|---|
| 79 | ** Parameters: |
|---|
| 80 | ** DeviceAddr - MxL201RF Device address |
|---|
| 81 | ** Addr - register address for read |
|---|
| 82 | ** *Data - data return |
|---|
| 83 | ** |
|---|
| 84 | ** Returns: 0 if success |
|---|
| 85 | ** |
|---|
| 86 | ** Revision History: |
|---|
| 87 | ** |
|---|
| 88 | ** SCR Date Author Description |
|---|
| 89 | ** ------------------------------------------------------------------------- |
|---|
| 90 | ** N/A 12-16-2007 khuang initial release. |
|---|
| 91 | ** |
|---|
| 92 | ******************************************************************************/ |
|---|
| 93 | UINT32 MxL_I2C_Read(UINT8 DeviceAddr, UINT8 Addr, UINT8* mData) |
|---|
| 94 | { |
|---|
| 95 | MxL_ERR_MSG Status = MxL_OK; |
|---|
| 96 | |
|---|
| 97 | Status = MxL201_I2cRead((DeviceAddr<<1),Addr,mData); |
|---|
| 98 | |
|---|
| 99 | return Status; |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | /****************************************************************************** |
|---|
| 103 | ** |
|---|
| 104 | ** Name: MxL_Delay |
|---|
| 105 | ** |
|---|
| 106 | ** Description: Delay function in milli-second |
|---|
| 107 | ** |
|---|
| 108 | ** Parameters: |
|---|
| 109 | ** mSec - milli-second to delay |
|---|
| 110 | ** |
|---|
| 111 | ** Returns: 0 |
|---|
| 112 | ** |
|---|
| 113 | ** Revision History: |
|---|
| 114 | ** |
|---|
| 115 | ** SCR Date Author Description |
|---|
| 116 | ** ------------------------------------------------------------------------- |
|---|
| 117 | ** N/A 12-16-2007 khuang initial release. |
|---|
| 118 | ** |
|---|
| 119 | ******************************************************************************/ |
|---|
| 120 | void MxL_Delay(UINT32 mSec) |
|---|
| 121 | { |
|---|
| 122 | SemcoSleep(mSec); |
|---|
| 123 | } |
|---|