/* Copyright 2000 Pace Micro Technology plc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *  AsmUtils (modulefp.h)
 *
 * Copyright (C) Pace Micro Technology plc. 1999
 *
 */
#ifndef asmutils_modulefp_h_inluded
#define asmutils_modulefp_h_inluded

#ifdef __cplusplus
extern "C" {
#endif

/*
 * This function should be called before doing any floating point operations
 * in a module. It cannot be called from interrupt routines. Note that if
 * the caller was on the verge of generating a floating point exception (e.g.
 * divide by zero), then the exception will be generated by your own
 * floating point code instead. Since raising your own exceptions would be
 * very ugly, all exceptions are disabled in the FPSR setup.
 *
 * Remember that the routine which calls this function may not then start
 * using floating point code itself, it must invoke another APCS routine
 * to do that. You must have a 32-bit FPEmulator module (there is no 'Z' in
 * the help string).
 */

typedef struct modulefp_buf
{
  unsigned int fpsr;
  unsigned int regs[12];

} modulefp_buf;

extern void modulefp_enable(modulefp_buf * regs);

/*
 * Once finished with floatng point code, you MUST call this function to
 * restore the previous state of the system.
 */

extern void modulefp_disable(modulefp_buf * regs);

#ifdef __cplusplus
}
#endif
#endif
