![]() |
|
|||
File indexing completed on 2025-05-11 08:23:56
0001 /* BSP-specific bits of flash programmer support */ 0002 0003 /* 0004 * Authorship 0005 * ---------- 0006 * This software ('mvme3100' RTEMS BSP) was created by 0007 * 0008 * Till Straumann <strauman@slac.stanford.edu>, 2005-2007, 0009 * Stanford Linear Accelerator Center, Stanford University. 0010 * 0011 * Acknowledgement of sponsorship 0012 * ------------------------------ 0013 * The 'mvme3100' BSP was produced by 0014 * the Stanford Linear Accelerator Center, Stanford University, 0015 * under Contract DE-AC03-76SFO0515 with the Department of Energy. 0016 * 0017 * Government disclaimer of liability 0018 * ---------------------------------- 0019 * Neither the United States nor the United States Department of Energy, 0020 * nor any of their employees, makes any warranty, express or implied, or 0021 * assumes any legal liability or responsibility for the accuracy, 0022 * completeness, or usefulness of any data, apparatus, product, or process 0023 * disclosed, or represents that its use would not infringe privately owned 0024 * rights. 0025 * 0026 * Stanford disclaimer of liability 0027 * -------------------------------- 0028 * Stanford University makes no representations or warranties, express or 0029 * implied, nor assumes any liability for the use of this software. 0030 * 0031 * Stanford disclaimer of copyright 0032 * -------------------------------- 0033 * Stanford University, owner of the copyright, hereby disclaims its 0034 * copyright and all other rights in this software. Hence, anyone may 0035 * freely use it for any purpose without restriction. 0036 * 0037 * Maintenance of notices 0038 * ---------------------- 0039 * In the interest of clarity regarding the origin and status of this 0040 * SLAC software, this and all the preceding Stanford University notices 0041 * are to remain affixed to any copy or derivative of this software made 0042 * or distributed by the recipient and are to be affixed to any copy of 0043 * software made or distributed by the recipient that contains a copy or 0044 * derivative of this software. 0045 * 0046 * ------------------ SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03 0047 */ 0048 #include <rtems.h> 0049 #include <bsp.h> 0050 #include <libcpu/spr.h> 0051 #include <stdio.h> 0052 0053 #include <bsp/flashPgmPvt.h> 0054 0055 SPR_RO(TBRL) 0056 0057 #define STATIC static 0058 0059 static struct bankdesc mvme3100Flash[] = { 0060 /* 0061 * Bank is populated from the top; make max_size negative to 0062 * indicate this 0063 */ 0064 { 0xf8000000, 0, - 0x08000000, 2, BSP_flash_vendor_spansion, 0, 0, 0 }, 0065 }; 0066 0067 STATIC struct bankdesc * 0068 bankcheck(int bank, int quiet) 0069 { 0070 if ( bank ) { 0071 if ( !quiet ) 0072 fprintf(stderr,"Invalid flash bank #%i\n",bank); 0073 return 0; 0074 } 0075 return &mvme3100Flash[bank]; 0076 } 0077 0078 STATIC int 0079 flash_wp(int bank, int enbl) 0080 { 0081 uint8_t mask = enbl < 0 ? 0 : BSP_MVME3100_FLASH_CSR_F_WP_SW; 0082 uint8_t val; 0083 0084 if ( bank != 0 ) { 0085 fprintf(stderr,"Invalid flash bank #%i\n",bank); 0086 return -1; 0087 } 0088 0089 if ( enbl ) 0090 val = BSP_setSysReg( BSP_MVME3100_FLASH_CSR, mask ); 0091 else 0092 val = BSP_clrSysReg( BSP_MVME3100_FLASH_CSR, mask ); 0093 0094 if ( BSP_MVME3100_FLASH_CSR_F_WP_HW & val ) { 0095 fprintf(stderr,"Flash: hardware write-protection engaged (switch)\n"); 0096 return -1; 0097 } 0098 if ( enbl < 0 ) 0099 return val & (BSP_MVME3100_FLASH_CSR_F_WP_HW | BSP_MVME3100_FLASH_CSR_F_WP_SW ); 0100 return 0; 0101 } 0102 0103 STATIC uint32_t 0104 read_us_timer(void) 0105 { 0106 uint32_t mhz = BSP_bus_frequency/BSP_time_base_divisor/1000; 0107 0108 return _read_TBRL()/mhz; 0109 } 0110 0111 /* BSP ops (detect banks, handle write-protection on board) */ 0112 struct flash_bsp_ops BSP_flashBspOps = { 0113 bankcheck: bankcheck, 0114 flash_wp: flash_wp, 0115 read_us_timer: read_us_timer, 0116 };
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |