source: rtems/bsps/powerpc/mvme3100/start/misc.c

Last change on this file was 9964895, checked in by Sebastian Huber <sebastian.huber@…>, on 04/20/18 at 08:35:35

bsps: Move startup files to bsps

Adjust build support files to new directory layout.

This patch is a part of the BSP source reorganization.

Update #3285.

  • Property mode set to 100644
File size: 3.4 KB
RevLine 
[b599faa]1/* Miscellaneous small BSP routines; reboot, board CSR, ... */
2
[ac7af4a]3/*
[b599faa]4 * Authorship
5 * ----------
6 * This software ('mvme3100' RTEMS BSP) was created by
7 *
8 *     Till Straumann <strauman@slac.stanford.edu>, 2005-2007,
9 *         Stanford Linear Accelerator Center, Stanford University.
[ac7af4a]10 *
[b599faa]11 * Acknowledgement of sponsorship
12 * ------------------------------
13 * The 'mvme3100' BSP was produced by
14 *     the Stanford Linear Accelerator Center, Stanford University,
15 *         under Contract DE-AC03-76SFO0515 with the Department of Energy.
[ac7af4a]16 *
[b599faa]17 * Government disclaimer of liability
18 * ----------------------------------
19 * Neither the United States nor the United States Department of Energy,
20 * nor any of their employees, makes any warranty, express or implied, or
21 * assumes any legal liability or responsibility for the accuracy,
22 * completeness, or usefulness of any data, apparatus, product, or process
23 * disclosed, or represents that its use would not infringe privately owned
24 * rights.
[ac7af4a]25 *
[b599faa]26 * Stanford disclaimer of liability
27 * --------------------------------
28 * Stanford University makes no representations or warranties, express or
29 * implied, nor assumes any liability for the use of this software.
[ac7af4a]30 *
[b599faa]31 * Stanford disclaimer of copyright
32 * --------------------------------
33 * Stanford University, owner of the copyright, hereby disclaims its
34 * copyright and all other rights in this software.  Hence, anyone may
[ac7af4a]35 * freely use it for any purpose without restriction.
36 *
[b599faa]37 * Maintenance of notices
38 * ----------------------
39 * In the interest of clarity regarding the origin and status of this
40 * SLAC software, this and all the preceding Stanford University notices
41 * are to remain affixed to any copy or derivative of this software made
42 * or distributed by the recipient and are to be affixed to any copy of
43 * software made or distributed by the recipient that contains a copy or
44 * derivative of this software.
[ac7af4a]45 *
[b599faa]46 * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
[ac7af4a]47 */
[b599faa]48
49#include <bsp.h>
[1ec8b829]50#include <bsp/bootcard.h>
[b599faa]51
52void
[6987eecc]53bsp_reset(void)
[b599faa]54{
55uint8_t v;
56        /*
57         * AFAIK, the hardest reset available; cleared
58         * some errors a VME-bus reset wouldn't (hung
59         * i2c bus)...
60         */
61        v  = in_8( BSP_MVME3100_SYS_CR );
62        v &= ~BSP_MVME3100_SYS_CR_RESET_MSK;
63        v |=  BSP_MVME3100_SYS_CR_RESET;
64        out_8( BSP_MVME3100_SYS_CR, v );
65}
66
67uint8_t
68BSP_setSysReg(volatile uint8_t *r, uint8_t mask)
69{
70uint8_t               v;
71rtems_interrupt_level l;
72
73        if ( !mask )
74                return in_8( r );
75
76        rtems_interrupt_disable(l);
77                v = in_8( r );
78                if ( mask ) {
79                        out_8( r,  v | mask );
80                }
81        rtems_interrupt_enable(l);
82        return v;
83}
84
85uint8_t
86BSP_clrSysReg(volatile uint8_t *r, uint8_t mask)
87{
88uint8_t               v;
89rtems_interrupt_level l;
90
91        if ( !mask )
92                return in_8( r );
93
94        rtems_interrupt_disable(l);
95                v = in_8( r );
96                if ( mask ) {
97                        out_8( r,  v & ~mask );
98                }
99        rtems_interrupt_enable(l);
100        return v;
101}
102
103uint8_t
104BSP_setLEDs(uint8_t mask)
105{
106        return BSP_setSysReg( BSP_MVME3100_SYS_IND_REG, mask );
107}
108
109uint8_t
110BSP_clrLEDs(uint8_t mask)
111{
112        return BSP_clrSysReg( BSP_MVME3100_SYS_IND_REG, mask );
113}
114
115uint8_t
[c7880448]116BSP_eeprom_write_protect(void)
[b599faa]117{
118uint8_t           m = BSP_MVME3100_SYS_CR_EEPROM_WP;
119volatile uint8_t *r = BSP_MVME3100_SYS_CR;
120
121        return m & BSP_setSysReg( r, m );
122}
123
124uint8_t
[c7880448]125BSP_eeprom_write_enable(void)
[b599faa]126{
127uint8_t           m = BSP_MVME3100_SYS_CR_EEPROM_WP;
128volatile uint8_t *r = BSP_MVME3100_SYS_CR;
129
130        return m & BSP_clrSysReg( r, m );
131}
Note: See TracBrowser for help on using the repository browser.