summaryrefslogtreecommitdiffstats
path: root/rtemsbsd/src/rtems-bsd-init.c
blob: eda989969802f5359e84817cb3f92f76bc23e852 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
 * @file
 *
 * @ingroup rtems_bsd_rtems
 *
 * @brief TODO.
 */

/*
 * Copyright (c) 2009, 2010 embedded brains GmbH.  All rights reserved.
 *
 *  embedded brains GmbH
 *  Obere Lagerstr. 30
 *  82178 Puchheim
 *  Germany
 *  <rtems@embedded-brains.de>
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rtems.com/license/LICENSE.
 */

#include <freebsd/machine/rtems-bsd-config.h>

#include <freebsd/sys/param.h>
#include <freebsd/sys/types.h>
#include <freebsd/sys/systm.h>
#include <freebsd/sys/kernel.h>
#include <freebsd/sys/lock.h>
#include <freebsd/sys/mutex.h>
#include <freebsd/sys/proc.h>

#include <freebsd/bsd.h>

/* In FreeBSD this is a local function */
void mi_startup(void);

int hz;
int tick;
int maxusers;     /* base tunable */

rtems_status_code
rtems_bsd_initialize(void)
{
	rtems_status_code sc = RTEMS_SUCCESSFUL;

  hz = (int) rtems_clock_get_ticks_per_second();
  tick = 1000000 / hz;
  maxusers = 1;

	sc =  rtems_timer_initiate_server(
		BSD_TASK_PRIORITY_TIMER,
		BSD_MINIMUM_TASK_STACK_SIZE,
		RTEMS_DEFAULT_ATTRIBUTES
	);
	if (sc != RTEMS_SUCCESSFUL) {
		return RTEMS_UNSATISFIED;
	}

	mutex_init();

	mi_startup();

	return RTEMS_SUCCESSFUL;
}