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
/* Performs connection upkeep for the given session handle. */
CURLcode curl_easy_upkeep(struct Curl_easy *data)
/* Performs connection upkeep for the given session handle. */ CURLcode curl_easy_upkeep(struct Curl_easy *data)
{ if(!GOOD_EASY_HANDLE(data)) return CURLE_BAD_FUNCTION_ARGUMENT; if(data->multi_easy) { return Curl_upkeep(&data->multi_easy->conn_cache, data); } else { return CURLE_OK; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* creates a new string and anchors it in scanner's table so that it will not be collected until the end of the compilation (by that time it should be anchored somewhere) */
TString* luaX_newstring(LexState *ls, const char *str, size_t l)
/* creates a new string and anchors it in scanner's table so that it will not be collected until the end of the compilation (by that time it should be anchored somewhere) */ TString* luaX_newstring(LexState *ls, const char *str, size_t l)
{ setbvalue(o, 1); luaC_checkGC(L); } else { ts = tsvalue(keyfromval(o)); } L->top--; return ts; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Returns the local resolvable private address currently being using by the scanner/initiator */
uint8_t* ble_ll_scan_get_local_rpa(void)
/* Returns the local resolvable private address currently being using by the scanner/initiator */ uint8_t* ble_ll_scan_get_local_rpa(void)
{ return g_ble_ll_scan_sm.pdu_data.scana; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Returns: (transfer full): the data if found, or NULL if no such data exists. */
gpointer g_object_steal_data(GObject *object, const gchar *key)
/* Returns: (transfer full): the data if found, or NULL if no such data exists. */ gpointer g_object_steal_data(GObject *object, const gchar *key)
{ GQuark quark; g_return_val_if_fail (G_IS_OBJECT (object), NULL); g_return_val_if_fail (key != NULL, NULL); quark = g_quark_try_string (key); return quark ? g_datalist_id_remove_no_notify (&object->qdata, quark) : NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* diagnose code 0x14 subcode 0x0000 - read next spool file buffer cc=0 normal completion cc=1 EOF reached cc=2 no file active on the virtual reader, and no file eligible cc=3 file already active on the virtual reader or specified virtual reader does not exist or is not a reader */
static int diag_read_file(int devno, char *buf)
/* diagnose code 0x14 subcode 0x0000 - read next spool file buffer cc=0 normal completion cc=1 EOF reached cc=2 no file active on the virtual reader, and no file eligible cc=3 file already active on the virtual reader or specified virtual reader does not exist or is not a reader */ static int diag_read_file(int devno, char *buf)
{ int cc; cc = diag14((unsigned long) buf, devno, 0x00); switch (cc) { case 0: return 0; case 1: return -ENODATA; case 2: return -ENOMEDIUM; default: return -EIO; } }
robutest/uclinux
C++
GPL-2.0
60
/* Puts a data element into the SSI transmit FIFO. */
int32_t SSIDataPutNonBlocking(uint32_t ui32Base, uint32_t ui32Data)
/* Puts a data element into the SSI transmit FIFO. */ int32_t SSIDataPutNonBlocking(uint32_t ui32Base, uint32_t ui32Data)
{ ASSERT(_SSIBaseValid(ui32Base)); ASSERT((ui32Data & (0xfffffffe << (HWREG(ui32Base + SSI_O_CR0) & SSI_CR0_DSS_M))) == 0); if (HWREG(ui32Base + SSI_O_SR) & SSI_SR_TNF) { HWREG(ui32Base + SSI_O_DR) = ui32Data; return (1); } else { return (0); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate and setup space for the CAN network device */
struct net_device* alloc_candev(int sizeof_priv, unsigned int echo_skb_max)
/* Allocate and setup space for the CAN network device */ struct net_device* alloc_candev(int sizeof_priv, unsigned int echo_skb_max)
{ struct net_device *dev; struct can_priv *priv; int size; if (echo_skb_max) size = ALIGN(sizeof_priv, sizeof(struct sk_buff *)) + echo_skb_max * sizeof(struct sk_buff *); else size = sizeof_priv; dev = alloc_netdev(size, "can%d", can_setup); if (!dev) return NULL; priv = netdev_priv(dev); if (echo_skb_max) { priv->echo_skb_max = echo_skb_max; priv->echo_skb = (void *)priv + ALIGN(sizeof_priv, sizeof(struct sk_buff *)); } priv->state = CAN_STATE_STOPPED; init_timer(&priv->restart_timer); return dev; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the SERCOM I2C master to be used with the AT30TSE75X device. */
void at30tse_init(void)
/* Configures the SERCOM I2C master to be used with the AT30TSE75X device. */ void at30tse_init(void)
{ struct i2c_master_config conf; i2c_master_get_config_defaults(&conf); conf.buffer_timeout = 10000; conf.pinmux_pad0 = AT30TSE_PINMUX_PAD0; conf.pinmux_pad1 = AT30TSE_PINMUX_PAD1; i2c_master_init(&dev_inst_at30tse75x, AT30TSE_SERCOM, &conf); i2c_master_enable(&dev_inst_at30tse75x); }
memfault/zero-to-main
C++
null
200
/* The constructor function initializes memory profile for SMM phase. */
EFI_STATUS EFIAPI SmmMemoryProfileLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function initializes memory profile for SMM phase. */ EFI_STATUS EFIAPI SmmMemoryProfileLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = gBS->LocateProtocol ( &gEdkiiMemoryProfileGuid, NULL, (VOID **)&mLibProfileProtocol ); if (EFI_ERROR (Status)) { mLibProfileProtocol = NULL; } Status = gSmst->SmmLocateProtocol ( &gEdkiiSmmMemoryProfileGuid, NULL, (VOID **)&mLibSmmProfileProtocol ); if (EFI_ERROR (Status)) { mLibSmmProfileProtocol = NULL; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Flushes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Flushes an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_Flush(pdev->pData, ep_addr); 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
/* Enables or disables the High Speed APB (APB2) peripheral clock. */
void RCC_APB2PeriphClockCmd(u32 apb2_periph, FunctionalState state)
/* Enables or disables the High Speed APB (APB2) peripheral clock. */ void RCC_APB2PeriphClockCmd(u32 apb2_periph, FunctionalState state)
{ (state) ? (RCC->APB2ENR |= apb2_periph) : (RCC->APB2ENR &= ~apb2_periph); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base CSI peripheral base address. param fifo The FIFO to clear. */
void CSI_ClearFifo(CSI_Type *base, csi_fifo_t fifo)
/* param base CSI peripheral base address. param fifo The FIFO to clear. */ void CSI_ClearFifo(CSI_Type *base, csi_fifo_t fifo)
{ uint32_t cr1; uint32_t mask = 0U; cr1 = base->CSICR1; base->CSICR1 = (cr1 & ~CSI_CSICR1_FCC_MASK); if ((uint32_t)fifo & (uint32_t)kCSI_RxFifo) { mask |= CSI_CSICR1_CLR_RXFIFO_MASK; } if ((uint32_t)fifo & (uint32_t)kCSI_StatFifo) { mask |= CSI_CSICR1_CLR_STATFIFO_MASK; } base->CSICR1 = (cr1 & ~CSI_CSICR1_FCC_MASK) | mask; while (base->CSICR1 & mask) { } base->CSICR1 = cr1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */
static void avma1cs_detach(struct pcmcia_device *p_dev)
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */ static void avma1cs_detach(struct pcmcia_device *p_dev)
{ dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); avma1cs_release(link); kfree(link->priv); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the Number of Wait States. Used to match the system clock to the FLASH memory access time. See the programming manual for more information on clock speed and voltage ranges. The latency must be changed to the appropriate value */
void flash_set_ws(uint32_t ws)
/* Set the Number of Wait States. Used to match the system clock to the FLASH memory access time. See the programming manual for more information on clock speed and voltage ranges. The latency must be changed to the appropriate value */ void flash_set_ws(uint32_t ws)
{ uint32_t reg32; reg32 = FLASH_ACR; reg32 &= ~(1 << 0); reg32 |= ws; FLASH_ACR = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* param base The I3C peripheral base address. param data IBI data pointer param dataSize IBI data length */
void I3C_SlaveRequestIBIWithData(I3C_Type *base, i3c_slave_handle_t *handle, uint8_t *data, size_t dataSize)
/* param base The I3C peripheral base address. param data IBI data pointer param dataSize IBI data length */ void I3C_SlaveRequestIBIWithData(I3C_Type *base, i3c_slave_handle_t *handle, uint8_t *data, size_t dataSize)
{ uint32_t ctrlValue = base->SCTRL; ctrlValue &= ~(I3C_SCTRL_EVENT_MASK | I3C_SCTRL_IBIDATA_MASK); ctrlValue |= I3C_SCTRL_EVENT(1U) | I3C_SCTRL_IBIDATA(*data); handle->ibiData = &data[1]; handle->ibiDataSize = dataSize - 1U; base->SCTRL = ctrlValue; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Turn on micro SD card power. DK doesn't support socket power control, only enable the SPI clock. */
void MICROSD_PowerOn(void)
/* Turn on micro SD card power. DK doesn't support socket power control, only enable the SPI clock. */ void MICROSD_PowerOn(void)
{ CMU_ClockEnable(MICROSD_CMUCLOCK, true); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Print all layer type names supported. We send the output to the stream described by the handle output. */
static void fprint_all_layer_types(FILE *output)
/* Print all layer type names supported. We send the output to the stream described by the handle output. */ static void fprint_all_layer_types(FILE *output)
{ prev_display_dissector_name = NULL; dissector_all_tables_foreach_table(display_dissector_table_names, (gpointer)output, (GCompareFunc)compare_dissector_key_name); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Accepts an array of octets as the next portion of the message. */
void ICACHE_FLASH_ATTR SHA256_Update(SHA256_CTX *ctx, const uint8_t *msg, int len)
/* Accepts an array of octets as the next portion of the message. */ void ICACHE_FLASH_ATTR SHA256_Update(SHA256_CTX *ctx, const uint8_t *msg, int len)
{ uint32_t left = ctx->total[0] & 0x3F; uint32_t fill = 64 - left; ctx->total[0] += len; ctx->total[0] &= 0xFFFFFFFF; if (ctx->total[0] < len) ctx->total[1]++; if (left && len >= fill) { memcpy((void *) (ctx->buffer + left), (void *)msg, fill); SHA256_Process(ctx->buffer, ctx); len -= fill; msg += fill; left = 0; } while (len >= 64) { SHA256_Process(msg, ctx); len -= 64; msg += 64; } if (len) { memcpy((void *) (ctx->buffer + left), (void *) msg, len); } }
eerimoq/simba
C++
Other
337
/* Must invoke this after you are finished using a given srcu_struct that was initialized via init_srcu_struct(), else you leak memory. */
void cleanup_srcu_struct(struct srcu_struct *sp)
/* Must invoke this after you are finished using a given srcu_struct that was initialized via init_srcu_struct(), else you leak memory. */ void cleanup_srcu_struct(struct srcu_struct *sp)
{ int sum; sum = srcu_readers_active(sp); WARN_ON(sum); if (sum != 0) return; free_percpu(sp->per_cpu_ref); sp->per_cpu_ref = NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function disables the RTC in the Hibernation module. After calling this function, the RTC features of the Hibernation module are not available. */
void HibernateRTCDisable(void)
/* This function disables the RTC in the Hibernation module. After calling this function, the RTC features of the Hibernation module are not available. */ void HibernateRTCDisable(void)
{ HWREG(HIB_CTL) &= ~HIB_CTL_RTCEN; _HibernateWriteComplete(); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This waits for either a completion of a specific task to be signaled or for a specified timeout to expire. It is interruptible. The timeout is in jiffies. */
unsigned long __sched wait_for_completion_interruptible_timeout(struct completion *x, unsigned long timeout)
/* This waits for either a completion of a specific task to be signaled or for a specified timeout to expire. It is interruptible. The timeout is in jiffies. */ unsigned long __sched wait_for_completion_interruptible_timeout(struct completion *x, unsigned long timeout)
{ return wait_for_common(x, timeout, TASK_INTERRUPTIBLE); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* locking rate makes sense only for internal clock mode */
static int is_pro_rate_locked(struct snd_ice1712 *ice)
/* locking rate makes sense only for internal clock mode */ static int is_pro_rate_locked(struct snd_ice1712 *ice)
{ return (!ice->is_spdif_master(ice)) && PRO_RATE_LOCKED; }
robutest/uclinux
C++
GPL-2.0
60
/* Shall be calle under atomic context... to avoid possible racing condition... */
struct wlan_network* _rtw_find_network(_queue *scanned_queue, u8 *addr)
/* Shall be calle under atomic context... to avoid possible racing condition... */ struct wlan_network* _rtw_find_network(_queue *scanned_queue, u8 *addr)
{ _list *phead, *plist; struct wlan_network *pnetwork = NULL; u8 zero_addr[ETH_ALEN] = {0,0,0,0,0,0}; _func_enter_; if(_rtw_memcmp(zero_addr, addr, ETH_ALEN)){ pnetwork=NULL; goto exit; } phead = get_list_head(scanned_queue); plist = get_next(phead); while (plist != phead) { pnetwork = LIST_CONTAINOR(plist, struct wlan_network ,list); if (_rtw_memcmp(addr, pnetwork->network.MacAddress, ETH_ALEN) == _TRUE) break; plist = get_next(plist); } if(plist == phead) pnetwork = NULL; exit:_func_exit_; return pnetwork; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Closes all channel buffers and frees the channel. */
void relay_close(struct rchan *chan)
/* Closes all channel buffers and frees the channel. */ void relay_close(struct rchan *chan)
{ unsigned int i; if (!chan) return; mutex_lock(&relay_channels_mutex); if (chan->is_global && chan->buf[0]) relay_close_buf(chan->buf[0]); else for_each_possible_cpu(i) if (chan->buf[i]) relay_close_buf(chan->buf[i]); if (chan->last_toobig) printk(KERN_WARNING "relay: one or more items not logged " "[item size (%Zd) > sub-buffer size (%Zd)]\n", chan->last_toobig, chan->subbuf_size); list_del(&chan->list); kref_put(&chan->kref, relay_destroy_channel); mutex_unlock(&relay_channels_mutex); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initialize UART channel. This routine is called to reset the chip in a quiescent state. It is assumed that this function is called only once per UART. */
static int cdc_acm_init(const struct device *dev)
/* Initialize UART channel. This routine is called to reset the chip in a quiescent state. It is assumed that this function is called only once per UART. */ static int cdc_acm_init(const struct device *dev)
{ struct cdc_acm_dev_data_t * const dev_data = dev->data; int ret = 0; dev_data->common.dev = dev; sys_slist_append(&cdc_acm_data_devlist, &dev_data->common.node); LOG_DBG("Device dev %p dev_data %p cfg %p added to devlist %p", dev, dev_data, dev->config, &cdc_acm_data_devlist); k_work_init(&dev_data->cb_work, cdc_acm_irq_callback_work_handler); k_work_init_delayable(&dev_data->tx_work, tx_work_handler); return ret; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Written by Sven Verdoolaege, Leiden Institute of Advanced Computer Science, Universiteit Leiden, Niels Bohrweg 1, 2333 CA Leiden, The Netherlands and K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
static void save_alpha(GBR_LP *lp, int first, int n, GBR_type *alpha)
/* Written by Sven Verdoolaege, Leiden Institute of Advanced Computer Science, Universiteit Leiden, Niels Bohrweg 1, 2333 CA Leiden, The Netherlands and K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ static void save_alpha(GBR_LP *lp, int first, int n, GBR_type *alpha)
{ int i; for (i = 0; i < n; ++i) GBR_lp_get_alpha(lp, first + i, &alpha[i]); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns 0 if current has the requested access, error code otherwise */
static int smack_sem_associate(struct sem_array *sma, int semflg)
/* Returns 0 if current has the requested access, error code otherwise */ static int smack_sem_associate(struct sem_array *sma, int semflg)
{ int may; may = smack_flags_to_may(semflg); return smk_curacc_sem(sma, may); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* pdcspath_attr_store - Generic write function call wrapper. @kobj: The kobject to write info to. @attr: The attribute to be modified. @buf: The input buffer. @count: The size of the buffer. */
static ssize_t pdcspath_attr_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count)
/* pdcspath_attr_store - Generic write function call wrapper. @kobj: The kobject to write info to. @attr: The attribute to be modified. @buf: The input buffer. @count: The size of the buffer. */ static ssize_t pdcspath_attr_store(struct kobject *kobj, struct attribute *attr, const char *buf, size_t count)
{ struct pdcspath_entry *entry = to_pdcspath_entry(kobj); struct pdcspath_attribute *pdcs_attr = to_pdcspath_attribute(attr); ssize_t ret = 0; if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (pdcs_attr->store) ret = pdcs_attr->store(entry, buf, count); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
VOID* EFIAPI AllocateRuntimeCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
/* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ VOID* EFIAPI AllocateRuntimeCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
{ return InternalAllocateCopyPool (EfiRuntimeServicesData, AllocationSize, Buffer); }
tianocore/edk2
C++
Other
4,240
/* Reads the general registers into an output buffer and sends it as a packet */
VOID EFIAPI ReadGeneralRegisters(IN EFI_SYSTEM_CONTEXT SystemContext)
/* Reads the general registers into an output buffer and sends it as a packet */ VOID EFIAPI ReadGeneralRegisters(IN EFI_SYSTEM_CONTEXT SystemContext)
{ UINTN Index; CHAR8 *OutBuffer; CHAR8 *OutBufPtr; UINTN RegisterCount = MaxRegisterCount (); OutBuffer = AllocatePool ((RegisterCount * 8) + 1); OutBufPtr = OutBuffer; for (Index = 0; Index < RegisterCount; Index++) { OutBufPtr = BasicReadRegister (SystemContext, Index, OutBufPtr); } *OutBufPtr = '\0'; SendPacket (OutBuffer); FreePool (OutBuffer); }
tianocore/edk2
C++
Other
4,240
/* Sets up the periodic ISR used for the RTOS tick. This uses RLT0, but can be done using any given RLT. */
static void prvSetupRLT0Interrupt(void)
/* Sets up the periodic ISR used for the RTOS tick. This uses RLT0, but can be done using any given RLT. */ static void prvSetupRLT0Interrupt(void)
{ const uint16_t usReloadValue = ( uint16_t ) ( ( ( configCLKP1_CLOCK_HZ / configTICK_RATE_HZ ) / 16UL ) - 1UL ); TMRLR0 = usReloadValue; TMCSR0 = 0x041B; }
labapart/polymcu
C++
null
201
/* Function to determine if a given filename represents a file. */
EFI_STATUS EFIAPI ShellIsFile(IN CONST CHAR16 *Name)
/* Function to determine if a given filename represents a file. */ EFI_STATUS EFIAPI ShellIsFile(IN CONST CHAR16 *Name)
{ EFI_STATUS Status; SHELL_FILE_HANDLE Handle; ASSERT (Name != NULL); Handle = NULL; Status = ShellOpenFileByName (Name, &Handle, EFI_FILE_MODE_READ, 0); if (EFI_ERROR (Status)) { return (Status); } if (FileHandleIsDirectory (Handle) != EFI_SUCCESS) { ShellCloseFile (&Handle); return (EFI_SUCCESS); } ShellCloseFile (&Handle); return (EFI_NOT_FOUND); }
tianocore/edk2
C++
Other
4,240
/* saddr == NULL means use device source address. daddr == NULL means leave destination address (eg unresolved arp). */
static int fwnet_header_create(struct sk_buff *skb, struct net_device *net, unsigned short type, const void *daddr, const void *saddr, unsigned len)
/* saddr == NULL means use device source address. daddr == NULL means leave destination address (eg unresolved arp). */ static int fwnet_header_create(struct sk_buff *skb, struct net_device *net, unsigned short type, const void *daddr, const void *saddr, unsigned len)
{ struct fwnet_header *h; h = (struct fwnet_header *)skb_push(skb, sizeof(*h)); put_unaligned_be16(type, &h->h_proto); if (net->flags & (IFF_LOOPBACK | IFF_NOARP)) { memset(h->h_dest, 0, net->addr_len); return net->hard_header_len; } if (daddr) { memcpy(h->h_dest, daddr, net->addr_len); return net->hard_header_len; } return -net->hard_header_len; }
robutest/uclinux
C++
GPL-2.0
60
/* Set maximum transmission length in number of bytes. */
void radio_set_maxlen(uint8_t maxlen)
/* Set maximum transmission length in number of bytes. */ void radio_set_maxlen(uint8_t maxlen)
{ uint32_t reg_pcnf1 = RADIO_PCNF1; reg_pcnf1 &= ~RADIO_PCNF1_MAXLEN_MASK; RADIO_PCNF1 = reg_pcnf1 | RADIO_PCNF1_MAXLEN_MASKED(maxlen); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Process some data in the one-pass (strip buffer) case. This is used for color precision reduction as well as one-pass quantization. */
post_process_1pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
/* Process some data in the one-pass (strip buffer) case. This is used for color precision reduction as well as one-pass quantization. */ post_process_1pass(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{ my_post_ptr post = (my_post_ptr) cinfo->post; JDIMENSION num_rows, max_rows; max_rows = out_rows_avail - *out_row_ctr; if (max_rows > post->strip_height) max_rows = post->strip_height; num_rows = 0; (*cinfo->upsample->upsample) (cinfo, input_buf, in_row_group_ctr, in_row_groups_avail, post->buffer, &num_rows, max_rows); (*cinfo->cquantize->color_quantize) (cinfo, post->buffer, output_buf + *out_row_ctr, (int) num_rows); *out_row_ctr += num_rows; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Return 1 if the @gtm indicates the BIOS selected an 80wire mode. */
int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm)
/* Return 1 if the @gtm indicates the BIOS selected an 80wire mode. */ int ata_acpi_cbl_80wire(struct ata_port *ap, const struct ata_acpi_gtm *gtm)
{ struct ata_device *dev; ata_for_each_dev(dev, &ap->link, ENABLED) { unsigned long xfer_mask, udma_mask; xfer_mask = ata_acpi_gtm_xfermask(dev, gtm); ata_unpack_xfermask(xfer_mask, NULL, NULL, &udma_mask); if (udma_mask & ~ATA_UDMA_MASK_40C) return 1; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Clears a module status flag. Clears the given status flag of the module. */
void dac_clear_status(struct dac_module *const module_inst, uint32_t status_flags)
/* Clears a module status flag. Clears the given status flag of the module. */ void dac_clear_status(struct dac_module *const module_inst, uint32_t status_flags)
{ Assert(module_inst); Assert(module_inst->hw); Dac *const dac_module = module_inst->hw; uint32_t intflags = 0; if (status_flags & DAC_STATUS_CHANNEL_0_EMPTY) { intflags |= DAC_INTFLAG_EMPTY; } if (status_flags & DAC_STATUS_CHANNEL_0_UNDERRUN) { intflags |= DAC_INTFLAG_UNDERRUN; } dac_module->INTFLAG.reg = intflags; }
memfault/zero-to-main
C++
null
200
/* Before stamping the inode's ->dirtied_when, we check to see whether it is already the most-recently-dirtied inode on the b_dirty list. If that is the case then the inode must have been redirtied while it was being written out and we don't reset its dirtied_when. */
static void redirty_tail(struct inode *inode)
/* Before stamping the inode's ->dirtied_when, we check to see whether it is already the most-recently-dirtied inode on the b_dirty list. If that is the case then the inode must have been redirtied while it was being written out and we don't reset its dirtied_when. */ static void redirty_tail(struct inode *inode)
{ struct bdi_writeback *wb = &inode_to_bdi(inode)->wb; if (!list_empty(&wb->b_dirty)) { struct inode *tail; tail = list_entry(wb->b_dirty.next, struct inode, i_list); if (time_before(inode->dirtied_when, tail->dirtied_when)) inode->dirtied_when = jiffies; } list_move(&inode->i_list, &wb->b_dirty); }
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)
{ long lInterruptMask; lInterruptMask = get_imask(); set_imask( portKERNEL_INTERRUPT_PRIORITY ); trapa( portYIELD_TRAP_NO ); set_imask( ( int ) lInterruptMask ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This controller supports PIO0 to PIO2 (no IORDY even though higher timings can be loaded). */
static void ht6560a_set_piomode(struct ata_port *ap, struct ata_device *adev)
/* This controller supports PIO0 to PIO2 (no IORDY even though higher timings can be loaded). */ static void ht6560a_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ u8 active, recover; struct ata_timing t; ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); active = clamp_val(t.active, 2, 15); recover = clamp_val(t.recover, 4, 15); inb(0x3E6); inb(0x3E6); inb(0x3E6); inb(0x3E6); iowrite8(recover << 4 | active, ap->ioaddr.device_addr); ioread8(ap->ioaddr.status_addr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the Internal High Speed oscillator (HSI). */
void RCC_HSICmd(FunctionalState state)
/* Enables or disables the Internal High Speed oscillator (HSI). */ void RCC_HSICmd(FunctionalState state)
{ MODIFY_REG(RCC->CR, RCC_CR_HSION, (state << RCC_CR_HSION_Pos)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read RTC content through its registers using IO access. */
STATIC UINT8 IoRtcRead(IN UINTN Address)
/* Read RTC content through its registers using IO access. */ STATIC UINT8 IoRtcRead(IN UINTN Address)
{ IoWrite8 ( mRtcIndexRegister, (UINT8)(Address | (UINT8)(IoRead8 (mRtcIndexRegister) & 0x80)) ); return IoRead8 (mRtcTargetRegister); }
tianocore/edk2
C++
Other
4,240
/* Scan ie for p2p ie and look for attribute 6 channel. If available determine channel and return it. */
static s32 brcmf_p2p_find_listen_channel(const u8 *ie, u32 ie_len)
/* Scan ie for p2p ie and look for attribute 6 channel. If available determine channel and return it. */ static s32 brcmf_p2p_find_listen_channel(const u8 *ie, u32 ie_len)
{ u8 channel_ie[5]; s32 listen_channel; s32 err; err = cfg80211_get_p2p_attr(ie, ie_len, IEEE80211_P2P_ATTR_LISTEN_CHANNEL, channel_ie, sizeof(channel_ie)); if (err < 0) return err; listen_channel = (s32)channel_ie[3 + 1]; if (listen_channel == SOCIAL_CHAN_1 || listen_channel == SOCIAL_CHAN_2 || listen_channel == SOCIAL_CHAN_3) { brcmf_dbg(INFO, "Found my Listen Channel %d\n", listen_channel); return listen_channel; } return -EPERM; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enable a PCI driver to access PCI config space. */
STATIC EFI_STATUS EFIAPI PciIoPciWrite(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT32 Offset, IN UINTN Count, IN OUT VOID *Buffer)
/* Enable a PCI driver to access PCI config space. */ STATIC EFI_STATUS EFIAPI PciIoPciWrite(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT32 Offset, IN UINTN Count, IN OUT VOID *Buffer)
{ NON_DISCOVERABLE_PCI_DEVICE *Dev; VOID *Address; if ((Width < 0) || (Width >= EfiPciIoWidthMaximum) || (Buffer == NULL)) { return EFI_INVALID_PARAMETER; } Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO (This); Address = (UINT8 *)&Dev->ConfigSpace + Offset; if (Offset + (Count << ((UINTN)Width & 0x3)) > sizeof (Dev->ConfigSpace)) { return EFI_UNSUPPORTED; } return PciIoMemRW (Width, Count, 1, Address, 1, Buffer); }
tianocore/edk2
C++
Other
4,240
/* ioctl routine All routines effect the processor that they are executed on. Thus you must be running on the processor that you wish to change. */
static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
/* ioctl routine All routines effect the processor that they are executed on. Thus you must be running on the processor that you wish to change. */ static long perf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ long error_start; uint32_t raddr[4]; int error = 0; switch (cmd) { case PA_PERF_ON: perf_start_counters(); break; case PA_PERF_OFF: error_start = perf_stop_counters(raddr); if (error_start != 0) { printk(KERN_ERR "perf_off: perf_stop_counters = %ld\n", error_start); error = -EFAULT; break; } if (copy_to_user((void __user *)arg, raddr, sizeof (raddr)) != 0) { error = -EFAULT; break; } break; case PA_PERF_VERSION: error = put_user(PERF_VERSION, (int *)arg); break; default: error = -ENOTTY; } return error; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base XBARB peripheral address. param input XBARB input signal. param output XBARB output signal. */
void XBARB_SetSignalsConnection(XBARB_Type *base, xbar_input_signal_t input, xbar_output_signal_t output)
/* param base XBARB peripheral address. param input XBARB input signal. param output XBARB output signal. */ void XBARB_SetSignalsConnection(XBARB_Type *base, xbar_input_signal_t input, xbar_output_signal_t output)
{ XBARB_WR_SELx_SELx(base, (((uint16_t)input) & 0xFFU), (((uint16_t)output) & 0xFFU)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* PCD MSP Initialization This function configures the hardware resources used in this example. */
void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
/* PCD MSP Initialization This function configures the hardware resources used in this example. */ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hpcd->Instance==USB_OTG_FS) { LL_RCC_SetUSBClockSource(LL_RCC_USB_CLKSOURCE_HSI48); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF10_USB; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); __HAL_RCC_USB_CLK_ENABLE(); if(__HAL_RCC_PWR_IS_CLK_DISABLED()) { __HAL_RCC_PWR_CLK_ENABLE(); HAL_PWREx_EnableVddUSB(); __HAL_RCC_PWR_CLK_DISABLE(); } else { HAL_PWREx_EnableVddUSB(); } } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Find the child device on the hub's port. */
USB_DEVICE* UsbFindChild(IN USB_INTERFACE *HubIf, IN UINT8 Port)
/* Find the child device on the hub's port. */ USB_DEVICE* UsbFindChild(IN USB_INTERFACE *HubIf, IN UINT8 Port)
{ USB_DEVICE *Device; USB_BUS *Bus; UINTN Index; Bus = HubIf->Device->Bus; for (Index = 1; Index < Bus->MaxDevices; Index++) { Device = Bus->Devices[Index]; if ((Device != NULL) && (Device->ParentAddr == HubIf->Device->Address) && (Device->ParentPort == Port)) { return Device; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Note, this is called with pte lock held. */
static void sh5_flush_cache_page(void *args)
/* Note, this is called with pte lock held. */ static void sh5_flush_cache_page(void *args)
{ struct flusher_data *data = args; struct vm_area_struct *vma; unsigned long eaddr, pfn; vma = data->vma; eaddr = data->addr1; pfn = data->addr2; sh64_dcache_purge_phy_page(pfn << PAGE_SHIFT); if (vma->vm_flags & VM_EXEC) sh64_icache_inv_user_page(vma, eaddr); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Level graph. The levels go from 0 at the leaves to N_LEVELS at the root. The opt_state->levels array points to the first node of the level list, whose elements are linked with the 'link' field of the struct block. */
static void find_levels(opt_state_t *opt_state, struct icode *ic)
/* Level graph. The levels go from 0 at the leaves to N_LEVELS at the root. The opt_state->levels array points to the first node of the level list, whose elements are linked with the 'link' field of the struct block. */ static void find_levels(opt_state_t *opt_state, struct icode *ic)
{ memset((char *)opt_state->levels, 0, opt_state->n_blocks * sizeof(*opt_state->levels)); unMarkAll(ic); find_levels_r(opt_state, ic, ic->root); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set up a new emulator and add it to the list */
static int i2c_emul_init(const struct device *dev)
/* Set up a new emulator and add it to the list */ static int i2c_emul_init(const struct device *dev)
{ struct i2c_emul_data *data = dev->data; int rc; sys_slist_init(&data->emuls); rc = emul_init_for_bus(dev); data->config = (I2C_MODE_CONTROLLER | i2c_map_dt_bitrate(data->bitrate)); return rc; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* See if we've already got a device in the list. */
static struct dm_dev_internal* find_device(struct list_head *l, dev_t dev)
/* See if we've already got a device in the list. */ static struct dm_dev_internal* find_device(struct list_head *l, dev_t dev)
{ struct dm_dev_internal *dd; list_for_each_entry (dd, l, list) if (dd->dm_dev.bdev->bd_dev == dev) return dd; return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Adjust path: If you specify a default route and want to connect a target on the digipeater path but w/o having a special route set before, the path has to be truncated from your target on. */
static void ax25_adjust_path(ax25_address *addr, ax25_digi *digipeat)
/* Adjust path: If you specify a default route and want to connect a target on the digipeater path but w/o having a special route set before, the path has to be truncated from your target on. */ static void ax25_adjust_path(ax25_address *addr, ax25_digi *digipeat)
{ int k; for (k = 0; k < digipeat->ndigi; k++) { if (ax25cmp(addr, &digipeat->calls[k]) == 0) break; } digipeat->ndigi = k; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns zero in case of success and a negative error code in case of failure. */
static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, void *buf, int len, int used_ebs)
/* This function returns zero in case of success and a negative error code in case of failure. */ static int write_leb(struct ubi_device *ubi, struct ubi_volume *vol, int lnum, void *buf, int len, int used_ebs)
{ int err; if (vol->vol_type == UBI_DYNAMIC_VOLUME) { int l = ALIGN(len, ubi->min_io_size); memset(buf + len, 0xFF, l - len); len = ubi_calc_data_len(ubi, buf, l); if (len == 0) { dbg_msg("all %d bytes contain 0xFF - skip", len); return 0; } err = ubi_eba_write_leb(ubi, vol, lnum, buf, 0, len, UBI_UNKNOWN); } else { memset(buf + len, 0, vol->usable_leb_size - len); err = ubi_eba_write_leb_st(ubi, vol, lnum, buf, len, UBI_UNKNOWN, used_ebs); } return err; }
EmcraftSystems/u-boot
C++
Other
181
/* The peer socket should always be NULL (or else). When we call this function we are destroying the object and from then on nobody should refer to it. */
int inet_release(struct socket *sock)
/* The peer socket should always be NULL (or else). When we call this function we are destroying the object and from then on nobody should refer to it. */ int inet_release(struct socket *sock)
{ struct sock *sk = sock->sk; if (sk) { long timeout; ip_mc_drop_socket(sk); timeout = 0; if (sock_flag(sk, SOCK_LINGER) && !(current->flags & PF_EXITING)) timeout = sk->sk_lingertime; sock->sk = NULL; sk->sk_prot->close(sk, timeout); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ks_restore_cmd_reg - restore the command register from the cache and write to hardware register. @ks: The chip information */
static void ks_restore_cmd_reg(struct ks_net *ks)
/* ks_restore_cmd_reg - restore the command register from the cache and write to hardware register. @ks: The chip information */ static void ks_restore_cmd_reg(struct ks_net *ks)
{ ks->cmd_reg_cache = ks->cmd_reg_cache_int; iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: (transfer full): a new reference to the source object for the @res, or NULL if there is none. */
GObject* g_async_result_get_source_object(GAsyncResult *res)
/* Returns: (transfer full): a new reference to the source object for the @res, or NULL if there is none. */ GObject* g_async_result_get_source_object(GAsyncResult *res)
{ GAsyncResultIface *iface; g_return_val_if_fail (G_IS_ASYNC_RESULT (res), NULL); iface = G_ASYNC_RESULT_GET_IFACE (res); return (* iface->get_source_object) (res); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Handles an incoming ATT error response for the specified write-long-characteristic-value proc. */
static void ble_gattc_write_long_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Handles an incoming ATT error response for the specified write-long-characteristic-value proc. */ static void ble_gattc_write_long_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ ble_gattc_dbg_assert_proc_not_inserted(proc); if (proc->write_long.attr.offset > 0 && proc->write_long.attr.offset < OS_MBUF_PKTLEN(proc->write_long.attr.om)) { ble_att_clt_tx_exec_write(proc->conn_handle, BLE_ATT_EXEC_WRITE_F_CANCEL); } ble_gattc_write_long_cb(proc, status, att_handle); }
Nicholas3388/LuaNode
C++
Other
1,055
/* i5400_enable_error_reporting Turn on the memory reporting features of the hardware */
static void i5400_enable_error_reporting(struct mem_ctl_info *mci)
/* i5400_enable_error_reporting Turn on the memory reporting features of the hardware */ static void i5400_enable_error_reporting(struct mem_ctl_info *mci)
{ struct i5400_pvt *pvt; u32 fbd_error_mask; pvt = mci->pvt_info; pci_read_config_dword(pvt->branchmap_werrors, EMASK_FBD, &fbd_error_mask); fbd_error_mask &= ~(ENABLE_EMASK_ALL); pci_write_config_dword(pvt->branchmap_werrors, EMASK_FBD, fbd_error_mask); }
robutest/uclinux
C++
GPL-2.0
60
/* Deallocates a colormap that was previously allocated with fb_alloc_cmap(). */
void fb_dealloc_cmap(struct fb_cmap *cmap)
/* Deallocates a colormap that was previously allocated with fb_alloc_cmap(). */ void fb_dealloc_cmap(struct fb_cmap *cmap)
{ kfree(cmap->red); kfree(cmap->green); kfree(cmap->blue); kfree(cmap->transp); cmap->red = cmap->green = cmap->blue = cmap->transp = NULL; cmap->len = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* SYSCTRL IIR1 Bus&Function Clock Disable and Reset Assert. */
void LL_SYSCTRL_IIR1_ClkDisRstAssert(void)
/* SYSCTRL IIR1 Bus&Function Clock Disable and Reset Assert. */ void LL_SYSCTRL_IIR1_ClkDisRstAssert(void)
{ __LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL); __LL_SYSCTRL_IIR1BusClk_Dis(SYSCTRL); __LL_SYSCTRL_IIR1FunClk_Dis(SYSCTRL); __LL_SYSCTRL_IIR1SoftRst_Assert(SYSCTRL); __LL_SYSCTRL_Reg_Lock(SYSCTRL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* show the raw stack from the specified stack pointer */
void show_stack(struct task_struct *task, unsigned long *sp)
/* show the raw stack from the specified stack pointer */ void show_stack(struct task_struct *task, unsigned long *sp)
{ unsigned long *stack; int i; if (!sp) sp = (unsigned long *) &sp; stack = sp; printk(KERN_EMERG "Stack:"); for (i = 0; i < kstack_depth_to_print; i++) { if (((long) stack & (THREAD_SIZE - 1)) == 0) break; if ((i % 8) == 0) printk(KERN_EMERG " "); printk("%08lx ", *stack++); } show_trace(sp); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the specified DMA Tx Desc frame segment. */
void ETH_ConfigDmaTxDescFrameSegment(ETH_DMADescType *DMATxDesc, uint32_t DMATxDesc_FrameSegment)
/* Set the specified DMA Tx Desc frame segment. */ void ETH_ConfigDmaTxDescFrameSegment(ETH_DMADescType *DMATxDesc, uint32_t DMATxDesc_FrameSegment)
{ assert_param(IS_ETH_DMA_TX_DESC_SEGMENT(DMATxDesc_FrameSegment)); DMATxDesc->CtrlOrBufSize |= DMATxDesc_FrameSegment; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Abort processing of a JPEG decompression operation, but don't destroy the object itself. */
jpeg_abort_decompress(j_decompress_ptr cinfo)
/* Abort processing of a JPEG decompression operation, but don't destroy the object itself. */ jpeg_abort_decompress(j_decompress_ptr cinfo)
{ jpeg_abort((j_common_ptr)cinfo); }
nanoframework/nf-interpreter
C++
MIT License
293
/* Call holding a reference to mm. Takes mm->mmap_sem during call. */
void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
/* Call holding a reference to mm. Takes mm->mmap_sem during call. */ void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new)
{ struct vm_area_struct *vma; down_write(&mm->mmap_sem); for (vma = mm->mmap; vma; vma = vma->vm_next) mpol_rebind_policy(vma->vm_policy, new); up_write(&mm->mmap_sem); }
robutest/uclinux
C++
GPL-2.0
60
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; if(hadc->Instance==ADC2) { if(IS_ENGINEERING_BOOT_MODE()) { PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC; PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_PER; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { Error_Handler(); } } __HAL_RCC_ADC12_CLK_ENABLE(); __HAL_RCC_GPIOF_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_14; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; HAL_GPIO_Init(GPIOF, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ad7877_read/write are only used for initial setup and for sysfs controls. The main traffic is done using spi_async() in the interrupt handler. */
static int ad7877_read(struct spi_device *spi, u16 reg)
/* ad7877_read/write are only used for initial setup and for sysfs controls. The main traffic is done using spi_async() in the interrupt handler. */ static int ad7877_read(struct spi_device *spi, u16 reg)
{ struct ser_req *req; int status, ret; req = kzalloc(sizeof *req, GFP_KERNEL); if (!req) return -ENOMEM; spi_message_init(&req->msg); req->command = (u16) (AD7877_WRITEADD(AD7877_REG_CTRL1) | AD7877_READADD(reg)); req->xfer[0].tx_buf = &req->command; req->xfer[0].len = 2; req->xfer[1].rx_buf = &req->sample; req->xfer[1].len = 2; spi_message_add_tail(&req->xfer[0], &req->msg); spi_message_add_tail(&req->xfer[1], &req->msg); status = spi_sync(spi, &req->msg); ret = status ? : req->sample; kfree(req); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* vxge_hw_vpath_stats_enable - Enable vpath h/wstatistics. Enable the DMA vpath statistics. The function is to be called to re-enable the adapter to update stats into the host memory */
enum vxge_hw_status vxge_hw_vpath_stats_enable(struct __vxge_hw_vpath_handle *vp)
/* vxge_hw_vpath_stats_enable - Enable vpath h/wstatistics. Enable the DMA vpath statistics. The function is to be called to re-enable the adapter to update stats into the host memory */ enum vxge_hw_status vxge_hw_vpath_stats_enable(struct __vxge_hw_vpath_handle *vp)
{ enum vxge_hw_status status = VXGE_HW_OK; struct __vxge_hw_virtualpath *vpath; vpath = vp->vpath; if (vpath->vp_open == VXGE_HW_VP_NOT_OPEN) { status = VXGE_HW_ERR_VPATH_NOT_OPEN; goto exit; } memcpy(vpath->hw_stats_sav, vpath->hw_stats, sizeof(struct vxge_hw_vpath_stats_hw_info)); status = __vxge_hw_vpath_stats_get(vpath, vpath->hw_stats); exit: return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Initializes hal outputs class. This is called automatically by the enable function. It may be called any time the feature is enabled, but is typically not needed to be called by outside callers. */
inv_error_t inv_init_hal_outputs(void)
/* Initializes hal outputs class. This is called automatically by the enable function. It may be called any time the feature is enabled, but is typically not needed to be called by outside callers. */ inv_error_t inv_init_hal_outputs(void)
{ int i; memset(&hal_out, 0, sizeof(hal_out)); for (i=0; i<3; i++) { inv_init_biquad_filter(&hal_out.lp_filter[i], compass_low_pass_filter_coeff); } return INV_SUCCESS; }
Luos-io/luos_engine
C++
MIT License
496
/* Fills each init_struct member with its reset value. */
void EXTI_StructInit(EXTI_InitTypeDef *init_struct)
/* Fills each init_struct member with its reset value. */ void EXTI_StructInit(EXTI_InitTypeDef *init_struct)
{ init_struct->EXTI_Line = EXTI_LineNone; init_struct->EXTI_Mode = EXTI_Mode_Interrupt; init_struct->EXTI_Trigger = EXTI_Trigger_Falling; init_struct->EXTI_LineCmd = DISABLE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Multiplex group of pins to the given alternate function. Because AF0 is not used on the LM4F, passing 0 as the alt_func_num parameter will disable the alternate function of the given pins. */
void gpio_set_af(uint32_t gpioport, uint8_t alt_func_num, uint8_t gpios)
/* Multiplex group of pins to the given alternate function. Because AF0 is not used on the LM4F, passing 0 as the alt_func_num parameter will disable the alternate function of the given pins. */ void gpio_set_af(uint32_t gpioport, uint8_t alt_func_num, uint8_t gpios)
{ uint32_t pctl32; uint8_t pin_mask; int i; if (alt_func_num == 0) { GPIO_AFSEL(gpioport) &= ~gpios; return; } GPIO_AFSEL(gpioport) |= gpios; GPIO_DEN(gpioport) |= gpios; pctl32 = GPIO_PCTL(gpioport); for (i = 0; i < 8; i++) { pin_mask = (1 << i); if (!(gpios & pin_mask)) { continue; } pctl32 &= ~PCTL_MASK(i); pctl32 |= PCTL_AF(i, (alt_func_num & 0xf)); } GPIO_PCTL(gpioport) = pctl32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Returns success (0) or appropriate error code (none as of now) */
static void emac_set_type1addr(struct emac_priv *priv, rt_uint32_t ch, char *mac_addr)
/* Returns success (0) or appropriate error code (none as of now) */ static void emac_set_type1addr(struct emac_priv *priv, rt_uint32_t ch, char *mac_addr)
{ rt_uint32_t val; emac_write(EMAC_MACINDEX, ch); val = ((mac_addr[5] << 8) | mac_addr[4]); emac_write(EMAC_MACADDRLO, val); val = ((mac_addr[3] << 24) | (mac_addr[2] << 16) | \ (mac_addr[1] << 8) | (mac_addr[0])); emac_write(EMAC_MACADDRHI, val); emac_set_type0addr(priv, ch, mac_addr); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This code gets the pointer to the variable guid. */
EFI_GUID* GetVendorGuidPtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFlag)
/* This code gets the pointer to the variable guid. */ EFI_GUID* GetVendorGuidPtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFlag)
{ AUTHENTICATED_VARIABLE_HEADER *AuthVariable; AuthVariable = (AUTHENTICATED_VARIABLE_HEADER *)Variable; if (AuthFlag) { return &AuthVariable->VendorGuid; } else { return &Variable->VendorGuid; } }
tianocore/edk2
C++
Other
4,240
/* Set the display top left drawing limit. Use this function to set the top left limit of the drawing limit box. */
void hx8347a_set_top_left_limit(hx8347a_coord_t x, hx8347a_coord_t y)
/* Set the display top left drawing limit. Use this function to set the top left limit of the drawing limit box. */ void hx8347a_set_top_left_limit(hx8347a_coord_t x, hx8347a_coord_t y)
{ hx8347a_write_register(HX8347A_COLSTARTHIGH, (x >> 8)); hx8347a_write_register(HX8347A_COLSTARTLOW, (x & 0xff)); hx8347a_write_register(HX8347A_ROWSTARTHIGH, (y >> 8)); hx8347a_write_register(HX8347A_ROWSTARTLOW, (y & 0xff)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* FIFO handler for encoded data stream. All possible data sources are polled until either no source has more data or fifo is full. */
size_t handle_encoded_fifo(std::array< uint16_t, MODBUS_FIFO_LEN > &fifo)
/* FIFO handler for encoded data stream. All possible data sources are polled until either no source has more data or fifo is full. */ size_t handle_encoded_fifo(std::array< uint16_t, MODBUS_FIFO_LEN > &fifo)
{ encoded = false; pickup_accelerometer_sample(encoder, encoded); if (encoder.can_encode<LoadcellRecord>()) { LoadcellRecord sample; if (dwarf::loadcell::get_loadcell_sample(sample)) { if (encoder.encode(sample)) { encoded = true; } else { failed_to_encode(); } } } if (encoder.can_encode<LogData>()) { LogData log_fragment; log_fragment.fill(0); size_t num_log_bytes = bufflog_pickup(log_fragment.data(), log_fragment.size()); if (num_log_bytes) { if (encoder.encode(log_fragment)) { encoded = true; } else { failed_to_encode(); } } } } encoder.padd(); return encoder.position(); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* A callback from the upper layers for PIO-only tuning. */
static void via_set_pio_mode(ide_drive_t *drive, const u8 pio)
/* A callback from the upper layers for PIO-only tuning. */ static void via_set_pio_mode(ide_drive_t *drive, const u8 pio)
{ via_set_drive(drive, XFER_PIO_0 + pio); }
robutest/uclinux
C++
GPL-2.0
60
/* This function gets the content in fixed MTRRs */
MTRR_FIXED_SETTINGS* EFIAPI MtrrGetFixedMtrr(OUT MTRR_FIXED_SETTINGS *FixedSettings)
/* This function gets the content in fixed MTRRs */ MTRR_FIXED_SETTINGS* EFIAPI MtrrGetFixedMtrr(OUT MTRR_FIXED_SETTINGS *FixedSettings)
{ BOOLEAN FixedMtrrSupported; MtrrLibIsMtrrSupported (&FixedMtrrSupported, NULL); if (!FixedMtrrSupported) { return FixedSettings; } return MtrrGetFixedMtrrWorker (FixedSettings); }
tianocore/edk2
C++
Other
4,240
/* Gets the unique 64-bit ID assigned to this IC (useful for security purposes to detect if the flash was changed, etc.) */
void w25q16bvGetUniqueID(uint8_t *buffer)
/* Gets the unique 64-bit ID assigned to this IC (useful for security purposes to detect if the flash was changed, etc.) */ void w25q16bvGetUniqueID(uint8_t *buffer)
{ uint8_t i; W25Q16BV_SELECT(); w25q16bv_TransferByte(W25Q16BV_CMD_READUNIQUEID); w25q16bv_TransferByte(0xFF); w25q16bv_TransferByte(0xFF); w25q16bv_TransferByte(0xFF); w25q16bv_TransferByte(0xFF); for (i = 0; i < 8; i++) { buffer[i] = w25q16bv_TransferByte(0xFF); } W25Q16BV_DESELECT(); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Waits until the device can accept read and write user actions. */
int32_t ad7124_wait_for_spi_ready(struct ad7124_dev *dev, uint32_t timeout)
/* Waits until the device can accept read and write user actions. */ int32_t ad7124_wait_for_spi_ready(struct ad7124_dev *dev, uint32_t timeout)
{ struct ad7124_st_reg *regs; int32_t ret; int8_t ready = 0; if(!dev) return INVALID_VAL; regs = dev->regs; while(!ready && --timeout) { ret = ad7124_read_register(dev, &regs[AD7124_Error]); if(ret < 0) return ret; ready = (regs[AD7124_Error].value & AD7124_ERR_REG_SPI_IGNORE_ERR) == 0; } return timeout ? 0 : TIMEOUT; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* The below routines pc_throttle and pc_unthrottle are used to slow (And resume) the receipt of data into the kernels receive buffers. The exact occurrence of this depends on the size of the kernels receive buffer and what the 'watermarks' are set to for that buffer. See the n_ttys.c file for more details. */
static void pc_throttle(struct tty_struct *tty)
/* The below routines pc_throttle and pc_unthrottle are used to slow (And resume) the receipt of data into the kernels receive buffers. The exact occurrence of this depends on the size of the kernels receive buffer and what the 'watermarks' are set to for that buffer. See the n_ttys.c file for more details. */ static void pc_throttle(struct tty_struct *tty)
{ struct channel *ch; unsigned long flags; ch = verifyChannel(tty); if (ch != NULL) { spin_lock_irqsave(&epca_lock, flags); if ((ch->statusflags & RXSTOPPED) == 0) { globalwinon(ch); fepcmd(ch, PAUSERX, 0, 0, 0, 0); ch->statusflags |= RXSTOPPED; memoff(ch); } spin_unlock_irqrestore(&epca_lock, flags); } }
robutest/uclinux
C++
GPL-2.0
60
/* Executes actions of a transition of the station state machine. Returns 0 if all actions complete successfully, nonzero otherwise. */
static u16 llc_exec_station_trans_actions(struct llc_station_state_trans *trans, struct sk_buff *skb)
/* Executes actions of a transition of the station state machine. Returns 0 if all actions complete successfully, nonzero otherwise. */ static u16 llc_exec_station_trans_actions(struct llc_station_state_trans *trans, struct sk_buff *skb)
{ u16 rc = 0; llc_station_action_t *next_action = trans->ev_actions; for (; next_action && *next_action; next_action++) if ((*next_action)(skb)) rc = 1; return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Oversampling is only supported on the sample sequencers that are more than one sample in depth (that is, the fourth sample sequencer is not supported). Oversampling by 2x (for example) divides the depth of the sample sequencer by two; so 2x oversampling on the first sample sequencer can only provide four samples per trigger. This also means that 8x oversampling is only available on the first sample sequencer. */
void ADCSoftwareOversampleConfigure(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long ulFactor)
/* Oversampling is only supported on the sample sequencers that are more than one sample in depth (that is, the fourth sample sequencer is not supported). Oversampling by 2x (for example) divides the depth of the sample sequencer by two; so 2x oversampling on the first sample sequencer can only provide four samples per trigger. This also means that 8x oversampling is only available on the first sample sequencer. */ void ADCSoftwareOversampleConfigure(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long ulFactor)
{ unsigned long ulValue; ASSERT((ulBase == ADC0_BASE) || (ulBase == ADC1_BASE)); ASSERT(ulSequenceNum < 3); ASSERT(((ulFactor == 2) || (ulFactor == 4) || (ulFactor == 8)) && ((ulSequenceNum == 0) || (ulFactor != 8))); for(ulValue = 0, ulFactor >>= 1; ulFactor; ulValue++, ulFactor >>= 1) { } g_pucOversampleFactor[ulSequenceNum] = ulValue; }
watterott/WebRadio
C++
null
71
/* MSS_SPI_enable() See "mss_spi.h" for details of how to use this function. */
void MSS_SPI_enable(volatile mss_spi_instance_t *this_spi)
/* MSS_SPI_enable() See "mss_spi.h" for details of how to use this function. */ void MSS_SPI_enable(volatile mss_spi_instance_t *this_spi)
{ this_spi->hw_reg->CONTROL |= CTRL_ENABLE_MASK; }
EmcraftSystems/u-boot
C++
Other
181
/* RETURNS: ATA_DEFER_* if deferring is needed, 0 otherwise. */
int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc)
/* RETURNS: ATA_DEFER_* if deferring is needed, 0 otherwise. */ int sata_pmp_qc_defer_cmd_switch(struct ata_queued_cmd *qc)
{ struct ata_link *link = qc->dev->link; struct ata_port *ap = link->ap; if (ap->excl_link == NULL || ap->excl_link == link) { if (ap->nr_active_links == 0 || ata_link_active(link)) { qc->flags |= ATA_QCFLAG_CLEAR_EXCL; return ata_std_qc_defer(qc); } ap->excl_link = link; } return ATA_DEFER_PORT; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If a device with the specified vendor and product id is not found, NULL is returned. */
struct usb_device* usb_find_device(u16 vendor_id, u16 product_id)
/* If a device with the specified vendor and product id is not found, NULL is returned. */ struct usb_device* usb_find_device(u16 vendor_id, u16 product_id)
{ struct list_head *buslist; struct usb_bus *bus; struct usb_device *dev = NULL; mutex_lock(&usb_bus_list_lock); for (buslist = usb_bus_list.next; buslist != &usb_bus_list; buslist = buslist->next) { bus = container_of(buslist, struct usb_bus, bus_list); if (!bus->root_hub) continue; usb_lock_device(bus->root_hub); dev = match_device(bus->root_hub, vendor_id, product_id); usb_unlock_device(bus->root_hub); if (dev) goto exit; } exit: mutex_unlock(&usb_bus_list_lock); return dev; }
robutest/uclinux
C++
GPL-2.0
60
/* Dynamic device ID manipulation via sysfs is disabled for !CONFIG_HOTPLUG */
static int pci_create_newid_file(struct pci_driver *drv)
/* Dynamic device ID manipulation via sysfs is disabled for !CONFIG_HOTPLUG */ static int pci_create_newid_file(struct pci_driver *drv)
{ return 0; } static inline void pci_remove_newid_file(struct pci_driver *drv) {}
robutest/uclinux
C++
GPL-2.0
60
/* Sets the control parameters for a DMA channel. Choose the destination address increment from one of */
void PDMAChannelControlSet(unsigned long ulChannelID, unsigned long ulControl)
/* Sets the control parameters for a DMA channel. Choose the destination address increment from one of */ void PDMAChannelControlSet(unsigned long ulChannelID, unsigned long ulControl)
{ xASSERT(xDMAChannelIDValid(ulChannelID)); xHWREG(g_psDMAChannelAddress[ulChannelID] + PDMA_CSR) &= ~(PDMA_CSR_SDA_M | PDMA_CSR_DAD_M | PDMA_CSR_TWS_M); xHWREG(g_psDMAChannelAddress[ulChannelID] + PDMA_CSR) |= ulControl; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Reads 32-bit value from register at specified address */
unsigned long PRCMHIBRegRead(unsigned long ulRegAddr)
/* Reads 32-bit value from register at specified address */ unsigned long PRCMHIBRegRead(unsigned long ulRegAddr)
{ unsigned long ulValue; ulValue = HWREG(ulRegAddr); UtilsDelay((80*200)/3); return ulValue; }
micropython/micropython
C++
Other
18,334
/* This gets invoked by the IDE driver once for each channel. It performs channel-specific pre-initialization before drive probing. */
static void __devinit init_hwif_cs5530(ide_hwif_t *hwif)
/* This gets invoked by the IDE driver once for each channel. It performs channel-specific pre-initialization before drive probing. */ static void __devinit init_hwif_cs5530(ide_hwif_t *hwif)
{ unsigned long basereg; u32 d0_timings; basereg = CS5530_BASEREG(hwif); d0_timings = inl(basereg + 0); if (CS5530_BAD_PIO(d0_timings)) outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 0); if (CS5530_BAD_PIO(inl(basereg + 8))) outl(cs5530_pio_timings[(d0_timings >> 31) & 1][0], basereg + 8); }
robutest/uclinux
C++
GPL-2.0
60
/* This is called to remove the extended PCICC driver information if an AP device is removed. */
static void zcrypt_pcicc_remove(struct ap_device *ap_dev)
/* This is called to remove the extended PCICC driver information if an AP device is removed. */ static void zcrypt_pcicc_remove(struct ap_device *ap_dev)
{ struct zcrypt_device *zdev = ap_dev->private; zcrypt_device_unregister(zdev); }
robutest/uclinux
C++
GPL-2.0
60
/* Generate notification for 'Value V6' attribute, if notifications are enabled. */
void service_b_3_1_value_v6_notify(void)
/* Generate notification for 'Value V6' attribute, if notifications are enabled. */ void service_b_3_1_value_v6_notify(void)
{ if (!value_v6_ntf_active) return; bt_gatt_notify(NULL, &service_b_3_1_attrs[1], &value_v6_value, sizeof(value_v6_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 4096 bytes. */
int32_t FMC_Erase(uint32_t u32PageAddr)
/* Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 4096 bytes. */ int32_t FMC_Erase(uint32_t u32PageAddr)
{ int32_t ret = 0; if (u32PageAddr == FMC_SPROM_BASE) { ret = FMC_Erase_SPROM(); } if (ret == 0) { FMC->ISPCMD = FMC_ISPCMD_PAGE_ERASE; FMC->ISPADDR = u32PageAddr; FMC->ISPTRG = FMC_ISPTRG_ISPGO_Msk; while (FMC->ISPTRG & FMC_ISPTRG_ISPGO_Msk) { } if (FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk) { FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk; ret = -1; } } return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* NOTE! Unlike the user-mode sys_sigprocmask(), the kernel interface happily blocks "unblockable" signals like SIGKILL and friends. */
int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
/* NOTE! Unlike the user-mode sys_sigprocmask(), the kernel interface happily blocks "unblockable" signals like SIGKILL and friends. */ int sigprocmask(int how, sigset_t *set, sigset_t *oldset)
{ int error; spin_lock_irq(&current->sighand->siglock); if (oldset) *oldset = current->blocked; error = 0; switch (how) { case SIG_BLOCK: sigorsets(&current->blocked, &current->blocked, set); break; case SIG_UNBLOCK: signandsets(&current->blocked, &current->blocked, set); break; case SIG_SETMASK: current->blocked = *set; break; default: error = -EINVAL; } recalc_sigpending(); spin_unlock_irq(&current->sighand->siglock); return error; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configures the frequency the timer shall run at. param value The timer frequency in Hz. */
void gtimer_set_counter_frequency(rt_uint32_t value)
/* Configures the frequency the timer shall run at. param value The timer frequency in Hz. */ void gtimer_set_counter_frequency(rt_uint32_t value)
{ __set_cntfrq(value); __asm__ volatile ("isb 0xF":::"memory"); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */
int main(int argc, char *argv[])
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */ int main(int argc, char *argv[])
{ SDL_Scancode scancode; SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); if (SDL_Init(SDL_INIT_VIDEO) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); exit(1); } for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) { SDL_Log("Scancode #%d, \"%s\"\n", scancode, SDL_GetScancodeName(scancode)); } SDL_Quit(); return (0); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This is a wrapper function for freeing consistent dma-able Memory. In linux Kernel, it depends on pci dev structure */
void plat_free_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, void *addr, u32 dma_addr)
/* This is a wrapper function for freeing consistent dma-able Memory. In linux Kernel, it depends on pci dev structure */ void plat_free_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, void *addr, u32 dma_addr)
{ rt_free((void*)PHYS_TO_CACHED(UNCACHED_TO_PHYS(addr))); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the number of bytes in RX FIFO. This returns the number of bytes in RX FIFO which can be read. */
static int mcux_i3c_fifo_rx_count_get(I3C_Type *base)
/* Get the number of bytes in RX FIFO. This returns the number of bytes in RX FIFO which can be read. */ static int mcux_i3c_fifo_rx_count_get(I3C_Type *base)
{ uint32_t mdatactrl = base->MDATACTRL; return (int)((mdatactrl & I3C_MDATACTRL_RXCOUNT_MASK) >> I3C_MDATACTRL_RXCOUNT_SHIFT); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function performs the CSHAKE-256 message digest of a given data buffer, and places the digest value into the specified memory. */
BOOLEAN EFIAPI CShake256HashAll(IN CONST VOID *Data, IN UINTN DataSize, IN UINTN OutputLen, IN CONST VOID *Name, IN UINTN NameLen, IN CONST VOID *Customization, IN UINTN CustomizationLen, OUT UINT8 *HashValue)
/* This function performs the CSHAKE-256 message digest of a given data buffer, and places the digest value into the specified memory. */ BOOLEAN EFIAPI CShake256HashAll(IN CONST VOID *Data, IN UINTN DataSize, IN UINTN OutputLen, IN CONST VOID *Name, IN UINTN NameLen, IN CONST VOID *Customization, IN UINTN CustomizationLen, OUT UINT8 *HashValue)
{ BOOLEAN Status; Keccak1600_Ctx Ctx; if (HashValue == NULL) { return FALSE; } if ((Data == NULL) && (DataSize != 0)) { return FALSE; } Status = CShake256Init (&Ctx, OutputLen, Name, NameLen, Customization, CustomizationLen); if (!Status) { return FALSE; } Status = CShake256Update (&Ctx, Data, DataSize); if (!Status) { return FALSE; } return CShake256Final (&Ctx, HashValue); }
tianocore/edk2
C++
Other
4,240
/* Registers a callback. Registers and enable a callback function which is implemented by the user. */
void aon_sleep_timer_register_callback(aon_sleep_timer_callback_t fun)
/* Registers a callback. Registers and enable a callback function which is implemented by the user. */ void aon_sleep_timer_register_callback(aon_sleep_timer_callback_t fun)
{ aon_sleep_timer_callback = fun; }
memfault/zero-to-main
C++
null
200
/* Determine if U-Boot should keep secondary cores in reset, or let them out of reset and hold them in a spinloop */
int hold_cores_in_reset(int verbose)
/* Determine if U-Boot should keep secondary cores in reset, or let them out of reset and hold them in a spinloop */ int hold_cores_in_reset(int verbose)
{ if (env_get_yesno("mp_holdoff") == 1) { if (verbose) { puts("Secondary cores are being held in reset.\n"); puts("See 'mp_holdoff' environment variable\n"); } return 1; } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137