Ejemplo n.º 1
0
void FreeBlockDictionary::verify_par_locked() const {
#ifdef ASSERT
  if (ParallelGCThreads > 0) {
    Thread* myThread = Thread::current();
    if (myThread->is_GC_task_thread()) {
      assert(par_lock() != NULL, "Should be using locking?");
      assert_lock_strong(par_lock());
    }
  }
#endif // ASSERT
}
Ejemplo n.º 2
0
/**
 * \brief Get state of Push to Talk from Parallel Port
 * \param p
 * \param pttx return value (must be non NULL)
 * \return RIG_OK or < 0 error
 */
int par_ptt_get(hamlib_port_t *p, ptt_t *pttx)
{
	switch (p->type.ptt) {
	case RIG_PTT_PARALLEL: {
		unsigned char ctl;
		int status;

		par_lock(p);
		status = par_read_control(p, &ctl);
		par_unlock(p);

		*pttx = (ctl & PARPORT_CONTROL_INIT) &&
			!(ctl & PARPORT_CONTROL_STROBE) ?
			RIG_PTT_ON : RIG_PTT_OFF;
		return status;
	}

	default:
		rig_debug(RIG_DEBUG_ERR, "Unsupported PTT type %d\n",
			  p->type.ptt);
		return -RIG_ENAVAIL;
	}

	return RIG_OK;
}
Ejemplo n.º 3
0
/**
 * \brief Set or unset Push to talk bit on Parallel Port
 * \param p
 * \param pttx RIG_PTT_ON --> Set PTT
 * \return RIG_OK or < 0 error
 */
int par_ptt_set(hamlib_port_t *p, ptt_t pttx)
{
	switch(p->type.ptt) {
	case RIG_PTT_PARALLEL:
		{
		unsigned char ctl;
		int status;

		par_lock (p);
		status = par_read_control(p, &ctl);
		if (status != RIG_OK)
			return status;

		/* Enable CW & PTT - /STROBE bit (pin 1) */
		ctl &= ~PARPORT_CONTROL_STROBE;

		/* TODO: kill parm.parallel.pin? */

		/* PTT keying - /INIT bit (pin 16) (inverted) */
		if (pttx == RIG_PTT_ON)
			ctl |= PARPORT_CONTROL_INIT;
		else
			ctl &= ~PARPORT_CONTROL_INIT;

		status = par_write_control(p, ctl);
		par_unlock (p);
		return status;
		}
	default:
		rig_debug(RIG_DEBUG_ERR,"Unsupported PTT type %d\n",
						p->type.ptt);
		return -RIG_EINVAL;
	}
	return RIG_OK;
}
Ejemplo n.º 4
0
static int setDirection(hamlib_port_t *port, unsigned char outputvalue)
{
  int ret;

  par_lock (port);

  /* set the data bits.
   * Should we read before write to not trample the lower significant bits?
   */
  ret = par_write_data(port, outputvalue);

  par_unlock (port);

  return ret;
}