Accessing a port is simply about accessing the register (memory location) that controls that port. So, all you need to do is "pass around" the memory address of the register.
example:
register address: 0x12
function prototype to accept memory locations:
void writeToMemory(void *address);
pass it to a function (as a pointer) and use it:
(uint8_t*)0x12 //cast memory address to pointer (the compiler now knows that the memory address is for unsigned 8-bit variable at that address)
dereference the pointer so that you can write to that location. Without dereferencing you would just change the address, not the value at that address.
(*((uint8_t*)0x12)) = 0b11111111; // write all ones to the port
If you look at how registers and other ports are defined in your library you will find something like:
#define PORTA (*((uint8_t*)0x12))