예제 #1
0
int main() {
  //Initialize libdlo, claim device and get current mode
  dlo_init_t initFlags;
  dlo_retcode_t err = dlo_init(initFlags);
  if( err != dlo_ok ) {
    printf("Failed to initialize DisplayLink library: %s\n", dlo_strerror(err));
    return 1;
  }

  dlo_claim_t claimFlags;
  dlo_dev_t dev = dlo_claim_first_device(claimFlags, 5000); //dont use dlo_claim_default_device because semihost wont get any argc/argv
  if( !dev ) {
    printf("Failed to claim DisplayLink device\n");
    goto end;
  }

  dlo_mode_t* displayMode = dlo_get_mode(dev);
  if( 0 ) { //activate to set display to 640x480
    dlo_mode_t mode = { .view = {.width = 640, .height = 480, .bpp = displayMode->view.bpp, .base = displayMode->view.base}, .refresh = 0 };
    err = dlo_set_mode(dev, &mode);
    if( err != dlo_ok ) {
      printf("Failed to set mode: %s\n", dlo_strerror(err));
      goto end;
    }
  }
예제 #2
0
DisplayLinkAdapter::DisplayLinkAdapter() {
	dlo_init_t ini_flags = { 0 };
	dlo_claim_t cnf_flags = { 0 };

	OO_ERR(dlo_init(ini_flags));
	uid = dlo_claim_first_device(cnf_flags, 0);
	if (!uid) throw NoDisplayLinkFound();

	setPreferredMode();
}