ARPDAS_QNX6 1.0
interrupt.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <errno.h>
00003 #include "serusb.h"
00004 #include "nortlib.h"
00005 
00006 
00007 int int_attach(int rcvid, subbusd_req_t *req, char *sreq) {
00008   card_def *cd;
00009   subbusd_req_data2 *ireq = &req->data.d2;
00010   int rv;
00011   
00012   if ( ireq->region != 0x40 ) {
00013     nl_error( 2, "Requested interrupt region incompatible with hardware." );
00014     return EADDRNOTAVAIL;
00015   }
00016   rv = expint_attach( rcvid, ireq->cardID, ireq->address, ireq->region,
00017           &ireq->event, &cd );
00018   if ( rv != 0 ) return rv;
00019   snprintf( sreq, SB_SERUSB_MAX_REQUEST, "i%d:%04X\n", cd->bitno, ireq->address );
00020   return EOK;
00021 }
00022 
00023 int int_detach(int rcvid, subbusd_req_t *req, char *sreq) {
00024   subbusd_req_data2 *ireq = &req->data.d2;
00025   unsigned short addr;
00026   unsigned int bn;
00027 
00028   int rv = expint_detach( rcvid, ireq->cardID, &addr, &bn );
00029   if (rv != 0) return rv;
00030   snprintf(sreq, SB_SERUSB_MAX_REQUEST, "u%X\n", addr);
00031   return EOK;
00032 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines