Advertisement
Guest User

Untitled

a guest
Sep 27th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1.  
  2. // export to HAL
  3. hm2->hm2dpll.pins = hal_malloc(sizeof(hm2_hm2dpll_pins_t));
  4. ...
  5. r += hal_pin_float_newf(HAL_IN, &(hm2->hm2dpll.pins->base_freq),
  6. hm2->llio->comp_id, "%s.hm2dpll.base-freq", hm2->llio->name);
  7. ...
  8. r += hal_pin_u32_newf(HAL_IN, &(hm2->hm2dpll.pins->ddssize),
  9. hm2->llio->comp_id, "%s.hm2dpll.ddsize", hm2->llio->name);
  10. r += hal_pin_u32_newf(HAL_IN, &(hm2->hm2dpll.pins->prescale),
  11. hm2->llio->comp_id, "%s.hm2dpll.prescale", hm2->llio->name);
  12. ...
  13.  
  14. void hm2_hm2dpll_write(hostmot2_t *hm2, long period) {
  15. hm2_hm2dpll_pins_t *pins;
  16. double period_ms = period / 1000;
  17. u32 buff;
  18.  
  19. if (hm2->hm2dpll.num_instances == 0) return;
  20.  
  21. pins = hm2->hm2dpll.pins;
  22.  
  23. buff = (u32)(*hm2->hm2dpll.pins->base_freq * period * 1e-6)
  24. / (( 1 << *pins->ddssize) * *pins->prescale);
  25. if (buff != hm2->hm2dpll.base_rate_written){
  26. hm2->llio->write(hm2->llio,
  27. hm2->hm2dpll.base_rate_addr,
  28. &buff,
  29. sizeof(u32));
  30. HM2_PRINT("setting base rate to %08x\n", buff);
  31. hm2->hm2dpll.base_rate_written= buff;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement