yaffs: Update year to 2011 in copyrights etc.
[yaffs2.git] / direct / timothy_tests / threading / lib.c
1 /*
2  * YAFFS: Yet another FFS. A NAND-flash specific file system.
3  *
4  * Copyright (C) 2002-2011 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Timothy Manning <timothy@yaffs.net>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13
14 #include "lib.h"
15 static volatile unsigned int *p_counter;
16 static unsigned int numberOfThreads=5;
17
18 unsigned int get_num_of_threads(void)
19 {
20         return numberOfThreads;
21 }
22
23 void number_of_threads(unsigned int num)
24 {
25         numberOfThreads=num;
26 }
27
28 int get_counter(int x)
29 {
30         return p_counter[x];
31 }
32
33 void set_counter(int x, unsigned int value)
34 {
35         p_counter[x]=value;
36 }
37
38 void init_counter(unsigned int size_of_counter)
39 {
40         p_counter=malloc(size_of_counter*sizeof(unsigned int));
41 }
42