/** * @brief Initializes the standard part of a @p CANDriver structure. * * @param[out] canp pointer to the @p CANDriver object * * @init */ void canObjectInit(CANDriver *canp) { canp->state = CAN_STOP; canp->config = NULL; osalThreadQueueObjectInit(&canp->txqueue); osalThreadQueueObjectInit(&canp->rxqueue); osalEventObjectInit(&canp->rxfull_event); osalEventObjectInit(&canp->txempty_event); osalEventObjectInit(&canp->error_event); #if CAN_USE_SLEEP_MODE == TRUE osalEventObjectInit(&canp->sleep_event); osalEventObjectInit(&canp->wakeup_event); #endif }
void sdObjectInit(SerialDriver *sdp, qnotify_t inotify, qnotify_t onotify) { sdp->vmt = &vmt; osalEventObjectInit(&sdp->event); sdp->state = SD_STOP; iqObjectInit(&sdp->iqueue, sdp->ib, SERIAL_BUFFERS_SIZE, inotify, sdp); oqObjectInit(&sdp->oqueue, sdp->ob, SERIAL_BUFFERS_SIZE, onotify, sdp); }
/** * @brief Initializes a generic full duplex driver object. * @details The HW dependent part of the initialization has to be performed * outside, usually in the hardware initialization code. * * @param[out] sdup pointer to a @p SerialUSBDriver structure * * @init */ void sduObjectInit(SerialUSBDriver *sdup) { sdup->vmt = &vmt; osalEventObjectInit(&sdup->event); sdup->state = SDU_STOP; iqObjectInit(&sdup->iqueue, sdup->ib, SERIAL_USB_BUFFERS_SIZE, inotify, sdup); oqObjectInit(&sdup->oqueue, sdup->ob, SERIAL_USB_BUFFERS_SIZE, onotify, sdup); }
/** * @brief Initialize the standard part of a @p MACDriver structure. * * @param[out] macp pointer to the @p MACDriver object * * @init */ void macObjectInit(MACDriver *macp) { macp->state = MAC_STOP; macp->config = NULL; osalThreadQueueObjectInit(&macp->tdqueue); osalThreadQueueObjectInit(&macp->rdqueue); #if MAC_USE_EVENTS == TRUE osalEventObjectInit(&macp->rdevent); #endif }
/** * @brief Initializes a generic teensy HID debug driver object. * @details The HW dependent part of the initialization has to be performed * outside, usually in the hardware initialization code. * * @param[out] hiddp pointer to a @p HIDDebugDriver structure * * @init */ void hidDebugObjectInit(HIDDebugDriver *hiddp) { hiddp->vmt = &vmt; osalEventObjectInit(&hiddp->event); hiddp->state = HIDDEBUG_STOP; /* TODO: how to make sure the queue is non-existent? */ /* hiddp->iqueue = (input_queue_t)NULL; */ hiddp->ib = (uint8_t *)NULL; oqObjectInit(&hiddp->oqueue, hiddp->ob, HID_DEBUG_OUTPUT_BUFFER_SIZE, onotify, hiddp); /* create the flush timer here as well (TODO: need to clean up/integrate!) */ chVTObjectInit(&hid_debug_flush_timer); }
/** * @brief Initializes a generic full duplex driver object. * @details The HW dependent part of the initialization has to be performed * outside, usually in the hardware initialization code. * * @param[out] sdup pointer to a @p SerialUSBDriver structure * * @init */ void sduObjectInit(SerialUSBDriver *sdup) { sdup->vmt = &vmt; osalEventObjectInit(&sdup->event); sdup->state = SDU_STOP; ibqObjectInit(&sdup->ibqueue, sdup->ib, SERIAL_USB_BUFFERS_SIZE, SERIAL_USB_BUFFERS_NUMBER, ibnotify, sdup); obqObjectInit(&sdup->obqueue, sdup->ob, SERIAL_USB_BUFFERS_SIZE, SERIAL_USB_BUFFERS_NUMBER, obnotify, sdup); }
/** * @brief Initializes a generic full duplex USB HID driver object. * @details The HW dependent part of the initialization has to be performed * outside, usually in the hardware initialization code. * * @param[out] uhdp pointer to a @p USBHIDDriver structure * * @init */ void hidObjectInit(USBHIDDriver *uhdp) { uhdp->vmt = &vmt; osalEventObjectInit(&uhdp->event); uhdp->state = HID_STOP; ibqObjectInit(&uhdp->ibqueue, uhdp->ib, USB_HID_BUFFERS_SIZE, USB_HID_BUFFERS_NUMBER, ibnotify, uhdp); obqObjectInit(&uhdp->obqueue, uhdp->ob, USB_HID_BUFFERS_SIZE, USB_HID_BUFFERS_NUMBER, obnotify, uhdp); }
/** * @brief Initializes all estimation threads. */ void EstimationInit(void) { /* Initialize new estimation event source */ osalEventObjectInit(&estimation_events_es); /* Start the estimation thread */ chThdCreateStatic(waThreadEstimation, sizeof(waThreadEstimation), HIGHPRIO - 2, ThreadEstimation, NULL); }
/** * @brief Initializes the standard part of a @p CANDriver structure. * * @param[out] canp pointer to the @p CANDriver object * * @init */ void canObjectInit(CANDriver *canp) { canp->state = CAN_STOP; canp->config = NULL; osalThreadQueueObjectInit(&canp->txqueue); osalThreadQueueObjectInit(&canp->rxqueue); #if CAN_ENFORCE_USE_CALLBACKS == FALSE osalEventObjectInit(&canp->rxfull_event); osalEventObjectInit(&canp->txempty_event); osalEventObjectInit(&canp->error_event); #if CAN_USE_SLEEP_MODE == TRUE osalEventObjectInit(&canp->sleep_event); osalEventObjectInit(&canp->wakeup_event); #endif #else /* CAN_ENFORCE_USE_CALLBACKS == TRUE */ canp->rxfull_cb = NULL; canp->txempty_cb = NULL; canp->error_cb = NULL; #if CAN_USE_SLEEP_MODE == TRUE canp->wakeup_cb = NULL; #endif #endif /* CAN_ENFORCE_USE_CALLBACKS == TRUE */ }
void sdObjectInit(SerialDriver *sdp) { sdp->vmt = &vmt; osalEventObjectInit(&sdp->event); sdp->state = SD_STOP; }