コード例 #1
0
void omap3_dinit(void *hdl)
{
	omap3_spi_t	*dev = hdl;
    
	/*
	 * unmap the register, detach the interrupt
	 */
	InterruptDetach(dev->iid_spi);
	munmap_device_io(dev->vbase, OMAP3_SPI_REGLEN);
	
	/*
	 * Disable EDMA
	 */
	if (dev->edma) {
		omap3_edma_disablespi(dev);
		InterruptDetach(dev->iid_edma);
		omap3_edma_detach (dev);
		munmap_device_memory((void *)dev->edmavbase, DM6446_EDMA_SIZE); 
		munmap(dev->dmabuf, OMAP3_SPI_MAXDMALEN);
		ConnectDetach(dev->edma_coid);
	}
	ConnectDetach(dev->coid);
	ChannelDestroy(dev->chid);
	
	free(hdl);
}
コード例 #2
0
ファイル: msgSendReceivePulse.cpp プロジェクト: yoruk/se2p
static void* client(void* arg) {
	int nodeId = 0; // 0 = local
	pid_t pid = 0; // 0 = same process
	int connectionId = 0;
	int number = 0;
	int res = 0;

	connectionId = ConnectAttach(nodeId, pid, channelId, 0, 0);
	if(connectionId == -1) {
		printf("msgSendReceivePulse: client: error attaching to channel!\n");fflush(stdout);
		exit(EXIT_FAILURE);
	}

	while(run) {
		sleep(WAIT_SHORT);

		number++;
		printf("Client: sending pulse message #%d\n", number);fflush(stdout);

		res = MsgSendPulse(connectionId, SIGEV_PULSE_PRIO_INHERIT, 1, 0);
		if(res == -1) {
			printf("msgSendReceivePulse: client: error sending pulse!\n");fflush(stdout);
			exit(EXIT_FAILURE);
		}
	}

	ConnectDetach(connectionId);
	if(res == -1) {
		printf("msgSendReceiveReply: client: error detaching from channel!\n");fflush(stdout);
		exit(EXIT_FAILURE);
	}

	pthread_exit(NULL);
}
コード例 #3
0
ファイル: fuser.c プロジェクト: vocho/openqnx
/*
 *  Given a process id, iterate through all open files of that process
 *  looking for a match to the target file, and then determine how it
 *  is being used by that process.  This is quite different in QNX to
 *  UNIX, as chroot and chdir do not hold open a reference to the file.
 *  The iteration process attempts to dup each file descriptor into
 *  this process, so it can then be queried; attempt to skip things which
 *  aren't files (heuristic guess) and use a timeout as self-defence.
 */
int howused(pid_t pid, match_t *match)
{
struct _server_info	sinfo;
struct _fdinfo		finfo;
struct stat			st;
io_dup_t			msg;
uint64_t			to;
int					fd, coid, usage;

	usage = 0;
	for (fd = 0; (fd = ConnectServerInfo(pid, fd, &sinfo)) != -1; ++fd) {
		if ((pid != sinfo.pid || !(fd & _NTO_SIDE_CHANNEL)) && (coid = ConnectAttach(sinfo.nd, sinfo.pid, sinfo.chid, 0, _NTO_COF_CLOEXEC)) != -1) {
			msg.i.type = _IO_DUP;
			msg.i.combine_len = sizeof(msg.i);
			msg.i.info.nd = netmgr_remote_nd(sinfo.nd, ND_LOCAL_NODE);
			msg.i.info.pid = pid;
			msg.i.info.chid = sinfo.chid;
			msg.i.info.scoid = sinfo.scoid;
			msg.i.info.coid = fd;
			TimerTimeout(CLOCK_MONOTONIC, _NTO_TIMEOUT_SEND | _NTO_TIMEOUT_REPLY, NULL, (to = 1000000000LL, &to), NULL);
			if (MsgSend(coid, &msg.i, sizeof(msg.i), NULL, 0) == -1) {
				ConnectDetach(coid);
			}
			else {
				if (fstat(coid, &st) != -1 && ismatch(match, st.st_dev, st.st_ino)) {
					if (iofdinfo(coid, 0, &finfo, NULL, 0) == -1 || sinfo.pid != PATHMGR_PID || finfo.mode != 0)
						usage |= USED_OPEN;
				}
				close(coid);
			}
		}
	}
	return(usage);
}
コード例 #4
0
inline void
isr_cleanup(omapl1xx_context_t *omapl1xx)
{
	ConnectDetach(omapl1xx->lcd_coid);
	ChannelDestroy(omapl1xx->lcd_chid);
	InterruptDetach(omapl1xx->lcd_iid);
}
コード例 #5
0
ファイル: ov8variety.c プロジェクト: slizer6/Sanntidssystemer
//Communication with the server
//Using buffers: buffer, receive
void* message_client(void* arg){

	//Define thread priority
	if(((struct thread_args*)arg)->which_thread == 0){
		set_priority(22);
		printf("I HAVE PRIORITY 22\n");
	}
	else if(((struct thread_args*)arg)->which_thread == 1){
		set_priority(21);
		printf("I HAVE PRIORITY 21\n");
	}
	else if(((struct thread_args*)arg)->which_thread == 2){
		set_priority(19);
		printf("I HAVE PRIORITY 19\n");
	}
	else{
		set_priority(18);
		printf("I HAVE PRIORITY 18\n");
	}

	//Perform communication
	int channelID, status;

	channelID = ConnectAttach(0, ((struct thread_args*)arg)->pid, 1, 0, 0);

	//Sends data in buffer. Puts returned data in receive buffer
	status = MsgSend(channelID, &buffer, sizeof buffer, &receive, sizeof receive);

	printf("SERVER REPLY: %c\n", receive[0]);

	//Detach from server
	ConnectDetach(channelID);

	return 0;
}
コード例 #6
0
ファイル: intr.c プロジェクト: trick77/QNX-BBB
int omap3_attach_intr(omap3_spi_t *omap3)
{
    if ((omap3->chid = ChannelCreate(_NTO_CHF_DISCONNECT | _NTO_CHF_UNBLOCK)) == -1)
        return -1;

    if ((omap3->coid = ConnectAttach(0, 0, omap3->chid, _NTO_SIDE_CHANNEL, 0)) == -1)
        goto fail0;

    omap3->spievent.sigev_notify   = SIGEV_PULSE;
    omap3->spievent.sigev_coid	 = omap3->coid;
    omap3->spievent.sigev_code	 = OMAP3_SPI_EVENT;
    omap3->spievent.sigev_priority = omap3->prio;

    /*
     * Attach SPI interrupt
     */
    omap3->iid_spi = InterruptAttach(omap3->irq_spi, spi_intr, omap3, 0, _NTO_INTR_FLAGS_TRK_MSK);

    if (omap3->iid_spi != -1)
        return 0;

    ConnectDetach(omap3->coid);
fail0:
    ChannelDestroy(omap3->chid);

    return -1;
}
コード例 #7
0
ファイル: nftw.c プロジェクト: vocho/openqnx
static char *tidypath(const char *path, int bufferlen)
{
char					*buffer;
struct _connect_ctrl	ctrl;
struct _io_connect		msg;		
int						fd, error;

	if ((buffer = malloc(bufferlen)) != NULL) {
		memset(&ctrl, 0x00, sizeof(struct _connect_ctrl));
		ctrl.base = _NTO_SIDE_CHANNEL;
		ctrl.path = buffer, ctrl.pathsize = bufferlen;
		ctrl.send = MsgSendvnc;
		ctrl.msg = memset(&msg, 0x00, sizeof(struct _io_connect));
		msg.ioflag = O_LARGEFILE | O_NOCTTY, msg.mode = S_IFLNK;
		msg.subtype = _IO_CONNECT_COMBINE_CLOSE;
		if ((fd = _connect_ctrl(&ctrl, path, 0, NULL)) != -1) {
			ConnectDetach(fd);
			if (*buffer != '\0')
				return(buffer);
			errno = ENAMETOOLONG;
		}
		error = errno, free(buffer), errno = error;
	}
	else {
		errno = ENOMEM;
	}
	return(NULL);
}
コード例 #8
0
ファイル: B1S02_Seg1.cpp プロジェクト: p3t3rmu3ll3r/se2p
void B1S02_Seg1::timerSeg1Max() {
	PuckHandler::getInstance()->printQueueStatus();
	if(controller->isFirstElementInSegment()) {

		puckHandler->removePuckFromSeg1();
		puckHandler->removePuckFromBand(controller);
		if(puckHandler->isBandEmpty()){
			actorHAL->engineStop();
		}
		controller->resetController();

		printf("Debug State <B1S02_Seg1>: ERROR<ERR_STATE_ERROR_MAX> called by puck%d\n", controller->getID());

		int errorfsmChid = errfsm->getErrorFSMChid();
		int errorfsmCoid;
		int rc;

		if ((errorfsmCoid = ConnectAttach(0, 0, errorfsmChid, _NTO_SIDE_CHANNEL, 0)) == -1) {
			printf("B1S02_Seg1: Error in ConnectAttach\n");
		}

		//rc = MsgSendPulse(errorfsmCoid, SIGEV_PULSE_PRIO_INHERIT, PULSE_FROM_PUCK, ERR_STATE_CRITICAL_ERROR);
		rc = MsgSendPulse(errorfsmCoid, SIGEV_PULSE_PRIO_INHERIT, PULSE_FROM_PUCK, ERR_STATE_ERROR_MAX);
		if (rc < 0) {
			printf("B1S02_Seg1: Error in MsgSendPulse");
		}

		if (ConnectDetach(errorfsmCoid) == -1) {
			printf("B1S02_Seg1: Error in ConnectDetach\n");
		}
	}
}
コード例 #9
0
ファイル: B1S02_Seg1.cpp プロジェクト: p3t3rmu3ll3r/se2p
void B1S02_Seg1::sbHeightcontrolOpen() {
	if(controller->isFirstElementInSegment()) {
		if(this->controller->isSegTimerMinCalled()){
			controller->resetSegTimers();

			puckHandler->removePuckFromSeg1();
			new (this) B1S03_Height(controller);
		} else {

			printf("Debug State <B1S02_Seg1>: ERROR<ERR_STATE_ERROR_MIN> called by puck%d\n", controller->getID());

			int errorfsmChid = errfsm->getErrorFSMChid();
			int errorfsmCoid;
			int rc;

			if ((errorfsmCoid = ConnectAttach(0, 0, errorfsmChid, _NTO_SIDE_CHANNEL, 0)) == -1) {
				printf("B1S02_Seg1: Error in ConnectAttach\n");
			}

			rc = MsgSendPulse(errorfsmCoid, SIGEV_PULSE_PRIO_INHERIT, PULSE_FROM_PUCK, ERR_STATE_ERROR_MIN);
			if (rc < 0) {
				printf("B1S02_Seg1: Error in MsgSendPulse");
			}

			if (ConnectDetach(errorfsmCoid) == -1) {
				printf("B1S02_Seg1: Error in ConnectDetach\n");
			}
		}
	} else {
		new (this) B1S02_Seg1(controller);
	}
}
コード例 #10
0
clsThread::~clsThread()
{
	ConnectDetach(m_coidThread);
	ChannelDestroy(m_chThread);

	pthread_cond_destroy(&m_condThread);
	pthread_mutex_destroy(&m_mtxThread);
}
コード例 #11
0
ファイル: pathmgr_unlink.c プロジェクト: vocho/openqnx
int pathmgr_unlink(const char *path) { 
	int							fd;
	
	if((fd = _connect(PATHMGR_COID, path, S_IFLNK, O_NOCTTY, SH_DENYNO, _IO_CONNECT_UNLINK, 0, 0, _FTYPE_LINK, 0, 0, 0, 0, 0, 0)) == -1) {
		return -1;
	}
	ConnectDetach(fd);
	return 0;
}
コード例 #12
0
int YARPNativeEndpointManager::Close(YARPUniqueNameID& id)
{
#ifndef __QNX6__
	ACE_UNUSED_ARG(id);
	return YARP_FAIL;
#else
	return ConnectDetach (id.getRawIdentifier());
#endif
}
コード例 #13
0
ファイル: SerielleSchnittstelle.cpp プロジェクト: TeamSE2/SE2
void SerielleSchnittstelle::stop()
{
	HAWThread::stop();

	if(ConnectDetach(dispatcherConnectionID) == -1)
	{
		perror("SerielleSchnittstelle: dispatcherConnectionID ConnectDetach fehlgeschlagen");
	}
}
コード例 #14
0
ファイル: rmdir.c プロジェクト: vocho/openqnx
int rmdir(const char *path) {
	int							fd;

	if((fd = _connect(_NTO_SIDE_CHANNEL, path, S_IFDIR, O_NOCTTY, SH_DENYNO, _IO_CONNECT_UNLINK, 0, 0, 0, 0, 0, 0, 0, 0, 0)) == -1) {
		return -1;
	}
	ConnectDetach(fd);
	return 0;
}
コード例 #15
0
ファイル: pathmgr_symlink.c プロジェクト: vocho/openqnx
int pathmgr_symlink(const char *path, const char *symlinkp) { 
	int							fd;
	
	if((fd = _connect(PATHMGR_COID, symlinkp, S_IFLNK | S_IPERMS, O_CREAT | O_EXCL | O_NOCTTY, SH_DENYNO, _IO_CONNECT_LINK, 0, 0, _FTYPE_LINK,
			_IO_CONNECT_EXTRA_PROC_SYMLINK, strlen(path) + 1, path, 0, 0, 0)) == -1) {
		return -1;
	}
	ConnectDetach(fd);
	return 0;
}
コード例 #16
0
ファイル: Demultiplexer.cpp プロジェクト: mohamedsakhri/se2p
/**
 * free memory reserved by demultiplexer's instance
 */
Demultiplexer::~Demultiplexer() {
#ifdef DEBUG_
	cout << "Demultiplexer deleted" << endl;
#endif

	delete demultiplexer_instance_;
	// detach connection channel if it has been created
	if (con_id_) {
		ConnectDetach(con_id_);
		ChannelDestroy(channel_id_);
	}
}
コード例 #17
0
ファイル: ov8variety.c プロジェクト: slizer6/Sanntidssystemer
//Communication with the server
//Using buffers: buffer, receive
int message_client(pid_t pid){
	int channelID, status;
	channelID = ConnectAttach(0, pid, 1, 0, 0);

	//Sends data in buffer. Puts returned data in receive buffer
	status = MsgSend(channelID, &buffer, sizeof buffer, &receive, sizeof receive);

	//Detach from server
	ConnectDetach(channelID);

	//Unnecessary return
	return channelID;
}
コード例 #18
0
ファイル: fini.c プロジェクト: minadanesh/apsc496
void
omap_fini(void *hdl)
{
    omap_dev_t  *dev = hdl;

    out16(dev->regbase + OMAP_I2C_CON, 0);
    out16(dev->regbase + OMAP_I2C_IE, 0);
	InterruptDetach(dev->iid);
	ConnectDetach(dev->coid);
	ChannelDestroy(dev->chid);
	munmap_device_io (dev->regbase, dev->reglen);
	free (hdl);
}
コード例 #19
0
ファイル: Sensorik.cpp プロジェクト: yoruk/se2p
void Sensorik::stop() {
	HAWThread::stop(); // super.stop();

	if (-1 == ConnectDetach(isr_coid)) {
		perror("SensorCtrl: ConnectDetach isr_coid failed");
	}
	if (-1 == ChannelDestroy(isr_Chid)) {
		perror("SensorCtrl: ChannelDestroy isr_chid failed");
	}
	// in Simulation: bleibt hier haengen
	//    if (-1 == InterruptDetach(interruptId)) {
	//        perror("SensorCtrl: InterruptDetach failed");
	//    }
}
コード例 #20
0
ファイル: ov8variety.c プロジェクト: slizer6/Sanntidssystemer
//Communication with the server
//Using buffers: buffer, receive
void* message_client(pid_t pid){
	int channelID, status;
	printf("RECEIVED ARGUMENT FROM DUMB PROCESS: %d\n", pid);
	channelID = ConnectAttach(0, pid, 1, 0, 0);

	//Sends data in buffer. Puts returned data in receive buffer
	status = MsgSend(channelID, &buffer, sizeof buffer, &receive, sizeof receive);

	printf("SERVER REPLY: %c\n", receive[0]);

	//Detach from server
	ConnectDetach(channelID);

	return 0;
}
コード例 #21
0
ファイル: Oving8QNX2.c プロジェクト: msholsve/rtkos
void nagger(void *arg){
	set_priority(*(int*)arg);

	// Creating shared memory
	int skynetDesc = shm_open("/skynetcore", O_RDWR, S_IRWXU);
	struct skynetCore_t* skynetCore = mmap(0, sizeof(struct skynetCore_t), PROT_READ|PROT_WRITE, MAP_SHARED, skynetDesc, 0);

	pthread_mutex_lock(&skynetCore->protector);
	int corePid = skynetCore->pid;
	pthread_mutex_unlock(&skynetCore->protector);

	int message = *(int*)arg;
	int skynetChannelId = ConnectAttach(0, corePid, 1, 0, 0);
	MsgSend(skynetChannelId, &message, sizeof(int), &message, sizeof(int));
	printf("I sent %i and got %i back!\n", *(int*)arg, message);
	ConnectDetach(skynetChannelId);
}
コード例 #22
0
ファイル: B2S02_Seg1.cpp プロジェクト: p3t3rmu3ll3r/se2p
void B2S02_Seg1::timerSeg1Max() {

	puckHandler->removePuckFromBand(controller);
	actorHAL->engineStop();

	printf("Debug State <B2S02_Seg1>: ERROR<ERR_STATE_ERROR_MAX> called by puck%d\n", controller->getID());

	int replyChid = errfsm->getReplyChid();
	int errorfsmChid = errfsm->getErrorFSMChid();
	int errorfsmCoid;
	int rc;

	struct _pulse pulse;

	if ((errorfsmCoid = ConnectAttach(0, 0, errorfsmChid, _NTO_SIDE_CHANNEL, 0)) == -1) {
		printf("B2S02_Seg1: Error in ConnectAttach\n");
	}

	//rc = MsgSendPulse(errorfsmCoid, SIGEV_PULSE_PRIO_INHERIT, PULSE_FROM_PUCK, ERR_STATE_CRITICAL_ERROR);
	rc = MsgSendPulse(errorfsmCoid, SIGEV_PULSE_PRIO_INHERIT, PULSE_FROM_PUCK, ERR_STATE_ERROR_MAX);
	if (rc < 0) {
		printf("B2S02_Seg1: Error in MsgSendPulse");
	}

	rc = MsgReceivePulse(replyChid, &pulse, sizeof(pulse), NULL);
	if (rc < 0) {
		printf("B2S02_Seg1: Error in recv pulse\n");
	}

	if (ConnectDetach(errorfsmCoid) == -1) {
		printf("B2S02_Seg1: Error in ConnectDetach\n");
	}

	bool tmpBand1Waiting = controller->isBand1Waiting();

	controller->resetController();

	if(tmpBand1Waiting){
		rs232_1->sendMsg(RS232_BAND2_READY);
		ActorHAL::getInstance()->engineRight(false);
		ActorHAL::getInstance()->engineUnstop();

		controller->handOverTimer = timerHandler->createTimer(puckHandler->getDispChid(), TIME_VALUE_HAND_OVER_SEC, TIME_VALUE_HAND_OVER_MSEC, TIMER_HAND_OVER);
		timerHandler->startTimer(controller->handOverTimer);
	}
}
コード例 #23
0
ファイル: SensorHAL.cpp プロジェクト: p3t3rmu3ll3r/se2p
void SensorHAL::stopInterrupt() {
	if (-1 == ThreadCtl(_NTO_TCTL_IO, 0)) {
		printf("ThreadCtl access failed\n");
		exit(EXIT_FAILURE);
	}

	if (InterruptDetach(interruptId) == -1) {
		printf("SensorHAL: Error InterruptDetach\n");
	}

	if (ConnectDetach(coid) == -1) {
		printf("SensorHAL: Error in ConnectDetach\n");
	}

	if (ChannelDestroy(chid) == -1) {
		printf("SensorHAL: Error in ChannelDestroy\n");
	}
}
コード例 #24
0
ファイル: message.c プロジェクト: vocho/openqnx
void _message_unblock(dispatch_context_t *ctp) {
	dispatch_t				*dpp = ((message_context_t *) ctp)->dpp;
	struct sched_param		param;
	int						coid;


	if ((coid = ConnectAttach(0, 0, dpp->chid, _NTO_SIDE_CHANNEL, 0)) == -1) {
		return;		//We should indicate an error, but we can't
	}

	memset(&param, 0, sizeof(param));
	if (SchedGet(0, 0, &param) == -1) {
		param.sched_priority = 1;
	}

	/* An unblock pulse with rcvid == 0 should be treated as a noop */
	//MsgSendPulse(coid, param.sched_priority, _PULSE_CODE_UNBLOCK, getpid());
	(void)MsgSendPulse(coid, param.sched_priority, _PULSE_CODE_UNBLOCK, 0);

	ConnectDetach(coid);
}
コード例 #25
0
inline int
isr_setup(omapl1xx_context_t *omapl1xx)
{
	int	err;

	if ((omapl1xx->lcd_chid = ChannelCreate(_NTO_CHF_DISCONNECT |
		_NTO_CHF_UNBLOCK)) == -1) {
		return -1;
	}

	if ((omapl1xx->lcd_coid = ConnectAttach(0, 0,
		omapl1xx->lcd_chid, _NTO_SIDE_CHANNEL, 0)) == -1) {
		err = errno;
		goto fail;
	}

	SIGEV_PULSE_INIT(&omapl1xx->lcd_event, omapl1xx->lcd_coid,
		omapl1xx->adapter->pulseprio, OMAPL1xx_LCD_INTERRUPT_PULSE, 0);

	omapl1xx->lcd_iid = InterruptAttach(_NTO_INTR_CLASS_EXTERNAL |
		omapl1xx->irq, omapl1xx_lcd_isr, (void *)omapl1xx, sizeof(*omapl1xx),  _NTO_INTR_FLAGS_END |
		_NTO_INTR_FLAGS_TRK_MSK | _NTO_INTR_FLAGS_PROCESS);

	if (omapl1xx->lcd_iid == -1) {
		err = errno;
		goto fail2;
	}

	return 0;

fail2:
	ConnectDetach(omapl1xx->lcd_coid);
fail:
	ChannelDestroy(omapl1xx->lcd_chid);

	errno = err;

	return -1;
}
コード例 #26
0
ファイル: intr.c プロジェクト: tyrantyr/onda_qnx
int omap3530_sdma_attach_intr(omap3530_spi_t *omap3530)
{
	int rx_idx = omap3530->sdma_rx_chid ;

	if ((omap3530->sdma_coid = ConnectAttach(0, 0, omap3530->chid, _NTO_SIDE_CHANNEL, 0)) == -1) 
		goto fail0;
	
	omap3530->sdmaevent.sigev_notify   = SIGEV_PULSE;
	omap3530->sdmaevent.sigev_coid     = omap3530->sdma_coid;
	omap3530->sdmaevent.sigev_code     = OMAP3530_SDMA_EVENT;
	omap3530->sdmaevent.sigev_priority = OMAP3530_SPI_PRIORITY+1;

	omap3530->iid_sdma = InterruptAttachEvent(omap3530->irq_sdma+rx_idx, &omap3530->sdmaevent, _NTO_INTR_FLAGS_TRK_MSK);
	
	if (omap3530->iid_sdma != -1)
		return 0;

	ConnectDetach(omap3530->sdma_coid);
fail0:

	return -1;
}
コード例 #27
0
B1S09_ERR_TurnOver::B1S09_ERR_TurnOver(Controller* controller) : BaseState(controller) {
	this->controller = controller;

#ifdef DEBUG_STATE_PRINTF
	printf("DEBUG STATE: Puck%d -> B1S09_ERR_TurnOver \n", this->controller->getID());
#endif

	printf("Debug State <B1S09_ERR_TurnOver>: ERROR<ERR_STATE_TURNOVER> called by puck%d\n", controller->getID());

	//int replyChid = errfsm->getReplyChid();
	int errorfsmChid = errfsm->getErrorFSMChid();
	int errorfsmCoid;
	int rc;

	//struct _pulse pulse;

	if ((errorfsmCoid = ConnectAttach(0, 0, errorfsmChid, _NTO_SIDE_CHANNEL, 0)) == -1) {
		printf("B1S09_ERR_TurnOver: Error in ConnectAttach\n");
	}

	rc = MsgSendPulse(errorfsmCoid, SIGEV_PULSE_PRIO_INHERIT, PULSE_FROM_PUCK, ERR_STATE_TURNOVER);
	if (rc < 0) {
		printf("B1S09_ERR_TurnOver: Error in MsgSendPulse");
	}
/*
	rc = MsgReceivePulse(replyChid, &pulse, sizeof(pulse), NULL);
	if (rc < 0) {
		printf("B1S09_ERR_TurnOver: Error in recv pulse\n");
	}
*/
	//this->controller->puckType = PUCK_ACCEPTED;

	if (ConnectDetach(errorfsmCoid) == -1) {
		printf("B1S09_ERR_TurnOver: Error in ConnectDetach\n");
	}

	//new (this) B1S08_End(this->controller);
}
コード例 #28
0
ファイル: pathmgr_link.c プロジェクト: vocho/openqnx
int pathmgr_link(const char *path, uint32_t nd, pid_t pid, int chid, unsigned handle, enum _file_type file_type, unsigned flags) {
    struct _io_resmgr_link_extra	linkl;
    int								fd;

    if(flags & _RESMGR_FLAG_FTYPEALL) {
        // Ignore passed in ftype
        file_type = _FTYPE_ALL;
    } else if(file_type < _FTYPE_ANY) {
        errno = EINVAL;
        return -1;
    }

    if(!path || !*path) {
        path = "/";
        flags |= _RESMGR_FLAG_FTYPEONLY;
    } else if(flags & _RESMGR_FLAG_FTYPEONLY) { 	//You must pass in a null path to use FTYPEONLY
        errno = EINVAL;
        return -1;
    }

    linkl.nd = nd;
    linkl.pid = pid ? pid : getpid();
    linkl.chid = chid;
    linkl.handle = handle;
    linkl.file_type = file_type;
    linkl.flags = flags;

    if((fd = _connect(PATHMGR_COID, path, 0, O_NOCTTY, SH_DENYNO, _IO_CONNECT_LINK, 0, 0, _FTYPE_LINK,
                      _IO_CONNECT_EXTRA_RESMGR_LINK, sizeof linkl, &linkl, 0, 0, 0)) == -1) {
        return -1;
    }

    if(flags & PATHMGR_FLAG_STICKY) {
        ConnectDetach(fd);
        fd = 0;
    }
    return fd;
}
コード例 #29
0
ファイル: _waitfor.c プロジェクト: vocho/openqnx
int _waitfor( __const char *path, int delay_ms, int poll_ms, int (*checkfunc)(__const char *, void *), void *handle )
{
	int					notify_id = -1;
    struct sigevent     event;
    int                 chid = -1, coid = -1;
    struct _pulse       pulse;
	int					ret_val = -1;
	uint64_t			polltimeout = 100 * (uint64_t)1000000;
	uint64_t			timeout_nsec;

	timeout_nsec = _syspage_time(CLOCK_MONOTONIC);
	timeout_nsec += delay_ms * (uint64_t)1000000;

    /* Check to make sure we don't wait for something already there... */
    ret_val = checkfunc( path, handle );
	if ( ret_val >= 0 || ret_val == WAITFOR_CHECK_ABORT ) {
		return ret_val;
    }

	if ( poll_ms > 0 ) {
		polltimeout = poll_ms * (uint64_t)1000000;
	}

	/* 
	 * We make the channel fixed since we want to remain at the current
	 * thread's priority
	 */
    chid = ChannelCreate(_NTO_CHF_FIXED_PRIORITY);
	if ( chid == -1 ) {
		goto fail1;
	}
    coid = ConnectAttach( ND_LOCAL_NODE, 0, chid, _NTO_SIDE_CHANNEL, 0 );
	if ( coid == -1 ) {
		goto fail2;
	}

    SIGEV_PULSE_INIT( &event, coid, SIGEV_PULSE_PRIO_INHERIT, PULSE_CODE_PATHSPACE, 0 );
    notify_id = procmgr_event_notify_add( PROCMGR_EVENT_PATHSPACE, &event );
	if ( notify_id == -1 ) {
		goto fail3;
	}

    while(_syspage_time(CLOCK_MONOTONIC) < timeout_nsec) {

		/* we need to poll in case we are checking for a subdirectory/file,
		 * since we won't get a pathmgr event for those.
		 */
		SIGEV_UNBLOCK_INIT(&event);
		if ( TimerTimeout( CLOCK_MONOTONIC, _NTO_TIMEOUT_RECEIVE, &event, &polltimeout, NULL) == -1 ) {
			ret_val = -1;
			break;
		}
	   	if ( MsgReceivePulse( chid, &pulse, sizeof(pulse), NULL ) != -1 || errno == ETIMEDOUT ) {
			ret_val = checkfunc( path, handle );
			if ( ret_val >= 0 || ret_val == WAITFOR_CHECK_ABORT ) {
				break;
            }
		} else {
			break;
		}
    }

	(void)procmgr_event_notify_delete( notify_id );
fail3:
	(void)ConnectDetach(coid);
fail2:
	(void)ChannelDestroy(chid);
fail1:
    return ret_val;
}
コード例 #30
-35
ファイル: intr.c プロジェクト: trick77/QNX-BBB
int omap3_edma_attach_intr(omap3_spi_t *omap3)
{
    struct sigevent		event;

    if ((omap3->edma_coid = ConnectAttach(0, 0, omap3->chid, _NTO_SIDE_CHANNEL, 0)) == -1)
        goto fail0;

    event.sigev_notify   = SIGEV_PULSE;
    event.sigev_coid	 = omap3->edma_coid;
    event.sigev_code	 = OMAP3_EDMA_EVENT;
    event.sigev_priority = omap3->prio;

    omap3->iid_edma = InterruptAttachEvent(omap3->irq_edma, &event, _NTO_INTR_FLAGS_TRK_MSK);

    if (omap3->iid_edma != -1)
        return 0;

    ConnectDetach(omap3->edma_coid);
fail0:

    return -1;
}