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 |
|---|---|---|---|---|---|---|---|
/* This function returns the current PWM clock configuration. */ | unsigned long SysCtlPWMClockGet(void) | /* This function returns the current PWM clock configuration. */
unsigned long SysCtlPWMClockGet(void) | {
ASSERT(HWREG(SYSCTL_DC1) & SYSCTL_DC1_PWM0);
if(!(HWREG(SYSCTL_RCC) & SYSCTL_RCC_USEPWMDIV))
{
return(SYSCTL_PWMDIV_1);
}
else
{
return(HWREG(SYSCTL_RCC) &
(SYSCTL_RCC_USEPWMDIV | SYSCTL_RCC_PWMDIV_M));
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Configures the voltage threshold detected by the Power Voltage Detector(PVD). */ | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel) | /* Configures the voltage threshold detected by the Power Voltage Detector(PVD). */
void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel) | {
uint32_t tmpreg = 0;
assert_param(IS_PWR_PVD_LEVEL(PWR_PVDLevel));
tmpreg = PWR->CR;
tmpreg &= CR_PLS_MASK;
tmpreg |= PWR_PVDLevel;
PWR->CR = tmpreg;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Returns TRUE if the instance of #CRInput got destroyed, false otherwise. */ | gboolean cr_input_unref(CRInput *a_this) | /* Returns TRUE if the instance of #CRInput got destroyed, false otherwise. */
gboolean cr_input_unref(CRInput *a_this) | {
g_return_val_if_fail (a_this && PRIVATE (a_this), FALSE);
if (PRIVATE (a_this)->ref_count) {
PRIVATE (a_this)->ref_count--;
}
if (PRIVATE (a_this)->ref_count == 0) {
cr_input_destroy (a_this);
return TRUE;
}
return FALSE;
... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Try to find the size of the ASs encoded in an as-path. It is not obvious, as both Old speakers that do not support 4 byte AS, and the new speakers that do support, exchange AS-Path with the same path-attribute type value 0x02. */ | static int bgp_attr_get_as_size(netdissect_options *ndo, uint8_t bgpa_type, const u_char *pptr, int len) | /* Try to find the size of the ASs encoded in an as-path. It is not obvious, as both Old speakers that do not support 4 byte AS, and the new speakers that do support, exchange AS-Path with the same path-attribute type value 0x02. */
static int bgp_attr_get_as_size(netdissect_options *ndo, uint8_t bgpa_type, const u_ch... | {
const u_char *tptr = pptr;
if (bgpa_type == BGPTYPE_AS4_PATH) {
return 4;
}
while (tptr < pptr + len) {
ND_TCHECK(tptr[0]);
if (tptr[0] < BGP_AS_SEG_TYPE_MIN || tptr[0] > BGP_AS_SEG_TYPE_MAX) {
goto trunc;
}
ND_TCHECK(tptr[1]);
tptr += 2 + tp... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This comparator searches for the next Interface descriptor of the correct CDC control Class, Subclass and Protocol values. */ | uint8_t DComp_NextCDCControlInterface(void *CurrentDescriptor) | /* This comparator searches for the next Interface descriptor of the correct CDC control Class, Subclass and Protocol values. */
uint8_t DComp_NextCDCControlInterface(void *CurrentDescriptor) | {
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
if (Header->Type == DTYPE_Interface)
{
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
if ((Interface->Class == CDC_CSCP_CDCClass) &&
(Interface->... | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Set the filter type for the specified ETHERNET MAC address. */ | void ETH_ConfigMacAddrMaskBytesFilter(uint32_t MacAddr, uint32_t MaskByte) | /* Set the filter type for the specified ETHERNET MAC address. */
void ETH_ConfigMacAddrMaskBytesFilter(uint32_t MacAddr, uint32_t MaskByte) | {
assert_param(IS_ETH_MAC_ADDR123(MacAddr));
assert_param(IS_ETH_MAC_ADDR_MASK(MaskByte));
(*(__IO uint32_t*)(ETH_MAC_ADDR_HBASE + MacAddr)) &= (~(uint32_t)ETH_MACADDR1HI_MBC);
(*(__IO uint32_t*)(ETH_MAC_ADDR_HBASE + MacAddr)) |= MaskByte;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Release the memory region(s) being used by 'port' */ | static void ks8695uart_release_port(struct uart_port *port) | /* Release the memory region(s) being used by 'port' */
static void ks8695uart_release_port(struct uart_port *port) | {
release_mem_region(port->mapbase, UART_PORT_SIZE);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function: MX25_BE Arguments: flash_address, 32 bit flash memory address Description: The BE instruction is for erasing the data of the chosen sector (64KB) to be "1". Return Message: FlashAddressInvalid, FlashIsBusy, FlashOperationSuccess, FlashTimeOut */ | ReturnMsg MX25_BE(uint32_t flash_address) | /* Function: MX25_BE Arguments: flash_address, 32 bit flash memory address Description: The BE instruction is for erasing the data of the chosen sector (64KB) to be "1". Return Message: FlashAddressInvalid, FlashIsBusy, FlashOperationSuccess, FlashTimeOut */
ReturnMsg MX25_BE(uint32_t flash_address) | {
uint8_t addr_4byte_mode;
if( flash_address > FlashSize ) return FlashAddressInvalid;
if( IsFlashBusy() ) return FlashIsBusy;
if( IsFlash4Byte() )
addr_4byte_mode = TRUE;
else
addr_4byte_mode = FALSE;
MX25_WREN();
CS_Low();
SendByte( FLASH_CMD_BE, SIO );
SendFlas... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Sending a TPM1.2 command to a TPM2 should return a TPM1.2 header (tag = 0xc4) and error code (TPM_BADTAG = 0x1e) */ | STATIC EFI_STATUS TestTpm12() | /* Sending a TPM1.2 command to a TPM2 should return a TPM1.2 header (tag = 0xc4) and error code (TPM_BADTAG = 0x1e) */
STATIC EFI_STATUS TestTpm12() | {
EFI_STATUS Status;
TPM_RQU_COMMAND_HDR Command;
TPM_RSP_GET_TICKS Response;
UINT32 Length;
Command.tag = SwapBytes16 (TPM_TAG_RQU_COMMAND);
Command.paramSize = SwapBytes32 (sizeof (Command));
Command.ordinal = SwapBytes32 (TPM_ORD_GetTicks);
Length = sizeof (Respons... | tianocore/edk2 | C++ | Other | 4,240 |
/* Scan the cache with a timer and see what we need to throw out. */ | static void rif_check_expire(unsigned long dummy) | /* Scan the cache with a timer and see what we need to throw out. */
static void rif_check_expire(unsigned long dummy) | {
int i;
unsigned long flags, next_interval = jiffies + sysctl_tr_rif_timeout/2;
spin_lock_irqsave(&rif_lock, flags);
for(i =0; i < RIF_TABLE_SIZE; i++) {
struct rif_cache *entry, **pentry;
pentry = rif_table+i;
while((entry=*pentry) != NULL) {
unsigned long expires
= entry->last_used + sysctl_tr_rif_t... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Cause a BFTM Event trigger for a sample sequence. */ | void ADCBftmEventTrigger(unsigned long ulBase) | /* Cause a BFTM Event trigger for a sample sequence. */
void ADCBftmEventTrigger(unsigned long ulBase) | {
xASSERT(ulBase == ADC_BASE);
xHWREG(ulBase + ADC_TCR) |= ADC_TCR_BFTM_EN;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Converts a text device path node to Keyboard device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextKeyboard(CHAR16 *TextDeviceNode) | /* Converts a text device path node to Keyboard device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextKeyboard(CHAR16 *TextDeviceNode) | {
return ConvertFromTextAcpi (TextDeviceNode, 0x0301);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Informs application whether the APB bus write operation to the LPTIMx_CMP register has been successfully completed. If so, a new one can be initiated. @rmtoll ISR CMPOK LPTIM_IsActiveFlag_CMPOK. */ | uint32_t LPTIM_IsActiveFlag_CMPOK(LPTIM_Module *LPTIMx) | /* Informs application whether the APB bus write operation to the LPTIMx_CMP register has been successfully completed. If so, a new one can be initiated. @rmtoll ISR CMPOK LPTIM_IsActiveFlag_CMPOK. */
uint32_t LPTIM_IsActiveFlag_CMPOK(LPTIM_Module *LPTIMx) | {
return (((READ_BIT(LPTIMx->INTSTS,LPTIM_INTSTS_CMPUPD) ==LPTIM_INTSTS_CMPUPD)? 1UL : 0UL));
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* param base TEMPMON base pointer return current temperature with degrees Celsius. */ | float TEMPMON_GetCurrentTemperature(TEMPMON_Type *base) | /* param base TEMPMON base pointer return current temperature with degrees Celsius. */
float TEMPMON_GetCurrentTemperature(TEMPMON_Type *base) | {
assert(NULL != base);
uint32_t nmeas;
float tmeas;
while (0U == (base->TEMPSENSE0 & TEMPMON_TEMPSENSE0_FINISHED_MASK))
{
}
nmeas = (base->TEMPSENSE0 & TEMPMON_TEMPSENSE0_TEMP_CNT_MASK) >> TEMPMON_TEMPSENSE0_TEMP_CNT_SHIFT;
tmeas = (float)s_hotTemp - (((float)nmeas - (float)s_hotCount) ... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Disable endpoint interrupts on a given USB controller. */ | void USBIntDisableEndpoint(unsigned long ulBase, unsigned long ulFlags) | /* Disable endpoint interrupts on a given USB controller. */
void USBIntDisableEndpoint(unsigned long ulBase, unsigned long ulFlags) | {
ASSERT(ulBase == USB0_BASE);
HWREGH(ulBase + USB_O_TXIE) &=
~(ulFlags & (USB_INTEP_HOST_OUT | USB_INTEP_DEV_IN | USB_INTEP_0));
HWREGH(ulBase + USB_O_RXIE) &=
~((ulFlags & (USB_INTEP_HOST_IN | USB_INTEP_DEV_OUT)) >>
USB_INTEP_RX_SHIFT);
} | watterott/WebRadio | C++ | null | 71 |
/* Sets the given bit(s) in a register in the Si7021 device. */ | uint32_t SI7210_regSetBits(uint8_t addr, uint8_t mask) | /* Sets the given bit(s) in a register in the Si7021 device. */
uint32_t SI7210_regSetBits(uint8_t addr, uint8_t mask) | {
uint8_t value;
uint32_t status;
status = SI7210_regRead( addr, &value );
if( status != SI7210_OK ) {
return status;
}
value |= mask;
status = SI7210_regWrite( addr, value );
return status;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* atc_desc_put - move a descriptor, including any children, to the free list @atchan: channel we work on @desc: descriptor, at the head of a chain, to move to free list */ | static void atc_desc_put(struct at_dma_chan *atchan, struct at_desc *desc) | /* atc_desc_put - move a descriptor, including any children, to the free list @atchan: channel we work on @desc: descriptor, at the head of a chain, to move to free list */
static void atc_desc_put(struct at_dma_chan *atchan, struct at_desc *desc) | {
if (desc) {
struct at_desc *child;
spin_lock_bh(&atchan->lock);
list_for_each_entry(child, &desc->tx_list, desc_node)
dev_vdbg(chan2dev(&atchan->chan_common),
"moving child desc %p to freelist\n",
child);
list_splice_init(&desc->tx_list, &atchan->free_list);
dev_vdbg(chan2dev(&atchan->chan_com... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine goes all-out, setting everything up anew at each open, even though many of these registers should only need to be set once at boot. */ | static int ax_open(struct net_device *dev) | /* This routine goes all-out, setting everything up anew at each open, even though many of these registers should only need to be set once at boot. */
static int ax_open(struct net_device *dev) | {
unsigned long flags;
struct ei_device *ei_local = (struct ei_device *) netdev_priv(dev);
spin_lock_irqsave(&ei_local->page_lock, flags);
AX88190_init(dev, 1);
netif_start_queue(dev);
spin_unlock_irqrestore(&ei_local->page_lock, flags);
ei_local->irqlock = 0;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Library constructor: retrieves the Hyperpage address from the gEfiXenInfoGuid HOB */ | RETURN_STATUS EFIAPI XenHypercallLibInit(VOID) | /* Library constructor: retrieves the Hyperpage address from the gEfiXenInfoGuid HOB */
RETURN_STATUS EFIAPI XenHypercallLibInit(VOID) | {
EFI_HOB_GUID_TYPE *GuidHob;
EFI_XEN_INFO *XenInfo;
GuidHob = GetFirstGuidHob (&gEfiXenInfoGuid);
if (GuidHob == NULL) {
return RETURN_NOT_FOUND;
}
XenInfo = (EFI_XEN_INFO *)GET_GUID_HOB_DATA (GuidHob);
HyperPage = XenInfo->HyperPages;
return RETURN_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Read a 16bit register from the chip, returning the result */ | static u16 ks_rdreg16(struct ks_net *ks, int offset) | /* Read a 16bit register from the chip, returning the result */
static u16 ks_rdreg16(struct ks_net *ks, int offset) | {
ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
return ioread16(ks->hw_addr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disables the period interrupt for the given PWM channel. */ | void PWMC_DisableChannelIt(unsigned char channel) | /* Disables the period interrupt for the given PWM channel. */
void PWMC_DisableChannelIt(unsigned char channel) | {
AT91C_BASE_PWMC->PWMC_IDR = 1 << channel;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Master sends single byte through the I2Cx peripheral to detect slave device. */ | int I2C_MasterSendNullData_TimeOut(I2C_TypeDef *I2Cx, int address, u32 timeout_ms) | /* Master sends single byte through the I2Cx peripheral to detect slave device. */
int I2C_MasterSendNullData_TimeOut(I2C_TypeDef *I2Cx, int address, u32 timeout_ms) | {
u8 I2CTemp = (u8)(address<<1);
I2C_MasterSendNullData(I2Cx, &I2CTemp, 0, 1, 0);
DelayMs(timeout_ms);
if(I2C_GetRawINT(I2Cx) & BIT_IC_RAW_INTR_STAT_TX_ABRT) {
I2C_ClearAllINT(I2Cx);
DelayUs(100);
I2C_Cmd(I2Cx, DISABLE);
I2C_Cmd(I2Cx, ENABLE);
return -1;
}
return 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Routine: get_board_mem_timings Description: If we use SPL then there is no x-loader nor config header so we have to setup the DDR timings ourself on the first bank. This provides the timing values back to the function that configures the memory. We have either one or two banks of 128MB DDR. */ | void get_board_mem_timings(struct board_sdrc_timings *timings) | /* Routine: get_board_mem_timings Description: If we use SPL then there is no x-loader nor config header so we have to setup the DDR timings ourself on the first bank. This provides the timing values back to the function that configures the memory. We have either one or two banks of 128MB DDR. */
void get_board_mem_ti... | {
timings->mcfg = MICRON_V_MCFG_165(128 << 20);
timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
timings->ctrla = MICRON_V_ACTIMA_165;
timings->ctrlb = MICRON_V_ACTIMB_165;
timings->mr = MICRON_V_MR_165;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns: TRUE if @data was successfully added to the @stream. */ | gboolean g_data_output_stream_put_int16(GDataOutputStream *stream, gint16 data, GCancellable *cancellable, GError **error) | /* Returns: TRUE if @data was successfully added to the @stream. */
gboolean g_data_output_stream_put_int16(GDataOutputStream *stream, gint16 data, GCancellable *cancellable, GError **error) | {
gsize bytes_written;
g_return_val_if_fail (G_IS_DATA_OUTPUT_STREAM (stream), FALSE);
switch (stream->priv->byte_order)
{
case G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN:
data = GINT16_TO_BE (data);
break;
case G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN:
data = GINT16_TO_LE (data);
break... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Master finish up a transfer. It would call back if there is callback function and set the state to idle. This is not a public API. */ | static void LPSPI_MasterTransferComplete(LPSPI_Type *base, lpspi_master_handle_t *handle) | /* Master finish up a transfer. It would call back if there is callback function and set the state to idle. This is not a public API. */
static void LPSPI_MasterTransferComplete(LPSPI_Type *base, lpspi_master_handle_t *handle) | {
assert(handle);
LPSPI_DisableInterrupts(base, (uint32_t)kLPSPI_AllInterruptEnable);
handle->state = (uint8_t)kLPSPI_Idle;
if (handle->callback != NULL)
{
handle->callback(base, handle, kStatus_Success, handle->userData);
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Checks whether the specified CAN interrupt has occurred or not. */ | ITStatus CAN_Peli_GetITStatus(u32 it) | /* Checks whether the specified CAN interrupt has occurred or not. */
ITStatus CAN_Peli_GetITStatus(u32 it) | {
return (ITStatus)(((CAN1_PELI->IR & it) != it) ? RESET : SET);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is called, when no request is outstanding and we get an interrupt */ | static int tape_34xx_unsolicited_irq(struct tape_device *device, struct irb *irb) | /* This function is called, when no request is outstanding and we get an interrupt */
static int tape_34xx_unsolicited_irq(struct tape_device *device, struct irb *irb) | {
if (irb->scsw.cmd.dstat == 0x85) {
DBF_EVENT(6, "xuud med\n");
tape_34xx_delete_sbid_from(device, 0);
tape_34xx_schedule_work(device, TO_MSEN);
} else {
DBF_EVENT(3, "unsol.irq! dev end: %08x\n", device->cdev_id);
tape_dump_sense_dbf(device, NULL, irb);
}
return TAPE_IO_SUCCESS;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function should be called when we hit a congestion event since only at that point do we really have a real sense of maxRTT (the queues en route were getting just too full now). */ | static void htcp_param_update(struct sock *sk) | /* This function should be called when we hit a congestion event since only at that point do we really have a real sense of maxRTT (the queues en route were getting just too full now). */
static void htcp_param_update(struct sock *sk) | {
struct htcp *ca = inet_csk_ca(sk);
u32 minRTT = ca->minRTT;
u32 maxRTT = ca->maxRTT;
htcp_beta_update(ca, minRTT, maxRTT);
htcp_alpha_update(ca);
if (minRTT > 0 && maxRTT > minRTT)
ca->maxRTT = minRTT + ((maxRTT - minRTT) * 95) / 100;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* 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 + sizeof (UINTN));
ASSERT (NewIdtTable != NULL);
*NewIdtTable = (UINTN)GetPeiServicesTab... | tianocore/edk2 | C++ | Other | 4,240 |
/* This function gets pointer to the end of the variable storage area, according to the input variable store header. */ | VARIABLE_HEADER* GetEndPointer(IN VARIABLE_STORE_HEADER *VarStoreHeader) | /* This function gets pointer to the end of the variable storage area, according to the input variable store header. */
VARIABLE_HEADER* GetEndPointer(IN VARIABLE_STORE_HEADER *VarStoreHeader) | {
return (VARIABLE_HEADER *)HEADER_ALIGN ((UINTN)VarStoreHeader + VarStoreHeader->Size);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disables a GPIO pin as a trigger to start a DMA transaction. */ | void GPIODMATriggerDisable(uint32_t ui32Port, uint8_t ui8Pins) | /* Disables a GPIO pin as a trigger to start a DMA transaction. */
void GPIODMATriggerDisable(uint32_t ui32Port, uint8_t ui8Pins) | {
ASSERT(_GPIOBaseValid(ui32Port));
HWREG(ui32Port + GPIO_O_DMACTL) &= (~ui8Pins);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Adds or subtracts one hour from the current time depending on the daylight saving parameter. */ | void RTC_DayLightSavingConfig(RTC_DayLightSaving_TypeDef RTC_DayLightSaving, RTC_StoreOperation_TypeDef RTC_StoreOperation) | /* Adds or subtracts one hour from the current time depending on the daylight saving parameter. */
void RTC_DayLightSavingConfig(RTC_DayLightSaving_TypeDef RTC_DayLightSaving, RTC_StoreOperation_TypeDef RTC_StoreOperation) | {
assert_param(IS_RTC_DAYLIGHT_SAVING(RTC_DayLightSaving));
assert_param(IS_RTC_STORE_OPERATION(RTC_StoreOperation));
RTC_WriteProtectionCmd(DISABLE);
RTC->CR3 &= (uint8_t)~(RTC_CR3_BCK);
RTC->CR3 |= (uint8_t)((uint8_t)RTC_DayLightSaving | (uint8_t)RTC_StoreOperation);
RTC_WriteProtectionCmd(ENABLE);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Destroy the DHCP service. The Dhcp4 service may be partly initialized, or partly destroyed. If a resource is destroyed, it is marked as so in case the destroy failed and being called again later. */ | EFI_STATUS Dhcp4CloseService(IN DHCP_SERVICE *DhcpSb) | /* Destroy the DHCP service. The Dhcp4 service may be partly initialized, or partly destroyed. If a resource is destroyed, it is marked as so in case the destroy failed and being called again later. */
EFI_STATUS Dhcp4CloseService(IN DHCP_SERVICE *DhcpSb) | {
DhcpCleanLease (DhcpSb);
if (DhcpSb->UdpIo != NULL) {
UdpIoFreeIo (DhcpSb->UdpIo);
DhcpSb->UdpIo = NULL;
}
if (DhcpSb->Timer != NULL) {
gBS->SetTimer (DhcpSb->Timer, TimerCancel, 0);
gBS->CloseEvent (DhcpSb->Timer);
DhcpSb->Timer = NULL;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */ | bool CLOCK_EnableUsbhs0Clock(clock_usb_src_t src, uint32_t freq) | /* param src USB HS does not care about the clock source, here must be ref kCLOCK_UsbSrcUnused. param freq USB HS does not care about the clock source, so this parameter is ignored. retval true The clock is set successfully. retval false The clock source is invalid to get proper USB HS clock. */
bool CLOCK_EnableUsbhs... | {
uint32_t i;
CCM->CCGR6 |= CCM_CCGR6_CG0_MASK;
USB->USBCMD |= USBHS_USBCMD_RST_MASK;
for (i = 0; i < 400000UL; i++)
{
__ASM("nop");
}
PMU->REG_3P0 = (PMU->REG_3P0 & (~PMU_REG_3P0_OUTPUT_TRG_MASK)) |
(PMU_REG_3P0_OUTPUT_TRG(0x17) | PMU_REG_3P0_ENABLE_LINREG_MASK);
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable or Disable logs in run time (Disable Firmware logs will enhance the firmware start-up time and performance) */ | NMI_API sint8 m2m_wifi_set_battery_voltage(uint16 u16BattVoltx100) | /* Enable or Disable logs in run time (Disable Firmware logs will enhance the firmware start-up time and performance) */
NMI_API sint8 m2m_wifi_set_battery_voltage(uint16 u16BattVoltx100) | {
sint8 ret = M2M_SUCCESS;
tstrM2mBatteryVoltage strM2mBattVol = {0};
strM2mBattVol.u16BattVolt = u16BattVoltx100;
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_BATTERY_VOLTAGE, (uint8*)&strM2mBattVol,sizeof(tstrM2mBatteryVoltage), NULL, 0, 0);
return ret;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Set scheduling parameter attributes in thread attributes object.
See IEEE 1003.1 */ | int pthread_attr_setschedparam(pthread_attr_t *_attr, const struct sched_param *schedparam) | /* Set scheduling parameter attributes in thread attributes object.
See IEEE 1003.1 */
int pthread_attr_setschedparam(pthread_attr_t *_attr, const struct sched_param *schedparam) | {
struct posix_thread_attr *attr = (struct posix_thread_attr *)_attr;
if (!__attr_is_initialized(attr) || schedparam == NULL ||
!is_posix_policy_prio_valid(schedparam->sched_priority, attr->schedpolicy)) {
LOG_ERR("Invalid pthread_attr_t or sched_param");
return EINVAL;
}
attr->priority = schedparam->sched... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Reads the PHY register at offset and stores the retrieved information in data. Assumes semaphore already acquired. */ | s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) | /* Reads the PHY register at offset and stores the retrieved information in data. Assumes semaphore already acquired. */
s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data) | {
return __e1000_read_phy_reg_hv(hw, offset, data, true);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ppc440spe_desc_init_memcpy - initialize the descriptor for MEMCPY operation */ | static void ppc440spe_desc_init_memcpy(struct ppc440spe_adma_desc_slot *desc, unsigned long flags) | /* ppc440spe_desc_init_memcpy - initialize the descriptor for MEMCPY operation */
static void ppc440spe_desc_init_memcpy(struct ppc440spe_adma_desc_slot *desc, unsigned long flags) | {
struct dma_cdb *hw_desc = desc->hw_desc;
memset(desc->hw_desc, 0, sizeof(struct dma_cdb));
desc->hw_next = NULL;
desc->src_cnt = 1;
desc->dst_cnt = 1;
if (flags & DMA_PREP_INTERRUPT)
set_bit(PPC440SPE_DESC_INT, &desc->flags);
else
clear_bit(PPC440SPE_DESC_INT, &desc->flags);
hw_desc->opc = DMA_CDB_OPC_MV_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advanta... | static void zlib_updatewindow(z_streamp strm, unsigned out) | /* Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advanta... | {
struct inflate_state *state;
unsigned copy, dist;
state = (struct inflate_state *)strm->state;
copy = out - strm->avail_out;
if (copy >= state->wsize) {
memcpy(state->window, strm->next_out - state->wsize, state->wsize);
state->write = 0;
state->whave = state->wsize;
}
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* configure the number of valid bits in last word of the message */ | void hau_last_word_validbits_num_config(uint32_t valid_num) | /* configure the number of valid bits in last word of the message */
void hau_last_word_validbits_num_config(uint32_t valid_num) | {
HAU_CFG &= ~(HAU_CFG_VBL);
HAU_CFG |= CFG_VBL(valid_num);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read 16 or 32 bits depending on the current size of the counter. Counters 4, 5, 6 & 7 are always 16 bit. */ | u32 ps3_read_ctr(u32 cpu, u32 ctr) | /* Read 16 or 32 bits depending on the current size of the counter. Counters 4, 5, 6 & 7 are always 16 bit. */
u32 ps3_read_ctr(u32 cpu, u32 ctr) | {
u32 val;
u32 phys_ctr = ctr & (NR_PHYS_CTRS - 1);
val = ps3_read_phys_ctr(cpu, phys_ctr);
if (ps3_get_ctr_size(cpu, phys_ctr) == 16)
val = (ctr < NR_PHYS_CTRS) ? (val >> 16) : (val & 0xffff);
return val;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This API is used to get the latch duration in the register 0x21 bit from 0 to 3. */ | BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_latch_intr(u8 *latch_intr_u8) | /* This API is used to get the latch duration in the register 0x21 bit from 0 to 3. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_latch_intr(u8 *latch_intr_u8) | {
u8 data_u8 = BMA2x2_INIT_VALUE;
BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR;
if (p_bma2x2 == BMA2x2_NULL)
{
return E_BMA2x2_NULL_PTR;
}
else
{
com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC
(p_bma2x2->dev_addr, BMA2x2_LATCH_INTR_REG,
&data... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Thread for toggling LED_1.
This thread is receiving signals from main loop and toggle BSP_LED_1. */ | static void blinky_thread(void const *arg) | /* Thread for toggling LED_1.
This thread is receiving signals from main loop and toggle BSP_LED_1. */
static void blinky_thread(void const *arg) | {
UNUSED_PARAMETER(arg);
osEvent evt;
while (true)
{
evt = osSignalWait(SIGNAL_OUTPUT_1_TOGGLE, osWaitForever);
if (evt.status == osEventSignal)
{
bsp_board_led_invert(BSP_BOARD_LED_1);
}
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* The register selects a DWORD (32 bit) register offset. Hence it doesn't get shifted by 2 bits as we want to "drop" the bottom two bits. */ | static int mk_conf_addr(struct pci_bus *pbus, unsigned int device_fn, int where, unsigned long *pci_addr) | /* The register selects a DWORD (32 bit) register offset. Hence it doesn't get shifted by 2 bits as we want to "drop" the bottom two bits. */
static int mk_conf_addr(struct pci_bus *pbus, unsigned int device_fn, int where, unsigned long *pci_addr) | {
unsigned long addr;
u8 bus = pbus->number;
if (bus == 0) {
int device = device_fn >> 3;
int func = device_fn & 0x7;
if (device > 12) {
return -1;
}
*(vulp)LCA_IOC_CONF = 0;
addr = (1 << (11 + device)) | (func << 8) | where;
} else {
*(vulp)LCA_IOC_CONF = 1;
addr = (bus << 16) | (device_fn << 8)... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Change the mode of the USB controller to host. */ | void USBHostMode(unsigned long ulBase) | /* Change the mode of the USB controller to host. */
void USBHostMode(unsigned long ulBase) | {
ASSERT(ulBase == USB0_BASE);
HWREGB(ulBase + USB_O_GPCS) &= ~(USB_GPCS_DEVMOD);
} | watterott/WebRadio | C++ | null | 71 |
/* Get the maximum current capability data from the specified slot. */ | EFI_STATUS SdMmcHcGetMaxCurrent(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot, OUT UINT64 *MaxCurrent) | /* Get the maximum current capability data from the specified slot. */
EFI_STATUS SdMmcHcGetMaxCurrent(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot, OUT UINT64 *MaxCurrent) | {
EFI_STATUS Status;
Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_MAX_CURRENT_CAP, TRUE, sizeof (UINT64), MaxCurrent);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables offset cancellation in single measurement mode. The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function "set_rst_mode(SENS_OFF_CANC_EVERY_ODR)" is need.. */ | int32_t iis2mdc_set_rst_sensor_single_set(stmdev_ctx_t *ctx, uint8_t val) | /* Enables offset cancellation in single measurement mode. The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function "set_rst_mode(SENS_OFF_CANC_EVERY_ODR)" is need.. */
int32_t iis2mdc_set_rst_sensor_single_set(stmdev_ctx_t *ctx, uint8_t val) | {
iis2mdc_cfg_reg_b_t reg;
int32_t ret;
ret = iis2mdc_read_reg(ctx, IIS2MDC_CFG_REG_B, (uint8_t *) ®, 1);
if (ret == 0) {
reg.off_canc_one_shot = val;
ret = iis2mdc_write_reg(ctx, IIS2MDC_CFG_REG_B, (uint8_t *) ®, 1);
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* To Disable optimize the I/O speed when the product voltage is low. */ | void HAL_SYSCFG_DisableIOSpeedOptimize(uint32_t SYSCFG_HighSpeedSignal) | /* To Disable optimize the I/O speed when the product voltage is low. */
void HAL_SYSCFG_DisableIOSpeedOptimize(uint32_t SYSCFG_HighSpeedSignal) | {
SYSCFG->IOCTRLCLRR = SYSCFG_HighSpeedSignal;
} | ua1arn/hftrx | C++ | null | 69 |
/* Count the number of each code length for a Huffman tree. */ | STATIC VOID CountLen(IN INT32 Index) | /* Count the number of each code length for a Huffman tree. */
STATIC VOID CountLen(IN INT32 Index) | {
STATIC INT32 Depth = 0;
if (Index < mN) {
mLenCnt[(Depth < 16) ? Depth : 16]++;
} else {
Depth++;
CountLen (mLeft[Index]);
CountLen (mRight[Index]);
Depth--;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param handle The RTOS LPSPI handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the LPSPI instance to initialize. param masterConfig Configuration structure to set-up LPSPI in master mode. param srcClock_Hz Frequency of input clock of the LPSPI module. return status of ... | status_t LPSPI_RTOS_Init(lpspi_rtos_handle_t *handle, LPSPI_Type *base, const lpspi_master_config_t *masterConfig, uint32_t srcClock_Hz) | /* param handle The RTOS LPSPI handle, the pointer to an allocated space for RTOS context. param base The pointer base address of the LPSPI instance to initialize. param masterConfig Configuration structure to set-up LPSPI in master mode. param srcClock_Hz Frequency of input clock of the LPSPI module. return status of ... | {
if (handle == NULL)
{
return kStatus_InvalidArgument;
}
if (base == NULL)
{
return kStatus_InvalidArgument;
}
(void)memset(handle, 0, sizeof(lpspi_rtos_handle_t));
handle->mutex = xSemaphoreCreateMutex();
if (handle->mutex == NULL)
{
return kStatus_Fail;... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base SMC peripheral base address. return SMC configuration error code. */ | status_t SMC_SetPowerModeRun(SMC_Type *base) | /* param base SMC peripheral base address. return SMC configuration error code. */
status_t SMC_SetPowerModeRun(SMC_Type *base) | {
uint8_t reg;
reg = base->PMCTRL;
reg &= ~(uint8_t)SMC_PMCTRL_RUNM_MASK;
reg |= ((uint8_t)kSMC_RunNormal << SMC_PMCTRL_RUNM_SHIFT);
base->PMCTRL = reg;
return kStatus_Success;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Enables or disables the selected ADC software start conversion . */ | void ADC_SoftwareStartConv(ADC_TypeDef *ADCx) | /* Enables or disables the selected ADC software start conversion . */
void ADC_SoftwareStartConv(ADC_TypeDef *ADCx) | {
assert_param(IS_ADC_ALL_PERIPH(ADCx));
ADCx->CR2 |= (uint32_t)(ADC_CR2_SWSTART | ADC_CR2_EXTTRIG);
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Get the capability data from the specified slot. */ | EFI_STATUS SdMmcHcGetCapability(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot, OUT SD_MMC_HC_SLOT_CAP *Capability) | /* Get the capability data from the specified slot. */
EFI_STATUS SdMmcHcGetCapability(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot, OUT SD_MMC_HC_SLOT_CAP *Capability) | {
EFI_STATUS Status;
UINT64 Cap;
Status = SdMmcHcRwMmio (PciIo, Slot, SD_MMC_HC_CAP, TRUE, sizeof (Cap), &Cap);
if (EFI_ERROR (Status)) {
return Status;
}
CopyMem (Capability, &Cap, sizeof (Cap));
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* helper to find a free sequence number in a given directory. This current code is very simple, later versions will do smarter things in the btree */ | int btrfs_set_inode_index(struct inode *dir, u64 *index) | /* helper to find a free sequence number in a given directory. This current code is very simple, later versions will do smarter things in the btree */
int btrfs_set_inode_index(struct inode *dir, u64 *index) | {
int ret = 0;
if (BTRFS_I(dir)->index_cnt == (u64)-1) {
ret = btrfs_set_inode_index_count(dir);
if (ret)
return ret;
}
*index = BTRFS_I(dir)->index_cnt;
BTRFS_I(dir)->index_cnt++;
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* A commonly used alloc and free fn that kmalloc/kfrees the amount of memory specified by pool_data */ | void* mempool_kmalloc(gfp_t gfp_mask, void *pool_data) | /* A commonly used alloc and free fn that kmalloc/kfrees the amount of memory specified by pool_data */
void* mempool_kmalloc(gfp_t gfp_mask, void *pool_data) | {
size_t size = (size_t)pool_data;
return kmalloc(size, gfp_mask);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* I2C MSP De-Initialization This function frees the hardware resources used in this example: */ | void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c) | /* I2C MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c) | {
I2Cx_FORCE_RESET();
I2Cx_RELEASE_RESET();
HAL_GPIO_DeInit(I2Cx_SCL_GPIO_PORT, I2Cx_SCL_PIN);
HAL_GPIO_DeInit(I2Cx_SDA_GPIO_PORT, I2Cx_SDA_PIN);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Enables the GPIO mode of a set of pins. */ | void gpio_enable_gpio(const gpio_map_t gpiomap, uint32_t size) | /* Enables the GPIO mode of a set of pins. */
void gpio_enable_gpio(const gpio_map_t gpiomap, uint32_t size) | {
uint32_t i;
for (i = 0; i < size; i++) {
gpio_enable_gpio_pin(gpiomap->pin);
gpiomap++;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Output: void, but we will add to proto tree if !NULL. */ | void isis_dissect_ipv6_int_clv(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, expert_field *expert, int offset, int length, int tree_id) | /* Output: void, but we will add to proto tree if !NULL. */
void isis_dissect_ipv6_int_clv(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, expert_field *expert, int offset, int length, int tree_id) | {
struct e_in6_addr addr;
if ( length <= 0 ) {
return;
}
while ( length > 0 ) {
if ( length < 16 ) {
proto_tree_add_expert_format(tree, pinfo, expert, tvb, offset, -1,
"Short IPv6 interface address (%d vs 16)",length );
return;
}
tv... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get current search key. For level 0 we don't actually have a key structure so we make one up from the record. For all other levels we just return the right key. */ | STATIC union xfs_btree_key* xfs_lookup_get_search_key(struct xfs_btree_cur *cur, int level, int keyno, struct xfs_btree_block *block, union xfs_btree_key *kp) | /* Get current search key. For level 0 we don't actually have a key structure so we make one up from the record. For all other levels we just return the right key. */
STATIC union xfs_btree_key* xfs_lookup_get_search_key(struct xfs_btree_cur *cur, int level, int keyno, struct xfs_btree_block *block, union xfs_btree_ke... | {
if (level == 0) {
cur->bc_ops->init_key_from_rec(kp,
xfs_btree_rec_addr(cur, keyno, block));
return kp;
}
return xfs_btree_key_addr(cur, keyno, block);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Look for a page at index that is suitable for clustering. */ | STATIC unsigned int xfs_probe_page(struct page *page, unsigned int pg_offset, int mapped) | /* Look for a page at index that is suitable for clustering. */
STATIC unsigned int xfs_probe_page(struct page *page, unsigned int pg_offset, int mapped) | {
int ret = 0;
if (PageWriteback(page))
return 0;
if (page->mapping && PageDirty(page)) {
if (page_has_buffers(page)) {
struct buffer_head *bh, *head;
bh = head = page_buffers(page);
do {
if (!buffer_uptodate(bh))
break;
if (mapped != buffer_mapped(bh))
break;
ret += bh->b_size;
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param config Pointer to configuration structure. See to "dcdc_low_power_config_t" */ | void DCDC_GetDefaultLowPowerConfig(dcdc_low_power_config_t *config) | /* param config Pointer to configuration structure. See to "dcdc_low_power_config_t" */
void DCDC_GetDefaultLowPowerConfig(dcdc_low_power_config_t *config) | {
assert(NULL != config);
memset(config, 0, sizeof(*config));
config->enableOverloadDetection = true;
config->enableAdjustHystereticValue = false;
config->countChargingTimePeriod = kDCDC_CountChargingTimePeriod8Cycle;
config->countChargingTimeThreshold = kDCDC_CountChargingTimeThreshold32;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* RDR_to_PC_NotifySlotChange Interrupt message to be sent to the host, Checks the card presence status and update the buffer accordingly. */ | void RDR_to_PC_NotifySlotChange(USBD_HandleTypeDef *pdev) | /* RDR_to_PC_NotifySlotChange Interrupt message to be sent to the host, Checks the card presence status and update the buffer accordingly. */
void RDR_to_PC_NotifySlotChange(USBD_HandleTypeDef *pdev) | {
USBD_CCID_HandleTypeDef *hccid = (USBD_CCID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
hccid->UsbIntData[OFFSET_INT_BMESSAGETYPE] = RDR_TO_PC_NOTIFYSLOTCHANGE;
if (SC_Detect() != 0U)
{
hccid->UsbIntData[OFFSET_INT_BMSLOTICCSTATE] = SLOT_ICC_PRESENT | SLOT_ICC_CHANGE;
}
else
{
hccid->... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* The function determines slot which is should we boot from among the two. */ | static int ab_compare_slots(const struct slot_metadata *a, const struct slot_metadata *b) | /* The function determines slot which is should we boot from among the two. */
static int ab_compare_slots(const struct slot_metadata *a, const struct slot_metadata *b) | {
if (a->priority != b->priority)
return b->priority - a->priority;
if (a->successful_boot != b->successful_boot)
return b->successful_boot - a->successful_boot;
if (a->tries_remaining != b->tries_remaining)
return b->tries_remaining - a->tries_remaining;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Reset the Stream (move the current position to the initial position). */ | EFI_STATUS EFIAPI AmlStreamReset(IN AML_STREAM *Stream) | /* Reset the Stream (move the current position to the initial position). */
EFI_STATUS EFIAPI AmlStreamReset(IN AML_STREAM *Stream) | {
if (!IS_STREAM (Stream)) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Stream->Index = 0;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the CRC value calculation of the transferred bytes. */ | void SPI_EnableCalculateCrc(SPI_Module *SPIx, FunctionalState Cmd) | /* Enables or disables the CRC value calculation of the transferred bytes. */
void SPI_EnableCalculateCrc(SPI_Module *SPIx, FunctionalState Cmd) | {
assert_param(IS_SPI_PERIPH(SPIx));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
SPIx->CTRL1 |= CTRL1_CRCEN_ENABLE;
}
else
{
SPIx->CTRL1 &= CTRL1_CRCEN_DISABLE;
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */ | VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL) | /* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL) | {
return InternalReallocatePool (EfiBootServicesData, OldSize, NewSize, OldBuffer);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi) | /* QSPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_QSPI_MspDeInit(QSPI_HandleTypeDef *hqspi) | {
if(hqspi->Instance==QUADSPI)
{
__HAL_RCC_QSPI_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOB, QSPI_BK1_NCS_Pin|QSPI_BK1_IO1_Pin|QSPI_BK1_IO0_Pin);
HAL_GPIO_DeInit(GPIOA, QSPI_BK1_IO2_Pin|QSPI_CLK_Pin|QSPI_BK1_IO3_Pin);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Compute a SID to use when selecting a member of a polyinstantiated object of class @tclass based on a SID pair (@ssid, @tsid). Return -EINVAL if any of the parameters are invalid, -ENOMEM if insufficient memory is available, or %0 if the SID was computed successfully. */ | int security_member_sid(u32 ssid, u32 tsid, u16 tclass, u32 *out_sid) | /* Compute a SID to use when selecting a member of a polyinstantiated object of class @tclass based on a SID pair (@ssid, @tsid). Return -EINVAL if any of the parameters are invalid, -ENOMEM if insufficient memory is available, or %0 if the SID was computed successfully. */
int security_member_sid(u32 ssid, u32 tsid, ... | {
return security_compute_sid(ssid, tsid, tclass, AVTAB_MEMBER, out_sid,
false);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* remap the vpu registers. it should be on any access to vpu registers. */ | static uint32_t* vpu_reg_map(uint32_t offset) | /* remap the vpu registers. it should be on any access to vpu registers. */
static uint32_t* vpu_reg_map(uint32_t offset) | {
return (uint32_t *) (offset + (uint32_t) g_vpu_reg_base.virt_addr);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Change Logs: Date Author Notes aozima the first version Stanley Lwin add pwm function liYony fix complementary outputs and add usage information in finsh liYony Add complementary output section to framework for management qiyu Add dead-time and phase configuration 1ridic Add second-level command completion */ | static rt_err_t _pwm_control(rt_device_t dev, int cmd, void *args) | /* Change Logs: Date Author Notes aozima the first version Stanley Lwin add pwm function liYony fix complementary outputs and add usage information in finsh liYony Add complementary output section to framework for management qiyu Add dead-time and phase configuration 1ridic Add second-level command completion */... | {
rt_err_t result = RT_EOK;
struct rt_device_pwm *pwm = (struct rt_device_pwm *)dev;
struct rt_pwm_configuration *configuration = (struct rt_pwm_configuration *)args;
switch (cmd)
{
case PWMN_CMD_ENABLE:
configuration->complementary = RT_TRUE;
break;
case PWMN_CMD_DISABLE:
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* deinitialize the ENET, and reset structure parameters for ENET initialization */ | void enet_deinit(void) | /* deinitialize the ENET, and reset structure parameters for ENET initialization */
void enet_deinit(void) | {
rcu_periph_reset_enable(RCU_ENETRST);
rcu_periph_reset_disable(RCU_ENETRST);
enet_initpara_reset();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Return Value: The 6 most significant bits of the 32-bit CRC result */ | static uint8 fec_hash_address(const uint8 *addr) | /* Return Value: The 6 most significant bits of the 32-bit CRC result */
static uint8 fec_hash_address(const uint8 *addr) | {
uint32 crc;
uint8 byte;
int i, j;
crc = 0xFFFFFFFF;
for(i=0; i<6; ++i)
{
byte = addr[i];
for(j=0; j<8; ++j)
{
if((byte & 0x01)^(crc & 0x01))
{
crc >>= 1;
crc = crc ^ 0xEDB88320;
}
else
{
crc >>= 1;
}
byte >>= 1;
}
}
return (uint8)(crc >> 26);
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Covert the input memory size to internal register set value. */ | static status_t SEMC_CovertMemorySize(SEMC_Type *base, uint32_t size_kbytes, uint8_t *sizeConverted) | /* Covert the input memory size to internal register set value. */
static status_t SEMC_CovertMemorySize(SEMC_Type *base, uint32_t size_kbytes, uint8_t *sizeConverted) | {
assert(sizeConverted);
uint32_t memsize;
if ((size_kbytes < SEMC_BR_MEMSIZE_MIN) || (size_kbytes > SEMC_BR_MEMSIZE_MAX))
{
return kStatus_SEMC_InvalidMemorySize;
}
*sizeConverted = 0;
memsize = size_kbytes / 8;
while (memsize)
{
memsize >>= 1;
(*sizeC... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Number of external sensors to be read by the sensor hub.. */ | int32_t lsm6dsl_sh_num_of_dev_connected_set(stmdev_ctx_t *ctx, lsm6dsl_aux_sens_on_t val) | /* Number of external sensors to be read by the sensor hub.. */
int32_t lsm6dsl_sh_num_of_dev_connected_set(stmdev_ctx_t *ctx, lsm6dsl_aux_sens_on_t val) | {
lsm6dsl_slave0_config_t slave0_config;
int32_t ret;
ret = lsm6dsl_mem_bank_set(ctx, LSM6DSL_BANK_A);
if(ret == 0){
ret = lsm6dsl_read_reg(ctx, LSM6DSL_SLAVE0_CONFIG,
(uint8_t*)&slave0_config, 1);
if(ret == 0){
slave0_config.aux_sens_on = (uint8_t) val;
ret = lsm6... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Set / reset given feature. Flag indicates wether to set (!=0) or the reset (=0) the feature. */ | int dasd_set_feature(struct ccw_device *cdev, int feature, int flag) | /* Set / reset given feature. Flag indicates wether to set (!=0) or the reset (=0) the feature. */
int dasd_set_feature(struct ccw_device *cdev, int feature, int flag) | {
struct dasd_devmap *devmap;
devmap = dasd_find_busid(dev_name(&cdev->dev));
if (IS_ERR(devmap))
return PTR_ERR(devmap);
spin_lock(&dasd_devmap_lock);
if (flag)
devmap->features |= feature;
else
devmap->features &= ~feature;
if (devmap->device)
devmap->device->features = devmap->features;
spin_unlock(&... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Drop a reference on the passed journal_head. If it fell to zero then try to release the journal_head from the buffer_head. */ | void jbd2_journal_put_journal_head(struct journal_head *jh) | /* Drop a reference on the passed journal_head. If it fell to zero then try to release the journal_head from the buffer_head. */
void jbd2_journal_put_journal_head(struct journal_head *jh) | {
struct buffer_head *bh = jh2bh(jh);
jbd_lock_bh_journal_head(bh);
J_ASSERT_JH(jh, jh->b_jcount > 0);
--jh->b_jcount;
if (!jh->b_jcount && !jh->b_transaction) {
__journal_remove_journal_head(bh);
__brelse(bh);
}
jbd_unlock_bh_journal_head(bh);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* 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);
Status = PeiServicesFreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)Buffer, Pages);
ASSERT_EFI_ERROR (Status);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Fill the LCD buffer with the specified color. */ | void hx8347a_fill(hx8347a_color_t us_color) | /* Fill the LCD buffer with the specified color. */
void hx8347a_fill(hx8347a_color_t us_color) | {
uint32_t i;
hx8347a_set_cursor_position(0, 0);
hx8347a_write_ram_prepare();
for (i = HX8347A_LCD_WIDTH * HX8347A_LCD_HEIGHT; i > 0; i--) {
hx8347a_write_ram(us_color);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This internal function is utilized by the MPU driver to parse the intent type (i.e. THREAD_STACK_REGION) and return the correct parameter set. */ | static uint32_t get_region_attr_by_type(uint32_t type) | /* This internal function is utilized by the MPU driver to parse the intent type (i.e. THREAD_STACK_REGION) and return the correct parameter set. */
static uint32_t get_region_attr_by_type(uint32_t type) | {
switch (type) {
case THREAD_STACK_USER_REGION:
return REGION_RAM_ATTR;
case THREAD_STACK_REGION:
return AUX_MPU_ATTR_KW | AUX_MPU_ATTR_KR;
case THREAD_APP_DATA_REGION:
return REGION_RAM_ATTR;
case THREAD_STACK_GUARD_REGION:
return AUX_MPU_ATTR_UR | AUX_MPU_ATTR_KR;
default:
return 0;
}
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* ubifs_tnc_close - close TNC subsystem and free all related resources. */ | void ubifs_tnc_close(struct ubifs_info *c) | /* ubifs_tnc_close - close TNC subsystem and free all related resources. */
void ubifs_tnc_close(struct ubifs_info *c) | {
long clean_freed;
tnc_destroy_cnext(c);
if (c->zroot.znode) {
clean_freed = ubifs_destroy_tnc_subtree(c->zroot.znode);
atomic_long_sub(clean_freed, &ubifs_clean_zn_cnt);
}
kfree(c->gap_lebs);
kfree(c->ilebs);
destroy_old_idx(c);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* We fork()ed a process, and we need a new context for the child to run in. We reserve version 0 for initial tasks so we will always allocate an ASID. The ASID 0 is reserved for the TTBR register changing sequence. */ | void __init_new_context(struct task_struct *tsk, struct mm_struct *mm) | /* We fork()ed a process, and we need a new context for the child to run in. We reserve version 0 for initial tasks so we will always allocate an ASID. The ASID 0 is reserved for the TTBR register changing sequence. */
void __init_new_context(struct task_struct *tsk, struct mm_struct *mm) | {
mm->context.id = 0;
spin_lock_init(&mm->context.id_lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Internal trigger function to start acquisition for an 'INTERRUPT' subdevice. */ | static int dio200_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trignum) | /* Internal trigger function to start acquisition for an 'INTERRUPT' subdevice. */
static int dio200_inttrig_start_intr(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int trignum) | {
struct dio200_subdev_intr *subpriv;
unsigned long flags;
int event = 0;
if (trignum != 0)
return -EINVAL;
subpriv = s->private;
spin_lock_irqsave(&subpriv->spinlock, flags);
s->async->inttrig = 0;
if (subpriv->active) {
event = dio200_start_intr(dev, s);
}
spin_unlock_irqrestore(&subpriv->spinlock, flag... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Swap every 64 bytes of this page around, to account for it having a new bit 17 of its physical address and therefore being interpreted differently by the GPU. */ | static int i915_gem_swizzle_page(struct page *page) | /* Swap every 64 bytes of this page around, to account for it having a new bit 17 of its physical address and therefore being interpreted differently by the GPU. */
static int i915_gem_swizzle_page(struct page *page) | {
char *vaddr;
int i;
char temp[64];
vaddr = kmap(page);
if (vaddr == NULL)
return -ENOMEM;
for (i = 0; i < PAGE_SIZE; i += 128) {
memcpy(temp, &vaddr[i], 64);
memcpy(&vaddr[i], &vaddr[i + 64], 64);
memcpy(&vaddr[i + 64], temp, 64);
}
kunmap(page);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* gfs2_assert_withdraw_i - Cause the machine to withdraw if @assertion is false Returns: -1 if this call withdrew the machine, -2 if it was already withdrawn */ | int gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion, const char *function, char *file, unsigned int line) | /* gfs2_assert_withdraw_i - Cause the machine to withdraw if @assertion is false Returns: -1 if this call withdrew the machine, -2 if it was already withdrawn */
int gfs2_assert_withdraw_i(struct gfs2_sbd *sdp, char *assertion, const char *function, char *file, unsigned int line) | {
int me;
me = gfs2_lm_withdraw(sdp,
"GFS2: fsid=%s: fatal: assertion \"%s\" failed\n"
"GFS2: fsid=%s: function = %s, file = %s, line = %u\n",
sdp->sd_fsname, assertion,
sdp->sd_fsname, function, file, line);
dump_stack();
return (me) ? -1 : -2;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* e1000_set_vfta_vf - Set/Unset vlan filter table address @hw: pointer to the HW structure @vid: determines the vfta register and bit to set/unset @set: if true then set bit, else clear bit */ | static s32 e1000_set_vfta_vf(struct e1000_hw *, u16, bool) | /* e1000_set_vfta_vf - Set/Unset vlan filter table address @hw: pointer to the HW structure @vid: determines the vfta register and bit to set/unset @set: if true then set bit, else clear bit */
static s32 e1000_set_vfta_vf(struct e1000_hw *, u16, bool) | {
struct e1000_mbx_info *mbx = &hw->mbx;
u32 msgbuf[2];
s32 err;
msgbuf[0] = E1000_VF_SET_VLAN;
msgbuf[1] = vid;
if (set)
msgbuf[0] |= 1 << E1000_VT_MSGINFO_SHIFT;
mbx->ops.write_posted(hw, msgbuf, 2);
err = mbx->ops.read_posted(hw, msgbuf, 2);
msgbuf[0] &= ~E1000_VT_MSGTYPE_CTS;
if (!err && (msgbuf[0] == (... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the priority of an interrupt.
The hardware priority mechanism will only look at the upper N bits of the priority level, so any prioritization must be performed in those bits.The remaining bits can be used to sub-prioritize the interrupt sources,and may be used by the hardware priority mechanism on a future par... | void xIntPrioritySet(unsigned long ulInterrupt, unsigned char ucPriority) | /* Sets the priority of an interrupt.
The hardware priority mechanism will only look at the upper N bits of the priority level, so any prioritization must be performed in those bits.The remaining bits can be used to sub-prioritize the interrupt sources,and may be used by the hardware priority mechanism on a future par... | {
unsigned long ulTemp;
xASSERT((ulInterrupt >= 4) && (ulInterrupt < NUM_INTERRUPTS));
ulTemp = xHWREG(g_pulRegs[ulInterrupt >> 2]);
ulTemp &= ~(0xFF << (8 * (ulInterrupt & 3)));
ulTemp |= ucPriority << (8 * (ulInterrupt & 3));
xHWREG(g_pulRegs[ulInterrupt >> 2]) = ulTemp;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Close the cursor on top of the stack. Return 1 */ | static int cur_close(lua_State *L) | /* Close the cursor on top of the stack. Return 1 */
static int cur_close(lua_State *L) | {
lua_pushboolean (L, 0);
return 1;
}
cur->closed = 1;
mysql_free_result(cur->my_res);
luaL_unref (L, LUA_REGISTRYINDEX, cur->conn);
luaL_unref (L, LUA_REGISTRYINDEX, cur->colnames);
luaL_unref (L, LUA_REGISTRYINDEX, cur->coltypes);
lua_pushboolean (L, 1);
return 1;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* We account for memory if it's a private writeable mapping, not hugepages and VM_NORESERVE wasn't set. */ | static int accountable_mapping(struct file *file, unsigned int vm_flags) | /* We account for memory if it's a private writeable mapping, not hugepages and VM_NORESERVE wasn't set. */
static int accountable_mapping(struct file *file, unsigned int vm_flags) | {
if (file && is_file_hugepages(file))
return 0;
return (vm_flags & (VM_NORESERVE | VM_SHARED | VM_WRITE)) == VM_WRITE;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine purges all of the queues of frames. */ | void rose_clear_queues(struct sock *sk) | /* This routine purges all of the queues of frames. */
void rose_clear_queues(struct sock *sk) | {
skb_queue_purge(&sk->sk_write_queue);
skb_queue_purge(&rose_sk(sk)->ack_queue);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Clear the I2C time out flag of the specified I2C port.
The */ | void I2CTimeoutFlagClear(unsigned long ulBase) | /* Clear the I2C time out flag of the specified I2C port.
The */
void I2CTimeoutFlagClear(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) ||
(ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) ||
(ulBase == I2C4_BASE));
xHWREG(ulBase + I2C_TOCTL) |= I2C_TOCTL_TIF;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Request the PE to send a request message. */ | USBPD_StatusTypeDef USBPD_DPM_RequestMessageRequest(uint8_t PortNum, uint8_t IndexSrcPDO, uint16_t RequestedVoltage) | /* Request the PE to send a request message. */
USBPD_StatusTypeDef USBPD_DPM_RequestMessageRequest(uint8_t PortNum, uint8_t IndexSrcPDO, uint16_t RequestedVoltage) | {
USBPD_StatusTypeDef status = USBPD_ERROR;
USBPD_SNKRDO_TypeDef rdo;
USBPD_CORE_PDO_Type_TypeDef pdo_object;
rdo.d32 = 0;
DPM_SNK_GetSelectedPDO(PortNum, (IndexSrcPDO - 1), RequestedVoltage, &rdo, &pdo_object);
status = USBPD_PE_Send_Request(PortNum, rdo.d32, pdo_object);
return status;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* force line state on a PHY output (only in MAINT state) */ | static void sm_ph_linestate(struct s_smc *smc, int phy, int ls) | /* force line state on a PHY output (only in MAINT state) */
static void sm_ph_linestate(struct s_smc *smc, int phy, int ls) | {
int cntrl ;
SK_UNUSED(smc) ;
cntrl = (inpw(PLC(phy,PL_CNTRL_B)) & ~PL_MAINT_LS) |
PL_PCM_STOP | PL_MAINT ;
switch(ls) {
case PC_QLS:
cntrl |= PL_M_QUI0 ;
break ;
case PC_MLS:
cntrl |= PL_M_MASTR ;
break ;
case PC_HLS:
cntrl |= PL_M_HALT ;
break ;
default :
case PC_ILS:
cntrl |= PL_M_IDLE ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* gelic_card_kick_txdma - enables TX DMA processing @card: card structure @descr: descriptor address to enable TX processing at */ | static int gelic_card_kick_txdma(struct gelic_card *card, struct gelic_descr *descr) | /* gelic_card_kick_txdma - enables TX DMA processing @card: card structure @descr: descriptor address to enable TX processing at */
static int gelic_card_kick_txdma(struct gelic_card *card, struct gelic_descr *descr) | {
int status = 0;
if (card->tx_dma_progress)
return 0;
if (gelic_descr_get_status(descr) == GELIC_DESCR_DMA_CARDOWNED) {
card->tx_dma_progress = 1;
status = lv1_net_start_tx_dma(bus_id(card), dev_id(card),
descr->bus_addr, 0);
if (status)
dev_info(ctodev(card), "lv1_net_start_txdma failed," \
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Iinitializes the UARTx peripheral registers to their default reset values. */ | void UART_DeInit(UART_Type *UARTx) | /* Iinitializes the UARTx peripheral registers to their default reset values. */
void UART_DeInit(UART_Type *UARTx) | {
__IO uint32_t dummy_data = 0UL;
assert_parameters(IS_UART_ALL_INSTANCE(UARTx));
dummy_data = UARTx->DATA;
dummy_data += 1;
UARTx->INTSTS = UART_INTSTS_RCMsk;
UARTx->STATE = UART_STATE_RCMsk;
UARTx->BAUDDIV = UART_BAUDDIV_RSTValue;
UARTx->CTRL2 = UART_CTRL2_RSTValue;
UARTx->CTRL = UART_CTRL_RSTValue... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* we set the bit immediately, then we record the page number so that when an unplug occurs, we can flush the dirty pages out to disk */ | static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) | /* we set the bit immediately, then we record the page number so that when an unplug occurs, we can flush the dirty pages out to disk */
static void bitmap_file_set_bit(struct bitmap *bitmap, sector_t block) | {
unsigned long bit;
struct page *page;
void *kaddr;
unsigned long chunk = block >> CHUNK_BLOCK_SHIFT(bitmap);
if (!bitmap->filemap) {
return;
}
page = filemap_get_page(bitmap, chunk);
if (!page) return;
bit = file_page_offset(bitmap, chunk);
kaddr = kmap_atomic(page, KM_USER0);
if (bitmap->flags & BITMAP_... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.... | VOID* EFIAPI AllocateRuntimeZeroPool(IN UINTN AllocationSize) | /* Allocates the number bytes specified by AllocationSize of type EfiRuntimeServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.... | {
VOID *Buffer;
Buffer = InternalAllocateZeroPool (EfiRuntimeServicesData, AllocationSize);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RUNTIME_ZERO_POOL,
EfiRuntimeServicesData,
Buffer,
Allocatio... | tianocore/edk2 | C++ | Other | 4,240 |
/* set gpio pad int mask type in pds */ | BL_Err_Type ATTR_TCM_SECTION PDS_Set_GPIO_Pad_IntMask(GLB_GPIO_Type pad, BL_Mask_Type intMask) | /* set gpio pad int mask type in pds */
BL_Err_Type ATTR_TCM_SECTION PDS_Set_GPIO_Pad_IntMask(GLB_GPIO_Type pad, BL_Mask_Type intMask) | {
uint32_t tmpVal = 0;
uint32_t pos = 0;
if (pad <= GLB_GPIO_PIN_8) {
pos = pad;
} else if ((pad >= GLB_GPIO_PIN_16) && (pad <= GLB_GPIO_PIN_38)) {
pos = pad - 7;
} else {
return ERROR;
}
tmpVal = BL_RD_REG(PDS_BASE, PDS_GPIO_PD_SET);
if (UNMASK != intMask) {
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Function for finding a record of a write buffer allocation. */ | static pdb_buffer_record_t* write_buffer_record_find_next(pm_peer_id_t peer_id, int *p_index) | /* Function for finding a record of a write buffer allocation. */
static pdb_buffer_record_t* write_buffer_record_find_next(pm_peer_id_t peer_id, int *p_index) | {
for (uint32_t i = *p_index; i < N_WRITE_BUFFER_RECORDS; i++)
{
if ((m_pdb.write_buffer_records[i].peer_id == peer_id))
{
return &m_pdb.write_buffer_records[i];
}
}
return NULL;
} | labapart/polymcu | C++ | null | 201 |
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value ra... | UINT64 EFIAPI MmioBitFieldOr64(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 OrData) | /* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value ra... | {
return MmioWrite64 (
Address,
BitFieldOr64 (MmioRead64 (Address), StartBit, EndBit, OrData)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Cause text to flow from right to left. */ | void samsungvfdRightToLeft(void) | /* Cause text to flow from right to left. */
void samsungvfdRightToLeft(void) | {
samsungvfd_displaymode &= ~SAMSUNGVFD_ENTRYLEFT;
samsungvfd_command(SAMSUNGVFD_ENTRYMODESET | samsungvfd_displaymode);
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.