当前位置: 首页>>代码示例>>C++>>正文


C++ CONCAT函数代码示例

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


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

示例1: CONCAT

static unsigned MY_TYPE_T CONCAT(libbf_compute_expr_,MY_TYPE_T_STR) (Expression* expr, unsigned MY_TYPE_T* data_ptr)
{
  switch(expr->e_type)
  {
    case EXPR_CONSTANT:
      return expr->e_constant;
      break;
      
    case EXPR_DATA:
      return data_ptr[expr->e_offset];
      break;
      
    case EXPR_ADD:
      return CONCAT(libbf_compute_expr_,MY_TYPE_T_STR)(expr->e_expr1, data_ptr) +
             CONCAT(libbf_compute_expr_,MY_TYPE_T_STR)(expr->e_expr2, data_ptr);
      break;
      
    case EXPR_MUL:
      return CONCAT(libbf_compute_expr_,MY_TYPE_T_STR)(expr->e_expr1, data_ptr) *
             CONCAT(libbf_compute_expr_,MY_TYPE_T_STR)(expr->e_expr2, data_ptr);
      break;

    default:
      SHOULDNT_HAPPEN();
      return 0;
      break;
  }
}
开发者ID:2lost4u,项目名称:libbf,代码行数:28,代码来源:libbf_interpreter_optimizer.c

示例2: BitBangSPI_Send_Byte

/*============================================================================
Name    :   BitBangSPI_Send_Byte
------------------------------------------------------------------------------
Purpose :   Send and Read one byte using BitBangSPI Interface
Input   :   Data to send to slave
Output  :   Data read from slave
Notes   :	Called from BitBangSPI_Send_Message in this file
============================================================================*/
uint8_t BitBangSPI_Send_Byte(uint8_t c)
{
    unsigned bit;
    for (bit = 0; bit < 8; bit++) {
        /* write MOSI on trailing edge of previous clock */
        if (c & 0x80)
            CONCAT( PORT, SPI_BB_MOSI, _OUTSET) =  ( 1 << MOSI_BB );
        else
            CONCAT( PORT, SPI_BB_MOSI, _OUTCLR) =  ( 1 << MOSI_BB );

        c <<= 1;

        /* half a clock cycle before leading/rising edge */
        DELAYUS(1);

        CONCAT( PORT, SPI_BB_SCK, _OUTSET) = (1 << SCK_BB );

        /* half a clock cycle before trailing/falling edge */
        DELAYUS(1);

        /* read MISO on trailing edge */
        c |= ((CONCAT( PORT, SPI_BB_MISO, _IN) >> MISO_BB) & 0x01);
        CONCAT( PORT, SPI_BB_SCK, _OUTCLR) = (1 << SCK_BB );
    }

    CONCAT( PORT, SPI_BB_MOSI, _OUTCLR) =  ( 1 << MOSI_BB );

    DELAYUS(50);

    return c;
}
开发者ID:GordonMcGregor,项目名称:luminous,代码行数:39,代码来源:BitBangSPI_Master.c

示例3: concat_unlock

static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{
	struct mtd_concat *concat = CONCAT(mtd);
	int i, err = 0;

	for (i = 0; i < concat->num_subdev; i++) {
		struct mtd_info *subdev = concat->subdev[i];
		uint64_t size;

		if (ofs >= subdev->size) {
			size = 0;
			ofs -= subdev->size;
			continue;
		}
		if (ofs + len > subdev->size)
			size = subdev->size - ofs;
		else
			size = len;

		err = mtd_unlock(subdev, ofs, size);
		if (err)
			break;

		len -= size;
		if (len == 0)
			break;

		err = -EINVAL;
		ofs = 0;
	}

	return err;
}
开发者ID:Noltari,项目名称:u-boot,代码行数:33,代码来源:mtdconcat.c

示例4: concat_block_isbad

static int concat_block_isbad(struct mtd_info *mtd, loff_t ofs)
{
    struct mtd_concat *concat = CONCAT(mtd);
    int i, res = 0;

    if (!concat->subdev[0]->block_isbad)
        return res;

    if (ofs > mtd->size)
        return -EINVAL;

    for (i = 0; i < concat->num_subdev; i++) {
        struct mtd_info *subdev = concat->subdev[i];

        if (ofs >= subdev->size) {
            ofs -= subdev->size;
            continue;
        }

        res = subdev->block_isbad(subdev, ofs);
        break;
    }

    return res;
}
开发者ID:274914765,项目名称:C,代码行数:25,代码来源:mtdconcat.c

示例5: concat_block_markbad

static int concat_block_markbad(struct mtd_info *mtd, loff_t ofs)
{
    struct mtd_concat *concat = CONCAT(mtd);
    int i, err = -EINVAL;

    if (!concat->subdev[0]->block_markbad)
        return 0;

    if (ofs > mtd->size)
        return -EINVAL;

    for (i = 0; i < concat->num_subdev; i++) {
        struct mtd_info *subdev = concat->subdev[i];

        if (ofs >= subdev->size) {
            ofs -= subdev->size;
            continue;
        }

        err = subdev->block_markbad(subdev, ofs);
        if (!err)
            mtd->ecc_stats.badblocks++;
        break;
    }

    return err;
}
开发者ID:274914765,项目名称:C,代码行数:27,代码来源:mtdconcat.c

示例6: mtd_concat_destroy

void mtd_concat_destroy(struct mtd_info *mtd)
{
    struct mtd_concat *concat = CONCAT(mtd);
    if (concat->mtd.numeraseregions)
        kfree(concat->mtd.eraseregions);
    kfree(concat);
}
开发者ID:274914765,项目名称:C,代码行数:7,代码来源:mtdconcat.c

示例7: concat_get_unmapped_area

/*
 * try to support NOMMU mmaps on concatenated devices
 * - we don't support subdev spanning as we can't guarantee it'll work
 */
static unsigned long concat_get_unmapped_area(struct mtd_info *mtd,
					      unsigned long len,
					      unsigned long offset,
					      unsigned long flags)
{
	struct mtd_concat *concat = CONCAT(mtd);
	int i;

	for (i = 0; i < concat->num_subdev; i++) {
		struct mtd_info *subdev = concat->subdev[i];

		if (offset >= subdev->size) {
			offset -= subdev->size;
			continue;
		}

		/* we've found the subdev over which the mapping will reside */
		if (offset + len > subdev->size)
			return (unsigned long) -EINVAL;

		if (subdev->get_unmapped_area)
			return subdev->get_unmapped_area(subdev, len, offset,
							 flags);

		break;
	}

	return (unsigned long) -ENOSYS;
}
开发者ID:Aaroneke,项目名称:galaxy-2636,代码行数:33,代码来源:mtdconcat.c

示例8: ut_read_os_version_index

/* Writes to ut_os_version_index a zero-based index identifying the OS version and HW model.
 * Also sets up the syscalls table.
 * Should be called only once.
 * May be used for OS-specific arrays of constants (marked with "// OS-specific"). */
void ut_read_os_version_index(void) {
	#if defined STAGE1
			sc_addrs_ptr = CONCAT(CONCAT(CONCAT(syscalls_light_, MODEL), _), OS_VERSION);
	switch (*(unsigned*)(OS_BASE_ADDRESS + 0x20)) {
		// OS-specific
		case 0x102F0FA0:  // 3.1.0 non-CAS
			ut_os_version_index = 0;
			break;
		case 0x102F16D0:  // 3.1.0 CAS
			ut_os_version_index = 1;
			break;
		case 0x102F0A10:  // 3.1.0 non-CAS CX
			ut_os_version_index = 2;
			break;
		case 0x102F11A0:  // 3.1.0 CAS CX
			ut_os_version_index = 3;
			break;
	}
	#else
	/* The heuristic is based on the address of INT_Initialize - Thanks Goplat.
	 * The address is read from the RAM copy and not the real vector which is
	 * destroyed at installation time */
	switch (*(unsigned*)(OS_BASE_ADDRESS + 0x20)) {
		// OS-specific
		case 0x102F0FA0:  // 3.1.0 non-CAS
			ut_os_version_index = 0;
			sc_addrs_ptr = syscalls_ncas_3_1_0;
			break;
		case 0x102F16D0:  // 3.1.0 CAS
			ut_os_version_index = 1;
			sc_addrs_ptr = syscalls_cas_3_1_0;
			break;
		case 0x102F0A10:  // 3.1.0 non-CAS CX
			ut_os_version_index = 2;
			sc_addrs_ptr = syscalls_ncascx_3_1_0;
			break;
		case 0x102F11A0:  // 3.1.0 CAS CX
			ut_os_version_index = 3;
			sc_addrs_ptr = syscalls_cascx_3_1_0;
			break;
		default:
			ut_panic("v?");
	}
	#endif
}
开发者ID:p0wer0n,项目名称:ndless,代码行数:49,代码来源:utils.c

示例9: SPI_Master_Init

/*============================================================================
Name    :   SPI_Master_Init
------------------------------------------------------------------------------
Purpose :   Initialize SPI Interface
Input   :   n/a
Output  :   n/a
Notes   :	Called from QDebug_Init in QDebug.c
============================================================================*/
void SPI_Master_Init (void)
{
    // MOSI, SCK and SS are outputs. Pullup on MISO
    //SPI_DDR |= (1<<SS) | (1<<MOSI) | (1<<SCK) ;
    CONCAT( PORT, SPI_SS, _DIR) =  (1<<SS) | (1<<MOSI) | (1<<SCK) ;

    //SPI_DDR &=~(1<<MISO);
    CONCAT( PORT, SPI_SS, _DIR) &=~(1<<MISO);

   //SPI_PORT &=~ ((1<<SS) | (1<<SCK) | (1<<MOSI)) ;
    CONCAT( PORT, SPI_SS, _OUT)  &=~ ((1<<SS) | (1<<SCK) | (1<<MOSI)) ;

	//SPI_PORT |= (1<<MISO);
    CONCAT( PORT, SPI_SS, _OUT) |= (1<<MISO);

  	SPIC_CTRL = (1<<SPI_ENABLE_bp) | (1<<SPI_MASTER_bp) |
		(0<<SPI_PRESCALER1_bp)|(1<<SPI_PRESCALER0_bp);
}
开发者ID:GordonMcGregor,项目名称:luminous,代码行数:26,代码来源:SPI_Master.c

示例10: concat_read_ecc

static int
concat_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
                size_t * retlen, u_char * buf, u_char * eccbuf,
                struct nand_oobinfo *oobsel)
{
    struct mtd_concat *concat = CONCAT(mtd);
    int err = -EINVAL;
    int i;

    *retlen = 0;

    for (i = 0; i < concat->num_subdev; i++) {
        struct mtd_info *subdev = concat->subdev[i];
        size_t size, retsize;

        if (from >= subdev->size) {
            /* Not destined for this subdev */
            size = 0;
            from -= subdev->size;
            continue;
        }

        if (from + len > subdev->size)
            /* First part goes into this subdev */
            size = subdev->size - from;
        else
            /* Entire transaction goes into this subdev */
            size = len;

        if (subdev->read_ecc)
            err = subdev->read_ecc(subdev, from, size,
                                   &retsize, buf, eccbuf, oobsel);
        else
            err = -EINVAL;

        if (err)
            break;

        *retlen += retsize;
        len -= size;
        if (len == 0)
            break;

        err = -EINVAL;
        buf += size;
        if (eccbuf) {
            eccbuf += subdev->oobsize;
            /* in nand.c at least, eccbufs are
               tagged with 2 (int)eccstatus'; we
               must account for these */
            eccbuf += 2 * (sizeof (int));
        }
        from = 0;
    }
    return err;
}
开发者ID:jhbsz,项目名称:MI424WR_GEN2_Rev_E-F,代码行数:56,代码来源:mtdconcat.c

示例11: concat_read_oob

static int
concat_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops)
{
    struct mtd_concat *concat = CONCAT(mtd);
    struct mtd_oob_ops devops = *ops;
    int i, err, ret = 0;

    ops->retlen = ops->oobretlen = 0;

    for (i = 0; i < concat->num_subdev; i++) {
        struct mtd_info *subdev = concat->subdev[i];

        if (from >= subdev->size) {
            from -= subdev->size;
            continue;
        }

        /* partial read ? */
        if (from + devops.len > subdev->size)
            devops.len = subdev->size - from;

        err = subdev->read_oob(subdev, from, &devops);
        ops->retlen += devops.retlen;
        ops->oobretlen += devops.oobretlen;

        /* Save information about bitflips! */
        if (unlikely(err)) {
            if (err == -EBADMSG) {
                mtd->ecc_stats.failed++;
                ret = err;
            } else if (err == -EUCLEAN) {
                mtd->ecc_stats.corrected++;
                /* Do not overwrite -EBADMSG !! */
                if (!ret)
                    ret = err;
            } else
                return err;
        }

        if (devops.datbuf) {
            devops.len = ops->len - ops->retlen;
            if (!devops.len)
                return ret;
            devops.datbuf += devops.retlen;
        }
        if (devops.oobbuf) {
            devops.ooblen = ops->ooblen - ops->oobretlen;
            if (!devops.ooblen)
                return ret;
            devops.oobbuf += ops->oobretlen;
        }

        from = 0;
    }
    return -EINVAL;
}
开发者ID:274914765,项目名称:C,代码行数:56,代码来源:mtdconcat.c

示例12: concat_resume

static void concat_resume(struct mtd_info *mtd)
{
    struct mtd_concat *concat = CONCAT(mtd);
    int i;

    for (i = 0; i < concat->num_subdev; i++) {
        struct mtd_info *subdev = concat->subdev[i];
        subdev->resume(subdev);
    }
}
开发者ID:274914765,项目名称:C,代码行数:10,代码来源:mtdconcat.c

示例13: concat_read

static int
concat_read(struct mtd_info *mtd, loff_t from, size_t len,
	    size_t * retlen, u_char * buf)
{
	struct mtd_concat *concat = CONCAT(mtd);
	int ret = 0, err;
	int i;

#ifdef __UBOOT__
	*retlen = 0;
#endif

	for (i = 0; i < concat->num_subdev; i++) {
		struct mtd_info *subdev = concat->subdev[i];
		size_t size, retsize;

		if (from >= subdev->size) {
			/* Not destined for this subdev */
			size = 0;
			from -= subdev->size;
			continue;
		}
		if (from + len > subdev->size)
			/* First part goes into this subdev */
			size = subdev->size - from;
		else
			/* Entire transaction goes into this subdev */
			size = len;

		err = mtd_read(subdev, from, size, &retsize, buf);

		/* Save information about bitflips! */
		if (unlikely(err)) {
			if (mtd_is_eccerr(err)) {
				mtd->ecc_stats.failed++;
				ret = err;
			} else if (mtd_is_bitflip(err)) {
				mtd->ecc_stats.corrected++;
				/* Do not overwrite -EBADMSG !! */
				if (!ret)
					ret = err;
			} else
				return err;
		}

		*retlen += retsize;
		len -= size;
		if (len == 0)
			return ret;

		buf += size;
		from = 0;
	}
	return -EINVAL;
}
开发者ID:Noltari,项目名称:u-boot,代码行数:55,代码来源:mtdconcat.c

示例14: BitBangSPI_Master_Init

/*============================================================================
Name    :   BitBangSPI_Master_Init
------------------------------------------------------------------------------
Purpose :   Initialize BitBangSPI Interface
Input   :   n/a
Output  :   n/a
Notes   :	Called from QDebug_Init in QDebug.c
============================================================================*/
void BitBangSPI_Master_Init (void)
{
    CONCAT( PORT, SPI_BB_SS, _DIRSET) =  ((1<<SS_BB));
    CONCAT( PORT, SPI_BB_MOSI, _DIRSET) =  (( 1 << MOSI_BB ));
    CONCAT( PORT, SPI_BB_SCK, _DIRSET) =  (( 1 << SCK_BB ));

    CONCAT( PORT, SPI_BB_MISO, _DIRCLR) =  ( 1 << MISO_BB );

    CONCAT( PORT, SPI_BB_SS, _OUTCLR) =  ((1<<SS_BB));
    CONCAT( PORT, SPI_BB_MOSI, _OUTCLR) =  (( 1 << MOSI_BB ));
    CONCAT( PORT, SPI_BB_SCK, _OUTCLR) =  (( 1 << SCK_BB ));
    CONCAT( PORT, SPI_BB_MISO, _OUTSET) =  ( 1 << MISO_BB );
}
开发者ID:GordonMcGregor,项目名称:luminous,代码行数:21,代码来源:BitBangSPI_Master.c

示例15: concat_suspend

static int concat_suspend(struct mtd_info *mtd)
{
    struct mtd_concat *concat = CONCAT(mtd);
    int i, rc = 0;

    for (i = 0; i < concat->num_subdev; i++) {
        struct mtd_info *subdev = concat->subdev[i];
        if ((rc = subdev->suspend(subdev)) < 0)
            return rc;
    }
    return rc;
}
开发者ID:274914765,项目名称:C,代码行数:12,代码来源:mtdconcat.c


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