コード例 #1
0
ファイル: uz_spif.c プロジェクト: xdpsee/uIP_on_eCos
UINT8 spi_lr(UINT16 Address) {
    UINT8 Value;
    Address = (Address << 5) | 0x8000;

    disable_rf_int();

    uz2400_select(); //Put the CS to Low

    SPI_I2S_SendData(RF_SPI,(Address>>8)&0x00ff);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    SPI_I2S_SendData(RF_SPI,Address&0x00ff);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    SPI_I2S_SendData(RF_SPI,0x00);
    uz2400_wait_spi_r_ready();
    uz2400_wait_spi_r_ready();
    wait_uz2400();
    Value = SPI_I2S_ReceiveData(RF_SPI);

    wait_uz2400();
    uz2400_deselect(); //Put the CS to High

    enable_rf_int();

    return Value;
}
コード例 #2
0
ファイル: uz_spif.c プロジェクト: xdpsee/uIP_on_eCos
void spi_lw(UINT16 Address, UINT8 Value)
{
    Address = (Address << 5) | 0x8010;

    disable_rf_int();

//Set up the SFRPAGE
    uz2400_select(); //Put the CS to Low
    SPI_I2S_SendData(RF_SPI,(Address>>8)&0x00ff);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();

    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    SPI_I2S_SendData(RF_SPI,Address&0x00ff);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    SPI_I2S_SendData(RF_SPI,Value);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);

    wait_uz2400();

    wait_uz2400();
    uz2400_deselect(); //Put the CS to High

    enable_rf_int();
}
コード例 #3
0
ファイル: uz_spif.c プロジェクト: xdpsee/uIP_on_eCos
UINT8 spi_sr(UINT8 Address) {
    UINT8 Value;

    Address = (Address << 1);

    disable_rf_int();

    uz2400_select();
    SPI_I2S_SendData(RF_SPI,Address);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    SPI_I2S_SendData(RF_SPI,0x00);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    wait_uz2400();
    Value = SPI_I2S_ReceiveData(RF_SPI);

    wait_uz2400();
    uz2400_deselect();

    enable_rf_int();

    return Value;

}
コード例 #4
0
ファイル: uz_spif.c プロジェクト: xdpsee/uIP_on_eCos
void spi_dump_fifo(UINT16 Address, UINT8 *DataPtr, UINT8 Length)
{

    Address = (Address << 5) | 0x8000;

    disable_rf_int();

    uz2400_select(); //Put the CS to Low

    SPI_I2S_SendData(RF_SPI,(Address>>8)&0x00ff);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    SPI_I2S_SendData(RF_SPI,Address&0x00ff);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    while(Length--) {
        SPI_I2S_SendData(RF_SPI,0x00ff);
        uz2400_wait_spi_w_ready();
        uz2400_wait_spi_r_ready();
        wait_uz2400();
        *DataPtr++ = SPI_I2S_ReceiveData(RF_SPI);
    }
    wait_uz2400();
    uz2400_deselect(); //Put the CS to High

    enable_rf_int();
}
コード例 #5
0
ファイル: uz_spif.c プロジェクト: xdpsee/uIP_on_eCos
void spi_rd_rx_fifo(UINT8 *DataPtr, UINT8 *RxLength) {

    UINT8 Length;

    disable_rf_int();

    uz2400_select(); //Put the CS to Low

    SPI_I2S_SendData(RF_SPI,0xE0);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    SPI_I2S_SendData(RF_SPI,0x00);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    SPI_I2S_SendData(RF_SPI,0x00);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    wait_uz2400();
    Length = SPI_I2S_ReceiveData(RF_SPI);

    Length += 2;
    *RxLength = Length;

    while(Length--) {
        SPI_I2S_SendData(RF_SPI,0x00);
        uz2400_wait_spi_w_ready();
        uz2400_wait_spi_r_ready();
        wait_uz2400();
        *DataPtr++ = SPI_I2S_ReceiveData(RF_SPI);
    }
    wait_uz2400();
    uz2400_deselect(); //Put the CS to High

    enable_rf_int();

}
コード例 #6
0
//RF ISR
void  GPABC_IRQHandler(void){
	if(GPIOB_ISRC&0x00000200UL){
		disable_rf_int();
		uz2400_isr_handler();
		enable_rf_int();
	}
	GPIOB_ISRC = GPIOB_ISRC;		
#if 0	
    if (EXTI_GetITStatus(EXTI_Line4) != RESET){
		#ifdef SELECT_CC2520
			halRfDisableRxInterrupt();
			cc2520_isr_handler();
			halRfEnableRxInterrupt();
		#else
			//disable_rf_int();
			uz2400_isr_handler();
			//enable_rf_int();
		#endif
		EXTI4_ClearBit();
    }
#endif    
}
コード例 #7
0
ファイル: uz_spif.c プロジェクト: xdpsee/uIP_on_eCos
void spi_sw(UINT8 Address, UINT8 Value) {
    Address = (Address << 1) | 0x0001; //Shfit the Address
    disable_rf_int();

    //Set up the SFRPAGE
    uz2400_select();

    SPI_I2S_SendData(RF_SPI,Address);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    SPI_I2S_SendData(RF_SPI,Value);
    uz2400_wait_spi_w_ready();
    uz2400_wait_spi_r_ready();
    SPI_I2S_ReceiveData(RF_SPI);
    wait_uz2400();

    uz2400_deselect();

    enable_rf_int();
}