Commit c3fd9424 authored by Colin González's avatar Colin González
Browse files

Trying different disable interrupt

parent 0e949aab
......@@ -15,7 +15,7 @@ BOARD = at91sam9g20-ek
# TRACE_LEVEL_ERROR 2
# TRACE_LEVEL_FATAL 1
# TRACE_LEVEL_NO_TRACE 0
TRACE_LEVEL = 5
# TRACE_LEVEL = 5
AT91LIB = src/at91lib
FREERTOS = src/freertos
......@@ -61,11 +61,15 @@ INCLUDES += -I$(FREERTOS)/include
INCLUDES += -I$(FREERTOS)
INCLUDES += -Isrc/
OPTIM = -O3
CFLAGS = -Wall -mlong-calls -ffunction-sections
#CFLAGS += -mthumb-interwork -D THUMB_INTERWORK
CFLAGS += -g $(INCLUDES) -D$(CHIP) -DTRACE_LEVE=$(TRACE_LEVEL)
ASFLAGS = -Wall -g $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
LDFLAGS = -g -nostartfiles -Wl,--gc-sections
CFLAGS += -fomit-frame-pointer -fno-strict-aliasing -fno-dwarf2-cfi-asm
CFLAGS += -mthumb-interwork -D THUMB_INTERWORK
CFLAGS += -g $(OPTIM) $(INCLUDES) -D$(CHIP)
# -DTRACE_LEVE=$(TRACE_LEVEL)
ASFLAGS = -Wall -g $(OPTIM) $(INCLUDES) -D$(CHIP) -D__ASSEMBLY__
LDFLAGS = -mthumb -g $(OPTIM) -nostartfiles -Wl,--gc-sections
#-------------------------------------------------------------------------------
# FILES
......@@ -156,7 +160,7 @@ $$(ARM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
$(CC) $(CFLAGS) -D$(1) -c -o $$@ $$<
$$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
$(CC) $(CFLAGS) -D$(1) -c -o $$@ $$<
$(CC) $(CFLAGS) -mthumb -D$(1) -c -o $$@ $$<
$$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
$(CC) $(ASFLAGS) -D$(1) -c -o $$@ $$<
......
#! /bin/sh
sam-ba /dev/ttyACM0 at91sam9g20-ek src/flashing/nand-flash.tcl > flash.log 2>&1
sam-ba /dev/ttyACM0 at91sam9g20-ek src/flashing/sdram.tcl > flash.log 2>&1
true
......@@ -30,6 +30,7 @@ void vPortTickISR( void );
void vPortTickISR( void )
{
portSAVE_CONTEXT();
volatile uint32_t ulDummy;
volatile uint32_t status;
// Read the PIT status register
......@@ -44,7 +45,7 @@ void vPortTickISR( void )
//Returns the number of occurrences of periodic intervals since the last read of PIT_PIVR.
ulDummy += (PIT_GetPIVR() >> 20);
}
portRESTORE_CONTEXT();
/* Increment the tick count - which may wake some tasks but as the
preemptive scheduler is not being used any woken task is not given
processor time no matter what its priority. */
......@@ -67,9 +68,11 @@ void vPortDisableInterruptsFromThumb( void )
{
__asm volatile (
"STMDB SP!, {R0} \n\t" /* Push R0. */
"MRS R0, CPSR \n\t" /* Get CPSR. */
"ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */
"MSR CPSR, R0 \n\t" /* Write back modified value. */
"MRS R0, CPSR \n\t" /* Get CPSR. */
"ORR R0, R0, #0x80\n"
"MSR CPSR, R0\n"
"ORR R0, R0, #0x40\n"
"MSR CPSR, R0 \n\t"
"LDMIA SP!, {R0} \n\t" /* Pop R0. */
"BX R14" ); /* Return back to thumb. */
}
......@@ -95,12 +98,16 @@ in a variable, which is then saved as part of the stack context. */
void vPortEnterCritical( void )
{
/* Disable interrupts as per portDISABLE_INTERRUPTS(); */
__asm volatile (
"STMDB SP!, {R0} \n\t" /* Push R0. */
"MRS R0, CPSR \n\t" /* Get CPSR. */
"ORR R0, R0, #0xC0 \n\t" /* Disable IRQ, FIQ. */
"MSR CPSR, R0 \n\t" /* Write back modified value. */
"LDMIA SP!, {R0}" ); /* Pop R0. */
__asm volatile (
"STMDB SP!, {R0} \n\t" /* Push R0. */
"MRS R0, CPSR \n\t" /* Get CPSR. */
"ORR R0, R0, #0x80\n"
"MSR CPSR, R0\n"
"ORR R0, R0, #0x40\n"
"MSR CPSR, R0 \n\t"
"LDMIA SP!, {R0} \n\t" /* Pop R0. */
"BX R14" );
/* Now interrupts are disabled ulCriticalNesting can be accessed
directly. Increment ulCriticalNesting to keep a count of how many times
......
......@@ -150,11 +150,14 @@ typedef unsigned long UBaseType_t;
#define portDISABLE_INTERRUPTS()\
__asm volatile (\
"STMDB SP!, {R0}\n"\
"MRS R0, CPSR\n"\
"ORR R0, R0, #0xC0\n"\
"MSR CPSR, R0\n"\
"LDMIA SP!, {R0}\n")
"STMDB SP!, {R0}\n"\
"MRS R0, CPSR\n"\
"ORR R0, R0, #0x80\n"\
"MSR CPSR, R0\n"\
"ORR R0, R0, #0x40\n"\
"MSR CPSR, R0\n"
"LDMIA SP!, {R0}\n"\
"BX R14" )
#define portENABLE_INTERRUPTS()\
__asm volatile (\
......
#include <board.h>
#include <pio/pio.h>
#include <pio/pio_it.h>
#if defined(AT91C_BASE_PITC)
#include <pit/pit.h>
#endif
#include <irq/irq.h>
#include <tc/tc.h>
#include <utility/led.h>
#include <utility/trace.h>
#include <stdio.h>
......@@ -85,9 +78,15 @@ void ConfigureLeds (void) {
LED_Configure(1);
}
int main () {
static void prvSetupHardware (void) {
AT91C_BASE_AIC->AIC_EOICR = 0;
ConfigureLeds();
}
int main () {
prvSetupHardware();
LED_Set(1);
/* TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK); */
/* printf("-- Template project %s --\n\r", SOFTPACK_VERSION); */
/* printf("-- %s\n\r", BOARD_NAME); */
......@@ -96,9 +95,8 @@ int main () {
/* int x = many_test(); */
/* printf("--Testouch %d \n\r", x); */
xTaskCreate(task1, "LED_0", 128, NULL, 0, NULL);
xTaskCreate(task2, "LED_1", 128, NULL, 0, NULL);
/* xTaskCreate(task1, "LED_0", 128, NULL, 0, NULL); */
/* xTaskCreate(task2, "LED_1", 128, NULL, 0, NULL); */
vTaskStartScheduler();
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment