Input Output Request Blocks (IORBs)

As mentioned above, IORBs are managed by user tasks. The user program prepares the IORB data structure and passes it to the read and write calls.

Example 8-2. IORB base class


typedef struct Cyg_IORB_t
{
    friend class Cyg_Device;

    private:
    Cyg_Device        * pdevice;

    // Accessor functions
    void set_pdevice(Cyg_Device * device) { pdevice = device; }

    public:

    // Accessor functions
    Cyg_Device *
    get_pdevice(void) { return(pdevice); }

    struct Cyg_IORB_t * volatile next;		

    void              * buffer;         // ptr to buffer
    cyg_uint32		buffer_length;  // length of buffer
    volatile cyg_uint32 xferred_length; // length of buffer xferd

    cyg_uint8       	opcode;         // operation code + options
    volatile cyg_uint8 	status;         // state, result + error code

    CYG_ADDRWORD        callback_data;	// data field for callback routine
    void            	(*callback)( struct Cyg_IORB_t * piorb);
} Cyg_IORB;

Example 8-3. IORB operation flag codes and result status codes

// opcodes
#define CYG_IORB_NOBLOCK  0x01		// opcode for special serial reads

// Resultstatus codes
#define CYG_IORB_OK	  0x00
#define CYG_IORB_CANCELED 0x02
	

Example 8-4. Definition of the Cyg_Device class

class Cyg_Device
{
    protected:

    // Accessor functions
    void
    set_iorb_pdevice( Cyg_IORB * iorb ) { iorb->set_pdevice( this ); }

    public:
};