/SPARTAN/trunk/src/lib/memstr.c |
---|
29,6 → 29,18 |
#include <memstr.h> |
#include <arch/types.h> |
/** Copy block of memory |
* |
* Copy cnt bytes from src address to dst address. |
* The copying is done byte-by-byte. The source |
* and destination memory areas cannot overlap. |
* |
* @param src Origin address to copy from. |
* @param dst Origin address to copy to. |
* @param cnt Number of bytes to copy. |
* |
*/ |
void _memcopy(__address src, __address dst, int cnt) |
{ |
int i; |
37,6 → 49,17 |
*((__u8 *) (dst + i)) = *((__u8 *) (src + i)); |
} |
/** Fill block of memory |
* |
* Fill cnt bytes at dst address with the value x. |
* The filling is done byte-by-byte. |
* |
* @param dst Origin address to fill. |
* @param cnt Number of bytes to fill. |
* @param x Value to fill. |
* |
*/ |
void _memsetb(__address dst, int cnt, __u8 x) |
{ |
int i; |
/SPARTAN/trunk/src/lib/func.c |
---|
32,8 → 32,14 |
#include <arch/asm.h> |
#include <arch.h> |
__u32 haltstate = 0; |
__u32 haltstate = 0; /**< Halt flag */ |
/** Halt wrapper |
* |
* Set halt flag and halt the cpu. |
* |
*/ |
void halt(void) |
{ |
haltstate = 1; |
43,9 → 49,17 |
} |
/* |
* returns 0 if src == dst |
* otherwise returns 1 |
/** Compare two NULL terminated strings |
* |
* Do a char-by-char comparment of two NULL terminated strings. |
* The strings are considered equal iff they have the same |
* length and consist of the same characters. |
* |
* @param src First string to compare. |
* @param dst Second string to compare. |
* |
* @return 0 if the strings are equal, 1 otherwise. |
* |
*/ |
int strcmp(char *src, char *dst) |
{ |
/SPARTAN/trunk/src/lib/list.c |
---|
28,6 → 28,18 |
#include <list.h> |
/** Check for membership |
* |
* Check whether link is contained in the list head. |
* The membership is defined as pointer equivalence. |
* |
* @param link Item to look for. |
* @param head List to look in. |
* |
* @return 1 if link is contained in head, 0 otherwise. |
* |
*/ |
int list_member(link_t *link, link_t *head) |
{ |
int found = 0; |
44,6 → 56,17 |
return found; |
} |
/** Concatenate two lists |
* |
* Concatenate lists head1 and head2, producing a single |
* list head1 containing items from both (in head1, head2 |
* order) and empty list head2. |
* |
* @param head1 First list and concatenated output |
* @param head2 Second list and empty output. |
* |
*/ |
void list_concat(link_t *head1, link_t *head2) |
{ |
if (list_empty(head2)) |