Lines Matching refs:vtb

45 #define vtb_wrap(vtb, at, offset)				\
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)
51 vtb->vtb_flags = 0;
52 vtb->vtb_type = type;
53 vtb->vtb_cols = cols;
54 vtb->vtb_rows = rows;
55 vtb->vtb_size = cols*rows;
56 vtb->vtb_buffer = 0;
57 vtb->vtb_tail = 0;
63 vtb->vtb_buffer =
67 if (vtb->vtb_buffer != 0) {
68 bzero((void *)sc_vtb_pointer(vtb, 0),
70 vtb->vtb_flags |= VTB_ALLOCED;
73 vtb->vtb_buffer = (vm_offset_t)buf;
75 vtb->vtb_flags |= VTB_VALID;
79 vtb->vtb_buffer = (vm_offset_t)buf;
80 vtb->vtb_flags |= VTB_VALID;
89 sc_vtb_destroy(sc_vtb_t *vtb)
93 vtb->vtb_cols = 0;
94 vtb->vtb_rows = 0;
95 vtb->vtb_size = 0;
96 vtb->vtb_tail = 0;
98 p = vtb->vtb_buffer;
99 vtb->vtb_buffer = 0;
100 switch (vtb->vtb_type) {
103 if ((vtb->vtb_flags & VTB_ALLOCED) && (p != 0))
109 vtb->vtb_flags = 0;
110 vtb->vtb_type = VTB_INVALID;
120 sc_vtb_getc(sc_vtb_t *vtb, int at)
123 if (vtb->vtb_type == VTB_FRAMEBUFFER)
124 return (readw(sc_vtb_pointer(vtb, at)) & 0x00ff);
127 return (*(u_int16_t *)sc_vtb_pointer(vtb, at) & 0x00ff);
131 sc_vtb_geta(sc_vtb_t *vtb, int at)
134 if (vtb->vtb_type == VTB_FRAMEBUFFER)
135 return (readw(sc_vtb_pointer(vtb, at)) & 0xff00);
138 return (*(u_int16_t *)sc_vtb_pointer(vtb, at) & 0xff00);
142 sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a)
145 if (vtb->vtb_type == VTB_FRAMEBUFFER)
146 writew(sc_vtb_pointer(vtb, at), a | c);
149 *(u_int16_t *)sc_vtb_pointer(vtb, at) = a | c;
153 sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a)
156 if (vtb->vtb_type == VTB_FRAMEBUFFER)
165 sc_vtb_pointer(sc_vtb_t *vtb, int at)
167 return (vtb->vtb_buffer + sizeof(u_int16_t)*(at));
171 sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset)
173 return ((pos + offset + vtb->vtb_size)%vtb->vtb_size);
177 sc_vtb_clear(sc_vtb_t *vtb, int c, int attr)
180 if (vtb->vtb_type == VTB_FRAMEBUFFER)
181 fillw_io(attr | c, sc_vtb_pointer(vtb, 0), vtb->vtb_size);
184 fillw(attr | c, (void *)sc_vtb_pointer(vtb, 0), vtb->vtb_size);
234 sc_vtb_seek(sc_vtb_t *vtb, int pos)
236 vtb->vtb_tail = pos%vtb->vtb_size;
240 sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr)
242 if (at + count > vtb->vtb_size)
243 count = vtb->vtb_size - at;
245 if (vtb->vtb_type == VTB_FRAMEBUFFER)
246 fillw_io(attr | c, sc_vtb_pointer(vtb, at), count);
249 fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count);
253 sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count)
255 if (from + count > vtb->vtb_size)
256 count = vtb->vtb_size - from;
257 if (to + count > vtb->vtb_size)
258 count = vtb->vtb_size - to;
262 if (vtb->vtb_type == VTB_FRAMEBUFFER)
263 bcopy_io(sc_vtb_pointer(vtb, from),
264 sc_vtb_pointer(vtb, to), count*sizeof(u_int16_t));
267 bcopy((void *)sc_vtb_pointer(vtb, from),
268 (void *)sc_vtb_pointer(vtb, to), count*sizeof(u_int16_t));
272 sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr)
276 if (at + count > vtb->vtb_size)
277 count = vtb->vtb_size - at;
278 len = vtb->vtb_size - at - count;
281 if (vtb->vtb_type == VTB_FRAMEBUFFER)
282 bcopy_io(sc_vtb_pointer(vtb, at + count),
283 sc_vtb_pointer(vtb, at),
287 bcopy((void *)sc_vtb_pointer(vtb, at + count),
288 (void *)sc_vtb_pointer(vtb, at),
292 if (vtb->vtb_type == VTB_FRAMEBUFFER)
293 fillw_io(attr | c, sc_vtb_pointer(vtb, at + len),
294 vtb->vtb_size - at - len);
297 fillw(attr | c, (void *)sc_vtb_pointer(vtb, at + len),
298 vtb->vtb_size - at - len);
302 sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr)
304 if (at + count > vtb->vtb_size)
305 count = vtb->vtb_size - at;
308 if (vtb->vtb_type == VTB_FRAMEBUFFER)
309 bcopy_io(sc_vtb_pointer(vtb, at),
310 sc_vtb_pointer(vtb, at + count),
311 (vtb->vtb_size - at - count)*sizeof(u_int16_t));
314 bcopy((void *)sc_vtb_pointer(vtb, at),
315 (void *)sc_vtb_pointer(vtb, at + count),
316 (vtb->vtb_size - at - count)*sizeof(u_int16_t));
319 if (vtb->vtb_type == VTB_FRAMEBUFFER)
320 fillw_io(attr | c, sc_vtb_pointer(vtb, at), count);
323 fillw(attr | c, (void *)sc_vtb_pointer(vtb, at), count);