162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This header file contains assembly-language definitions (assembly 362306a36Sopenharmony_ci * macros, etc.) for this specific Xtensa processor's TIE extensions 462306a36Sopenharmony_ci * and options. It is customized to this Xtensa processor configuration. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 762306a36Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 862306a36Sopenharmony_ci * for more details. 962306a36Sopenharmony_ci * 1062306a36Sopenharmony_ci * Copyright (C) 1999-2007 Tensilica Inc. 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#ifndef _XTENSA_CORE_TIE_ASM_H 1462306a36Sopenharmony_ci#define _XTENSA_CORE_TIE_ASM_H 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* Selection parameter values for save-area save/restore macros: */ 1762306a36Sopenharmony_ci/* Option vs. TIE: */ 1862306a36Sopenharmony_ci#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */ 1962306a36Sopenharmony_ci#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */ 2062306a36Sopenharmony_ci/* Whether used automatically by compiler: */ 2162306a36Sopenharmony_ci#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */ 2262306a36Sopenharmony_ci#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */ 2362306a36Sopenharmony_ci/* ABI handling across function calls: */ 2462306a36Sopenharmony_ci#define XTHAL_SAS_CALR 0x0010 /* caller-saved */ 2562306a36Sopenharmony_ci#define XTHAL_SAS_CALE 0x0020 /* callee-saved */ 2662306a36Sopenharmony_ci#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */ 2762306a36Sopenharmony_ci/* Misc */ 2862306a36Sopenharmony_ci#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */ 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci/* Macro to save all non-coprocessor (extra) custom TIE and optional state 3362306a36Sopenharmony_ci * (not including zero-overhead loop registers). 3462306a36Sopenharmony_ci * Save area ptr (clobbered): ptr (1 byte aligned) 3562306a36Sopenharmony_ci * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed) 3662306a36Sopenharmony_ci */ 3762306a36Sopenharmony_ci .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL 3862306a36Sopenharmony_ci xchal_sa_start \continue, \ofs 3962306a36Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~\select 4062306a36Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-8, 4, 4 4162306a36Sopenharmony_ci rsr \at1, ACCLO // MAC16 accumulator 4262306a36Sopenharmony_ci rsr \at2, ACCHI 4362306a36Sopenharmony_ci s32i \at1, \ptr, .Lxchal_ofs_ + 0 4462306a36Sopenharmony_ci s32i \at2, \ptr, .Lxchal_ofs_ + 4 4562306a36Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 4662306a36Sopenharmony_ci .endif 4762306a36Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select 4862306a36Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-16, 4, 4 4962306a36Sopenharmony_ci rsr \at1, M0 // MAC16 registers 5062306a36Sopenharmony_ci rsr \at2, M1 5162306a36Sopenharmony_ci s32i \at1, \ptr, .Lxchal_ofs_ + 0 5262306a36Sopenharmony_ci s32i \at2, \ptr, .Lxchal_ofs_ + 4 5362306a36Sopenharmony_ci rsr \at1, M2 5462306a36Sopenharmony_ci rsr \at2, M3 5562306a36Sopenharmony_ci s32i \at1, \ptr, .Lxchal_ofs_ + 8 5662306a36Sopenharmony_ci s32i \at2, \ptr, .Lxchal_ofs_ + 12 5762306a36Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 16 5862306a36Sopenharmony_ci .endif 5962306a36Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select 6062306a36Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-4, 4, 4 6162306a36Sopenharmony_ci rsr \at1, SCOMPARE1 // conditional store option 6262306a36Sopenharmony_ci s32i \at1, \ptr, .Lxchal_ofs_ + 0 6362306a36Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 4 6462306a36Sopenharmony_ci .endif 6562306a36Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select 6662306a36Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-4, 4, 4 6762306a36Sopenharmony_ci rur \at1, THREADPTR // threadptr option 6862306a36Sopenharmony_ci s32i \at1, \ptr, .Lxchal_ofs_ + 0 6962306a36Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 4 7062306a36Sopenharmony_ci .endif 7162306a36Sopenharmony_ci .endm // xchal_ncp_store 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci/* Macro to save all non-coprocessor (extra) custom TIE and optional state 7462306a36Sopenharmony_ci * (not including zero-overhead loop registers). 7562306a36Sopenharmony_ci * Save area ptr (clobbered): ptr (1 byte aligned) 7662306a36Sopenharmony_ci * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed) 7762306a36Sopenharmony_ci */ 7862306a36Sopenharmony_ci .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL 7962306a36Sopenharmony_ci xchal_sa_start \continue, \ofs 8062306a36Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~\select 8162306a36Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-8, 4, 4 8262306a36Sopenharmony_ci l32i \at1, \ptr, .Lxchal_ofs_ + 0 8362306a36Sopenharmony_ci l32i \at2, \ptr, .Lxchal_ofs_ + 4 8462306a36Sopenharmony_ci wsr \at1, ACCLO // MAC16 accumulator 8562306a36Sopenharmony_ci wsr \at2, ACCHI 8662306a36Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 8 8762306a36Sopenharmony_ci .endif 8862306a36Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select 8962306a36Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-16, 4, 4 9062306a36Sopenharmony_ci l32i \at1, \ptr, .Lxchal_ofs_ + 0 9162306a36Sopenharmony_ci l32i \at2, \ptr, .Lxchal_ofs_ + 4 9262306a36Sopenharmony_ci wsr \at1, M0 // MAC16 registers 9362306a36Sopenharmony_ci wsr \at2, M1 9462306a36Sopenharmony_ci l32i \at1, \ptr, .Lxchal_ofs_ + 8 9562306a36Sopenharmony_ci l32i \at2, \ptr, .Lxchal_ofs_ + 12 9662306a36Sopenharmony_ci wsr \at1, M2 9762306a36Sopenharmony_ci wsr \at2, M3 9862306a36Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 16 9962306a36Sopenharmony_ci .endif 10062306a36Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~\select 10162306a36Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-4, 4, 4 10262306a36Sopenharmony_ci l32i \at1, \ptr, .Lxchal_ofs_ + 0 10362306a36Sopenharmony_ci wsr \at1, SCOMPARE1 // conditional store option 10462306a36Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 4 10562306a36Sopenharmony_ci .endif 10662306a36Sopenharmony_ci .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select 10762306a36Sopenharmony_ci xchal_sa_align \ptr, 0, 1024-4, 4, 4 10862306a36Sopenharmony_ci l32i \at1, \ptr, .Lxchal_ofs_ + 0 10962306a36Sopenharmony_ci wur \at1, THREADPTR // threadptr option 11062306a36Sopenharmony_ci .set .Lxchal_ofs_, .Lxchal_ofs_ + 4 11162306a36Sopenharmony_ci .endif 11262306a36Sopenharmony_ci .endm // xchal_ncp_load 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci 11662306a36Sopenharmony_ci#define XCHAL_NCP_NUM_ATMPS 2 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci#define XCHAL_SA_NUM_ATMPS 2 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci#endif /*_XTENSA_CORE_TIE_ASM_H*/ 12262306a36Sopenharmony_ci 123