/* Set gpio blink register */ static int pch_gpio_blink_config(int gpio, int value, unsigned int gpio_base_addr) { unsigned long int gpio_use_sel_addr, gp_io_sel_addr, gp_lvl_addr; int new_gpio; if (gpio > 31) /* only support GPIO0 to GPIO31 */ return -1; /* Set gpio_out direction to output and pull low or high. */ new_gpio = gpio_setup_addr(&gpio_use_sel_addr, &gp_io_sel_addr, \ &gp_lvl_addr, gpio, gpio_base_addr); gpio_enable(gpio_use_sel_addr, new_gpio); gpio_blink(gpio_base_addr, new_gpio, value); DBG("gpio_sel_addr = %x, gp_lvl_addr =%x\n", gp_io_sel_addr, gp_lvl_addr); printf("%s GPIO[%d] blink.\n", value ? "Enalbe" : "Disable", gpio); return 0; }
int main(int argc, char **argv){ gpio_init(); CvMat *matA = cvLoadImageM(argv[1],0); if(!matA) return(-1); else printf("%s is %dx%d\n",argv[1],matA->cols,matA->rows); int i, j; imageblink: for (j=0; j<matA->rows; j++){ if ((j==0) & (i==0)){ gpio_blink(0xc); gpio_blink(0xc); // just to be safe } else{ gpio_blink(0xd); gpio_blink(0xd); // just to be safe } for (i=0; i<matA->cols; i++){ temp= matA->data.ptr[j*matA->cols+i]; if ((temp==0xc) || (temp==0xd)) gpio_blink(0xe); else gpio_blink(temp); } } goto imageblink; }