blob: 4c59f1d0b279e45eaa6e35c9837762a4b328e71f (
plain)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
* 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 <rtems.h>
#include <assert.h>
#include <stdio.h>
#include <inttypes.h>
#include <bsp.h>
#include <bsp/irq.h>
#include "PCI.h"
/*PAGE
*
* SCORE603e_FLASH_Disable
*/
unsigned int SCORE603e_FLASH_Disable(
uint32_t area /* IN */
)
{
uint8_t value;
value = *SCORE603E_BOARD_CTRL_REG;
value = value | (~SCORE603E_BRD_FLASH_DISABLE_MASK);
*SCORE603E_BOARD_CTRL_REG = value;
return RTEMS_SUCCESSFUL;
}
unsigned int SCORE603e_FLASH_verify_enable( void )
{
volatile uint8_t *Ctrl_Status_Register =
(void *)SCORE603E_BOARD_CTRL_REG;
uint8_t ctrl_value;
uint32_t pci_value;
ctrl_value = *Ctrl_Status_Register;
if ( ctrl_value & SCORE603E_BRD_FLASH_DISABLE_MASK ) {
printf ("Flash Writes Disabled by board control register %x\n",
ctrl_value );
assert( 0x0 );
}
pci_value = Read_pci_device_register( 0x800000A8 );
if (( pci_value & 0x00001000 ) == 0) {
printf("Error PCI A8 \n");
assert( 0x0 );
}
pci_value = Read_pci_device_register( 0x800000AC );
if ( pci_value & 0x02000000) {
printf("Error PCI AC \n");
assert( 0x0 );
}
return RTEMS_SUCCESSFUL;
}
unsigned int SCORE603e_FLASH_pci_reset_reg(
uint8_t reg,
uint32_t cmask,
uint32_t mask
)
{
uint32_t pci_value;
uint32_t value;
pci_value = Read_pci_device_register( reg );
pci_value &= cmask;
pci_value |= mask;
Write_pci_device_register( reg, pci_value );
value = Read_pci_device_register( reg );
if (value != pci_value) {
printf("Error PCI 0x%2"PRIX8" wrote 0x%8"PRIX32" read %8"PRIX32"\n", reg, pci_value, value);
}
return RTEMS_SUCCESSFUL;
}
/*PAGE
*
* SCORE603e_FLASH_Enable_writes
*/
unsigned int SCORE603e_FLASH_Enable_writes(
uint32_t area /* IN */
)
{
uint8_t ctrl_value;
uint32_t pci_value;
ctrl_value = *SCORE603E_BOARD_CTRL_REG;
ctrl_value = ctrl_value & 0xbf;
*SCORE603E_BOARD_CTRL_REG = ctrl_value;
pci_value = Read_pci_device_register( 0x800000A8 );
pci_value |= 0x00001000;
Write_pci_device_register( 0x800000A8, pci_value );
pci_value = Read_pci_device_register( 0x800000AC );
pci_value &= (~0x02000000);
Write_pci_device_register( 0x000000AC, pci_value );
return RTEMS_SUCCESSFUL;
}
|