| 
    PHiLIP
    
   | 
 
Files | |
| file | app_common.h | 
| For common application functions.  | |
| file | app_reg.h | 
| Accessing application registers.  | |
| file | app_shell_if.h | 
| Protocol for application communication.  | |
| file | map_if.h | 
| Handles memory map specific interface functions.  | |
| file | app_common.c | 
| For common application functions.  | |
| file | app_reg.c | 
| Accessing application registers.  | |
| file | app_shell_if.c | 
| Protocol for application communication.  | |
| file | map_if.c | 
| Handles memory map specific interface functions.  | |
Macros | |
| #define | DIS_INT __disable_irq(); | 
| Disables interrupts.  | |
| #define | EN_INT __enable_irq(); | 
| Enables interrupts.  | |
| #define | SOFT_RESET soft_reset() | 
| Resets device.  More... | |
| #define | TICK_BIT_OFFSET 16 | 
| Bit shifting ticks.  | |
| #define | RX_END_CHAR '\n' | 
| Parse on newline.  | |
| #define | TX_END_STR "\n" | 
| Send newline at end of transmission.  | |
| #define | READ_REG_CMD "rr " | 
| The command to read application registers.  | |
| #define | WRITE_REG_CMD "wr " | 
| The command to write application registers.  | |
| #define | EXECUTE_CMD "ex\n" | 
| The command to execute and commit changes in the registers.  | |
| #define | RESET_CMD "mcu_rst\n" | 
| The command to provide a software reset to the applications.  | |
| #define | VERSION_CMD "-v\n" | 
| Prints the version of the interface.  | |
| #define | VERSION_CMD2 "version\n" | 
| Prints the version of the interface.  | |
| #define | VERSION_CMD3 "ver\n" | 
| Prints the version of the interface.  | |
| #define | VERSION_CMD4 "--v\n" | 
| Prints the version of the interface.  | |
| #define | HELP_CMD "help\n" | 
| Prints a help menu.  | |
| #define | MEMORY_MAP_CMD "mm " | 
| Gives properties of the memory map for a given index.  | |
| #define | MM_SIZE_CMD "mm_size\n" | 
| Gives the amount of records in the memory map.  | |
| #define | READ_KEY_CMD "r " | 
| Reads values given a record name.  | |
| #define | WRITE_KEY_CMD "w " | 
| Writes a value to a record name.  | |
Functions | |
| void | delay_us (uint16_t micros) | 
| Imprecise blocking delay in microseconds.  More... | |
| void | copy_until_same (void *dest, void *src, size_t size) | 
| Copies and compares data until copied data matches.  More... | |
| void | soft_reset () | 
| Wrapper function to provide software reset.  | |
| uint64_t | get_tick () | 
| Gets tick value in amount to system tick (72 MHz).  | |
| uint32_t | get_tick32 () | 
| Gets tick value in amount to system tick (72 MHz) in 32bit.  | |
| uint32_t | get_tick32_div (uint8_t div) | 
| Gets 32 bit tick shifted down by an amount.  More... | |
| void | init_app_reg (map_t *reg) | 
| Initializes application registers.  More... | |
| error_t | execute_reg_change () | 
| Executes or commits all register changes on the periphs.  More... | |
| uint32_t | get_reg_size () | 
| Gets the total size of the register map in bytes.  More... | |
| void | unprotected_read_uint8 (uint32_t index, uint8_t *data) | 
| An unprotected read from the register map.  More... | |
| error_t | read_reg (uint32_t index, uint8_t *data) | 
| Reads a register from the register map.  More... | |
| error_t | read_regs (uint32_t index, uint8_t *data, uint16_t size) | 
| Reads multiple registers from the register map.  More... | |
| error_t | write_reg (uint32_t index, uint8_t data, uint8_t access) | 
| Writes a register from the register map.  More... | |
| error_t | write_regs (uint32_t index, uint8_t *data, uint16_t size, uint8_t access) | 
| Writes multiple register from the register map.  More... | |
| void | add_index (uint16_t *i) | 
| Adds a number and wraps around if register size exceeded.  More... | |
| void | sub_index (uint16_t *i) | 
| Subtracts a number and wraps around if 0.  More... | |
| error_t | parse_command (char *str, uint16_t buf_size, uint8_t access) | 
| Parses a string and executes commands.  More... | |
| error_t | get_mm (uint16_t index, char *str) | 
| Gets parameters of a record in the memory map.  More... | |
| error_t | get_mm_val (char *mm_name, uint32_t array_index, uint32_t *data) | 
| Gets the value of a record in the memory map.  More... | |
| error_t | set_mm_val (char *mm_name, uint32_t array_index, uint32_t data, uint8_t access) | 
| Sets the value of a record in the memory map.  More... | |
| #define SOFT_RESET soft_reset() | 
Resets device.
| void add_index | ( | uint16_t * | i | ) | 
Adds a number and wraps around if register size exceeded.
| [in,out] | i | index to increment | 
| void copy_until_same | ( | void * | dest, | 
| void * | src, | ||
| size_t | size | ||
| ) | 
Copies and compares data until copied data matches.
| [out] | dest | Destination address to copy to | 
| [in] | src | Source address to copy | 
| [in] | size | Size of bytes to copy | 
| void delay_us | ( | uint16_t | micros | ) | 
Imprecise blocking delay in microseconds.
| [in] | micros | Number of microseconds to delay | 
| error_t execute_reg_change | ( | ) | 
Executes or commits all register changes on the periphs.
| error_t get_mm | ( | uint16_t | index, | 
| char * | str | ||
| ) | 
Gets parameters of a record in the memory map.
| [in] | index | index of the record to get | 
| [out] | str | string to put the record information | 
| error_t get_mm_val | ( | char * | mm_name, | 
| uint32_t | array_index, | ||
| uint32_t * | data | ||
| ) | 
Gets the value of a record in the memory map.
| [in] | mm_name | name of the record | 
| [in] | array_index | index if the record is an array | 
| [out] | data | data from the record | 
| uint32_t get_reg_size | ( | ) | 
Gets the total size of the register map in bytes.
| uint32_t get_tick32_div | ( | uint8_t | div | ) | 
Gets 32 bit tick shifted down by an amount.
| [in] | div | Divisor, divide ticks by 2^n | 
| void init_app_reg | ( | map_t * | reg | ) | 
Initializes application registers.
| [in] | reg | Pointer to register memory map | 
| error_t parse_command | ( | char * | str, | 
| uint16_t | buf_size, | ||
| uint8_t | access | ||
| ) | 
Parses a string and executes commands.
| [in] | str | String with the command | 
| [in] | buf_size | The max size of the string buffer | 
| [in] | access | The callers access level | 
| error_t read_reg | ( | uint32_t | index, | 
| uint8_t * | data | ||
| ) | 
Reads a register from the register map.
| [in] | index | The index of the register map to start to read | 
| [out] | data | Pointer to data that was read | 
| error_t read_regs | ( | uint32_t | index, | 
| uint8_t * | data, | ||
| uint16_t | size | ||
| ) | 
Reads multiple registers from the register map.
| [in] | index | The index of the register map to start to read | 
| [out] | data | Pointer to data that was read | 
| [in] | size | The amount of bytes to read | 
| error_t set_mm_val | ( | char * | mm_name, | 
| uint32_t | array_index, | ||
| uint32_t | data, | ||
| uint8_t | access | ||
| ) | 
Sets the value of a record in the memory map.
| [in] | mm_name | name of the record | 
| [in] | array_index | index if the record is an array | 
| [in] | data | data for the record | 
| [in] | access | access level of the calling function | 
| void sub_index | ( | uint16_t * | i | ) | 
Subtracts a number and wraps around if 0.
| [in,out] | i | index to decrement | 
| void unprotected_read_uint8 | ( | uint32_t | index, | 
| uint8_t * | data | ||
| ) | 
An unprotected read from the register map.
| [in] | index | The index of the register map to start to read | 
| [out] | data | Pointer to data that was read | 
This is a direct read from the register without any protection, the purpose is for speed. This should also be used for entering data directly to hardware registers.
| error_t write_reg | ( | uint32_t | index, | 
| uint8_t | data, | ||
| uint8_t | access | ||
| ) | 
Writes a register from the register map.
| [in] | index | The index of the register map to start to write | 
| [out] | data | Pointer to data that was write | 
| [in] | access | The access level of the caller | 
| error_t write_regs | ( | uint32_t | index, | 
| uint8_t * | data, | ||
| uint16_t | size, | ||
| uint8_t | access | ||
| ) | 
Writes multiple register from the register map.
| [in] | index | The index of the register map to start to write | 
| [out] | data | Pointer to data that was write | 
| [in] | size | The amount of bytes to write | 
| [in] | access | The access level of the caller |