Example #1
0
void SystemInit(void) {
   /*
    * This is generic initialization code
    * It may not be correct for a specific target
    */

   /* Use Clock initialisation - if present */
   clock_initialise();

   /* Use UART initialisation - if present */
   console_initialise();

   /* Use RTC initialisation - if present */
   rtc_initialise();

#if defined (__VFP_FP__) && !defined(__SOFTFP__)
   /* Initialise FPU if present & in use */
   __asm__ (
         "  .equ CPACR, 0xE000ED88     \n"
         "                             \n"
         "  LDR.W R0, =CPACR           \n"  // CPACR address
         "  LDR R1, [R0]               \n"  // Read CPACR
         "  ORR R1, R1, #(0xF << 20)   \n"  // Enable CP10 and CP11 coprocessors
         "  STR R1, [R0]               \n"  // Write back the modified value to the CPACR
         "  DSB                        \n"  // Wait for store to complete"
         "  ISB                        \n"  // Reset pipeline now the FPU is enabled
   );
#endif
}
/**
 * @brief Initialize the system
 *
 * Setup the microcontroller system.
 */
void SystemInit(void) {
   /* This is generic initialization code */
   /* It may not be correct for a specific target */

   /* Use Clock initialisation - if present */
   clock_initialise();

   /* Use UART initialisation - if present */
   uart_initialise(19200);

   /* Use RTC initialisation - if present */
   rtc_initialise();

}
Example #3
0
void
SYS_NetBSD_Initialise(void)
{
  static struct nlist nl[] = {
    {"_tickadj"},
    {"_bigadj"},
    {NULL}
  };

  kvm_t *kt;
  FILE *fp;

  kt = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
  if (!kt) {
    LOG_FATAL(LOGF_SysNetBSD, "Cannot open kvm");
  }

  if (kvm_nlist(kt, nl) < 0) {
    LOG_FATAL(LOGF_SysNetBSD, "Cannot read kernel symbols");
  }

  if (kvm_read(kt, nl[0].n_value, (char *)(&kern_tickadj), sizeof(int)) < 0) {
    LOG_FATAL(LOGF_SysNetBSD, "Cannot read from _tickadj");
  }

  if (kvm_read(kt, nl[1].n_value, (char *)(&kern_bigadj), sizeof(long)) < 0) {
    /* kernel doesn't have the symbol, use one second instead */
    kern_bigadj = 1000000;
  }

  kvm_close(kt);

  clock_initialise();

  lcl_RegisterSystemDrivers(read_frequency, set_frequency, 
                            accrue_offset, apply_step_offset,
                            get_offset_correction,
                            NULL /* set_leap */);

}