UbixOS  2.0
vitals.c
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2002-2018 The UbixOS Project.
3  * All rights reserved.
4  *
5  * This was developed by Christopher W. Olsen for the UbixOS Project.
6  *
7  * Redistribution and use in source and binary forms, with or without modification, are permitted
8  * provided that the following conditions are met:
9  *
10  * 1) Redistributions of source code must retain the above copyright notice, this list of
11  * conditions, the following disclaimer and the list of authors.
12  * 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13  * conditions, the following disclaimer and the list of authors in the documentation and/or
14  * other materials provided with the distribution.
15  * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16  * endorse or promote products derived from this software without specific prior written
17  * permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #include <ubixos/vitals.h>
30 #include <ubixos/kpanic.h>
31 #include <lib/kprintf.h>
32 #include <lib/kmalloc.h>
33 #include <string.h>
34 
37 
38 /************************************************************************
39 
40  Function: vitals_init();
41  Description: This will enable the vitals subsystem for ubixos
42 
43  Notes:
44 
45  02/20/2004 - Approved Its Quality
46 
47  ************************************************************************/
48 int vitals_init() {
49  /* Initialize Vitals SpinLock */
51 
52  /* Initialize Memory For The System Vitals Node */
54 
55  /* If malloc Failed Then Error */
56  if (systemVitals == 0x0) {
57  kpanic("Error: kmalloc Failed In initVitals\n");
58  }
59 
60  /* Set all default values */
61  memset(systemVitals, 0x0, sizeof(vitalsNode));
62 
63  systemVitals->quantum = 8;
65 
66  /* Print Out Info For Vitals: */
67  kprintf("vitals0 - Address: [0x%X]\n", systemVitals);
68 
69  /* Return so kernel knows that there is no problem */
70  return (0x0);
71 }
72 
73 /***
74  END
75  ***/
76 
spinLockInit
void spinLockInit(spinLock_t *lock)
Definition: spinlock.c:32
vitalsStruct::quantum
uint32_t quantum
Definition: vitals.h:39
string.h
kpanic
void kpanic(const char *fmt,...)
print panic message and halt system
Definition: kpanic.c:41
kpanic.h
kprintf.h
vitals.h
vitals_init
int vitals_init()
Definition: vitals.c:47
vitalsStruct
Definition: vitals.h:36
vitals_lock
spinLock_t vitals_lock
Definition: vitals.c:36
kmalloc
void * kmalloc(uInt32 len)
Definition: kmalloc.c:241
spinLock
Definition: spinlock.h:41
memset
void * memset(void *dst, int c, size_t length)
vitalsStruct::dQuantum
uint32_t dQuantum
Definition: vitals.h:40
kprintf
int kprintf(const char *,...)
Definition: kprintf.c:259
kmalloc.h
systemVitals
vitalsNode * systemVitals
Definition: vitals.c:35