docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* The functions for inserting/removing us as a module. */
static int __init stinger_init(void)
/* The functions for inserting/removing us as a module. */ static int __init stinger_init(void)
{ return serio_register_driver(&stinger_drv); }
robutest/uclinux
C++
GPL-2.0
60
/* SMP: Our groups are copy-on-write. We can set them safely without another task interfering. */
SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
/* SMP: Our groups are copy-on-write. We can set them safely without another task interfering. */ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
{ struct group_info *group_info; int retval; if (!capable(CAP_SETGID)) return -EPERM; if ((unsigned)gidsetsize > NGROUPS_MAX) return -EINVAL; group_info = groups_alloc(gidsetsize); if (!group_info) return -ENOMEM; retval = groups_from_user(group_info, grouplist); if (retval) { put_group_info(group_info)...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */
void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */ void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
{ uint32_t tmpreg1 = 0, tmpreg2 = 0; assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_DAC_TRIGGER(DAC_InitStruct->DAC_Trigger)); assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->DAC_WaveGeneration)); assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude...
avem-labs/Avem
C++
MIT License
1,752
/* Sets bits in the data register of the GPIO pin bank. Sets bits in the data register of the current GPIO pin bank as a read-modify-write operation. All bits set in the bit mask provided by the caller are OR'ed into the current data word of the bank. This operation has no effect on the values associated with pins con...
static int gpio_xlnx_ps_bank_set_bits(const struct device *dev, gpio_port_pins_t pins)
/* Sets bits in the data register of the GPIO pin bank. Sets bits in the data register of the current GPIO pin bank as a read-modify-write operation. All bits set in the bit mask provided by the caller are OR'ed into the current data word of the bank. This operation has no effect on the values associated with pins con...
{ const struct gpio_xlnx_ps_bank_dev_cfg *dev_conf = dev->config; uint32_t bank_data; bank_data = sys_read32(GPIO_XLNX_PS_BANK_DATA_REG); bank_data |= pins; sys_write32(bank_data, GPIO_XLNX_PS_BANK_DATA_REG); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Print the name corresponding to a value, with overflow check. */
static void iw_print_value_name(unsigned int value, const char *names[], const unsigned int num_names)
/* Print the name corresponding to a value, with overflow check. */ static void iw_print_value_name(unsigned int value, const char *names[], const unsigned int num_names)
{ if(value >= num_names) printf(" unknown (%d)", value); else printf(" %s", names[value]); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Gets the interrupt software priority bits (I1, I0) value from CPU CC register. */
uint8_t ITC_GetSoftIntStatus(void)
/* Gets the interrupt software priority bits (I1, I0) value from CPU CC register. */ uint8_t ITC_GetSoftIntStatus(void)
{ return ((uint8_t)(ITC_GetCPUCC() & CPU_SOFT_INT_DISABLED)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function can't do checks to see if multiple devices end up with the same resources, so you might see magic smoke if someone screws up. */
void mca_write_pos(int slot, int reg, unsigned char byte)
/* This function can't do checks to see if multiple devices end up with the same resources, so you might see magic smoke if someone screws up. */ void mca_write_pos(int slot, int reg, unsigned char byte)
{ struct mca_device *mca_dev = mca_find_device_by_slot(slot); if(!mca_dev) return; mca_device_write_pos(mca_dev, reg, byte); }
robutest/uclinux
C++
GPL-2.0
60
/* This function must guarantee that all I/O read and write operations are serialized. If such operations are not supported, then ASSERT(). */
UINT64 EFIAPI IoReadWorker(IN UINTN Port, IN EFI_CPU_IO_PROTOCOL_WIDTH Width)
/* This function must guarantee that all I/O read and write operations are serialized. If such operations are not supported, then ASSERT(). */ UINT64 EFIAPI IoReadWorker(IN UINTN Port, IN EFI_CPU_IO_PROTOCOL_WIDTH Width)
{ EFI_STATUS Status; UINT64 Data; Status = mCpuIo->Io.Read (mCpuIo, Width, Port, 1, &Data); ASSERT_EFI_ERROR (Status); return Data; }
tianocore/edk2
C++
Other
4,240
/* Erase a Page of FLASH. Note that the page sizes differ between devices. See the reference manual or the FLASH programming manual for details. */
void flash_erase_page(uint32_t page_address)
/* Erase a Page of FLASH. Note that the page sizes differ between devices. See the reference manual or the FLASH programming manual for details. */ void flash_erase_page(uint32_t page_address)
{ flash_wait_for_last_operation(); FLASH_CR |= FLASH_CR_PER; FLASH_AR = page_address; FLASH_CR |= FLASH_CR_STRT; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_PER; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* The packets that are spewed tend to all have deltas between -2 and 2, and the cursor will move around without really going very far. It will tend to end up in the same location; if we tally up the changes over 100 packets, we end up w/ a final delta of close to 0. This happens pretty regularly when the touchpad is s...
static void hgpk_spewing_hack(struct psmouse *psmouse, int l, int r, int x, int y)
/* The packets that are spewed tend to all have deltas between -2 and 2, and the cursor will move around without really going very far. It will tend to end up in the same location; if we tally up the changes over 100 packets, we end up w/ a final delta of close to 0. This happens pretty regularly when the touchpad is s...
{ struct hgpk_data *priv = psmouse->private; if (l || r) return; priv->x_tally += x; priv->y_tally += y; if (++priv->count > 100) { if (abs(priv->x_tally) < 3 && abs(priv->y_tally) < 3) { hgpk_dbg(psmouse, "packet spew detected (%d,%d)\n", priv->x_tally, priv->y_tally); psmouse_queue_work(psmouse, &...
robutest/uclinux
C++
GPL-2.0
60
/* This function is executed in case of error occurrence. */
void Error_Handler(void)
/* This function is executed in case of error occurrence. */ void Error_Handler(void)
{ BSP_LED_On(LED4); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* grab the name string from a mapping string */
static char* SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
/* grab the name string from a mapping string */ static char* SDL_PrivateGetControllerNameFromMappingString(const char *pMapping)
{ const char *pFirstComma, *pSecondComma; char *pchName; pFirstComma = SDL_strchr(pMapping, ','); if (!pFirstComma) return NULL; pSecondComma = SDL_strchr(pFirstComma + 1, ','); if (!pSecondComma) return NULL; pchName = SDL_malloc(pSecondComma - pFirstComma); if (!pchName...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Locks GPIO Pins configuration registers. The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH. */
void GPIO_PinLockConfig(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
/* Locks GPIO Pins configuration registers. The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH. */ void GPIO_PinLockConfig(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
{ uint32_t tmp = 0x00010000; assert_param(IS_GPIO_LIST_PERIPH(GPIOx)); assert_param(IS_GPIO_PIN(GPIO_Pin)); tmp |= GPIO_Pin; GPIOx->LCKR = tmp; GPIOx->LCKR = GPIO_Pin; GPIOx->LCKR = tmp; tmp = GPIOx->LCKR; tmp = GPIOx->LCKR; }
ajhc/demo-cortex-m3
C++
null
38
/* This function is executed in case of error occurrence. */
static void Error_Handler(void)
/* This function is executed in case of error occurrence. */ static void Error_Handler(void)
{ BSP_LED_On(LED2); HAL_Delay(1000); BSP_LED_Off(LED2); HAL_Delay(1000); while(1) { } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Same as pbuf_header but does not check if 'header_size > 0' is allowed. This is used internally only, to allow PBUF_REF for RX. */
u8_t pbuf_header_force(struct pbuf *p, s16_t header_size_increment)
/* Same as pbuf_header but does not check if 'header_size > 0' is allowed. This is used internally only, to allow PBUF_REF for RX. */ u8_t pbuf_header_force(struct pbuf *p, s16_t header_size_increment)
{ return pbuf_header_impl(p, header_size_increment, 1); }
Nicholas3388/LuaNode
C++
Other
1,055
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToInt32(IN INTN Operand, OUT INT32 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeIntnToInt32(IN INTN Operand, OUT INT32 *Result)
{ if (Result == NULL) { return RETURN_INVALID_PARAMETER; } *Result = (INT32)Operand; return RETURN_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Signals SMM to synchronize any pending variable updates with the runtime cache(s). */
VOID SyncRuntimeCache(VOID)
/* Signals SMM to synchronize any pending variable updates with the runtime cache(s). */ VOID SyncRuntimeCache(VOID)
{ InitCommunicateBuffer (NULL, 0, SMM_VARIABLE_FUNCTION_SYNC_RUNTIME_CACHE); SendCommunicateBuffer (0); }
tianocore/edk2
C++
Other
4,240
/* enable_intrs - enable interrupts @port: port to enable @mask: mask to use */
static void enable_intrs(struct ioc3_port *port, uint32_t mask)
/* enable_intrs - enable interrupts @port: port to enable @mask: mask to use */ static void enable_intrs(struct ioc3_port *port, uint32_t mask)
{ if ((port->ip_card->ic_enable & mask) != mask) { port->ip_card->ic_enable |= mask; ioc3_enable(port->ip_is, port->ip_idd, mask); } }
robutest/uclinux
C++
GPL-2.0
60
/* Request MBMS Context Activation Reject Direction: MS to network */
static void dtap_sm_req_mbms_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
/* Request MBMS Context Activation Reject Direction: MS to network */ static void dtap_sm_req_mbms_rej(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len)
{ guint32 curr_offset; guint32 consumed; guint curr_len; curr_offset = offset; curr_len = len; pinfo->p2p_dir = P2P_DIR_RECV; ELEM_MAND_V( GSM_A_PDU_TYPE_GM, DE_SM_CAUSE, NULL); ELEM_OPT_TLV( 0x35, GSM_A_PDU_TYPE_GM, DE_MBMS_PROT_CONF_OPT, NULL); EXTRANEOUS_DATA_CHECK(curr_len, 0, pinfo, &ei_gsm_a_gm_extran...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Useful for clk_ops such as .set_rate and .determine_rate. */
int __clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
/* Useful for clk_ops such as .set_rate and .determine_rate. */ int __clk_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
{ if (!hw) { req->rate = 0; return 0; } return clk_core_round_rate_nolock(hw->core, req); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Create and send a dynamic Web Page. This page contains the list of running tasks and the number of page hits. */
void DynWebPage(int conn)
/* Create and send a dynamic Web Page. This page contains the list of running tasks and the number of page hits. */ void DynWebPage(int conn)
{ portCHAR pagehits[10]; memset(PAGE_BODY, 0,512); nPageHits++; sprintf( pagehits, "%d", (int)nPageHits ); strcat(PAGE_BODY, pagehits); strcat((char *) PAGE_BODY, "<pre><br>Name State Priority Stack Num" ); strcat((char *) PAGE_BODY, "<br>---------------------------------------------<br>"); ...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Note: we still hold spinlock of primary hash chain, so no other writer can insert/delete a socket with local_port == num */
static int udp_lib_lport_inuse2(struct net *net, __u16 num, struct udp_hslot *hslot2, struct sock *sk, int(*saddr_comp)(const struct sock *sk1, const struct sock *sk2))
/* Note: we still hold spinlock of primary hash chain, so no other writer can insert/delete a socket with local_port == num */ static int udp_lib_lport_inuse2(struct net *net, __u16 num, struct udp_hslot *hslot2, struct sock *sk, int(*saddr_comp)(const struct sock *sk1, const struct sock *sk2))
{ struct sock *sk2; struct hlist_nulls_node *node; int res = 0; spin_lock(&hslot2->lock); udp_portaddr_for_each_entry(sk2, node, &hslot2->head) if (net_eq(sock_net(sk2), net) && sk2 != sk && (udp_sk(sk2)->udp_port_hash == num) && (!sk2->sk_reuse || !sk->sk_reuse) && (!sk2->sk_bound_dev_if...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Offset the real time clock by a number of microseconds. Note that this only affects the RTC_CLOCK_REALTIME and RTC_CLOCK_PSEUDOHOSTREALTIME clocks. */
void native_rtc_offset(int64_t delta_us)
/* Offset the real time clock by a number of microseconds. Note that this only affects the RTC_CLOCK_REALTIME and RTC_CLOCK_PSEUDOHOSTREALTIME clocks. */ void native_rtc_offset(int64_t delta_us)
{ hwtimer_adjust_rtc_offset(delta_us); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* A local utility function that returns the PCD value, if specified. Otherwise it defaults to ArmGenericTimerGetTimerFreq. */
STATIC UINTN EFIAPI GetPlatformTimerFreq()
/* A local utility function that returns the PCD value, if specified. Otherwise it defaults to ArmGenericTimerGetTimerFreq. */ STATIC UINTN EFIAPI GetPlatformTimerFreq()
{ UINTN TimerFreq; TimerFreq = PcdGet32 (PcdArmArchTimerFreqInHz); if (TimerFreq == 0) { TimerFreq = ArmGenericTimerGetTimerFreq (); } return TimerFreq; }
tianocore/edk2
C++
Other
4,240
/* For one reason or another this nlh isn't getting delivered to the userspace audit daemon, just send it to printk. */
static void audit_printk_skb(struct sk_buff *skb)
/* For one reason or another this nlh isn't getting delivered to the userspace audit daemon, just send it to printk. */ static void audit_printk_skb(struct sk_buff *skb)
{ struct nlmsghdr *nlh = nlmsg_hdr(skb); char *data = NLMSG_DATA(nlh); if (nlh->nlmsg_type != AUDIT_EOE) { if (printk_ratelimit()) printk(KERN_NOTICE "type=%d %s\n", nlh->nlmsg_type, data); else audit_log_lost("printk limit exceeded\n"); } audit_hold_skb(skb); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Calculates the sea-level pressure (in hPa) based on the current altitude (in meters), atmospheric pressure (in hPa), and temperature (in °C) */
float pressureSeaLevelFromAltitude(float altitude, float atmospheric, float temp)
/* Calculates the sea-level pressure (in hPa) based on the current altitude (in meters), atmospheric pressure (in hPa), and temperature (in °C) */ float pressureSeaLevelFromAltitude(float altitude, float atmospheric, float temp)
{ return atmospheric * (float)pow((1.0F - (0.0065 * altitude) / (temp + 0.0065 * altitude + 273.15F)), -5.257F); }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* If 8-bit operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI BitFieldAnd8(IN UINT8 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData)
/* If 8-bit operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI BitFieldAn...
{ ASSERT (EndBit < 8); ASSERT (StartBit <= EndBit); return (UINT8)InternalBaseLibBitFieldAndUint (Operand, StartBit, EndBit, AndData); }
tianocore/edk2
C++
Other
4,240
/* Set up internal state. If a pointer to an array of clockdomains was supplied, loop through the list of clockdomains, register all that are available on the current platform. Similarly, if a pointer to an array of clockdomain-powerdomain autodependencies was provided, register those. No return value. */
void clkdm_init(struct clockdomain **clkdms, struct clkdm_pwrdm_autodep *init_autodeps)
/* Set up internal state. If a pointer to an array of clockdomains was supplied, loop through the list of clockdomains, register all that are available on the current platform. Similarly, if a pointer to an array of clockdomain-powerdomain autodependencies was provided, register those. No return value. */ void clkdm_i...
{ struct clockdomain **c = NULL; struct clkdm_pwrdm_autodep *autodep = NULL; if (clkdms) for (c = clkdms; *c; c++) clkdm_register(*c); autodeps = init_autodeps; if (autodeps) for (autodep = autodeps; autodep->pwrdm.ptr; autodep++) _autodep_lookup(autodep); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Just throw the needed data at the libata helper and it does all our work. */
static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
/* Just throw the needed data at the libata helper and it does all our work. */ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
{ static const struct ata_port_info info = { .flags = ATA_FLAG_SLAVE_POSS, .pio_mask = ATA_PIO4, .mwdma_mask = ATA_MWDMA2, .udma_mask = ATA_UDMA2, .port_ops = &sc1200_port_ops }; const struct ata_port_info *ppi[] = { &info, NULL }; return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Attribute write call back for the Value V2 attribute. */
static ssize_t write_value_v2_7(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Value V2 attribute. */ static ssize_t write_value_v2_7(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ char *value = attr->user_data; if (offset >= sizeof(value_v2_7_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(value_v2_7_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); if (!bAuthorized) return BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION); memcpy(value + offset, buf...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Configures the register SIDFC for the 11-bit Standard Message ID Filter elements. */
static void CANFD_ConfigSIDFC(CANFD_T *psCanfd, CANFD_RAM_PART_T *psRamConfig, CANFD_ELEM_SIZE_T *psElemSize)
/* Configures the register SIDFC for the 11-bit Standard Message ID Filter elements. */ static void CANFD_ConfigSIDFC(CANFD_T *psCanfd, CANFD_RAM_PART_T *psRamConfig, CANFD_ELEM_SIZE_T *psElemSize)
{ uint32_t u32Address; psCanfd->SIDFC = ((psElemSize->u32SIDFC & 0xFF) << CANFD_SIDFC_LSS_Pos) | (psRamConfig->u32SIDFC_FLSSA & CANFD_SIDFC_FLSSA_Msk); u32Address = CANFD_SRAM_BASE_ADDR(psCanfd) + (psRamConfig->u32SIDFC_FLSSA & CANFD_SIDFC_FLSSA_Msk); memset((uint32_t *)(u32Address), 0x00, (psElemSize->...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If PatchVariable is NULL, then ASSERT(). If SizeOfPatchVariable is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). */
VOID* EFIAPI LibPatchPcdSetPtrAndSize(OUT VOID *PatchVariable, OUT UINTN *SizeOfPatchVariable, IN UINTN MaximumDatumSize, IN OUT UINTN *SizeOfBuffer, IN CONST VOID *Buffer)
/* If PatchVariable is NULL, then ASSERT(). If SizeOfPatchVariable is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). */ VOID* EFIAPI LibPatchPcdSetPtrAndSize(OUT VOID *PatchVariable, OUT UINTN *SizeOfPatchVariable, IN UINTN MaximumDatumSize, IN OUT UI...
{ ASSERT (PatchVariable != NULL); ASSERT (SizeOfPatchVariable != NULL); ASSERT (SizeOfBuffer != NULL); if (*SizeOfBuffer > 0) { ASSERT (Buffer != NULL); } if ((*SizeOfBuffer > MaximumDatumSize) || (*SizeOfBuffer == MAX_ADDRESS)) { *SizeOfBuffer = MaximumDatumSize; return NULL; } Cop...
tianocore/edk2
C++
Other
4,240
/* Retrieve ordinal number of the given afec hardware instance. */
static uint8_t _afec_get_hardware_index(const void *const hw)
/* Retrieve ordinal number of the given afec hardware instance. */ static uint8_t _afec_get_hardware_index(const void *const hw)
{ if (hw == AFEC0) { return 0; } else if (hw == AFEC1) { return 1; } ASSERT(false); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* When GPIO is in output mode, puts the corresponding GPO in High (1) or Low (0) level. */
void mfxstm32l152_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState)
/* When GPIO is in output mode, puts the corresponding GPO in High (1) or Low (0) level. */ void mfxstm32l152_IO_WritePin(uint16_t DeviceAddr, uint32_t IO_Pin, uint8_t PinState)
{ if (PinState != 0) { mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPO_SET1, IO_Pin, 1); } else { mfxstm32l152_reg24_setPinValue(DeviceAddr, MFXSTM32L152_REG_ADR_GPO_CLR1, IO_Pin, 1); } }
eclipse-threadx/getting-started
C++
Other
310
/* Clears the user bits in the status word (16-bits) of an LPC Channel. */
void LPCChannelStatusClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulStatus)
/* Clears the user bits in the status word (16-bits) of an LPC Channel. */ void LPCChannelStatusClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulStatus)
{ unsigned long ulTemp; ASSERT(ulBase == LPC0_BASE); ASSERT(LPCChannelValid(ulChannel)); ASSERT((ulStatus & (~LPC_CH0ST_USER_M)) == 0); ulTemp = HWREG(ulBase + LPC_O_CH0ST + (ulChannel * 0x10)); ulTemp &= ~ulStatus; HWREG(ulBase + LPC_O_CH0ST + (ulChannel * 0x10)) = ulTemp; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable or disable the Read of low-voltage mode. */
void EFM_LowVoltageReadCmd(en_functional_state_t enNewState)
/* Enable or disable the Read of low-voltage mode. */ void EFM_LowVoltageReadCmd(en_functional_state_t enNewState)
{ DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); DDL_ASSERT(IS_EFM_REG_UNLOCK()); WRITE_REG32(bCM_EFM->FRMC_b.SLPMD, enNewState); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sends an amount of data in non blocking mode. */
static ald_status_t __uart_send_by_it(ald_uart_handle_t *hperh)
/* Sends an amount of data in non blocking mode. */ static ald_status_t __uart_send_by_it(ald_uart_handle_t *hperh)
{ if ((hperh->state & ALD_UART_STATE_TX_MASK) == 0x0) return ALD_BUSY; hperh->perh->TXBUF = (uint8_t)(*hperh->tx_buf++ & 0x00FF); hperh->tx_count++; if (hperh->tx_count >= hperh->tx_size) { ald_uart_interrupt_config(hperh, ALD_UART_IT_TFEMPTY, DISABLE); ald_uart_interrupt_con...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the frequency of PLL USB1 software clock. */
static uint32_t CLOCK_GetPllUsb1SWFreq(void)
/* Get the frequency of PLL USB1 software clock. */ static uint32_t CLOCK_GetPllUsb1SWFreq(void)
{ uint32_t freq; switch ((CCM->CCSR & CCM_CCSR_PLL3_SW_CLK_SEL_MASK) >> CCM_CCSR_PLL3_SW_CLK_SEL_SHIFT) { case 0: { freq = CLOCK_GetPllFreq(kCLOCK_PllUsb1); break; } case 1: { freq = 24000000UL; break; } ...
eclipse-threadx/getting-started
C++
Other
310
/* This makes me sad. the maestro3 has lists internally that must be packed.. 0 terminates, apparently, or maybe all unused entries have to be 0, the lists have static lengths set by the binary code images. */
static int snd_m3_add_list(struct snd_m3 *chip, struct m3_list *list, u16 val)
/* This makes me sad. the maestro3 has lists internally that must be packed.. 0 terminates, apparently, or maybe all unused entries have to be 0, the lists have static lengths set by the binary code images. */ static int snd_m3_add_list(struct snd_m3 *chip, struct m3_list *list, u16 val)
{ snd_m3_assp_write(chip, MEMTYPE_INTERNAL_DATA, list->mem_addr + list->curlen, val); return list->curlen++; }
robutest/uclinux
C++
GPL-2.0
60
/* If 64-bit I/O port operations are not supported, then ASSERT(). */
UINT64 EFIAPI S3IoOr64(IN UINTN Port, IN UINT64 OrData)
/* If 64-bit I/O port operations are not supported, then ASSERT(). */ UINT64 EFIAPI S3IoOr64(IN UINTN Port, IN UINT64 OrData)
{ return InternalSaveIoWrite64ValueToBootScript (Port, IoOr64 (Port, OrData)); }
tianocore/edk2
C++
Other
4,240
/* uea_init - Initialize the module. Register to USB subsystem */
static int __init uea_init(void)
/* uea_init - Initialize the module. Register to USB subsystem */ static int __init uea_init(void)
{ printk(KERN_INFO "[ueagle-atm] driver " EAGLEUSBVERSION " loaded\n"); usb_register(&uea_driver); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the xmlChar * for the first occurrence or NULL. */
xmlChar* xmlStrsub(const xmlChar *str, int start, int len)
/* Returns the xmlChar * for the first occurrence or NULL. */ xmlChar* xmlStrsub(const xmlChar *str, int start, int len)
{ if (*str == 0) return(NULL); str++; } if (*str == 0) return(NULL); return(xmlStrndup(str, len)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clone a task - this clones the calling program thread. This is called indirectly via a small wrapper */
asmlinkage long score_clone(struct pt_regs *regs)
/* Clone a task - this clones the calling program thread. This is called indirectly via a small wrapper */ asmlinkage long score_clone(struct pt_regs *regs)
{ unsigned long clone_flags; unsigned long newsp; int __user *parent_tidptr, *child_tidptr; clone_flags = regs->regs[4]; newsp = regs->regs[5]; if (!newsp) newsp = regs->regs[0]; parent_tidptr = (int __user *)regs->regs[6]; child_tidptr = (int __user *)regs->regs[8]; return do_fork(clone_flags, newsp, regs, ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* The function will add a memory region configuraiton for a thread. */
rt_err_t rt_mprotect_add_region(rt_thread_t thread, rt_mem_region_t *region)
/* The function will add a memory region configuraiton for a thread. */ rt_err_t rt_mprotect_add_region(rt_thread_t thread, rt_mem_region_t *region)
{ if (thread == RT_NULL) { thread = rt_thread_self(); } if (thread->mem_regions == RT_NULL) { thread->mem_regions = RT_KERNEL_MALLOC(NUM_DYNAMIC_REGIONS * sizeof(rt_mem_region_t)); if (thread->mem_regions == RT_NULL) { return RT_ERROR; } rt...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is used to set IP divider number from the corresponding clock source. The divider number is chosen with one of the following values: divider 1-16 for peripheral */
void SysCtlIPClockDividerSet(unsigned long ulConfig)
/* This function is used to set IP divider number from the corresponding clock source. The divider number is chosen with one of the following values: divider 1-16 for peripheral */ void SysCtlIPClockDividerSet(unsigned long ulConfig)
{ xASSERT((ulConfig & 0xFF)<=256); xHWREG(g_pulIPRSTRegs[SYSCTL_PERIPH_INDEX_CLK(ulConfig)]) &= ~(SYSCTL_PERIPH_MASK_CLK(ulConfig)); xHWREG(g_pulIPRSTRegs[SYSCTL_PERIPH_INDEX_CLK(ulConfig)]) |= (SYSCTL_PERIPH_ENUM_CLK(ulConfig)-1); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Read a single byte from the usb client port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
int usbtty_getc(struct stdio_dev *dev)
/* Read a single byte from the usb client port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */ int usbtty_getc(struct stdio_dev *dev)
{ char c; struct usb_endpoint_instance *endpoint = &endpoint_instance[rx_endpoint]; while (usbtty_input.size <= 0) { udc_unset_nak(endpoint->endpoint_address&0x03); usbtty_poll (); } buf_pop (&usbtty_input, &c, 1); udc_set_nak(endpoint->endpoint_address&0x03); return c; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Save user physical presence state from a PCD to mUserPhysicalPresence. */
RETURN_STATUS EFIAPI PlatformSecureLibNullConstructor(VOID)
/* Save user physical presence state from a PCD to mUserPhysicalPresence. */ RETURN_STATUS EFIAPI PlatformSecureLibNullConstructor(VOID)
{ mUserPhysicalPresence = PcdGetBool (PcdUserPhysicalPresence); return RETURN_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* mos7840_get_reg_sync To set the Uart register by calling usb_fill_control_urb function by passing usb_rcvctrlpipe function as parameter. */
static int mos7840_get_reg_sync(struct usb_serial_port *port, __u16 reg, __u16 *val)
/* mos7840_get_reg_sync To set the Uart register by calling usb_fill_control_urb function by passing usb_rcvctrlpipe function as parameter. */ static int mos7840_get_reg_sync(struct usb_serial_port *port, __u16 reg, __u16 *val)
{ struct usb_device *dev = port->serial->dev; int ret = 0; ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), MCS_RDREQ, MCS_RD_RTYPE, 0, reg, val, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); dbg("mos7840_get_reg_sync offset is %x, return val %x", reg, *val); *val = (*val) & 0x00ff; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Request ownership for an IO pin. This function has to be the first one being called before that pin is used. The caller has to check the return value to make sure it returns 0. */
void mxc_request_iomux(iomux_pin_name_t pin, iomux_pin_cfg_t cfg)
/* Request ownership for an IO pin. This function has to be the first one being called before that pin is used. The caller has to check the return value to make sure it returns 0. */ void mxc_request_iomux(iomux_pin_name_t pin, iomux_pin_cfg_t cfg)
{ iomux_config_mux(pin, cfg); }
EmcraftSystems/u-boot
C++
Other
181
/* Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration of the USB device after enumeration - the device endpoints are configured and the CDC management task started. */
void EVENT_USB_Device_ConfigurationChanged(void)
/* Event handler for the USB_ConfigurationChanged event. This is fired when the host set the current configuration of the USB device after enumeration - the device endpoints are configured and the CDC management task started. */ void EVENT_USB_Device_ConfigurationChanged(void)
{ bool ConfigSuccess = true; ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_NOTIFICATION_EPADDR, EP_TYPE_INTERRUPT, CDC_NOTIFICATION_EPSIZE, 1); ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_TX_EPADDR, EP_TYPE_BULK, CDC_TXRX_EPSIZE, 1); ConfigSuccess &= Endpoint_ConfigureEndpoint(CDC_RX_EPADDR, EP_TYPE_BULK, CD...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This function loads the X.509 certificate into the specified TLS object for TLS negotiation. */
EFI_STATUS EFIAPI TlsSetHostPublicCert(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
/* This function loads the X.509 certificate into the specified TLS object for TLS negotiation. */ EFI_STATUS EFIAPI TlsSetHostPublicCert(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
{ CALL_CRYPTO_SERVICE (TlsSetHostPublicCert, (Tls, Data, DataSize), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* Reads a byte of data from the memory of the LCD controller. DMDIF_prepareDataAccess() needs to be called before using this function. DOESN'T WORK. */
uint32_t DMDIF_readData(void)
/* Reads a byte of data from the memory of the LCD controller. DMDIF_prepareDataAccess() needs to be called before using this function. DOESN'T WORK. */ uint32_t DMDIF_readData(void)
{ uint32_t data; data = DVK__readRegister( (uint16_t *) data_register ) << 9; data |= DVK_readRegister( (uint16_t *) data_register ); return data; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This I2C function puts the SHA204 device into idle state. */
uint8_t sha204p_idle(void)
/* This I2C function puts the SHA204 device into idle state. */ uint8_t sha204p_idle(void)
{ return sha204p_send(SHA204_I2C_PACKET_FUNCTION_IDLE, 0, NULL); }
remotemcu/remcu-chip-sdks
C++
null
436
/* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */
static void ctcm_chx_rxdisc(fsm_instance *fi, int event, void *arg)
/* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */ static void ctcm_chx_rxdisc(fsm_instance *fi, int event, void *arg)
{ struct channel *ch = arg; struct channel *ch2; struct net_device *dev = ch->netdev; struct ctcm_priv *priv = dev->ml_priv; CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, "%s: %s: remote disconnect - re-init ...", CTCM_FUNTAIL, dev->name); fsm_deltimer(&ch->timer); fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); fs...
robutest/uclinux
C++
GPL-2.0
60
/* Disable the ADC module. Disable an ADC module that has previously been configured. */
void adc_disable(void)
/* Disable the ADC module. Disable an ADC module that has previously been configured. */ void adc_disable(void)
{ system_clock_peripheral_disable(PERIPHERAL_ADC); AON_GP_REGS0->AON_PMU_CTRL.reg &= \ ~(AON_GP_REGS_AON_PMU_CTRL_PMU_SENS_ADC_EN | \ AON_GP_REGS_AON_PMU_CTRL_PMU_BGR_EN); }
memfault/zero-to-main
C++
null
200
/* Ethernet PHY Interface Selection either MII or RMII. */
void HAL_SYSCFG_ETHInterfaceSelect(uint32_t SYSCFG_ETHInterface)
/* Ethernet PHY Interface Selection either MII or RMII. */ void HAL_SYSCFG_ETHInterfaceSelect(uint32_t SYSCFG_ETHInterface)
{ assert_param(IS_SYSCFG_ETHERNET_CONFIG(SYSCFG_ETHInterface)); SYSCFG->PMCCLRR = SYSCFG_PMCSETR_ETH_SEL|SYSCFG_PMCSETR_ETH_SELMII_SEL; SYSCFG->PMCSETR = (uint32_t)(SYSCFG_ETHInterface); }
ua1arn/hftrx
C++
null
69
/* If 64-bit operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger tha...
UINT64 EFIAPI BitFieldAndThenOr64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData, IN UINT64 OrData)
/* If 64-bit operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger tha...
{ ASSERT (EndBit < 64); ASSERT (StartBit <= EndBit); return BitFieldOr64 ( BitFieldAnd64 (Operand, StartBit, EndBit, AndData), StartBit, EndBit, OrData ); }
tianocore/edk2
C++
Other
4,240
/* The user Entry Point for the PKCS7 Verification driver. */
EFI_STATUS EFIAPI Pkcs7VerifyDriverEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The user Entry Point for the PKCS7 Verification driver. */ EFI_STATUS EFIAPI Pkcs7VerifyDriverEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; EFI_HANDLE Handle; EFI_PKCS7_VERIFY_PROTOCOL Useless; Status = gBS->LocateProtocol (&gEfiPkcs7VerifyProtocolGuid, NULL, (VOID **)&Useless); if (!EFI_ERROR (Status)) { return EFI_ABORTED; } Handle = NULL; Status = gBS->InstallMultipleProtocolInter...
tianocore/edk2
C++
Other
4,240
/* The important thing is that only one context begins cleanup. This is why error handling and cleanup become simple. We do not want to consider race condition as possible. */
static void vhci_shutdown_connection(struct usbip_device *ud)
/* The important thing is that only one context begins cleanup. This is why error handling and cleanup become simple. We do not want to consider race condition as possible. */ static void vhci_shutdown_connection(struct usbip_device *ud)
{ struct vhci_device *vdev = container_of(ud, struct vhci_device, ud); if (ud->tcp_socket) { usbip_udbg("shutdown tcp_socket %p\n", ud->tcp_socket); kernel_sock_shutdown(ud->tcp_socket, SHUT_RDWR); } usbip_stop_threads(&vdev->ud); usbip_uinfo("stop threads\n"); if (vdev->ud.tcp_socket != NULL) { sock_releas...
robutest/uclinux
C++
GPL-2.0
60
/* The Protected Mode Interface is 32-bit x86 code, so we only run it on x86 and not x86_64. Check whether a video mode is supported by the Video BIOS and is compatible with the monitor limits. */
static int __devinit uvesafb_is_valid_mode(struct fb_videomode *mode, struct fb_info *info)
/* The Protected Mode Interface is 32-bit x86 code, so we only run it on x86 and not x86_64. Check whether a video mode is supported by the Video BIOS and is compatible with the monitor limits. */ static int __devinit uvesafb_is_valid_mode(struct fb_videomode *mode, struct fb_info *info)
{ if (info->monspecs.gtf) { fb_videomode_to_var(&info->var, mode); if (fb_validate_mode(&info->var, info)) return 0; } if (uvesafb_vbe_find_mode(info->par, mode->xres, mode->yres, 8, UVESAFB_EXACT_RES) == -1) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Attribute read call back for the Value V8 attribute. */
static ssize_t read_value_v8(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Value V8 attribute. */ static ssize_t read_value_v8(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint8_t *value = attr->user_data; return bt_gatt_attr_read(conn, attr, buf, len, offset, value, sizeof(value_v8_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* link is up, continue any user processes, and ensure timer is a nop, if running. Let timer keep running, if set; it will nop when it sees the link is up */
void ipath_hol_up(struct ipath_devdata *dd)
/* link is up, continue any user processes, and ensure timer is a nop, if running. Let timer keep running, if set; it will nop when it sees the link is up */ void ipath_hol_up(struct ipath_devdata *dd)
{ ipath_hol_signal_up(dd); dd->ipath_hol_state = IPATH_HOL_UP; }
robutest/uclinux
C++
GPL-2.0
60
/* The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero, this function will return to the caller and not iterate over any more devices. */
struct device* bus_find_device(struct bus_type *bus, struct device *start, void *data, int(*match)(struct device *dev, void *data))
/* The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero, this function will return to the caller and not iterate over any more devices. */ struct device* bus_find_device(struct bus_type *bus, struct device *start, void *data, int(*match)(struct device *dev,...
{ struct klist_iter i; struct device *dev; if (!bus) return NULL; klist_iter_init_node(&bus->p->klist_devices, &i, (start ? &start->p->knode_bus : NULL)); while ((dev = next_device(&i))) if (match(dev, data) && get_device(dev)) break; klist_iter_exit(&i); return dev; }
robutest/uclinux
C++
GPL-2.0
60
/* On success, returns 1 if this snapshot is a handover destination, otherwise returns 0. */
static int __validate_exception_handover(struct dm_snapshot *snap)
/* On success, returns 1 if this snapshot is a handover destination, otherwise returns 0. */ static int __validate_exception_handover(struct dm_snapshot *snap)
{ struct dm_snapshot *snap_src = NULL, *snap_dest = NULL; struct dm_snapshot *snap_merge = NULL; if ((__find_snapshots_sharing_cow(snap, &snap_src, &snap_dest, &snap_merge) == 2) || snap_dest) { snap->ti->error = "Snapshot cow pairing for exception " "table handover failed"; return -EINVAL; } ...
robutest/uclinux
C++
GPL-2.0
60
/* Returns the number of bytes received on success, or else the status code returned by the underlying usb_control_msg() call. */
s32 usb_get_descriptor(struct usb_host_virt_dev *dev, u8 type, u8 index, void *buf, s32 size)
/* Returns the number of bytes received on success, or else the status code returned by the underlying usb_control_msg() call. */ s32 usb_get_descriptor(struct usb_host_virt_dev *dev, u8 type, u8 index, void *buf, s32 size)
{ int i = 0; int result = 0; memset(buf, 0, size); for (i = 0; i < 3; ++i) { result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Memory allocation and freeing are controlled by the regular library routines malloc() and free(). */
jpeg_get_small(j_common_ptr cinfo, size_t sizeofobject)
/* Memory allocation and freeing are controlled by the regular library routines malloc() and free(). */ jpeg_get_small(j_common_ptr cinfo, size_t sizeofobject)
{ return (void *) JMALLOC(sizeofobject); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function should not be in .ramcode, because it will be called only once before self-upgrade. */
u32 lpc178x_iap_read_part_id_num(void)
/* This function should not be in .ramcode, because it will be called only once before self-upgrade. */ u32 lpc178x_iap_read_part_id_num(void)
{ iap_commands[0] = IAP_CMD_READ_PART_ID; lpc178x_iap_entry(iap_commands, iap_results); return iap_results[1]; }
EmcraftSystems/u-boot
C++
Other
181
/* input: han - handle to identify resources output: cb - pointer to first CBR dsr - pointer to first DSR */
void gru_lock_async_resource(unsigned long han, void **cb, void **dsr)
/* input: han - handle to identify resources output: cb - pointer to first CBR dsr - pointer to first DSR */ void gru_lock_async_resource(unsigned long han, void **cb, void **dsr)
{ struct gru_blade_state *bs = ASYNC_HAN_TO_BS(han); int blade_id = ASYNC_HAN_TO_BID(han); int ncpus; gru_lock_kernel_context(blade_id); ncpus = uv_blade_nr_possible_cpus(blade_id); if (cb) *cb = bs->kernel_cb + ncpus * GRU_HANDLE_STRIDE; if (dsr) *dsr = bs->kernel_dsr + ncpus * GRU_NUM_KERNEL_DSR_BYTES; }
robutest/uclinux
C++
GPL-2.0
60
/* If 16-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI S3MmioBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
/* If 16-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16...
{ return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldAnd16 (Address, StartBit, EndBit, AndData)); }
tianocore/edk2
C++
Other
4,240
/* Find an MPU address region an address belongs to */
static mpu_addr_region_t* mpu_addr_region_find(unsigned long a)
/* Find an MPU address region an address belongs to */ static mpu_addr_region_t* mpu_addr_region_find(unsigned long a)
{ int i; int f; mpu_addr_region_t *r; for (i = 0, f = 0, r = 0; i < mpu_addr_region_next && !f; i++) { r = &mpu_addr_region_tbl[i]; f = (r->bot <= a) && (a < r->top); } return f ? r : (mpu_addr_region_t *) 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set default master type of the specified slave. */
void matrix_set_slave_default_master_type(uint32_t ul_id, defaut_master_t type)
/* Set default master type of the specified slave. */ void matrix_set_slave_default_master_type(uint32_t ul_id, defaut_master_t type)
{ Matrix *p_matrix = MATRIX; volatile uint32_t ul_reg; ul_reg = p_matrix->MATRIX_SCFG[ul_id] & (~MATRIX_SCFG_DEFMSTR_TYPE_Msk); p_matrix->MATRIX_SCFG[ul_id] = ul_reg | (uint32_t)type; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Find the physical pxa27x ep, and setup its UDCCR */
static __init void pxa_ep_setup(struct pxa_ep *ep)
/* Find the physical pxa27x ep, and setup its UDCCR */ static __init void pxa_ep_setup(struct pxa_ep *ep)
{ u32 new_udccr; new_udccr = ((ep->config << UDCCONR_CN_S) & UDCCONR_CN) | ((ep->interface << UDCCONR_IN_S) & UDCCONR_IN) | ((ep->alternate << UDCCONR_AISN_S) & UDCCONR_AISN) | ((EPADDR(ep) << UDCCONR_EN_S) & UDCCONR_EN) | ((EPXFERTYPE(ep) << UDCCONR_ET_S) & UDCCONR_ET) | ((ep->dir_in) ? UDCCONR_ED : 0) |...
robutest/uclinux
C++
GPL-2.0
60
/* Set the addresses of the buffer 0 and 1. */
void USB_SetEpDblBuferAddr(uint8_t bEpNum, uint16_t wBuf0Addr, uint16_t wBuf1Addr)
/* Set the addresses of the buffer 0 and 1. */ void USB_SetEpDblBuferAddr(uint8_t bEpNum, uint16_t wBuf0Addr, uint16_t wBuf1Addr)
{ _SetEPDblBuffAddr(bEpNum, wBuf0Addr, wBuf1Addr); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Initialize Base protocol and install protocol on a given handle. */
EFI_STATUS ScmiBaseProtocolInit(IN OUT EFI_HANDLE *Handle)
/* Initialize Base protocol and install protocol on a given handle. */ EFI_STATUS ScmiBaseProtocolInit(IN OUT EFI_HANDLE *Handle)
{ return gBS->InstallMultipleProtocolInterfaces ( Handle, &gArmScmiBaseProtocolGuid, &BaseProtocol, NULL ); }
tianocore/edk2
C++
Other
4,240
/* Sets the UART hardware flow control mode to be used. */
void xUARTFlowControlSet(unsigned long ulBase, unsigned long ulMode)
/* Sets the UART hardware flow control mode to be used. */ void xUARTFlowControlSet(unsigned long ulBase, unsigned long ulMode)
{ UARTFlowControlSet(ulBase, ulMode); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set selected GPIO Interrupts. ui64InterruptMask should be a logical or of AM_HAL_GPIO_BITx defines. */
void am_hal_gpio_int_set(uint64_t ui64InterruptMask)
/* Set selected GPIO Interrupts. ui64InterruptMask should be a logical or of AM_HAL_GPIO_BITx defines. */ void am_hal_gpio_int_set(uint64_t ui64InterruptMask)
{ AM_REG(GPIO, INT1SET) = (ui64InterruptMask >> 32); AM_REG(GPIO, INT0SET) = (ui64InterruptMask & 0xFFFFFFFF); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Closes an endpoint of the low level driver. */
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Closes an endpoint of the low level driver. */ USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_Close(pdev->pData, ep_addr); switch (hal_status) { case HAL_OK : usb_status = USBD_OK; break; case HAL_ERROR : usb_status = USBD_FAIL; break; case HAL_BUSY : usb_status...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Description: Add a new CIPSO DOI definition as defined by @doi_def. Returns zero on success and negative values on failure. */
int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def, struct netlbl_audit *audit_info)
/* Description: Add a new CIPSO DOI definition as defined by @doi_def. Returns zero on success and negative values on failure. */ int netlbl_cfg_cipsov4_add(struct cipso_v4_doi *doi_def, struct netlbl_audit *audit_info)
{ return cipso_v4_doi_add(doi_def, audit_info); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Note, we currently do not try and look to see if we've already copied the data in a previous set. */
static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
/* Note, we currently do not try and look to see if we've already copied the data in a previous set. */ static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
{ void *ptr; int size; size = sizeof(struct mtd_partition) * set->nr_partitions; if (size) { ptr = kmemdup(set->partitions, size, GFP_KERNEL); set->partitions = ptr; if (!ptr) return -ENOMEM; } if (set->nr_map && set->nr_chips) { size = sizeof(int) * set->nr_chips; ptr = kmemdup(set->nr_map, size, GF...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This routine is the driver/module removal entry point. It unregisters the driver as an OpenFirmware device tree platform driver. */
static void __exit ppc4xx_edac_exit(void)
/* This routine is the driver/module removal entry point. It unregisters the driver as an OpenFirmware device tree platform driver. */ static void __exit ppc4xx_edac_exit(void)
{ of_unregister_platform_driver(&ppc4xx_edac_driver); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the newest character in the CLI FIFO. */
void cli_get_last_character(struct cli_desc *dev, uint8_t *new_char)
/* Get the newest character in the CLI FIFO. */ void cli_get_last_character(struct cli_desc *dev, uint8_t *new_char)
{ if (!uart_line_index) return; *new_char = uart_current_line[(uart_line_index - 1)]; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Sets the LCD clock mode, i.e. always active or active only during display period. */
void LCD_SetClockMode(unsigned int clockMode)
/* Sets the LCD clock mode, i.e. always active or active only during display period. */ void LCD_SetClockMode(unsigned int clockMode)
{ unsigned int value; ASSERT((clockMode & ~AT91C_LCDC_CLKMOD) == 0, "LCD_SetScanMode: Wrong scan mode value.\n\r"); value = AT91C_BASE_LCDC->LCDC_LCDCON2; value &= ~AT91C_LCDC_CLKMOD; value |= clockMode; AT91C_BASE_LCDC->LCDC_LCDCON2 = value; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Given a circuit type and ID, and a frame number, search for a circuit with that type and ID whose range of frames includes that frame number. Returns NULL if not found. */
circuit_t* find_circuit(circuit_type ctype, guint32 circuit_id, guint32 frame)
/* Given a circuit type and ID, and a frame number, search for a circuit with that type and ID whose range of frames includes that frame number. Returns NULL if not found. */ circuit_t* find_circuit(circuit_type ctype, guint32 circuit_id, guint32 frame)
{ circuit_key key; circuit_t *circuit; key.ctype = ctype; key.circuit_id = circuit_id; for (circuit = (circuit_t *)g_hash_table_lookup(circuit_hashtable, &key); circuit != NULL; circuit = circuit->next) { if ((circuit->first_frame == 0 || circuit->first_frame <= frame) && (circuit->last_frame == 0 || ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* ad1843_get_gain reads the specified register and extracts the gain value using the supplied gain type. */
int ad1843_get_gain(struct snd_ad1843 *ad1843, int id)
/* ad1843_get_gain reads the specified register and extracts the gain value using the supplied gain type. */ int ad1843_get_gain(struct snd_ad1843 *ad1843, int id)
{ int lg, rg, lm, rm; const struct ad1843_gain *gp = ad1843_gain[id]; unsigned short mask = (1 << gp->lfield->nbits) - 1; ad1843_read_multi(ad1843, 2, gp->lfield, &lg, gp->rfield, &rg); if (gp->negative) { lg = mask - lg; rg = mask - rg; } if (gp->lmute) { ad1843_read_multi(ad1843, 2, gp->lmute, &lm, gp->r...
robutest/uclinux
C++
GPL-2.0
60
/* __audit_fd_pair - record audit data for pipe and socketpair @fd1: the first file descriptor @fd2: the second file descriptor */
void __audit_fd_pair(int fd1, int fd2)
/* __audit_fd_pair - record audit data for pipe and socketpair @fd1: the first file descriptor @fd2: the second file descriptor */ void __audit_fd_pair(int fd1, int fd2)
{ struct audit_context *context = current->audit_context; context->fds[0] = fd1; context->fds[1] = fd2; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the current operating mode for the UART transmit interrupt. */
unsigned long UARTTxIntModeGet(unsigned long ulBase)
/* Returns the current operating mode for the UART transmit interrupt. */ unsigned long UARTTxIntModeGet(unsigned long ulBase)
{ ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE) || (ulBase == UART2_BASE)); return(HWREG(ulBase + UART_O_CTL) & (UART_TXINT_MODE_EOT | UART_TXINT_MODE_FIFO)); }
watterott/WebRadio
C++
null
71
/* DAC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_DAC_MspInit(DAC_HandleTypeDef *hdac)
/* DAC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_DAC_MspInit(DAC_HandleTypeDef *hdac)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hdac->Instance==DAC) { __HAL_RCC_DAC_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Setup a timer to schedule a function call */
struct hndrte_timer* schedule_work(void *context, void *data, void *mainfn, int ms, int periodic)
/* Setup a timer to schedule a function call */ struct hndrte_timer* schedule_work(void *context, void *data, void *mainfn, int ms, int periodic)
{ struct hndrte_timer *task; task = hndrte_init_timer(context, data, mainfn, 0); if (task) { if(!hndrte_add_timer(task, ms, periodic)) hndrte_free_timer(task); } return task; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Note: The host lock held by the libata layer protects us from two channels both trying to set DMA bits at once */
static void atiixp_bmdma_stop(struct ata_queued_cmd *qc)
/* Note: The host lock held by the libata layer protects us from two channels both trying to set DMA bits at once */ static void atiixp_bmdma_stop(struct ata_queued_cmd *qc)
{ struct ata_port *ap = qc->ap; struct pci_dev *pdev = to_pci_dev(ap->host->dev); int dn = (2 * ap->port_no) + qc->dev->devno; u16 tmp16; pci_read_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, &tmp16); tmp16 &= ~(1 << dn); pci_write_config_word(pdev, ATIIXP_IDE_UDMA_CONTROL, tmp16); ata_bmdma_stop(qc); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* We are searching for a record in between, not an exact match. */
static int func_bcmp(const void *a, const void *b)
/* We are searching for a record in between, not an exact match. */ static int func_bcmp(const void *a, const void *b)
{ const struct func_map *fa = a; const struct func_map *fb = b; if ((fa->addr == fb->addr) || (fa->addr > fb->addr && fa->addr < (fb+1)->addr)) return 0; if (fa->addr < fb->addr) return -1; return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the address of the next matching extended capability structure within the device's PCI configuration space or 0 if the device does not support it. Some capabilities can occur several times, e.g., the vendor-specific capability, and this provides a way to find them all. */
int pci_find_next_ext_capability(struct pci_controller *hose, pci_dev_t dev, int start, int cap)
/* Returns the address of the next matching extended capability structure within the device's PCI configuration space or 0 if the device does not support it. Some capabilities can occur several times, e.g., the vendor-specific capability, and this provides a way to find them all. */ int pci_find_next_ext_capability(st...
{ u32 header; int ttl, pos = PCI_CFG_SPACE_SIZE; ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8; if (start) pos = start; pci_hose_read_config_dword(hose, dev, pos, &header); if (header == 0xffffffff || header == 0) return 0; while (ttl-- > 0) { if (PCI_EXT_CAP_ID(header) == cap && pos != start) ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Currently, all pixman_format_code_t values are supported except for the YUV formats. */
PIXMAN_EXPORT pixman_bool_t pixman_format_supported_destination(pixman_format_code_t format)
/* Currently, all pixman_format_code_t values are supported except for the YUV formats. */ PIXMAN_EXPORT pixman_bool_t pixman_format_supported_destination(pixman_format_code_t format)
{ if (format == PIXMAN_yuy2 || format == PIXMAN_yv12) return FALSE; return pixman_format_supported_source (format); }
xboot/xboot
C++
MIT License
779
/* @argvp: Returns newly allocated args list @add_args: Arguments to add, each a string @count: Number of arguments in @add_args */
static int add_args(char ***argvp, char *add_args[], int count)
/* @argvp: Returns newly allocated args list @add_args: Arguments to add, each a string @count: Number of arguments in @add_args */ static int add_args(char ***argvp, char *add_args[], int count)
{ char **argv, **ap; int argc; for (argc = 0; (*argvp)[argc]; argc++) ; argv = os_malloc((argc + count + 1) * sizeof(char *)); if (!argv) { printf("Out of memory for %d argv\n", count); return -ENOMEM; } for (ap = *argvp, argc = 0; *ap; ap++) { char *arg = *ap; if (*arg == '-' && strlen(arg) == 2) { ...
4ms/stm32mp1-baremetal
C++
Other
137
/* These routines are called before setting or resetting tty->stopped. They enable or disable transmitter interrupts, */
static void dz_stop_tx(struct uart_port *uport)
/* These routines are called before setting or resetting tty->stopped. They enable or disable transmitter interrupts, */ static void dz_stop_tx(struct uart_port *uport)
{ struct dz_port *dport = to_dport(uport); u16 tmp, mask = 1 << dport->port.line; tmp = dz_in(dport, DZ_TCR); tmp &= ~mask; dz_out(dport, DZ_TCR, tmp); }
robutest/uclinux
C++
GPL-2.0
60
/* function : de_gsu_enable(unsigned int sel, unsigned int chno, unsigned int en) description : enable/disable gsu parameters : sel <rtmx select> chno <overlay select> en <enable: 0-disable; 1-enable> return : success */
int de_gsu_enable(unsigned int sel, unsigned int chno, unsigned int en)
/* function : de_gsu_enable(unsigned int sel, unsigned int chno, unsigned int en) description : enable/disable gsu parameters : sel <rtmx select> chno <overlay select> en <enable: 0-disable; 1-enable> return : success */ int de_gsu_enable(unsigned int sel, unsigned int chno, unsigned int en)
{ gsu_dev[sel][chno - VI_CHN_NUM]->ctrl.bits.en = en; gsu_glb_block[sel][chno - VI_CHN_NUM].dirty = 1; return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Snoop PTP packet for version 2 format When set the PTP packets are snooped using the version 2 format. */
void synopGMAC_TS_pkt_snoop_ver1(synopGMACdevice *gmacdev)
/* Snoop PTP packet for version 2 format When set the PTP packets are snooped using the version 2 format. */ void synopGMAC_TS_pkt_snoop_ver1(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase,GmacTSControl,GmacTSVER2ENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return: 0 in case of success, a negative error core otherwise. */
int spi_mem_driver_register_with_owner(struct spi_mem_driver *memdrv, struct module *owner)
/* Return: 0 in case of success, a negative error core otherwise. */ int spi_mem_driver_register_with_owner(struct spi_mem_driver *memdrv, struct module *owner)
{ memdrv->spidrv.probe = spi_mem_probe; memdrv->spidrv.remove = spi_mem_remove; memdrv->spidrv.shutdown = spi_mem_shutdown; return __spi_register_driver(owner, &memdrv->spidrv); }
4ms/stm32mp1-baremetal
C++
Other
137
/* These are the file operation function for user access to /dev/keypad */
static ssize_t keypad_read(struct file *file, char *buf, size_t count, loff_t *ppos)
/* These are the file operation function for user access to /dev/keypad */ static ssize_t keypad_read(struct file *file, char *buf, size_t count, loff_t *ppos)
{ unsigned i = *ppos; char *tmp = buf; if (keypad_buflen == 0) { if (file->f_flags & O_NONBLOCK) return -EAGAIN; interruptible_sleep_on(&keypad_read_wait); if (signal_pending(current)) return -EINTR; } for (; count-- > 0 && (keypad_buflen > 0); ++i, ++tmp, --keypad_buflen) { put_user(keypad_buffer[ke...
robutest/uclinux
C++
GPL-2.0
60
/* Print a Unicode string to the output buffer. */
UINTN EFIAPI EDBSPrint(OUT CHAR16 *Buffer, IN INTN BufferSize, IN CONST CHAR16 *Format,...)
/* Print a Unicode string to the output buffer. */ UINTN EFIAPI EDBSPrint(OUT CHAR16 *Buffer, IN INTN BufferSize, IN CONST CHAR16 *Format,...)
{ UINTN Return; VA_LIST Marker; ASSERT (BufferSize > 0); VA_START (Marker, Format); Return = UnicodeVSPrint (Buffer, (UINTN)BufferSize, Format, Marker); VA_END (Marker); return Return; }
tianocore/edk2
C++
Other
4,240
/* This function dumps whole UBIFS indexing B-tree, unlike 'ubifs_dump_tnc()' which dumps only in-memory znodes and does not read znodes which from flash. */
void ubifs_dump_index(struct ubifs_info *c)
/* This function dumps whole UBIFS indexing B-tree, unlike 'ubifs_dump_tnc()' which dumps only in-memory znodes and does not read znodes which from flash. */ void ubifs_dump_index(struct ubifs_info *c)
{ dbg_walk_index(c, NULL, dump_znode, NULL); }
4ms/stm32mp1-baremetal
C++
Other
137