diff --git a/caravel_board/firmware_vex/mpw8_tests/IRQ_external/IRQ_external.c b/caravel_board/firmware_vex/mpw8_tests/IRQ_external/IRQ_external.c index 96367354..45689774 100755 --- a/caravel_board/firmware_vex/mpw8_tests/IRQ_external/IRQ_external.c +++ b/caravel_board/firmware_vex/mpw8_tests/IRQ_external/IRQ_external.c @@ -40,12 +40,12 @@ Enable interrupt for IRQ external pin mprj_io[7] -> should be drived to 1 by the bool IRQ_external() { - clear_flag(); + IRQ_clearFlag(); - configure_gpio(7,GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(7,GPIO_MODE_MGMT_STD_INPUT_NOPULL); - gpio_config_load(); - enable_external1_irq(1); + GPIOs_loadConfigs(); + IRQ_enableExternal1(1); reg_irq_source = 1; config_uart(); print("Start Test: IRQ_external\n"); @@ -57,7 +57,7 @@ bool IRQ_external() for (int i = 0; i < timeout; i++) { - if (get_flag() == 1) + if (IRQ_getFlag() == 1) { is_pass = true; return true; diff --git a/caravel_board/firmware_vex/mpw8_tests/IRQ_external2/IRQ_external2.c b/caravel_board/firmware_vex/mpw8_tests/IRQ_external2/IRQ_external2.c index 6c4d27bd..959df5f2 100755 --- a/caravel_board/firmware_vex/mpw8_tests/IRQ_external2/IRQ_external2.c +++ b/caravel_board/firmware_vex/mpw8_tests/IRQ_external2/IRQ_external2.c @@ -40,12 +40,12 @@ Enable interrupt for IRQ external pin mprj_io[12] -> should be drived to 1 by th bool IRQ_external2() { - clear_flag(); + IRQ_clearFlag(); - configure_gpio(12,GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(12,GPIO_MODE_MGMT_STD_INPUT_NOPULL); - gpio_config_load(); - enable_external2_irq(1); + GPIOs_loadConfigs(); + IRQ_enableExternal2(1); reg_irq_source = 2; // enable set housekeeping irq register config_uart(); print("Start Test: IRQ_external2\n"); @@ -57,7 +57,7 @@ bool IRQ_external2() for (int i = 0; i < timeout; i++) { - if (get_flag() == 1) + if (IRQ_getFlag() == 1) { is_pass = true; return true; diff --git a/caravel_board/firmware_vex/mpw8_tests/IRQ_spi/IRQ_spi.c b/caravel_board/firmware_vex/mpw8_tests/IRQ_spi/IRQ_spi.c index 4478b978..e4749153 100755 --- a/caravel_board/firmware_vex/mpw8_tests/IRQ_spi/IRQ_spi.c +++ b/caravel_board/firmware_vex/mpw8_tests/IRQ_spi/IRQ_spi.c @@ -40,8 +40,8 @@ wait for interrupt bool IRQ_spi() { - clear_flag(); - enable_hk_spi_irq(1); + IRQ_clearFlag(); + IRQ_hkSpi(1); user_irq_0_ev_pending_write(1); reg_hkspi_irq = 1; // Loop, waiting for the interrupt to change reg_mprj_datah @@ -50,7 +50,7 @@ bool IRQ_spi() for (int i = 0; i < timeout; i++) { - if (get_flag() == 1) + if (IRQ_getFlag() == 1) { is_pass = true; return true; diff --git a/caravel_board/firmware_vex/mpw8_tests/IRQ_timer/IRQ_timer.c b/caravel_board/firmware_vex/mpw8_tests/IRQ_timer/IRQ_timer.c index 6210e6bf..2546cfb6 100755 --- a/caravel_board/firmware_vex/mpw8_tests/IRQ_timer/IRQ_timer.c +++ b/caravel_board/firmware_vex/mpw8_tests/IRQ_timer/IRQ_timer.c @@ -41,17 +41,17 @@ wait for interrupt bool IRQ_timer() { - clear_flag(); - enable_timer0_irq(1); + IRQ_clearFlag(); + IRQ_enableTimer(1); timer0_ev_pending_write(1); - timer0_oneshot_configure(10000); + timer0_configureOneShot(10000); // Loop, waiting for the interrupt to change reg_mprj_datah bool is_pass = false; int timeout = 500000; for (int i = 0; i < timeout; i++){ - if (get_flag() == 1) + if (IRQ_getFlag() == 1) { is_pass = true; return true; diff --git a/caravel_board/firmware_vex/mpw8_tests/IRQ_uart/IRQ_uart.c b/caravel_board/firmware_vex/mpw8_tests/IRQ_uart/IRQ_uart.c index 8c0ed1bd..d8336791 100755 --- a/caravel_board/firmware_vex/mpw8_tests/IRQ_uart/IRQ_uart.c +++ b/caravel_board/firmware_vex/mpw8_tests/IRQ_uart/IRQ_uart.c @@ -40,10 +40,10 @@ wait for interrupt bool IRQ_uart() { - clear_flag(); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - gpio_config_load(); - enable_uart_tx_irq(1); + IRQ_clearFlag(); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_loadConfigs(); + IRQ_enableUartTx(1); uart_ev_pending_write(1); print("M"); @@ -53,7 +53,7 @@ bool IRQ_uart() for (int i = 0; i < timeout; i++) { - if (get_flag() == 1) + if (IRQ_getFlag() == 1) { is_pass = true; return true; diff --git a/caravel_board/firmware_vex/mpw8_tests/IRQ_uart_rx/IRQ_uart_rx.c b/caravel_board/firmware_vex/mpw8_tests/IRQ_uart_rx/IRQ_uart_rx.c index 57d213be..9b3136cc 100755 --- a/caravel_board/firmware_vex/mpw8_tests/IRQ_uart_rx/IRQ_uart_rx.c +++ b/caravel_board/firmware_vex/mpw8_tests/IRQ_uart_rx/IRQ_uart_rx.c @@ -40,12 +40,12 @@ wait for interrupt bool IRQ_uart_rx() { - clear_flag(); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - configure_gpio(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - gpio_config_load(); - uart_RX_enable(1); - enable_uart_rx_irq(1); + IRQ_clearFlag(); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_loadConfigs(); + UART_enableRX(1); + IRQ_enableUartRx(1); uart_ev_pending_write(1); config_uart(); send_packet(2); @@ -55,7 +55,7 @@ bool IRQ_uart_rx() for (int i = 0; i < timeout; i++) { - if (get_flag() == 1) + if (IRQ_getFlag() == 1) { is_pass = true; send_packet(5); @@ -67,7 +67,7 @@ bool IRQ_uart_rx() send_packet(9); // timeout } empty_buffer(); - uart_RX_enable(0); - enable_uart_rx_irq(0); + UART_enableRX(0); + IRQ_enableUartRx(0); uart_ev_pending_write(0); } diff --git a/caravel_board/firmware_vex/mpw8_tests/bitbang_i/bitbang_i.c b/caravel_board/firmware_vex/mpw8_tests/bitbang_i/bitbang_i.c index 5439d775..65fffb9e 100644 --- a/caravel_board/firmware_vex/mpw8_tests/bitbang_i/bitbang_i.c +++ b/caravel_board/firmware_vex/mpw8_tests/bitbang_i/bitbang_i.c @@ -29,38 +29,38 @@ void main() int timeout = 10000; long int timeout_count = 0; char *c; - bb_configure_all_gpios(GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + bb_configureAllGpios(GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); config_uart(); print("Start Test: bitbang_i\n"); while (true) { - c = uart_get_line(); + c = UART_readLine(); io_number = get_int_from_string(c); if (io_number >= 32) { temp_io = io_number - 32; mask = 0x1 << temp_io; - old_recieved = get_gpio_h() & mask; + old_recieved = GPIOs_readHigh() & mask; } else { mask = 0x1 << io_number; - old_recieved = get_gpio_l() & mask; + old_recieved = GPIOs_readLow() & mask; } while (true) { if (io_number >= 32) { - recieved = get_gpio_h() & mask; // mask gpio bit + recieved = GPIOs_readHigh() & mask; // mask gpio bit } else { - recieved = get_gpio_l() & mask; // mask gpio bit + recieved = GPIOs_readLow() & mask; // mask gpio bit } if (recieved != old_recieved) { diff --git a/caravel_board/firmware_vex/mpw8_tests/bitbang_i_h/bitbang_i_h.c b/caravel_board/firmware_vex/mpw8_tests/bitbang_i_h/bitbang_i_h.c index a049d776..32d62e63 100644 --- a/caravel_board/firmware_vex/mpw8_tests/bitbang_i_h/bitbang_i_h.c +++ b/caravel_board/firmware_vex/mpw8_tests/bitbang_i_h/bitbang_i_h.c @@ -23,10 +23,10 @@ void main() int old_recieved; int timeout = 15000; long int timeout_count = 0; - set_gpio_h(0); - set_gpio_l(0); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); configure_mgmt_gpio(); - bb_configure_all_gpios(GPIO_MODE_MGMT_STD_INPUT_NOPULL); + bb_configureAllGpios(GPIO_MODE_MGMT_STD_INPUT_NOPULL); count_down(PULSE_WIDTH * 20); // send_packet(1); // configuration finished start test @@ -38,23 +38,23 @@ void main() { temp_io = io_number - 32; mask = 0x1 << temp_io; - old_recieved = get_gpio_h() & mask; + old_recieved = GPIOs_readHigh() & mask; } else { mask = 0x1 << io_number; - old_recieved = get_gpio_l() & mask; + old_recieved = GPIOs_readLow() & mask; } while (true) { if (io_number >= 32) { - recieved = get_gpio_h() & mask; // mask gpio bit + recieved = GPIOs_readHigh() & mask; // mask gpio bit } else { - recieved = get_gpio_l() & mask; // mask gpio bit + recieved = GPIOs_readLow() & mask; // mask gpio bit } if (recieved != old_recieved) { diff --git a/caravel_board/firmware_vex/mpw8_tests/bitbang_i_l/bitbang_i_l.c b/caravel_board/firmware_vex/mpw8_tests/bitbang_i_l/bitbang_i_l.c index 3cc723de..f5877505 100644 --- a/caravel_board/firmware_vex/mpw8_tests/bitbang_i_l/bitbang_i_l.c +++ b/caravel_board/firmware_vex/mpw8_tests/bitbang_i_l/bitbang_i_l.c @@ -22,11 +22,11 @@ void main() int old_recieved; int timeout = 15000; long int timeout_count = 0; - set_gpio_h(0); - set_gpio_l(0); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); configure_mgmt_gpio(); // gpio_config_io(); - bb_configure_all_gpios(GPIO_MODE_MGMT_STD_INPUT_NOPULL); + bb_configureAllGpios(GPIO_MODE_MGMT_STD_INPUT_NOPULL); count_down(PULSE_WIDTH * 20); // send_packet(2); // configuration finished start test @@ -36,10 +36,10 @@ void main() send_packet(1); // send on the next io io_number++; mask = 0x1 << io_number; - old_recieved = get_gpio_l() & mask; + old_recieved = GPIOs_readLow() & mask; while (true) { - recieved = get_gpio_l() & mask; // mask gpio bit + recieved = GPIOs_readLow() & mask; // mask gpio bit if (recieved != old_recieved) { count++; diff --git a/caravel_board/firmware_vex/mpw8_tests/bitbang_o/bitbang_o.c b/caravel_board/firmware_vex/mpw8_tests/bitbang_o/bitbang_o.c index 9fc569c7..3160fccf 100644 --- a/caravel_board/firmware_vex/mpw8_tests/bitbang_o/bitbang_o.c +++ b/caravel_board/firmware_vex/mpw8_tests/bitbang_o/bitbang_o.c @@ -7,25 +7,25 @@ void main() int i, j; int num_pulses = 4; char *c; - bb_configure_all_gpios(GPIO_MODE_MGMT_STD_OUTPUT); - configure_gpio(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + bb_configureAllGpios(GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); config_uart(); print("Start Test: bitbang_o\n"); while (true) { - c = uart_get_line(); + c = UART_readLine(); j = get_int_from_string(c); if (j >= 32) { for (i = 0; i < num_pulses; i++) { - set_gpio_h(0x1 << j - 32); + GPIOs_writeHigh(0x1 << j - 32); print("u\n"); count_down(PULSE_WIDTH); - set_gpio_h(0x0); + GPIOs_writeHigh(0x0); print("d\n"); count_down(PULSE_WIDTH); } @@ -34,10 +34,10 @@ void main() { for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << j); + GPIOs_writeLow(0x1 << j); print("u\n"); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); print("d\n"); count_down(PULSE_WIDTH); } diff --git a/caravel_board/firmware_vex/mpw8_tests/bitbang_o_h/bitbang_o_h.c b/caravel_board/firmware_vex/mpw8_tests/bitbang_o_h/bitbang_o_h.c index d1a98312..c6485e6f 100644 --- a/caravel_board/firmware_vex/mpw8_tests/bitbang_o_h/bitbang_o_h.c +++ b/caravel_board/firmware_vex/mpw8_tests/bitbang_o_h/bitbang_o_h.c @@ -60,9 +60,9 @@ void main() int num_pulses = 4; int num_bits = 8; configure_mgmt_gpio(); - bb_configure_all_gpios(GPIO_MODE_MGMT_STD_OUTPUT); - set_gpio_h(0); - set_gpio_l(0); + bb_configureAllGpios(GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); send_packet(1); // start sending on the higest gpios @@ -73,9 +73,9 @@ void main() { for (i = 0; i < num_pulses; i++) { - set_gpio_h(0x1 << j - 32); + GPIOs_writeHigh(0x1 << j - 32); count_down(PULSE_WIDTH); - set_gpio_h(0x0); + GPIOs_writeHigh(0x0); count_down(PULSE_WIDTH); } } @@ -83,9 +83,9 @@ void main() { for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << j); + GPIOs_writeLow(0x1 << j); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); count_down(PULSE_WIDTH); } } @@ -96,9 +96,9 @@ void main() send_packet(28 - j + 2); // send 4 pulses at gpio[j] for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << j); + GPIOs_writeLow(0x1 << j); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); count_down(PULSE_WIDTH); } } diff --git a/caravel_board/firmware_vex/mpw8_tests/bitbang_o_l/bitbang_o_l.c b/caravel_board/firmware_vex/mpw8_tests/bitbang_o_l/bitbang_o_l.c index db5c9cdd..4e99142f 100644 --- a/caravel_board/firmware_vex/mpw8_tests/bitbang_o_l/bitbang_o_l.c +++ b/caravel_board/firmware_vex/mpw8_tests/bitbang_o_l/bitbang_o_l.c @@ -7,9 +7,9 @@ void main() int num_pulses = 4; int num_bits = 19; configure_mgmt_gpio(); - bb_configure_all_gpios(GPIO_MODE_MGMT_STD_OUTPUT); - set_gpio_h(0); - set_gpio_l(0); + bb_configureAllGpios(GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); send_packet(1); // configuration finished for (j = 0; j < 9; j++) @@ -17,9 +17,9 @@ void main() send_packet(j + 2); // send 4 pulses at gpio[j] for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << j); + GPIOs_writeLow(0x1 << j); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); count_down(PULSE_WIDTH); } } @@ -30,9 +30,9 @@ void main() send_packet(j - 9 + 2); // send 4 pulses at gpio[j] for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << j); + GPIOs_writeLow(0x1 << j); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); count_down(PULSE_WIDTH); } } diff --git a/caravel_board/firmware_vex/mpw8_tests/clock_redirect/clock_redirect.c b/caravel_board/firmware_vex/mpw8_tests/clock_redirect/clock_redirect.c index 6cd82858..ccf7a87d 100755 --- a/caravel_board/firmware_vex/mpw8_tests/clock_redirect/clock_redirect.c +++ b/caravel_board/firmware_vex/mpw8_tests/clock_redirect/clock_redirect.c @@ -27,10 +27,10 @@ checking user clock and caravel clock at gpio 15 and gpio 14 void main(){ configure_mgmt_gpio(); - configure_gpio(14,GPIO_MODE_MGMT_STD_OUTPUT); - configure_gpio(15,GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(14,GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(15,GPIO_MODE_MGMT_STD_OUTPUT); /* Apply configuration */ - gpio_config_load(); + GPIOs_loadConfigs(); reg_clk_out_dest = 0x6; send_packet(2); // diff --git a/caravel_board/firmware_vex/mpw8_tests/common/bitbang.h b/caravel_board/firmware_vex/mpw8_tests/common/bitbang.h index cae5eb50..70edfdbe 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/bitbang.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/bitbang.h @@ -66,7 +66,7 @@ void bb_reset(){ // 2 & 35 // 1 & 36 // 0 & 37 -void bb_configure_2_gpios(unsigned int configL,unsigned int configR){ +void bb_configure2Gpios(unsigned int configL,unsigned int configR){ int num_bits,mask; int left,right; num_bits = get_gpio_num_bit(); @@ -90,7 +90,7 @@ void bb_configure_2_gpios(unsigned int configL,unsigned int configR){ } } -void bb_configure_all_gpios(unsigned int config){ +void bb_configureAllGpios(unsigned int config){ #ifndef ARM reg_mprj_io_37 = config; reg_mprj_io_36 = config; @@ -133,25 +133,25 @@ void bb_configure_all_gpios(unsigned int config){ reg_mprj_io_0 = config; bb_reset(); - bb_configure_2_gpios(config,config);// 18 & 19 - bb_configure_2_gpios(config,config);// 17 & 20 - bb_configure_2_gpios(config,config);// 16 & 21 - bb_configure_2_gpios(config,config);// 15 & 22 - bb_configure_2_gpios(config,config);// 14 & 23 - bb_configure_2_gpios(config,config);// 13 & 24 - bb_configure_2_gpios(config,config);// 12 & 25 - bb_configure_2_gpios(config,config);// 11 & 26 - bb_configure_2_gpios(config,config);// 10 & 27 - bb_configure_2_gpios(config,config);// 9 & 28 - bb_configure_2_gpios(config,config);// 8 & 29 - bb_configure_2_gpios(config,config);// 7 & 30 - bb_configure_2_gpios(config,config);// 6 & 31 - bb_configure_2_gpios(config,config);// 5 & 32 - bb_configure_2_gpios(config,config);// 4 & 33 - bb_configure_2_gpios(config,config);// 3 & 34 - bb_configure_2_gpios(config,config);// 2 & 35 - bb_configure_2_gpios(config,config);// 1 & 36 - bb_configure_2_gpios(config,config);// 0 & 37 + bb_configure2Gpios(config,config);// 18 & 19 + bb_configure2Gpios(config,config);// 17 & 20 + bb_configure2Gpios(config,config);// 16 & 21 + bb_configure2Gpios(config,config);// 15 & 22 + bb_configure2Gpios(config,config);// 14 & 23 + bb_configure2Gpios(config,config);// 13 & 24 + bb_configure2Gpios(config,config);// 12 & 25 + bb_configure2Gpios(config,config);// 11 & 26 + bb_configure2Gpios(config,config);// 10 & 27 + bb_configure2Gpios(config,config);// 9 & 28 + bb_configure2Gpios(config,config);// 8 & 29 + bb_configure2Gpios(config,config);// 7 & 30 + bb_configure2Gpios(config,config);// 6 & 31 + bb_configure2Gpios(config,config);// 5 & 32 + bb_configure2Gpios(config,config);// 4 & 33 + bb_configure2Gpios(config,config);// 3 & 34 + bb_configure2Gpios(config,config);// 2 & 35 + bb_configure2Gpios(config,config);// 1 & 36 + bb_configure2Gpios(config,config);// 0 & 37 bb_load(); } diff --git a/caravel_board/firmware_vex/mpw8_tests/common/common.h b/caravel_board/firmware_vex/mpw8_tests/common/common.h index 12eb289d..989e6ce8 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/common.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/common.h @@ -29,7 +29,7 @@ * This necessary when reading or writing are needed between wishbone and user project * if interface isn't enabled no ack would be receive and the writing or reading command will be stuck */ -void enable_user_interface(){ +void enableUserIF(){ #ifdef ARM // ARM use dirrent location reg_wb_enable = reg_wb_enable | 0x8; // for enable writing to reg_debug_1 and reg_debug_2 #else @@ -47,7 +47,7 @@ void enable_user_interface(){ * * @param is_enable when 1 (true) housekeeping is active, 0 (false) housekeeping is disabled */ -void enable_hk_spi(bool is_enable){reg_hkspi_disable = !is_enable;} +void enableHkSpi(bool is_enable){reg_hkspi_disable = !is_enable;} // user project registers #ifndef DOXYGEN_SHOULD_SKIP_THIS @@ -106,7 +106,7 @@ void output_enable_all_gpio_user(char is_enable){ * * */ -void dummy_delay(int num){ +void dummyDelay(int num){ for (int i=0;i < num;i++){ #ifdef ARM reg_wb_enable = reg_wb_enable; diff --git a/caravel_board/firmware_vex/mpw8_tests/common/gpios.h b/caravel_board/firmware_vex/mpw8_tests/common/gpios.h index eab556e5..9cbcc031 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/gpios.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/gpios.h @@ -11,10 +11,10 @@ * @param config is configuration of type gpio_mode * * \note - * These configurations will not be change the GPIOs modes until calling gpio_config_load() + * These configurations will not be change the GPIOs modes until calling GPIOs_loadConfigs() * */ -void configure_all_gpios(enum gpio_mode config){ +void GPIOs_configureAll(enum gpio_mode config){ #ifndef ARM reg_mprj_io_37 = config; reg_mprj_io_36 = config; @@ -55,13 +55,13 @@ void configure_all_gpios(enum gpio_mode config){ reg_mprj_io_2 = config; reg_mprj_io_1 = config; reg_mprj_io_0 = config; - // gpio_config_load(); + // GPIOs_loadConfigs(); } /** * Load the configurations changes to the GPIOs * */ -void gpio_config_load(){ +void GPIOs_loadConfigs(){ reg_mprj_xfer = 1; while ((reg_mprj_xfer&0x1) == 1); @@ -73,10 +73,10 @@ void gpio_config_load(){ * @param gpio_num is GPIO number it can have values from 0 to 37 * * \note - * These configurations will not be change the GPIOs modes until calling gpio_config_load() + * These configurations will not be change the GPIOs modes until calling GPIOs_loadConfigs() * */ -void configure_gpio(int gpio_num,enum gpio_mode config){ +void GPIOs_configure(int gpio_num,enum gpio_mode config){ switch(gpio_num){ case 0 : reg_mprj_io_0 = config; break; @@ -161,9 +161,9 @@ void configure_gpio(int gpio_num,enum gpio_mode config){ void config_uart() { - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - gpio_config_load(); - enable_uart_TX(1); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_loadConfigs(); + UART_enableTX(1); count_down(PULSE_WIDTH * 10); } @@ -175,10 +175,10 @@ void config_uart() * @param data is the data sent to the GPIOs * * Examples: - * \li \code set_gpio_l(0x1); // write 1 to GPIO [0] and write 0 in the remaining 31 GPIOs \endcode - * \li \code set_gpio_l(0x5); // write 1 to GPIO [0] and GPIO [3] and write 0 in the remaining 30 GPIOs\endcode + * \li \code GPIOs_writeLow(0x1); // write 1 to GPIO [0] and write 0 in the remaining 31 GPIOs \endcode + * \li \code GPIOs_writeLow(0x5); // write 1 to GPIO [0] and GPIO [3] and write 0 in the remaining 30 GPIOs\endcode */ -void set_gpio_l(unsigned int data){reg_mprj_datal = data;} +void GPIOs_writeLow(unsigned int data){reg_mprj_datal = data;} /** * Write to the highest 6 GPIOs GPIOS[37:32] * \note @@ -187,10 +187,10 @@ void set_gpio_l(unsigned int data){reg_mprj_datal = data;} * @param data is the data sent to the GPIOs * * Examples: - * \li \code set_gpio_h(0x1); // write 1 to GPIO [32] and write 0 in the remaining 5 GPIOs\endcode - * \li \code set_gpio_h(0x5); // write 1 to GPIO [32] and 34 and write 0 in the remaining 4 GPIOs\endcode + * \li \code GPIOs_writeHigh(0x1); // write 1 to GPIO [32] and write 0 in the remaining 5 GPIOs\endcode + * \li \code GPIOs_writeHigh(0x5); // write 1 to GPIO [32] and 34 and write 0 in the remaining 4 GPIOs\endcode */ -void set_gpio_h(unsigned int data){reg_mprj_datah = data;} +void GPIOs_writeHigh(unsigned int data){reg_mprj_datah = data;} /** * Write to the 38 GPIOs GPIOS[37:0] * \note @@ -199,13 +199,13 @@ void set_gpio_h(unsigned int data){reg_mprj_datah = data;} * @param data is the data sent to the GPIOs * * Examples: - * \li \code set_gpio(0x1); // write 1 to GPIO [0] and write 0 in the remaining 37 GPIOs \endcode - * \li \code set_gpio(0x5); // write 1 to GPIO [0] and GPIO [3] and write 0 in the remaining 36 GPIOs\endcode - * \li \code set_gpio(0x100000000); // write 1 to GPIO [32] and write 0 in the remaining 36 GPIOs\endcode + * \li \code GPIOs_writeLowHigh(0x1); // write 1 to GPIO [0] and write 0 in the remaining 37 GPIOs \endcode + * \li \code GPIOs_writeLowHigh(0x5); // write 1 to GPIO [0] and GPIO [3] and write 0 in the remaining 36 GPIOs\endcode + * \li \code GPIOs_writeLowHigh(0x100000000); // write 1 to GPIO [32] and write 0 in the remaining 36 GPIOs\endcode * * \todo verify this function */ -void set_gpio(long data){ +void GPIOs_writeLowHigh(long data){ reg_mprj_datal = data; reg_mprj_datah = data <<32; @@ -216,7 +216,7 @@ void set_gpio(long data){ * For Reading value from the GPIOs, the GPIO should be configured as management input. otherwise 0 would be read * */ -unsigned int get_gpio_h(){ +unsigned int GPIOs_readHigh(){ #ifdef ARM return reg_mprj_datah & 0x7; // because with ARM the highest 3 GPIOsare not used by the design it is used by flashing #else @@ -229,7 +229,7 @@ unsigned int get_gpio_h(){ * For Reading value from the GPIOs, the GPIO should be configured as management input. otherwise 0 would be read * */ -unsigned int get_gpio_l(){return reg_mprj_datal;} +unsigned int GPIOs_readLow(){return reg_mprj_datal;} /** * wait over the lowest 32 GPIOsto equal the data passed * \note @@ -238,10 +238,10 @@ unsigned int get_gpio_l(){return reg_mprj_datal;} * @param data is the data that should wait until sent to the GPIOs * * Examples: - * \li \code wait_gpio_l(0x1); // function would return only when GPIO [0]==1 and rest of 31 GPIOs= 0 \endcode - * \li \code wait_gpio_l(0x5); // function would return only when GPIO [0]==1 and GPIO [3]==1 and rest of 30 GPIOs = 0 \endcode + * \li \code GPIOs_waitLow(0x1); // function would return only when GPIO [0]==1 and rest of 31 GPIOs= 0 \endcode + * \li \code GPIOs_waitLow(0x5); // function would return only when GPIO [0]==1 and GPIO [3]==1 and rest of 30 GPIOs = 0 \endcode */ -void wait_gpio_l(unsigned int data){while (get_gpio_l() != data);} +void GPIOs_waitLow(unsigned int data){while (GPIOs_readLow() != data);} /** * wait over the highest 6 GPIOs to equal the data passed * \note @@ -250,14 +250,14 @@ void wait_gpio_l(unsigned int data){while (get_gpio_l() != data);} * @param data is the data that should wait until sent to the GPIOs * * Examples: - * \li \code wait_gpio_h(0x1); // function would return only when GPIO [32]==1 and rest of 5 GPIOs = 0 \endcode - * \li \code wait_gpio_h(0x5); // function would return only when GPIO [32]==1 and GPIO [34]==1 and rest of 4 GPIOs = 0 \endcode + * \li \code GPIOs_waitHigh(0x1); // function would return only when GPIO [32]==1 and rest of 5 GPIOs = 0 \endcode + * \li \code GPIOs_waitHigh(0x5); // function would return only when GPIO [32]==1 and GPIO [34]==1 and rest of 4 GPIOs = 0 \endcode */ -void wait_gpio_h(unsigned int data){ +void GPIOs_waitHigh(unsigned int data){ #ifdef ARM data = data&0x7; // because with ARM the highest 3 GPIOs are not used by the design it is used by flashing #endif - while (get_gpio_h() != data); + while (GPIOs_readHigh() != data); } /** * wait over the masked lowest 32 GPIOs to equal the data passed @@ -268,10 +268,10 @@ void wait_gpio_h(unsigned int data){ * @param mask mask over the each GPIO if the mask value is 0 the this GPIO value are ignored * * Examples: - * \li \code wait_gpio_l_masked(0x1,0xF); // function would return only when GPIO [0]==1 and GPIO [3:1]==0 and don't care about the rest of GPIOs \endcode - * \li \code wait_gpio_l_masked(0x5,0x7); // function would return only when GPIO [0]==1 and GPIO [3]==1 and GPIO [2]==0 and don't care about the rest of GPIOs \endcode + * \li \code GPIOs_waitLowWithMask(0x1,0xF); // function would return only when GPIO [0]==1 and GPIO [3:1]==0 and don't care about the rest of GPIOs \endcode + * \li \code GPIOs_waitLowWithMask(0x5,0x7); // function would return only when GPIO [0]==1 and GPIO [3]==1 and GPIO [2]==0 and don't care about the rest of GPIOs \endcode */ -void wait_gpio_l_masked(unsigned int data,unsigned int mask){while (get_gpio_l() & mask != data);} +void GPIOs_waitLowWithMask(unsigned int data,unsigned int mask){while (GPIOs_readLow() & mask != data);} /** * wait over the masked highest 6 GPIOs to equal the data passed * \note @@ -281,14 +281,14 @@ void wait_gpio_l_masked(unsigned int data,unsigned int mask){while (get_gpio_l() * @param mask mask over the each GPIO if the mask value is 0 the this GPIO value are ignored * * Examples: - * \li \code wait_gpio_h_masked(0x1,0xF); // function would return only when GPIO [32]==1 and GPIO [35:33]==0 and don't care about the rest of GPIOs \endcode - * \li \code wait_gpio_h_masked(0x5,0x7); // function would return only when GPIO [32]==1 and GPIO [34]==1 and GPIO [33]==0 and don't care about the rest of GPIOs \endcode + * \li \code GPIOs_waitHighWithMask(0x1,0xF); // function would return only when GPIO [32]==1 and GPIO [35:33]==0 and don't care about the rest of GPIOs \endcode + * \li \code GPIOs_waitHighWithMask(0x5,0x7); // function would return only when GPIO [32]==1 and GPIO [34]==1 and GPIO [33]==0 and don't care about the rest of GPIOs \endcode */ -void wait_gpio_h_masked(unsigned int data,unsigned int mask){ +void GPIOs_waitHighWithMask(unsigned int data,unsigned int mask){ #ifdef ARM data = data&0x7; // because with ARM the highest 3 GPIOs are not used by the design it is used by flashing #endif - while (get_gpio_h() != data); + while (GPIOs_readHigh() != data); } // #ifndef DOXYGEN_SHOULD_SKIP_THIS diff --git a/caravel_board/firmware_vex/mpw8_tests/common/irq_api.h b/caravel_board/firmware_vex/mpw8_tests/common/irq_api.h index 66dad2ec..114fcc1e 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/irq_api.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/irq_api.h @@ -22,16 +22,16 @@ void clear_UART0_Handler(){ reg_uart_isc =0x3; } #endif -char get_flag(){ +char IRQ_getFlag(){ #ifndef ARM return flag; #else - dummy_delay(1); + dummyDelay(1); return flag; #endif } -void clear_flag(){ +void IRQ_clearFlag(){ #ifndef ARM flag=0; #else @@ -46,7 +46,7 @@ void clear_flag(){ * * @param is_enable when 1 (true) interrupt is active and firmware would detect if happened, 0 (false) interrupt is disabled and firmware would not detect if happened */ -void enable_external1_irq(bool is_enable){ +void IRQ_enableExternal1(bool is_enable){ if (is_enable){ #ifndef ARM irq_setmask(0); @@ -76,7 +76,7 @@ void enable_external1_irq(bool is_enable){ * * @param is_enable when 1 (true) interrupt is active and firmware would detect if happened, 0 (false) interrupt is disabled and firmware would not detect if happened */ -void enable_external2_irq(bool is_enable){ +void IRQ_enableExternal2(bool is_enable){ if (is_enable){ #ifndef ARM irq_setmask(0); @@ -106,7 +106,7 @@ void enable_external2_irq(bool is_enable){ * * @param is_enable when 1 (true) interrupt is active and firmware would detect if happened, 0 (false) interrupt is disabled and firmware would not detect if happened */ -void enable_user0_irq(bool is_enable){ +void IRQ_enableUser0(bool is_enable){ if (is_enable){ #ifndef ARM irq_setmask(0); @@ -138,7 +138,7 @@ void enable_user0_irq(bool is_enable){ * * @param is_enable when 1 (true) interrupt is active and firmware would detect if happened, 0 (false) interrupt is disabled and firmware would not detect if happened */ -void enable_user1_irq(bool is_enable){ +void IRQ_enableUser1(bool is_enable){ if (is_enable){ #ifndef ARM irq_setmask(0); @@ -171,7 +171,7 @@ void enable_user1_irq(bool is_enable){ * * @param is_enable when 1 (true) interrupt is active and firmware would detect if happened, 0 (false) interrupt is disabled and firmware would not detect if happened */ -void enable_user2_irq(bool is_enable){ +void IRQ_enableUser2(bool is_enable){ if (is_enable){ #ifndef ARM irq_setmask(0); @@ -203,7 +203,7 @@ void enable_user2_irq(bool is_enable){ * * @param is_enable when 1 (true) interrupt is active and firmware would detect if happened, 0 (false) interrupt is disabled and firmware would not detect if happened */ -void enable_timer0_irq(bool is_enable){ +void IRQ_enableTimer(bool is_enable){ if (is_enable){ #ifndef ARM irq_setmask(0); @@ -235,7 +235,7 @@ void enable_timer0_irq(bool is_enable){ * * @param is_enable when 1 (true) interrupt is active and firmware would detect if happened, 0 (false) interrupt is disabled and firmware would not detect if happened */ -void enable_uart_tx_irq(bool is_enable){ +void IRQ_enableUartTx(bool is_enable){ if (is_enable){ #ifndef ARM reg_uart_enable = 1; @@ -268,7 +268,7 @@ void enable_uart_tx_irq(bool is_enable){ * * @param is_enable when 1 (true) interrupt is active and firmware would detect if happened, 0 (false) interrupt is disabled and firmware would not detect if happened */ -void enable_uart_rx_irq(bool is_enable){ +void IRQ_enableUartRx(bool is_enable){ if (is_enable){ #ifndef ARM reg_uart_enable = 1; @@ -301,7 +301,7 @@ void enable_uart_rx_irq(bool is_enable){ * * @param is_enable when 1 (true) interrupt is active and firmware would detect if happened, 0 (false) interrupt is disabled and firmware would not detect if happened */ -void enable_hk_spi_irq(bool is_enable){ +void IRQ_hkSpi(bool is_enable){ if (is_enable){ #ifndef ARM reg_user3_irq_en =1; diff --git a/caravel_board/firmware_vex/mpw8_tests/common/la.h b/caravel_board/firmware_vex/mpw8_tests/common/la.h index 0e84676b..53a8757f 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/la.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/la.h @@ -37,7 +37,7 @@ enum la_reg_number { * @param is_enable 32 bits each bit indicate if the corresponding probe enabled as input * */ -void set_la_ien(enum la_reg_number reg_num , unsigned int is_enable){ +void LogicAnalyzer_inputEnable(enum la_reg_number reg_num , unsigned int is_enable){ switch(reg_num){ #if LA_SIZE >= 64 case 0 : reg_la0_iena = is_enable; break; @@ -64,7 +64,7 @@ void set_la_ien(enum la_reg_number reg_num , unsigned int is_enable){ * @param is_enable 32 bits each bit indicate if the corresponding probe enabled as output * */ -void set_la_oen(enum la_reg_number reg_num , unsigned int is_enable){ +void LogicAnalyzer_outputEnable(enum la_reg_number reg_num , unsigned int is_enable){ switch(reg_num){ #if LA_SIZE >= 64 case 0 : reg_la0_oenb = ~is_enable; break; @@ -91,7 +91,7 @@ void set_la_oen(enum la_reg_number reg_num , unsigned int is_enable){ * @param data data to write through logic analyzers * */ -void set_la_reg(enum la_reg_number reg_num , unsigned int data){ +void LogicAnalyzer_write(enum la_reg_number reg_num , unsigned int data){ switch(reg_num){ #if LA_SIZE >= 64 case 0 : reg_la0_data = data; break; @@ -117,7 +117,7 @@ void set_la_reg(enum la_reg_number reg_num , unsigned int data){ * * */ -unsigned int get_la_reg(enum la_reg_number reg_num){ +unsigned int LogicAnalyzer_read(enum la_reg_number reg_num){ switch(reg_num){ #if LA_SIZE >= 64 case 0 : return reg_la0_data_in; diff --git a/caravel_board/firmware_vex/mpw8_tests/common/mgmt_gpio.h b/caravel_board/firmware_vex/mpw8_tests/common/mgmt_gpio.h index 756af39c..88c0a070 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/mgmt_gpio.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/mgmt_gpio.h @@ -9,7 +9,7 @@ * Configure management GPIO as input * */ -void mgmt_gpio_i_enable(){ +void ManagmentGpio_inputEnable(){ reg_gpio_mode1 = 1; reg_gpio_mode0 = 0; // for full swing #ifndef REG_GPIO_INVERTED @@ -19,13 +19,13 @@ void mgmt_gpio_i_enable(){ reg_gpio_ien = 0; // because in gf the GPIO enable regs are inverted reg_gpio_oe = 1; #endif - dummy_delay(1); + dummyDelay(1); } /** * Configure management GPIO as output * */ -void mgmt_gpio_o_enable(){ +void ManagmentGpio_outputEnable(){ reg_gpio_mode1 = 1; reg_gpio_mode0 = 0; // for full swing #ifndef REG_GPIO_INVERTED @@ -35,13 +35,13 @@ void mgmt_gpio_o_enable(){ reg_gpio_ien = 1; // because in gf the GPIO enable regs are inverted reg_gpio_oe = 0; #endif - dummy_delay(1); + dummyDelay(1); } /** * Configure management GPIO as bi-direction * */ -void mgmt_gpio_io_enable(){ +void ManagmentGpio_ioEnable(){ reg_gpio_mode1 = 1; reg_gpio_mode0 = 0; // for full swing #ifndef REG_GPIO_INVERTED @@ -57,7 +57,7 @@ void mgmt_gpio_io_enable(){ * It's not connected as input or output * */ -void mgmt_gpio_io_disable(){ +void ManagmentGpio_disable(){ reg_gpio_mode1 = 1; reg_gpio_mode0 = 0; // for full swing #ifndef REG_GPIO_INVERTED @@ -77,7 +77,7 @@ void mgmt_gpio_io_disable(){ * This function works when management GPIO configured as output * */ -void mgmt_gpio_wr(bool data){reg_gpio_out = data;} +void ManagmentGpio_write(bool data){reg_gpio_out = data;} /** * Read data in management GPIO * @@ -86,7 +86,7 @@ void mgmt_gpio_wr(bool data){reg_gpio_out = data;} * If management doesn't connect to anything the firmware would read "0" * */ -int mgmt_gpio_rd(){return reg_gpio_in;} +int ManagmentGpio_read(){return reg_gpio_in;} /** * Wait over management GPIO to equal data * @@ -96,7 +96,7 @@ int mgmt_gpio_rd(){return reg_gpio_in;} * @param data data to wait over * */ -void wait_gpio_mgmt(bool data){while (reg_gpio_in == data);} +void ManagmentGpio_wait(bool data){while (reg_gpio_in == data);} #endif // MGMT_GPIO_C_HEADER_FILE diff --git a/caravel_board/firmware_vex/mpw8_tests/common/packet.h b/caravel_board/firmware_vex/mpw8_tests/common/packet.h index b3f65848..b05109e6 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/packet.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/packet.h @@ -14,23 +14,23 @@ void count_down(const int d) { /* Configure timer for a single-shot countdown */ - timer0_oneshot_configure(d); + timer0_configureOneShot(d); // Loop, waiting for value to reach zero - update_timer0_val(); // latch current value - int old_val = get_timer0_val(); + timer0_updateValue(); // latch current value + int old_val = timer0_readValue(); while (old_val > 0) { - update_timer0_val(); - old_val = get_timer0_val(); + timer0_updateValue(); + old_val = timer0_readValue(); } } void send_pulse() { - mgmt_gpio_wr(0); + ManagmentGpio_write(0); count_down(PULSE_WIDTH); - mgmt_gpio_wr(1); + ManagmentGpio_write(1); count_down(PULSE_WIDTH); } diff --git a/caravel_board/firmware_vex/mpw8_tests/common/spi_master.h b/caravel_board/firmware_vex/mpw8_tests/common/spi_master.h index 886f62fb..9358beec 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/spi_master.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/spi_master.h @@ -17,7 +17,7 @@ char spi_done(){return reg_spimaster_status & 0x1;} * @param c byte to write range 0x0 to 0xFF * */ -void spi_write(char c){ +void MSPI_write(char c){ reg_spimaster_wdata = (unsigned long) c; #ifndef ARM reg_spimaster_control = 0x0801; @@ -31,8 +31,8 @@ void spi_write(char c){ * Read byte (8bits) through SPI master * */ -char spi_read(){ - spi_write(0x00); +char MSPI_read(){ + MSPI_write(0x00); while (reg_spimaster_status != 1); return reg_spimaster_rdata; } @@ -41,16 +41,16 @@ char spi_read(){ * * @param is_enable when 1 (true) master SPI is active, 0 (false) master SPI is disabled */ -void enable_spi(bool is_enable){ +void MSPI_enable(bool is_enable){ if(is_enable){ #ifndef ARM - reg_spi_enable = 1; + reg_MSPI_enable = 1; #else reg_wb_enable = reg_wb_enable | 0x20; #endif }else{ #ifndef ARM - reg_spi_enable = 0; + reg_MSPI_enable = 0; #else reg_wb_enable = reg_wb_enable & 0xFFDF; #endif @@ -61,7 +61,7 @@ void enable_spi(bool is_enable){ * * @param is_enable when 1 (true) chip select is asserted, 0 (false) chip select is deasserted */ -void enable_CS(bool is_enable){ +void MSPI_enableCS(bool is_enable){ if (is_enable){ #ifndef ARM reg_spimaster_cs = 0x10001; // select chip 0 diff --git a/caravel_board/firmware_vex/mpw8_tests/common/timer0.h b/caravel_board/firmware_vex/mpw8_tests/common/timer0.h index 5461dafa..f97d09b7 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/timer0.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/timer0.h @@ -11,10 +11,10 @@ * @param count start value in the counter > 0 * */ -void timer0_oneshot_configure(unsigned int count){ - enable_timer0(0); // disable +void timer0_configureOneShot(unsigned int count){ + timer0_enable(0); // disable reg_timer0_data = count; - enable_timer0(1); // enable + timer0_enable(1); // enable } /** * Start counter in periodic countdown mode start value is count @@ -23,11 +23,11 @@ void timer0_oneshot_configure(unsigned int count){ * @param count start value in the counter > 0 * */ -void timer0_periodic_configure(unsigned int count){ - enable_timer0(0); // disable +void timer0_configurePeriodic(unsigned int count){ + timer0_enable(0); // disable reg_timer0_data = 0; reg_timer0_data_periodic = count; - enable_timer0(1); // enable + timer0_enable(1); // enable } /** * Enable or Disable timer0 @@ -35,7 +35,7 @@ void timer0_periodic_configure(unsigned int count){ * @param is_enable when 1 (true) timer0 is enable (start counting), 0 (false) timer0 is disabled * */ -void enable_timer0(bool is_enable){ +void timer0_enable(bool is_enable){ if (is_enable) reg_timer0_config = 1;// enable else @@ -43,7 +43,7 @@ void enable_timer0(bool is_enable){ } #ifndef DOXYGEN_SHOULD_SKIP_THIS -void update_timer0_val(){ +void timer0_updateValue(){ #ifdef ARM // arm update the register automatically return; #else @@ -55,11 +55,11 @@ void update_timer0_val(){ * Get timer current value * */ -unsigned int get_timer0_val(){ +unsigned int timer0_readValue(){ #ifdef ARM return reg_timer0_data; #else - update_timer0_val(); + timer0_updateValue(); return reg_timer0_value; #endif } diff --git a/caravel_board/firmware_vex/mpw8_tests/common/uart_api.h b/caravel_board/firmware_vex/mpw8_tests/common/uart_api.h index eaa66f66..46521ea4 100644 --- a/caravel_board/firmware_vex/mpw8_tests/common/uart_api.h +++ b/caravel_board/firmware_vex/mpw8_tests/common/uart_api.h @@ -20,7 +20,7 @@ void arm_mgmt_uart_disable(){reg_wb_enable = reg_wb_enable & 0xFFBF;} * Some caravel CPU enable and disable UART TX and RX together * */ -void enable_uart_TX(bool is_enable){ +void UART_enableTX(bool is_enable){ if (is_enable){ #ifdef ARM // 0x08 RW CTRL[3:0] TxIntEn, RxIntEn, TxEn, RxEn @@ -59,7 +59,7 @@ void enable_uart_TX(bool is_enable){ * Some caravel CPU enable and disable UART TX and RX together * */ -void uart_RX_enable(bool is_enable){ +void UART_enableRX(bool is_enable){ if (is_enable){ #ifdef ARM arm_mgmt_uart_enable(); @@ -88,7 +88,7 @@ void uart_RX_enable(bool is_enable){ * RX mode have to be enabled * */ -char uart_getc(){ +char UART_readChar(){ #ifdef ARM while ((reg_uart_stat &2) == 0); // RX is empty #else @@ -99,9 +99,9 @@ char uart_getc(){ /** * Pop the first ASCII symbol of the UART received queue * - * uart_getc() function would keeping reading the same symbol unless this function is called + * UART_readChar() function would keeping reading the same symbol unless this function is called */ -void uart_pop_char(){ +void UART_popChar(){ #ifndef ARM uart_ev_pending_write(UART_EV_RX); #endif @@ -120,27 +120,27 @@ void wait_for_char(char *c) { send_packet(9); // recieved incorrect correct character } - uart_pop_char(); + UART_popChar(); } void empty_buffer() { while (uart_rxempty_read() != 1) - uart_pop_char(); + UART_popChar(); } -char *uart_get_line() +char *UART_readLine() { char *received_array = 0; char received_char; int count = 0; - while ((received_char = uart_getc()) != '\n') + while ((received_char = UART_readChar()) != '\n') { received_array[count++] = received_char; - uart_pop_char(); + UART_popChar(); } received_array[count++] = received_char; - uart_pop_char(); + UART_popChar(); return received_array; } diff --git a/caravel_board/firmware_vex/mpw8_tests/config_io_o_new/config_io_o_new.c b/caravel_board/firmware_vex/mpw8_tests/config_io_o_new/config_io_o_new.c index 275c5e1b..860df691 100644 --- a/caravel_board/firmware_vex/mpw8_tests/config_io_o_new/config_io_o_new.c +++ b/caravel_board/firmware_vex/mpw8_tests/config_io_o_new/config_io_o_new.c @@ -73,10 +73,10 @@ void main() int num_pulses = 4; int num_bits = 19; configure_mgmt_gpio(); - configure_all_gpios(GPIO_MODE_MGMT_STD_OUTPUT); - gpio_config_load(); - set_gpio_h(0); - set_gpio_l(0); + GPIOs_configureAll(GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_loadConfigs(); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); // gpio_config_io(); send_packet(1); // configuration finished while (1) @@ -84,11 +84,11 @@ void main() send_packet(3); // send 4 pulses at all gpios for (i = 0; i < 4; i++) { - set_gpio_l(0xFFFFFFFF); - set_gpio_h(0x3F); + GPIOs_writeLow(0xFFFFFFFF); + GPIOs_writeHigh(0x3F); count_down(PULSE_WIDTH); - set_gpio_h(0x0); - set_gpio_l(0x0); + GPIOs_writeHigh(0x0); + GPIOs_writeLow(0x0); count_down(PULSE_WIDTH); } } diff --git a/caravel_board/firmware_vex/mpw8_tests/debug/debug.c b/caravel_board/firmware_vex/mpw8_tests/debug/debug.c index ae36b79a..0d1b3fd0 100644 --- a/caravel_board/firmware_vex/mpw8_tests/debug/debug.c +++ b/caravel_board/firmware_vex/mpw8_tests/debug/debug.c @@ -29,7 +29,7 @@ void wait_for_char(char *c) { send_packet(9); // recieved incorrect correct character } - uart_pop_char(); + UART_popChar(); } /* @@ -58,10 +58,10 @@ Connect the transimssion and the reciever of the uart void main(){ int j; configure_mgmt_gpio(); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - configure_gpio(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(0, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - gpio_config_load(); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(0, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_loadConfigs(); (*(volatile uint32_t*) CSR_DEBUG_MODE_OUT_ADDR ) = 1; // enable debug mode count_down(PULSE_WIDTH * 50); send_packet(2); // Start of the test diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_i/gpio_i.c b/caravel_board/firmware_vex/mpw8_tests/gpio_i/gpio_i.c index 9cb376fe..295e930d 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_i/gpio_i.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_i/gpio_i.c @@ -28,38 +28,38 @@ void main() int timeout = 10000; long int timeout_count = 0; char *c; - configure_all_gpios(GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + GPIOs_configureAll(GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); config_uart(); print("Start Test: gpio_i\n"); while (true) { - c = uart_get_line(); + c = UART_readLine(); io_number = get_int_from_string(c); if (io_number >= 32) { temp_io = io_number - 32; mask = 0x1 << temp_io; - old_recieved = get_gpio_h() & mask; + old_recieved = GPIOs_readHigh() & mask; } else { mask = 0x1 << io_number; - old_recieved = get_gpio_l() & mask; + old_recieved = GPIOs_readLow() & mask; } while (true) { if (io_number >= 32) { - recieved = get_gpio_h() & mask; // mask gpio bit + recieved = GPIOs_readHigh() & mask; // mask gpio bit } else { - recieved = get_gpio_l() & mask; // mask gpio bit + recieved = GPIOs_readLow() & mask; // mask gpio bit } if (recieved != old_recieved) { diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_i_h/gpio_i_h.c b/caravel_board/firmware_vex/mpw8_tests/gpio_i_h/gpio_i_h.c index 7cb99f3a..680a6612 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_i_h/gpio_i_h.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_i_h/gpio_i_h.c @@ -2,25 +2,25 @@ void set_registers() { - configure_gpio(19, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(20, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(21, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(22, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(23, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(24, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(25, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(26, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(27, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(28, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(29, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(30, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(31, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(32, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(33, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(34, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(35, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(36, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(37, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(19, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(20, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(21, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(22, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(23, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(24, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(25, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(26, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(27, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(28, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(29, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(30, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(31, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(32, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(33, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(34, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(35, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(36, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(37, GPIO_MODE_MGMT_STD_INPUT_NOPULL); } /* @ send on the next io (start from 37 to 19) @@ -46,11 +46,11 @@ void main() int timeout = 15000; long int timeout_count = 0; set_registers(); - set_gpio_h(0); - set_gpio_l(0); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); configure_mgmt_gpio(); // gpio_config_io(); - gpio_config_load(); + GPIOs_loadConfigs(); count_down(PULSE_WIDTH * 20); // send_packet(1); // configuration finished start test @@ -62,23 +62,23 @@ void main() { temp_io = io_number - 32; mask = 0x1 << temp_io; - old_recieved = get_gpio_h() & mask; + old_recieved = GPIOs_readHigh() & mask; } else { mask = 0x1 << io_number; - old_recieved = get_gpio_l() & mask; + old_recieved = GPIOs_readLow() & mask; } while (true) { if (io_number >= 32) { - recieved = get_gpio_h() & mask; // mask gpio bit + recieved = GPIOs_readHigh() & mask; // mask gpio bit } else { - recieved = get_gpio_l() & mask; // mask gpio bit + recieved = GPIOs_readLow() & mask; // mask gpio bit } if (recieved != old_recieved) { diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_i_l/gpio_i_l.c b/caravel_board/firmware_vex/mpw8_tests/gpio_i_l/gpio_i_l.c index e436223f..d2a197f6 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_i_l/gpio_i_l.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_i_l/gpio_i_l.c @@ -2,25 +2,25 @@ void set_registers() { - configure_gpio(0, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(1, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(2, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(3, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(4, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(6, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(7, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(8, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(9, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(10, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(11, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(12, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(13, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(14, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(15, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(16, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(17, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - configure_gpio(18, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(0, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(1, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(2, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(3, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(4, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(7, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(8, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(9, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(10, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(11, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(12, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(13, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(14, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(15, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(16, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(17, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_configure(18, GPIO_MODE_MGMT_STD_INPUT_NOPULL); } /* @ send on the next io (start from 0 to 18) @@ -45,11 +45,11 @@ void main() int timeout = 15000; long int timeout_count = 0; set_registers(); - set_gpio_h(0); - set_gpio_l(0); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); configure_mgmt_gpio(); // gpio_config_io(); - gpio_config_load(); + GPIOs_loadConfigs(); count_down(PULSE_WIDTH * 20); // send_packet(2); // configuration finished start test @@ -59,10 +59,10 @@ void main() send_packet(1); // send on the next io io_number++; mask = 0x1 << io_number; - old_recieved = get_gpio_l() & mask; + old_recieved = GPIOs_readLow() & mask; while (true) { - recieved = get_gpio_l() & mask; // mask gpio bit + recieved = GPIOs_readLow() & mask; // mask gpio bit if (recieved != old_recieved) { count++; diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_lo_hpd/gpio_lo_hpd.c b/caravel_board/firmware_vex/mpw8_tests/gpio_lo_hpd/gpio_lo_hpd.c index 8f4c12f5..8d37704d 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_lo_hpd/gpio_lo_hpd.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_lo_hpd/gpio_lo_hpd.c @@ -6,11 +6,11 @@ void set_registers() { if (i >= 19) { - configure_gpio(i, GPIO_MODE_MGMT_STD_INPUT_PULLDOWN); + GPIOs_configure(i, GPIO_MODE_MGMT_STD_INPUT_PULLDOWN); } else { - configure_gpio(i, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(i, GPIO_MODE_MGMT_STD_OUTPUT); } } } @@ -25,9 +25,9 @@ input value send to gpio[19:37] suppose to be received as output at GPIO[0:18] void main() { set_registers(); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); int mask = 0xFFF80000; int mask_h = 0x7E000; int i_val = 0; @@ -40,10 +40,10 @@ void main() send_packet(2); while (true) { - i_val = get_gpio_l() & mask; - o_val_h = get_gpio_h() << 13; + i_val = GPIOs_readLow() & mask; + o_val_h = GPIOs_readHigh() << 13; o_val_l = i_val >> 19; o_val = o_val_l | o_val_h; - set_gpio_l(o_val); + GPIOs_writeLow(o_val); } } diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_lo_hpu/gpio_lo_hpu.c b/caravel_board/firmware_vex/mpw8_tests/gpio_lo_hpu/gpio_lo_hpu.c index b12da2ba..cef82a4e 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_lo_hpu/gpio_lo_hpu.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_lo_hpu/gpio_lo_hpu.c @@ -6,11 +6,11 @@ void set_registers() { if (i >= 19) { - configure_gpio(i, GPIO_MODE_MGMT_STD_INPUT_PULLUP); + GPIOs_configure(i, GPIO_MODE_MGMT_STD_INPUT_PULLUP); } else { - configure_gpio(i, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(i, GPIO_MODE_MGMT_STD_OUTPUT); } } } @@ -25,9 +25,9 @@ input value send to gpio[19:37] suppose to be received as output at GPIO[0:18] void main() { set_registers(); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); int mask = 0xFFF80000; int mask_h = 0x7E000; int i_val = 0; @@ -41,10 +41,10 @@ void main() send_packet(2); while (true) { - i_val = get_gpio_l() & mask; - o_val_h = get_gpio_h() << 13; + i_val = GPIOs_readLow() & mask; + o_val_h = GPIOs_readHigh() << 13; o_val_l = i_val >> 19; o_val = o_val_l | o_val_h; - set_gpio_l(o_val); + GPIOs_writeLow(o_val); } } diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_lpd_ho/gpio_lpd_ho.c b/caravel_board/firmware_vex/mpw8_tests/gpio_lpd_ho/gpio_lpd_ho.c index fd31bf47..e9c1b421 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_lpd_ho/gpio_lpd_ho.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_lpd_ho/gpio_lpd_ho.c @@ -6,11 +6,11 @@ void set_registers() { if (i < 19) { - configure_gpio(i, GPIO_MODE_MGMT_STD_INPUT_PULLDOWN); + GPIOs_configure(i, GPIO_MODE_MGMT_STD_INPUT_PULLDOWN); } else { - configure_gpio(i, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(i, GPIO_MODE_MGMT_STD_OUTPUT); } } } @@ -25,9 +25,9 @@ input value send to gpio[0:18] suppose to be received as output at GPIO[19:37] void main() { set_registers(); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); int mask = 0x7FFFF; int mask_h = 0x7E000; int i_val = 0; @@ -39,11 +39,11 @@ void main() send_packet(2); while (true) { - i_val = get_gpio_l() & mask; + i_val = GPIOs_readLow() & mask; o_val_l = i_val << 19; o_val_h = i_val & mask_h; o_val_h = o_val_h >> 13; - set_gpio_h(o_val_h); - set_gpio_l(o_val_l); + GPIOs_writeHigh(o_val_h); + GPIOs_writeLow(o_val_l); } } diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_lpu_ho/gpio_lpu_ho.c b/caravel_board/firmware_vex/mpw8_tests/gpio_lpu_ho/gpio_lpu_ho.c index d5e30492..922f01a2 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_lpu_ho/gpio_lpu_ho.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_lpu_ho/gpio_lpu_ho.c @@ -6,11 +6,11 @@ void set_registers() { if (i < 19) { - configure_gpio(i, GPIO_MODE_MGMT_STD_INPUT_PULLUP); + GPIOs_configure(i, GPIO_MODE_MGMT_STD_INPUT_PULLUP); } else { - configure_gpio(i, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(i, GPIO_MODE_MGMT_STD_OUTPUT); } } } @@ -25,9 +25,9 @@ input value send to gpio[0:18] suppose to be received as output at GPIO[19:37] void main() { set_registers(); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); int mask = 0x7FFFF; int mask_h = 0x7E000; int i_val = 0; @@ -39,11 +39,11 @@ void main() send_packet(2); while (true) { - i_val = get_gpio_l() & mask; + i_val = GPIOs_readLow() & mask; o_val_l = i_val << 19; o_val_h = i_val & mask_h; o_val_h = o_val_h >> 13; - set_gpio_h(o_val_h); - set_gpio_l(o_val_l); + GPIOs_writeHigh(o_val_h); + GPIOs_writeLow(o_val_l); } } diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_o/gpio_o.c b/caravel_board/firmware_vex/mpw8_tests/gpio_o/gpio_o.c index c3496129..3c5fb04d 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_o/gpio_o.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_o/gpio_o.c @@ -6,25 +6,25 @@ void main() int i, j; int num_pulses = 4; char *c; - configure_all_gpios(GPIO_MODE_MGMT_STD_OUTPUT); - configure_gpio(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + GPIOs_configureAll(GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); config_uart(); print("Start Test: gpio_o\n"); while (true) { - c = uart_get_line(); + c = UART_readLine(); j = get_int_from_string(c); if (j >= 32) { for (i = 0; i < num_pulses; i++) { - set_gpio_h(0x1 << j - 32); + GPIOs_writeHigh(0x1 << j - 32); print("u\n"); count_down(PULSE_WIDTH); - set_gpio_h(0x0); + GPIOs_writeHigh(0x0); print("d\n"); count_down(PULSE_WIDTH); } @@ -33,10 +33,10 @@ void main() { for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << j); + GPIOs_writeLow(0x1 << j); print("u\n"); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); print("d\n"); count_down(PULSE_WIDTH); } diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_o_h/gpio_o_h.c b/caravel_board/firmware_vex/mpw8_tests/gpio_o_h/gpio_o_h.c index 66767397..af1e9184 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_o_h/gpio_o_h.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_o_h/gpio_o_h.c @@ -104,10 +104,10 @@ void main() int num_pulses = 4; int num_bits = 8; configure_mgmt_gpio(); - configure_all_gpios(GPIO_MODE_MGMT_STD_OUTPUT); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + GPIOs_configureAll(GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); // gpio_config_io(); send_packet(1); // start sending on the higest gpios @@ -118,9 +118,9 @@ void main() { for (i = 0; i < num_pulses; i++) { - set_gpio_h(0x1 << j - 32); + GPIOs_writeHigh(0x1 << j - 32); count_down(PULSE_WIDTH); - set_gpio_h(0x0); + GPIOs_writeHigh(0x0); count_down(PULSE_WIDTH); } } @@ -128,9 +128,9 @@ void main() { for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << j); + GPIOs_writeLow(0x1 << j); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); count_down(PULSE_WIDTH); } } @@ -141,9 +141,9 @@ void main() send_packet(28 - j + 2); // send 4 pulses at gpio[j] for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << j); + GPIOs_writeLow(0x1 << j); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); count_down(PULSE_WIDTH); } } diff --git a/caravel_board/firmware_vex/mpw8_tests/gpio_o_l/gpio_o_l.c b/caravel_board/firmware_vex/mpw8_tests/gpio_o_l/gpio_o_l.c index f63e175f..0c43bed8 100644 --- a/caravel_board/firmware_vex/mpw8_tests/gpio_o_l/gpio_o_l.c +++ b/caravel_board/firmware_vex/mpw8_tests/gpio_o_l/gpio_o_l.c @@ -7,12 +7,12 @@ void main() int num_pulses = 4; int num_bits = 19; char *c; - configure_all_gpios(GPIO_MODE_MGMT_STD_OUTPUT); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + GPIOs_configureAll(GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); // config_uart(); - enable_uart_TX(1); + UART_enableTX(1); print("Start Test: gpio_o\n"); for (j = 0; j < 37; j++) @@ -27,9 +27,9 @@ void main() { for (i = 0; i < num_pulses; i++) { - set_gpio_h(0x1 << j - 32); + GPIOs_writeHigh(0x1 << j - 32); count_down(PULSE_WIDTH); - set_gpio_h(0x0); + GPIOs_writeHigh(0x0); count_down(PULSE_WIDTH); } } @@ -37,9 +37,9 @@ void main() { for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << j); + GPIOs_writeLow(0x1 << j); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); count_down(PULSE_WIDTH); } } diff --git a/caravel_board/firmware_vex/mpw8_tests/hk_regs_wr_wb_cpu/hk_regs_wr_wb_cpu.c b/caravel_board/firmware_vex/mpw8_tests/hk_regs_wr_wb_cpu/hk_regs_wr_wb_cpu.c index 342852f3..52e2ecdb 100755 --- a/caravel_board/firmware_vex/mpw8_tests/hk_regs_wr_wb_cpu/hk_regs_wr_wb_cpu.c +++ b/caravel_board/firmware_vex/mpw8_tests/hk_regs_wr_wb_cpu/hk_regs_wr_wb_cpu.c @@ -162,7 +162,7 @@ bool check_all_gpio_ctrl_regs(unsigned int data_in) bool hk_regs_wr_wb_cpu() { - enable_hk_spi(0); + enableHkSpi(0); int old_reg_hkspi_status = reg_hkspi_status; int old_reg_hkspi_chip_id = reg_hkspi_chip_id; int old_reg_hkspi_user_id = reg_hkspi_user_id; diff --git a/caravel_board/firmware_vex/mpw8_tests/receive_packet/receive_packet.c b/caravel_board/firmware_vex/mpw8_tests/receive_packet/receive_packet.c index dbdbd591..6c6d17cb 100644 --- a/caravel_board/firmware_vex/mpw8_tests/receive_packet/receive_packet.c +++ b/caravel_board/firmware_vex/mpw8_tests/receive_packet/receive_packet.c @@ -20,19 +20,19 @@ void receive_packet_test() send_packet(2); bool is_recieved; configure_mgmt_gpio_input(); - configure_all_gpios(GPIO_MODE_MGMT_STD_OUTPUT); - set_gpio_h(0); - set_gpio_l(0); + GPIOs_configureAll(GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); // gpio_config_io(); - gpio_config_load(); - // enable_uart_TX(1); + GPIOs_loadConfigs(); + // UART_enableTX(1); // print("ready"); for (int i = 5; i < 8; i++) { configure_mgmt_gpio_input(); - set_gpio_l(0x1 << 0); + GPIOs_writeLow(0x1 << 0); is_recieved = recieved_pulse_num(i); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); configure_mgmt_gpio(); count_down(PULSE_WIDTH); if (is_recieved) diff --git a/caravel_board/firmware_vex/mpw8_tests/spi_master/spi_master.c b/caravel_board/firmware_vex/mpw8_tests/spi_master/spi_master.c index 853073da..cece8be5 100644 --- a/caravel_board/firmware_vex/mpw8_tests/spi_master/spi_master.c +++ b/caravel_board/firmware_vex/mpw8_tests/spi_master/spi_master.c @@ -51,35 +51,35 @@ void main() configure_mgmt_gpio(); // For SPI operation, GPIO 1 should be an input, and GPIOs 2 to 4 // should be outputs. - configure_gpio(34,GPIO_MODE_MGMT_STD_INPUT_NOPULL); // SDI - configure_gpio(35,GPIO_MODE_MGMT_STD_OUTPUT); // SDO - configure_gpio(33,GPIO_MODE_MGMT_STD_OUTPUT); // CSB - configure_gpio(32,GPIO_MODE_MGMT_STD_OUTPUT); // SCK - gpio_config_load(); + GPIOs_configure(34,GPIO_MODE_MGMT_STD_INPUT_NOPULL); // SDI + GPIOs_configure(35,GPIO_MODE_MGMT_STD_OUTPUT); // SDO + GPIOs_configure(33,GPIO_MODE_MGMT_STD_OUTPUT); // CSB + GPIOs_configure(32,GPIO_MODE_MGMT_STD_OUTPUT); // SCK + GPIOs_loadConfigs(); reg_spimaster_clk_divider = 0x4; - enable_spi(1); - enable_CS(1); // sel=0, manual CS + MSPI_enable(1); + MSPI_enableCS(1); // sel=0, manual CS send_packet(2); count_down(PULSE_WIDTH * 5); - value = spi_write_reg(); // + value = MSPI_write_reg(); // - // spi_write(0x40); // Caravel Stream Write + // MSPI_write(0x40); // Caravel Stream Write // for(int i = 0; i < 10000; i++); - // spi_write(0x01); // Write register for mfg code + // MSPI_write(0x01); // Write register for mfg code // for(int i = 0; i < 20000; i++); - // value = spi_read(); // 0xD + // value = MSPI_read(); // 0xD if (value == 0x04) send_packet(5); // read correct value else send_packet(9); // read wrong value - enable_CS(0); // release CS - enable_CS(1); // sel=0, manual CS + MSPI_enableCS(0); // release CS + MSPI_enableCS(1); // sel=0, manual CS // End test send_packet(3); diff --git a/caravel_board/firmware_vex/mpw8_tests/spi_rd/spi_rd.c b/caravel_board/firmware_vex/mpw8_tests/spi_rd/spi_rd.c index 48ed13bc..46e12df4 100644 --- a/caravel_board/firmware_vex/mpw8_tests/spi_rd/spi_rd.c +++ b/caravel_board/firmware_vex/mpw8_tests/spi_rd/spi_rd.c @@ -24,11 +24,11 @@ void main() configure_mgmt_gpio(); // For SPI operation, GPIO 1 should be an input, and GPIOs 2 to 4 // should be outputs. - configure_gpio(34, GPIO_MODE_MGMT_STD_INPUT_NOPULL); // SDI - configure_gpio(35, GPIO_MODE_MGMT_STD_OUTPUT); // SDO - configure_gpio(33, GPIO_MODE_MGMT_STD_OUTPUT); // CSB - configure_gpio(32, GPIO_MODE_MGMT_STD_OUTPUT); // SCK - gpio_config_load(); - enable_spi(1); + GPIOs_configure(34, GPIO_MODE_MGMT_STD_INPUT_NOPULL); // SDI + GPIOs_configure(35, GPIO_MODE_MGMT_STD_OUTPUT); // SDO + GPIOs_configure(33, GPIO_MODE_MGMT_STD_OUTPUT); // CSB + GPIOs_configure(32, GPIO_MODE_MGMT_STD_OUTPUT); // SCK + GPIOs_loadConfigs(); + MSPI_enable(1); send_packet(2); } \ No newline at end of file diff --git a/caravel_board/firmware_vex/mpw8_tests/timer0_oneshot/timer0_oneshot.c b/caravel_board/firmware_vex/mpw8_tests/timer0_oneshot/timer0_oneshot.c index 5d806316..44c54744 100755 --- a/caravel_board/firmware_vex/mpw8_tests/timer0_oneshot/timer0_oneshot.c +++ b/caravel_board/firmware_vex/mpw8_tests/timer0_oneshot/timer0_oneshot.c @@ -44,17 +44,17 @@ bool timer0_oneshot() uint32_t old_value; /* Configure timer for a single-shot countdown */ - timer0_oneshot_configure(0xF3000); + timer0_configureOneShot(0xF3000); // Loop, waiting for the interrupt to change reg_mprj_datah // test path if counter value stop updated after reach 0 and also the value is always decrementing - update_timer0_val(); // update reg_timer0_value with new counter value - old_value = get_timer0_val(); + timer0_updateValue(); // update reg_timer0_value with new counter value + old_value = timer0_readValue(); // value us decrementing until it reachs zero while (1) { - update_timer0_val(); // update reg_timer0_value with new counter value - value = get_timer0_val(); + timer0_updateValue(); // update reg_timer0_value with new counter value + value = timer0_readValue(); if (value < old_value || value == 0){ //send_packet(5); //timer updated correctly if (value==0) @@ -71,9 +71,9 @@ bool timer0_oneshot() // check after 10 iterations that value don't change from 0 for (int i = 0; i < 10; i++); - update_timer0_val(); // update reg_timer0_value with new counter value + timer0_updateValue(); // update reg_timer0_value with new counter value - if (get_timer0_val() == 0){ + if (timer0_readValue() == 0){ return true; // timer updated correctly }else{ return false; // timer updated incorrectly diff --git a/caravel_board/firmware_vex/mpw8_tests/uart/uart.c b/caravel_board/firmware_vex/mpw8_tests/uart/uart.c index fadb3311..83b3f0c8 100644 --- a/caravel_board/firmware_vex/mpw8_tests/uart/uart.c +++ b/caravel_board/firmware_vex/mpw8_tests/uart/uart.c @@ -36,13 +36,13 @@ void uart() { int i, j; configure_mgmt_gpio(); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); // gpio_config_io(); - gpio_config_load(); + GPIOs_loadConfigs(); // Start test send_packet(2); // start of transmitting - enable_uart_TX(1); + UART_enableTX(1); print("Monitor: Test UART passed\n"); @@ -51,5 +51,5 @@ void uart() for (j = 0; j < 1000; j++) ; send_packet(5); // end of transmitting - enable_uart_TX(0); + UART_enableTX(0); } diff --git a/caravel_board/firmware_vex/mpw8_tests/uart_io/uart_io.c b/caravel_board/firmware_vex/mpw8_tests/uart_io/uart_io.c index 503b3416..3994c8e7 100644 --- a/caravel_board/firmware_vex/mpw8_tests/uart_io/uart_io.c +++ b/caravel_board/firmware_vex/mpw8_tests/uart_io/uart_io.c @@ -13,11 +13,11 @@ void uart_io() int timeout = 15000; long int timeout_count = 0; configure_mgmt_gpio(); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - configure_gpio(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - set_gpio_h(0); - set_gpio_l(0); - gpio_config_load(); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_writeHigh(0); + GPIOs_writeLow(0); + GPIOs_loadConfigs(); // gpio_config_io(); mask = 0x1 << 5; // count_down(PULSE_WIDTH * 100); @@ -25,19 +25,19 @@ void uart_io() count_down(PULSE_WIDTH * 4); for (i = 0; i < num_pulses; i++) { - set_gpio_l(0x1 << 6); + GPIOs_writeLow(0x1 << 6); count_down(PULSE_WIDTH); - set_gpio_l(0x0); + GPIOs_writeLow(0x0); count_down(PULSE_WIDTH); } send_packet(3); - old_recieved = get_gpio_l() & mask; + old_recieved = GPIOs_readLow() & mask; while (true) { - recieved = get_gpio_l() & mask; // mask gpio bit + recieved = GPIOs_readLow() & mask; // mask gpio bit if (recieved != old_recieved) { count++; diff --git a/caravel_board/firmware_vex/mpw8_tests/uart_loopback/uart_loopback.c b/caravel_board/firmware_vex/mpw8_tests/uart_loopback/uart_loopback.c index 9f90b4a9..7bfca994 100644 --- a/caravel_board/firmware_vex/mpw8_tests/uart_loopback/uart_loopback.c +++ b/caravel_board/firmware_vex/mpw8_tests/uart_loopback/uart_loopback.c @@ -40,15 +40,15 @@ void uart_loopback() { int j; configure_mgmt_gpio(); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - configure_gpio(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - gpio_config_load(); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_loadConfigs(); // Start test send_packet(2); // Start of the test - uart_RX_enable(1); - enable_uart_TX(1); + UART_enableRX(1); + UART_enableTX(1); empty_buffer(); print("M"); @@ -75,5 +75,5 @@ void uart_loopback() for (j = 0; j < 1000; j++) ; wait_for_char("o"); - uart_RX_enable(0); + UART_enableRX(0); } \ No newline at end of file diff --git a/caravel_board/firmware_vex/mpw8_tests/uart_reception/uart_reception.c b/caravel_board/firmware_vex/mpw8_tests/uart_reception/uart_reception.c index 0a1bc9c8..affa933d 100644 --- a/caravel_board/firmware_vex/mpw8_tests/uart_reception/uart_reception.c +++ b/caravel_board/firmware_vex/mpw8_tests/uart_reception/uart_reception.c @@ -44,11 +44,11 @@ void uart_reception() { int j; configure_mgmt_gpio(); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - configure_gpio(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - gpio_config_load(); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_loadConfigs(); - uart_RX_enable(1); + UART_enableRX(1); empty_buffer(); // Start test @@ -62,5 +62,5 @@ void uart_reception() send_packet(4); // wait for new character wait_for_char("A"); // 0 - uart_RX_enable(0); + UART_enableRX(0); } \ No newline at end of file diff --git a/caravel_board/firmware_vex/mpw8_tests/uart_recieve_back/uart_recieve_back.c b/caravel_board/firmware_vex/mpw8_tests/uart_recieve_back/uart_recieve_back.c index 976ed5d5..82a5dd9d 100644 --- a/caravel_board/firmware_vex/mpw8_tests/uart_recieve_back/uart_recieve_back.c +++ b/caravel_board/firmware_vex/mpw8_tests/uart_recieve_back/uart_recieve_back.c @@ -23,7 +23,7 @@ int wait_for_char() while (uart_rxempty_read() == 1); uart_temp = reg_uart_data; - uart_pop_char(); + UART_popChar(); return uart_temp; } @@ -47,12 +47,12 @@ void main() { int j; configure_mgmt_gpio(); - configure_gpio(6, GPIO_MODE_MGMT_STD_OUTPUT); - configure_gpio(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); - gpio_config_load(); + GPIOs_configure(6, GPIO_MODE_MGMT_STD_OUTPUT); + GPIOs_configure(5, GPIO_MODE_MGMT_STD_INPUT_NOPULL); + GPIOs_loadConfigs(); - uart_RX_enable(1); - enable_uart_TX(1); + UART_enableRX(1); + UART_enableTX(1); // Start test send_packet(2); // Start of the test diff --git a/caravel_board/firmware_vex/silicon_tests/spi_master/spi_master.c b/caravel_board/firmware_vex/silicon_tests/spi_master/spi_master.c index ca2c85c9..b9d55cb0 100644 --- a/caravel_board/firmware_vex/silicon_tests/spi_master/spi_master.c +++ b/caravel_board/firmware_vex/silicon_tests/spi_master/spi_master.c @@ -28,7 +28,7 @@ * - Uses SPI master to talk to external SPI module */ - void spi_write(char c) + void MSPI_write(char c) { reg_spimaster_wdata = (unsigned long) c; // reg_spimaster_wdata = c; @@ -37,16 +37,16 @@ // reg_spimaster_control = 0x0800; reg_spimaster_control = 0x0801; } - char spi_read() + char MSPI_read() { // reg_spimaster_wdata = c; // spi_master_control_length_write(8); // spi_master_control_start_write(1); // reg_spimaster_control = 0x0800; -// spi_write(0x00); +// MSPI_write(0x00); // reg_spimaster_rdata = 0x00; // reg_spimaster_control = 0x0801; - spi_write(0x00); + MSPI_write(0x00); while (reg_spimaster_status != 1); return reg_spimaster_rdata; } @@ -105,16 +105,16 @@ void main() // reg_spimaster_clk_divider = 0x4E20; - reg_spi_enable = 1; + reg_MSPI_enable = 1; send_packet(1); // enable the SPI reg_spimaster_cs = 0x10001; // sel=0, manual CS - spi_write(0x08); // Write 0x08 + MSPI_write(0x08); // Write 0x08 // for(int i = 0; i < 10000; i++); - spi_write(0x05); // Write 0x05 + MSPI_write(0x05); // Write 0x05 // for(int i = 0; i < 20000; i++); - value = spi_read(); // 0xD + value = MSPI_read(); // 0xD if (value == 0xD) send_packet(5); // read correct value