void pwm_gpt_stop(int id) { if ( !_check_id(id) ) { return; } if ( !_check_timer(id) ) { return; } omap_dm_timer_stop(gpt_pwm_list[id].timer); omap_dm_timer_disable(gpt_pwm_list[id].timer); }
void pwm_gpt_dump(int id) { int i; if ( !_check_id(id) ) { return; } if ( !_check_timer(id) ) { return; } for (i=0;i<(17*4);i+=4) printk("0x%02x: 0x%08x\n", i, omap_dm_timer_read_reg(gpt_pwm_list[id].timer,i)); }
void pwm_gpt_start(int id) { if ( !_check_id(id) ) { return; } if ( !_check_timer(id) ) { return; } /* enable the timer, start the clock */ omap_dm_timer_enable(gpt_pwm_list[id].timer); /* do not wait for ack, just set up the reg and leave */ /* this is better if you setup 2 correlated timers */ omap_dm_timer_start(gpt_pwm_list[id].timer); }
//Initialize Sentral bool AP_SENTRAL::init() { //Turn on orientation sensor by setting sensor rate uint8_t paramPage = SENTRAL_PARAM_PAGE_SENSOR_CONF; //ParamInfo param = { SENSOR_TYPE_ORIENTATION, 2 }; uint8_t rate = 200; hal.scheduler->suspend_timer_procs(); AP_HAL::Semaphore *i2c_sem = hal.i2c->get_semaphore(); if (!i2c_sem || !i2c_sem->take(HAL_SEMAPHORE_BLOCK_FOREVER)) { hal.console->printf("Sentral: Unable to get bus semaphore\n"); if (!i2c_sem) { hal.console->printf("bus semaphore is NULL!!!!! x.x\n"); } goto fail_sem; } if (!_check_id()) { hal.console->printf("Sentral : Wrong id\n"); goto fail; } //Enable Sentral CPU if (!_sentral_init()) { hal.console->printf("Sentral : init failed...\n"); goto fail; } //Set scale later // Turn on sensor by setting rates to it if (!(_7186_param_write((uint8_t*)&rate, paramPage, ¶m_orient, 1))) { hal.console->printf("Sentral : param write failed...\n"); goto fail; } // Turn on sensor by setting rates to it if (!(_7186_param_write((uint8_t*)&rate, paramPage, ¶m_baro, 1))) { hal.console->printf("Sentral : param write failed...\n"); goto fail; } // Turn on sensor by setting rates to it //if (!(_7186_param_write((uint8_t*)&rate, paramPage, ¶m_accel, 1))) { // hal.console->printf("Sentral : param write failed...\n"); // goto fail; //} /*/ // Turn on sensor by setting rates to it if (!(_7186_param_write((uint8_t*)&rate, paramPage, ¶m_gyro, 1))) { hal.console->printf("Sentral : param write failed...\n"); goto fail; } // Turn on sensor by setting rates to it if (!(_7186_param_write((uint8_t*)&rate, paramPage, ¶m_mag, 1))) { hal.console->printf("Sentral : param write failed...\n"); goto fail; } */ _initialized = true; i2c_sem->give(); hal.scheduler->resume_timer_procs(); return true; fail: i2c_sem->give(); fail_sem: hal.scheduler->resume_timer_procs(); return false; }