Lines Matching refs:vtb
45 #define vtb_wrap(vtb, at, offset) \ argument
46 (((at) + (offset) + (vtb)->vtb_size)%(vtb)->vtb_size)
49 sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait) in sc_vtb_init() argument
51 vtb->vtb_flags = 0; in sc_vtb_init()
52 vtb->vtb_type = type; in sc_vtb_init()
53 vtb->vtb_cols = cols; in sc_vtb_init()
54 vtb->vtb_rows = rows; in sc_vtb_init()
55 vtb->vtb_size = cols*rows; in sc_vtb_init()
56 vtb->vtb_buffer = 0; in sc_vtb_init()
57 vtb->vtb_tail = 0; in sc_vtb_init()
63 vtb->vtb_buffer = in sc_vtb_init()
67 if (vtb->vtb_buffer != 0) { in sc_vtb_init()
68 bzero((void *)sc_vtb_pointer(vtb, 0), in sc_vtb_init()
70 vtb->vtb_flags |= VTB_ALLOCED; in sc_vtb_init()
73 vtb->vtb_buffer = (vm_offset_t)buf; in sc_vtb_init()
75 vtb->vtb_flags |= VTB_VALID; in sc_vtb_init()
78 vtb->vtb_buffer = (vm_offset_t)buf; in sc_vtb_init()
79 vtb->vtb_flags |= VTB_VALID; in sc_vtb_init()
87 sc_vtb_destroy(sc_vtb_t *vtb) in sc_vtb_destroy() argument
91 vtb->vtb_cols = 0; in sc_vtb_destroy()
92 vtb->vtb_rows = 0; in sc_vtb_destroy()
93 vtb->vtb_size = 0; in sc_vtb_destroy()
94 vtb->vtb_tail = 0; in sc_vtb_destroy()
96 p = vtb->vtb_buffer; in sc_vtb_destroy()
97 vtb->vtb_buffer = 0; in sc_vtb_destroy()
98 switch (vtb->vtb_type) { in sc_vtb_destroy()
101 if ((vtb->vtb_flags & VTB_ALLOCED) && (p != 0)) in sc_vtb_destroy()
107 vtb->vtb_flags = 0; in sc_vtb_destroy()
108 vtb->vtb_type = VTB_INVALID; in sc_vtb_destroy()
118 sc_vtb_getc(sc_vtb_t *vtb, int at) in sc_vtb_getc() argument
120 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_getc()
121 return (readw(sc_vtb_pointer(vtb, at)) & 0x00ff); in sc_vtb_getc()
123 return (*(u_int16_t *)sc_vtb_pointer(vtb, at) & 0x00ff); in sc_vtb_getc()
127 sc_vtb_geta(sc_vtb_t *vtb, int at) in sc_vtb_geta() argument
129 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_geta()
130 return (readw(sc_vtb_pointer(vtb, at)) & 0xff00); in sc_vtb_geta()
132 return (*(u_int16_t *)sc_vtb_pointer(vtb, at) & 0xff00); in sc_vtb_geta()
136 sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a) in sc_vtb_putc() argument
138 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_putc()
139 writew(sc_vtb_pointer(vtb, at), a | c); in sc_vtb_putc()
141 *(u_int16_t *)sc_vtb_pointer(vtb, at) = a | c; in sc_vtb_putc()
145 sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a) in sc_vtb_putchar() argument
147 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_putchar()
155 sc_vtb_pointer(sc_vtb_t *vtb, int at) in sc_vtb_pointer() argument
157 return (vtb->vtb_buffer + sizeof(u_int16_t)*(at)); in sc_vtb_pointer()
161 sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset) in sc_vtb_pos() argument
163 return ((pos + offset + vtb->vtb_size)%vtb->vtb_size); in sc_vtb_pos()
167 sc_vtb_clear(sc_vtb_t *vtb, int c, int attr) in sc_vtb_clear() argument
169 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_clear()
170 fillw_io(attr | c, sc_vtb_pointer(vtb, 0), vtb->vtb_size); in sc_vtb_clear()
172 fillw(attr | c, (void *)sc_vtb_pointer(vtb, 0), vtb->vtb_size); in sc_vtb_clear()
218 sc_vtb_seek(sc_vtb_t *vtb, int pos) in sc_vtb_seek() argument
220 vtb->vtb_tail = pos%vtb->vtb_size; in sc_vtb_seek()
224 sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr) in sc_vtb_erase() argument
226 if (at + count > vtb->vtb_size) in sc_vtb_erase()
227 count = vtb->vtb_size - at; in sc_vtb_erase()
228 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_erase()
229 fillw_io(attr | c, sc_vtb_pointer(vtb, at), count); in sc_vtb_erase()
231 fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count); in sc_vtb_erase()
235 sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count) in sc_vtb_move() argument
237 if (from + count > vtb->vtb_size) in sc_vtb_move()
238 count = vtb->vtb_size - from; in sc_vtb_move()
239 if (to + count > vtb->vtb_size) in sc_vtb_move()
240 count = vtb->vtb_size - to; in sc_vtb_move()
243 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_move()
244 bcopy_io(sc_vtb_pointer(vtb, from), in sc_vtb_move()
245 sc_vtb_pointer(vtb, to), count*sizeof(u_int16_t)); in sc_vtb_move()
247 bcopy((void *)sc_vtb_pointer(vtb, from), in sc_vtb_move()
248 (void *)sc_vtb_pointer(vtb, to), count*sizeof(u_int16_t)); in sc_vtb_move()
252 sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr) in sc_vtb_delete() argument
256 if (at + count > vtb->vtb_size) in sc_vtb_delete()
257 count = vtb->vtb_size - at; in sc_vtb_delete()
258 len = vtb->vtb_size - at - count; in sc_vtb_delete()
260 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_delete()
261 bcopy_io(sc_vtb_pointer(vtb, at + count), in sc_vtb_delete()
262 sc_vtb_pointer(vtb, at), in sc_vtb_delete()
265 bcopy((void *)sc_vtb_pointer(vtb, at + count), in sc_vtb_delete()
266 (void *)sc_vtb_pointer(vtb, at), in sc_vtb_delete()
269 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_delete()
270 fillw_io(attr | c, sc_vtb_pointer(vtb, at + len), in sc_vtb_delete()
271 vtb->vtb_size - at - len); in sc_vtb_delete()
273 fillw(attr | c, (void *)sc_vtb_pointer(vtb, at + len), in sc_vtb_delete()
274 vtb->vtb_size - at - len); in sc_vtb_delete()
278 sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr) in sc_vtb_ins() argument
280 if (at + count > vtb->vtb_size) in sc_vtb_ins()
281 count = vtb->vtb_size - at; in sc_vtb_ins()
283 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_ins()
284 bcopy_io(sc_vtb_pointer(vtb, at), in sc_vtb_ins()
285 sc_vtb_pointer(vtb, at + count), in sc_vtb_ins()
286 (vtb->vtb_size - at - count)*sizeof(u_int16_t)); in sc_vtb_ins()
288 bcopy((void *)sc_vtb_pointer(vtb, at), in sc_vtb_ins()
289 (void *)sc_vtb_pointer(vtb, at + count), in sc_vtb_ins()
290 (vtb->vtb_size - at - count)*sizeof(u_int16_t)); in sc_vtb_ins()
292 if (vtb->vtb_type == VTB_FRAMEBUFFER) in sc_vtb_ins()
293 fillw_io(attr | c, sc_vtb_pointer(vtb, at), count); in sc_vtb_ins()
295 fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count); in sc_vtb_ins()