summaryrefslogtreecommitdiffstats
path: root/bsps/powerpc/gen5200/include/bsp/nvram.h
blob: a6bdc19687b0e0f1459b4a9b7d194e5fcc874ee9 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 * RTEMS generic MPC5200 BSP
 *
 * This file contains the nvram declarations.
 *
 * M93C46 is a serial microwire EEPROM which contains
 * 1Kbit (128 bytes/64 words) of non-volatile memory.
 * The device can be configured for byte- or word-
 * access. The driver provides a file-like interface
 * to this memory.
 *
 * MPC5x00 PIN settings:
 *
 * PSC3_6 (output) -> MC93C46 serial data in    (D)
 * PSC3_7 (input)  -> MC93C46 serial data out   (Q)
 * PSC3_8 (output) -> MC93C46 chip select input (S)
 * PSC3_9 (output) -> MC93C46 serial clock      (C)
 *
 * References: DS1307-based Non-Volatile memory device driver
 * by Victor V. Vengerov.
 */

/*
 * Author: Victor V. Vengerov
 * Copyright (c) 2000 OKTET Ltd.,St.-Petersburg,Russia
 *
 * Copyright (c) 2003 IPR Engineering
 *
 * Copyright (c) 2005 embedded brains GmbH & Co. KG
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rtems.org/license/LICENSE.
 */

#ifndef __NVRAM_H__
#define __NVRAM_H__

#ifdef __cplusplus
extern "C" {
#endif

/* include <bsp.h> */
#include <bsp.h>

/* Macros for TBL read access */
#define TBL_READ(count)    __asm__ volatile ("mftb %0\n" : "=r" (count) : "0" (count))
#define TMBASE_CLOCK       (G2_CLOCK/4)

/* Simple usec delay function prototype */
void wait_usec(unsigned long);

/* nvram_driver_initialize --
 *     Non-volatile memory device driver initialization.
 */
rtems_device_driver
nvram_driver_initialize(rtems_device_major_number major,
                        rtems_device_minor_number minor,
                        void *arg);

/* nvram_driver_open --
 *     Non-volatile memory device driver open primitive.
 */
rtems_device_driver
nvram_driver_open(rtems_device_major_number major,
                  rtems_device_minor_number minor,
                  void *arg);

/* nvram_driver_close --
 *     Non-volatile memory device driver close primitive.
 */
rtems_device_driver
nvram_driver_close(rtems_device_major_number major,
                   rtems_device_minor_number minor,
                   void *arg);

/* nvram_driver_read --
 *     Non-volatile memory device driver read primitive.
 */
rtems_device_driver
nvram_driver_read(rtems_device_major_number major,
                  rtems_device_minor_number minor,
                  void *arg);

/* nvram_driver_write --
 *     Non-volatile memory device driver write primitive.
 */
rtems_device_driver
nvram_driver_write(rtems_device_major_number major,
                   rtems_device_minor_number minor,
                   void *arg);

#ifdef __cplusplus
}
#endif

#endif /* __NVRAM_H__ */