extern int camera_info (struct camera_info *info) { //PAR_ERROR ret = CE_NO_ERROR; StatusResults gvr; QueryTemperatureStatusResults qtsr; if (!is_init) return -1; sem_lock (); if (MicroCommand (MC_STATUS, cameraID, NULL, &gvr)) goto err; if (MicroCommand (MC_TEMP_STATUS, cameraID, NULL, &qtsr)) goto err; // get camera info get_eeprom (); sem_unlock (); strcpy (info->type, Cams[eePtr.model].fullName); strcpy (info->serial_number, eePtr.serialNumber); if (Cams[eePtr.model].hasTrack) chips = 2; else chips = 1; info->chips = chips; info->chip_info = ch_info; // memcpy(info->chip_info,&(ch_info[0]),sizeof(struct chip_info)); info->temperature_regulation = camera_reg; info->temperature_setpoint = ccd_ad2c (qtsr.ccdSetpoint); info->cooling_power = (qtsr.power == 255) ? 1000 : qtsr.power * 3.906; info->air_temperature = ambient_ad2c (qtsr.ambientThermistor); info->ccd_temperature = ccd_ad2c (qtsr.ccdThermistor); info->fan = gvr.fanEnabled; info->filter = camera_filter; info->can_df = 1; return 0; err: sem_unlock (); errno = ENODEV; return -1; }
/* * Routine: misc_init_r * Description: Configure board specific parts */ int misc_init_r(void) { struct tricorder_eeprom eeprom; get_eeprom(&eeprom); print_hwversion(&eeprom); twl4030_power_init(); status_led_set(0, CONFIG_LED_STATUS_ON); status_led_set(1, CONFIG_LED_STATUS_ON); status_led_set(2, CONFIG_LED_STATUS_ON); omap_die_id_display(); return 0; }
/* * Routine: get_board_mem_timings * Description: If we use SPL then there is no x-loader nor config header * so we have to setup the DDR timings ourself on the first bank. This * provides the timing values back to the function that configures * the memory. We have either one or two banks of 128MB DDR. */ void get_board_mem_timings(struct board_sdrc_timings *timings) { struct tricorder_eeprom eeprom; get_eeprom(&eeprom); /* General SDRC config */ if (eeprom.board_version[0] > 'D') { /* use optimized timings for our SDRAM device */ timings->mcfg = MCFG((256 << 20), 14); #define MT46H64M32_TDAL 6 /* Twr/Tck + Trp/tck */ /* 15/6 + 18/6 = 5.5 -> 6 */ #define MT46H64M32_TDPL 3 /* 15/6 = 2.5 -> 3 (Twr) */ #define MT46H64M32_TRRD 2 /* 12/6 = 2 */ #define MT46H64M32_TRCD 3 /* 18/6 = 3 */ #define MT46H64M32_TRP 3 /* 18/6 = 3 */ #define MT46H64M32_TRAS 7 /* 42/6 = 7 */ #define MT46H64M32_TRC 10 /* 60/6 = 10 */ #define MT46H64M32_TRFC 12 /* 72/6 = 12 */ timings->ctrla = ACTIM_CTRLA(MT46H64M32_TRFC, MT46H64M32_TRC, MT46H64M32_TRAS, MT46H64M32_TRP, MT46H64M32_TRCD, MT46H64M32_TRRD, MT46H64M32_TDPL, MT46H64M32_TDAL); #define MT46H64M32_TWTR 1 #define MT46H64M32_TCKE 1 #define MT46H64M32_XSR 19 /* 112.5/6 = 18.75 => ~19 */ #define MT46H64M32_TXP 1 timings->ctrlb = ACTIM_CTRLB(MT46H64M32_TWTR, MT46H64M32_TCKE, MT46H64M32_TXP, MT46H64M32_XSR); timings->mr = MICRON_V_MR_165; timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; } else { /* use conservative beagleboard timings as default */ timings->mcfg = MICRON_V_MCFG_165(128 << 20); timings->ctrla = MICRON_V_ACTIMA_165; timings->ctrlb = MICRON_V_ACTIMB_165; timings->mr = MICRON_V_MR_165; timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; } }
int cond_init (char *device_name, int camera_id) { short base; int i; //StatusResults sr; QueryTemperatureStatusResults qtsr; GetVersionResults gvr; if (is_init) return 0; base = getbaseaddr (0); // sbig_port...? // lock the device sem_lock (); // This is a standard driver init procedure begin_realtime (); CameraInit (base); if (MicroCommand (MC_GET_VERSION, ST7_CAMERA, NULL, &gvr)) goto err; cameraID = gvr.cameraID; //if(MicroCommand (MC_STATUS, cameraID, NULL, &sr)) goto err; if (MicroCommand (MC_TEMP_STATUS, cameraID, NULL, &qtsr)) goto err; get_eeprom (); if (Cams[eePtr.model].hasTrack) chips = 2; else chips = 1; ch_info = (struct chip_info *) malloc (sizeof (struct chip_info) * chips); for (i = 0; i < chips; i++) { ch_info[i].width = Cams[eePtr.model].horzImage; ch_info[i].height = Cams[eePtr.model].vertImage; ch_info[i].binning_vertical = 1; ch_info[i].binning_horizontal = 1; ch_info[i].pixelX = Cams[eePtr.model].pixelX; ch_info[i].pixelY = Cams[eePtr.model].pixelY; if (i) ch_info[i].gain = eePtr.trackingGain; else ch_info[i].gain = eePtr.imagingGain; } // make space for the read out image { CAMERA *C; int j, k; for (j = 0; j < chips; j++) { OpenCCD (j, &C); free (img[j]); free (lin[j]); img[j] = (unsigned short *) malloc (C->horzTotal * C->vertTotal * sizeof (unsigned short)); lin[j] = (unsigned short **) malloc (C->vertTotal * sizeof (unsigned short *)); for (k = 0; k < C->vertTotal; k++) lin[j][k] = img[j] + k * C->horzTotal; max_line[j] = C->vertTotal; CloseCCD (C); } } // determine temperature regulation state switch (qtsr.enabled) { case 0: // a bit strange: may have different // meanings... (freeze) camera_reg = (qtsr.power > 250) ? CAMERA_COOL_MAX : CAMERA_COOL_OFF; break; case 1: camera_reg = CAMERA_COOL_HOLD; break; break; default: camera_reg = CAMERA_COOL_OFF; } is_init = 1; sem_unlock (); return 0; err: sem_unlock (); errno = ENODEV; return -1; }