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 |
|---|---|---|---|---|---|---|---|
/* cycles_reset is the count value specified by the user when setting up OProfile to count SPU_CYCLES. */ | void start_spu_profiling_events(void) | /* cycles_reset is the count value specified by the user when setting up OProfile to count SPU_CYCLES. */
void start_spu_profiling_events(void) | {
spu_prof_running = 1;
schedule_delayed_work(&spu_work, DEFAULT_TIMER_EXPIRE);
return;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* There are several entries we don't let the Guest set. The TSS entry is the "Task State Segment" which controls all kinds of delicate things. The LGUEST_CS and LGUEST_DS entries are reserved for the Switcher, and the the Guest can't be trusted to deal with double faults. */ | static bool ignored_gdt(unsigned int num) | /* There are several entries we don't let the Guest set. The TSS entry is the "Task State Segment" which controls all kinds of delicate things. The LGUEST_CS and LGUEST_DS entries are reserved for the Switcher, and the the Guest can't be trusted to deal with double faults. */
static bool ignored_gdt(unsigned int num) | {
return (num == GDT_ENTRY_TSS
|| num == GDT_ENTRY_LGUEST_CS
|| num == GDT_ENTRY_LGUEST_DS
|| num == GDT_ENTRY_DOUBLEFAULT_TSS);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note that as with g_object_weak_ref(), the weak references created by this method are not thread-safe: they cannot safely be used in one thread if the object's last g_object_unref() might happen in another thread. Use #GWeakRef if thread-safety is required. */ | void g_object_add_weak_pointer(GObject *object, gpointer *weak_pointer_location) | /* Note that as with g_object_weak_ref(), the weak references created by this method are not thread-safe: they cannot safely be used in one thread if the object's last g_object_unref() might happen in another thread. Use #GWeakRef if thread-safety is required. */
void g_object_add_weak_pointer(GObject *object, gpointer *weak_pointer_location) | {
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (weak_pointer_location != NULL);
g_object_weak_ref (object,
(GWeakNotify) g_nullify_pointer,
weak_pointer_location);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The tasks as described in the comments at the top of this file. */ | static void prvQueueReceiveTask(void *pvParameters) | /* The tasks as described in the comments at the top of this file. */
static void prvQueueReceiveTask(void *pvParameters) | {
unsigned long ulReceivedValue;
for( ;; )
{
xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
if( ulReceivedValue == 100UL )
{
if( ( FM3_GPIO->PDOR3 & mainTASK_CONTROLLED_LED ) != 0 )
{
FM3_GPIO->PDOR3 &= ~mainTASK_CONTROLLED_LED;
}
else
{
FM3_GPIO->PDOR3 |= mainTASK_CONTROLLED_LED;
}
}
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Returns the AirpcapLinkType corresponding to the given string name. */ | AirpcapLinkType airpcap_get_link_type(const gchar *name) | /* Returns the AirpcapLinkType corresponding to the given string name. */
AirpcapLinkType airpcap_get_link_type(const gchar *name) | {
if (!(g_ascii_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_ONLY,name))) {
return AIRPCAP_LT_802_11;
}else if (!(g_ascii_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_RADIO,name))) {
return AIRPCAP_LT_802_11_PLUS_RADIO;
}else if (!(g_ascii_strcasecmp(AIRPCAP_LINK_TYPE_NAME_802_11_PLUS_PPI,name))) {
return AIRPCAP_LT_802_11_PLUS_PPI;
}else{
return AIRPCAP_LT_UNKNOWN;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The default values are: code config->faultClearingMode = kPWM_Automatic; config->faultLevel = false; config->enableCombinationalPath = true; config->recoverMode = kPWM_NoRecovery; endcode param config Pointer to user's PWM fault config structure. */ | void PWM_FaultDefaultConfig(pwm_fault_param_t *config) | /* The default values are: code config->faultClearingMode = kPWM_Automatic; config->faultLevel = false; config->enableCombinationalPath = true; config->recoverMode = kPWM_NoRecovery; endcode param config Pointer to user's PWM fault config structure. */
void PWM_FaultDefaultConfig(pwm_fault_param_t *config) | {
assert(config);
(void)memset(config, 0, sizeof(*config));
config->faultClearingMode = kPWM_Automatic;
config->faultLevel = false;
config->enableCombinationalPath = true;
config->recoverMode = kPWM_NoRecovery;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Disable the time tick or alarm interrupt of RTC.
The */ | void RTCIntDisable(unsigned long ulIntType) | /* Disable the time tick or alarm interrupt of RTC.
The */
void RTCIntDisable(unsigned long ulIntType) | {
xASSERT(((ulIntType & RTC_INT_TIME_TICK) == RTC_INT_TIME_TICK) ||
((ulIntType & RTC_INT_ALARM) == RTC_INT_ALARM) ||
((ulIntType & RTC_INT_OVERFLOW) == RTC_INT_OVERFLOW));
xHWREG(RTC_IWEN) &= ~ulIntType;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* As with pcpu_pre_unmap_flush(), TLB flushing also is done at once for the whole region. */ | static void pcpu_post_unmap_tlb_flush(struct pcpu_chunk *chunk, int page_start, int page_end) | /* As with pcpu_pre_unmap_flush(), TLB flushing also is done at once for the whole region. */
static void pcpu_post_unmap_tlb_flush(struct pcpu_chunk *chunk, int page_start, int page_end) | {
flush_tlb_kernel_range(
pcpu_chunk_addr(chunk, pcpu_first_unit_cpu, page_start),
pcpu_chunk_addr(chunk, pcpu_last_unit_cpu, page_end));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes the current value of MM7. This function is only available on IA32 and X64. */ | VOID EFIAPI AsmWriteMm7(IN UINT64 Value) | /* Writes the current value of MM7. This function is only available on IA32 and X64. */
VOID EFIAPI AsmWriteMm7(IN UINT64 Value) | {
__asm__ __volatile__ (
"movq %0, %%mm7"
:
: "m" (Value)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If the ACK number matches the expected block number, and there are more data pending, send the next block. Otherwise tell the caller that we are done. */ | EFI_STATUS Mtftp4WrqHandleAck(IN MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len, OUT BOOLEAN *Completed) | /* If the ACK number matches the expected block number, and there are more data pending, send the next block. Otherwise tell the caller that we are done. */
EFI_STATUS Mtftp4WrqHandleAck(IN MTFTP4_PROTOCOL *Instance, IN EFI_MTFTP4_PACKET *Packet, IN UINT32 Len, OUT BOOLEAN *Completed) | {
UINT16 AckNum;
INTN Expected;
UINT64 BlockCounter;
*Completed = FALSE;
AckNum = NTOHS (Packet->Ack.Block[0]);
Expected = Mtftp4GetNextBlockNum (&Instance->Blocks);
ASSERT (Expected >= 0);
if (Expected != AckNum) {
return EFI_SUCCESS;
}
Mtftp4RemoveBlockNum (&Instance->Blocks, AckNum, *Completed, &BlockCounter);
Expected = Mtftp4GetNextBlockNum (&Instance->Blocks);
if (Expected < 0) {
if (Instance->LastBlock == AckNum) {
ASSERT (Instance->LastBlock >= 1);
*Completed = TRUE;
return EFI_SUCCESS;
} else {
Mtftp4SendError (
Instance,
EFI_MTFTP4_ERRORCODE_REQUEST_DENIED,
(UINT8 *)"Block number rolls back, not supported, try blksize option"
);
return EFI_TFTP_ERROR;
}
}
return Mtftp4WrqSendBlock (Instance, (UINT16)Expected);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The common function cache current active TpmInterfaceType when needed. */ | EFI_STATUS InternalTpm2DeviceLibDTpmCommonConstructor(VOID) | /* The common function cache current active TpmInterfaceType when needed. */
EFI_STATUS InternalTpm2DeviceLibDTpmCommonConstructor(VOID) | {
mActiveTpmInterfaceType = 0xFF;
mCRBIdleByPass = 0xFF;
mActiveTpmInterfaceType = Tpm2GetPtpInterface ((VOID *)(UINTN)PcdGet64 (PcdTpmBaseAddress));
if (mActiveTpmInterfaceType == Tpm2PtpInterfaceCrb) {
mCRBIdleByPass = Tpm2GetIdleByPass ((VOID *)(UINTN)PcdGet64 (PcdTpmBaseAddress));
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Software reset. Restore the default values in user registers.. */ | int32_t lis2mdl_reset_set(stmdev_ctx_t *ctx, uint8_t val) | /* Software reset. Restore the default values in user registers.. */
int32_t lis2mdl_reset_set(stmdev_ctx_t *ctx, uint8_t val) | {
lis2mdl_cfg_reg_a_t reg;
int32_t ret;
ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t*)®, 1);
if(ret == 0){
reg.soft_rst = val;
ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t*)®, 1);
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Prints a hexadecimal value in plain characters, along with the char equivalents in the following format.
AA BB CC DD EE FF ...... */ | void pn532PrintHexChar(const byte_t *pbtData, const size_t szBytes) | /* Prints a hexadecimal value in plain characters, along with the char equivalents in the following format.
AA BB CC DD EE FF ...... */
void pn532PrintHexChar(const byte_t *pbtData, const size_t szBytes) | {
size_t szPos;
for (szPos=0; szPos < szBytes; szPos++)
{
printf("%02x", pbtData[szPos]);
}
printf(" ");
for (szPos=0; szPos < szBytes; szPos++)
{
printf("%c", pbtData[szPos] <= 0x1F ? '.' : pbtData[szPos]);
}
printf(CFG_PRINTF_NEWLINE);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Gets the selected ADC Software start conversion Status. */ | FlagStatus ADC_GetSoftwareStartConvStatus(ADC_Module *ADCx) | /* Gets the selected ADC Software start conversion Status. */
FlagStatus ADC_GetSoftwareStartConvStatus(ADC_Module *ADCx) | {
FlagStatus bitstatus = RESET;
assert_param(IsAdcModule(ADCx));
if ((ADCx->CTRL2 & CTRL2_SOFT_START_SET) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* If latched faults are configured, the application must call */ | unsigned long PWMGenFaultStatus(unsigned long ulBase, unsigned long ulGen, unsigned long ulGroup) | /* If latched faults are configured, the application must call */
unsigned long PWMGenFaultStatus(unsigned long ulBase, unsigned long ulGen, unsigned long ulGroup) | {
ASSERT(HWREG(SYSCTL_DC5) & SYSCTL_DC5_PWMEFLT);
ASSERT(ulBase == PWM_BASE);
ASSERT(PWMGenValid(ulGen));
ASSERT((ulGroup == PWM_FAULT_GROUP_0) || (ulGroup == PWM_FAULT_GROUP_1));
if(ulGroup == PWM_FAULT_GROUP_0)
{
return(HWREG(PWM_GEN_EXT_BADDR(ulBase, ulGen) + PWM_O_X_FLTSTAT0));
}
else
{
return(HWREG(PWM_GEN_EXT_BADDR(ulBase, ulGen) + PWM_O_X_FLTSTAT1));
}
} | watterott/WebRadio | C++ | null | 71 |
/* @tlv_hdr: pointer to the TLV @tlv_type: type of the TLV we are looking for @tlv_size: expected size of the TLV we are looking for (if -1, don't check the size). This includes the header Returns: 0 if the TLV matches < 0 if it doesn't match at all > 0 total TLV + payload size, if the type matches, but not the size */ | static ssize_t i2400m_tlv_match(const struct i2400m_tlv_hdr *tlv, enum i2400m_tlv tlv_type, ssize_t tlv_size) | /* @tlv_hdr: pointer to the TLV @tlv_type: type of the TLV we are looking for @tlv_size: expected size of the TLV we are looking for (if -1, don't check the size). This includes the header Returns: 0 if the TLV matches < 0 if it doesn't match at all > 0 total TLV + payload size, if the type matches, but not the size */
static ssize_t i2400m_tlv_match(const struct i2400m_tlv_hdr *tlv, enum i2400m_tlv tlv_type, ssize_t tlv_size) | {
if (le16_to_cpu(tlv->type) != tlv_type)
return -1;
if (tlv_size != -1
&& le16_to_cpu(tlv->length) + sizeof(*tlv) != tlv_size) {
size_t size = le16_to_cpu(tlv->length) + sizeof(*tlv);
printk(KERN_WARNING "W: tlv type 0x%x mismatched because of "
"size (got %zu vs %zu expected)\n",
tlv_type, size, tlv_size);
return size;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Convert grayscale to RGB: just duplicate the graylevel three times. This is provided to support applications that don't want to cope with grayscale as a separate case. */ | gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) | /* Convert grayscale to RGB: just duplicate the graylevel three times. This is provided to support applications that don't want to cope with grayscale as a separate case. */
gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows) | {
register JSAMPROW outptr;
register JSAMPROW inptr;
register JDIMENSION col;
JDIMENSION num_cols = cinfo->output_width;
while (--num_rows >= 0) {
inptr = input_buf[0][input_row++];
outptr = *output_buf++;
for (col = 0; col < num_cols; col++) {
outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
outptr += RGB_PIXELSIZE;
}
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This function is for FSP dispatch mode to perform post FSP-S process. */ | EFI_STATUS EFIAPI FspsWrapperEndOfPeiNotify(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, IN VOID *Ppi) | /* This function is for FSP dispatch mode to perform post FSP-S process. */
EFI_STATUS EFIAPI FspsWrapperEndOfPeiNotify(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc, IN VOID *Ppi) | {
EFI_STATUS Status;
PostFspsHobProcess (NULL);
Status = PeiServicesInstallPpi (&mPeiFspSiliconInitDonePpi);
ASSERT_EFI_ERROR (Status);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* SCL low ETMeout value that determines the ETMeout period of SCL low. */ | void I2C_SetSCLLowETMeout(I2C_Type *pI2Cx, uint16_t u16ETMeout) | /* SCL low ETMeout value that determines the ETMeout period of SCL low. */
void I2C_SetSCLLowETMeout(I2C_Type *pI2Cx, uint16_t u16ETMeout) | {
pI2Cx->SLTL = (uint8_t)u16ETMeout;
pI2Cx->SLTH = (uint8_t)(u16ETMeout>>8);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is called every time the MTD device is being put. Returns zero in case of success and a negative error code in case of failure. */ | static void gluebi_put_device(struct mtd_info *mtd) | /* This function is called every time the MTD device is being put. Returns zero in case of success and a negative error code in case of failure. */
static void gluebi_put_device(struct mtd_info *mtd) | {
struct gluebi_device *gluebi;
gluebi = container_of(mtd, struct gluebi_device, mtd);
mutex_lock(&devices_mutex);
gluebi->refcnt -= 1;
if (gluebi->refcnt == 0)
ubi_close_volume(gluebi->desc);
module_put(THIS_MODULE);
mutex_unlock(&devices_mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is a temporary stop-gap and will be removed soon. It is only to support the fs_enet, ucc_geth and gianfar Ethernet drivers. Do not call this function from new drivers. */ | struct phy_device* of_phy_connect_fixed_link(struct net_device *dev, void(*hndlr)(struct net_device *), phy_interface_t iface) | /* This function is a temporary stop-gap and will be removed soon. It is only to support the fs_enet, ucc_geth and gianfar Ethernet drivers. Do not call this function from new drivers. */
struct phy_device* of_phy_connect_fixed_link(struct net_device *dev, void(*hndlr)(struct net_device *), phy_interface_t iface) | {
struct device_node *net_np;
char bus_id[MII_BUS_ID_SIZE + 3];
struct phy_device *phy;
const u32 *phy_id;
int sz;
if (!dev->dev.parent)
return NULL;
net_np = dev_archdata_get_node(&dev->dev.parent->archdata);
if (!net_np)
return NULL;
phy_id = of_get_property(net_np, "fixed-link", &sz);
if (!phy_id || sz < sizeof(*phy_id))
return NULL;
sprintf(bus_id, PHY_ID_FMT, "0", phy_id[0]);
phy = phy_connect(dev, bus_id, hndlr, 0, iface);
return IS_ERR(phy) ? NULL : phy;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the first valid block number on the range list. */ | INTN Mtftp6GetNextBlockNum(IN LIST_ENTRY *Head) | /* Get the first valid block number on the range list. */
INTN Mtftp6GetNextBlockNum(IN LIST_ENTRY *Head) | {
MTFTP6_BLOCK_RANGE *Range;
if (IsListEmpty (Head)) {
return -1;
}
Range = NET_LIST_HEAD (Head, MTFTP6_BLOCK_RANGE, Link);
return Range->Start;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Find a file in the volume by name */ | EFI_STATUS EFIAPI FfsFindFileByName(IN CONST EFI_GUID *FileName, IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle) | /* Find a file in the volume by name */
EFI_STATUS EFIAPI FfsFindFileByName(IN CONST EFI_GUID *FileName, IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle) | {
EFI_STATUS Status;
if ((VolumeHandle == NULL) || (FileName == NULL) || (FileHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
Status = FindFileEx (VolumeHandle, FileName, 0, FileHandle);
if (Status == EFI_NOT_FOUND) {
*FileHandle = NULL;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set value of a data element in an Array by its Index. */ | VOID SetArrayData(IN VOID *Array, IN UINT8 Type, IN UINTN Index, IN UINT64 Value) | /* Set value of a data element in an Array by its Index. */
VOID SetArrayData(IN VOID *Array, IN UINT8 Type, IN UINTN Index, IN UINT64 Value) | {
ASSERT (Array != NULL);
switch (Type) {
case EFI_IFR_TYPE_NUM_SIZE_8:
*(((UINT8 *)Array) + Index) = (UINT8)Value;
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
*(((UINT16 *)Array) + Index) = (UINT16)Value;
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
*(((UINT32 *)Array) + Index) = (UINT32)Value;
break;
case EFI_IFR_TYPE_NUM_SIZE_64:
*(((UINT64 *)Array) + Index) = (UINT64)Value;
break;
default:
break;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This file is part of the TinyUSB stack. */ | void timer_ISR(void) | /* This file is part of the TinyUSB stack. */
void timer_ISR(void) | {
if (timer_is_interrupted(timer_select_a))
{
timer_ms++;
}
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Equivalent to xenbus_dev_error(dev, err, fmt, args), followed by xenbus_switch_state(dev, XenbusStateClosing) to schedule an orderly closedown of this driver and its peer. */ | void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,...) | /* Equivalent to xenbus_dev_error(dev, err, fmt, args), followed by xenbus_switch_state(dev, XenbusStateClosing) to schedule an orderly closedown of this driver and its peer. */
void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,...) | {
va_list ap;
va_start(ap, fmt);
xenbus_va_dev_error(dev, err, fmt, ap);
va_end(ap);
xenbus_switch_state(dev, XenbusStateClosing);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Retrieve work items and do the writeback they describe */ | long wb_do_writeback(struct bdi_writeback *wb, int force_wait) | /* Retrieve work items and do the writeback they describe */
long wb_do_writeback(struct bdi_writeback *wb, int force_wait) | {
struct backing_dev_info *bdi = wb->bdi;
struct bdi_work *work;
long wrote = 0;
while ((work = get_next_work_item(bdi, wb)) != NULL) {
struct wb_writeback_args args = work->args;
if (force_wait)
work->args.sync_mode = args.sync_mode = WB_SYNC_ALL;
if (args.sync_mode == WB_SYNC_NONE)
wb_clear_pending(wb, work);
wrote += wb_writeback(wb, &args);
if (args.sync_mode == WB_SYNC_ALL)
wb_clear_pending(wb, work);
}
wrote += wb_check_old_data_flush(wb);
return wrote;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Count is greater than 63, then ASSERT(). */ | UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count) | /* If Count is greater than 63, then ASSERT(). */
UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count) | {
ASSERT (Count < 64);
return InternalMathRShiftU64 (Operand, Count);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Programs n byte at a specified start address. */ | void FLASH_ProgramByte(uint32_t Addr, uint8_t *ByteBuffer, uint32_t Length) | /* Programs n byte at a specified start address. */
void FLASH_ProgramByte(uint32_t Addr, uint8_t *ByteBuffer, uint32_t Length) | {
uint32_t i;
assert_parameters(IS_FLASH_ADDRESS(Addr));
FLASH->PGADDR = Addr;
FLASH->PASS = FLASH_PASS_KEY;
for (i=0; i<Length; i++)
{
if (((Addr + i)&0x3) == 0)
*((__IO uint8_t*)(&FLASH->PGDATA)) = *(ByteBuffer++);
else if (((Addr + i)&0x3) == 1)
*((__IO uint8_t*)(&FLASH->PGDATA) + 1) = *(ByteBuffer++);
else if (((Addr + i)&0x3) == 2)
*((__IO uint8_t*)(&FLASH->PGDATA) + 2) = *(ByteBuffer++);
else
*((__IO uint8_t*)(&FLASH->PGDATA) + 3) = *(ByteBuffer++);
while (FLASH->STS != 1);
}
FLASH->PASS = 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clears the SPIx CRC Error (CRCERR) interrupt pending bit. */ | void SPI_I2S_ClrITPendingBit(SPI_Module *SPIx, uint8_t SPI_I2S_IT) | /* Clears the SPIx CRC Error (CRCERR) interrupt pending bit. */
void SPI_I2S_ClrITPendingBit(SPI_Module *SPIx, uint8_t SPI_I2S_IT) | {
uint16_t itpos = 0;
assert_param(IS_SPI_PERIPH(SPIx));
assert_param(IS_SPI_I2S_CLR_INT(SPI_I2S_IT));
itpos = 0x01 << (SPI_I2S_IT & 0x0F);
SPIx->STS = (uint16_t)~itpos;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* returns all SMI handlers' size associated with SmiEntry. */ | UINTN GetSmmSmiHandlerSizeOnSmiEntry(IN SMI_ENTRY *SmiEntry) | /* returns all SMI handlers' size associated with SmiEntry. */
UINTN GetSmmSmiHandlerSizeOnSmiEntry(IN SMI_ENTRY *SmiEntry) | {
LIST_ENTRY *ListEntry;
SMI_HANDLER *SmiHandler;
UINTN Size;
Size = 0;
ListEntry = &SmiEntry->SmiHandlers;
for (ListEntry = ListEntry->ForwardLink;
ListEntry != &SmiEntry->SmiHandlers;
ListEntry = ListEntry->ForwardLink)
{
SmiHandler = CR (ListEntry, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
Size += sizeof (SMM_CORE_SMI_HANDLER_STRUCTURE) + GET_OCCUPIED_SIZE (SmiHandler->ContextSize, sizeof (UINT64));
}
return Size;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Convert the pointer that points to where the block's data starts, to a pointer that points to where the block's allocated memory starts. */ | static void * TbxMemPoolBlockGetMemPtr(void *dataPtr) | /* Convert the pointer that points to where the block's data starts, to a pointer that points to where the block's allocated memory starts. */
static void * TbxMemPoolBlockGetMemPtr(void *dataPtr) | {
void * result = NULL;
void * blockMemPtr;
size_t * blockSizeArray;
TBX_ASSERT(dataPtr != NULL);
if (dataPtr != NULL)
{
blockSizeArray = dataPtr;
blockMemPtr = &blockSizeArray[-1];
result = blockMemPtr;
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* provide access to fpga gpios (for I2C bitbang) (these may look all too simple but make iocon.h much more readable) */ | void fpga_gpio_set(uint bus, int pin) | /* provide access to fpga gpios (for I2C bitbang) (these may look all too simple but make iocon.h much more readable) */
void fpga_gpio_set(uint bus, int pin) | {
FPGA_SET_REG(bus, gpio.set, pin);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Destroy the IP instance if its StationAddress is removed. It is the help function for */ | VOID Ip6DestroyInstanceByAddress(IN OUT IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Address) | /* Destroy the IP instance if its StationAddress is removed. It is the help function for */
VOID Ip6DestroyInstanceByAddress(IN OUT IP6_SERVICE *IpSb, IN EFI_IPv6_ADDRESS *Address) | {
LIST_ENTRY *List;
IP6_DESTROY_CHILD_BY_ADDR_CALLBACK_CONTEXT Context;
NET_CHECK_SIGNATURE (IpSb, IP6_SERVICE_SIGNATURE);
List = &IpSb->Children;
Context.ServiceBinding = &IpSb->ServiceBinding;
Context.Address = Address;
NetDestroyLinkList (
List,
Ip6DestroyChildEntryByAddr,
&Context,
NULL
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Decrypts the len-bytes in the specified data-array, using the specified 256- bit (32 bytes) key. The results are written back into the same array. */ | void TbxCryptoAes256Decrypt(uint8_t *data, size_t len, uint8_t const *key) | /* Decrypts the len-bytes in the specified data-array, using the specified 256- bit (32 bytes) key. The results are written back into the same array. */
void TbxCryptoAes256Decrypt(uint8_t *data, size_t len, uint8_t const *key) | {
tbx_aes256_context ctx;
TBX_ASSERT(data != NULL);
TBX_ASSERT(len > 0U);
TBX_ASSERT(key != NULL);
TBX_ASSERT((len % TBX_CRYPTO_AES_BLOCK_SIZE) == 0U);
if ( (data != NULL) && (len > 0U) && (key != NULL) && \
((len % TBX_CRYPTO_AES_BLOCK_SIZE) == 0U) )
{
tbx_aes256_init(&ctx, key);
for (size_t idx = 0U; idx < (len / TBX_CRYPTO_AES_BLOCK_SIZE); idx++)
{
tbx_aes256_decrypt_ecb(&ctx, &data[idx * TBX_CRYPTO_AES_BLOCK_SIZE]);
}
tbx_aes256_done(&ctx);
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* \This function use extern interrupt to wake up mcu from sleep mode */ | void WakeUpFromPowerDown(void) | /* \This function use extern interrupt to wake up mcu from sleep mode */
void WakeUpFromPowerDown(void) | {
xIntEnable(INT_EINT0);
xIntPrioritySet(INT_EINT0, 1);
xGPIOSPinTypeGPIOInput(PD2);
xSPinTypeEXTINT(NINT0, PD2);
xGPIOPinIntEnable(GPIO_PORTD_BASE, GPIO_PIN_2, xGPIO_FALLING_EDGE);
GPIOPinIntCallbackInit(GPIO_PORTD_BASE, GPIO_PIN_2, INT0CallbackFunction);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Clear ALL of the status bits in the reset generator.
This function will clear all status bits in the reset generator status. */ | void am_hal_reset_status_clear(void) | /* Clear ALL of the status bits in the reset generator.
This function will clear all status bits in the reset generator status. */
void am_hal_reset_status_clear(void) | {
AM_REG(RSTGEN, CLRSTAT) = AM_REG_RSTGEN_CLRSTAT_CLRSTAT(1);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */ | int pxa_getc_dev(unsigned int uart_index) | /* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
int pxa_getc_dev(unsigned int uart_index) | {
switch (uart_index) {
case FFUART_INDEX:
while (!(FFLSR & LSR_DR))
WATCHDOG_RESET ();
return (char) FFRBR & 0xff;
case BTUART_INDEX:
while (!(BTLSR & LSR_DR))
WATCHDOG_RESET ();
return (char) BTRBR & 0xff;
case STUART_INDEX:
while (!(STLSR & LSR_DR))
WATCHDOG_RESET ();
return (char) STRBR & 0xff;
}
return -1;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Take down a ppp interface unit - called when the owning file (the one that created the unit) is closed or detached. */ | static void ppp_shutdown_interface(struct ppp *ppp) | /* Take down a ppp interface unit - called when the owning file (the one that created the unit) is closed or detached. */
static void ppp_shutdown_interface(struct ppp *ppp) | {
struct ppp_net *pn;
pn = ppp_pernet(ppp->ppp_net);
mutex_lock(&pn->all_ppp_mutex);
ppp_lock(ppp);
if (!ppp->closing) {
ppp->closing = 1;
ppp_unlock(ppp);
unregister_netdev(ppp->dev);
} else
ppp_unlock(ppp);
unit_put(&pn->units_idr, ppp->file.index);
ppp->file.dead = 1;
ppp->owner = NULL;
wake_up_interruptible(&ppp->file.rwait);
mutex_unlock(&pn->all_ppp_mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the entry of the validation combo using the AirpcapValidationType. */ | void airpcap_validation_type_combo_set_by_type(GtkWidget *c, AirpcapValidationType type) | /* Sets the entry of the validation combo using the AirpcapValidationType. */
void airpcap_validation_type_combo_set_by_type(GtkWidget *c, AirpcapValidationType type) | {
gtk_combo_box_set_active(GTK_COMBO_BOX(c), airpcap_get_validation_combo_entry(type));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Set the SFH5712 execution mode.
SENSOR_STATE_NORMAL: Setting the sleep mode puts sensor in continuous measurement mode. */ | static bool sfh5712_set_state(sensor_hal_t *hal, sensor_state_t state) | /* Set the SFH5712 execution mode.
SENSOR_STATE_NORMAL: Setting the sleep mode puts sensor in continuous measurement mode. */
static bool sfh5712_set_state(sensor_hal_t *hal, sensor_state_t state) | {
switch (state) {
case SENSOR_STATE_SLEEP:
sensor_bus_put(hal, SFH5712_ALS_CONTROL, ALS_MODE_STANDBY);
break;
case SENSOR_STATE_NORMAL:
sensor_bus_put(hal, SFH5712_ALS_CONTROL, ALS_MODE_ACTIVE);
break;
default:
return false;
}
return true;
} | memfault/zero-to-main | C++ | null | 200 |
/* The dequeue_task method is called before nr_running is decreased. We remove the task from the rbtree and update the fair scheduling stats: */ | static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep) | /* The dequeue_task method is called before nr_running is decreased. We remove the task from the rbtree and update the fair scheduling stats: */
static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep) | {
struct cfs_rq *cfs_rq;
struct sched_entity *se = &p->se;
for_each_sched_entity(se) {
cfs_rq = cfs_rq_of(se);
dequeue_entity(cfs_rq, se, sleep);
if (cfs_rq->load.weight)
break;
sleep = 1;
}
hrtick_update(rq);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initializes an system calibration configuration structure to default values.
This function will initialize a given system calibration configuration structure to a set of known default values. This function should be called on any new instance of the configuration structures before being modified by the user application. */ | void system_calibration_get_config_defaults(struct system_calibration_config *config) | /* Initializes an system calibration configuration structure to default values.
This function will initialize a given system calibration configuration structure to a set of known default values. This function should be called on any new instance of the configuration structures before being modified by the user application. */
void system_calibration_get_config_defaults(struct system_calibration_config *config) | {
config->clk_num = CALIBRATION_CLK_NUM_1024;
config->interrupt_control = CALIBRATION_INTERRUPT_OSC_DONE;
config->osc_fractional_part = 0;
config->osc_integer_part = 0;
config->rtc_fractional_part = 0;
config->rtc_integer_part = 0;
} | memfault/zero-to-main | C++ | null | 200 |
/* This is the callback from dput() when d_count is going to 0. We use this to unhash dentries with bad inodes. Closing files can be safely postponed until iput() - it's done there anyway. */ | static int ncp_delete_dentry(struct dentry *) | /* This is the callback from dput() when d_count is going to 0. We use this to unhash dentries with bad inodes. Closing files can be safely postponed until iput() - it's done there anyway. */
static int ncp_delete_dentry(struct dentry *) | {
struct inode *inode = dentry->d_inode;
if (inode) {
if (is_bad_inode(inode))
return 1;
} else
{
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable time stamp snapshot for IPV4 frames. When enabled, time stamp snapshot is taken for IPV4 frames Reserved when "Advanced Time Stamp" is not selected */ | void synopGMAC_TS_IPV4_enable(synopGMACdevice *gmacdev) | /* Enable time stamp snapshot for IPV4 frames. When enabled, time stamp snapshot is taken for IPV4 frames Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_IPV4_enable(synopGMACdevice *gmacdev) | {
synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSIPV4ENA);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */ | VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages) | /* If Buffer was not allocated with a page allocation function in the Memory Allocation Library, then ASSERT(). If Pages is zero, then ASSERT(). */
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages) | {
EFI_STATUS Status;
ASSERT (Pages != 0);
if (BufferInSmram (Buffer)) {
Status = gSmst->SmmFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
} else {
Status = gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
}
ASSERT_EFI_ERROR (Status);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Default C language implementation of a 16x32->32 multiply. This function may be replaced by a platform-specific version for speed. */ | INLINE OI_INT32 default_mul_16s_32s_hi(OI_INT16 u, OI_INT32 v) | /* Default C language implementation of a 16x32->32 multiply. This function may be replaced by a platform-specific version for speed. */
INLINE OI_INT32 default_mul_16s_32s_hi(OI_INT16 u, OI_INT32 v) | {
OI_UINT16 v0;
OI_INT16 v1;
OI_INT32 w, x;
v0 = (OI_UINT16)(v & 0xffff);
v1 = (OI_INT16)(v >> 16);
w = v1 * u;
x = u * v0;
return w + (x >> 16);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* This function make WWDT module start counting with different counter period and compared window value. */ | void WWDT_Open(UINT u32PreScale, UINT u32CmpValue, UINT u32EnableInt) | /* This function make WWDT module start counting with different counter period and compared window value. */
void WWDT_Open(UINT u32PreScale, UINT u32CmpValue, UINT u32EnableInt) | {
UINT reg;
reg = u32PreScale |
(u32CmpValue << 16) |
0x1 |
(u32EnableInt ? 0x2 : 0);
outpw(REG_WWDT_CTL, reg);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* We map the most common registers we'd access of the internal 4GB host adapter memory space. If a register/internal memory location is wanted which is not mapped, we slide SWB, by paging it, see asd_move_swb() in aic94xx_reg.c. asd_move_swb */ | static void asd_move_swb(struct asd_ha_struct *asd_ha, u32 reg) | /* We map the most common registers we'd access of the internal 4GB host adapter memory space. If a register/internal memory location is wanted which is not mapped, we slide SWB, by paging it, see asd_move_swb() in aic94xx_reg.c. asd_move_swb */
static void asd_move_swb(struct asd_ha_struct *asd_ha, u32 reg) | {
u32 base = reg & ~(MBAR0_SWB_SIZE-1);
pci_write_config_dword(asd_ha->pcidev, PCI_CONF_MBAR0_SWB, base);
asd_ha->io_handle[0].swb_base = base;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* NOTE: This function is a backend of PCI power management routines and is not supposed to be called drivers. */ | void pci_disable_enabled_device(struct pci_dev *dev) | /* NOTE: This function is a backend of PCI power management routines and is not supposed to be called drivers. */
void pci_disable_enabled_device(struct pci_dev *dev) | {
if (pci_is_enabled(dev))
do_pci_disable_device(dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param xfer LPUART transfer structure, see #lpuart_transfer_t. retval kStatus_Success Successfully start the data transmission. retval kStatus_LPUART_TxBusy Previous transmission still not finished, data not all written to the TX register. retval kStatus_InvalidArgument Invalid argument. */ | status_t LPUART_TransferSendNonBlocking(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer) | /* param base LPUART peripheral base address. param handle LPUART handle pointer. param xfer LPUART transfer structure, see #lpuart_transfer_t. retval kStatus_Success Successfully start the data transmission. retval kStatus_LPUART_TxBusy Previous transmission still not finished, data not all written to the TX register. retval kStatus_InvalidArgument Invalid argument. */
status_t LPUART_TransferSendNonBlocking(LPUART_Type *base, lpuart_handle_t *handle, lpuart_transfer_t *xfer) | {
assert(NULL != handle);
assert(NULL != xfer);
assert(NULL != xfer->txData);
assert(0U != xfer->dataSize);
status_t status;
if ((uint8_t)kLPUART_TxBusy == handle->txState)
{
status = kStatus_LPUART_TxBusy;
}
else
{
handle->txData = xfer->txData;
handle->txDataSize = xfer->dataSize;
handle->txDataSizeAll = xfer->dataSize;
handle->txState = (uint8_t)kLPUART_TxBusy;
uint32_t irqMask = DisableGlobalIRQ();
base->CTRL |= (uint32_t)LPUART_CTRL_TIE_MASK;
EnableGlobalIRQ(irqMask);
status = kStatus_Success;
}
return status;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* scsi_build_sense_buffer - build sense data in a buffer @desc: Sense format (non zero == descriptor format, 0 == fixed format) @buf: Where to build sense data @key: Sense key @asc: Additional sense code @ascq: Additional sense code qualifier */ | void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq) | /* scsi_build_sense_buffer - build sense data in a buffer @desc: Sense format (non zero == descriptor format, 0 == fixed format) @buf: Where to build sense data @key: Sense key @asc: Additional sense code @ascq: Additional sense code qualifier */
void scsi_build_sense_buffer(int desc, u8 *buf, u8 key, u8 asc, u8 ascq) | {
if (desc) {
buf[0] = 0x72;
buf[1] = key;
buf[2] = asc;
buf[3] = ascq;
buf[7] = 0;
} else {
buf[0] = 0x70;
buf[2] = key;
buf[7] = 0xa;
buf[12] = asc;
buf[13] = ascq;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function for initializing the BLE stack.
Initializes the SoftDevice and the BLE event interrupt. */ | static void ble_stack_init(void) | /* Function for initializing the BLE stack.
Initializes the SoftDevice and the BLE event interrupt. */
static void ble_stack_init(void) | {
uint32_t err_code;
nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
ble_enable_params_t ble_enable_params;
err_code = softdevice_enable_get_default_config(CENTRAL_LINK_COUNT,
PERIPHERAL_LINK_COUNT,
&ble_enable_params);
APP_ERROR_CHECK(err_code);
CHECK_RAM_START_ADDR(CENTRAL_LINK_COUNT,PERIPHERAL_LINK_COUNT);
err_code = softdevice_enable(&ble_enable_params);
APP_ERROR_CHECK(err_code);
err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);
err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
APP_ERROR_CHECK(err_code);
} | labapart/polymcu | C++ | null | 201 |
/* Compare two host keys for an exact match. */ | static gint host_match(gconstpointer v, gconstpointer w) | /* Compare two host keys for an exact match. */
static gint host_match(gconstpointer v, gconstpointer w) | {
const host_key_t *v1 = (const host_key_t *)v;
const host_key_t *v2 = (const host_key_t *)w;
if (v1->port == v2->port &&
addresses_equal(&v1->myaddress, &v2->myaddress)) {
return 1;
}
return 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This API configure the duration and threshold of any-motion interrupt. */ | static int8_t config_any_dur_threshold(const struct bmi160_acc_any_mot_int_cfg *any_motion_int_cfg, const struct bmi160_dev *dev) | /* This API configure the duration and threshold of any-motion interrupt. */
static int8_t config_any_dur_threshold(const struct bmi160_acc_any_mot_int_cfg *any_motion_int_cfg, const struct bmi160_dev *dev) | {
int8_t rslt;
uint8_t data = 0;
uint8_t temp = 0;
uint8_t data_array[2] = { 0 };
uint8_t dur;
rslt = bmi160_get_regs(BMI160_INT_MOTION_0_ADDR, &data, 1, dev);
if (rslt == BMI160_OK)
{
dur = (uint8_t)any_motion_int_cfg->anymotion_dur;
temp = data & ~BMI160_SLOPE_INT_DUR_MASK;
data = temp | (dur & BMI160_MOTION_SRC_INT_MASK);
data_array[0] = data;
data_array[1] = any_motion_int_cfg->anymotion_thr;
rslt = bmi160_set_regs(BMI160_INT_MOTION_0_ADDR, data_array, 2, dev);
}
return rslt;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* ISR to handle the reloading of the PWM timer with the next sample. */ | ISR(TIMER0_COMPA_vect, ISR_BLOCK) | /* ISR to handle the reloading of the PWM timer with the next sample. */
ISR(TIMER0_COMPA_vect, ISR_BLOCK) | {
uint16_t MixedSample = 0;
for (uint8_t i = 0; i < MAX_SIMULTANEOUS_NOTES; i++)
{
if (NoteData[i].Pitch)
{
uint8_t TableIndex = (NoteData[i].TablePosition >> 24);
MixedSample += SineTable[TableIndex];
NoteData[i].TablePosition += NoteData[i].TableIncrement;
}
}
OCR3A = (MixedSample <= 0xFF) ? MixedSample : 0xFF;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Queues an event (on the station event queue) for handling by the station state machine and attempts to process any queued-up events. */ | static void llc_station_state_process(struct sk_buff *skb) | /* Queues an event (on the station event queue) for handling by the station state machine and attempts to process any queued-up events. */
static void llc_station_state_process(struct sk_buff *skb) | {
spin_lock_bh(&llc_main_station.ev_q.lock);
skb_queue_tail(&llc_main_station.ev_q.list, skb);
llc_station_service_events();
spin_unlock_bh(&llc_main_station.ev_q.lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* When a writepage implementation decides that it doesn't want to write this page for some reason, it should redirty the locked page via redirty_page_for_writepage() and it should then unlock the page and return 0 */ | int redirty_page_for_writepage(struct writeback_control *wbc, struct page *page) | /* When a writepage implementation decides that it doesn't want to write this page for some reason, it should redirty the locked page via redirty_page_for_writepage() and it should then unlock the page and return 0 */
int redirty_page_for_writepage(struct writeback_control *wbc, struct page *page) | {
wbc->pages_skipped++;
return __set_page_dirty_nobuffers(page);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Calculate and return the operational path mask (opm) based on the chpids used by the subchannel and the status of the associated channel-paths. */ | u8 chp_get_sch_opm(struct subchannel *sch) | /* Calculate and return the operational path mask (opm) based on the chpids used by the subchannel and the status of the associated channel-paths. */
u8 chp_get_sch_opm(struct subchannel *sch) | {
struct chp_id chpid;
int opm;
int i;
opm = 0;
chp_id_init(&chpid);
for (i = 0; i < 8; i++) {
opm <<= 1;
chpid.id = sch->schib.pmcw.chpid[i];
if (chp_get_status(chpid) != 0)
opm |= 1;
}
return opm;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check all channels if we have a 'no carrier' timeout. Timeout value is set by Register S7. */ | void isdn_tty_carrier_timeout(void) | /* Check all channels if we have a 'no carrier' timeout. Timeout value is set by Register S7. */
void isdn_tty_carrier_timeout(void) | {
int ton = 0;
int i;
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
modem_info *info = &dev->mdm.info[i];
if (info->dialing) {
if (info->emu.carrierwait++ > info->emu.mdmreg[REG_WAITC]) {
info->dialing = 0;
isdn_tty_modem_result(RESULT_NO_CARRIER, info);
isdn_tty_modem_hup(info, 1);
}
else
ton = 1;
}
}
isdn_timer_ctrl(ISDN_TIMER_CARRIER, ton);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base Pointer to the FLEXIO_SPI_Type structure. param mask SPI DMA source. param enable True means enable DMA, false means disable DMA. */ | void FLEXIO_SPI_EnableDMA(FLEXIO_SPI_Type *base, uint32_t mask, bool enable) | /* param base Pointer to the FLEXIO_SPI_Type structure. param mask SPI DMA source. param enable True means enable DMA, false means disable DMA. */
void FLEXIO_SPI_EnableDMA(FLEXIO_SPI_Type *base, uint32_t mask, bool enable) | {
if (mask & kFLEXIO_SPI_TxDmaEnable)
{
FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1U << base->shifterIndex[0], enable);
}
if (mask & kFLEXIO_SPI_RxDmaEnable)
{
FLEXIO_EnableShifterStatusDMA(base->flexioBase, 1U << base->shifterIndex[1], enable);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* LLDs that need to run a task from the session workqueue should call this. The session lock must be held. This should only be called by software drivers. */ | void iscsi_requeue_task(struct iscsi_task *task) | /* LLDs that need to run a task from the session workqueue should call this. The session lock must be held. This should only be called by software drivers. */
void iscsi_requeue_task(struct iscsi_task *task) | {
struct iscsi_conn *conn = task->conn;
if (list_empty(&task->running))
list_add_tail(&task->running, &conn->requeue);
iscsi_conn_queue_work(conn);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @maxlen specifies the maximum length to map. If you want to get access to the complete BAR without checking for its length first, pass %0 here. */ | void __iomem* pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | /* @maxlen specifies the maximum length to map. If you want to get access to the complete BAR without checking for its length first, pass %0 here. */
void __iomem* pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | {
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if (maxlen && len > maxlen)
len = maxlen;
if (flags & IORESOURCE_IO)
return ioport_map(start, len);
if (flags & IORESOURCE_MEM) {
if (flags & IORESOURCE_CACHEABLE)
return ioremap(start, len);
return ioremap_nocache(start, len);
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function overrides the generic pixis_write() function, so that it can use PIXIS indirect mode if necessary. */ | void pixis_write(unsigned int reg, u8 value) | /* This function overrides the generic pixis_write() function, so that it can use PIXIS indirect mode if necessary. */
void pixis_write(unsigned int reg, u8 value) | {
ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
if ((in_be32(&gur->pmuxcr) & PMUXCR_ELBCDIU_MASK) !=
PMUXCR_ELBCDIU_NOR16) {
out_8(lbc_lcs0_ba, reg);
out_8(lbc_lcs1_ba, value);
in_8(lbc_lcs1_ba);
} else {
void *p = (void *)PIXIS_BASE;
out_8(p + reg, value);
}
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Clean up process after a packet is received. */ | void EMAC_RecvPktDone(void) | /* Clean up process after a packet is received. */
void EMAC_RecvPktDone(void) | {
EMAC_DESCRIPTOR_T *desc;
desc = (EMAC_DESCRIPTOR_T *)u32CurrentRxDesc;
desc->u32Data = desc->u32Backup1;
desc->u32Next = desc->u32Backup2;
desc->u32Status1 |= EMAC_DESC_OWN_EMAC;
desc = (EMAC_DESCRIPTOR_T *)desc->u32Next;
u32CurrentRxDesc = (uint32_t)desc;
EMAC_TRIGGER_RX();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Fills each SDADC_AINStruct member with its default value. */ | void SDADC_AINStructInit(SDADC_AINStructTypeDef *SDADC_AINStruct) | /* Fills each SDADC_AINStruct member with its default value. */
void SDADC_AINStructInit(SDADC_AINStructTypeDef *SDADC_AINStruct) | {
SDADC_AINStruct->SDADC_InputMode = SDADC_InputMode_Diff;
SDADC_AINStruct->SDADC_Gain = SDADC_Gain_1;
SDADC_AINStruct->SDADC_CommonMode = SDADC_CommonMode_VSSA;
SDADC_AINStruct->SDADC_Offset = 0;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* UART DMA send finished callback function.
This function is called when UART DMA send finished. It disables the UART TX DMA request and sends kStatus_UART_TxIdle to UART callback. */ | static void UART_TransferSendDMACallback(dma_handle_t *handle, void *param) | /* UART DMA send finished callback function.
This function is called when UART DMA send finished. It disables the UART TX DMA request and sends kStatus_UART_TxIdle to UART callback. */
static void UART_TransferSendDMACallback(dma_handle_t *handle, void *param) | {
uart_dma_private_handle_t *uartPrivateHandle = (uart_dma_private_handle_t *)param;
UART_EnableTxDMA(uartPrivateHandle->base, false);
DMA_DisableInterrupts(handle->base, handle->channel);
uartPrivateHandle->handle->txState = kUART_TxIdle;
if (uartPrivateHandle->handle->callback)
{
uartPrivateHandle->handle->callback(uartPrivateHandle->base, uartPrivateHandle->handle, kStatus_UART_TxIdle,
uartPrivateHandle->handle->userData);
}
} | labapart/polymcu | C++ | null | 201 |
/* Set GPIO Pin Mode.
Sets the mode (input/output) and configuration (analog/digitial and open drain/push pull), for a set of GPIO pins on a given GPIO port. */ | void gpio_mode_setup(uint32_t gpioport, uint32_t mode, uint32_t pull_up_down, uint32_t gpios) | /* Set GPIO Pin Mode.
Sets the mode (input/output) and configuration (analog/digitial and open drain/push pull), for a set of GPIO pins on a given GPIO port. */
void gpio_mode_setup(uint32_t gpioport, uint32_t mode, uint32_t pull_up_down, uint32_t gpios) | {
(void) gpioport;
uint8_t i = 0;
while (gpios) {
if (gpios & 1) {
GPIO_PIN_CNF(i) = (
GPIO_PIN_CNF(i) &
~((GPIO_CNF_MODE_MASK << GPIO_CNF_MODE_SHIFT)
| (GPIO_CNF_PUPD_MASK << GPIO_CNF_PUPD_SHIFT)
)
) | (mode << GPIO_CNF_MODE_SHIFT)
| (pull_up_down << GPIO_CNF_PUPD_SHIFT);
}
++i;
gpios >>= 1;
}
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* param base VBAT peripheral base address. param timeoutPeriod The bandgap timerout 1 period, in number of seconds, ranging from 0 to 65535s. */ | void VBAT_SetBandgapTimer1TimeoutValue(VBAT_Type *base, uint32_t timeoutPeriod) | /* param base VBAT peripheral base address. param timeoutPeriod The bandgap timerout 1 period, in number of seconds, ranging from 0 to 65535s. */
void VBAT_SetBandgapTimer1TimeoutValue(VBAT_Type *base, uint32_t timeoutPeriod) | {
bool timerEnabled = false;
timerEnabled = ((base->LDOTIMER1 & VBAT_LDOTIMER1_TIMEN_MASK) != 0UL) ? true : false;
if (timerEnabled)
{
base->LDOTIMER1 &= ~VBAT_LDOTIMER1_TIMEN_MASK;
}
base->LDOTIMER1 = ((base->LDOTIMER1 & (~VBAT_LDOTIMER1_TIMCFG_MASK)) | VBAT_LDOTIMER1_TIMCFG(timeoutPeriod));
if (timerEnabled)
{
base->LDOTIMER1 |= VBAT_LDOTIMER1_TIMEN_MASK;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get prompt string id from the opcode data buffer. */ | EFI_STRING_ID GetPrompt(IN EFI_IFR_OP_HEADER *OpCode) | /* Get prompt string id from the opcode data buffer. */
EFI_STRING_ID GetPrompt(IN EFI_IFR_OP_HEADER *OpCode) | {
EFI_IFR_STATEMENT_HEADER *Header;
if (OpCode->Length <= sizeof (EFI_IFR_OP_HEADER)) {
return 0;
}
Header = (EFI_IFR_STATEMENT_HEADER *)(OpCode + 1);
return Header->Prompt;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The function is used to get the number of elements in a JSON object, or 0 if it is NULL or not a JSON object. */ | UINTN EFIAPI JsonObjectSize(IN EDKII_JSON_OBJECT JsonObject) | /* The function is used to get the number of elements in a JSON object, or 0 if it is NULL or not a JSON object. */
UINTN EFIAPI JsonObjectSize(IN EDKII_JSON_OBJECT JsonObject) | {
return json_object_size ((json_t *)JsonObject);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Fetch current temperature from temperature sensor (in Celsius).
If reading the temperature, when a measurement is completed inside the sensor device, the new measurement may not be stored. For this reason, the temperature should not be polled with a higher frequency than the measurement conversion time for a given resolution configuration. Please refer to sensor device datasheet. */ | int TEMPSENS_TemperatureGet(I2C_TypeDef *i2c, uint8_t addr, TEMPSENS_Temp_TypeDef *temp) | /* Fetch current temperature from temperature sensor (in Celsius).
If reading the temperature, when a measurement is completed inside the sensor device, the new measurement may not be stored. For this reason, the temperature should not be polled with a higher frequency than the measurement conversion time for a given resolution configuration. Please refer to sensor device datasheet. */
int TEMPSENS_TemperatureGet(I2C_TypeDef *i2c, uint8_t addr, TEMPSENS_Temp_TypeDef *temp) | {
int ret;
uint32_t tmp;
uint16_t val = 0;
ret = TEMPSENS_RegisterGet(i2c, addr, tempsensRegTemp, &val);
if (ret < 0)
{
return(ret);
}
tmp = (uint32_t)(val >> 4);
if (tmp & 0x800)
{
tmp = (~tmp + 1) & 0xfff;
temp->i = -(int16_t)(tmp >> 4);
temp->f = -(int16_t)((tmp & 0xf) * 625);
}
else
{
temp->i = (int16_t)(tmp >> 4);
temp->f = (int16_t)((tmp & 0xf) * 625);
}
return(0);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* New entries to a heap are added at the bottom and then moved up until the parent's value is greater. In the case of LPT's category heaps, the value is either the amount of free space or the amount of dirty space, depending on the category. */ | static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, struct ubifs_lprops *lprops, int cat) | /* New entries to a heap are added at the bottom and then moved up until the parent's value is greater. In the case of LPT's category heaps, the value is either the amount of free space or the amount of dirty space, depending on the category. */
static void move_up_lpt_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, struct ubifs_lprops *lprops, int cat) | {
int val1, val2, hpos;
hpos = lprops->hpos;
if (!hpos)
return;
val1 = get_heap_comp_val(lprops, cat);
do {
int ppos = (hpos - 1) / 2;
val2 = get_heap_comp_val(heap->arr[ppos], cat);
if (val2 >= val1)
return;
heap->arr[ppos]->hpos = hpos;
heap->arr[hpos] = heap->arr[ppos];
heap->arr[ppos] = lprops;
lprops->hpos = ppos;
hpos = ppos;
} while (hpos);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Write a value in a register of the device through BUS. */ | static int32_t I2C2_WriteReg(uint16_t DevAddr, uint16_t Reg, uint16_t MemAddSize, uint8_t *pData, uint16_t Length) | /* Write a value in a register of the device through BUS. */
static int32_t I2C2_WriteReg(uint16_t DevAddr, uint16_t Reg, uint16_t MemAddSize, uint8_t *pData, uint16_t Length) | {
if (HAL_I2C_Mem_Write(&hbus_i2c2, DevAddr, Reg, MemAddSize, pData, Length, 10000) == HAL_OK)
{
return BSP_ERROR_NONE;
}
return BSP_ERROR_BUS_FAILURE;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Determines if there are any characters in the receive FIFO. */ | bool UARTCharsAvail(uint32_t ui32Base) | /* Determines if there are any characters in the receive FIFO. */
bool UARTCharsAvail(uint32_t ui32Base) | {
ASSERT(_UARTBaseValid(ui32Base));
return ((HWREG(ui32Base + UART_O_FR) & UART_FR_RXFE) ? false : true);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param handle Pointer to DMA handle. param descriptor descriptor to submit. */ | void DMA_SubmitChannelDescriptor(dma_handle_t *handle, dma_descriptor_t *descriptor) | /* param handle Pointer to DMA handle. param descriptor descriptor to submit. */
void DMA_SubmitChannelDescriptor(dma_handle_t *handle, dma_descriptor_t *descriptor) | {
assert((NULL != handle) && (NULL != descriptor));
DMA_LoadChannelDescriptor(handle->base, handle->channel, descriptor);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* clock in the nvram command and the register number. For the national semiconductor nv ram chip the op code is 3 bits and the address is 6/8 bits. */ | static void eeprom_cmd(unsigned int *ctrl, unsigned cmd, unsigned reg) | /* clock in the nvram command and the register number. For the national semiconductor nv ram chip the op code is 3 bits and the address is 6/8 bits. */
static void eeprom_cmd(unsigned int *ctrl, unsigned cmd, unsigned reg) | {
unsigned short ser_cmd;
int i;
ser_cmd = cmd | (reg << (16 - BITS_IN_COMMAND));
for (i = 0; i < BITS_IN_COMMAND; i++) {
if (ser_cmd & (1<<15))
__raw_writel(__raw_readl(ctrl) | EEPROM_DATO, ctrl);
else
__raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
__raw_writel(__raw_readl(ctrl) & ~EEPROM_ECLK, ctrl);
delay();
__raw_writel(__raw_readl(ctrl) | EEPROM_ECLK, ctrl);
delay();
ser_cmd <<= 1;
}
__raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* All the functions below are part of public USB device support API. */ | struct net_buf* usbd_ep_ctrl_buf_alloc(struct usbd_contex *const uds_ctx, const uint8_t ep, const size_t size) | /* All the functions below are part of public USB device support API. */
struct net_buf* usbd_ep_ctrl_buf_alloc(struct usbd_contex *const uds_ctx, const uint8_t ep, const size_t size) | {
if (USB_EP_GET_IDX(ep)) {
return NULL;
}
return udc_ep_buf_alloc(uds_ctx->dev, ep, size);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* This function finds and removes the table specified by the handle. */ | EFI_STATUS RemoveTableFromList(IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN EFI_ACPI_TABLE_VERSION Version, IN UINTN Handle) | /* This function finds and removes the table specified by the handle. */
EFI_STATUS RemoveTableFromList(IN EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance, IN EFI_ACPI_TABLE_VERSION Version, IN UINTN Handle) | {
EFI_ACPI_TABLE_LIST *Table;
EFI_STATUS Status;
Table = (EFI_ACPI_TABLE_LIST *)NULL;
ASSERT (AcpiTableInstance);
Status = FindTableByHandle (
Handle,
&AcpiTableInstance->TableList,
&Table
);
if (EFI_ERROR (Status)) {
return EFI_NOT_FOUND;
}
Status = DeleteTable (AcpiTableInstance, Version, Table);
if (EFI_ERROR (Status)) {
return EFI_ABORTED;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Refer to SD Host Controller Simplified spec 3.0 Section 3.2.2 for details. */ | EFI_STATUS EmmcPeimHcStopClock(IN UINTN Bar) | /* Refer to SD Host Controller Simplified spec 3.0 Section 3.2.2 for details. */
EFI_STATUS EmmcPeimHcStopClock(IN UINTN Bar) | {
EFI_STATUS Status;
UINT32 PresentState;
UINT16 ClockCtrl;
Status = EmmcPeimHcWaitMmioSet (
Bar + EMMC_HC_PRESENT_STATE,
sizeof (PresentState),
BIT0 | BIT1,
0,
EMMC_TIMEOUT
);
if (EFI_ERROR (Status)) {
return Status;
}
ClockCtrl = (UINT16) ~BIT2;
Status = EmmcPeimHcAndMmio (Bar + EMMC_HC_CLOCK_CTRL, sizeof (ClockCtrl), &ClockCtrl);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI S3PciWrite32(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 S3PciWrite32(IN UINTN Address, IN UINT32 Value) | {
return InternalSavePciWrite32ValueToBootScript (Address, PciWrite32 (Address, Value));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Removes a registered user return notifier. Must be called from atomic context, and from the same cpu registration occured in. */ | void user_return_notifier_unregister(struct user_return_notifier *urn) | /* Removes a registered user return notifier. Must be called from atomic context, and from the same cpu registration occured in. */
void user_return_notifier_unregister(struct user_return_notifier *urn) | {
hlist_del(&urn->link);
if (hlist_empty(&__get_cpu_var(return_notifier_list)))
clear_tsk_thread_flag(current, TIF_USER_RETURN_NOTIFY);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If this function returns, it means that the system does not support shutdown reset. */ | VOID EFIAPI ResetShutdown(VOID) | /* If this function returns, it means that the system does not support shutdown reset. */
VOID EFIAPI ResetShutdown(VOID) | {
SbiSystemReset (SBI_SRST_RESET_TYPE_SHUTDOWN, SBI_SRST_RESET_REASON_NONE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Scrolls the contents of the LCD screen vertically the specified number of pixels using a HW optimised routine. */ | void lcdScroll(int16_t pixels, uint16_t fillColor) | /* Scrolls the contents of the LCD screen vertically the specified number of pixels using a HW optimised routine. */
void lcdScroll(int16_t pixels, uint16_t fillColor) | {
int16_t y = pixels;
while (y < 0)
y += 320;
while (y >= 320)
y -= 320;
ili9328WriteCmd(ILI9328_COMMANDS_VERTICALSCROLLCONTROL);
ili9328WriteData(y);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Clears or safeguards the OCREF1 signal on an external event. */ | void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | /* Clears or safeguards the OCREF1 signal on an external event. */
void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear) | {
uint16_t tmpccmr1 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= (uint16_t)~((uint16_t)TIM_CCMR1_OC1CE);
tmpccmr1 |= TIM_OCClear;
TIMx->CCMR1 = tmpccmr1;
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Function for processing a received acknowledgement packet.
Verifies does the received acknowledgement packet has the expected acknowledgement number and that the header checksum is correct. */ | static __INLINE bool rx_ack_pkt_type_handle(const uint8_t *p_buffer) | /* Function for processing a received acknowledgement packet.
Verifies does the received acknowledgement packet has the expected acknowledgement number and that the header checksum is correct. */
static __INLINE bool rx_ack_pkt_type_handle(const uint8_t *p_buffer) | {
const uint32_t expected_checksum =
((p_buffer[0] + p_buffer[1] + p_buffer[2] + p_buffer[3])) & 0xFFu;
if (expected_checksum != 0)
{
return false;
}
const uint8_t ack_number = (p_buffer[0] >> 3u) & 0x07u;
return (ack_number == expected_ack_number_get());
} | labapart/polymcu | C++ | null | 201 |
/* internal IRQs operations: only mask/unmask on PERF irq mask register. */ | static void bcm63xx_internal_irq_mask(unsigned int irq) | /* internal IRQs operations: only mask/unmask on PERF irq mask register. */
static void bcm63xx_internal_irq_mask(unsigned int irq) | {
u32 mask;
irq -= IRQ_INTERNAL_BASE;
mask = bcm_perf_readl(PERF_IRQMASK_REG);
mask &= ~(1 << irq);
bcm_perf_writel(mask, PERF_IRQMASK_REG);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* ZigBee Device Profile dissector for the remove node cache */ | void dissect_zbee_zdp_rsp_remove_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | /* ZigBee Device Profile dissector for the remove node cache */
void dissect_zbee_zdp_rsp_remove_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) | {
guint offset = 0;
guint8 status;
status = zdp_parse_status(tree, tvb, &offset);
zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status));
zdp_dump_excess(tvb, offset, pinfo, tree);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns number of us since last clock interrupt. Note that interrupts will have been disabled by do_gettimeoffset() */ | static unsigned long pnx4008_gettimeoffset(void) | /* Returns number of us since last clock interrupt. Note that interrupts will have been disabled by do_gettimeoffset() */
static unsigned long pnx4008_gettimeoffset(void) | {
u32 ticks_to_match =
__raw_readl(HSTIM_MATCH0) - __raw_readl(HSTIM_COUNTER);
u32 elapsed = LATCH - ticks_to_match;
return (elapsed * (tick_nsec / 1000)) / LATCH;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* inventory.c:do_inventory() hasn't yet been run and thus we don't 'discover' the additional CPUs until later. */ | void __init smp_prepare_cpus(unsigned int max_cpus) | /* inventory.c:do_inventory() hasn't yet been run and thus we don't 'discover' the additional CPUs until later. */
void __init smp_prepare_cpus(unsigned int max_cpus) | {
int cpu;
for_each_possible_cpu(cpu)
spin_lock_init(&per_cpu(ipi_lock, cpu));
init_cpu_present(cpumask_of(0));
parisc_max_cpus = max_cpus;
if (!max_cpus)
printk(KERN_INFO "SMP mode deactivated.\n");
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Called by a driver the first time it's needed, must be attached to desired connectors. */ | int drm_mode_create_dirty_info_property(struct drm_device *dev) | /* Called by a driver the first time it's needed, must be attached to desired connectors. */
int drm_mode_create_dirty_info_property(struct drm_device *dev) | {
struct drm_property *dirty_info;
int i;
if (dev->mode_config.dirty_info_property)
return 0;
dirty_info =
drm_property_create(dev, DRM_MODE_PROP_ENUM |
DRM_MODE_PROP_IMMUTABLE,
"dirty",
ARRAY_SIZE(drm_dirty_info_enum_list));
for (i = 0; i < ARRAY_SIZE(drm_dirty_info_enum_list); i++)
drm_property_add_enum(dirty_info, i,
drm_dirty_info_enum_list[i].type,
drm_dirty_info_enum_list[i].name);
dev->mode_config.dirty_info_property = dirty_info;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Erase complete Flash Memory Return Value: 0 - OK, 1 - Failed */ | uint32_t EraseChip(void) | /* Erase complete Flash Memory Return Value: 0 - OK, 1 - Failed */
uint32_t EraseChip(void) | {
cortex_int_state_t state = cortex_int_get_and_disable();
int status = FLASH_EraseAll(&g_flash, kFLASH_apiEraseKey);
if (status == kStatus_Success)
{
status = FLASH_VerifyEraseAll(&g_flash, kFLASH_marginValueNormal);
}
cortex_int_restore(state);
return status;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* We need to reset the 8042 back to original mode on system shutdown, because otherwise BIOSes will be confused. */ | static void i8042_shutdown(struct platform_device *dev) | /* We need to reset the 8042 back to original mode on system shutdown, because otherwise BIOSes will be confused. */
static void i8042_shutdown(struct platform_device *dev) | {
i8042_controller_reset();
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ks_read_qmu - read 1 pkt data from the QMU. @ks: The chip information @buf: buffer address to save 1 pkt @len: Pkt length Here is the sequence to read 1 pkt: */ | static void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len) | /* ks_read_qmu - read 1 pkt data from the QMU. @ks: The chip information @buf: buffer address to save 1 pkt @len: Pkt length Here is the sequence to read 1 pkt: */
static void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len) | {
u32 r = ks->extra_byte & 0x1 ;
u32 w = ks->extra_byte - r;
ks_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI);
ks_wrreg8(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_SDA) & 0xff);
if (unlikely(r))
ioread8(ks->hw_addr);
ks_inblk(ks, buf, w + 2 + 2);
ks_inblk(ks, buf, ALIGN(len, 4));
ks_wrreg8(ks, KS_RXQCR, ks->rc_rxqcr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* RETURNS: non-zero for PCI device is a target device to reassign, or zero is not. */ | int pci_is_reassigndev(struct pci_dev *dev) | /* RETURNS: non-zero for PCI device is a target device to reassign, or zero is not. */
int pci_is_reassigndev(struct pci_dev *dev) | {
return (pci_specified_resource_alignment(dev) != 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This code executes in exception context so no efi calls are allowed. This code is called from assembly file. */ | VOID InterruptDistrubutionHub(EFI_EXCEPTION_TYPE ExceptionType, EFI_SYSTEM_CONTEXT_IA32 *ContextRecord) | /* This code executes in exception context so no efi calls are allowed. This code is called from assembly file. */
VOID InterruptDistrubutionHub(EFI_EXCEPTION_TYPE ExceptionType, EFI_SYSTEM_CONTEXT_IA32 *ContextRecord) | {
if (IdtEntryTable[ExceptionType].RegisteredCallback != NULL) {
if (ExceptionType != SYSTEM_TIMER_VECTOR) {
IdtEntryTable[ExceptionType].RegisteredCallback (ExceptionType, ContextRecord);
} else {
OrigVector = IdtEntryTable[ExceptionType].OrigVector;
IdtEntryTable[ExceptionType].RegisteredCallback (ContextRecord);
}
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Recovery of dead resources on error handled by the Lua GC as standard in the case of RAM loading. In the case of loading an LFS image into flash, the error recovery could be done through the S->protogc list, but given that the immediate action is to restart the CPU, there is little point in adding the extra functionality to recover these dangling resources. */ | static void LoadProtos(LoadState *S, Proto *f) | /* Recovery of dead resources on error handled by the Lua GC as standard in the case of RAM loading. In the case of loading an LFS image into flash, the error recovery could be done through the S->protogc list, but given that the immediate action is to restart the CPU, there is little point in adding the extra functionality to recover these dangling resources. */
static void LoadProtos(LoadState *S, Proto *f) | {
f->p = StoreAV(S, cast(void **, p), n);
luaM_freearray(S->L, p, n);
}
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Create a hostcache id string for the provided host + port, to be used by the DNS caching. Without alloc. */ | static void create_hostcache_id(const char *name, int port, char *ptr, size_t buflen) | /* Create a hostcache id string for the provided host + port, to be used by the DNS caching. Without alloc. */
static void create_hostcache_id(const char *name, int port, char *ptr, size_t buflen) | {
size_t len = strlen(name);
if(len > (buflen - 7))
len = buflen - 7;
while(len--)
*ptr++ = (char)TOLOWER(*name++);
msnprintf(ptr, 7, ":%u", port);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Converts a text device path node to Vendor-defined media device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenMedia(CHAR16 *TextDeviceNode) | /* Converts a text device path node to Vendor-defined media device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenMedia(CHAR16 *TextDeviceNode) | {
return ConvertFromTextVendor (
TextDeviceNode,
MEDIA_DEVICE_PATH,
MEDIA_VENDOR_DP
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the MCU into Thread-Mode and load the initial task from the stack and run it. */ | void NORETURN __enter_thread_mode(void) | /* Set the MCU into Thread-Mode and load the initial task from the stack and run it. */
void NORETURN __enter_thread_mode(void) | {
enableIRQ();
__context_restore();
asm volatile("ret");
UNREACHABLE();
} | labapart/polymcu | C++ | null | 201 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.