Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
duo-buildroot-sdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
duo-buildroot-sdk
Commits
9426e0ad
Commit
9426e0ad
authored
Nov 30, 2023
by
carbon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mailbox: control LED through the little core
parent
1bca5068
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
9 deletions
+49
-9
freertos/cvitek/driver/rtos_cmdqu/include/rtos_cmdqu.h
freertos/cvitek/driver/rtos_cmdqu/include/rtos_cmdqu.h
+7
-1
freertos/cvitek/task/comm/src/riscv64/comm_main.c
freertos/cvitek/task/comm/src/riscv64/comm_main.c
+15
-1
freertos/cvitek/task/comm/src/riscv64/milkv_duo_io.c
freertos/cvitek/task/comm/src/riscv64/milkv_duo_io.c
+12
-0
freertos/cvitek/task/comm/src/riscv64/milkv_duo_io.h
freertos/cvitek/task/comm/src/riscv64/milkv_duo_io.h
+14
-0
linux_5.10/drivers/soc/cvitek/rtos_cmdqu/Makefile
linux_5.10/drivers/soc/cvitek/rtos_cmdqu/Makefile
+1
-0
linux_5.10/drivers/soc/cvitek/rtos_cmdqu/rtos_cmdqu.h
linux_5.10/drivers/soc/cvitek/rtos_cmdqu/rtos_cmdqu.h
+0
-7
No files found.
freertos/cvitek/driver/rtos_cmdqu/include/rtos_cmdqu.h
View file @
9426e0ad
...
...
@@ -9,14 +9,20 @@
#define NR_RTOS_CMD 127
#define NR_RTOS_IP IP_LIMIT
enum
SYS_CMD_ID
{
CMD_TEST_A
=
0x10
,
CMD_TEST_B
,
CMD_TEST_C
,
CMD_DUO_LED
,
SYS_CMD_INFO_LIMIT
,
};
enum
DUO_LED_STATUS
{
DUO_LED_ON
=
0x02
,
DUO_LED_OFF
,
DUO_LED_DONE
,
};
struct
valid_t
{
unsigned
char
linux_valid
;
unsigned
char
rtos_valid
;
...
...
freertos/cvitek/task/comm/src/riscv64/comm_main.c
View file @
9426e0ad
...
...
@@ -18,6 +18,8 @@
#include "comm.h"
#include "cvi_spinlock.h"
/* Milk-V Duo */
#include "milkv_duo_io.h"
// #define __DEBUG__
#ifdef __DEBUG__
...
...
@@ -94,7 +96,6 @@ void main_cvirtos(void)
/* Start the tasks and timer running. */
vTaskStartScheduler
();
/* If all is well, the scheduler will now be running, and the following
line will never be reached. If the following line does execute, then
there was either insufficient FreeRTOS heap memory available for the idle
...
...
@@ -158,6 +159,19 @@ void prvCmdQuRunTask(void *pvParameters)
rtos_cmdq
.
resv
.
valid
.
linux_valid
=
0
;
printf
(
"recv cmd(%d) from C906B...send [0x%x] to C906B
\n
"
,
rtos_cmdq
.
cmd_id
,
rtos_cmdq
.
param_ptr
);
goto
send_label
;
case
CMD_DUO_LED
:
rtos_cmdq
.
cmd_id
=
CMD_DUO_LED
;
printf
(
"recv cmd(%d) from C906B, param_ptr [0x%x]
\n
"
,
rtos_cmdq
.
cmd_id
,
rtos_cmdq
.
param_ptr
);
if
(
rtos_cmdq
.
param_ptr
==
DUO_LED_ON
)
{
duo_led_control
(
1
);
}
else
{
duo_led_control
(
0
);
}
rtos_cmdq
.
param_ptr
=
DUO_LED_DONE
;
rtos_cmdq
.
resv
.
valid
.
rtos_valid
=
1
;
rtos_cmdq
.
resv
.
valid
.
linux_valid
=
0
;
printf
(
"recv cmd(%d) from C906B...send [0x%x] to C906B
\n
"
,
rtos_cmdq
.
cmd_id
,
rtos_cmdq
.
param_ptr
);
goto
send_label
;
default:
send_label:
/* used to send command to linux*/
...
...
freertos/cvitek/task/comm/src/riscv64/milkv_duo_io.c
0 → 100644
View file @
9426e0ad
#include "milkv_duo_io.h"
void
duo_led_control
(
int
enable
)
{
*
(
uint32_t
*
)(
GPIO2
|
GPIO_SWPORTA_DDR
)
=
1
<<
24
;
if
(
enable
)
{
*
(
uint32_t
*
)(
GPIO2
|
GPIO_SWPORTA_DR
)
=
1
<<
24
;
}
else
{
*
(
uint32_t
*
)(
GPIO2
|
GPIO_SWPORTA_DR
)
=
0
;
}
}
freertos/cvitek/task/comm/src/riscv64/milkv_duo_io.h
0 → 100644
View file @
9426e0ad
#include <stdio.h>
/*
* The blue LED on Duo is GPIOC24.
* The datasheet page 536 says:
* Configure register GPIO_SWPORTA_DDR and set GPIO as input or output.
* When the output pin is configured, write the output value to the
* GPIO_SWPORTA_DR register to control the GPIO output level.
*/
#define GPIO2 0x03022000
#define GPIO_SWPORTA_DR 0x000
#define GPIO_SWPORTA_DDR 0x004
void
duo_led_control
(
int
enable
);
linux_5.10/drivers/soc/cvitek/rtos_cmdqu/Makefile
View file @
9426e0ad
...
...
@@ -3,3 +3,4 @@ cvi_mbox-y := rtos_cmdqu.o \
cvi_spinlock.o
ccflags-y
+=
-I
$(srctree)
/
$(src)
/
ccflags-$(CONFIG_DYNAMIC_DEBUG)
+=
-DDEBUG
linux_5.10/drivers/soc/cvitek/rtos_cmdqu/rtos_cmdqu.h
View file @
9426e0ad
...
...
@@ -33,13 +33,6 @@ enum SYSTEM_CMD_TYPE {
CMDQU_SYSTEM_LIMIT
=
NR_SYSTEM_CMD
,
};
enum
SYS_CMD_ID
{
CMD_TEST_A
=
0x10
,
CMD_TEST_B
,
CMD_TEST_C
,
SYS_CMD_INFO_LIMIT
,
};
#define RTOS_CMDQU_DEV_NAME "cvi-rtos-cmdqu"
#define RTOS_CMDQU_SEND _IOW('r', CMDQU_SEND, unsigned long)
#define RTOS_CMDQU_SEND_WAIT _IOW('r', CMDQU_SEND_WAIT, unsigned long)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment