1 |
595 |
jeremybenn |
/**************************************************************************//**
|
2 |
|
|
* @file
|
3 |
|
|
* @brief Chip initialization, SW workarounds for chip errata issues
|
4 |
|
|
* @author Energy Micro AS
|
5 |
|
|
* @version 1.1.1
|
6 |
|
|
******************************************************************************
|
7 |
|
|
* @section License
|
8 |
|
|
* <b>(C) Copyright 2009 Energy Micro AS, http://www.energymicro.com</b>
|
9 |
|
|
******************************************************************************
|
10 |
|
|
*
|
11 |
|
|
* This source code is the property of Energy Micro AS. The source and compiled
|
12 |
|
|
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
13 |
|
|
*
|
14 |
|
|
* This copyright notice may not be removed from the source code nor changed.
|
15 |
|
|
*
|
16 |
|
|
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
17 |
|
|
* obligation to support this Software. Energy Micro AS is providing the
|
18 |
|
|
* Software "AS IS", with no express or implied warranties of any kind,
|
19 |
|
|
* including, but not limited to, any implied warranties of merchantability
|
20 |
|
|
* or fitness for any particular purpose or warranties against infringement
|
21 |
|
|
* of any proprietary rights of a third party.
|
22 |
|
|
*
|
23 |
|
|
* Energy Micro AS will not be liable for any consequential, incidental, or
|
24 |
|
|
* special damages, or any other relief, or for any claim by any third party,
|
25 |
|
|
* arising from your use of this Software.
|
26 |
|
|
*
|
27 |
|
|
*****************************************************************************/
|
28 |
|
|
|
29 |
|
|
#ifndef __CHIP_H
|
30 |
|
|
#define __CHIP_H
|
31 |
|
|
|
32 |
|
|
#include <stdint.h>
|
33 |
|
|
|
34 |
|
|
/**************************************************************************//**
|
35 |
|
|
* @brief Chip errata workarounds
|
36 |
|
|
*****************************************************************************/
|
37 |
|
|
static inline void CHIP_init(void)
|
38 |
|
|
{
|
39 |
|
|
uint32_t rev;
|
40 |
|
|
volatile uint32_t *reg;
|
41 |
|
|
|
42 |
|
|
rev = *(volatile uint32_t *)(0x0FE081FC);
|
43 |
|
|
/* Engineering Sample calibration setup */
|
44 |
|
|
if ((rev >> 24) == 0)
|
45 |
|
|
{
|
46 |
|
|
reg = (volatile uint32_t *) 0x400CA00C;
|
47 |
|
|
*reg &= ~(0x70UL);
|
48 |
|
|
/* DREG */
|
49 |
|
|
reg = (volatile uint32_t *) 0x400C6020;
|
50 |
|
|
*reg &= ~(0xE0000000UL);
|
51 |
|
|
*reg |= ~(7 << 25);
|
52 |
|
|
}
|
53 |
|
|
if ((rev >> 24) <= 1)
|
54 |
|
|
{
|
55 |
|
|
/* DREG */
|
56 |
|
|
reg = (volatile uint32_t *) 0x400C6020;
|
57 |
|
|
*reg &= ~(0x00001F80UL);
|
58 |
|
|
/* Update CMU reset values */
|
59 |
|
|
reg = (volatile uint32_t *) 0x400C8040;
|
60 |
|
|
*reg = 0;
|
61 |
|
|
reg = (volatile uint32_t *) 0x400C8044;
|
62 |
|
|
*reg = 0;
|
63 |
|
|
reg = (volatile uint32_t *) 0x400C8058;
|
64 |
|
|
*reg = 0;
|
65 |
|
|
reg = (volatile uint32_t *) 0x400C8060;
|
66 |
|
|
*reg = 0;
|
67 |
|
|
reg = (volatile uint32_t *) 0x400C8078;
|
68 |
|
|
*reg = 0;
|
69 |
|
|
}
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
#endif
|