int main (void) { int result = 0; // UART init UartStdOutInit(); // Test banner message and revision number puts("Cortex Microcontroller System Design Kit - GPIO Driver Test - revision $Revision: 242484 $\n"); if (gpio0_id_check()!=0) { puts ("GPIO 0 not present. Test skipped."); UartEndSimulation(); return 0;} if (gpio1_id_check()!=0) { puts ("GPIO 1 not present. Test skipped."); UartEndSimulation(); return 0;} result |= GPIO_OPEN(); result |= GPIO_AltFuncEN(); result |= GPIO_IRQ(); result |= GPIO_Mask_OP(); if(result == 0) { puts("** TEST PASSED **\n"); } else { printf("** TEST FAILED **, Error code: (0x%x)\n", result); } UartEndSimulation(); return result; }
int main(int argc,char **argv) { unsigned int ret; int i; GPIO_OPEN(); printf("\n%s entered\n",argv[0]); /* //gpio output test gpio_set_port_data(0x80); gpio_set_direction(0xff); gpio_set_int_mask(0xff); gpio_set_event_type(0xff); ret = gpio_get_int_status(); */ for(i=0;i<0xffff;i++); //gpio input test gpio_set_direction(0x0); gpio_set_int_mask(0x0); gpio_set_event_type(0xff); ret = gpio_get_port_data(); printf("get port data = 0x%x\n",ret); ret = gpio_get_int_status(); printf("gpio status = %x\n",ret); GPIO_CLOSE(); return 0; }