// Minimum required shmem size in bytes
size_t
YCbCrImageDataDeserializerBase::ComputeMinBufferSize(const gfx::IntSize& aYSize,
                                                   uint32_t aYStride,
                                                   const gfx::IntSize& aCbCrSize,
                                                   uint32_t aCbCrStride)
{
  return ComputeOffset(aYSize.height, aYStride)
         + 2 * ComputeOffset(aCbCrSize.height, aCbCrStride)
         + MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
}
// Minimum required shmem size in bytes
size_t
YCbCrImageDataSerializer::ComputeMinBufferSize(const gfx::IntSize& aYSize,
                                               const gfx::IntSize& aCbCrSize)
{
  uint32_t yStride = aYSize.width;
  uint32_t CbCrStride = aCbCrSize.width;

  return ComputeOffset(aYSize.height, yStride)
         + 2 * ComputeOffset(aCbCrSize.height, CbCrStride)
         + MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
}
Exemplo n.º 3
0
// Minimum required shmem size in bytes
size_t
YCbCrImageDataDeserializerBase::ComputeMinBufferSize(const gfx::IntSize& aYSize,
        uint32_t aYStride,
        const gfx::IntSize& aCbCrSize,
        uint32_t aCbCrStride)
{
    MOZ_ASSERT(aYSize.height >= 0 && aYSize.width >= 0);
    if (aYSize.height <= 0 || aYSize.width <= 0 || aCbCrSize.height <= 0 || aCbCrSize.width <= 0) {
        gfxDebug() << "Non-positive YCbCr buffer size request " << aYSize.height << "x" << aYSize.width << ", " << aCbCrSize.height << "x" << aCbCrSize.width;
        return 0;
    }
    return ComputeOffset(aYSize.height, aYStride)
           + 2 * ComputeOffset(aCbCrSize.height, aCbCrStride)
           + MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
}
/**
 * Retrieve the gain calibration value for the specified sampling parameters.
 *
 * @param rate ADS1256_SPS_t The sample rate to lookup for.
 * @param gain ADS1256_PGA_t The gain to lookup for.
 * @param buffer ADS1256_BUFFER_t The buffer setting to lookup for.
 * @param temperature float The temperature value to lookup for.
 * @retval The determined calibration value.
 */
uint32_t Tekdaqc_GetGainCalibration(ADS1256_SPS_t rate, ADS1256_PGA_t gain, ADS1256_BUFFER_t buffer, float temperature) {
	uint8_t rate_index = 0U;
	uint8_t gain_index = 0U;
	uint8_t buffer_index = 0U;
	ComputeTableIndices(&rate_index, &gain_index, &buffer_index, rate, gain, buffer);
	uint32_t baseGain = baseGainCalibrations[rate_index][gain_index][buffer_index];

	if (CALIBRATION_VALID != TRUE) {
#ifdef CALIBRATION_TABLE_DEBUG
		printf("[Calibration Table] The calibration table is not valid, returning ADC calibration only (0x%" PRIX32 ").\n\r", baseGain);
#endif
		return baseGain;
	}
	if (temperature < CAL_TEMP_LOW || temperature > CAL_TEMP_HIGH) {
		/* The temperature is out of range, we will return the closest */
#ifdef CALIBRATION_TABLE_DEBUG
		printf("[Calibration Table] The requested temperature %f was out of range. Minimum is %f and maximum is %f.\n\r", temperature,
				CAL_TEMP_LOW, CAL_TEMP_HIGH);
#endif
		snprintf(TOSTRING_BUFFER, sizeof(TOSTRING_BUFFER),
				"Error fetching the gain calibration value for temperature: %f Deg C. Temperature out of range. Allowable range is %f to %f Deg C",
				temperature, CAL_TEMP_LOW, CAL_TEMP_HIGH);
		TelnetWriteErrorMessage(TOSTRING_BUFFER);
		if (temperature < CAL_TEMP_LOW) {
			temperature = CAL_TEMP_LOW;
		} else {
			temperature = CAL_TEMP_HIGH;
		}
	}

	uint8_t num_temp_steps = (uint8_t) (temperature / CAL_TEMP_STEP);
	float low_temp = CAL_TEMP_LOW * num_temp_steps;
	float high_temp = CAL_TEMP_HIGH * num_temp_steps;
	float factor = (temperature - CAL_TEMP_LOW) / CAL_TEMP_STEP;

	uint32_t offset = ComputeOffset(rate, gain, buffer, low_temp);                                                                                                                                            //Add one for the move to gain
	uint32_t Address = CAL_DATA_START_ADDR + 4 * offset;                                                                                                                                            //Multiply offset by 4 because entries are 4bytes long

	uint32_t data_low = (*(__IO uint32_t*) Address);

	offset = ComputeOffset(rate, gain, buffer, high_temp);                                                                                                                                            //Add one for the move to gain
	Address = CAL_DATA_START_ADDR + 4 * offset;                                                                                                                                            //Multiply offset by 4 because entries are 4bytes long

	uint32_t data_high = (*(__IO uint32_t*) Address);
	return (baseGain + InterpolateValue(data_low, data_high, factor));
}
/**
 * Writes the gain calibration value for the specified parameters. This method requires that the board be in
 * calibration mode and will return FLASH_ERROR_WRP if it is not.
 *
 * @param cal uint32_t The calibration value to write.
 * @param rate ADS1256_SPS_t The sample rate to write for.
 * @param gain ADS1256_PGA_t The gain to write for.
 * @param buffer ADS1256_BUFFER_t The buffer setting to write for.
 * @param temperature float The temperature value to write for.
 * @retval FLASH_Status FLASH_COMPLETE on success, or the error status on failure.
 */
FLASH_Status Tekdaqc_SetGainCalibration(uint32_t cal, ADS1256_SPS_t rate, ADS1256_PGA_t gain, ADS1256_BUFFER_t buffer, float temperature) {
	if (CalibrationModeEnabled == false) {
		return FLASH_ERROR_WRP;
	}

	uint32_t addr = ComputeOffset(rate, gain, buffer, temperature);
	FLASH_Status status = FLASH_ProgramWord(addr, cal);
	return status;
}
Exemplo n.º 6
0
 MinDistanceIntervalTree(const VertexMap<T>& distance_map,
                         const T& distance_max,
                         const TCompare& compare)
 : d_(distance_map),
   popped_(d_.size()),
   size_(d_.size()),
   offset_(ComputeOffset(size_)),
   d_min_(new T[offset_]),
   d_max_(distance_max),
   compare_(compare) {
   std::fill(d_min_, d_min_ + offset_, distance_max);
 }
// Minimum required shmem size in bytes
size_t
YCbCrImageDataSerializer::ComputeMinBufferSize(uint32_t aSize)
{
  return ComputeOffset(aSize) + MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
}
Exemplo n.º 8
0
int main( void )
{
	int32_t tmp = 0x0;
//	uint8_t tmp8;

	cli();

	SetupInterruptPins();

	y_pos = 0;
	x_pos = 0;

//	DDRC = _BV(PC6); //output pin
	SetupDriverPins();

	setup_clock();
	setup_timers();
	SetupPrintf();

	USB_ZeroPrescaler();
	USB_Init();

	sei();

	printf("hello world");

//	motorflags |= 0x01;
//	set_motor_pwm(PWM_MAX);
//	forward();
//	while(1);

//AutoSlop();

/*
AutoSlop();
while(1);
*/

//		dec_backward();
//		set_dec_pwm(0x1fff);
//		ra_forward();
//		set_ra_pwm(0x3fff);

	while(1)
	{
		cli();
//		tmp8 = usbHasEvent;
		//add accumulated radial encoder output
		y_pos += y_tmp;
		y_tmp = 0;

		x_pos += x_tmp;
		x_tmp = 0;
		sei();

		if (usbHasEvent) ProcessUSB();

		if (jog_value_dec == 0) {
			tmp = ComputeOffset(&y_pos,&y_dest); //pid error value
			slew_dec(&tmp);
		}

		if (jog_value_ra == 0) {
			tmp = ComputeOffset(&x_pos,&x_dest); //pid error value
			slew_ra(&tmp);
		}

	}
	return 0;
}