Exemplo n.º 1
0
void
init_proc() {
	list_init(&ready);
	list_init(&block);
	list_init(&free);


    int i=0;
    for(;i<PCB_NUM;i++)
        list_add_before(&free,&proc_pool[i].list);

    init_driver();
    init_fm();
    //PCB *ptest = create_kthread(drivertest,0,NULL);
    //wakeup(ptest);
    /**pa = create_kthread(A,0,NULL);
    pb = create_kthread(B,0,NULL);
    pc = create_kthread(C,0,NULL);
    pd = create_kthread(D,0,NULL);
    pe = create_kthread(E,0,NULL);**/
    timertest = create_kthread(timer_test,0,NULL);
    fmtest = create_kthread(fm_test,0,NULL);
    //(fmtest->pool_mutex).pid = fmtest->pid;
    /**wakeup(pa);
    wakeup(pb);
    wakeup(pc);
    wakeup(pd);
    wakeup(pe);**/
    wakeup(timertest);
    wakeup(fmtest);
	/**
    pa = create_kthread(print_ch,'a',&pb);
	printk("pa : %d ,pa->tf : %x\n",pa->pid,pa->tf);
	list_add_before(&ready,&(pa->list));

    printk("ready:\n");
    ListHead *p1;
    list_foreach(p1,&ready)
        printk("id : %d ,tf : %x\n",((PCB *)(list_entry(p1,PCB,list)))->pid,
                                    ((PCB *)(list_entry(p1,PCB,list)))->tf);
    printk("\n-----------\n");

    pb = create_kthread(print_ch,'b',&pc);
	printk("pb : %d ,pb->tf : %x\n",pb->pid,pb->tf);
	list_add_before(&block,&(pb->list));
	pc = create_kthread(print_ch,'c',&pd);
	printk("pc : %d ,pc->tf : %x\n",pc->pid,pc->tf);
	list_add_before(&block,&(pc->list));
    pd = create_kthread(print_ch,'d',&pa);
    printk("pd : %d ,pd->tf : %x\n",pd->pid,pd->tf);
    list_add_before(&block,&(pd->list));
    
    printk("block:\n");
    ListHead *p2;
    list_foreach(p2,&block)
        printk("id : %d ,tf : %x\n",((PCB *)(list_entry(p2,PCB,list)))->pid,
                                    ((PCB *)(list_entry(p2,PCB,list)))->tf);
    printk("\n---------\n");
    **/
    //test_setup();
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{

	int c;
	int frequency;
	int tmp;
	struct dab_digrad_status_t dab_digrad_status;

	printf("dabpi_ctl version %s\r\n",GIT_VERSION);

	si46xx_init();
	while((c=getopt(argc, argv, "abc:def:ghi:j:k:l:mnos")) != -1){
		switch(c){
		case 'a':
			init_dab();
			break;
		case 'b':
			init_fm();
			break;
		case 'c':
			frequency = atoi(optarg);
			si46xx_fm_tune_freq(frequency,0);
			break;
		case 'd':
			si46xx_fm_rsq_status();
			break;
		case 'e':
			si46xx_dab_digrad_status(&dab_digrad_status);
			si46xx_dab_digrad_status_print(&dab_digrad_status);
			break;
		case 'f':
			si46xx_dab_get_digital_service_list();
			si46xx_dab_print_service_list();
			si46xx_dab_start_digital_service_num(atoi(optarg));
			break;
		case 'g':
			si46xx_dab_get_digital_service_list();
			si46xx_dab_print_service_list();
			break;
		case 'h':
			show_help(argv[0]);
			break;
		case 'i':
			si46xx_dab_tune_freq(atoi(optarg),0);
			break;
		case 'j':
			tmp = atoi(optarg);
			load_regional_channel_list(tmp);
			break;
		case 'k':
			tmp = atoi(optarg);
			load_regional_channel_list(tmp);
			si46xx_dab_scan();
			break;
		case 'l':
			if(strcmp(optarg,"down") == 0){
				si46xx_fm_seek_start(0,1);
			}else{
				si46xx_fm_seek_start(1,1);
			}
			break;
		case 'm':
			si46xx_fm_rds_status();
			si46xx_fm_rds_blockcount();
			break;
		case 'n':
			si46xx_dab_get_audio_info();
			break;
		case 'o':
			si46xx_dab_get_subchannel_info();
			break;
		case 's':
			si46xx_get_sys_state();
			break;
		default:
			show_help(argv[0]);
			break;
		}
	}
	if(argc == 1){
		show_help(argv[0]);
	}
	return 0;
}