C/C++

Setting HS Timers

0 490
luckbox  
Edited by luckbox at Jul 31, 2016 23:13

Has anyone had luck setting hs timers on the BPi? I was able to set the low no problem.
  1. #define HST_REG_SIZE 0x84
  2.    
  3. int main()
  4. {
  5.     char buf2_[HST_REG_SIZE];
  6.     char* hst_map = buf2_;

  7.     uint32_t* addrHST = hst_map;

  8.     // offset of hs timer irq enable reg: 0x0
  9.     uint32_t hsTimerIrqOffset = 0x0;

  10.     volatile uint32_t* addrHSTimerIRQ = (uint32_t*)((uint32_t)addrHST | hsTimerIrqOffset);

  11.     // print address of hsttimer irq register.
  12.     printf("\nHSTimer IRQ address should be: %x\n", (uint32_t)addrHSTimerIRQ);

  13.     // print whats in that register.
  14.     printf("\nHSTimer IRQ at that address contains: %x\n", *addrHSTimerIRQ);

  15.     *addrHSTimerIRQ |= 0x1;
  16.     // print whats in that register.
  17.     printf("\nHSTimer IRQ at that address now contains: %x\n", *addrHSTimerIRQ);
  18. }
Copy the Code



Do I need to set something else first?
You have to log in before you can reply Login | Sign Up

Points Rules