/************************************************************************/
/* CQBBEL GNU CC Common Control Software / (C) Toshio MURAI 2011, 2012	*/
/*      This is Free Software;   You can redistribute this software     */
/*      and/or modify it under the terms of the GNU General Public      */
/*      License version 3, or (at your option) any later version.       */
/************************************************************************/

	.text
#
#	Power On Reset Start up Routine
#
	.globl start
start:
	mov	r1, #0xD3	/* #(CPSR_MD_SVC|CPSR_IRQ|CPSR_FIQ)*/
	msr	cpsr_all,  r1	/* Set Supervisor mode	*/
	ldr	r3,  =systemStack	/* Supervisor Task Context stack */
	mov	sp,  r3

	mov	r1, #0xD2	/*#(CPSR_MD_IRQ|CPSR_IRQ|CPSR_FIQ)*/
	msr	cpsr_all,  r1	/* Set Interrupt mode	*/
	ldr	r3,  =interruptStack	/* Interrupt Task Context stack */
	mov	sp,  r3

	mov	r1, #0xD3	/*#(CPSR_MD_SVC|CPSR_IRQ|CPSR_FIQ)*/
	msr	cpsr_all,  r1

	bl	initializeMemory
	bl	main
exit:				
	b	exit		

#
#	Interrupt disable
#
.global	disableInterrupt
disableInterrupt:
	mrs	r0, cpsr_all
	orr	r0, r0 ,#0x080	/*#CPSR_IRQ*/
	msr	cpsr_all, r0
	mov	pc, lr		 /*  return */
#
#	Interrupt enable
#
.global	enableInterrupt
enableInterrupt:
	mrs	r0, cpsr_all
	and	r0, r0 ,#~0x80	/*#~CPSR_IRQ*/
	msr	cpsr_all, r0
	mov	pc, lr		 /*  return */

#
#	Interrupt C program wrapper
#
