您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CMD函数代码示例

51自学网 2021-06-01 20:02:45
  C++
这篇教程C++ CMD函数代码示例写得很实用,希望能帮到您。

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

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

示例1: exec_pipe

int	exec_pipe(char **cmd, char **env){    t_pip	p;    p.ret = 0;    if (pipe(p.fd) == -1)        return (my_putstr("QuadriSH: Error pipe./n", 2));    if ((p.pid = fork()) < 0)        return (1);    if (p.pid == 0)    {        close(p.fd[0]);        dup2(p.fd[1], 1);        my_parser(my_str_to_wordtab(CMD(cmd[0])), 1, env);        exit(0);    }    else    {        close(p.fd[1]);        dup2(p.fd[0], 0);        my_parser(my_str_to_wordtab(CMD(cmd[1])), 1, env);        wait(&p.ret);        exit(0);    }    return (p.ret);}
开发者ID:TH3Mjuss,项目名称:QuadriSH,代码行数:26,


示例2: LCD_INIT

void LCD_INIT(){DDRD=0xFF;                                                    DDRC=0xFF;PORTD=0x38;CMD ();_delay_ms(100);PORTD=0x0E;CMD ();_delay_ms(100);PORTD=0x01;CMD ();_delay_ms(100);PORTD=0x06;CMD ();_delay_ms(100);PORTD=0x80;CMD ();_delay_ms(100);PORTD=0x00;}
开发者ID:ashishrai12,项目名称:LCD_ADC_AVR,代码行数:26,


示例3: FlashSingleProgram

ReturnType FlashSingleProgram(udword udAddrOff,uCPUBusType ucValue)/***************************************************************************** INPUT(S)             :* OUTPUT(S)            :* DESIGN DOC.          :* FUNCTION DESCRIPTION :*****************************************************************************/{  uCPUBusType val;  OS_Use(&mSemaFlashDrv);  FlashWrite( 0x00555, (uCPUBusType)CMD(0x00AA) );  /* 1st cycle */  FlashWrite( 0x002AA, (uCPUBusType)CMD(0x0055) );  /* 2nd cycle */  FlashWrite( 0x00555, (uCPUBusType)CMD(0x00A0) );  /* Program command */  FlashWrite( udAddrOff,ucValue );                  /* Program value */  FlashDataToggle();  val = FlashRead( udAddrOff );  if (val != ucValue)  {    return Flash_OperationTimeOut;  }  OS_Unuse(&mSemaFlashDrv);  return Flash_Success;}
开发者ID:Strongc,项目名称:DC_source,代码行数:28,


示例4: locate_cmd

/*-------------------------------------------------------------------*/int locate_cmd(int argc, char *argv[], char *cmdline){    int rc = 0;    UNREFERENCED(cmdline);    if (argc > 1 && CMD(argv[1],sysblk,6))    {        rc = locate_sysblk(argc, argv, cmdline);    }    else    if (argc > 1 && CMD(argv[1],regs,4))    {        rc = locate_regs(argc, argv, cmdline);    }    else    if (argc > 1 && CMD(argv[1],hostinfo,4))    {        rc = locate_hostinfo(argc, argv, cmdline);    }    else    {        WRMSG( HHC02299, "E", argv[0] );        rc = -1;    }    return rc;}
开发者ID:IanWorthington,项目名称:hercules-390,代码行数:29,


示例5: setup_gpioexp_stm32

void setup_gpioexp_stm32(void){  uint8_t data[16];  int sz;  int ret;  Serial.println("starting stm32 gpio code");  ret = stm32_cmd(CMD(0, 0), NULL, 0, data, 3);  if (ret < 0) {    Serial.println("Failed to find stm32 info");  } else {    sz = data[2];    if (sz > sizeof(data)) {       Serial.println("truncating info buffer size");       sz = sizeof(data);    }          ret = stm32_cmd(CMD(0,0), NULL, 0, data, sz);    if (ret) {      Serial.println("failed to read all stm32 info");    } else {      Serial.println("Found stm32 info:");      Serial.print("Major version "); Serial.println(data[0]);      Serial.print("Minor version "); Serial.println(data[1]);    }  }}
开发者ID:HACManchester,项目名称:haccess-code,代码行数:28,


示例6: manage_env

void	manage_env(t_group *grp){	int		i;	int		j;	int		pos;	i = -1;	j = -1;	pos = list_to_tab(0, grp->first, NULL);	while (++i < grp->define_cmd[namenv] &&		CMD(cmd_split)[i + grp->define_cmd[e_opt] + 1])		pos += 1;	grp->env = (char **)malloc(sizeof(char *) * (pos + 1));	grp->env_save = (char **)malloc(sizeof(char *) * (pos + 1));	while (++j < pos + 1)	{		grp->env[j] = NULL;		grp->env_save[j] = NULL;	}	i = -1;	pos = list_to_tab(1, grp->first, &(grp->env));	while (++i < grp->define_cmd[namenv] &&		CMD(cmd_split)[i + grp->define_cmd[e_opt] + 1])	{		grp->env[pos + i] =		SDUP(CMD(cmd_split)[i + grp->define_cmd[e_opt] + 1]);	}}
开发者ID:jmontija,项目名称:21sh,代码行数:28,


示例7: shell_run

void shell_run(tree_t e, struct tree_rd_ctx *ctx){   const int ndecls = tree_decls(e);   hash_t *decl_hash = hash_new(ndecls * 2, true);   for (int i = 0; i < ndecls; i++) {      tree_t d = tree_decl(e, i);      hash_put(decl_hash, tree_ident(d), d);   }   Tcl_Interp *interp = Tcl_CreateInterp();   bool have_quit = false;   Tcl_CreateExitHandler(shell_exit_handler, &have_quit);   shell_cmd_t shell_cmds[] = {      CMD(quit,      &have_quit, "Exit simulation"),      CMD(run,       ctx,        "Start or resume simulation"),      CMD(restart,   NULL,       "Restart simulation"),      CMD(show,      decl_hash,  "Display simulation objects"),      CMD(help,      shell_cmds, "Display this message"),      CMD(copyright, NULL,       "Display copyright information"),      CMD(signals,   e,          "Find signal objects in the design"),      CMD(now,       NULL,       "Display current simulation time"),      CMD(watch,     decl_hash,  "Trace changes to a signal"),      CMD(unwatch,   decl_hash,  "Stop tracing signals"),      { NULL, NULL, NULL, NULL}   };   qsort(shell_cmds, ARRAY_LEN(shell_cmds) - 1, sizeof(shell_cmd_t),         compare_shell_cmd);   for (shell_cmd_t *c = shell_cmds; c->name != NULL; c++)      Tcl_CreateObjCommand(interp, c->name, c->fn, c->cd, NULL);   show_banner();   slave_post_msg(SLAVE_RESTART, NULL, 0);   char *line;   while (!have_quit && (line = shell_get_line())) {      switch (Tcl_Eval(interp, line)) {      case TCL_OK:         break;      case TCL_ERROR:         errorf("%s", Tcl_GetStringResult(interp));         break;      default:         assert(false);      }      free(line);   }   Tcl_Exit(EXIT_SUCCESS);}
开发者ID:a4a881d4,项目名称:nvc,代码行数:57,


示例8: my_commands

static void my_commands (void){	extern int nsp (int argc, char *argv[]);	extern int psp (int argc, char *argv[]);	extern int keysp (int argc, char *argv[]);	CMD(ns,		"# list nodes");	CMD(ps,		"# list processes and avatars");	CMD(keys,	"# list processes and keys");}
开发者ID:taysom,项目名称:tau,代码行数:10,


示例9: init_dir

void init_dir (void){	int		rc;	rc = sw_local("dir_cmd", &Dir_key);	if (rc) failure("sw_local", rc);	CMD(cr,		"<path> # create a dir entry");	CMD(prtree,	"# have dirfs print full directory tree");	CMD(prbackup,	"# have dirfs print backup tree");	CMD(rd,		"[inode num]+ # get and print a dir");	CMD(ls,		"# list dir tree");}
开发者ID:taysom,项目名称:tau,代码行数:13,


示例10: handleCommand

void handleCommand(string command){	hC_begin	CMD("look")		cout << "You see:" << endl;		for (unsigned i = 0; i < stuff.size(); i++)			cout << " * " << stuff[i] << endl;	CMD("open")		if (args[1] == "door")			if (has_item("key"))			{				cout << "The door opened!" << endl;				ACHIEVE(DOOR_OPEN);				goNextLevel();			}			else				cout << "The door is locked!" << endl;	CMD("take")		if (args[1] == "comment")		{			if (has_achievement(EA_CAPTCHA)) {				FIND("comment");			} else				cout << "You can't! It's not your's!" << endl;		}		if (args[1] == "captcha")			FIND("captcha");	CMD("say")		if (args[1] == "captcha")			if (has_item("captcha"))			{				cout << "Man, that captcha was lamer than i thought!" << endl;				ACHIEVE(CAPTCHA);			}			else				cout << "What does that captcha say? I don't know!" << endl;	CMD("post")		if (args[1] == "comment")			if (has_item("comment"))			{				FIND("key");				ACHIEVE(COMMENT);			}			else				cout << "You can't! It's not your's!" << endl;	CMD("help")		cout << "The following commands are availeble:" << endl << " * look/n * open/n * take/n * say/n * post/n";	hC_end}
开发者ID:roelforg,项目名称:textgame,代码行数:51,


示例11: main

int main(int argc, const char **argv){    setlocale(LC_ALL, "");    /* Hack:     * Right-to-left scripts don't work properly in many terminals.     * Hebrew speaking people say he_IL.utf8 looks so mangled     * they prefer en_US.utf8 instead.     */    const char *msg_locale = setlocale(LC_MESSAGES, NULL);    if (msg_locale && strcmp(msg_locale, "he_IL.utf8") == 0)        setlocale(LC_MESSAGES, "en_US.utf8");#if ENABLE_NLS    bindtextdomain(PACKAGE, LOCALEDIR);    textdomain(PACKAGE);#endif    abrt_init((char **)argv);    argv++;    argc--;    const char *abrt_cli_usage_string = _(                                            "Usage: abrt-cli [--version] COMMAND [DIR]..."                                        );    const struct cmd_struct commands[] = {        CMD(list, _("List problems [in DIRs]")),        CMD(rm, _("Remove problem directory DIR")),        CMD(report, _("Analyze and report problem data in DIR")),        CMD(info, _("Print information about DIR")),        CMD(status, _("Print the count of the recent crashes")),        {NULL, NULL, NULL}    };    migrate_to_xdg_dirs();    unsigned skip = handle_internal_options(argc, argv, abrt_cli_usage_string);    argc -= skip;    argv += skip;    if (argc > 0)        handle_internal_command(argc, argv, commands);    /* user didn't specify command; print out help */    printf("%s/n/n", abrt_cli_usage_string);    list_cmds_help(commands);    printf("/n%s/n", _("See 'abrt-cli COMMAND --help' for more information"));    return 0;}
开发者ID:shlomif,项目名称:abrt,代码行数:49,


示例12: st7565Init

void st7565Init(FONT_DEF_STRUCT * font){  // Note: This can be optimised to set all pins to output and high  // in two commands by manipulating the registers directly (assuming  // that the pins are located in the same GPIO bank).  The code is left  // as is for clarity sake in case the pins are not all located in the  // same bank.	ST7565_CS_DIR	 		= OUTPUT;	ST7565_RST_DIR	 	= OUTPUT;	ST7565_A0_DIR	 		= OUTPUT;	ST7565_SCL_DIR	 	= OUTPUT;	ST7565_SDA_DIR	 	= OUTPUT;	ST7565_SDA = 1;  ST7565_SCL = 1;	ST7565_A0  = 1;	ST7565_RST = 1;	ST7565_CS  = 1;  // Reset	ST7565_CS  = 0;	ST7565_RST = 0;	_delay_ms(500);	ST7565_RST = 1;	currentFont = font;  // Configure Display  //CMD(ST7565_CMD_SET_BIAS_7);                       // LCD Bias Select									0xA3		0xA2  CMD(ST7565_CMD_SET_BIAS_9);                         // LCD Bias Select									0xA3		0xA2  CMD(ST7565_CMD_SET_ADC_NORMAL);                     // ADC Select												0xA0		0xA6  CMD(ST7565_CMD_SET_COM_NORMAL);                     // SHL Select												0xC0		0xc8  //CMD(ST7565_CMD_SET_COM_REVERSE);                     // SHL Select												0xC0		0xc8  CMD(ST7565_CMD_SET_DISP_START_LINE);                // Initial Display Line							0x40		0x40  CMD(ST7565_CMD_SET_POWER_CONTROL | 0x04);           // Turn on voltage converter (VC=1, VR=0, VF=0)			0x28		0x24  _delay_ms(50);                											// Wait 50mS  CMD(ST7565_CMD_SET_POWER_CONTROL | 0x06);           // Turn on voltage regulator (VC=1, VR=1, VF=0)  _delay_ms(50);                											// Wait 50mS  CMD(ST7565_CMD_SET_POWER_CONTROL | 0x07);           // Turn on voltage follower  _delay_ms(10);                											// Wait 10mS  CMD(ST7565_CMD_SET_RESISTOR_RATIO | 0x6);           // Set LCD operating voltage  // Turn display on  CMD(ST7565_CMD_DISPLAY_ON);													// 0xAF  CMD(ST7565_CMD_SET_ALLPTS_NORMAL);									// 0xA4  st7565SetBrightness(0x11);	// 0x18}
开发者ID:bytepicker,项目名称:kk20,代码行数:48,


示例13: bot_disconnect

int bot_disconnect(struct bot* b){	printf("Dying.../n");	CMD(b->conn, "PRIVMSG", NULL, "EXIT CBOT is dying.");	globalkill=1;	return 0;}
开发者ID:Detegr,项目名称:CBot,代码行数:7,


示例14: writeBuffer

void writeBuffer(uint8_t *buffer) {  uint8_t c, p;  for(p = 0; p < 8; p++)   {    CMD(ST7565_CMD_SET_PAGE | (7-p));//    CMD(ST7565_CMD_SET_PAGE | (p));      CMD(ST7565_CMD_SET_COLUMN_LOWER | (0x0 & 0xf));    CMD(ST7565_CMD_SET_COLUMN_UPPER | ((0x0 >> 4) & 0xf));    CMD(ST7565_CMD_RMW);        for(c = 0; c < 128; c++)     {      DATA(buffer[(128*p)+c]);    }  }}
开发者ID:bytepicker,项目名称:kk20,代码行数:18,


示例15: stm32_gpio_set

extern int stm32_gpio_set(unsigned int gpio, unsigned int state){  uint8_t data;  int ret;    data = (gpio << 3) | (state ? 1 : 0);  ret = stm32_cmd(CMD(STM_CMD_SET, 0), &data, 1, NULL, 0);  return ret;}
开发者ID:HACManchester,项目名称:haccess-code,代码行数:9,


示例16: init_cmd

void init_cmd (void){	CMD(q,     "         # quit");	CMD(inuse, "         # dump inuse cache buffers");	CMD(gen,   "[n]      # generate n random directories, defaults to 10");	CMD(mkdir, "<name>*  # create the named directories");	CMD(ls,    "<name>*  # list content of directories");	CMD(inodes,"         # list content of directories");	CMD(cr,    "<name>+  # create the named files");	CMD(rw,    "<name>+  # read/write test of given files");}
开发者ID:wtaysom,项目名称:tau,代码行数:11,


示例17: bot_connect

int bot_connect(struct bot* b, const char* server, unsigned int port){	if(conn_connect(b->conn, server, port)==0)	{		const char** nick = config_getvals(b->conf, "nick");		const char** realname = config_getvals(b->conf, "realname");		CMD(b->conn, "NICK", NULL, *nick);		char name[64]; *name=0;		concat(name, 5, *nick, " ", *nick, " * :", *realname);		CMD(b->conn, "USER", NULL, name);		return 0;	}	else	{		fprintf(stderr, "Couldn't connect to %s:%d/n", server, port);		return -1;	}}
开发者ID:Detegr,项目名称:CBot,代码行数:20,


示例18: mpu401_uninit

intmpu401_uninit(struct mpu401 *m){	int retval;	CMD(m, MPU_RESET);	retval = midi_uninit(m->mid);	if (retval)		return retval;	free(m, M_MIDI);	return 0;}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:12,


示例19: define_arg_cmd

void	define_arg_cmd(t_group *grp){	int	i;	i = 0;	while (CMD(cmd_split) && CMD(cmd_split)[++i])	{		if (CMD(cmd_split)[i][0] == '-' &&			grp->define_cmd[namenv] == false &&			grp->define_cmd[utils] == false)			grp->define_cmd[e_opt] = i;		else if (is_env(CMD(cmd_split)[i]) > 0 &&			grp->define_cmd[utils] == false)			grp->define_cmd[namenv] = i;		else		{			grp->define_cmd[utils] = i;			break ;		}	}}
开发者ID:jmontija,项目名称:21sh,代码行数:21,


示例20: bot_execcmd

int bot_execcmd(struct bot* b, char* msg){	char* p = strstr(msg, " ");	if(p)	{		*p=0;		CMD(b->conn, msg, NULL, ++p);		//printf("CMD: %s, TOKEN: %s/n", msg, p);		return 0;		}	return -1;}
开发者ID:Detegr,项目名称:CBot,代码行数:12,


示例21: main

void main(void){ double a,b; unsigned int c,i; char f[4]; LCD_INIT(); _delay_ms(10); DDRA=0x00; sei(); ADMUX=0x00; ADMUX|=(1<<ADLAR); ADCSRA=0xCF;	 DDRB=0xFF;	 PORTB=0x00; PORTD=0x00;while(1){	a=ADCH;	b=((a/255)*5);		itoa(b,f,10);	for(i=0;i<3;i++)	{	PORTD=f[i];	_delay_ms(5);	DATA();			}		_delay_ms(1000);	PORTD=0x01;	CMD ();		_delay_ms(100);}}
开发者ID:ashishrai12,项目名称:LCD_ADC_AVR,代码行数:53,


示例22: testReadWrite

static void testReadWrite() {	int32_t ret;	{		ret = sd_setBlockSize(sd, SD_BLOCK_SIZE_512B);		CONFIG_ASSERT(ret == 0);#if 1		memset(data, 0x42, ARRAY_SIZE(data));		/* read 4K from card */		ret = sd_read(sd, CMD(18), 0, ARRAY_SIZE(data), (uint32_t *) data, 1000 / portTICK_PERIOD_MS);		CONFIG_ASSERT(ret == 0);		/* stop transver */		ret = sd_sendCommand(sd, CMD(12), 0, NULL, 100 / portTICK_PERIOD_MS);		CONFIG_ASSERT(ret == 0);#else		memset(data, 0x00, ARRAY_SIZE(data));#endif		/* Write Back test */		ret = sd_write(sd, CMD(25), 0, ARRAY_SIZE(data), (uint32_t *) data, 1000 / portTICK_PERIOD_MS);		CONFIG_ASSERT(ret == 0);		/* stop transver */		ret = sd_sendCommand(sd, CMD(12), 0, NULL, 100 / portTICK_PERIOD_MS);		CONFIG_ASSERT(ret == 0);		vTaskDelay(500 / portTICK_PERIOD_MS);		/* read 4K from card */		ret = sd_read(sd, CMD(18), 0, ARRAY_SIZE(data2), (uint32_t *) data2, 1000 / portTICK_PERIOD_MS);		CONFIG_ASSERT(ret == 0);		/* stop transver */		ret = sd_sendCommand(sd, CMD(12), 0, NULL, 100 / portTICK_PERIOD_MS);		CONFIG_ASSERT(ret == 0);		ret = memcmp(data, data2, ARRAY_SIZE(data));		CONFIG_ASSERT(ret == 0);	}}
开发者ID:FreeRTOSHAL,项目名称:testsystem,代码行数:34,


示例23: LCD_INIT

void LCD_INIT(){PORTC=0x38;CMD ();_delay_ms(10);PORTC=0x0C;CMD ();_delay_ms(10);PORTC=0x01;CMD ();_delay_ms(10);PORTC=0x06;CMD ();_delay_ms(10);PORTC=0x80;CMD ();_delay_ms(10);PORTC='v';DATA ();_delay_ms(10);PORTC='=';DATA ();_delay_ms(10);PORTC=0x85;CMD ();_delay_ms(10);}
开发者ID:ashishrai12,项目名称:LCD_ADC_AVR,代码行数:29,


示例24: Hooks_ObScript_Init

void Hooks_ObScript_Init(void){	// read vanilla commands	g_commandTable.Init(0x1000, 0x1480);	g_commandTable.Read(g_scriptCommandsStart, g_scriptCommandsEnd);	// pad to 0x1400 to give bethesda room	// pretty sure obscript is dead, but eh be safe	while(g_commandTable.GetID() < 0x1400)		g_commandTable.Add();	// add our commands#define CMD(name)	g_commandTable.Add(&kCommandInfo_##name)	CMD(GetSKSEVersion);	CMD(GetSKSEVersionMinor);	CMD(GetSKSEVersionBeta);	CMD(GetSKSERelease);	CMD(ClearInvalidRegistrations);#ifdef _DEBUG	CMD(SKSETestFunc);#endif#undef CMD	g_commandTable.Add();	// padding command}
开发者ID:RealAntithesis,项目名称:JContainers,代码行数:29,


示例25: mpu401_minit

static intmpu401_minit(struct snd_midi *sm, void *arg){	struct mpu401 *m = arg;	int i;	CMD(m, MPU_RESET);	CMD(m, MPU_UART);	return 0;	i = 0;	while (++i < 2000) {		if (RXRDY(m))			if (READ(m) == MPU_ACK)				break;	}	if (i < 2000) {		CMD(m, MPU_UART);		return 0;	}	printf("mpu401_minit failed active sensing/n");	return 1;}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:23,


示例26: main

int main (int argc, char *argv[]){	debugenv();	setprogname(argv[0]);	init_shell(NULL);	init_net();	init_sage();	init_dir();	init_test();	CMD(test, "# test function");	return shell();}
开发者ID:taysom,项目名称:tau,代码行数:15,


示例27: read_block

byte read_block(byte* buf,dword addr){  int i;  byte c;  byte r1;    if (addr % 512 != 0)  {    #if DEBUG    pmsg("read_block: Address 0x"); disdword(addr);      pmsg("is not aligned to a 512 byte block!/r/n");    #endif    return 0;  }    #if DEBUG  pmsg("Reading block at address 0x"); disdword(addr); pmsg("/r/n");  #endif    r1=CMD(17,addr);    for (i=0;i<50;i++)     // wait until the data is found  {    if (r1==0x00) break;    r1 = SPI_Byte(0xFF);  }  if (r1!=0x00)  {    #if DEBUG    pmsg("Read block timed out!/r/n");    #endif    return 0;   }      c = SPI_Byte(0xFF);  while (c!=0xFE)  {    c=SPI_Byte(0xFF);  } // wait for the "data follows" code  for (i=0;i<512;i++)  {        *(buf++)=SPI_Byte(0xFF);   }  c=SPI_Byte(0xFF);  c=SPI_Byte(0xFF);  // dummy bytes to clear any queues  return 1;}
开发者ID:caskeep,项目名称:Freescale-SD-FAT-Library,代码行数:48,


示例28: FlashBlockErase

ReturnType FlashBlockErase(uBlockType ublBlockNr)/***************************************************************************** INPUT(S)             :* OUTPUT(S)            :* DESIGN DOC.          :* FUNCTION DESCRIPTION :*****************************************************************************/{  ReturnType rRetVal = Flash_Success;    /* Holds return value: optimistic initially! */  OS_Use(&mSemaFlashDrv);  FlashWrite( 0x00555, (uCPUBusType)CMD(0x00AA) );  FlashWrite( 0x002AA, (uCPUBusType)CMD(0x0055) );  FlashWrite( 0x00555, (uCPUBusType)CMD(0x0080) );  FlashWrite( 0x00555, (uCPUBusType)CMD(0x00AA) );  FlashWrite( 0x002AA, (uCPUBusType)CMD(0x0055) );  FlashWrite( BlockOffset[ublBlockNr], (uCPUBusType)CMD(0x0030) );  FlashTimeOut(0);  while( !(FlashRead( BlockOffset[ublBlockNr] ) & CMD(0x0008) ) )  {    if (FlashTimeOut(5) == Flash_OperationTimeOut)    {      FlashWrite( ANY_ADDR, (uCPUBusType)CMD(0x00F0) ); /* Use single instruction cycle method */      return Flash_OperationTimeOut;    }  }  if( FlashDataToggle() !=  Flash_Success )  {    FlashWrite( ANY_ADDR, (uCPUBusType)CMD(0x00F0) ); /* Use single instruction cycle method */    rRetVal=Flash_BlockEraseFailed;  }  OS_Unuse(&mSemaFlashDrv);  return rRetVal;}
开发者ID:Strongc,项目名称:DC_source,代码行数:40,


示例29: write_block

byte write_block(byte* data, dword addr){  byte c;  short i;    if (addr % 512 != 0)  {    #if DEBUG    pmsg("write_block: Address 0x"); disdword(addr);      pmsg("is not aligned to a 512 byte block!/r/n");    #endif    return 0;  }    #if DEBUG  pmsg("Writing block at address 0x"); disdword(addr); pmsg("/r/n");  #endif    if (CMD(24,addr) != 0)   {    #if DEBUG    pmsg("Failed to write block!/r/n");    #endif     return 0;  }  c=SPI_Byte(0xFF); c=SPI_Byte(0xFF); c=SPI_Byte(0xFE); // lead in to actual data  for (i=0;i<BLOCKSIZE;i++) c=SPI_Byte(data[i]);  c=SPI_Byte(0xFF); c=SPI_Byte(0xFF); // dummy before response recieved  c=SPI_Byte(0xFF); c&=0x1F; // bit mask for write error codes   // see http://elm-chan.org/docs/mmc/mmc_e.html  if (c!=0x05)  {    #if DEBUG    pmsg("Failed to write block!/r/n");    #endif    return 0;   }  while (SPI_Byte(0xFF)!=0xFF);  // block until write finished    return 1;}
开发者ID:caskeep,项目名称:Freescale-SD-FAT-Library,代码行数:41,



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


C++ CMDQ_ERR函数代码示例
C++ CL_WritePacket函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。