Added I-class variants to some SIO functions.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15720 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
533213a41d
commit
44417d95c3
|
@ -618,7 +618,9 @@ extern "C" {
|
||||||
void sioObjectInit(SIODriver *siop);
|
void sioObjectInit(SIODriver *siop);
|
||||||
msg_t sioStart(SIODriver *siop, const SIOConfig *config);
|
msg_t sioStart(SIODriver *siop, const SIOConfig *config);
|
||||||
void sioStop(SIODriver *siop);
|
void sioStop(SIODriver *siop);
|
||||||
|
void sioStartOperationI(SIODriver *siop, const SIOOperation *operation);
|
||||||
void sioStartOperation(SIODriver *siop, const SIOOperation *operation);
|
void sioStartOperation(SIODriver *siop, const SIOOperation *operation);
|
||||||
|
void sioStopOperationI(SIODriver *siop);
|
||||||
void sioStopOperation(SIODriver *siop);
|
void sioStopOperation(SIODriver *siop);
|
||||||
void sioWriteEnableFlags(SIODriver *siop, sioflags_t flags);
|
void sioWriteEnableFlags(SIODriver *siop, sioflags_t flags);
|
||||||
void sioSetEnableFlags(SIODriver *siop, sioflags_t flags);
|
void sioSetEnableFlags(SIODriver *siop, sioflags_t flags);
|
||||||
|
|
|
@ -156,7 +156,6 @@ msg_t bsdStart(BufferedSIODriver *bsdp, const BufferedSIOConfig *config) {
|
||||||
|
|
||||||
osalDbgCheck(bsdp != NULL);
|
osalDbgCheck(bsdp != NULL);
|
||||||
|
|
||||||
osalSysLock();
|
|
||||||
osalDbgAssert((bsdp->state == BS_STOP) || (bsdp->state == BS_READY),
|
osalDbgAssert((bsdp->state == BS_STOP) || (bsdp->state == BS_READY),
|
||||||
"invalid state");
|
"invalid state");
|
||||||
|
|
||||||
|
@ -167,15 +166,16 @@ msg_t bsdStart(BufferedSIODriver *bsdp, const BufferedSIOConfig *config) {
|
||||||
|
|
||||||
msg = sioStart(bsdp->siop, config);
|
msg = sioStart(bsdp->siop, config);
|
||||||
if (msg == HAL_RET_SUCCESS) {
|
if (msg == HAL_RET_SUCCESS) {
|
||||||
sioStartOperation(bsdp->siop, &bs_default_operation);
|
osalSysLock();
|
||||||
|
sioStartOperationI(bsdp->siop, &bs_default_operation);
|
||||||
|
sioWriteEnableFlagsI(bsdp->siop, SIO_FL_ALL);
|
||||||
bsdp->state = BS_READY;
|
bsdp->state = BS_READY;
|
||||||
|
osalSysUnlock();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bsdp->state = BS_STOP;
|
bsdp->state = BS_STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
osalSysUnlock();
|
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,8 +192,6 @@ void bsdStop(BufferedSIODriver *bsdp) {
|
||||||
|
|
||||||
osalDbgCheck(bsdp != NULL);
|
osalDbgCheck(bsdp != NULL);
|
||||||
|
|
||||||
osalSysLock();
|
|
||||||
|
|
||||||
osalDbgAssert((bsdp->state == BS_STOP) || (bsdp->state == BS_READY),
|
osalDbgAssert((bsdp->state == BS_STOP) || (bsdp->state == BS_READY),
|
||||||
"invalid state");
|
"invalid state");
|
||||||
|
|
||||||
|
@ -205,10 +203,10 @@ void bsdStop(BufferedSIODriver *bsdp) {
|
||||||
|
|
||||||
bsdp->state = BS_STOP;
|
bsdp->state = BS_STOP;
|
||||||
|
|
||||||
oqResetI(&bsdp->oqueue);
|
osalSysLock();
|
||||||
|
oqResetI(&bsdp->oqueue); /* TODO should go in the upper class.*/
|
||||||
iqResetI(&bsdp->iqueue);
|
iqResetI(&bsdp->iqueue);
|
||||||
osalOsRescheduleS();
|
osalOsRescheduleS();
|
||||||
|
|
||||||
osalSysUnlock();
|
osalSysUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -304,13 +304,12 @@ void sioStop(SIODriver *siop) {
|
||||||
* be @p NULL if callbacks are not required
|
* be @p NULL if callbacks are not required
|
||||||
* encoding the operation to be performed
|
* encoding the operation to be performed
|
||||||
*
|
*
|
||||||
* @api
|
* @iclass
|
||||||
*/
|
*/
|
||||||
void sioStartOperation(SIODriver *siop, const SIOOperation *operation) {
|
void sioStartOperationI(SIODriver *siop, const SIOOperation *operation) {
|
||||||
|
|
||||||
osalDbgCheck(siop != NULL);
|
osalDbgCheck(siop != NULL);
|
||||||
|
osalDbgCheckClassI();
|
||||||
osalSysLock();
|
|
||||||
|
|
||||||
osalDbgAssert((siop->state == SIO_READY) ||
|
osalDbgAssert((siop->state == SIO_READY) ||
|
||||||
(siop->state == SIO_ACTIVE), "invalid state");
|
(siop->state == SIO_ACTIVE), "invalid state");
|
||||||
|
@ -326,7 +325,7 @@ void sioStartOperation(SIODriver *siop, const SIOOperation *operation) {
|
||||||
|
|
||||||
if (siop->state == SIO_READY) {
|
if (siop->state == SIO_READY) {
|
||||||
sio_lld_start_operation(siop);
|
sio_lld_start_operation(siop);
|
||||||
siop->state = SIO_ACTIVE;
|
siop->state = SIO_ACTIVE;
|
||||||
|
|
||||||
#if SIO_USE_SYNCHRONIZATION == TRUE
|
#if SIO_USE_SYNCHRONIZATION == TRUE
|
||||||
/* If synchronization is enabled then some events are enforced by
|
/* If synchronization is enabled then some events are enforced by
|
||||||
|
@ -335,7 +334,22 @@ void sioStartOperation(SIODriver *siop, const SIOOperation *operation) {
|
||||||
SIO_FL_ALL_DATA | SIO_FL_ALL_ERRORS | SIO_FL_ALL_PROTOCOL);
|
SIO_FL_ALL_DATA | SIO_FL_ALL_ERRORS | SIO_FL_ALL_PROTOCOL);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Starts a SIO operation.
|
||||||
|
*
|
||||||
|
* @param[in] siop pointer to an @p SIODriver structure
|
||||||
|
* @param[in] operation pointer to an @p SIOOperation structure, can
|
||||||
|
* be @p NULL if callbacks are not required
|
||||||
|
* encoding the operation to be performed
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
void sioStartOperation(SIODriver *siop, const SIOOperation *operation) {
|
||||||
|
|
||||||
|
osalSysLock();
|
||||||
|
sioStartOperationI(siop, operation);
|
||||||
osalSysUnlock();
|
osalSysUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,13 +358,12 @@ void sioStartOperation(SIODriver *siop, const SIOOperation *operation) {
|
||||||
*
|
*
|
||||||
* @param[in] siop pointer to an @p SIODriver structure
|
* @param[in] siop pointer to an @p SIODriver structure
|
||||||
*
|
*
|
||||||
* @api
|
* @iclass
|
||||||
*/
|
*/
|
||||||
void sioStopOperation(SIODriver *siop) {
|
void sioStopOperationI(SIODriver *siop) {
|
||||||
|
|
||||||
osalDbgCheck(siop != NULL);
|
osalDbgCheck(siop != NULL);
|
||||||
|
osalDbgCheckClassI();
|
||||||
osalSysLock();
|
|
||||||
|
|
||||||
osalDbgAssert((siop->state == SIO_READY) ||
|
osalDbgAssert((siop->state == SIO_READY) ||
|
||||||
(siop->state == SIO_ACTIVE), "invalid state");
|
(siop->state == SIO_ACTIVE), "invalid state");
|
||||||
|
@ -369,7 +382,21 @@ void sioStopOperation(SIODriver *siop) {
|
||||||
siop->operation = NULL;
|
siop->operation = NULL;
|
||||||
siop->state = SIO_READY;
|
siop->state = SIO_READY;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stops an ongoing SIO operation, if any.
|
||||||
|
*
|
||||||
|
* @param[in] siop pointer to an @p SIODriver structure
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
void sioStopOperation(SIODriver *siop) {
|
||||||
|
|
||||||
|
osalDbgCheck(siop != NULL);
|
||||||
|
|
||||||
|
osalSysLock();
|
||||||
|
sioStopOperationI(siop);
|
||||||
osalSysUnlock();
|
osalSysUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue