/* ORI */
void test_ori() {
    test_execute(create_itype_hex(0xFFFF, I_T0, I_T1, OC_ORI));
    assert((T0 == 0xFFFF) | (T0 == T1));
    
    test_execute(create_itype_hex(0x00FF, I_T0, I_T1, OC_ORI));
    assert((T0 == 0xFF) | (T0 == T1));
}
Beispiel #2
0
/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * Activates the serial driver 3 using the driver default configuration.
   */
  sdStart(&SD3, NULL);

  /*
   * Creates the example thread.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO + 1, Thread1, NULL);

  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (true) {
    if (palReadLine(LINE_BUTTON)) {
      test_execute((BaseSequentialStream *)&SD3, &rt_test_suite);
      test_execute((BaseSequentialStream *)&SD3, &oslib_test_suite);
    }
    chThdSleepMilliseconds(500);
  }
}
Beispiel #3
0
/* LUI */
void test_lui() {
    test_execute(create_itype_hex(0xFFFF, I_T0, I_ZERO, OC_LUI));
    assert(T0 == 0xFFFF0000);
    
    test_execute(create_itype_hex(0x0001, I_T0, I_ZERO, OC_LUI));
    assert(T0 == 0x00010000);
}
Beispiel #4
0
/* ORI */
void test_ori() {
     T2 = 0x0000A005;
     test_execute(create_itype_hex(0xA099, I_T0, I_T2, OC_ORI));
     assert(T0 == (0x0000A005 | 0xA099));

     test_execute(create_itype_hex(0xFFFF, I_T0, I_T2, OC_ORI));
     assert(T0 == 0x0000FFFF);
}
Beispiel #5
0
/* ORI */
void test_ori() {
	T0 = 0x0000A0A0;
	test_execute(create_itype_hex(0x0A0A, I_T2, I_T0, OC_ORI));
	assert(T2 == 0x0000AAAA);
	
	T0 = 0x0000F0F0;
	test_execute(create_itype_hex(0x0000, I_T2, I_T0, OC_ORI));
	assert(T2 == 0x0000F0F0);
}
Beispiel #6
0
/* ORI */
void test_ori() {
    T0 = 0xFFFF0000;
    test_execute(create_itype_hex(0x0000FFFF, I_T0, I_T0, OC_ORI));
    assert(T0 == 0xFFFFFFFF);

    T0 = 0xF0F0F0F0;
    test_execute(create_itype_hex(0x0000FFF0, I_T0, I_T0, OC_ORI));
    assert(T0 == 0xF0F0FFF0);

}
Beispiel #7
0
/* SUB */
void test_sub() {
	T1 = 5;
	T2 = 3;
	test_execute(create_rtype_hex(FC_SUB, 0x0000, I_T0, I_T1, I_T2, OC_SUB));
	assert(T0 == -2);
	
	T1 = 3; 
	T2 = 6;
	test_execute(create_rtype_hex(FC_SUB, 0x0000, I_T0, I_T1, I_T2, OC_SUB));
	assert(T0 == 3);
}
Beispiel #8
0
/* LW */
void test_lw() {
    word location1 = 0x00001000;
        
    word w = 0xFFFFFFFF;
    storeWord(w, location1);
    T1 = location1;
    test_execute(create_itype_hex(0x0000, I_T0, I_T1, OC_LW));
    assert(T0 == w);

    w =0x12345678;
    storeWord(w, location1 + 0x0001);
    T1 = location1;
    test_execute(create_itype_hex(0x0001, I_T0, I_T1, OC_LW));
    assert(T0 == w);
}
Beispiel #9
0
/* ADD */
void test_add() {
    T1=1;
    T2=1;
    test_execute(create_rtype_hex(FC_ADD, 0x0000, I_T0, I_T1, I_T2, OC_ADD));
    assert(T0==2);

    T1=1;
    T2=-1;
    test_execute(create_rtype_hex(FC_ADD, 0x0000, I_T0, I_T1, I_T2, OC_ADD));
    assert(T0==0);

    T1=-1;
    T2=-1;
    test_execute(create_rtype_hex(FC_ADD, 0x0000, I_T0, I_T1, I_T2, OC_ADD));
    assert(T0==-2);
}
Beispiel #10
0
/* SW */
void test_sw() {
    word location1 = 0x00001000;
    word location2 = 0x00001004;

    word w = 0xFFFFFFFF;
    T0 = w;
    T1 = location1;
    test_execute(create_itype_hex(0x0000, I_T0, I_T1, OC_SW));
    assert(loadWord(location1) == w);

    w =0x12345678;
    T0 = w;
    T1 = location2;
    test_execute(create_itype_hex(0xFFFC, I_T0, I_T1, OC_SW));
    assert(loadWord(location1) == w);
}
Beispiel #11
0
/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  palClearPad(IOPORT2, PORTB_LED1);

  /*
   * Activates the serial driver 1 using the driver default configuration.
   */
  sdStart(&SD1, NULL);

  /*
   * Starts the LED blinker thread.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  test_execute((BaseSequentialStream *)&SD1);
  while(TRUE) {
    chThdSleepMilliseconds(1000);
  }
}
Beispiel #12
0
int main(void)
{
  INTR_DISABLE; /* 割込み無効にする */

  init_system();
  init_components();
  test_execute();

  if (PORTCONF_SDC_DETECT() && !sw_read(Sw1)) {
      puts("Boot : SDC detected.\n");
      puts("Boot : Booting from SDC.\n");
      boot_from_sdc("kozos");
      puts("Boot : Boot from SDC failed.\n");
      puts("Boot : Going to serial boot mode.\n");
      boot_from_ser();
  } else {
      puts("Boot : SDC not found.\n");
      puts("Boot : Going to serial boot mode.\n");
      boot_from_ser();
  }

  for (;;) { }

  return 0;
}
Beispiel #13
0
/* SUB */
void test_sub() {
	T1=2;
        T2=8;
        test_execute(create_rtype_hex(FC_SUB, 0x0000, I_T0, I_T1, I_T2, OC_SUB));
        assert(T0==6);

        T1=8;
        T2=2;
        test_execute(create_rtype_hex(FC_SUB, 0x0000, I_T0, I_T1, I_T2, OC_SUB));
        assert(T0==-6);

        T1=4;
        T2=4;
        test_execute(create_rtype_hex(FC_SUB, 0x0000, I_T0, I_T1, I_T2, OC_SUB));
        assert(T0==0);
}
Beispiel #14
0
/* LW */
void test_lw() {
    word location1 =  0x00001230;
    word location2 =  0x00001234;

    word w = 0xFFFFFFFF;
    storeWord(w, location1);
    T1 = location1;
    test_execute(create_itype_hex(0x0000, I_T0, I_T1, OC_LW));
    assert(T0 == w);

    w = 0x87654321;
    storeWord(w, location2);
    T1 = location1;
    test_execute(create_itype_hex(0x0004, I_T0, I_T1, OC_LW));
    assert(T0 == w);
}
Beispiel #15
0
/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * Activates serial 1 (UART0) using the driver default configuration.
   */
  sdStart(&SD1, NULL);

  /*
   * Creates the blinker threads.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
  chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);
  chThdCreateStatic(waThread3, sizeof(waThread3), NORMALPRIO, Thread3, NULL);

  test_execute((BaseSequentialStream *)&SD1);
  while (1) {
    chThdSleepMilliseconds(500);
  }
}
Beispiel #16
0
/*
 * Application entry point.
 */
int main(void) {
  uint32 blinker_id;

  /* HAL initialization, this also initializes the configured device drivers
     and performs the board-specific initializations.*/
  halInit();

  /* OS initialization.*/
  (void) OS_API_Init();

  /* Activates the serial driver 1 using the driver default configuration.*/
  sdStart(&SD1, NULL);

  /* ARD_D13 is programmed as output (board LED).*/
  palClearLine(LINE_ARD_D13);
  palSetLineMode(LINE_ARD_D13, PAL_MODE_OUTPUT_PUSHPULL);

  /* Starting the blinker thread.*/
  (void) OS_TaskCreate(&blinker_id, "blinker", blinker,
                       (uint32 *)wa_blinker, sizeof wa_blinker,
                       128, 0);

  /* In the ChibiOS/RT OSAL implementation the main() function is an
     usable thread with priority 128 (NORMALPRIO), here we just sleep
     waiting for a button event, then the test suite is executed.*/
  while (true) {
    if (palReadLine(LINE_BUTTON_USER))
      test_execute((BaseSequentialStream *)&SD1, &nasa_osal_test_suite);
    OS_TaskDelay(500);
  }
}
Beispiel #17
0
/* printf memory */
void test_printf_memory_write() {
    byte buf[4];
    word w = 'a' << 24 | 'b'<<16 | 'c'<<8 | '\n';

    /* set up a testfile in write mode */
    FILE *file = fopen(TESTFILE,"w");
    assert(file);

    /* redirect output of fprintf memory to this file */
    outputStream = file;

    /* write the string "abc" to fprintf */
    S2 = FPRINTF_MEMORY_LOCATION;
    S1 = w;
    test_execute(create_itype_hex(0x000, I_S1, I_S2, OC_SW));
    fclose(file);

    /* check if the output was "abc" */
    file = fopen(TESTFILE,"r");
    assert(file);
    fread(buf, 1, 4, file);
    fclose(file);
    assert(buf[0] == 'a');
    assert(buf[1] == 'b');
    assert(buf[2] == 'c');
    assert(buf[3] == '\n');
}
Beispiel #18
0
/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * Activates the serial driver 2 using the driver default configuration.
   */
  sdStart(&SD2, NULL);
  chprintf((BaseSequentialStream *)&SD2, "SYSCLK=%u\r\n", STM32_SYSCLK);

  /*
   * Creates the blinker thread.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (true) {
    if (!palReadPad(GPIOC, GPIOC_BUTTON))
      test_execute((BaseSequentialStream *)&SD2);
    chThdSleepMilliseconds(500);
  }
}
Beispiel #19
0
/* SUB */
void test_sub() {
    T1 = 4;
    T2 = 5;
    test_execute(create_rtype_hex(FC_SUB, 0x0000, I_T0, I_T1, I_T2, OC_SUB));
    assert(T0==1);
    
    T1 = 7;
    T2 = 3;
    test_execute(create_rtype_hex(FC_SUB, 0x0000, I_T0, I_T1, I_T2, OC_SUB));
    assert(T0==-4);
    
    T1 = 4;
    T2 = -1;
    test_execute(create_rtype_hex(FC_SUB, 0x0000, I_T0, I_T1, I_T2, OC_SUB));
    assert(T0==-5);
}
int main( void ) {
    test_input();
    test_parse();
    test_getPath();
    test_forkAndRun();
    test_execute();
    return 0;
}   
Beispiel #21
0
/* LW */
void test_lw() {
	word location = 0x000000FF;
	
	word save = 0xDEADBEEF;
	storeWord(save, location);
	T1 = location;

	test_execute(create_itype_hex(0x0000, I_T0, I_T1, OC_LW));
	assert(T0 == save);
} 
Beispiel #22
0
/* MULT */
void test_mult() {
    T1=2;
    T2=3;
    test_execute(create_rtype_hex(FC_MULT, 0x0000, I_T0, I_T1, I_T2, OC_MULT));
    assert(T0==6);

    T1=-2;
    T2=3;
    test_execute(create_rtype_hex(FC_MULT, 0x0000, I_T0, I_T1, I_T2, OC_MULT));
    assert(T0==-6);

    T1=2;
    T2=-3;
    test_execute(create_rtype_hex(FC_MULT, 0x0000, I_T0, I_T1, I_T2, OC_MULT));
    assert(T0==-6);

    T1=-2;
    T2=-3;
    test_execute(create_rtype_hex(FC_MULT, 0x0000, I_T0, I_T1, I_T2, OC_MULT));
    assert(T0==6);
}
Beispiel #23
0
THD_FUNCTION(Thread2, arg) {

  (void)arg;

  /*
   * Activates the serial driver 1 using the driver default configuration.
   */
  sdStart(&SD1, NULL);

  /* Welcome message.*/
  chnWriteTimeout(&SD1, (uint8_t *)"Hello World!\r\n", 14, TIME_INFINITE);

  /* Waiting for button push and activation of the test suite.*/
  while (true) {
    if (palReadPad(PORT_E, PE_BUTTON1)) {
      test_execute((BaseSequentialStream *)&SD1, &nil_test_suite);
      test_execute((BaseSequentialStream *)&SD1, &oslib_test_suite);
    }
    chThdSleepMilliseconds(500);
  }
}
Beispiel #24
0
THD_FUNCTION(Thread2, arg) {

  (void)arg;

  /*
   * Activate the serial driver 0 using the driver default configuration.
   */
  sdStart(&SD0, NULL);

  while (chnGetTimeout(&SD0, TIME_INFINITE)) {
    chnWrite(&SD0, (const uint8_t *)"Hello World!\r\n", 14);
    test_execute((void*)&SD0);
    chThdSleepMilliseconds(2000);
  }
}
Beispiel #25
0
THD_FUNCTION(Thread3, arg) {

  (void)arg;

  /*
   * Activates the serial driver 1 using the driver default configuration.
   * PA9 and PA10 are routed to USART1.
   */
  sdStart(&SD1, NULL);
  palSetPadMode(GPIOA, 9, PAL_MODE_ALTERNATE(7));       /* USART1 TX.       */
  palSetPadMode(GPIOA, 10, PAL_MODE_ALTERNATE(7));      /* USART1 RX.       */

  /* Welcome message.*/
  chnWrite(&SD1, (const uint8_t *)"Hello World!\r\n", 14);

  /* Waiting for button push and activation of the test suite.*/
  while (true) {
    if (palReadPad(GPIOA, GPIOA_BUTTON))
      test_execute((BaseSequentialStream *)&SD1);
    chThdSleepMilliseconds(500);
  }
}
Beispiel #26
0
/*
 * Simulator main.
 */
int main(int argc, char *argv[]) {

  (void)argc;
  (void)argv;

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  conInit();
  chSysInit();

  test_execute((BaseSequentialStream *)&CD1);
  if (test_global_fail)
    exit(1);
  else
    exit(0);
}
Beispiel #27
0
/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * Turning off buck switch. Note that this means to completely turn of the
   * High Brightness LED which is driven by the buck converter.
   */
  palSetLineMode(LINE_BK_Drive, PAL_MODE_OUTPUT_PUSHPULL);
  palClearLine(LINE_BK_Drive);

  /*
   * Activates the serial driver 2 using the driver default configuration.
   */
  sdStart(&SD2, NULL);

  /*
   * Creates the blinker thread.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (true) {
    if (palReadPad(GPIOA, GPIOA_BUTTON))
      test_execute((BaseSequentialStream *)&SD2);
    chThdSleepMilliseconds(500);
  }
}
Beispiel #28
0
/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();
  lwipInit(NULL);

  /*
   * Activates the serial driver 3 using the driver default configuration.
   */
  sdStart(&SD3, NULL);

  /*
   * Creates the blinker thread.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  /*
   * Creates the HTTP thread (it changes priority internally).
   */
  chThdCreateStatic(wa_http_server, sizeof(wa_http_server), NORMALPRIO + 1,
                    http_server, NULL);

  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (true) {
    if (palReadPad(GPIOC, GPIOC_SWITCH_TAMPER) == 0)
      test_execute((BaseSequentialStream *)&SD3);
    chThdSleepMilliseconds(500);
  }
}
Beispiel #29
0
/* ADDI */
void test_addi() {
    test_execute(create_itype_hex(0xFFFF, I_T0, I_ZERO, OC_ADDI));
    assert(T0 == -1);
    test_execute(create_itype_hex(1, I_T0, I_T0, OC_ADDI));
    assert(T0 ==  0);

    test_execute(create_itype_hex(0xFFFF, I_T0, I_ZERO, OC_ADDI));
    assert(T0 == -1);
    test_execute(create_itype_hex(0xFFFF, I_T0, I_T0, OC_ADDI));
    assert(T0 == -2);

    test_execute(create_itype_hex(3, I_T0, I_ZERO, OC_ADDI));
    assert(T0 ==  3);
    test_execute(create_itype_hex(1, I_T1, I_T0, OC_ADDI));
    assert(T0 ==  3);
    assert(T1 ==  4);
}
Beispiel #30
0
/*
 * Application entry point.
 */
int main(void) {

  /*
   * System initializations.
   * - HAL initialization, this also initializes the configured device drivers
   *   and performs the board-specific initializations.
   * - Kernel initialization, the main() function becomes a thread and the
   *   RTOS is active.
   */
  halInit();
  chSysInit();

  /*
   * ARD_D13 is programmed as output (board LED).
   */
  palClearLine(LINE_ARD_D13);
  palSetLineMode(LINE_ARD_D13, PAL_MODE_OUTPUT_PUSHPULL);

  /*
   * Activates the serial driver 1 using the driver default configuration.
   */
  sdStart(&SD1, NULL);

  /*
   * Creates the example thread.
   */
  chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

  /*
   * Normal main() thread activity, in this demo it does nothing except
   * sleeping in a loop and check the button state.
   */
  while (true) {
    if (palReadLine(LINE_BUTTON_USER))
      test_execute((BaseSequentialStream *)&SD1);
    chThdSleepMilliseconds(500);
  }
}