#include <iostream>
#include <map>

#define REGISTER_PORT(map, key, value) map.insert(std::make_pair(key, (PORT_ADDR)value))

typedef volatile int* const PORT_ADDR;
typedef enum {PORT0, PORT1, PORT2, PORT3, PORT4, PORT5} PORT_TYPE;

using namespace std;

int main(int argc, char* argv[])
{
	std::map<PORT_TYPE, PORT_ADDR> portMap;
	REGISTER_PORT(portMap, PORT0, 0x42128005);
	REGISTER_PORT(portMap, PORT1, 0x42128000);
	REGISTER_PORT(portMap, PORT2, 0x42188004);
	REGISTER_PORT(portMap, PORT3, 0x42128001);
	REGISTER_PORT(portMap, PORT4, 0x42188005);
	REGISTER_PORT(portMap, PORT5, 0x42128004);

	for(auto iter = portMap.begin(); iter != portMap.end(); ++iter)
	{
		printf("[key: %d, Val: %p]\n", iter->first, iter->second);
	}

	return 0;
}