These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!

Committer:
frank26080115
Date:
Sun Mar 20 05:38:56 2011 +0000
Revision:
0:bf7b9fba3924

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
frank26080115 0:bf7b9fba3924 1 /***********************************************************************
frank26080115 0:bf7b9fba3924 2 * $Id:: libnosys_gnu.c 1388 2008-12-01 19:20:06Z pdurgesh $
frank26080115 0:bf7b9fba3924 3 *
frank26080115 0:bf7b9fba3924 4 * Project: Linosys function for GNU c compiler
frank26080115 0:bf7b9fba3924 5 *
frank26080115 0:bf7b9fba3924 6 * Description:
frank26080115 0:bf7b9fba3924 7 * Definitions for OS interface, stub function required by newlibc
frank26080115 0:bf7b9fba3924 8 * used by Codesourcery GNU compiler.
frank26080115 0:bf7b9fba3924 9 *
frank26080115 0:bf7b9fba3924 10 ***********************************************************************
frank26080115 0:bf7b9fba3924 11 * Software that is described herein is for illustrative purposes only
frank26080115 0:bf7b9fba3924 12 * which provides customers with programming information regarding the
frank26080115 0:bf7b9fba3924 13 * products. This software is supplied "AS IS" without any warranties.
frank26080115 0:bf7b9fba3924 14 * NXP Semiconductors assumes no responsibility or liability for the
frank26080115 0:bf7b9fba3924 15 * use of the software, conveys no license or title under any patent,
frank26080115 0:bf7b9fba3924 16 * copyright, or mask work right to the product. NXP Semiconductors
frank26080115 0:bf7b9fba3924 17 * reserves the right to make changes in the software without
frank26080115 0:bf7b9fba3924 18 * notification. NXP Semiconductors also make no representation or
frank26080115 0:bf7b9fba3924 19 * warranty that such application will be suitable for the specified
frank26080115 0:bf7b9fba3924 20 * use without further testing or modification.
frank26080115 0:bf7b9fba3924 21 **********************************************************************/
frank26080115 0:bf7b9fba3924 22 #if defined(__GNUC__)
frank26080115 0:bf7b9fba3924 23
frank26080115 0:bf7b9fba3924 24 #include "lpc_types.h"
frank26080115 0:bf7b9fba3924 25 #include <errno.h>
frank26080115 0:bf7b9fba3924 26 #include <sys/times.h>
frank26080115 0:bf7b9fba3924 27 #include <sys/stat.h>
frank26080115 0:bf7b9fba3924 28
frank26080115 0:bf7b9fba3924 29 /* errno definition */
frank26080115 0:bf7b9fba3924 30 #undef errno
frank26080115 0:bf7b9fba3924 31 extern int errno;
frank26080115 0:bf7b9fba3924 32
frank26080115 0:bf7b9fba3924 33 char *__env[1] = { 0 };
frank26080115 0:bf7b9fba3924 34 char **environ = __env;
frank26080115 0:bf7b9fba3924 35
frank26080115 0:bf7b9fba3924 36 int _close(int file)
frank26080115 0:bf7b9fba3924 37 {
frank26080115 0:bf7b9fba3924 38 return -1;
frank26080115 0:bf7b9fba3924 39 }
frank26080115 0:bf7b9fba3924 40
frank26080115 0:bf7b9fba3924 41 int _execve(char *name, char **argv, char **env)
frank26080115 0:bf7b9fba3924 42 {
frank26080115 0:bf7b9fba3924 43 errno = ENOMEM;
frank26080115 0:bf7b9fba3924 44 return -1;
frank26080115 0:bf7b9fba3924 45 }
frank26080115 0:bf7b9fba3924 46 int _exit()
frank26080115 0:bf7b9fba3924 47 {
frank26080115 0:bf7b9fba3924 48 return 0;
frank26080115 0:bf7b9fba3924 49 }
frank26080115 0:bf7b9fba3924 50
frank26080115 0:bf7b9fba3924 51 int _fork()
frank26080115 0:bf7b9fba3924 52 {
frank26080115 0:bf7b9fba3924 53 errno = EAGAIN;
frank26080115 0:bf7b9fba3924 54 return -1;
frank26080115 0:bf7b9fba3924 55 }
frank26080115 0:bf7b9fba3924 56
frank26080115 0:bf7b9fba3924 57 int _fstat(int file, struct stat *st)
frank26080115 0:bf7b9fba3924 58 {
frank26080115 0:bf7b9fba3924 59 st->st_mode = S_IFCHR;
frank26080115 0:bf7b9fba3924 60 return 0;
frank26080115 0:bf7b9fba3924 61 }
frank26080115 0:bf7b9fba3924 62
frank26080115 0:bf7b9fba3924 63 int _getpid()
frank26080115 0:bf7b9fba3924 64 {
frank26080115 0:bf7b9fba3924 65 return 1;
frank26080115 0:bf7b9fba3924 66 }
frank26080115 0:bf7b9fba3924 67
frank26080115 0:bf7b9fba3924 68 int _kill(int pid, int sig)
frank26080115 0:bf7b9fba3924 69 {
frank26080115 0:bf7b9fba3924 70 errno = EINVAL;
frank26080115 0:bf7b9fba3924 71 return(-1);
frank26080115 0:bf7b9fba3924 72 }
frank26080115 0:bf7b9fba3924 73
frank26080115 0:bf7b9fba3924 74 int isatty(int fildes)
frank26080115 0:bf7b9fba3924 75 {
frank26080115 0:bf7b9fba3924 76 return 1;
frank26080115 0:bf7b9fba3924 77 }
frank26080115 0:bf7b9fba3924 78 int _isatty(int fildes)
frank26080115 0:bf7b9fba3924 79 {
frank26080115 0:bf7b9fba3924 80 return 1;
frank26080115 0:bf7b9fba3924 81 }
frank26080115 0:bf7b9fba3924 82
frank26080115 0:bf7b9fba3924 83 int _link(char *old, char *new)
frank26080115 0:bf7b9fba3924 84 {
frank26080115 0:bf7b9fba3924 85 errno = EMLINK;
frank26080115 0:bf7b9fba3924 86 return -1;
frank26080115 0:bf7b9fba3924 87 }
frank26080115 0:bf7b9fba3924 88
frank26080115 0:bf7b9fba3924 89 int _lseek(int file, int ptr, int dir)
frank26080115 0:bf7b9fba3924 90 {
frank26080115 0:bf7b9fba3924 91 return 0;
frank26080115 0:bf7b9fba3924 92 }
frank26080115 0:bf7b9fba3924 93
frank26080115 0:bf7b9fba3924 94 int _open(const char *name, int flags, int mode)
frank26080115 0:bf7b9fba3924 95 {
frank26080115 0:bf7b9fba3924 96 return -1;
frank26080115 0:bf7b9fba3924 97 }
frank26080115 0:bf7b9fba3924 98
frank26080115 0:bf7b9fba3924 99 int _read(int file, char *ptr, int len)
frank26080115 0:bf7b9fba3924 100 {
frank26080115 0:bf7b9fba3924 101 return 0;
frank26080115 0:bf7b9fba3924 102 }
frank26080115 0:bf7b9fba3924 103
frank26080115 0:bf7b9fba3924 104 caddr_t _sbrk(int incr)
frank26080115 0:bf7b9fba3924 105 {
frank26080115 0:bf7b9fba3924 106 extern char estack; /* Defined by the linker */
frank26080115 0:bf7b9fba3924 107 static char *heap_end;
frank26080115 0:bf7b9fba3924 108 char *prev_heap_end;
frank26080115 0:bf7b9fba3924 109
frank26080115 0:bf7b9fba3924 110 if (heap_end == 0)
frank26080115 0:bf7b9fba3924 111 {
frank26080115 0:bf7b9fba3924 112 heap_end = &estack;
frank26080115 0:bf7b9fba3924 113 /* give 16KB area for stacks and use the rest of memory for heap*/
frank26080115 0:bf7b9fba3924 114 heap_end += 0x4000;
frank26080115 0:bf7b9fba3924 115 }
frank26080115 0:bf7b9fba3924 116 prev_heap_end = heap_end;
frank26080115 0:bf7b9fba3924 117
frank26080115 0:bf7b9fba3924 118 heap_end += incr;
frank26080115 0:bf7b9fba3924 119 return (caddr_t) prev_heap_end;
frank26080115 0:bf7b9fba3924 120 }
frank26080115 0:bf7b9fba3924 121
frank26080115 0:bf7b9fba3924 122 int _stat(char *file, struct stat *st)
frank26080115 0:bf7b9fba3924 123 {
frank26080115 0:bf7b9fba3924 124 st->st_mode = S_IFCHR;
frank26080115 0:bf7b9fba3924 125 return 0;
frank26080115 0:bf7b9fba3924 126 }
frank26080115 0:bf7b9fba3924 127 int _times(struct tms *buf)
frank26080115 0:bf7b9fba3924 128 {
frank26080115 0:bf7b9fba3924 129 return -1;
frank26080115 0:bf7b9fba3924 130 }
frank26080115 0:bf7b9fba3924 131
frank26080115 0:bf7b9fba3924 132 int _unlink(char *name)
frank26080115 0:bf7b9fba3924 133 {
frank26080115 0:bf7b9fba3924 134 errno = ENOENT;
frank26080115 0:bf7b9fba3924 135 return -1;
frank26080115 0:bf7b9fba3924 136 }
frank26080115 0:bf7b9fba3924 137
frank26080115 0:bf7b9fba3924 138 int _wait(int *status)
frank26080115 0:bf7b9fba3924 139 {
frank26080115 0:bf7b9fba3924 140 errno = ECHILD;
frank26080115 0:bf7b9fba3924 141 return -1;
frank26080115 0:bf7b9fba3924 142 }
frank26080115 0:bf7b9fba3924 143
frank26080115 0:bf7b9fba3924 144 int _write(int file, char *ptr, int len)
frank26080115 0:bf7b9fba3924 145 {
frank26080115 0:bf7b9fba3924 146 return 0;
frank26080115 0:bf7b9fba3924 147 }
frank26080115 0:bf7b9fba3924 148
frank26080115 0:bf7b9fba3924 149 #endif /*__GNUC__*/