docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* ccw_device_get_id - obtain a ccw device id @cdev: device to obtain the id for @dev_id: where to fill in the values */
void ccw_device_get_id(struct ccw_device *cdev, struct ccw_dev_id *dev_id)
/* ccw_device_get_id - obtain a ccw device id @cdev: device to obtain the id for @dev_id: where to fill in the values */ void ccw_device_get_id(struct ccw_device *cdev, struct ccw_dev_id *dev_id)
{ *dev_id = cdev->private->dev_id; }
robutest/uclinux
C++
GPL-2.0
60
/* Start the IO functionality used and enable the AF for selected IO pin(s). */
void mfxstm32l152_IO_Start(uint16_t DeviceAddr, uint32_t IO_Pin)
/* Start the IO functionality used and enable the AF for selected IO pin(s). */ void mfxstm32l152_IO_Start(uint16_t DeviceAddr, uint32_t IO_Pin)
{ uint8_t mode; mode = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL); mode |= MFXSTM32L152_GPIO_EN; if (IO_Pin > 0xFFFF) { mode |= MFXSTM32L152_ALTERNATE_GPIO_EN; } else { mode &= ~MFXSTM32L152_ALTERNATE_GPIO_EN; } MFX_IO_Write(DeviceAddr, MFXSTM32L152_REG_ADR_SYS_CTRL, mode); MFX_IO_Delay(1); }
eclipse-threadx/getting-started
C++
Other
310
/* Checks whether the specified ETHERNET MMC IT is set or not. */
INTStatus ETH_GetMmcIntStatus(uint32_t ETH_MMC_IT)
/* Checks whether the specified ETHERNET MMC IT is set or not. */ INTStatus ETH_GetMmcIntStatus(uint32_t ETH_MMC_IT)
{ INTStatus bitstatus = RESET; assert_param(IS_ETH_MMC_GET_INT(ETH_MMC_IT)); if ((ETH_MMC_IT & (uint32_t)0x10000000) != (uint32_t)RESET) { if ((((ETH->MMCRXINT & ETH_MMC_IT) != (uint32_t)RESET)) && ((ETH->MMCRXINTMSK & ETH_MMC_IT) != (uint32_t)RESET)) { bitstatus = SET; } else { bitstatus = RESET; } } else { if ((((ETH->MMCTXINT & ETH_MMC_IT) != (uint32_t)RESET)) && ((ETH->MMCRXINTMSK & ETH_MMC_IT) != (uint32_t)RESET)) { bitstatus = SET; } else { bitstatus = RESET; } } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* See _g_freedesktop_dbus_call_get_name_owner_sync() for the synchronous, blocking version of this method. */
void _g_freedesktop_dbus_call_get_name_owner(_GFreedesktopDBus *proxy, const gchar *arg_name, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* See _g_freedesktop_dbus_call_get_name_owner_sync() for the synchronous, blocking version of this method. */ void _g_freedesktop_dbus_call_get_name_owner(_GFreedesktopDBus *proxy, const gchar *arg_name, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ g_dbus_proxy_call (G_DBUS_PROXY (proxy), "GetNameOwner", g_variant_new ("(s)", arg_name), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Starts checksum computation. Configures the CRC module for the specified CRC protocol. */
static void crc_ConfigureAndStart(CRC_Type *base, const crc_module_config_t *config)
/* Starts checksum computation. Configures the CRC module for the specified CRC protocol. */ static void crc_ConfigureAndStart(CRC_Type *base, const crc_module_config_t *config)
{ uint32_t crcControl; crcControl = 0 | CRC_CTRL_TOT(config->writeTranspose) | CRC_CTRL_TOTR(config->readTranspose) | CRC_CTRL_FXOR(config->complementChecksum) | CRC_CTRL_TCRC(config->crcBits); base->CTRL = crcControl; base->GPOLY = config->polynomial; base->CTRL = crcControl | CRC_CTRL_WAS(true); base->DATA = config->seed; base->CTRL = crcControl; }
labapart/polymcu
C++
null
201
/* Trap START_STOP and READ_10 to leave/re-enter storage mode. Everything else is propagated to the normal bulk layer. */
static int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us)
/* Trap START_STOP and READ_10 to leave/re-enter storage mode. Everything else is propagated to the normal bulk layer. */ static int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us)
{ int ret; struct karma_data *data = (struct karma_data *) us->extra; if (srb->cmnd[0] == READ_10 && !data->in_storage) { ret = rio_karma_send_command(RIO_ENTER_STORAGE, us); if (ret) return ret; data->in_storage = 1; return usb_stor_Bulk_transport(srb, us); } else if (srb->cmnd[0] == START_STOP) { ret = rio_karma_send_command(RIO_LEAVE_STORAGE, us); if (ret) return ret; data->in_storage = 0; return rio_karma_send_command(RIO_RESET, us); } return usb_stor_Bulk_transport(srb, us); }
robutest/uclinux
C++
GPL-2.0
60
/* list_move_tail - delete from one list and add as another's tail @list: the entry to move @head: the head that will follow our entry */
static void list_move_tail(struct list_head *list, struct list_head *head)
/* list_move_tail - delete from one list and add as another's tail @list: the entry to move @head: the head that will follow our entry */ static void list_move_tail(struct list_head *list, struct list_head *head)
{ __list_del(list->prev, list->next); list_add_tail(list, head); }
robutest/uclinux
C++
GPL-2.0
60
/* r e m o v e I n d e x */
returnValue Constraints_removeIndex(Constraints *_THIS, Indexlist *const indexlist, int removenumber)
/* r e m o v e I n d e x */ returnValue Constraints_removeIndex(Constraints *_THIS, Indexlist *const indexlist, int removenumber)
{ if ( _THIS->status != 0 ) _THIS->status[removenumber] = ST_UNDEFINED; else return THROWERROR( RET_REMOVEINDEX_FAILED ); if ( indexlist != 0 ) { if ( Indexlist_removeNumber( indexlist,removenumber ) != SUCCESSFUL_RETURN ) return THROWERROR( RET_REMOVEINDEX_FAILED ); } else return THROWERROR( RET_INVALID_ARGUMENTS ); return SUCCESSFUL_RETURN; }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* This macro is used to enable input channel interrupt. */
void ECAP_EnableINT(ECAP_T *ecap, uint32_t u32Mask)
/* This macro is used to enable input channel interrupt. */ void ECAP_EnableINT(ECAP_T *ecap, uint32_t u32Mask)
{ ecap->CTL0 |= (u32Mask); if((ecap == ECAP0) || (ecap == ECAP0_NS)) { NVIC_EnableIRQ(ECAP0_IRQn); } else { NVIC_EnableIRQ(ECAP1_IRQn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* pci_msix_table_size - return the number of device's MSI-X table entries @dev: pointer to the pci_dev data structure of MSI-X device function */
int pci_msix_table_size(struct pci_dev *dev)
/* pci_msix_table_size - return the number of device's MSI-X table entries @dev: pointer to the pci_dev data structure of MSI-X device function */ int pci_msix_table_size(struct pci_dev *dev)
{ int pos; u16 control; pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); if (!pos) return 0; pci_read_config_word(dev, msi_control_reg(pos), &control); return multi_msix_capable(control); }
robutest/uclinux
C++
GPL-2.0
60
/* Get pointer to progress bar window. Returns a reference to the window that should be used when managing the widget, such as destroying, moving or reparenting it. */
struct win_window* wtk_progress_bar_as_child(struct wtk_progress_bar *bar)
/* Get pointer to progress bar window. Returns a reference to the window that should be used when managing the widget, such as destroying, moving or reparenting it. */ struct win_window* wtk_progress_bar_as_child(struct wtk_progress_bar *bar)
{ Assert(bar); return bar->container; }
memfault/zero-to-main
C++
null
200
/* De-initialize PWM Interface. stops operation and releases the software resources used by the interface. */
int32_t drv_pwm_uninitialize(pwm_handle_t handle)
/* De-initialize PWM Interface. stops operation and releases the software resources used by the interface. */ int32_t drv_pwm_uninitialize(pwm_handle_t handle)
{ PWM_NULL_PARAM_CHK(handle); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Writes a value to a PHY register hw - Struct containing variables accessed by shared code reg_addr - address of the PHY register to write data - data to write to the PHY */
int atl1e_write_phy_reg(struct atl1e_hw *hw, u32 reg_addr, u16 phy_data)
/* Writes a value to a PHY register hw - Struct containing variables accessed by shared code reg_addr - address of the PHY register to write data - data to write to the PHY */ int atl1e_write_phy_reg(struct atl1e_hw *hw, u32 reg_addr, u16 phy_data)
{ int i; u32 val; val = ((u32)(phy_data & MDIO_DATA_MASK)) << MDIO_DATA_SHIFT | (reg_addr&MDIO_REG_ADDR_MASK) << MDIO_REG_ADDR_SHIFT | MDIO_SUP_PREAMBLE | MDIO_START | MDIO_CLK_25_4 << MDIO_CLK_SEL_SHIFT; AT_WRITE_REG(hw, REG_MDIO_CTRL, val); wmb(); for (i = 0; i < MDIO_WAIT_TIMES; i++) { udelay(2); val = AT_READ_REG(hw, REG_MDIO_CTRL); if (!(val & (MDIO_START | MDIO_BUSY))) break; wmb(); } if (!(val & (MDIO_START | MDIO_BUSY))) return 0; return AT_ERR_PHY; }
robutest/uclinux
C++
GPL-2.0
60
/* Frank Warmerdam'2000: I modified this to return 1 if TIFF_BEENWRITING is not set, so that TIFFFlush() will proceed to write out the directory. The documentation says returning 1 is an error indicator, but not having been writing isn't exactly a an error. Hopefully this doesn't cause problems for other people. */
int TIFFFlushData(TIFF *tif)
/* Frank Warmerdam'2000: I modified this to return 1 if TIFF_BEENWRITING is not set, so that TIFFFlush() will proceed to write out the directory. The documentation says returning 1 is an error indicator, but not having been writing isn't exactly a an error. Hopefully this doesn't cause problems for other people. */ int TIFFFlushData(TIFF *tif)
{ if ((tif->tif_flags & TIFF_BEENWRITING) == 0) return (1); if (tif->tif_flags & TIFF_POSTENCODE) { tif->tif_flags &= ~TIFF_POSTENCODE; if (!(*tif->tif_postencode)(tif)) return (0); } return (TIFFFlushData1(tif)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Perform basic hardware initialization. Initialize the interrupt controller device drivers. Also initialize the timer device driver, if required. */
static int kw2xd_init(void)
/* Perform basic hardware initialization. Initialize the interrupt controller device drivers. Also initialize the timer device driver, if required. */ static int kw2xd_init(void)
{ PMC->REGSC |= PMC_REGSC_ACKISO_MASK; clock_init(); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This puts a job in the kernel-global workqueue if it was not already queued and leaves it in the same position on the kernel-global workqueue otherwise. */
int schedule_work(struct work_struct *work)
/* This puts a job in the kernel-global workqueue if it was not already queued and leaves it in the same position on the kernel-global workqueue otherwise. */ int schedule_work(struct work_struct *work)
{ return queue_work(keventd_wq, work); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* @buf: IP header @len: length of header in bytes */
static unsigned int efi_ip_checksum(const void *buf, size_t len)
/* @buf: IP header @len: length of header in bytes */ static unsigned int efi_ip_checksum(const void *buf, size_t len)
{ size_t i; u32 sum = 0; const u16 *pos = buf; for (i = 0; i < len; i += 2) sum += *pos++; sum = (sum >> 16) + (sum & 0xffff); sum += sum >> 16; sum = ~sum & 0xffff; return sum; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Detach an urb_link from a list, and set it up as a single element list, so no dangling pointers can be followed, and so it can be joined to another list if so desired. */
void urb_detach(struct urb *urb)
/* Detach an urb_link from a list, and set it up as a single element list, so no dangling pointers can be followed, and so it can be joined to another list if so desired. */ void urb_detach(struct urb *urb)
{ if (urb) { urb_link *ul = &urb->link; ul->next->prev = ul->prev; ul->prev->next = ul->next; urb_link_init (ul); } }
EmcraftSystems/u-boot
C++
Other
181
/* Copy 'size' bytes from 'src' to 'dest', correcting endianness if given 'islittle' is different from native endianness. */
static void copywithendian(char *dest, const char *src, int size, int islittle)
/* Copy 'size' bytes from 'src' to 'dest', correcting endianness if given 'islittle' is different from native endianness. */ static void copywithendian(char *dest, const char *src, int size, int islittle)
{ if (islittle == nativeendian.little) memcpy(dest, src, size); else { dest += size - 1; while (size-- != 0) *(dest--) = *(src++); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Dequeues all requests on an endpoint. As a side effect, interrupts will be disabled on that endpoint (because no more requests). */
static void nuke(struct pxa_ep *ep, int status)
/* Dequeues all requests on an endpoint. As a side effect, interrupts will be disabled on that endpoint (because no more requests). */ static void nuke(struct pxa_ep *ep, int status)
{ struct pxa27x_request *req; while (!list_empty(&ep->queue)) { req = list_entry(ep->queue.next, struct pxa27x_request, queue); req_done(ep, req, status); } }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */
uint16_t lcdGetHeight(void)
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */ uint16_t lcdGetHeight(void)
{ return hx8347dProperties.height; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Sets the alert function that's called when an interrupt is triggered due to a TCPC alert. */
static int ucpd_set_alert_handler_cb(const struct device *dev, tcpc_alert_handler_cb_t handler, void *alert_data)
/* Sets the alert function that's called when an interrupt is triggered due to a TCPC alert. */ static int ucpd_set_alert_handler_cb(const struct device *dev, tcpc_alert_handler_cb_t handler, void *alert_data)
{ struct tcpc_data *data = dev->data; data->alert_info.handler = handler; data->alert_info.data = alert_data; return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* History: <time> <version > <author> <desc> 1.0 Kingvan.Tong build this file */
unsigned int uvc_strlcpy(char *dest, const char *src, unsigned int size)
/* History: <time> <version > <author> <desc> 1.0 Kingvan.Tong build this file */ unsigned int uvc_strlcpy(char *dest, const char *src, unsigned int size)
{ unsigned int ret = strlen(src); if (size) { unsigned int len = (ret >= size) ? size - 1 : ret; memcpy(dest, src, len); dest[len] = '\0'; } return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the target "split_io" field to the minimum of all the snapshots' chunk sizes. */
static void origin_resume(struct dm_target *ti)
/* Set the target "split_io" field to the minimum of all the snapshots' chunk sizes. */ static void origin_resume(struct dm_target *ti)
{ struct dm_dev *dev = ti->private; ti->split_io = get_origin_minimum_chunksize(dev->bdev); }
robutest/uclinux
C++
GPL-2.0
60
/* snapshot_write_finalize - must be called after the last call to snapshot_write_next() in case the last page in the image happens to be a highmem page and its contents should be stored in the highmem. Additionally, it releases the memory that will not be used any more. */
void snapshot_write_finalize(struct snapshot_handle *handle)
/* snapshot_write_finalize - must be called after the last call to snapshot_write_next() in case the last page in the image happens to be a highmem page and its contents should be stored in the highmem. Additionally, it releases the memory that will not be used any more. */ void snapshot_write_finalize(struct snapshot_handle *handle)
{ copy_last_highmem_page(); if (handle->prev && handle->cur > nr_meta_pages + nr_copy_pages) { memory_bm_free(&orig_bm, PG_UNSAFE_CLEAR); free_highmem_data(); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Called to do the PIO mode setup. Our timing registers are shared so a configure_dmamode call will undo any work we do here and vice versa */
static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio)
/* Called to do the PIO mode setup. Our timing registers are shared so a configure_dmamode call will undo any work we do here and vice versa */ static void sl82c105_configure_piomode(struct ata_port *ap, struct ata_device *adev, int pio)
{ struct pci_dev *pdev = to_pci_dev(ap->host->dev); static u16 pio_timing[5] = { 0x50D, 0x407, 0x304, 0x242, 0x240 }; u16 dummy; int timing = 0x44 + (8 * ap->port_no) + (4 * adev->devno); pci_write_config_word(pdev, timing, pio_timing[pio]); pci_read_config_word(pdev, timing, &dummy); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Expands the 3 byte size commonly used in Firmware Volume data structures */
UINT32 FvBufExpand3ByteSize(IN VOID *Size)
/* Expands the 3 byte size commonly used in Firmware Volume data structures */ UINT32 FvBufExpand3ByteSize(IN VOID *Size)
{ return (((UINT8*)Size)[2] << 16) + (((UINT8*)Size)[1] << 8) + ((UINT8*)Size)[0]; }
tianocore/edk2
C++
Other
4,240
/* This function is mainly a wrapper around driver_register(). Returns: %0 on success and a negative error value on failure. */
int ccw_driver_register(struct ccw_driver *cdriver)
/* This function is mainly a wrapper around driver_register(). Returns: %0 on success and a negative error value on failure. */ int ccw_driver_register(struct ccw_driver *cdriver)
{ struct device_driver *drv = &cdriver->driver; drv->bus = &ccw_bus_type; drv->name = cdriver->name; drv->owner = cdriver->owner; return driver_register(drv); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the last block number of the block range list. It removes all the blocks after the Last. MTFTP initialize the block range to the maximum possible range, such as for WRQ. When it gets the last block number, it calls this function to set the last block number. */
VOID Mtftp6SetLastBlockNum(IN LIST_ENTRY *Head, IN UINT16 Last)
/* Set the last block number of the block range list. It removes all the blocks after the Last. MTFTP initialize the block range to the maximum possible range, such as for WRQ. When it gets the last block number, it calls this function to set the last block number. */ VOID Mtftp6SetLastBlockNum(IN LIST_ENTRY *Head, IN UINT16 Last)
{ MTFTP6_BLOCK_RANGE *Range; while (!IsListEmpty (Head)) { Range = NET_LIST_TAIL (Head, MTFTP6_BLOCK_RANGE, Link); if (Range->Start > Last) { RemoveEntryList (&Range->Link); FreePool (Range); continue; } if (Range->End > Last) { Range->End = Last; } return; } }
tianocore/edk2
C++
Other
4,240
/* param base TMPSNS base pointer param mask The interrupts to enable from tmpsns_interrupt_status_enable_t. */
void TMPSNS_EnableInterrupt(TMPSNS_Type *base, uint32_t mask)
/* param base TMPSNS base pointer param mask The interrupts to enable from tmpsns_interrupt_status_enable_t. */ void TMPSNS_EnableInterrupt(TMPSNS_Type *base, uint32_t mask)
{ uint32_t tempRegVal; tempRegVal = TMPSNS_AIReadAccess((uint32_t) & (base->CTRL1)); TMPSNS_AIWriteAccess((uint32_t) & (base->CTRL1), tempRegVal | mask); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables interrupt coming from the given (unique) source (AT91C_ID_xxx). */
void IRQ_EnableIT(unsigned int source)
/* Enables interrupt coming from the given (unique) source (AT91C_ID_xxx). */ void IRQ_EnableIT(unsigned int source)
{ NVIC_EnableIRQ((IRQn_Type)source); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This call is similar to hwconfig_f(), except that it takes additional argument @subopt. In this example: "dr_usb:mode=peripheral" "dr_usb" is an option, "mode" is a sub-option, and "peripheral" is its argument. */
int hwconfig_sub_f(const char *opt, const char *subopt, char *buf)
/* This call is similar to hwconfig_f(), except that it takes additional argument @subopt. In this example: "dr_usb:mode=peripheral" "dr_usb" is an option, "mode" is a sub-option, and "peripheral" is its argument. */ int hwconfig_sub_f(const char *opt, const char *subopt, char *buf)
{ size_t arglen; const char *arg; arg = __hwconfig(opt, &arglen, buf); if (!arg) return 0; return !!hwconfig_parse(arg, arglen, subopt, ",;", '=', NULL); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Set update rate of the channel value registers. It is recommended that this rate be at most 80 times lower than the output data rate of the ADC. */
int32_t cn0414_channel_set_update_rate(struct cn0414_dev *dev, uint8_t *arg)
/* Set update rate of the channel value registers. It is recommended that this rate be at most 80 times lower than the output data rate of the ADC. */ int32_t cn0414_channel_set_update_rate(struct cn0414_dev *dev, uint8_t *arg)
{ float new_rate; low_sample_rate_flag = 0; new_rate = atof((char *)arg); cn0414_channel_sur_check(dev, &new_rate); return adc_update_set_rate(dev->adc_update_desc, new_rate); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* If Sha384Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceSha384Final(IN OUT VOID *Sha384Context, OUT UINT8 *HashValue)
/* If Sha384Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceSha384Final(IN OUT VOID *Sha384Context, OUT UINT8 *HashValue)
{ return CALL_BASECRYPTLIB (Sha384.Services.Final, Sha384Final, (Sha384Context, HashValue), FALSE); }
tianocore/edk2
C++
Other
4,240
/* erplog controls the logging of ERP related data (e.g. failing channel programs). */
static ssize_t dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf)
/* erplog controls the logging of ERP related data (e.g. failing channel programs). */ static ssize_t dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf)
{ struct dasd_devmap *devmap; int erplog; devmap = dasd_find_busid(dev_name(dev)); if (!IS_ERR(devmap)) erplog = (devmap->features & DASD_FEATURE_ERPLOG) != 0; else erplog = (DASD_FEATURE_DEFAULT & DASD_FEATURE_ERPLOG) != 0; return snprintf(buf, PAGE_SIZE, erplog ? "1\n" : "0\n"); }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the length of received frame (if any). */
static status_t enet_get_rx_frame_size(struct ethernetif *ethernetif, uint32_t *length)
/* Gets the length of received frame (if any). */ static status_t enet_get_rx_frame_size(struct ethernetif *ethernetif, uint32_t *length)
{ return ENET_GetRxFrameSize(&ethernetif->handle, length); }
nanoframework/nf-interpreter
C++
MIT License
293
/* IER sleep support. UARTs which have EFRs need the "extended capability" bit enabled. Note that on XR16C850s, we need to reset LCR to write to IER. */
static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
/* IER sleep support. UARTs which have EFRs need the "extended capability" bit enabled. Note that on XR16C850s, we need to reset LCR to write to IER. */ static void serial8250_set_sleep(struct uart_8250_port *p, int sleep)
{ if (p->capabilities & UART_CAP_SLEEP) { if (p->capabilities & UART_CAP_EFR) { serial_outp(p, UART_LCR, 0xBF); serial_outp(p, UART_EFR, UART_EFR_ECB); serial_outp(p, UART_LCR, 0); } serial_outp(p, UART_IER, sleep ? UART_IERX_SLEEP : 0); if (p->capabilities & UART_CAP_EFR) { serial_outp(p, UART_LCR, 0xBF); serial_outp(p, UART_EFR, 0); serial_outp(p, UART_LCR, 0); } } }
robutest/uclinux
C++
GPL-2.0
60
/* If necessary, first collects the instruction up to and including the immediates bytes. */
void insn_get_length(struct insn *insn)
/* If necessary, first collects the instruction up to and including the immediates bytes. */ void insn_get_length(struct insn *insn)
{ if (insn->length) return; if (!insn->immediate.got) insn_get_immediate(insn); insn->length = (unsigned char)((unsigned long)insn->next_byte - (unsigned long)insn->kaddr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* For use when you can have multiple fragments in the same frame added to the same reassembled PDU, e.g. with ONC RPC-over-TCP. */
fragment_head* fragment_add_multiple_ok(reassembly_table *table, tvbuff_t *tvb, const int offset, const packet_info *pinfo, const guint32 id, const void *data, const guint32 frag_offset, const guint32 frag_data_len, const gboolean more_frags)
/* For use when you can have multiple fragments in the same frame added to the same reassembled PDU, e.g. with ONC RPC-over-TCP. */ fragment_head* fragment_add_multiple_ok(reassembly_table *table, tvbuff_t *tvb, const int offset, const packet_info *pinfo, const guint32 id, const void *data, const guint32 frag_offset, const guint32 frag_data_len, const gboolean more_frags)
{ return fragment_add_common(table, tvb, offset, pinfo, id, data, frag_offset, frag_data_len, more_frags, FALSE); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Exit a critical section. Critical sections are needed in an interrupt driven software program to obtain mutual exclusive access shared resources such as global data and certain peripherals. Note that each call to this function should always be preceded by a call to */
void TbxCriticalSectionExit(void)
/* Exit a critical section. Critical sections are needed in an interrupt driven software program to obtain mutual exclusive access shared resources such as global data and certain peripherals. Note that each call to this function should always be preceded by a call to */ void TbxCriticalSectionExit(void)
{ TBX_ASSERT(tbxCritSectNestingCounter > 0U); if (tbxCritSectNestingCounter > 0U) { tbxCritSectNestingCounter--; if (tbxCritSectNestingCounter == 0U) { TbxPortInterruptsRestore(tbxCritSectCpuSR); } } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Function for printing speed or cadence page0 data. */
static void page0_data_log(ant_bsc_page0_data_t const *p_page_data)
/* Function for printing speed or cadence page0 data. */ static void page0_data_log(ant_bsc_page0_data_t const *p_page_data)
{ LOG_PAGE0("%-30s %u\n\r", "Revolution count:", (unsigned int)p_page_data->rev_count); LOG_PAGE0("%-30s %u.", "BSC event time:", (unsigned int)ANT_BSC_EVENT_TIME_SEC(p_page_data->event_time)); LOG_PAGE0("%03us\n\r", (unsigned int)ANT_BSC_EVENT_TIME_MSEC(p_page_data->event_time)); }
labapart/polymcu
C++
null
201
/* Checks whether the specified TIM flag is set or not. */
FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint32_t TIM_FLAG)
/* Checks whether the specified TIM flag is set or not. */ FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint32_t TIM_FLAG)
{ ITStatus bitstatus = RESET; assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_TIM_GET_FLAG(TIM_FLAG)); if ((TIMx->SR & TIM_FLAG) != RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
ajhc/demo-cortex-m3
C++
null
38
/* Configure block length for MMC/SD cards and initiate the transfer. */
static int omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, struct mmc_request *req)
/* Configure block length for MMC/SD cards and initiate the transfer. */ static int omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, struct mmc_request *req)
{ int ret; host->data = req->data; if (req->data == NULL) { OMAP_HSMMC_WRITE(host->base, BLK, 0); if (req->cmd->flags & MMC_RSP_BUSY) set_data_timeout(host, 100000000U, 0); return 0; } OMAP_HSMMC_WRITE(host->base, BLK, (req->data->blksz) | (req->data->blocks << 16)); set_data_timeout(host, req->data->timeout_ns, req->data->timeout_clks); if (host->use_dma) { ret = omap_hsmmc_start_dma_transfer(host, req); if (ret != 0) { dev_dbg(mmc_dev(host->mmc), "MMC start dma failure\n"); return ret; } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Read multiple lines until a complete Lua statement */
static int multiline(lua_State *L)
/* Read multiple lines until a complete Lua statement */ static int multiline(lua_State *L)
{ size_t len; const char *line = lua_tolstring(L, 1, &len); int status = luaL_loadbuffer(L, line, len, "=stdin"); if (!incomplete(L, status) || !pushline(L, 0)) { lua_saveline(L, line); return status; } lua_pushliteral(L, "\n"); lua_insert(L, -2); lua_concat(L, 3); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Return value: number of bytes printed to buffer */
static ssize_t ibmvfc_store_log_level(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
/* Return value: number of bytes printed to buffer */ static ssize_t ibmvfc_store_log_level(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ struct Scsi_Host *shost = class_to_shost(dev); struct ibmvfc_host *vhost = shost_priv(shost); unsigned long flags = 0; spin_lock_irqsave(shost->host_lock, flags); vhost->log_level = simple_strtoul(buf, NULL, 10); spin_unlock_irqrestore(shost->host_lock, flags); return strlen(buf); }
robutest/uclinux
C++
GPL-2.0
60
/* Determine whether a buffer is currently out on a read-ahead request. ci_io_sem should be held to serialize submitters with the logic here. */
int ocfs2_buffer_read_ahead(struct ocfs2_caching_info *ci, struct buffer_head *bh)
/* Determine whether a buffer is currently out on a read-ahead request. ci_io_sem should be held to serialize submitters with the logic here. */ int ocfs2_buffer_read_ahead(struct ocfs2_caching_info *ci, struct buffer_head *bh)
{ return buffer_locked(bh) && ocfs2_buffer_cached(ci, bh); }
robutest/uclinux
C++
GPL-2.0
60
/* Peer allocation may fail only in serious out-of-memory conditions. However we still can generate some output. Random ID selection looks a bit dangerous because we have no chances to select ID being unique in a reasonable period of time. But broken packet identifier may be better than no packet at all. */
static void ip_select_fb_ident(struct iphdr *iph)
/* Peer allocation may fail only in serious out-of-memory conditions. However we still can generate some output. Random ID selection looks a bit dangerous because we have no chances to select ID being unique in a reasonable period of time. But broken packet identifier may be better than no packet at all. */ static void ip_select_fb_ident(struct iphdr *iph)
{ static DEFINE_SPINLOCK(ip_fb_id_lock); static u32 ip_fallback_id; u32 salt; spin_lock_bh(&ip_fb_id_lock); salt = secure_ip_id((__force __be32)ip_fallback_id ^ iph->daddr); iph->id = htons(salt & 0xFFFF); ip_fallback_id = salt; spin_unlock_bh(&ip_fb_id_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Starts the counter. It must be previously configured with hw_counter_set_period() and hw_counter_set_target(). */
void hw_counter_start(void)
/* Starts the counter. It must be previously configured with hw_counter_set_period() and hw_counter_set_target(). */ void hw_counter_start(void)
{ if (counter_running) { return; } counter_running = true; hw_counter_timer = nsi_hws_get_time() + counter_period; nsi_hws_find_next_event(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Give reset command to the CAN controller using SPI interface. */
int32_t can_ctrl_ecc_set(struct can_ctrl_dev *dev, bool enable)
/* Give reset command to the CAN controller using SPI interface. */ int32_t can_ctrl_ecc_set(struct can_ctrl_dev *dev, bool enable)
{ int32_t ret; uint32_t temp; ret = can_ctrl_sfr_word_read(dev, CAN_CTRL_REG_ECCCON, &temp); if(ret != 0) return ret; temp &= ~ECCCON_ECCEN_MODE(WORD_MASK); temp |= ECCCON_ECCEN_MODE(enable); return can_ctrl_sfr_word_write(dev, CAN_CTRL_REG_ECCCON, temp); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This function sleeps until the commit operation is no longer running. */
static int wait_for_commit(struct ubifs_info *c)
/* This function sleeps until the commit operation is no longer running. */ static int wait_for_commit(struct ubifs_info *c)
{ dbg_cmt("pid %d goes sleep", current->pid); wait_event(c->cmt_wq, c->cmt_state != COMMIT_RUNNING_BACKGROUND && c->cmt_state != COMMIT_RUNNING_REQUIRED); dbg_cmt("commit finished, pid %d woke up", current->pid); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The TRAPA handler used to force a context switch. */
void vPortYield(void)
/* The TRAPA handler used to force a context switch. */ void vPortYield(void)
{ int32_t lInterruptMask; lInterruptMask = get_imask(); set_imask( portKERNEL_INTERRUPT_PRIORITY ); trapa( portYIELD_TRAP_NO ); set_imask( ( int ) lInterruptMask ); }
labapart/polymcu
C++
null
201
/* If we have an error on a dasd_block layer request then we cancel and return all further requests from the same dasd_block as well. */
static void __dasd_device_recovery(struct dasd_device *device, struct dasd_ccw_req *ref_cqr)
/* If we have an error on a dasd_block layer request then we cancel and return all further requests from the same dasd_block as well. */ static void __dasd_device_recovery(struct dasd_device *device, struct dasd_ccw_req *ref_cqr)
{ struct list_head *l, *n; struct dasd_ccw_req *cqr; if (!ref_cqr->block) return; list_for_each_safe(l, n, &device->ccw_queue) { cqr = list_entry(l, struct dasd_ccw_req, devlist); if (cqr->status == DASD_CQR_QUEUED && ref_cqr->block == cqr->block) { cqr->status = DASD_CQR_CLEARED; } } }
robutest/uclinux
C++
GPL-2.0
60
/* Reads data from the specified adc channel fifo. */
uint16_t analogin_read_u16(analogin_t *obj)
/* Reads data from the specified adc channel fifo. */ uint16_t analogin_read_u16(analogin_t *obj)
{ uint8_t ChIdx = obj->adc_idx; uint32_t data; ADC->ADC_CHSW_LIST[0] = ChIdx; ADC_ClearFIFO(); ADC_SWTrigCmd(ENABLE); while(ADC_Readable()== 0); ADC_SWTrigCmd(DISABLE); data = ADC_Read(); return (uint16_t)(data & BIT_MASK_DAT_GLOBAL); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Draws a block at the specified LCD address. A block is the smallest addressable memory on the LCD and is equivalent to 8 pixels, each of which is represented by 2 bits that represent a grayscale value between 00b and 11b. */
void halLcdDrawBlock(unsigned int Address, unsigned int Value)
/* Draws a block at the specified LCD address. A block is the smallest addressable memory on the LCD and is equivalent to 8 pixels, each of which is represented by 2 bits that represent a grayscale value between 00b and 11b. */ void halLcdDrawBlock(unsigned int Address, unsigned int Value)
{ halLcdSetAddress(Address); halLcdDrawCurrentBlock(Value); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* param base LPSPI peripheral base address. param handle LPSPI handle pointer to lpspi_slave_edma_handle_t. param callback LPSPI callback. param userData callback function parameter. param edmaRxRegToRxDataHandle edmaRxRegToRxDataHandle pointer to edma_handle_t. param edmaTxDataToTxRegHandle edmaTxDataToTxRegHandle pointer to edma_handle_t. */
void LPSPI_SlaveTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, lpspi_slave_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
/* param base LPSPI peripheral base address. param handle LPSPI handle pointer to lpspi_slave_edma_handle_t. param callback LPSPI callback. param userData callback function parameter. param edmaRxRegToRxDataHandle edmaRxRegToRxDataHandle pointer to edma_handle_t. param edmaTxDataToTxRegHandle edmaTxDataToTxRegHandle pointer to edma_handle_t. */ void LPSPI_SlaveTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_slave_edma_handle_t *handle, lpspi_slave_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
{ assert(handle); assert(edmaRxRegToRxDataHandle); assert(edmaTxDataToTxRegHandle); (void)memset(handle, 0, sizeof(*handle)); uint32_t instance = LPSPI_GetInstance(base); s_lpspiSlaveEdmaPrivateHandle[instance].base = base; s_lpspiSlaveEdmaPrivateHandle[instance].handle = handle; handle->callback = callback; handle->userData = userData; handle->edmaRxRegToRxDataHandle = edmaRxRegToRxDataHandle; handle->edmaTxDataToTxRegHandle = edmaTxDataToTxRegHandle; }
eclipse-threadx/getting-started
C++
Other
310
/* Convert hexadecimal value to integer part of temperature. */
static void mcp980x_hex_to_temperature_int(uint8_t uc_hex, int8_t *p_integer)
/* Convert hexadecimal value to integer part of temperature. */ static void mcp980x_hex_to_temperature_int(uint8_t uc_hex, int8_t *p_integer)
{ *p_integer = (int8_t) uc_hex; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Check whether there is already a label with the given 'name'. */
static void checkrepeated(LexState *ls, TString *name)
/* Check whether there is already a label with the given 'name'. */ static void checkrepeated(LexState *ls, TString *name)
{ const char *msg = "label '%s' already defined on line %d"; msg = luaO_pushfstring(ls->L, msg, getstr(name), lb->line); luaK_semerror(ls, msg); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Platform console init. Include the platform firmware vendor, revision and so crc check. */
VOID EFIAPI PlatformConsoleInit(VOID)
/* Platform console init. Include the platform firmware vendor, revision and so crc check. */ VOID EFIAPI PlatformConsoleInit(VOID)
{ VisitAllInstancesOfProtocol ( &gEfiPciRootBridgeIoProtocolGuid, ConnectOneRootBridge ); DetectAndPreparePlatformPciDevicePaths (FALSE); }
tianocore/edk2
C++
Other
4,240
/* Draws a single pixel at the specified X/Y location. */
void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
/* Draws a single pixel at the specified X/Y location. */ void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
{ if((x >= hx8347dProperties.width) || (y >= hx8347dProperties.height)) { return; } fillRect(x,y,x,y,color); return; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Description: Make sure the PHY is set to supported speeds and duplexes. Drop down by one in this order: 1000/FULL, 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF. */
void phy_sanitize_settings(struct phy_device *phydev)
/* Description: Make sure the PHY is set to supported speeds and duplexes. Drop down by one in this order: 1000/FULL, 1000/HALF, 100/FULL, 100/HALF, 10/FULL, 10/HALF. */ void phy_sanitize_settings(struct phy_device *phydev)
{ u32 features = phydev->supported; int idx; if ((features & SUPPORTED_Autoneg) == 0) phydev->autoneg = AUTONEG_DISABLE; idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex), features); phydev->speed = settings[idx].speed; phydev->duplex = settings[idx].duplex; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified AES flag is set or not. */
FlagStatus AES_GetFlagStatus(uint32_t AES_FLAG)
/* Checks whether the specified AES flag is set or not. */ FlagStatus AES_GetFlagStatus(uint32_t AES_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_AES_FLAG(AES_FLAG)); if ((AES->SR & AES_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
avem-labs/Avem
C++
MIT License
1,752
/* Moved here from drivers/net/net_init.c, which is: Written 1993,1994,1995 by Donald Becker. */
static void ltalk_setup(struct net_device *dev)
/* Moved here from drivers/net/net_init.c, which is: Written 1993,1994,1995 by Donald Becker. */ static void ltalk_setup(struct net_device *dev)
{ dev->type = ARPHRD_LOCALTLK; dev->hard_header_len = LTALK_HLEN; dev->mtu = LTALK_MTU; dev->addr_len = LTALK_ALEN; dev->tx_queue_len = 10; dev->broadcast[0] = 0xFF; dev->flags = IFF_BROADCAST|IFF_MULTICAST|IFF_NOARP; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Put all the gunge required to become a kernel thread without attached user resources in one place where it belongs. */
void daemonize(const char *name,...)
/* Put all the gunge required to become a kernel thread without attached user resources in one place where it belongs. */ void daemonize(const char *name,...)
{ va_list args; sigset_t blocked; va_start(args, name); vsnprintf(current->comm, sizeof(current->comm), name, args); va_end(args); exit_mm(current); current->flags |= (PF_NOFREEZE | PF_KTHREAD); if (current->nsproxy != &init_nsproxy) { get_nsproxy(&init_nsproxy); switch_task_namespaces(current, &init_nsproxy); } set_special_pids(&init_struct_pid); proc_clear_tty(current); sigfillset(&blocked); sigprocmask(SIG_BLOCK, &blocked, NULL); flush_signals(current); daemonize_fs_struct(); exit_files(current); current->files = init_task.files; atomic_inc(&current->files->count); reparent_to_kthreadd(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Checks whether the FLASH Sleep Mode status is SET or RESET. */
FlagStatus FLASH_GetFLASHSleepModeSTS(void)
/* Checks whether the FLASH Sleep Mode status is SET or RESET. */ FlagStatus FLASH_GetFLASHSleepModeSTS(void)
{ FlagStatus bitstatus = RESET; if ((FLASH->AC & AC_SLMF_MSK) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Calculate the corresponding pci bus address according to the Mem parameter. */
EFI_PHYSICAL_ADDRESS UsbHcGetPciAddrForHostAddr(IN USBHC_MEM_POOL *Pool, IN VOID *Mem, IN UINTN Size, IN BOOLEAN Alignment)
/* Calculate the corresponding pci bus address according to the Mem parameter. */ EFI_PHYSICAL_ADDRESS UsbHcGetPciAddrForHostAddr(IN USBHC_MEM_POOL *Pool, IN VOID *Mem, IN UINTN Size, IN BOOLEAN Alignment)
{ USBHC_MEM_BLOCK *Head; USBHC_MEM_BLOCK *Block; UINTN AllocSize; EFI_PHYSICAL_ADDRESS PhyAddr; UINTN Offset; Head = Pool->Head; if (Alignment) { AllocSize = USBHC_MEM_ROUND (Size); } else { AllocSize = Size; } if (Mem == NULL) { return 0; } for (Block = Head; Block != NULL; Block = Block->Next) { if ((Block->BufHost <= (UINT8 *)Mem) && (((UINT8 *)Mem + AllocSize) <= (Block->BufHost + Block->BufLen))) { break; } } ASSERT ((Block != NULL)); Offset = (UINT8 *)Mem - Block->BufHost; PhyAddr = (EFI_PHYSICAL_ADDRESS)(UINTN)(Block->Buf + Offset); return PhyAddr; }
tianocore/edk2
C++
Other
4,240
/* Map 'pfn' using fixed map 'type' and protections 'prot' */
void* iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
/* Map 'pfn' using fixed map 'type' and protections 'prot' */ void* iomap_atomic_prot_pfn(unsigned long pfn, enum km_type type, pgprot_t prot)
{ if (!pat_enabled && pgprot_val(prot) == pgprot_val(PAGE_KERNEL_WC)) prot = PAGE_KERNEL_UC_MINUS; return kmap_atomic_prot_pfn(pfn, type, prot); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = USART_TX_Pin|USART_RX_Pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF7_USART2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return an appropriate combo box entry number for the given an AirpcapValidationType, defaulting to 0 */
gint airpcap_get_validation_combo_entry(AirpcapValidationType vt)
/* Return an appropriate combo box entry number for the given an AirpcapValidationType, defaulting to 0 */ gint airpcap_get_validation_combo_entry(AirpcapValidationType vt)
{ switch (vt) { case AIRPCAP_VT_ACCEPT_CORRECT_FRAMES: return 1; break; case AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES: return 2; break; default: return 0; break; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* rpavscsi_task: - Process srps asynchronously @data: ibmvscsi_host_data of host */
static void rpavscsi_task(void *data)
/* rpavscsi_task: - Process srps asynchronously @data: ibmvscsi_host_data of host */ static void rpavscsi_task(void *data)
{ struct ibmvscsi_host_data *hostdata = (struct ibmvscsi_host_data *)data; struct vio_dev *vdev = to_vio_dev(hostdata->dev); struct viosrp_crq *crq; int done = 0; while (!done) { while ((crq = crq_queue_next_crq(&hostdata->queue)) != NULL) { ibmvscsi_handle_crq(crq, hostdata); crq->valid = 0x00; } vio_enable_interrupts(vdev); if ((crq = crq_queue_next_crq(&hostdata->queue)) != NULL) { vio_disable_interrupts(vdev); ibmvscsi_handle_crq(crq, hostdata); crq->valid = 0x00; } else { done = 1; } } }
robutest/uclinux
C++
GPL-2.0
60
/* This function configures system clock at maximum frequency with HSI as clock source of the PLL. */
ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
/* This function configures system clock at maximum frequency with HSI as clock source of the PLL. */ ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
{ ErrorStatus status; uint32_t pllfreq; if (UTILS_PLL_IsBusy() == SUCCESS) { pllfreq = UTILS_GetPLLOutputFrequency(HSI_VALUE, UTILS_PLLInitStruct); if (LL_RCC_HSI_IsReady() != 1U) { LL_RCC_HSI_Enable(); while (LL_RCC_HSI_IsReady() != 1U) { } } LL_RCC_PLL1_ConfigDomain_SYS(LL_RCC_PLL1SOURCE_HSI, UTILS_PLLInitStruct->PLLM, UTILS_PLLInitStruct->PLLN, UTILS_PLLInitStruct->PLLR); status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct); } else { status = ERROR; } return status; }
eclipse-threadx/getting-started
C++
Other
310
/* The GetPhysicalAddress() function retrieves the base address of a memory-mapped firmware volume. This function should be called only for memory-mapped firmware volumes. */
EFI_STATUS EFIAPI FvbProtocolGetPhysicalAddress(IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, OUT EFI_PHYSICAL_ADDRESS *Address)
/* The GetPhysicalAddress() function retrieves the base address of a memory-mapped firmware volume. This function should be called only for memory-mapped firmware volumes. */ EFI_STATUS EFIAPI FvbProtocolGetPhysicalAddress(IN CONST EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL *This, OUT EFI_PHYSICAL_ADDRESS *Address)
{ EFI_FW_VOL_BLOCK_DEVICE *FvbDevice; FvbDevice = FVB_DEVICE_FROM_THIS (This); *Address = (EFI_PHYSICAL_ADDRESS)(UINTN)FvbDevice->BufferPtr; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* PCI Bus Number - Max 256 busses (Bits 15:8 of BDF) PCI Device Number - Max 32 devices (Bits 7:3 of BDF) PCI Function Number - Max 8 functions (Bits 2:0 of BDF) */
STATIC UINT16 GetBdf(IN CONST CM_ARM_DEVICE_HANDLE_PCI *DeviceHandlePci)
/* PCI Bus Number - Max 256 busses (Bits 15:8 of BDF) PCI Device Number - Max 32 devices (Bits 7:3 of BDF) PCI Function Number - Max 8 functions (Bits 2:0 of BDF) */ STATIC UINT16 GetBdf(IN CONST CM_ARM_DEVICE_HANDLE_PCI *DeviceHandlePci)
{ UINT16 Bdf; Bdf = (UINT16)DeviceHandlePci->BusNumber << 8; Bdf |= (DeviceHandlePci->DeviceNumber & 0x1F) << 3; Bdf |= DeviceHandlePci->FunctionNumber & 0x7; return Bdf; }
tianocore/edk2
C++
Other
4,240
/* Message: EnhancedAlarmMessage Opcode: 0x015a Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
static void handle_EnhancedAlarmMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: EnhancedAlarmMessage Opcode: 0x015a Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */ static void handle_EnhancedAlarmMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ dissect_skinny_xml(cursor, hf_skinny_alarmInfo, pinfo, 0, 2048); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Mark interrupt as serviced. After an interrupt is services, its flag must be cleared. If the flag is not cleared, then execution will jump back to the start of the ISR after the ISR returns. */
void uart_clear_interrupt_flag(uint32_t uart, enum uart_interrupt_flag ints)
/* Mark interrupt as serviced. After an interrupt is services, its flag must be cleared. If the flag is not cleared, then execution will jump back to the start of the ISR after the ISR returns. */ void uart_clear_interrupt_flag(uint32_t uart, enum uart_interrupt_flag ints)
{ UART_ICR(uart) |= ints; } /**@}
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* start_transaction gets us a new handle for a truncate transaction, and extend_transaction tries to extend the existing one a bit. If extend fails, we need to propagate the failure up and restart the transaction in the top-level truncate loop. */
static handle_t* start_transaction(struct inode *inode)
/* start_transaction gets us a new handle for a truncate transaction, and extend_transaction tries to extend the existing one a bit. If extend fails, we need to propagate the failure up and restart the transaction in the top-level truncate loop. */ static handle_t* start_transaction(struct inode *inode)
{ handle_t *result; result = ext4_journal_start(inode, blocks_for_truncate(inode)); if (!IS_ERR(result)) return result; ext4_std_error(inode->i_sb, PTR_ERR(result)); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciSegmentBitFieldAnd8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI PciSegmentBitFieldAnd8(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
{ UINTN Count; PCI_SEGMENT_INFO *SegmentInfo; SegmentInfo = GetPciSegmentInfo (&Count); return MmioBitFieldAnd8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData); }
tianocore/edk2
C++
Other
4,240
/* Fills each DAC_InitStruct member with its default value. */
void DAC_ConfigStructInit(DAC_Config_T *dacConfig)
/* Fills each DAC_InitStruct member with its default value. */ void DAC_ConfigStructInit(DAC_Config_T *dacConfig)
{ dacConfig->trigger = DAC_TRIGGER_NONE; dacConfig->waveGeneration = DAC_WAVE_GENERATION_NONE; dacConfig->maskAmplitudeSelect = DAC_LFSRUNAMASK_BIT0; dacConfig->outputBuff = DAC_OUTPUTBUFF_ENABLE; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Returns: number of days in @month during the @year */
guint8 g_date_get_days_in_month(GDateMonth month, GDateYear year)
/* Returns: number of days in @month during the @year */ guint8 g_date_get_days_in_month(GDateMonth month, GDateYear year)
{ gint idx; g_return_val_if_fail (g_date_valid_year (year), 0); g_return_val_if_fail (g_date_valid_month (month), 0); idx = g_date_is_leap_year (year) ? 1 : 0; return days_in_months[idx][month]; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set and enable the desired interrupt levels for the RX/TX fifo. Valid values for ui32LvlCfg are: */
void am_hal_uart_fifo_config(uint32_t ui32Module, uint32_t ui32LvlCfg)
/* Set and enable the desired interrupt levels for the RX/TX fifo. Valid values for ui32LvlCfg are: */ void am_hal_uart_fifo_config(uint32_t ui32Module, uint32_t ui32LvlCfg)
{ AM_REGn(UART, ui32Module, LCRH) |= AM_REG_UART_LCRH_FEN_M; AM_REGn(UART, ui32Module, IFLS) = ui32LvlCfg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This routine is called when the user clicks the "Close" button in the "Decode As..." dialog window. This routine then destroys the dialog box and performs other housekeeping functions. */
static void decode_close_cb(GtkWidget *close_bt _U_, gpointer parent_w)
/* This routine is called when the user clicks the "Close" button in the "Decode As..." dialog window. This routine then destroys the dialog box and performs other housekeeping functions. */ static void decode_close_cb(GtkWidget *close_bt _U_, gpointer parent_w)
{ GtkWidget *notebook, *notebook_pg; gint page_num; decode_as_t *entry; notebook = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_NOTEBOOK); page_num = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)); notebook_pg = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_num); entry = (decode_as_t *)g_object_get_data(G_OBJECT(notebook_pg), E_PAGE_DECODE_AS_DATA); if ((entry->num_items == 1) && (entry->free_func != NULL)) entry->free_func(g_object_get_data(G_OBJECT(notebook_pg), E_PAGE_VALUE)); window_destroy(GTK_WIDGET(parent_w)); g_slist_free(decode_dimmable); decode_dimmable = NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns 1 on success or < 0 on error. */
int get_pxelinux_path(cmd_tbl_t *cmdtp, const char *file, unsigned long pxefile_addr_r)
/* Returns 1 on success or < 0 on error. */ int get_pxelinux_path(cmd_tbl_t *cmdtp, const char *file, unsigned long pxefile_addr_r)
{ size_t base_len = strlen(PXELINUX_DIR); char path[MAX_TFTP_PATH_LEN + 1]; if (base_len + strlen(file) > MAX_TFTP_PATH_LEN) { printf("path (%s%s) too long, skipping\n", PXELINUX_DIR, file); return -ENAMETOOLONG; } sprintf(path, PXELINUX_DIR "%s", file); return get_pxe_file(cmdtp, path, pxefile_addr_r); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Socket removal during an interrupt is now safe. */
static void __lapb_remove_cb(struct lapb_cb *lapb)
/* Socket removal during an interrupt is now safe. */ static void __lapb_remove_cb(struct lapb_cb *lapb)
{ if (lapb->node.next) { list_del(&lapb->node); lapb_put(lapb); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set all bits in the LCDCA display memory high. */
void lcdca_set_display_memory(void)
/* Set all bits in the LCDCA display memory high. */ void lcdca_set_display_memory(void)
{ LCDCA->LCDCA_DRL0 = LCDCA_DRL0_DATA_Msk; LCDCA->LCDCA_DRH0 = LCDCA_DRH0_DATA_Msk; LCDCA->LCDCA_DRL1 = LCDCA_DRL1_DATA_Msk; LCDCA->LCDCA_DRH1 = LCDCA_DRH1_DATA_Msk; LCDCA->LCDCA_DRL2 = LCDCA_DRL2_DATA_Msk; LCDCA->LCDCA_DRH2 = LCDCA_DRH2_DATA_Msk; LCDCA->LCDCA_DRL3 = LCDCA_DRL3_DATA_Msk; LCDCA->LCDCA_DRH3 = LCDCA_DRH3_DATA_Msk; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Return value: TRUE if there is an entry in the cache that matches @key, (which will now be in *entry_return). FALSE otherwise, (in which case *entry_return will be NULL). */
void* _cairo_cache_lookup(cairo_cache_t *cache, cairo_cache_entry_t *key)
/* Return value: TRUE if there is an entry in the cache that matches @key, (which will now be in *entry_return). FALSE otherwise, (in which case *entry_return will be NULL). */ void* _cairo_cache_lookup(cairo_cache_t *cache, cairo_cache_entry_t *key)
{ return _cairo_hash_table_lookup (cache->hash_table, (cairo_hash_entry_t *) key); }
xboot/xboot
C++
MIT License
779
/* This function could be updated to check more types of Hot Plug devices. Currently, it checks USB and PCCard device. */
BOOLEAN IsHotPlugDevice(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* This function could be updated to check more types of Hot Plug devices. Currently, it checks USB and PCCard device. */ BOOLEAN IsHotPlugDevice(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ EFI_DEVICE_PATH_PROTOCOL *CheckDevicePath; CheckDevicePath = DevicePath; while (!IsDevicePathEnd (CheckDevicePath)) { if ((DevicePathType (CheckDevicePath) == MESSAGING_DEVICE_PATH) && ((DevicePathSubType (CheckDevicePath) == MSG_USB_DP) || (DevicePathSubType (CheckDevicePath) == MSG_USB_CLASS_DP) || (DevicePathSubType (CheckDevicePath) == MSG_USB_WWID_DP))) { return TRUE; } if ((DevicePathType (CheckDevicePath) == HARDWARE_DEVICE_PATH) && (DevicePathSubType (CheckDevicePath) == HW_PCCARD_DP)) { return TRUE; } CheckDevicePath = NextDevicePathNode (CheckDevicePath); } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ BSP_LED_On(LED3); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function clears memory encryption bit for the memory region specified by BaseAddress and NumPages from the current page table context. */
RETURN_STATUS EFIAPI MemEncryptSevClearPageEncMask(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
/* This function clears memory encryption bit for the memory region specified by BaseAddress and NumPages from the current page table context. */ RETURN_STATUS EFIAPI MemEncryptSevClearPageEncMask(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
{ return InternalMemEncryptSevSetMemoryDecrypted ( Cr3BaseAddress, BaseAddress, EFI_PAGES_TO_SIZE (NumPages) ); }
tianocore/edk2
C++
Other
4,240
/* In Half duplex GMAC disables the back pressure feature. */
void synopGMAC_tx_flow_control_disable(synopGMACdevice *gmacdev)
/* In Half duplex GMAC disables the back pressure feature. */ void synopGMAC_tx_flow_control_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase, GmacFlowControl, GmacTxFlowControl); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Locking Note: The lport lock is expected to be held before calling this routine. */
static void fc_lport_enter_reset(struct fc_lport *)
/* Locking Note: The lport lock is expected to be held before calling this routine. */ static void fc_lport_enter_reset(struct fc_lport *)
{ FC_LPORT_DBG(lport, "Entered RESET state from %s state\n", fc_lport_state(lport)); if (lport->state == LPORT_ST_DISABLED || lport->state == LPORT_ST_LOGO) return; if (lport->vport) { if (lport->link_up) fc_vport_set_state(lport->vport, FC_VPORT_INITIALIZING); else fc_vport_set_state(lport->vport, FC_VPORT_LINKDOWN); } fc_lport_state_enter(lport, LPORT_ST_RESET); fc_vports_linkchange(lport); fc_lport_reset_locked(lport); if (lport->link_up) fc_lport_enter_flogi(lport); }
robutest/uclinux
C++
GPL-2.0
60
/* Queue segment on the new socket if the new socket is active, otherwise we just shortcircuit this and continue with the new socket. */
int tcp_child_process(struct sock *parent, struct sock *child, struct sk_buff *skb)
/* Queue segment on the new socket if the new socket is active, otherwise we just shortcircuit this and continue with the new socket. */ int tcp_child_process(struct sock *parent, struct sock *child, struct sk_buff *skb)
{ int ret = 0; int state = child->sk_state; if (!sock_owned_by_user(child)) { ret = tcp_rcv_state_process(child, skb, tcp_hdr(skb), skb->len); if (state == TCP_SYN_RECV && child->sk_state != state) parent->sk_data_ready(parent, 0); } else { sk_add_backlog(child, skb); } bh_unlock_sock(child); sock_put(child); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base ACMP peripheral base address. param mask Mask of round robin channel index. Available range is channel0:0x01 to channel7:0x80. */
void ACMP_SetRoundRobinPreState(CMP_Type *base, uint32_t mask)
/* param base ACMP peripheral base address. param mask Mask of round robin channel index. Available range is channel0:0x01 to channel7:0x80. */ void ACMP_SetRoundRobinPreState(CMP_Type *base, uint32_t mask)
{ uint32_t tmp32 = (base->C2 & ~(CMP_C2_ACOn_MASK | CMP_C2_CHnF_MASK)); tmp32 |= (mask << CMP_C2_ACOn_SHIFT); base->C2 = tmp32; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function transfers the USB MSC data to the memory. */
Ctrl_status nand_flash_usb_write_10(uint32_t addr, uint16_t nb_sector)
/* This function transfers the USB MSC data to the memory. */ Ctrl_status nand_flash_usb_write_10(uint32_t addr, uint16_t nb_sector)
{ uint8_t nb_sector_trans; uint16_t page_data_size = nand_flash_model_get_page_data_size(MODEL(&nf_translation)); if (nand_flash_status == NAND_FLASH_READY) { while (nb_sector) { nb_sector_trans = min(nb_sector, (page_data_size / SECTOR_SIZE)); udi_msc_trans_block(false, (uint8_t *)nand_flash_usb_buffer, (nb_sector_trans * SECTOR_SIZE), NULL); if (nand_flash_write((addr * SECTOR_SIZE), nand_flash_usb_buffer, (nb_sector_trans * SECTOR_SIZE))) { return CTRL_FAIL; } nb_sector -= nb_sector_trans; addr += nb_sector_trans; } return CTRL_GOOD; } return CTRL_BUSY; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get the current IRQ handler. Since (V1.6) the vector table is relocated in RAM, the vectors can be easily modified by the applications. */
tHandler UTIL_GetIrqHandler(int Offs)
/* Get the current IRQ handler. Since (V1.6) the vector table is relocated in RAM, the vectors can be easily modified by the applications. */ tHandler UTIL_GetIrqHandler(int Offs)
{ if ( (Offs >= 8) && (Offs<0x100) ) return *(tHandler *)( CIRCLEOS_RAM_BASE + Offs ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Validates the shared parameter buffer contents by looking at the table identifier and verifying its checksum. */
static bool SharedParamsValidateBuffer(void)
/* Validates the shared parameter buffer contents by looking at the table identifier and verifying its checksum. */ static bool SharedParamsValidateBuffer(void)
{ bool result = false; if ( (sharedParamsBuffer.identifier == SHARED_PARAMS_BUFFER_ID) && (SharedParamsVerifyChecksum()) ) { result = true; } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Note: the tcal field of the tccb header will be updates to reflect added content. */
struct dcw* tccb_add_dcw(struct tccb *tccb, size_t tccb_size, u8 cmd, u8 flags, void *cd, u8 cd_count, u32 count)
/* Note: the tcal field of the tccb header will be updates to reflect added content. */ struct dcw* tccb_add_dcw(struct tccb *tccb, size_t tccb_size, u8 cmd, u8 flags, void *cd, u8 cd_count, u32 count)
{ struct dcw *dcw; int size; int tca_offset; tca_offset = tca_size(tccb); size = ALIGN(sizeof(struct dcw) + cd_count, 4); if (sizeof(struct tccb_tcah) + tca_offset + size + sizeof(struct tccb_tcat) > tccb_size) return ERR_PTR(-ENOSPC); dcw = (struct dcw *) &tccb->tca[tca_offset]; memset(dcw, 0, size); dcw->cmd = cmd; dcw->flags = flags; dcw->count = count; dcw->cd_count = cd_count; if (cd) memcpy(&dcw->cd[0], cd, cd_count); tccb->tcah.tcal += size; return dcw; }
robutest/uclinux
C++
GPL-2.0
60
/* Block all interrupts from the et131x device at the device itself */
void et131x_disable_interrupts(struct et131x_adapter *adapter)
/* Block all interrupts from the et131x device at the device itself */ void et131x_disable_interrupts(struct et131x_adapter *adapter)
{ adapter->CachedMaskValue = INT_MASK_DISABLE; writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask); }
robutest/uclinux
C++
GPL-2.0
60
/* Output a character in polled mode. Writes data to tx register. Waits for space if transmitter is full. */
static void uart_usbserial_poll_out(const struct device *dev, unsigned char c)
/* Output a character in polled mode. Writes data to tx register. Waits for space if transmitter is full. */ static void uart_usbserial_poll_out(const struct device *dev, unsigned char c)
{ while (usbserial_tx_fifo_full()) ; usbserial_regs->wdata = c; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This lets other kernel code access the eeprom data. For example, it might hold a board's Ethernet address, or board-specific calibration data generated on the manufacturing floor. */
static ssize_t at24_macc_read(struct memory_accessor *macc, char *buf, off_t offset, size_t count)
/* This lets other kernel code access the eeprom data. For example, it might hold a board's Ethernet address, or board-specific calibration data generated on the manufacturing floor. */ static ssize_t at24_macc_read(struct memory_accessor *macc, char *buf, off_t offset, size_t count)
{ struct at24_data *at24 = container_of(macc, struct at24_data, macc); return at24_read(at24, buf, offset, count); }
robutest/uclinux
C++
GPL-2.0
60
/* Message: LocationInfoMessage Opcode: 0x0156 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no Comment: Sent by wifi devices, contains xml information about connected SSID */
static void handle_LocationInfoMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: LocationInfoMessage Opcode: 0x0156 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no Comment: Sent by wifi devices, contains xml information about connected SSID */ static void handle_LocationInfoMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_locationInfo, 2401, ENC_ASCII|ENC_NA); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* q40kbd_open() is called when a port is open by the higher layer. It allocates the interrupt and enables in in the chip. */
static int q40kbd_open(struct serio *port)
/* q40kbd_open() is called when a port is open by the higher layer. It allocates the interrupt and enables in in the chip. */ static int q40kbd_open(struct serio *port)
{ q40kbd_flush(); if (request_irq(Q40_IRQ_KEYBOARD, q40kbd_interrupt, 0, "q40kbd", NULL)) { printk(KERN_ERR "q40kbd.c: Can't get irq %d.\n", Q40_IRQ_KEYBOARD); return -EBUSY; } master_outb(-1, KEYBOARD_UNLOCK_REG); master_outb(1, KEY_IRQ_ENABLE_REG); return 0; }
robutest/uclinux
C++
GPL-2.0
60