2020-2021 Sunseeker Telemetry and Lighting System
pmap.c
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // pmap.c - Driver for the pmap Module.
4 //
5 //*****************************************************************************
6 
7 //*****************************************************************************
8 //
11 //
12 //*****************************************************************************
13 
14 #include "inc/hw_memmap.h"
15 
16 #ifdef __MSP430_HAS_PORT_MAPPING__
17 #include "pmap.h"
18 
19 #include <assert.h>
20 
21 void PMAP_initPorts ( uint16_t baseAddress,
22  PMAP_initPortsParam *param)
23 {
24 
25  //Store current interrupt state, then disable all interrupts
26  uint16_t globalInterruptState = __get_SR_register() & GIE;
27  __disable_interrupt();
28 
29  //Get write-access to port mapping registers:
30  HWREG16(baseAddress + OFS_PMAPKEYID) = PMAPPW;
31 
32  //Enable/Disable reconfiguration during runtime
33  HWREG8(baseAddress + OFS_PMAPCTL) &= ~PMAPRECFG;
34  HWREG8(baseAddress + OFS_PMAPCTL) |= param->portMapReconfigure;
35 
36  //Configure Port Mapping:
37  uint16_t i;
38  for (i = 0; i < param->numberOfPorts * 8; i++)
39  {
40  param->PxMAPy[i] = param->portMapping[i];
41  }
42 
43  //Disable write-access to port mapping registers:
44  HWREG8(baseAddress + OFS_PMAPKEYID) = 0;
45 
46  //Restore previous interrupt state
47  __bis_SR_register(globalInterruptState);
48 }
49 
50 #endif
51 //*****************************************************************************
52 //
55 //
56 //*****************************************************************************
MPU_initThreeSegmentsParam param
#define HWREG8(x)
Definition: hw_memmap.h:41
#define HWREG16(x)
Definition: hw_memmap.h:39