source: rtems/bsps/powerpc/motorola_powerpc/bootloader/lib.c @ 03e1d837

5
Last change on this file since 03e1d837 was 03e1d837, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 24, 2018 at 5:06:36 AM

bsps/powerpc: Move bootloader to bsps

This bootloader is only used by the motorola_powerpc BSP.

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/* lib.c
2 *
3 *  This file contains the implementation of functions that are unresolved
4 *  in the bootloader.  Unfortunately it  shall not use any object code
5 *  from newlib or rtems  because they are not compiled with the right option!!!
6 *
7 *  You've been warned!!!.
8 */
9
10/*
11 *  Copyright (C) 1998, 1999 valette@crf.canon.fr
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18
19/*
20 * Provide our own prototypes to avoid warnings and risk getting inlined
21 * conflicts from the normal header files.
22 */
23void* memset(void *p, int c, unsigned int n);
24void* memcpy(void *dst, const void * src, unsigned int n);
25char* strcat(char * dest, const char * src);
26int strlen(const char* string);
27
28void* memset(void *p, int c, unsigned int n)
29{
30  char *q =p;
31  for(; n>0; --n) *q++=c;
32  return p;
33}
34
35void* memcpy(void *dst, const void * src, unsigned int n)
36{
37  unsigned char *d=dst;
38  const unsigned char *s=src;
39
40  while(n-- > 0) *d++=*s++;
41  return dst;
42}
43
44char* strcat(char * dest, const char * src)
45{
46  char *tmp = dest;
47
48  while (*dest)
49    dest++;
50  while ((*dest++ = *src++) != '\0')
51    ;
52  return tmp;
53}
54
55int strlen(const char* string)
56{
57  register int i = 0;
58
59  while (string[i] != '\0')
60    ++i;
61  return i;
62}
Note: See TracBrowser for help on using the repository browser.