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 |
|---|---|---|---|---|---|---|---|
/* If the TypeMerge is TRUE, Res resource type is changed to the type of destination resource type. If Dst is NULL or Res is NULL, ASSERT (). */ | VOID MergeResourceTree(IN PCI_RESOURCE_NODE *Dst, IN PCI_RESOURCE_NODE *Res, IN BOOLEAN TypeMerge) | /* If the TypeMerge is TRUE, Res resource type is changed to the type of destination resource type. If Dst is NULL or Res is NULL, ASSERT (). */
VOID MergeResourceTree(IN PCI_RESOURCE_NODE *Dst, IN PCI_RESOURCE_NODE *Res, IN BOOLEAN TypeMerge) | {
LIST_ENTRY *CurrentLink;
PCI_RESOURCE_NODE *Temp;
ASSERT (Dst != NULL);
ASSERT (Res != NULL);
while (!IsListEmpty (&Res->ChildList)) {
CurrentLink = Res->ChildList.ForwardLink;
Temp = RESOURCE_NODE_FROM_LINK (CurrentLink);
if (TypeMerge) {
Temp->ResType = Dst->ResType;
}
R... | tianocore/edk2 | C++ | Other | 4,240 |
/* Set up persistent memory. If we were given values, we patch the array of resources. Otherwise, persistent memory may be allocated anywhere at all. */ | static void __init pmem_setup_resource(void) | /* Set up persistent memory. If we were given values, we patch the array of resources. Otherwise, persistent memory may be allocated anywhere at all. */
static void __init pmem_setup_resource(void) | {
struct resource *resource;
resource = asic_resource_get("DiagPersistentMemory");
if (resource && pmemaddr && pmemlen) {
resource->start = phys_to_bus(pmemaddr - 0x80000000);
resource->end = resource->start + pmemlen - 1;
pr_info("persistent memory: start=0x%x end=0x%x\n",
resource->start, resource->end);... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function enables the interrupt according to the mask parameter. */ | void I2S_EnableInt(I2S_T *i2s, uint32_t u32Mask) | /* This function enables the interrupt according to the mask parameter. */
void I2S_EnableInt(I2S_T *i2s, uint32_t u32Mask) | {
i2s->IEN |= u32Mask;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Converts a text device path node to SD (Secure Digital) device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextSd(CHAR16 *TextDeviceNode) | /* Converts a text device path node to SD (Secure Digital) device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextSd(CHAR16 *TextDeviceNode) | {
CHAR16 *SlotNumberStr;
SD_DEVICE_PATH *Sd;
SlotNumberStr = GetNextParamStr (&TextDeviceNode);
Sd = (SD_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_SD_DP,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns 0 on success, errno on failure (as defined in errno.h) */ | static int __init et131x_init_module(void) | /* Returns 0 on success, errno on failure (as defined in errno.h) */
static int __init et131x_init_module(void) | {
if (et131x_speed_set < PARM_SPEED_DUPLEX_MIN ||
et131x_speed_set > PARM_SPEED_DUPLEX_MAX) {
printk(KERN_WARNING "et131x: invalid speed setting ignored.\n");
et131x_speed_set = 0;
}
return pci_register_driver(&et131x_driver);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This API is used to get the sleep timer mode in the register 0x12 bit 5. */ | BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_sleep_timer_mode(u8 *sleep_timer_u8) | /* This API is used to get the sleep timer mode in the register 0x12 bit 5. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_sleep_timer_mode(u8 *sleep_timer_u8) | {
u8 data_u8 = BMA2x2_INIT_VALUE;
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC
(p_bma2x2->dev_addr, BMA2x2_SLEEP_TIMER_REG,
&dat... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciAnd16(IN UINTN Address, IN UINT16 AndData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciAnd16(IN UINTN Address, IN UINT16 AndData) | {
return PciCf8And16 (Address, AndData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If called multiple times, then the data read will continue at the offset of the firmware configuration item where the previous read ended. */ | VOID EFIAPI QemuFwCfgReadBytes(IN UINTN Size, IN VOID *Buffer) | /* If called multiple times, then the data read will continue at the offset of the firmware configuration item where the previous read ended. */
VOID EFIAPI QemuFwCfgReadBytes(IN UINTN Size, IN VOID *Buffer) | {
if (InternalQemuFwCfgIsAvailable ()) {
InternalQemuFwCfgReadBytes (Size, Buffer);
} else {
ZeroMem (Buffer, Size);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Code generated for this function might be very inefficient for some CPUs. __div64_32() can be overridden by linking arch-specific assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S. */ | uint32_t __div64_32(uint64_t *n, uint32_t base) | /* Code generated for this function might be very inefficient for some CPUs. __div64_32() can be overridden by linking arch-specific assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S. */
uint32_t __div64_32(uint64_t *n, uint32_t base) | {
uint64_t rem = *n;
uint64_t b = base;
uint64_t res, d = 1;
uint32_t high = rem >> 32;
res = 0;
if (high >= base) {
high /= base;
res = (uint64_t) high << 32;
rem -= (uint64_t) (high*base) << 32;
}
while ((int64_t)b > 0 && b < rem) {
b = b+b;
d = d+d;
}
do {
if (rem >= b) {
rem -= b;
res +=... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* SYSCTRL LSTIMER Bus Clock Disable and Reset Assert. */ | void LL_SYSCTRL_LSTMR_ClkDisRstAssert(void) | /* SYSCTRL LSTIMER Bus Clock Disable and Reset Assert. */
void LL_SYSCTRL_LSTMR_ClkDisRstAssert(void) | {
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_LSTIMERBusClk_Dis(SYSCTRL);
__LL_SYSCTRL_LSTIMERSoftRst_Assert(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* tlsv1_client_get_keyblock_size - Get TLS key_block size @conn: TLSv1 client connection data from tlsv1_client_init() Returns: Size of the key_block for the negotiated cipher suite or -1 on failure */ | int tlsv1_client_get_keyblock_size(struct tlsv1_client *conn) | /* tlsv1_client_get_keyblock_size - Get TLS key_block size @conn: TLSv1 client connection data from tlsv1_client_init() Returns: Size of the key_block for the negotiated cipher suite or -1 on failure */
int tlsv1_client_get_keyblock_size(struct tlsv1_client *conn) | {
if (conn->state == CLIENT_HELLO || conn->state == SERVER_HELLO)
return -1;
return 2 * (conn->rl.hash_size + conn->rl.key_material_len +
conn->rl.iv_size);
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* This function extracts the port where the protocol is mapped to. */ | static uint8_t _getPortFromProtocol(uint8_t uc_p_type) | /* This function extracts the port where the protocol is mapped to. */
static uint8_t _getPortFromProtocol(uint8_t uc_p_type) | {
uint8_t i;
for (i = 0; i < NUM_PROTOCOLS; i++) {
if ((uc_p_type < 0x10) && (usi_cfg_map_protocols[i].uc_p_type == MNGP_PRIME_PROT)) {
return usi_cfg_map_protocols[i].uc_port;
}
if (usi_cfg_map_protocols[i].uc_p_type == uc_p_type) {
return usi_cfg_map_protocols[i].uc_port;
}
}
return (uint8_t)USI_STA... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function will be called after sclp_facilities_detect(), which gets called from early.c code. Therefore the sccb should have valid contents. */ | void __init sclp_get_ipl_info(struct sclp_ipl_info *info) | /* This function will be called after sclp_facilities_detect(), which gets called from early.c code. Therefore the sccb should have valid contents. */
void __init sclp_get_ipl_info(struct sclp_ipl_info *info) | {
struct read_info_sccb *sccb;
if (!early_read_info_sccb_valid)
return;
sccb = &early_read_info_sccb;
info->is_valid = 1;
if (sccb->flags & 0x2)
info->has_dump = 1;
memcpy(&info->loadparm, &sccb->loadparm, LOADPARM_LEN);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the FLASH Prefetch Buffer status is set or not. */ | FlagStatus FLASH_GetPrefetchBufferStatus(void) | /* Checks whether the FLASH Prefetch Buffer status is set or not. */
FlagStatus FLASH_GetPrefetchBufferStatus(void) | {
FlagStatus bitstatus = RESET;
if ((FLASH->ACR & FLASH_ACR_PRFTBS) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* The upper layer software is responsible for re-configuring (if necessary) and restarting the QSPI device after the reset. */ | void XQspiPs_Reset(XQspiPs *InstancePtr) | /* The upper layer software is responsible for re-configuring (if necessary) and restarting the QSPI device after the reset. */
void XQspiPs_Reset(XQspiPs *InstancePtr) | {
u32 ConfigReg;
Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
XQspiPs_Abort(InstancePtr);
ConfigReg = XQspiPs_ReadReg(InstancePtr->Config.BaseAddress,
XQSPIPS_CR_OFFSET);
ConfigReg |= XQSPIPS_CR_RESET_MASK_SET;
ConfigReg &= ~XQSPIPS_CR_RESET_MASK_CLR;
... | ua1arn/hftrx | C++ | null | 69 |
/* Sets the functional address for the device that is connected to an endpoint in host mode. */ | void USBHostAddrSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Addr, uint32_t ui32Flags) | /* Sets the functional address for the device that is connected to an endpoint in host mode. */
void USBHostAddrSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Addr, uint32_t ui32Flags) | {
ASSERT(ui32Base == USB0_BASE);
ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) ||
(ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) ||
(ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) ||
(ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7));
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Decodes the message length according to the MQTT algorithm, non-blocking */ | static int MQTTPacket_decodenb(MQTTTransport *trp) | /* Decodes the message length according to the MQTT algorithm, non-blocking */
static int MQTTPacket_decodenb(MQTTTransport *trp) | {
trp->multiplier = 1;
trp->rem_len = 0;
}
do {
int frc;
if (trp->len >= MAX_NO_OF_REMAINING_LENGTH_BYTES)
goto exit;
if ((frc = (*trp->getfn)(trp->sck, &c, 1)) == -1)
goto exit;
if (frc == 0) {
rc = 0;
goto exit;
... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* int2_pin_detect_4d: 4D enable: 4D detection is enabled on INT2 pin when 6D bit on INT2_CFG (34h) is set to 1. */ | int32_t lis2dh12_int2_pin_detect_4d_set(stmdev_ctx_t *ctx, uint8_t val) | /* int2_pin_detect_4d: 4D enable: 4D detection is enabled on INT2 pin when 6D bit on INT2_CFG (34h) is set to 1. */
int32_t lis2dh12_int2_pin_detect_4d_set(stmdev_ctx_t *ctx, uint8_t val) | {
lis2dh12_ctrl_reg5_t ctrl_reg5;
int32_t ret;
ret = lis2dh12_read_reg(ctx, LIS2DH12_CTRL_REG5,
(uint8_t *)&ctrl_reg5, 1);
if (ret == 0)
{
ctrl_reg5.d4d_int2 = val;
ret = lis2dh12_write_reg(ctx, LIS2DH12_CTRL_REG5,
(uint8_t *)&ctrl_reg5, 1);
}
... | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Output: PRT_RFD pRfd (pRfd->Status.TimeStampHigh is updated) (pRfd->Status.TimeStampLow is updated) Return: None */ | static void UpdateRxPktTimeStamp8190(struct net_device *dev, struct ieee80211_rx_stats *stats) | /* Output: PRT_RFD pRfd (pRfd->Status.TimeStampHigh is updated) (pRfd->Status.TimeStampLow is updated) Return: None */
static void UpdateRxPktTimeStamp8190(struct net_device *dev, struct ieee80211_rx_stats *stats) | {
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
if(stats->bIsAMPDU && !stats->bFirstMPDU) {
stats->mac_time[0] = priv->LastRxDescTSFLow;
stats->mac_time[1] = priv->LastRxDescTSFHigh;
} else {
priv->LastRxDescTSFLow = stats->mac_time[0];
priv->LastRxDescTSFHigh = stats->mac_time[1];
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* hubdev_init_node() - Creates the HUB data structure and link them to it's own NODE specific data area. */ | void __init hubdev_init_node(nodepda_t *npda, cnodeid_t node) | /* hubdev_init_node() - Creates the HUB data structure and link them to it's own NODE specific data area. */
void __init hubdev_init_node(nodepda_t *npda, cnodeid_t node) | {
struct hubdev_info *hubdev_info;
int size;
pg_data_t *pg;
size = sizeof(struct hubdev_info);
if (node >= num_online_nodes())
pg = NODE_DATA(0);
else
pg = NODE_DATA(node);
hubdev_info = (struct hubdev_info *)alloc_bootmem_node(pg, size);
npda->pdinfo = (void *)hubdev_info;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, then ASSERT(). */ | VOID EFIAPI FreePool(IN VOID *Buffer) | /* If Buffer was not allocated with a pool allocation function in the Memory Allocation Library, then ASSERT(). */
VOID EFIAPI FreePool(IN VOID *Buffer) | {
EFI_STATUS Status;
Status = CoreFreePool (Buffer);
ASSERT_EFI_ERROR (Status);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The result of unregistration is reported via dprintk for those who want verification of the result, but is otherwise not important. */ | static void svc_unregister(const struct svc_serv *serv) | /* The result of unregistration is reported via dprintk for those who want verification of the result, but is otherwise not important. */
static void svc_unregister(const struct svc_serv *serv) | {
struct svc_program *progp;
unsigned long flags;
unsigned int i;
clear_thread_flag(TIF_SIGPENDING);
for (progp = serv->sv_program; progp; progp = progp->pg_next) {
for (i = 0; i < progp->pg_nvers; i++) {
if (progp->pg_vers[i] == NULL)
continue;
if (progp->pg_vers[i]->vs_hidden)
continue;
__svc_... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* we need to reverse all data we recieve from the mcu due to its physical location returns : 01110111 -> 11101110 */ | u8 jornada_ssp_reverse(u8 byte) | /* we need to reverse all data we recieve from the mcu due to its physical location returns : 01110111 -> 11101110 */
u8 jornada_ssp_reverse(u8 byte) | {
return
((0x80 & byte) >> 7) |
((0x40 & byte) >> 5) |
((0x20 & byte) >> 3) |
((0x10 & byte) >> 1) |
((0x08 & byte) << 1) |
((0x04 & byte) << 3) |
((0x02 & byte) << 5) |
((0x01 & byte) << 7);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* At some point this and xfs_trans_next_item() should be optimized to quickly look at the mask to determine if there is anything to look at. */ | xfs_log_item_desc_t* xfs_trans_first_item(xfs_trans_t *tp) | /* At some point this and xfs_trans_next_item() should be optimized to quickly look at the mask to determine if there is anything to look at. */
xfs_log_item_desc_t* xfs_trans_first_item(xfs_trans_t *tp) | {
xfs_log_item_chunk_t *licp;
int i;
licp = &tp->t_items;
if (xfs_lic_are_all_free(licp)) {
licp = licp->lic_next;
}
ASSERT(!xfs_lic_are_all_free(licp));
for (i = 0; i < licp->lic_unused; i++) {
if (xfs_lic_isfree(licp, i)) {
continue;
}
return xfs_lic_slot(licp, i);
}
cmn_err(CE_WARN, "xfs_trans_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Apply the timings of the proper unit (master/slave) to the shared timing register when selecting that unit. This version is for ASICs with a dual timing register (Kauai) */ | static void pmac_ide_kauai_apply_timings(ide_drive_t *drive) | /* Apply the timings of the proper unit (master/slave) to the shared timing register when selecting that unit. This version is for ASICs with a dual timing register (Kauai) */
static void pmac_ide_kauai_apply_timings(ide_drive_t *drive) | {
ide_hwif_t *hwif = drive->hwif;
pmac_ide_hwif_t *pmif =
(pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
if (drive->dn & 1) {
writel(pmif->timings[1], PMAC_IDE_REG(IDE_KAUAI_PIO_CONFIG));
writel(pmif->timings[3], PMAC_IDE_REG(IDE_KAUAI_ULTRA_CONFIG));
} else {
writel(pmif->timings[0], PMAC_IDE_REG... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes the MMIO registers specified by Address with registers width and value specified by Width and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). This function must guarantee that all MMIO read and write operations are serialized. */ | UINT64 EFIAPI MmioWriteWorker(IN UINTN Address, IN EFI_SMM_IO_WIDTH Width, IN UINT64 Data) | /* Writes the MMIO registers specified by Address with registers width and value specified by Width and Data respectively. Data is returned. If such operations are not supported, then ASSERT(). This function must guarantee that all MMIO read and write operations are serialized. */
UINT64 EFIAPI MmioWriteWorker(IN UINTN... | {
EFI_STATUS Status;
Status = gSmst->SmmIo.Mem.Write (&gSmst->SmmIo, Width, Address, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Initializes config with predefined default values.
This function will initialize a given AON Sleep Timer configuration structure to a set of known default values. This function should be called on any new instance of the configuration structures before being modified by the user application. */ | void aon_sleep_timer_get_config_defaults(struct aon_sleep_timer_config *config) | /* Initializes config with predefined default values.
This function will initialize a given AON Sleep Timer configuration structure to a set of known default values. This function should be called on any new instance of the configuration structures before being modified by the user application. */
void aon_sleep_timer... | {
config->wakeup = AON_SLEEP_TIMER_WAKEUP_ARM;
config->mode = AON_SLEEP_TIMER_SINGLE_MODE;
config->counter = 32000;
} | memfault/zero-to-main | C++ | null | 200 |
/* Returns number of bytes in OUT fifos. Broken for IN fifos. */ | static int pxa_ep_fifo_status(struct usb_ep *_ep) | /* Returns number of bytes in OUT fifos. Broken for IN fifos. */
static int pxa_ep_fifo_status(struct usb_ep *_ep) | {
struct pxa_ep *ep;
struct udc_usb_ep *udc_usb_ep;
if (!_ep)
return -ENODEV;
udc_usb_ep = container_of(_ep, struct udc_usb_ep, usb_ep);
ep = udc_usb_ep->pxa_ep;
if (!ep || is_ep0(ep))
return -ENODEV;
if (ep->dir_in)
return -EOPNOTSUPP;
if (ep->dev->gadget.speed == USB_SPEED_UNKNOWN || ep_is_empty(ep))
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function raises the system's current task priority level to the task priority level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state. If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned. Otherwise, EFI_SUCCESS is returned. If Lock is NULL, then... | EFI_STATUS EFIAPI EfiAcquireLockOrFail(IN EFI_LOCK *Lock) | /* This function raises the system's current task priority level to the task priority level of the mutual exclusion lock. Then, it attempts to place the lock in the acquired state. If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned. Otherwise, EFI_SUCCESS is returned. If Lock is NULL, then... | {
ASSERT (Lock != NULL);
ASSERT (Lock->Lock != EfiLockUninitialized);
if (Lock->Lock == EfiLockAcquired) {
return EFI_ACCESS_DENIED;
}
Lock->OwnerTpl = gBS->RaiseTPL (Lock->Tpl);
Lock->Lock = EfiLockAcquired;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* USBH_ClrFeature This request is used to clear or disable a specific feature. */ | USBH_Status USBH_ClrFeature(USB_OTG_CORE_HANDLE *pdev, USBH_HOST *phost, uint8_t ep_num, uint8_t hc_num) | /* USBH_ClrFeature This request is used to clear or disable a specific feature. */
USBH_Status USBH_ClrFeature(USB_OTG_CORE_HANDLE *pdev, USBH_HOST *phost, uint8_t ep_num, uint8_t hc_num) | {
phost->Control.setup.b.bmRequestType = USB_H2D |
USB_REQ_RECIPIENT_ENDPOINT |
USB_REQ_TYPE_STANDARD;
phost->Control.setup.b.bRequest = USB_REQ_CLEAR_FEATURE;
phost->Control.setup.b.wValue.w = FEATURE_SELECTOR_ENDPOINT;
phost->C... | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Set a single pin in GPIO data out register to 1. */ | void GPIO_PinOutSet(GPIO_Port_TypeDef port, unsigned int pin) | /* Set a single pin in GPIO data out register to 1. */
void GPIO_PinOutSet(GPIO_Port_TypeDef port, unsigned int pin) | {
EFM_ASSERT(GPIO_PORT_VALID(port) && GPIO_PIN_VALID(pin));
GPIO->P[port].DOUTSET = 1 << pin;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Set the fields of structure stc_sdioc_cmd_config_t to default values. */ | int32_t SDIOC_CommandStructInit(stc_sdioc_cmd_config_t *pstcCmdConfig) | /* Set the fields of structure stc_sdioc_cmd_config_t to default values. */
int32_t SDIOC_CommandStructInit(stc_sdioc_cmd_config_t *pstcCmdConfig) | {
int32_t i32Ret = LL_OK;
if (NULL == pstcCmdConfig) {
i32Ret = LL_ERR_INVD_PARAM;
} else {
pstcCmdConfig->u32Argument = 0U;
pstcCmdConfig->u16CmdIndex = 0U;
pstcCmdConfig->u16CmdType = SDIOC_CMD_TYPE_NORMAL;
pstcCmdConfig->u16DataLine = SDIOC_DAT... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will disable and clear the handler to be called when a memory management fault occurs. */ | void MPUIntUnregister(void) | /* This function will disable and clear the handler to be called when a memory management fault occurs. */
void MPUIntUnregister(void) | {
IntDisable(FAULT_MPU);
IntUnregister(FAULT_MPU);
} | watterott/WebRadio | C++ | null | 71 |
/* Inputs : str - unused, ints - array of integer parameters with ints equal to the number of ints. */ | void __init pas16_setup(char *str, int *ints) | /* Inputs : str - unused, ints - array of integer parameters with ints equal to the number of ints. */
void __init pas16_setup(char *str, int *ints) | {
static int commandline_current = 0;
int i;
if (ints[0] != 2)
printk("pas16_setup : usage pas16=io_port,irq\n");
else
if (commandline_current < NO_OVERRIDES) {
overrides[commandline_current].io_port = (unsigned short) ints[1];
overrides[commandline_current].irq = ints[2];
for (i = 0;... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fetches the "cooked" vblank count value that represents the number of vblank events since the system was booted, including lost events due to modesetting activity. */ | u32 drm_vblank_count(struct drm_device *dev, int crtc) | /* Fetches the "cooked" vblank count value that represents the number of vblank events since the system was booted, including lost events due to modesetting activity. */
u32 drm_vblank_count(struct drm_device *dev, int crtc) | {
return atomic_read(&dev->_vblank_count[crtc]);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The functions for insering/removing us as a module. */ | static int __init serport_init(void) | /* The functions for insering/removing us as a module. */
static int __init serport_init(void) | {
int retval;
retval = tty_register_ldisc(N_MOUSE, &serport_ldisc);
if (retval)
printk(KERN_ERR "serport.c: Error registering line discipline.\n");
return retval;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note that this function does not validate the certificate chain. That needs to be done before using this function. */ | EFI_STATUS EFIAPI VerifyEKUsInPkcs7Signature(IN CONST UINT8 *Pkcs7Signature, IN CONST UINT32 SignatureSize, IN CONST CHAR8 *RequiredEKUs[], IN CONST UINT32 RequiredEKUsSize, IN BOOLEAN RequireAllPresent) | /* Note that this function does not validate the certificate chain. That needs to be done before using this function. */
EFI_STATUS EFIAPI VerifyEKUsInPkcs7Signature(IN CONST UINT8 *Pkcs7Signature, IN CONST UINT32 SignatureSize, IN CONST CHAR8 *RequiredEKUs[], IN CONST UINT32 RequiredEKUsSize, IN BOOLEAN RequireAllPres... | {
ASSERT (FALSE);
return EFI_NOT_READY;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Try to posts the "msg" to the mailbox. */ | err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg) | /* Try to posts the "msg" to the mailbox. */
err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg) | {
u8_t err;
u8_t i=0;
if(msg == NULL )
msg = (void*)null_pointer;
while (i < 10){
err = tls_os_queue_send(*mbox, msg, 0);
if(err == TLS_OS_SUCCESS)
return ERR_OK;
i++;
tls_os_time_delay(1);
}
return ERR_ABRT;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Returns the amount of free space in the output buffer. */ | static int tty3215_write_room(struct tty_struct *tty) | /* Returns the amount of free space in the output buffer. */
static int tty3215_write_room(struct tty_struct *tty) | {
struct raw3215_info *raw;
raw = (struct raw3215_info *) tty->driver_data;
if ((RAW3215_BUFFER_SIZE - raw->count - TAB_STOP_SIZE) >= 0)
return RAW3215_BUFFER_SIZE - raw->count - TAB_STOP_SIZE;
else
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If LangCode is NULL, then ASSERT. If Lang is NULL, then ASSERT. */ | VOID GetNextLanguage(IN OUT CHAR8 **LangCode, OUT CHAR8 *Lang) | /* If LangCode is NULL, then ASSERT. If Lang is NULL, then ASSERT. */
VOID GetNextLanguage(IN OUT CHAR8 **LangCode, OUT CHAR8 *Lang) | {
UINTN Index;
CHAR8 *StringPtr;
ASSERT (LangCode != NULL);
ASSERT (*LangCode != NULL);
ASSERT (Lang != NULL);
Index = 0;
StringPtr = *LangCode;
while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
Index++;
}
CopyMem (Lang, StringPtr, Index);
Lang[Index] = 0;
if (StringPtr[Index]... | tianocore/edk2 | C++ | Other | 4,240 |
/* Parameters: t: tree h: page to be deleted */ | static int __bt_relink(BTREE *t, PAGE *h) | /* Parameters: t: tree h: page to be deleted */
static int __bt_relink(BTREE *t, PAGE *h) | {
PAGE *pg;
if (h->nextpg != P_INVALID) {
if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL)
return (RET_ERROR);
pg->prevpg = h->prevpg;
mpool_put(t->bt_mp, pg, MPOOL_DIRTY);
}
if (h->prevpg != P_INVALID) {
if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL)
return (RET_ERROR);
pg->nextpg = h->... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Calculates new value of xl_bit so the driver can distinguish between make/break pair of scancodes for select keys and PS/2 protocol responses. */ | static void atkbd_calculate_xl_bit(struct atkbd *atkbd, unsigned char code) | /* Calculates new value of xl_bit so the driver can distinguish between make/break pair of scancodes for select keys and PS/2 protocol responses. */
static void atkbd_calculate_xl_bit(struct atkbd *atkbd, unsigned char code) | {
int i;
for (i = 0; i < ARRAY_SIZE(xl_table); i++) {
if (!((code ^ xl_table[i]) & 0x7f)) {
if (code & 0x80)
__clear_bit(i, &atkbd->xl_bit);
else
__set_bit(i, &atkbd->xl_bit);
break;
}
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* __vxge_hw_channel_reset - Resets a channel This function resets a channel by properly setting the various references */ | enum vxge_hw_status __vxge_hw_channel_reset(struct __vxge_hw_channel *channel) | /* __vxge_hw_channel_reset - Resets a channel This function resets a channel by properly setting the various references */
enum vxge_hw_status __vxge_hw_channel_reset(struct __vxge_hw_channel *channel) | {
u32 i;
for (i = 0; i < channel->length; i++) {
if (channel->reserve_arr != NULL)
channel->reserve_arr[i] = channel->orig_arr[i];
if (channel->free_arr != NULL)
channel->free_arr[i] = NULL;
if (channel->work_arr != NULL)
channel->work_arr[i] = NULL;
}
channel->free_ptr = channel->length;
channel->r... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called when preparing the capture device for use */ | static void saa7134_dma_start(struct saa7134_dev *dev) | /* Called when preparing the capture device for use */
static void saa7134_dma_start(struct saa7134_dev *dev) | {
dev->dmasound.dma_blk = 0;
dev->dmasound.dma_running = 1;
saa7134_set_dmabits(dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Register a host attribute with the BLE stack. */ | int ble_att_svr_register(const ble_uuid_t *uuid, uint8_t flags, uint8_t min_key_size, uint16_t *handle_id, ble_att_svr_access_fn *cb, void *cb_arg) | /* Register a host attribute with the BLE stack. */
int ble_att_svr_register(const ble_uuid_t *uuid, uint8_t flags, uint8_t min_key_size, uint16_t *handle_id, ble_att_svr_access_fn *cb, void *cb_arg) | {
struct ble_att_svr_entry *entry;
entry = ble_att_svr_entry_alloc();
if (entry == NULL) {
return BLE_HS_ENOMEM;
}
entry->ha_uuid = uuid;
entry->ha_flags = flags;
entry->ha_min_key_size = min_key_size;
entry->ha_handle_id = ble_att_svr_next_id();
entry->ha_cb = cb;
entry-... | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Tell whether this Operand is an Statement OpCode. */ | BOOLEAN IsStatementOpCode(IN UINT8 Operand) | /* Tell whether this Operand is an Statement OpCode. */
BOOLEAN IsStatementOpCode(IN UINT8 Operand) | {
if ((Operand == EFI_IFR_SUBTITLE_OP) ||
(Operand == EFI_IFR_TEXT_OP) ||
(Operand == EFI_IFR_RESET_BUTTON_OP) ||
(Operand == EFI_IFR_REF_OP) ||
(Operand == EFI_IFR_ACTION_OP) ||
(Operand == EFI_IFR_NUMERIC_OP) ||
(Operand == EFI_IFR_ORDERED_LIST_OP) ||
(Operand == EFI_IFR_CH... | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns: (transfer none): a #GObject associated with the given @attribute, or NULL otherwise. */ | GObject* g_file_info_get_attribute_object(GFileInfo *info, const char *attribute) | /* Returns: (transfer none): a #GObject associated with the given @attribute, or NULL otherwise. */
GObject* g_file_info_get_attribute_object(GFileInfo *info, const char *attribute) | {
GFileAttributeValue *value;
g_return_val_if_fail (G_IS_FILE_INFO (info), NULL);
g_return_val_if_fail (attribute != NULL && *attribute != '\0', NULL);
value = g_file_info_find_value_by_name (info, attribute);
return _g_file_attribute_value_get_object (value);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function initializes the event counters in L2 Cache controller with a set of event codes specified by the user. */ | void XL2cc_EventCtrInit(s32 Event0, s32 Event1) | /* This function initializes the event counters in L2 Cache controller with a set of event codes specified by the user. */
void XL2cc_EventCtrInit(s32 Event0, s32 Event1) | {
*((volatile u32*)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNT1_CTRL_OFFSET)) = (((u32)Event1) << 2);
*((volatile u32*)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNT0_CTRL_OFFSET)) = (((u32)Event0) << 2);
XL2cc_EventCtrReset();
} | ua1arn/hftrx | C++ | null | 69 |
/* Move the device towards the tail of the device list. Need to be called while holding the zcrypt device list lock. Note: cards with speed_rating of 0 are kept at the end of the list. */ | static void __zcrypt_decrease_preference(struct zcrypt_device *zdev) | /* Move the device towards the tail of the device list. Need to be called while holding the zcrypt device list lock. Note: cards with speed_rating of 0 are kept at the end of the list. */
static void __zcrypt_decrease_preference(struct zcrypt_device *zdev) | {
struct zcrypt_device *tmp;
struct list_head *l;
if (zdev->speed_rating == 0)
return;
for (l = zdev->list.next; l != &zcrypt_device_list; l = l->next) {
tmp = list_entry(l, struct zcrypt_device, list);
if ((tmp->request_count + 1) * tmp->speed_rating >
(zdev->request_count + 1) * zdev->speed_rating ||
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Unregisters an interrupt handler for the DES module. */ | void DESIntUnregister(uint32_t ui32Base) | /* Unregisters an interrupt handler for the DES module. */
void DESIntUnregister(uint32_t ui32Base) | {
ASSERT(ui32Base == DES_BASE);
IntDisable(INT_DES);
IntUnregister(INT_DES);
} | micropython/micropython | C++ | Other | 18,334 |
/* Finds the protocol entry for the requested protocol. The gProtocolDatabaseLock must be owned */ | PROTOCOL_ENTRY* CoreFindProtocolEntry(IN EFI_GUID *Protocol, IN BOOLEAN Create) | /* Finds the protocol entry for the requested protocol. The gProtocolDatabaseLock must be owned */
PROTOCOL_ENTRY* CoreFindProtocolEntry(IN EFI_GUID *Protocol, IN BOOLEAN Create) | {
LIST_ENTRY *Link;
PROTOCOL_ENTRY *Item;
PROTOCOL_ENTRY *ProtEntry;
ASSERT_LOCKED (&gProtocolDatabaseLock);
ProtEntry = NULL;
for (Link = mProtocolDatabase.ForwardLink;
Link != &mProtocolDatabase;
Link = Link->ForwardLink)
{
Item = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_E... | tianocore/edk2 | C++ | Other | 4,240 |
/* Functions for getting the pages from a bvec. */ | static void bvec_get_page(struct dpages *dp, struct page **p, unsigned long *len, unsigned *offset) | /* Functions for getting the pages from a bvec. */
static void bvec_get_page(struct dpages *dp, struct page **p, unsigned long *len, unsigned *offset) | {
struct bio_vec *bvec = (struct bio_vec *) dp->context_ptr;
*p = bvec->bv_page;
*len = bvec->bv_len;
*offset = bvec->bv_offset;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set GPIO port mask register of the specified GPIO pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIOPinMaskSet(unsigned long ulPort, unsigned long ulPins) | /* Set GPIO port mask register of the specified GPIO pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinMaskSet(unsigned long ulPort, ... | {
xASSERT(GPIOBaseValid(ulPort));
xHWREG(ulPort + GPIO_DMASK) |= ulPins;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* If this function is not defined here, board.c alters dram bank zero configuration defined above. */ | int dram_init_banksize(void) | /* If this function is not defined here, board.c alters dram bank zero configuration defined above. */
int dram_init_banksize(void) | {
u64 size = 0;
int i;
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
gd->bd->bi_dram[i].start = mvebu_sdram_bar(i);
gd->bd->bi_dram[i].size = mvebu_sdram_bs(i);
size += gd->bd->bi_dram[i].size;
if (size > MVEBU_SDRAM_SIZE_MAX)
mvebu_sdram_bs_set(i, 0x40000000);
}
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Allocate memory. This routine is like sqlite3_malloc() except that it assumes the memory subsystem has already been initialized. */ | SQLITE_PRIVATE void * sqlite3Malloc(int) | /* Allocate memory. This routine is like sqlite3_malloc() except that it assumes the memory subsystem has already been initialized. */
SQLITE_PRIVATE void * sqlite3Malloc(int) | {
void *p;
if( n<=0
|| n>=0x7fffff00
){
p = 0;
}else if( sqlite3GlobalConfig.bMemstat ){
sqlite3_mutex_enter(mem0.mutex);
mallocWithAlarm(n, &p);
sqlite3_mutex_leave(mem0.mutex);
}else{
p = sqlite3GlobalConfig.m.xMalloc(n);
}
assert( EIGHT_BYTE_ALIGNMENT(p) );
return p;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* there's basically nothing to do here since the memory controller isn't on the CPU in this case. */ | void cpu_init_f(void) | /* there's basically nothing to do here since the memory controller isn't on the CPU in this case. */
void cpu_init_f(void) | {
switch (get_cpu_type()) {
case CPU_7450:
case CPU_7455:
case CPU_7457:
case CPU_7447A:
case CPU_7448:
set_hid0(get_hid0() | 0x4000000);
break;
default:
break;
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | /* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | {
if(hspi->Instance==SPI5)
{
__HAL_RCC_SPI5_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_9|GPIO_PIN_7);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* SSP macro: write 1 bytes to FIFO buffer */ | STATIC void SSP_Write1BFifo(LPC_SSP_T *pSSP, Chip_SSP_DATA_SETUP_T *xf_setup) | /* SSP macro: write 1 bytes to FIFO buffer */
STATIC void SSP_Write1BFifo(LPC_SSP_T *pSSP, Chip_SSP_DATA_SETUP_T *xf_setup) | {
if (xf_setup->tx_data) {
Chip_SSP_SendFrame(pSSP, (*(uint8_t *) ((uint32_t) xf_setup->tx_data + xf_setup->tx_cnt)));
}
else {
Chip_SSP_SendFrame(pSSP, 0xFF);
}
xf_setup->tx_cnt++;
} | labapart/polymcu | C++ | null | 201 |
/* This function sets the byte order for the given @stream. All subsequent reads from the @stream will be read in the given @order. */ | void g_data_input_stream_set_byte_order(GDataInputStream *stream, GDataStreamByteOrder order) | /* This function sets the byte order for the given @stream. All subsequent reads from the @stream will be read in the given @order. */
void g_data_input_stream_set_byte_order(GDataInputStream *stream, GDataStreamByteOrder order) | {
GDataInputStreamPrivate *priv;
g_return_if_fail (G_IS_DATA_INPUT_STREAM (stream));
priv = stream->priv;
if (priv->byte_order != order)
{
priv->byte_order = order;
g_object_notify (G_OBJECT (stream), "byte-order");
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Note, no "add" uevent will be created with this call, the caller should set up all of the necessary sysfs files for the object and then call kobject_uevent() with the UEVENT_ADD parameter to ensure that userspace is properly notified of this kobject's creation. */ | int kobject_add(struct kobject *kobj, struct kobject *parent, const char *fmt,...) | /* Note, no "add" uevent will be created with this call, the caller should set up all of the necessary sysfs files for the object and then call kobject_uevent() with the UEVENT_ADD parameter to ensure that userspace is properly notified of this kobject's creation. */
int kobject_add(struct kobject *kobj, struct kobjec... | {
va_list args;
int retval;
if (!kobj)
return -EINVAL;
if (!kobj->state_initialized) {
printk(KERN_ERR "kobject '%s' (%p): tried to add an "
"uninitialized object, something is seriously wrong.\n",
kobject_name(kobj), kobj);
dump_stack();
return -EINVAL;
}
va_start(args, fmt);
retval = ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the return value of the notifier can be and'ed with NOTIFY_STOP_MASK then raw_notifier_call_chain() will return immediately, with the return value of the notifier function which halted execution. Otherwise the return value is the return value of the last notifier function called. */ | int __raw_notifier_call_chain(struct raw_notifier_head *nh, unsigned long val, void *v, int nr_to_call, int *nr_calls) | /* If the return value of the notifier can be and'ed with NOTIFY_STOP_MASK then raw_notifier_call_chain() will return immediately, with the return value of the notifier function which halted execution. Otherwise the return value is the return value of the last notifier function called. */
int __raw_notifier_call_chain... | {
return notifier_call_chain(&nh->head, val, v, nr_to_call, nr_calls);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This socket option is a boolean flag which turns on or off mapped V4 addresses. If this option is turned on and the socket is type PF_INET6, then IPv4 addresses will be mapped to V6 representation. If this option is turned off, then no mapping will be done of V4 addresses and a user will receive both PF_INET6 and PF... | static int sctp_setsockopt_mappedv4(struct sock *sk, char __user *optval, unsigned int optlen) | /* This socket option is a boolean flag which turns on or off mapped V4 addresses. If this option is turned on and the socket is type PF_INET6, then IPv4 addresses will be mapped to V6 representation. If this option is turned off, then no mapping will be done of V4 addresses and a user will receive both PF_INET6 and PF... | {
int val;
struct sctp_sock *sp = sctp_sk(sk);
if (optlen < sizeof(int))
return -EINVAL;
if (get_user(val, (int __user *)optval))
return -EFAULT;
if (val)
sp->v4mapped = 1;
else
sp->v4mapped = 0;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get memory block size in a Memory Pool. */ | uint32_t osMemoryPoolGetBlockSize(osMemoryPoolId_t mp_id) | /* Get memory block size in a Memory Pool. */
uint32_t osMemoryPoolGetBlockSize(osMemoryPoolId_t mp_id) | {
struct cv2_mslab *mslab = (struct cv2_mslab *)mp_id;
if (mslab == NULL) {
return 0;
} else {
return mslab->z_mslab.info.block_size;
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Clear PCR Sleep control sleep all causing HW to de-assert all peripheral SLP_EN signals. HW will does this automatically only if it vectors to an ISR after wake. We are masking ISR's from running until we restore peripheral state therefore we force HW to de-assert the SLP_EN signals. */ | void soc_deep_sleep_disable(void) | /* Clear PCR Sleep control sleep all causing HW to de-assert all peripheral SLP_EN signals. HW will does this automatically only if it vectors to an ISR after wake. We are masking ISR's from running until we restore peripheral state therefore we force HW to de-assert the SLP_EN signals. */
void soc_deep_sleep_disable(... | {
PCR_REGS->SYS_SLP_CTRL = 0U;
SCB->SCR &= ~(1ul << 2);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* This function returns positive resulting integer in case of success and a negative error code in case of failure. */ | static int __init bytes_str_to_int(const char *str) | /* This function returns positive resulting integer in case of success and a negative error code in case of failure. */
static int __init bytes_str_to_int(const char *str) | {
char *endp;
unsigned long result;
result = simple_strtoul(str, &endp, 0);
if (str == endp || result >= INT_MAX) {
printk(KERN_ERR "UBI error: incorrect bytes count: \"%s\"\n",
str);
return -EINVAL;
}
switch (*endp) {
case 'G':
result *= 1024;
case 'M':
result *= 1024;
case 'K':
result *= 1... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the USB Host Speed from the Low Level Driver. */ | USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost) | /* Returns the USB Host Speed from the Low Level Driver. */
USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost) | {
USBH_SpeedTypeDef speed = USBH_SPEED_FULL;
switch (HAL_HCD_GetCurrentSpeed(phost->pData))
{
case 0:
speed = USBH_SPEED_HIGH;
break;
case 1:
speed = USBH_SPEED_FULL;
break;
case 2:
speed = USBH_SPEED_LOW;
break;
default:
speed = USBH_SPEED_FULL;
break;
}
return spee... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Specifies the TIMx Counter Mode to be used. */ | void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode) | /* Specifies the TIMx Counter Mode to be used. */
void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode) | {
uint16_t tmpcr1 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_COUNTER_MODE(TIM_CounterMode));
tmpcr1 = TIMx->CR1;
tmpcr1 &= (uint16_t)(~((uint16_t)(TIM_CR1_DIR | TIM_CR1_CMS)));
tmpcr1 |= TIM_CounterMode;
TIMx->CR1 = tmpcr1;
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* Read 32bits data from specified UFS MMIO register. */ | EFI_STATUS UfsMmioRead32(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN UINTN Offset, OUT UINT32 *Value) | /* Read 32bits data from specified UFS MMIO register. */
EFI_STATUS UfsMmioRead32(IN UFS_PASS_THRU_PRIVATE_DATA *Private, IN UINTN Offset, OUT UINT32 *Value) | {
EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;
EFI_STATUS Status;
UfsHc = Private->UfsHostController;
Status = UfsHc->Read (UfsHc, EfiUfsHcWidthUint32, Offset, 1, Value);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Gets the url of the @import rule statement. Returns CR_OK upon successful completion, an error code otherwise. */ | enum CRStatus cr_statement_at_import_rule_get_url(CRStatement *a_this, CRString **a_url) | /* Gets the url of the @import rule statement. Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_statement_at_import_rule_get_url(CRStatement *a_this, CRString **a_url) | {
g_return_val_if_fail (a_this
&& a_this->type == AT_IMPORT_RULE_STMT
&& a_this->kind.import_rule,
CR_BAD_PARAM_ERROR);
*a_url = a_this->kind.import_rule->url;
return CR_OK;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Read a word from the EEPROM using the regular EEPROM access register. Assume that we are in register window zero. */ | static u16 read_eeprom(unsigned int ioaddr, int index) | /* Read a word from the EEPROM using the regular EEPROM access register. Assume that we are in register window zero. */
static u16 read_eeprom(unsigned int ioaddr, int index) | {
int i;
outw(EEPROM_READ + index, ioaddr + 10);
for (i = 1620; i >= 0; i--)
if ((inw(ioaddr + 10) & EEPROM_BUSY) == 0)
break;
return inw(ioaddr + 12);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* brief Return Frequency of PLL1 return Frequency of PLL1 */ | uint32_t CLOCK_GetPll1OutFreq(void) | /* brief Return Frequency of PLL1 return Frequency of PLL1 */
uint32_t CLOCK_GetPll1OutFreq(void) | {
uint32_t clkRate = 0;
uint32_t prediv, postdiv;
float workRate = 0.0F;
clkRate = CLOCK_GetPLL1InClockRate();
if (CLOCK_IsPLL1Locked() == true)
{
prediv = findPll1PreDiv();
postdiv = findPll1PostDiv();
clkRate = clkRate / prediv;
workRate = (float)clkRate * (flo... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Simple form of proto_reg_handoff_lisp_tcp which can be used if there are no prefs-dependent registration function calls. */ | void proto_reg_handoff_lisp_tcp(void) | /* Simple form of proto_reg_handoff_lisp_tcp which can be used if there are no prefs-dependent registration function calls. */
void proto_reg_handoff_lisp_tcp(void) | {
dissector_add_uint("tcp.port", LISP_CONTROL_PORT, lisp_tcp_handle);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Configure the I2C fast mode plus driving capability. */ | void SYSCFG_I2CFastModePlusConfig(uint32_t SYSCFG_I2CFastModePlus, FunctionalState NewState) | /* Configure the I2C fast mode plus driving capability. */
void SYSCFG_I2CFastModePlusConfig(uint32_t SYSCFG_I2CFastModePlus, FunctionalState NewState) | {
assert_param(IS_SYSCFG_I2C_FMP(SYSCFG_I2CFastModePlus));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
SYSCFG->CFGR1 |= (uint32_t)SYSCFG_I2CFastModePlus;
}
else
{
SYSCFG->CFGR1 &= (uint32_t)(~SYSCFG_I2CFastModePlus);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* @ Funciton: NF_ReadID Parameter: id: pointer to device ID Return: None */ | void NF_ReadID(unsigned char *id) | /* @ Funciton: NF_ReadID Parameter: id: pointer to device ID Return: None */
void NF_ReadID(unsigned char *id) | {
unsigned char maker_code;
NF_Init();
NF_OE_L();
NF_DATA_OUT();
NF_CMD(NAND_CMD_READID);
NF_ADDR(0x00);
NF_CLR_ALE();
Wait(10);
NF_DATA_IN();
maker_code = NF_RDDATA();
maker_code = maker_code;
*id = NF_RDDATA();
NF_OE_H();
NF_UnInit();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get the current statistics. This may be called with the card open or closed. */ | static struct net_device_stats * tc35815_get_stats(struct net_device *dev) | /* Get the current statistics. This may be called with the card open or closed. */
static struct net_device_stats * tc35815_get_stats(struct net_device *dev) | {
struct tc35815_regs __iomem *tr =
(struct tc35815_regs __iomem *)dev->base_addr;
if (netif_running(dev))
dev->stats.rx_missed_errors += tc_readl(&tr->Miss_Cnt);
return &dev->stats;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Adds the RIO device to the global device list and adds the RIO device to the RIO device list. Creates the generic sysfs nodes for an RIO device. */ | static int __devinit rio_add_device(struct rio_dev *rdev) | /* Adds the RIO device to the global device list and adds the RIO device to the RIO device list. Creates the generic sysfs nodes for an RIO device. */
static int __devinit rio_add_device(struct rio_dev *rdev) | {
int err;
err = device_add(&rdev->dev);
if (err)
return err;
spin_lock(&rio_global_list_lock);
list_add_tail(&rdev->global_list, &rio_devices);
spin_unlock(&rio_global_list_lock);
rio_create_sysfs_dev_files(rdev);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get a 14-bit integer from raw ADC data. */ | static int ads7052_get_be14(const uint8_t src[2]) | /* Get a 14-bit integer from raw ADC data. */
static int ads7052_get_be14(const uint8_t src[2]) | {
return ((src[0] & 0x7F) << 7) | (src[1] >> 1);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Enables or disables the Internal High Speed oscillator request from ADC. */ | void RCC_HSI14ADCRequestCmd(FunctionalState NewState) | /* Enables or disables the Internal High Speed oscillator request from ADC. */
void RCC_HSI14ADCRequestCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RCC->CR2 &= ~RCC_CR2_HSI14DIS;
}
else
{
RCC->CR2 |= RCC_CR2_HSI14DIS;
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* ADC MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | /* ADC MSP Initialization This function configures the hardware resources used in this example: */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | {
GPIO_InitTypeDef GPIO_InitStruct;
ADCx_CLK_ENABLE();
ADCx_CHANNEL_GPIO_CLK_ENABLE();
GPIO_InitStruct.Pin = ADCx_CHANNEL_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(ADCx_CHANNEL_GPIO_PORT, &GPIO_InitStruct);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Event handler for the library USB Disconnection event. */ | void EVENT_USB_Device_Disconnect(void) | /* Event handler for the library USB Disconnection event. */
void EVENT_USB_Device_Disconnect(void) | {
PulseMSRemaining.PingPongLEDPulse = 0;
LEDs_SetAllLEDs(LEDS_NO_LEDS);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Clear the End of Operation Status Flag, upper Bank. */ | void flash_clear_eop_flag_upper(void) | /* Clear the End of Operation Status Flag, upper Bank. */
void flash_clear_eop_flag_upper(void) | {
if (DESIG_FLASH_SIZE > 512) {
FLASH_SR2 |= FLASH_SR_EOP;
}
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* serialization: IREAD_LOCK(ipbmap), e.g., from dbAlloc(), or IWRITE_LOCK(ipbmap), e.g., dbAllocCtl(), held on entry/exit; */ | static int dbAllocDmapLev(struct bmap *bmp, struct dmap *dp, int nblocks, int l2nb, s64 *results) | /* serialization: IREAD_LOCK(ipbmap), e.g., from dbAlloc(), or IWRITE_LOCK(ipbmap), e.g., dbAllocCtl(), held on entry/exit; */
static int dbAllocDmapLev(struct bmap *bmp, struct dmap *dp, int nblocks, int l2nb, s64 *results) | {
s64 blkno;
int leafidx, rc;
assert(l2nb <= L2BPERDMAP);
if (dbFindLeaf((dmtree_t *) & dp->tree, l2nb, &leafidx))
return -ENOSPC;
blkno = le64_to_cpu(dp->start) + (leafidx << L2DBWORD);
if (dp->tree.stree[leafidx + LEAFIND] < BUDMIN)
blkno += dbFindBits(le32_to_cpu(dp->wmap[leafidx]), l2nb);
if ((rc = dbAll... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base USART peripheral base address param handle Pointer to usart_dma_handle_t structure */ | void USART_TransferAbortReceiveDMA(USART_Type *base, usart_dma_handle_t *handle) | /* param base USART peripheral base address param handle Pointer to usart_dma_handle_t structure */
void USART_TransferAbortReceiveDMA(USART_Type *base, usart_dma_handle_t *handle) | {
assert(NULL != handle);
assert(NULL != handle->rxDmaHandle);
DMA_AbortTransfer(handle->rxDmaHandle);
handle->rxState = (uint8_t)kUSART_RxIdle;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Sets the TIMx Autoreload Register(TIMx_ARR) value to change period with protection. */ | void RTIM_ChangePeriod(RTIM_TypeDef *TIMx, u32 Autoreload) | /* Sets the TIMx Autoreload Register(TIMx_ARR) value to change period with protection. */
void RTIM_ChangePeriod(RTIM_TypeDef *TIMx, u32 Autoreload) | {
assert_param(IS_TIM_ALL_TIM(TIMx));
TIMx->ARR = Autoreload;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Update binding hardware IRQ number (hw) and Virtuql IRQ number (virq). This is called only once for a given mapping. */ | static void beatic_pic_host_remap(struct irq_host *h, unsigned int virq, irq_hw_number_t hw) | /* Update binding hardware IRQ number (hw) and Virtuql IRQ number (virq). This is called only once for a given mapping. */
static void beatic_pic_host_remap(struct irq_host *h, unsigned int virq, irq_hw_number_t hw) | {
beat_construct_and_connect_irq_plug(virq, hw);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If StartAddress > 0x0FFFFFFF, then ASSERT(). If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). If Size > 0 and Buffer is NULL, then ASSERT(). */ | UINTN EFIAPI S3PciWriteBuffer(IN UINTN StartAddress, IN UINTN Size, IN VOID *Buffer) | /* If StartAddress > 0x0FFFFFFF, then ASSERT(). If ((StartAddress & 0xFFF) + Size) > 0x1000, then ASSERT(). If Size > 0 and Buffer is NULL, then ASSERT(). */
UINTN EFIAPI S3PciWriteBuffer(IN UINTN StartAddress, IN UINTN Size, IN VOID *Buffer) | {
RETURN_STATUS Status;
Status = S3BootScriptSavePciCfgWrite (
S3BootScriptWidthUint8,
PCILIB_TO_COMMON_ADDRESS (StartAddress),
PciWriteBuffer (StartAddress, Size, Buffer),
Buffer
);
ASSERT (Status == RETURN_SUCCESS);
return Size;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* lps22hh_enable_int - enable selected int pin to generate interrupt */ | static int lps22hh_enable_int(const struct device *dev, int enable) | /* lps22hh_enable_int - enable selected int pin to generate interrupt */
static int lps22hh_enable_int(const struct device *dev, int enable) | {
const struct lps22hh_config * const cfg = dev->config;
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
lps22hh_pin_int_route_t int_route;
lps22hh_pin_int_route_get(ctx, &int_route);
int_route.drdy_pres = enable;
return lps22hh_pin_int_route_set(ctx, &int_route);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Draw an outline of a rectangle (generic implementation). */ | void gfx_mono_generic_draw_rect(gfx_coord_t x, gfx_coord_t y, gfx_coord_t width, gfx_coord_t height, enum gfx_mono_color color) | /* Draw an outline of a rectangle (generic implementation). */
void gfx_mono_generic_draw_rect(gfx_coord_t x, gfx_coord_t y, gfx_coord_t width, gfx_coord_t height, enum gfx_mono_color color) | {
gfx_mono_draw_horizontal_line(x, y, width, color);
gfx_mono_draw_horizontal_line(x, y + height - 1, width, color);
gfx_mono_draw_vertical_line(x, y, height, color);
gfx_mono_draw_vertical_line(x + width - 1, y, height, color);
} | memfault/zero-to-main | C++ | null | 200 |
/* Disables control interrupts on a given USB controller. */ | void USBIntDisableControl(uint32_t ui32Base, uint32_t ui32Flags) | /* Disables control interrupts on a given USB controller. */
void USBIntDisableControl(uint32_t ui32Base, uint32_t ui32Flags) | {
ASSERT(ui32Base == USB0_BASE);
ASSERT((ui32Flags & ~(USB_INTCTRL_ALL)) == 0);
if(ui32Flags & USB_INTCTRL_STATUS)
{
HWREGB(ui32Base + USB_O_IE) &= ~(ui32Flags & USB_INTCTRL_STATUS);
}
if(ui32Flags & USB_INTCTRL_POWER_FAULT)
{
HWREG(ui32Base + USB_O_EPCIM) = 0;
}
if(u... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* copy from ds while checksumming, otherwise like csum_partial */ | __wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum) | /* copy from ds while checksumming, otherwise like csum_partial */
__wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum) | {
memcpy(dst, src, len);
return csum_partial(dst, len, sum);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets I2C start condition (High -> Low on SDA while SCL is High) */ | static void ixgbe_i2c_start(struct ixgbe_hw *hw) | /* Sets I2C start condition (High -> Low on SDA while SCL is High) */
static void ixgbe_i2c_start(struct ixgbe_hw *hw) | {
u32 i2cctl = IXGBE_READ_REG(hw, IXGBE_I2CCTL);
ixgbe_set_i2c_data(hw, &i2cctl, 1);
ixgbe_raise_i2c_clk(hw, &i2cctl);
udelay(IXGBE_I2C_T_SU_STA);
ixgbe_set_i2c_data(hw, &i2cctl, 0);
udelay(IXGBE_I2C_T_HD_STA);
ixgbe_lower_i2c_clk(hw, &i2cctl);
udelay(IXGBE_I2C_T_LOW);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return if there is touch detected or not. */ | uint8_t stmpe811_TS_DetectTouch(uint16_t DeviceAddr) | /* Return if there is touch detected or not. */
uint8_t stmpe811_TS_DetectTouch(uint16_t DeviceAddr) | {
uint8_t state;
uint8_t ret = 0;
state = ((IOE_Read(DeviceAddr, STMPE811_REG_TSC_CTRL) & (uint8_t)STMPE811_TS_CTRL_STATUS) == (uint8_t)0x80);
if(state > 0)
{
if(IOE_Read(DeviceAddr, STMPE811_REG_FIFO_SIZE) > 0)
{
ret = 1;
}
}
else
{
IOE_Write(DeviceAddr, STMPE811_REG_FIFO_STA, 0x0... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Sensing chain FIFO stop values memorization at threshold level.. */ | int32_t lps22hh_fifo_stop_on_wtm_set(stmdev_ctx_t *ctx, uint8_t val) | /* Sensing chain FIFO stop values memorization at threshold level.. */
int32_t lps22hh_fifo_stop_on_wtm_set(stmdev_ctx_t *ctx, uint8_t val) | {
lps22hh_fifo_ctrl_t reg;
int32_t ret;
ret = lps22hh_read_reg(ctx, LPS22HH_FIFO_CTRL, (uint8_t *) ®, 1);
if (ret == 0) {
reg.stop_on_wtm = val;
ret = lps22hh_write_reg(ctx, LPS22HH_FIFO_CTRL, (uint8_t *) ®, 1);
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Return: 0 if the module config showed that reset isolation is supported. Returns 1 otherwise. This is not an error, but setting the bit in mdctl has no effect. */ | int psc_set_reset_iso(u32 mod_num) | /* Return: 0 if the module config showed that reset isolation is supported. Returns 1 otherwise. This is not an error, but setting the bit in mdctl has no effect. */
int psc_set_reset_iso(u32 mod_num) | {
u32 v;
u32 mdctl;
mdctl = __raw_readl(KS2_PSC_BASE + PSC_REG_MDCTL(mod_num));
mdctl = PSC_REG_MDCTL_SET_RESET_ISO(mdctl, 1);
__raw_writel(mdctl, KS2_PSC_BASE + PSC_REG_MDCTL(mod_num));
v = __raw_readl(KS2_PSC_BASE + PSC_REG_MDCFG(mod_num));
if (PSC_REG_MDCFG_GET_RESET_ISO(v) == 1)
return 0;
return 1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* set power down sleep VDDCORE gpio interrupt mask */ | BL_Sts_Type PDS_Get_Vddcore_GPIO_IntStatus(void) | /* set power down sleep VDDCORE gpio interrupt mask */
BL_Sts_Type PDS_Get_Vddcore_GPIO_IntStatus(void) | {
return BL_GET_REG_BITS_VAL(BL_RD_REG(PDS_BASE, PDS_GPIO_INT), PDS_GPIO_INT_STAT) ? SET : RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* we need to detect all attempts to write to the EBC entry point argument stack area and adjust the address (which will initially point into the VM stack) to point into the EBC entry point arguments. */ | EFI_STATUS VmWriteMem8(IN VM_CONTEXT *VmPtr, IN UINTN Addr, IN UINT8 Data) | /* we need to detect all attempts to write to the EBC entry point argument stack area and adjust the address (which will initially point into the VM stack) to point into the EBC entry point arguments. */
EFI_STATUS VmWriteMem8(IN VM_CONTEXT *VmPtr, IN UINTN Addr, IN UINT8 Data) | {
Addr = ConvertStackAddr (VmPtr, Addr);
*(UINT8 *)Addr = Data;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Write to UART Transmit Holding Register Before writing user should check if tx is ready (or empty). */ | uint32_t uart_write(Uart *p_uart, const uint8_t uc_data) | /* Write to UART Transmit Holding Register Before writing user should check if tx is ready (or empty). */
uint32_t uart_write(Uart *p_uart, const uint8_t uc_data) | {
if (!(p_uart->UART_SR & UART_SR_TXRDY))
return 1;
p_uart->UART_THR = uc_data;
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function customized the behavior that whether Setup exits Page so that system able to boot when configuration is not changed. */ | BOOLEAN EFIAPI FormExitPolicy(VOID) | /* This function customized the behavior that whether Setup exits Page so that system able to boot when configuration is not changed. */
BOOLEAN EFIAPI FormExitPolicy(VOID) | {
return gClassOfVfr == FORMSET_CLASS_FRONT_PAGE ? FALSE : TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Periodically called callback used to add samples to the DAC. */ | static void fill_timer_cb(struct music_player_t *self_p) | /* Periodically called callback used to add samples to the DAC. */
static void fill_timer_cb(struct music_player_t *self_p) | {
uint32_t mask;
mask = EVENT_TIMEOUT;
event_write_isr(&self_p->event, &mask, sizeof(mask));
} | eerimoq/simba | C++ | Other | 337 |
/* The irq number of the new irq or a negative error value is returned. */ | int ht_create_irq(struct pci_dev *dev, int idx) | /* The irq number of the new irq or a negative error value is returned. */
int ht_create_irq(struct pci_dev *dev, int idx) | {
return __ht_create_irq(dev, idx, NULL);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.