git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15743 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
2bb5f3c1c6
commit
0b506373ea
|
@ -26,6 +26,10 @@
|
|||
|
||||
#include "startup_defs.h"
|
||||
|
||||
|
||||
/* Sandbox objects.*/
|
||||
sb_class_t sbx1, sbx2;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* VHAL-related. */
|
||||
/*===========================================================================*/
|
||||
|
@ -45,7 +49,11 @@ static vio_gpio_units_t gpio_units1 = {
|
|||
static vio_uart_units_t uart_units1 = {
|
||||
.n = 1U,
|
||||
.units = {
|
||||
[0] = {&LPSIOD1}
|
||||
[0] = {
|
||||
.siop = &LPSIOD1,
|
||||
.vrqsb = &sbx1,
|
||||
.vrqn = 8
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -162,9 +170,6 @@ static const char *sbx2_envp[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
/* Sandbox objects.*/
|
||||
sb_class_t sbx1, sbx2;
|
||||
|
||||
static THD_WORKING_AREA(waUnprivileged1, 512);
|
||||
static THD_WORKING_AREA(waUnprivileged2, 512);
|
||||
|
||||
|
|
|
@ -432,10 +432,20 @@ msg_t sio_lld_control(SIODriver *siop, unsigned int operation, void *arg) {
|
|||
* @notapi
|
||||
*/
|
||||
void sio_lld_serve_interrupt(SIODriver *siop) {
|
||||
sioevents_t events;
|
||||
|
||||
/* The callback is simply invoked. Letting the driver on the host side
|
||||
decide how to manipulate IRQ sources.*/
|
||||
__sio_callback(siop);
|
||||
__syscall2rr(201, SB_VUART_GCEVT, siop->nvuart);
|
||||
osalDbgAssert((msg_t)r0 == HAL_RET_SUCCESS, "unexpected failure");
|
||||
|
||||
/* Only processing enabled events.*/
|
||||
events = (sioevents_t)r1;
|
||||
|
||||
/* Processing events, if any.*/
|
||||
if (events != (sioevents_t)0) {
|
||||
|
||||
/* The callback is finally invoked.*/
|
||||
__sio_callback(siop);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* HAL_USE_SIO == TRUE */
|
||||
|
|
|
@ -36,10 +36,6 @@
|
|||
#include "sbsysc.h"
|
||||
#include "sbconf.h"
|
||||
|
||||
#if (SB_CFG_ENABLE_VIO == TRUE) || defined (__DOXYGEN__)
|
||||
#include "sbvio.h"
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module constants. */
|
||||
/*===========================================================================*/
|
||||
|
@ -172,11 +168,25 @@
|
|||
/* Module data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
|
||||
/**
|
||||
* @brief Type of a sandbox object.
|
||||
*/
|
||||
typedef struct sb_class sb_class_t;
|
||||
|
||||
/**
|
||||
* @brief Type of a mask of Virtual IRQs.
|
||||
*/
|
||||
typedef uint32_t sb_vrqmask_t;
|
||||
|
||||
#if (SB_CFG_ENABLE_VRQ == TRUE) || defined (__DOXYGEN__)
|
||||
#include "sbvrq.h"
|
||||
#endif
|
||||
|
||||
#if (SB_CFG_ENABLE_VIO == TRUE) || defined (__DOXYGEN__)
|
||||
#include "sbvio.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Type of a sandbox manager global structure.
|
||||
*/
|
||||
|
@ -262,9 +272,9 @@ typedef struct {
|
|||
} sb_config_t;
|
||||
|
||||
/**
|
||||
* @brief Type of a sandbox object.
|
||||
* @brief Structure representing a sandbox object.
|
||||
*/
|
||||
typedef struct {
|
||||
struct sb_class {
|
||||
/**
|
||||
* @brief Pointer to the sandbox configuration data.
|
||||
*/
|
||||
|
@ -317,7 +327,7 @@ typedef struct {
|
|||
*/
|
||||
sb_ioblock_t io;
|
||||
#endif
|
||||
} sb_class_t;
|
||||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Module macros. */
|
||||
|
@ -339,10 +349,6 @@ extern "C" {
|
|||
/* Module inline functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if (SB_CFG_ENABLE_VRQ == TRUE) || defined (__DOXYGEN__)
|
||||
#include "sbvrq.h"
|
||||
#endif
|
||||
|
||||
#include "sbelf.h"
|
||||
#include "sbposix.h"
|
||||
#include "sbapi.h"
|
||||
|
|
|
@ -50,9 +50,9 @@
|
|||
/*===========================================================================*/
|
||||
|
||||
static void vuart_cb(SIODriver *siop) {
|
||||
sb_class_t *sbp = (sb_class_t *)siop->arg;
|
||||
const vio_uart_unit_t *unitp = (const vio_uart_unit_t *)siop->arg;
|
||||
|
||||
sbVRQTriggerFromISR(sbp, 1U << SB_CFG_ALARM_VRQ);
|
||||
sbVRQTriggerFromISR(unitp->vrqsb, 1U << unitp->vrqn);
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
|
@ -86,12 +86,14 @@ void sb_api_vio_uart(struct port_extctx *ectxp) {
|
|||
return;
|
||||
}
|
||||
|
||||
/* Specified VUART configuration.*/
|
||||
confp = &sbp->config->vioconf->uartconfs->cfgs[conf];
|
||||
|
||||
/* Associating this virtual UART to the SIO driver.*/
|
||||
unitp->siop->arg = (void *)unitp;
|
||||
|
||||
msg = sioStart(unitp->siop, confp->siocfgp);
|
||||
if (msg == HAL_RET_SUCCESS) {
|
||||
/* Associating this SIO to the sandbox.*/
|
||||
unitp->siop->arg = (sb_class_t *)sbp;
|
||||
|
||||
/* Starting with disabled events, enabling the callback.*/
|
||||
sioWriteEnableFlags(unitp->siop, SIO_FL_NONE);
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
*/
|
||||
typedef struct vio_uart_unit {
|
||||
SIODriver *siop;
|
||||
sb_class_t *vrqsb;
|
||||
unsigned vrqn;
|
||||
} vio_uart_unit_t;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue