这篇教程C++ CONCAT函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CONCAT函数的典型用法代码示例。如果您正苦于以下问题:C++ CONCAT函数的具体用法?C++ CONCAT怎么用?C++ CONCAT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CONCAT函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CONCATstatic 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,
示例2: BitBangSPI_Send_Byte/*============================================================================Name : BitBangSPI_Send_Byte------------------------------------------------------------------------------Purpose : Send and Read one byte using BitBangSPI InterfaceInput : Data to send to slaveOutput : Data read from slaveNotes : 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,
示例3: concat_unlockstatic 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,
示例4: concat_block_isbadstatic 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,
示例5: concat_block_markbadstatic 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,
示例6: mtd_concat_destroyvoid 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,
示例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,
示例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,
示例9: SPI_Master_Init/*============================================================================Name : SPI_Master_Init------------------------------------------------------------------------------Purpose : Initialize SPI InterfaceInput : n/aOutput : n/aNotes : 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,
示例10: concat_read_eccstatic intconcat_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,
示例11: concat_read_oobstatic intconcat_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,
示例12: concat_resumestatic 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,
示例13: concat_readstatic intconcat_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,
示例14: BitBangSPI_Master_Init/*============================================================================Name : BitBangSPI_Master_Init------------------------------------------------------------------------------Purpose : Initialize BitBangSPI InterfaceInput : n/aOutput : n/aNotes : 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,
示例15: concat_suspendstatic 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,
示例16: concat_write_eccstatic intconcat_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char * buf, u_char * eccbuf, struct nand_oobinfo *oobsel){ struct mtd_concat *concat = CONCAT(mtd); int err = -EINVAL; int i; if (!(mtd->flags & MTD_WRITEABLE)) return -EROFS; *retlen = 0; for (i = 0; i < concat->num_subdev; i++) { struct mtd_info *subdev = concat->subdev[i]; size_t size, retsize; if (to >= subdev->size) { size = 0; to -= subdev->size; continue; } if (to + len > subdev->size) size = subdev->size - to; else size = len; if (!(subdev->flags & MTD_WRITEABLE)) err = -EROFS; else if (subdev->write_ecc) err = subdev->write_ecc(subdev, to, 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; to = 0; } return err;}
开发者ID:jhbsz,项目名称:MI424WR_GEN2_Rev_E-F,代码行数:52,
示例17: add_hooksstatic BOOL add_hooks(){ wchar_t curFile[512]; GetModuleFileNameW(NULL, curFile, 512); wstring f = strlower(wstring(curFile)); // bail immediately if we're in a system process. We don't want to hook, log, anything - // this instance is being used for a shell extension. if(f.find(L"dllhost.exe") != wstring::npos || f.find(L"explorer.exe") != wstring::npos) {#ifndef _RELEASE OutputDebugStringA("Hosting " STRINGIZE(RDOC_DLL_FILE) ".dll in shell process/n");#endif return TRUE; } if(f.find(CONCAT(L, STRINGIZE(RDOC_DLL_FILE)) L"cmd.exe") != wstring::npos || f.find(CONCAT(L, STRINGIZE(RDOC_DLL_FILE)) L"ui.vshost.exe") != wstring::npos || f.find(L"q" CONCAT(L, STRINGIZE(RDOC_DLL_FILE)) L".exe") != wstring::npos || f.find(CONCAT(L, STRINGIZE(RDOC_DLL_FILE)) L"ui.exe") != wstring::npos) { RDCDEBUG("Not creating hooks - in replay app"); RenderDoc::Inst().SetReplayApp(true); RenderDoc::Inst().Initialise(); return true; } RenderDoc::Inst().Initialise(); RDCLOG("Loading into %ls", curFile); LibraryHooks::GetInstance().CreateHooks(); return TRUE;}
开发者ID:kvark,项目名称:renderdoc,代码行数:39,
示例18: BitBangSPI_Master_Init/** * /brief Initialize BitBangSPI Interface. */void BitBangSPI_Master_Init(void){#if SAM3N CONCAT(PORT, SPI_BB, _OER) = ((1 << MOSI_BB) | (1 << SCK_BB) | (1 << PIO_SS)); CONCAT(PORT, SPI_BB, _ODR) = (1 << MISO_BB); CONCAT(PORT, SPI_BB, _CODR) = ((1 << MOSI_BB) | (1 << SCK_BB) | (1 << PIO_SS)); CONCAT(PORT, SPI_BB, _SODR) = (1 << MISO_BB);#else CONCAT(PORT, SPI_BB, _OER) = ((1 << MOSI_BB) | (1 << SCK_BB)); CONCAT(PORT, SPI_BB, _ODR) = (1 << MISO_BB); CONCAT(PORT, SPI_BB, _CODR) = ((1 << MOSI_BB) | (1 << SCK_BB)); CONCAT(PORT, SPI_BB, _SODR) = (1 << MISO_BB);#endif}
开发者ID:InSoonPark,项目名称:asf,代码行数:19,
示例19: BitBangSPI_Send_Byte/** * /brief Send and Read one byte using BitBangSPI Interface. * * /param c Data to send to slave. * * /return Data read from slave. */static uint8_t BitBangSPI_Send_Byte(uint8_t c){ uint32_t bit; volatile uint32_t i; for (bit = 0; bit < 8; bit++) { /* Write MOSI on trailing edge of previous clock */ if (c & 0x80) { CONCAT(PORT, SPI_BB, _SODR) = (1 << MOSI_BB); } else { CONCAT(PORT, SPI_BB, _CODR) = (1 << MOSI_BB); } c <<= 1; /* Half a clock cycle before leading/rising edge */ DELAY1US(); CONCAT(PORT, SPI_BB, _SODR) = (1 << SCK_BB); /* Half a clock cycle before trailing/falling edge */ DELAY1US(); /* Read MISO on trailing edge */ c |= ((CONCAT(PORT, SPI_BB, _PDSR) >> MISO_BB) & 0x01); CONCAT(PORT, SPI_BB, _CODR) = (1 << SCK_BB); } CONCAT(PORT, SPI_BB, _CODR) = (1 << MOSI_BB); for (i = 0; i < 50; i++) { DELAY50US(); } return c;}
开发者ID:InSoonPark,项目名称:asf,代码行数:43,
示例20: concat_read_oobstatic intconcat_read_oob(struct mtd_info *mtd, loff_t from, size_t len, size_t * retlen, u_char * buf){ 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_oob) err = subdev->read_oob(subdev, from, size, &retsize, buf); else err = -EINVAL; if (err) break; *retlen += retsize; len -= size; if (len == 0) break; err = -EINVAL; buf += size; from = 0; } return err;}
开发者ID:jhbsz,项目名称:MI424WR_GEN2_Rev_E-F,代码行数:47,
示例21: concat_write_oobstatic intconcat_write_oob(struct mtd_info *mtd, loff_t to, struct mtd_oob_ops *ops){ struct mtd_concat *concat = CONCAT(mtd); struct mtd_oob_ops devops = *ops; int i, err; if (!(mtd->flags & MTD_WRITEABLE)) return -EROFS; ops->retlen = 0; for (i = 0; i < concat->num_subdev; i++) { struct mtd_info *subdev = concat->subdev[i]; if (to >= subdev->size) { to -= subdev->size; continue; } /* partial write ? */ if (to + devops.len > subdev->size) devops.len = subdev->size - to; err = subdev->write_oob(subdev, to, &devops); ops->retlen += devops.retlen; if (err) return err; if (devops.datbuf) { devops.len = ops->len - ops->retlen; if (!devops.len) return 0; devops.datbuf += devops.retlen; } if (devops.oobbuf) { devops.ooblen = ops->ooblen - ops->oobretlen; if (!devops.ooblen) return 0; devops.oobbuf += devops.oobretlen; } to = 0; } return -EINVAL;}
开发者ID:274914765,项目名称:C,代码行数:45,
示例22: concat_writestatic intconcat_write(struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char * buf){ struct mtd_concat *concat = CONCAT(mtd); int err = -EINVAL; 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 (to >= subdev->size) { size = 0; to -= subdev->size; continue; } if (to + len > subdev->size) size = subdev->size - to; else size = len; err = mtd_write(subdev, to, size, &retsize, buf); if (err) break; *retlen += retsize; len -= size; if (len == 0) break; err = -EINVAL; buf += size; to = 0; } return err;}
开发者ID:Noltari,项目名称:u-boot,代码行数:41,
示例23: 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; } return mtd_get_unmapped_area(subdev, len, offset, flags); } return (unsigned long) -ENOSYS;}
开发者ID:Noltari,项目名称:u-boot,代码行数:25,
示例24: concat_block_isbadstatic int concat_block_isbad(struct mtd_info *mtd, loff_t ofs){ struct mtd_concat *concat = CONCAT(mtd); int i, res = 0; if (!mtd_can_have_bb(concat->subdev[0])) return res; for (i = 0; i < concat->num_subdev; i++) { struct mtd_info *subdev = concat->subdev[i]; if (ofs >= subdev->size) { ofs -= subdev->size; continue; } res = mtd_block_isbad(subdev, ofs); break; } return res;}
开发者ID:Noltari,项目名称:u-boot,代码行数:22,
示例25: 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){ struct port_config config_port_pin; port_get_config_defaults(&config_port_pin); config_port_pin.direction = PORT_PIN_DIR_OUTPUT; port_pin_set_config(CONCAT(PIN_P, SPI_BB_SS, SS_BB), &config_port_pin); port_pin_set_config(CONCAT(PIN_P, SPI_BB_MOSI,MOSI_BB), &config_port_pin); port_pin_set_config(CONCAT(PIN_P, SPI_BB_SCK,SCK_BB), &config_port_pin); config_port_pin.direction = PORT_PIN_DIR_INPUT; config_port_pin.input_pull = PORT_PIN_PULL_UP; port_pin_set_config(CONCAT(PIN_P, SPI_BB_MISO,MISO_BB), &config_port_pin); port_pin_set_output_level(CONCAT(PIN_P, SPI_BB_SS, SS_BB), 0u); port_pin_set_output_level(CONCAT(PIN_P, SPI_BB_MISO, MISO_BB), 1u); port_pin_set_output_level(CONCAT(PIN_P, SPI_BB_MOSI, MOSI_BB), 0u); port_pin_set_output_level(CONCAT(PIN_P, SPI_BB_SCK, SCK_BB), 0u);}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:32,
示例26: 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){ uint32_t bit; bool i; for (bit = 0u; bit < 8u; bit++) { /* write MOSI on trailing edge of previous clock */ if (c & 0x80u) { port_pin_set_output_level(CONCAT(PIN_P, SPI_BB_MOSI, MOSI_BB), 1u); } else { port_pin_set_output_level(CONCAT(PIN_P, SPI_BB_MOSI, MOSI_BB), 0u); } c <<= 1u; /* half a clock cycle before leading/rising edge */ cpu_delay_us(1u); /* SHOULD BE ~3uS. */ port_pin_set_output_level(CONCAT(PIN_P, SPI_BB_SCK, SCK_BB), 1u); /* half a clock cycle before trailing/falling edge */ cpu_delay_us(1u); /* SHOULD BE ~3uS. */ /* read MISO on trailing edge */ i = (port_pin_get_input_level(CONCAT(PIN_P, SPI_BB_MISO, MISO_BB))); if (i == true) { c |= (0x01u); } else { } port_pin_set_output_level(CONCAT(PIN_P, SPI_BB_SCK, SCK_BB), 0u); } port_pin_set_output_level(CONCAT(PIN_P, SPI_BB_MOSI, MOSI_BB), 0u); cpu_delay_us(50u); /* SHOULD BE ~18uS. */ return c;}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:47,
注:本文中的CONCAT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CONFIG函数代码示例 C++ COM_ParseString函数代码示例 |