Linux Audio

Check our new training course

Real-Time Linux with PREEMPT_RT training

Feb 18-20, 2025
Register
Loading...
 1/*
 2 * Copyright 2016-17 IBM Corp.
 3 *
 4 * This program is free software; you can redistribute it and/or
 5 * modify it under the terms of the GNU General Public License
 6 * as published by the Free Software Foundation; either version
 7 * 2 of the License, or (at your option) any later version.
 8 */
 9#include <asm/ppc-opcode.h>
10
11#define CR0_SHIFT	28
12#define CR0_MASK	0xF
13/*
14 * Copy/paste instructions:
15 *
16 *	copy RA,RB
17 *		Copy contents of address (RA) + effective_address(RB)
18 *		to internal copy-buffer.
19 *
20 *	paste RA,RB
21 *		Paste contents of internal copy-buffer to the address
22 *		(RA) + effective_address(RB)
23 */
24static inline int vas_copy(void *crb, int offset)
25{
26	asm volatile(PPC_COPY(%0, %1)";"
27		:
28		: "b" (offset), "b" (crb)
29		: "memory");
30
31	return 0;
32}
33
34static inline int vas_paste(void *paste_address, int offset)
35{
36	u32 cr;
37
38	cr = 0;
39	asm volatile(PPC_PASTE(%1, %2)";"
40		"mfocrf %0, 0x80;"
41		: "=r" (cr)
42		: "b" (offset), "b" (paste_address)
43		: "memory", "cr0");
44
45	return (cr >> CR0_SHIFT) & CR0_MASK;
46}