"DM642 Learning note Five" Fvid Driver Model API function

Source: Internet
Author: User
1, Fvid_control

Function: Send a control command to Mini_driver

Syntax: status = Fvid_control (Fvidchan, cmd, args);

Parameters:

Fvid_handlefvidchan

Intcmd

Ptrargs

Return Value Int Status

Parameter description:

Fvidchan is a handle to the channel created by Fvid_create ().

CMD has two values: iom_abort----function is to abort so the undetermined I/O work

Iom_flush----function is so that the work of the acquisition port is discarded, so the display I/O is working normally.

return value:

If the call succeeds, Fvid_control returns iom_completed. If an error occurs, the call returns a negative value.

Example:

Fvid_control (Fvidchan,iom_abort, NULL);

2, Fvid_create ()

Function: Allocates and initializes the Fvid channel object;

Syntax: Fvidchan = fvid_create (name, mode, *status, Optargs, *attrs);

Stringname

Intmode

Int*status

Ptroptargs

Fvid_attrs*attrs

Where: Name is the handle to the device instance and is a string

Mode is the selected pattern with only two values: Iom_input sets the acquisition mode, Iom_output sets the display mode.

Status is the status of the argument Isan out parameter, the This function fills with a pointer to Thestatus, is returned by th E mini-driver.

Attrs is a pointer to the FVID_ATTRS structure:

Fvid_attrs is defined as follows: Typedefstruct Fvid_attrs

Uns timeout;

} fvid_attrs;

The timeout member is used to specify semaphore synchronization, and its value can be:

1. >sys_forever: Will let Fvid_alloc, Fvid_free andfvid_exchange call indeterminate wait until this call is complete.

2. The timeout value of the > number causes these APIs to block for a specified amount of time (in the system clock).

3. The >0 value will keep APIs from blocking and they will return immediately, in which case the application will check the returned status value to ensure that the call has been successfully completed.

Note: Fvid_alloc, Fvid_free Andfvid_exchange is called only in Dsp/bios task (TSK).

· return value of Fvid_create:

If the channel is successfully opened, then Fvid_create returns a handle to the channel. This handle can be used to allow subsequent modules to invoke this channel.

Example

Fvid_attrs Dispattrs =fvid_attrs;

chan-

Handle =fvid_create ("\display0", iom_input, NULL, NULL,

&DISPATTRS);

3, the definition of FVID.h

#defineFVID_BASE Iom_user

#defineFVID_ALLOC (fvid_base + 0)
#defineFVID_FREE (fvid_base + 1)
#define Fvid_exchange (Fvid_base + 2)

typedef gio_handlefvid_handle;

typedef struct fvid_iframe{
Char*y1;
CHAR*CB1;
CHAR*CR1;
Char*y2;
CHAR*CB2;
CHAR*CR2;
}fvid_iframe;


typedef struct FVID_PFRAME {
Char*y;
CHAR*CB;
CHAR*CR;
} fvid_pframe;



typedef struct fvid_rawiframe{
CHAR*BUF1;
CHAR*BUF2;
} fvid_rawiframe;

typedef structfvid_rawpframe{
Char*buf;
} fvid_rawpframe;


typedef struct FVID_FRAME {
Que_elem queelement;
union{
Fvid_iframe IFrm;
Fvid_pframe pfrm;
Fvid_rawiframe rifrm;
Fvid_rawpframe rpfrm;
}frame;
} fvid_frame;


#define FVID_ALLOC (Giochan, BUFP) \
Gio_submit (Giochan, Fvid_alloc, BUFP, NULL, NULL)



#define Fvid_control (Giochan, cmd, args) \
Gio_control (Giochan, cmd, args)



#define FVID_CREATE (name, mode, status, Optargs,attrs) \
Gio_create (name, mode, status, Optargs, Attrs)



#define FVID_DELETE (Giochan) \
Gio_delete (Giochan)



#define Fvid_exchange (Giochan, BUFP) \
Gio_submit (Giochan, Fvid_exchange, BUFP, NULL, NULL)


#define Fvid_free (Giochan, BUFP) \
Gio_submit (Giochan, fvid_free, BUFP, NULL, NULL)


#ifdef __cplusplus
}
#endif

#endif

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.