Minor changes for consistency with other ports.

This commit is contained in:
Kelvin Lawson
2011-07-19 22:51:54 +01:00
parent 0ec7a4629e
commit 1ca423d8f6
4 changed files with 41 additions and 28 deletions

View File

@@ -33,8 +33,10 @@
/* Include Atomthreads kernel API */
#include "atom.h"
/* Prerequisite include for ATOMLOG() macro (via printf) */
#include "printk.h"
/* Logger macro for viewing test results */
/* FIXME: Add uart out routine once uart is supported */
#define ATOMLOG printk
#define _STR

View File

@@ -31,17 +31,33 @@
#ifndef __ATOM_PORT_H
#define __ATOM_PORT_H
/* Required number of system ticks per second (normally 100 for 10ms tick) */
#define SYSTEM_TICKS_PER_SEC 1000
typedef signed int int32_t;
typedef signed short int16_t;
typedef signed char int8_t;
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
typedef long long int64_t;
typedef unsigned long size_t;
/**
* Definition of NULL. stddef.h not available on this platform.
*/
#define NULL ((void *)(0))
/* Size of each stack entry / stack alignment size (32 bits on ARMv7A) */
#define STACK_ALIGN_SIZE sizeof(uint32_t)
/**
* Architecture-specific types.
* Provide stdint.h style types.
*/
#define uint8_t unsigned char
#define uint16_t unsigned short
#define uint32_t unsigned int
#define uint64_t unsigned long long
#define int8_t signed char
#define int16_t signed short
#define int32_t signed int
#define int64_t long long
#define size_t unsigned long
#define POINTER void *
#define UINT32 uint32_t
typedef unsigned int irq_flags_t;
typedef unsigned int virtual_addr_t;
@@ -51,17 +67,6 @@ typedef unsigned int physical_size_t;
typedef unsigned int clock_freq_t;
typedef unsigned long long jiffies_t;
#define UINT32 uint32_t
#define STACK_ALIGN_SIZE sizeof(uint32_t)
#define NULL ((void *)(0))
/**
* Architecture-specific types.
* Most of these are available from stdint.h on this platform, which is
* included above.
*/
#define POINTER void *
struct pt_regs {
uint32_t cpsr; // Current Program Status
uint32_t gpr[13]; // R0 - R12
@@ -71,10 +76,14 @@ struct pt_regs {
} __attribute ((packed)) ;
typedef struct pt_regs pt_regs_t;
#include <printk.h>
#include <arm_irq.h>
/* Critical region protection */
/**
* Critical region protection: this should disable interrupts
* to protect OS data structures during modification. It must
* allow nested calls, which means that interrupts should only
* be re-enabled when the outer CRITICAL_END() is reached.
*/
#include "arm_irq.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);
@@ -82,4 +91,5 @@ typedef struct pt_regs pt_regs_t;
/* Uncomment to enable stack-checking */
/* #define ATOM_STACK_CHECKING */
#endif /* __ATOM_PORT_H */

View File

@@ -28,10 +28,11 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <system.h>
#include <atomport.h>
#include <stdarg.h>
#include <arm_uart.h>
#include "system.h"
#include "atomport.h"
#include "printk.h"
#include "arm_uart.h"
static int8_t buf[2048];

View File

@@ -5,8 +5,8 @@
*/
#include <stdarg.h>
#include <system.h>
#include <atomport.h>
#include "system.h"
#include "atomport.h"
/* we use this so that we can do without the ctype library */
#define is_digit(c) ((c) >= '0' && (c) <= '9')