Skip to content

Commit 02c6c92

Browse files
committed
add support for SmartFusion2 family FPGA
1 parent 695a586 commit 02c6c92

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+31851
-0
lines changed

bsp/smartfusion2/CMSIS/core_cm3.c

Lines changed: 810 additions & 0 deletions
Large diffs are not rendered by default.

bsp/smartfusion2/CMSIS/core_cm3.h

Lines changed: 1844 additions & 0 deletions
Large diffs are not rendered by default.

bsp/smartfusion2/CMSIS/hw_reg_io.h

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*******************************************************************************
2+
* (c) Copyright 2011-2013 Microsemi SoC Products Group. All rights reserved.
3+
*
4+
* SmartFusion2 Cortex Microcontroller Software Interface - Peripheral
5+
* Access Layer.
6+
*
7+
* This file provides interfaces to perform register and register bit level
8+
* read / write operations. These interfaces support bit-banding in case of
9+
* Cortex-M3 CPU.
10+
*
11+
* SVN $Revision: 5263 $
12+
* SVN $Date: 2013-03-21 14:44:58 +0000 (Thu, 21 Mar 2013) $
13+
*/
14+
15+
#ifndef HW_REG_IO_H_
16+
#define HW_REG_IO_H_
17+
18+
#include <stdint.h> /* Include standard types */
19+
20+
#if defined ( __CC_ARM )
21+
#define __INLINE __inline /*!< inline keyword for ARM Compiler */
22+
23+
#elif defined ( __ICCARM__ )
24+
#define __INLINE inline /*!< inline keyword for IAR Compiler. Only avaiable in High optimization mode! */
25+
26+
#elif defined ( __GNUC__ )
27+
#define __INLINE inline /*!< inline keyword for GNU Compiler */
28+
#endif
29+
30+
/*****************************************************************************************
31+
* Definitions for register access
32+
*/
33+
34+
#define HW_REG(addr) (*((volatile uint32_t *) (addr)))
35+
36+
static __INLINE void write_reg32(volatile uint32_t * reg, uint32_t val)
37+
{
38+
HW_REG(reg) = val;
39+
}
40+
static __INLINE void write_reg16(volatile uint16_t * reg, uint16_t val)
41+
{
42+
HW_REG(reg) = val;
43+
}
44+
static __INLINE void write_reg8(volatile uint8_t * reg, uint8_t val)
45+
{
46+
HW_REG(reg) = val;
47+
}
48+
49+
static __INLINE uint32_t read_reg32(volatile uint32_t * reg)
50+
{
51+
return ( HW_REG(reg) );
52+
}
53+
static __INLINE uint16_t read_reg16(volatile uint16_t * reg)
54+
{
55+
return ( HW_REG(reg) );
56+
}
57+
static __INLINE uint8_t read_reg8(volatile uint8_t * reg)
58+
{
59+
return ( HW_REG(reg) );
60+
}
61+
/*****************************************************************************************
62+
* Definitions for register bits access using bit-band aliases for Cortex-M3
63+
*/
64+
#define BITBAND(addr,bitnum) (((uint32_t)addr & 0xF0000000)+0x02000000+(((uint32_t)addr & 0xFFFFF)<<5)+(bitnum<<2))
65+
#define HW_REG_BIT(reg,bitnum) (*(volatile unsigned int *)((BITBAND(reg,bitnum))))
66+
67+
/*****************************************************************************************
68+
* Functions to set a bit field in Cortex-M3
69+
*/
70+
static __INLINE void set_bit_reg32(volatile uint32_t * reg, uint8_t bit)
71+
{
72+
HW_REG_BIT(reg,bit) = 0x1;
73+
}
74+
static __INLINE void set_bit_reg16(volatile uint16_t * reg, uint8_t bit)
75+
{
76+
HW_REG_BIT(reg,bit) = 0x1;
77+
}
78+
static __INLINE void set_bit_reg8(volatile uint8_t * reg, uint8_t bit)
79+
{
80+
HW_REG_BIT(reg,bit) = 0x1;
81+
}
82+
/*****************************************************************************************
83+
* Functions to clear a bit field in Cortex-M3
84+
*/
85+
static __INLINE void clear_bit_reg32(volatile uint32_t * reg, uint8_t bit)
86+
{
87+
HW_REG_BIT(reg,bit) = 0x0;
88+
}
89+
static __INLINE void clear_bit_reg16(volatile uint16_t * reg, uint8_t bit)
90+
{
91+
HW_REG_BIT(reg,bit) = 0x0;
92+
}
93+
static __INLINE void clear_bit_reg8(volatile uint8_t * reg, uint8_t bit)
94+
{
95+
HW_REG_BIT(reg,bit) = 0x0;
96+
}
97+
/*****************************************************************************************
98+
* Functions to read a bit field in Cortex-M3
99+
*/
100+
static __INLINE uint8_t read_bit_reg32(volatile uint32_t * reg, uint8_t bit)
101+
{
102+
return (HW_REG_BIT(reg,bit));
103+
}
104+
static __INLINE uint8_t read_bit_reg16(volatile uint16_t * reg, uint8_t bit)
105+
{
106+
return (HW_REG_BIT(reg,bit));
107+
}
108+
static __INLINE uint8_t read_bit_reg8(volatile uint8_t * reg, uint8_t bit)
109+
{
110+
return (HW_REG_BIT(reg,bit));
111+
}
112+
113+
#endif /* HW_REG_IO_H_ */

0 commit comments

Comments
 (0)