CDMmap
(FUN)
FUNCTION CDMmap : POINTER TO BYTE
Map files or devices into memory. mmap() creates a new mapping in the virtual address space of the calling process.
- InOut:
Scope
Name
Type
Comment
Return
CDMmap
POINTER TO BYTE
pointer to the mapped area, or MAP_FAILED if failed.
Input
addr
POINTER TO BYTE
Pointer to starting address for the new mapping
length
UDINT
Number of bytes mapped
prot
DINT
- Memory protection of the mapping. It is either PROT_NONE or the bitwise OR of one or more of the following flags:
PROT_EXEC: Pages may be executed
PROT_READ: Pages may be read
PROT_WRITE: Pages may be written
PROT_NONE: Pages may not be accessed
flags
DINT
- one of the following flags
MAP_SHARED: Share this mapping
MAP_SHARED_VALIDATE: This flag provides the same behavior as MAP_SHARED except that MAP_SHARED mappings ignore unknown flags in flags
MAP_PRIVATE: Create a private copy-on-write mapping
Optional flags for mmap: See linux man page for Details
hFile
RTS_IEC_HANDLE
File descriptor of the file to be mapped
offset
DINT
Offset in the file (or other object) where mapping starts
pResult
POINTER TO DINT
Pointer to linux errno error code, 0 is ok