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
/* The task that is woken by the ISR that processes GPIO interrupts originating from the push button. */
static void vButtonHandlerTask(void *pvParameters)
/* The task that is woken by the ISR that processes GPIO interrupts originating from the push button. */ static void vButtonHandlerTask(void *pvParameters)
{ const char *pcInterruptMessage = "Int"; for( ;; ) { while( xSemaphoreTake( xButtonSemaphore, portMAX_DELAY ) != pdPASS ); UARTIntDisable( UART0_BASE, UART_INT_TX ); { pcNextChar = cMessage; if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) { HWREG( UART0_BASE + UART_O_DR ) = *pcNextChar; } pcNextChar++; } UARTIntEnable(UART0_BASE, UART_INT_TX); xQueueSend( xPrintQueue, &pcInterruptMessage, portMAX_DELAY ); vTaskDelay( mainDEBOUNCE_DELAY ); xSemaphoreTake( xButtonSemaphore, mainNO_DELAY ); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* sa1111_get_audio_rate - get the audio sample rate @sadev: SA1111 SAC function block device */
int sa1111_get_audio_rate(struct sa1111_dev *sadev)
/* sa1111_get_audio_rate - get the audio sample rate @sadev: SA1111 SAC function block device */ int sa1111_get_audio_rate(struct sa1111_dev *sadev)
{ struct sa1111 *sachip = sa1111_chip_driver(sadev); unsigned long div; if (sadev->devid != SA1111_DEVID_SAC) return -EINVAL; div = sa1111_readl(sachip->base + SA1111_SKAUD) + 1; return __sa1111_pll_clock(sachip) / (256 * div); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This is the packet destructor used for Tx packets that need to remain mapped until they are freed rather than until their Tx descriptors are freed. */
static void deferred_unmap_destructor(struct sk_buff *skb)
/* This is the packet destructor used for Tx packets that need to remain mapped until they are freed rather than until their Tx descriptors are freed. */ static void deferred_unmap_destructor(struct sk_buff *skb)
{ int i; const dma_addr_t *p; const struct skb_shared_info *si; const struct deferred_unmap_info *dui; dui = (struct deferred_unmap_info *)skb->head; p = dui->addr; if (skb->tail - skb->transport_header) pci_unmap_single(dui->pdev, *p++, skb->tail - skb->transport_header, PCI_DMA_TODEVICE); si = skb_shinfo(skb); for (i = 0; i < si->nr_frags; i++) pci_unmap_page(dui->pdev, *p++, si->frags[i].size, PCI_DMA_TODEVICE); }
robutest/uclinux
C++
GPL-2.0
60
/* Creates the metatables for the objects and registers the driver open method. */
LUASQL_API int luaopen_luasql_sqlite3(lua_State *L)
/* Creates the metatables for the objects and registers the driver open method. */ LUASQL_API int luaopen_luasql_sqlite3(lua_State *L)
{ struct luaL_reg driver[] = { {"sqlite3", create_environment}, {NULL, NULL}, }; create_metatables (L); luaL_openlib (L, LUASQL_TABLENAME, driver, 0); luasql_set_info (L); return 1; }
DC-SWAT/DreamShell
C++
null
404
/* Resume normal operations after an error recovery sequence has been completed. */
static void e100_io_resume(struct pci_dev *pdev)
/* Resume normal operations after an error recovery sequence has been completed. */ static void e100_io_resume(struct pci_dev *pdev)
{ struct net_device *netdev = pci_get_drvdata(pdev); struct nic *nic = netdev_priv(netdev); pci_enable_wake(pdev, 0, 0); netif_device_attach(netdev); if (netif_running(netdev)) { e100_open(netdev); mod_timer(&nic->watchdog, jiffies); } }
robutest/uclinux
C++
GPL-2.0
60
/* This function reinitializes all serial ports that are compiled into U-Boot by calling their serial_start() functions. */
void serial_reinit_all(void)
/* This function reinitializes all serial ports that are compiled into U-Boot by calling their serial_start() functions. */ void serial_reinit_all(void)
{ struct serial_device *s; for (s = serial_devices; s; s = s->next) s->start(); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns: a startup notification ID for the application, or NULL if not supported. */
char* g_app_launch_context_get_startup_notify_id(GAppLaunchContext *context, GAppInfo *info, GList *files)
/* Returns: a startup notification ID for the application, or NULL if not supported. */ char* g_app_launch_context_get_startup_notify_id(GAppLaunchContext *context, GAppInfo *info, GList *files)
{ GAppLaunchContextClass *class; g_return_val_if_fail (G_IS_APP_LAUNCH_CONTEXT (context), NULL); g_return_val_if_fail (G_IS_APP_INFO (info), NULL); class = G_APP_LAUNCH_CONTEXT_GET_CLASS (context); if (class->get_startup_notify_id == NULL) return NULL; return class->get_startup_notify_id (context, info, files); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The IA32/X64 version PE/COFF loader/relocater both support IA32, X64 and EBC images. */
BOOLEAN PeCoffLoaderImageFormatSupported(IN UINT16 Machine)
/* The IA32/X64 version PE/COFF loader/relocater both support IA32, X64 and EBC images. */ BOOLEAN PeCoffLoaderImageFormatSupported(IN UINT16 Machine)
{ if ((Machine == IMAGE_FILE_MACHINE_I386) || (Machine == IMAGE_FILE_MACHINE_X64) || (Machine == IMAGE_FILE_MACHINE_EBC) || (Machine == IMAGE_FILE_MACHINE_ARM64)) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* sht15_send_byte() - send a single byte to the device @data: device state @byte: value to be sent */
static void sht15_send_byte(struct sht15_data *data, u8 byte)
/* sht15_send_byte() - send a single byte to the device @data: device state @byte: value to be sent */ static void sht15_send_byte(struct sht15_data *data, u8 byte)
{ int i; for (i = 0; i < 8; i++) { sht15_send_bit(data, !!(byte & 0x80)); byte <<= 1; } }
robutest/uclinux
C++
GPL-2.0
60
/* @this block IO protocol @media_id media id @lba start of the read in logical blocks @buffer_size number of bytes to read @buffer target buffer */
static efi_status_t EFIAPI read_blocks(struct efi_block_io *this, u32 media_id, u64 lba, efi_uintn_t buffer_size, void *buffer)
/* @this block IO protocol @media_id media id @lba start of the read in logical blocks @buffer_size number of bytes to read @buffer target buffer */ static efi_status_t EFIAPI read_blocks(struct efi_block_io *this, u32 media_id, u64 lba, efi_uintn_t buffer_size, void *buffer)
{ u8 *start; if ((lba << LB_BLOCK_SIZE) + buffer_size > img.length) return EFI_INVALID_PARAMETER; start = image + (lba << LB_BLOCK_SIZE); boottime->copy_mem(buffer, start, buffer_size); return EFI_SUCCESS; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Enables the ADC DMA request after last transfer in multi ADC mode. */
void ADC_EnableMultiModeDMARequest(void)
/* Enables the ADC DMA request after last transfer in multi ADC mode. */ void ADC_EnableMultiModeDMARequest(void)
{ ADC->CCTRL_B.DMADISSEL = BIT_SET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Hash a string to an integer in a case-independent way */
int hfs_hash_dentry(struct dentry *dentry, struct qstr *this)
/* Hash a string to an integer in a case-independent way */ int hfs_hash_dentry(struct dentry *dentry, struct qstr *this)
{ const unsigned char *name = this->name; unsigned int hash, len = this->len; if (len > HFS_NAMELEN) len = HFS_NAMELEN; hash = init_name_hash(); for (; len; len--) hash = partial_name_hash(caseorder[*name++], hash); this->hash = end_name_hash(hash); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT16 EFIAPI S3PciBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT16 EFIAPI S3PciBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
{ return InternalSavePciWrite16ValueToBootScript (Address, PciBitFieldRead16 (Address, StartBit, EndBit)); }
tianocore/edk2
C++
Other
4,240
/* Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void)
/* Event handler for the library USB Disconnection event. */ void EVENT_USB_Device_Disconnect(void)
{ TCCR0B = 0; LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* ufshcd_ready_for_uic_cmd - Check if controller is ready to accept UIC commands */
static bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
/* ufshcd_ready_for_uic_cmd - Check if controller is ready to accept UIC commands */ static bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
{ if (ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY) return true; else return false; }
4ms/stm32mp1-baremetal
C++
Other
137
/* tasklet_hrtimer_init - Init a tasklet/hrtimer combo for softirq callbacks @ttimer: tasklet_hrtimer which is initialized @function: hrtimer callback funtion which gets called from softirq context @which_clock: clock id (CLOCK_MONOTONIC/CLOCK_REALTIME) @mode: hrtimer mode (HRTIMER_MODE_ABS/HRTIMER_MODE_REL) */
void tasklet_hrtimer_init(struct tasklet_hrtimer *ttimer, enum hrtimer_restart(*function)(struct hrtimer *), clockid_t which_clock, enum hrtimer_mode mode)
/* tasklet_hrtimer_init - Init a tasklet/hrtimer combo for softirq callbacks @ttimer: tasklet_hrtimer which is initialized @function: hrtimer callback funtion which gets called from softirq context @which_clock: clock id (CLOCK_MONOTONIC/CLOCK_REALTIME) @mode: hrtimer mode (HRTIMER_MODE_ABS/HRTIMER_MODE_REL) */ void tasklet_hrtimer_init(struct tasklet_hrtimer *ttimer, enum hrtimer_restart(*function)(struct hrtimer *), clockid_t which_clock, enum hrtimer_mode mode)
{ hrtimer_init(&ttimer->timer, which_clock, mode); ttimer->timer.function = __hrtimer_tasklet_trampoline; tasklet_init(&ttimer->tasklet, __tasklet_hrtimer_trampoline, (unsigned long)ttimer); ttimer->function = function; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base MCAN peripheral base address. param config The receive buffer configuration structure. */
void MCAN_SetRxBufferConfig(CAN_Type *base, const mcan_rx_buffer_config_t *config)
/* param base MCAN peripheral base address. param config The receive buffer configuration structure. */ void MCAN_SetRxBufferConfig(CAN_Type *base, const mcan_rx_buffer_config_t *config)
{ base->RXBC |= CAN_RXBC_RBSA(config->address >> CAN_RXBC_RBSA_SHIFT); base->RXESC |= CAN_RXESC_RBDS(config->datafieldSize); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_set_rx_handler(mss_uart_instance_t *this_uart, mss_uart_rx_handler_t handler, mss_uart_rx_trig_level_t trigger_level)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_set_rx_handler(mss_uart_instance_t *this_uart, mss_uart_rx_handler_t handler, mss_uart_rx_trig_level_t trigger_level)
{ ASSERT( (this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1) ); this_uart->rx_handler = handler; this_uart->hw_reg->FCR = (this_uart->hw_reg->FCR & (uint8_t)(~((uint8_t)FCR_TRIG_LEVEL_MASK))) | (uint8_t)trigger_level; this_uart->hw_reg_bit->IER_ERBFI = 1U; NVIC_EnableIRQ( this_uart->irqn ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* ADC Read the Overrun Flag. The overrun flag is set when data is not read from a result register before the next conversion is written. If DMA is enabled, all transfers are terminated and any conversion sequence is aborted. */
bool adc_get_overrun_flag(uint32_t adc)
/* ADC Read the Overrun Flag. The overrun flag is set when data is not read from a result register before the next conversion is written. If DMA is enabled, all transfers are terminated and any conversion sequence is aborted. */ bool adc_get_overrun_flag(uint32_t adc)
{ return ADC_ISR(adc) & ADC_ISR_OVR; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* fcoe_ctlr_reset() - Reset a FCoE controller @fip: The FCoE controller to reset */
static void fcoe_ctlr_reset(struct fcoe_ctlr *fip)
/* fcoe_ctlr_reset() - Reset a FCoE controller @fip: The FCoE controller to reset */ static void fcoe_ctlr_reset(struct fcoe_ctlr *fip)
{ fcoe_ctlr_reset_fcfs(fip); del_timer(&fip->timer); fip->ctlr_ka_time = 0; fip->port_ka_time = 0; fip->sol_time = 0; fip->flogi_oxid = FC_XID_UNKNOWN; fip->map_dest = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Return 0 if no error, -EINVAL or -ECONNRESET otherwise */
static int pxa_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
/* Return 0 if no error, -EINVAL or -ECONNRESET otherwise */ static int pxa_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
{ struct pxa_ep *ep; struct udc_usb_ep *udc_usb_ep; struct pxa27x_request *req; unsigned long flags; int rc = -EINVAL; if (!_ep) return rc; udc_usb_ep = container_of(_ep, struct udc_usb_ep, usb_ep); ep = udc_usb_ep->pxa_ep; if (!ep || is_ep0(ep)) return rc; spin_lock_irqsave(&ep->lock, flags); list_for_each_entry(req, &ep->queue, queue) { if (&req->req == _req) { req_done(ep, req, -ECONNRESET); rc = 0; break; } } spin_unlock_irqrestore(&ep->lock, flags); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* The return value is the disposition of the chunk. */
sctp_disposition_t sctp_sf_pdiscard(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands)
/* The return value is the disposition of the chunk. */ sctp_disposition_t sctp_sf_pdiscard(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands)
{ SCTP_INC_STATS(SCTP_MIB_IN_PKT_DISCARDS); sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL()); return SCTP_DISPOSITION_CONSUME; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function will post an message to usb message queue, */
rt_err_t rt_usbd_event_signal(struct udev_msg *msg)
/* This function will post an message to usb message queue, */ rt_err_t rt_usbd_event_signal(struct udev_msg *msg)
{ RT_ASSERT(msg != RT_NULL); return rt_mq_send(&usb_mq, (void*)msg, sizeof(struct udev_msg)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* @dai: Array of DAIs to register @count: Number of DAIs */
int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count)
/* @dai: Array of DAIs to register @count: Number of DAIs */ int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count)
{ int i, ret; for (i = 0; i < count; i++) { ret = snd_soc_register_dai(&dai[i]); if (ret != 0) goto err; } return 0; err: for (i--; i >= 0; i--) snd_soc_unregister_dai(&dai[i]); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPCMP peripheral base address. param config Pointer to "lpcmp_filter_config_t" structure. */
void LPCMP_SetFilterConfig(LPCMP_Type *base, const lpcmp_filter_config_t *config)
/* param base LPCMP peripheral base address. param config Pointer to "lpcmp_filter_config_t" structure. */ void LPCMP_SetFilterConfig(LPCMP_Type *base, const lpcmp_filter_config_t *config)
{ assert(config != NULL); uint32_t tmp32; tmp32 = base->CCR1 & ~(LPCMP_CCR1_FILT_PER_MASK | LPCMP_CCR1_FILT_CNT_MASK | LPCMP_CCR1_SAMPLE_EN_MASK); if (config->enableSample) { tmp32 |= LPCMP_CCR1_SAMPLE_EN_MASK; } tmp32 |= LPCMP_CCR1_FILT_PER(config->filterSamplePeriod) | LPCMP_CCR1_FILT_CNT(config->filterSampleCount); base->CCR1 = tmp32; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Appends a number of bytes in the internal Flash. */
void _flash_append(struct _flash_device *const device, const uint32_t dst_addr, uint8_t *buffer, uint32_t length)
/* Appends a number of bytes in the internal Flash. */ void _flash_append(struct _flash_device *const device, const uint32_t dst_addr, uint8_t *buffer, uint32_t length)
{ uint32_t page_start_addr = dst_addr & ~(NVMCTRL_PAGE_SIZE - 1); uint32_t size; uint32_t offset = 0; if (dst_addr != page_start_addr) { size = min(length, NVMCTRL_PAGE_SIZE - (dst_addr - page_start_addr)); _flash_program(device->hw, dst_addr, buffer, size, NVMCTRL_CTRLA_CMD_WP); page_start_addr += NVMCTRL_PAGE_SIZE; offset += size; } while (offset < length) { size = min(length - offset, NVMCTRL_PAGE_SIZE); _flash_program(device->hw, page_start_addr, buffer + offset, size, NVMCTRL_CTRLA_CMD_WP); page_start_addr += NVMCTRL_PAGE_SIZE; offset += size; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is called on #RST and FLR. FLR if PCI_EXP_DEVCTL_BCR_FLR is set */
void pci_device_reset(PCIDevice *dev)
/* This function is called on #RST and FLR. FLR if PCI_EXP_DEVCTL_BCR_FLR is set */ void pci_device_reset(PCIDevice *dev)
{ qdev_reset_all(&dev->qdev); pci_do_device_reset(dev); }
ve3wwg/teensy3_qemu
C++
Other
15
/* brief DMA instance 0, channel 8 IRQ handler. */
void EDMA_0_CH8_DriverIRQHandler(void)
/* brief DMA instance 0, channel 8 IRQ handler. */ void EDMA_0_CH8_DriverIRQHandler(void)
{ EDMA_DriverIRQHandler(0U, 8U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return code 0 - driver can claim the device negative value - driver can not claim the device */
static int __devinit lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
/* Return code 0 - driver can claim the device negative value - driver can not claim the device */ static int __devinit lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
{ int rc; struct lpfc_sli_intf intf; if (pci_read_config_dword(pdev, LPFC_SLIREV_CONF_WORD, &intf.word0)) return -ENODEV; if ((bf_get(lpfc_sli_intf_valid, &intf) == LPFC_SLI_INTF_VALID) && (bf_get(lpfc_sli_intf_rev, &intf) == LPFC_SLIREV_CONF_SLI4)) rc = lpfc_pci_probe_one_s4(pdev, pid); else rc = lpfc_pci_probe_one_s3(pdev, pid); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks the sorted timer list against the current system time. Signals any expired event timer. */
VOID EFIAPI CoreCheckTimers(IN EFI_EVENT CheckEvent, IN VOID *Context)
/* Checks the sorted timer list against the current system time. Signals any expired event timer. */ VOID EFIAPI CoreCheckTimers(IN EFI_EVENT CheckEvent, IN VOID *Context)
{ UINT64 SystemTime; IEVENT *Event; CoreAcquireLock (&mEfiTimerLock); SystemTime = CoreCurrentSystemTime (); while (!IsListEmpty (&mEfiTimerList)) { Event = CR (mEfiTimerList.ForwardLink, IEVENT, Timer.Link, EVENT_SIGNATURE); if (Event->Timer.TriggerTime > SystemTime) { break; } RemoveEntryList (&Event->Timer.Link); Event->Timer.Link.ForwardLink = NULL; CoreSignalEvent (Event); if (Event->Timer.Period != 0) { Event->Timer.TriggerTime = Event->Timer.TriggerTime + Event->Timer.Period; if (Event->Timer.TriggerTime <= SystemTime) { Event->Timer.TriggerTime = SystemTime; CoreSignalEvent (mEfiCheckTimerEvent); } CoreInsertEventTimer (Event); } } CoreReleaseLock (&mEfiTimerLock); }
tianocore/edk2
C++
Other
4,240
/* Add host bridge handle to global variable for enumerating. */
EFI_STATUS AddHostBridgeEnumerator(IN EFI_HANDLE HostBridgeHandle)
/* Add host bridge handle to global variable for enumerating. */ EFI_STATUS AddHostBridgeEnumerator(IN EFI_HANDLE HostBridgeHandle)
{ UINTN Index; if (HostBridgeHandle == NULL) { return EFI_ABORTED; } for (Index = 0; Index < gPciHostBridgeNumber; Index++) { if (HostBridgeHandle == gPciHostBrigeHandles[Index]) { return EFI_ABORTED; } } if (Index < PCI_MAX_HOST_BRIDGE_NUM) { gPciHostBrigeHandles[Index] = HostBridgeHandle; gPciHostBridgeNumber++; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* USBD_CDC_RNDIS_USRStringDescriptor Manages the transfer of user string descriptors. */
uint8_t USBD_CDC_RNDIS_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length)
/* USBD_CDC_RNDIS_USRStringDescriptor Manages the transfer of user string descriptors. */ uint8_t USBD_CDC_RNDIS_SetTxBuffer(USBD_HandleTypeDef *pdev, uint8_t *pbuff, uint32_t length)
{ USBD_CDC_RNDIS_HandleTypeDef *hcdc = (USBD_CDC_RNDIS_HandleTypeDef *)pdev->pClassData; if (hcdc == NULL) { return (uint8_t)USBD_FAIL; } hcdc->TxBuffer = pbuff; hcdc->TxLength = length; return (uint8_t)USBD_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Refer to SD Host Controller Simplified spec 3.0 Section for details. */
EFI_STATUS EmmcPeimHcInitTimeoutCtrl(IN UINTN Bar)
/* Refer to SD Host Controller Simplified spec 3.0 Section for details. */ EFI_STATUS EmmcPeimHcInitTimeoutCtrl(IN UINTN Bar)
{ EFI_STATUS Status; UINT8 Timeout; Timeout = 0x0E; Status = EmmcPeimHcRwMmio (Bar + EMMC_HC_TIMEOUT_CTRL, FALSE, sizeof (Timeout), &Timeout); return Status; }
tianocore/edk2
C++
Other
4,240
/* sends next data block during TFTP READ operation */
void tftp_send_next_block(struct udp_pcb *upcb, tftp_connection_args *args, const ip_addr_t *to_ip, u16_t to_port)
/* sends next data block during TFTP READ operation */ void tftp_send_next_block(struct udp_pcb *upcb, tftp_connection_args *args, const ip_addr_t *to_ip, u16_t to_port)
{ f_read(&file_SD, (uint8_t*)args->data, TFTP_DATA_LEN_MAX, (UINT*)(&args->data_len)); tftp_send_data_packet(upcb, to_ip, to_port, args->block, args->data, args->data_len); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* param base LPSPI peripheral base address. return LPSPI instance. */
uint32_t LPSPI_GetInstance(LPSPI_Type *base)
/* param base LPSPI peripheral base address. return LPSPI instance. */ uint32_t LPSPI_GetInstance(LPSPI_Type *base)
{ uint8_t instance = 0; for (instance = 0; instance < ARRAY_SIZE(s_lpspiBases); instance++) { if (s_lpspiBases[instance] == base) { break; } } assert(instance < ARRAY_SIZE(s_lpspiBases)); return instance; }
eclipse-threadx/getting-started
C++
Other
310
/* Wrapper for the DTR/RTS raise logic. For the moment this is used to hide some internal details. This will eventually become entirely internal to the tty port. */
void tty_port_lower_dtr_rts(struct tty_port *port)
/* Wrapper for the DTR/RTS raise logic. For the moment this is used to hide some internal details. This will eventually become entirely internal to the tty port. */ void tty_port_lower_dtr_rts(struct tty_port *port)
{ if (port->ops->dtr_rts) port->ops->dtr_rts(port, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize some variables every time a file is loaded or re-loaded. Create a new hash table for the conversations in the new file. */
void conversation_init(void)
/* Initialize some variables every time a file is loaded or re-loaded. Create a new hash table for the conversations in the new file. */ void conversation_init(void)
{ conversation_hashtable_exact = g_hash_table_new_full(conversation_hash_exact, conversation_match_exact, NULL, free_data_list); conversation_hashtable_no_addr2 = g_hash_table_new_full(conversation_hash_no_addr2, conversation_match_no_addr2, NULL, free_data_list); conversation_hashtable_no_port2 = g_hash_table_new_full(conversation_hash_no_port2, conversation_match_no_port2, NULL, free_data_list); conversation_hashtable_no_addr2_or_port2 = g_hash_table_new_full(conversation_hash_no_addr2_or_port2, conversation_match_no_addr2_or_port2, NULL, free_data_list); new_index = 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return code 0 - driver suspended the device Error otherwise */
static int lpfc_pci_resume_one(struct pci_dev *pdev)
/* Return code 0 - driver suspended the device Error otherwise */ static int lpfc_pci_resume_one(struct pci_dev *pdev)
{ struct Scsi_Host *shost = pci_get_drvdata(pdev); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; int rc = -ENODEV; switch (phba->pci_dev_grp) { case LPFC_PCI_DEV_LP: rc = lpfc_pci_resume_one_s3(pdev); break; case LPFC_PCI_DEV_OC: rc = lpfc_pci_resume_one_s4(pdev); break; default: lpfc_printf_log(phba, KERN_ERR, LOG_INIT, "1426 Invalid PCI device group: 0x%x\n", phba->pci_dev_grp); break; } return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables the uDMA requests in the SHA/MD5 module. */
void SHAMD5DMAEnable(uint32_t ui32Base)
/* Enables the uDMA requests in the SHA/MD5 module. */ void SHAMD5DMAEnable(uint32_t ui32Base)
{ ASSERT(ui32Base == SHAMD5_BASE); HWREG(ui32Base + SHAMD5_O_SYSCONFIG) |= SHAMD5_SYSCONFIG_PADVANCED | SHAMD5_SYSCONFIG_PDMA_EN; }
micropython/micropython
C++
Other
18,334
/* Find a registered I3C target device. This returns the I3C device descriptor of the I3C device matching the incoming */
static struct i3c_device_desc* mcux_i3c_device_find(const struct device *dev, const struct i3c_device_id *id)
/* Find a registered I3C target device. This returns the I3C device descriptor of the I3C device matching the incoming */ static struct i3c_device_desc* mcux_i3c_device_find(const struct device *dev, const struct i3c_device_id *id)
{ const struct mcux_i3c_config *config = dev->config; return i3c_dev_list_find(&config->common.dev_list, id); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* parport_ip32_enable_irq - enable interrupts on the rising edge of nACK */
static void parport_ip32_enable_irq(struct parport *p)
/* parport_ip32_enable_irq - enable interrupts on the rising edge of nACK */ static void parport_ip32_enable_irq(struct parport *p)
{ __parport_ip32_frob_control(p, DCR_IRQ, DCR_IRQ); }
robutest/uclinux
C++
GPL-2.0
60
/* Terminate execution of a thread and remove it from ActiveThreads. */
osStatus svcThreadTerminate(osThreadId thread_id)
/* Terminate execution of a thread and remove it from ActiveThreads. */ osStatus svcThreadTerminate(osThreadId thread_id)
{ return osErrorParameter; } stk = ptcb->priv_stack ? ptcb->stack : NULL; res = rt_tsk_delete(ptcb->task_id); if (res == OS_R_NOK) { return osErrorResource; } if (stk != NULL) { rt_free_mem(os_stack_mem, stk); } return osOK; }
labapart/polymcu
C++
null
201
/* Enables or disables the temperature sensor and Vrefint channel. */
void ADC_TempSensorVrefintCmd(FunctionalState NewState)
/* Enables or disables the temperature sensor and Vrefint channel. */ void ADC_TempSensorVrefintCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADC1->ADCFG |= ADCFG_TVSEN ; ADC2->ADCFG |= ADCFG_TVSEN ; } else { ADC1->ADCFG &=~ ADCFG_TVSEN; ADC2->ADCFG &=~ ADCFG_TVSEN; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* setup_fault_attr() is a helper function for various __setup handlers, so it returns 0 on error, because that is what __setup handlers do. */
int __init setup_fault_attr(struct fault_attr *attr, char *str)
/* setup_fault_attr() is a helper function for various __setup handlers, so it returns 0 on error, because that is what __setup handlers do. */ int __init setup_fault_attr(struct fault_attr *attr, char *str)
{ unsigned long probability; unsigned long interval; int times; int space; if (sscanf(str, "%lu,%lu,%d,%d", &interval, &probability, &space, &times) < 4) { printk(KERN_WARNING "FAULT_INJECTION: failed to parse arguments\n"); return 0; } attr->probability = probability; attr->interval = interval; atomic_set(&attr->times, times); atomic_set(&attr->space, space); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the last data output value of the selected DAC channel. */
uint16_t DAC_GetOutputDataVal(void)
/* Returns the last data output value of the selected DAC channel. */ uint16_t DAC_GetOutputDataVal(void)
{ __IO uint32_t tmp = 0; tmp = (uint32_t)DAC_BASE; tmp += DATO_OFFSET; return (uint16_t)(*(__IO uint32_t*)tmp); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Forces CHxOREF waveform to active or inactive level. The */
void TimerForcedOREF(unsigned long ulBase, unsigned long ulChannel, unsigned long ForcedAction)
/* Forces CHxOREF waveform to active or inactive level. The */ void TimerForcedOREF(unsigned long ulBase, unsigned long ulChannel, unsigned long ForcedAction)
{ xASSERT((ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE)); xASSERT((ulChannel == TIMER_CH_0) || (ulChannel == TIMER_CH_1) || (ulChannel == TIMER_CH_2) || (ulChannel == TIMER_CH_3)); xASSERT((ForcedAction == TIMER_OM_FORCED_INACTIVE) || (ForcedAction == TIMER_OM_FORCED_ACTIVE)); xHWREG(ulBase + TIMER_CH0OCFR + ulChannel * 4) &= ~TIMER_CH0OCFR_CH0OM_M; xHWREG(ulBase + TIMER_CH0OCFR + ulChannel * 4) |= ForcedAction; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This is a helper function for 'ubifs_rcvry_gc_commit()' which grabs an empty LEB to be used as GC LEB ( */
static int grab_empty_leb(struct ubifs_info *c)
/* This is a helper function for 'ubifs_rcvry_gc_commit()' which grabs an empty LEB to be used as GC LEB ( */ static int grab_empty_leb(struct ubifs_info *c)
{ int lnum, err; lnum = ubifs_find_free_leb_for_idx(c); if (lnum < 0) { ubifs_err(c, "could not find an empty LEB"); ubifs_dump_lprops(c); ubifs_dump_budg(c, &c->bi); return lnum; } err = ubifs_change_one_lp(c, lnum, LPROPS_NC, LPROPS_NC, 0, LPROPS_INDEX, 0); if (err) return err; c->gc_lnum = lnum; dbg_rcvry("found empty LEB %d, run commit", lnum); return ubifs_run_commit(c); }
4ms/stm32mp1-baremetal
C++
Other
137
/* A function to calculate the intersection of two rectangles: return true if the rectangles intersect, false otherwise */
static __inline__ SDL_bool SDL_IntersectRect(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *intersection)
/* A function to calculate the intersection of two rectangles: return true if the rectangles intersect, false otherwise */ static __inline__ SDL_bool SDL_IntersectRect(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *intersection)
{ int Amin, Amax, Bmin, Bmax; Amin = A->x; Amax = Amin + A->w; Bmin = B->x; Bmax = Bmin + B->w; if(Bmin > Amin) Amin = Bmin; intersection->x = Amin; if(Bmax < Amax) Amax = Bmax; intersection->w = Amax - Amin > 0 ? Amax - Amin : 0; Amin = A->y; Amax = Amin + A->h; Bmin = B->y; Bmax = Bmin + B->h; if(Bmin > Amin) Amin = Bmin; intersection->y = Amin; if(Bmax < Amax) Amax = Bmax; intersection->h = Amax - Amin > 0 ? Amax - Amin : 0; return (intersection->w && intersection->h); }
DC-SWAT/DreamShell
C++
null
404
/* Returns 0 on success, or a negative FDT error code on error. */
int fdt_set_phy_handle(void *fdt, char *compat, phys_addr_t addr, const char *alias)
/* Returns 0 on success, or a negative FDT error code on error. */ int fdt_set_phy_handle(void *fdt, char *compat, phys_addr_t addr, const char *alias)
{ int offset; unsigned int ph; const char *path; path = fdt_get_alias(fdt, alias); if (!path) return -FDT_ERR_BADPATH; offset = fdt_path_offset(fdt, path); if (offset < 0) return offset; ph = fdt_create_phandle(fdt, offset); if (!ph) return -FDT_ERR_BADPHANDLE; ph = cpu_to_fdt32(ph); offset = fdt_node_offset_by_compat_reg(fdt, compat, addr); if (offset < 0) return offset; return fdt_setprop(fdt, offset, "phy-handle", &ph, sizeof(ph)); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Read whether the Tamper Pin Event flag is set or not. */
uint8_t BAKPR_ReadStatusFlag(void)
/* Read whether the Tamper Pin Event flag is set or not. */ uint8_t BAKPR_ReadStatusFlag(void)
{ return BAKPR->CSTS_B.TEFLG; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Send STOP_TRANSMISSION command to card to stop ongoing data transferring. */
static status_t MMC_StopTransmission(mmc_card_t *card)
/* Send STOP_TRANSMISSION command to card to stop ongoing data transferring. */ static status_t MMC_StopTransmission(mmc_card_t *card)
{ assert(card); HOST_TRANSFER content = {0}; HOST_COMMAND command = {0}; command.index = kSDMMC_StopTransmission; command.argument = 0U; command.type = kCARD_CommandTypeAbort; command.responseType = kCARD_ResponseTypeR1b; command.responseErrorFlags = kSDMMC_R1ErrorAllFlag; content.command = &command; content.data = 0U; if (kStatus_Success != MMC_Transfer(card, &content, 2U)) { return kStatus_SDMMC_TransferFailed; } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read USB Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer Return Value: Number of bytes read */
uint32_t USB_ReadEP(uint32_t EPNum, uint8_t *pData)
/* Read USB Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer Return Value: Number of bytes read */ uint32_t USB_ReadEP(uint32_t EPNum, uint8_t *pData)
{ cnt = USB_RXPLEN; } while ((cnt & PKT_DV) == 0); cnt &= PKT_LNGTH_MASK; for (n = 0; n < (cnt + 3) / 4; n++) { *((uint32_t __attribute__((packed)) *)pData) = USB_RXDATA; pData += 4; } USB_CTRL = 0; if ((EPNum & 0x80) != 0x04) { WrCmdEP(EPNum, CMD_CLR_BUF); } return (cnt); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Initialises the FIFO buffer. This function will return the byte located at the array index of the read pointer, and then increment the read pointer index. If the read pointer exceeds the maximum buffer size, it will roll over to zero. */
bool fifo_read(fifo_t *f, void *p_buffer)
/* Initialises the FIFO buffer. This function will return the byte located at the array index of the read pointer, and then increment the read pointer index. If the read pointer exceeds the maximum buffer size, it will roll over to zero. */ bool fifo_read(fifo_t *f, void *p_buffer)
{ if( !is_fifo_initalized(f) || fifo_isEmpty(f) ) { return false; } mutex_lock(f); memcpy(p_buffer, f->buffer + (f->rd_idx * f->item_size), f->item_size); f->rd_idx = (f->rd_idx + 1) % f->depth; f->count--; mutex_unlock(f); return true; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_lin_init(mss_uart_instance_t *this_uart, uint32_t baud_rate, uint8_t line_config)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_lin_init(mss_uart_instance_t *this_uart, uint32_t baud_rate, uint8_t line_config)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); global_init(this_uart, baud_rate, line_config); set_bit_reg8(&this_uart->hw_reg->MM0, ELIN); clear_bit_reg8(&this_uart->hw_reg->MM1, EIRD); clear_bit_reg8(&this_uart->hw_reg->MM2, EERR); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SYSCTRL ADC Bus&Function Clock Enable and Reset Release. */
void LL_SYSCTRL_ADC_ClkEnRstRelease(void)
/* SYSCTRL ADC Bus&Function Clock Enable and Reset Release. */ void LL_SYSCTRL_ADC_ClkEnRstRelease(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_ADCBusClk_En(SYSCTRL); __LL_SYSCTRL_ADCFunClk_En(SYSCTRL); __LL_SYSCTRL_ADCSoftRst_Release(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if this interface is USB ECM SubType */
BOOLEAN IsSupportedDevice(IN EFI_USB_IO_PROTOCOL *UsbIo)
/* Check if this interface is USB ECM SubType */ BOOLEAN IsSupportedDevice(IN EFI_USB_IO_PROTOCOL *UsbIo)
{ EFI_STATUS Status; EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &InterfaceDescriptor); if (EFI_ERROR (Status)) { return FALSE; } if ((InterfaceDescriptor.InterfaceClass == USB_CDC_CLASS) && (InterfaceDescriptor.InterfaceSubClass == USB_CDC_ECM_SUBCLASS) && (InterfaceDescriptor.InterfaceProtocol == USB_NO_CLASS_PROTOCOL)) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Determine whether a conditional branch instruction would branch. */
static int __kprobes branch_taken(unsigned int instr, struct pt_regs *regs)
/* Determine whether a conditional branch instruction would branch. */ static int __kprobes branch_taken(unsigned int instr, struct pt_regs *regs)
{ unsigned int bo = (instr >> 21) & 0x1f; unsigned int bi; if ((bo & 4) == 0) { --regs->ctr; if (((bo >> 1) & 1) ^ (regs->ctr == 0)) return 0; } if ((bo & 0x10) == 0) { bi = (instr >> 16) & 0x1f; if (((regs->ccr >> (31 - bi)) & 1) != ((bo >> 3) & 1)) return 0; } return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Gets the value of the requested RTC match register. */
uint32_t HibernateRTCMatchGet(uint32_t ui32Match)
/* Gets the value of the requested RTC match register. */ uint32_t HibernateRTCMatchGet(uint32_t ui32Match)
{ ASSERT(ui32Match == 0); return(HWREG(HIB_RTCM0)); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Read value of dynamic EH Ctrl register configuration. */
int32_t BSP_NFCTAG_ReadEHCtrl_Dyn(uint32_t Instance, ST25DV_EH_CTRL *const pEH_CTRL)
/* Read value of dynamic EH Ctrl register configuration. */ int32_t BSP_NFCTAG_ReadEHCtrl_Dyn(uint32_t Instance, ST25DV_EH_CTRL *const pEH_CTRL)
{ UNUSED(Instance); return ST25DV_ReadEHCtrl_Dyn(&NfcTagObj, pEH_CTRL); }
eclipse-threadx/getting-started
C++
Other
310
/* Returns true if inflate is currently at the end of a block generated by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored block. When decompressing, PPP checks that at the end of input packet, inflate is waiting for these length bytes. */
int ZEXPORT inflateSyncPoint(z_streamp strm)
/* Returns true if inflate is currently at the end of a block generated by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored block. When decompressing, PPP checks that at the end of input packet, inflate is waiting for these length bytes. */ int ZEXPORT inflateSyncPoint(z_streamp strm)
{ struct inflate_state FAR *state; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; state = (struct inflate_state FAR *)strm->state; return state->mode == STORED && state->bits == 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns currently detected breakpoint value based on the register DR6 B0-B3 field. If no breakpoint is detected then it returns 0. */
UINTN GetBreakpointDetected(IN EFI_SYSTEM_CONTEXT SystemContext)
/* Returns currently detected breakpoint value based on the register DR6 B0-B3 field. If no breakpoint is detected then it returns 0. */ UINTN GetBreakpointDetected(IN EFI_SYSTEM_CONTEXT SystemContext)
{ IA32_DR6 Dr6; UINTN BreakpointNumber; Dr6.UintN = SystemContext.SystemContextIa32->Dr6; if (Dr6.Bits.B0 == 1) { BreakpointNumber = 1; } else if (Dr6.Bits.B1 == 1) { BreakpointNumber = 2; } else if (Dr6.Bits.B2 == 1) { BreakpointNumber = 3; } else if (Dr6.Bits.B3 == 1) { BreakpointNumber = 4; } else { BreakpointNumber = 0; } return BreakpointNumber; }
tianocore/edk2
C++
Other
4,240
/* Gets the selected ADC reset calibration registers status. */
FlagStatus ADC_GetResetCalibrationStatus(ADC_TypeDef *ADCx)
/* Gets the selected ADC reset calibration registers status. */ FlagStatus ADC_GetResetCalibrationStatus(ADC_TypeDef *ADCx)
{ FlagStatus bitstatus = RESET; assert_param(IS_ADC_ALL_PERIPH(ADCx)); if ((ADCx->CR2 & ADC_CR2_RSTCAL) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
avem-labs/Avem
C++
MIT License
1,752
/* decode a bitstring into a buffer of the expected length. enclen = bit string length explen = expected length (define in rfc) */
int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen)
/* decode a bitstring into a buffer of the expected length. enclen = bit string length explen = expected length (define in rfc) */ int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, int explen)
{ if (!(out->data = kzalloc(explen,GFP_NOFS))) return 0; out->len = explen; memcpy(out->data, in, enclen); return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* API to retrieve frequency of System PLL VCO input clock */
uint32_t XMC_SCU_CLOCK_GetSystemPllClockSourceFrequency(void)
/* API to retrieve frequency of System PLL VCO input clock */ uint32_t XMC_SCU_CLOCK_GetSystemPllClockSourceFrequency(void)
{ clock_frequency = OSCHP_GetFrequency(); } else { clock_frequency = OFI_FREQUENCY; } return (clock_frequency); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Returns the number of IOCB entries needed to store @dsds. */
uint16_t qla2x00_calc_iocbs_64(uint16_t dsds)
/* Returns the number of IOCB entries needed to store @dsds. */ uint16_t qla2x00_calc_iocbs_64(uint16_t dsds)
{ uint16_t iocbs; iocbs = 1; if (dsds > 2) { iocbs += (dsds - 2) / 5; if ((dsds - 2) % 5) iocbs++; } return (iocbs); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: the last element in the #GList, or NULL if the #GList has no elements */
GList* g_list_last(GList *list)
/* Returns: the last element in the #GList, or NULL if the #GList has no elements */ GList* g_list_last(GList *list)
{ if (list) { while (list->next) list = list->next; } return list; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Main operation less than or equal to; return 'l <= r'. If it needs a metamethod and there is no '__le', try '__lt', based on l <= r iff !(r < l) (assuming a total order). If the metamethod yields during this substitution, the continuation has to know about it (to negate the result of r<l); bit CIST_LEQ in the call status keeps that information. */
int luaV_lessequal(lua_State *L, const TValue *l, const TValue *r)
/* Main operation less than or equal to; return 'l <= r'. If it needs a metamethod and there is no '__le', try '__lt', based on l <= r iff !(r < l) (assuming a total order). If the metamethod yields during this substitution, the continuation has to know about it (to negate the result of r<l); bit CIST_LEQ in the call status keeps that information. */ int luaV_lessequal(lua_State *L, const TValue *l, const TValue *r)
{ L->ci->callstatus |= CIST_LEQ; res = luaT_callorderTM(L, r, l, TM_LT); L->ci->callstatus ^= CIST_LEQ; if (res < 0) luaG_ordererror(L, l, r); return !res; } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* De-Initializes the low level portion of the device driver. */
USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev)
/* De-Initializes the low level portion of the device driver. */ USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev)
{ HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_DeInit(pdev->pData); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status = USBD_BUSY; break; case HAL_TIMEOUT : usb_status = USBD_FAIL; break; default : usb_status = USBD_FAIL; break; } return usb_status; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeUART(unsigned long ulPort, unsigned char ucPins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeUART(unsigned long ulPort, unsigned char ucPins)
{ ASSERT(GPIOBaseValid(ulPort)); GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_HW); GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD); }
watterott/WebRadio
C++
null
71
/* Given a wmem scope, a tvbuff, an offset, and a length, treat the string of bytes referred to by the tvbuff, the offset, and the length as an ISO 8859/1 string, and return a pointer to a UTF-8 string, allocated using the wmem scope. */
static guint8* tvb_get_string_8859_1(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint length)
/* Given a wmem scope, a tvbuff, an offset, and a length, treat the string of bytes referred to by the tvbuff, the offset, and the length as an ISO 8859/1 string, and return a pointer to a UTF-8 string, allocated using the wmem scope. */ static guint8* tvb_get_string_8859_1(wmem_allocator_t *scope, tvbuff_t *tvb, gint offset, gint length)
{ const guint8 *ptr; ptr = ensure_contiguous(tvb, offset, length); return get_8859_1_string(scope, ptr, length); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Configuration of the TPM's Platform Hierarchy Authorization Value (platformAuth) and Platform Hierarchy Authorization Policy (platformPolicy) can be defined through this function. */
VOID EFIAPI SmmReadyToLockEventCallBack(IN EFI_EVENT Event, IN VOID *Context)
/* Configuration of the TPM's Platform Hierarchy Authorization Value (platformAuth) and Platform Hierarchy Authorization Policy (platformPolicy) can be defined through this function. */ VOID EFIAPI SmmReadyToLockEventCallBack(IN EFI_EVENT Event, IN VOID *Context)
{ EFI_STATUS Status; VOID *Interface; Status = gBS->LocateProtocol ( &gEfiDxeSmmReadyToLockProtocolGuid, NULL, &Interface ); if (EFI_ERROR (Status)) { return; } ConfigureTpmPlatformHierarchy (); gBS->CloseEvent (Event); }
tianocore/edk2
C++
Other
4,240
/* Fills each DAC_InitStruct member with its default value. */
void DAC_ClearStruct(DAC_InitType *DAC_InitStruct)
/* Fills each DAC_InitStruct member with its default value. */ void DAC_ClearStruct(DAC_InitType *DAC_InitStruct)
{ DAC_InitStruct->Trigger = DAC_TRG_NONE; DAC_InitStruct->WaveGen = DAC_WAVEGEN_NONE; DAC_InitStruct->LfsrUnMaskTriAmp = DAC_UNMASK_LFSRBIT0; DAC_InitStruct->BufferOutput = DAC_BUFFOUTPUT_ENABLE; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function puts the system into Deep Sleep power mode. System exits the power state on any one of the available interrupt. On exit from deep sleep the function returns to the calling function with all the processor core registers retained. */
void PRCMDeepSleepEnter(void)
/* This function puts the system into Deep Sleep power mode. System exits the power state on any one of the available interrupt. On exit from deep sleep the function returns to the calling function with all the processor core registers retained. */ void PRCMDeepSleepEnter(void)
{ HWREG(HIB1P2_BASE + HIB1P2_O_BGAP_DUTY_CYCLING_EXIT_CFG) = 0x1; HWREG(0xE000ED10)|=1<<2; CPUwfi(); HWREG(0xE000ED10) &= ~(1<<2); }
micropython/micropython
C++
Other
18,334
/* This should be the only way how to change classe's mode under normal cirsumstances. Routine will update feed lists linkage, change mode and add class to the wait event queue if appropriate. New mode should be different from old one and cl->pq_key has to be valid if changing to mode other than HTB_CAN_SEND (see htb_add_to_wait_tree). */
static void htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, long *diff)
/* This should be the only way how to change classe's mode under normal cirsumstances. Routine will update feed lists linkage, change mode and add class to the wait event queue if appropriate. New mode should be different from old one and cl->pq_key has to be valid if changing to mode other than HTB_CAN_SEND (see htb_add_to_wait_tree). */ static void htb_change_class_mode(struct htb_sched *q, struct htb_class *cl, long *diff)
{ enum htb_cmode new_mode = htb_class_mode(cl, diff); if (new_mode == cl->cmode) return; if (cl->prio_activity) { if (cl->cmode != HTB_CANT_SEND) htb_deactivate_prios(q, cl); cl->cmode = new_mode; if (new_mode != HTB_CANT_SEND) htb_activate_prios(q, cl); } else cl->cmode = new_mode; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Fills each TIM_TimeBaseInitStruct member with its default value. */
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
/* Fills each TIM_TimeBaseInitStruct member with its default value. */ void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
{ TIM_TimeBaseInitStruct->TIM_Period = 0xFFFFFFFF; TIM_TimeBaseInitStruct->TIM_Prescaler = 0x0000; TIM_TimeBaseInitStruct->TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseInitStruct->TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInitStruct->TIM_RepetitionCounter = 0x0000; }
MaJerle/stm32f429
C++
null
2,036
/* Clears the integrated USB DMA status for a specified channel. */
void USBDMAChannelStatusClear(uint32_t ui32Base, uint32_t ui32Channel, uint32_t ui32Status)
/* Clears the integrated USB DMA status for a specified channel. */ void USBDMAChannelStatusClear(uint32_t ui32Base, uint32_t ui32Channel, uint32_t ui32Status)
{ ASSERT(ui32Base == USB0_BASE); ASSERT(ui32Channel < 8); ui32Status &= USB_DMACTL0_ERR; HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) &= ~ui32Status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Flush all HCI events from the input-copy queue. */
static void flush_events(uint16_t size)
/* Flush all HCI events from the input-copy queue. */ static void flush_events(uint16_t size)
{ uint16_t response = sys_cpu_to_le16(CMD_FLUSH_EVENTS_RSP); struct net_buf *buf; while ((buf = net_buf_get(&event_queue, K_NO_WAIT))) { net_buf_unref(buf); m_events--; } read_excess_bytes(size); size = 0; edtt_write((uint8_t *)&response, sizeof(response), EDTTT_BLOCK); edtt_write((uint8_t *)&size, sizeof(size), EDTTT_BLOCK); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function creates a new device node in a newly allocated buffer of size NodeLength and initializes the device path node header with NodeType and NodeSubType. The new device path node is returned. If NodeLength is smaller than a device path header, then NULL is returned. If there is not enough memory to allocate space for the new device path, then NULL is returned. The memory is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. */
EFI_DEVICE_PATH_PROTOCOL* CreateDeviceNode(UINT8 NodeType, UINT8 NodeSubType, UINT16 NodeLength)
/* This function creates a new device node in a newly allocated buffer of size NodeLength and initializes the device path node header with NodeType and NodeSubType. The new device path node is returned. If NodeLength is smaller than a device path header, then NULL is returned. If there is not enough memory to allocate space for the new device path, then NULL is returned. The memory is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. */ EFI_DEVICE_PATH_PROTOCOL* CreateDeviceNode(UINT8 NodeType, UINT8 NodeSubType, UINT16 NodeLength)
{ return UefiDevicePathLibCreateDeviceNode (NodeType, NodeSubType, NodeLength); }
tianocore/edk2
C++
Other
4,240
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM1) { __HAL_RCC_TIM1_CLK_DISABLE(); } else if(htim_base->Instance==TIM4) { __HAL_RCC_TIM4_CLK_DISABLE(); } else if(htim_base->Instance==TIM14) { __HAL_RCC_TIM14_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will attempt to write BufferSize bytes data from the Buffer to the TLS object. */
INTN EFIAPI TlsCtrlTrafficIn(IN VOID *Tls, IN VOID *Buffer, IN UINTN BufferSize)
/* This function will attempt to write BufferSize bytes data from the Buffer to the TLS object. */ INTN EFIAPI TlsCtrlTrafficIn(IN VOID *Tls, IN VOID *Buffer, IN UINTN BufferSize)
{ CALL_CRYPTO_SERVICE (TlsCtrlTrafficIn, (Tls, Buffer, BufferSize), 0); }
tianocore/edk2
C++
Other
4,240
/* fc_bsg_softirq_done - softirq done routine for destroying the bsg requests @rq: BSG request that holds the job to be destroyed */
static void fc_bsg_softirq_done(struct request *rq)
/* fc_bsg_softirq_done - softirq done routine for destroying the bsg requests @rq: BSG request that holds the job to be destroyed */ static void fc_bsg_softirq_done(struct request *rq)
{ struct fc_bsg_job *job = rq->special; unsigned long flags; spin_lock_irqsave(&job->job_lock, flags); job->state_flags |= FC_RQST_STATE_DONE; job->ref_cnt--; spin_unlock_irqrestore(&job->job_lock, flags); blk_end_request_all(rq, rq->errors); fc_destroy_bsgjob(job); }
robutest/uclinux
C++
GPL-2.0
60
/* Reset Alternate Functions registers to their default reset values. */
void GPIO_AFIOReset(void)
/* Reset Alternate Functions registers to their default reset values. */ void GPIO_AFIOReset(void)
{ RCM_EnableAPB2PeriphReset(RCM_APB2_PERIPH_AFIO); RCM_DisableAPB2PeriphReset(RCM_APB2_PERIPH_AFIO); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Returns the allocated I2O device or a negative error code if the device could not be allocated. */
static struct i2o_device* i2o_device_alloc(void)
/* Returns the allocated I2O device or a negative error code if the device could not be allocated. */ static struct i2o_device* i2o_device_alloc(void)
{ struct i2o_device *dev; dev = kzalloc(sizeof(*dev), GFP_KERNEL); if (!dev) return ERR_PTR(-ENOMEM); INIT_LIST_HEAD(&dev->list); mutex_init(&dev->lock); dev->device.bus = &i2o_bus_type; dev->device.release = &i2o_device_release; return dev; }
robutest/uclinux
C++
GPL-2.0
60
/* Use of supply names configured via regulator_set_device_supply() is strongly encouraged. It is recommended that the supply name used should match the name used for the supply and/or the relevant device pins in the datasheet. */
struct regulator* regulator_get(struct device *dev, const char *id)
/* Use of supply names configured via regulator_set_device_supply() is strongly encouraged. It is recommended that the supply name used should match the name used for the supply and/or the relevant device pins in the datasheet. */ struct regulator* regulator_get(struct device *dev, const char *id)
{ return _regulator_get(dev, id, 0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read next Short Allocation Descriptor from a given file's data. */
EFI_STATUS GetShortAdFromAds(IN VOID *Data, IN OUT UINT64 *Offset, IN UINT64 Length, OUT UDF_SHORT_ALLOCATION_DESCRIPTOR **FoundShortAd)
/* Read next Short Allocation Descriptor from a given file's data. */ EFI_STATUS GetShortAdFromAds(IN VOID *Data, IN OUT UINT64 *Offset, IN UINT64 Length, OUT UDF_SHORT_ALLOCATION_DESCRIPTOR **FoundShortAd)
{ UDF_SHORT_ALLOCATION_DESCRIPTOR *ShortAd; UDF_EXTENT_FLAGS ExtentFlags; for ( ; ;) { if (*Offset >= Length) { return EFI_DEVICE_ERROR; } ShortAd = (UDF_SHORT_ALLOCATION_DESCRIPTOR *)((UINT8 *)Data + *Offset); ExtentFlags = GET_EXTENT_FLAGS (ShortAdsSequence, ShortAd); if ((ExtentFlags == ExtentIsNextExtent) || (ExtentFlags == ExtentRecordedAndAllocated)) { break; } *Offset += AD_LENGTH (ShortAdsSequence); } *FoundShortAd = ShortAd; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Enable SMRR register if SMRR is supported and */
VOID EFIAPI SmmCpuFeaturesReenableSmrr(VOID)
/* Enable SMRR register if SMRR is supported and */ VOID EFIAPI SmmCpuFeaturesReenableSmrr(VOID)
{ if (FeaturePcdGet (PcdSmrrEnable) && mNeedConfigureMtrrs) { AsmWriteMsr64 (mSmrrPhysMaskMsr, AsmReadMsr64 (mSmrrPhysMaskMsr) | EFI_MSR_SMRR_PHYS_MASK_VALID); } }
tianocore/edk2
C++
Other
4,240
/* Sends the current status of an endpoints to the USB host. */
static void GetEndpointStatus(unsigned char bEndpoint)
/* Sends the current status of an endpoints to the USB host. */ static void GetEndpointStatus(unsigned char bEndpoint)
{ static unsigned short data; data = 0; if (bEndpoint > CHIP_USB_NUMENDPOINTS) { USBD_Stall(0); } else { if (USBD_IsHalted(bEndpoint)) { data = 1; } USBD_Write(0, &data, 2, 0, 0); } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Run service completions on the card with interrupts enabled. */
static void run(struct work_struct *work)
/* Run service completions on the card with interrupts enabled. */ static void run(struct work_struct *work)
{ struct aha152x_hostdata *hd; list_for_each_entry(hd, &aha152x_host_list, host_list) { struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata); is_complete(shost); } }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate baudrate for LEUART given reference frequency and clock division. This function returns the baudrate that a LEUART module will use if configured with the given frequency and clock divisor. Notice that this function will not use actual HW configuration. It can be used to determinate if a given configuration is sufficiently accurate for the application. */
uint32_t LEUART_BaudrateCalc(uint32_t refFreq, uint32_t clkdiv)
/* Calculate baudrate for LEUART given reference frequency and clock division. This function returns the baudrate that a LEUART module will use if configured with the given frequency and clock divisor. Notice that this function will not use actual HW configuration. It can be used to determinate if a given configuration is sufficiently accurate for the application. */ uint32_t LEUART_BaudrateCalc(uint32_t refFreq, uint32_t clkdiv)
{ uint32_t divisor; uint32_t remainder; uint32_t quotient; uint32_t br; clkdiv &= _LEUART_CLKDIV_MASK; divisor = 256 + clkdiv; quotient = refFreq / divisor; remainder = refFreq % divisor; br = 256 * quotient; br += (256 * remainder) / divisor; return br; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This function is called after a PCI bus error affecting this device has been detected. */
static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
/* This function is called after a PCI bus error affecting this device has been detected. */ static pci_ers_result_t t3_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
{ struct adapter *adapter = pci_get_drvdata(pdev); int ret; if (state == pci_channel_io_perm_failure) return PCI_ERS_RESULT_DISCONNECT; ret = t3_adapter_error(adapter, 0); return PCI_ERS_RESULT_NEED_RESET; }
robutest/uclinux
C++
GPL-2.0
60
/* Initializes the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
/* Initializes the Low Level portion of the Device driver. */ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev)
{ hpcd.Instance = USB_OTG_FS; hpcd.Init.dev_endpoints = 4; hpcd.Init.use_dedicated_ep1 = 0; hpcd.Init.dma_enable = 0; hpcd.Init.low_power_enable = 0; hpcd.Init.phy_itface = PCD_PHY_EMBEDDED; hpcd.Init.Sof_enable = 0; hpcd.Init.speed = PCD_SPEED_FULL; hpcd.Init.vbus_sensing_enable = 1; hpcd.Init.lpm_enable = 0; hpcd.pData = pdev; pdev->pData = &hpcd; HAL_PCD_Init(&hpcd); HAL_PCDEx_SetRxFiFo(&hpcd, 0xA0); HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0xA0); return USBD_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function starts the SimpleLink in the configured role. The device notifies the host asynchronously when the initialization is completed. */
static int32_t InitSimplelink(uint8_t const role)
/* This function starts the SimpleLink in the configured role. The device notifies the host asynchronously when the initialization is completed. */ static int32_t InitSimplelink(uint8_t const role)
{ Provisioning_AppContext *const pCtx = &gAppCtx; int32_t retVal = -1; pCtx->role = role; pCtx->pendingEvents = 0; retVal = sl_Start(0, 0, (P_INIT_CALLBACK)SimpleLinkInitCallback); ASSERT_ON_ERROR(retVal); pCtx->asyncEvtTimeout = ASYNC_EVT_TIMEOUT; retVal = StartAsyncEvtTimer(pCtx->asyncEvtTimeout); ASSERT_ON_ERROR(retVal); return (retVal); }
nanoframework/nf-interpreter
C++
MIT License
293
/* Sets the designated bits in a 16/32-bit write-protected data word at a local CPU system address */
void IPCRtoLSetBits_Protected(tIpcMessage *psMessage)
/* Sets the designated bits in a 16/32-bit write-protected data word at a local CPU system address */ void IPCRtoLSetBits_Protected(tIpcMessage *psMessage)
{ uint16_t usLength; EALLOW; usLength = (uint16_t)psMessage->uldataw1; if (usLength == IPC_LENGTH_16_BITS) { *(volatile uint16_t*)psMessage->uladdress |= (uint16_t) psMessage->uldataw2; } else if (usLength == IPC_LENGTH_32_BITS) { *(volatile unsigned long *)psMessage->uladdress |= psMessage->uldataw2; } EDIS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Erase a page in the NVM. This function calls MSC_ErasePage and converts the return status. */
Ecode_t NVMHAL_PageErase(uint8_t *pAddress)
/* Erase a page in the NVM. This function calls MSC_ErasePage and converts the return status. */ Ecode_t NVMHAL_PageErase(uint8_t *pAddress)
{ return returnTypeConvert(MSC_ErasePage((uint32_t *) pAddress)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Config the slave select pins of the specified SPI port. The */
void SPISSConfig(unsigned long ulBase, unsigned long ulSSTriggerMode, unsigned long ulSSActType)
/* Config the slave select pins of the specified SPI port. The */ void SPISSConfig(unsigned long ulBase, unsigned long ulSSTriggerMode, unsigned long ulSSActType)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); xASSERT((ulSSTriggerMode == SPI_SS_EDGE_TRIGGER) || (ulSSTriggerMode == SPI_SS_LEVEL_TRIGGER)); xASSERT((ulSSActType == SPI_SS_ACTIVE_LOW_FALLING) || (ulSSActType == SPI_SS_ACTIVE_HIGH_RISING)); xHWREG(ulBase + SPI_SSR) &= ~(SPI_SS_LEVEL_TRIGGER | SPI_SS_ACTIVE_HIGH_RISING); xHWREG(ulBase + SPI_SSR) |= ulSSTriggerMode | ulSSActType; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Enables or disables the DMA Tx Desc CRC. */
void ETH_EnableDmaTxDescCrc(ETH_DMADescType *DMATxDesc, FunctionalState Cmd)
/* Enables or disables the DMA Tx Desc CRC. */ void ETH_EnableDmaTxDescCrc(ETH_DMADescType *DMATxDesc, FunctionalState Cmd)
{ assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { DMATxDesc->CtrlOrBufSize &= (~(uint32_t)ETH_DMA_TX_DESC_DC); } else { DMATxDesc->CtrlOrBufSize |= ETH_DMA_TX_DESC_DC; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Make a lv_timer ready. It will not wait its period. */
void lv_timer_ready(lv_timer_t *timer)
/* Make a lv_timer ready. It will not wait its period. */ void lv_timer_ready(lv_timer_t *timer)
{ timer->last_run = lv_tick_get() - timer->period - 1; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Flush all the dirty cache back, include the FAT cache and the Data cache. */
EFI_STATUS FatVolumeFlushCache(IN FAT_VOLUME *Volume, IN FAT_TASK *Task)
/* Flush all the dirty cache back, include the FAT cache and the Data cache. */ EFI_STATUS FatVolumeFlushCache(IN FAT_VOLUME *Volume, IN FAT_TASK *Task)
{ EFI_STATUS Status; CACHE_DATA_TYPE CacheDataType; UINTN GroupIndex; UINTN GroupMask; DISK_CACHE *DiskCache; CACHE_TAG *CacheTag; for (CacheDataType = (CACHE_DATA_TYPE)0; CacheDataType < CacheMaxType; CacheDataType++) { DiskCache = &Volume->DiskCache[CacheDataType]; if (DiskCache->Dirty) { GroupMask = DiskCache->GroupMask; for (GroupIndex = 0; GroupIndex <= GroupMask; GroupIndex++) { CacheTag = &DiskCache->CacheTag[GroupIndex]; if ((CacheTag->RealSize > 0) && CacheTag->Dirty) { Status = FatExchangeCachePage (Volume, CacheDataType, WriteDisk, CacheTag, Task); if (EFI_ERROR (Status)) { return Status; } } } DiskCache->Dirty = FALSE; } } Status = Volume->BlockIo->FlushBlocks (Volume->BlockIo); return Status; }
tianocore/edk2
C++
Other
4,240
/* STUSB1602 sets the VCONN_MONITORING Enabling bit (bit7 0x20 */
STUSB1602_StatusTypeDef STUSB1602_VCONN_Monitor_Status_Set(uint8_t Addr, VCONN_Monitoring_TypeDef st)
/* STUSB1602 sets the VCONN_MONITORING Enabling bit (bit7 0x20 */ STUSB1602_StatusTypeDef STUSB1602_VCONN_Monitor_Status_Set(uint8_t Addr, VCONN_Monitoring_TypeDef st)
{ STUSB1602_StatusTypeDef status = STUSB1602_OK; STUSB1602_VCONN_MONITORING_CTRL_RegTypeDef reg; STUSB1602_ReadReg(&reg.d8, Addr, STUSB1602_VCONN_MONITORING_CTRL_REG, 1); reg.b.VCONN_MONITORING_EN = st; status = STUSB1602_WriteReg(&reg.d8, Addr, STUSB1602_VCONN_MONITORING_CTRL_REG, 1); return status; }
st-one/X-CUBE-USB-PD
C++
null
110
/* Description: Process a user generated STATICREMOVEDEF message and remove the default unlabeled connection entry. Returns zero on success, negative values on failure. */
static int netlbl_unlabel_staticremovedef(struct sk_buff *skb, struct genl_info *info)
/* Description: Process a user generated STATICREMOVEDEF message and remove the default unlabeled connection entry. Returns zero on success, negative values on failure. */ static int netlbl_unlabel_staticremovedef(struct sk_buff *skb, struct genl_info *info)
{ int ret_val; void *addr; void *mask; u32 addr_len; struct netlbl_audit audit_info; if (!((!info->attrs[NLBL_UNLABEL_A_IPV4ADDR] || !info->attrs[NLBL_UNLABEL_A_IPV4MASK]) ^ (!info->attrs[NLBL_UNLABEL_A_IPV6ADDR] || !info->attrs[NLBL_UNLABEL_A_IPV6MASK]))) return -EINVAL; netlbl_netlink_auditinfo(skb, &audit_info); ret_val = netlbl_unlabel_addrinfo_get(info, &addr, &mask, &addr_len); if (ret_val != 0) return ret_val; return netlbl_unlhsh_remove(&init_net, NULL, addr, mask, addr_len, &audit_info); }
EmcraftSystems/linux-emcraft
C++
Other
266