Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
|
#include "std.h"
Go to the source code of this file.
Functions | |
void | memory_read_id (void) |
Function sending a request for the ID of the memory chip. More... | |
void | memory_send_wren (void) |
Function sending a request to set the writte enable flag in the memory. More... | |
void | memory_send_wrdi (void) |
Function sending a request to clear the writte enable flag in the memory. More... | |
void | memory_read_status_1 (void) |
Function sending a request to fetch the status Byte of the memory. More... | |
void | memory_read_values (uint32_t mem_addr, uint8_t size) |
Function sending a request to read some values in memory. More... | |
void | memory_write_values (uint32_t mem_addr, uint8_t *values, uint8_t size) |
Function sending a request to write a buffer of values to the memory. More... | |
void | memory_completly_erase (void) |
Function sending a request to erase the entire memory. More... | |
void | memory_erase_4k (uint32_t mem_addr) |
Function sending a request to erase 4KB of the memory. More... | |
uint8_t | ml_write_values_to_memory (uint32_t mem_addr, uint8_t *values, uint8_t size) |
Function writting a buffer of values to the memory. More... | |
uint8_t | ml_erase_4k_on_memory (uint32_t mem_addr) |
Function erasing 4KB of the memory. More... | |
uint8_t | ml_erase_completely_memory (void) |
Function erasing the entire memory. More... | |
void | ml_read_log_in_memory (void) |
Function continuing the reading of the current log in memory. More... | |
uint8_t | append_values_to_memory (uint8_t *values, uint8_t size) |
Function adding a buffer of values to the memory. More... | |
uint8_t | send_buffer_to_memory (uint8_t *buffer, uint8_t *size) |
Function sending a buffer ot the memory. More... | |
void | send_buffer_to_uart (void) |
Function sending the read values from the memory to te UART. More... | |
void | add_byte_to_buffer (uint8_t value) |
Function adding a Byte to the local buffer. More... | |
void | add_array_to_buffer (uint8_t *array, uint8_t size) |
Function adding an array to the local buffer. More... | |
uint8_t | run_memory_management (void) |
Function sending the buffer to the memory when possible. More... | |
uint8_t | are_buffers_empty (void) |
Function returning true if the two local buffers are empty. More... | |
uint8_t | start_new_log (void) |
Function starting a new log. More... | |
void | add_values_to_buffer (void) |
Function adding the configured messages to the buffers of the values to be written in memory. More... | |
void | run_logger (void) |
Funcion called to add the values to log to the buffer with a frequency divider in order to not overflow the buffers. More... | |
uint8_t | end_log (void) |
Function ending the current log. More... | |
void | high_speed_logger_direct_memory_init (void) |
Function initialisating the module. More... | |
void | high_speed_logger_direct_memory_periodic (void) |
Main function of the module. More... | |
uint8_t | is_sequence_in_array (uint8_t *array, uint8_t array_size, uint8_t *sequence, uint8_t sequence_size) |
Function testing if a sequence is in a buffer of values. More... | |
void | high_speed_logger_direct_memory_handler (uint8_t val) |
Function managing the interface with the user. More... | |
Variables | |
uint8_t | logging_status_gui |
Status of the module. More... | |
Definition in file high_speed_logger_direct_memory.h.
Function adding an array to the local buffer.
This function will just add the values sended to the local buffer. The buffer will then be automaticaly written to the memory when possible.
array | the array to add to the buffer |
size | the size of the array to add to the buffer |
Definition at line 853 of file high_speed_logger_direct_memory.c.
References add_byte_to_buffer().
Referenced by end_log(), run_memory_management(), and start_new_log().
void add_byte_to_buffer | ( | uint8_t | value | ) |
Function adding a Byte to the local buffer.
This function will just add the value sended to the local buffer. The buffer will then be automaticaly written to the memory when possible.
value | the value to add to the buffer |
Definition at line 821 of file high_speed_logger_direct_memory.c.
References buffer_used, buffer_values_logged, buffer_values_sending, nbr_lost_values, nbr_values_in_buffer, nbr_values_in_buffer_sending, and value.
Referenced by add_array_to_buffer(), add_values_to_buffer(), run_memory_management(), and start_new_log().
void add_values_to_buffer | ( | void | ) |
Function adding the configured messages to the buffers of the values to be written in memory.
This function will fetch the values of the variables setted in the array values_to_log, and send them to the local buffer to be written in memory
Definition at line 1025 of file high_speed_logger_direct_memory.c.
References add_byte_to_buffer(), NBR_VALUES_TO_LOG, SIZE_OF_LOGGED_VALUES, and values_to_log.
Referenced by run_logger().
Function adding a buffer of values to the memory.
This function is going to take care of writting a buffer of values into the memory. It starts at the address 0x00000000 and will writte after that. It keeps the last written address in memory and will erase the blocks if needed and configured (ERASE_MEMORY_AT_START) before programming the values into the blocks. This function is non blocking, it must be called multiple times to complet it's work.
values | the buffer of values to writte to the memory |
size | the size of the buffer of values to writte |
Definition at line 643 of file high_speed_logger_direct_memory.c.
References current_unerased_addr, current_writting_addr, END_OF_MEMORY_THRESHOLD, ERASE_MEMORY_AT_START, logging_status_gui, ml_erase_4k_on_memory(), ml_write_values_to_memory(), and TOTAL_MEMORY_SIZE.
Referenced by send_buffer_to_memory().
uint8_t are_buffers_empty | ( | void | ) |
Function returning true if the two local buffers are empty.
Definition at line 927 of file high_speed_logger_direct_memory.c.
References nbr_values_in_buffer, and nbr_values_in_buffer_sending.
Referenced by end_log().
uint8_t end_log | ( | void | ) |
Function ending the current log.
This function will simply write the ending tag of the log.
This function is none blocking and need to be called multiple times to complete it's work. It will return 0 when the work is completed.
Definition at line 1069 of file high_speed_logger_direct_memory.c.
References add_array_to_buffer(), are_buffers_empty(), and stop_log_sequence.
Referenced by high_speed_logger_direct_memory_periodic().
void high_speed_logger_direct_memory_handler | ( | uint8_t | val | ) |
Function managing the interface with the user.
Definition at line 1241 of file high_speed_logger_direct_memory.c.
References logging_status_gui, and val.
void high_speed_logger_direct_memory_init | ( | void | ) |
Function initialisating the module.
Definition at line 1094 of file high_speed_logger_direct_memory.c.
References spi_transaction::after_cb, spi_transaction::bitorder, spi_transaction::cdiv, spi_transaction::cpha, spi_transaction::cpol, spi_transaction::dss, spi_transaction::input_buf, spi_transaction::input_length, memory_send_value_transaction, memory_transaction, memory_transaction_done_cb(), spi_transaction::output_buf, spi_transaction::output_length, spi_transaction::select, spi_transaction::slave_idx, spi_submit(), SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, uart_periph_init(), and uart_periph_set_bits_stop_parity().
void high_speed_logger_direct_memory_periodic | ( | void | ) |
Main function of the module.
Will manage the log.
Definition at line 1140 of file high_speed_logger_direct_memory.c.
References continue_reading_memory, end_log(), logging_status_gui, memory_ready, ml_read_log_in_memory(), run_logger(), run_memory_management(), send_buffer_to_uart(), start_new_log(), uart_char_available(), and uart_getch().
uint8_t is_sequence_in_array | ( | uint8_t * | array, |
uint8_t | array_size, | ||
uint8_t * | sequence, | ||
uint8_t | sequence_size | ||
) |
Function testing if a sequence is in a buffer of values.
This function is usefull to detect the tag indicating the end of the log in order to stop reading. This function will remember the previus values and as such can detect tags even when cutted. We can detect the first half of the tag at the end of one buffer and detect the other half at the begining of the folowing buffer.
array | the buffer in wich we are searching for the sequence |
array_size | the size of the buffer in wich we are searching |
sequence | the tag we are searching for |
sequence_size | the size of the tag we are searching for |
Definition at line 1216 of file high_speed_logger_direct_memory.c.
References MEMORY_READ_LATTENCY.
Referenced by memory_read_values_cb().
void memory_completly_erase | ( | void | ) |
Function sending a request to erase the entire memory.
Definition at line 319 of file high_speed_logger_direct_memory.c.
References spi_transaction::after_cb, FALSE, spi_transaction::input_buf, spi_transaction::input_length, memory_ready, memory_transaction, memory_transaction_done_cb(), msg, spi_transaction::output_buf, spi_transaction::output_length, and spi_submit().
Referenced by ml_erase_completely_memory().
void memory_erase_4k | ( | uint32_t | mem_addr | ) |
Function sending a request to erase 4KB of the memory.
mem_addr | the address of the block of 4K that you want to erase |
Definition at line 293 of file high_speed_logger_direct_memory.c.
References spi_transaction::after_cb, FALSE, spi_transaction::input_buf, spi_transaction::input_length, memory_ready, memory_transaction, memory_transaction_done_cb(), msg, spi_transaction::output_buf, spi_transaction::output_length, and spi_submit().
Referenced by ml_erase_4k_on_memory().
void memory_read_id | ( | void | ) |
Function sending a request for the ID of the memory chip.
Definition at line 200 of file high_speed_logger_direct_memory.c.
References spi_transaction::after_cb, buff, FALSE, spi_transaction::input_buf, spi_transaction::input_length, memory_ready, memory_transaction, memory_transaction_done_cb(), msg, spi_transaction::output_buf, spi_transaction::output_length, and spi_submit().
void memory_read_status_1 | ( | void | ) |
Function sending a request to fetch the status Byte of the memory.
Definition at line 258 of file high_speed_logger_direct_memory.c.
References spi_transaction::after_cb, buff, FALSE, spi_transaction::input_buf, spi_transaction::input_length, memory_read_status_cb(), memory_ready, memory_transaction, msg, spi_transaction::output_buf, spi_transaction::output_length, and spi_submit().
Referenced by ml_erase_4k_on_memory(), ml_erase_completely_memory(), and ml_write_values_to_memory().
Function sending a request to read some values in memory.
mem_addr | the address at wich we want to read |
size | the number of Bytes to be read |
Definition at line 377 of file high_speed_logger_direct_memory.c.
References spi_transaction::after_cb, FALSE, spi_transaction::input_buf, spi_transaction::input_length, MEMORY_READ_LATTENCY, memory_read_values_cb(), memory_ready, memory_transaction, msg, spi_transaction::output_buf, spi_transaction::output_length, spi_submit(), and uart_read_buff.
Referenced by ml_read_log_in_memory().
void memory_send_wrdi | ( | void | ) |
Function sending a request to clear the writte enable flag in the memory.
Definition at line 239 of file high_speed_logger_direct_memory.c.
References spi_transaction::after_cb, FALSE, spi_transaction::input_buf, spi_transaction::input_length, memory_ready, memory_transaction, memory_transaction_done_cb(), msg, spi_transaction::output_buf, spi_transaction::output_length, and spi_submit().
void memory_send_wren | ( | void | ) |
Function sending a request to set the writte enable flag in the memory.
Definition at line 220 of file high_speed_logger_direct_memory.c.
References spi_transaction::after_cb, FALSE, spi_transaction::input_buf, spi_transaction::input_length, memory_ready, memory_transaction, memory_transaction_done_cb(), msg, spi_transaction::output_buf, spi_transaction::output_length, and spi_submit().
Referenced by ml_erase_4k_on_memory(), ml_erase_completely_memory(), and ml_write_values_to_memory().
Function sending a request to write a buffer of values to the memory.
mem_addr | the address at wich the block must beggin to be written |
values | pointer to the buffer of value to be written to the memory. This buffer will be copied during this function. It can be reused right after having called this function. |
size | the size of the buffer of values |
Definition at line 343 of file high_speed_logger_direct_memory.c.
References spi_transaction::after_cb, FALSE, spi_transaction::input_buf, spi_transaction::input_length, memory_ready, memory_send_value_transaction, memory_transaction_done_cb(), spi_transaction::output_buf, spi_transaction::output_length, spi_submit(), and values_send_buffer.
Referenced by ml_write_values_to_memory().
Function erasing 4KB of the memory.
This function is going to take care of setting the writte enable flag, then will erase the block, then will check the status of the erase process. Once the erasing is done it will return 0. This function must be called multiple times to complet it's work, it is a none blocking function
mem_addr | The address of the 4KB block we want to erase |
Definition at line 528 of file high_speed_logger_direct_memory.c.
References memory_erase_4k(), memory_read_status_1(), memory_send_wren(), memory_status_byte, and wait_answear_from_reading_memory.
Referenced by append_values_to_memory().
uint8_t ml_erase_completely_memory | ( | void | ) |
Function erasing the entire memory.
This function is going to take care of setting the writte enable flag, then will erase the memory, then will check the status of the erase process. Once the erasing is done it will return 0. This function must be called multiple times to complet it's work, it is a none blocking function
Definition at line 573 of file high_speed_logger_direct_memory.c.
References memory_completly_erase(), memory_read_status_1(), memory_send_wren(), memory_status_byte, and wait_answear_from_reading_memory.
Referenced by start_new_log().
void ml_read_log_in_memory | ( | void | ) |
Function continuing the reading of the current log in memory.
This function will start the reading of a new block of the memory, the size of this block is defined by READING_BLOCK_SIZE.
Definition at line 613 of file high_speed_logger_direct_memory.c.
References current_reading_addr, memory_read_values(), and READING_BLOCK_SIZE.
Referenced by high_speed_logger_direct_memory_periodic(), and send_buffer_to_uart().
Function writting a buffer of values to the memory.
This function is going to take care of setting the writte enable flag, then will write the values, then will check the status of the write process. Once the writting is done it will return 0. This function must be called multiple times to complet it's work, it is a none blocking function
mem_addr | The address at which we want to write the buffer of values |
values | A pointer to the buffer of values we want to write |
size | The size of the buffer |
Definition at line 462 of file high_speed_logger_direct_memory.c.
References memory_read_status_1(), memory_send_wren(), memory_status_byte, memory_write_values(), and wait_answear_from_reading_memory.
Referenced by append_values_to_memory().
void run_logger | ( | void | ) |
Funcion called to add the values to log to the buffer with a frequency divider in order to not overflow the buffers.
Definition at line 1045 of file high_speed_logger_direct_memory.c.
References add_values_to_buffer(), and SKIP_X_CALLS_BETWEEN_VALUES.
Referenced by high_speed_logger_direct_memory_periodic().
uint8_t run_memory_management | ( | void | ) |
Function sending the buffer to the memory when possible.
This function will send a local buffer to the memory when possible.
Definition at line 868 of file high_speed_logger_direct_memory.c.
References add_array_to_buffer(), add_byte_to_buffer(), buffer_used, buffer_values_logged, buffer_values_sending, nbr_lost_values, nbr_values_in_buffer, nbr_values_in_buffer_sending, send_buffer_to_memory(), start_lost_values_sequence, and stop_lost_values_sequence.
Referenced by high_speed_logger_direct_memory_periodic().
Function sending a buffer ot the memory.
This function is just a verification that the buffer is not empty and that we are not asking for writting an empty buffer. It is simply an abstraction of the append_values_to_memory function.
buffer | the buffer of values to writte to the memory |
size | the size of the buffer of values to writte |
Definition at line 785 of file high_speed_logger_direct_memory.c.
References append_values_to_memory().
Referenced by run_memory_management().
void send_buffer_to_uart | ( | void | ) |
Function sending the read values from the memory to te UART.
This function will send the buffer of values read back to the UART and will launch an other blokc to be read if needed.
Definition at line 738 of file high_speed_logger_direct_memory.c.
References continue_reading_memory, spi_transaction::input_length, MEMORY_READ_LATTENCY, memory_transaction, ml_read_log_in_memory(), relaunch_reading_memory, sending_buffer_to_uart, uart_check_free_space(), uart_put_byte(), and uart_read_buff.
Referenced by high_speed_logger_direct_memory_periodic(), and memory_read_values_cb().
uint8_t start_new_log | ( | void | ) |
Function starting a new log.
This function will start a new log by erasing he memory if configured (ERASE_MEMORY_AT_START) and then will send the starting tags and the name of the messages.
This function is none blokcing, it need to be called multiples times to complete it's work. It will return 0 when the work have been done.
Add the size of the values sended (in Bytes : SIZE_OF_LOGGED_VALUES).
Add a space to writte the total size of that log (for the progress bar in the downloading application)
Definition at line 960 of file high_speed_logger_direct_memory.c.
References add_array_to_buffer(), add_byte_to_buffer(), current_unerased_addr, current_writting_addr, ERASE_MEMORY_AT_START, ml_erase_completely_memory(), name_of_the_values, NBR_VALUES_TO_LOG, SIZE_OF_LOGGED_VALUES, SIZE_OF_VALUES_NAMES, start_log_sequence, and start_values_sequence.
Referenced by high_speed_logger_direct_memory_periodic().
uint8_t logging_status_gui |
Status of the module.
Definition at line 181 of file high_speed_logger_direct_memory.c.
Referenced by append_values_to_memory(), high_speed_logger_direct_memory_handler(), and high_speed_logger_direct_memory_periodic().