コード例 #1
0
ファイル: intr.c プロジェクト: nguyenvuhung/SDP_QNX_BBB
/*
 * Process data in a line status register
 */
static int
process_lsr(DEV_OMAP *dev, unsigned char lsr) {
	unsigned key = 0, eventflag = 0;

	// Return immediately if no errors.
	if((lsr & (OMAP_LSR_BI|OMAP_LSR_OE|OMAP_LSR_FE|OMAP_LSR_PE)) == 0)
		return(0);

	// Save the error as out-of-band data which can be retrieved via devctl().
	dev->tty.oband_data |= (lsr >> 1) & 0x0f;
	atomic_set(&dev->tty.flags, OBAND_DATA);
// Uncomment for post 1.0 since there was no time to test sufficiently
//	if(dev->tty.notify[2].cnt) {
//		dev->tty.notify[2].cnt = 0;	// Disarm
//		dev->tty.notify[2].event.sigev_value.sival_int |= _NOTIFY_COND_OBAND;
//		atomic_set(&dev->tty.flags, EVENT_NOTIFY_OBAND);
//		eventflag = 1;
//		}

	// Read whatever input data happens to be in the buffer to "eat" the
	// spurious data associated with break, parity error, etc.
	key = read_omap(dev->port[OMAP_UART_RHR]);

	if(lsr & OMAP_LSR_BI)
		key |= TTI_BREAK;
	else if(lsr & OMAP_LSR_OE)
		key |= TTI_OVERRUN;
	else if(lsr & OMAP_LSR_FE)
		key |= TTI_FRAME;
	else if(lsr & OMAP_LSR_PE)
		key |= TTI_PARITY;

	return(tti(&dev->tty, key) | eventflag);
	}
コード例 #2
0
          void TransparencyManagerOITClosestArray::initializeParameterContainer( dp::rix::core::Renderer * renderer, dp::math::Vec2ui const & viewportSize )
          {
            dp::rix::core::TextureDescription tti(dp::rix::core::TextureType::_2D, dp::rix::core::InternalTextureFormat::R32UI, dp::PixelFormat::R, dp::DataType::UNSIGNED_INT_32);
            m_perFragmentCountTexture       = renderer->textureCreate( tti );
            m_perFragmentIndexTexture       = renderer->textureCreate( tti );
            m_perFragmentSpinLockTexture    = renderer->textureCreate( tti );
            m_samplesTexture                = renderer->textureCreate( dp::rix::core::TextureDescription( dp::rix::core::TextureType::BUFFER, dp::rix::core::InternalTextureFormat::RG32UI, dp::PixelFormat::RG, dp::DataType::UNSIGNED_INT_32 ) );
            m_perFragmentSamplesAccuTexture = renderer->textureCreate( dp::rix::core::TextureDescription( dp::rix::core::TextureType::_2D, dp::rix::core::InternalTextureFormat::RGBA32F, dp::PixelFormat::RGBA, dp::DataType::FLOAT_32 ) );

            std::vector<dp::rix::core::ProgramParameter> parameters;
            parameters.push_back( dp::rix::core::ProgramParameter( "perFragmentCount", dp::rix::core::ContainerParameterType::IMAGE, 0 ) );
            parameters.push_back( dp::rix::core::ProgramParameter( "perFragmentIndex", dp::rix::core::ContainerParameterType::IMAGE, 0 ) );
            parameters.push_back( dp::rix::core::ProgramParameter( "perFragmentSpinLock", dp::rix::core::ContainerParameterType::IMAGE, 0 ) );
            parameters.push_back( dp::rix::core::ProgramParameter( "samplesBuffer", dp::rix::core::ContainerParameterType::IMAGE, 0 ) );
            parameters.push_back( dp::rix::core::ProgramParameter( "perFragmentSamplesAccu", dp::rix::core::ContainerParameterType::IMAGE, 0 ) );

            m_parameterContainerDescriptor = renderer->containerDescriptorCreate( dp::rix::core::ProgramParameterDescriptorCommon( parameters.data(), parameters.size() ) );
            m_parameterContainer = renderer->containerCreate( m_parameterContainerDescriptor );

            renderer->containerSetData( m_parameterContainer
                                      , renderer->containerDescriptorGetEntry( m_parameterContainerDescriptor, parameters[0].m_name )
                                      , dp::rix::core::ContainerDataImage( m_perFragmentCountTexture.get(), 0, false, 0, dp::rix::core::AccessType::READ_WRITE ) );
            renderer->containerSetData( m_parameterContainer
                                      , renderer->containerDescriptorGetEntry( m_parameterContainerDescriptor, parameters[1].m_name )
                                      , dp::rix::core::ContainerDataImage( m_perFragmentIndexTexture.get(), 0, false, 0, dp::rix::core::AccessType::READ_WRITE ) );
            renderer->containerSetData( m_parameterContainer
                                      , renderer->containerDescriptorGetEntry( m_parameterContainerDescriptor, parameters[2].m_name )
                                      , dp::rix::core::ContainerDataImage( m_perFragmentSpinLockTexture.get(), 0, false, 0, dp::rix::core::AccessType::READ_WRITE ) );
            renderer->containerSetData( m_parameterContainer
                                      , renderer->containerDescriptorGetEntry( m_parameterContainerDescriptor, parameters[3].m_name )
                                      , dp::rix::core::ContainerDataImage( m_samplesTexture.get(), 0, false, 0, dp::rix::core::AccessType::READ_WRITE ) );
            renderer->containerSetData( m_parameterContainer
                                      , renderer->containerDescriptorGetEntry( m_parameterContainerDescriptor, parameters[4].m_name )
                                      , dp::rix::core::ContainerDataImage( m_perFragmentSamplesAccuTexture.get(), 0, false, 0, dp::rix::core::AccessType::READ_WRITE ) );
          }
コード例 #3
0
ファイル: intr.c プロジェクト: nguyenvuhung/SDP_QNX_BBB
/*
 * Serial interrupt handler
 */
const struct sigevent *
ser_intr(void *area, int id) {
	int				status, cnt;
	unsigned char	msr, lsr;
	DEV_OMAP		*dev = area;
	struct sigevent *event = NULL;
	unsigned		iir;
	uintptr_t		*port = dev->port;

#ifdef PWR_MAN
	/* Our idle state can be changed by a devctl so we must use a spinlock */
	InterruptLock(&dev->idle_spinlock);
#endif

	while (1) {
		status = 0;

#ifdef PWR_MAN
        if (dev->idle) {

            omap_clock_enable_isr(dev);
#ifdef WINBT            
            omap_force_rts(dev, 0);

            // once we are in idle mode the only interrupt that can wake us up is from am CTS line change
            tti(&dev->tty, TTI_OHW_STOP);

            // start a spare timer for debouncing, if this timer actually
            // expires, then this was a CTS glitch, if the timer
            // is cleared by having data on the RX line, it will send up the
            // oband notification to wake up the host.
            dev->signal_oband_notification = 1;

            if( dev->tty.un.s.spare_tmr == 0 ){
                atomic_set (&dev->tty.eflags, EVENT_TIMER_QUEUE);
                dev->tty.un.s.spare_tmr = 4;

                // queue the event here because the switch statement can just exit
                // without actually queuing the event with setting the status flag
                if((dev->tty.flags & EVENT_QUEUED) == 0) {
                    event = &ttyctrl.event;
                    dev_lock(&ttyctrl);
                    ttyctrl.event_queue[ttyctrl.num_events++] = &dev->tty;
                    atomic_set(&dev->tty.flags, EVENT_QUEUED);
                    dev_unlock(&ttyctrl);
                    continue;
                }
            }
#endif // End of #ifdef WINBT
        }

		unsigned ssr = read_omap(port[OMAP_UART_SSR]);
		if (ssr & OMAP_SSR_WAKEUP_STS) {
			/* Clear the wake up interrupt */
			set_port(port[OMAP_UART_SCR], OMAP_SCR_WAKEUPEN, 0);
		}
#endif


		iir = read_omap(port[OMAP_UART_IIR]) & OMAP_II_MASK;

		switch(iir) {
			case OMAP_II_RX:		// Receive data
			case OMAP_II_RXTO:		// Receive data timeout
			case OMAP_II_LS:		// Line status change
				cnt = 0;
				lsr = read_omap(port[OMAP_UART_LSR]);
				do {
					if( lsr & (OMAP_LSR_BI|OMAP_LSR_OE|OMAP_LSR_FE|OMAP_LSR_PE) ) {
						// Error character
						status |= process_lsr(dev, lsr);
					}
					else {
						// Good character
						status |= tti(&dev->tty, (read_omap(port[OMAP_UART_RHR])) & 0xff);
						cnt++;
					}
					lsr = read_omap(port[OMAP_UART_LSR]);
				} while(lsr & OMAP_LSR_RXRDY && cnt < FIFO_SIZE);
#ifdef WINBT
				if( cnt && dev->signal_oband_notification ){

				    // received data after a CTS wake up
				    // notify the host that it's a valid CTS wakeup.
				    dev->signal_oband_notification = 0;
		            dev->tty.oband_data |= _OBAND_SER_MS;
		            atomic_set(&dev->tty.flags, OBAND_DATA);
		            atomic_set(&dev->tty.flags, EVENT_NOTIFY_OBAND);
		            status |= 1;
				}

				if (cnt && dev->tty.un.s.spare_tmr) {
				    // received data, clear spare timer
	                dev->tty.un.s.spare_tmr = 0;
	            }
#endif
				break;

			case OMAP_II_TX:		// Transmit buffer empty

				// disable thr interrupt
				set_port(dev->port[OMAP_UART_IER], OMAP_IER_THR, 0);

				dev->tty.un.s.tx_tmr = 0;
				/* Send event to io-char, tto() will be processed at thread time */
				atomic_set(&dev->tty.flags, EVENT_TTO);
				status |= 1;
				break;

			case OMAP_II_MS:		// Modem change
				msr = read_omap(port[OMAP_UART_MSR]);

				if(msr & OMAP_MSR_DDCD) {
					status |= tti(&dev->tty, (msr & OMAP_MSR_DCD) ? TTI_CARRIER : TTI_HANGUP);
				}

				if((msr & OMAP_MSR_DCTS)  &&  (dev->tty.c_cflag & OHFLOW)) {
					status |= tti(&dev->tty, (msr & OMAP_MSR_CTS) ? TTI_OHW_CONT : TTI_OHW_STOP);
				}

				/* OBAND notification of Modem status change */
				dev->tty.oband_data |= _OBAND_SER_MS;
				atomic_set(&dev->tty.flags, OBAND_DATA);
				atomic_set(&dev->tty.flags, EVENT_NOTIFY_OBAND);
				status |= 1;

				break;

			case OMAP_II_NOINTR:	// No interrupt
				if (read_omap(port[OMAP_UART_SSR]) & OMAP_SSR_WAKEUP_STS) {	// Wake up interrupt
					set_port(port[OMAP_UART_SCR], OMAP_SCR_WAKEUPEN, 0);		// clear wakeup interrupt
					set_port(port[OMAP_UART_SCR], OMAP_SCR_WAKEUPEN, OMAP_SCR_WAKEUPEN);	// re-enable wakeup interrupt
				}
			default:
				goto done;
		}

		if (status) {
			if((dev->tty.flags & EVENT_QUEUED) == 0) {
				event = &ttyctrl.event;
				dev_lock(&ttyctrl);
				ttyctrl.event_queue[ttyctrl.num_events++] = &dev->tty;
				atomic_set(&dev->tty.flags, EVENT_QUEUED);
				dev_unlock(&ttyctrl);
			}
		}
	}

done:
#ifdef PWR_MAN
	InterruptUnlock(&dev->idle_spinlock);
#endif

	return (event);
}
コード例 #4
0
    //
    // DrawSelf
    //
    // Redraw self
    //
    void Color::DrawSelf(PaintInfo &pi)
    {
      IControl::DrawSelf(pi);

      // Get the color for the current color
      const PlayerInfo *playerInfo;
      Data::Get(&playerInfo, Network::GetCurrentPlayer().GetId());
      ASSERT(playerInfo);
      ASSERT(teamId < Game::MAX_TEAMS);

      const Team *team;
      Data::Get(&team, teamId);
      ASSERT(team);

      // Update the current color
      colorCurrent->SetIntegerValue(team->color);

      // Figure out which colors are available
      BinTree<GroupTree> groups;
      BuildPlayerHierachy(groups);
      Bool colors[Game::MAX_TEAMS + 1];

      for (U32 t = 0; t <= Game::MAX_TEAMS; t++)
      {
        colors[t] = FALSE;
      }
      for (BinTree<GroupTree>::Iterator gti(&groups); *gti; gti++)
      {
        for (BinTree<TeamTree>::Iterator tti(&(*gti)->teams); *tti; tti++)
        {
          colors[(*tti)->team->color] = TRUE;
        }
      }
      groups.DisposeAll();

      /*
      // Is the currently selected color still available ?
      if (colors[colorSelected->GetIntegerValue()])
      {
        colorSelected->SetIntegerValue(team->color);
      }
      */

      // Display all of the available colors
      for (t = 0; t <= Game::MAX_TEAMS; t++)
      {
        // Is the color available ?
        if (!colors[t] || t == team->color)
        {
          Point<S32> p(t * pi.client.Height(), 0);

          // Draw the team color
          ClipRect c(
            pi.client.p0.x + p.x + 3, 
            pi.client.p0.y + p.y + 3, 
            pi.client.p0.x + p.x + pi.client.Height() - 3, 
            pi.client.p0.y + p.y + pi.client.Height() - 3);

          IFace::RenderShadow(
            c, 
            c + IFace::GetMetric(IFace::DROPSHADOW_UP), 
            ::Color(0, 0, 0, IFace::GetMetric(IFace::SHADOW_ALPHA)), 
            0);

          IFace::RenderGradient(c, GetTeamColor(t), 150);

          // Is this the selected color ?
          if (t == U32(colorSelected->GetIntegerValue()))
          {
            IFace::RenderGradient(
              ClipRect(
                pi.client.p0.x + p.x + 1, 
                pi.client.p0.y + p.y + 1, 
                pi.client.p0.x + p.x + pi.client.Height() - 1, 
                pi.client.p0.y + p.y + pi.client.Height() - 1),
              ::Color(1.0f, 1.0f, 1.0f, 0.4f), 
              ::Color(0.5f, 0.5f, 0.5f, 0.4f));
          }
          // Is this the current color ?
          else if (t == team->color)
          {
            IFace::RenderGradient(
              ClipRect(
                pi.client.p0.x + p.x + 1, 
                pi.client.p0.y + p.y + 1, 
                pi.client.p0.x + p.x + pi.client.Height() - 1, 
                pi.client.p0.y + p.y + pi.client.Height() - 1),
              ::Color(1.0f, 1.0f, 1.0f, 0.15f),
              ::Color(0.5f, 0.5f, 0.5f, 0.15f));
          }
        }
      }
    }