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 |
|---|---|---|---|---|---|---|---|
/* Returns the pclk2 frequency of different on chip clocks. */ | u32 RCC_GetPCLK2Freq(void) | /* Returns the pclk2 frequency of different on chip clocks. */
u32 RCC_GetPCLK2Freq(void) | {
return (RCC_GetHCLKFreq() >> tbPresc[(RCC->CFGR & RCC_CFGR_PPRE2) >> RCC_CFGR_PPRE2_Pos]);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* As per section 4.3 of the data sheet. */ | static int sht15_calc_temp(struct sht15_data *data) | /* As per section 4.3 of the data sheet. */
static int sht15_calc_temp(struct sht15_data *data) | {
int d1 = 0;
int i;
for (i = 1; i < ARRAY_SIZE(temppoints); i++)
if (data->supply_uV > temppoints[i - 1].vdd) {
d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd)
* (temppoints[i].d1 - temppoints[i - 1].d1)
/ (temppoints[i].vdd - temppoints[i - 1].vdd)
+ temppoints[i - 1].d1;
break;
}
return data->val_temp*10 + d1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Try to acquire the OOM killer lock for the zones in zonelist. Returns zero if a parallel OOM killing is already taking place that includes a zone in the zonelist. Otherwise, locks all zones in the zonelist and returns 1. */ | int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_mask) | /* Try to acquire the OOM killer lock for the zones in zonelist. Returns zero if a parallel OOM killing is already taking place that includes a zone in the zonelist. Otherwise, locks all zones in the zonelist and returns 1. */
int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_mask) | {
struct zoneref *z;
struct zone *zone;
int ret = 1;
spin_lock(&zone_scan_lock);
for_each_zone_zonelist(zone, z, zonelist, gfp_zone(gfp_mask)) {
if (zone_is_oom_locked(zone)) {
ret = 0;
goto out;
}
}
for_each_zone_zonelist(zone, z, zonelist, gfp_zone(gfp_mask)) {
zone_set_flag(zone, ZONE_OOM_LOCKED);
}
out:
spin_unlock(&zone_scan_lock);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The function get algorithm from hash mask info. */ | TPM_ALG_ID Tpm2GetAlgoFromHashMask(VOID) | /* The function get algorithm from hash mask info. */
TPM_ALG_ID Tpm2GetAlgoFromHashMask(VOID) | {
UINT32 HashMask;
UINTN Index;
HashMask = PcdGet32 (PcdTpm2HashMask);
for (Index = 0; Index < sizeof (mTpm2HashMask)/sizeof (mTpm2HashMask[0]); Index++) {
if (mTpm2HashMask[Index].Mask == HashMask) {
return mTpm2HashMask[Index].AlgoId;
}
}
return TPM_ALG_NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function is the entry point of the Fault Tolerant Write driver. */ | EFI_STATUS EFIAPI FaultTolerantWriteInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* This function is the entry point of the Fault Tolerant Write driver. */
EFI_STATUS EFIAPI FaultTolerantWriteInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
EFI_FTW_DEVICE *FtwDevice;
FtwDevice = NULL;
Status = InitFtwDevice (&FtwDevice);
if (EFI_ERROR (Status)) {
return Status;
}
EfiCreateProtocolNotifyEvent (
&gEfiFirmwareVolumeBlockProtocolGuid,
TPL_CALLBACK,
FvbNotificationEvent,
(VOID *)FtwDevice,
&mFvbRegistration
);
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The Poll() function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the Poll() function more often. */ | EFI_STATUS EFIAPI EfiMtftp6Poll(IN EFI_MTFTP6_PROTOCOL *This) | /* The Poll() function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit and receive queues. In some systems, the periodic timer event in the managed network driver may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the Poll() function more often. */
EFI_STATUS EFIAPI EfiMtftp6Poll(IN EFI_MTFTP6_PROTOCOL *This) | {
MTFTP6_INSTANCE *Instance;
EFI_UDP6_PROTOCOL *Udp6;
if (This == NULL) {
return EFI_INVALID_PARAMETER;
}
Instance = MTFTP6_INSTANCE_FROM_THIS (This);
if (Instance->Config == NULL) {
return EFI_NOT_STARTED;
}
Udp6 = Instance->UdpIo->Protocol.Udp6;
return Udp6->Poll (Udp6);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* 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 GPIOPinTypeComparatorOutput(uint32_t ui32Port, uint8_t ui8Pins) | /* 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 GPIOPinTypeComparatorOutput(uint32_t ui32Port, uint8_t ui8Pins) | {
ASSERT(_GPIOBaseValid(ui32Port));
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function does not return until the protection has been saved. */ | int32_t FlashLibProtectSave(void) | /* This function does not return until the protection has been saved. */
int32_t FlashLibProtectSave(void) | {
uint32_t ui32Temp;
for(ui32Temp = 0; ui32Temp < 8; ui32Temp++)
{
HWREG(FLASH_FMA) = ui32Temp;
HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT;
while(HWREG(FLASH_FMC) & FLASH_FMC_COMT)
{
}
}
return(0);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* It is the same with flash_stream_write function which is used to write a stream of data to specified address. */ | int flash_burst_write(flash_t *obj, u32 address, u32 Length, u8 *data) | /* It is the same with flash_stream_write function which is used to write a stream of data to specified address. */
int flash_burst_write(flash_t *obj, u32 address, u32 Length, u8 *data) | {
flash_stream_write(obj, address, Length, data);
return 1;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* The units that we store/show are always MILLISECONDS. However, the value of trust_timeout is jiffies. */ | static ssize_t wusb_trust_timeout_show(struct device *dev, struct device_attribute *attr, char *buf) | /* The units that we store/show are always MILLISECONDS. However, the value of trust_timeout is jiffies. */
static ssize_t wusb_trust_timeout_show(struct device *dev, struct device_attribute *attr, char *buf) | {
struct wusbhc *wusbhc = usbhc_dev_to_wusbhc(dev);
return scnprintf(buf, PAGE_SIZE, "%u\n", wusbhc->trust_timeout);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* CMP 8 bit DAC connect to ADC reference voltage command. */ | void CMP_8BitDAC_AdcRefCmd(uint16_t u16AdcRefSw, en_functional_state_t enNewState) | /* CMP 8 bit DAC connect to ADC reference voltage command. */
void CMP_8BitDAC_AdcRefCmd(uint16_t u16AdcRefSw, en_functional_state_t enNewState) | {
DDL_ASSERT(IS_CMP_8_BIT_DAC_SW(u16AdcRefSw));
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
uint16_t WrTmp;
if (ENABLE == enNewState) {
WrTmp = u16AdcRefSw;
} else {
WrTmp = 0U;
}
WRITE_REG16(CM_CMPCR->RVADC, CMP_DADC_RVADC_REG_UNLOCK);
WRITE_REG16(CM_CMPCR->RVADC, WrTmp);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* After this function, please call ref CLOCK_SetXtal0Freq to set external clock frequency to 0. */ | void CLOCK_DeinitExternalClk(void) | /* After this function, please call ref CLOCK_SetXtal0Freq to set external clock frequency to 0. */
void CLOCK_DeinitExternalClk(void) | {
CCM_ANALOG->MISC0_SET = CCM_ANALOG_MISC0_XTAL_24M_PWD_MASK;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Note that this sets EFLAGS_CF in the input register set; this makes it easier to catch functions which do nothing but don't explicitly set CF. */ | void initregs(struct biosregs *reg) | /* Note that this sets EFLAGS_CF in the input register set; this makes it easier to catch functions which do nothing but don't explicitly set CF. */
void initregs(struct biosregs *reg) | {
memset(reg, 0, sizeof *reg);
reg->eflags |= X86_EFLAGS_CF;
reg->ds = ds();
reg->es = ds();
reg->fs = fs();
reg->gs = gs();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This routine will get a word off of the process kernel stack. */ | static int get_stack_long(struct task_struct *task, int offset) | /* This routine will get a word off of the process kernel stack. */
static int get_stack_long(struct task_struct *task, int offset) | {
unsigned char *stack;
stack = (unsigned char *)task_pt_regs(task);
stack += offset;
return (*((int *)stack));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* HRPWM positive edge adjust enable or disable for specified channel. */ | void HRPWM_ChPositiveAdjustCmd(uint32_t u32Ch, en_functional_state_t enNewState) | /* HRPWM positive edge adjust enable or disable for specified channel. */
void HRPWM_ChPositiveAdjustCmd(uint32_t u32Ch, en_functional_state_t enNewState) | {
__IO uint32_t *CRx;
DDL_ASSERT(IS_VALID_HRPWM_CH(u32Ch));
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
CRx = (__IO uint32_t *)(((uint32_t)&CM_HRPWM->CR1) + 4UL * (u32Ch - 1UL));
if (ENABLE == enNewState) {
SET_REG32_BIT(*CRx, HRPWM_CR_PE);
} else {
CLR_REG32_BIT(*CRx, HRPWM_CR_PE);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Disable I2C DMA of the specified I2C port.
The */ | void I2CDMADisable(unsigned long ulBase) | /* Disable I2C DMA of the specified I2C port.
The */
void I2CDMADisable(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
xHWREGB(ulBase + I2C_CON1) &= ~I2C_CON1_DMAEN;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Return: 0 if wait succeeded, -ve if error occurred */ | static int aux_wait_reply(struct udevice *dev) | /* Return: 0 if wait succeeded, -ve if error occurred */
static int aux_wait_reply(struct udevice *dev) | {
u32 timeout = 100;
while (timeout > 0) {
int status = get_reg(dev, REG_REPLY_STATUS);
if (status & REPLY_STATUS_REPLY_ERROR_MASK)
return -ETIMEDOUT;
if ((status & REPLY_STATUS_REPLY_RECEIVED_MASK) &&
!(status &
REPLY_STATUS_REQUEST_IN_PROGRESS_MASK) &&
!(status &
REPLY_STATUS_REPLY_IN_PROGRESS_MASK)) {
return 0;
}
timeout--;
udelay(20);
}
return -ETIMEDOUT;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Set bits in DOUT register for a port to 0. */ | void GPIO_PortOutClear(GPIO_Port_TypeDef port, uint32_t pins) | /* Set bits in DOUT register for a port to 0. */
void GPIO_PortOutClear(GPIO_Port_TypeDef port, uint32_t pins) | {
EFM_ASSERT(GPIO_PORT_VALID(port));
GPIO->P[port].DOUTCLR = pins & _GPIO_P_DOUTCLR_DOUTCLR_MASK;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* param base CSI peripheral base address. param fifo The FIFO DMA to reflash. */ | void CSI_ReflashFifoDma(CSI_Type *base, csi_fifo_t fifo) | /* param base CSI peripheral base address. param fifo The FIFO DMA to reflash. */
void CSI_ReflashFifoDma(CSI_Type *base, csi_fifo_t fifo) | {
uint32_t cr3 = 0U;
if ((uint32_t)fifo & (uint32_t)kCSI_RxFifo)
{
cr3 |= CSI_CSICR3_DMA_REFLASH_RFF_MASK;
}
if ((uint32_t)fifo & (uint32_t)kCSI_StatFifo)
{
cr3 |= CSI_CSICR3_DMA_REFLASH_SFF_MASK;
}
base->CSICR3 |= cr3;
while (base->CSICR3 & cr3)
{
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Calculate the inverse of the supplied EC point. */ | BOOLEAN EFIAPI EcPointInvert(IN CONST VOID *EcGroup, IN OUT VOID *EcPoint, IN VOID *BnCtx) | /* Calculate the inverse of the supplied EC point. */
BOOLEAN EFIAPI EcPointInvert(IN CONST VOID *EcGroup, IN OUT VOID *EcPoint, IN VOID *BnCtx) | {
return (BOOLEAN)EC_POINT_invert (EcGroup, EcPoint, BnCtx);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* stm32_copro_reset() - Reset the STM32 remote processor @dev: corresponding STM32 remote processor device */ | static int stm32_copro_reset(struct udevice *dev) | /* stm32_copro_reset() - Reset the STM32 remote processor @dev: corresponding STM32 remote processor device */
static int stm32_copro_reset(struct udevice *dev) | {
struct stm32_copro_privdata *priv;
int ret;
priv = dev_get_priv(dev);
ret = stm32_copro_set_hold_boot(dev, true);
if (ret)
return ret;
ret = reset_assert(&priv->reset_ctl);
if (ret) {
dev_err(dev, "Unable to assert reset line (ret=%d)\n", ret);
return ret;
}
writel(TAMP_COPRO_STATE_OFF, TAMP_COPRO_STATE);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* radix_tree_next_hole may be called under rcu_read_lock. However, like radix_tree_gang_lookup, this will not atomically search a snapshot of the tree at a single point in time. For example, if a hole is created at index 10, then subsequently a hole is created at index 5, radix_tree_prev_hole covering both indexes may return 5 if called under rcu_read_lock. */ | unsigned long radix_tree_prev_hole(struct radix_tree_root *root, unsigned long index, unsigned long max_scan) | /* radix_tree_next_hole may be called under rcu_read_lock. However, like radix_tree_gang_lookup, this will not atomically search a snapshot of the tree at a single point in time. For example, if a hole is created at index 10, then subsequently a hole is created at index 5, radix_tree_prev_hole covering both indexes may return 5 if called under rcu_read_lock. */
unsigned long radix_tree_prev_hole(struct radix_tree_root *root, unsigned long index, unsigned long max_scan) | {
unsigned long i;
for (i = 0; i < max_scan; i++) {
if (!radix_tree_lookup(root, index))
break;
index--;
if (index == LONG_MAX)
break;
}
return index;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set mmr_blade and mmr_offset to what was passed in on uv_setup_irq(). */ | void uv_teardown_irq(unsigned int irq) | /* Set mmr_blade and mmr_offset to what was passed in on uv_setup_irq(). */
void uv_teardown_irq(unsigned int irq) | {
struct uv_irq_2_mmr_pnode *e;
struct rb_node *n;
unsigned long irqflags;
spin_lock_irqsave(&uv_irq_lock, irqflags);
n = uv_irq_root.rb_node;
while (n) {
e = rb_entry(n, struct uv_irq_2_mmr_pnode, list);
if (e->irq == irq) {
arch_disable_uv_irq(e->pnode, e->offset);
rb_erase(n, &uv_irq_root);
kfree(e);
break;
}
if (irq < e->irq)
n = n->rb_left;
else
n = n->rb_right;
}
spin_unlock_irqrestore(&uv_irq_lock, irqflags);
destroy_irq(irq);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set the device's Microsoft vendor code Get device configuration */ | sl_status_t sl_usbd_core_get_device_configuration(sl_usbd_device_config_t **p_dev_cfg) | /* Set the device's Microsoft vendor code Get device configuration */
sl_status_t sl_usbd_core_get_device_configuration(sl_usbd_device_config_t **p_dev_cfg) | {
sli_usbd_device_t *p_dev;
if (p_dev_cfg == NULL) {
return SL_STATUS_INVALID_PARAMETER;
}
p_dev = &usbd_ptr->device;
*p_dev_cfg = &p_dev->device_config;
return SL_STATUS_OK;
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Creates the metatables for the objects and registers the driver open method. */ | LUASQL_API int luaopen_luasql_oci8(lua_State *L) | /* Creates the metatables for the objects and registers the driver open method. */
LUASQL_API int luaopen_luasql_oci8(lua_State *L) | {
{"oci8", create_environment},
{NULL, NULL},
};
create_metatables (L);
luaL_openlib (L, LUASQL_TABLENAME, driver, 0);
luasql_set_info (L);
return 1;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Standard operations sd = sd + (sn * sm) */ | static u32 vfp_single_fmac(int sd, int sn, s32 m, u32 fpscr) | /* Standard operations sd = sd + (sn * sm) */
static u32 vfp_single_fmac(int sd, int sn, s32 m, u32 fpscr) | {
return vfp_single_multiply_accumulate(sd, sn, m, fpscr, 0, "fmac");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Parameter: card = pointer to card struct. ch = channel (0-based) */ | static void isdnloop_atimeout(isdnloop_card *card, int ch) | /* Parameter: card = pointer to card struct. ch = channel (0-based) */
static void isdnloop_atimeout(isdnloop_card *card, int ch) | {
unsigned long flags;
char buf[60];
spin_lock_irqsave(&card->isdnloop_lock, flags);
if (card->rcard) {
isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1);
card->rcard[ch]->rcard[card->rch[ch]] = NULL;
card->rcard[ch] = NULL;
}
isdnloop_fake(card, "DDIS_I", ch + 1);
sprintf(buf, "CAU%s", isdnloop_unicause(card, 1, 3));
isdnloop_fake(card, buf, ch + 1);
spin_unlock_irqrestore(&card->isdnloop_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get certain file attributes from the netfs data */ | static void nfs_fscache_inode_get_attr(const void *cookie_netfs_data, uint64_t *size) | /* Get certain file attributes from the netfs data */
static void nfs_fscache_inode_get_attr(const void *cookie_netfs_data, uint64_t *size) | {
const struct nfs_inode *nfsi = cookie_netfs_data;
*size = nfsi->vfs_inode.i_size;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI PciWrite32(IN UINTN Address, IN UINT32 Value) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciWrite32(IN UINTN Address, IN UINT32 Value) | {
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
return DxePciLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint32, Value);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Tries to open block device by device number. Use it ONLY if you really do not have anything better - i.e. when you are behind a truly sucky interface and all you are given is a device number. */ | struct block_device* open_by_devnum(dev_t dev, fmode_t mode) | /* Tries to open block device by device number. Use it ONLY if you really do not have anything better - i.e. when you are behind a truly sucky interface and all you are given is a device number. */
struct block_device* open_by_devnum(dev_t dev, fmode_t mode) | {
struct block_device *bdev = bdget(dev);
int err = -ENOMEM;
if (bdev)
err = blkdev_get(bdev, mode);
return err ? ERR_PTR(err) : bdev;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks if target device is ready for communication. */ | static HAL_StatusTypeDef I2Cx_IsDeviceReady(I2C_HandleTypeDef *i2c_handler, uint16_t DevAddress, uint32_t Trials) | /* Checks if target device is ready for communication. */
static HAL_StatusTypeDef I2Cx_IsDeviceReady(I2C_HandleTypeDef *i2c_handler, uint16_t DevAddress, uint32_t Trials) | {
return (HAL_I2C_IsDeviceReady(i2c_handler, DevAddress, Trials, 1000));
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Delete any leading 0's (and allow for 0). */ | static bigint *ICACHE_FLASH_ATTR trim(bigint *bi) | /* Delete any leading 0's (and allow for 0). */
static bigint *ICACHE_FLASH_ATTR trim(bigint *bi) | {
check(bi);
while (bi->comps[bi->size-1] == 0 && bi->size > 1)
{
bi->size--;
}
return bi;
} | eerimoq/simba | C++ | Other | 337 |
/* Heuristic to guess if this is a string or concatenated strings. */ | static int is_printable_string(const void *data, int len) | /* Heuristic to guess if this is a string or concatenated strings. */
static int is_printable_string(const void *data, int len) | {
const char *s = data;
if (len == 0)
return 0;
if (s[len - 1] != '\0' && s[len - 1] != '\n')
return 0;
while (((*s == '\0') || isprint(*s) || isspace(*s)) && (len > 0)) {
if (s[0] == '\0') {
if (len == 1)
return 1;
if (s[1] == '\0')
return 0;
}
s++;
len--;
}
if (*s != '\0' || (len != 0))
return 0;
return 1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Initialize Bsp Idt with a new Idt table and return the IA32_DESCRIPTOR buffer. In PEIM, store original PeiServicePointer before new Idt table. */ | VOID* InitializeBspIdt(VOID) | /* Initialize Bsp Idt with a new Idt table and return the IA32_DESCRIPTOR buffer. In PEIM, store original PeiServicePointer before new Idt table. */
VOID* InitializeBspIdt(VOID) | {
UINTN *NewIdtTable;
IA32_DESCRIPTOR *Idtr;
Idtr = AllocateZeroPool (sizeof (IA32_DESCRIPTOR));
ASSERT (Idtr != NULL);
NewIdtTable = AllocateZeroPool (sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM);
ASSERT (NewIdtTable != NULL);
Idtr->Base = (UINTN)NewIdtTable;
Idtr->Limit = (UINT16)(sizeof (IA32_IDT_GATE_DESCRIPTOR) * CPU_INTERRUPT_NUM - 1);
AsmWriteIdtr (Idtr);
return Idtr;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Exit FlexCAN Freeze Mode.
This function makes the FlexCAN leave Freeze Mode. */ | static void FLEXCAN_ExitFreezeMode(CAN_Type *base) | /* Exit FlexCAN Freeze Mode.
This function makes the FlexCAN leave Freeze Mode. */
static void FLEXCAN_ExitFreezeMode(CAN_Type *base) | {
base->MCR &= ~CAN_MCR_HALT_MASK;
base->MCR &= ~CAN_MCR_FRZ_MASK;
while (base->MCR & CAN_MCR_FRZACK_MASK)
{
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2, since this indicates that nlinks count was previously 1. */ | static void ext4_inc_count(handle_t *handle, struct inode *inode) | /* DIR_NLINK feature is set if 1) nlinks > EXT4_LINK_MAX or 2) nlinks == 2, since this indicates that nlinks count was previously 1. */
static void ext4_inc_count(handle_t *handle, struct inode *inode) | {
inc_nlink(inode);
if (is_dx(inode) && inode->i_nlink > 1) {
if (inode->i_nlink >= EXT4_LINK_MAX || inode->i_nlink == 2) {
inode->i_nlink = 1;
EXT4_SET_RO_COMPAT_FEATURE(inode->i_sb,
EXT4_FEATURE_RO_COMPAT_DIR_NLINK);
}
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | /* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | {
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC1_CLK_ENABLE();
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* hdaps_read_pair - reads the values from a pair of ports, placing the values in the given pointers. Returns zero on success. Can sleep. */ | static int hdaps_read_pair(unsigned int port1, unsigned int port2, int *val1, int *val2) | /* hdaps_read_pair - reads the values from a pair of ports, placing the values in the given pointers. Returns zero on success. Can sleep. */
static int hdaps_read_pair(unsigned int port1, unsigned int port2, int *val1, int *val2) | {
int ret;
mutex_lock(&hdaps_mtx);
ret = __hdaps_read_pair(port1, port2, val1, val2);
mutex_unlock(&hdaps_mtx);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Constructs a new net device, complete with a private data area of size @sizeof_priv. A 32-byte (not bit) alignment is enforced for this private data area. */ | struct net_device* alloc_trdev(int sizeof_priv) | /* Constructs a new net device, complete with a private data area of size @sizeof_priv. A 32-byte (not bit) alignment is enforced for this private data area. */
struct net_device* alloc_trdev(int sizeof_priv) | {
return alloc_netdev(sizeof_priv, "tr%d", tr_setup);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Since ext3_try_to_allocate() will always allocate blocks within the reservation window range, if the window size is too small, multiple blocks allocation has to stop at the end of the reservation window. To make this more efficient, given the total number of blocks needed and the current size of the window, we try to expand the reservation window size if necessary on a best-effort basis before ext3_new_blocks() tries to allocate blocks, */ | static void try_to_extend_reservation(struct ext3_reserve_window_node *my_rsv, struct super_block *sb, int size) | /* Since ext3_try_to_allocate() will always allocate blocks within the reservation window range, if the window size is too small, multiple blocks allocation has to stop at the end of the reservation window. To make this more efficient, given the total number of blocks needed and the current size of the window, we try to expand the reservation window size if necessary on a best-effort basis before ext3_new_blocks() tries to allocate blocks, */
static void try_to_extend_reservation(struct ext3_reserve_window_node *my_rsv, struct super_block *sb, int size) | {
struct ext3_reserve_window_node *next_rsv;
struct rb_node *next;
spinlock_t *rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock;
if (!spin_trylock(rsv_lock))
return;
next = rb_next(&my_rsv->rsv_node);
if (!next)
my_rsv->rsv_end += size;
else {
next_rsv = rb_entry(next, struct ext3_reserve_window_node, rsv_node);
if ((next_rsv->rsv_start - my_rsv->rsv_end - 1) >= size)
my_rsv->rsv_end += size;
else
my_rsv->rsv_end = next_rsv->rsv_start - 1;
}
spin_unlock(rsv_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Simple bounce buffer support for highmem pages. Depending on the queue gfp mask set, *to may or may not be a highmem page. kmap it always, it will do the Right Thing */ | static void copy_to_high_bio_irq(struct bio *to, struct bio *from) | /* Simple bounce buffer support for highmem pages. Depending on the queue gfp mask set, *to may or may not be a highmem page. kmap it always, it will do the Right Thing */
static void copy_to_high_bio_irq(struct bio *to, struct bio *from) | {
unsigned char *vfrom;
struct bio_vec *tovec, *fromvec;
int i;
__bio_for_each_segment(tovec, to, i, 0) {
fromvec = from->bi_io_vec + i;
if (tovec->bv_page == fromvec->bv_page)
continue;
vfrom = page_address(fromvec->bv_page) + tovec->bv_offset;
flush_dcache_page(tovec->bv_page);
bounce_copy_vec(tovec, vfrom);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* convert a disk-based directory entry to a Linux ADFS directory entry */ | static void adfs_dir2obj(struct object_info *obj, struct adfs_direntry *de) | /* convert a disk-based directory entry to a Linux ADFS directory entry */
static void adfs_dir2obj(struct object_info *obj, struct adfs_direntry *de) | {
obj->name_len = adfs_readname(obj->name, de->dirobname, ADFS_F_NAME_LEN);
obj->file_id = adfs_readval(de->dirinddiscadd, 3);
obj->loadaddr = adfs_readval(de->dirload, 4);
obj->execaddr = adfs_readval(de->direxec, 4);
obj->size = adfs_readval(de->dirlen, 4);
obj->attr = de->newdiratts;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the orientation of the display data.
Configures the display for a given orientation, including mirroring and/or screen rotation. */ | void ili9341_set_orientation(uint8_t flags) | /* Sets the orientation of the display data.
Configures the display for a given orientation, including mirroring and/or screen rotation. */
void ili9341_set_orientation(uint8_t flags) | {
uint8_t madctl = 0x48;
flags ^= ILI9341_SWITCH_XY | ILI9341_FLIP_X;
if (flags & ILI9341_FLIP_X) {
madctl &= ~(1 << 6);
}
if (flags & ILI9341_FLIP_Y) {
madctl |= 1 << 7;
}
if (flags & ILI9341_SWITCH_XY) {
madctl |= 1 << 5;
}
ili9341_send_command(ILI9341_CMD_MEMORY_ACCESS_CONTROL);
ili9341_send_byte(madctl);
ili9341_wait_for_send_done();
ili9341_deselect_chip();
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Called whenever a 32-bit process running under a 64-bit kernel performs an ioctl on /dev/dri/card<n>. */ | long radeon_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | /* Called whenever a 32-bit process running under a 64-bit kernel performs an ioctl on /dev/dri/card<n>. */
long radeon_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | {
unsigned int nr = DRM_IOCTL_NR(cmd);
drm_ioctl_compat_t *fn = NULL;
int ret;
if (nr < DRM_COMMAND_BASE)
return drm_compat_ioctl(filp, cmd, arg);
if (nr < DRM_COMMAND_BASE + DRM_ARRAY_SIZE(radeon_compat_ioctls))
fn = radeon_compat_ioctls[nr - DRM_COMMAND_BASE];
if (fn != NULL)
ret = (*fn) (filp, cmd, arg);
else
ret = drm_ioctl(filp, cmd, arg);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write 0 to ask the device to soft reset, 1 to cold reset, 2 to bus reset (as defined by enum i2400m_reset_type). */ | static int debugfs_i2400m_reset_set(void *data, u64 val) | /* Write 0 to ask the device to soft reset, 1 to cold reset, 2 to bus reset (as defined by enum i2400m_reset_type). */
static int debugfs_i2400m_reset_set(void *data, u64 val) | {
int result;
struct i2400m *i2400m = data;
enum i2400m_reset_type rt = val;
switch(rt) {
case I2400M_RT_WARM:
case I2400M_RT_COLD:
case I2400M_RT_BUS:
result = i2400m_reset(i2400m, rt);
if (result >= 0)
result = 0;
default:
result = -EINVAL;
}
return result;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* si470x_vidioc_s_frequency - set tuner or modulator radio frequency */ | static int si470x_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *freq) | /* si470x_vidioc_s_frequency - set tuner or modulator radio frequency */
static int si470x_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *freq) | {
struct si470x_device *radio = video_drvdata(file);
int retval = 0;
retval = si470x_disconnect_check(radio);
if (retval)
goto done;
if (freq->tuner != 0) {
retval = -EINVAL;
goto done;
}
retval = si470x_set_freq(radio, freq->frequency);
done:
if (retval < 0)
dev_warn(&radio->videodev->dev,
"set frequency failed with %d\n", retval);
return retval;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This is the thermal zone callback which does the delayed polling of the fan state. We do check /sysfs-originating settings here in acerhdf_check_param() as late as the polling interval is since we can't do that in the respective accessors of the module parameters. */ | static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal, unsigned long *t) | /* This is the thermal zone callback which does the delayed polling of the fan state. We do check /sysfs-originating settings here in acerhdf_check_param() as late as the polling interval is since we can't do that in the respective accessors of the module parameters. */
static int acerhdf_get_ec_temp(struct thermal_zone_device *thermal, unsigned long *t) | {
int temp, err = 0;
acerhdf_check_param(thermal);
err = acerhdf_get_temp(&temp);
if (err)
return err;
if (verbose)
pr_notice("temp %d\n", temp);
*t = temp;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read-ahead the block, don't wait for it, don't return a buffer. Long-form addressing. */ | void xfs_btree_reada_bufl(xfs_mount_t *mp, xfs_fsblock_t fsbno, xfs_extlen_t count) | /* Read-ahead the block, don't wait for it, don't return a buffer. Long-form addressing. */
void xfs_btree_reada_bufl(xfs_mount_t *mp, xfs_fsblock_t fsbno, xfs_extlen_t count) | {
xfs_daddr_t d;
ASSERT(fsbno != NULLFSBLOCK);
d = XFS_FSB_TO_DADDR(mp, fsbno);
xfs_baread(mp->m_ddev_targp, d, mp->m_bsize * count);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function writes the given structure to the TDET Control Register. param base TDET peripheral base address param config Pointer to structure with TDET peripheral configuration parameters return kStatus_Fail when writing to TDET Control Register is not allowed return kStatus_Success when operation completes successfully */ | status_t TDET_SetConfig(DIGTMP_Type *base, const tdet_config_t *config) | /* This function writes the given structure to the TDET Control Register. param base TDET peripheral base address param config Pointer to structure with TDET peripheral configuration parameters return kStatus_Fail when writing to TDET Control Register is not allowed return kStatus_Success when operation completes successfully */
status_t TDET_SetConfig(DIGTMP_Type *base, const tdet_config_t *config) | {
uint32_t tmpCR;
status_t retval = kStatus_Fail;
if ((tdet_IsRegisterWriteAllowed(base, DIGTMP_LR_CRL_MASK)) && (config != NULL))
{
tmpCR = 0;
tmpCR |= DIGTMP_CR_TFSR(config->tamperForceSystemResetEnable);
tmpCR |= DIGTMP_CR_UM(config->updateMode);
tmpCR |= DIGTMP_CR_ATCS0(config->clockSourceActiveTamper0);
tmpCR |= DIGTMP_CR_ATCS1(config->clockSourceActiveTamper1);
tmpCR |= DIGTMP_CR_DPR(config->prescaler);
base->CR = tmpCR;
if (config->innerClockAndPrescalerEnable)
{
base->CR = tmpCR | DIGTMP_CR_DEN_MASK;
}
retval = kStatus_Success;
}
else
{
retval = kStatus_Fail;
}
return retval;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether the specified SPI flag is set or not. */ | FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef *SPIx, uint16_t SPI_I2S_FLAG) | /* Checks whether the specified SPI flag is set or not. */
FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef *SPIx, uint16_t SPI_I2S_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_SPI_ALL_PERIPH_EXT(SPIx));
assert_param(IS_SPI_I2S_GET_FLAG(SPI_I2S_FLAG));
if ((SPIx->SR & SPI_I2S_FLAG) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Initializes the firmware data module for a specified firmware file parser. */ | LIBOPENBLT_EXPORT void BltFirmwareInit(uint32_t parserType) | /* Initializes the firmware data module for a specified firmware file parser. */
LIBOPENBLT_EXPORT void BltFirmwareInit(uint32_t parserType) | {
tFirmwareParser const * firmwareParser = NULL;
assert(parserType == BLT_FIRMWARE_PARSER_SRECORD);
if (parserType == BLT_FIRMWARE_PARSER_SRECORD)
{
firmwareParser = SRecParserGetParser();
}
FirmwareInit(firmwareParser);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */ | void EVENT_USB_Device_Connect(void) | /* Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs. */
void EVENT_USB_Device_Connect(void) | {
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
IsMassStoreReset = false;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Enable ADC sample sequence. Allows the specified sample sequence to be captured when its trigger is detected. A sample sequence must be configured before it is enabled. */ | void xADCEnable(unsigned long ulBase) | /* Enable ADC sample sequence. Allows the specified sample sequence to be captured when its trigger is detected. A sample sequence must be configured before it is enabled. */
void xADCEnable(unsigned long ulBase) | {
xASSERT(ulBase == xADC0_BASE);
if(0 == _ADC_Status)
{
while(1);
}
ADCInit(ulBase, 200000);
if(_ADC_Mode == xADC_MODE_SCAN_CONTINUOUS)
{
ADCStart(ulBase, _ADC_Channels, ADC_START_MODE_BURST);
}
else
{
ADCStart(ulBase, _ADC_Channels, _ADC_Triggler);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* ubi_get_volume_info - get information about UBI volume. @desc: volume descriptor @vi: the information is stored here */ | void ubi_get_volume_info(struct ubi_volume_desc *desc, struct ubi_volume_info *vi) | /* ubi_get_volume_info - get information about UBI volume. @desc: volume descriptor @vi: the information is stored here */
void ubi_get_volume_info(struct ubi_volume_desc *desc, struct ubi_volume_info *vi) | {
ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base SAI base pointer. param handle Pointer to the sai_handle_t structure which stores the transfer state. param count Bytes count received. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */ | status_t SAI_TransferGetReceiveCount(I2S_Type *base, sai_handle_t *handle, size_t *count) | /* param base SAI base pointer. param handle Pointer to the sai_handle_t structure which stores the transfer state. param count Bytes count received. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */
status_t SAI_TransferGetReceiveCount(I2S_Type *base, sai_handle_t *handle, size_t *count) | {
assert(handle != NULL);
status_t status = kStatus_Success;
uint32_t queueDriverIndex = handle->queueDriver;
if (handle->state != (uint32_t)kSAI_Busy)
{
status = kStatus_NoTransferInProgress;
}
else
{
*count = (handle->transferSize[queueDriverIndex] - handle->saiQueue[queueDriverIndex].dataSize);
}
return status;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* deinitialize interface of msc class by freeing host channels */ | void usb_host_msc_itfdeinit(usb_core_instance *pdev) | /* deinitialize interface of msc class by freeing host channels */
void usb_host_msc_itfdeinit(usb_core_instance *pdev) | {
if (MSC_Machine.hc_num_out != 0U) {
usb_hchstop(&pdev->regs, MSC_Machine.hc_num_out);
(void)usb_host_freech(pdev, MSC_Machine.hc_num_out);
MSC_Machine.hc_num_out = 0U;
}
if (MSC_Machine.hc_num_in != 0U) {
usb_hchstop(&pdev->regs, MSC_Machine.hc_num_in);
(void)usb_host_freech(pdev, MSC_Machine.hc_num_in);
MSC_Machine.hc_num_in = 0U;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Adds a doorbell resource/callback pair into a port's doorbell event list. Returns 0 if the request has been satisfied. */ | static int rio_setup_inb_dbell(struct rio_mport *mport, void *dev_id, struct resource *res, void(*dinb)(struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info)) | /* Adds a doorbell resource/callback pair into a port's doorbell event list. Returns 0 if the request has been satisfied. */
static int rio_setup_inb_dbell(struct rio_mport *mport, void *dev_id, struct resource *res, void(*dinb)(struct rio_mport *mport, void *dev_id, u16 src, u16 dst, u16 info)) | {
int rc = 0;
struct rio_dbell *dbell;
if (!(dbell = kmalloc(sizeof(struct rio_dbell), GFP_KERNEL))) {
rc = -ENOMEM;
goto out;
}
dbell->res = res;
dbell->dinb = dinb;
dbell->dev_id = dev_id;
list_add_tail(&dbell->node, &mport->dbells);
out:
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is used to process WPS messages with OP Codes WSC_ACK, WSC_NACK, WSC_MSG, and WSC_Done. The caller (e.g., EAP server/peer) is responsible for reassembling the messages before calling this function. Response to this message is built by calling wps_get_msg(). */ | enum wps_process_res wps_process_msg(struct wps_data *wps, enum wsc_op_code op_code, const struct wpabuf *msg) | /* This function is used to process WPS messages with OP Codes WSC_ACK, WSC_NACK, WSC_MSG, and WSC_Done. The caller (e.g., EAP server/peer) is responsible for reassembling the messages before calling this function. Response to this message is built by calling wps_get_msg(). */
enum wps_process_res wps_process_msg(struct wps_data *wps, enum wsc_op_code op_code, const struct wpabuf *msg) | {
if (wps->registrar)
return wps_registrar_process_msg(wps, op_code, msg);
else
return wps_enrollee_process_msg(wps, op_code, msg);
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Sets the 11- or 29-bit acceptance filter of a CAN connection. */ | static HRESULT IxxatVciLibFuncCanControlSetAccFilter(HANDLE hCanCtl, BOOL fExtend, UINT32 dwCode, UINT32 dwMask) | /* Sets the 11- or 29-bit acceptance filter of a CAN connection. */
static HRESULT IxxatVciLibFuncCanControlSetAccFilter(HANDLE hCanCtl, BOOL fExtend, UINT32 dwCode, UINT32 dwMask) | {
HRESULT result = VCI_E_UNEXPECTED;
assert(ixxatVciLibFuncCanControlSetAccFilterPtr != NULL);
assert(ixxatVciDllHandle != NULL);
if ((ixxatVciLibFuncCanControlSetAccFilterPtr != NULL) && (ixxatVciDllHandle != NULL))
{
result = ixxatVciLibFuncCanControlSetAccFilterPtr(hCanCtl, fExtend, dwCode, dwMask);
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Returns: (type GObject.TypeClass) (transfer none): the #GTypeClass structure for the given type ID or NULL if the class does not currently exist */ | gpointer g_type_class_peek(GType type) | /* Returns: (type GObject.TypeClass) (transfer none): the #GTypeClass structure for the given type ID or NULL if the class does not currently exist */
gpointer g_type_class_peek(GType type) | {
TypeNode *node;
gpointer class;
node = lookup_type_node_I (type);
if (node && node->is_classed && NODE_REFCOUNT (node) &&
g_atomic_int_get (&node->data->class.init_state) == INITIALIZED)
class = node->data->class.class;
else
class = NULL;
return class;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Prepare a color buffer for a single LED using its color mapping and the desired color index. */ | static int prepare_color_buffer(const struct led_info *info, uint8_t *buf, uint8_t color_idx) | /* Prepare a color buffer for a single LED using its color mapping and the desired color index. */
static int prepare_color_buffer(const struct led_info *info, uint8_t *buf, uint8_t color_idx) | {
uint8_t color;
for (color = 0; color < info->num_colors; color++) {
switch (info->color_mapping[color]) {
case LED_COLOR_ID_RED:
buf[color] = colors[color_idx][0];
continue;
case LED_COLOR_ID_GREEN:
buf[color] = colors[color_idx][1];
continue;
case LED_COLOR_ID_BLUE:
buf[color] = colors[color_idx][2];
continue;
default:
LOG_ERR("Invalid color: %d",
info->color_mapping[color]);
return -EINVAL;
}
}
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Sets the host clock to the highest possible frequency that is below "hz". */ | void mmcsd_set_clock(struct rt_mmcsd_host *host, rt_uint32_t clk) | /* Sets the host clock to the highest possible frequency that is below "hz". */
void mmcsd_set_clock(struct rt_mmcsd_host *host, rt_uint32_t clk) | {
if (clk < host->freq_min)
{
LOG_W("clock too low!");
}
host->io_cfg.clock = clk;
mmcsd_set_iocfg(host);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Open 485 mode on the specified UART.
The */ | void UART485Config(unsigned long ulBase, unsigned long ulBaud, unsigned long ul485Config, unsigned long ulUARTConfig) | /* Open 485 mode on the specified UART.
The */
void UART485Config(unsigned long ulBase, unsigned long ulBaud, unsigned long ul485Config, unsigned long ulUARTConfig) | {
xASSERT(UARTBaseValid(ulBase));
UARTConfigSetExpClk(ulBase, ulBaud, ulUARTConfig);
UARTEnable485(ulBase);
xHWREG(ulBase + UART_LIN_BCNT) &= 0xFFFFFF00;
xHWREG(ulBase + UART_LIN_BCNT) |= ul485Config;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The difference between the producer and consumer cannot exceed the size of the ring. */ | STATIC BOOLEAN XenStoreCheckIndexes(XENSTORE_RING_IDX Cons, XENSTORE_RING_IDX Prod) | /* The difference between the producer and consumer cannot exceed the size of the ring. */
STATIC BOOLEAN XenStoreCheckIndexes(XENSTORE_RING_IDX Cons, XENSTORE_RING_IDX Prod) | {
return ((Prod - Cons) <= XENSTORE_RING_SIZE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Convert integer part of temperature to hexadecimal value. */ | static void mcp980x_temperature_to_hex_int(int8_t c_integer, uint8_t *p_hex) | /* Convert integer part of temperature to hexadecimal value. */
static void mcp980x_temperature_to_hex_int(int8_t c_integer, uint8_t *p_hex) | {
*p_hex = (uint8_t) c_integer;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Fixup data pointers so that the services can be called in virtual mode. */ | VOID EFIAPI SmmControlVirtualAddressChangeEvent(IN EFI_EVENT Event, IN VOID *Context) | /* Fixup data pointers so that the services can be called in virtual mode. */
VOID EFIAPI SmmControlVirtualAddressChangeEvent(IN EFI_EVENT Event, IN VOID *Context) | {
EfiConvertPointer (0x0, (VOID **)&(mSmmControl2.Trigger));
EfiConvertPointer (0x0, (VOID **)&(mSmmControl2.Clear));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base SPI peripheral base address. param handle SPI handle pointer. param callback User callback function called at the end of a transfer. param userData User data for callback. param txHandle DMA handle pointer for SPI Tx, the handle shall be static allocated by users. param rxHandle DMA handle pointer for SPI Rx, the handle shall be static allocated by users. */ | status_t SPI_MasterTransferCreateHandleDMA(SPI_Type *base, spi_dma_handle_t *handle, spi_dma_callback_t callback, void *userData, dma_handle_t *txHandle, dma_handle_t *rxHandle) | /* param base SPI peripheral base address. param handle SPI handle pointer. param callback User callback function called at the end of a transfer. param userData User data for callback. param txHandle DMA handle pointer for SPI Tx, the handle shall be static allocated by users. param rxHandle DMA handle pointer for SPI Rx, the handle shall be static allocated by users. */
status_t SPI_MasterTransferCreateHandleDMA(SPI_Type *base, spi_dma_handle_t *handle, spi_dma_callback_t callback, void *userData, dma_handle_t *txHandle, dma_handle_t *rxHandle) | {
uint32_t instance;
assert(!(NULL == base));
if (NULL == base)
{
return kStatus_InvalidArgument;
}
assert(!(NULL == handle));
if (NULL == handle)
{
return kStatus_InvalidArgument;
}
instance = SPI_GetInstance(base);
(void)memset(handle, 0, sizeof(*handle));
handle->txHandle = txHandle;
handle->rxHandle = rxHandle;
handle->callback = callback;
handle->userData = userData;
handle->state = (uint8_t)kSPI_Idle;
s_dmaPrivateHandle[instance].base = base;
s_dmaPrivateHandle[instance].handle = handle;
DMA_SetCallback(handle->txHandle, SPI_TxDMACallback, &s_dmaPrivateHandle[instance]);
DMA_SetCallback(handle->rxHandle, SPI_RxDMACallback, &s_dmaPrivateHandle[instance]);
return kStatus_Success;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* A native bus (eg Runway or GSC) may have up to 64 devices on it, spaced at intervals of 0x1000 bytes. PDC may not inform us of these devices, so we have to probe for them. Unfortunately, we may find devices which are not physically connected (such as extra serial & keyboard ports). This problem is not yet solved. */ | static void walk_native_bus(unsigned long io_io_low, unsigned long io_io_high, struct device *parent) | /* A native bus (eg Runway or GSC) may have up to 64 devices on it, spaced at intervals of 0x1000 bytes. PDC may not inform us of these devices, so we have to probe for them. Unfortunately, we may find devices which are not physically connected (such as extra serial & keyboard ports). This problem is not yet solved. */
static void walk_native_bus(unsigned long io_io_low, unsigned long io_io_high, struct device *parent) | {
int i, devices_found = 0;
unsigned long hpa = io_io_low;
struct hardware_path path;
get_node_path(parent, &path);
do {
for(i = 0; i < MAX_NATIVE_DEVICES; i++, hpa += NATIVE_DEVICE_OFFSET) {
struct parisc_device *dev;
dev = find_device_by_addr(hpa);
if (!dev) {
path.mod = i;
dev = alloc_pa_dev(hpa, &path);
if (!dev)
continue;
register_parisc_device(dev);
devices_found++;
}
walk_lower_bus(dev);
}
} while(!devices_found && hpa < io_io_high);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* perform a single pressure measurement uses the stored temperature value for sensor temperature compensation temperature must be measured regularly for good temperature compensation */ | static bool dps310_measure_psr(const struct device *dev) | /* perform a single pressure measurement uses the stored temperature value for sensor temperature compensation temperature must be measured regularly for good temperature compensation */
static bool dps310_measure_psr(const struct device *dev) | {
struct dps310_data *data = dev->data;
const struct dps310_cfg *config = dev->config;
if (!dps310_trigger_pressure(dev)) {
return false;
}
uint8_t value_raw[3];
int res = i2c_write_read_dt(&config->i2c, ®_ADDR_PSR_B2, 1,
&value_raw, sizeof(value_raw));
if (res < 0) {
LOG_WRN("I2C error: %d", res);
return false;
}
int32_t psr_raw = raw_to_int24(&value_raw[0]);
dps310_scale_pressure(dev, data->raw_tmp, psr_raw);
return true;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Note that the resulting string will be placed at the end of the buffer */ | static char* nfs4_pathname_string(const struct nfs4_pathname *pathname, char *buffer, ssize_t buflen) | /* Note that the resulting string will be placed at the end of the buffer */
static char* nfs4_pathname_string(const struct nfs4_pathname *pathname, char *buffer, ssize_t buflen) | {
char *end = buffer + buflen;
int n;
*--end = '\0';
buflen--;
n = pathname->ncomponents;
while (--n >= 0) {
const struct nfs4_string *component = &pathname->components[n];
buflen -= component->len + 1;
if (buflen < 0)
goto Elong;
end -= component->len;
memcpy(end, component->data, component->len);
*--end = '/';
}
return end;
Elong:
return ERR_PTR(-ENAMETOOLONG);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* determine_revid() - Determine revision ID of CPU device @dev: CPU device from which to read revision ID */ | static void determine_revid(struct udevice *dev) | /* determine_revid() - Determine revision ID of CPU device @dev: CPU device from which to read revision ID */
static void determine_revid(struct udevice *dev) | {
struct mpc83xx_cpu_priv *priv = dev_get_priv(dev);
u32 REVID_MAJOR_MASK;
u32 REVID_MINOR_MASK;
u32 spridr = get_spridr();
if (priv->family == FAMILY_834X) {
REVID_MAJOR_MASK = 0x0000FF00;
REVID_MINOR_MASK = 0x000000FF;
} else {
REVID_MAJOR_MASK = 0x000000F0;
REVID_MINOR_MASK = 0x0000000F;
}
priv->revid.major = bitfield_extract_by_mask(spridr, REVID_MAJOR_MASK);
priv->revid.minor = bitfield_extract_by_mask(spridr, REVID_MINOR_MASK);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function is used to display a string on console, normally, it's invoked by rt_kprintf */ | void rt_hw_console_output(const char *str) | /* This function is used to display a string on console, normally, it's invoked by rt_kprintf */
void rt_hw_console_output(const char *str) | {
while (*str)
{
rt_console_putc (*str++);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return: 0 on success or a negative error code on failure */ | int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi, enum mipi_dsi_dcs_tear_mode mode) | /* Return: 0 on success or a negative error code on failure */
int mipi_dsi_dcs_set_tear_on(struct mipi_dsi_device *dsi, enum mipi_dsi_dcs_tear_mode mode) | {
u8 value = mode;
ssize_t err;
err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SET_TEAR_ON, &value,
sizeof(value));
if (err < 0)
return err;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Change Logs: Date Author Notes RT-Thread the first version */ | void init_bss(void) | /* Change Logs: Date Author Notes RT-Thread the first version */
void init_bss(void) | {
unsigned int *dst;
dst = &__bss_start;
while (dst < &__bss_end)
{
*dst++ = 0;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Specifies the function mode for the specified TMR2 channel. */ | void TMR2_SetFunc(CM_TMR2_TypeDef *TMR2x, uint32_t u32Ch, uint32_t u32Func) | /* Specifies the function mode for the specified TMR2 channel. */
void TMR2_SetFunc(CM_TMR2_TypeDef *TMR2x, uint32_t u32Ch, uint32_t u32Func) | {
DDL_ASSERT(IS_TMR2_UNIT(TMR2x));
DDL_ASSERT(IS_TMR2_CH(u32Ch));
DDL_ASSERT(IS_TMR2_FUNC(u32Func));
u32Ch *= TMR2_CH_OFFSET;
MODIFY_REG32(TMR2x->BCONR, (TMR2_BCONR_CAPMDA << u32Ch), (u32Func << u32Ch));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set open file's I/O descriptor, and return previous value. */ | int TIFFSetFileno(TIFF *tif, int fd) | /* Set open file's I/O descriptor, and return previous value. */
int TIFFSetFileno(TIFF *tif, int fd) | {
int old_fd = tif->tif_fd;
tif->tif_fd = fd;
return old_fd;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Setup the microcontroller system. Initialize the Embedded Flash Interface, the PLL and update the SystemCoreClock variable. */ | void SystemInit(void) | /* Setup the microcontroller system. Initialize the Embedded Flash Interface, the PLL and update the SystemCoreClock variable. */
void SystemInit(void) | {
RCC->CR |= (uint32_t)0x00000001;
RCC->CFGR &= (uint32_t)0xF8FFB80C;
RCC->CR &= (uint32_t)0xFEF6FFFF;
RCC->CR &= (uint32_t)0xFFFBFFFF;
RCC->CFGR &= (uint32_t)0xFFC0FFFF;
RCC->CFGR2 &= (uint32_t)0xFFFFFFF0;
RCC->CFGR3 &= (uint32_t)0xFFFFFEAC;
RCC->CR2 &= (uint32_t)0xFFFFFFFE;
RCC->CIR = 0x00000000;
SetSysClock();
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Internal interface to free a range of physical memory. Frees non RAM regions only. */ | static void free_pfn_range(u64 paddr, unsigned long size) | /* Internal interface to free a range of physical memory. Frees non RAM regions only. */
static void free_pfn_range(u64 paddr, unsigned long size) | {
int is_ram;
is_ram = pat_pagerange_is_ram(paddr, paddr + size);
if (is_ram == 0)
free_memtype(paddr, paddr + size);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Brownout low voltage detected IRQ, declared in start up code. */ | void BODIntHandler(void) | /* Brownout low voltage detected IRQ, declared in start up code. */
void BODIntHandler(void) | {
unsigned long ulTemp0;
ulTemp0 = (xHWREG(PWRCU_LVDCSR) & PWRCU_LVDCSR_BODF);
xHWREG(PWRCU_LVDCSR) = ulTemp0;
if (g_pfnBODHandlerCallbacks[0] != 0)
{
g_pfnBODHandlerCallbacks[0](0, 0, ulTemp0, 0);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Writes the configuration register reg with the value passed. */ | void at30tse_write_config_register(uint16_t value) | /* Writes the configuration register reg with the value passed. */
void at30tse_write_config_register(uint16_t value) | {
at30tse_write_register(AT30TSE_CONFIG_REG,
AT30TSE_NON_VOLATILE_REG,
AT30TSE_CONFIG_REG_SIZE-1,
value);
resolution = ( value >> AT30TSE_CONFIG_RES_Pos ) & ( AT30TSE_CONFIG_RES_Msk >> AT30TSE_CONFIG_RES_Pos);
} | memfault/zero-to-main | C++ | null | 200 |
/* Compute BnA inverse modulo BnM. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */ | BOOLEAN EFIAPI BigNumInverseMod(IN CONST VOID *BnA, IN CONST VOID *BnM, OUT VOID *BnRes) | /* Compute BnA inverse modulo BnM. Please note, all "out" Big number arguments should be properly initialized by calling to BigNumInit() or BigNumFromBin() functions. */
BOOLEAN EFIAPI BigNumInverseMod(IN CONST VOID *BnA, IN CONST VOID *BnM, OUT VOID *BnRes) | {
BOOLEAN RetVal;
BN_CTX *Ctx;
Ctx = BN_CTX_new ();
if (Ctx == NULL) {
return FALSE;
}
RetVal = FALSE;
if (BN_mod_inverse (BnRes, BnA, BnM, Ctx) != NULL) {
RetVal = TRUE;
}
BN_CTX_free (Ctx);
return RetVal;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reverse Digipeat List. May not pass both parameters as same struct */ | void ax25_digi_invert(const ax25_digi *in, ax25_digi *out) | /* Reverse Digipeat List. May not pass both parameters as same struct */
void ax25_digi_invert(const ax25_digi *in, ax25_digi *out) | {
int ct;
out->ndigi = in->ndigi;
out->lastrepeat = in->ndigi - in->lastrepeat - 2;
for (ct = 0; ct < in->ndigi; ct++) {
out->calls[ct] = in->calls[in->ndigi - ct - 1];
if (ct <= out->lastrepeat) {
out->calls[ct].ax25_call[6] |= AX25_HBIT;
out->repeated[ct] = 1;
} else {
out->calls[ct].ax25_call[6] &= ~AX25_HBIT;
out->repeated[ct] = 0;
}
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* When in host mode, this function signals devices to leave the suspend state. This call must first be made with the */ | void USBHostResume(uint32_t ui32Base, bool bStart) | /* When in host mode, this function signals devices to leave the suspend state. This call must first be made with the */
void USBHostResume(uint32_t ui32Base, bool bStart) | {
ASSERT(ui32Base == USB0_BASE);
if (bStart)
{
HWREGB(ui32Base + USB_O_POWER) |= USB_POWER_RESUME;
}
else
{
HWREGB(ui32Base + USB_O_POWER) &= ~USB_POWER_RESUME;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read a data from a slave when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Read Step2)
Then useres can call this function to continue receive data from slave. Users call also can xI2CMasterStop() to terminate this transmition and release the I2C bus. */ | unsigned long I2CMasterReadS2(unsigned long ulBase, unsigned char *pucData, xtBoolean bEndTransmition) | /* Read a data from a slave when the master have obtained control of the bus, and waiting for all bus transmiton complete.(Read Step2)
Then useres can call this function to continue receive data from slave. Users call also can xI2CMasterStop() to terminate this transmition and release the I2C bus. */
unsigned long I2CMasterReadS2(unsigned long ulBase, unsigned char *pucData, xtBoolean bEndTransmition) | {
*pucData = I2CMasterReadRequestS2(ulBase, bEndTransmition);
return (0);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* function to decode operator in BGP flow spec NLRI when it address decimal values (TCP ports, UDP ports, ports, ...) */ | static void decode_bgp_flow_spec_dec_operator(proto_tree *tree, tvbuff_t *tvb, gint offset) | /* function to decode operator in BGP flow spec NLRI when it address decimal values (TCP ports, UDP ports, ports, ...) */
static void decode_bgp_flow_spec_dec_operator(proto_tree *tree, tvbuff_t *tvb, gint offset) | {
static const int * flags[] = {
&hf_bgp_flowspec_nlri_op_eol,
&hf_bgp_flowspec_nlri_op_and,
&hf_bgp_flowspec_nlri_op_val_len,
&hf_bgp_flowspec_nlri_op_un_bit4,
&hf_bgp_flowspec_nlri_op_lt,
&hf_bgp_flowspec_nlri_op_gt,
&hf_bgp_flowspec_nlri_op_eq,
NULL
};
proto_tree_add_bitmask(tree, tvb, offset, hf_bgp_flowspec_nlri_op_flags, ett_bgp_flow_spec_nlri_op_flags, flags, ENC_NA);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Start photo .
Send Send start photo Command to PTC08 device. */ | xtBoolean PTC08PhotoStart(void) | /* Start photo .
Send Send start photo Command to PTC08 device. */
xtBoolean PTC08PhotoStart(void) | {
unsigned long i;
unsigned char ucTmp[5];
UARTBufferPut(PTC08_UART, (unsigned char *)&ucStartPhotoCmd[0], 5);
if (!UARTBufferGet(PTC08_UART, ucTmp, 5))
{
return xfalse;
}
for (i = 0; i < 5; i++)
{
if (ucTmp[i] != ucStartPhotoRcv[i])
{
return xfalse;
}
}
return xtrue;} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* this is basically a dynamic stabbing problem: Could use the existing prio tree code or Possible better implementations: The Interval Skip List: A Data Structure for Finding All Intervals That Overlap a Point (might be simple) Space Efficient Dynamic Stabbing with Fast Queries - Mikkel Thorup */ | static struct kmmio_probe* get_kmmio_probe(unsigned long addr) | /* this is basically a dynamic stabbing problem: Could use the existing prio tree code or Possible better implementations: The Interval Skip List: A Data Structure for Finding All Intervals That Overlap a Point (might be simple) Space Efficient Dynamic Stabbing with Fast Queries - Mikkel Thorup */
static struct kmmio_probe* get_kmmio_probe(unsigned long addr) | {
struct kmmio_probe *p;
list_for_each_entry_rcu(p, &kmmio_probes, list) {
if (addr >= p->addr && addr < (p->addr + p->len))
return p;
}
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Configures a SPI peripheral as specified. The configuration can be computed using several macros (see "SPI configuration macros") and the constants defined in LibV3 (AT91C_SPI_*). */ | void SPI_Configure(AT91S_SPI *spi, unsigned int id, unsigned int configuration) | /* Configures a SPI peripheral as specified. The configuration can be computed using several macros (see "SPI configuration macros") and the constants defined in LibV3 (AT91C_SPI_*). */
void SPI_Configure(AT91S_SPI *spi, unsigned int id, unsigned int configuration) | {
AT91C_BASE_PMC->PMC_PCER = 1 << id;
spi->SPI_CR = AT91C_SPI_SPIDIS;
spi->SPI_CR = AT91C_SPI_SWRST;
spi->SPI_CR = AT91C_SPI_SWRST;
spi->SPI_MR = configuration;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* configures OUT endpoint 0 to receive SETUP packets */ | void usb_ctlep_startout(usb_core_driver *udev) | /* configures OUT endpoint 0 to receive SETUP packets */
void usb_ctlep_startout(usb_core_driver *udev) | {
udev->regs.er_out[0]->DOEPLEN = DOEP0_TLEN(8U * 3U) | DOEP0_PCNT(1U) | DOEP0_STPCNT(3U);
if ((uint8_t)USB_USE_DMA == udev->bp.transfer_mode) {
udev->regs.er_out[0]->DOEPDMAADDR = (uint32_t)&udev->dev.control.req;
udev->regs.er_out[0]->DOEPCTL |= DEPCTL_EPACT | DEPCTL_EPEN;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is used to write data to the MsgQ. */ | OsiReturnVal_e osi_MsgQWrite(OsiMsgQ_t *pMsgQ, void *pMsg, OsiTime_t Timeout) | /* This function is used to write data to the MsgQ. */
OsiReturnVal_e osi_MsgQWrite(OsiMsgQ_t *pMsgQ, void *pMsg, OsiTime_t Timeout) | {
xHigherPriorityTaskWoken = pdFALSE;
if(pdPASS == xQueueSendFromISR((QueueHandle_t) *pMsgQ, pMsg, &xHigherPriorityTaskWoken ))
{
taskYIELD ();
return OSI_OK;
}
else
{
return OSI_OPERATION_FAILED;
}
} | micropython/micropython | C++ | Other | 18,334 |
/* Change Logs: Date Author Notes WangHuachen first version */ | void rt_hw_cpu_reset() | /* Change Logs: Date Author Notes WangHuachen first version */
void rt_hw_cpu_reset() | {
__REG32(ZynqMP_CRL_APB_BASEADDR + ZynqMP_CRL_APB_RESET_CTRL) |= ZynqMP_RESET_MASK;
while (1);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* RETURNS: Found partition on success, part0 is returned if no partition matches */ | struct hd_struct* disk_map_sector_rcu(struct gendisk *disk, sector_t sector) | /* RETURNS: Found partition on success, part0 is returned if no partition matches */
struct hd_struct* disk_map_sector_rcu(struct gendisk *disk, sector_t sector) | {
struct disk_part_tbl *ptbl;
struct hd_struct *part;
int i;
ptbl = rcu_dereference(disk->part_tbl);
part = rcu_dereference(ptbl->last_lookup);
if (part && sector_in_part(part, sector))
return part;
for (i = 1; i < ptbl->len; i++) {
part = rcu_dereference(ptbl->part[i]);
if (part && sector_in_part(part, sector)) {
rcu_assign_pointer(ptbl->last_lookup, part);
return part;
}
}
return &disk->part0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function handles USB On The Go FS End Point 1 In global interrupt. */ | void OTG_FS_EP1_IN_IRQHandler(void) | /* This function handles USB On The Go FS End Point 1 In global interrupt. */
void OTG_FS_EP1_IN_IRQHandler(void) | {
HAL_PCD_IRQHandler(&hpcd_USB_OTG_FS);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* bcm_rx_cmp_to_index - (bit)compares the currently received data to formerly received data stored in op->last_frames */ | static void bcm_rx_cmp_to_index(struct bcm_op *op, int index, const struct can_frame *rxdata) | /* bcm_rx_cmp_to_index - (bit)compares the currently received data to formerly received data stored in op->last_frames */
static void bcm_rx_cmp_to_index(struct bcm_op *op, int index, const struct can_frame *rxdata) | {
if (!(op->last_frames[index].can_dlc & RX_RECV)) {
bcm_rx_update_and_send(op, &op->last_frames[index], rxdata);
return;
}
if ((GET_U64(&op->frames[index]) & GET_U64(rxdata)) !=
(GET_U64(&op->frames[index]) & GET_U64(&op->last_frames[index]))) {
bcm_rx_update_and_send(op, &op->last_frames[index], rxdata);
return;
}
if (op->flags & RX_CHECK_DLC) {
if (rxdata->can_dlc != (op->last_frames[index].can_dlc &
BCM_CAN_DLC_MASK)) {
bcm_rx_update_and_send(op, &op->last_frames[index],
rxdata);
return;
}
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Code for all boards that route the PCI interrupts through the SIO PCI/ISA bridge. This includes Noname (AXPpci33), Multia (UDB), Kenetics's Platform 2000, Avanti (AlphaStation), XL, and AlphaBook1. */ | static void __init sio_init_irq(void) | /* Code for all boards that route the PCI interrupts through the SIO PCI/ISA bridge. This includes Noname (AXPpci33), Multia (UDB), Kenetics's Platform 2000, Avanti (AlphaStation), XL, and AlphaBook1. */
static void __init sio_init_irq(void) | {
if (alpha_using_srm)
alpha_mv.device_interrupt = srm_device_interrupt;
init_i8259a_irqs();
common_init_isa_dma();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Must be called when a user of a device is finished with it. When the last user of the device calls this function, the memory of the device is freed. */ | void pci_dev_put(struct pci_dev *dev) | /* Must be called when a user of a device is finished with it. When the last user of the device calls this function, the memory of the device is freed. */
void pci_dev_put(struct pci_dev *dev) | {
if (dev)
put_device(&dev->dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets whether the pins are edge triggered or level triggered.
Sets whether the pins are edge triggered or level triggered. Edge-triggered interrupt bits must be cleared by software. */ | void gpio_int_type(uint16_t gpios, enum gpio_trig_type type) | /* Sets whether the pins are edge triggered or level triggered.
Sets whether the pins are edge triggered or level triggered. Edge-triggered interrupt bits must be cleared by software. */
void gpio_int_type(uint16_t gpios, enum gpio_trig_type type) | {
if (type) {
GPIO_INTLEVEL_A |= gpios;
} else {
GPIO_INTLEVEL_A &= ~gpios;
}
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */ | UINT64* EFIAPI MmioReadBuffer64(IN UINTN StartAddress, IN UINTN Length, OUT UINT64 *Buffer) | /* If Buffer is not aligned on a 64-bit boundary, then ASSERT(). */
UINT64* EFIAPI MmioReadBuffer64(IN UINTN StartAddress, IN UINTN Length, OUT UINT64 *Buffer) | {
UINT64 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT64) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT64) - 1)) == 0);
ASSERT (((UINTN)Buffer & (sizeof (UINT64) - 1)) == 0);
ReturnBuffer = Buffer;
while (Length > 0) {
*(Buffer++) = MmioRead64 (StartAddress);
StartAddress += sizeof (UINT64);
Length -= sizeof (UINT64);
}
return ReturnBuffer;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return the receive message for the given sequence number and release the sequence number so it can be reused. Some other data is passed in to be sure the message matches up correctly (to help guard against message coming in after their timeout and the sequence number being reused). */ | static int intf_find_seq(ipmi_smi_t intf, unsigned char seq, short channel, unsigned char cmd, unsigned char netfn, struct ipmi_addr *addr, struct ipmi_recv_msg **recv_msg) | /* Return the receive message for the given sequence number and release the sequence number so it can be reused. Some other data is passed in to be sure the message matches up correctly (to help guard against message coming in after their timeout and the sequence number being reused). */
static int intf_find_seq(ipmi_smi_t intf, unsigned char seq, short channel, unsigned char cmd, unsigned char netfn, struct ipmi_addr *addr, struct ipmi_recv_msg **recv_msg) | {
int rv = -ENODEV;
unsigned long flags;
if (seq >= IPMI_IPMB_NUM_SEQ)
return -EINVAL;
spin_lock_irqsave(&(intf->seq_lock), flags);
if (intf->seq_table[seq].inuse) {
struct ipmi_recv_msg *msg = intf->seq_table[seq].recv_msg;
if ((msg->addr.channel == channel) && (msg->msg.cmd == cmd)
&& (msg->msg.netfn == netfn)
&& (ipmi_addr_equal(addr, &(msg->addr)))) {
*recv_msg = msg;
intf->seq_table[seq].inuse = 0;
rv = 0;
}
}
spin_unlock_irqrestore(&(intf->seq_lock), flags);
return rv;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reset Digital Watchdog.
This function can be called to reset Digital Watchdog. */ | void dwdReset(void) | /* Reset Digital Watchdog.
This function can be called to reset Digital Watchdog. */
void dwdReset(void) | {
rtiREG1->WDKEY = 0x0000E51AU;
rtiREG1->WDKEY = 0x0000A35CU;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.