nmc-utils  0.1.1
Core library API

Functions

int easynmc_startupcode_is_compatible (uint32_t codever)
enum easynmc_core_state easynmc_core_state (struct easynmc_handle *h)
const char * easynmc_state_name (enum easynmc_core_state state)
int easynmc_get_core_name (struct easynmc_handle *h, char *str)
int easynmc_get_core_type (struct easynmc_handle *h, char *str)
int easynmc_send_irq (struct easynmc_handle *h, enum nmc_irq irq)
int easynmc_reset_stats (struct easynmc_handle *h)
void easynmc_reset_core (struct easynmc_handle *h)
char * easynmc_get_default_ipl (char *name, int debug)
struct easynmc_handleeasynmc_open_noboot (int coreid, int exclusive)
int easynmc_boot_core (struct easynmc_handle *h, int debug)
 Bring up an NMC core, optionally with a debug IPL.

Variables

char * iplpaths []

Detailed Description

This section contains lower level API functions.

Function Documentation

int easynmc_boot_core ( struct easynmc_handle h,
int  debug 
)

Bring up an NMC core, optionally with a debug IPL.

This function is called internally by easynmc_open(), so normally you do not need to ever call it.

Debug version of IPL comes with some board-specific debugging functionality. On MB77.07 this involves blinking a LED while nmc is running IPL.

Parameters
h
debugset to '1' if you need a 'debug' IPL.
Returns

Definition at line 373 of file easynmc-core.c.

References dbg, EASYNMC_CORE_COLD, EASYNMC_CORE_IDLE, easynmc_evt_name(), easynmc_get_core_name(), easynmc_get_default_ipl(), easynmc_load_abs(), easynmc_reset_core(), easynmc_send_irq(), easynmc_token_new(), easynmc_token_wait(), err, easynmc_handle::imem32, NMC_REG_ISR_ON_START, and easynmc_token::tok.

Referenced by do_boot_core(), do_load_abs(), and easynmc_open().

int easynmc_get_core_name ( struct easynmc_handle h,
char *  str 
)

Returns the nmc core name

Parameters
h
str
Returns

Definition at line 155 of file easynmc-core.c.

References easynmc_handle::iofd.

Referenced by easynmc_boot_core().

int easynmc_get_core_type ( struct easynmc_handle h,
char *  str 
)

Returns the easynmc core type

Parameters
h
str
Returns

Definition at line 167 of file easynmc-core.c.

References easynmc_handle::iofd.

char* easynmc_get_default_ipl ( char *  name,
int  debug 
)

Returns the path to the default ipl file. if debug is '1' a path to an IPL with board-specific debugging functionality is returned.

Parameters
name
debug
Returns

Definition at line 235 of file easynmc-core.c.

References ARRAY_SIZE, and dbg.

Referenced by easynmc_boot_core().

struct easynmc_handle* easynmc_open_noboot ( int  coreid,
int  exclusive 
)
read

Open a Neuromatrix core skipping the usual initialization. Opening a NeuroMatrix core with easynmc_open_noboot() will try to acquire an exclusive lock if 'exclusive' is 1. Killing the userspace application that has the lock automatically releases the core.

easynmc_open_noboot() doesn't guarantee that the core returned will be in 'idle' state.

Parameters
coreidNumber of the core or EASYNMC_CORE_ANY to get first unused one
exclusive.Attempt to get exlusive access to the NMC core
Returns

Definition at line 284 of file easynmc-core.c.

References easynmc_handle::appid, dbg, EASYNMC_CORE_ANY, easynmc_for_each_core(), easynmc_init_default_filters(), err, easynmc_handle::id, easynmc_handle::imem, easynmc_handle::imem32, easynmc_handle::imem_size, easynmc_handle::iofd, easynmc_handle::memfd, easynmc_handle::persistent, and easynmc_handle::sfilters.

Referenced by easynmc_for_each_core(), and easynmc_open().

void easynmc_reset_core ( struct easynmc_handle h)

Reset a Neuromatrix Core

Parameters
h

Definition at line 204 of file easynmc-core.c.

References easynmc_handle::iofd.

Referenced by easynmc_boot_core().

int easynmc_reset_stats ( struct easynmc_handle h)

Reset internal IRQ statistics.

WARNING: Never call this when there are any active waits on tokens or when there's somebody polling nmc. Bad things WILL happen.

Parameters
h
Returns

Definition at line 193 of file easynmc-core.c.

References easynmc_handle::iofd.

Referenced by do_reset_stats().

int easynmc_send_irq ( struct easynmc_handle h,
enum nmc_irq  irq 
)

Send an irq to the nmc core.

Parameters
h
irq
Returns

Definition at line 179 of file easynmc-core.c.

References easynmc_handle::iofd.

Referenced by do_irq(), easynmc_boot_core(), and easynmc_stop_app().

int easynmc_startupcode_is_compatible ( uint32_t  codever)

Checks if the startup code version is compatible with this library version

Parameters
codever
Returns
1 - compatible, 0 - not compatible

Definition at line 81 of file easynmc-core.c.

References ARRAY_SIZE.

Referenced by do_dump_core_info(), and easynmc_core_state().

const char* easynmc_state_name ( enum easynmc_core_state  state)

Transforms enum easynmc_core_state into a human-readable state name

Parameters
state
Returns

Definition at line 141 of file easynmc-core.c.

References EASYNMC_CORE_INVALID.

Referenced by do_dump_core_info(), easynmc_load_abs(), easynmc_start_app(), and main().

Variable Documentation

char* iplpaths[]
Initial value:
{
"/usr/share/easynmc-" LIBEASYNMC_VERSION "/ipl/ipl-%s%s.abs",
"/usr/local/share/easynmc-" LIBEASYNMC_VERSION "/ipl/ipl-%s%s.abs",
"./ipl-%s.abs"
}

Definition at line 220 of file easynmc-core.c.