• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Q_ERROR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Q_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_ERROR函数的具体用法?C++ Q_ERROR怎么用?C++ Q_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Q_ERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pfq_egress_bind

int
pfq_egress_bind(pfq_t *q, const char *dev, int queue)
{
	struct pfq_binding b;

	int index;
	if (strcmp(dev, "any")==0) {
		index = Q_ANY_DEVICE;
	}
	else {
		index = pfq_ifindex(q, dev);
		if (index == -1) {
			return Q_ERROR(q, "PFQ: egress_bind: device not found");
		}
	}

	b.gid = 0;
	b.if_index = index;
	b.hw_queue = queue;

        if (setsockopt(q->fd, PF_Q, Q_SO_EGRESS_BIND, &b, sizeof(b)) == -1)
		return Q_ERROR(q, "PFQ: egress bind error");

	return Q_OK(q);
}
开发者ID:Mr-Click,项目名称:PFQ,代码行数:25,代码来源:libpfq.c


示例2: pfq_unbind_group

int
pfq_unbind_group(pfq_t *q, int gid, const char *dev, int queue) /* Q_ANY_QUEUE */
{
	struct pfq_binding b;

	int index;
	if (strcmp(dev, "any")==0) {
		index = Q_ANY_DEVICE;
	}
	else {
		index = pfq_ifindex(q, dev);
		if (index == -1) {
			return Q_ERROR(q, "PFQ: unbind_group: device not found");
		}
	}

	b.gid = gid;
	b.if_index = index;
	b.hw_queue = queue;

	if (setsockopt(q->fd, PF_Q, Q_SO_GROUP_UNBIND, &b, sizeof(b)) == -1) {
		return Q_ERROR(q, "PFQ: unbind error");
	}
	return Q_OK(q);
}
开发者ID:Mr-Click,项目名称:PFQ,代码行数:25,代码来源:libpfq.c


示例3: pfq_disable

int
pfq_disable(pfq_t *q)
{
	if (q->fd == -1)
		return Q_ERROR(q, "PFQ: socket not open");

	if (q->shm_addr != MAP_FAILED) {

		if (munmap(q->shm_addr,q->shm_size) == -1)
			return Q_ERROR(q, "PFQ: munmap error");

		if (q->hd != -1) {
			char filename[64];
			snprintf(filename, 64, "/dev/hugepages/pfq.%d", q->fd);
			unlink(filename);
		}

	}

	q->shm_addr = NULL;
	q->shm_size = 0;

	if(setsockopt(q->fd, PF_Q, Q_SO_DISABLE, NULL, 0) == -1) {
		return Q_ERROR(q, "PFQ: socket disable");
	}
	return Q_OK(q);
}
开发者ID:Mr-Click,项目名称:PFQ,代码行数:27,代码来源:libpfq.c


示例4: main

int main(void) {
	uint16_t status;

	WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
	LED_init();
	LED_on();
    /* configure the Basic Clock Module */
    DCOCTL = CALDCO_1MHZ;
    BCSCTL1 = CALBC1_1MHZ;

    BCSCTL2 = SELM_3 + DIVM_0;//MCLK = LFXTCLK/1
#ifdef NECESSARY
    do {
    	int i;
        IFG1 &= ~OFIFG;                           // Clear OSCFault flag
        for (i = 0xFF; i > 0; i--);               // Time for flag to set
    } while ((IFG1 & OFIFG)); // OSCFault flag still set?
#endif
    TACTL = TASSEL_2 | MC_1; /* SMCLK, upmode */
    TACCR0 = TIMER_CLK_HZ/SYSTICK_HZ;
	TACCTL0 = CCIE; /*Enable timer A0 interrupt*/

	//Enable SCLK, SDI, SDO, master
	USICTL0 |= USIPE7 | USIPE6 | USIPE5 | USIMST | USIOE;
	USICKCTL |= USIDIV_0 //this actually means divide by 1
			  | USISSEL_2//Use SMCLK to drive the SPI clk
			  //| USICKPL
			  ;
	USICTL1 |= USICKPH;//delay?
	//USICTL1 |= USIIE;//interrupt enable
	//		;
	P1OUT = BIT4;//Pull up nCS at first
	P1DIR |= BIT4;//nCS is P1.4
	//P1REN |= 0x10;?

	_enable_interrupts();//vs. _BIS_SR(LPM0_bits + GIE);
	LED_off();

	dSPIN_Soft_Stop();
	dSPIN_Reset_Device();

	status = dSPIN_Get_Status();
   	if(status & dSPIN_STATUS_SW_EVN
   		|| (status & dSPIN_STATUS_MOT_STATUS) != dSPIN_STATUS_MOT_STATUS_STOPPED
   		|| status & dSPIN_STATUS_NOTPERF_CMD
   		|| status & dSPIN_STATUS_WRONG_CMD
   		// !(status & dSPIN_STATUS_UVLO)
   		|| !(status & dSPIN_STATUS_TH_SD)
   		|| !(status & dSPIN_STATUS_OCD))
		Q_ERROR();
    if(dSPIN_Busy_HW()) Q_ERROR();
    return 0;
}
开发者ID:henrychoi,项目名称:realtime,代码行数:53,代码来源:main.c


示例5: pfq_enable

int
pfq_enable(pfq_t *q)
{
	size_t tot_mem; socklen_t size = sizeof(tot_mem);
	char filename[64];

	if (q->shm_addr != MAP_FAILED &&
	    q->shm_addr != NULL) {
		return Q_ERROR(q, "PFQ: queue already enabled");
	}

	if (getsockopt(q->fd, PF_Q, Q_SO_GET_SHMEM_SIZE, &tot_mem, &size) == -1) {
		return Q_ERROR(q, "PFQ: queue memory error");
	}

	snprintf(filename, 64, "/dev/hugepages/pfq.%d", q->fd);

	q->hd = open(filename, O_CREAT | O_RDWR, 0755);
	if (q->hd != -1)
		q->shm_addr = mmap(NULL, tot_mem, PROT_READ|PROT_WRITE, MAP_SHARED, q->hd, 0);

	if (q->shm_addr != MAP_FAILED &&
	    q->shm_addr != NULL) {
		if(setsockopt(q->fd, PF_Q, Q_SO_ENABLE, &q->shm_addr, sizeof(q->shm_addr)) == -1) {
			return Q_ERROR(q, "PFQ: socket enable (hugepages)");
		}
	}
	else {
		void * null = NULL;
		if(setsockopt(q->fd, PF_Q, Q_SO_ENABLE, &null, sizeof(null)) == -1) {
			return Q_ERROR(q, "PFQ: socket enable");
		}

		q->shm_addr = mmap(NULL, tot_mem, PROT_READ|PROT_WRITE, MAP_SHARED, q->fd, 0);
	}

	if (q->shm_addr == MAP_FAILED ||
	    q->shm_addr == NULL) {
		return Q_ERROR(q, "PFQ: socket enable (memory map)");
	}

	q->shm_size = tot_mem;

	q->rx_queue_addr = (char *)(q->shm_addr) + sizeof(struct pfq_shared_queue);
	q->rx_queue_size = q->rx_slots * q->rx_slot_size;

	q->tx_queue_addr = (char *)(q->shm_addr) + sizeof(struct pfq_shared_queue) + q->rx_queue_size * 2;
	q->tx_queue_size = q->tx_slots * q->tx_slot_size;

	return Q_OK(q);
}
开发者ID:Mr-Click,项目名称:PFQ,代码行数:51,代码来源:libpfq.c


示例6: pfq_set_tx_slots

int
pfq_set_tx_slots(pfq_t *q, size_t value)
{
	int enabled = pfq_is_enabled(q);
	if (enabled == 1) {
		return Q_ERROR(q, "PFQ: enabled (Tx slots could not be set)");
	}
	if (setsockopt(q->fd, PF_Q, Q_SO_SET_TX_SLOTS, &value, sizeof(value)) == -1) {
		return Q_ERROR(q, "PFQ: set Tx slots error");
	}

	q->tx_slots = value;
	return Q_OK(q);
}
开发者ID:Mr-Click,项目名称:PFQ,代码行数:14,代码来源:libpfq.c


示例7: pfq_set_caplen

int
pfq_set_caplen(pfq_t *q, size_t value)
{
	int enabled = pfq_is_enabled(q);
	if (enabled == 1) {
		return Q_ERROR(q, "PFQ: enabled (caplen could not be set)");
	}

	if (setsockopt(q->fd, PF_Q, Q_SO_SET_RX_CAPLEN, &value, sizeof(value)) == -1) {
		return Q_ERROR(q, "PFQ: set caplen error");
	}

	q->rx_slot_size = ALIGN(sizeof(struct pfq_pkthdr) + value, 8);
	return Q_OK(q);
}
开发者ID:Mr-Click,项目名称:PFQ,代码行数:15,代码来源:libpfq.c


示例8: BSP_init

/*..........................................................................*/
void BSP_init(void) {
    WDT.TCSRWD.BYTE = 0x10;                             /* disable Watchdog */
    WDT.TCSRWD.BYTE = 0x00;

    MSTCR2.BIT.MSTTZ   = 0;                               /* turn on TimerZ */
    TZ0.TCR.BIT.TPSC   = 3;                         /* internal clock phi/8 */
    TZ0.TCR.BIT.CCLR   = 1;
    TZ0.GRA            = (uint16_t)(((f1_CLK_SPEED/8 + BSP_TICKS_PER_SEC/2)
                                     / BSP_TICKS_PER_SEC) - 1);
    TZ0.TIER.BIT.IMIEA = 1;               /* compare match interrupt enable */

                                                 /* enable the User LEDs... */
    LED0_DDR_1();                           /* configure LED0 pin as output */
    LED1_DDR_1();                           /* configure LED1 pin as output */
    LED2_DDR_1();                           /* configure LED2 pin as output */
    LED3_DDR_1();                           /* configure LED3 pin as output */
    LED0 = LED_OFF;
    LED1 = LED_OFF;
    LED2 = LED_OFF;
    LED3 = LED_OFF;
                                                    /* enable the Switch... */
    SW1_DDR = 0;

    if (QS_INIT((void *)0) == 0) {    /* initialize the QS software tracing */
        Q_ERROR();
    }
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:28,代码来源:bsp.c


示例9: BSP_init

/* BSP functions ===========================================================*/
void BSP_init(void) {
    /* NOTE: SystemInit() has been already called from the startup code
    *  but SystemCoreClock needs to be updated
    */
    SystemCoreClockUpdate();

    /* enable GPIOA clock for the LED */
    RCC->AHBENR |= (1U << 0);

    /* configure LED (PA.5) pin as push-pull outputs, No pull-up, pull-down */
    GPIOA->MODER   &= ~((3U << 2*5));
    GPIOA->MODER   |=  ((1U << 2*5));
    GPIOA->OTYPER  &= ~((1U <<   5));
    GPIOA->OSPEEDR &= ~((3U << 2*5));
    GPIOA->OSPEEDR |=  ((1U << 2*5));
    GPIOA->PUPDR   &= ~((3U << 2*5));

    /* enable GPIOC clock for the Button */
    RCC->AHBENR |=  (1ul << 2);

    /* configure BTN (PC.13) pin as push-pull outputs, No pull-up, pull-down */
    GPIOC->MODER   &= ~(3ul << 2*13);
    GPIOC->OSPEEDR &= ~(3ul << 2*13);
    GPIOC->OSPEEDR |=  (1ul << 2*13);
    GPIOC->PUPDR   &= ~(3ul << 2*13);


    BSP_randomSeed(1234U);

    if (QS_INIT((void *)0) == 0U) { /* initialize the QS software tracing */
        Q_ERROR();
    }
    QS_OBJ_DICTIONARY(&l_tickHook);
    QS_OBJ_DICTIONARY(&l_EXTI0_IRQHandler);
}
开发者ID:alisonjoe,项目名称:qpc,代码行数:36,代码来源:bsp.c


示例10: BSP_init

/*..........................................................................*/
void BSP_init(void) {
    uint32_t i;

    for (i = 0; i < Q_DIM(l_led); ++i) {          /* initialize the LEDs... */
        AT91C_BASE_PIOA->PIO_PER = l_led[i];                  /* enable pin */
        AT91C_BASE_PIOA->PIO_OER = l_led[i];     /* configure as output pin */
        LED_OFF(i);                                   /* extinguish the LED */
    }
                /* configure Advanced Interrupt Controller (AIC) of AT91... */
    AT91C_BASE_AIC->AIC_IDCR = ~0;                /* disable all interrupts */
    AT91C_BASE_AIC->AIC_ICCR = ~0;                  /* clear all interrupts */
    for (i = 0; i < 8; ++i) {
        AT91C_BASE_AIC->AIC_EOICR = 0;           /* write AIC_EOICR 8 times */
    }

                             /* set the desired ticking rate for the PIT... */
    i = (MCK / 16 / BSP_TICKS_PER_SEC) - 1;
    AT91C_BASE_PITC->PITC_PIMR = (AT91C_PITC_PITEN | AT91C_PITC_PITIEN | i);

    if (QS_INIT((void *)0) == 0) {    /* initialize the QS software tracing */
        Q_ERROR();
    }

    QS_OBJ_DICTIONARY(&QS_tickIRQ);
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:26,代码来源:bsp.c


示例11: Philo_hungry

/*${AOs::Philo::SM::hungry} ................................................*/
QState Philo_hungry(Philo * const me) {
    QState status_;
    switch (Q_SIG(me)) {
        /*${AOs::Philo::SM::hungry} */
        case Q_ENTRY_SIG: {
            QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->num);
            status_ = Q_HANDLED();
            break;
        }
        /*${AOs::Philo::SM::hungry::EAT} */
        case EAT_SIG: {
            status_ = Q_TRAN(&Philo_eating);
            break;
        }
        /*${AOs::Philo::SM::hungry::DONE} */
        case DONE_SIG: {
            Q_ERROR(); /* this event should never arrive in this state */
            status_ = Q_HANDLED();
            break;
        }
        default: {
            status_ = Q_SUPER(&QHsm_top);
            break;
        }
    }
    return status_;
}
开发者ID:QuantumLeaps,项目名称:qpn,代码行数:28,代码来源:philo.c


示例12: Philo_thinking

/*${AOs::Philo::SM::thinking} ..............................................*/
QState Philo_thinking(Philo * const me) {
    QState status_;
    switch (Q_SIG(me)) {
        /*${AOs::Philo::SM::thinking} */
        case Q_ENTRY_SIG: {
            me->tickCtr = THINK_TIME;
            status_ = Q_HANDLED();
            break;
        }
        /*${AOs::Philo::SM::thinking} */
        case Q_EXIT_SIG: {
            me->tickCtr = 0U;
            status_ = Q_HANDLED();
            break;
        }
        /*${AOs::Philo::SM::thinking::Q_TIMEOUT} */
        case Q_TIMEOUT_SIG: {
            status_ = Q_TRAN(&Philo_hungry);
            break;
        }
        /*${AOs::Philo::SM::thinking::EAT, DONE} */
        case EAT_SIG: /* intentionally fall through */
        case DONE_SIG: {
            Q_ERROR(); /* these events should never arrive in this state */
            status_ = Q_HANDLED();
            break;
        }
        default: {
            status_ = Q_SUPER(&QHsm_top);
            break;
        }
    }
    return status_;
}
开发者ID:QuantumLeaps,项目名称:qpn,代码行数:35,代码来源:philo.c


示例13: Philo_eating

/*${AOs::Philo::SM::eating} ................................................*/
QState Philo_eating(Philo * const me) {
    QState status_;
    switch (Q_SIG(me)) {
        /*${AOs::Philo::SM::eating} */
        case Q_ENTRY_SIG: {
            me->tickCtr = EAT_TIME;
            status_ = Q_HANDLED();
            break;
        }
        /*${AOs::Philo::SM::eating} */
        case Q_EXIT_SIG: {
            me->tickCtr = 0U;
            QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->num);
            status_ = Q_HANDLED();
            break;
        }
        /*${AOs::Philo::SM::eating::Q_TIMEOUT} */
        case Q_TIMEOUT_SIG: {
            status_ = Q_TRAN(&Philo_thinking);
            break;
        }
        /*${AOs::Philo::SM::eating::EAT, DONE} */
        case EAT_SIG: /* intentionally fall through */
        case DONE_SIG: {
            Q_ERROR(); /* these events should never arrive in this state */
            status_ = Q_HANDLED();
            break;
        }
        default: {
            status_ = Q_SUPER(&QHsm_top);
            break;
        }
    }
    return status_;
}
开发者ID:QuantumLeaps,项目名称:qpn,代码行数:36,代码来源:philo.c


示例14: BSP_init

void BSP_init(void) {
	uint32_t err_code;
    err_code = nrf_drv_timer_init(&TIMER1, NULL, Timer1_handler);
    APP_ERROR_CHECK(err_code);
    nrf_drv_timer_extended_compare(&TIMER1, NRF_TIMER_CC_CHANNEL0
    		, nrf_drv_timer_ms_to_ticks(&TIMER1, 1000/BSP_TICKS_PER_SEC)
			, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);

    // Configure button 1 for low accuracy (why not high accuracy?)
    Q_ALLEGE(nrf_drv_gpiote_init() == NRF_SUCCESS);

    nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
    config.pull = NRF_GPIO_PIN_PULLUP;

    Q_ALLEGE(nrf_drv_gpiote_in_init(BTN_PIN, &config, btn1_event_handler)
    		== NRF_SUCCESS);
    nrf_drv_gpiote_in_event_enable(BTN_PIN, /* int enable = */ true);

    NRF_GPIO->DIRSET = 1 << GPIO_TP;

    /* initialize the QS software tracing... */
    if (QS_INIT((void *)0) == 0) {
        Q_ERROR();
    }
}
开发者ID:henrychoi,项目名称:realtime,代码行数:25,代码来源:qp.c


示例15: BSP_init

/* BSP functions ===========================================================*/
void BSP_init(void) {
    /* NOTE: SystemInit() has been already called from the startup code
    *  but SystemCoreClock needs to be updated
    */
    SystemCoreClockUpdate();

    /* turn the GPIO clock on */
    LPC_SC->PCONP |= (1U << 15);

    /* setup the GPIO pin functions for the LEDs... */
    LPC_PINCON->PINSEL3 &= ~(3U <<  4); /* LED_1: function P1.18 to GPIO */
    LPC_PINCON->PINSEL3 &= ~(3U <<  8); /* LED_2: function P1.20 to GPIO */
    LPC_PINCON->PINSEL3 &= ~(3U << 10); /* LED_3: function P1.21 to GPIO */
    LPC_PINCON->PINSEL3 &= ~(3U << 14); /* LED_4: function P1.23 to GPIO */

    /* Set GPIO-P1 LED pins to output */
    LPC_GPIO1->FIODIR |= (LED_1 | LED_2 | LED_3 | LED_4);


    /* setup the GPIO pin function for the Button... */
    LPC_PINCON->PINSEL0 &= ~(3U << 12); /* function P0.6 to GPIO, pull-up */

    /* Set GPIO-P0 Button pin as input */
    LPC_GPIO0->FIODIR &= ~BTN_EXT;

    BSP_randomSeed(1234U);

    if (QS_INIT((void *)0) == 0U) { /* initialize the QS software tracing */
        Q_ERROR();
    }
    QS_OBJ_DICTIONARY(&l_SysTick_Handler);
    QS_OBJ_DICTIONARY(&l_EINT0_IRQHandler);
    QS_USR_DICTIONARY(PHILO_STAT);
}
开发者ID:alisonjoe,项目名称:qpc,代码行数:35,代码来源:bsp.c


示例16: Philo_eating

/* @(/2/0/2/3) .............................................................*/
QState Philo_eating(Philo *me, QEvent const *e) {
    switch (e->sig) {
        /* @(/2/0/2/3) */
        case Q_ENTRY_SIG: {
            QTimeEvt_postIn(&me->timeEvt, &me->super, EAT_TIME);
            return Q_HANDLED();
        }
        /* @(/2/0/2/3) */
        case Q_EXIT_SIG: {
            TableEvt *pe = Q_NEW(TableEvt, DONE_SIG);
            pe->philoNum = PHILO_ID(me);
            QF_PUBLISH((QEvent const *)pe, me);
            return Q_HANDLED();
        }
        /* @(/2/0/2/3/0) */
        case TIMEOUT_SIG: {
            BSP_busyDelay();
            return Q_TRAN(&Philo_thinking);
        }
        /* @(/2/0/2/3/1) */
        case TERMINATE_SIG: /* intentionally fall through */
        case DONE_SIG: {
            Q_ERROR();
            return Q_HANDLED();
        }
        /* @(/2/0/2/3/2) */
        case EAT_SIG: {
            Q_ASSERT(((TableEvt const *)e)->philoNum != PHILO_ID(me));
            return Q_HANDLED();
        }
    }
    return Q_SUPER(&QHsm_top);
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:34,代码来源:philo.c


示例17: BSP_init

/*..........................................................................*/
void BSP_init(void) {

    SystemInit();         /* initialize STM32 system (clock, PLL and Flash) */

             /* initialize LEDs, Key Button, and LCD on STM3210X-EVAL board */
    STM_EVAL_LEDInit(LED1);
    STM_EVAL_LEDInit(LED2);
    STM_EVAL_LEDInit(LED3);
    STM_EVAL_LEDInit(LED4);

    STM3210C_LCD_Init();                              /* initialize the LCD */
    LCD_Clear(White);                                      /* clear the LCD */
    LCD_SetBackColor(Grey);
    LCD_SetTextColor(Black);
    LCD_DisplayString(Line0, 0, "   Quantum Leaps    ");
    LCD_DisplayString(Line1, 0, "     DPP example    ");
    LCD_DisplayString(Line2, 0, "QP/C(Vanilla)       ");
    LCD_DisplayString(Line2, 14*16, QF_getVersion());
    LCD_SetBackColor(White);
    LCD_DisplayString(Line5, 0, "DPP:");
    LCD_SetBackColor(Black);
    LCD_SetTextColor(Yellow);
    LCD_DisplayString(Line9, 0, "  state-machine.com ");
    LCD_SetBackColor(Blue);
    LCD_SetTextColor(White);
    LCD_DisplayString(Line5, 4*16, "0 ,1 ,2 ,3 ,4    ");

    if (QS_INIT((void *)0) == 0) {    /* initialize the QS software tracing */
        Q_ERROR();
    }
}
开发者ID:JigsawRenaissance,项目名称:GGHC,代码行数:32,代码来源:bsp.c


示例18: Philo_thinking

/* @(/2/0/2/1) .............................................................*/
QState Philo_thinking(Philo *me, QEvent const *e) {
    switch (e->sig) {
        /* @(/2/0/2/1) */
        case Q_ENTRY_SIG: {
            QTimeEvt_postIn(&me->timeEvt, &me->super, THINK_TIME);
            return Q_HANDLED();
        }
        /* @(/2/0/2/1/0) */
        case TIMEOUT_SIG: {
            BSP_busyDelay();
            return Q_TRAN(&Philo_hungry);
        }
        /* @(/2/0/2/1/1) */
        case TERMINATE_SIG: /* intentionally fall through */
        case DONE_SIG: {
            Q_ERROR();
            return Q_HANDLED();
        }
        /* @(/2/0/2/1/2) */
        case EAT_SIG: {
            Q_ASSERT(((TableEvt const *)e)->philoNum != PHILO_ID(me));
            return Q_HANDLED();
        }
    }
    return Q_SUPER(&QHsm_top);
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:27,代码来源:philo.c


示例19: Philo_hungry

/* @(/2/0/2/2) .............................................................*/
QState Philo_hungry(Philo *me, QEvent const *e) {
    switch (e->sig) {
        /* @(/2/0/2/2) */
        case Q_ENTRY_SIG: {
            TableEvt *pe = Q_NEW(TableEvt, HUNGRY_SIG);
            pe->philoNum = PHILO_ID(me);
            QACTIVE_POST(AO_Table, (QEvent const *)pe, me);
            return Q_HANDLED();
        }
        /* @(/2/0/2/2/0) */
        case EAT_SIG: {
            /* @(/2/0/2/2/0/0) */
            if (((TableEvt const *)e)->philoNum == PHILO_ID(me)) {
                BSP_busyDelay();
                return Q_TRAN(&Philo_eating);
            }
            break;
        }
        /* @(/2/0/2/2/1) */
        case TERMINATE_SIG: /* intentionally fall through */
        case DONE_SIG: {
            Q_ERROR();
            return Q_HANDLED();
        }
    }
    return Q_SUPER(&QHsm_top);
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:28,代码来源:philo.c


示例20: BSP_init

/*..........................................................................*/
void BSP_init(void) {
    WDTCTL   = (WDTPW | WDTHOLD);                               /* Stop WDT */

    /* configure the Basic Clock Module */
    DCOCTL   = CALDCO_8MHZ;                              /* Set DCO to 8MHz */
    BCSCTL1  = CALBC1_8MHZ;

    TACTL    = (ID_3 | TASSEL_2 | MC_1);       /* SMCLK, /8 divider, upmode */
    TACCR0   = (((BSP_SMCLK / 8) + BSP_TICKS_PER_SEC/2) / BSP_TICKS_PER_SEC);

    P1DIR   |= (BIT0 | BIT1);               /* P1.0 and P1.1 outputs (LEDs) */

    P1DIR  &= ~BIT2;                             /* P1.2 input (Switch TS1) */
    P1REN  |=  BIT2;                     /* enable pull-up resistor on P1.2 */
    P1SEL  &= ~BIT2;                         /* enable I/O function on P1.2 */
    P1IES  |=  BIT2;                     /* interrupt edge select high->low */
    P1IFG  &= ~BIT2;                              /* clear interrupt source */

    BSP_randomSeed(1234U);

    if (QS_INIT((void *)0) == 0) {    /* initialize the QS software tracing */
        Q_ERROR();
    }
    QS_RESET();
    QS_OBJ_DICTIONARY(&l_timerA_ISR);
}
开发者ID:MCUapps,项目名称:qpc-gnu,代码行数:27,代码来源:bsp.c



注:本文中的Q_ERROR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Q_FOREACH函数代码示例发布时间:2022-05-30
下一篇:
C++ Q_D函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap