예제 #1
0
파일: librq-blacklist.c 프로젝트: hyper/rq
void rq_blacklist_init(rq_blacklist_t *blacklist, rq_t *rq, const char *queue, int expires)
{
	assert(blacklist);
	assert(rq);
	assert(queue);
	assert(expires > 0);

	blacklist->rq = rq;
	blacklist->queue = (char *) queue;

  blacklist->expires = expires; 
  
  blacklist->cache = (list_t *) malloc(sizeof(list_t));
  ll_init(blacklist->cache);

  blacklist->waiting = (list_t *) malloc(sizeof(list_t));
  ll_init(blacklist->waiting);

	blacklist->risp = risp_init();
	assert(blacklist->risp != NULL);
	risp_add_invalid(blacklist->risp, cmdInvalid);
	risp_add_command(blacklist->risp, BL_CMD_CLEAR, 	 &cmdClear);
	risp_add_command(blacklist->risp, BL_CMD_ACCEPT,   &cmdAccept);
 	risp_add_command(blacklist->risp, BL_CMD_DENY,     &cmdDeny);
}
예제 #2
0
파일: tracy.c 프로젝트: HetGroteBos/tracy
struct tracy *tracy_init(long opt) {
    struct tracy *t;

    t = malloc(sizeof(struct tracy));

    if (!t) {
        return NULL;
    }

    t->fpid = 0;

    t->childs = ll_init();
    t->hooks = ll_init();
    t->defhook = NULL;
    t->signal_hook = NULL;

    if (!t->childs || !t->hooks) {
        /* TODO: Does this even work */
        free(t->childs);
        free(t->hooks);
        free(t);
        return NULL;
    }

    /* TODO Check opt for validity */
    t->opt = opt;

    t->defhook = NULL;
    t->signal_hook = NULL;
    t->se.child_create = NULL;

    return t;
}
static int __init hci_uart_init(void)
{
	static struct tty_ldisc_ops hci_uart_ldisc;
	int err;

	BT_INFO("HCI UART driver ver %s", VERSION);

	/* Register the tty discipline */

	memset(&hci_uart_ldisc, 0, sizeof (hci_uart_ldisc));
	hci_uart_ldisc.magic		= TTY_LDISC_MAGIC;
	hci_uart_ldisc.name		= "n_hci";
	hci_uart_ldisc.open		= hci_uart_tty_open;
	hci_uart_ldisc.close		= hci_uart_tty_close;
	hci_uart_ldisc.read		= hci_uart_tty_read;
	hci_uart_ldisc.write		= hci_uart_tty_write;
	hci_uart_ldisc.ioctl		= hci_uart_tty_ioctl;
	hci_uart_ldisc.poll		= hci_uart_tty_poll;
	hci_uart_ldisc.receive_buf	= hci_uart_tty_receive;
	hci_uart_ldisc.write_wakeup	= hci_uart_tty_wakeup;
	hci_uart_ldisc.owner		= THIS_MODULE;

	if ((err = tty_register_ldisc(N_HCI, &hci_uart_ldisc))) {
		BT_ERR("HCI line discipline registration failed. (%d)", err);
		return err;
	}

#ifdef CONFIG_BT_HCIUART_H4
	h4_init();
#endif
#ifdef CONFIG_BT_HCIUART_BCSP
	bcsp_init();
#endif
/* < DTS2012020604357 zhangyun 20120206 begin */
#if defined(CONFIG_BT_HCIUART_LL) && defined(HUAWEI_BT_BTLA_VER30)
	ll_init();
#endif

/*default without Huawei modification*/
#if defined(CONFIG_BT_HCIUART_LL) && (!defined(CONFIG_HUAWEI_KERNEL))
    ll_init();
#endif
/* DTS2012020604357 zhangyun 20120206 end > */
#ifdef CONFIG_BT_HCIUART_ATH3K
	ath_init();
#endif
/* < DTS2012020604357 zhangyun 20120206 begin */
#if defined(CONFIG_BT_HCIUART_IBS) && defined(HUAWEI_BT_BLUEZ_VER30)
	ibs_init();
#endif

/*default without Huawei modification*/
#if defined(CONFIG_BT_HCIUART_IBS) && (!defined(CONFIG_HUAWEI_KERNEL))
    ibs_init();
#endif
/* DTS2012020604357 zhangyun 20120206 end > */

	return 0;
}
예제 #4
0
void Init_liblicense(void) {
	ll_init();

	cLiblicense = rb_define_class("Liblicense", rb_cObject);
	rb_define_alloc_func(cLiblicense, rbll_alloc);

	rb_define_method(cLiblicense, "initialize", rbll_initialize, 1);
	rb_define_method(cLiblicense, "initialize_copy", rbll_initialize_copy, 1);

	rb_define_method(cLiblicense, "uri", rbll_uri_get, 0);
	rb_define_method(cLiblicense, "uri=", rbll_uri_set, 1);
	rb_define_method(cLiblicense, "filename", rbll_filename_get, 0);

	rb_define_method(cLiblicense, "name", rbll_name_get, 0);
	rb_define_method(cLiblicense, "version", rbll_version_get, 0);
	rb_define_method(cLiblicense, "jurisdiction", rbll_jurisdiction_get, 0);

	rb_define_method(cLiblicense, "attribute", rbll_attribute_get, -1);

	rb_define_method(cLiblicense, "permits", rbll_permits_get, 0);
	rb_define_method(cLiblicense, "prohibits", rbll_prohibits_get, 0);
	rb_define_method(cLiblicense, "requires", rbll_requires_get, 0);

	rb_define_method(cLiblicense, "write", rbll_write, -1);
	rb_define_singleton_method(cLiblicense, "read", rbll_read, -1);

	rb_define_singleton_method(cLiblicense, "licenses", rbll_licenses_get, -1);
	rb_define_singleton_method(cLiblicense, "verify", rbll_verify, 1);

	rb_define_singleton_method(cLiblicense, "modules", rbll_modules, 0);
	rb_define_singleton_method(cLiblicense, "modules_config", rbll_modules_config, 0);
	rb_define_singleton_method(cLiblicense, "modules_io", rbll_modules_io, 0);
}
예제 #5
0
void bz_bluetooth_init(void)
{
    bt_fw_stack_init();
    hci_td_init();    
    lc_init();  
    lmp_init();    
    
#ifdef LE_MODE_EN
    //--- ll module init---
    if (IS_BT40)
    {
        ll_init();
    }
#endif      

#if defined (_3DD_FUNCTION_SUPPORT_) || defined (_DAPE_TEST_USE_GPIO1_AS_FRAME_SYNC)
#ifdef _3DD_FUNCTION_SUPPORT_
    if (IS_SUPPORT_3DG_APP)
#endif        
    {
        bt_3dd_driver_init();
    }
#endif

    init_hci();
}
예제 #6
0
/*
  Create a box_whisker struct, suitable for generating a boxplot.

  TH are the tukey hinges of the dataset.

  id_idx is the index into the casereader which will be used to label 
  outliers.
  id_var is the variable from which that label came, or NULL
*/
struct box_whisker *
box_whisker_create (const struct tukey_hinges *th,
		    size_t id_idx, const struct variable *id_var)
{
  struct box_whisker *w = xzalloc (sizeof (*w));
  struct order_stats *os = &w->parent;
  struct statistic *stat = &os->parent;

  os->n_k = 0;

  stat->destroy = destroy;
  stat->accumulate = acc;

  tukey_hinges_calculate (th, w->hinges);

  w->id_idx = id_idx;
  w->id_var = id_var;

  w->step = (w->hinges[2] - w->hinges[0]) * 1.5;

  w->whiskers[1] = w->hinges[2];
  w->whiskers[0] = SYSMIS;

  ll_init (&w->outliers);

  return w;
}
예제 #7
0
파일: abc.c 프로젝트: JamesLinus/vsta
/*
 * init_buf()
 *	Initialize the buffering system
 */
void
init_buf(port_t arg_ioport, int arg_coresec)
{
	char *p;

	/*
	 * Record args
	 */
	ioport = arg_ioport;
	coresec = arg_coresec;

	/*
	 * Initialize data structures
	 */
	ll_init(&allbufs);
	bufpool = hash_alloc(coresec / 8);
	bufsize = 0;
	ASSERT_DEBUG(bufpool, "init_buf: bufpool");
	fg_pid = gettid();

	/*
	 * Record whether DMA is supported
	 */
	p = rstat(ioport, "dma");
	can_dma = p && atoi(p);

	/*
	 * Spin off background thread
	 */
	bg_pid = tfork(bg_thread, 0);
}
예제 #8
0
int main(int argc, char** argv) {
  LinkLayer *link_layer = malloc(sizeof(LinkLayer));

  struct sigaction sa;
  sa.sa_flags = 0;
  sa.sa_handler = atende;
  if (sigaction(SIGALRM, &sa, NULL) == -1) {
    perror("Error: cannot handle SIGALRM");
    return 0;
  }

  if ( (argc < 3) || 
	      (strcmp("/dev/ttyS0", argv[1])!=0 && 
	      (strcmp("/dev/ttyS4", argv[1])!=0))) {
    printf("Usage:\tnserial SerialPort\n\tex: nserial /dev/ttyS1\n");
    exit(1);
  }

  ll_init(link_layer, argv[1], BAUDRATE, 1, 5, 1000, TRANSMITTER); 

  app_layer(link_layer, argv[2]);

  ll_end(link_layer);

  return 0;
}
예제 #9
0
파일: timers.c 프로젝트: niximor/prebot
/**
 * Init timers instance
 * @return Timers intsnce
 */
Timers timers_cinit() {
	Timers result = malloc(sizeof(struct sTimers));
	result->lastTest = time(NULL);
	ll_init(result);

	return result;
} // timers_cinit
예제 #10
0
파일: county.c 프로젝트: HetGroteBos/tracy
int main(int argc, char** argv) {
    struct tracy *tracy;

    ll = ll_init();
    tracy = tracy_init(TRACY_TRACE_CHILDREN);

    if (argc < 2) {
        printf("Usage: county <program name> <program arguments>\n");
        return EXIT_FAILURE;
    }

    if (tracy_set_default_hook(tracy, all)) {
        printf("Failed to hook default hook.\n");
        return EXIT_FAILURE;
    }

    argv++; argc--;
    if (!tracy_exec(tracy, argv)) {
        perror("tracy_exec returned NULL");
        return EXIT_FAILURE;
    }

    tracy_main(tracy);

    tracy_free(tracy);

    print_stats();

    ll_free(ll);

    return 0;
}
예제 #11
0
int
os_perf_init(void)
{
	int ringsize, size;

	s_profiling_recbuf = NULL;
	s_ll_recbuf = NULL;
	s_partpause_enabled = B_FALSE;

	ringsize = pf_ringsize_init();
	size = ((ringsize / sizeof (pf_profiling_rbrec_t)) + 1) *
		sizeof (pf_profiling_rec_t);

	if ((s_profiling_recbuf = zalloc(size)) == NULL) {
		return (-1);
	}

	profiling_init(&s_profiling_conf);

	size = ((ringsize / sizeof (pf_ll_rbrec_t)) + 1) *
		sizeof (pf_ll_rec_t);

	if ((s_ll_recbuf = zalloc(size)) == NULL) {
		free(s_profiling_recbuf);
		s_profiling_recbuf = NULL;
		return (-1);
	}

	ll_init(&s_ll_conf);
	return (0);	
}
예제 #12
0
/* Le o arquivo de entrada. */
int read_file(char *path) {
     FILE *f;
     char t;
     int k, flag, dist = 0;
     f = fopen(path, "r");
     if (f == NULL) {
          return -1;
     }
     fscanf(f, "%d", &m);
     fscanf(f, "%d", &n);
     fscanf(f, "%c", &v); /* Ler o '\n'. */
     fscanf(f, "%c", &v);
     fscanf(f, "%d", &d);
     fscanf(f, "%c", &t); /* '\n'... */
     ll_init();
     while (dist < d) {
          fscanf(f, "%c", &t);
          fscanf(f, "%d", &k);
          dist += k;
          flag = ll_add(t, k);
          if (flag != 0) {
               ll_clean();
               return -1;
          }
          fscanf(f, "%c", &t);
     }
     fclose(f);
     return 0;
}
예제 #13
0
파일: rqd.c 프로젝트: hyper/rqd
// create the nodelist list.
static void init_nodes(system_data_t *sysdata)
{
	assert(sysdata);
	assert(sysdata->nodelist == NULL);
	
	sysdata->nodelist = (list_t *) malloc(sizeof(list_t));
	ll_init(sysdata->nodelist);
}
예제 #14
0
파일: dllmain.c 프로젝트: cbh34680/jbx
static int on_accepted(const struct jbxm_initconf_st* iconf,
                       struct jbxm_callback_if_st* cbif)
{
    assert(iconf);
    assert(cbif);
    assert(cbif->type == JBXM_CBT_ACCEPTED);

    bool success = false;

    struct UserData_st* ud = calloc(1, sizeof(struct UserData_st));
    if (! ud)
    {
        fprintf(stderr, "error: calloc (errno=%d)\n", errno);

        goto EXIT_LABEL;
    }

// set ud members

    ud->headers = hm_init(19);
    if (! ud->headers)
    {
        fprintf(stderr, "error: hm_init\n");

        goto EXIT_LABEL;
    }

    ud->body_chunks = ll_init(free_varmem);
    if (! ud->body_chunks)
    {
        fprintf(stderr, "error: ll_init\n");

        goto EXIT_LABEL;
    }

// save to memory

    dbSET0(cbif, "user-data", ud);

    success = true;

EXIT_LABEL:

    if (! success)
    {
        if (ud)
        {
            hm_free(ud->headers);
            ll_free(ud->body_chunks);

            free(ud);
        }

        return -1;
    }

    return 0;
}
예제 #15
0
파일: hci_ldisc.c 프로젝트: 020gzh/linux
static int __init hci_uart_init(void)
{
	static struct tty_ldisc_ops hci_uart_ldisc;
	int err;

	BT_INFO("HCI UART driver ver %s", VERSION);

	/* Register the tty discipline */

	memset(&hci_uart_ldisc, 0, sizeof(hci_uart_ldisc));
	hci_uart_ldisc.magic		= TTY_LDISC_MAGIC;
	hci_uart_ldisc.name		= "n_hci";
	hci_uart_ldisc.open		= hci_uart_tty_open;
	hci_uart_ldisc.close		= hci_uart_tty_close;
	hci_uart_ldisc.read		= hci_uart_tty_read;
	hci_uart_ldisc.write		= hci_uart_tty_write;
	hci_uart_ldisc.ioctl		= hci_uart_tty_ioctl;
	hci_uart_ldisc.poll		= hci_uart_tty_poll;
	hci_uart_ldisc.receive_buf	= hci_uart_tty_receive;
	hci_uart_ldisc.write_wakeup	= hci_uart_tty_wakeup;
	hci_uart_ldisc.owner		= THIS_MODULE;

	err = tty_register_ldisc(N_HCI, &hci_uart_ldisc);
	if (err) {
		BT_ERR("HCI line discipline registration failed. (%d)", err);
		return err;
	}

#ifdef CONFIG_BT_HCIUART_H4
	h4_init();
#endif
#ifdef CONFIG_BT_HCIUART_BCSP
	bcsp_init();
#endif
#ifdef CONFIG_BT_HCIUART_LL
	ll_init();
#endif
#ifdef CONFIG_BT_HCIUART_ATH3K
	ath_init();
#endif
#ifdef CONFIG_BT_HCIUART_3WIRE
	h5_init();
#endif
#ifdef CONFIG_BT_HCIUART_INTEL
	intel_init();
#endif
#ifdef CONFIG_BT_HCIUART_BCM
	bcm_init();
#endif
#ifdef CONFIG_BT_HCIUART_QCA
	qca_init();
#endif
#ifdef CONFIG_BT_HCIUART_AG6XX
	ag6xx_init();
#endif

	return 0;
}
예제 #16
0
파일: rqd.c 프로젝트: hyper/rqd
// initialise the empty linked-list of queues.
static void init_queues(system_data_t *sysdata)
{
	assert(sysdata);
	assert(sysdata->queues == NULL);
	
	sysdata->queues = (list_t *) malloc(sizeof(list_t));
	ll_init(sysdata->queues);
	assert(sysdata->queues);
}
예제 #17
0
파일: main.c 프로젝트: Ryan311/blessed
int main(void)
{
	ll_init(&addr);
	ll_advertise_start(LL_PDU_ADV_NONCONN_IND, LL_ADV_INTERVAL_MIN_NONCONN,
					LL_ADV_CH_ALL, data, sizeof(data));

	while (1);

	return 0;
}
예제 #18
0
static void rr_init(){
	int i;
	ll_init(&rr_queue);

	for(i=0; i<g_total_cpus; i++){
		rr_thread_args[i].cpu = i;
		sem_init(&rr_cpu_available[i], 0, 1);
		pthread_create(&rr_loop_thread[i], NULL, (void *)&rr_loop, (void *)&rr_thread_args[i]);
	}
}
예제 #19
0
파일: settings.c 프로젝트: hyper/rq
//-----------------------------------------------------------------------------
// Initialise the settings structure.
void settings_init(settings_t *ptr)
{
	assert(ptr != NULL);

	ptr->port = RQ_DEFAULT_PORT;
	ptr->maxconns = DEFAULT_MAXCONNS;
	ptr->verbose = false;
	ptr->daemonize = false;
	ptr->username = NULL;
	ptr->pid_file = NULL;

	ptr->interfaces = (list_t *) malloc(sizeof(list_t));
	ll_init(ptr->interfaces);

	ptr->controllers = (list_t *) malloc(sizeof(list_t));
	ll_init(ptr->controllers);

	ptr->logfile = NULL;
}
예제 #20
0
파일: task.c 프로젝트: Nani0119/OS-One
/*****************************************************************
*	2015-02-16 18:34:32
*	V1.0 	By Breaker
*
*		void task_init(LinkedList *ll)
*   	初始化系统任务管理机制
*		return void
*/
void task_init()
{
		//初始化 task_ready
		task_ready = &task_ready_ll;
		ll_init(task_ready);

		//初始化 MSG_list
		MSG_list = & MSG_list_ll;
		ll_init(MSG_list);

		//创建一个默认任务, 当前的代码将会以任务的方式执行
		u8 rank = MAX_rank ;
		u32 task_func = (u32)task_idle;
		u8 TID = task_create( rank , task_func);
		task_run(TID);

		//初始化task_global
		task_global.schedule_lock = false;
		task_global.current_TID = TID;
		task_global.current_tasktable = (u32) &task_table[TID];
}
예제 #21
0
void _LSList::toLList_t(llist_t* L) {
	ll_init(L,Weight(),numFields());
	L->numFields=numFields();
	for (u32 i=0; i<_m_count(); ++i) {
		_LSListField* cField = fetchField(i);
		for (u32 j=0; j<cField->numEntries();++j) {
			L->data[L->index[i]+j]=cField->at(j);
		}
		L->index[i+1]=L->index[i]+cField->numEntries();
		releaseField(cField);
	}
}
예제 #22
0
int main(int argc, char** argv) {

        (void)argc;
        (void)argv;
	ll_init();

	do_test(); /* Separated out into a function
		      so one can verify that calling
		      it twice or thrice, it still works. */
	do_test();
	ll_stop();
	return 0;
}
예제 #23
0
파일: main.c 프로젝트: xueliu/nRF51822
int main(void)
{
	log_init();
	ll_init(&addr);

	DBG("End init");

	ll_scan_start(LL_SCAN_PASSIVE, SCAN_INTERVAL, SCAN_WINDOW,
							adv_report_cb);

	evt_loop_run();

	return 0;
}
예제 #24
0
파일: main.c 프로젝트: jgensler8/cs211
int main( int argc, char** argv){
  int d = 0, quit = 1, commandNum, numRead;
  char *input, command;
  Line l = line_init(stdin);
  Ll ll = ll_init();

  gen_parse_args( argc, argv, &d);

  while( quit){
    printf("Command: ");
    line_read_line( l);
    input = get_line( l);
    sscanf(input, " %c%n", &command, &numRead);
    switch( command){
      case 'q': quit = 0; break;
      case 'i': if( gen_exists_num( input+numRead) ){
                sscanf(input+numRead, "%d", &commandNum);
                ll_insert( ll, commandNum , d);
              }
              else printf("Sorry, you didn't enter a number!\n");
              break;
      case 'd': if( gen_exists_num( input+numRead) ){
                sscanf( input+numRead, "%d", &commandNum);
                ll_delete( ll, commandNum, d);
              }
              else printf("Sorry, you didn't enter a number!\n");
              break;
      case 'c': if( gen_exists_num( input+numRead) ){
                  sscanf( input+numRead, "%d", &commandNum);
                  if( ll_contains( ll, commandNum, d) )
                    printf("LIST DOES CONTAIN %d\n", commandNum);
                  else printf("LIST DOES NOT CONATAIN %d\n", commandNum);
                }
                else printf("Sorry, you didn't enter a number!\n");
                break;
      case 'e': ll_empty( ll, d); break;
      case 'l': ll_print( ll, d); break;
      case 'r': ll_print_rev( ll, d); break;
      case '?': gen_print_help(); break;
      case 'h': gen_print_help(); break;
      case '\n': break;
      default: printf("Invalid Command\n");
    }
    free( input);    
  }

  ll_free( ll, d);
  line_free( l);
  return 0;
}
예제 #25
0
llist_t * _LBList<BTECOLL>::toLList_t() {
	llist_t* P = (llist_t *)lxmalloc(sizeof(llist_t),1);
	ll_init(P,Weight(),numFields());
	for (u32 i=0; i<_count; ++i) {
		// do bulk load. Without any cache.
		_LBListField<BTECOLL>* cField = fetchField(i);
		for (u32 j=0; j<cField->info()->entries;++j) {
			P->data[P->index[i]+j]=cField->el[j];
		}
		P->index[i+1]=P->index[i]+cField->info()->entries;
		releaseField(cField);
	}
	return P;	
}
예제 #26
0
rq_http_t * rq_http_new (rq_t *rq, char *queue, void (*handler)(rq_http_req_t *req), void *arg)
{
	rq_http_t *http;

	assert(rq);
	assert(queue);
	assert(handler);
	assert((arg && handler) || (arg == NULL));

	// create http object.
	http = malloc(sizeof(*http));
	http->rq = rq;
	http->queue = strdup(queue);
	assert(strlen(queue) < 256);
	http->handler = handler;
	http->arg = arg;

	http->req_list = ll_init(NULL);
	assert(http->req_list);
	
	http->safe_buffer = NULL;
	http->safe_len = 0;

	// create RISP object
	http->risp = risp_init(NULL);
	assert(http->risp);
	risp_add_command(http->risp, HTTP_CMD_CLEAR, 	   &cmdClear);
	risp_add_command(http->risp, HTTP_CMD_EXECUTE,     &cmdExecute);
	risp_add_command(http->risp, HTTP_CMD_METHOD_GET,  &cmdMethodGet);
	risp_add_command(http->risp, HTTP_CMD_METHOD_POST, &cmdMethodPost);
	risp_add_command(http->risp, HTTP_CMD_METHOD_HEAD, &cmdMethodHead);
	risp_add_command(http->risp, HTTP_CMD_HOST,        &cmdHost);
	risp_add_command(http->risp, HTTP_CMD_PATH,        &cmdPath);
	risp_add_command(http->risp, HTTP_CMD_PARAMS,      &cmdParams);
	risp_add_command(http->risp, HTTP_CMD_CODE,        &cmdCode);

// 	risp_add_command(http->risp, HTTP_CMD_SET_HEADER,  &cmdHeader);
// 	risp_add_command(http->risp, HTTP_CMD_LENGTH,      &cmdLength);
// 	risp_add_command(http->risp, HTTP_CMD_REMOTE_HOST, &cmdRemoteHost);
// 	risp_add_command(http->risp, HTTP_CMD_LANGUAGE,    &cmdLanguage);
// 	risp_add_command(http->risp, HTTP_CMD_FILE,        &cmdParams);
// 	risp_add_command(http->risp, HTTP_CMD_KEY,         &cmdKey);
// 	risp_add_command(http->risp, HTTP_CMD_VALUE,       &cmdValue);
// 	risp_add_command(http->risp, HTTP_CMD_FILENAME,    &cmdFilename);

	rq_consume(rq, http->queue, 200, RQ_PRIORITY_NORMAL, 0, message_handler, NULL, NULL, http);

	return(http);
}
예제 #27
0
파일: linked_list.c 프로젝트: tjhei/fgmpi
/**
 * Create a new linked list
 **/
linked_list_t* new_linked_list(const char *name, int entry_size)
{
  linked_list_t *ll;
  object_pool_t *pool;

  assert((unsigned int)entry_size > sizeof(linked_list_entry_t));

  ll = (linked_list_t*) malloc(sizeof(linked_list_t));    assert(ll);
  pool = new_object_pool(entry_size, MIN_ALLOC_BLOCK);    assert(pool);

  ll_init(ll, name, pool);

  check_list_integrity(ll);

  return ll;
}
예제 #28
0
int main (int argc, char *argv[])
{
    DWORD sp1, sp2;
    WORD c;
    int i;
    LIN_ADDR b;
    struct multiboot_info *mbi;

    sp1 = get_sp();
    mbi = ll_init();


    if (mbi == NULL) {
        message("Error in LowLevel initialization code...\n");
        l1_exit(-1);
    }

    message("Starting...");
    c = ll_context_save();
    message("CX=%x\n",c);
    for (i = 0; i < 0x4F000; i++);

    dos_mem_init();
    b = dos_alloc(BSIZE);
    vm86_init(b, BSIZE);


    l1_int_bind(0x40, reflect);
    l1_int_bind(0x15, reflect);
    l1_int_bind(0x10, int0x10);
    l1_irq_bind(6, reflect);
    l1_irq_bind(15, reflect);
    l1_irq_bind(14, reflect);
    irq_unmask(6);
    irq_unmask(15);
    irq_unmask(14);

    disk_demo();
    sp2 = get_sp();
    message("End reached!\n");
    message("Actual stack : %lx - ", sp2);
    message("Begin stack : %lx\n", sp1);
    message("Check if same : %s\n",sp1 == sp2 ? "Ok :-)" : "No :-(");

    ll_end();
    return 1;
}
예제 #29
0
int ll_check(){
    printf("Testing Linked Lists Functions\n");
    LinkList *l;

    counter = 0;

    l = ll_init(); assert_i(ll_size(l), 0, "Check LL Size after init");
    //ll_print(l);

    ll_addFront(l, 1, -1); assert_i(ll_size(l), 1, "Check LL Size after addFront");
    ll_addFront(l, 2, -2); assert_i(ll_size(l), 2, "Check LL Size after addFront");
    ll_addFront(l, 3, -3); assert_i(ll_size(l), 3, "Check LL Size after addFront");
    //ll_print(l);

    ll_addBack(l, 4, -4); assert_i(ll_size(l), 4, "Check LL Size after addBack");
    ll_addBack(l, 5, -5); assert_i(ll_size(l), 5, "Check LL Size after addBack");
    ll_addBack(l, 6, -6); assert_i(ll_size(l), 6, "Check LL Size after addBack");
    //ll_print(l);

    int x, y;
    ll_getFront(l, &x, &y); 
        assert_p(x, y, 3, -3, "Check LL getFront");
        assert_i(ll_size(l), 5, "Check LL Size after getFront");
    ll_getFront(l, &x, &y);
        assert_p(x, y, 2, -2, "Check LL getFront");
        assert_i(ll_size(l), 4, "Check LL Size after getFront");
    ll_getFront(l, &x, &y);
        assert_p(x, y, 1, -1, "Check LL getFront");
        assert_i(ll_size(l), 3, "Check LL Size after getFront");
    ll_getFront(l, &x, &y);
        assert_p(x, y, 4, -4, "Check LL getFront");
        assert_i(ll_size(l), 2, "Check LL Size after getFront");
    ll_getFront(l, &x, &y);
        assert_p(x, y, 5, -5, "Check LL getFront");
        assert_i(ll_size(l), 1, "Check LL Size after getFront");
    ll_getFront(l, &x, &y);
        assert_p(x, y, 6, -6, "Check LL getFront");
        assert_i(ll_size(l), 0, "Check LL Size after getFront");

    ll_addBack(l, 2, 3); assert_i(ll_size(l), 1, "Check LL Size after addBack on Empty List");
    ll_getFront(l, &x, &y);
        assert_p(x, y, 2, 3, "Check LL getFront");
        assert_i(ll_size(l), 0, "Check LL Size after getFront");


    ll_free(l);
}
예제 #30
0
static int __init hci_uart_init(void)
{
	static struct tty_ldisc_ops hci_uart_ldisc;
	int err;

	BT_INFO("HCI UART driver ver %s", VERSION);

#if defined(CONFIG_MT5931_MT6622)
	wake_lock_init(&bt_wake_lock, WAKE_LOCK_SUSPEND, "bt");
#endif
	/* Register the tty discipline */

	memset(&hci_uart_ldisc, 0, sizeof (hci_uart_ldisc));
	hci_uart_ldisc.magic		= TTY_LDISC_MAGIC;
	hci_uart_ldisc.name		= "n_hci";
	hci_uart_ldisc.open		= hci_uart_tty_open;
	hci_uart_ldisc.close		= hci_uart_tty_close;
	hci_uart_ldisc.read		= hci_uart_tty_read;
	hci_uart_ldisc.write		= hci_uart_tty_write;
	hci_uart_ldisc.ioctl		= hci_uart_tty_ioctl;
	hci_uart_ldisc.poll		= hci_uart_tty_poll;
	hci_uart_ldisc.receive_buf	= hci_uart_tty_receive;
	hci_uart_ldisc.write_wakeup	= hci_uart_tty_wakeup;
	hci_uart_ldisc.owner		= THIS_MODULE;

	if ((err = tty_register_ldisc(N_HCI, &hci_uart_ldisc))) {
		BT_ERR("HCI line discipline registration failed. (%d)", err);
		return err;
	}

#ifdef CONFIG_BT_HCIUART_H4
	h4_init();
#endif
#ifdef CONFIG_BT_HCIUART_BCSP
	bcsp_init();
#endif
#ifdef CONFIG_BT_HCIUART_LL
	ll_init();
#endif
#ifdef CONFIG_BT_HCIUART_ATH3K
	ath_init();
#endif

	return 0;
}