Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pccard_arm.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pccard_arm.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pccard_arm.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pccard_arm.html on line 8

pccard_arm()

Arm the devp-pccard server

Synopsis:

#include <sys/pccard.h>

int pccard_arm( pccard_t handle, 
                int devtype, 
                unsigned event, 
                int coid );

Arguments:

handle
The handle returned by pccard_attach().
devtype
The type of device that your application wants to be informed about. Valid devices are:
event
The type of event that you want to be notified of:
coid
A connection ID, obtained from ConnectAttach(), that's used to send the pulse.

Library:

libpccard

Use the -l pccard option to qcc to link against this library.

Description:

The pccard_arm() function call is used to request that the devp-pccard server notify the user application, via a pulse, when the specified event occurs.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

EBADF
Invalid handle parameter.

Examples:

/*
 * Ask to be informed when a Network card is inserted
 */

#include    <stdio.h>
#include    <stdlib.h>
#include    <fcntl.h>
#include    <sys/neutrino.h>
#include    <sys/pccard.h>

int     main (void)

{
pccard_t    handle;
int         chid, coid;
char        buf [10];
struct _pccard_info io;

   if ((handle = pccard_attach (0)) == -1) {
       printf ("Unable to attach to PCCARD\n");
       exit (EXIT_FAILURE);
       }

   if ((chid = ChannelCreate (_NTO_CHF_FIXED_PRIORITY)) == -1) {
       printf ("Unable to create channel\n");
       exit (EXIT_FAILURE);
       }

   if ((coid = ConnectAttach (0, 0, chid, _NTO_SIDE_CHANNEL, 
            0)) == -1) {
       printf ("Unable to ConnectAttach\n");
       exit (EXIT_FAILURE);
       }

   if (pccard_arm (handle, _PCCARD_DEV_NETWORK, 
           _PCCARD_ARM_INSERT_REMOVE, coid) == -1) {
       perror ("Arm failed");
       exit (EXIT_FAILURE);
       }

   /* To be informed about any card insertion/removal event, 
    * change _PCCARD_DEV_NETWORK to _PCCARD_DEV_ALL.
    */

   /*
    * MsgReceive (chid, ....);
    * Other user logic...
    */

   /* Get information from socket 0 - function 0 */
   if (pccard_info (handle, 0, &io, sizeof (io)) == -1) {
       perror ("Info failed");
       exit (EXIT_FAILURE);
       }
   if (io.flags & _PCCARD_FLAG_CARD) {
       printf ("Card inserted in socket 1 - Type %x\n", 
                io.window [0].device & 0xff00);
   /* Now lock the card in socket 1 with exclusive access */
       if (pccard_lock (handle, 0, 0, O_RDWR | O_EXCL) == -1) {
           perror ("Lock failed");
           exit (EXIT_FAILURE);
           }
   /* Read 2 bytes of the CIS from offset 0 in attribute memory */
       if (pccard_raw_read (handle, 0, _PCCARD_MEMTYPE_ATTRIBUTE, 
                                0, 2, buf) == -1) {
           perror ("Raw read");
           exit (EXIT_FAILURE);
           }
       /* More user logic... */
       }
   pccard_unlock (handle, 0, 0);
   pccard_detach (handle);

   return (EXIT_SUCCESS);
}

Classification:

QNX Neutrino

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pccard_attach(), pccard_detach(), pccard_info(), pccard_lock(), pccard_raw_read(), pccard_unlock()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/p/pccard_arm.html on line 298

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/p/pccard_arm.html on line 298