On Wed, 4 Aug 1999, David J. Christini wrote:

> Is it possible to rtf_put an entire array with just one rtf_put call?
> 
> I have an array:  unsigned short ai_data[4];
> 
> I read in 4 channels of analog input data from my data acquisition card
> and place it into ai_data using a single ioctl call. I then want to
> rtf_put this data to a FIFO. I'd like to avoid using a for loop with 4
> rtf_put calls. Can I do it in one rtf_put call (i.e., put the entire
> array), and if so, can I then pull them off of the FIFO in my
> non-real-time process using a single read command (if so, what's the
> syntax), or do I need to use multiple read commands in a loop?

You may want to typedef a struct which contains the array, then
sizeof() the struct:

typedef struct
{
        unsigned short ai_data[4];
} my_ai_data_st, * p_my_ai_data_st;

some_function_to_do_your_ai()
{
my_ai_data_st the_ai_data_st;

do_the_ai_thing_with_this_array(the_ai_data_st.ai_data);

rtf_put(PIPE, &the_ai_data_st, sizeof(my_ai_data_st));
}

You could also, of course, just specify the number of bytes in
your unsigned int array - you do need to be aware of
alignment issues when maintaining the code however. 

--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to