hollyhock
Loading...
Searching...
No Matches
mcs.h File Reference

Functions for retrieving and setting data in the MCS. More...

#include <stdint.h>
Include dependency graph for mcs.h:

Go to the source code of this file.

Classes

struct  OBCD
struct  CBCD

Macros

#define __UCONCAT(a, b)
#define _UCONCAT(a, b)
#define UCONCAT(b)
#define cstr(x)
#define ro(...)
#define rw(...)
#define wo(...)
#define wu   __attribute__((warn_unused_result))
#define inline   inline __attribute__((always_inline))
#define GET_BCD_DIGIT(n, i)

Enumerations

enum  MCS_VariableType {
  VARTYPE_OBCD = 0x01 , VARTYPE_CBCD = 0x02 , VARTYPE_STR = 0x05 , VARTYPE_LIST = 0x0A ,
  VARTYPE_MAT = 0x0C , VARTYPE_PRGM = 0x47 , VARTYPE_FUNC = 0x48 , VARTYPE_GEO = 0x54
}
enum  MCS_Error {
  MCS_OK = 0x00 , MCS_NO_VARIABLE = 0x30 , MCS_NO_FOLDER = 0x40 , MCS_FOLDER_EXISTS = 0x42 ,
  MCS_SIZE_NOT_PO2 = 0x61 , MCS_NOT_LIST = 0x62 , MCS_INDEX_OOB = 0x63
}

Functions

return MCS_List_CreateU (folder, name, size, length,(uint8_t) variableType)
static wu const char uint32_t uint16_t enum MCS_VariableType variableType MCS_Error static wu enum MCS_Error MCS_List_Set (const char *folder, const char *name, uint32_t size, unsigned int index, enum MCS_VariableType variableType, void *data)
enum MCS_Error static wu enum MCS_Error MCS_SetVariable (const char *folder, const char *name, enum MCS_VariableType variableType, uint32_t size, void *data)

Variables

enum MCS_Error(* MCS_CreateFolder )(const char *folder, uint8_t *folderIndex) wu cstr(1)
enum MCS_Error(* MCS_GetVariableU )(const char *folder, const char *name, uint8_t *variableType, char **name2, void **data, uint32_t *size) __asm__(UCONCAT("MCS_GetVariable")) wu cstr(1) cstr(2) ro(1) ro(2) wo(3) wo(4) wo(5)
static wu const char * name
static wu const char enum MCS_VariableType * variableType
static wu const char enum MCS_VariableType char ** name2
static wu const char enum MCS_VariableType char void ** data
static wu const char enum MCS_VariableType char void uint32_t * size
enum MCS_Error(* MCS_List_CreateU )(const char *folder, const char *name, uint32_t size, uint16_t length, uint8_t variableType) __asm__(UCONCAT("MCS_List_Create")) wu cstr(1) cstr(2) ro(1) ro(2)
static wu const char uint32_t uint16_t length
static wu const char uint32_t uint16_t enum MCS_VariableType variableType MCS_Error(* MCS_List_SetU )(const char *folder, const char *name, uint32_t size, unsigned int index, uint8_t variableType, void *data) __asm__(UCONCAT("MCS_List_Set")) wu cstr(1) cstr(2) ro(1) ro(2) ro(6
enum MCS_Error(* MCS_SetVariableU )(const char *folder, const char *name, uint8_t variableType, uint32_t size, void *data) __asm__(UCONCAT("MCS_SetVariable")) wu cstr(1) cstr(2) ro(1) ro(2) ro(5

Detailed Description

Functions for retrieving and setting data in the MCS.

Macro Definition Documentation

◆ __UCONCAT

#define __UCONCAT ( a,
b )
Value:
#a b

◆ _UCONCAT

#define _UCONCAT ( a,
b )
Value:
__UCONCAT(a, b)

◆ cstr

#define cstr ( x)
Value:
__attribute__((null_terminated_string_arg(x)))

◆ GET_BCD_DIGIT

#define GET_BCD_DIGIT ( n,
i )
Value:
(((n) >> ((i) * 4)) & 0xF)

Retrieves the BCD digit at position i (0 representing the least significant place) from a BCD encoded number n.

Parameters
nThe number to retrieve a digit from.
iThe index of the digit to retrieve.

◆ ro

#define ro ( ...)
Value:
__attribute__((access(read_only, __VA_ARGS__)))

◆ rw

#define rw ( ...)
Value:
__attribute__((access(read_write, __VA_ARGS__)))

◆ UCONCAT

#define UCONCAT ( b)
Value:
_UCONCAT(__USER_LABEL_PREFIX__, b)

◆ wo

#define wo ( ...)
Value:
__attribute__((access(write_only, __VA_ARGS__)))

Enumeration Type Documentation

◆ MCS_Error

enum MCS_Error
Enumerator
MCS_NO_VARIABLE 

Error code signaling that the variable does not exist.

MCS_NO_FOLDER 

Error code signaling that the folder does not exist.

MCS_FOLDER_EXISTS 

Error code signaling that the folder already exists.

MCS_SIZE_NOT_PO2 

Error code signaling that the specified size was not a power of 2.

MCS_NOT_LIST 

Error code signaling that the variable was not a list.

MCS_INDEX_OOB 

Error code signaling that the index was out of bounds.

◆ MCS_VariableType

Enumerator
VARTYPE_OBCD 

Variable type: OBCD (struct OBCD).

VARTYPE_CBCD 

Variable type: CBCD (struct CBCD).

VARTYPE_STR 

Variable type: null-terminated string.

VARTYPE_LIST 

Variable type: list.

VARTYPE_MAT 

Variable type: matrix.

VARTYPE_PRGM 

Variable type: program.

VARTYPE_FUNC 

Variable type: function.

VARTYPE_GEO 

Variable type: geometry data.

Variable Documentation

◆ MCS_CreateFolder

enum MCS_Error(* MCS_CreateFolder) (const char *folder, uint8_t *folderIndex) wu cstr(1) ( const char * folder,
uint8_t * folderIndex )
extern

Creates a folder in the MCS.

If the folder name is greater than the 8 character max, it is truncated to a valid length.

The folderIndex parameter is still populated if the folder already exists. However, its purpose is currently unknown.

Parameters
[in]folderThe name of the folder to create.
[out]folderIndexAn unknown index for the folder.
Returns
0 if the folder was created successfully, or MCS_FOLDER_EXISTS if the folder already exists.

◆ size

wu const char uint32_t size
Initial value:
{
return MCS_GetVariableU(folder, name, (uint8_t *)variableType, name2, data, size)