Beispiel #1
0
void    event_handler( event_type_t event_type, unidata_t   unidata )
{
    if( event_type == GIOP_INTERRUPT ) {
        /* Изменилось состояние входов */
#if defined(BLINK_ON)
        port_t  ledpin;
        port_read( LED_PORT, LED1, &ledpin );
        ledpin ^= LED1; 
        port_write( LED_PORT, LED1, ledpin );
#endif
#if defined(INVERT_ATTR)
        unidata = ~unidata;
#endif        
        attr_write( INPUT, &unidata );
    } else if( event_type == EV_AWRITTEN ){
        if( unidata == OUTPUT ) {
            /* Изменён атрибут цифровых выходов */
            port_t  out;
            result_t res = attr_read( OUTPUT, &out );
            if( IS_OK(res) ) {
                /* Записываем в порт новое значение атрибута */
                port_write( OPORT, OPINS, out );
            }
#if defined(BLINK_ON)
            port_t  ledpin;
            port_read( LED_PORT, LED2, &ledpin );
            ledpin ^= LED2; 
            port_write( LED_PORT, LED2, ledpin );
#endif
        }
    }
    return;
}
Beispiel #2
0
uint8_t read_vga_register(register_set_t target, uint8_t index)
{
	switch(target)
	{
	case GRAPHIC_CTRL:
		return gctrl_read(index);
		break;
	case SEQUENCER:
		return seq_read(index);
		break;
	case ATTRIBUTE_CTRL:
		return attr_read(index);
		break;
	case CRT_CTRL:
		return crtc_read(index);
		break;
	case EXTERNAL_REGISTERS:
		switch(index)
		{
		case MISC_OUTPUT_REGISTER:
			return misc_output_read();
			break;
		case FEATURE_CONTROL_REGISTER:
			return feature_control_read();
			break;
		}
		break;
	default:
		break;
	}
	return 0;
}
Beispiel #3
0
static Attr*
read_object (FILE *in)
{
    Attr *attr = NULL;

    /* peek to see if there is more to read from this stream */
    int tmp_char = fgetc(in);
    if (tmp_char == -1) return NULL;
    ungetc(tmp_char, in);

    attr = attr_read (in);

    return attr;
}
Beispiel #4
0
static __inline__ void display_dentries(struct dentry **ptr,int size) {
  register int j;  
  printf ("%-20s%-20s%-20s\n","Name", "Type", "Size");
  for (j = 0; j < size; j++)
    printf ("%-20s%-20s%-10d\n",ptr[j]->name, attr_read(ptr[j]->attr), ptr[j]->v ? ptr[j]->v->ss.size : 0);
}
Beispiel #5
0
void
attr_read_all(PENNFILE *f)
{
  ATTR *a;
  int c, found, count = 0;
  char alias[BUFFER_LEN];

  /* Clear existing attributes */
  ptab_free(&ptab_attrib);

  ptab_start_inserts(&ptab_attrib);

  db_read_this_labeled_int(f, "attrcount", &count);
  for (found = 0;;) {

    c = penn_fgetc(f);
    penn_ungetc(c, f);

    if (c != ' ')
      break;

    found++;

    if ((a = attr_read(f)))
      ptab_insert(&ptab_attrib, a->name, a);
  }

  ptab_end_inserts(&ptab_attrib);

  if (found != count)
    do_rawlog(LT_ERR,
              "WARNING: Actual number of attrs (%d) different than expected count (%d).",
              found, count);

  /* Assumes we'll always have at least one alias */
  db_read_this_labeled_int(f, "attraliascount", &count);
  for (found = 0;;) {
    c = penn_fgetc(f);
    penn_ungetc(c, f);

    if (c != ' ')
      break;

    found++;

    if ((a = attr_alias_read(f, alias))) {
      upcasestr(alias);
      if (!good_atr_name(alias)) {
        do_rawlog(LT_ERR, "Bad attribute name on alias '%s' in db.", alias);
      } else if (aname_find_exact(strupper(alias))) {
        do_rawlog(LT_ERR,
                  "Unable to alias attribute '%s' to '%s' in db: alias already in use.",
                  AL_NAME(a), alias);
      } else if (!alias_attribute(AL_NAME(a), alias)) {
        do_rawlog(LT_ERR, "Unable to alias attribute '%s' to '%s' in db.",
                  AL_NAME(a), alias);
      }
    }
  }
  if (found != count)
    do_rawlog(LT_ERR,
              "WARNING: Actual number of attr aliases (%d) different than expected count (%d).",
              found, count);

  return;
}