![](/images/new-backgrounds/1174551/174551165x1.webp)
Chapter 4 Command Operation |
|
Example ‘C’ Routines for Command List | Page 4 - 25 |
{/* First: check to see if the list is full */
if ( (clist→pbin +1) % NPB == clist→pbout)
{
/* If the list is full, then handle_full_list */
/* This may be a function call that waits for an open entry or you could choose to return an error. */
if (!handle_full_list(pb,clist)) return;}
/* Second: put the Parameter Block into the next available location in the list
*/
clist→pblist[clist→pbin] = pb;
/* Third: increment the Parameter Block IN index */ clist→pbin = (clist→pbin + 1) % NPB;
/* Next issue a Command List Channel Attention */ /* This is a separate function called to issue a Command List Channel Attention. */ issue_cl_channel_atn();
} /* put_parameter_block */
/
*________________________________________________________________
* get_status_block - Read a Status Block returned in the Command List
*_______________________________________________________________*
/
status_block get_status_block(clist) command_list *clist;
(
status_block tsb;
/* First: check to see if a Status Block is available */ if (clist→sbout == clist→sbin)
{
/* If the list is empty there are no blocks to read. Check the adapter
*Status Port for any error conditions, and return. */
/*This routine could check the Status Port for 11H error code (no active command list.) */ handle_empty_sb_list(clist);
return(EMPTY);
}
/* Second: read the Status Block into a temporary value so that it can be returned at the end of the function.
*/
tsb = clist→sblist[clist→sbout];
/* Third: increment the Status Block OUT index. */ clist→sbout = (clist→sbout + 1) % NSB;
/* Next: return with the Status Block. */ return (tsb);
} /* get_status_block
User’s Guide | 21020285 D |