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

C++ cfs_open函数代码示例

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

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



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

示例1: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(handle_output(struct httpd_state *s))
{
  PT_BEGIN(&s->outputpt);

  petsciiconv_topetscii(s->filename, sizeof(s->filename));
  s->fd = cfs_open(s->filename, CFS_READ);
  petsciiconv_toascii(s->filename, sizeof(s->filename));
  if(s->fd < 0) {
    strcpy(s->filename, "notfound.html");
    s->fd = cfs_open(s->filename, CFS_READ);
    petsciiconv_toascii(s->filename, sizeof(s->filename));
    if(s->fd < 0) {
      PT_WAIT_THREAD(&s->outputpt,
                     send_headers(s, http_header_404));
      PT_WAIT_THREAD(&s->outputpt,
                     send_string(s, "not found"));
      uip_close();
      webserver_log_file(&uip_conn->ripaddr, "404 (no notfound.html)");
      PT_EXIT(&s->outputpt);
    }
    PT_WAIT_THREAD(&s->outputpt,
		   send_headers(s, http_header_404));
    webserver_log_file(&uip_conn->ripaddr, "404 - notfound.html");
  } else {
    PT_WAIT_THREAD(&s->outputpt,
		   send_headers(s, http_header_200));
  }
  PT_WAIT_THREAD(&s->outputpt, send_file(s));
  cfs_close(s->fd);
  s->fd = -1;
  PSOCK_CLOSE(&s->sout);
  PT_END(&s->outputpt);
}
开发者ID:arbraham,项目名称:hummingbird,代码行数:35,代码来源:httpd-cfs.c


示例2: write_chunk

/*---------------------------------------------------------------------------*/
static void
write_chunk(struct rudolph2_conn *c, int offset, int flag,
	    uint8_t *data, int datalen)
{
  int fd;
#if CONTIKI_TARGET_NETSIM
  {
    char buf[100];
    sprintf(buf, "%d%%", (100 * (offset + datalen)) / FILESIZE);
    ether_set_text(buf);
  }
#endif /* CONTIKI_TARGET_NETSIM */

  if(flag == RUDOLPH2_FLAG_NEWFILE) {
    printf("+++ rudolph2 new file incoming at %lu\n", clock_time());
    leds_on(LEDS_RED);
    fd = cfs_open("codeprop.out", CFS_WRITE);
  } else {
    fd = cfs_open("codeprop.out", CFS_WRITE + CFS_APPEND);
  }
  
  if(datalen > 0) {
    int ret;
    cfs_seek(fd, offset, CFS_SEEK_SET);
    ret = cfs_write(fd, data, datalen);
    printf("+++ rudolph2 offset %d, length %d\n", offset, datalen);
  }

  cfs_close(fd);

  if(flag == RUDOLPH2_FLAG_LASTCHUNK) {
    int i;
    printf("+++ rudolph2 entire file received at %d, %d\n",
	   rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1]);
    leds_off(LEDS_RED);
    leds_on(LEDS_YELLOW);

    fd = cfs_open("hej", CFS_READ);
    for(i = 0; i < FILESIZE; ++i) {
      unsigned char buf;
      int r = cfs_read(fd, &buf, 1);
      if (r != 1) {
	printf("%d.%d: error: read failed at %d\n",
	       rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
	       i);
	break;
      }       
      else if(buf != (unsigned char)i) {
	printf("%d.%d: error: diff at %d, %d != %d\n",
	       rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
	       i, (unsigned char)i, buf);
	break;
      }
    }
#if CONTIKI_TARGET_NETSIM
    ether_send_done();
#endif
    cfs_close(fd);
  }
}
开发者ID:Contiki-leoqin,项目名称:contiki,代码行数:61,代码来源:example-rudolph2.c


示例3: PROCESS_THREAD

PROCESS_THREAD(cfs_write_test, ev, data) {
    PROCESS_BEGIN();

    char str[20], str2[20];
    strcpy(str, "Vot bl'a nahuj!");

    int fd = cfs_open("a", CFS_WRITE);
    if (fd == -1) {
        cfs_close(fd);
        fd = cfs_open("a", CFS_WRITE);
        if (fd == -1) {
            alarma(5);
        }
    }
    cfs_write(fd, (void *)str, strlen(str));
    cfs_close(fd);

    fd = cfs_open("a", CFS_READ);
    cfs_read(fd, (void *)str2, strlen(str));
    cfs_close(fd);

    strcat(str2, " Da yopt!");

    fd = cfs_open("a", CFS_WRITE);
    cfs_write(fd, (void *)str2, strlen(str2));
    cfs_close(fd);

    ledd_on(PB5);
    PROCESS_END();
}
开发者ID:project-master-device,项目名称:project-master-device,代码行数:30,代码来源:eeprom_write_contiki_test.c


示例4: PT_THREAD

/*---------------------------------------------------------------------------*/
static
PT_THREAD(handle_output(struct httpd_state *s))
{
  PT_BEGIN(&s->outputpt);

  s->fd = cfs_open(s->filename, CFS_READ);
  if(s->fd < 0) {
    s->fd = cfs_open("404.html", CFS_READ);
    if(s->fd < 0) {
      uip_abort();
      PT_EXIT(&s->outputpt);
    }
    PT_WAIT_THREAD(&s->outputpt,
		   send_headers(s, "HTTP/1.0 404 Not found\r\n"));
    PT_WAIT_THREAD(&s->outputpt,
		   send_file(s));
  } else {
    PT_WAIT_THREAD(&s->outputpt,
		   send_headers(s, "HTTP/1.0 200 OK\r\n"));
    PT_WAIT_THREAD(&s->outputpt,
		   send_file(s));
    cfs_close(s->fd);
  }
  PSOCK_CLOSE(&s->sout);
  PT_END(&s->outputpt);
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:27,代码来源:httpd-cfs.c


示例5: apply_tcpipconfig

/*-----------------------------------------------------------------------------------*/
static void
apply_tcpipconfig(void)
{
  int file = cfs_open("contiki.cfg", CFS_READ);
  int size = cfs_read(file, uip_buf, 100);
  cfs_close(file);

  nullterminate(ipaddr);
  uiplib_ipaddrconv(ipaddr, (uip_ipaddr_t *)&uip_buf[0]);

  nullterminate(netmask);
  uiplib_ipaddrconv(netmask, (uip_ipaddr_t *)&uip_buf[4]);

  nullterminate(gateway);
  uiplib_ipaddrconv(gateway, (uip_ipaddr_t *)&uip_buf[8]);
  
#if WITH_DNS
  nullterminate(dnsserver);
  uiplib_ipaddrconv(dnsserver, (uip_ipaddr_t *)&uip_buf[12]);
#endif /* WITH_DNS */

  file = cfs_open("contiki.cfg", CFS_WRITE);
  cfs_write(file, uip_buf, size);
  cfs_close(file);
}
开发者ID:AWRyder,项目名称:contiki,代码行数:26,代码来源:dhcp-client.c


示例6: sendDelugeGroup

static int
sendDelugeGroup(void* inst, ContainerRoot* model)
{
	// so, we receive a new model to distribute
	DelugeGroup* instance = (DelugeGroup*) inst;

	PRINTF("Sending with DELUGE %p %p\n", instance->lastReceivedModel, model);

	/* we don't want to resend the model as if we were the creators if we just received */
	if (instance->lastReceivedModel == model){
		return 0;
	}

	PRINTF("Sending the model through deluge\n");
	
	// TODO serialize model to a file

	// TODO calculate number of pages in the file
	
	int fd = cfs_open(instance->fileNameWithModel, CFS_READ);
	cfs_offset_t offset = cfs_seek(fd, 0, CFS_SEEK_END);
	uint16_t nPages = offset / S_PAGE;
	cfs_close(fd);
	if (offset % S_PAGE != 0) {
		
		uint16_t mod = 	offset % S_PAGE;
		PRINTF("INFO: +++++++++++++++++++++++++ %d\n", mod);
		mod = S_PAGE - mod;
		char* buf = (char*)malloc(mod);
		memset(buf, ' ', mod);
		fd = cfs_open(instance->fileNameWithModel, CFS_WRITE | CFS_APPEND);
		cfs_seek(fd, 0, CFS_SEEK_END);
		cfs_write(fd, buf, mod);
		cfs_close(fd);
		free(buf);
		nPages++;
	}

	// set my local announcement to the new version
	instance->info.version = instance->info.version + 1;
	instance->info.nr_pages = nPages;
	
	// FIXME distribute announcement to other motes
#if 0
	announcement_bump(&instance->a);
#endif

	// activate deluge
	if (deluge_disseminate(instance->fileNameWithModel, 1, NULL)) {
		PRINTF("ERROR: some problem dissemineting\n");
	}
	else {
		PRINTF("INFO: dissemineting new version of the file with version %d\n", newVersion);
	}
	
	return 0;
}
开发者ID:AlexandreRio,项目名称:contiki,代码行数:57,代码来源:deluge_group.c


示例7: coffee_test_append

/*---------------------------------------------------------------------------*/
static int
coffee_test_append(void)
{
  int error;
  int afd;
  unsigned char buf[256], buf2[11];
  int r, i, j, total_read;
#define APPEND_BYTES 1000
#define BULK_SIZE 10

  cfs_remove("T2");

  /* Test 1 and 2: Append data to the same file many times. */
  for(i = 0; i < APPEND_BYTES; i += BULK_SIZE) {
    afd = cfs_open("T3", CFS_WRITE | CFS_APPEND);
    if(afd < 0) {
      FAIL(1);
    }
    for(j = 0; j < BULK_SIZE; j++) {
      buf[j] = 1 + ((i + j) & 0x7f);
    }
    if((r = cfs_write(afd, buf, BULK_SIZE)) != BULK_SIZE) {
      printf("r=%d\n", r);
      FAIL(2);
    }
    cfs_close(afd);
  }

  /* Test 3-6: Read back the data written previously and verify that it 
     is correct. */
  afd = cfs_open("T3", CFS_READ);
  if(afd < 0) {
    FAIL(3);
  }
  total_read = 0;
  while((r = cfs_read(afd, buf2, sizeof(buf2))) > 0) {
    for(j = 0; j < r; j++) {
      if(buf2[j] != 1 + ((total_read + j) & 0x7f)) {
	FAIL(4);
      }
    }
    total_read += r;
  }
  if(r < 0) {
    FAIL(5);
  }
  if(total_read != APPEND_BYTES) {
    FAIL(6);
  }
  cfs_close(afd);

  error = 0;
end:
  cfs_close(afd);
  return error;
}
开发者ID:13416795,项目名称:contiki,代码行数:57,代码来源:test-coffee.c


示例8: savescript

/*-----------------------------------------------------------------------------------*/
static void
savescript(void)
{
  char line[40];
  /*  struct c64_fs_file f;*/
  int f;
  
  f = cfs_open("@:config.cfg", CFS_WRITE);
  if(f == -1) {
    log_message("Could not open config.cfg", "");
    return;
  }
  if(cfs[0] != 0) {
	int len = makeline(line, 'c',cfs);
	cfs_write(f, line, len);
//    cfs_write(f, line, makeline(line, 'c', cfs));
  }
  if(theme[0] != 0) {
	int len = makeline(line, 't',theme);
	cfs_write(f, line, len);
//    cfs_write(f, line, makeline(line, 't', theme));
  }
  if(driver[0] != 0) {
	int len = makeline(line, 'n',driver);
	cfs_write(f, line, len);
//    cfs_write(f, line, makeline(line, 'n', driver));
  }
  if(ipaddr[0] != 0) {
	int len = makeline(line, 'i',ipaddr);
	cfs_write(f, line, len);
//    cfs_write(f, line, makeline(line, 'i', ipaddr));
  }
  if(netmask[0] != 0) {
	int len = makeline(line, 'm',netmask);
	cfs_write(f, line, len);
//    cfs_write(f, line, makeline(line, 'm', netmask));
  }
  if(gateway[0] != 0) {
	int len = makeline(line, 'r',gateway);
	cfs_write(f, line, len);
//    cfs_write(f, line, makeline(line, 'r', gateway));
  }
  if(dnsserver[0] != 0) {
	int len = makeline(line, 'd',dnsserver);
	cfs_write(f, line, len);
//    cfs_write(f, line, makeline(line, 'd', dnsserver));
  }
  
  if(screensaver[0] != 0) {
	int len = makeline(line, 's',screensaver);
	cfs_write(f, line, len);
//    cfs_write(f, line, makeline(line, 's', screensaver));
  }
  
  strcpy(line, ".\n\0\n\n\n");
  cfs_write(f, line, strlen(line));
  
  cfs_close(f);
  
}
开发者ID:pulkomandy,项目名称:contiki-1.x,代码行数:61,代码来源:configedit.c


示例9: initscript

static void
initscript(void)
{
  char line[40], *lineptr;
  /*  struct c64_fs_file f;*/
  int f;

  if((f = cfs_open("config.cfg", 0)) == -1) {
    return;
  }
  line[0] = ' ';
  while(line[0] != '.' &&
	line[0] != 0) {
    lineptr = line;
    do {
      if(cfs_read(f, lineptr, 1) != 1) {
	cfs_close(f);
	return;
      }
      ++lineptr;
    } while(*(lineptr - 1) != '\n' &&
	    *(lineptr - 1) != '\r');

    *lineptr = 0;

    if(line[0] != '.' &&
       line[0] != 0) {
      parse(line, initparsetab);
    }
    
  }
  cfs_close(f);
  return;
}
开发者ID:pulkomandy,项目名称:contiki-1.x,代码行数:34,代码来源:configedit.c


示例10: TestScriptEngine

void TestScriptEngine(CuTest *tc)
{
    // COPY A SCRIPT FILE FOR SCRIPT TESTING
  FILE* fp = fopen("script1.amx", "rb");
  int fd = cfs_open("/script1.amx", CFS_WRITE);

  if (fp != NULL && fd != -1)
  {
    // copy the file
    char buf[1024];
    int length;

    length = fread(buf, 1, 1024, fp);
    while(length > 0)
    {
      cfs_write(fd, buf, length);
      length = fread(buf, 1, 1024, fp);
    }
    fclose(fp);
    cfs_close(fd);
  }

  test_window(&script_process, "/script1.amx");
  test_window(&script_process, "/notexist.amx");
}
开发者ID:Sowhat2112,项目名称:KreyosFirmware,代码行数:25,代码来源:windowTest.c


示例11: request_recv

/*---------------------------------------------------------------------------*/
static void request_recv(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
{
  const char *filename;
  uint8_t seq;
  if(packetbuf_datalen() < 2) {
    printf("download: bad filename request (null)\n");
    return;
  }
  seq = ((uint8_t *)packetbuf_dataptr())[0];
  if(seq == req_last_seq) {
    printf("download: ignoring duplicate request\n");
    return;
  }
  req_last_seq = seq;
  filename = ((char *)packetbuf_dataptr()) + 1;

  printf("file requested: '%s'\n", filename);
  /* Initiate file transfer */
  leds_on(LEDS_GREEN);
  if(fd >= 0) {
    cfs_close(fd);
  }
  fd = cfs_open(filename, CFS_READ);
  if(fd < 0) {
    printf("download: bad filename request (no read access): %s\n", filename);
  }

  rucb_close(&rucb);
  rucb_open(&rucb, RUCB_CHANNEL, &rucb_call);
  rucb_send(&rucb, from);

}
开发者ID:sebyx31,项目名称:contiki-exercises,代码行数:33,代码来源:contiki_exercise12.c


示例12: storage_get_index

db_result_t
storage_get_index(index_t *index, relation_t *rel, attribute_t *attr)
{
  char filename[INDEX_NAME_LENGTH];
  int fd;
  int r;
  struct index_record record;
  db_result_t result;

  merge_strings(filename, rel->name, INDEX_NAME_SUFFIX);

  fd = cfs_open(filename, CFS_READ);
  if(fd < 0) {
    return DB_STORAGE_ERROR;
  }

  for(result = DB_STORAGE_ERROR;;) {
    r = cfs_read(fd, &record, sizeof(record));
    if(r < sizeof(record)) {
      break;
    }
    if(strcmp(attr->name, record.attribute_name) == 0) {
      PRINTF("DB: Found the index record for %s.%s: type %d, filename %s\n",
	rel->name, attr->name, record.type, record.file_name);
      index->type = record.type;
      memcpy(index->descriptor_file, record.file_name,
	     sizeof(index->descriptor_file));
      result = DB_OK;
    }
  }

  cfs_close(fd);

  return result;
}
开发者ID:1uk3,项目名称:contiki,代码行数:35,代码来源:storage-cfs.c


示例13: transfer_file

int transfer_file(char* filename)
{
    int fd_read = cfs_open(filename, CFS_READ);
    if (fd_read == -1)
    {
        log_error("cfs_open(%s) failed\n", filename); 
        return -1;
    }

    cfs_offset_t pos = -1;
    if ((pos = cfs_seek(fd_read, 0, CFS_SEEK_END)) == -1)
    {
        log_error("cfs_seek(%s) to file end failed", filename); 
        cfs_close(fd_read);
        return -1;
    }

    if ((pos = cfs_seek(fd_read, 0, CFS_SEEK_SET)) == -1)
    {
        log_error("cfs_seek(%s) to file begin failed", filename); 
        cfs_close(fd_read);
        return -1;
    }

    init_file_reader(&_f_reader);
    strcpy(_f_reader.file_name, filename);
    _f_reader.send_fd = begin_send_file(filename);
    _f_reader.read_fd = fd_read;
    _f_reader.file_size = (uint16_t)pos;

    send_file_block(_f_reader.send_fd);

    return 0;
}
开发者ID:Sowhat2112,项目名称:KreyosFirmware,代码行数:34,代码来源:stlv_handler.c


示例14: copy_file_from_romfs_to_cfs

/*---------------------------------------------------------------------------*/
static void
copy_file_from_romfs_to_cfs(const char * from, const char * to)
{
  static char buf[128];
  cfs_offset_t filesize, read, pos;

  /* Format CFS */
  cfs_coffee_format();

  /* Open file for writing in CFS */
  int cfs_fd = cfs_open(to, CFS_WRITE);

  /* Open file for reading in ROMFS */
  int rom_fd = romfs_open(from, CFS_READ);

  /* Determine file size */
  filesize = romfs_seek(rom_fd, 0, CFS_SEEK_END) - 1;

  /* Restore offset to start of file */
  romfs_seek(rom_fd, 0, CFS_SEEK_SET);

  /* Copy file data from romfs to cfs in chunks of 128 bytes */
  for (pos = 0; pos < filesize; pos += read) {
    read = romfs_read(rom_fd, buf, sizeof(buf));
    cfs_write(cfs_fd, buf, read);
  }

  /* Close both files */
  cfs_close(cfs_fd);
  romfs_close(rom_fd);
}
开发者ID:EasyRF,项目名称:contiki,代码行数:32,代码来源:display-test.c


示例15: init_object

static int
init_object(struct deluge_object *obj, char *filename, unsigned version)
{
  static struct deluge_page *page;
  int i;

  obj->cfs_fd = cfs_open(filename, CFS_READ | CFS_WRITE);
  if(obj->cfs_fd < 0) {
    return -1;
  }

  obj->filename = filename;
  obj->object_id = next_object_id++;
  obj->size = file_size(filename);
  obj->version = obj->update_version = version;
  obj->current_rx_page = 0;
  obj->nrequests = 0;
  obj->tx_set = 0;

  obj->pages = malloc(OBJECT_PAGE_COUNT(*obj) * sizeof(*obj->pages));
  if(obj->pages == NULL) {
    cfs_close(obj->cfs_fd);
    return -1; 
  }

  for(i = 0; i < OBJECT_PAGE_COUNT(current_object); i++) {
    page = &current_object.pages[i];
    init_page(&current_object, i, 1);
  }

  memset(obj->current_page, 0, sizeof(obj->current_page));

  return 0;
}
开发者ID:1847123212,项目名称:ampm_contiki_wisun,代码行数:34,代码来源:deluge.c


示例16: PROCESS_THREAD

/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_append_process, ev, data)
{
  static int fd = 0;
  struct shell_input *input;

  PROCESS_EXITHANDLER(cfs_close(fd));
  
  PROCESS_BEGIN();

  fd = cfs_open(data, CFS_WRITE | CFS_APPEND);

  if(fd < 0) {
    shell_output_str(&append_command,
		     "append: could not open file for writing: ", data);
  } else {
    while(1) {
      PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
      input = data;
      /*    printf("cat input %d %d\n", input->len1, input->len2);*/
      if(input->len1 + input->len2 == 0) {
	cfs_close(fd);
	PROCESS_EXIT();
      }
      
      cfs_write(fd, input->data1, input->len1);
      cfs_write(fd, input->data2, input->len2);
      
      shell_output(&append_command,
		   input->data1, input->len1,
		   input->data2, input->len2);
    }
  }
  
  PROCESS_END();
}
开发者ID:13416795,项目名称:contiki,代码行数:36,代码来源:shell-file.c


示例17: storage_put_attribute

db_result_t
storage_put_attribute(relation_t *rel, attribute_t *attr)
{
  int fd;
  struct attribute_record record;
  int r;

  PRINTF("DB: put_attribute(%s, %s)\n", rel->name, attr->name);

  fd = cfs_open(rel->name, CFS_WRITE | CFS_APPEND);
  if(fd < 0) {
    return DB_STORAGE_ERROR;
  }

  memset(&record.name, 0, sizeof(record.name));
  memcpy(record.name, attr->name, sizeof(record.name));
  record.domain = attr->domain;
  record.element_size = attr->element_size;
  r = cfs_write(fd, &record, sizeof(record));
  if(r != sizeof(record)) {
    cfs_close(fd);
    cfs_remove(rel->name);
    return DB_STORAGE_ERROR;
  }

  cfs_close(fd);
  return DB_OK;
}
开发者ID:1uk3,项目名称:contiki,代码行数:28,代码来源:storage-cfs.c


示例18: load

/*-----------------------------------------------------------------------------------*/
unsigned char
load(const char *name)
{
  unsigned char res;
  
  /* Now open the file */
  ctrl.callerdata = cfs_open(name, 0);
  if(ctrl.callerdata < 0) {
    /* Could not open the file, display an error and return */
    /* ### */
    return LOADER_ERR_OPEN;
  }
  
  /* Load the module */
  res = mod_load(&ctrl);
  
  /* Close the input file */
  cfs_close(ctrl.callerdata);
  
  /* Check the return code */
  if(res != MLOAD_OK) {
    /* Wrong module, out of memory or whatever. Print an error
     * message and return.
     */
    /* ### */
    return res;
  }
  
  /* We've successfully loaded the module. */
  
  return LOADER_OK;
}
开发者ID:EDAyele,项目名称:ptunes,代码行数:33,代码来源:loader-arch.c


示例19: manage_acq_setup

void manage_acq_setup()
{
  for (u8 prn=0; prn<32; prn++) {
    acq_prn_param[prn].state = ACQ_PRN_UNTRIED;
    acq_prn_param[prn].score = 0;
  }

  int fd = cfs_open("almanac", CFS_READ);
  if (fd != -1) {
    cfs_read(fd, almanac, 32*sizeof(almanac_t));
    log_info("Loaded almanac from flash\n");
    cfs_close(fd);
  } else {
    log_info("No almanac file present in flash, create an empty one\n");
    cfs_coffee_reserve("almanac", 32*sizeof(almanac_t));
    cfs_coffee_configure_log("almanac", 256, sizeof(almanac_t));

    for (u8 prn=0; prn<32; prn++) {
      almanac[prn].valid = 0;
    }
  }

  sbp_register_cbk(
    MSG_ALMANAC,
    &almanac_callback,
    &almanac_callback_node
  );

  chThdCreateStatic(
      wa_manage_acq_thread,
      sizeof(wa_manage_acq_thread),
      MANAGE_ACQ_THREAD_PRIORITY,
      manage_acq_thread, NULL
  );
}
开发者ID:njoubert,项目名称:piksi_firmware,代码行数:35,代码来源:manage.c


示例20: start_program

/*---------------------------------------------------------------------*/
static int
start_program(void)
{
  /* Link, load, and start new program. */
  int ret;
  s.fd = cfs_open("codeprop.out", CFS_READ);
  ret = elfloader_load(s.fd);

  /* XXX: Interrupts seems to be turned off a little too long during the
     ELF loading process, so we need to "manually" trigger a timer
     interrupt here. */
  TACCR1 = TAR + 1000;
  
  if(ret == ELFLOADER_OK) {
    sprintf(msg, "ok\n");
    PRINTF("Ok, starting new program.\n");
    /* Start processes. */
    autostart_start(elfloader_autostart_processes);
  } else {
    sprintf(msg, "err %d %s", ret, elfloader_unknown);
    PRINTF("Error: '%s'.\n", msg);
  }
  cfs_close(s.fd);
  return ret;
}
开发者ID:arbraham,项目名称:hummingbird,代码行数:26,代码来源:tcprudolph0.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ cfs_read函数代码示例发布时间:2022-05-30
下一篇:
C++ cfread函数代码示例发布时间: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