Go to the source code of this file.
reset/initialize the spi interface
This macro is usually used once before the beginning of the program.
Example Usage:
3 // initialize spi interface
spi_get_fifo_space |
( |
reg |
s | ) |
|
get status index of the least number of space in fifo
- Parameters
-
[out] | s | the ipu register to store the index |
This macro is mostly used to gurantee that the fifo has enough space to buffer the in-out speed mismatch in spi communication.
The absolute safe way to achieve this is the make sure the fifo space is bigger than the size of all packets used in a frame iteration.
get a value from the SPI input port
- Parameters
-
[in] | e | SPI input port option |
- Returns
- the value presented in the port
The valid options for the input port is SPI_RX_0
to SPI_RX_7
.
See SPI Downwards Communication for some extra notes on receving data from host.
Example
The follow code use a value from SPI input port to threshold a image
3 s0 = spi.port(SPI_RX_0)
send an AREG plane as a standard packet (packet size: 65552 bytes)
- Parameters
-
[in] | r | the AREG plane to be sent |
send a 64x64 subsample of an AREG plane as a standard packet (packet size: 4120 bytes)
- Parameters
-
[in] | r | the AREG plane to be sent |
send a DREG plane as a standard packet (packet size: 8208 bytes)
- Parameters
-
[in] | r | the DREG plane to be sent |
scan and send the coordinates of n
points in a DREG plane (packet size: 16 + 2*n bytes)
- Parameters
-
[in] | r | the DREG plane to be scanned |
[in] | n | maximum number of points, can be a value between [0,65535] |
spi_scan_target |
( |
dreg |
r | ) |
|
scan and send the coordinates of the bounding box of '1's in a DREG plane (packet size: 16 bytes)
- Parameters
-
[in] | r | the DREG plane to be scanned |
send a spi header, which containing the payload size. The size of the header itself is always 8 bytes.
- Parameters
-
change the transfer size, which is the number of bytes in a single transfer burst
- Parameters
-
[in] | w | number of bytes in a single transfer burst, between [16,4096] |
This macro provide the optional setting of the transfer size, which may be used to optimize the spi communication for better bandwith or latency.
For more details about setting transfer size, see Optimizing Transfer Size.