• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/arch/mips/include/asm/
1/*
2 * Copyright (C) 2005 Mips Technologies
3 * Author: Chris Dearman, chris@mips.com derived from fpu.h
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation;  either version 2 of the  License, or (at your
8 * option) any later version.
9 */
10#ifndef _ASM_DSP_H
11#define _ASM_DSP_H
12
13#include <asm/cpu.h>
14#include <asm/cpu-features.h>
15#include <asm/hazards.h>
16#include <asm/mipsregs.h>
17
18#define DSP_DEFAULT	0x00000000
19#ifdef CONFIG_CPU_MICROMIPS
20#define DSP_MASK	0x7f
21#else
22#define DSP_MASK	0x3ff
23#endif
24
25#define __enable_dsp_hazard()						\
26do {									\
27	asm("_ehb");							\
28} while (0)
29
30static inline void __init_dsp(void)
31{
32	mthi1(0);
33	mtlo1(0);
34	mthi2(0);
35	mtlo2(0);
36	mthi3(0);
37	mtlo3(0);
38	wrdsp(DSP_DEFAULT, DSP_MASK);
39}
40
41static inline void init_dsp(void)
42{
43	if (cpu_has_dsp)
44		__init_dsp();
45}
46
47#define __save_dsp(tsk)							\
48do {									\
49	tsk->thread.dsp.dspr[0] = mfhi1();				\
50	tsk->thread.dsp.dspr[1] = mflo1();				\
51	tsk->thread.dsp.dspr[2] = mfhi2();				\
52	tsk->thread.dsp.dspr[3] = mflo2();				\
53	tsk->thread.dsp.dspr[4] = mfhi3();				\
54	tsk->thread.dsp.dspr[5] = mflo3();				\
55	tsk->thread.dsp.dspcontrol = rddsp(DSP_MASK);			\
56} while (0)
57
58#define save_dsp(tsk)							\
59do {									\
60	if (cpu_has_dsp)						\
61		__save_dsp(tsk);					\
62} while (0)
63
64#define __restore_dsp(tsk)						\
65do {									\
66	mthi1(tsk->thread.dsp.dspr[0]);					\
67	mtlo1(tsk->thread.dsp.dspr[1]);					\
68	mthi2(tsk->thread.dsp.dspr[2]);					\
69	mtlo2(tsk->thread.dsp.dspr[3]);					\
70	mthi3(tsk->thread.dsp.dspr[4]);					\
71	mtlo3(tsk->thread.dsp.dspr[5]);					\
72	wrdsp(tsk->thread.dsp.dspcontrol, DSP_MASK);			\
73} while (0)
74
75#define restore_dsp(tsk)						\
76do {									\
77	if (cpu_has_dsp)						\
78		__restore_dsp(tsk);					\
79} while (0)
80
81#define __get_dsp_regs(tsk)						\
82({									\
83	if (tsk == current)						\
84		__save_dsp(current);					\
85									\
86	tsk->thread.dsp.dspr;						\
87})
88
89#endif /* _ASM_DSP_H */
90