hal_spi.h File Reference

Description : file given by texas instrument for the PHY layer. More...

#include <bite.h>

Include dependency graph for hal_spi.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define FASTSPI_GETREG(a, v)
#define FASTSPI_READ_FIFO_BYTE(b)
#define FASTSPI_READ_FIFO_GARBAGE(c)
#define FASTSPI_READ_FIFO_NO_WAIT(p, c)
#define FASTSPI_READ_RAM_LE(p, a, c, n)
#define FASTSPI_RX(x)
#define FASTSPI_RX_ADDR(a)
#define FASTSPI_RX_GARBAGE()
#define FASTSPI_RX_WORD(x)
#define FASTSPI_SETREG(a, v)
#define FASTSPI_STROBE(s)
#define FASTSPI_TX(x)
#define FASTSPI_TX_ADDR(a)
#define FASTSPI_TX_MANY(p, c)
#define FASTSPI_UPD_STATUS(s)
#define FASTSPI_WRITE_FIFO(p, c)
#define FASTSPI_WRITE_FIFO_NOCE(p, c)
#define FASTSPI_WRITE_RAM_LE(p, a, c, n)
#define SPI_WAITFOREORx()   while ((IFG2 & URXIFG1) == 0)
#define SPI_WAITFOREOTx()   while ((U1TCTL & TXEPT) == 0)

Functions

void halRfSetChannel (UINT8 channel)
void halRfWaitForCrystalOscillator (void)
 Waits for the crystal oscillator to become stable. The flag ispolled via the SPI status byte.
void halSpiInit (void)
 Configure uart 1 in mode SPI master.


Detailed Description

Description : file given by texas instrument for the PHY layer.

Definition in file hal_spi.h.


Define Documentation

#define FASTSPI_GETREG ( a,
 ) 

Value:

do {\
      SPI_ENABLE();\
      FASTSPI_RX_ADDR(a);\
      v= (BYTE)U1RXBUF;\
      FASTSPI_RX_WORD(v);\
      halWait(1);\
      SPI_DISABLE();\
   } while (0)

Definition at line 109 of file hal_spi.h.

Referenced by cc2420_active_batmon(), and halRfGetRSSI().

#define FASTSPI_READ_FIFO_BYTE (  ) 

Value:

do {\
      SPI_ENABLE();\
      FASTSPI_RX_ADDR(CC2420_RXFIFO);\
      U1RXBUF;\
      FASTSPI_RX(b);\
        halWait(1);\
      SPI_DISABLE();\
   } while (0)

Definition at line 155 of file hal_spi.h.

Referenced by fifo_interrupt(), and RecepFrame().

#define FASTSPI_READ_FIFO_GARBAGE (  ) 

Value:

do {\
      SPI_ENABLE();\
      FASTSPI_RX_ADDR(CC2420_RXFIFO);\
      U1RXBUF;\
      for (UINT8 spiCnt = 0; spiCnt < (c); spiCnt++) {\
        FASTSPI_RX_GARBAGE();\
      }\
        halWait(1);\
      SPI_DISABLE();\
   } while (0)

Definition at line 180 of file hal_spi.h.

#define FASTSPI_READ_FIFO_NO_WAIT ( p,
 ) 

Value:

do {\
      SPI_ENABLE();\
      FASTSPI_RX_ADDR(CC2420_RXFIFO);\
      U1RXBUF;\
      for (UINT8 spiCnt = 0; spiCnt < (c); spiCnt++) {\
        FASTSPI_RX(((BYTE*)(p))[spiCnt]);\
      }\
      halWait(1);\
      SPI_DISABLE();\
   } while (0)

Definition at line 166 of file hal_spi.h.

Referenced by fifo_interrupt(), and RecepFrame().

#define FASTSPI_READ_RAM_LE ( p,
a,
c,
 ) 

Value:

do {\
      SPI_ENABLE();\
      FASTSPI_TX(0x80 | (a & 0x7F));\
      FASTSPI_TX((((a >> 1) & 0xC0)|0x20));\
      for (n = 0; n < (c); n++) {\
        FASTSPI_RX(((BYTE*)(p))[n]);\
      }\
      SPI_DISABLE();\
   } while (0)

Definition at line 220 of file hal_spi.h.

#define FASTSPI_RX (  ) 

Value:

do {\
        U1TXBUF = 0;\
      SPI_WAITFOREORx();\
    x = U1RXBUF;\
    } while(0)

Definition at line 39 of file hal_spi.h.

#define FASTSPI_RX_ADDR (  ) 

Value:

do {\
      U1TXBUF = (a) | 0x40;\
      SPI_WAITFOREOTx();\
   } while (0)

Definition at line 77 of file hal_spi.h.

 
#define FASTSPI_RX_GARBAGE (  ) 

Value:

do {\
      U1TXBUF = 0;\
    SPI_WAITFOREORx();\
    U1RXBUF;\
  } while(0)

Definition at line 46 of file hal_spi.h.

#define FASTSPI_RX_WORD (  ) 

Value:

do {\
      U1TXBUF = 0;\
        SPI_WAITFOREORx();\
    x = U1RXBUF << 8;\
      U1TXBUF = 0;\
    SPI_WAITFOREORx();\
    x |= U1RXBUF;\
    } while (0)

Definition at line 61 of file hal_spi.h.

#define FASTSPI_SETREG ( a,
 ) 

Value:

do {\
      SPI_ENABLE();\
      FASTSPI_TX_ADDR(a);\
      FASTSPI_TX((BYTE) ((v) >> 8));\
      FASTSPI_TX((BYTE) (v));\
      SPI_DISABLE();\
   } while (0)

Definition at line 99 of file hal_spi.h.

Referenced by cc2420_active_batmon(), cc2420_change_channel(), cc2420_change_emission_power(), and setup_cc2420().

#define FASTSPI_STROBE (  ) 

Value:

do {\
      SPI_ENABLE();\
      FASTSPI_TX_ADDR(s);\
      SPI_DISABLE();\
    } while (0)

Definition at line 92 of file hal_spi.h.

Referenced by cc2420_powerdown(), fifo_interrupt(), init_cc2420_rx(), RecepFrame(), sendFrame(), setup_cc2420(), and wakeup_cc2420().

#define FASTSPI_TX (  ) 

Value:

do {\
    U1TXBUF = x;\
    SPI_WAITFOREOTx();\
  } while(0)

Definition at line 33 of file hal_spi.h.

#define FASTSPI_TX_ADDR (  ) 

Value:

do {\
      U1TXBUF = a;\
      SPI_WAITFOREOTx();\
   } while (0)

Definition at line 71 of file hal_spi.h.

#define FASTSPI_TX_MANY ( p,
 ) 

Value:

do {\
    for (UINT8 spiCnt = 0; spiCnt < (c); spiCnt++) {\
      FASTSPI_TX(((BYTE*)(p))[spiCnt]);\
    }\
  } while(0)

Definition at line 53 of file hal_spi.h.

#define FASTSPI_UPD_STATUS (  ) 

Value:

do {\
      SPI_ENABLE();\
      U1TXBUF = CC2420_SNOP;\
      SPI_WAITFOREOTx();\
      s = U1RXBUF;\
      SPI_DISABLE();\
   } while (0)

Definition at line 121 of file hal_spi.h.

Referenced by halRfWaitForCrystalOscillator(), and sendFrame().

#define FASTSPI_WRITE_FIFO ( p,
 ) 

Value:

do {\
      SPI_ENABLE();\
    FASTSPI_TX_ADDR(CC2420_TXFIFO);\
    for (UINT8 i = 0; i < (c); i++) {\
        FASTSPI_TX(((BYTE*)(p))[i]);\
    }\
    SPI_DISABLE();\
    } while (0)

Definition at line 137 of file hal_spi.h.

Referenced by sendFrame().

#define FASTSPI_WRITE_FIFO_NOCE ( p,
 ) 

Value:

do {\
    FASTSPI_TX_ADDR(CC2420_TXFIFO);\
    for (UINT8 spiCnt = 0; spiCnt < (c); spiCnt++) {\
        FASTSPI_TX(((BYTE*)(p))[spiCnt]);\
    }\
    } while (0)

Definition at line 147 of file hal_spi.h.

#define FASTSPI_WRITE_RAM_LE ( p,
a,
c,
 ) 

Value:

do {\
      SPI_ENABLE();\
      FASTSPI_TX(0x80 | (a & 0x7F));\
      FASTSPI_TX((a >> 1) & 0xC0);\
      for (n = 0; n < (c); n++) {\
        FASTSPI_TX(((BYTE*)(p))[n]);\
      }\
      SPI_DISABLE();\
   } while (0)

Definition at line 209 of file hal_spi.h.

 
#define SPI_WAITFOREORx (  )     while ((IFG2 & URXIFG1) == 0)

Definition at line 30 of file hal_spi.h.

 
#define SPI_WAITFOREOTx (  )     while ((U1TCTL & TXEPT) == 0)

Definition at line 29 of file hal_spi.h.


Function Documentation

void halRfSetChannel ( UINT8  channel  ) 

void halRfWaitForCrystalOscillator ( void   ) 

Waits for the crystal oscillator to become stable. The flag ispolled via the SPI status byte.

Note:
Note that this function will lock up if the SXOSCON commandstrobe has not been given before the function call. Also note that global interrupts will always beenabled when this function returns.

Definition at line 71 of file cc2420.c.

References BM, CC2420_XOSC16M_STABLE, and FASTSPI_UPD_STATUS.

Referenced by cc2420_Init(), and wakeup_cc2420().

Here is the caller graph for this function:

void halSpiInit ( void   ) 

Configure uart 1 in mode SPI master.

Definition at line 92 of file set_hardware.c.

Referenced by init().

Here is the caller graph for this function:


Generated on Wed Jun 3 12:05:50 2009 for PowWow v1.0 by  doxygen 1.5.6