]> rtime.felk.cvut.cz Git - lincan.git/blob - embedded/arch/arm/generic/libs/misc/bbconf_info.c
Update of system-less architecture and board support code to actual uLAN.sf.net version.
[lincan.git] / embedded / arch / arm / generic / libs / misc / bbconf_info.c
1 /*******************************************************************
2   Components for embedded applications builded for
3   laboratory and medical instruments firmware
4
5   bbconf_info.c - boot block config parameters retrieval
6
7   Copyright (C) 2001 by Pavel Pisa pisa@cmp.felk.cvut.cz
8             (C) 2002 by PiKRON Ltd. http://www.pikron.com
9
10  *******************************************************************/
11
12 #include <string.h>
13 #include <bbconf_info.h>
14
15 int bbconf_get_param(unsigned long tag, unsigned long *pval)
16 {
17   unsigned long *magic  = (unsigned long *)BBCONF_MAGIC_ADDR;
18   unsigned long *pt_ptr = (unsigned long *)BBCONF_PTPTR_ADDR;
19   unsigned long *pt;
20   int cnt;
21
22   if(*magic != BBCONF_MAGIC_VAL)
23     return -2;
24
25   if(!(*pt_ptr) || !(*pt_ptr+1))
26     return -2;
27
28   pt = (unsigned long *)*pt_ptr;
29
30   for(cnt = 0; (cnt < BBCONF_PT_MAX_CNT) &&
31       (pt[0] != BBCONF_PTTAG_END); cnt++, pt += 2) {
32     if(pt[0] == tag) {
33       *pval=pt[1];
34       return 1;
35     }
36   }
37   return -1;
38 }