#include <string.h>\r
#include "../kernel/core_cr4.h"\r
\r
-GIO_RegisterType *GPIO_ports[] = { GIO_PORTA_BASE, GIO_PORTB_BASE, GIO_HET_PORT1_BASE };\r
+GIO_RegisterType *GPIO_ports[] = { GIO_PORTA_BASE, GIO_PORTB_BASE, GIO_HET_PORT1_BASE, GIO_DMM_PORT_BASE };\r
\r
#define DIO_GET_PORT_FROM_CHANNEL_ID(_channelId) (_channelId >> 8)\r
#define DIO_GET_BIT_FROM_CHANNEL_ID(_channelId) (1 << (_channelId & 0x1F))\r
{\r
VALIDATE_PORT(portId, DIO_WRITEPORT_ID);\r
\r
- GPIO_ports[portId]->DOUT = (uint32)level;\r
+ GPIO_ports[portId]->DOUT = (uint16)level; // uint32 for TMS570LS3137HDK, uint16 for RPP\r
\r
#if ( DIO_DEV_ERROR_DETECT == STD_ON )\r
cleanup:\r
\r
#define PORT_NOT_CONFIGURED 0x00000000\r
\r
-#define PORT_0_BASE ((Port_RegisterType *)0xFFF7BC30)\r
-#define PORT_1_BASE ((Port_RegisterType *)0xFFF7BC50)\r
+#define PORT_0_BASE ((Port_RegisterType *)0xFFF7BC30) // GIO Port A\r
+#define PORT_1_BASE ((Port_RegisterType *)0xFFF7BC50) // GIO Port B\r
#define PORT_2_BASE ((Port_RegisterType *)0xFFF7B848) // N2HET1 Base\r
-#define PORT_3_BASE ((Port_RegisterType *)PORT_NOT_CONFIGURED)\r
+#define PORT_3_BASE ((Port_RegisterType *)0xFFFFF76C) // DMM used as a GIO\r
#define PORT_4_BASE ((Port_RegisterType *)PORT_NOT_CONFIGURED)\r
#define PORT_5_BASE ((Port_RegisterType *)PORT_NOT_CONFIGURED)\r
#define PORT_6_BASE ((Port_RegisterType *)PORT_NOT_CONFIGURED)\r
#endif\r
\r
void Port_RefreshPin(uint16 pinNumber) {\r
- uint8 port = GET_PIN_PORT(_configPtr->pins[pinNumber].pin);\r
+ uint32 port = GET_PIN_PORT(_configPtr->pins[pinNumber].pin);\r
uint32 mask = GET_PIN_MASK(_configPtr->pins[pinNumber].pin);\r
- uint16 conf = _configPtr->pins[pinNumber].conf;\r
+ uint32 conf = _configPtr->pins[pinNumber].conf;\r
\r
uint32 pinmux = _configPtr->pins[pinNumber].pinmux;\r
uint8 pinmuxFunctionNum = _configPtr->pins[pinNumber].pinmuxFunctionNum;\r
}\r
\r
\r
-void Port_Init(const Port_ConfigType *configType) {\r
+void Port_Init(const Port_ConfigType *configType) { // note: HalCoGen: gioInit\r
VALIDATE_PARAM_CONFIG(configType, PORT_INIT_ID);\r
\r
_configPtr = (Port_ConfigType *)configType;\r
for (uint16 i = 0; i < PORT_NUMBER_OF_PINS; i++) {\r
Port_RefreshPin(i);\r
}\r
+ if (DMM_USED) {\r
+ for (uint16 i = 0; i < PORT_NUMBER_OF_PINS; i++) {\r
+ Dmm_Init(i);\r
+ }\r
+ }\r
\r
_portState = PORT_INITIALIZED;\r
\r
return;\r
}\r
\r
+void Dmm_Init(uint16 pinNumber) {\r
+\r
+ dmmReg->GLBCTRL= 0x00000605; /* DMM switched ON, set 32 bit length */\r
+ //dmmReg->GLBCTRL = 0x5; // don't use DMM_Reset\r
+\r
+ uint32 port = GET_PIN_PORT(_configPtr->pins[pinNumber].pin);\r
+ uint32 mask = GET_PIN_MASK(_configPtr->pins[pinNumber].pin);\r
+\r
+ Port_Base[port]->FUN |= ~mask; // pin usage: 1 - functional, 0 - GIO\r
+ //Port_Base[port]->FUN = 0x00000000;\r
+ //Port_Base[port]->DIR = 0x00000001;\r
+ Port_Base[port]->DIR = 0x7FFFF; // I/O selection: 0 - input, 1 - output (not necessary but assures that all DMM GIO pins are used as outputs in our example)\r
+ Port_Base[port]->PSL &= ~mask; // pull-up/pull-down selection: 0 - pull-down, 1 - pull-up\r
+}\r
+\r
+void Dmm_Reset(const Port_ConfigType *configType) {\r
+ VALIDATE_PARAM_CONFIG(configType, PORT_INIT_ID);\r
+\r
+ _configPtr = (Port_ConfigType *)configType;\r
+\r
+ uint32 mask = GET_PIN_MASK(_configPtr->pins[0].pin);\r
+ dmmReg->GLBCTRL |= mask;\r
+ dmmReg->GLBCTRL &= ~mask;\r
+}\r
+\r
#if ( PORT_SET_PIN_DIRECTION_API == STD_ON )\r
void Port_SetPinDirection( Port_PinType pin, Port_PinDirectionType direction )\r
{\r
#define PORT_SET_PIN_MODE_ID 0x04
//@}
+/** @name DMM defines */
+#define DMM_SYNC 0
+#define DMM_CLK 1
+#define DMM_DATA0 2
+#define DMM_DATA1 3
+#define DMM_DATA2 4
+#define DMM_DATA3 5
+#define DMM_DATA4 6
+#define DMM_DATA5 7
+#define DMM_DATA6 8
+#define DMM_DATA7 9
+#define DMM_DATA8 10
+#define DMM_DATA9 11
+#define DMM_DATA10 12
+#define DMM_DATA11 13
+#define DMM_DATA12 14
+#define DMM_DATA13 15
+#define DMM_DATA14 16
+#define DMM_DATA15 17
+#define DMM_ENA 18
+
/** @req PORT046
* The type Port_PinDirectionType is a type for defining the direction of a Port Pin.
* PORT_PIN_IN Sets port pin as input.
void Port_Init(const Port_ConfigType *configType);
+void Dmm_Init(uint16 pinNumber); // Dmm will be used as a GIO
+void Dmm_Reset(const Port_ConfigType *configType);
+
#if ( PORT_SET_PIN_DIRECTION_API == STD_ON )
void Port_SetPinDirection(Port_PinType pin, Port_PinDirectionType direction);
#endif