LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
c_memory.c File Reference
#include "lms2012.h"
#include "c_memory.h"
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.

Data Structures

struct  FOLDER
 

Macros

#define snprintf   _snprintf
 

Enumerations

enum  { OPEN_FOR_WRITE = 1, OPEN_FOR_APPEND = 2, OPEN_FOR_READ = 3, OPEN_FOR_LOG = 4 }
 
enum  {
  SORT_NONE, SORT_PRJS, SORT_APPS, SORT_TOOLS,
  SORT_TYPES
}
 

Functions

void setMemoryInstance (MEMORY_GLOBALS *_Instance)
 
MEMORY_GLOBALSgetMemoryInstance ()
 
void cMemoryGetUsage (DATA32 *pTotal, DATA32 *pFree, DATA8 Force)
 
RESULT cMemoryMalloc (void **ppMemory, DATA32 Size)
 
RESULT cMemoryRealloc (void *pOldMemory, void **ppMemory, DATA32 Size)
 
RESULT cMemoryAlloc (PRGID PrgId, DATA8 Type, GBINDEX Size, void **pMemory, HANDLER *pHandle)
 
void * cMemoryReallocate (PRGID PrgId, HANDLER Handle, GBINDEX Size)
 
RESULT cMemoryGetPointer (PRGID PrgId, HANDLER Handle, void **pMemory)
 
RESULT cMemoryArraryPointer (PRGID PrgId, HANDLER Handle, void **pMemory)
 
DSPSTAT cMemoryFreeHandle (PRGID PrgId, HANDLER Handle)
 
void cMemoryFreePool (PRGID PrgId, void *pMemory)
 
void cMemoryFreeProgram (PRGID PrgId)
 
void cMemoryFreeAll (void)
 
RESULT cMemoryInit (void)
 
RESULT cMemoryOpen (PRGID PrgId, GBINDEX Size, void **pMemory)
 
RESULT cMemoryClose (PRGID PrgId)
 
RESULT cMemoryExit (void)
 
void * cMemoryResize (PRGID PrgId, HANDLER TmpHandle, DATA32 Elements)
 
void FindName (char *pSource, char *pPath, char *pName, char *pExt)
 
RESULT cMemoryCheckFilename (char *pFilename, char *pPath, char *pName, char *pExt)
 
RESULT ConstructFilename (PRGID PrgId, char *pFilename, char *pName, char *pDefaultExt)
 
int FindDot (char *pString)
 
void cMemoryDeleteCacheFile (char *pFileName)
 
int cMemorySort (void *ppFirst, void *ppSecond)
 
DATA8 cMemoryFindSubFolders (char *pFolderName)
 
DATA8 cMemoryFindType (char *pExt)
 
DATA8 cMemoryGetSubFolderName (DATA8 Item, DATA8 MaxLength, char *pFolderName, char *pSubFolderName)
 
void cMemoryDeleteSubFolders (char *pFolderName)
 
DATA32 cMemoryFindSize (char *pFolderName, DATA32 *pFiles)
 
DATA8 cMemoryGetCacheName (DATA8 Item, DATA8 MaxLength, char *pFileName, char *pName)
 
DATA8 cMemoryGetCacheFiles (void)
 
DATA8 cMemoryFindFiles (char *pFolderName)
 
void cMemoryGetResourcePath (PRGID PrgId, char *pString, DATA8 MaxLength)
 
RESULT cMemoryGetIcon (DATA8 *pFolderName, DATA8 Item, DATA32 *pImagePointer)
 
void cMemoryFilename (PRGID PrgId, char *pName, char *pExt, DATA8 Length, char *pResult)
 
DSPSTAT cMemoryGetFileHandle (PRGID PrgId, char *pFileName, HANDLER *pHandle, DATA8 *pOpenForWrite)
 
RESULT cMemoryCheckOpenWrite (char *pFileName)
 
DSPSTAT cMemoryOpenFile (PRGID PrgId, DATA8 Access, char *pFileName, HANDLER *pHandle, DATA32 *pSize)
 
DSPSTAT cMemoryWriteFile (PRGID PrgId, HANDLER Handle, DATA32 Size, DATA8 Del, DATA8 *pSource)
 
DSPSTAT cMemoryReadFile (PRGID PrgId, HANDLER Handle, DATA32 Size, DATA8 Del, DATA8 *pDestination)
 
DSPSTAT cMemoryCloseFile (PRGID PrgId, HANDLER Handle)
 
void cMemoryFindLogName (PRGID PrgId, char *pName)
 
RESULT cMemoryGetImage (DATA8 *pFileName, DATA16 Size, UBYTE *pBmp)
 
RESULT cMemoryGetMediaName (char *pChar, char *pName)
 
void cMemorySortEntry (FOLDER *pMemory, UBYTE Type, char *pName)
 
void cMemorySortList (FOLDER *pMemory)
 
RESULT cMemoryOpenFolder (PRGID PrgId, DATA8 Type, DATA8 *pFolderName, HANDLER *pHandle)
 
RESULT cMemoryGetFolderItems (PRGID PrgId, HANDLER Handle, DATA16 *pItems)
 
RESULT cMemoryGetItemName (PRGID PrgId, HANDLER Handle, DATA16 Item, DATA8 Length, DATA8 *pName, DATA8 *pType, DATA8 *pPriority)
 
RESULT cMemoryGetItemIcon (PRGID PrgId, HANDLER Handle, DATA16 Item, HANDLER *pHandle, DATA32 *pImagePointer)
 
RESULT cMemoryGetItemText (PRGID PrgId, HANDLER Handle, DATA16 Item, DATA8 Length, DATA8 *pText)
 
RESULT cMemorySetItemText (PRGID PrgId, HANDLER Handle, DATA16 Item, DATA8 *pText)
 
RESULT cMemoryGetItem (PRGID PrgId, HANDLER Handle, DATA16 Item, DATA8 Length, DATA8 *pName, DATA8 *pType)
 
void cMemoryCloseFolder (PRGID PrgId, HANDLER *pHandle)
 
void cMemoryFile (void)
 opFILE byte code More...
 
void cMemoryArray (void)
 opARRAY byte code More...
 
void cMemoryArrayWrite (void)
 opARRAY_WRITE byte code More...
 
void cMemoryArrayRead (void)
 opARRAY_READ byte code More...
 
void cMemoryArrayAppend (void)
 opARRAY_APPEND byte code More...
 
void cMemoryUsage (void)
 opMEMORY_USAGE byte code More...
 
void cMemoryFileName (void)
 opFILENAME byte code More...
 

Variables

MEMORY_GLOBALSgMemoryInstance
 
DATA8 NoOfFavourites [SORT_TYPES]
 
DATA8 FavouriteExts [FILETYPES]
 
char * pFavourites [SORT_TYPES][8]
 

Macro Definition Documentation

#define snprintf   _snprintf

Definition at line 75 of file c_memory.c.

Enumeration Type Documentation

anonymous enum
Enumerator
OPEN_FOR_WRITE 
OPEN_FOR_APPEND 
OPEN_FOR_READ 
OPEN_FOR_LOG 

Definition at line 1146 of file c_memory.c.

anonymous enum
Enumerator
SORT_NONE 
SORT_PRJS 
SORT_APPS 
SORT_TOOLS 
SORT_TYPES 

Definition at line 1552 of file c_memory.c.

Function Documentation

RESULT cMemoryAlloc ( PRGID  PrgId,
DATA8  Type,
GBINDEX  Size,
void **  pMemory,
HANDLER pHandle 
)

Definition at line 174 of file c_memory.c.

RESULT cMemoryArraryPointer ( PRGID  PrgId,
HANDLER  Handle,
void **  pMemory 
)

Definition at line 277 of file c_memory.c.

void cMemoryArray ( void  )

opARRAY byte code

Definition at line 3392 of file c_memory.c.

void cMemoryArrayAppend ( void  )

opARRAY_APPEND byte code

Definition at line 4134 of file c_memory.c.

void cMemoryArrayRead ( void  )

opARRAY_READ byte code

Definition at line 4047 of file c_memory.c.

void cMemoryArrayWrite ( void  )

opARRAY_WRITE byte code

Definition at line 3935 of file c_memory.c.

RESULT cMemoryCheckFilename ( char *  pFilename,
char *  pPath,
char *  pName,
char *  pExt 
)

Definition at line 552 of file c_memory.c.

RESULT cMemoryCheckOpenWrite ( char *  pFileName)

Definition at line 1199 of file c_memory.c.

RESULT cMemoryClose ( PRGID  PrgId)

Definition at line 437 of file c_memory.c.

DSPSTAT cMemoryCloseFile ( PRGID  PrgId,
HANDLER  Handle 
)

Definition at line 1421 of file c_memory.c.

void cMemoryCloseFolder ( PRGID  PrgId,
HANDLER pHandle 
)

Definition at line 2064 of file c_memory.c.

void cMemoryDeleteCacheFile ( char *  pFileName)

Definition at line 687 of file c_memory.c.

void cMemoryDeleteSubFolders ( char *  pFolderName)

Definition at line 911 of file c_memory.c.

RESULT cMemoryExit ( void  )

Definition at line 448 of file c_memory.c.

void cMemoryFile ( void  )

opFILE byte code

Definition at line 2303 of file c_memory.c.

void cMemoryFilename ( PRGID  PrgId,
char *  pName,
char *  pExt,
DATA8  Length,
char *  pResult 
)

Definition at line 1115 of file c_memory.c.

void cMemoryFileName ( void  )

opFILENAME byte code

Definition at line 4347 of file c_memory.c.

DATA8 cMemoryFindFiles ( char *  pFolderName)

Definition at line 1038 of file c_memory.c.

void cMemoryFindLogName ( PRGID  PrgId,
char *  pName 
)

Definition at line 1452 of file c_memory.c.

DATA32 cMemoryFindSize ( char *  pFolderName,
DATA32 pFiles 
)

Definition at line 951 of file c_memory.c.

DATA8 cMemoryFindSubFolders ( char *  pFolderName)

Definition at line 763 of file c_memory.c.

DATA8 cMemoryFindType ( char *  pExt)

Definition at line 794 of file c_memory.c.

void cMemoryFreeAll ( void  )

Definition at line 364 of file c_memory.c.

DSPSTAT cMemoryFreeHandle ( PRGID  PrgId,
HANDLER  Handle 
)

Definition at line 292 of file c_memory.c.

void cMemoryFreePool ( PRGID  PrgId,
void *  pMemory 
)

Definition at line 334 of file c_memory.c.

void cMemoryFreeProgram ( PRGID  PrgId)

Definition at line 350 of file c_memory.c.

DATA8 cMemoryGetCacheFiles ( void  )

Definition at line 1021 of file c_memory.c.

DATA8 cMemoryGetCacheName ( DATA8  Item,
DATA8  MaxLength,
char *  pFileName,
char *  pName 
)

Definition at line 986 of file c_memory.c.

DSPSTAT cMemoryGetFileHandle ( PRGID  PrgId,
char *  pFileName,
HANDLER pHandle,
DATA8 pOpenForWrite 
)

Definition at line 1155 of file c_memory.c.

RESULT cMemoryGetFolderItems ( PRGID  PrgId,
HANDLER  Handle,
DATA16 pItems 
)

Definition at line 1742 of file c_memory.c.

RESULT cMemoryGetIcon ( DATA8 pFolderName,
DATA8  Item,
DATA32 pImagePointer 
)

Definition at line 1071 of file c_memory.c.

RESULT cMemoryGetImage ( DATA8 pFileName,
DATA16  Size,
UBYTE pBmp 
)

Definition at line 1480 of file c_memory.c.

RESULT cMemoryGetItem ( PRGID  PrgId,
HANDLER  Handle,
DATA16  Item,
DATA8  Length,
DATA8 pName,
DATA8 pType 
)

Definition at line 2023 of file c_memory.c.

RESULT cMemoryGetItemIcon ( PRGID  PrgId,
HANDLER  Handle,
DATA16  Item,
HANDLER pHandle,
DATA32 pImagePointer 
)

Definition at line 1869 of file c_memory.c.

RESULT cMemoryGetItemName ( PRGID  PrgId,
HANDLER  Handle,
DATA16  Item,
DATA8  Length,
DATA8 pName,
DATA8 pType,
DATA8 pPriority 
)

Definition at line 1815 of file c_memory.c.

RESULT cMemoryGetItemText ( PRGID  PrgId,
HANDLER  Handle,
DATA16  Item,
DATA8  Length,
DATA8 pText 
)

Definition at line 1921 of file c_memory.c.

RESULT cMemoryGetMediaName ( char *  pChar,
char *  pName 
)

Definition at line 1504 of file c_memory.c.

RESULT cMemoryGetPointer ( PRGID  PrgId,
HANDLER  Handle,
void **  pMemory 
)

Definition at line 252 of file c_memory.c.

void cMemoryGetResourcePath ( PRGID  PrgId,
char *  pString,
DATA8  MaxLength 
)

Definition at line 1065 of file c_memory.c.

DATA8 cMemoryGetSubFolderName ( DATA8  Item,
DATA8  MaxLength,
char *  pFolderName,
char *  pSubFolderName 
)

Definition at line 852 of file c_memory.c.

void cMemoryGetUsage ( DATA32 pTotal,
DATA32 pFree,
DATA8  Force 
)

Definition at line 104 of file c_memory.c.

RESULT cMemoryInit ( void  )

Definition at line 375 of file c_memory.c.

RESULT cMemoryMalloc ( void **  ppMemory,
DATA32  Size 
)

Definition at line 140 of file c_memory.c.

RESULT cMemoryOpen ( PRGID  PrgId,
GBINDEX  Size,
void **  pMemory 
)

Definition at line 426 of file c_memory.c.

DSPSTAT cMemoryOpenFile ( PRGID  PrgId,
DATA8  Access,
char *  pFileName,
HANDLER pHandle,
DATA32 pSize 
)

Definition at line 1219 of file c_memory.c.

RESULT cMemoryOpenFolder ( PRGID  PrgId,
DATA8  Type,
DATA8 pFolderName,
HANDLER pHandle 
)

Definition at line 1690 of file c_memory.c.

DSPSTAT cMemoryReadFile ( PRGID  PrgId,
HANDLER  Handle,
DATA32  Size,
DATA8  Del,
DATA8 pDestination 
)

Definition at line 1343 of file c_memory.c.

RESULT cMemoryRealloc ( void *  pOldMemory,
void **  ppMemory,
DATA32  Size 
)

Definition at line 160 of file c_memory.c.

void* cMemoryReallocate ( PRGID  PrgId,
HANDLER  Handle,
GBINDEX  Size 
)

Definition at line 216 of file c_memory.c.

void* cMemoryResize ( PRGID  PrgId,
HANDLER  TmpHandle,
DATA32  Elements 
)

Definition at line 468 of file c_memory.c.

RESULT cMemorySetItemText ( PRGID  PrgId,
HANDLER  Handle,
DATA16  Item,
DATA8 pText 
)

Definition at line 1982 of file c_memory.c.

int cMemorySort ( void *  ppFirst,
void *  ppSecond 
)

Definition at line 719 of file c_memory.c.

void cMemorySortEntry ( FOLDER pMemory,
UBYTE  Type,
char *  pName 
)

Definition at line 1588 of file c_memory.c.

void cMemorySortList ( FOLDER pMemory)

Definition at line 1671 of file c_memory.c.

void cMemoryUsage ( void  )

opMEMORY_USAGE byte code

Definition at line 4257 of file c_memory.c.

DSPSTAT cMemoryWriteFile ( PRGID  PrgId,
HANDLER  Handle,
DATA32  Size,
DATA8  Del,
DATA8 pSource 
)

Definition at line 1301 of file c_memory.c.

RESULT ConstructFilename ( PRGID  PrgId,
char *  pFilename,
char *  pName,
char *  pDefaultExt 
)

Definition at line 633 of file c_memory.c.

int FindDot ( char *  pString)

Definition at line 670 of file c_memory.c.

void FindName ( char *  pSource,
char *  pPath,
char *  pName,
char *  pExt 
)

Definition at line 496 of file c_memory.c.

MEMORY_GLOBALS* getMemoryInstance ( )

Definition at line 86 of file c_memory.c.

void setMemoryInstance ( MEMORY_GLOBALS _Instance)

Definition at line 81 of file c_memory.c.

Variable Documentation

DATA8 FavouriteExts[FILETYPES]
Initial value:
=
{
[TYPE_BYTECODE] = 1,
[TYPE_SOUND] = 2,
[TYPE_GRAPHICS] = 3,
[TYPE_TEXT] = 4,
}

Definition at line 1570 of file c_memory.c.

MEMORY_GLOBALS* gMemoryInstance

Definition at line 79 of file c_memory.c.

DATA8 NoOfFavourites[SORT_TYPES]
Initial value:
=
{
0,
6,
5,
8
}

Definition at line 1562 of file c_memory.c.

char* pFavourites[SORT_TYPES][8]
Initial value:
=
{
{ },
{ "", "BrkProg_SAVE", "BrkDL_SAVE", "SD_Card", "USB_Stick", "TEST" },
{ "Port View", "Motor Control", "IR Control", "Brick Program", "Brick Datalog" },
{ "Volume", "Sleep", "Bluetooth", "WiFi", "Brick Info", "Test", "Performance", "Debug" }
}

Definition at line 1578 of file c_memory.c.