The PCM middle layer of ALSA is quite powerful and it is only necessary for each driver to implement the low-level functions to access its hardware.
For accessing to the PCM layer, you need to include <sound/pcm.h> above all. In addition, <sound/pcm_params.h> might be needed if you access to some functions related with hw_param.
Each card device can have up to four pcm instances. A pcm instance corresponds to a pcm device file. The limitation of number of instances comes only from the available bit size of the linux's device number. Once when 64bit device number is used, we'll have more available pcm instances.
A pcm instance consists of pcm playback and capture streams,
and each pcm stream consists of one or more pcm substreams. Some
soundcard supports the multiple-playback function. For example,
emu10k1 has a PCM playback of 32 stereo substreams. In this case, at
each open, a free substream is (usually) automatically chosen
and opened. Meanwhile, when only one substream exists and it was
already opened, the succeeding open will result in the blocking
or the error with EAGAIN according to the
file open mode. But you don't have to know the detail in your
driver. The PCM middle layer will take all such jobs.