SZSPTP ez430-RF2480 1.0

ZigBee Sensor Network with synchronized time and time-stamped measurements.
SPI

SPI communication. More...

Files

file  spi.c
 SPI implementation.
 
file  spi.h
 SPI interface.
 

Macros

#define SPI_BUFSIZE   128
 Size of the SPI buffer.
 

Functions

void spi_init ()
 SPI initialization. More...
 
UInt16 spi_proccess ()
 SPI proccess. More...
 
UInt8 spi_reqBegin (UInt8 len, UInt8 cmd0, UInt8 cmd1)
 Request begin. More...
 
UInt8 spi_reqData (UInt8 len, void *pBuf)
 Request data. More...
 
void spi_reqEnd (UInt8 forwardToSerial)
 Request end. More...
 
UInt8 spi_busy ()
 SPI busy. More...
 
void SPI_SRDYISR ()
 ISR SRDY. More...
 
void SPI_USCIB0RX_ISR ()
 USCIB0 RX. More...
 

Variables

char spi_buf [SPI_BUFSIZE]
 SPI buffer, used to send and receive data.
 

Detailed Description

SPI communication.

Function Documentation

UInt8 spi_busy ( )

SPI busy.

This function checks if SPI is idle or busy on another state.

Returns
1 if busy, 0 if idle

Definition at line 444 of file spi.c.

References spi_currentState.

void spi_init ( )

SPI initialization.

This function initializes the SPI variables.

Definition at line 287 of file spi.c.

References spi_bytesLeft, spi_currentFreeBytes, spi_currentState, SPI_MRDYBIT, spi_receiveOverFlow, SPI_SETMRDY, SPI_SETSRDYDETECTDOWN, SPI_SRDYBIT, and SPI_SSBIT.

Referenced by ccai_proccess(), main(), and uart_proccessCmd().

+ Here is the caller graph for this function:

UInt16 spi_proccess ( )

SPI proccess.

This function processes the tasks of the spi.

Returns
Time to run again (ms); 0 means 65536ms

Definition at line 325 of file spi.c.

References ccai_resetFull(), and spi_currentState.

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 spi_reqBegin ( UInt8  len,
UInt8  cmd0,
UInt8  cmd1 
)

Request begin.

This function starts data feed to a synchronous request to the SPI.

Parameters
[in]lenSize of the data field of the packet
[in]cmd0First byte of the command
[in]cmd1Second byte of the command
Returns
1 if success, 0 if fail

Definition at line 352 of file spi.c.

References im_disable_interrupt(), im_enable_interrupt(), spi_buf, SPI_BUFSIZE, spi_currentFreeBytes, spi_currentState, SPI_FRAMEHDRSIZE, spi_pBuf, and SPI_SETSRDYDETECTDOWN.

Referenced by ccai_a_sys_reset_req(), ccai_a_sys_test_rf(), ccai_s_sys_adc_read(), ccai_s_sys_gpio(), ccai_s_sys_osal_nv_read(), ccai_s_sys_osal_nv_write(), ccai_s_sys_osal_start_timer(), ccai_s_sys_osal_stop_timer(), ccai_s_sys_random(), ccai_s_sys_test_loopback(), ccai_s_sys_version(), ccai_s_zb_allow_bind(), ccai_s_zb_app_register_request(), ccai_s_zb_bind_device(), ccai_s_zb_find_device_request(), ccai_s_zb_get_device_info(), ccai_s_zb_permit_joining_request(), ccai_s_zb_read_configuration(), ccai_s_zb_send_data_request(), ccai_s_zb_send_data_request_begin(), ccai_s_zb_start_request(), and ccai_s_zb_write_configuration().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt8 spi_reqData ( UInt8  len,
void *  pBuf 
)

Request data.

This function writes data to the SPI buffer.

Parameters
[in]lenSize of the data to write
[in]pBufPointer to the data buffer to copy on the SPI buffer.
Returns
1 if success, 0 if fail

Definition at line 382 of file spi.c.

References spi_currentFreeBytes, and spi_pBuf.

Referenced by ccai_a_sys_reset_req(), ccai_a_sys_test_rf(), ccai_s_sys_adc_read(), ccai_s_sys_gpio(), ccai_s_sys_osal_nv_read(), ccai_s_sys_osal_nv_write(), ccai_s_sys_osal_start_timer(), ccai_s_sys_osal_stop_timer(), ccai_s_sys_test_loopback(), ccai_s_zb_allow_bind(), ccai_s_zb_app_register_request(), ccai_s_zb_bind_device(), ccai_s_zb_find_device_request(), ccai_s_zb_get_device_info(), ccai_s_zb_permit_joining_request(), ccai_s_zb_read_configuration(), ccai_s_zb_send_data_request(), ccai_s_zb_send_data_request_begin(), ccai_s_zb_send_data_request_payload(), and ccai_s_zb_write_configuration().

+ Here is the caller graph for this function:

void spi_reqEnd ( UInt8  forwardToSerial)

Request end.

This function terminate receiving data to a request to the SPI and sends the request.

Parameters
[in]forwardToSerial1 to forward the packet to serial port, 0 to not

Definition at line 411 of file spi.c.

References im_enable_interrupt(), spi_buf, SPI_BUFSIZE, spi_bytesLeft, SPI_CLRMRDY, spi_currentState, SPI_FRAMEHDRSIZE, spi_pBuf, and uart_forwardCmd().

Referenced by ccai_a_sys_reset_req(), ccai_a_sys_test_rf(), ccai_s_sys_adc_read(), ccai_s_sys_gpio(), ccai_s_sys_osal_nv_read(), ccai_s_sys_osal_nv_write(), ccai_s_sys_osal_start_timer(), ccai_s_sys_osal_stop_timer(), ccai_s_sys_random(), ccai_s_sys_test_loopback(), ccai_s_sys_version(), ccai_s_zb_allow_bind(), ccai_s_zb_app_register_request(), ccai_s_zb_bind_device(), ccai_s_zb_find_device_request(), ccai_s_zb_get_device_info(), ccai_s_zb_permit_joining_request(), ccai_s_zb_read_configuration(), ccai_s_zb_send_data_request(), ccai_s_zb_send_data_request_end(), ccai_s_zb_start_request(), and ccai_s_zb_write_configuration().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SPI_SRDYISR ( )

ISR SRDY.

Interrupt service request for SRDY line.

Definition at line 569 of file spi.c.

References SPI_CLRMRDY, spi_currentState, SPI_SETMRDY, spi_setPollCmd(), SPI_SETSRDYDETECTDOWN, SPI_SETSRDYDETECTUP, spi_snd(), and SPI_SRDYBIT.

+ Here is the call graph for this function:

void SPI_USCIB0RX_ISR ( )

USCIB0 RX.

Interrupt service request for USCIB0 RX.

Definition at line 625 of file spi.c.

References spi_currentState, spi_pBuf, and spi_snd().

+ Here is the call graph for this function: