Created
December 6, 2010 01:00
-
-
Save scottellis/729675 to your computer and use it in GitHub Desktop.
spike_queue_spi_write
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int spike_queue_spi_write(void) | |
{ | |
int status; | |
unsigned long flags; | |
spi_message_init(&spike_ctl.msg); | |
/* this gets called when the spi_message completes */ | |
spike_ctl.msg.complete = spike_completion_handler; | |
spike_ctl.msg.context = NULL; | |
/* write some toggling bit patterns, doesn't really matter */ | |
spike_ctl.tx_buff[0] = 0xAA; | |
spike_ctl.tx_buff[1] = 0x55; | |
spike_ctl.transfer.tx_buf = spike_ctl.tx_buff; | |
spike_ctl.transfer.rx_buf = NULL; | |
spike_ctl.transfer.len = 2; | |
spi_message_add_tail(&spike_ctl.transfer, &spike_ctl.msg); | |
spin_lock_irqsave(&spike_dev.spi_lock, flags); | |
if (spike_dev.spi_device) | |
status = spi_async(spike_dev.spi_device, &spike_ctl.msg); | |
else | |
status = -ENODEV; | |
spin_unlock_irqrestore(&spike_dev.spi_lock, flags); | |
if (status == 0) | |
spike_ctl.busy = 1; | |
return status; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment