/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */

#include <ios.h>
#include <arm.h>
#include <asm.h>
#include <swi.h>
#include <hw.h>


/*
 * u32 __armDisableInt(void)
 *
 * Disable IRQ and FIQ, return their previous status
 *
 */
BEGIN_PROC(__armDisableInt)
        mrs     r1, cpsr
        and     r0, r1, #ARM_IRQ|ARM_FIQ
        orr     r1, r1, #ARM_IRQ|ARM_FIQ
        msr     cpsr_c, r1
        bx      lr
END_PROC(__armDisableInt)

/*
 * u32 __armRestoreInt(u32 mask)
 *
 * Set IRQ and FIQ to the values in mask
 *
 */
BEGIN_PROC(__armRestoreInt)
        mrs     r1, cpsr
        bic     r1, r1, #ARM_IRQ|ARM_FIQ
        orr     r1, r1, r0
        msr     cpsr_c, r1
        bx      lr
END_PROC(__armRestoreInt)

