Пример #1
0
/* set_srq_at - see set_clock_at (nice for debugging) */
static __attribute__((unused)) void set_srq_at(uint32_t time, unsigned int state, unsigned int wait) {
  /* check if requested time is possible */
  // FIXME: Wrap in debugging macro?
  if (IEC_MTIMER_SRQ->TC > reference_time+time)
    set_test_led(1);

  /* set match time */
  IEC_MTIMER_SRQ->IEC_MATCH_SRQ = reference_time + time;

  /* reset match interrupt flag */
  IEC_MTIMER_SRQ->IR = BV(IEC_OPIN_SRQ);

  /* set match action */
  if (state) {
    IEC_MTIMER_SRQ->EMR = (IEC_MTIMER_SRQ->EMR & ~(3 << (4+IEC_OPIN_SRQ*2))) |
                           EMR_HIGH << (4+IEC_OPIN_SRQ*2);
  } else {
    IEC_MTIMER_SRQ->EMR = (IEC_MTIMER_SRQ->EMR & ~(3 << (4+IEC_OPIN_SRQ*2))) |
                           EMR_LOW << (4+IEC_OPIN_SRQ*2);
  }

  /* optional: wait for match */
  if (wait)
    while (!BITBAND(IEC_MTIMER_SRQ->IR, IEC_OPIN_SRQ)) ;
}
Пример #2
0
/**
 * read_bus_at - reads the IEC bus at a certain time
 * @time: read time in 100ns after reference_time
 *
 * This function returns the current IEC bus state at a certain time
 * after the reference_time set by a previous wait_* function.
 */
static __attribute__((unused)) uint32_t read_bus_at(uint32_t time) {
  /* check if requested time is possible */
  // FIXME: Wrap in debugging macro?
  if (IEC_TIMER_A->TC >= reference_time+time)
    set_test_led(1);

  // FIXME: This could be done in hardware using DMA
  /* Wait until specified time */
  while (IEC_TIMER_A->TC < reference_time+time) ;

  return iec_bus_read();
}
Пример #3
0
void UsageFault_Handler(void) {
  set_test_led(1);
  while (1) ;
}
Пример #4
0
void BusFault_Handler(void) {
  set_test_led(1);
  while (1);
}
Пример #5
0
void MemManage_Handler(void) {
  set_test_led(1);
  while (1) ;
}
Пример #6
0
void HardFault_Handler(void) {
  set_test_led(1);
  while (1) ;
}