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
/* Starting is done in two stages to allow the application time to configure the event queue to use after system initialization but before the host starts. */
static void ble_hs_event_start_stage2(struct ble_npl_event *ev)
/* Starting is done in two stages to allow the application time to configure the event queue to use after system initialization but before the host starts. */ static void ble_hs_event_start_stage2(struct ble_npl_event *ev)
{ int rc; rc = ble_hs_start(); assert(rc == 0); }
Nicholas3388/LuaNode
C++
Other
1,055
/* For the synchronous version of this function, see g_file_output_stream_query_info(). */
void g_file_output_stream_query_info_async(GFileOutputStream *stream, const char *attributes, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* For the synchronous version of this function, see g_file_output_stream_query_info(). */ void g_file_output_stream_query_info_async(GFileOutputStream *stream, const char *attributes, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ GFileOutputStreamClass *klass; GOutputStream *output_stream; GError *error = NULL; g_return_if_fail (G_IS_FILE_OUTPUT_STREAM (stream)); output_stream = G_OUTPUT_STREAM (stream); if (!g_output_stream_set_pending (output_stream, &error)) { g_task_report_error (stream, callback, user_data, g_file_output_stream_query_info_async, error); return; } klass = G_FILE_OUTPUT_STREAM_GET_CLASS (stream); stream->priv->outstanding_callback = callback; g_object_ref (stream); klass->query_info_async (stream, attributes, io_priority, cancellable, async_ready_callback_wrapper, user_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Change Logs: Date Author Notes GuEe-GUI the first version fangjianzhou support SDL2 */
rt_inline void _virtio_dev_check(struct virtio_device *dev)
/* Change Logs: Date Author Notes GuEe-GUI the first version fangjianzhou support SDL2 */ rt_inline void _virtio_dev_check(struct virtio_device *dev)
{ RT_ASSERT(dev != RT_NULL); RT_ASSERT(dev->mmio_config != RT_NULL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the HCD hasn't registered a disable() function, this sets the endpoint's maxpacket size to 0 to prevent further submissions. */
void usb_disable_endpoint(struct usb_host_virt_dev *dev, unsigned int epaddr)
/* If the HCD hasn't registered a disable() function, this sets the endpoint's maxpacket size to 0 to prevent further submissions. */ void usb_disable_endpoint(struct usb_host_virt_dev *dev, unsigned int epaddr)
{ unsigned int epnum = epaddr & USB_ENDPOINT_NUMBER_MASK; struct usb_host_virt_endpoint *ep; if (!dev) { hal_log_err("PANIC : usb disable ep: input dev == NULL"); return; } if (usb_endpoint_out(epaddr)) { ep = dev->ep_out[epnum]; dev->ep_out[epnum] = NULL; } else { ep = dev->ep_in[epnum]; dev->ep_in[epnum] = NULL; } if (ep == NULL) { __wrn("WARNING : usb disable ep: ep == NULL"); return; } hcd_ops_endpoint_disable(dev, ep); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is used directly or indirectly to implement gpio_set_value(). It invokes the associated gpio_chip.set() method. */
void __gpio_set_value(unsigned gpio, int value)
/* This is used directly or indirectly to implement gpio_set_value(). It invokes the associated gpio_chip.set() method. */ void __gpio_set_value(unsigned gpio, int value)
{ struct gpio_chip *chip; chip = gpio_to_chip(gpio); WARN_ON(extra_checks && chip->can_sleep); chip->set(chip, gpio - chip->base, value); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will move memory content from source address to destination address. If the destination memory does not overlap with the source memory, the function is the same as memcpy(). */
void* rt_memmove(void *dest, const void *src, rt_size_t n)
/* This function will move memory content from source address to destination address. If the destination memory does not overlap with the source memory, the function is the same as memcpy(). */ void* rt_memmove(void *dest, const void *src, rt_size_t n)
{ char *tmp = (char *)dest, *s = (char *)src; if (s < tmp && tmp < s + n) { tmp += n; s += n; while (n--) *(--tmp) = *(--s); } else { while (n--) *tmp++ = *s++; } return dest; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnToUint8(IN UINTN Operand, OUT UINT8 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUintnToUint8(IN UINTN Operand, OUT UINT8 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand <= MAX_UINT8) { *Result = (UINT8)Operand; Status = RETURN_SUCCESS; } else { *Result = UINT8_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* kobject_get - increment refcount for object. @kobj: object. */
struct kobject* kobject_get(struct kobject *kobj)
/* kobject_get - increment refcount for object. @kobj: object. */ struct kobject* kobject_get(struct kobject *kobj)
{ if (kobj) kref_get(&kobj->kref); return kobj; }
robutest/uclinux
C++
GPL-2.0
60
/* @rc: radio controller for the devices. @function: function to call. @priv: data to pass to @function. */
int uwb_dev_for_each(struct uwb_rc *rc, uwb_dev_for_each_f function, void *priv)
/* @rc: radio controller for the devices. @function: function to call. @priv: data to pass to @function. */ int uwb_dev_for_each(struct uwb_rc *rc, uwb_dev_for_each_f function, void *priv)
{ return device_for_each_child(&rc->uwb_dev.dev, priv, function); }
robutest/uclinux
C++
GPL-2.0
60
/* update the playback position and call snd_pcm_period_elapsed() if necessary called from interrupt handler */
static void vx_pcm_playback_update(struct vx_core *chip, struct snd_pcm_substream *subs, struct vx_pipe *pipe)
/* update the playback position and call snd_pcm_period_elapsed() if necessary called from interrupt handler */ static void vx_pcm_playback_update(struct vx_core *chip, struct snd_pcm_substream *subs, struct vx_pipe *pipe)
{ int err; struct snd_pcm_runtime *runtime = subs->runtime; if (pipe->running && ! (chip->chip_status & VX_STAT_IS_STALE)) { if ((err = vx_update_pipe_position(chip, runtime, pipe)) < 0) return; if (pipe->transferred >= (int)runtime->period_size) { pipe->transferred %= runtime->period_size; snd_pcm_period_elapsed(subs); } } }
robutest/uclinux
C++
GPL-2.0
60
/* Locking Note: The lport lock is expected to be held before calling this routine. */
static void fc_lport_enter_dns(struct fc_lport *)
/* Locking Note: The lport lock is expected to be held before calling this routine. */ static void fc_lport_enter_dns(struct fc_lport *)
{ struct fc_rport_priv *rdata; FC_LPORT_DBG(lport, "Entered DNS state from %s state\n", fc_lport_state(lport)); fc_lport_state_enter(lport, LPORT_ST_DNS); mutex_lock(&lport->disc.disc_mutex); rdata = lport->tt.rport_create(lport, FC_FID_DIR_SERV); mutex_unlock(&lport->disc.disc_mutex); if (!rdata) goto err; rdata->ops = &fc_lport_rport_ops; lport->tt.rport_login(rdata); return; err: fc_lport_error(lport, NULL); }
robutest/uclinux
C++
GPL-2.0
60
/* Each I2O controller has a chain of devices on it - these match the useful parts of the LCT of the board. */
static int adpt_i2o_install_device(adpt_hba *pHba, struct i2o_device *d)
/* Each I2O controller has a chain of devices on it - these match the useful parts of the LCT of the board. */ static int adpt_i2o_install_device(adpt_hba *pHba, struct i2o_device *d)
{ mutex_lock(&adpt_configuration_lock); d->controller=pHba; d->owner=NULL; d->next=pHba->devices; d->prev=NULL; if (pHba->devices != NULL){ pHba->devices->prev=d; } pHba->devices=d; *d->dev_name = 0; mutex_unlock(&adpt_configuration_lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3PciSegmentBitFieldWrite32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 EFIAPI S3PciSegmentBitFieldWrite32(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
{ return InternalSavePciSegmentWrite32ValueToBootScript (Address, PciSegmentBitFieldWrite32 (Address, StartBit, EndBit, Value)); }
tianocore/edk2
C++
Other
4,240
/* Get the offset to the state for a specific hash function within the context structure. This shall be called only for the supported hash functions, */
static size_t get_state_offset(int id)
/* Get the offset to the state for a specific hash function within the context structure. This shall be called only for the supported hash functions, */ static size_t get_state_offset(int id)
{ if (id >= 5) { return offsetof(br_multihash_context, val_64) + ((size_t)(id - 5) * (8 * sizeof(uint64_t))); } else { unsigned x; x = id - 1; x = ((x + (x & (x >> 1))) << 2) + (x >> 1); return offsetof(br_multihash_context, val_32) + x * sizeof(uint32_t); } }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* This function returns after the IPI has been accepted by the target processor. */
VOID EFIAPI SendInitIpi(IN UINT32 ApicId)
/* This function returns after the IPI has been accepted by the target processor. */ VOID EFIAPI SendInitIpi(IN UINT32 ApicId)
{ LOCAL_APIC_ICR_LOW IcrLow; IcrLow.Uint32 = 0; IcrLow.Bits.DeliveryMode = LOCAL_APIC_DELIVERY_MODE_INIT; IcrLow.Bits.Level = 1; SendIpi (IcrLow.Uint32, ApicId); }
tianocore/edk2
C++
Other
4,240
/* this routine will get a word off of the processes privileged stack. the offset is how far from the base addr as stored in the THREAD. this routine assumes that all the privileged stacks are in our data space. */
static long get_user_reg(struct task_struct *task, int offset)
/* this routine will get a word off of the processes privileged stack. the offset is how far from the base addr as stored in the THREAD. this routine assumes that all the privileged stacks are in our data space. */ static long get_user_reg(struct task_struct *task, int offset)
{ return task_pt_regs(task)->uregs[offset]; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* tlsv1_client_established - Check whether connection has been established @conn: TLSv1 client connection data from tlsv1_client_init() Returns: 1 if connection is established, 0 if not */
int tlsv1_client_established(struct tlsv1_client *conn)
/* tlsv1_client_established - Check whether connection has been established @conn: TLSv1 client connection data from tlsv1_client_init() Returns: 1 if connection is established, 0 if not */ int tlsv1_client_established(struct tlsv1_client *conn)
{ return conn->state == ESTABLISHED; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Specifies the condition of compare value buffer transmission. */
void TMRA_SetCompareBufCond(CM_TMRA_TypeDef *TMRAx, uint32_t u32Ch, uint16_t u16Cond)
/* Specifies the condition of compare value buffer transmission. */ void TMRA_SetCompareBufCond(CM_TMRA_TypeDef *TMRAx, uint32_t u32Ch, uint16_t u16Cond)
{ uint32_t u32BCONRAddr; DDL_ASSERT(IS_TMRA_UNIT(TMRAx)); DDL_ASSERT(IS_TMRA_CMPVAL_BUF_CH(u32Ch)); DDL_ASSERT(IS_TMRA_BUF_TRANS_COND(u16Cond)); u32BCONRAddr = (uint32_t)&TMRAx->BCONR1 + u32Ch * 4U; MODIFY_REG16(RW_MEM16(u32BCONRAddr), TMRA_BUF_TRANS_COND_PEAK_VALLEY, u16Cond); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable or disable write protect of DACC registers. */
void dacc_set_writeprotect(Dacc *p_dacc, uint32_t ul_enable)
/* Enable or disable write protect of DACC registers. */ void dacc_set_writeprotect(Dacc *p_dacc, uint32_t ul_enable)
{ if (ul_enable) { p_dacc->DACC_WPMR = DACC_WPMR_WPKEY_PASSWD | DACC_WPMR_WPEN; } else { p_dacc->DACC_WPMR = DACC_WPMR_WPKEY_PASSWD; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Forces the TIMx output 2 waveform to active or inactive level. */
void TIM_ForcedOC2Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
/* Forces the TIMx output 2 waveform to active or inactive level. */ void TIM_ForcedOC2Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction)
{ uint16_t tmpccmr1 = 0; assert_param(IS_TIM_LIST2_PERIPH(TIMx)); assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= (uint16_t)~TIM_CCMR1_OC2M; tmpccmr1 |= (uint16_t)(TIM_ForcedAction << 8); TIMx->CCMR1 = tmpccmr1; }
MaJerle/stm32f429
C++
null
2,036
/* I2C MSP Initialization This function configures the hardware resources used in this example: */
void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
/* I2C MSP Initialization This function configures the hardware resources used in this example: */ void HAL_I2C_MspInit(I2C_HandleTypeDef *hi2c)
{ GPIO_InitTypeDef GPIO_InitStruct; I2Cx_SCL_GPIO_CLK_ENABLE(); I2Cx_SDA_GPIO_CLK_ENABLE(); GPIO_InitStruct.Pin = I2Cx_SCL_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; GPIO_InitStruct.Alternate = I2Cx_SCL_AF; HAL_GPIO_Init(I2Cx_SCL_GPIO_PORT, &GPIO_InitStruct); GPIO_InitStruct.Pin = I2Cx_SDA_PIN; GPIO_InitStruct.Alternate = I2Cx_SDA_AF; HAL_GPIO_Init(I2Cx_SDA_GPIO_PORT, &GPIO_InitStruct); I2Cx_CLK_ENABLE(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function is used to skip ISA aliasing aperture. */
VOID SkipIsaAliasAperture(OUT UINT64 *Start, IN UINT64 Length)
/* This function is used to skip ISA aliasing aperture. */ VOID SkipIsaAliasAperture(OUT UINT64 *Start, IN UINT64 Length)
{ UINT64 Original; UINT64 Mask; UINT64 StartOffset; UINT64 LimitOffset; ASSERT (Start != NULL); Mask = 0x3FF; Original = *Start; StartOffset = Original & Mask; LimitOffset = ((*Start) + Length - 1) & Mask; if (LimitOffset >= ISABASE) { *Start = *Start - StartOffset + ISALIMIT + 1; } }
tianocore/edk2
C++
Other
4,240
/* Return the current memory clock frequency in units of 10kHz */
unsigned int pxa25x_get_memclk_frequency_10khz(void)
/* Return the current memory clock frequency in units of 10kHz */ unsigned int pxa25x_get_memclk_frequency_10khz(void)
{ return L_clk_mult[(CCCR >> 0) & 0x1f] * BASE_CLK / 10000; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function for handling read response events. This function will validate the read response and raise the appropriate event to the application. */
static void on_read_rsp(ble_bas_c_t *p_bas_c, const ble_evt_t *p_ble_evt)
/* Function for handling read response events. This function will validate the read response and raise the appropriate event to the application. */ static void on_read_rsp(ble_bas_c_t *p_bas_c, const ble_evt_t *p_ble_evt)
{ const ble_gattc_evt_read_rsp_t * p_response; if (p_bas_c->conn_handle != p_ble_evt->evt.gattc_evt.conn_handle) { return; } p_response = &p_ble_evt->evt.gattc_evt.params.read_rsp; if (p_response->handle == p_bas_c->peer_bas_db.bl_handle) { ble_bas_c_evt_t evt; evt.conn_handle = p_ble_evt->evt.gattc_evt.conn_handle; evt.evt_type = BLE_BAS_C_EVT_BATT_READ_RESP; evt.params.battery_level = p_response->data[0]; p_bas_c->evt_handler(p_bas_c, &evt); } tx_buffer_process(); }
labapart/polymcu
C++
null
201
/* Allocate a new board structure. Fill out the basic info in it. */
static struct stlibrd * stli_allocbrd(void)
/* Allocate a new board structure. Fill out the basic info in it. */ static struct stlibrd * stli_allocbrd(void)
{ struct stlibrd *brdp; brdp = kzalloc(sizeof(struct stlibrd), GFP_KERNEL); if (!brdp) { printk(KERN_ERR "istallion: failed to allocate memory " "(size=%Zd)\n", sizeof(struct stlibrd)); return NULL; } brdp->magic = STLI_BOARDMAGIC; return brdp; }
robutest/uclinux
C++
GPL-2.0
60
/* Disable interrupt mode for the selected IO pin(s). */
void mfxstm32l152_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin)
/* Disable interrupt mode for the selected IO pin(s). */ void mfxstm32l152_IO_DisablePinIT(uint16_t DeviceAddr, uint32_t IO_Pin)
{ mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_SRC1, IO_Pin, 0); }
eclipse-threadx/getting-started
C++
Other
310
/* Callback to notify the a transmission is completed. */
void PHY_TxCompleted(uint8_t PortNum)
/* Callback to notify the a transmission is completed. */ void PHY_TxCompleted(uint8_t PortNum)
{ PHY_Ports[PortNum].State = PHY_StateNone; if (PHY_Ports[PortNum].cbs->USBPD_PHY_TxCompleted) { PHY_Ports[PortNum].cbs->USBPD_PHY_TxCompleted(PortNum); } }
st-one/X-CUBE-USB-PD
C++
null
110
/* Apply and load a particular output delay for the DQ pins in a group. */
static void scc_mgr_apply_group_dq_out1_delay(struct socfpga_sdrseq *seq, const u32 delay)
/* Apply and load a particular output delay for the DQ pins in a group. */ static void scc_mgr_apply_group_dq_out1_delay(struct socfpga_sdrseq *seq, const u32 delay)
{ int i; for (i = 0; i < seq->rwcfg->mem_dq_per_write_dqs; i++) { scc_mgr_set_dq_out1_delay(i, delay); scc_mgr_load_dq(i); } }
4ms/stm32mp1-baremetal
C++
Other
137
/* Put a string into the print buffer. This function puts a string into the print buffer, taking care to not exceed the buffer's free space. If the buffer becomes full, this function will start the UART and wait for enough space to free up until the entire string has been put into buffer. */
static void _dbg_putstr(const char *str, size_t length)
/* Put a string into the print buffer. This function puts a string into the print buffer, taking care to not exceed the buffer's free space. If the buffer becomes full, this function will start the UART and wait for enough space to free up until the entire string has been put into buffer. */ static void _dbg_putstr(const char *str, size_t length)
{ dbg_buffer_space_t write_length; _dbg_stop_uart(); write_length = _dbg_get_free_buffer_space(); if (write_length) { write_length = min(write_length, length); _dbg_write_str_to_buffer(str, write_length); length -= write_length; str += write_length; } write_length = _dbg_request_free_space(length); _dbg_start_uart(); while (length) { _dbg_wait_for_requested_space(); _dbg_stop_uart(); _dbg_write_str_to_buffer(str, write_length); length -= write_length; str += write_length; write_length = _dbg_request_free_space(length); _dbg_start_uart(); } }
memfault/zero-to-main
C++
null
200
/* Checks whether the specified HASH flag is set or not. */
FlagStatus HASH_GetFlagStatus(uint32_t HASH_FLAG)
/* Checks whether the specified HASH flag is set or not. */ FlagStatus HASH_GetFlagStatus(uint32_t HASH_FLAG)
{ FlagStatus bitstatus = RESET; uint32_t tempreg = 0; assert_param(IS_HASH_GET_FLAG(HASH_FLAG)); if ((HASH_FLAG & HASH_FLAG_DINNE) != (uint32_t)RESET ) { tempreg = HASH->CR; } else { tempreg = HASH->SR; } if ((tempreg & HASH_FLAG) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
MaJerle/stm32f429
C++
null
2,036
/* The callback function that is assigned to both the periodic timer and the ARP timer. */
static void prvUIPTimerCallback(xTimerHandle xTimer)
/* The callback function that is assigned to both the periodic timer and the ARP timer. */ static void prvUIPTimerCallback(xTimerHandle xTimer)
{ static const unsigned long ulARPTimerExpired = uipARP_TIMER_EVENT; static const unsigned long ulPeriodicTimerExpired = uipPERIODIC_TIMER_EVENT; switch( ( int ) pvTimerGetTimerID( xTimer ) ) { case uipARP_TIMER : xQueueSend( xEMACEventQueue, &ulARPTimerExpired, uipDONT_BLOCK ); break; case uipPERIODIC_TIMER : xQueueSend( xEMACEventQueue, &ulPeriodicTimerExpired, uipDONT_BLOCK ); break; default : break; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Change IP address configuration for a network interface (including netmask and default gateway). */
void netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw)
/* Change IP address configuration for a network interface (including netmask and default gateway). */ void netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, ip_addr_t *gw)
{ netif_set_ipaddr(netif, ipaddr); netif_set_netmask(netif, netmask); netif_set_gw(netif, gw); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Sets the configuration of DMA for LPC channels. */
void LPCChannelDMAConfigSet(unsigned long ulBase, unsigned long ulConfig, unsigned long ulMask)
/* Sets the configuration of DMA for LPC channels. */ void LPCChannelDMAConfigSet(unsigned long ulBase, unsigned long ulConfig, unsigned long ulMask)
{ unsigned long ulTemp; ASSERT(ulBase == LPC0_BASE); ASSERT((ulConfig & ~0x000000FF) == 0); ASSERT((ulConfig & 0x00000003) != 0x00000003); ASSERT((ulConfig & 0x0000000C) != 0x0000000C); ASSERT((ulConfig & 0x00000030) != 0x00000030); ASSERT((ulConfig & 0x000000C0) != 0x000000C0); ASSERT((ulMask & ~0x000000FF) == 0); ulTemp = HWREG(ulBase + LPC_O_DMACX); ulTemp &= ~ulMask; ulTemp |= (ulConfig & ulMask); HWREG(ulBase + LPC_O_DMACX) = ulTemp; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns a pointer to the pnode on success or a negative error code on failure. */
struct ubifs_pnode* ubifs_get_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
/* This function returns a pointer to the pnode on success or a negative error code on failure. */ struct ubifs_pnode* ubifs_get_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
{ struct ubifs_nbranch *branch; struct ubifs_pnode *pnode; int err; branch = &parent->nbranch[iip]; pnode = branch->pnode; if (pnode) return pnode; err = read_pnode(c, parent, iip); if (err) return ERR_PTR(err); update_cats(c, branch->pnode); return branch->pnode; }
EmcraftSystems/u-boot
C++
Other
181
/* Program a 64bits word to FLASH. Program a 64bit word to FLASH memory. Flash programing error must be checked and cleared if needed before starting programming. */
void flash_program_double_word(uint32_t address, uint64_t data)
/* Program a 64bits word to FLASH. Program a 64bit word to FLASH memory. Flash programing error must be checked and cleared if needed before starting programming. */ void flash_program_double_word(uint32_t address, uint64_t data)
{ flash_wait_for_last_operation(); FLASH_CR |= FLASH_CR_PG; MMIO32(address) = (uint32_t)data; MMIO32(address+4) = (uint32_t)(data >> 32); flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_PG; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* clear the specified DAC0 flag(DAC0 DMA underrun flag) */
void dac0_flag_clear(void)
/* clear the specified DAC0 flag(DAC0 DMA underrun flag) */ void dac0_flag_clear(void)
{ DAC_STAT &= ~DAC_STAT_DDUDR0; }
liuxuming/trochili
C++
Apache License 2.0
132
/* Returns: the @queue that was passed in (since 2.6) */
GAsyncQueue* g_async_queue_ref(GAsyncQueue *queue)
/* Returns: the @queue that was passed in (since 2.6) */ GAsyncQueue* g_async_queue_ref(GAsyncQueue *queue)
{ g_return_val_if_fail (queue, NULL); g_atomic_int_inc (&queue->ref_count); return queue; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Disable the IOS in the power control block. This function disables the IOS module in the power control block. */
void am_hal_ios_pwrctrl_disable(void)
/* Disable the IOS in the power control block. This function disables the IOS module in the power control block. */ void am_hal_ios_pwrctrl_disable(void)
{ am_hal_pwrctrl_periph_disable(AM_HAL_PWRCTRL_IOS); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Find occurrence of mem (with length mem_len) in pbuf p, starting at offset start_offset. */
u16_t pbuf_memfind(const struct pbuf *p, const void *mem, u16_t mem_len, u16_t start_offset)
/* Find occurrence of mem (with length mem_len) in pbuf p, starting at offset start_offset. */ u16_t pbuf_memfind(const struct pbuf *p, const void *mem, u16_t mem_len, u16_t start_offset)
{ u16_t i; u16_t max = p->tot_len - mem_len; if (p->tot_len >= mem_len + start_offset) { for (i = start_offset; i <= max; i++) { u16_t plus = pbuf_memcmp(p, i, mem, mem_len); if (plus == 0) { return i; } } } return 0xFFFF; }
Nicholas3388/LuaNode
C++
Other
1,055
/* This function must guarantee that all I/O read and write operations are serialized. If such operations are not supported, then ASSERT(). */
VOID EFIAPI IoReadFifoWorker(IN UINTN Port, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINTN Count, IN VOID *Buffer)
/* This function must guarantee that all I/O read and write operations are serialized. If such operations are not supported, then ASSERT(). */ VOID EFIAPI IoReadFifoWorker(IN UINTN Port, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINTN Count, IN VOID *Buffer)
{ EFI_STATUS Status; Status = mCpuIo->Io.Read (mCpuIo, Width, Port, Count, Buffer); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* This function returns %0 on success and a negative error code on failure. */
int ubifs_clean_lebs(struct ubifs_info *c, void *sbuf)
/* This function returns %0 on success and a negative error code on failure. */ int ubifs_clean_lebs(struct ubifs_info *c, void *sbuf)
{ dbg_rcvry("recovery"); while (!list_empty(&c->unclean_leb_list)) { struct ubifs_unclean_leb *ucleb; int err; ucleb = list_entry(c->unclean_leb_list.next, struct ubifs_unclean_leb, list); err = clean_an_unclean_leb(c, ucleb, sbuf); if (err) return err; list_del(&ucleb->list); kfree(ucleb); } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Set the specified timestamp in seconds to RTC. */
void rtc_write(time_t t)
/* Set the specified timestamp in seconds to RTC. */ void rtc_write(time_t t)
{ struct tm *timeinfo = localtime(&t); RTC_TimeTypeDef RTC_TimeStruct; RTC_TimeStruct.RTC_H12_PMAM = RTC_H12_AM; RTC_TimeStruct.RTC_Days = timeinfo->tm_yday; RTC_TimeStruct.RTC_Hours = timeinfo->tm_hour; RTC_TimeStruct.RTC_Minutes = timeinfo->tm_min; RTC_TimeStruct.RTC_Seconds = timeinfo->tm_sec; RTC_SetTime(RTC_Format_BIN, &RTC_TimeStruct); _memcpy((void*)&rtc_timeinfo, (void*)timeinfo, sizeof(struct tm)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Binary search the DhcpOptionFormats array to find the format information about a specific option. */
DHCP_OPTION_FORMAT* DhcpFindOptionFormat(IN UINT8 Tag)
/* Binary search the DhcpOptionFormats array to find the format information about a specific option. */ DHCP_OPTION_FORMAT* DhcpFindOptionFormat(IN UINT8 Tag)
{ INTN Left; INTN Right; INTN Middle; Left = 0; Right = sizeof (DhcpOptionFormats) / sizeof (DHCP_OPTION_FORMAT) - 1; while (Right >= Left) { Middle = (Left + Right) / 2; if (Tag == DhcpOptionFormats[Middle].Tag) { return &DhcpOptionFormats[Middle]; } if (Tag < DhcpOptionFormats[Middle].Tag) { Right = Middle - 1; } else { Left = Middle + 1; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10); HAL_NVIC_DisableIRQ(USART1_IRQn); } else if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3); } else if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_10|GPIO_PIN_11); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return FALSE to indicate this interface is not supported. */
BOOLEAN EFIAPI RandomBytesUsingArray(OUT UINT8 *Output, IN UINTN Size)
/* Return FALSE to indicate this interface is not supported. */ BOOLEAN EFIAPI RandomBytesUsingArray(OUT UINT8 *Output, IN UINTN Size)
{ UINTN Index; for (Index = 0; Index < Size; Index++) { if (mNumberIndex >= mNumberCount) { mNumberIndex = 0; } Output[Index] = mNumbers[mNumberIndex]; mNumberIndex++; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Enable the internal oscillator. Clears the IOSCDIS bit in SYSCTL_RCC, enabling the internal oscillator. */
void rcc_enable_interal_osc(void)
/* Enable the internal oscillator. Clears the IOSCDIS bit in SYSCTL_RCC, enabling the internal oscillator. */ void rcc_enable_interal_osc(void)
{ SYSCTL_RCC &= ~SYSCTL_RCC_IOSCDIS; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Handle TX transaction on non-ISO endpoint. The ep argument is a physical endpoint number for a non-ISO IN endpoint in the range 16 to 30. */
static void spear_udc_epn_tx(int ep)
/* Handle TX transaction on non-ISO endpoint. The ep argument is a physical endpoint number for a non-ISO IN endpoint in the range 16 to 30. */ static void spear_udc_epn_tx(int ep)
{ struct usb_endpoint_instance *endpoint = spear_find_ep(ep); if (endpoint && endpoint->tx_urb && endpoint->tx_urb->actual_length) { if (endpoint->last == endpoint->tx_packetSize) { writel(0x0, &inep_regs_p[ep].write_done); } usbd_tx_complete(endpoint); if (endpoint->tx_urb && endpoint->tx_urb->actual_length) { spear_write_noniso_tx_fifo(endpoint); writel(0x0, &inep_regs_p[ep].write_done); } else if (endpoint->tx_urb && (endpoint->tx_urb->actual_length == 0)) { } } }
EmcraftSystems/u-boot
C++
Other
181
/* Allocate an SCB and return a pointer to the SCB object. NULL is returned if no SCB is free. */
static struct orc_scb* orc_alloc_scb(struct orc_host *host)
/* Allocate an SCB and return a pointer to the SCB object. NULL is returned if no SCB is free. */ static struct orc_scb* orc_alloc_scb(struct orc_host *host)
{ struct orc_scb *scb; unsigned long flags; spin_lock_irqsave(&host->allocation_lock, flags); scb = __orc_alloc_scb(host); spin_unlock_irqrestore(&host->allocation_lock, flags); return scb; }
robutest/uclinux
C++
GPL-2.0
60
/* This function removes the multicast group specified by Arg from the Map. */
EFI_STATUS EFIAPI Udp6LeaveGroup(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg OPTIONAL)
/* This function removes the multicast group specified by Arg from the Map. */ EFI_STATUS EFIAPI Udp6LeaveGroup(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg OPTIONAL)
{ EFI_IPv6_ADDRESS *McastIp; McastIp = Arg; if ((McastIp != NULL) && !EFI_IP6_EQUAL (McastIp, ((EFI_IPv6_ADDRESS *)Item->Key)) ) { return EFI_SUCCESS; } FreePool (Item->Key); NetMapRemoveItem (Map, Item, NULL); if (McastIp != NULL) { return EFI_ABORTED; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Return: false - we are done with this request true - still buffers pending for this request */
bool __blk_end_request_err(struct request *rq, int error)
/* Return: false - we are done with this request true - still buffers pending for this request */ bool __blk_end_request_err(struct request *rq, int error)
{ WARN_ON(error >= 0); return __blk_end_request(rq, error, blk_rq_err_bytes(rq)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Find an indexed string and return a pointer to a it. */
struct usb_string_descriptor* usbd_get_string(__u8 index)
/* Find an indexed string and return a pointer to a it. */ struct usb_string_descriptor* usbd_get_string(__u8 index)
{ if (index >= maxstrings) { return NULL; } return usb_strings[index]; }
EmcraftSystems/u-boot
C++
Other
181
/* Reset the ITERATION in US_CSR when the ISO7816 mode is enabled. */
void usart_reset_iterations(Usart *p_usart)
/* Reset the ITERATION in US_CSR when the ISO7816 mode is enabled. */ void usart_reset_iterations(Usart *p_usart)
{ p_usart->US_CR = US_CR_RSTIT; }
remotemcu/remcu-chip-sdks
C++
null
436
/* RETURNS: 0 on success, AC_ERR_* mask on failure. */
static unsigned int sata_pmp_read(struct ata_link *link, int reg, u32 *r_val)
/* RETURNS: 0 on success, AC_ERR_* mask on failure. */ static unsigned int sata_pmp_read(struct ata_link *link, int reg, u32 *r_val)
{ struct ata_port *ap = link->ap; struct ata_device *pmp_dev = ap->link.device; struct ata_taskfile tf; unsigned int err_mask; ata_tf_init(pmp_dev, &tf); tf.command = ATA_CMD_PMP_READ; tf.protocol = ATA_PROT_NODATA; tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48; tf.feature = reg; tf.device = link->pmp; err_mask = ata_exec_internal(pmp_dev, &tf, NULL, DMA_NONE, NULL, 0, SATA_PMP_RW_TIMEOUT); if (err_mask) return err_mask; *r_val = tf.nsect | tf.lbal << 8 | tf.lbam << 16 | tf.lbah << 24; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Function for checking if the TLV block length is correct. Some TLV block has predefined length: TLV_NULL and TLV_TERMINATOR always have a length of 1 byte. TLV_LOCK_CONTROL and TLV_MEMORY_CONTROL always have a length of 3 bytes. */
static bool tlv_block_is_data_length_correct(tlv_block_t *p_block_to_check)
/* Function for checking if the TLV block length is correct. Some TLV block has predefined length: TLV_NULL and TLV_TERMINATOR always have a length of 1 byte. TLV_LOCK_CONTROL and TLV_MEMORY_CONTROL always have a length of 3 bytes. */ static bool tlv_block_is_data_length_correct(tlv_block_t *p_block_to_check)
{ switch(p_block_to_check->tag) { case TLV_NULL: case TLV_TERMINATOR: if (p_block_to_check->length != TLV_NULL_TERMINATOR_LEN) { return false; } break; case TLV_LOCK_CONTROL: case TLV_MEMORY_CONTROL: if (p_block_to_check->length != TLV_LOCK_MEMORY_CTRL_LEN) { return false; } break; case TLV_NDEF_MESSAGE: case TLV_PROPRIETARY: default: break; } return true; }
labapart/polymcu
C++
null
201
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI MmioBitFieldWrite32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 EFIAPI MmioBitFieldWrite32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
{ return MmioWrite32 ( Address, BitFieldWrite32 (MmioRead32 (Address), StartBit, EndBit, Value) ); }
tianocore/edk2
C++
Other
4,240
/* Converts a text device path node to USB audio device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbAudio(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB audio device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbAudio(IN CHAR16 *TextDeviceNode)
{ USB_CLASS_TEXT UsbClassText; UsbClassText.ClassExist = FALSE; UsbClassText.Class = USB_CLASS_AUDIO; UsbClassText.SubClassExist = TRUE; return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); }
tianocore/edk2
C++
Other
4,240
/* Convert an NFS error code to a local one. This one is used jointly by NFSv2 and NFSv3. */
static int nfs4_stat_to_errno(int)
/* Convert an NFS error code to a local one. This one is used jointly by NFSv2 and NFSv3. */ static int nfs4_stat_to_errno(int)
{ int i; for (i = 0; nfs_errtbl[i].stat != -1; i++) { if (nfs_errtbl[i].stat == stat) return nfs_errtbl[i].errno; } if (stat <= 10000 || stat > 10100) { return -EREMOTEIO; } return -stat; }
robutest/uclinux
C++
GPL-2.0
60
/* param handle ENET handler pointer. Should be provided by application. param callback The ENET callback function. param userData The callback function parameter. */
void ENET_SetCallback(enet_handle_t *handle, enet_callback_t callback, void *userData)
/* param handle ENET handler pointer. Should be provided by application. param callback The ENET callback function. param userData The callback function parameter. */ void ENET_SetCallback(enet_handle_t *handle, enet_callback_t callback, void *userData)
{ assert(handle); handle->callback = callback; handle->userData = userData; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Return the child ACPI objects from Non-Root Handle. */
EFI_STATUS AmlGetChildFromNonRoot(IN EFI_AML_HANDLE *AmlParentHandle, IN EFI_AML_HANDLE *AmlHandle, OUT VOID **Buffer)
/* Return the child ACPI objects from Non-Root Handle. */ EFI_STATUS AmlGetChildFromNonRoot(IN EFI_AML_HANDLE *AmlParentHandle, IN EFI_AML_HANDLE *AmlHandle, OUT VOID **Buffer)
{ EFI_STATUS Status; if (AmlHandle == NULL) { AmlHandle = AmlParentHandle; } Status = AmlGetChildFromOptionList (AmlParentHandle, AmlHandle, Buffer); if (EFI_ERROR (Status)) { return EFI_INVALID_PARAMETER; } if (*Buffer != NULL) { return EFI_SUCCESS; } return AmlGetChildFromObjectChildList (AmlParentHandle, AmlHandle, Buffer); }
tianocore/edk2
C++
Other
4,240
/* Erase whole chip memory with build-in erase program. */
unsigned char AT45DBxxxDChipErase()
/* Erase whole chip memory with build-in erase program. */ unsigned char AT45DBxxxDChipErase()
{ unsigned int i = 0; if(AT45DBxxxDStatusGet() & AT45DBxxxD_SCPT_EN) return AT45DBxxxD_OP_INVALID; while(!AT45DBxxxDWaitReady()) { if(++i > AT45DBxxxD_OVERTIME) { return AT45DBxxxD_OP_BUSY; } } AT45DBxxxD_CS_CLR; if(AT45DBxxxDStatusGet() & AT45DBxxxD_SCPT_EN) return AT45DBxxxD_OP_WRITEPROTECT; xSPIDataWrite(AT45DBxxxD_SPI_PORT, AT45DBxxxD_CMD_CPER, 4); AT45DBxxxD_CS_SET; return AT45DBxxxD_OP_OK; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set the link pointer validor bit in TD. */
VOID SetTDLinkPtrValidorInvalid(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsValid)
/* Set the link pointer validor bit in TD. */ VOID SetTDLinkPtrValidorInvalid(IN TD_STRUCT *PtrTDStruct, IN BOOLEAN IsValid)
{ PtrTDStruct->TDData.TDLinkPtrTerminate = (IsValid ? 0 : 1); }
tianocore/edk2
C++
Other
4,240
/* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
/* @handle: handle of the loaded image @systable: system table */ static int setup(const efi_handle_t handle, const struct efi_system_table *systable)
{ efi_status_t ret; boottime = systable->boottime; ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_CALLBACK, notify, (void *)&timer_ticks, &event_notify); if (ret != EFI_SUCCESS) { efi_st_error("could not create event\n"); return EFI_ST_FAILURE; } ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT, TPL_CALLBACK, notify, NULL, &event_wait); if (ret != EFI_SUCCESS) { efi_st_error("could not create event\n"); return EFI_ST_FAILURE; } return EFI_ST_SUCCESS; }
4ms/stm32mp1-baremetal
C++
Other
137
/* dmi_name_in_serial - Check if string is in the DMI product serial information @str: string to check for */
int dmi_name_in_serial(const char *str)
/* dmi_name_in_serial - Check if string is in the DMI product serial information @str: string to check for */ int dmi_name_in_serial(const char *str)
{ int f = DMI_PRODUCT_SERIAL; if (dmi_ident[f] && strstr(dmi_ident[f], str)) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the device path of a specific storage security device. */
EFI_STATUS EFIAPI NvmeStorageSecurityGetDevicePath(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, IN UINTN DeviceIndex, OUT UINTN *DevicePathLength, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
/* Gets the device path of a specific storage security device. */ EFI_STATUS EFIAPI NvmeStorageSecurityGetDevicePath(IN EDKII_PEI_STORAGE_SECURITY_CMD_PPI *This, IN UINTN DeviceIndex, OUT UINTN *DevicePathLength, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath)
{ PEI_NVME_CONTROLLER_PRIVATE_DATA *Private; if ((This == NULL) || (DevicePathLength == NULL) || (DevicePath == NULL)) { return EFI_INVALID_PARAMETER; } Private = GET_NVME_PEIM_HC_PRIVATE_DATA_FROM_THIS_STROAGE_SECURITY (This); if ((DeviceIndex == 0) || (DeviceIndex > Private->ActiveNamespaceNum)) { return EFI_INVALID_PARAMETER; } return NvmeBuildDevicePath ( Private, Private->NamespaceInfo[DeviceIndex-1].NamespaceId, Private->NamespaceInfo[DeviceIndex-1].NamespaceUuid, DevicePathLength, DevicePath ); }
tianocore/edk2
C++
Other
4,240
/* Encode an ASN1 item, this is use by the standard 'i2d' function. 'out' points to a buffer to output the data to. The new i2d has one additional feature. If the output buffer is NULL (i.e. *out == NULL) then a buffer is allocated and populated with the encoding. */
static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it, int flags)
/* Encode an ASN1 item, this is use by the standard 'i2d' function. 'out' points to a buffer to output the data to. The new i2d has one additional feature. If the output buffer is NULL (i.e. *out == NULL) then a buffer is allocated and populated with the encoding. */ static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it, int flags)
{ if (out && !*out) { unsigned char *p, *buf; int len; len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags); if (len <= 0) return len; buf = OPENSSL_malloc(len); if (!buf) return -1; p = buf; ASN1_item_ex_i2d(&val, &p, it, -1, flags); *out = buf; return len; } return ASN1_item_ex_i2d(&val, out, it, -1, flags); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Switch back to polling (used when shutting down the device) */
void mlx4_cmd_use_polling(struct mlx4_dev *dev)
/* Switch back to polling (used when shutting down the device) */ void mlx4_cmd_use_polling(struct mlx4_dev *dev)
{ struct mlx4_priv *priv = mlx4_priv(dev); int i; priv->cmd.use_events = 0; for (i = 0; i < priv->cmd.max_cmds; ++i) down(&priv->cmd.event_sem); kfree(priv->cmd.context); up(&priv->cmd.poll_sem); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads and returns the current value of MM0. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMm0(VOID)
/* Reads and returns the current value of MM0. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmReadMm0(VOID)
{ UINT64 Data; __asm__ __volatile__ ( "push %%eax \n\t" "push %%eax \n\t" "movq %%mm0, (%%esp)\n\t" "pop %%eax \n\t" "pop %%edx \n\t" : "=A" (Data) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* SPI1 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
void SPI1IntHandler(void)
/* SPI1 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */ void SPI1IntHandler(void)
{ unsigned long ulFIFOFlags, ulFlags; unsigned long ulBase = SPI1_BASE; ulFIFOFlags = xHWREG(ulBase + SPI_FSR); ulFlags = xHWREG(ulBase + SPI_SR); xHWREG(ulBase + SPI_FSR) &= ~ulFIFOFlags; xHWREG(ulBase + SPI_SR) |= 0x78; if(g_pfnSPIHandlerCallbacks[1]) { g_pfnSPIHandlerCallbacks[0](0, 0, (ulFIFOFlags << 16) | ulFlags, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Note: we warn about excess calls to jpeg_read_scanlines() since this likely signals an application programmer error. However, an oversize buffer (max_lines > scanlines remaining) is not an error. */
jpeg_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines)
/* Note: we warn about excess calls to jpeg_read_scanlines() since this likely signals an application programmer error. However, an oversize buffer (max_lines > scanlines remaining) is not an error. */ jpeg_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines, JDIMENSION max_lines)
{ JDIMENSION row_ctr; if (cinfo->global_state != DSTATE_SCANNING) ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state); if (cinfo->output_scanline >= cinfo->output_height) { WARNMS(cinfo, JWRN_TOO_MUCH_DATA); return 0; } if (cinfo->progress != NULL) { cinfo->progress->pass_counter = (long)cinfo->output_scanline; cinfo->progress->pass_limit = (long)cinfo->output_height; (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo); } row_ctr = 0; (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines); cinfo->output_scanline += row_ctr; return row_ctr; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Output: void, will modify proto_tree if not null. */
static void dissect_lsp_te_router_id_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length _U_, int length)
/* Output: void, will modify proto_tree if not null. */ static void dissect_lsp_te_router_id_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length _U_, int length)
{ isis_dissect_te_router_id_clv(tree, pinfo, tvb, &ei_isis_lsp_short_packet, offset, length, hf_isis_lsp_clv_te_router_id ); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Called very early, MMU is off, device-tree isn't unflattened */
static int __init mpc832x_sys_probe(void)
/* Called very early, MMU is off, device-tree isn't unflattened */ static int __init mpc832x_sys_probe(void)
{ unsigned long root = of_get_flat_dt_root(); return of_flat_dt_is_compatible(root, "MPC832xMDS"); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Note that SA_RESETHAND requires either _POSIX_C_SOURCE>=200809L or _XOPEN_SOURCE>=500 */
void hwm_set_sig_handler(void)
/* Note that SA_RESETHAND requires either _POSIX_C_SOURCE>=200809L or _XOPEN_SOURCE>=500 */ void hwm_set_sig_handler(void)
{ struct sigaction act; act.sa_handler = hwm_signal_end_handler; PC_SAFE_CALL(sigemptyset(&act.sa_mask)); act.sa_flags = SA_RESETHAND; PC_SAFE_CALL(sigaction(SIGTERM, &act, NULL)); PC_SAFE_CALL(sigaction(SIGINT, &act, NULL)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Function for dispatching a SoftDevice event. This function is called from the SoftDevice event interrupt handler after a SoftDevice event has been received. */
static void ble_evt_dispatch(ble_evt_t *p_ble_evt)
/* Function for dispatching a SoftDevice event. This function is called from the SoftDevice event interrupt handler after a SoftDevice event has been received. */ static void ble_evt_dispatch(ble_evt_t *p_ble_evt)
{ ble_conn_params_on_ble_evt(p_ble_evt); on_ble_evt(p_ble_evt); }
remotemcu/remcu-chip-sdks
C++
null
436
/* configures EPO to receive SETUP packets from host */
void usb_ep0outstart(usb_core_instance *pdev)
/* configures EPO to receive SETUP packets from host */ void usb_ep0outstart(usb_core_instance *pdev)
{ pdev->dev.out_ep[0].xfer_len = 64U; pdev->dev.out_ep[0].rem_data_len = 64U; pdev->dev.out_ep[0].total_data_len = 64U; usb_ep0revcfg(&pdev->regs, pdev->basic_cfgs.dmaen, pdev->dev.setup_pkt_buf); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note: src here is the sender, thus it's the target of the DM */
void ax25_return_dm(struct net_device *dev, ax25_address *src, ax25_address *dest, ax25_digi *digi)
/* Note: src here is the sender, thus it's the target of the DM */ void ax25_return_dm(struct net_device *dev, ax25_address *src, ax25_address *dest, ax25_digi *digi)
{ struct sk_buff *skb; char *dptr; ax25_digi retdigi; if (dev == NULL) return; if ((skb = alloc_skb(dev->hard_header_len + 1, GFP_ATOMIC)) == NULL) return; skb_reserve(skb, dev->hard_header_len); skb_reset_network_header(skb); ax25_digi_invert(digi, &retdigi); dptr = skb_put(skb, 1); *dptr = AX25_DM | AX25_PF; dptr = skb_push(skb, ax25_addr_size(digi)); dptr += ax25_addr_build(dptr, dest, src, &retdigi, AX25_RESPONSE, AX25_MODULUS); ax25_queue_xmit(skb, dev); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* function : wb_ebios_apply(u32 sel, struct disp_capture_config *cfg) description : save user config parameters : sel <controller select> cfg <write-back information,include input_fb and output_fb information> return : 0 success -1 fail note : Don't support YUV input yet when write-back format is yuv, default 16-235 output */
s32 wb_ebios_apply(u32 sel, struct disp_capture_config *cfg)
/* function : wb_ebios_apply(u32 sel, struct disp_capture_config *cfg) description : save user config parameters : sel <controller select> cfg <write-back information,include input_fb and output_fb information> return : 0 success -1 fail note : Don't support YUV input yet when write-back format is yuv, default 16-235 output */ s32 wb_ebios_apply(u32 sel, struct disp_capture_config *cfg)
{ memcpy(&wb_config, cfg, sizeof(struct disp_capture_config)); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clears the register array which contains the VLAN filter table by setting all the values to 0. */
void e1000_clear_vfta_generic(struct e1000_hw *hw)
/* Clears the register array which contains the VLAN filter table by setting all the values to 0. */ void e1000_clear_vfta_generic(struct e1000_hw *hw)
{ u32 offset; for (offset = 0; offset < E1000_VLAN_FILTER_TBL_SIZE; offset++) { E1000_WRITE_REG_ARRAY(hw, E1000_VFTA, offset, 0); e1e_flush(); } }
robutest/uclinux
C++
GPL-2.0
60
/* The Reset() function resets the input device hardware. As part of initialization process, the firmware/device will make a quick but reasonable attempt to verify that the device is functioning. If the ExtendedVerification flag is TRUE the firmware may take an extended amount of time to verify the device is operating on reset. Otherwise the reset operation is to occur as quickly as possible. The hardware verification process is not defined by this specification and is left up to the platform firmware or driver to implement. */
EFI_STATUS EFIAPI USBKeyboardResetEx(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
/* The Reset() function resets the input device hardware. As part of initialization process, the firmware/device will make a quick but reasonable attempt to verify that the device is functioning. If the ExtendedVerification flag is TRUE the firmware may take an extended amount of time to verify the device is operating on reset. Otherwise the reset operation is to occur as quickly as possible. The hardware verification process is not defined by this specification and is left up to the platform firmware or driver to implement. */ EFI_STATUS EFIAPI USBKeyboardResetEx(IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
{ EFI_STATUS Status; USB_KB_DEV *UsbKeyboardDevice; UsbKeyboardDevice = TEXT_INPUT_EX_USB_KB_DEV_FROM_THIS (This); Status = UsbKeyboardDevice->SimpleInput.Reset (&UsbKeyboardDevice->SimpleInput, ExtendedVerification); if (EFI_ERROR (Status)) { return EFI_DEVICE_ERROR; } UsbKeyboardDevice->KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID; UsbKeyboardDevice->KeyState.KeyToggleState = EFI_TOGGLE_STATE_VALID; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Notification from rport that PLOGI is complete to initiate FC-4 session. */
void bfa_fcs_itnim_rport_online(struct bfa_fcs_itnim_s *itnim)
/* Notification from rport that PLOGI is complete to initiate FC-4 session. */ void bfa_fcs_itnim_rport_online(struct bfa_fcs_itnim_s *itnim)
{ itnim->stats.onlines++; if (!BFA_FCS_PID_IS_WKA(itnim->rport->pid)) { bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_ONLINE); } else { itnim->stats.initiator++; bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_INITIATOR); } }
robutest/uclinux
C++
GPL-2.0
60
/* Event dispatcher. Dispatch any events received for a fixed amount of time to the application callback. This function will block the caller for the specified amount of time, and pass events to the callback. */
ADI_WIFI_RESULT adi_wifi_DispatchEvents(const uint32_t nTimeoutMilliSeconds)
/* Event dispatcher. Dispatch any events received for a fixed amount of time to the application callback. This function will block the caller for the specified amount of time, and pass events to the callback. */ ADI_WIFI_RESULT adi_wifi_DispatchEvents(const uint32_t nTimeoutMilliSeconds)
{ adi_wifi_ClearEventPending(); return adi_wifi_WaitForResponseWithTimeout(nTimeoutMilliSeconds, CMD_NONE); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Registers the callback function that this server calls, whenever a client requests the reading of a specific discrete input. */
void TbxMbServerSetCallbackReadInput(tTbxMbServer channel, tTbxMbServerReadInput callback)
/* Registers the callback function that this server calls, whenever a client requests the reading of a specific discrete input. */ void TbxMbServerSetCallbackReadInput(tTbxMbServer channel, tTbxMbServerReadInput callback)
{ TBX_ASSERT((channel != NULL) && (callback != NULL)); if ((channel != NULL) && (callback != NULL)) { tTbxMbServerCtx * serverCtx = (tTbxMbServerCtx *)channel; TBX_ASSERT(serverCtx->type == TBX_MB_SERVER_CONTEXT_TYPE); TbxCriticalSectionEnter(); serverCtx->readInputFcn = callback; TbxCriticalSectionExit(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Fills each LTDC_RGBStruct member with its default value. */
void LTDC_RGBStructInit(LTDC_RGBTypeDef *LTDC_RGB_InitStruct)
/* Fills each LTDC_RGBStruct member with its default value. */ void LTDC_RGBStructInit(LTDC_RGBTypeDef *LTDC_RGB_InitStruct)
{ LTDC_RGB_InitStruct->LTDC_BlueWidth = 0x02; LTDC_RGB_InitStruct->LTDC_GreenWidth = 0x02; LTDC_RGB_InitStruct->LTDC_RedWidth = 0x02; }
MaJerle/stm32f429
C++
null
2,036
/* Generate a master secret based on the client/server random data and the premaster secret. */
void ICACHE_FLASH_ATTR generate_master_secret(SSL *ssl, const uint8_t *premaster_secret)
/* Generate a master secret based on the client/server random data and the premaster secret. */ void ICACHE_FLASH_ATTR generate_master_secret(SSL *ssl, const uint8_t *premaster_secret)
{ uint8_t buf[128]; strcpy((char *)buf, "master secret"); memcpy(&buf[13], ssl->dc->client_random, SSL_RANDOM_SIZE); memcpy(&buf[45], ssl->dc->server_random, SSL_RANDOM_SIZE); prf(premaster_secret, SSL_SECRET_SIZE, buf, 77, ssl->dc->master_secret, SSL_SECRET_SIZE); }
eerimoq/simba
C++
Other
337
/* Note that changes are synched to the GPIO clock, so reading values back right after you've set them may give old values. */
static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
/* Note that changes are synched to the GPIO clock, so reading values back right after you've set them may give old values. */ static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
{ struct davinci_gpio *d = container_of(chip, struct davinci_gpio, chip); struct gpio_controller *__iomem g = d->regs; return (1 << offset) & __raw_readl(&g->in_data); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check to see if a specific OSS interrupt is pending */
int oss_irq_pending(int irq)
/* Check to see if a specific OSS interrupt is pending */ int oss_irq_pending(int irq)
{ switch(irq) { case IRQ_SCC: case IRQ_SCCA: case IRQ_SCCB: return oss->irq_pending & OSS_IP_IOPSCC; break; case IRQ_MAC_ADB: return oss->irq_pending & OSS_IP_IOPISM; break; case IRQ_MAC_SCSI: return oss->irq_pending & OSS_IP_SCSI; break; case IRQ_NUBUS_9: case IRQ_NUBUS_A: case IRQ_NUBUS_B: case IRQ_NUBUS_C: case IRQ_NUBUS_D: case IRQ_NUBUS_E: irq -= NUBUS_SOURCE_BASE; return oss->irq_pending & (1 << irq); break; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Calculates the Euler angles (roll, pitch, yaw) from the DCM matrix. */
void IMU_dcmGetAngles(float dcm[3][3], float angle[3])
/* Calculates the Euler angles (roll, pitch, yaw) from the DCM matrix. */ void IMU_dcmGetAngles(float dcm[3][3], float angle[3])
{ angle[0] = atan2f( dcm[2][1], dcm[2][2] ); angle[1] = -asinf( dcm[2][0] ); angle[2] = atan2f( dcm[1][0], dcm[0][0] ); return; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Check to see if there are any methods still in use */
static int check_method_table(struct ib_mad_mgmt_method_table *method)
/* Check to see if there are any methods still in use */ static int check_method_table(struct ib_mad_mgmt_method_table *method)
{ int i; for (i = 0; i < IB_MGMT_MAX_METHODS; i++) if (method->agent[i]) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Delete the timer that was created by osTimerCreate. */
osStatus osTimerDelete(osTimerId timer_id)
/* Delete the timer that was created by osTimerCreate. */ osStatus osTimerDelete(osTimerId timer_id)
{ struct timer_obj *timer = (struct timer_obj *) timer_id; if (timer == NULL) { return osErrorParameter; } if (k_is_in_isr()) { return osErrorISR; } if (timer->status == ACTIVE) { k_timer_stop(&timer->ztimer); timer->status = NOT_ACTIVE; } k_mem_slab_free(&cmsis_timer_slab, (void *)timer); return osOK; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Initialize device before it's used by a driver. Ask low-level code to enable I/O resources. Wake up the device if it was suspended. Beware, this function can fail. */
int pci_enable_device_io(struct pci_dev *dev)
/* Initialize device before it's used by a driver. Ask low-level code to enable I/O resources. Wake up the device if it was suspended. Beware, this function can fail. */ int pci_enable_device_io(struct pci_dev *dev)
{ return __pci_enable_device_flags(dev, IORESOURCE_IO); }
robutest/uclinux
C++
GPL-2.0
60
/* DMA get current destination count in non-sequence mode. */
uint32_t DMA_GetNonSeqDestCount(const CM_DMA_TypeDef *DMAx, uint8_t u8Ch)
/* DMA get current destination count in non-sequence mode. */ uint32_t DMA_GetNonSeqDestCount(const CM_DMA_TypeDef *DMAx, uint8_t u8Ch)
{ DDL_ASSERT(IS_DMA_UNIT(DMAx)); DDL_ASSERT(IS_DMA_CH(u8Ch)); return ((READ_REG32(DMA_CH_REG(DMAx->MONDNSEQCTL0, u8Ch)) >> DMA_DNSEQCTL_DNSCNT_POS) & 0xFFFUL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ __HAL_RCC_TIM1_CLK_ENABLE(); } else if (htim_base->Instance == TIM2) { __HAL_RCC_TIM2_CLK_ENABLE(); } else if (htim_base->Instance == TIM3) { __HAL_RCC_TIM3_CLK_ENABLE(); } else if (htim_base->Instance == TIM14) { __HAL_RCC_TIM14_CLK_ENABLE(); HAL_NVIC_SetPriority(TIM8_TRG_COM_TIM14_IRQn, ISR_PRIORITY_DEFAULT, 0); HAL_NVIC_EnableIRQ(TIM8_TRG_COM_TIM14_IRQn); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Write and compress a tile of data. The tile is selected by the (x,y,z,s) coordinates. */
tmsize_t TIFFWriteTile(TIFF *tif, void *buf, uint32 x, uint32 y, uint32 z, uint16 s)
/* Write and compress a tile of data. The tile is selected by the (x,y,z,s) coordinates. */ tmsize_t TIFFWriteTile(TIFF *tif, void *buf, uint32 x, uint32 y, uint32 z, uint16 s)
{ if (!TIFFCheckTile(tif, x, y, z, s)) return ((tmsize_t)(-1)); return (TIFFWriteEncodedTile(tif, TIFFComputeTile(tif, x, y, z, s), buf, (tmsize_t)(-1))); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Invoked from macros defined in mmu_context.h which must already have disabled interrupts and done a DVPE or DMT as appropriate. */
void smtc_flush_tlb_asid(unsigned long asid)
/* Invoked from macros defined in mmu_context.h which must already have disabled interrupts and done a DVPE or DMT as appropriate. */ void smtc_flush_tlb_asid(unsigned long asid)
{ int entry; unsigned long ehi; entry = read_c0_wired(); while (entry < current_cpu_data.tlbsize) { write_c0_index(entry); ehb(); tlb_read(); ehb(); ehi = read_c0_entryhi(); if ((ehi & ASID_MASK) == asid) { write_c0_entryhi(CKSEG0 + (entry << (PAGE_SHIFT + 1))); write_c0_entrylo0(0); write_c0_entrylo1(0); mtc0_tlbw_hazard(); tlb_write_indexed(); } entry++; } write_c0_index(PARKED_INDEX); tlbw_use_hazard(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if the current speed of the device requires IORDY. Used by various controllers for chip configuration. */
unsigned int ata_pio_need_iordy(const struct ata_device *adev)
/* Check if the current speed of the device requires IORDY. Used by various controllers for chip configuration. */ unsigned int ata_pio_need_iordy(const struct ata_device *adev)
{ if (adev->link->ap->pflags & ATA_PFLAG_RESETTING) return 0; if (adev->link->ap->flags & ATA_FLAG_NO_IORDY) return 0; if (ata_id_is_cfa(adev->id) && (adev->pio_mode == XFER_PIO_5 || adev->pio_mode == XFER_PIO_6)) return 0; if (adev->pio_mode > XFER_PIO_2) return 1; if (ata_id_has_iordy(adev->id)) return 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Transforms an 18 bpp pixel into a 24bpp pixel. */
static void colorTransform16To24bpp(uint32_t color, uint8_t *red, uint8_t *green, uint8_t *blue)
/* Transforms an 18 bpp pixel into a 24bpp pixel. */ static void colorTransform16To24bpp(uint32_t color, uint8_t *red, uint8_t *green, uint8_t *blue)
{ uint8_t redValue = (color & 0x0000F800) >> 11; uint8_t greenValue = (color & 0x000007E0) >> 5; uint8_t blueValue = (color & 0x0000001F); redValue <<= 3; greenValue <<= 2; blueValue <<= 3; *red = redValue; *green = greenValue; *blue = blueValue; return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Create refresh hook event for form which has refresh event or interval. */
VOID CreateRefreshEventForForm(IN FORM_BROWSER_FORM *Form)
/* Create refresh hook event for form which has refresh event or interval. */ VOID CreateRefreshEventForForm(IN FORM_BROWSER_FORM *Form)
{ EFI_STATUS Status; EFI_EVENT RefreshEvent; FORM_BROWSER_REFRESH_EVENT_NODE *EventNode; Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, RefreshEventNotifyForForm, Form, &Form->RefreshGuid, &RefreshEvent ); ASSERT_EFI_ERROR (Status); EventNode = AllocateZeroPool (sizeof (FORM_BROWSER_REFRESH_EVENT_NODE)); ASSERT (EventNode != NULL); EventNode->RefreshEvent = RefreshEvent; InsertTailList (&mRefreshEventList, &EventNode->Link); }
tianocore/edk2
C++
Other
4,240
/* Returning non-zero value without CONFIG_HWCONFIG has its crucial purpose: the hwconfig() call should be a "transparent" interface, e.g. if a board doesn't need hwconfig facility, then we assume that the board file only calls things that are actually used, so hwconfig() will always return true result. */
int hwconfig_f(const char *opt, char *buf)
/* Returning non-zero value without CONFIG_HWCONFIG has its crucial purpose: the hwconfig() call should be a "transparent" interface, e.g. if a board doesn't need hwconfig facility, then we assume that the board file only calls things that are actually used, so hwconfig() will always return true result. */ int hwconfig_f(const char *opt, char *buf)
{ return !!__hwconfig(opt, NULL, buf); }
4ms/stm32mp1-baremetal
C++
Other
137
/* We can't do this directly from our _pop handler, since the ppp code doesn't want to be called in interrupt context, so we do it from a tasklet */
static void pppoatm_wakeup_sender(unsigned long arg)
/* We can't do this directly from our _pop handler, since the ppp code doesn't want to be called in interrupt context, so we do it from a tasklet */ static void pppoatm_wakeup_sender(unsigned long arg)
{ ppp_output_wakeup((struct ppp_channel *) arg); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* And for microcontrollers that have a USB peripheral: */
unsigned long uDMAChannelAttributeGet(unsigned long ulChannel)
/* And for microcontrollers that have a USB peripheral: */ unsigned long uDMAChannelAttributeGet(unsigned long ulChannel)
{ unsigned long ulAttr = 0; ASSERT(ulChannel < 32); if(HWREG(UDMA_USEBURSTSET) & (1 << ulChannel)) { ulAttr |= UDMA_ATTR_USEBURST; } if(HWREG(UDMA_ALTSET) & (1 << ulChannel)) { ulAttr |= UDMA_ATTR_ALTSELECT; } if(HWREG(UDMA_PRIOSET) & (1 << ulChannel)) { ulAttr |= UDMA_ATTR_HIGH_PRIORITY; } if(HWREG(UDMA_REQMASKSET) & (1 << ulChannel)) { ulAttr |= UDMA_ATTR_REQMASK; } return(ulAttr); }
watterott/WebRadio
C++
null
71
/* The following are all MBUS based SRMMU modules, and therefore could be found in a multiprocessor configuration. On the whole, these chips seems to be much more touchy about DVMA and page tables with respect to cache coherency. */
static void cypress_flush_cache_all(void)
/* The following are all MBUS based SRMMU modules, and therefore could be found in a multiprocessor configuration. On the whole, these chips seems to be much more touchy about DVMA and page tables with respect to cache coherency. */ static void cypress_flush_cache_all(void)
{ volatile unsigned long cypress_sucks; unsigned long faddr, tagval; flush_user_windows(); for(faddr = 0; faddr < 0x10000; faddr += 0x20) { __asm__ __volatile__("lda [%1 + %2] %3, %0\n\t" : "=r" (tagval) : "r" (faddr), "r" (0x40000), "i" (ASI_M_DATAC_TAG)); if((tagval & 0x60) == 0x60) cypress_sucks = *(unsigned long *)(0xf0020000 + faddr); } }
EmcraftSystems/linux-emcraft
C++
Other
266