unsigned int board_info_peripheral_base_addr(void) { unsigned address = get_dt_ranges("/proc/device-tree/soc/ranges", 4); board_info_init(); if (address == ~0) { if (board_model == MODEL_B_2) return 0x3f000000; else return 0x20000000; } else { return address; } }
unsigned int board_info_sdram_address(void) { unsigned address = get_dt_ranges("/proc/device-tree/axi/vc_mem/reg", 8); board_info_init(); if (address == ~0) { if (board_model == MODEL_B_2) return 0xc0000000; else return 0x40000000; } else { return address; } }
int main(int argc, char **argv) { int shader = 0; if (argc >= 3){ if(sscanf (argv[2], "%i", &anim_delay)!=1){ printf ("Error, delay must be an integer \n"); return 0; } } int newbrightness = 0; if (argc >= 4){ if(sscanf (argv[3], "%i", &newbrightness)!=1){ printf ("Error, brightness must be an integer \n"); return 0; }else{ setBrightness(newbrightness/100.0); } } if (argc == 2){ if(sscanf (argv[1], "%i", &newbrightness)==1){ setBrightness(newbrightness/100.0); shader = 1; } } int i; for (i = 0; i < 64; i++) { struct sigaction sa; memset(&sa, 0, sizeof(sa)); sa.sa_handler = unicorn_exit; sigaction(i, &sa, NULL); } setvbuf(stdout, NULL, _IONBF, 0); if (board_info_init() < 0) { return -1; } if(ws2811_init(&ledstring)) { return -1; } clearLEDBuffer(); if(argc < 2){ shader = 1; } if(shader){ run_shader(); }else{ read_png_file(argv[1]); while(1){ process_file(); if (height/8 == 1){ break; } } } unicorn_exit(0); return 0; }
void cpu_startup(void) { /* For use by propdb. */ static u_int memsize = PHYSMEM * 1024 * 1024; static u_int cpuspeed = CPUFREQ * 1000 * 1000; prop_number_t pn; vaddr_t minaddr, maxaddr; char pbuf[9]; curcpu()->ci_khz = cpuspeed / 1000; /* Initialize error message buffer. */ initmsgbuf((void *)msgbuf, round_page(MSGBUFSIZE)); printf("%s%s", copyright, version); format_bytes(pbuf, sizeof(pbuf), ctob(physmem)); printf("total memory = %s\n", pbuf); minaddr = 0; /* * Allocate a submap for physio */ phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, VM_PHYS_SIZE, 0, false, NULL); /* * No need to allocate an mbuf cluster submap. Mbuf clusters * are allocated via the pool allocator, and we use direct-mapped * pool pages. */ format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free)); printf("avail memory = %s\n", pbuf); /* * Set up the board properties database. */ board_info_init(); pn = prop_number_create_integer(memsize); KASSERT(pn != NULL); if (prop_dictionary_set(board_properties, "mem-size", pn) == false) panic("setting mem-size"); prop_object_release(pn); pn = prop_number_create_integer(cpuspeed); KASSERT(pn != NULL); if (prop_dictionary_set(board_properties, "processor-frequency", pn) == false) panic("setting processor-frequency"); prop_object_release(pn); /* * Now that we have VM, malloc()s are OK in bus_space. */ bus_space_mallocok(); fake_mapiodev = 0; }