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
/* Lookup and return the dwarf reg @reg_num for this frame. Return NULL if @reg_num is an register invalid number. */
static struct dwarf_reg* dwarf_frame_reg(struct dwarf_frame *frame, unsigned int reg_num)
/* Lookup and return the dwarf reg @reg_num for this frame. Return NULL if @reg_num is an register invalid number. */ static struct dwarf_reg* dwarf_frame_reg(struct dwarf_frame *frame, unsigned int reg_num)
{ struct dwarf_reg *reg; list_for_each_entry(reg, &frame->reg_list, link) { if (reg->number == reg_num) return reg; } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns 0 on success or negative error code on failure. */
int __init i2o_exec_init(void)
/* Returns 0 on success or negative error code on failure. */ int __init i2o_exec_init(void)
{ return i2o_driver_register(&i2o_exec_driver); }
robutest/uclinux
C++
GPL-2.0
60
/* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hspi->Instance==SPI1) { __HAL_RCC_SPI1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_6|GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Copy pixels from the screen to a pixel buffer. Use this function to copy pixels from the display to an internal SRAM buffer. Limits have to be set prior to calling this function, e.g.: */
void hx8347a_copy_pixels_from_screen(hx8347a_color_t *pixels, uint32_t count)
/* Copy pixels from the screen to a pixel buffer. Use this function to copy pixels from the display to an internal SRAM buffer. Limits have to be set prior to calling this function, e.g.: */ void hx8347a_copy_pixels_from_screen(hx8347a_color_t *pixels, uint32_t count)
{ uint8_t red; uint8_t green; uint8_t blue; Assert(count > 0); hx8347a_select_register(HX8347A_SRAMWRITE); hx8347a_select_chip(); hx8347a_send_byte(HX8347A_START_READREG); red = hx8347a_read_byte(); while (count > 0) { red = hx8347a_read_byte(); green = hx8347a_read_byte(); blue = hx8347a_read_byte(); *pixels = HX8347A_COLOR(red, green, blue); pixels++; count--; } hx8347a_deselect_chip(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* FC transport template entry, get rport loss timeout. */
static void bfad_im_get_rport_loss_tmo(struct fc_rport *rport)
/* FC transport template entry, get rport loss timeout. */ static void bfad_im_get_rport_loss_tmo(struct fc_rport *rport)
{ struct bfad_itnim_data_s *itnim_data = rport->dd_data; struct bfad_itnim_s *itnim = itnim_data->itnim; struct bfad_s *bfad = itnim->im->bfad; unsigned long flags; spin_lock_irqsave(&bfad->bfad_lock, flags); rport->dev_loss_tmo = bfa_fcpim_path_tov_get(&bfad->bfa); spin_unlock_irqrestore(&bfad->bfad_lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* RCC Clear the Oscillator Ready Interrupt Flag. Clear the interrupt flag that was set when a clock oscillator became ready to use. */
void rcc_osc_ready_int_clear(enum rcc_osc osc)
/* RCC Clear the Oscillator Ready Interrupt Flag. Clear the interrupt flag that was set when a clock oscillator became ready to use. */ void rcc_osc_ready_int_clear(enum rcc_osc osc)
{ switch (osc) { case RCC_HSI48: RCC_CIR |= RCC_CIR_HSI48RDYC; break; case RCC_HSI14: RCC_CIR |= RCC_CIR_HSI14RDYC; break; case RCC_HSI: RCC_CIR |= RCC_CIR_HSIRDYC; break; case RCC_HSE: RCC_CIR |= RCC_CIR_HSERDYC; break; case RCC_PLL: RCC_CIR |= RCC_CIR_PLLRDYC; break; case RCC_LSE: RCC_CIR |= RCC_CIR_LSERDYC; break; case RCC_LSI: RCC_CIR |= RCC_CIR_LSIRDYC; break; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Set the fields of structure stc_eth_init_t to default values. */
int32_t ETH_StructInit(stc_eth_init_t *pstcEthInit)
/* Set the fields of structure stc_eth_init_t to default values. */ int32_t ETH_StructInit(stc_eth_init_t *pstcEthInit)
{ int32_t i32Ret = LL_OK; if (NULL == pstcEthInit) { i32Ret = LL_ERR_INVD_PARAM; } else { (void)ETH_MAC_StructInit(&pstcEthInit->stcMacInit); (void)ETH_DMA_StructInit(&pstcEthInit->stcDmaInit); } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* cx_device_match - Find cx_device in the id table. @ids: id table from driver @cx_device: part/mfg id for the device */
static const struct cx_device_id* cx_device_match(const struct cx_device_id *ids, struct cx_dev *cx_device)
/* cx_device_match - Find cx_device in the id table. @ids: id table from driver @cx_device: part/mfg id for the device */ static const struct cx_device_id* cx_device_match(const struct cx_device_id *ids, struct cx_dev *cx_device)
{ while (ids->part_num && ids->mfg_num) { if (ids->part_num == cx_device->cx_id.part_num && ids->mfg_num == cx_device->cx_id.mfg_num) return ids; ids++; } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* eeprom_emu_set_change: create change blocks from data in blk and address */
static void eeprom_emu_set_change(const struct device *dev, const uint32_t address, const uint8_t *data, uint8_t *blk)
/* eeprom_emu_set_change: create change blocks from data in blk and address */ static void eeprom_emu_set_change(const struct device *dev, const uint32_t address, const uint8_t *data, uint8_t *blk)
{ const struct eeprom_emu_config *dev_config = dev->config; for (int i = 0; i < (dev_config->flash_cbs / 2); i++) { (*blk++) = (*data++); } for (int i = 0; i < (dev_config->flash_cbs / 2); i++) { if (i < sizeof(address)) { (*blk++) = (uint8_t)(((address >> (8 * i)) & 0xff)); } else { (*blk++) = 0xff; } } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks */
void QTMR_SetTimerPeriod(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks)
/* param base Quad Timer peripheral base address param channel Quad Timer channel number param ticks Timer period in units of ticks */ void QTMR_SetTimerPeriod(TMR_Type *base, qtmr_channel_selection_t channel, uint16_t ticks)
{ base->CHANNEL[channel].CTRL |= TMR_CTRL_LENGTH_MASK; if ((base->CHANNEL[channel].CTRL & TMR_CTRL_DIR_MASK) != 0U) { base->CHANNEL[channel].COMP2 = ticks; } else { base->CHANNEL[channel].COMP1 = ticks; } }
eclipse-threadx/getting-started
C++
Other
310
/* This function returns the reason(s) for a reset. Because the reset reasons are sticky until either cleared by software or a power-on reset, multiple reset reasons may be returned if multiple resets have occurred. The reset reason is a logical OR of */
uint32_t SysCtlResetCauseGet(void)
/* This function returns the reason(s) for a reset. Because the reset reasons are sticky until either cleared by software or a power-on reset, multiple reset reasons may be returned if multiple resets have occurred. The reset reason is a logical OR of */ uint32_t SysCtlResetCauseGet(void)
{ return (HWREG(SYSCTL_RESC)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Draw filled trigon (triangle) with alpha blending. Note: Creates vertex array and uses aapolygon routine to render. */
int filledTrigonColor(SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
/* Draw filled trigon (triangle) with alpha blending. Note: Creates vertex array and uses aapolygon routine to render. */ int filledTrigonColor(SDL_Surface *dst, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color)
{ Sint16 vx[3]; Sint16 vy[3]; vx[0]=x1; vx[1]=x2; vx[2]=x3; vy[0]=y1; vy[1]=y2; vy[2]=y3; return(filledPolygonColor(dst,vx,vy,3,color)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Converts a USB device path structure to its string representative. */
VOID DevPathToTextUsb(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
/* Converts a USB device path structure to its string representative. */ VOID DevPathToTextUsb(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
{ USB_DEVICE_PATH *Usb; Usb = DevPath; UefiDevicePathLibCatPrint (Str, L"USB(0x%x,0x%x)", Usb->ParentPortNumber, Usb->InterfaceNumber); }
tianocore/edk2
C++
Other
4,240
/* 'mxml_file_putc()' - Write a character to a file. */
static int mxml_file_putc(int ch, void *p)
/* 'mxml_file_putc()' - Write a character to a file. */ static int mxml_file_putc(int ch, void *p)
{ return (putc(ch, (FILE *)p) == EOF ? -1 : 0); }
DC-SWAT/DreamShell
C++
null
404
/* Retrieve a pointer to EVP message digest object. */
STATIC const EVP_MD* GetEvpMD(IN UINT16 DigestLen)
/* Retrieve a pointer to EVP message digest object. */ STATIC const EVP_MD* GetEvpMD(IN UINT16 DigestLen)
{ switch (DigestLen) { case SHA256_DIGEST_SIZE: return EVP_sha256 (); break; case SHA384_DIGEST_SIZE: return EVP_sha384 (); break; case SHA512_DIGEST_SIZE: return EVP_sha512 (); break; default: return NULL; } }
tianocore/edk2
C++
Other
4,240
/* rmmod daqboard2000 ; rmmod comedi; make install ; modprobe daqboard2000; /usr/sbin/comedi_config /dev/comedi0 daqboard/2000 ; tail -40 /var/log/messages */
static int daqboard2000_8255_cb(int dir, int port, int data, unsigned long ioaddr)
/* rmmod daqboard2000 ; rmmod comedi; make install ; modprobe daqboard2000; /usr/sbin/comedi_config /dev/comedi0 daqboard/2000 ; tail -40 /var/log/messages */ static int daqboard2000_8255_cb(int dir, int port, int data, unsigned long ioaddr)
{ int result = 0; if (dir) { writew(data, ((void *)ioaddr) + port * 2); result = 0; } else { result = readw(((void *)ioaddr) + port * 2); } return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Get node with specified destination prefix (and source prefix, if subtrees are used) */
static struct fib6_node* fib6_locate_1(struct fib6_node *root, struct in6_addr *addr, int plen, int offset)
/* Get node with specified destination prefix (and source prefix, if subtrees are used) */ static struct fib6_node* fib6_locate_1(struct fib6_node *root, struct in6_addr *addr, int plen, int offset)
{ struct fib6_node *fn; for (fn = root; fn ; ) { struct rt6key *key = (struct rt6key *)((u8 *)fn->leaf + offset); if (plen < fn->fn_bit || !ipv6_prefix_equal(&key->addr, addr, fn->fn_bit)) return NULL; if (plen == fn->fn_bit) return fn; if (addr_bit_set(addr, fn->fn_bit)) fn = fn->right; else fn = fn->left; } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If Address > 0x0FFFFFFF, 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 PciExpressBitFieldWrite32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
/* If Address > 0x0FFFFFFF, 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 PciExpressBitFieldWrite32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
{ ASSERT_INVALID_PCI_ADDRESS (Address); return MmioBitFieldWrite32 ( (UINTN)GetPciExpressBaseAddress () + Address, StartBit, EndBit, Value ); }
tianocore/edk2
C++
Other
4,240
/* PARAMETER erp current erp_head RETURN VALUES erp new erp_head - pointer to new ERP */
static struct dasd_ccw_req* dasd_3990_erp_overrun(struct dasd_ccw_req *erp, char *sense)
/* PARAMETER erp current erp_head RETURN VALUES erp new erp_head - pointer to new ERP */ static struct dasd_ccw_req* dasd_3990_erp_overrun(struct dasd_ccw_req *erp, char *sense)
{ struct dasd_device *device = erp->startdev; erp->function = dasd_3990_erp_overrun; DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Overrun - service overrun or overrun" " error requested by channel"); erp = dasd_3990_erp_action_5(erp); return erp; }
robutest/uclinux
C++
GPL-2.0
60
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI S3PciSegmentAnd16(IN UINT64 Address, IN UINT16 AndData)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI S3PciSegmentAnd16(IN UINT64 Address, IN UINT16 AndData)
{ return InternalSavePciSegmentWrite16ValueToBootScript (Address, PciSegmentAnd16 (Address, AndData)); }
tianocore/edk2
C++
Other
4,240
/* xs_udp_print_stats - display UDP socket-specifc stats @xprt: rpc_xprt struct containing statistics @seq: output file */
static void xs_udp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
/* xs_udp_print_stats - display UDP socket-specifc stats @xprt: rpc_xprt struct containing statistics @seq: output file */ static void xs_udp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq)
{ struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); seq_printf(seq, "\txprt:\tudp %u %lu %lu %lu %lu %Lu %Lu\n", transport->srcport, xprt->stat.bind_count, xprt->stat.sends, xprt->stat.recvs, xprt->stat.bad_xids, xprt->stat.req_u, xprt->stat.bklog_u); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return the CM_IDLEST register address and bit shift corresponding to the module that "owns" this clock. This default code assumes that the CM_IDLEST bit shift is the CM_*CLKEN bit shift, and that the IDLEST register address ID corresponds to the CM_*CLKEN register address ID (e.g., that CM_FCLKEN2 corresponds to CM_IDLEST2). This is not true for all modules. No return value. */
void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, u8 *idlest_bit)
/* Return the CM_IDLEST register address and bit shift corresponding to the module that "owns" this clock. This default code assumes that the CM_IDLEST bit shift is the CM_*CLKEN bit shift, and that the IDLEST register address ID corresponds to the CM_*CLKEN register address ID (e.g., that CM_FCLKEN2 corresponds to CM_IDLEST2). This is not true for all modules. No return value. */ void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, u8 *idlest_bit)
{ u32 r; r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); *idlest_reg = (__force void __iomem *)r; *idlest_bit = clk->enable_bit; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Converts a text device path node to Parallel Port device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextParallelPort(CHAR16 *TextDeviceNode)
/* Converts a text device path node to Parallel Port device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextParallelPort(CHAR16 *TextDeviceNode)
{ return ConvertFromTextAcpi (TextDeviceNode, 0x0401); }
tianocore/edk2
C++
Other
4,240
/* This file is part of the Simba project. */
int mock_write_isotp_init(uint8_t *message_p, size_t size, int flags, int res)
/* This file is part of the Simba project. */ int mock_write_isotp_init(uint8_t *message_p, size_t size, int flags, int res)
{ harness_mock_write("isotp_init(message_p)", message_p, sizeof(*message_p)); harness_mock_write("isotp_init(size)", &size, sizeof(size)); harness_mock_write("isotp_init(flags)", &flags, sizeof(flags)); harness_mock_write("isotp_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Send the commands sequentially from the given array. The array must be terminated with NID=0. */
void snd_hda_sequence_write(struct hda_codec *codec, const struct hda_verb *seq)
/* Send the commands sequentially from the given array. The array must be terminated with NID=0. */ void snd_hda_sequence_write(struct hda_codec *codec, const struct hda_verb *seq)
{ for (; seq->nid; seq++) snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); }
robutest/uclinux
C++
GPL-2.0
60
/* Makes a copy of the current state of @gstate and saves it to @gstate->next, then put the address of the newly allcated copy into @gstate. _cairo_gstate_restore() reverses this. */
cairo_status_t _cairo_gstate_save(cairo_gstate_t **gstate, cairo_gstate_t **freelist)
/* Makes a copy of the current state of @gstate and saves it to @gstate->next, then put the address of the newly allcated copy into @gstate. _cairo_gstate_restore() reverses this. */ cairo_status_t _cairo_gstate_save(cairo_gstate_t **gstate, cairo_gstate_t **freelist)
{ cairo_gstate_t *top; cairo_status_t status; if (CAIRO_INJECT_FAULT ()) return _cairo_error (CAIRO_STATUS_NO_MEMORY); top = *freelist; if (top == NULL) { top = _cairo_malloc (sizeof (cairo_gstate_t)); if (unlikely (top == NULL)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); } else *freelist = top->next; status = _cairo_gstate_init_copy (top, *gstate); if (unlikely (status)) { top->next = *freelist; *freelist = top; return status; } top->next = *gstate; *gstate = top; return CAIRO_STATUS_SUCCESS; }
xboot/xboot
C++
MIT License
779
/* Function for dequeing a possible pending flash access operation. */
static void cmd_queue_dequeue(void)
/* Function for dequeing a possible pending flash access operation. */ static void cmd_queue_dequeue(void)
{ if ((m_cmd_queue.count != 0)) { cmd_process(); } }
labapart/polymcu
C++
null
201
/* param base PDM base pointer param enableMaxBlock If signal maximum block enabled. param signalGain Gain value for the signal energy. */
void PDM_SetHwvadSignalFilterConfig(PDM_Type *base, bool enableMaxBlock, uint32_t signalGain)
/* param base PDM base pointer param enableMaxBlock If signal maximum block enabled. param signalGain Gain value for the signal energy. */ void PDM_SetHwvadSignalFilterConfig(PDM_Type *base, bool enableMaxBlock, uint32_t signalGain)
{ uint32_t signalConfig = base->VAD0_SCONFIG; signalConfig &= ~(PDM_VAD0_SCONFIG_VADSMAXEN_MASK | PDM_VAD0_SCONFIG_VADSGAIN_MASK); signalConfig |= (PDM_VAD0_SCONFIG_VADSMAXEN(enableMaxBlock) | PDM_VAD0_SCONFIG_VADSGAIN(signalGain)) | PDM_VAD0_SCONFIG_VADSFILEN_MASK; base->VAD0_SCONFIG = signalConfig; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The higher levels take care of making this non-reentrant (it's called with bh's disabled). */
static netdev_tx_t loopback_xmit(struct sk_buff *skb, struct net_device *dev)
/* The higher levels take care of making this non-reentrant (it's called with bh's disabled). */ static netdev_tx_t loopback_xmit(struct sk_buff *skb, struct net_device *dev)
{ struct pcpu_lstats *pcpu_lstats, *lb_stats; int len; skb_orphan(skb); skb->protocol = eth_type_trans(skb, dev); pcpu_lstats = dev->ml_priv; lb_stats = this_cpu_ptr(pcpu_lstats); len = skb->len; if (likely(netif_rx(skb) == NET_RX_SUCCESS)) { lb_stats->bytes += len; lb_stats->packets++; } else lb_stats->drops++; return NETDEV_TX_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* For both inputs and outputs tv_nsec must be in the range [0, NSEC_PER_SEC). tv_sec may be negative, zero, or positive. */
void timespec_add(struct timespec *apb, const struct timespec *a, const struct timespec *b)
/* For both inputs and outputs tv_nsec must be in the range [0, NSEC_PER_SEC). tv_sec may be negative, zero, or positive. */ void timespec_add(struct timespec *apb, const struct timespec *a, const struct timespec *b)
{ apb->tv_nsec = a->tv_nsec + b->tv_nsec; apb->tv_sec = a->tv_sec + b->tv_sec; if (apb->tv_nsec >= NSEC_PER_SEC) { apb->tv_sec += 1; apb->tv_nsec -= NSEC_PER_SEC; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function opens a file with the open mode according to the file path. The Attributes is valid only for EFI_FILE_MODE_CREATE. */
EFI_STATUS EFIAPI ShellOpenFileByDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes)
/* This function opens a file with the open mode according to the file path. The Attributes is valid only for EFI_FILE_MODE_CREATE. */ EFI_STATUS EFIAPI ShellOpenFileByDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, OUT SHELL_FILE_HANDLE *FileHandle, IN UINT64 OpenMode, IN UINT64 Attributes)
{ CHAR16 *FileName; EFI_STATUS Status; EFI_FILE_PROTOCOL *File; if ((FilePath == NULL) || (FileHandle == NULL)) { return (EFI_INVALID_PARAMETER); } if (gEfiShellProtocol != NULL) { FileName = gEfiShellProtocol->GetFilePathFromDevicePath (*FilePath); if (FileName == NULL) { return (EFI_INVALID_PARAMETER); } Status = ShellOpenFileByName (FileName, FileHandle, OpenMode, Attributes); FreePool (FileName); return (Status); } Status = EfiOpenFileByDevicePath (FilePath, &File, OpenMode, Attributes); if (EFI_ERROR (Status)) { return Status; } *FileHandle = (VOID *)File; return (EFI_SUCCESS); }
tianocore/edk2
C++
Other
4,240
/* Implementation of fputs using the DBGU as the standard output. Required for printf(). Does NOT currently use the PDC. Returns the number of characters written if successful, or -1 if the output stream is not stdout or stderr. */
signed int fputs(const char *pStr, FILE *pStream)
/* Implementation of fputs using the DBGU as the standard output. Required for printf(). Does NOT currently use the PDC. Returns the number of characters written if successful, or -1 if the output stream is not stdout or stderr. */ signed int fputs(const char *pStr, FILE *pStream)
{ signed int num = 0; while (*pStr != 0) { if (fputc(*pStr, pStream) == -1) { return -1; } num++; pStr++; } return num; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This function is used to read USB interrupt transfer before the response RNDIS message. */
EFI_STATUS EFIAPI ReadRndisResponseInterrupt(IN USB_RNDIS_DEVICE *UsbRndisDevice)
/* This function is used to read USB interrupt transfer before the response RNDIS message. */ EFI_STATUS EFIAPI ReadRndisResponseInterrupt(IN USB_RNDIS_DEVICE *UsbRndisDevice)
{ EFI_STATUS Status; UINT32 Data[2]; UINT32 UsbStatus; UINTN DataLength; DataLength = 8; ZeroMem (Data, sizeof (Data)); Status = UsbRndisDevice->UsbIo->UsbSyncInterruptTransfer ( UsbRndisDevice->UsbIo, UsbRndisDevice->InterrupEndpoint, &Data, &DataLength, 0x20, &UsbStatus ); return Status; }
tianocore/edk2
C++
Other
4,240
/* This function returns the BD element index based on endpoint address and the odd bit. */
static uint8_t get_bdt_idx(uint8_t ep, uint8_t odd)
/* This function returns the BD element index based on endpoint address and the odd bit. */ static uint8_t get_bdt_idx(uint8_t ep, uint8_t odd)
{ if (ep & USB_EP_DIR_IN) { return ((((KINETIS_ADDR2IDX(ep)) * 4) + 2 + (odd & 1))); } return ((((KINETIS_ADDR2IDX(ep)) * 4) + (odd & 1))); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function returns the same value as date('now'). */
static void cdateFunc(sqlite3_context *context, int NotUsed, sqlite3_value **NotUsed2)
/* This function returns the same value as date('now'). */ static void cdateFunc(sqlite3_context *context, int NotUsed, sqlite3_value **NotUsed2)
{ UNUSED_PARAMETER2(NotUsed, NotUsed2); dateFunc(context, 0, 0); }
DC-SWAT/DreamShell
C++
null
404
/* Enables or disables the TIMx's Hall sensor interface. */
void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Enables or disables the TIMx's Hall sensor interface. */ void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_LIST3_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->CR2 |= TIM_CR2_TI1S; } else { TIMx->CR2 &= (uint16_t)~((uint16_t)TIM_CR2_TI1S); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set IRQ configuration register for all ESS models */
static int ess_common_set_irq_hw(sb_devc *devc)
/* Set IRQ configuration register for all ESS models */ static int ess_common_set_irq_hw(sb_devc *devc)
{ int irq_bits; if ((irq_bits = ess_irq_bits (devc->irq)) == -1) return 0; if (!ess_write (devc, 0xb1, 0x50 | (irq_bits << 2))) { printk(KERN_ERR "ES1688: Failed to write to IRQ config register\n"); return 0; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Locking: The method gets called under an irqsave() spinlock; and locks struct hvc_iucv_private->lock. */
static int hvc_iucv_put_chars(uint32_t vtermno, const char *buf, int count)
/* Locking: The method gets called under an irqsave() spinlock; and locks struct hvc_iucv_private->lock. */ static int hvc_iucv_put_chars(uint32_t vtermno, const char *buf, int count)
{ struct hvc_iucv_private *priv = hvc_iucv_get_private(vtermno); int queued; if (count <= 0) return 0; if (!priv) return -ENODEV; spin_lock(&priv->lock); queued = hvc_iucv_queue(priv, buf, count); spin_unlock(&priv->lock); return queued; }
robutest/uclinux
C++
GPL-2.0
60
/* Routine implementing u-boot fsinfo command. This routine prints out miscellaneous filesystem informations/statistics. */
int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
/* Routine implementing u-boot fsinfo command. This routine prints out miscellaneous filesystem informations/statistics. */ int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{ struct part_info *part; char *fsname; int ret; if (mtdparts_init() !=0) return 1; if ((part = jffs2_part_info(current_mtd_dev, current_mtd_partnum))){ fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2"); printf("### filesystem type is %s\n", fsname); if (cramfs_check(part)) { ret = cramfs_info (part); } else { ret = jffs2_1pass_info(part); } return ret ? 0 : 1; } return 1; }
EmcraftSystems/u-boot
C++
Other
181
/* Wrap Write register component function to Bus IO function. */
static int32_t WriteRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length)
/* Wrap Write register component function to Bus IO function. */ static int32_t WriteRegWrap(void *Handle, uint8_t Reg, uint8_t *pData, uint16_t Length)
{ LPS22HH_Object_t *pObj = (LPS22HH_Object_t *)Handle; return pObj->IO.WriteReg(pObj->IO.Address, Reg, pData, Length); }
eclipse-threadx/getting-started
C++
Other
310
/* MMU default configuration. This function provides the default configuration mechanism for the Memory Management Unit (MMU). */
void z_arm64_mm_init(bool is_primary_core)
/* MMU default configuration. This function provides the default configuration mechanism for the Memory Management Unit (MMU). */ void z_arm64_mm_init(bool is_primary_core)
{ unsigned int flags = 0U; __ASSERT(CONFIG_MMU_PAGE_SIZE == KB(4), "Only 4K page size is supported\n"); __ASSERT(GET_EL(read_currentel()) == MODE_EL1, "Exception level not EL1, MMU not enabled!\n"); __ASSERT((read_sctlr_el1() & SCTLR_M_BIT) == 0, "MMU is already enabled\n"); if (is_primary_core) { kernel_ptables.base_xlat_table = new_table(); setup_page_tables(&kernel_ptables); } enable_mmu_el1(&kernel_ptables, flags); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Timestamp first data output register (r). The value is expressed as a 32-bit word and the bit resolution is 25 μs.. */
int32_t lsm6dso_timestamp_raw_get(stmdev_ctx_t *ctx, uint32_t *val)
/* Timestamp first data output register (r). The value is expressed as a 32-bit word and the bit resolution is 25 μs.. */ int32_t lsm6dso_timestamp_raw_get(stmdev_ctx_t *ctx, uint32_t *val)
{ uint8_t buff[4]; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_TIMESTAMP0, buff, 4); *val = buff[3]; *val = (*val * 256U) + buff[2]; *val = (*val * 256U) + buff[1]; *val = (*val * 256U) + buff[0]; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Disable I2C interrupt of the specified I2C port. The */
void xI2CMasterIntDisable(unsigned long ulBase, unsigned long ulIntType)
/* Disable I2C interrupt of the specified I2C port. The */ void xI2CMasterIntDisable(unsigned long ulBase, unsigned long ulIntType)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); xHWREG(ulBase + I2C_CON) &= ~I2C_CON_EI; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This routine is called when a Clear Request is needed outside of the context of a connected socket. */
void rose_transmit_clear_request(struct rose_neigh *neigh, unsigned int lci, unsigned char cause, unsigned char diagnostic)
/* This routine is called when a Clear Request is needed outside of the context of a connected socket. */ void rose_transmit_clear_request(struct rose_neigh *neigh, unsigned int lci, unsigned char cause, unsigned char diagnostic)
{ struct sk_buff *skb; unsigned char *dptr; int len; len = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN + 3; if ((skb = alloc_skb(len, GFP_ATOMIC)) == NULL) return; skb_reserve(skb, AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN); dptr = skb_put(skb, ROSE_MIN_LEN + 3); *dptr++ = AX25_P_ROSE; *dptr++ = ((lci >> 8) & 0x0F) | ROSE_GFI; *dptr++ = ((lci >> 0) & 0xFF); *dptr++ = ROSE_CLEAR_REQUEST; *dptr++ = cause; *dptr++ = diagnostic; if (!rose_send_frame(skb, neigh)) kfree_skb(skb); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* try to close a goto with existing labels; this solves backward jumps */
static int findlabel(LexState *ls, int g)
/* try to close a goto with existing labels; this solves backward jumps */ static int findlabel(LexState *ls, int g)
{ Labeldesc *lb = &dyd->label.arr[i]; if (eqstr(lb->name, gt->name)) { if (gt->nactvar > lb->nactvar && (bl->upval || dyd->label.n > bl->firstlabel)) luaK_patchclose(ls->fs, gt->pc, lb->nactvar); closegoto(ls, g, lb); return 1; } } return 0; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* If Sha1Context is NULL, then return FALSE. If NewSha1Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceSha1Duplicate(IN CONST VOID *Sha1Context, OUT VOID *NewSha1Context)
/* If Sha1Context is NULL, then return FALSE. If NewSha1Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceSha1Duplicate(IN CONST VOID *Sha1Context, OUT VOID *NewSha1Context)
{ return CALL_BASECRYPTLIB (Sha1.Services.Duplicate, Sha1Duplicate, (Sha1Context, NewSha1Context), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Called to close down a network device which has been active. Cancell any work, shutdown the RX and TX process and then place the chip into a low power state whilst it is not being used. */
static int ks_net_stop(struct net_device *netdev)
/* Called to close down a network device which has been active. Cancell any work, shutdown the RX and TX process and then place the chip into a low power state whilst it is not being used. */ static int ks_net_stop(struct net_device *netdev)
{ struct ks_net *ks = netdev_priv(netdev); if (netif_msg_ifdown(ks)) ks_info(ks, "%s: shutting down\n", netdev->name); netif_stop_queue(netdev); mutex_lock(&ks->lock); ks_wrreg16(ks, KS_IER, 0x0000); ks_wrreg16(ks, KS_ISR, 0xffff); ks_disable_qmu(ks); ks_set_powermode(ks, PMECR_PM_SOFTDOWN); free_irq(ks->irq, netdev); mutex_unlock(&ks->lock); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The source data is assumed to be in little-endian order in memory and is maintained in little-endian order when writen to LRAM. */
static void AscMemDWordCopyPtrToLram(PortAddr iop_base, ushort s_addr, uchar *s_buffer, int dwords)
/* The source data is assumed to be in little-endian order in memory and is maintained in little-endian order when writen to LRAM. */ static void AscMemDWordCopyPtrToLram(PortAddr iop_base, ushort s_addr, uchar *s_buffer, int dwords)
{ int i; AscSetChipLramAddr(iop_base, s_addr); for (i = 0; i < 4 * dwords; i += 4) { outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]); outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 3] << 8) | s_buffer[i + 2]); } }
robutest/uclinux
C++
GPL-2.0
60
/* Read at most max_packets from the capture stream and call the callback for each of them. Returns the number of packets handled or -1 if an error occured. */
static int pcap_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char *user)
/* Read at most max_packets from the capture stream and call the callback for each of them. Returns the number of packets handled or -1 if an error occured. */ static int pcap_read_linux(pcap_t *handle, int max_packets _U_, pcap_handler callback, u_char *user)
{ return pcap_read_packet(handle, callback, user); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Appends a new term to the current list of #CRTerm. */
CRTerm* cr_term_append_term(CRTerm *a_this, CRTerm *a_new_term)
/* Appends a new term to the current list of #CRTerm. */ CRTerm* cr_term_append_term(CRTerm *a_this, CRTerm *a_new_term)
{ CRTerm *cur = NULL; g_return_val_if_fail (a_new_term, NULL); if (a_this == NULL) return a_new_term; for (cur = a_this; cur->next; cur = cur->next) ; cur->next = a_new_term; a_new_term->prev = cur; return a_this; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* UART 0 interrupt handler. This function is the UART interrupt handler, it simple execute the callback function if there be one. */
void UART0IntHandler(void)
/* UART 0 interrupt handler. This function is the UART interrupt handler, it simple execute the callback function if there be one. */ void UART0IntHandler(void)
{ if(g_pfnWDTHandlerCallbacks != 0) { g_pfnWDTHandlerCallbacks[0](0, 0, 0, 0); } else { while(1); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Disable the assertion of SUPC interrupt signal when a supply monitor detection occurs. */
void supc_disable_monitor_interrupt(Supc *p_supc)
/* Disable the assertion of SUPC interrupt signal when a supply monitor detection occurs. */ void supc_disable_monitor_interrupt(Supc *p_supc)
{ p_supc->SUPC_SMMR &= ~SUPC_SMMR_SMIEN; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Enable or disable the BMA222 sleep mode. This routine enables or disables the BMA222 sleep mode depending upon the value of the \sleep parameter; a \true value enables sleep mode and a \false value disables sleep mode by setting or clearing the 'sleep_en' bit, respectively. */
static void bma222_sleep_en(sensor_hal_t *hal, bool sleep)
/* Enable or disable the BMA222 sleep mode. This routine enables or disables the BMA222 sleep mode depending upon the value of the \sleep parameter; a \true value enables sleep mode and a \false value disables sleep mode by setting or clearing the 'sleep_en' bit, respectively. */ static void bma222_sleep_en(sensor_hal_t *hal, bool sleep)
{ uint8_t const power_mode_val = (sleep == true) ? (BMA222_LOWPOWER_EN | BMA222_SLEEP_DUR_1ms) : 0; sensor_bus_put(hal, BMA222_POWER_MODES, power_mode_val); }
memfault/zero-to-main
C++
null
200
/* A CAM has been removed => shut it down. */
static int dvb_ca_en50221_slot_shutdown(struct dvb_ca_private *ca, int slot)
/* A CAM has been removed => shut it down. */ static int dvb_ca_en50221_slot_shutdown(struct dvb_ca_private *ca, int slot)
{ dprintk("%s\n", __func__); ca->pub->slot_shutdown(ca->pub, slot); ca->slot_info[slot].slot_state = DVB_CA_SLOTSTATE_NONE; wake_up_interruptible(&ca->wait_queue); dprintk("Slot %i shutdown\n", slot); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* ufshcd_init_query() - init the query response and request parameters */
static void ufshcd_init_query(struct ufs_hba *hba, struct ufs_query_req **request, struct ufs_query_res **response, enum query_opcode opcode, u8 idn, u8 index, u8 selector)
/* ufshcd_init_query() - init the query response and request parameters */ static void ufshcd_init_query(struct ufs_hba *hba, struct ufs_query_req **request, struct ufs_query_res **response, enum query_opcode opcode, u8 idn, u8 index, u8 selector)
{ *request = &hba->dev_cmd.query.request; *response = &hba->dev_cmd.query.response; memset(*request, 0, sizeof(struct ufs_query_req)); memset(*response, 0, sizeof(struct ufs_query_res)); (*request)->upiu_req.opcode = opcode; (*request)->upiu_req.idn = idn; (*request)->upiu_req.index = index; (*request)->upiu_req.selector = selector; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Send a master data receive request with an NACK when the master have obtained control of the bus(Write Step2). For this function returns immediately, it is always using in the interrupt hander. */
void xI2CMasterReadLastRequestS2(unsigned long ulBase)
/* Send a master data receive request with an NACK when the master have obtained control of the bus(Write Step2). For this function returns immediately, it is always using in the interrupt hander. */ void xI2CMasterReadLastRequestS2(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE)); xHWREG(ulBase + I2C_CON) &= ~I2C_CON_AA; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* macio_release_resources - Release reserved memory resources @dev: MacIO device whose resources were previously reserved */
void macio_release_resources(struct macio_dev *dev)
/* macio_release_resources - Release reserved memory resources @dev: MacIO device whose resources were previously reserved */ void macio_release_resources(struct macio_dev *dev)
{ int i; for (i = 0; i < dev->n_resources; i++) macio_release_resource(dev, i); }
robutest/uclinux
C++
GPL-2.0
60
/* Return value: Number of bytes in the utf8 string or 0 if an invalid unicode character */
int _cairo_ucs4_to_utf8(uint32_t unicode, char *utf8)
/* Return value: Number of bytes in the utf8 string or 0 if an invalid unicode character */ int _cairo_ucs4_to_utf8(uint32_t unicode, char *utf8)
{ int bytes; char *p; if (unicode < 0x80) { if (utf8) *utf8 = unicode; return 1; } else if (unicode < 0x800) { bytes = 2; } else if (unicode < 0x10000) { bytes = 3; } else if (unicode < 0x200000) { bytes = 4; } else { return 0; } if (!utf8) return bytes; p = utf8 + bytes; while (p > utf8) { *--p = 0x80 | (unicode & 0x3f); unicode >>= 6; } *p |= 0xf0 << (4 - bytes); return bytes; }
xboot/xboot
C++
MIT License
779
/* Checks APs status and updates APs status if needed. */
VOID CheckAndUpdateApsStatus(VOID)
/* Checks APs status and updates APs status if needed. */ VOID CheckAndUpdateApsStatus(VOID)
{ UINTN ProcessorNumber; EFI_STATUS Status; CPU_MP_DATA *CpuMpData; CpuMpData = GetCpuMpData (); if (CpuMpData->WaitEvent != NULL) { Status = CheckAllAPs (); if (Status != EFI_NOT_READY) { Status = gBS->SignalEvent (CpuMpData->WaitEvent); CpuMpData->WaitEvent = NULL; } } for (ProcessorNumber = 0; ProcessorNumber < CpuMpData->CpuCount; ProcessorNumber++) { if (CpuMpData->CpuData[ProcessorNumber].WaitEvent == NULL) { continue; } Status = CheckThisAP (ProcessorNumber); if (Status != EFI_NOT_READY) { gBS->SignalEvent (CpuMpData->CpuData[ProcessorNumber].WaitEvent); CpuMpData->CpuData[ProcessorNumber].WaitEvent = NULL; } } }
tianocore/edk2
C++
Other
4,240
/* Read from a Port. Read the current value of the given GPIO port. Only the lower 16 bits contain valid pin data. */
uint16_t gpio_port_read(uint32_t gpioport)
/* Read from a Port. Read the current value of the given GPIO port. Only the lower 16 bits contain valid pin data. */ uint16_t gpio_port_read(uint32_t gpioport)
{ return (uint16_t)GPIO_IDR(gpioport); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Disable the SPI interrupt of the specified SPI port. This function is to disable the SPI interrupt of the specified SPI port */
void SPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
/* Disable the SPI interrupt of the specified SPI port. This function is to disable the SPI interrupt of the specified SPI port */ void SPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags)
{ xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)); xHWREG(ulBase + SPI_CR2) &= ~ulIntFlags; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Can sleep, may be called under the atomic_read_lock mutex but this is not guaranteed. */
static void check_unthrottle(struct tty_struct *tty)
/* Can sleep, may be called under the atomic_read_lock mutex but this is not guaranteed. */ static void check_unthrottle(struct tty_struct *tty)
{ if (tty->count) tty_unthrottle(tty); }
robutest/uclinux
C++
GPL-2.0
60
/* Sends a byte through the SPI interface and return the byte received from the SPI bus. */
uint8_t sFLASH_SendByte(uint8_t byte)
/* Sends a byte through the SPI interface and return the byte received from the SPI bus. */ uint8_t sFLASH_SendByte(uint8_t byte)
{ while (SPI_I2S_GetFlagStatus(sFLASH_SPI, SPI_I2S_FLAG_TXE) == RESET); SPI_I2S_SendData(sFLASH_SPI, byte); while (SPI_I2S_GetFlagStatus(sFLASH_SPI, SPI_I2S_FLAG_RXNE) == RESET); return SPI_I2S_ReceiveData(sFLASH_SPI); }
avem-labs/Avem
C++
MIT License
1,752
/* We don't have to worry about flush_dcache_page() as this only works with private pages. If, say, we were to do directed receive to pinned user pages we'd have to worry more about cache coherence. (Though the flush_dcache_page() in get_user_pages() would probably be enough). */
int rds_page_copy_user(struct page *page, unsigned long offset, void __user *ptr, unsigned long bytes, int to_user)
/* We don't have to worry about flush_dcache_page() as this only works with private pages. If, say, we were to do directed receive to pinned user pages we'd have to worry more about cache coherence. (Though the flush_dcache_page() in get_user_pages() would probably be enough). */ int rds_page_copy_user(struct page *page, unsigned long offset, void __user *ptr, unsigned long bytes, int to_user)
{ unsigned long ret; void *addr; if (to_user) rds_stats_add(s_copy_to_user, bytes); else rds_stats_add(s_copy_from_user, bytes); addr = kmap_atomic(page, KM_USER0); if (to_user) ret = __copy_to_user_inatomic(ptr, addr + offset, bytes); else ret = __copy_from_user_inatomic(addr + offset, ptr, bytes); kunmap_atomic(addr, KM_USER0); if (ret) { addr = kmap(page); if (to_user) ret = copy_to_user(ptr, addr + offset, bytes); else ret = copy_from_user(addr + offset, ptr, bytes); kunmap(page); if (ret) return -EFAULT; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Normally called from arch_cpu_idle(): the idle loop will call this function to set the CPU to "sleep". Others may also call this function with care. The CPU will be set to sleep until some interrupt awakes it. Interrupts should be enabled before calling. */
void posix_halt_cpu(void)
/* Normally called from arch_cpu_idle(): the idle loop will call this function to set the CPU to "sleep". Others may also call this function with care. The CPU will be set to sleep until some interrupt awakes it. Interrupts should be enabled before calling. */ void posix_halt_cpu(void)
{ nce_halt_cpu(nce_st); posix_irq_handler(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Cache the DHCPv6 ack packet, and parse it on demand. */
EFI_STATUS PxeBcCopyDhcp6Ack(IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP6_PACKET *Ack, IN BOOLEAN Verified)
/* Cache the DHCPv6 ack packet, and parse it on demand. */ EFI_STATUS PxeBcCopyDhcp6Ack(IN PXEBC_PRIVATE_DATA *Private, IN EFI_DHCP6_PACKET *Ack, IN BOOLEAN Verified)
{ EFI_PXE_BASE_CODE_MODE *Mode; EFI_STATUS Status; Mode = Private->PxeBc.Mode; Status = PxeBcCacheDhcp6Packet (&Private->DhcpAck.Dhcp6.Packet.Ack, Ack); if (EFI_ERROR (Status)) { return Status; } if (Verified) { PxeBcParseDhcp6Packet (&Private->DhcpAck.Dhcp6); CopyMem (&Mode->DhcpAck.Dhcpv6, &Ack->Dhcp6, Ack->Length); Mode->DhcpAckReceived = TRUE; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This function returns %0 on success and a negative error code on failure. */
static int read_ltab(struct ubifs_info *c)
/* This function returns %0 on success and a negative error code on failure. */ static int read_ltab(struct ubifs_info *c)
{ int err; void *buf; buf = vmalloc(c->ltab_sz); if (!buf) return -ENOMEM; err = ubi_read(c->ubi, c->ltab_lnum, buf, c->ltab_offs, c->ltab_sz); if (err) goto out; err = unpack_ltab(c, buf); out: vfree(buf); return err; }
EmcraftSystems/u-boot
C++
Other
181
/* Reads a byte from the I2C receive FIFO. */
uint32_t I2CFIFODataGet(uint32_t ui32Base)
/* Reads a byte from the I2C receive FIFO. */ uint32_t I2CFIFODataGet(uint32_t ui32Base)
{ ASSERT(_I2CBaseValid(ui32Base)); while (HWREG(ui32Base + I2C_O_FIFOSTATUS) & I2C_FIFOSTATUS_RXFE) { } return (HWREG(ui32Base + I2C_O_FIFODATA)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Dequeue a receive skb and its corresponding ring entry. The ring entry is returned, *pskb is updated to point to the skb. */
static u64 octeon_mgmt_dequeue_rx_buffer(struct octeon_mgmt *p, struct sk_buff **pskb)
/* Dequeue a receive skb and its corresponding ring entry. The ring entry is returned, *pskb is updated to point to the skb. */ static u64 octeon_mgmt_dequeue_rx_buffer(struct octeon_mgmt *p, struct sk_buff **pskb)
{ union mgmt_port_ring_entry re; dma_sync_single_for_cpu(p->dev, p->rx_ring_handle, ring_size_to_bytes(OCTEON_MGMT_RX_RING_SIZE), DMA_BIDIRECTIONAL); re.d64 = p->rx_ring[p->rx_next]; p->rx_next = (p->rx_next + 1) % OCTEON_MGMT_RX_RING_SIZE; p->rx_current_fill--; *pskb = __skb_dequeue(&p->rx_list); dma_unmap_single(p->dev, re.s.addr, ETH_FRAME_LEN + OCTEON_MGMT_RX_HEADROOM, DMA_FROM_DEVICE); return re.d64; }
robutest/uclinux
C++
GPL-2.0
60
/* If doing a CI lookup and case-insensitive match, dup actual name into args.value. Return EEXIST for success (ie. name found) or an error. */
int xfs_dir_cilookup_result(struct xfs_da_args *args, const char *name, int len)
/* If doing a CI lookup and case-insensitive match, dup actual name into args.value. Return EEXIST for success (ie. name found) or an error. */ int xfs_dir_cilookup_result(struct xfs_da_args *args, const char *name, int len)
{ if (args->cmpresult == XFS_CMP_DIFFERENT) return ENOENT; if (args->cmpresult != XFS_CMP_CASE || !(args->op_flags & XFS_DA_OP_CILOOKUP)) return EEXIST; args->value = kmem_alloc(len, KM_NOFS | KM_MAYFAIL); if (!args->value) return ENOMEM; memcpy(args->value, name, len); args->valuelen = len; return EEXIST; }
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes shelton first version */
void system_clock_config(void)
/* Change Logs: Date Author Notes shelton first version */ void system_clock_config(void)
{ flash_psr_set(FLASH_WAIT_CYCLE_2); crm_reset(); crm_clock_source_enable(CRM_CLOCK_SOURCE_HEXT, TRUE); while(crm_hext_stable_wait() == ERROR) { } crm_pll_config(CRM_PLL_SOURCE_HEXT, CRM_PLL_MULT_12); crm_clock_source_enable(CRM_CLOCK_SOURCE_PLL, TRUE); while(crm_flag_get(CRM_PLL_STABLE_FLAG) != SET) { } crm_ahb_div_set(CRM_AHB_DIV_1); crm_apb2_div_set(CRM_APB2_DIV_1); crm_apb1_div_set(CRM_APB1_DIV_1); crm_sysclk_switch(CRM_SCLK_PLL); while(crm_sysclk_switch_status_get() != CRM_SCLK_PLL) { } system_core_clock_update(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Data must describe a GIC interrupt. A GIC interrupt is on at least 3 UINT32 cells. This function DOES NOT SUPPORT extended SPI range and extended PPI range. */
UINT32 EFIAPI FdtGetInterruptId(UINT32 CONST *Data)
/* Data must describe a GIC interrupt. A GIC interrupt is on at least 3 UINT32 cells. This function DOES NOT SUPPORT extended SPI range and extended PPI range. */ UINT32 EFIAPI FdtGetInterruptId(UINT32 CONST *Data)
{ UINT32 IrqType; UINT32 IrqId; ASSERT (Data != NULL); IrqType = fdt32_to_cpu (Data[IRQ_TYPE_OFFSET]); IrqId = fdt32_to_cpu (Data[IRQ_NUMBER_OFFSET]); switch (IrqType) { case DT_SPI_IRQ: IrqId += SPI_OFFSET; break; case DT_PPI_IRQ: IrqId += PPI_OFFSET; break; default: ASSERT (0); IrqId = 0; } return IrqId; }
tianocore/edk2
C++
Other
4,240
/* This function returns %0 on success and a negative error code on failure. */
static int recover_head(const struct ubifs_info *c, int lnum, int offs, void *sbuf)
/* This function returns %0 on success and a negative error code on failure. */ static int recover_head(const struct ubifs_info *c, int lnum, int offs, void *sbuf)
{ int len, err; if (c->min_io_size > 1) len = c->min_io_size; else len = 512; if (offs + len > c->leb_size) len = c->leb_size - offs; if (!len) return 0; err = ubi_read(c->ubi, lnum, sbuf, offs, len); if (err || !is_empty(sbuf, len)) { dbg_rcvry("cleaning head at %d:%d", lnum, offs); if (offs == 0) return ubifs_leb_unmap(c, lnum); err = ubi_read(c->ubi, lnum, sbuf, 0, offs); if (err) return err; return ubi_leb_change(c->ubi, lnum, sbuf, offs, UBI_UNKNOWN); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM1) { __HAL_RCC_TIM1_CLK_DISABLE(); } else if(htim_base->Instance==TIM2) { __HAL_RCC_TIM2_CLK_DISABLE(); } else if(htim_base->Instance==TIM3) { __HAL_RCC_TIM3_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configures one or more pin(s) or a PIO controller as inputs. Optionally, the corresponding internal pull-up(s) and glitch filter(s) can be enabled. */
static void PIO_SetInput(AT91S_PIO *pio, unsigned int mask, unsigned char enablePullUp, unsigned char enableFilter)
/* Configures one or more pin(s) or a PIO controller as inputs. Optionally, the corresponding internal pull-up(s) and glitch filter(s) can be enabled. */ static void PIO_SetInput(AT91S_PIO *pio, unsigned int mask, unsigned char enablePullUp, unsigned char enableFilter)
{ pio->PIO_IDR = mask; if (enablePullUp) { pio->PIO_PPUER = mask; } else { pio->PIO_PPUDR = mask; } if (enableFilter) { pio->PIO_IFER = mask; } else { pio->PIO_IFDR = mask; } pio->PIO_ODR = mask; pio->PIO_PER = mask; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* aac_rx_select_comm - Select communications method @dev: Adapter @comm: communications method */
int aac_rx_select_comm(struct aac_dev *dev, int comm)
/* aac_rx_select_comm - Select communications method @dev: Adapter @comm: communications method */ int aac_rx_select_comm(struct aac_dev *dev, int comm)
{ switch (comm) { case AAC_COMM_PRODUCER: dev->a_ops.adapter_enable_int = aac_rx_enable_interrupt_producer; dev->a_ops.adapter_intr = aac_rx_intr_producer; dev->a_ops.adapter_deliver = aac_rx_deliver_producer; break; case AAC_COMM_MESSAGE: dev->a_ops.adapter_enable_int = aac_rx_enable_interrupt_message; dev->a_ops.adapter_intr = aac_rx_intr_message; dev->a_ops.adapter_deliver = aac_rx_deliver_message; break; default: return 1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* On auxiliary interface connect/disconnect SDO and OCS internal pull-up.. */
int32_t lsm6dso_aux_sdo_ocs_mode_get(stmdev_ctx_t *ctx, lsm6dso_ois_pu_dis_t *val)
/* On auxiliary interface connect/disconnect SDO and OCS internal pull-up.. */ int32_t lsm6dso_aux_sdo_ocs_mode_get(stmdev_ctx_t *ctx, lsm6dso_ois_pu_dis_t *val)
{ lsm6dso_pin_ctrl_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_PIN_CTRL, (uint8_t *)&reg, 1); switch (reg.ois_pu_dis) { case LSM6DSO_AUX_PULL_UP_DISC: *val = LSM6DSO_AUX_PULL_UP_DISC; break; case LSM6DSO_AUX_PULL_UP_CONNECT: *val = LSM6DSO_AUX_PULL_UP_CONNECT; break; default: *val = LSM6DSO_AUX_PULL_UP_DISC; break; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* This function will close the pipe and release the pipe buffer. */
rt_err_t rt_pipe_close(rt_device_t device)
/* This function will close the pipe and release the pipe buffer. */ rt_err_t rt_pipe_close(rt_device_t device)
{ rt_pipe_t *pipe = (rt_pipe_t *)device; if (device == RT_NULL) { return -RT_EINVAL; } rt_mutex_take(&pipe->lock, RT_WAITING_FOREVER); rt_ringbuffer_destroy(pipe->fifo); pipe->fifo = RT_NULL; rt_mutex_release(&pipe->lock); return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function actually applies the mapping to the page table of the dma_ops domain. */
static int dma_ops_unity_map(struct dma_ops_domain *dma_dom, struct unity_map_entry *e)
/* This function actually applies the mapping to the page table of the dma_ops domain. */ static int dma_ops_unity_map(struct dma_ops_domain *dma_dom, struct unity_map_entry *e)
{ u64 addr; int ret; for (addr = e->address_start; addr < e->address_end; addr += PAGE_SIZE) { ret = iommu_map_page(&dma_dom->domain, addr, addr, e->prot, PM_MAP_4k); if (ret) return ret; if (addr < dma_dom->aperture_size) __set_bit(addr >> PAGE_SHIFT, dma_dom->aperture[0]->bitmap); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables I2C Extended Clock Timeout (SCL cumulative Timeout detection). */
void I2C_ExtendedClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
/* Enables or disables I2C Extended Clock Timeout (SCL cumulative Timeout detection). */ void I2C_ExtendedClockTimeoutCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
{ assert_param(IS_I2C_1_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { I2Cx->TIMEOUTR |= I2C_TIMEOUTR_TEXTEN; } else { I2Cx->TIMEOUTR &= (uint32_t)~((uint32_t)I2C_TIMEOUTR_TEXTEN); } }
ajhc/demo-cortex-m3
C++
null
38
/* Manages the multicast receive filters of a network interface. */
EFI_STATUS EFIAPI EmuSnpReceiveFilters(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINT32 EnableBits, IN UINT32 DisableBits, IN BOOLEAN ResetMcastFilter, IN UINTN McastFilterCount OPTIONAL, IN EFI_MAC_ADDRESS *McastFilter OPTIONAL)
/* Manages the multicast receive filters of a network interface. */ EFI_STATUS EFIAPI EmuSnpReceiveFilters(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN UINT32 EnableBits, IN UINT32 DisableBits, IN BOOLEAN ResetMcastFilter, IN UINTN McastFilterCount OPTIONAL, IN EFI_MAC_ADDRESS *McastFilter OPTIONAL)
{ EFI_STATUS Status; EMU_SNP_PRIVATE_DATA *Private; Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This); Status = Private->Io->ReceiveFilters ( Private->Io, EnableBits, DisableBits, ResetMcastFilter, McastFilterCount, McastFilter ); return Status; }
tianocore/edk2
C++
Other
4,240
/* ZigBee Device Profile dissector for the extended address */
void dissect_zbee_zdp_req_ext_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the extended address */ void dissect_zbee_zdp_req_ext_addr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint16 device; device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); zbee_parse_uint(tree, hf_zbee_zdp_req_type, tvb, &offset, sizeof(guint8), NULL); zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */
UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value)
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */ UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value)
{ BOOLEAN Flag; ASSERT ((Address & 7) == 0); Flag = FilterBeforeMmIoWrite (FilterWidth64, Address, &Value); if (Flag) { MmioWrite64Internal (Address, Value); } FilterAfterMmIoWrite (FilterWidth64, Address, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* param base DCP peripheral base address param handle Handle used for this request. param plaintext Input plain text to encrypt param ciphertext Output cipher text param size Size of input and output data in bytes. Must be multiple of 16 bytes. return Status from encrypt operation */
status_t DCP_AES_EncryptEcb(DCP_Type *base, dcp_handle_t *handle, const uint8_t *plaintext, uint8_t *ciphertext, size_t size)
/* param base DCP peripheral base address param handle Handle used for this request. param plaintext Input plain text to encrypt param ciphertext Output cipher text param size Size of input and output data in bytes. Must be multiple of 16 bytes. return Status from encrypt operation */ status_t DCP_AES_EncryptEcb(DCP_Type *base, dcp_handle_t *handle, const uint8_t *plaintext, uint8_t *ciphertext, size_t size)
{ status_t completionStatus = kStatus_Fail; dcp_work_packet_t dcpWork = {0}; do { completionStatus = DCP_AES_EncryptEcbNonBlocking(base, handle, &dcpWork, plaintext, ciphertext, size); } while (completionStatus == kStatus_DCP_Again); if (completionStatus != kStatus_Success) { return completionStatus; } return DCP_WaitForChannelComplete(base, handle); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This will search for a matching channel:id:lun in the scsi_lookup array, returning 1 if found. */
static u8 _scsih_scsi_lookup_find_by_lun(struct MPT2SAS_ADAPTER *ioc, int id, unsigned int lun, int channel)
/* This will search for a matching channel:id:lun in the scsi_lookup array, returning 1 if found. */ static u8 _scsih_scsi_lookup_find_by_lun(struct MPT2SAS_ADAPTER *ioc, int id, unsigned int lun, int channel)
{ u8 found; unsigned long flags; int i; spin_lock_irqsave(&ioc->scsi_lookup_lock, flags); found = 0; for (i = 0 ; i < ioc->scsiio_depth; i++) { if (ioc->scsi_lookup[i].scmd && (ioc->scsi_lookup[i].scmd->device->id == id && ioc->scsi_lookup[i].scmd->device->channel == channel && ioc->scsi_lookup[i].scmd->device->lun == lun)) { found = 1; goto out; } } out: spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); return found; }
robutest/uclinux
C++
GPL-2.0
60
/* If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServicePkcs7Sign(IN CONST UINT8 *PrivateKey, IN UINTN PrivateKeySize, IN CONST UINT8 *KeyPassword, IN UINT8 *InData, IN UINTN InDataSize, IN UINT8 *SignCert, IN UINT8 *OtherCerts OPTIONAL, OUT UINT8 **SignedData, OUT UINTN *SignedDataSize)
/* If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServicePkcs7Sign(IN CONST UINT8 *PrivateKey, IN UINTN PrivateKeySize, IN CONST UINT8 *KeyPassword, IN UINT8 *InData, IN UINTN InDataSize, IN UINT8 *SignCert, IN UINT8 *OtherCerts OPTIONAL, OUT UINT8 **SignedData, OUT UINTN *SignedDataSize)
{ return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7Sign, Pkcs7Sign, (PrivateKey, PrivateKeySize, KeyPassword, InData, InDataSize, SignCert, OtherCerts, SignedData, SignedDataSize), FALSE); }
tianocore/edk2
C++
Other
4,240
/* param base Pointer to FLEXIO_I2C_Type structure param handle Pointer to flexio_i2c_master_handle_t structure which stores the transfer state param xfer pointer to flexio_i2c_master_transfer_t structure retval kStatus_Success Successfully start a transfer. retval kStatus_FLEXIO_I2C_Busy FlexIO I2C is not idle, is running another transfer. */
status_t FLEXIO_I2C_MasterTransferNonBlocking(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle, flexio_i2c_master_transfer_t *xfer)
/* param base Pointer to FLEXIO_I2C_Type structure param handle Pointer to flexio_i2c_master_handle_t structure which stores the transfer state param xfer pointer to flexio_i2c_master_transfer_t structure retval kStatus_Success Successfully start a transfer. retval kStatus_FLEXIO_I2C_Busy FlexIO I2C is not idle, is running another transfer. */ status_t FLEXIO_I2C_MasterTransferNonBlocking(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle, flexio_i2c_master_transfer_t *xfer)
{ assert(handle); assert(xfer); if (handle->state != kFLEXIO_I2C_Idle) { return kStatus_FLEXIO_I2C_Busy; } else { FLEXIO_I2C_MasterTransferInitStateMachine(base, handle, xfer); FLEXIO_I2C_MasterEnableInterrupts(base, kFLEXIO_I2C_TxEmptyInterruptEnable | kFLEXIO_I2C_RxFullInterruptEnable); return kStatus_Success; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configures the board hardware and chip peripherals for the demo's functionality. */
static void SetupHardware(void)
/* Configures the board hardware and chip peripherals for the demo's functionality. */ static void SetupHardware(void)
{ MCUSR &= ~(1 << WDRF); wdt_disable(); clock_prescale_set(clock_div_1); MCUCR = (1 << IVCE); MCUCR = (1 << IVSEL); LEDs_Init(); USB_Init(); TIMSK1 = (1 << TOIE1); TCCR1B = ((1 << CS11) | (1 << CS10)); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This optional function does a "fast" set of critical region protection to the value specified by pval. See the documentation for sys_arch_protect() for more information. This function is only required if your port is supporting an operating system. */
void sys_arch_unprotect(sys_prot_t pval)
/* This optional function does a "fast" set of critical region protection to the value specified by pval. See the documentation for sys_arch_protect() for more information. This function is only required if your port is supporting an operating system. */ void sys_arch_unprotect(sys_prot_t pval)
{ ( void )pval; vPortExitCritical( ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Implement CPU time clocks for the POSIX clock interface. Called after updating RLIMIT_CPU to set timer expiration if necessary. */
void update_rlimit_cpu(unsigned long rlim_new)
/* Implement CPU time clocks for the POSIX clock interface. Called after updating RLIMIT_CPU to set timer expiration if necessary. */ void update_rlimit_cpu(unsigned long rlim_new)
{ cputime_t cputime = secs_to_cputime(rlim_new); struct signal_struct *const sig = current->signal; if (cputime_eq(sig->it[CPUCLOCK_PROF].expires, cputime_zero) || cputime_gt(sig->it[CPUCLOCK_PROF].expires, cputime)) { spin_lock_irq(&current->sighand->siglock); set_process_cpu_timer(current, CPUCLOCK_PROF, &cputime, NULL); spin_unlock_irq(&current->sighand->siglock); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Computes the 8-bit CRC of a given 8-bit data. */
uint32_t CRC_CalcCRC8bits(uint8_t CRC_Data)
/* Computes the 8-bit CRC of a given 8-bit data. */ uint32_t CRC_CalcCRC8bits(uint8_t CRC_Data)
{ *(uint8_t*)(CRC_BASE) = (uint8_t) CRC_Data; return (CRC->DR); }
ajhc/demo-cortex-m3
C++
null
38
/* Basically undoes what has been done in nanddev_init(). */
void nanddev_cleanup(struct nand_device *nand)
/* Basically undoes what has been done in nanddev_init(). */ void nanddev_cleanup(struct nand_device *nand)
{ if (nanddev_bbt_is_initialized(nand)) nanddev_bbt_cleanup(nand); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Cousin of drbd_request_state(), useful with the CS_WAIT_COMPLETE flag, or when logging of failed state change requests is not desired. */
int _drbd_request_state(struct drbd_conf *mdev, union drbd_state mask, union drbd_state val, enum chg_state_flags f)
/* Cousin of drbd_request_state(), useful with the CS_WAIT_COMPLETE flag, or when logging of failed state change requests is not desired. */ int _drbd_request_state(struct drbd_conf *mdev, union drbd_state mask, union drbd_state val, enum chg_state_flags f)
{ int rv; wait_event(mdev->state_wait, (rv = drbd_req_state(mdev, mask, val, f)) != SS_IN_TRANSIENT_STATE); return rv; }
robutest/uclinux
C++
GPL-2.0
60
/* 10.5.3.2.2 Authentication Failure parameter (UMTS and EPS authentication challenge) */
static guint16 de_auth_fail_param(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
/* 10.5.3.2.2 Authentication Failure parameter (UMTS and EPS authentication challenge) */ static guint16 de_auth_fail_param(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
{ proto_item *item; proto_tree *subtree; item = proto_tree_add_item(tree, hf_gsm_a_dtap_auts, tvb, offset, len, ENC_NA); subtree = proto_item_add_subtree(item, ett_gsm_dtap_elem[DE_AUTH_FAIL_PARAM]); if (len == 14) { proto_tree_add_item(subtree, hf_gsm_a_dtap_auts_sqn_ms_xor_ak, tvb, offset, 6, ENC_NA); proto_tree_add_item(subtree, hf_gsm_a_dtap_auts_mac_s, tvb, offset + 6, 8, ENC_NA); } else expert_add_info(pinfo, item, &ei_gsm_a_dtap_auts); return (len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* 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==LPUART1) { __HAL_RCC_LPUART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_1); } else if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10); } else if(huart->Instance==USART3) { __HAL_RCC_USART3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_4|GPIO_PIN_5); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* eap_peer_tls_decrypt - Decrypt received phase 2 TLS message @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() @data: Data for TLS processing @in_data: Message received from the server @in_decrypted: Buffer for returning a pointer to the decrypted message Returns: 0 on success, 1 if more input data is needed, or -1 on failure */
int eap_peer_tls_decrypt(struct eap_sm *sm, struct eap_ssl_data *data, const struct wpabuf *in_data, struct wpabuf **in_decrypted)
/* eap_peer_tls_decrypt - Decrypt received phase 2 TLS message @sm: Pointer to EAP state machine allocated with eap_peer_sm_init() @data: Data for TLS processing @in_data: Message received from the server @in_decrypted: Buffer for returning a pointer to the decrypted message Returns: 0 on success, 1 if more input data is needed, or -1 on failure */ int eap_peer_tls_decrypt(struct eap_sm *sm, struct eap_ssl_data *data, const struct wpabuf *in_data, struct wpabuf **in_decrypted)
{ const struct wpabuf *msg; int need_more_input; msg = eap_peer_tls_data_reassemble(data, in_data, &need_more_input); if (msg == NULL) return need_more_input ? 1 : -1; *in_decrypted = tls_connection_decrypt(data->ssl_ctx, data->conn, msg); eap_peer_tls_reset_input(data); if (*in_decrypted == NULL) { wpa_printf(MSG_INFO, "SSL: Failed to decrypt Phase 2 data"); return -1; } return 0; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* 0 aic7xxx 0 1 aic7xxx 1 2 expansion slot 3 N/C 4 N/C */
static int mkaddr(struct pci_bus *bus, unsigned int devfn, unsigned int reg)
/* 0 aic7xxx 0 1 aic7xxx 1 2 expansion slot 3 N/C 4 N/C */ static int mkaddr(struct pci_bus *bus, unsigned int devfn, unsigned int reg)
{ return ((bus->number & 0xff) << 16) | ((devfn & 0xff) << 8) | (reg & 0xfc); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function must not be called if the LIDD interface is currently configured to expect DMA transactions. If DMA was previously used to write to the panel, */
uint16_t LCDIDDStatusRead(uint32_t ui32Base, uint32_t ui32CS)
/* This function must not be called if the LIDD interface is currently configured to expect DMA transactions. If DMA was previously used to write to the panel, */ uint16_t LCDIDDStatusRead(uint32_t ui32Base, uint32_t ui32CS)
{ uint32_t ui32Reg; ASSERT(ui32Base == LCD0_BASE); ASSERT((ui32CS == 0) || (ui32CS == 1)); ui32Reg = ui32CS ? LCD_O_LIDDCS1ADDR : LCD_O_LIDDCS0ADDR; return((uint16_t)HWREG(ui32Base + ui32Reg)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* e1000_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */
static void e1000_tx_timeout(struct net_device *netdev)
/* e1000_tx_timeout - Respond to a Tx Hang @netdev: network interface device structure */ static void e1000_tx_timeout(struct net_device *netdev)
{ struct e1000_adapter *adapter = netdev_priv(netdev); adapter->tx_timeout_count++; schedule_work(&adapter->reset_task); }
robutest/uclinux
C++
GPL-2.0
60
/* We really should do dev_remove_pack() here, but this function can not be called at tasklet level. => Use eth_bearer->bearer as a flag to throw away incoming buffers, & postpone dev_remove_pack() to eth_media_stop() on exit. */
static void disable_bearer(struct tipc_bearer *tb_ptr)
/* We really should do dev_remove_pack() here, but this function can not be called at tasklet level. => Use eth_bearer->bearer as a flag to throw away incoming buffers, & postpone dev_remove_pack() to eth_media_stop() on exit. */ static void disable_bearer(struct tipc_bearer *tb_ptr)
{ ((struct eth_bearer *)tb_ptr->usr_handle)->bearer = NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266