WWDC2003 Session 505

Transcript

Kind: captions
Language: en
we have two firewire sessions this year
like we do every year one is more in
depth and focuses on writing software
the other is more introductory and this
year focus is a great deal on firewire
800 but this year they are in reverse
order so you haven't missed anything the
next one is tomorrow at 9am I'm sure
you'll all be up bright and early for
that what this session is about is
writing firewire software we're going to
talk about what in Mac OS 10 how the
fire wire services work what's available
for you to tap into where you can hook
your software in two hours and we have a
new focus this year on a number of
topics more in-depth for example we'll
look at how isochronous transmitted
really works which we've always glossed
over in the past and we have a bunch of
new tools for you that I think you'll be
really interested in so let's launch
right into this wasn't expecting this to
be tipped over it like that we're going
over the architecture first look at the
layers of firewire software the various
modules how driver matching and loading
works where you can hook in how you
develop software then we have special
sections on tcp/ip the internet protocol
running over firewire some detailed
examples of how isochronous transfer
works what dcl really is and what
happens when you run one will look at
new AVC services including new ABC
target support that add some great new
capabilities we'll talk briefly about
SVP tree which adds a new performance
capability and then we'll have a
detailed look at some new tools and
other support that we have for you to
help you develop for firewire on Mac OS
10 let's start with the architecture see
if this thing works here's the stack
showing various elements in Mac OS 10
firewire the four that are brightly
colored are the core services that are
provided by the firewire software team
and some others are shown around them
for context starting at the bottom you
see the silicon that represents the
firewire interface and the power
macintosh system the five which we'll
talk more about later and the ohci chip
together that's what you typically find
on a firewire card
when that's detected our services load
in the colonel pretty much all the
firewire is in the kernel because
firewires a resource that we can boot
from we can take a page fault from a
firewire device so it's got to be there
in the colonel similarly our IP
networking services have to be in the
colonel so we'll go over the layers in
the kernel and we'll also talk about how
you can hook into that from user space
up on top you can see the three layers
in the kernel there the controller hooks
directly onto the hardware the family
pulls everything together the protocol
layers where we start to differentiate
into SB p2 or ABC and then the user
client interfaces up on top let's start
with the family right in the middle the
family is the layer that brings
everything together you've got multiple
firewire devices multiple drivers
multiple applications they all want to
use the same firewire bus at the same
time well there's only so many DMA
contexts in the dress space and
interrupts and so on you don't want them
trying to know what each other are doing
you want the mall to function
independently that's what the family
does it lets the different drivers make
their requests accuse them up and send
them on the bus when packets come back
in it figures out which packets go to
which drivers hands them out accordingly
so your drivers don't have to tiptoe
around each other you can write just to
do your thing and not worry about
everybody else that's what the family is
for the family also provides some basic
management services for example e the
family may tune the performance of the
firewire bus to optimize some of the
hardware settings the families provided
in kernel extension called io firewire
family text and there's going to be one
of these for each firewire bus in your
system typically you only have one
firewire bus in the system but if you
want you can have more than one the
layer below that is the controller this
is what glues to family to the hardware
in your system in most systems this will
be apple fw ohci the colonel extension
although in certain very old systems it
will be Apple links such as on the blue
and white g3 the controller actually
knows how to program DMA knows how to
handle interrupts and knows how to do
all the hardware specific stuff this is
the same whether you have an integrated
controller like Steve showed yesterday
in the in the new g5
architecture where the firewire
controllers just built into the chipset
or if you have a pci card or card bus
card it's all the same as a controller
layer now as I described all those
things sharing the family everything
they do have to go through the
controller the controller cannot be
subclassed even though it's in the
colonel this is a location that has to
please everybody so if you go in there
changing it to please your device you're
probably going to make someone else
unhappy so don't even think about trying
to sub classic controller this does mean
if you make a din cards be sure to pick
silicon that works now moving up from
the family protocol this is where things
start to differentiate if you're a
camcorder or an iPod or a printer you
start to have a different personality at
this layer for example SBP the serial
bus protocol is what's used by storage
devices like the ipod hard disk drives
it's also used by others guzzi type
devices like scanners or printers on
fire wire in comparison the AVC command
set is used by camcorders TV set digital
bcrs sort of consumer electronic devices
each of these has a service layer that
sits on top of the firewire family that
provides all the basics of that protocol
so that you don't have to reinvent it
from scratch just to communicate with
that particular device these letters
also perform protocol specific matching
services now we don't have our own
matching musieo kit for everything but
these layers know how to take a closer
look at say an ABC device and figure out
what subunits it has is it a tape or a
VCR or a TV this information goes into
the registry so that you can use i/o get
to match properly to your device finally
outside the kernel we provide a variety
of user clients officially these are
known as device interfaces but everyone
seems to call them user clients so we'll
do that here this is a way to cook in to
all the fire wire services in the kernel
from an application or from your plug-in
that's running in the context of an
application in user space just about
everything you can do in the colonel in
firewire you can also do from user space
and you'll find it's usually a lot
easier there's direct api's for sending
and receiving packets you can also
access the protocols like SBP and ABC
for
userspace when you do this you're not
using a copy of the services you're not
using some user safe version of the
services you're using the real SBP to or
the real ABC that's in the colonel so
you're going to get the exact same
behavior the same performance places
where buffers have to move across the
user colonel boundary we mapped memory
we don't copy your data across we just
map it directly into the DMA their data
moves as fast as it can writing and
debugging your software out and user
space is much easier than doing so in
the colonel so please do that if you can
somebody wasn't listening to the
announcement before we started about
cell phones now how does driver matching
work as i said we use standard i/o kick
services there's nothing special about
firewire like we had mac OS 9 where we
had our own unique firewire matching in
Mac OS 10 it's all just I Oh Kip but we
put firewire specific information in the
i/o registry so you can find the unit
directory in your device or the vendor
ID or the GUI doll the firewire
information that you expect the firewire
family discovers nodes on the bus that
have configuration roms and create a
device object for each one of them in
the i/o registry it then scans the ROM
further and if it finds unit directories
it creates unit objects typically one
per device but there could be more than
one the unit is where you start to
differentiate whether you become SBP two
or a PC or something else so the
appropriate protocol layer load and it
takes a further examination of the
device if the SBP to layer loads like is
shown in the picture it will create a
target object then it will scan the
device further and create logical unit
objects with SVP specific information
such as the device type whether it's a
disk or a tape or a printer so the
matching is iterative these items build
up one by one in the registry at each
stage you have the opportunity to do
active matching if you need to actually
talk to the device and find out whether
it's really the one you want to drive if
you're working in the kernel you can do
subclassing at the various layers as
well
in addition to the devices we find on
the bus there's also a device in the
registry called the local node the local
node is there whether anything's plugged
in or not it represents the Macintosh
itself but it doesn't mean you're
talking to yourself it's just an
all-purpose portal onto the bus if you
want to talk to a single device out
there you should probably match against
that device but if you're talking to
several devices the local node gives you
a way to do that for example IP /
firewire or the em lam protocol or multi
node cluster computing the local node
might be a good way to hook in for those
because it's always there no matter how
many or how few devices are plugged in
on the bus for you to talk to just like
everything else you can also use the
user client on the local node now that
you've seen the layers and you know
where to hook in where exactly should
you develop your software your first
choice should be to write software out
in user space as I said just about every
service that we have in firewire is
available to a user client in user space
io firewire lib is the primary user
client it has direct access to all the
packet send and receive services and the
specific user clients for ABC and SBP
that are listed here as well however if
you're looking to use SBP you may
instead want to use the fuzzy task user
client we'll talk more about that later
but if your device complies with sam
discuz the architecture model scuzzy
task user clients going to be a lot
easier than spp to user plan if you're
working in user space we have lots of
sample code available if you've
installed the firewire SDK you can look
in this path and you'll find all the
sample code for writing drivers and
applications out in user space now I
said writing in user space should be
your first choice you only actually have
two choices writing in the kernel is
your last choice you really don't want
to do this if you can avoid it all fire
wire services are available and you may
need to write in here if you're writing
a bootable driver although we provide
one for you so you shouldn't have to if
you're writing a networking driver same
caveat or something else that supports
another colonel service but many kinds
of things simply can
filling the colonel you can't put a
printer driver in the colonel it just
there's no way to hook it into print
center the same goes with a scanner
driver but if you need to write in the
kernel you can and that may give you the
opportunity to subclass some of the
layers that we have in the colonel for
example we do this fairly extensively in
the mass storage class we sub class so
that we can provide the best possible
support for each of the different kinds
of bridge silicon that's out there in
firewire hard drive sample code for
working the colonel is limited basically
all we have to offer is the source code
for firewire itself which is in Darwin
so you can start there and you'll see
how it works and you can figure out how
to look into it debugging and testing is
more difficult in the kernel than in
user space if you crash in user space
you can just run again but if you crash
your driver in the colonel you'll get to
reboot the machine that'll give you some
time to ponder when you left and your
backups so you should really develop out
in user space if you can if that wasn't
enough incentive here's all the sample
code that we have now in SDK 16 once
you've installed SDK 16 that path is
where you'll find all of this there's
some very general purpose sample code
like fw sample project very non-specific
io firewire lid basics do you want to
cause trouble you can start with the
reset storm sample code we have some new
stuff that's very exciting the dvhs
capture sample and the firewire MPEG if
you have a firewire devices like a
digital VCO or firewire TV try these out
you'll find some really interesting new
capabilities there so whatever you're
trying to do we surely got something on
this list that's a good starting point
now I mentioned scuzzy task user clients
and Sam lots of devices that use SBP to
also comply with fuzzy architecture
model so fuzzy task user client may be a
lot easier for you if you use SBP to
user client you have to deal with bus
reset logins reconnect and so on all
that's handled for you in scuzzy task
use our client you can just form the
commands or task and hand them down to
have them executed so if you'd like to
try that this shows where it's located
it's inside iOS because
architecture model family checks if your
device is some kind of optical media
burner you may want to move to an even
higher level we now have a P is for disc
recorded for DVD r tdr and so on you can
find documentation as listed there that
would be generally even easier than
using scuzzy task and certainly been
using SBP too now if your device has
some SBP to unique behavior or it
doesn't quite SBP to then you may need
to move back down the software stack and
use SBP to itself or even the basic
firewire api's but whatever your device
does there's some way we provide that
you can hook into it and they may be
several ways to choose from
new this year possibly late last year
tcp/ip the Internet Protocol we now
support this on fire wire this is an
industry standard I Tripoli standard 27
34 is very straightforward it's only a
few pages it shows how to send IP
datagrams on fire wire you can get it at
the I Triple E website if you want
internet data grams are simply packaged
up and firewire block right each
firewire node that supports IP allocates
an address in its own address space
where it will receive these packets and
that address is published in the nodes
configuration ROM so that other nodes on
the bus can discover it so our driver
finds all the other nodes that speak I
pee and then can send data grams to them
broadcast packets are supported that's
used for example for our plea address
resolution protocol that's done with a
firewire a synchronous stream packet
it's like an isochronous packet but it's
not sent in real time so no reservation
is required so it's fine for arc it's
also very low bandwidth so it doesn't
interfere with anything else I Triple E
1394a set aside isochronous channel
number 31 for this purpose and certain
related purposes if you have a device
that's hardwired to channel 31 I don't
know of any you're going to have to move
to another channel but you'll see these
packets and Firebug as isochronous
Packers they're actually a synchronous
stream Packard's Firebug can't tell
whether it was tenth in real time or not
it only knows when it arrived so it
shows it as if it was isochronous so
what's this good for the internet good
for a lot of things everyone you ask
will have a different favorite use
there's no restriction here we support
IP so anything that runs on IP should
run on IP over firewire HTTP protocol
file services like FTP or AFP whatever
you want now you may find this
interesting if you're presently using
target disk mode using AFP or personal
file sharing maybe you may want to
investigate that is it after that
depends you don't have to reboot twice
so that may help but you do have to
login and setup personal file sharing
the actual performance is likely to
depend on
kinda files you're moving how much of
the CPU you're using and so on so give
us a try you may find it to your liking
many cluster computing api's use IP
because it's ubiquitous nobody makes a
computer that doesn't have tcp/ip are
they certainly don't sell very many of
them so if you have a cluster computing
application that you'd like to run on
firewire and it's based on IP you can
run it immediately on IP over firewire
however firewires direct memory access
model where memory space is visible on
the firewire bus is very well suited for
certain kinds of cluster computing that
exchange a lot of data between the nodes
if that's the kind you're doing IP will
work but you may get the best
performance by going to a firewire
native solution so how do you get this
configured like any other IP interface
you start in the network craft control
panel sorry Mac OS 9 term network
preferences panel in the upper left this
is a pop-up menu called show if you'd
pick that at the bottom there's always
something called network port
configuration you probably mostly tried
this once you pick that you'll find
firewire is in your list of network port
unless you're running mac OS 10.2 in
which case you may instead find ethernet
adapter en tu we're working on that if
you see that just double click on it and
rename it to firewire once you've done
that and be sure to turn on the checkbox
you can then drag firewire to the top of
the list if you'd like to use rendezvous
to automatically provide an IP address
for your firewire port just drag it up
to the top like is shown there then if
you'd like to further configure it go
back to the network port pop up and just
pick firewire from the list and you can
select your IP address or whatever else
you like now in Mac OS 10 dot too it
will allow you to configure appletalk
and pppoe not f e and neither of those
make any sense on fire wire so ignore
those you can try to set them up but
they won't do anything we fixed this all
in mac OS 10.3 here's where we have
deployed support for IP on firewire
there's two Developer Preview releases
they're available through the ADC
website and
buddy can download those they run on 10
25 it is also included in Mac OS 10
server version 10 25 and it's
pre-installed on every xserve in mac OS
10.3 it is pre-installed for everybody
using the seed that you received from
this conference you can go turn it on
and try it out right away in Mac OS 10
version 10.3 we have fixed all the
little user interface issues because we
were able to change everything at once
rather than just adding our new text and
we've added support for ipv6 and we've
improved the performance quite a bit
let's look at that now this is somewhere
where the ethernet guys have a big
advantage over us ethernet is an IP
network hardly anyone uses it for
anything else ethernet hardware is
designed for optimal transmission and
reception of IP datagrams firewire
hardware is not it's designed to do
everything ipod camcorders still cameras
TVs it can do a lot of things really
well but it's not customized for IP so
we had a little bit of a disadvantage
when we started so how do we do in the
first preview release our standard
benchmark is to run net / between two x
servers the first preview release on 10
24 could get 216 megabits per second
that's more than half of the firewire
bus it's not bad and in fact if you were
running this on your ibook or your eMac
that's twice as fast as the built-in 100
megabit Ethernet port so this already
may be very useful to a lot of people
but of course we'd like to go faster in
the second preview release and booked in
Mac OS 10 25 server what got that up to
277 megabits per second we're never
going to hit 400 those overhead those
arbitration of acknowledgement we're
going to get somewhere in the 300s but
we're never going to hit 400 but we're
going to keep trying so how have we done
for macro is 10.3 same test we're now up
to 317 megabits per second and if you
hook up to firewire 800 ports that are
now included on the xserve we're getting
660 megabits per second now these are
preliminary and their benchmark numbers
so nothing will ever go this fast in
real life but you can see we're making
it a lot faster and its really getting
very competitive with gigabit ethernet
so if you want to run IP on firewire we
think
put you in pretty good shape to try that
out next isochronous services every year
we talked about the fact that we have I
saw Korean services we say they're
complicated and kind of gloss over how
you actually use them this year we're
going to go into depth and try to
explain the basics of how it works we
have something called a data stream
control language dcl isochronous
transfer on firewire sends or receives
8000 packets per second each one is very
precisely spaced on the firewire bus you
wouldn't want to do this through some
kind of system call API 8000 system
calls per second even if you can do it
is very expensive and it's going to be
almost impossible to get them at the
right time and meet your real time
guarantee so that's just not how it's
designed nobody's ever done it that way
we have hardware that can send to
receive the packets according to a fixed
program of when they should appear but
that hardware is also complicated so it
has different register steps on
different models of Mac requires taking
interrupts knowing physical memory
addresses you don't want to be exposed
to it that's what dcl solve a dcl is an
abstract description of data flow on
firewire a dcl program that you write in
memory describes on a packet by packet
basis how where and when you'd like to
send or receive data you write the
program you hand it to us we figure out
how to make the hardware do what you're
told us to so it's very precise it gives
you packet level control but you don't
have to make frequent system calls you
don't have to hit field time guarantees
yourself at least not 8,000 times per
second so a dcl program is a linked list
of operations and they're going to
execute in the order of the length lift
each operation in there does one basic
thing sends the packet or receives a
packet so you can't mix those in a
single program or it may invoke a call
back to tell you that it's reached a
certain point in a program or it may
jump to another dcl if you don't want to
run the program exactly in the order if
it's written for example you can make a
loop and jump back to the top so you
keep going
we will compile your dcl program to
execute natively on whatever Hardware we
actually have but because of this there
are some restrictions to what you can do
while the programs running if you make
changes to the source they won't
necessarily affect the DMA unless you
tell us what you've done and there's
some limitations on the kind of change
you can make here's a picture here's a
dcl shown on the left as a linked list
of operations the solid arrows pointing
down are the linked list very important
at the bottom you can see it links to 0
if you link it back to the top the
compiler will hang trying to find the
end of your program so please don't
forget to link it to 0 at the end the
last instruction though is a jump
instruction and you can see the dotted
line going up to the top which is a
label instruction this causes the
program to run in an endless loop even
though it's only actually about nine
steps long this program sends data
continuously all of the operations that
move packets are send operations each
one points to a buffer that contains a
packet interspersed between the send
operations are called proc operations
after sending three packets this program
will call will cause your callback to be
executed and you'll know that those
three packets have been delivered onto
the bus this gives you the opportunity
in a looping program like this to update
those three buffer so that the next time
to they send something fresh time waits
for nobody and neither does the DMA it's
really important to understand when you
write these programs packets number one
two and three are sense approximately
125 microseconds apart on the firewire
bus and then we call your fallback but
we also send packet number 4 we don't
wait for your call back to finish your
callback may not have even started yet
when we get to packet number 4 if it's
on your work Luke when you're waiting
for something else to run the DMA is
going to march through those packets
exactly on time according to the
firewire clock this means if your
callback is going to fill in new data
for buffers number 1 2 & 3 you have to
do so quickly now an ordinary program is
not really this small this program sends
only three packets then
the callback so at 8,000 packets per
second you'd have 2,700 callbacks per
second that's really a little too fine
grained typical program will have 20 to
200 packets for each call back and that
depends on the latency that you need in
processing the Packers typical program
may also have more than two clusters it
might have three or four so that you
have a little more time there's less
danger of the DMA wrapping around and
capturing you by surprise there's
another thing in the program that i'm
not showing because it doesn't fit on
that slide so let's zoom in very
important is an update dcl if you change
the contents of one of the transmit
buffers while the program is running we
need to know about it in particular we
usually have to bite swap the header so
that the transmitter will be able to
pick it up over pci where everything
ends up getting bite swapped so after
every call back in the transmit program
typically you'll have an update this
doesn't take any time from the dma's
point of view still just marches through
from send number three to send number
for the update though tell the firewire
family that some previous or some
details and the program may have changed
the update instruction has a list of
pointers to other instructions you can
see here it points to the three send
operations just before you don't have to
tell us what changed we'll figure that
out because we know what kind of
operation they are but you do have to
tell us when they've changed the
callback will execute to completion
before the update happens they're both
done in the CPU so even though the DMA
may have marched on many packets into
the future your callback will finish
before the update happened in a transmit
dcl you have to update the packets
before they get sent in a receive dcl
you have to update the package after
they've been received but before you
look at them if you don't do this or if
you get out of sequence with the update
you may find packets that don't make any
sense because we haven't bike swap the
headers or done other necessary
adjustments
detail programs don't have to loop you
could have a one-shot program that's
very rare or you can change the jumps on
the fly in order to keep feeding new
data to the dcl engine without ever
actually making a loop that's what our
DV transmitter does you'd never want to
send stale DV data every packet has a
sequence number in it so we make sure
that the program always ends somewhere
and if we fall behind the DMA is going
to hit the end and stop so we won't
confuse any TV or camcorder will just
stop sending data of course our goal is
to never let that happen and just keep
running which we usually do there's
another operation called a time stamp
this is something you can insert into
the program if you want to find out
exactly what time it was when the DMA
reached that point you could use a time
stamp which returns the firewire cycle
time to synchronize to programs or
synchronize a program with some external
activity or to make sure this program is
really running on time and they're not
losing packets or having some other
problem time stamps also have to be
updated before you look at them because
they're generated by hardware so they
may come in light swapped or they may
need other modification before they're
accurate in macro 10.3 we're adding a
new kind of dcl details were invented
about seven years ago back when we
didn't have ohci so they're very
flexible so that we had room for growth
now we have ohci everywhere and that's
not going to change so we have adapted
details to really fit well on no HCI
previously there were a lot of hidden
rules in dcl like a label had to be
immediately followed by a send or
receive op the compiler didn't enforce
that but if you forgot your program
wouldn't work it wasn't hard to code
around these rules but it was hard to
remember to follow them the new style
dcl mapped much better to the hardware
so they don't have this kind of rule the
new style dcl has one operation for each
cycle it's going to send or receive a
packet or do nothing at all if that's
what you want and for that one operation
you have won call back if you want it
one update one time stamp you get one of
everything this is being added Mexico if
10.3 it's not yet in the SDK but we will
have it out there soon because it Maps
there's a hard
where we can now do some new things too
that we couldn't do before in particular
we can give you the error status for any
particular packet which may be very
important if you have to check back data
integrity and we can let you change the
length of the packets in the transmit
program which was really difficult to do
before the old style of dcl will still
be supported but they are compiled into
the new style so if you're doing
anything new as soon as the new style is
available you should try to use it we
have new services for ABC first of all
if you need to manage plugs these are
connections established between devices
on the firewire bus that represent an
ongoing data flow I saw currently
between two devices we have api's now to
make that easier you can call these
api's to establish input or output plugs
and we will take care of them so that
they remain set up every bus reset
requires every bus reset invalidates all
the plugs that are out there and have to
be reestablished so if you've used these
api's will do that for you you don't
have to keep tracking them so that
should make it easier we've also added a
lot of stuff to help you become an ABC
target up till now the Mac has been
really good at telling other devices
what to do camcorders should play tuners
should go to channel 37 and so on but
ABC some of those devices want to
control the Mac or they may if you write
software that makes the max do something
interesting when they talk to you so we
have api's to help you do that publish
ABC unit directory causes the Mac to
publish in its own config ROM a unit
directory telling everyone that it
speaks ABC and you can send commands to
it and subunit adds an ABC subunit to
the Mac so that when someone asks us
what sub units we have will respond
accordingly that we have a tape sub unit
or a tuner subunit or whatever it is
that you've added now you'd actually
call those in the reverse order first
add your sub units then publish
otherwise you may start getting requests
before you're ready the publish API will
cause the bus reset that's how AVC lets
everybody know that something new is
available or might be saleable
if you want to handle commands that come
in say to the subunit that you've added
you can use these api's you can install
a command handler you can specify which
subunit and which opcodes you're going
to handle and this wild card so you
don't have to enumerate everything and
very important most things that you get
require some kind of response so you can
now call send ABC response to send that
response back to the device to tell it
what happened with that commands it get
sent to you we handle all of these
commands automatically but there is a
mechanism for you to handle them too if
you know what you're doing for example
unit info and subunit info there at the
bottom we handle those based on the
subunits you've added we automatically
respond and say yes we've got one of
those here's a list of the existing ABC
api's before we went and made all these
changes all but one are still available
we have deprecated the one at the bottom
set ABC request callback that was the
old way to handle incoming commands and
it really wasn't right so if you were
using that you really want to use new
functions instead SBP three this is a
new revision of the SBP to standard
that's the standard use for hard drives
ipods swords devices on firewire we've
added support for something called fast
start if you've watched in firebug and
SBP to device you may have noticed it
takes up to five packets just to get the
device to start doing i oh you sent it
the orb pointer it asks for the orb you
send at the orbit asks for the page
table you send at the page table finally
it can move some data that's ok if
you're moving megabytes of data but for
small iOS it's really expensive fast
start defines a way to send all that
information in a single packet the drive
can immediately start moving payload we
have measured a 30-percent performance
speed up for optimal iOS using this
technique so it's definitely worth
having this technique is in ballot now
within an Z which is the standards group
that owns it ESP fast start has been
stabilized which means nobody's going to
change it in fact we've been supporting
it since 10 20 for now your device has
to understand this new packet you can't
just turn it on and it goes
stir but if your device does understand
this new packet publish the appropriate
key in your configuration ROM so that we
know you understand it and we'll send
you fast start packets if you're doing
hardware that does this we'd like to
hear from you because we've only seen
one so far so please let us know we'll
try it out and see if it works now
that's covered new and more detailed
information about what's in fire our
software mac OS 10 for you to develop
with let's talk about some of the
resources we provide to help you do this
software development kits we've made 16
of these so far it's our biggest product
for you developers it has lots of sample
code I showed you the list earlier the
SDKs often have pre-release versions of
the firewire text so that you can try
out new api's or new bug fixes before
your customers are exposed to them the
SDKs also have tools utilities and lots
of documentation to help you program on
firewire these have always been
available for free public download at
the URL shown on the slide we have
something new in the past year the
firewire reference platform this is
completely independent from our Mac os10
firewire this is a software stack that
can run on embedded devices so if you
are making a set-top box or a TV or
firewire multifunction printer take a
look at our reference platform you'll
find a lot of code especially for the
ABC protocol and command sets they can
give you a big head start for
implementing firewire on embedded
systems there's also a session on this
later this week we hold several
developer events for firewire we have
plugfest at macworld and here at dub dub
DC in fact we had 40 devices submitted
that are now being tested by the 1394
ta4 plugfest testing and we will bring
them all Thursday during the campus bash
down at Apple plus you're welcome to
bring additional devices then we'll plug
them all in we hold developer kitchens
this is where we bring our core
engineers and meet with your engineers
for two to three days of hands on
debugging development often we introduce
new SDK the new API is that these
sessions these have been held in tokyo
in cupertino we've done about 10 of
these so far we hold these on demand so
when you're ready for one of these
contact apple developer relations let us
know and we'll try to schedule one and
we participate in
1394 ta interrupt workshops these are
like slugfests only they're much more
rigorous there's three kinds of testing
done at these events pairwise testing of
each device against each other device
the official test suites which go
through the spec line by line electrical
test and configure on testing all kinds
of things and the grand melee where we
plug all the devices together and try to
get a 63 node bus to work that's always
a lot of fun these happened four times
every year there's one in Tokyo usually
in april one in taipei usually in
october and two on the west coast either
in the Bay Area or up in redmond for
some reason these are not limited to TA
members anyone can come to these there
is a slight fee reduction if you belong
to the TA but it's not expensive either
way we learn a ton of stuff about our
own products and other products we've
never seen before you should come to
these events they're really valuable
1394 ta is an industry trade group that
promotes 1394 that's where all the AVC
specs come from they also do a lot of
marketing and evangelism work so you may
want to consider joining the TA if you
make 1394 products ok now let's look at
some new firewire tools I mentioned this
earlier this is related to tools who get
to it in a second what exactly is a phy
there was a box marked by in that
architecture stack right at the
beginning by a short for physical layer
it's the chip that actually drives
differential voltages on the firewire
cable and makes ones and zeros and it
receives them at the other end and turn
them back into bits the Phi acts as a
repeater if it has two or more ports and
the five perform of the arbitration so
there's no software control for the Phi
it's all automated it makes the
arbitration go very fast in comparison
the link layer which in the mac is ohci
is much higher level it knows about DMA
crcs isochronous time is higher level
than fine the Phi does not have a device
driver it doesn't it's not programmable
but it does have a small register file
this is a page from the 1394 a standard
that shows the registers in the thigh
each one is 8 bits wide but there's some
very interesting and
mission in there like the status of each
of the ports on the five often when you
find some unique and interesting thing
happening on your firewire bus you may
want to look at the five ports to find
out why it's doing that unique and
interesting thing 1394a defines these
bits 1394 be defines a few more we now
have a tool that lets you examine these
directly this was possible in Mac OS 9
into jumped into max bug but it was
really tedious think you'll find us a
little bit easier by tool is a real-time
browser and editor for phi registers it
displays the phi registers just like the
specification except each one of those
boxes now a checkbox or pop up menu and
it has an explanation of what its
current value is and what that means hi
tool has integrated documentation if you
move the mouse over one of the bits like
enable fanned by the text from the
specification itself will appear at the
bottom of the screen telling you exactly
how that bit is supposed to work by tool
can examine the Phi in your Macintosh or
it can reach out across the firewire bus
and examine the Phi and other devices if
they support 1394a or 1394 be it also
provides a continually updated summary
of defy it's looking at and the status
of all of its ports so you can see
devices that are plugged and unplugged
in real time Phi tool doesn't require
any special Hardware Phi 2 runs on every
Mac that we sell it runs on the 1394
ohci controller here's a full screen
shot you can see the center portion
looks just like the spec down at the
bottom there is the text explaining what
the speed field means where the cursor
is located on line 3 over on the left
you have a summary of what all the ports
are doing port number 1 is connected the
other two are disconnected and there's
pop-up menus to pick which interface if
you have multiple interfaces and which
node if you want to look across the bus
at another note so it's really easy to
use believe me if you've never tried
cocoa programming you won't believe how
easy it is to get this kind of stuff
working this with a lot of fun and I
think you really enjoy this tool even if
you don't have problems in your file
this tool is very educational just
looking at the bits seeing them change
finding out what's happening on a
running firewire bus
we have another new tool for you this is
called firestarter this tool was written
for plugfest all of the commercial
firewire analyzers out there can show
the topology of the firewire buff but
none of them does it very quickly at it
like I mentioned the grand melee where
we get 363 nodes on the bus which we've
really done some of the commercial
analyzers take 30 seconds or more to try
to figure out how to draw a picture of
that by that time one of them is cause
the bus reset and everything's changed
system flow firestarter can update it
can draw a slightly simpler version but
topologically accurate map of the bus
and it can update it 10 times per second
so it gives you a very real time idea of
exactly what's actually on your buff in
the picture there you can see on the
right a simple ASCII rendering of the
bus and on the left various information
that's especially applicable to plugfest
like how many nodes what's the maximum
hop count how long has it been since the
last boss reset and what's the longest
time we ever survives between bus reset
there's also a bunch of data in the
lower left it sorts all the nodes and
shows you how many rs.400 f200 how many
or 1394 be so you can get a very rapid
snapshot of what's connected to your bus
here's our full screen display this is a
bus with just six nodes on it and you
can see in the upper right the hierarchy
showing who's connected to who here's a
pictures one in the plug fest where we
got sixty three nodes on the buff I
didn't actually have a big enough screen
you have to stretch the window down a
little bit to see the last seven nodes
but it's showing the topology of how
everyone's connected to everybody else
and I'd like to point out that the bus
was stable for I believe more than a
minute under that configuration and then
we plugged in the 64th node and things
went downhill from there we have one
more new tool fw busy buff this is a
traffic generator fw busy bus can send
any kind of asynchronous packet on the
firewire buff it can also send bus reset
and it can cause bus reset storm it will
even enable and disable its own ports to
simulate hot plugging it's automated it
can automatically ramp up and down
the level of activity so you can leave
it running over a period of time and
test different levels of activity on
your bus you can also turn on and off
every different kind of packet packet
speed bus reset everything that it does
all three of these tools work on ohci so
you don't need any special hardware
here's a full-screen picture of busy
buff the sliders at the top let you
adjust the intensity level and how
quickly it ramps up and down the check
boxes in the middle that you turn on and
off every different kind of packet and
packet speeds and the control at the
bottom gives you a brief summary of
what's on the bus and what the tools
doing at any particular moment plus on
the Left we have defy status that is
copied from title now fw busy bus can
send any kind of packet if you configure
it properly it can write garbage data
onto physical memory in your mac so be
careful what you turn on and what you
don't in this tool the default settings
are safe now if there are interesting
things happening on your firewire bus if
somebody's writing garbage data into
your memory you might want to examine
the firewire bus and see what's going on
we have a tool for that called Firebug
and I'm pleased to announce today that
Firebug is now available for mac OS 10
really there it is Firebug is a
real-time packets nupur it can decode
every packet on the bus and show them to
you in a sort of semi English ASCII way
firebug provides precision timestamps to
within one cycle time usually much
better than that Firebug can decode
common protocols like FTP to an AVC so
you don't have to pull out the spec and
look up hex codes it'll tell you if
that's a block read he told the
camcorder to play Firebug also provides
some simple bus configuration services
if you'd like to tune the gap count or
cause a bus reset or go poke at the phy
you can do that from within Firebug
Firebug still requires the ti PCI links
interface we made it run on mac OS 10
but osei just doesn't have the snooping
hardware these interfaces are still
available you can get them on card
postcard or PCI card and if you have a
really old Mac like the blue and white t
3 it actually has one of those
Tim but we not only brought it to Mac
os10 we've made a few improvements we've
improved the decoding we added a bunch
new a bunch of new ABC commands
especially the unit info command so you
can see when that's happening the SBP to
decode can now survive a bus reset
almost every time whereas usually almost
never survived it would just go back to
showing hex because it didn't know what
was going on there's a tool called the
five register dunk this if you don't
have pi tool handy you can just ask
Firebug to do the same thing and you can
see in the picture there it has dumped
out the contents of the thigh in a
concise ASCII format we've added node ID
filters you can now look at packets only
going to or from or between whatever
nodes you choose you can select which
isochronous channel you'd like to look
at you can get my soccer in a summary
usually you don't look at our talkers
package because those eight thousand per
second they're just wiped out to display
but Firebug will now tell you even if
it's not showing their soccer his packet
ah channel 63 has gone active in fact
it's active at s100 it's coming from
node to its ntsc video so now you'll
know something's happening even though
you didn't get the display blown away by
thousands and thousands of isochronous
packets and because it runs on mac OS 10
we've been able to make Firebug support
dual processors so now it's even faster
than it ever was before so let's demo
Firebug on Mac OS 10 may I have number
three please there we go it's right here
launch is just like that and there it is
now this system running Firebug it's a
g4 tower so I installed a PCI links pci
card into it it's connected to this
other g4 tower and you can see the
package there as the other g4 tower
scans the bus so I'm going to plug in my
ipod and we'll feed all the activities
that this generates and we'll see that
Firebug can decode the SBP to protocol
that the ipod is using take the ipod a
few seconds to switch from mp3 mode over
into disk mode but it should be ready to
go right about now
there we go Mac os10 is mounting it as a
file system so it's reading different
blocks it's figuring out that it's hfs+
you can't see it but to do through the
icon on the desktop of Rama Sodor Mac
you can see here some of the new
features in the decode of normal command
orb there at the bottom it says read one
block at lb a 900 III C so you no longer
have to figure that out for yourself
from those 12 like to text under command
additionally I can cause a bus reset and
Firebug and then go ask this max to do
something with the ipod and you'll see
that it's still decoding the command
even after the bus reset which almost
never worked before I mentioned Firebug
takes advantage of dual processors it
also no longer completely monopolizes
the machine like you did on Mac OS 9 so
if you want you can leave your other
apps open now it's not doing anything
but let me ask it to show cycle start
back and you'll see that it gets quite
busy this is a pretty fast g4 tower I
have on a slower units maxed out both
processors or one hundred percent
running Firebug but you can see it is
using them both so if you are longtime
Firebug users you're tired of booting
back in the mac OS 9 to run Firebug if
you'd like some of these new features I
think you'll be pretty happy with this
let's go back to the slide
ok so i renounced all these new tools by
tool fire starter fw busy bus those all
run on ohci so you can use them on any
mac that we have today plus Firebug
which still requires PCI links all of
these tools require Mac OS 10 10 point
two point five or later very important
if you're familiar with Firebug you know
how it works it touches the hardware
directly all of these tools do that
that's good and bad we displace all fire
wire services when you run the tool we
do it in a clean way if you have an ipod
or a disc mounted the tool will refuse
to run it won't just displace the driver
and leave you with a corrupt ipod you
will have to unplug any discs or iPods
that you have in order to run these
tools but because we displace the
software you no longer have mac OS 10 on
the bus trying to manage the bus so if
you're trying to run five tool to figure
out why some camcorder keeps resetting
the bus you don't have to wonder if mac
OS 10 is also on there trying to manage
the bus if not we've displaced it the
tool is the only thing touching the bus
these are all new we've tested them as
best we can but please be careful they
do touch hardware directly so they can
crash the machine make backups or run
this on a dedicated machine at least
until you're sure that it's really going
to be stable in your environment and
watch our mailing list for updates
regarding these tools because again
they're new so you're probably wondering
where can I get all these great tools
these sounds like I want to try them out
today well you can firewire SDK 17 is
available live today on the web the only
catch is that because they redesigned
the whole ADC website yesterday the link
is missing I know you can all figure
this out go find SDK 16 copy the link
change the 62 or seven and you'll get to
disk image for SDK 17
[Applause]
okay let's wrap up here are the firewire
sessions at double WC this week not
including 505 which you're in right now
tomorrow morning 50 for developing with
firewire 800 that's the higher level
session but we have a ton of new content
this year about how firewire 800 works
we have a feedback form for both
firewire and USB like we do every year
you can get all your serial bus feedback
in one convenient location we have a new
session this year on Thursday 508 the
firewire reference platform will go into
much greater detail about what's in
there and how you can use it to make
products finally thursday evening during
the apple campus bash we have our
firewire USB and bluetooth plug and
unplug fest and i'm sure that will be
very interesting if you'd like to
contact apple if you want to come to a
firewire kitchen if you need help
developing you want license a reference
platform here's contact information
prashant con harry he'll be up here in a
moment is the program manager for
firewire technologies you can also
contact your mo Ortiz and apple
developer relations we have a public
developer mailing list anybody can join
us a lot of people on there this is a
place where developers can ask questions
developers can answer questions we
answer questions too we announce new
tools we announce things about Firebug
just follow this link and you can
subscribe at the same place you can
subscribe to the reference platform
mailing list which the same thing but
it's focused on the reference platform
if you'd like more information about
developing firewire in Mac OS 10 our
standard document is a book called
working with firewire device interfaces
I said earlier that's the formal name
for a user client it's available online
has a lot of information about how to
use the user client to talk to firewire
devices our software development kits
are all available on the web ftk 17 as I
just described we also have a tech note
coming i don't think it's live yet that
goes into more depths about how to use
dcl it should be posted soon and we'll
announce it on the mailing list when it
is the I Triple E 1394 standard itself
is available from the I Triple E on the
way
the 1394 ta also on the web has
standards for a vc command sip the I IDC
digital camera automotive 1394 various
other interesting things and if you're
working with ABC you may also need some
standards from the ISO such as the
format for DV video it's also available
on the web