python-on-a-chip online compiler

Dependencies:   mbed TSI

Embed: (wiki syntax)

« Back to documentation index

mem.c File Reference

mem.c File Reference

VM Memory. More...

Go to the source code of this file.

Functions

uint16_t mem_getWord (PmMemSpace_t memspace, uint8_t const **paddr)
 Returns the 2-byte word at the given address in memspace.
uint32_t mem_getInt (PmMemSpace_t memspace, uint8_t const **paddr)
 Returns the 4-byte int at the given address in memspace.
float mem_getFloat (PmMemSpace_t memspace, uint8_t const **paddr)
 Returns the 4-byte float at the given address in memspace.
void mem_copy (PmMemSpace_t memspace, uint8_t **pdest, uint8_t const **psrc, uint16_t count)
 Copies count number of bytes from src in memspace to dest in RAM.
uint16_t mem_getStringLength (PmMemSpace_t memspace, uint8_t const *const pstr)
 Returns the number of bytes in the C string pointed to by pstr.
PmReturn_t mem_cmpn (uint8_t *cname, uint16_t cnamelen, PmMemSpace_t memspace, uint8_t const **paddr)
 Compares a byte array in RAM to a byte array in the given memory space.

Detailed Description

VM Memory.

VM memory operations. Implementations and stubs for getByte and memCopy functions. Functions to load object images from static memory.

Definition in file mem.c.


Function Documentation

PmReturn_t mem_cmpn ( uint8_t *  cname,
uint16_t  cnamelen,
PmMemSpace_t  memspace,
uint8_t const **  paddr 
)

Compares a byte array in RAM to a byte array in the given memory space.

Parameters:
cnamePointer to byte array in RAM
cnamelenLength of byte array to compare
memspaceMemory space of other byte array
paddrPointer to address of other byte array
Returns:
PM_RET_OK if all bytes in both arrays match; PM_RET_NO otherwise

Definition at line 131 of file mem.c.

void mem_copy ( PmMemSpace_t  memspace,
uint8_t **  pdest,
uint8_t const **  psrc,
uint16_t  count 
)

Copies count number of bytes from src in memspace to dest in RAM.

Leaves dest and src pointing one byte past end of the data.

Parameters:
memspacememory space/type of source
pdestptr to destination address
psrcptr to source address
countnumber of bytes to copy
Returns:
nothing. src, dest - point 1 past end of data
See also:
sli_memcpy

Definition at line 84 of file mem.c.

float mem_getFloat ( PmMemSpace_t  memspace,
uint8_t const **  paddr 
)

Returns the 4-byte float at the given address in memspace.

Float obtained in LITTLE ENDIAN order (per Python convention). afterward, addr points one byte past the float.

Parameters:
memspacememory space
paddrptr to address
Returns:
float from memory. addr - points one byte past the word

Definition at line 50 of file mem.c.

uint32_t mem_getInt ( PmMemSpace_t  memspace,
uint8_t const **  paddr 
)

Returns the 4-byte int at the given address in memspace.

Int obtained in LITTLE ENDIAN order (per Python convention). afterward, addr points one byte past the int.

Parameters:
memspacememory space
paddrptr to address
Returns:
int from memory. addr - points one byte past the word

Definition at line 38 of file mem.c.

uint16_t mem_getStringLength ( PmMemSpace_t  memspace,
uint8_t const *const   pstr 
)

Returns the number of bytes in the C string pointed to by pstr.

Does not modify pstr

Parameters:
memspacememory space/type of source
pstrptr to source C string
Returns:
Number of bytes in the string.

Definition at line 113 of file mem.c.

uint16_t mem_getWord ( PmMemSpace_t  memspace,
uint8_t const **  paddr 
)

Returns the 2-byte word at the given address in memspace.

Word obtained in LITTLE ENDIAN order (per Python convention). afterward, addr points one byte past the word.

Parameters:
memspacememory space
paddrptr to address
Returns:
word from memory. addr - points one byte past the word

Definition at line 27 of file mem.c.