Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: OSSynchronizeIO and device memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OSSynchronizeIO and device memory



Shawn,

Thank you for the response.

We are not using a DMA engine, that's part of the problem.

And the "order" is not really important in this case. I mean a read does
not really depend on a previous write having gone through! I mean the
previous writes that do matter are all under "my" control, and I can put
the proper OSSyncIO in the correct places.

I was only worried about the write not making all the way out to the
device (a cache issue?).

It looks like I have no reason to worry now!

Thanks.

Devendra.

At 09:58 AM 10/26/2002, Shawn Erickson wrote:

On Thursday, October 24, 2002, at 10:32 AM, Devendra Parakh wrote:

> Hi,
>
> We have a PCI card(audio) which has a large buffer that we use to
> transfer data.
>
> If I understand correctly, before reading from device memory, and
after
> writing to device memory, I need to call OSSynchronizeIO.
>
> Is there a way to avoid this?

Are you using a DMA engine to move things? If you are then you don't
need t worry about OSSynchronizeIO.

You only really need OSSynchronizeIO between memory operations that
have to happen in a specific order. For example writing bits into a
mailbox registers followed by setting a bit to get your adapter to do
something with the data you wrote in the mailbox. You want the IO ops
related to the mailbox registers to happen before the trigger bit, to
do this insert OSSynchronizeIO between the first block of writes and
the final write.

Example... (WL16 is a macro for writing out 16 bit value byte swapped
as needed)

if ( BIT_TEST( mask, MB_BOX0 ) ) WL16( m_box0, box[0] );
if ( BIT_TEST( mask, MB_BOX1 ) ) WL16( m_box1, box[1] );
if ( BIT_TEST( mask, MB_BOX2 ) ) WL16( m_box2, box[2] );
if ( BIT_TEST( mask, MB_BOX3 ) ) WL16( m_box3, box[3] );
if ( BIT_TEST( mask, MB_BOX4 ) ) WL16( m_box4, box[4] );
if ( BIT_TEST( mask, MB_BOX5 ) ) WL16( m_box5, box[5] );
if ( BIT_TEST( mask, MB_BOX6 ) ) WL16( m_box6, box[6] );
if ( BIT_TEST( mask, MB_BOX7 ) ) WL16( m_box7, box[7] );
OSSynchronizeIO();
WL16( &m_isp->hccr, FIELD_INSERT( 0, HCCR_COMMAND,
HCCR_COMMAND_SET_HOST_INT ) );

Or...
WL16( &m_isp->intctl, tmpIntctl );
OSSynchronizeIO();
for ( unsigned int i = 0; i < 500; i++ )
{
if ( RL16( &m_isp->intctl ) == tmpIntctl )
{
bIntSetComplete = true;
break;
}
....
}

-Shawn
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.

Devendra ParakhSinging Electrons, Inc.http://www.singingelectrons.com425-889-2478
_______________________________________________
darwin-drivers mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-drivers
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: OSSynchronizeIO and device memory (From: Shawn Erickson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.