File Index
Files and directories
Sign in
FILE

sysmem.h

File preview with syntax highlighting.

linux-6.19.14/drivers/video/fbdev/core/sysmem.h OBJECTIVE-C
 1/* SPDX-License-Identifier: GPL-2.0-only
 2 *
 3 *	Virtual memory framebuffer access for drawing routines
 4 *
 5 *	Copyright (C) 2025 Zsolt Kajtar (soci@c64.rulez.org)
 6 */
 7
 8/* keeps track of a bit address in framebuffer memory */
 9struct fb_address {
10	void *address;
11	int bits;
12};
13
14/* initialize the bit address pointer to the beginning of the frame buffer */
15static inline struct fb_address fb_address_init(struct fb_info *p)
16{
17	void *base = p->screen_buffer;
18	struct fb_address ptr;
19
20	ptr.address = PTR_ALIGN_DOWN(base, BITS_PER_LONG / BITS_PER_BYTE);
21	ptr.bits = (base - ptr.address) * BITS_PER_BYTE;
22	return ptr;
23}
24
25/* framebuffer write access */
26static inline void fb_write_offset(unsigned long val, int offset, const struct fb_address *dst)
27{
28	unsigned long *mem = dst->address;
29
30	mem[offset] = val;
31}
32
33/* framebuffer read access */
34static inline unsigned long fb_read_offset(int offset, const struct fb_address *src)
35{
36	unsigned long *mem = src->address;
37
38	return mem[offset];
39}
~/ Read-only file preview.