PR #45678: clangformat all the files under the micro directory.
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/45678 ``` tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/format_code.py tensorflow/lite/micro/ -e "\.inc" -e "\.py" --fix ``` Copybara import of the project: -- 9372cbff4bd4c65fa269c9de1e09208106f030c7 by Advait Jain <advaitjain@users.noreply.github.com>: clangformat all the files under the micro directory. ``` tensorflow/lite/micro/tools/make/downloads/pigweed/pw_presubmit/py/pw_presubmit/format_code.py tensorflow/lite/micro/ -e "\.inc" -e "\.py" --fix ``` COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/tensorflow/pull/45678 from advaitjain:clang-format 9372cbff4bd4c65fa269c9de1e09208106f030c7 PiperOrigin-RevId: 347642692 Change-Id: I6eac70bde20818f3937b55db9a9170ca8b5ce793
This commit is contained in:
parent
6aec6478d3
commit
ddfc8bd0fb
@ -14,6 +14,7 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/lite/micro/all_ops_resolver.h"
|
||||
|
||||
#include "tensorflow/lite/micro/kernels/micro_ops.h"
|
||||
|
||||
namespace tflite {
|
||||
|
@ -37,8 +37,8 @@ limitations under the License.
|
||||
#include "tensorflow/lite/micro/debug_log.h"
|
||||
|
||||
// These are headers from Ambiq's Apollo3 SDK.
|
||||
#include "am_bsp.h" // NOLINT
|
||||
#include "am_util.h" // NOLINT
|
||||
#include "am_bsp.h" // NOLINT
|
||||
#include "am_util.h" // NOLINT
|
||||
|
||||
extern "C" void DebugLog(const char* s) {
|
||||
#ifndef TF_LITE_STRIP_ERROR_STRINGS
|
||||
|
@ -22,6 +22,6 @@ extern "C" void DebugLog(const char* s) {
|
||||
"mov r1, %[str]\n"
|
||||
"bkpt #0xAB\n"
|
||||
:
|
||||
: [ str ] "r"(s)
|
||||
: [str] "r"(s)
|
||||
: "r0", "r1");
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ limitations under the License.
|
||||
|
||||
extern "C" {
|
||||
|
||||
void __assert_func(const char *, int, const char *, const char *) {}
|
||||
void __assert_func(const char*, int, const char*, const char*) {}
|
||||
}
|
||||
|
@ -15,5 +15,5 @@ limitations under the License.
|
||||
|
||||
extern "C" {
|
||||
|
||||
void __assert_func(const char *, int, const char *, const char *) {}
|
||||
void __assert_func(const char*, int, const char*, const char*) {}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "am_bsp.h"
|
||||
#include "am_mcu_apollo.h" // Defines AM_CMSIS_REGS
|
||||
#include "am_util.h"
|
||||
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||
/* This file is a modification of the Tensorflow Micro Lite file _main.c */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "am_bsp.h"
|
||||
#include "am_mcu_apollo.h" // Defines AM_CMSIS_REGS
|
||||
#include "am_util.h"
|
||||
|
@ -21,24 +21,24 @@ LCD_DISCO_F746NG lcd;
|
||||
|
||||
// When a command is detected, write it to the display and log it to the
|
||||
// serial port.
|
||||
void RespondToCommand(tflite::ErrorReporter *error_reporter,
|
||||
int32_t current_time, const char *found_command,
|
||||
void RespondToCommand(tflite::ErrorReporter* error_reporter,
|
||||
int32_t current_time, const char* found_command,
|
||||
uint8_t score, bool is_new_command) {
|
||||
if (is_new_command) {
|
||||
TF_LITE_REPORT_ERROR(error_reporter, "Heard %s (%d) @%dms", found_command,
|
||||
score, current_time);
|
||||
if (*found_command == 'y') {
|
||||
lcd.Clear(0xFF0F9D58);
|
||||
lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"Heard yes!", CENTER_MODE);
|
||||
lcd.DisplayStringAt(0, LINE(5), (uint8_t*)"Heard yes!", CENTER_MODE);
|
||||
} else if (*found_command == 'n') {
|
||||
lcd.Clear(0xFFDB4437);
|
||||
lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"Heard no :(", CENTER_MODE);
|
||||
lcd.DisplayStringAt(0, LINE(5), (uint8_t*)"Heard no :(", CENTER_MODE);
|
||||
} else if (*found_command == 'u') {
|
||||
lcd.Clear(0xFFF4B400);
|
||||
lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"Heard unknown", CENTER_MODE);
|
||||
lcd.DisplayStringAt(0, LINE(5), (uint8_t*)"Heard unknown", CENTER_MODE);
|
||||
} else {
|
||||
lcd.Clear(0xFF4285F4);
|
||||
lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"Heard silence", CENTER_MODE);
|
||||
lcd.DisplayStringAt(0, LINE(5), (uint8_t*)"Heard silence", CENTER_MODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,9 +35,9 @@ limitations under the License.
|
||||
|
||||
using namespace std;
|
||||
|
||||
static const char *TAG = "TF_LITE_AUDIO_PROVIDER";
|
||||
static const char* TAG = "TF_LITE_AUDIO_PROVIDER";
|
||||
/* ringbuffer to hold the incoming audio data */
|
||||
ringbuf_t *g_audio_capture_buffer;
|
||||
ringbuf_t* g_audio_capture_buffer;
|
||||
volatile int32_t g_latest_audio_timestamp = 0;
|
||||
/* model requires 20ms new data from g_audio_capture_buffer and 10ms old data
|
||||
* each time , storing old data in the histrory buffer , {
|
||||
@ -96,13 +96,13 @@ static void i2s_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static void CaptureSamples(void *arg) {
|
||||
static void CaptureSamples(void* arg) {
|
||||
size_t bytes_read;
|
||||
uint8_t i2s_read_buffer[i2s_bytes_to_read] = {};
|
||||
i2s_init();
|
||||
while (1) {
|
||||
/* read 100ms data at once from i2s */
|
||||
i2s_read((i2s_port_t)1, (void *)i2s_read_buffer, i2s_bytes_to_read,
|
||||
i2s_read((i2s_port_t)1, (void*)i2s_read_buffer, i2s_bytes_to_read,
|
||||
&bytes_read, 10);
|
||||
if (bytes_read <= 0) {
|
||||
ESP_LOGE(TAG, "Error in I2S read : %d", bytes_read);
|
||||
@ -112,7 +112,7 @@ static void CaptureSamples(void *arg) {
|
||||
}
|
||||
/* write bytes read by i2s into ring buffer */
|
||||
int bytes_written = rb_write(g_audio_capture_buffer,
|
||||
(uint8_t *)i2s_read_buffer, bytes_read, 10);
|
||||
(uint8_t*)i2s_read_buffer, bytes_read, 10);
|
||||
/* update the timestamp (in ms) to let the model know that new data has
|
||||
* arrived */
|
||||
g_latest_audio_timestamp +=
|
||||
@ -127,7 +127,7 @@ static void CaptureSamples(void *arg) {
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
TfLiteStatus InitAudioRecording(tflite::ErrorReporter *error_reporter) {
|
||||
TfLiteStatus InitAudioRecording(tflite::ErrorReporter* error_reporter) {
|
||||
g_audio_capture_buffer = rb_init("tf_ringbuffer", kAudioCaptureBufferSize);
|
||||
if (!g_audio_capture_buffer) {
|
||||
ESP_LOGE(TAG, "Error creating ring buffer");
|
||||
@ -142,9 +142,9 @@ TfLiteStatus InitAudioRecording(tflite::ErrorReporter *error_reporter) {
|
||||
return kTfLiteOk;
|
||||
}
|
||||
|
||||
TfLiteStatus GetAudioSamples(tflite::ErrorReporter *error_reporter,
|
||||
TfLiteStatus GetAudioSamples(tflite::ErrorReporter* error_reporter,
|
||||
int start_ms, int duration_ms,
|
||||
int *audio_samples_size, int16_t **audio_samples) {
|
||||
int* audio_samples_size, int16_t** audio_samples) {
|
||||
if (!g_is_audio_initialized) {
|
||||
TfLiteStatus init_status = InitAudioRecording(error_reporter);
|
||||
if (init_status != kTfLiteOk) {
|
||||
@ -153,14 +153,14 @@ TfLiteStatus GetAudioSamples(tflite::ErrorReporter *error_reporter,
|
||||
g_is_audio_initialized = true;
|
||||
}
|
||||
/* copy 160 samples (320 bytes) into output_buff from history */
|
||||
memcpy((void *)(g_audio_output_buffer), (void *)(g_history_buffer),
|
||||
memcpy((void*)(g_audio_output_buffer), (void*)(g_history_buffer),
|
||||
history_samples_to_keep * sizeof(int16_t));
|
||||
|
||||
/* copy 320 samples (640 bytes) from rb at ( int16_t*(g_audio_output_buffer) +
|
||||
* 160 ), first 160 samples (320 bytes) will be from history */
|
||||
int32_t bytes_read =
|
||||
rb_read(g_audio_capture_buffer,
|
||||
((uint8_t *)(g_audio_output_buffer + history_samples_to_keep)),
|
||||
((uint8_t*)(g_audio_output_buffer + history_samples_to_keep)),
|
||||
new_samples_to_get * sizeof(int16_t), 10);
|
||||
if (bytes_read < 0) {
|
||||
ESP_LOGE(TAG, " Model Could not read data from Ring Buffer");
|
||||
@ -173,8 +173,8 @@ TfLiteStatus GetAudioSamples(tflite::ErrorReporter *error_reporter,
|
||||
}
|
||||
|
||||
/* copy 320 bytes from output_buff into history */
|
||||
memcpy((void *)(g_history_buffer),
|
||||
(void *)(g_audio_output_buffer + new_samples_to_get),
|
||||
memcpy((void*)(g_history_buffer),
|
||||
(void*)(g_audio_output_buffer + new_samples_to_get),
|
||||
history_samples_to_keep * sizeof(int16_t));
|
||||
|
||||
*audio_samples_size = kMaxAudioSampleSize;
|
||||
|
@ -32,9 +32,9 @@ limitations under the License.
|
||||
|
||||
#define RB_TAG "RINGBUF"
|
||||
|
||||
ringbuf_t *rb_init(const char *name, uint32_t size) {
|
||||
ringbuf_t *r;
|
||||
unsigned char *buf;
|
||||
ringbuf_t* rb_init(const char* name, uint32_t size) {
|
||||
ringbuf_t* r;
|
||||
unsigned char* buf;
|
||||
|
||||
if (size < 2 || !name) {
|
||||
return NULL;
|
||||
@ -50,7 +50,7 @@ ringbuf_t *rb_init(const char *name, uint32_t size) {
|
||||
#endif
|
||||
assert(buf);
|
||||
|
||||
r->name = (char *)name;
|
||||
r->name = (char*)name;
|
||||
r->base = r->readptr = r->writeptr = buf;
|
||||
r->fill_cnt = 0;
|
||||
r->size = size;
|
||||
@ -70,7 +70,7 @@ ringbuf_t *rb_init(const char *name, uint32_t size) {
|
||||
return r;
|
||||
}
|
||||
|
||||
void rb_cleanup(ringbuf_t *rb) {
|
||||
void rb_cleanup(ringbuf_t* rb) {
|
||||
free(rb->base);
|
||||
rb->base = NULL;
|
||||
vSemaphoreDelete(rb->can_read);
|
||||
@ -85,17 +85,17 @@ void rb_cleanup(ringbuf_t *rb) {
|
||||
/*
|
||||
* @brief: get the number of filled bytes in the buffer
|
||||
*/
|
||||
ssize_t rb_filled(ringbuf_t *rb) { return rb->fill_cnt; }
|
||||
ssize_t rb_filled(ringbuf_t* rb) { return rb->fill_cnt; }
|
||||
|
||||
/*
|
||||
* @brief: get the number of empty bytes available in the buffer
|
||||
*/
|
||||
ssize_t rb_available(ringbuf_t *rb) {
|
||||
ssize_t rb_available(ringbuf_t* rb) {
|
||||
ESP_LOGD(RB_TAG, "rb leftover %d bytes", rb->size - rb->fill_cnt);
|
||||
return (rb->size - rb->fill_cnt);
|
||||
}
|
||||
|
||||
int rb_read(ringbuf_t *rb, uint8_t *buf, int buf_len, uint32_t ticks_to_wait) {
|
||||
int rb_read(ringbuf_t* rb, uint8_t* buf, int buf_len, uint32_t ticks_to_wait) {
|
||||
int read_size;
|
||||
int total_read_size = 0;
|
||||
|
||||
@ -178,7 +178,7 @@ out:
|
||||
return total_read_size;
|
||||
}
|
||||
|
||||
int rb_write(ringbuf_t *rb, const uint8_t *buf, int buf_len,
|
||||
int rb_write(ringbuf_t* rb, const uint8_t* buf, int buf_len,
|
||||
uint32_t ticks_to_wait) {
|
||||
int write_size;
|
||||
int total_write_size = 0;
|
||||
@ -245,7 +245,7 @@ out:
|
||||
/**
|
||||
* abort and set abort_read and abort_write to asked values.
|
||||
*/
|
||||
static void _rb_reset(ringbuf_t *rb, int abort_read, int abort_write) {
|
||||
static void _rb_reset(ringbuf_t* rb, int abort_read, int abort_write) {
|
||||
if (rb == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -259,9 +259,9 @@ static void _rb_reset(ringbuf_t *rb, int abort_read, int abort_write) {
|
||||
xSemaphoreGive(rb->lock);
|
||||
}
|
||||
|
||||
void rb_reset(ringbuf_t *rb) { _rb_reset(rb, 0, 0); }
|
||||
void rb_reset(ringbuf_t* rb) { _rb_reset(rb, 0, 0); }
|
||||
|
||||
void rb_abort_read(ringbuf_t *rb) {
|
||||
void rb_abort_read(ringbuf_t* rb) {
|
||||
if (rb == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -270,7 +270,7 @@ void rb_abort_read(ringbuf_t *rb) {
|
||||
xSemaphoreGive(rb->lock);
|
||||
}
|
||||
|
||||
void rb_abort_write(ringbuf_t *rb) {
|
||||
void rb_abort_write(ringbuf_t* rb) {
|
||||
if (rb == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -279,7 +279,7 @@ void rb_abort_write(ringbuf_t *rb) {
|
||||
xSemaphoreGive(rb->lock);
|
||||
}
|
||||
|
||||
void rb_abort(ringbuf_t *rb) {
|
||||
void rb_abort(ringbuf_t* rb) {
|
||||
if (rb == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -296,12 +296,12 @@ void rb_abort(ringbuf_t *rb) {
|
||||
* This serves a special purpose to not allow this abort to be mixed with
|
||||
* rb_write.
|
||||
*/
|
||||
void rb_reset_and_abort_write(ringbuf_t *rb) {
|
||||
void rb_reset_and_abort_write(ringbuf_t* rb) {
|
||||
_rb_reset(rb, 0, 1);
|
||||
xSemaphoreGive(rb->can_write);
|
||||
}
|
||||
|
||||
void rb_signal_writer_finished(ringbuf_t *rb) {
|
||||
void rb_signal_writer_finished(ringbuf_t* rb) {
|
||||
if (rb == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -309,14 +309,14 @@ void rb_signal_writer_finished(ringbuf_t *rb) {
|
||||
xSemaphoreGive(rb->can_read);
|
||||
}
|
||||
|
||||
int rb_is_writer_finished(ringbuf_t *rb) {
|
||||
int rb_is_writer_finished(ringbuf_t* rb) {
|
||||
if (rb == NULL) {
|
||||
return RB_FAIL;
|
||||
}
|
||||
return (rb->writer_finished);
|
||||
}
|
||||
|
||||
void rb_wakeup_reader(ringbuf_t *rb) {
|
||||
void rb_wakeup_reader(ringbuf_t* rb) {
|
||||
if (rb == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -324,7 +324,7 @@ void rb_wakeup_reader(ringbuf_t *rb) {
|
||||
xSemaphoreGive(rb->can_read);
|
||||
}
|
||||
|
||||
void rb_stat(ringbuf_t *rb) {
|
||||
void rb_stat(ringbuf_t* rb) {
|
||||
xSemaphoreTake(rb->lock, portMAX_DELAY);
|
||||
ESP_LOGI(RB_TAG,
|
||||
"filled: %d, base: %p, read_ptr: %p, write_ptr: %p, size: %d\n",
|
||||
|
@ -30,11 +30,11 @@ extern "C" {
|
||||
#define RB_READER_UNBLOCK -3
|
||||
|
||||
typedef struct ringbuf {
|
||||
char *name;
|
||||
uint8_t *base; /**< Original pointer */
|
||||
char* name;
|
||||
uint8_t* base; /**< Original pointer */
|
||||
/* XXX: these need to be volatile? */
|
||||
uint8_t *volatile readptr; /**< Read pointer */
|
||||
uint8_t *volatile writeptr; /**< Write pointer */
|
||||
uint8_t* volatile readptr; /**< Read pointer */
|
||||
uint8_t* volatile writeptr; /**< Write pointer */
|
||||
volatile ssize_t fill_cnt; /**< Number of filled slots */
|
||||
ssize_t size; /**< Buffer size */
|
||||
xSemaphoreHandle can_read;
|
||||
@ -46,26 +46,26 @@ typedef struct ringbuf {
|
||||
int reader_unblock;
|
||||
} ringbuf_t;
|
||||
|
||||
ringbuf_t *rb_init(const char *rb_name, uint32_t size);
|
||||
void rb_abort_read(ringbuf_t *rb);
|
||||
void rb_abort_write(ringbuf_t *rb);
|
||||
void rb_abort(ringbuf_t *rb);
|
||||
void rb_reset(ringbuf_t *rb);
|
||||
ringbuf_t* rb_init(const char* rb_name, uint32_t size);
|
||||
void rb_abort_read(ringbuf_t* rb);
|
||||
void rb_abort_write(ringbuf_t* rb);
|
||||
void rb_abort(ringbuf_t* rb);
|
||||
void rb_reset(ringbuf_t* rb);
|
||||
/**
|
||||
* @brief Special function to reset the buffer while keeping rb_write aborted.
|
||||
* This rb needs to be reset again before being useful.
|
||||
*/
|
||||
void rb_reset_and_abort_write(ringbuf_t *rb);
|
||||
void rb_stat(ringbuf_t *rb);
|
||||
ssize_t rb_filled(ringbuf_t *rb);
|
||||
ssize_t rb_available(ringbuf_t *rb);
|
||||
int rb_read(ringbuf_t *rb, uint8_t *buf, int len, uint32_t ticks_to_wait);
|
||||
int rb_write(ringbuf_t *rb, const uint8_t *buf, int len,
|
||||
void rb_reset_and_abort_write(ringbuf_t* rb);
|
||||
void rb_stat(ringbuf_t* rb);
|
||||
ssize_t rb_filled(ringbuf_t* rb);
|
||||
ssize_t rb_available(ringbuf_t* rb);
|
||||
int rb_read(ringbuf_t* rb, uint8_t* buf, int len, uint32_t ticks_to_wait);
|
||||
int rb_write(ringbuf_t* rb, const uint8_t* buf, int len,
|
||||
uint32_t ticks_to_wait);
|
||||
void rb_cleanup(ringbuf_t *rb);
|
||||
void rb_signal_writer_finished(ringbuf_t *rb);
|
||||
void rb_wakeup_reader(ringbuf_t *rb);
|
||||
int rb_is_writer_finished(ringbuf_t *rb);
|
||||
void rb_cleanup(ringbuf_t* rb);
|
||||
void rb_signal_writer_finished(ringbuf_t* rb);
|
||||
void rb_wakeup_reader(ringbuf_t* rb);
|
||||
int rb_is_writer_finished(ringbuf_t* rb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ limitations under the License.
|
||||
defined(FSL_FEATURE_L1ICACHE_LINESIZE_BYTE))
|
||||
#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) \
|
||||
__attribute__((section("NonCacheable"), zero_init)) \
|
||||
__attribute__((aligned(alignbytes))) var
|
||||
__attribute__((aligned(alignbytes))) var
|
||||
#else
|
||||
#define AT_NONCACHEABLE_SECTION_ALIGN(var, alignbytes) \
|
||||
__attribute__((aligned(alignbytes))) var
|
||||
@ -131,7 +131,7 @@ volatile uint8_t g_da7212_register_config[da7212ConfigurationSize][2] = {
|
||||
{0x24, 0x00}, {0x25, 0x00}, {0x26, 0x20}, {0x20, 0x80}};
|
||||
|
||||
// Save audio samples into intermediate buffer
|
||||
void CaptureSamples(const int16_t *sample_data) {
|
||||
void CaptureSamples(const int16_t* sample_data) {
|
||||
const int sample_size = kNoOfSamples;
|
||||
const int32_t time_in_ms =
|
||||
g_latest_audio_timestamp + (sample_size / (kAudioSampleFrequency / 1000));
|
||||
@ -148,17 +148,17 @@ void CaptureSamples(const int16_t *sample_data) {
|
||||
}
|
||||
|
||||
// Callback function for SAI RX EDMA transfer complete
|
||||
static void SaiRxCallback(I2S_Type *base, sai_edma_handle_t *handle,
|
||||
status_t status, void *userData) {
|
||||
static void SaiRxCallback(I2S_Type* base, sai_edma_handle_t* handle,
|
||||
status_t status, void* userData) {
|
||||
if (kStatus_SAI_RxError == status) {
|
||||
// Handle the error
|
||||
} else {
|
||||
// Save audio data into intermediate buffer
|
||||
CaptureSamples(
|
||||
reinterpret_cast<int16_t *>(g_rx_buffer + g_tx_index * kNoOfSamples));
|
||||
reinterpret_cast<int16_t*>(g_rx_buffer + g_tx_index * kNoOfSamples));
|
||||
|
||||
// Submit received audio buffer to SAI TX for audio loopback debug
|
||||
g_sai_transfer.data = (uint8_t *)(g_rx_buffer + g_tx_index * kNoOfSamples);
|
||||
g_sai_transfer.data = (uint8_t*)(g_rx_buffer + g_tx_index * kNoOfSamples);
|
||||
g_sai_transfer.dataSize = kBufferSize;
|
||||
if (kStatus_Success ==
|
||||
SAI_TransferSendEDMA(I2S0, &g_tx_sai_handle, &g_sai_transfer)) {
|
||||
@ -169,7 +169,7 @@ static void SaiRxCallback(I2S_Type *base, sai_edma_handle_t *handle,
|
||||
}
|
||||
|
||||
// Submit buffer to SAI RX to receive audio data
|
||||
g_sai_transfer.data = (uint8_t *)(g_rx_buffer + g_rx_index * kNoOfSamples);
|
||||
g_sai_transfer.data = (uint8_t*)(g_rx_buffer + g_rx_index * kNoOfSamples);
|
||||
g_sai_transfer.dataSize = kBufferSize;
|
||||
if (kStatus_Success ==
|
||||
SAI_TransferReceiveEDMA(I2S0, &g_rx_sai_handle, &g_sai_transfer)) {
|
||||
@ -182,8 +182,8 @@ static void SaiRxCallback(I2S_Type *base, sai_edma_handle_t *handle,
|
||||
}
|
||||
|
||||
// Callback function for TX Buffer transfer
|
||||
static void SaiTxCallback(I2S_Type *base, sai_edma_handle_t *handle,
|
||||
status_t status, void *userData) {
|
||||
static void SaiTxCallback(I2S_Type* base, sai_edma_handle_t* handle,
|
||||
status_t status, void* userData) {
|
||||
if (kStatus_SAI_TxError == status) {
|
||||
// Handle the error
|
||||
}
|
||||
@ -243,7 +243,7 @@ status_t Da7212WriteRegister(uint8_t register_address, uint8_t register_data) {
|
||||
i2c_data.direction = kI2C_Write;
|
||||
i2c_data.subaddress = register_address;
|
||||
i2c_data.subaddressSize = 1;
|
||||
i2c_data.data = (uint8_t * volatile) data;
|
||||
i2c_data.data = (uint8_t* volatile)data;
|
||||
i2c_data.dataSize = 1;
|
||||
i2c_data.flags = kI2C_TransferDefaultFlag;
|
||||
return I2C_MasterTransferBlocking(I2C1, &i2c_data);
|
||||
@ -258,7 +258,7 @@ void Da7212Initialize(void) {
|
||||
}
|
||||
|
||||
// Initialization for receiving audio data
|
||||
TfLiteStatus InitAudioRecording(tflite::ErrorReporter *error_reporter) {
|
||||
TfLiteStatus InitAudioRecording(tflite::ErrorReporter* error_reporter) {
|
||||
edma_config_t dma_config = {0};
|
||||
sai_config_t sai_config;
|
||||
sai_transfer_format_t sai_format;
|
||||
@ -328,7 +328,7 @@ TfLiteStatus InitAudioRecording(tflite::ErrorReporter *error_reporter) {
|
||||
sai_format.masterClockHz);
|
||||
|
||||
// Submit buffers to SAI RX to start receiving audio
|
||||
g_sai_transfer.data = (uint8_t *)(g_rx_buffer + g_rx_index * kNoOfSamples);
|
||||
g_sai_transfer.data = (uint8_t*)(g_rx_buffer + g_rx_index * kNoOfSamples);
|
||||
g_sai_transfer.dataSize = kBufferSize;
|
||||
if (kStatus_Success ==
|
||||
SAI_TransferReceiveEDMA(I2S0, &g_rx_sai_handle, &g_sai_transfer)) {
|
||||
@ -337,7 +337,7 @@ TfLiteStatus InitAudioRecording(tflite::ErrorReporter *error_reporter) {
|
||||
if (g_rx_index == kNoOfBuffers) {
|
||||
g_rx_index = 0U;
|
||||
}
|
||||
g_sai_transfer.data = (uint8_t *)(g_rx_buffer + g_rx_index * kNoOfSamples);
|
||||
g_sai_transfer.data = (uint8_t*)(g_rx_buffer + g_rx_index * kNoOfSamples);
|
||||
g_sai_transfer.dataSize = kBufferSize;
|
||||
if (kStatus_Success ==
|
||||
SAI_TransferReceiveEDMA(I2S0, &g_rx_sai_handle, &g_sai_transfer)) {
|
||||
@ -352,9 +352,9 @@ TfLiteStatus InitAudioRecording(tflite::ErrorReporter *error_reporter) {
|
||||
} // namespace
|
||||
|
||||
// Main entry point for getting audio data.
|
||||
TfLiteStatus GetAudioSamples(tflite::ErrorReporter *error_reporter,
|
||||
TfLiteStatus GetAudioSamples(tflite::ErrorReporter* error_reporter,
|
||||
int start_ms, int duration_ms,
|
||||
int *audio_samples_size, int16_t **audio_samples) {
|
||||
int* audio_samples_size, int16_t** audio_samples) {
|
||||
if (!g_is_audio_initialized) {
|
||||
TfLiteStatus init_status = InitAudioRecording(error_reporter);
|
||||
if (init_status != kTfLiteOk) {
|
||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||
|
||||
#include "app_camera_esp.h"
|
||||
|
||||
static const char *TAG = "app_camera";
|
||||
static const char* TAG = "app_camera";
|
||||
|
||||
int app_camera_init() {
|
||||
#if CONFIG_CAMERA_MODEL_ESP_EYE
|
||||
|
@ -673,7 +673,8 @@ uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t* psCfg, uint8_t* pui8Buffer,
|
||||
|
||||
am_util_stdio_printf("[%s] +\n", __func__);
|
||||
#ifdef ENABLE_ASYNC
|
||||
while (!s_bVsyncAsserted);
|
||||
while (!s_bVsyncAsserted)
|
||||
;
|
||||
|
||||
while (s_bVsyncAsserted) {
|
||||
// we don't check HSYNC here on the basis of assuming HM01B0 in the gated
|
||||
@ -687,18 +688,21 @@ uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t* psCfg, uint8_t* pui8Buffer,
|
||||
goto end;
|
||||
}
|
||||
|
||||
while (read_pclk());
|
||||
while (read_pclk())
|
||||
;
|
||||
}
|
||||
}
|
||||
#else
|
||||
uint32_t ui32HsyncCnt = 0x00;
|
||||
|
||||
while ((ui32HsyncCnt < HM01B0_PIXEL_Y_NUM)) {
|
||||
while (0x00 == read_hsync());
|
||||
while (0x00 == read_hsync())
|
||||
;
|
||||
|
||||
// read one row
|
||||
while (read_hsync()) {
|
||||
while (0x00 == read_pclk());
|
||||
while (0x00 == read_pclk())
|
||||
;
|
||||
|
||||
*(pui8Buffer + ui32Idx++) = read_byte();
|
||||
|
||||
@ -706,7 +710,8 @@ uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t* psCfg, uint8_t* pui8Buffer,
|
||||
goto end;
|
||||
}
|
||||
|
||||
while (read_pclk());
|
||||
while (read_pclk())
|
||||
;
|
||||
}
|
||||
|
||||
ui32HsyncCnt++;
|
||||
|
@ -99,7 +99,7 @@ typedef struct {
|
||||
am_hal_iom_mode_e eIOMMode;
|
||||
uint32_t ui32IOMModule;
|
||||
am_hal_iom_config_t sIOMCfg;
|
||||
void *pIOMHandle;
|
||||
void* pIOMHandle;
|
||||
|
||||
uint32_t ui32CTimerModule;
|
||||
uint32_t ui32CTimerSegment;
|
||||
@ -138,8 +138,8 @@ typedef struct {
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static uint32_t hm01b0_write_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg,
|
||||
uint8_t *pui8Value, uint32_t ui32NumBytes);
|
||||
static uint32_t hm01b0_write_reg(hm01b0_cfg_t* psCfg, uint16_t ui16Reg,
|
||||
uint8_t* pui8Value, uint32_t ui32NumBytes);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -156,8 +156,8 @@ static uint32_t hm01b0_write_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg,
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static uint32_t hm01b0_read_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg,
|
||||
uint8_t *pui8Value, uint32_t ui32NumBytes);
|
||||
static uint32_t hm01b0_read_reg(hm01b0_cfg_t* psCfg, uint16_t ui16Reg,
|
||||
uint8_t* pui8Value, uint32_t ui32NumBytes);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -172,7 +172,7 @@ static uint32_t hm01b0_read_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg,
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
static uint32_t hm01b0_load_script(hm01b0_cfg_t *psCfg, hm_script_t *psScript,
|
||||
static uint32_t hm01b0_load_script(hm01b0_cfg_t* psCfg, hm_script_t* psScript,
|
||||
uint32_t ui32ScriptCmdNum);
|
||||
|
||||
//*****************************************************************************
|
||||
@ -186,7 +186,7 @@ static uint32_t hm01b0_load_script(hm01b0_cfg_t *psCfg, hm_script_t *psScript,
|
||||
//! @return none.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void hm01b0_power_up(hm01b0_cfg_t *psCfg);
|
||||
void hm01b0_power_up(hm01b0_cfg_t* psCfg);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -199,7 +199,7 @@ void hm01b0_power_up(hm01b0_cfg_t *psCfg);
|
||||
//! @return none.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void hm01b0_power_down(hm01b0_cfg_t *psCfg);
|
||||
void hm01b0_power_down(hm01b0_cfg_t* psCfg);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -212,7 +212,7 @@ void hm01b0_power_down(hm01b0_cfg_t *psCfg);
|
||||
//! @return none.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void hm01b0_mclk_enable(hm01b0_cfg_t *psCfg);
|
||||
void hm01b0_mclk_enable(hm01b0_cfg_t* psCfg);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -225,7 +225,7 @@ void hm01b0_mclk_enable(hm01b0_cfg_t *psCfg);
|
||||
//! @return none.
|
||||
//
|
||||
//*****************************************************************************
|
||||
void hm01b0_mclk_disable(hm01b0_cfg_t *psCfg);
|
||||
void hm01b0_mclk_disable(hm01b0_cfg_t* psCfg);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -238,7 +238,7 @@ void hm01b0_mclk_disable(hm01b0_cfg_t *psCfg);
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_init_if(hm01b0_cfg_t *psCfg);
|
||||
uint32_t hm01b0_init_if(hm01b0_cfg_t* psCfg);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -251,7 +251,7 @@ uint32_t hm01b0_init_if(hm01b0_cfg_t *psCfg);
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_deinit_if(hm01b0_cfg_t *psCfg);
|
||||
uint32_t hm01b0_deinit_if(hm01b0_cfg_t* psCfg);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -265,7 +265,7 @@ uint32_t hm01b0_deinit_if(hm01b0_cfg_t *psCfg);
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_get_modelid(hm01b0_cfg_t *psCfg, uint16_t *pui16MID);
|
||||
uint32_t hm01b0_get_modelid(hm01b0_cfg_t* psCfg, uint16_t* pui16MID);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -281,7 +281,7 @@ uint32_t hm01b0_get_modelid(hm01b0_cfg_t *psCfg, uint16_t *pui16MID);
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_init_system(hm01b0_cfg_t *psCfg, hm_script_t *psScript,
|
||||
uint32_t hm01b0_init_system(hm01b0_cfg_t* psCfg, hm_script_t* psScript,
|
||||
uint32_t ui32ScriptCmdNum);
|
||||
|
||||
//*****************************************************************************
|
||||
@ -295,7 +295,7 @@ uint32_t hm01b0_init_system(hm01b0_cfg_t *psCfg, hm_script_t *psScript,
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_test_walking1s(hm01b0_cfg_t *psCfg);
|
||||
uint32_t hm01b0_test_walking1s(hm01b0_cfg_t* psCfg);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -308,7 +308,7 @@ uint32_t hm01b0_test_walking1s(hm01b0_cfg_t *psCfg);
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_reset_sw(hm01b0_cfg_t *psCfg);
|
||||
uint32_t hm01b0_reset_sw(hm01b0_cfg_t* psCfg);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -323,7 +323,7 @@ uint32_t hm01b0_reset_sw(hm01b0_cfg_t *psCfg);
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_get_mode(hm01b0_cfg_t *psCfg, uint8_t *pui8Mode);
|
||||
uint32_t hm01b0_get_mode(hm01b0_cfg_t* psCfg, uint8_t* pui8Mode);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -344,7 +344,7 @@ uint32_t hm01b0_get_mode(hm01b0_cfg_t *psCfg, uint8_t *pui8Mode);
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_set_mode(hm01b0_cfg_t *psCfg, uint8_t ui8Mode,
|
||||
uint32_t hm01b0_set_mode(hm01b0_cfg_t* psCfg, uint8_t ui8Mode,
|
||||
uint8_t framecnt);
|
||||
|
||||
//*****************************************************************************
|
||||
@ -360,7 +360,7 @@ uint32_t hm01b0_set_mode(hm01b0_cfg_t *psCfg, uint8_t ui8Mode,
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_hardware_trigger_streaming(hm01b0_cfg_t *psCfg, bool bTrigger);
|
||||
uint32_t hm01b0_hardware_trigger_streaming(hm01b0_cfg_t* psCfg, bool bTrigger);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -375,7 +375,7 @@ uint32_t hm01b0_hardware_trigger_streaming(hm01b0_cfg_t *psCfg, bool bTrigger);
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_set_mirror(hm01b0_cfg_t *psCfg, bool bHmirror, bool bVmirror);
|
||||
uint32_t hm01b0_set_mirror(hm01b0_cfg_t* psCfg, bool bHmirror, bool bVmirror);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@ -390,7 +390,7 @@ uint32_t hm01b0_set_mirror(hm01b0_cfg_t *psCfg, bool bHmirror, bool bVmirror);
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t *psCfg, uint8_t *pui8Buffer,
|
||||
uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t* psCfg, uint8_t* pui8Buffer,
|
||||
uint32_t ui32BufferLen);
|
||||
|
||||
//*****************************************************************************
|
||||
@ -404,7 +404,7 @@ uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t *psCfg, uint8_t *pui8Buffer,
|
||||
//! @return Error code.
|
||||
//
|
||||
//*****************************************************************************
|
||||
uint32_t hm01b0_single_frame_capture(hm01b0_cfg_t *psCfg);
|
||||
uint32_t hm01b0_single_frame_capture(hm01b0_cfg_t* psCfg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -20,7 +20,8 @@ limitations under the License.
|
||||
#ifndef ARDUINO_EXCLUDE_CODE
|
||||
|
||||
#include "HM01B0_debug.h"
|
||||
#include "am_util.h" // NOLINT
|
||||
|
||||
#include "am_util.h" // NOLINT
|
||||
|
||||
void hm01b0_framebuffer_dump(uint8_t* frame, uint32_t length) {
|
||||
am_util_stdio_printf("+++ frame +++");
|
||||
|
@ -20,9 +20,9 @@ limitations under the License.
|
||||
#ifndef ARDUINO_EXCLUDE_CODE
|
||||
|
||||
#include "HM01B0.h"
|
||||
#include "am_bsp.h" //NOLINT
|
||||
#include "am_mcu_apollo.h" //NOLINT
|
||||
#include "platform.h" // TARGET specific implementation
|
||||
#include "am_bsp.h" //NOLINT
|
||||
#include "am_mcu_apollo.h" //NOLINT
|
||||
#include "platform.h" // TARGET specific implementation
|
||||
|
||||
// Image is down-sampled by applying a stride of 2 pixels in both the x and y
|
||||
// directions.
|
||||
@ -58,7 +58,8 @@ uint32_t hm01b0_blocking_read_oneframe_scaled(hm01b0_cfg_t* psCfg,
|
||||
|
||||
while ((hsync_count < HM01B0_PIXEL_Y_NUM)) {
|
||||
// Wait for horizontal sync.
|
||||
while (!read_hsync());
|
||||
while (!read_hsync())
|
||||
;
|
||||
|
||||
// Get resulting image position. When hsync_count < offset_y, this will
|
||||
// underflow resulting in an index out of bounds which we check later,
|
||||
@ -69,14 +70,15 @@ uint32_t hm01b0_blocking_read_oneframe_scaled(hm01b0_cfg_t* psCfg,
|
||||
// Read one row. Hsync is held high for the duration of a row read.
|
||||
while (read_hsync()) {
|
||||
// Wait for pixel value to be ready.
|
||||
while (!read_pclk());
|
||||
while (!read_pclk())
|
||||
;
|
||||
|
||||
// Read 8-bit value from camera.
|
||||
const uint8_t value = read_byte();
|
||||
const uint32_t output_x = (rowidx++ - offset_x) >> kStrideShift;
|
||||
if (output_x < w && output_y < h) {
|
||||
const int output_idx = (output_y * w + output_x) * channels;
|
||||
for (int i=0; i<channels; i++) {
|
||||
for (int i = 0; i < channels; i++) {
|
||||
// See the top of main_functions.cc for an explanation of and
|
||||
// rationale for our unsigned to signed input conversion.
|
||||
buffer[output_idx + i] = value - 128;
|
||||
@ -84,7 +86,8 @@ uint32_t hm01b0_blocking_read_oneframe_scaled(hm01b0_cfg_t* psCfg,
|
||||
}
|
||||
|
||||
// Wait for next pixel clock.
|
||||
while (read_pclk());
|
||||
while (read_pclk())
|
||||
;
|
||||
}
|
||||
|
||||
hsync_count++;
|
||||
|
@ -23,12 +23,11 @@ limitations under the License.
|
||||
|
||||
#ifndef ARDUINO_EXCLUDE_CODE
|
||||
|
||||
#include "tensorflow/lite/micro/examples/person_detection/image_provider.h"
|
||||
|
||||
#include "tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0.h"
|
||||
#include "tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_RAW8_QVGA_8bits_lsb_5fps.h"
|
||||
#include "tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_debug.h"
|
||||
#include "tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_optimized.h"
|
||||
#include "tensorflow/lite/micro/examples/person_detection/image_provider.h"
|
||||
|
||||
// These are headers from Ambiq's Apollo3 SDK.
|
||||
#include "am_bsp.h" // NOLINT
|
||||
|
@ -63,15 +63,15 @@ static int8_t scratch_mem_z[SCRATCH_MEM_Z_SIZE];
|
||||
#pragma Bss()
|
||||
} // namespace
|
||||
|
||||
static int8_t *scratch_mem[] = {scratch_mem_x, scratch_mem_y, scratch_mem_z};
|
||||
static int8_t* scratch_mem[] = {scratch_mem_x, scratch_mem_y, scratch_mem_z};
|
||||
static uint32_t scratch_sizes[] = {SCRATCH_MEM_X_SIZE, SCRATCH_MEM_Y_SIZE,
|
||||
SCRATCH_MEM_Z_SIZE};
|
||||
|
||||
void *get_arc_scratch_buffer(int size) {
|
||||
void* get_arc_scratch_buffer(int size) {
|
||||
// Function to asign fast memory from one of 3 scratch buffers.
|
||||
// Best Fit strategy - memory is allocated from that memory bank that leaves
|
||||
// the least unused memory.
|
||||
void *buf = NULL;
|
||||
void* buf = NULL;
|
||||
int best_mem_idx = -1;
|
||||
int best_mem_delta = INT_MAX;
|
||||
const int num_mem = sizeof(scratch_mem) / sizeof(scratch_mem[0]);
|
||||
@ -85,14 +85,14 @@ void *get_arc_scratch_buffer(int size) {
|
||||
}
|
||||
}
|
||||
if (best_mem_idx >= 0) {
|
||||
buf = static_cast<void *>(scratch_mem[best_mem_idx]);
|
||||
buf = static_cast<void*>(scratch_mem[best_mem_idx]);
|
||||
scratch_mem[best_mem_idx] += size;
|
||||
scratch_sizes[best_mem_idx] -= size;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
void get_arc_scratch_buffer_max_size(int *size) {
|
||||
void get_arc_scratch_buffer_max_size(int* size) {
|
||||
int maxavailable = 0;
|
||||
const int num_mem = sizeof(scratch_mem) / sizeof(scratch_mem[0]);
|
||||
// find the largest available buffer.
|
||||
@ -104,7 +104,7 @@ void get_arc_scratch_buffer_max_size(int *size) {
|
||||
*size = maxavailable;
|
||||
}
|
||||
|
||||
void get_arc_scratch_buffer_two_max_sizes(int *size1, int *size2) {
|
||||
void get_arc_scratch_buffer_two_max_sizes(int* size1, int* size2) {
|
||||
int maxavailable = 0;
|
||||
int secondavail = 0;
|
||||
const int num_mem = sizeof(scratch_mem) / sizeof(scratch_mem[0]);
|
||||
|
@ -20,8 +20,6 @@ limitations under the License.
|
||||
#include "tensorflow/lite/micro/test_helpers.h"
|
||||
#include "tensorflow/lite/micro/testing/micro_test.h"
|
||||
|
||||
|
||||
|
||||
namespace tflite {
|
||||
namespace testing {
|
||||
namespace {
|
||||
|
0
tensorflow/lite/micro/kernels/xtensa_hifi/pooling.cc
Executable file → Normal file
0
tensorflow/lite/micro/kernels/xtensa_hifi/pooling.cc
Executable file → Normal file
@ -20,6 +20,6 @@ extern "C" void DebugLog(const char* s) {
|
||||
"mov r1, %[str]\n"
|
||||
"bkpt #0xAB\n"
|
||||
:
|
||||
: [ str ] "r"(s)
|
||||
: [str] "r"(s)
|
||||
: "r0", "r1");
|
||||
}
|
||||
|
@ -28,19 +28,19 @@ extern "C" {
|
||||
|
||||
#ifdef __GNUC__
|
||||
int __io_putchar(int ch) {
|
||||
HAL_UART_Transmit(&DEBUG_UART_HANDLE, (uint8_t *)&ch, 1, HAL_MAX_DELAY);
|
||||
HAL_UART_Transmit(&DEBUG_UART_HANDLE, (uint8_t*)&ch, 1, HAL_MAX_DELAY);
|
||||
|
||||
return ch;
|
||||
}
|
||||
#else
|
||||
int fputc(int ch, FILE *f) {
|
||||
HAL_UART_Transmit(&DEBUG_UART_HANDLE, (uint8_t *)&ch, 1, HAL_MAX_DELAY);
|
||||
int fputc(int ch, FILE* f) {
|
||||
HAL_UART_Transmit(&DEBUG_UART_HANDLE, (uint8_t*)&ch, 1, HAL_MAX_DELAY);
|
||||
|
||||
return ch;
|
||||
}
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
void DebugLog(const char *s) { fprintf(stderr, "%s", s); }
|
||||
void DebugLog(const char* s) { fprintf(stderr, "%s", s); }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ limitations under the License.
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "eta_bsp.h"
|
||||
#include "eta_chip.h"
|
||||
#include "eta_csp.h"
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
calls _main() which is the entry point into the application */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "eta_chip.h"
|
||||
#include "memio.h"
|
||||
|
||||
@ -30,9 +31,9 @@ calls _main() which is the entry point into the application */
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
int _main(int argc, char *argv[]);
|
||||
int _main(int argc, char* argv[]);
|
||||
void set_vtor(void);
|
||||
void *startup_get_my_pc(void);
|
||||
void* startup_get_my_pc(void);
|
||||
|
||||
//*****************************************************************************
|
||||
// Forward DECLS for interrupt service routines (ISR)
|
||||
@ -94,7 +95,7 @@ extern uint32_t _stack_top;
|
||||
__attribute__((section(".vectors"), used)) void (*const gVectors[])(void) = {
|
||||
//(void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), // Stack
|
||||
// pointer
|
||||
(void *)STARTUP_STACK_TOP,
|
||||
(void*)STARTUP_STACK_TOP,
|
||||
ResetISR, // Reset handler
|
||||
NmiSR, // The NMI handler
|
||||
FaultISR, // The hard fault handler
|
||||
@ -402,8 +403,8 @@ void default_ResetISR(void) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// get my PC
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void *startup_get_my_pc(void) {
|
||||
void *pc;
|
||||
void* startup_get_my_pc(void) {
|
||||
void* pc;
|
||||
asm("mov %0, pc" : "=r"(pc));
|
||||
return pc;
|
||||
}
|
||||
@ -411,8 +412,8 @@ void *startup_get_my_pc(void) {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// get my SP
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void *startup_get_my_sp(void) {
|
||||
void *sp;
|
||||
void* startup_get_my_sp(void) {
|
||||
void* sp;
|
||||
asm("mov %0, sp" : "=r"(sp));
|
||||
return sp;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user