mirror of
https://github.com/kelvinlawson/atomthreads.git
synced 2026-01-11 18:33:16 +01:00
Cosmetic changes for consistency with other architecture ports.
This commit is contained in:
@@ -30,8 +30,9 @@
|
||||
#ifndef __ARM_IRQ_H
|
||||
#define __ARM_IRQ_H
|
||||
|
||||
#include <atomport.h>
|
||||
#include <arm_defines.h>
|
||||
#include "atomport.h"
|
||||
#include "atomport-private.h"
|
||||
#include "arm_defines.h"
|
||||
|
||||
typedef int (*arm_irq_handler_t) (uint32_t irq_no, pt_regs_t * regs);
|
||||
|
||||
|
||||
@@ -27,14 +27,14 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <atom.h>
|
||||
#include <atomport.h>
|
||||
#include <atomtests.h>
|
||||
#include <atomtimer.h>
|
||||
#include "atom.h"
|
||||
#include "atomport.h"
|
||||
#include "atomtests.h"
|
||||
#include "atomtimer.h"
|
||||
#include "system.h"
|
||||
#include <arm_irq.h>
|
||||
#include <arm_timer.h>
|
||||
#include <arm_uart.h>
|
||||
#include "arm_irq.h"
|
||||
#include "arm_timer.h"
|
||||
#include "arm_uart.h"
|
||||
|
||||
/* Constants */
|
||||
|
||||
@@ -169,11 +169,11 @@ int main ( void )
|
||||
IDLE_STACK_SIZE_BYTES, 0);
|
||||
if (status == ATOM_OK)
|
||||
{
|
||||
arm_irq_init();
|
||||
arm_irq_init();
|
||||
|
||||
arm_timer_init(SYSTEM_TICKS_PER_SEC);
|
||||
arm_timer_init(SYSTEM_TICKS_PER_SEC);
|
||||
|
||||
arm_uart_init();
|
||||
arm_uart_init();
|
||||
|
||||
/* Create an application thread */
|
||||
status = atomThreadCreate(&main_tcb,
|
||||
@@ -182,23 +182,24 @@ int main ( void )
|
||||
MAIN_STACK_SIZE_BYTES, 0);
|
||||
if (status == ATOM_OK)
|
||||
{
|
||||
arm_timer_enable();
|
||||
arm_timer_enable();
|
||||
|
||||
/**
|
||||
* First application thread successfully created. It is
|
||||
* now possible to start the OS. Execution will not return
|
||||
* from atomOSStart(), which will restore the context of
|
||||
* our application thread and start executing it.
|
||||
*
|
||||
* Note that interrupts are still disabled at this point.
|
||||
* They will be enabled as we restore and execute our first
|
||||
* thread in archFirstThreadRestore().
|
||||
*/
|
||||
atomOSStart();
|
||||
}
|
||||
/**
|
||||
* First application thread successfully created. It is
|
||||
* now possible to start the OS. Execution will not return
|
||||
* from atomOSStart(), which will restore the context of
|
||||
* our application thread and start executing it.
|
||||
*
|
||||
* Note that interrupts are still disabled at this point.
|
||||
* They will be enabled as we restore and execute our first
|
||||
* thread in archFirstThreadRestore().
|
||||
*/
|
||||
atomOSStart();
|
||||
}
|
||||
}
|
||||
|
||||
while (1);
|
||||
while (1)
|
||||
;
|
||||
|
||||
/* There was an error starting the OS if we reach here */
|
||||
return (0);
|
||||
@@ -227,5 +228,6 @@ static void main_thread_func (uint32_t data)
|
||||
}
|
||||
printk("Reset your board !!!!!");
|
||||
/* Test finished so just hang !!! */
|
||||
while (1);
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
54
ports/armv7a/atomport-private.h
Normal file
54
ports/armv7a/atomport-private.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Atomthreads Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. No personal names or organizations' names associated with the
|
||||
* Atomthreads project may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE ATOMTHREADS PROJECT AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __ATOMPORT_PRIVATE_H_
|
||||
#define __ATOMPORT_PRIVATE_H_
|
||||
|
||||
typedef unsigned int irq_flags_t;
|
||||
typedef unsigned int virtual_addr_t;
|
||||
typedef unsigned int virtual_size_t;
|
||||
typedef unsigned int physical_addr_t;
|
||||
typedef unsigned int physical_size_t;
|
||||
typedef unsigned int clock_freq_t;
|
||||
typedef unsigned long long jiffies_t;
|
||||
|
||||
struct pt_regs {
|
||||
uint32_t cpsr; // Current Program Status
|
||||
uint32_t gpr[13]; // R0 - R12
|
||||
uint32_t sp;
|
||||
uint32_t lr;
|
||||
uint32_t pc;
|
||||
} __attribute ((packed)) ;
|
||||
typedef struct pt_regs pt_regs_t;
|
||||
|
||||
/* Function prototypes */
|
||||
extern int archSetJump(pt_regs_t *regs, uint32_t *tmp);
|
||||
extern void archLongJump(pt_regs_t *regs);
|
||||
|
||||
#endif /* __ATOMPORT_PRIVATE_H_ */
|
||||
@@ -28,10 +28,11 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <atom.h>
|
||||
#include <atomport.h>
|
||||
#include <string.h>
|
||||
#include <arm_defines.h>
|
||||
#include "atom.h"
|
||||
#include "atomport.h"
|
||||
#include "atomport-private.h"
|
||||
#include "string.h"
|
||||
#include "arm_defines.h"
|
||||
|
||||
/**
|
||||
* This function initialises each thread's stack during creation, before the
|
||||
@@ -68,8 +69,6 @@ void archThreadContextInit (ATOM_TCB *tcb_ptr, void *stack_top,
|
||||
regs->pc = (uint32_t)entry_point;
|
||||
}
|
||||
|
||||
extern int archSetJump(pt_regs_t *regs, uint32_t *tmp);
|
||||
extern void archLongJump(pt_regs_t *regs);
|
||||
|
||||
/**
|
||||
* archFirstThreadRestore(ATOM_TCB *new_tcb)
|
||||
|
||||
@@ -59,24 +59,6 @@
|
||||
#define POINTER void *
|
||||
#define UINT32 uint32_t
|
||||
|
||||
typedef unsigned int irq_flags_t;
|
||||
typedef unsigned int virtual_addr_t;
|
||||
typedef unsigned int virtual_size_t;
|
||||
typedef unsigned int physical_addr_t;
|
||||
typedef unsigned int physical_size_t;
|
||||
typedef unsigned int clock_freq_t;
|
||||
typedef unsigned long long jiffies_t;
|
||||
|
||||
struct pt_regs {
|
||||
uint32_t cpsr; // Current Program Status
|
||||
uint32_t gpr[13]; // R0 - R12
|
||||
uint32_t sp;
|
||||
uint32_t lr;
|
||||
uint32_t pc;
|
||||
} __attribute ((packed)) ;
|
||||
typedef struct pt_regs pt_regs_t;
|
||||
|
||||
|
||||
/**
|
||||
* Critical region protection: this should disable interrupts
|
||||
* to protect OS data structures during modification. It must
|
||||
@@ -84,6 +66,7 @@ typedef struct pt_regs pt_regs_t;
|
||||
* be re-enabled when the outer CRITICAL_END() is reached.
|
||||
*/
|
||||
#include "arm_irq.h"
|
||||
#include "atomport-private.h"
|
||||
#define CRITICAL_STORE irq_flags_t status_flags
|
||||
#define CRITICAL_START() status_flags = arm_irq_save();
|
||||
#define CRITICAL_END() arm_irq_restore(status_flags);
|
||||
|
||||
Reference in New Issue
Block a user