static void blinkf() { res_type_t type = res_compose (RES_DEV, RES_GPIO, 0, 0); int prd; int on = 1; int off = 0; char msg[4]; uint32_t volatile ra = 0;// mmio_read (GPFSEL4); ra = 1 << 3; //mmio_write (GPFSEL4, ra); *((volatile uint32_t*) GPFSEL2) = ra; ra = 1 << 21; GET_RES (prd, type, 0, 0); while (1) { ssleep (0x60000); *((volatile uint32_t*) GPSET0) = ra; //mmio_write (GPSET1, ra); SEND(&on, 4, 5); ssleep (0x60000); //mmio_write (GPCLR1, ra); *((volatile uint32_t*) GPCLR0) = ra; SEND(&off, 4, 5); } GIVE_RES (prd, type, 0, 0); }
void terminal_func() { char* str = (char*) kcalloc (256, sizeof (char)); int retv = -1; res_type_t type = res_compose (RES_CPU, 0, 0, 0); int prd; while(1) { GET_RES (prd, type, 3, R_WAITFROM); //dump_rbuffer(GET_KERNEL_THREAD()->buffer, msg_d); while (try_receive (str) >= 0) kprint ("%s", str); GIVE_RES (prd, type, 3, R_SENDTO); } }
void thread_2_func() { char* str = (char*) kcalloc (256, sizeof (char)); res_type_t type = res_compose (RES_CPU, 0, 0, 0); int prd; GET_RES (prd, type, 0, 0); while(1) { GET_RES (prd, type, 2, R_WAITFROM); //dump_rbuffer(GET_KERNEL_THREAD()->buffer, msg_d); SEND_STR ("Hello #2\r\n", strlen ("Hello #2\r\n") + 1); kprint ("%d\r\n", prd); GIVE_RES (prd, type, 2, R_SENDTO); } }