示例#1
0
struct core_cfg *init_core(void)
{
	struct core_cfg *core;

	struct cic_device *pCic_dev0;
	struct cic_device *pCic_dev1;

	int core_num = BSP_GetCoreId();

	if (core_num >= USING_CORE)
		return NULL;

	core = &cores[core_num];
	memset(core, 0, sizeof(struct core_cfg));

	core->bp = 1;
	core->raw_num = core_num;
	core->os = core_num;
	core->vectors = init_vectors(core_num);

	/* init SOC architecture */
	BSP_ArchInit();
	core->entry_point = (void *)ucmain;
	core->ready = 1;
	return core;
}
示例#2
0
 BASKER_INLINE
 void BaskerMatrix<Int, Entry, Exe_Space>::init_matrix
 (
  string _label, Int _m, Int _n, 
  Int _nnz
  )
 {
   label = _label;
   init_vectors(_m, _n, _nnz);
 }//end init_matrix(string, Int, Int, Int)
示例#3
0
文件: irq.c 项目: 10x-Amin/nAa-kernel
void __init init_IRQ(void)
{
	int irq;

	init_vectors();

	for (irq = 0; (irq < NR_IRQS); irq++) {
		irq_desc[irq].status = IRQ_DISABLED;
		irq_desc[irq].action = NULL;
		irq_desc[irq].depth = 1;
		irq_desc[irq].chip = &m_irq_chip;
	}
}
示例#4
0
 BASKER_INLINE
 void BaskerMatrix<Int,Entry,Exe_Space>::init_matrix
 (
  string _label, Int _m, Int _n, Int _nnz,
  Int *_col_ptr, Int *_row_idx, Entry *_val
 )
 {
   label = _label;
   init_vectors(_m, _n, _nnz);
   copy_vec(_col_ptr, _n+1,  col_ptr);
   copy_vec(_row_idx, _nnz, row_idx);
   copy_vec(_val,_nnz,     val);
 }//end init_matrix(string with ptrs)
示例#5
0
  BASKER_INLINE
  void BaskerMatrix<Int, Entry, Exe_Space>::init_matrix
  (
   string _label,
   Int _sr, Int _m,
   Int _sc, Int _n,
   Int _nnz
  )
  {
    srow = _sr;
    erow = srow + _m;
    scol = _sc;
    ecol = scol + _n;

    init_vectors(_m, _n, _nnz);
  }//end init_matrix(Int, Int, Int, Int, Int)//srow and scol
示例#6
0
void
update_orientmap_dialog (void)
{
  if (!orient_map_window) return;

  init_vectors ();

  gtk_adjustment_set_value (GTK_ADJUSTMENT (orient_map_str_exp_adjust),
                            pcvals.orient_strength_exponent);
  gtk_adjustment_set_value (GTK_ADJUSTMENT (angle_offset_adjust),
                            pcvals.orient_angle_offset);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (orient_voronoi),
                                pcvals.orient_voronoi);

  update_vector_prev ();
  update_orient_map_preview_prev ();
}
示例#7
0
void __init init_IRQ(void)
{
	int irq;

	init_vectors();

	/* Mask all interrupt sources */
	__raw_writeb(0xff, MCFINTC0_SIMR);
	if (MCFINTC1_SIMR)
		__raw_writeb(0xff, MCFINTC1_SIMR);

	for (irq = 0; (irq < NR_IRQS); irq++) {
		irq_desc[irq].status = IRQ_DISABLED;
		irq_desc[irq].action = NULL;
		irq_desc[irq].depth = 1;
		irq_desc[irq].chip = &intc_irq_chip;
		intc_irq_set_type(irq, 0);
	}
}
void __init init_IRQ(void)
{
	int irq;

	init_vectors();

	/* Mask all interrupt sources */
	__raw_writel(0x1, MCFICM_INTC0 + MCFINTC_IMRL);
#ifdef MCFICM_INTC1
	__raw_writel(0x1, MCFICM_INTC1 + MCFINTC_IMRL);
#endif

	for (irq = MCFINT_VECBASE; (irq < MCFINT_VECBASE + NR_VECS); irq++) {
		if ((irq >= EINT1) && (irq <=EINT7))
			irq_set_chip(irq, &intc_irq_chip_edge_port);
		else
			irq_set_chip(irq, &intc_irq_chip);
		irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
		irq_set_handler(irq, handle_level_irq);
	}
}
示例#9
0
int main(int argc, char **argv)
{
   int n;
   int repeat;
   double dot;
   long start_time, end_time;

   if ((argc != 3)) {
      printf("Uso: %s <tamanho dos vetores> <repeticoes>\n", argv[0]);
      exit(EXIT_FAILURE);
   }

   n = atoi(argv[1]);       // tamanho dos vetores
   repeat = atoi(argv[2]);  // numero de repeticoes (variar carga)


   // Cria vetores
   double *a = (double *) malloc(sizeof(double) * n);
   double *b = (double *) malloc(sizeof(double) * n);

   if (a == NULL || b == NULL) {
      printf("Erro de alocacao de memoria\n");
      exit(EXIT_FAILURE);      
   }

   init_vectors(a, b, n);

   start_time = wtime();
   dot = dot_product(a, b, n, repeat);
   end_time = wtime();

   printf("Produto escalar = %f\n", dot);
   printf("Tempo de calculo = %ld usec\n", (long) (end_time - start_time));

   free((void *) a);
   free((void *) b);

   return EXIT_SUCCESS;
}
示例#10
0
void
create_orientmap_dialog (GtkWidget *parent)
{
  GtkWidget *tmpw, *tmpw2;
  GtkWidget *table1, *table2;
  GtkWidget *frame;
  GtkWidget *ebox, *hbox, *vbox;

  init_vectors ();

  if (orient_map_window)
    {
      update_vector_prev ();
      update_orient_map_preview_prev ();
      gtk_widget_show (orient_map_window);
      return;
    }

  orient_map_window =
    gimp_dialog_new (_("Orientation Map Editor"), PLUG_IN_BINARY,
                     gtk_widget_get_toplevel (parent), 0,
                     gimp_standard_help_func, PLUG_IN_PROC,

                     GTK_STOCK_APPLY,  GTK_RESPONSE_APPLY,
                     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                     GTK_STOCK_OK,     GTK_RESPONSE_OK,

                     NULL);

  gtk_dialog_set_alternative_button_order (GTK_DIALOG (orient_map_window),
                                           GTK_RESPONSE_OK,
                                           GTK_RESPONSE_APPLY,
                                           GTK_RESPONSE_CANCEL,
                                           -1);

  g_signal_connect (orient_map_window, "response",
                    G_CALLBACK (orient_map_response),
                    orient_map_window);
  g_signal_connect (orient_map_window, "destroy",
                    G_CALLBACK (gtk_widget_destroyed),
                    &orient_map_window);

  table1 = gtk_table_new (2, 5, FALSE);
  gtk_container_set_border_width (GTK_CONTAINER (table1), 6);
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (orient_map_window))),
                      table1, TRUE, TRUE, 0);
  gtk_widget_show (table1);

  frame = gtk_frame_new (_("Vectors"));
  gtk_container_set_border_width (GTK_CONTAINER (frame), 2);
  gtk_table_attach (GTK_TABLE (table1), frame, 0, 1, 0, 1,
                    GTK_EXPAND, GTK_EXPAND, 0, 0);
  gtk_widget_show (frame);

  hbox = gtk_hbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (frame), hbox);
  gtk_widget_show (hbox);

  ebox = gtk_event_box_new ();
  gimp_help_set_help_data (ebox,
                           _("The vector-field. "
                             "Left-click to move selected vector, "
                             "Right-click to point it towards mouse, "
                             "Middle-click to add a new vector."), NULL);
  gtk_box_pack_start (GTK_BOX (hbox), ebox, FALSE, FALSE, 0);

  tmpw = vector_preview = gimp_preview_area_new ();
  gtk_widget_set_size_request (tmpw, OMWIDTH, OMHEIGHT);
  gtk_container_add (GTK_CONTAINER (ebox), tmpw);
  gtk_widget_show (tmpw);
  gtk_widget_add_events (ebox, GDK_BUTTON_PRESS_MASK);
  g_signal_connect (ebox, "button-press-event",
                   G_CALLBACK (map_click_callback), NULL);
  gtk_widget_show (ebox);

  vector_preview_brightness_adjust =
    gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 1.0, 1.0);
  tmpw = gtk_vscale_new (GTK_ADJUSTMENT (vector_preview_brightness_adjust));
  gtk_scale_set_draw_value (GTK_SCALE (tmpw), FALSE);
  gtk_box_pack_start (GTK_BOX (hbox), tmpw, FALSE, FALSE,0);
  gtk_widget_show (tmpw);
  g_signal_connect (vector_preview_brightness_adjust, "value-changed",
                    G_CALLBACK (update_vector_prev), NULL);
  gimp_help_set_help_data (tmpw, _("Adjust the preview's brightness"), NULL);

  tmpw2 = tmpw = gtk_frame_new (_("Preview"));
  gtk_container_set_border_width (GTK_CONTAINER (tmpw), 2);
  gtk_table_attach (GTK_TABLE (table1), tmpw, 1,2, 0,1,
                    GTK_EXPAND, GTK_EXPAND, 0, 0);
  gtk_widget_show (tmpw);

  tmpw = orient_map_preview_prev = gimp_preview_area_new ();
  gtk_widget_set_size_request (tmpw, OMWIDTH, OMHEIGHT);;
  gtk_container_add (GTK_CONTAINER (tmpw2), tmpw);
  gtk_widget_show (tmpw);

  hbox = tmpw = gtk_hbox_new (TRUE,0);
  gtk_container_set_border_width (GTK_CONTAINER (tmpw), 2);
  gtk_table_attach_defaults (GTK_TABLE (table1), tmpw, 0,1, 1,2);
  gtk_widget_show (tmpw);

  prev_button = tmpw = gtk_button_new_with_mnemonic ("_<<");
  gtk_box_pack_start (GTK_BOX (hbox), tmpw, FALSE, TRUE, 0);
  gtk_widget_show (tmpw);
  g_signal_connect (tmpw, "clicked", G_CALLBACK (prev_click_callback), NULL);
  gimp_help_set_help_data (tmpw, _("Select previous vector"), NULL);

  next_button = tmpw = gtk_button_new_with_mnemonic ("_>>");
  gtk_box_pack_start (GTK_BOX (hbox),tmpw,FALSE,TRUE,0);
  gtk_widget_show (tmpw);
  g_signal_connect (tmpw, "clicked", G_CALLBACK (next_click_callback), NULL);
  gimp_help_set_help_data (tmpw, _("Select next vector"), NULL);

  add_button = tmpw = gtk_button_new_with_mnemonic ( _("A_dd"));
  gtk_box_pack_start (GTK_BOX (hbox), tmpw, FALSE, TRUE, 0);
  gtk_widget_show (tmpw);
  g_signal_connect (tmpw, "clicked", G_CALLBACK (add_click_callback), NULL);
  gimp_help_set_help_data (tmpw, _("Add new vector"), NULL);

  kill_button = tmpw = gtk_button_new_with_mnemonic ( _("_Kill"));
  gtk_box_pack_start (GTK_BOX (hbox), tmpw, FALSE, TRUE, 0);
  gtk_widget_show (tmpw);
  g_signal_connect (tmpw, "clicked", G_CALLBACK (delete_click_callback), NULL);
  gimp_help_set_help_data (tmpw, _("Delete selected vector"), NULL);

  hbox = gtk_hbox_new (FALSE, 0);
  gtk_box_set_spacing (GTK_BOX (hbox), 12);
  gtk_table_attach_defaults (GTK_TABLE (table1), hbox, 0, 2, 2, 3);
  gtk_widget_show (hbox);

  vbox = gtk_vbox_new (FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
  gtk_widget_show (vbox);

  frame = gimp_int_radio_group_new (TRUE, _("Type"),
                                    G_CALLBACK (vector_type_click_callback),
                                    &vector_type, 0,

                                    _("_Normal"),  0, &vector_types[0],
                                    _("Vorte_x"),  1, &vector_types[1],
                                    _("Vortex_2"), 2, &vector_types[2],
                                    _("Vortex_3"), 3, &vector_types[3],

                                    NULL);
  gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
  gtk_widget_show (frame);

  orient_voronoi = tmpw = gtk_check_button_new_with_mnemonic ( _("_Voronoi"));
  gtk_box_pack_start (GTK_BOX (vbox), tmpw, TRUE, TRUE, 0);
  gtk_widget_show (tmpw);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (tmpw),
                                pcvals.orient_voronoi);
  g_signal_connect (tmpw, "clicked",
                    G_CALLBACK (angle_offset_adjust_move_callback), NULL);
  gimp_help_set_help_data (tmpw,
                          _("Voronoi-mode makes only the vector closest to the given point have any influence"),
                          NULL);

  table2 = gtk_table_new (4, 3, FALSE);
  gtk_table_set_col_spacings (GTK_TABLE (table2), 4);
  gtk_box_pack_start (GTK_BOX (hbox), table2, TRUE, TRUE, 0);
  gtk_widget_show (table2);

  angle_adjust =
    gimp_scale_entry_new (GTK_TABLE (table2), 0, 0,
                          _("A_ngle:"),
                          150, 6, 0.0,
                          0.0, 360.0, 1.0, 10.0, 1,
                          TRUE, 0, 0,
                          _("Change the angle of the selected vector"),
                          NULL);
  g_signal_connect (angle_adjust, "value-changed",
                    G_CALLBACK (angle_adjust_move_callback), NULL);

  angle_offset_adjust =
    gimp_scale_entry_new (GTK_TABLE (table2), 0, 1,
                          _("Ang_le offset:"),
                          150, 6, 0.0,
                          0.0, 360.0, 1.0, 10.0, 1,
                          TRUE, 0, 0,
                          _("Offset all vectors with a given angle"),
                          NULL);
  g_signal_connect (angle_offset_adjust, "value-changed",
                    G_CALLBACK (angle_offset_adjust_move_callback), NULL);

  strength_adjust =
    gimp_scale_entry_new (GTK_TABLE (table2), 0, 2,
                          _("_Strength:"),
                          150, 6, 1.0,
                          0.1, 5.0, 0.1, 1.0, 1,
                          TRUE, 0, 0,
                          _("Change the strength of the selected vector"),
                          NULL);
  g_signal_connect (strength_adjust, "value-changed",
                    G_CALLBACK (strength_adjust_move_callback), NULL);

  orient_map_str_exp_adjust =
    gimp_scale_entry_new (GTK_TABLE (table2), 0, 3,
                          _("S_trength exp.:"),
                          150, 6, 1.0,
                          0.1, 10.9, 0.1, 1.0, 1,
                          TRUE, 0, 0,
                          _("Change the exponent of the strength"),
                          NULL);
  g_signal_connect (orient_map_str_exp_adjust, "value-changed",
                    G_CALLBACK (strength_exponent_adjust_move_callback), NULL);

  gtk_widget_show (orient_map_window);

  update_vector_prev ();
  update_orient_map_preview_prev ();
}