⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ia443x_rf.lst

📁 silicon wireless开发套件F920+Si4432原理图,源码
💻 LST
📖 第 1 页 / 共 5 页
字号:
 661   1              //enable transmitter
 662   1              temp8 = SpiRfReadRegister( OperatingFunctionControl1 );
 663   1              temp8 |= 0x09;
 664   1              SpiRfWriteAddressData((REG_WRITE | OperatingFunctionControl1), temp8);
 665   1      
 666   1              //enable the wanted ITs
 667   1              SpiRfWriteAddressData((REG_WRITE | InterruptEnable1), 0x04);
 668   1              SpiRfWriteAddressData((REG_WRITE | InterruptEnable2), 0x00);
 669   1              //release all IT flag
 670   1              ItStatus1 = SpiRfReadRegister( InterruptStatus1 );
 671   1              ItStatus2 = SpiRfReadRegister( InterruptStatus2 );
C51 COMPILER V8.00   IA443X_RF                                                             11/17/2008 10:50:33 PAGE 12  

 672   1      
 673   1              //enable EXT IT
 674   1              EnableExt0It();
 675   1              //start timeout for packet transmitting 
 676   1              RfTimer.U16 = ByteTime * TX_PACKET_LENGTH;
 677   1              Tmr2SwPrescaler = BYTE_TIME_SW_DIV;
 678   1              StartTmr2(BYTE_TIME_DIV,RfTimer,TRUE);
 679   1      
 680   1              //set next state
 681   1              RfState = sRFTransmitting;
 682   1      
 683   1              return RF_OK;
 684   1      }
 685          
 686          /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 687            +
 688            + FUNCTION NAME:  RF_ENUM RFDirectReceive(void)
 689            +
 690            + DESCRIPTION:    starts direct reception
 691            +
 692            + INPUT:                      None
 693            +
 694            + RETURN:         RF_OK:                              the operation was succesfull
 695            +                 RF_ERROR_STATE:     the command is ignored, because the MAC 
 696            +                                                                             was not in STANDBY or IDLE state.
 697            +                                     RF_ERROR_TIMING:        the command is ignored, there is
 698            +                                                                             not enough time to wake up
 699            +                                     RF_ERROR_PARAMETER: the command is ignored,some of the 
 700            +                                                                             input parameter(s) are
 701            +                                                                             out of the valid range
 702            +
 703            + NOTES:          
 704            +
 705            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
 706          RF_ENUM RFDirectReceive(void)
 707          {
 708   1              uint8 temp8;
 709   1      
 710   1              if( RfState != sRFIdle )
 711   1                      return RF_ERROR_STATE;
 712   1      
 713   1              //enable receiver chain
 714   1              temp8 = SpiRfReadRegister( OperatingFunctionControl1 );
 715   1              temp8 |= 0x05;
 716   1              SpiRfWriteAddressData((REG_WRITE | OperatingFunctionControl1), temp8);  
 717   1      
 718   1              //disable all the ITs
 719   1              SpiRfWriteAddressData((REG_WRITE | InterruptEnable1), 0x00);
 720   1              SpiRfWriteAddressData((REG_WRITE | InterruptEnable2), 0x00);
 721   1              //release all IT flag
 722   1              ItStatus1 = SpiRfReadRegister( InterruptStatus1 );
 723   1              ItStatus2 = SpiRfReadRegister( InterruptStatus2 );
 724   1      
 725   1              //enable EXT IT
 726   1              DisableExt0It();
 727   1              //disable PHY timer
 728   1              StopTmr2();
 729   1      
 730   1              //set next state
 731   1              RfState = sRFPacketReceived;
 732   1              
 733   1              fPacketReceived = FALSE;
C51 COMPILER V8.00   IA443X_RF                                                             11/17/2008 10:50:33 PAGE 13  

 734   1      
 735   1              //Reset ADC
 736   1              SpiRfWriteAddressData((REG_WRITE | DeltasigmaADCTuning1), 0x80);
 737   1              SpiRfWriteAddressData((REG_WRITE | DeltasigmaADCTuning1), 0x1C);
 738   1      
 739   1              return RF_OK;
 740   1      }
 741          
 742          
 743          /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 744            +
 745            + FUNCTION NAME:  RF_ENUM RFReceive(RECEIVE_COMMAND * Struct)
 746            +
 747            + DESCRIPTION:    starts packet reception
 748            +
 749            + INPUT:                      RECEIVE_COMMAND structure
 750            +
 751            + RETURN:         RF_OK:                              the operation was succesfull
 752            +                 RF_ERROR_STATE:     the command is ignored, because the MAC 
 753            +                                                                             was not in STANDBY or IDLE state.
 754            +                                     RF_ERROR_TIMING:        the command is ignored, there is
 755            +                                                                             not enough time to wake up
 756            +                                     RF_ERROR_PARAMETER: the command is ignored,some of the 
 757            +                                                                             input parameter(s) are
 758            +                                                                             out of the valid range
 759            +
 760            + NOTES:          
 761            +
 762            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
 763          RF_ENUM RFReceive(RECEIVE_COMMAND * Struct)
 764          {
 765   1              uint8 temp8;
 766   1      
 767   1              if( RfState != sRFIdle )
 768   1                      return RF_ERROR_STATE;
 769   1      
 770   1              //clear FIFO
 771   1              temp8 = SpiRfReadRegister( OperatingFunctionControl2 );
 772   1              temp8 |= 0x02;
 773   1              SpiRfWriteAddressData((REG_WRITE | OperatingFunctionControl2), temp8);
 774   1              temp8 &= 0xFD;
 775   1              SpiRfWriteAddressData((REG_WRITE | OperatingFunctionControl2), temp8);
 776   1      
 777   1              //set headers and filters
 778   1              if( Struct -> header.enabled_headers == 0 )
 779   1              {//header and header filter are disabled
 780   2                      SpiRfWriteAddressData((REG_WRITE | HeaderControl1 ), 0x00);
 781   2                      temp8 = SpiRfReadRegister( HeaderControl2 );
 782   2                      temp8 &= 0x07;
 783   2                      SpiRfWriteAddressData((REG_WRITE | HeaderControl2 ), temp8);
 784   2              }
 785   1              else
 786   1              {//TODO: header and header filter are enabled - NOT YET IMPLEMENTED
 787   2              }
 788   1      
 789   1              //enable receiver chain
 790   1              temp8 = SpiRfReadRegister( OperatingFunctionControl1 );
 791   1              temp8 |= 0x05;
 792   1              SpiRfWriteAddressData((REG_WRITE | OperatingFunctionControl1), temp8);  
 793   1      
 794   1              //enable the wanted ITs
 795   1              SpiRfWriteAddressData((REG_WRITE | InterruptEnable1), 0x00);
C51 COMPILER V8.00   IA443X_RF                                                             11/17/2008 10:50:33 PAGE 14  

 796   1              GotoPreambleSearchState();
 797   1      
 798   1              //release all IT flag
 799   1              ItStatus1 = SpiRfReadRegister( InterruptStatus1 );
 800   1              ItStatus2 = SpiRfReadRegister( InterruptStatus2 );
 801   1      
 802   1              //Reset ADC
 803   1              SpiRfWriteAddressData((REG_WRITE | DeltasigmaADCTuning1), 0x80);
 804   1              SpiRfWriteAddressData((REG_WRITE | DeltasigmaADCTuning1), 0x1C);
 805   1      
 806   1              return RF_OK;
 807   1      }
 808          
 809          /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 810            +
 811            + FUNCTION NAME:  RF_ENUM RFGetStatus(PHY_STATUS * Struct)
 812            +
 813            + DESCRIPTION:    gives back the actual state of the PHY
 814            +
 815            + INPUT:                      PHY_STATUS structure
 816            +
 817            + RETURN:         RF_OK: The operation was succesfull
 818            +
 819            + NOTES:          
 820            +
 821            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
 822          RF_ENUM RFGetStatus(PHY_STATUS * Struct)
 823          {
 824   1              Struct -> status = RfState;
 825   1              return RF_OK;
 826   1      }
 827          
 828          
 829          /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 830            +
 831            + FUNCTION NAME:  RF_ENUM RFGetBuffer(RECEIVED_DATA * Struct)
 832            +
 833            + DESCRIPTION:    gives back the received packet and RSSI value. If packet was not
 834            +                                     recived it gives back only the RSSI value.
 835            +
 836            + INPUT:                      RECEIVED_DATA structure
 837            +
 838            + RETURN:         RF_OK: operation was succesfull.
 839            +
 840            + NOTES:          
 841            +
 842            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
 843          RF_ENUM RFGetBuffer(RECEIVED_DATA * Struct)
 844          {       
 845   1              uint8 i;
 846   1      
 847   1              Struct -> fPacketReceived = fPacketReceived;
 848   1              //get header
 849   1              if( Struct -> message.header.enabled_headers != 0 )
 850   1              {       
 851   2                      //TODO: implement this
 852   2      
 853   2              }
 854   1              //get received data and length
 855   1              Struct -> message.length =  SpiRfReadRegister( ReceivedPacketLength );
 856   1              for(i=0;i<Struct -> message.length;i++)
 857   1              {
C51 COMPILER V8.00   IA443X_RF                                                             11/17/2008 10:50:33 PAGE 15  

 858   2                      *Struct -> message.payload++ = SpiRfReadRegister( FIFOAccess );
 859   2              }
 860   1              return RF_OK;
 861   1      }
 862          
 863          /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 864            +
 865            + FUNCTION NAME:  RF_ENUM RFGetRssiResult(uint8 * ant1, uint8 * ant2)
 866            +
 867            + DESCRIPTION:    gives back the RSSI values. If packet was not received
 868            +                                     it returns with RF_ERROR_PARAMETER
 869            +
 870            + INPUT:                      None
 871            +
 872            + RETURN:         RF_OK: operation was succesfull.
 873            +                                     RF_ERROR_PARAMETER: packet was not received - the values are may not relevant
 874            +                                     ant1 - RSSI on ANT1 or RSSI register value (in case not using ant diversity)
 875            +                                     ant2 - RSSI on ANT2 (valid only if diersity is used)
 876            +
 877            + NOTES:          
 878            +
 879            +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
 880          RF_ENUM RFGetRssiResult(uint8 * ant1, uint8 * ant2)
 881          {
 882   1              *ant1 = Rssi_ant1;
 883   1              *ant2 = Rssi_ant2;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -