EE445M RTOS
Taken at the University of Texas Spring 2015
nexus.c File Reference
#include "nexus.h"
Include dependency graph for nexus.c:

Go to the source code of this file.

Functions

void * memset (void *b, int c, int len)
 
uint32_t ustrlen (const char *s)
 
void * memcpy (void *str1, const void *str2, long n)
 
int strcmp (const char *s1, const char *s2)
 
int ustrncmp (const char *s1, const char *s2, uint32_t n)
 
void ustrcpy (char *dest, const char *source)
 

Function Documentation

void* memcpy ( void *  ,
const void *  ,
long   
)

A duplicate of the c standard memcpy function.

Definition at line 25 of file nexus.c.

Referenced by shell_set_ps1().

25  {
26 
27  long i = 0;
28  uint8_t *dest8 = (uint8_t*)str1;
29  uint8_t *source8 = (uint8_t*)str2;
30  for (i=0; i<n; ++i) {
31  dest8[i] = source8[i];
32  }
33 }

Here is the caller graph for this function:

void* memset ( void *  ,
int  ,
int   
)

A duplicate of the c standard memset function.

Definition at line 4 of file nexus.c.

Referenced by shell_clear_shell_buffer(), and system_register_command().

4  {
5 
6  int i;
7  unsigned char *p = b;
8  i = 0;
9  while(len > 0) {
10  *p = c;
11  ++p;
12  --len;
13  }
14  return b;
15 }

Here is the caller graph for this function:

int strcmp ( const char *  ,
const char *   
)

A duplicate of the c standard strcmp function.

Definition at line 35 of file nexus.c.

References ustrncmp().

Referenced by _system_command_from_name().

35  {
36 
37  return(ustrncmp(s1, s2, (uint32_t)-1));
38 }
int ustrncmp(const char *s1, const char *s2, uint32_t n)
Definition: nexus.c:40

Here is the call graph for this function:

Here is the caller graph for this function:

void ustrcpy ( char *  ,
const char *   
)

A duplicate of the c standard strcpy function.

Definition at line 69 of file nexus.c.

Referenced by system_register_command().

69  {
70  uint32_t i = 0;
71  while (1) {
72  dest[i] = source[i];
73  if (dest[i++] == '\0') { break; }
74  }
75 }

Here is the caller graph for this function:

uint32_t ustrlen ( const char *  s)

A duplicate of the c standard strlen function.

Definition at line 17 of file nexus.c.

Referenced by shell_set_ps1(), and uart_send_string_().

17  {
18  uint32_t len = 0;
19  while(s[len]) { ++len; }
20  return(len);
21 }

Here is the caller graph for this function:

int ustrncmp ( const char *  ,
const char *  ,
uint32_t   
)

A duplicate of the c standard strncmp function.

Definition at line 40 of file nexus.c.

Referenced by strcmp().

40  {
41 
42  /* Loop while there are more characters. */
43  while(n) {
44  /* If we reached a NULL in both strings, they must be equal so
45  * we end the comparison and return 0 */
46  if(!*s1 && !*s2) {
47  return(0);
48  }
49 
50  /* Compare the two characters and, if different, return the
51  * relevant return code. */
52  if(*s2 < *s1) {
53  return(1);
54  }
55  if(*s1 < *s2) {
56  return(-1);
57  }
58 
59  /* Move on to the next character. */
60  s1++;
61  s2++;
62  n--;
63  }
64  /* If we fall out, the strings must be equal for at least the
65  * first n characters so return 0 to indicate this. */
66  return 0;
67 }

Here is the caller graph for this function: