// TODO: Error codes int usart_putc(char data, FILE *unused) { if (usart_is_initialized) { while (!(UCSRA & (1 << UDRE))) os_delay(os_get_current_process(), 1000); UDR = data; } return 0; }
// TODO: Error codes int usart_getc(FILE *unused) { if (usart_is_initialized) { while (!(UCSRA & (1 << RXC))) os_delay(os_get_current_process(), 1000); return UDR; } return 0; }
/* * (see above for additional information) * * If the 'at' usage count drops to zero with the updated logic, the * VMA's file pointer is saved; nv_kern_close() uses it to find * these allocations when the parent file descriptor is closed. This * will typically happen when the process exits. * * Since this is technically a workaround to handle possible fallout * from misbehaving clients, we addtionally print a warning. */ static void nv_kern_vma_release(struct vm_area_struct *vma) { NV_PRINT_VMA(NV_DBG_MEMINFO, vma); if (NV_VMA_PRIVATE(vma)) { nv_alloc_t *at = (nv_alloc_t *) NV_VMA_PRIVATE(vma); if (NV_ATOMIC_DEC_AND_TEST(at->usage_count)) { static int count = 0; if ((at->pid == os_get_current_process()) && (count++ < NV_MAX_RECURRING_WARNING_MESSAGES)) { nv_printf(NV_DBG_MEMINFO, "NVRM: VM: %s: late unmap, comm: %s, 0x%p\n", __FUNCTION__, current->comm, at); } at->file = NV_VMA_FILE(vma); } if (!NV_ALLOC_MAPPING_AGP(at->flags)) { NV_PRINT_AT(NV_DBG_MEMINFO, at); nv_vm_list_page_count(at->page_table, at->num_pages); } } }