mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 16:11:56 +08:00
arch/risc-v/espressif: Add ULP as char device to support multiple ULP bins
Add ULP as char device to change binary that runs on ULP Signed-off-by: Eren Terzioglu <eren.terzioglu@espressif.com>
This commit is contained in:
committed by
Alan C. Assis
parent
90a881271e
commit
7403177473
@@ -47,6 +47,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
static int esp_ulp_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int esp_ulp_write(struct file *filep,
|
||||
const char *buffer,
|
||||
size_t buflen);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@@ -54,6 +57,7 @@ static int esp_ulp_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
|
||||
static const struct file_operations g_esp_ulp_fops =
|
||||
{
|
||||
.write = esp_ulp_write, /* write */
|
||||
.ioctl = esp_ulp_ioctl, /* ioctl */
|
||||
};
|
||||
|
||||
@@ -135,6 +139,33 @@ static int esp_ulp_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_ulp_write
|
||||
*
|
||||
* Description:
|
||||
* Load binary data into ULP.
|
||||
*
|
||||
* Input Parameters:
|
||||
* filep - The pointer of file
|
||||
* buffer - Buffer that includes binary to run on ULP.
|
||||
* buflen - Length of the buffer
|
||||
*
|
||||
* Returned Value:
|
||||
* Returns OK on success; a negated errno value on failure
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int esp_ulp_write(struct file *filep,
|
||||
const char *buffer,
|
||||
size_t buflen)
|
||||
{
|
||||
int ret = ERROR;
|
||||
ulp_lp_core_stop();
|
||||
ret = ulp_lp_core_load_binary((const uint8_t *)buffer, buflen);
|
||||
ulp_lp_core_run(&cfg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: esp_ulp_register
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user