__initfunc(void mem_init(unsigned long start_mem, unsigned long end_mem)) { int codepages = 0; int datapages = 0; unsigned long tmp; extern int _etext, _ftext; #ifdef CONFIG_MIPS_JAZZ if (mips_machgroup == MACH_GROUP_JAZZ) start_mem = vdma_init(start_mem, end_mem); #endif end_mem &= PAGE_MASK; max_mapnr = MAP_NR(end_mem); high_memory = (void *)end_mem; num_physpages = 0; /* mark usable pages in the mem_map[] */ start_mem = PAGE_ALIGN(start_mem); for(tmp = MAP_NR(start_mem);tmp < max_mapnr;tmp++) clear_bit(PG_reserved, &mem_map[tmp].flags); prom_fixup_mem_map(start_mem, (unsigned long)high_memory); for (tmp = PAGE_OFFSET; tmp < end_mem; tmp += PAGE_SIZE) { /* * This is only for PC-style DMA. The onboard DMA * of Jazz and Tyne machines is completely different and * not handled via a flag in mem_map_t. */ if (tmp >= MAX_DMA_ADDRESS) clear_bit(PG_DMA, &mem_map[MAP_NR(tmp)].flags); if (PageReserved(mem_map+MAP_NR(tmp))) { if ((tmp < (unsigned long) &_etext) && (tmp >= (unsigned long) &_ftext)) codepages++; else if ((tmp < start_mem) && (tmp > (unsigned long) &_etext)) datapages++; continue; } num_physpages++; atomic_set(&mem_map[MAP_NR(tmp)].count, 1); #ifdef CONFIG_BLK_DEV_INITRD if (!initrd_start || (tmp < initrd_start || tmp >= initrd_end)) #endif free_page(tmp); } tmp = nr_free_pages << PAGE_SHIFT; /* Setup zeroed pages. */ tmp -= setup_zero_pages(); printk("Memory: %luk/%luk available (%dk kernel code, %dk data)\n", tmp >> 10, max_mapnr << (PAGE_SHIFT-10), codepages << (PAGE_SHIFT-10), datapages << (PAGE_SHIFT-10)); }
int smart_car_demo_init( smart_car_demo_t *pDemo ) { int ret; OS_PRINTF("\n\r"); OS_PRINTF("------------------------------------------------------\n\r"); OS_PRINTF("-- Xilinx Zybo smart car demo --\n\r"); OS_PRINTF("-- 640*480P60 Real-Time Camera Demonstration --\n\r"); OS_PRINTF("------------------------------------------------------\n\r"); OS_PRINTF("\n\r"); pDemo->bVerbose = 0; OS_PRINTF( "SMART_CAR Initialization ...\n\r" ); #if defined(XPAR_XIMAGE_FILTER_0_S_AXI_CONTROL_BUS_BASEADDR) pDemo->SOBEL.IsReady = 1; XSobel_Set_rows(&(pDemo->SOBEL), 480); XSobel_Set_cols(&(pDemo->SOBEL), 640); XSobel_Set_C_XR0C0(&(pDemo->SOBEL), 1); XSobel_Set_C_XR0C1(&(pDemo->SOBEL), 0); XSobel_Set_C_XR0C2(&(pDemo->SOBEL), -1); XSobel_Set_C_XR1C0(&(pDemo->SOBEL), 2); XSobel_Set_C_XR1C1(&(pDemo->SOBEL), 0); XSobel_Set_C_XR1C2(&(pDemo->SOBEL), -2); XSobel_Set_C_XR2C0(&(pDemo->SOBEL), 1); XSobel_Set_C_XR2C1(&(pDemo->SOBEL), 0); XSobel_Set_C_XR2C2(&(pDemo->SOBEL), -1); XSobel_Set_C_YR0C0(&(pDemo->SOBEL), 1); XSobel_Set_C_YR0C1(&(pDemo->SOBEL), 2); XSobel_Set_C_YR0C2(&(pDemo->SOBEL), 1); XSobel_Set_C_YR1C0(&(pDemo->SOBEL), 0); XSobel_Set_C_YR1C1(&(pDemo->SOBEL), 0); XSobel_Set_C_YR1C2(&(pDemo->SOBEL), 0); XSobel_Set_C_YR2C0(&(pDemo->SOBEL), -1); XSobel_Set_C_YR2C1(&(pDemo->SOBEL), -2); XSobel_Set_C_YR2C2(&(pDemo->SOBEL), -1); XSobel_Set_c_high_thresh(&(pDemo->SOBEL), 200); XSobel_Set_c_low_thresh(&(pDemo->SOBEL), 100); XSobel_Set_c_invert(&(pDemo->SOBEL), 1); XSobel_Set_threshold(&(pDemo->SOBEL), 75); XSobel_EnableAutoRestart(&(pDemo->SOBEL)); XSobel_InterruptDisable(&(pDemo->SOBEL), 0xFFFFFFFF); XSobel_InterruptGlobalDisable(&(pDemo->SOBEL)); XSobel_Start(&(pDemo->SOBEL)); // printf("*******%d\n",XSobel_Get_c_invert(&(pDemo->SOBEL))); OS_PRINTF("SOBEL done\r\n"); #endif pDemo->vdma_resolution = 0; // re-initialization vdma_init( pDemo->uBaseAddr_VDMA_FrameBuffer, pDemo->vdma_resolution, VDMA_MEM_BASE_ADDR ); sleep(2); vdma_init_sobel( pDemo->uBaseAddr_VDMA_FrameBuffer_1, pDemo->vdma_resolution, VDMA_MEM_BASE_ADDR_1 ); return 0; }