drivers/staging/sm750fb/sm750_cursor.c

Source file repositories/reference/linux-study-clean/drivers/staging/sm750fb/sm750_cursor.c

File Facts

System
Linux kernel
Corpus path
drivers/staging/sm750fb/sm750_cursor.c
Extension
.c
Size
4074 bytes
Lines
176
Domain
Driver Families
Bucket
drivers/staging
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (mask & (0x80 >> j)) {
				if (rop == ROP_XOR)
					opr = mask ^ color;
				else
					opr = mask & color;

				/* 2 stands for forecolor and 1 for backcolor */
				data |= ((opr & (0x80 >> j)) ? 2 : 1) << (j * 2);
			}
		}
		iowrite16(data, pbuffer);

		/* assume pitch is 1,2,4,8,...*/
		if ((i + 1) % pitch == 0) {
			/* need a return */
			pstart += offset;
			pbuffer = pstart;
		} else {
			pbuffer += sizeof(u16);
		}
	}
}

void sm750_hw_cursor_set_data2(struct lynx_cursor *cursor, u16 rop,
			       const u8 *pcol, const u8 *pmsk)
{
	int i, j, count, pitch, offset;
	u8 color, mask;
	u16 data;
	void __iomem *pbuffer, *pstart;

	/*  in byte*/
	pitch = cursor->w >> 3;

	/* in byte	*/
	count = pitch * cursor->h;

	/* in byte */
	offset = cursor->max_w * 2 / 8;

	data = 0;
	pstart = cursor->vstart;
	pbuffer = pstart;

	for (i = 0; i < count; i++) {
		color = *pcol++;
		mask = *pmsk++;
		data = 0;

		for (j = 0; j < 8; j++) {
			if (mask & (1 << j))
				data |= ((color & (1 << j)) ? 1 : 2) << (j * 2);
		}
		iowrite16(data, pbuffer);

		/* assume pitch is 1,2,4,8,...*/
		if (!(i & (pitch - 1))) {
			/* need a return */
			pstart += offset;
			pbuffer = pstart;
		} else {
			pbuffer += sizeof(u16);
		}
	}
}

Annotation

Implementation Notes