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 |
|---|---|---|---|---|---|---|---|
/* Handle a fatal parser error, i.e. violating Well-Formedness constraints */ | static void xmlNsErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, const xmlChar *info1, const xmlChar *info2, const xmlChar *info3) | /* Handle a fatal parser error, i.e. violating Well-Formedness constraints */
static void xmlNsErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, const xmlChar *info1, const xmlChar *info2, const xmlChar *info3) | {
if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
(ctxt->instate == XML_PARSER_EOF))
return;
if (ctxt != NULL)
ctxt->errNo = error;
__xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
XML_ERR_ERROR, NULL, 0, (const char *) info1,
(const char *) info2, (const char *) info3, 0, 0, msg,
info1, info2, info3);
if (ctxt != NULL)
ctxt->nsWellFormed = 0;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Uart common interrupt process. This need add to uart ISR. */ | static void uart_isr(struct rt_serial_device *serial) | /* Uart common interrupt process. This need add to uart ISR. */
static void uart_isr(struct rt_serial_device *serial) | {
struct fsl_uart *uart;
RT_ASSERT(serial != RT_NULL);
uart = (struct fsl_uart *) serial->parent.user_data;
RT_ASSERT(uart != RT_NULL);
if (LPUART_GetStatusFlags(uart->uart_base) & kLPUART_RxDataRegFullFlag)
{
rt_hw_serial_isr(serial, RT_SERIAL_EVENT_RX_IND);
}
if (LPUART_STAT_OR_MASK & uart->uart_base->STAT)
{
uart->uart_base->STAT = ((uart->uart_base->STAT & 0x3FE00000U) | LPUART_STAT_OR_MASK);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The function is used to Unlock protected registers. */ | xtBoolean SysCtlKeyAddrUnlock(void) | /* The function is used to Unlock protected registers. */
xtBoolean SysCtlKeyAddrUnlock(void) | {
xHWREG(GCR_REGLOCK) = 0x59;
xHWREG(GCR_REGLOCK) = 0x16;
xHWREG(GCR_REGLOCK) = 0x88;
return xHWREG(GCR_REGLOCK)&0x01;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* : Enable FIFO batching of pedometer embedded function values. */ | int32_t lsm6dso_fifo_pedo_batch_set(lsm6dso_ctx_t *ctx, uint8_t val) | /* : Enable FIFO batching of pedometer embedded function values. */
int32_t lsm6dso_fifo_pedo_batch_set(lsm6dso_ctx_t *ctx, uint8_t val) | {
lsm6dso_emb_func_fifo_cfg_t reg;
int32_t ret;
ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_EMBEDDED_FUNC_BANK);
if (ret == 0) {
ret = lsm6dso_read_reg(ctx, LSM6DSO_EMB_FUNC_FIFO_CFG, (uint8_t*)®, 1);
}
if (ret == 0) {
reg.pedo_fifo_en = val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_EMB_FUNC_FIFO_CFG,
(uint8_t*)®, 1);
}
if (ret == 0) {
ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_USER_BANK);
}
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Return the UTC offset in seconds west of UTC, or 0 if it cannot be determined. */ | static int TimeZone(time_t t) | /* Return the UTC offset in seconds west of UTC, or 0 if it cannot be determined. */
static int TimeZone(time_t t) | {
struct tm *tm = gmtime(&t);
struct tm tm_utc;
if (tm == NULL)
return 0;
tm_utc = *tm;
tm = localtime(&t);
if (tm == NULL)
return 0;
return tm_diff(&tm_utc, tm);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Copy a bootloader version memory section to a RAM buffer. */ | static void mem_bootloader_read(void *dst, isp_addr_t src, uint16_t nbytes) | /* Copy a bootloader version memory section to a RAM buffer. */
static void mem_bootloader_read(void *dst, isp_addr_t src, uint16_t nbytes) | {
memcpy(dst, (uint8_t*)&mem_bootloader + src, nbytes);
} | memfault/zero-to-main | C++ | null | 200 |
/* This function waits until an IOMMU has completed a completion wait command */ | static void __iommu_wait_for_completion(struct amd_iommu *iommu) | /* This function waits until an IOMMU has completed a completion wait command */
static void __iommu_wait_for_completion(struct amd_iommu *iommu) | {
int ready = 0;
unsigned status = 0;
unsigned long i = 0;
INC_STATS_COUNTER(compl_wait);
while (!ready && (i < EXIT_LOOP_COUNT)) {
++i;
status = readl(iommu->mmio_base + MMIO_STATUS_OFFSET);
ready = status & MMIO_STATUS_COM_WAIT_INT_MASK;
}
status &= ~MMIO_STATUS_COM_WAIT_INT_MASK;
writel(status, iommu->mmio_base + MMIO_STATUS_OFFSET);
if (unlikely(i == EXIT_LOOP_COUNT))
iommu->reset_in_progress = true;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ | void Vector29_handler(void) | /* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector29_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (29 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Description: Update the value in phydev->link to reflect the current link value. In order to do this, we need to read the status register twice, keeping the second value. */ | int genphy_update_link(struct phy_device *phydev) | /* Description: Update the value in phydev->link to reflect the current link value. In order to do this, we need to read the status register twice, keeping the second value. */
int genphy_update_link(struct phy_device *phydev) | {
int status;
status = phy_read(phydev, MII_BMSR);
if (status < 0)
return status;
status = phy_read(phydev, MII_BMSR);
if (status < 0)
return status;
if ((status & BMSR_LSTATUS) == 0)
phydev->link = 0;
else
phydev->link = 1;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set a timeout value. The timeout value will be decremented towards zero when SPI traffic to/from the micro SD card takes place. Use */ | void MICROSD_TimeOutSet(uint32_t msec) | /* Set a timeout value. The timeout value will be decremented towards zero when SPI traffic to/from the micro SD card takes place. Use */
void MICROSD_TimeOutSet(uint32_t msec) | {
timeOut = xfersPrMsec * msec;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Initialize parameters to be sent via SVC call. */ | STATIC VOID InitArmSvcArgs(OUT ARM_SVC_ARGS *InitMmFoundationSvcArgs, OUT INT32 *Ret) | /* Initialize parameters to be sent via SVC call. */
STATIC VOID InitArmSvcArgs(OUT ARM_SVC_ARGS *InitMmFoundationSvcArgs, OUT INT32 *Ret) | {
if (FeaturePcdGet (PcdFfaEnable)) {
InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_FFA_MSG_SEND_DIRECT_RESP;
InitMmFoundationSvcArgs->Arg1 = 0;
InitMmFoundationSvcArgs->Arg2 = 0;
InitMmFoundationSvcArgs->Arg3 = ARM_SVC_ID_SP_EVENT_COMPLETE;
InitMmFoundationSvcArgs->Arg4 = *Ret;
} else {
InitMmFoundationSvcArgs->Arg0 = ARM_SVC_ID_SP_EVENT_COMPLETE;
InitMmFoundationSvcArgs->Arg1 = *Ret;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get that height reduced by the top an bottom padding. */ | lv_coord_t lv_obj_get_height_fit(lv_obj_t *obj) | /* Get that height reduced by the top an bottom padding. */
lv_coord_t lv_obj_get_height_fit(lv_obj_t *obj) | {
const lv_style_t * style = lv_obj_get_style(obj);
return lv_obj_get_height(obj) - style->body.padding.top - style->body.padding.bottom;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Callback function executed when a Redfish Config Handler Protocol is installed. */ | VOID EFIAPI RedfishConfigHandlerInstalledCallback(IN EFI_EVENT Event, IN VOID *Context) | /* Callback function executed when a Redfish Config Handler Protocol is installed. */
VOID EFIAPI RedfishConfigHandlerInstalledCallback(IN EFI_EVENT Event, IN VOID *Context) | {
if (!gRedfishDiscoverActivated) {
return;
}
RedfishConfigHandlerInitialization ();
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configure Timer Counter 0 (TC0) to generate an interrupt every second. */ | static void demo_configure_tc0(void) | /* Configure Timer Counter 0 (TC0) to generate an interrupt every second. */
static void demo_configure_tc0(void) | {
pmc_enable_periph_clk(ID_TC1);
tc_init(TC0, 1, 0x4 | TC_CMR_ACPC_SET | TC_CMR_WAVE
| TC_CMR_ACPA_CLEAR | TC_CMR_WAVSEL_UP_RC);
tc_write_ra(TC0, 1, 16384);
tc_write_rc(TC0, 1, 32768);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This function returns %1 if a bud reference already exists for the LEB. %0 is returned if the reference node is new, otherwise %-EINVAL is returned if validation failed. */ | static int validate_ref(struct ubifs_info *c, const struct ubifs_ref_node *ref) | /* This function returns %1 if a bud reference already exists for the LEB. %0 is returned if the reference node is new, otherwise %-EINVAL is returned if validation failed. */
static int validate_ref(struct ubifs_info *c, const struct ubifs_ref_node *ref) | {
struct ubifs_bud *bud;
int lnum = le32_to_cpu(ref->lnum);
unsigned int offs = le32_to_cpu(ref->offs);
unsigned int jhead = le32_to_cpu(ref->jhead);
if (jhead >= c->jhead_cnt || lnum >= c->leb_cnt ||
lnum < c->main_first || offs > c->leb_size ||
offs & (c->min_io_size - 1))
return -EINVAL;
bud = ubifs_search_bud(c, lnum);
if (bud) {
if (bud->jhead == jhead && bud->start <= offs)
return 1;
ubifs_err("bud at LEB %d:%d was already referred", lnum, offs);
return -EINVAL;
}
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This routine should set everything up anew at each open, even registers that "should" only need to be set once at boot, so that there is non-reboot way to recover if something goes wrong. */ | static int ether3_open(struct net_device *dev) | /* This routine should set everything up anew at each open, even registers that "should" only need to be set once at boot, so that there is non-reboot way to recover if something goes wrong. */
static int ether3_open(struct net_device *dev) | {
if (!is_valid_ether_addr(dev->dev_addr)) {
printk(KERN_WARNING "%s: invalid ethernet MAC address\n",
dev->name);
return -EINVAL;
}
if (request_irq(dev->irq, ether3_interrupt, 0, "ether3", dev))
return -EAGAIN;
ether3_init_for_open(dev);
netif_start_queue(dev);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* It is the caller's responsibility to delete all nodes from the tree before calling this function. */ | VOID EFIAPI OrderedCollectionUninit(IN RED_BLACK_TREE *Tree) | /* It is the caller's responsibility to delete all nodes from the tree before calling this function. */
VOID EFIAPI OrderedCollectionUninit(IN RED_BLACK_TREE *Tree) | {
ASSERT (OrderedCollectionIsEmpty (Tree));
FreePool (Tree);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Inform AEM/Board Controller about what energy mode we are currently entering. This information can be used for better visual feedback of EFM32GG activity for the board controller and PC applications. */ | void DVK_setEnergyMode(uint16_t energyMode) | /* Inform AEM/Board Controller about what energy mode we are currently entering. This information can be used for better visual feedback of EFM32GG activity for the board controller and PC applications. */
void DVK_setEnergyMode(uint16_t energyMode) | {
DVK_writeRegister(&BC_REGISTER->EM, energyMode);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Send a master data receive request when the master have obtained control of the bus.(Write Step2)
For this function returns immediately, it is always using in the interrupt hander. */ | void xI2CMasterReadRequestS2(unsigned long ulBase, xtBoolean bEndTransmition) | /* Send a master data receive request when the master have obtained control of the bus.(Write Step2)
For this function returns immediately, it is always using in the interrupt hander. */
void xI2CMasterReadRequestS2(unsigned long ulBase, xtBoolean bEndTransmition) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
if(bEndTransmition)
{
xHWREG(ulBase + I2C_CON) &= ~I2C_CON_AA;
I2CStopSend(ulBase);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Set pulse duration of the PWM channel. Make sure PWM clock is ON for writing registers. */ | static rt_err_t pwm_channel_pulse(struct rt_device_pwm *device, uint32_t channel, uint32_t pulse) | /* Set pulse duration of the PWM channel. Make sure PWM clock is ON for writing registers. */
static rt_err_t pwm_channel_pulse(struct rt_device_pwm *device, uint32_t channel, uint32_t pulse) | {
struct pwm_device *pwm_device = (struct pwm_device *)device;
uint32_t pdata, period;
period = pwm_device->period;
if (!period || pulse > period)
return -RT_EINVAL;
pdata = (pulse * PWM_CYCLE_MAX + (period >> 1)) / period;
pwm_device->reg_base->PWM_DATA[channel] = pdata;
return RT_EOK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Registers an interrupt handler for the Hibernation module interrupt. */ | void HibernateIntRegister(void(*pfnHandler)(void)) | /* Registers an interrupt handler for the Hibernation module interrupt. */
void HibernateIntRegister(void(*pfnHandler)(void)) | {
IntRegister(INT_HIBERNATE, pfnHandler);
IntEnable(INT_HIBERNATE);
} | watterott/WebRadio | C++ | null | 71 |
/* Returns true with the percentage of input Probability. */ | BOOLEAN RandomBoolean(UINT8 Probability) | /* Returns true with the percentage of input Probability. */
BOOLEAN RandomBoolean(UINT8 Probability) | {
return ((Probability > ((UINT8)Random64 (0, 100))) ? TRUE : FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function scans the connection cache for half-open/dead connections, closes and removes them. The cleanup is done at most once per second. */ | static void prune_dead_connections(struct Curl_easy *data) | /* This function scans the connection cache for half-open/dead connections, closes and removes them. The cleanup is done at most once per second. */
static void prune_dead_connections(struct Curl_easy *data) | {
struct curltime now = Curl_now();
time_t elapsed = Curl_timediff(now, data->state.conn_cache->last_cleanup);
if(elapsed >= 1000L) {
struct prunedead prune;
prune.data = data;
prune.extracted = NULL;
while(Curl_conncache_foreach(data, data->state.conn_cache, &prune,
call_extract_if_dead)) {
(void)Curl_disconnect(data, prune.extracted,TRUE);
}
data->state.conn_cache->last_cleanup = now;
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* If the connection is idle and we are restarting, then we don't want to do any Veno calculations until we get fresh rtt samples. So when we restart, we reset our Veno state to a clean state. After we get acks for this flight of packets, */ | static void tcp_veno_cwnd_event(struct sock *sk, enum tcp_ca_event event) | /* If the connection is idle and we are restarting, then we don't want to do any Veno calculations until we get fresh rtt samples. So when we restart, we reset our Veno state to a clean state. After we get acks for this flight of packets, */
static void tcp_veno_cwnd_event(struct sock *sk, enum tcp_ca_event event) | {
if (event == CA_EVENT_CWND_RESTART || event == CA_EVENT_TX_START)
tcp_veno_init(sk);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enable the relevant connector on the interface module. */ | static void realview_clcd_enable(struct clcd_fb *fb) | /* Enable the relevant connector on the interface module. */
static void realview_clcd_enable(struct clcd_fb *fb) | {
void __iomem *sys_clcd = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_CLCD_OFFSET;
u32 val;
val = readl(sys_clcd);
val |= SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH;
writel(val, sys_clcd);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initializes the global flash properties structure members.
This function checks and initializes the Flash module for the other Flash APIs. */ | status_t FLASH_Init(flash_config_t *config) | /* Initializes the global flash properties structure members.
This function checks and initializes the Flash module for the other Flash APIs. */
status_t FLASH_Init(flash_config_t *config) | {
assert(BOOTLOADER_API_TREE_POINTER);
return BOOTLOADER_API_TREE_POINTER->flashDriver->flash_init(config);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function will handle the initalization of any architecture specific callbacks. */ | int kgdb_arch_init(void) | /* This function will handle the initalization of any architecture specific callbacks. */
int kgdb_arch_init(void) | {
register_undef_hook(&kgdb_brkpt_hook);
register_undef_hook(&kgdb_compiled_brkpt_hook);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Destroy var store id in the Hii Variable node after parsing one Hii Package. */ | VOID DestroyVarStoreId(VOID) | /* Destroy var store id in the Hii Variable node after parsing one Hii Package. */
VOID DestroyVarStoreId(VOID) | {
VAR_CHECK_HII_VARIABLE_NODE *HiiVariableNode;
LIST_ENTRY *Link;
for (Link = mVarCheckHiiList.ForwardLink
; Link != &mVarCheckHiiList
; Link = Link->ForwardLink)
{
HiiVariableNode = VAR_CHECK_HII_VARIABLE_FROM_LINK (Link);
HiiVariableNode->VarStoreId = 0;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* ixgbe_atr_set_l4type_82599 - Sets the layer 4 packet type @input: input stream to modify @l4type: the layer 4 type value to load */ | s32 ixgbe_atr_set_l4type_82599(struct ixgbe_atr_input *input, u8 l4type) | /* ixgbe_atr_set_l4type_82599 - Sets the layer 4 packet type @input: input stream to modify @l4type: the layer 4 type value to load */
s32 ixgbe_atr_set_l4type_82599(struct ixgbe_atr_input *input, u8 l4type) | {
input->byte_stream[IXGBE_ATR_L4TYPE_OFFSET] = l4type;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI PciRead32(IN UINTN Address) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciRead32(IN UINTN Address) | {
return mRunningOnQ35 ?
PciExpressRead32 (Address) :
PciCf8Read32 (Address);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* reserve some DMA consistent memory calibrate the delay loop */ | void __cpuinit calibrate_delay(void) | /* reserve some DMA consistent memory calibrate the delay loop */
void __cpuinit calibrate_delay(void) | {
loops_per_jiffy = __delay_loops_MHz * (1000000 / HZ);
printk("Calibrating delay loop... %lu.%02lu BogoMIPS\n",
loops_per_jiffy / (500000 / HZ),
(loops_per_jiffy / (5000 / HZ)) % 100);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* BFA FCS itnim callbacks BFA FCS itnim alloc callback, after successful PRLI Context: Interrupt */ | void bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim, struct bfad_itnim_s **itnim_drv) | /* BFA FCS itnim callbacks BFA FCS itnim alloc callback, after successful PRLI Context: Interrupt */
void bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim, struct bfad_itnim_s **itnim_drv) | {
*itnim_drv = kzalloc(sizeof(struct bfad_itnim_s), GFP_ATOMIC);
if (*itnim_drv == NULL)
return;
(*itnim_drv)->im = bfad->im;
*itnim = &(*itnim_drv)->fcs_itnim;
(*itnim_drv)->state = ITNIM_STATE_NONE;
INIT_WORK(&(*itnim_drv)->itnim_work, bfad_im_itnim_work_handler);
bfad->bfad_flags |= BFAD_RPORT_ONLINE;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Interrupts cannot truely be simulated using WinPCap. In reality this task just polls the interface. */ | static void prvInterruptSimulator(void *pvParameters) | /* Interrupts cannot truely be simulated using WinPCap. In reality this task just polls the interface. */
static void prvInterruptSimulator(void *pvParameters) | {
static struct pcap_pkthdr *pxHeader;
const unsigned char *pucPacketData;
extern xQueueHandle xEMACEventQueue;
long lResult;
( void ) pvParameters;
for( ;; )
{
lResult = pcap_next_ex( pxOpenedInterfaceHandle, &pxHeader, &pucPacketData );
if( lResult == 1 )
{
if( pxlwIPNetIf != NULL )
{
prvEthernetInput( pucPacketData, pxHeader->len );
}
}
else
{
vTaskDelay( 5 );
}
}
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Generic handler for SIH interrupts ... we "know" this is called in task context, with IRQs enabled. */ | static void handle_twl4030_sih(unsigned irq, struct irq_desc *desc) | /* Generic handler for SIH interrupts ... we "know" this is called in task context, with IRQs enabled. */
static void handle_twl4030_sih(unsigned irq, struct irq_desc *desc) | {
struct sih_agent *agent = get_irq_data(irq);
const struct sih *sih = agent->sih;
int isr;
local_irq_enable();
isr = sih_read_isr(sih);
local_irq_disable();
if (isr < 0) {
pr_err("twl4030: %s SIH, read ISR error %d\n",
sih->name, isr);
return;
}
while (isr) {
irq = fls(isr);
irq--;
isr &= ~BIT(irq);
if (irq < sih->bits)
generic_handle_irq(agent->irq_base + irq);
else
pr_err("twl4030: %s SIH, invalid ISR bit %d\n",
sih->name, irq);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function replaces the original EthernetInit() API and performs the same actions. A macro is provided in */ | void EthernetInitExpClk(unsigned long ulBase, unsigned long ulEthClk) | /* This function replaces the original EthernetInit() API and performs the same actions. A macro is provided in */
void EthernetInitExpClk(unsigned long ulBase, unsigned long ulEthClk) | {
unsigned long ulDiv;
ASSERT(ulBase == ETH_BASE);
ulDiv = (ulEthClk / 2) / 2500000;
HWREG(ulBase + MAC_O_MDV) = (ulDiv & MAC_MDV_DIV_M);
} | watterott/WebRadio | C++ | null | 71 |
/* Get the GPIO Peripheral Id from a short Pin. */ | unsigned long GPIOPinToPeripheralId(unsigned long ulPort, unsigned long ulPin) | /* Get the GPIO Peripheral Id from a short Pin. */
unsigned long GPIOPinToPeripheralId(unsigned long ulPort, unsigned long ulPin) | {
xASSERT(GPIOBaseValid(ulPort));
return xSYSCTL_PERIPH_GPIOA;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The Xilinx errors that must be handled by the callback are: */ | void XEmac_SetErrorHandler(XEmac *InstancePtr, void *CallBackRef, XEmac_ErrorHandler FuncPtr) | /* The Xilinx errors that must be handled by the callback are: */
void XEmac_SetErrorHandler(XEmac *InstancePtr, void *CallBackRef, XEmac_ErrorHandler FuncPtr) | {
XASSERT_VOID(InstancePtr != NULL);
XASSERT_VOID(FuncPtr != NULL);
XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY);
InstancePtr->ErrorHandler = FuncPtr;
InstancePtr->ErrorRef = CallBackRef;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Read SFH7770 light level data.
This function reads the ambient light level data from the sensor and places it in the user-provided sensor_data_t structure. */ | static bool sfh7770_get_light(sensor_hal_t *hal, sensor_data_t *data) | /* Read SFH7770 light level data.
This function reads the ambient light level data from the sensor and places it in the user-provided sensor_data_t structure. */
static bool sfh7770_get_light(sensor_hal_t *hal, sensor_data_t *data) | {
struct {
uint8_t lsb;
uint8_t msb;
}
light_data;
size_t const count = sensor_bus_read(hal, SFH7770_ALS_DATA_LSB,
(uint8_t *)&light_data, sizeof(light_data));
data->light.value = (uint32_t)((light_data.msb << 8) | light_data.lsb);
return (count == sizeof(light_data));
} | memfault/zero-to-main | C++ | null | 200 |
/* Returns zero if successful, or a negative error code on failure. On success jack will be initialised. */ | int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type, struct snd_soc_jack *jack) | /* Returns zero if successful, or a negative error code on failure. On success jack will be initialised. */
int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type, struct snd_soc_jack *jack) | {
jack->card = card;
INIT_LIST_HEAD(&jack->pins);
return snd_jack_new(card->codec->card, id, type, &jack->jack);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reset WINC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. */ | nm_bsp_reset(void) | /* Reset WINC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. */
nm_bsp_reset(void) | {
pio_set_pin_low(CONF_WINC_PIN_CHIP_ENABLE);
pio_set_pin_low(CONF_WINC_PIN_RESET);
nm_bsp_sleep(1);
pio_set_pin_high(CONF_WINC_PIN_CHIP_ENABLE);
nm_bsp_sleep(10);
pio_set_pin_high(CONF_WINC_PIN_RESET);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* This routine initializes or updates the adapter's device database entry for the specified device. It also triggers a login for the specified device. Therefore, it may also be used as a secondary login routine when a NULL pointer is specified for the fw_ddb_entry. */ | int qla4xxx_set_ddb_entry(struct scsi_qla_host *ha, uint16_t fw_ddb_index, dma_addr_t fw_ddb_entry_dma) | /* This routine initializes or updates the adapter's device database entry for the specified device. It also triggers a login for the specified device. Therefore, it may also be used as a secondary login routine when a NULL pointer is specified for the fw_ddb_entry. */
int qla4xxx_set_ddb_entry(struct scsi_qla_host *ha, uint16_t fw_ddb_index, dma_addr_t fw_ddb_entry_dma) | {
uint32_t mbox_cmd[MBOX_REG_COUNT];
uint32_t mbox_sts[MBOX_REG_COUNT];
memset(&mbox_cmd, 0, sizeof(mbox_cmd));
memset(&mbox_sts, 0, sizeof(mbox_sts));
mbox_cmd[0] = MBOX_CMD_SET_DATABASE_ENTRY;
mbox_cmd[1] = (uint32_t) fw_ddb_index;
mbox_cmd[2] = LSDW(fw_ddb_entry_dma);
mbox_cmd[3] = MSDW(fw_ddb_entry_dma);
mbox_cmd[4] = sizeof(struct dev_db_entry);
return qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, &mbox_cmd[0], &mbox_sts[0]);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function will find an usb configuration object. */ | uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value) | /* This function will find an usb configuration object. */
uconfig_t rt_usbd_find_config(udevice_t device, rt_uint8_t value) | {
struct rt_list_node* node;
uconfig_t cfg = RT_NULL;
LOG_D("rt_usbd_find_config");
RT_ASSERT(device != RT_NULL);
RT_ASSERT(value <= device->dev_desc.bNumConfigurations);
for (node = device->cfg_list.next; node != &device->cfg_list; node = node->next)
{
cfg = (uconfig_t)rt_list_entry(node, struct udevice, list);
if(cfg->cfg_desc.bConfigurationValue == value)
{
return cfg;
}
}
rt_kprintf("can't find configuration %d\n", value);
return RT_NULL;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns: the signed 64-bit integer from the attribute, or 0. */ | gint64 _g_file_attribute_value_get_int64(const GFileAttributeValue *attr) | /* Returns: the signed 64-bit integer from the attribute, or 0. */
gint64 _g_file_attribute_value_get_int64(const GFileAttributeValue *attr) | {
if (attr == NULL)
return 0;
g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_INT64, 0);
return attr->u.int64;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* USB Endpoint 1 Event Callback Called automatically on USB Endpoint 1 Event Parameter: event */ | void USB_EndPoint1(uint32_t event) | /* USB Endpoint 1 Event Callback Called automatically on USB Endpoint 1 Event Parameter: event */
void USB_EndPoint1(uint32_t event) | {
case USB_EVT_IN:
temp = CDC_GetSerialState();
if (serialState != temp) {
serialState = temp;
CDC_NotificationIn();
}
break;
}
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Enable write access to Divider and Counter Reload registers. */ | void IWDT_EnableWriteAccess(void) | /* Enable write access to Divider and Counter Reload registers. */
void IWDT_EnableWriteAccess(void) | {
IWDT->KEY = IWDT_KEY_ACCESS;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This routine returns true iff two strings are equal, treating both NUL and newline-then-NUL as equivalent string terminations. It's geared for use with sysfs input strings, which generally terminate with newlines but are compared against values without newlines. */ | bool sysfs_streq(const char *s1, const char *s2) | /* This routine returns true iff two strings are equal, treating both NUL and newline-then-NUL as equivalent string terminations. It's geared for use with sysfs input strings, which generally terminate with newlines but are compared against values without newlines. */
bool sysfs_streq(const char *s1, const char *s2) | {
while (*s1 && *s1 == *s2) {
s1++;
s2++;
}
if (*s1 == *s2)
return true;
if (!*s1 && *s2 == '\n' && !s2[1])
return true;
if (*s1 == '\n' && !s1[1] && !*s2)
return true;
return false;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The Timer 1 default IRQ, declared in start up code. */ | void TIMER1IntHandler(void) | /* The Timer 1 default IRQ, declared in start up code. */
void TIMER1IntHandler(void) | {
unsigned long ulBase = TIMER1_BASE;
unsigned long ulTemp0,ulTemp1;
ulTemp0 = (xHWREG(ulBase + TIMER_O_TISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TISR) = ulTemp0;
ulTemp1 = (xHWREG(ulBase + TIMER_O_TEISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TEISR) = ulTemp1;
if (g_pfnTimerHandlerCallbacks[1] != 0)
{
g_pfnTimerHandlerCallbacks[1](0, 0, ulTemp0 | ulTemp1, 0);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Enables or disables the TIM Capture Compare Channel x. */ | void TIM_EnableCapCmpCh(TIM_Module *TIMx, uint16_t Channel, uint32_t TIM_CCx) | /* Enables or disables the TIM Capture Compare Channel x. */
void TIM_EnableCapCmpCh(TIM_Module *TIMx, uint16_t Channel, uint32_t TIM_CCx) | {
uint16_t tmp = 0;
assert_param(IsTimList8Module(TIMx));
assert_param(IsTimCh(Channel));
assert_param(IsTimCapCmpState(TIM_CCx));
tmp = CAPCMPEN_CCE_SET << Channel;
TIMx->CCEN &= (uint32_t)~tmp;
TIMx->CCEN |= (uint32_t)(TIM_CCx << Channel);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Transport Layer Write.
Writes nBufSize bytes from pBuf to the device */ | ADI_BLE_TRANSPORT_RESULT adi_tal_Write(void *pBuf, const uint32_t nBufSize) | /* Transport Layer Write.
Writes nBufSize bytes from pBuf to the device */
ADI_BLE_TRANSPORT_RESULT adi_tal_Write(void *pBuf, const uint32_t nBufSize) | {
ADI_BLE_TRANSPORT_RESULT eTransportResult;
uint8_t nBytes;
ASSERT(pBuf != NULL);
ASSERT(nBufSize > 0u);
ASSERT(nBufSize <= ADI_RADIO_BUFFER_BYTES);
eTransportResult = RadioTransaction(true, pBuf, nBufSize, &nBytes);
RETURN_ERROR(nBytes, nBufSize, ADI_BLE_TRANSPORT_FAILED_TRANSACTION);
return (eTransportResult);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* NDFC allows 32bit read/write of data. So we can speed up the buffer functions. No further checking, as nand_base will always read/write page aligned. */ | static void ndfc_read_buf(struct mtd_info *mtdinfo, uint8_t *buf, int len) | /* NDFC allows 32bit read/write of data. So we can speed up the buffer functions. No further checking, as nand_base will always read/write page aligned. */
static void ndfc_read_buf(struct mtd_info *mtdinfo, uint8_t *buf, int len) | {
struct nand_chip *this = mtdinfo->priv;
ulong base = (ulong) this->IO_ADDR_W & 0xffffff00;
uint32_t *p = (uint32_t *) buf;
for (;len > 0; len -= 4)
*p++ = in_be32((u32 *)(base + NDFC_DATA));
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Checks whether the specified SAI block x flag is set or not. */ | FlagStatus SAI_GetFlagStatus(SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_FLAG) | /* Checks whether the specified SAI block x flag is set or not. */
FlagStatus SAI_GetFlagStatus(SAI_Block_TypeDef *SAI_Block_x, uint32_t SAI_FLAG) | {
FlagStatus bitstatus = RESET;
assert_param(IS_SAI_BLOCK_PERIPH(SAI_Block_x));
assert_param(IS_SAI_BLOCK_GET_FLAG(SAI_FLAG));
if ((SAI_Block_x->SR & SAI_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* Helper function to initialize a page with the sclp request structure. */ | static struct sclp_vt220_request* sclp_vt220_initialize_page(void *page) | /* Helper function to initialize a page with the sclp request structure. */
static struct sclp_vt220_request* sclp_vt220_initialize_page(void *page) | {
struct sclp_vt220_request *request;
struct sclp_vt220_sccb *sccb;
request = ((struct sclp_vt220_request *)
((addr_t) page + PAGE_SIZE)) - 1;
request->retry_count = 0;
request->sclp_req.sccb = page;
sccb = (struct sclp_vt220_sccb *) page;
memset((void *) sccb, 0, sizeof(struct sclp_vt220_sccb));
sccb->header.length = sizeof(struct sclp_vt220_sccb);
sccb->header.function_code = SCLP_NORMAL_WRITE;
sccb->header.response_code = 0x0000;
sccb->evbuf.type = EVTYP_VT220MSG;
sccb->evbuf.length = sizeof(struct evbuf_header);
return request;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Note: To use this routine, must call RTMPInitTimer before. */ | void RTMPModTimer(struct rt_ralink_timer *pTimer, unsigned long Value) | /* Note: To use this routine, must call RTMPInitTimer before. */
void RTMPModTimer(struct rt_ralink_timer *pTimer, unsigned long Value) | {
BOOLEAN Cancel;
if (pTimer->Valid) {
pTimer->TimerValue = Value;
pTimer->State = FALSE;
if (pTimer->PeriodicType == TRUE) {
RTMPCancelTimer(pTimer, &Cancel);
RTMPSetTimer(pTimer, Value);
} else {
RTMP_OS_Mod_Timer(&pTimer->TimerObj, Value);
}
} else {
DBGPRINT_ERR(("RTMPModTimer failed, Timer hasn't been initialize!\n"));
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fills each HASH_Config_T member with its default value. */ | void HASH_ConfigStructInit(HASH_Config_T *hashConfig) | /* Fills each HASH_Config_T member with its default value. */
void HASH_ConfigStructInit(HASH_Config_T *hashConfig) | {
hashConfig->algoSelect = HASH_ALGO_SELECTION_SHA1;
hashConfig->algoMode = HASH_ALGO_MODE_HASH;
hashConfig->dataType = HASH_DATA_TYPE_32B;
hashConfig->hmacKeyType = HASH_HMAC_KEY_TYPE_SHORTKEY;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* check the parameters for the CRT head, and either bring them back into range, or return -EINVAL. */ | static int sm501fb_check_var_crt(struct fb_var_screeninfo *var, struct fb_info *info) | /* check the parameters for the CRT head, and either bring them back into range, or return -EINVAL. */
static int sm501fb_check_var_crt(struct fb_var_screeninfo *var, struct fb_info *info) | {
return sm501fb_check_var(var, info);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* function : de_vsu_enable(unsigned int sel, unsigned int chno, unsigned int en) description : enable/disable vsu parameters : sel <rtmx select> chno <overlay select> en <enable: 0-disable; 1-enable> return : success */ | int de_vsu_enable(unsigned int sel, unsigned int chno, unsigned int en) | /* function : de_vsu_enable(unsigned int sel, unsigned int chno, unsigned int en) description : enable/disable vsu parameters : sel <rtmx select> chno <overlay select> en <enable: 0-disable; 1-enable> return : success */
int de_vsu_enable(unsigned int sel, unsigned int chno, unsigned int en) | {
vsu_dev[sel][chno]->ctrl.bits.en = en;
vsu_glb_block[sel][chno].dirty = 1;
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Change the direction of a GPIO pin to output and set the level on this pin. */ | static int m2s_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level) | /* Change the direction of a GPIO pin to output and set the level on this pin. */
static int m2s_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level) | {
struct m2s_gpio_chip *m2s_chip
= container_of(chip, struct m2s_gpio_chip, chip);
u32 gpio_cfg;
unsigned long f;
spin_lock_irqsave(&m2s_chip->lock, f);
gpio_cfg = readl(M2S_GPIO_CFG(m2s_chip->gpio_cfg, gpio));
gpio_cfg |= GPIO_OUT_REG_EN | GPIO_OUT_BUF_EN;
gpio_cfg &= ~(GPIO_IN_REG_EN);
writel(0, M2S_GPIO_CFG(m2s_chip->gpio_cfg, gpio));
m2s_gpio_set_value_locked(m2s_chip, gpio, level);
writel(gpio_cfg, M2S_GPIO_CFG(m2s_chip->gpio_cfg, gpio));
spin_unlock_irqrestore(&m2s_chip->lock, f);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Internal worker function that is called to complete CPU initialization at the end of SmmCpuFeaturesInitializeProcessor(). */ | VOID FinishSmmCpuFeaturesInitializeProcessor(VOID) | /* Internal worker function that is called to complete CPU initialization at the end of SmmCpuFeaturesInitializeProcessor(). */
VOID FinishSmmCpuFeaturesInitializeProcessor(VOID) | {
MSR_IA32_SMM_MONITOR_CTL_REGISTER SmmMonitorCtl;
if (mMsegBase > 0) {
SmmMonitorCtl.Uint64 = 0;
SmmMonitorCtl.Bits.MsegBase = (UINT32)mMsegBase >> 12;
SmmMonitorCtl.Bits.Valid = 1;
AsmWriteMsr64 (MSR_IA32_SMM_MONITOR_CTL, SmmMonitorCtl.Uint64);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* USBH_LL_Init Initialize the Low Level portion of the Host driver. */ | USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | /* USBH_LL_Init Initialize the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | {
UNUSED(phost);
return USBH_OK;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Called to send a logout to the fabric. Used when a V-Port is deleted/stopped. */ | static void bfa_fcs_vport_do_logo(struct bfa_fcs_vport_s *vport) | /* Called to send a logout to the fabric. Used when a V-Port is deleted/stopped. */
static void bfa_fcs_vport_do_logo(struct bfa_fcs_vport_s *vport) | {
bfa_trc(__vport_fcs(vport), __vport_pwwn(vport));
vport->vport_stats.logo_sent++;
bfa_lps_fdisclogo(vport->lps);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable the automatic slave select function of the specified SPI port.
The */ | void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel) | /* Enable the automatic slave select function of the specified SPI port.
The */
void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) ||
(ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1));
xHWREG(ulBase + SPI_SSR) |= SPI_AUTOSS;
xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M;
xHWREG(ulBase + SPI_SSR) |= ulSlaveSel;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Configure the cpu with a given data image. First turn off the counters, then download the image, then turn the counters back on. */ | static int perf_config(uint32_t *image_ptr) | /* Configure the cpu with a given data image. First turn off the counters, then download the image, then turn the counters back on. */
static int perf_config(uint32_t *image_ptr) | {
long error;
uint32_t raddr[4];
error = perf_stop_counters(raddr);
if (error != 0) {
printk("perf_config: perf_stop_counters = %ld\n", error);
return -EINVAL;
}
printk("Preparing to write image\n");
error = perf_write_image((uint64_t *)image_ptr);
if (error != 0) {
printk("perf_config: DOWNLOAD = %ld\n", error);
return -EINVAL;
}
printk("Preparing to start counters\n");
perf_start_counters();
return sizeof(uint32_t);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* return The status flags. This is the logical OR of members of the enumeration ::snvs_status_flags_t */ | uint32_t SNVS_LP_SRTC_GetStatusFlags(SNVS_Type *base) | /* return The status flags. This is the logical OR of members of the enumeration ::snvs_status_flags_t */
uint32_t SNVS_LP_SRTC_GetStatusFlags(SNVS_Type *base) | {
uint32_t flags = 0U;
if ((base->LPSR & SNVS_LPSR_LPTA_MASK) != 0U)
{
flags |= (uint32_t)kSNVS_SRTC_AlarmInterruptFlag;
}
return flags;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Set the channel to run in frame count enable mode */ | void XAxiVdma_ChannelStartFrmCntEnable(XAxiVdma_Channel *Channel) | /* Set the channel to run in frame count enable mode */
void XAxiVdma_ChannelStartFrmCntEnable(XAxiVdma_Channel *Channel) | {
u32 CrBits;
CrBits = XAxiVdma_ReadReg(Channel->ChanBase, XAXIVDMA_CR_OFFSET) |
XAXIVDMA_CR_FRMCNT_EN_MASK;
XAxiVdma_WriteReg(Channel->ChanBase, XAXIVDMA_CR_OFFSET,
CrBits);
return;
} | ua1arn/hftrx | C++ | null | 69 |
/* ADC Read the Analog Watchdog Flag.
This flag is set when the converted voltage crosses the high or low thresholds. */ | bool adc_awd(uint32_t adc) | /* ADC Read the Analog Watchdog Flag.
This flag is set when the converted voltage crosses the high or low thresholds. */
bool adc_awd(uint32_t adc) | {
return ADC_SR(adc) & ADC_SR_AWD;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Return whether the Source interrupt index refers to a shared interrupt (SPI) */ | STATIC BOOLEAN SourceIsSpi(IN UINTN Source) | /* Return whether the Source interrupt index refers to a shared interrupt (SPI) */
STATIC BOOLEAN SourceIsSpi(IN UINTN Source) | {
return Source >= 32 && Source < 1020;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Registers an interrupt handler for the flash interrupt. */ | void FlashIntRegister(void(*pfnHandler)(void)) | /* Registers an interrupt handler for the flash interrupt. */
void FlashIntRegister(void(*pfnHandler)(void)) | {
IntRegister(INT_FLASH_TM4C123, pfnHandler);
IntEnable(INT_FLASH_TM4C123);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Used by Power Management to force the PHY into 10 Base T half-duplex mode, when going to D3 in WOL mode. Also used during initialization to set the PHY for normal operation. */ | void et131x_setphy_normal(struct et131x_adapter *etdev) | /* Used by Power Management to force the PHY into 10 Base T half-duplex mode, when going to D3 in WOL mode. Also used during initialization to set the PHY for normal operation. */
void et131x_setphy_normal(struct et131x_adapter *etdev) | {
ET1310_PhyPowerDown(etdev, 0);
et131x_xcvr_init(etdev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns information about the processor's cache and TLB. */ | int pdc_cache_info(struct pdc_cache_info *cache_info) | /* Returns information about the processor's cache and TLB. */
int pdc_cache_info(struct pdc_cache_info *cache_info) | {
int retval;
unsigned long flags;
spin_lock_irqsave(&pdc_lock, flags);
retval = mem_pdc_call(PDC_CACHE, PDC_CACHE_INFO, __pa(pdc_result), 0);
convert_to_wide(pdc_result);
memcpy(cache_info, pdc_result, sizeof(*cache_info));
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Register Ethernet media type with TIPC bearer code. Also register with OS for notifications about device state changes. */ | int tipc_eth_media_start(void) | /* Register Ethernet media type with TIPC bearer code. Also register with OS for notifications about device state changes. */
int tipc_eth_media_start(void) | {
struct tipc_media_addr bcast_addr;
int res;
if (eth_started)
return -EINVAL;
bcast_addr.type = htonl(TIPC_MEDIA_TYPE_ETH);
memset(&bcast_addr.dev_addr, 0xff, ETH_ALEN);
memset(eth_bearers, 0, sizeof(eth_bearers));
res = tipc_register_media(TIPC_MEDIA_TYPE_ETH, "eth",
enable_bearer, disable_bearer, send_msg,
eth_addr2str, &bcast_addr, ETH_LINK_PRIORITY,
ETH_LINK_TOLERANCE, ETH_LINK_WINDOW);
if (res)
return res;
notifier.notifier_call = &recv_notification;
notifier.priority = 0;
res = register_netdevice_notifier(¬ifier);
if (!res)
eth_started = 1;
return res;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Received disconnect ind on active state send disconnect resp send msg to user */ | void cb_disc_1(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data) | /* Received disconnect ind on active state send disconnect resp send msg to user */
void cb_disc_1(struct pcbit_dev *dev, struct pcbit_chan *chan, struct callb_data *data) | {
struct sk_buff *skb;
int len;
ushort refnum;
isdn_ctrl ictl;
if ((len = capi_disc_resp(chan, &skb)) < 0) {
printk("capi_disc_resp failed\n");
return;
}
refnum = last_ref_num++ & 0x7fffU;
chan->s_refnum = refnum;
pcbit_l2_write(dev, MSG_DISC_RESP, refnum, skb, len);
ictl.command = ISDN_STAT_BHUP;
ictl.driver=dev->id;
ictl.arg=chan->id;
dev->dev_if->statcallb(&ictl);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Complete setting up the rest field of DCD of V1 such as barker code and DCD data length. */ | static void set_dcd_rst_v1(struct imx_header *imxhdr, uint32_t dcd_len, char *name, int lineno) | /* Complete setting up the rest field of DCD of V1 such as barker code and DCD data length. */
static void set_dcd_rst_v1(struct imx_header *imxhdr, uint32_t dcd_len, char *name, int lineno) | {
dcd_v1_t *dcd_v1 = &imxhdr->header.hdr_v1.dcd_table;
dcd_v1->preamble.barker = DCD_BARKER;
dcd_v1->preamble.length = dcd_len * sizeof(dcd_type_addr_data_t);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* read CTC trim counter direction when reference sync pulse occurred */ | FlagStatus ctc_counter_direction_read(void) | /* read CTC trim counter direction when reference sync pulse occurred */
FlagStatus ctc_counter_direction_read(void) | {
if(RESET != (CTC_STAT & CTC_STAT_REFDIR)){
return SET;
}else{
return RESET;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */ | status_t HAL_CODEC_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth) | /* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth) | {
assert(handle != NULL);
return SGTL_ConfigDataFormat((sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), mclk,
sampleRate, bitWidth);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Calculate EPD input for a 4bpp buffer, but with a difference image LUT. This is used for small-LUT mode. */ | static void IRAM_ATTR calc_epd_input_4bpp_1k_lut(const uint32_t *ld, uint8_t *epd_input, const uint8_t *conversion_lut, uint8_t from) | /* Calculate EPD input for a 4bpp buffer, but with a difference image LUT. This is used for small-LUT mode. */
static void IRAM_ATTR calc_epd_input_4bpp_1k_lut(const uint32_t *ld, uint8_t *epd_input, const uint8_t *conversion_lut, uint8_t from) | {
uint16_t *ptr = (uint16_t *)ld;
for (uint32_t j = 0; j < EPD_WIDTH / 4; j += 4) {
epd_input[j + 2] = lookup_pixels_4bpp_1k(*(ptr++), conversion_lut, from);
epd_input[j + 3] = lookup_pixels_4bpp_1k(*(ptr++), conversion_lut, from);
epd_input[j + 0] = lookup_pixels_4bpp_1k(*(ptr++), conversion_lut, from);
epd_input[j + 1] = lookup_pixels_4bpp_1k(*(ptr++), conversion_lut, from);
}
} | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* 3.2.2.6 IMSI IMSI coded as the value part of the Mobile Identity IE defined in 3GPP TS 24.008 (NOTE 1) NOTE 1: The Type of identity field in the Mobile Identity IE shall be ignored by the receiver. Dissected in packet-gsm_a_common.c (de_mid) 3.2.2.7 TMSI */ | static guint16 be_tmsi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) | /* 3.2.2.6 IMSI IMSI coded as the value part of the Mobile Identity IE defined in 3GPP TS 24.008 (NOTE 1) NOTE 1: The Type of identity field in the Mobile Identity IE shall be ignored by the receiver. Dissected in packet-gsm_a_common.c (de_mid) 3.2.2.7 TMSI */
static guint16 be_tmsi(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len, gchar *add_string, int string_len) | {
guint32 curr_offset;
guint32 value;
curr_offset = offset;
value = tvb_get_ntohl(tvb, curr_offset);
proto_tree_add_uint(tree, hf_gsm_a_tmsi,
tvb, curr_offset, 4,
value);
if (add_string)
g_snprintf(add_string, string_len, " - (0x%04x)", value);
curr_offset += 4;
EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_bssmap_extraneous_data);
return(curr_offset - offset);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* UART MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_UART_MspInit(UART_HandleTypeDef *huart) | /* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
if(huart->Instance==LPUART1)
{
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LPUART1;
PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PCLK1;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
__HAL_RCC_LPUART1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_3|GPIO_PIN_2;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF8_LPUART1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Note: The system will reboot when Expire Flag is set TWICE. So, if the watchdog timer is 20 seconds, then the maximum hang time is about 40 seconds, and the minimum hang time is about 20.6 seconds. */ | static void supermicro_old_pre_start(unsigned long acpibase) | /* Note: The system will reboot when Expire Flag is set TWICE. So, if the watchdog timer is 20 seconds, then the maximum hang time is about 40 seconds, and the minimum hang time is about 20.6 seconds. */
static void supermicro_old_pre_start(unsigned long acpibase) | {
unsigned long val32;
val32 = inl(SMI_EN);
val32 &= 0xffffdfff;
outl(val32, SMI_EN);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns zero on success or %-ENOENT on failure. */ | int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh, struct notifier_block *n) | /* Returns zero on success or %-ENOENT on failure. */
int srcu_notifier_chain_unregister(struct srcu_notifier_head *nh, struct notifier_block *n) | {
int ret;
if (unlikely(system_state == SYSTEM_BOOTING))
return notifier_chain_unregister(&nh->head, n);
mutex_lock(&nh->mutex);
ret = notifier_chain_unregister(&nh->head, n);
mutex_unlock(&nh->mutex);
synchronize_srcu(&nh->srcu);
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Before the /proc/pid/status file was created the only way to read the effective uid of a /process was to stat /proc/pid. Reading /proc/pid/status is slow enough that procps and other packages kept stating /proc/pid. To keep the rules in /proc simple I have made this apply to all per process world readable and executable directories. */ | static int pid_revalidate(struct dentry *dentry, struct nameidata *nd) | /* Before the /proc/pid/status file was created the only way to read the effective uid of a /process was to stat /proc/pid. Reading /proc/pid/status is slow enough that procps and other packages kept stating /proc/pid. To keep the rules in /proc simple I have made this apply to all per process world readable and executable directories. */
static int pid_revalidate(struct dentry *dentry, struct nameidata *nd) | {
struct inode *inode = dentry->d_inode;
struct task_struct *task = get_proc_task(inode);
const struct cred *cred;
if (task) {
if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) ||
task_dumpable(task)) {
rcu_read_lock();
cred = __task_cred(task);
inode->i_uid = cred->euid;
inode->i_gid = cred->egid;
rcu_read_unlock();
} else {
inode->i_uid = 0;
inode->i_gid = 0;
}
inode->i_mode &= ~(S_ISUID | S_ISGID);
security_task_to_inode(task, inode);
put_task_struct(task);
return 1;
}
d_drop(dentry);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Extracts the filename including extention from the specified full filename, which could possible include a path. The function can handle both the backslash and forward slash path delimiter, to make it crossplatform. */ | bool UtilFileExtractFilename(char const *fullFilename, char *filenameBuffer) | /* Extracts the filename including extention from the specified full filename, which could possible include a path. The function can handle both the backslash and forward slash path delimiter, to make it crossplatform. */
bool UtilFileExtractFilename(char const *fullFilename, char *filenameBuffer) | {
bool result = false;
char const * filenamePtr;
assert(fullFilename != NULL);
assert(filenameBuffer != NULL);
if ( (fullFilename != NULL) && (filenameBuffer != NULL) )
{
filenamePtr = strrchr(fullFilename, '/');
if (filenamePtr != NULL)
{
filenamePtr++;
}
else
{
filenamePtr = strrchr(fullFilename, '\\');
if (filenamePtr != NULL)
{
filenamePtr++;
}
else
{
filenamePtr = fullFilename;
}
}
strcpy(filenameBuffer, filenamePtr);
result = true;
}
return result;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* In general, pagetable_init() assumes that the pagetable may already be partially populated, and so it avoids stomping on any existing mappings. */ | void __init early_ioremap_page_table_range_init(void) | /* In general, pagetable_init() assumes that the pagetable may already be partially populated, and so it avoids stomping on any existing mappings. */
void __init early_ioremap_page_table_range_init(void) | {
pgd_t *pgd_base = swapper_pg_dir;
unsigned long vaddr, end;
vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK;
page_table_range_init(vaddr, end, pgd_base);
early_ioremap_reset();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Computes a cycle count for a given time in nanoseconds. */ | static uint32_t LPI2C_GetCyclesForWidth(uint32_t sourceClock_Hz, uint32_t width_ns, uint32_t maxCycles, uint32_t prescaler) | /* Computes a cycle count for a given time in nanoseconds. */
static uint32_t LPI2C_GetCyclesForWidth(uint32_t sourceClock_Hz, uint32_t width_ns, uint32_t maxCycles, uint32_t prescaler) | {
assert(sourceClock_Hz > 0U);
uint32_t divider = 1U;
while (prescaler != 0U)
{
divider *= 2U;
prescaler--;
}
uint32_t busCycle_ns = 1000000U / (sourceClock_Hz / divider / 1000U);
uint32_t cycles = 0U;
while ((((cycles + 1U) * busCycle_ns) < width_ns) && (cycles + 1U < maxCycles))
{
++cycles;
}
if ((cycles == 0U) && (busCycle_ns <= (width_ns * 10U)))
{
cycles = 1U;
}
return cycles;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Compute the checksum for a bulk of data. */ | UINT16 EFIAPI NetblockChecksum(IN UINT8 *Bulk, IN UINT32 Len) | /* Compute the checksum for a bulk of data. */
UINT16 EFIAPI NetblockChecksum(IN UINT8 *Bulk, IN UINT32 Len) | {
register UINT32 Sum;
Sum = 0;
if (Len % 2 != 0) {
Sum += *(Bulk + Len - 1);
}
while (Len > 1) {
Sum += *(UINT16 *)Bulk;
Bulk += 2;
Len -= 2;
}
while ((Sum >> 16) != 0) {
Sum = (Sum & 0xffff) + (Sum >> 16);
}
return (UINT16)Sum;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Starts taking samples using DMA from the microphone. */ | void MIC_start(uint32_t nSamples) | /* Starts taking samples using DMA from the microphone. */
void MIC_start(uint32_t nSamples) | {
if( nSamples > sampleBufferLen ) {
sampleCount = sampleBufferLen;
}
else {
sampleCount = nSamples;
}
if( !dmaBusy ) {
DMADRV_PeripheralMemory( dmadrvChannelId,
dmadrvPeripheralSignal_ADC0_SCAN,
(void *) sampleBuffer,
(void *) &( ADC0 ->SCANDATA ),
true,
sampleCount,
dmadrvDataSize2,
dmaCompleteCallback,
NULL );
adcEnable( true );
dmaBusy = true;
sampleBufferReady = false;
}
return;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Initializes the Low Level portion of the Device driver. */ | USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) | /* Initializes the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev) | {
hpcd.Instance = USB_OTG_FS;
hpcd.Init.dev_endpoints = 4;
hpcd.Init.use_dedicated_ep1 = 0;
hpcd.Init.dma_enable = 0;
hpcd.Init.low_power_enable = 0;
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd.Init.Sof_enable = 0;
hpcd.Init.speed = PCD_SPEED_FULL;
hpcd.Init.vbus_sensing_enable = 1;
hpcd.Init.lpm_enable = 0;
hpcd.pData = pdev;
pdev->pData = &hpcd;
HAL_PCD_Init(&hpcd);
HAL_PCDEx_SetRxFiFo(&hpcd, 0xA0);
HAL_PCDEx_SetTxFiFo(&hpcd, 0, 0xA0);
return USBD_OK;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Resets the RCC clock configuration to the default reset state. */ | void RCC_DeInit(void) | /* Resets the RCC clock configuration to the default reset state. */
void RCC_DeInit(void) | {
RCC->CTRLSTS |= (uint32_t)0x00000004;
RCC->CFG &= (uint32_t)0xF8FFC000;
RCC->CTRL &= (uint32_t)0xFEF6FFFE;
RCC->CTRL &= (uint32_t)0xFFFBFFFF;
RCC->CFG &= (uint32_t)0xF700FFFF;
RCC->CFG2 = 0x00003800;
RCC->CFG3 = 0x00003800;
RCC->RDCTRL = 0x00000000;
RCC->PLLHSIPRE = 0x00000000;
RCC->CLKINT = 0x009F0000;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Returns: a newly allocated #GDir on success, NULL on failure. If non-NULL, you must free the result with g_dir_close() when you are finished with it. */ | GDir* g_dir_open(const gchar *path, guint flags, GError **error) | /* Returns: a newly allocated #GDir on success, NULL on failure. If non-NULL, you must free the result with g_dir_close() when you are finished with it. */
GDir* g_dir_open(const gchar *path, guint flags, GError **error) | {
gint saved_errno;
GDir *dir;
dir = g_dir_open_with_errno (path, flags);
if (dir == NULL)
{
gchar *utf8_path;
saved_errno = errno;
utf8_path = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (saved_errno),
_("Error opening directory '%s': %s"), utf8_path, g_strerror (saved_errno));
g_free (utf8_path);
}
return dir;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Called whenever a period elapses, it must return the current hardware position of the buffer. Also resets the read counter used to prevent overruns */ | static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(struct snd_pcm_substream *substream) | /* Called whenever a period elapses, it must return the current hardware position of the buffer. Also resets the read counter used to prevent overruns */
static snd_pcm_uframes_t snd_card_saa7134_capture_pointer(struct snd_pcm_substream *substream) | {
struct snd_pcm_runtime *runtime = substream->runtime;
snd_card_saa7134_pcm_t *pcm = runtime->private_data;
struct saa7134_dev *dev=pcm->dev;
if (dev->dmasound.read_count) {
dev->dmasound.read_count -= snd_pcm_lib_period_bytes(substream);
dev->dmasound.read_offset += snd_pcm_lib_period_bytes(substream);
if (dev->dmasound.read_offset == dev->dmasound.bufsize)
dev->dmasound.read_offset = 0;
}
return bytes_to_frames(runtime, dev->dmasound.read_offset);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Temporarily enable and disable the invalidation of the display. */ | void lv_disp_enable_invalidation(lv_disp_t *disp, bool en) | /* Temporarily enable and disable the invalidation of the display. */
void lv_disp_enable_invalidation(lv_disp_t *disp, bool en) | {
if(!disp) disp = lv_disp_get_default();
if(!disp) {
LV_LOG_WARN("no display registered");
return;
}
disp->inv_en_cnt += en ? 1 : -1;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Scale and compensate the raw temperature measurement value to micro °C The formula is based on the Chapter 4.9.2 in the datasheet and was modified to need only integer arithmetic. */ | static void dps310_scale_temperature(const struct device *dev, int32_t tmp_raw) | /* Scale and compensate the raw temperature measurement value to micro °C The formula is based on the Chapter 4.9.2 in the datasheet and was modified to need only integer arithmetic. */
static void dps310_scale_temperature(const struct device *dev, int32_t tmp_raw) | {
struct dps310_data *data = dev->data;
const struct dps310_cal_coeff *comp = &data->comp;
int32_t tmp_p0 = (1000000 / 2) * comp->c0;
int32_t tmp_p1 =
(((int64_t)1000000) * comp->c1 * tmp_raw) / IFX_DPS310_SF_TMP;
int32_t tmp_final = tmp_p0 + tmp_p1;
data->tmp_val1 = tmp_final / 1000000;
data->tmp_val2 = tmp_final % 1000000;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* ADC Enable Continuous Conversion Mode.
In this mode the ADC starts a new conversion of a single channel or a channel group immediately following completion of the previous channel group conversion. */ | void adc_set_continuous_conversion_mode(uint32_t adc) | /* ADC Enable Continuous Conversion Mode.
In this mode the ADC starts a new conversion of a single channel or a channel group immediately following completion of the previous channel group conversion. */
void adc_set_continuous_conversion_mode(uint32_t adc) | {
ADC_CR2(adc) |= ADC_CR2_CONT;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Returns 0 on success, or -EBUSY if the MAS requested aren't available. */ | int uwb_drp_avail_reserve_pending(struct uwb_rc *rc, struct uwb_mas_bm *mas) | /* Returns 0 on success, or -EBUSY if the MAS requested aren't available. */
int uwb_drp_avail_reserve_pending(struct uwb_rc *rc, struct uwb_mas_bm *mas) | {
struct uwb_mas_bm avail;
uwb_drp_available(rc, &avail);
if (!bitmap_subset(mas->bm, avail.bm, UWB_NUM_MAS))
return -EBUSY;
bitmap_andnot(rc->drp_avail.pending, rc->drp_avail.pending, mas->bm, UWB_NUM_MAS);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* USART initialization function.
Enables USART peripheral, clocks and initializes USART driver */ | void TARGET_IO_init(void) | /* USART initialization function.
Enables USART peripheral, clocks and initializes USART driver */
void TARGET_IO_init(void) | {
TARGET_IO_CLOCK_init();
usart_async_init(&TARGET_IO, SERCOM4, TARGET_IO_buffer, TARGET_IO_BUFFER_SIZE, (void *)NULL);
TARGET_IO_PORT_init();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clear the PWM interrupt flag of the PWM module.
The */ | void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | /* Clear the PWM interrupt flag of the PWM module.
The */
void PWMIntFlagClear(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType) | {
unsigned long ulChannelTemp;
ulChannelTemp = ulChannel;
xASSERT((ulBase == PWMA_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5)));
xASSERT((ulIntType == PWM_INT_DUTY) || (ulIntType == PWM_INT_BRAKE) ||
(ulIntType == PWM_INT_PWM));
if(ulIntType == PWM_INT_PWM)
{
xHWREG(ulBase + PWM_PIIR) |= (PWM_PIER_PWMPIF0 << ulChannelTemp);
}
else if(ulIntType == PWM_INT_DUTY)
{
xHWREG(ulBase + PWM_PIIR) |= (PWM_PIER_PWMDIF0 << ulChannelTemp);
}
else
{
xHWREG(ulBase + PWM_PIIR) |= (PWM_PIER_BKF0 | PWM_PIER_BKF1);
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns: TRUE if the file type corresponds to a type that can be executable, FALSE otherwise. */ | gboolean g_content_type_can_be_executable(const gchar *type) | /* Returns: TRUE if the file type corresponds to a type that can be executable, FALSE otherwise. */
gboolean g_content_type_can_be_executable(const gchar *type) | {
g_return_val_if_fail (type != NULL, FALSE);
if (g_content_type_is_a (type, "application/x-executable") ||
g_content_type_is_a (type, "text/plain"))
return TRUE;
return FALSE;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Enter SPI Flash low power mode.
Enter SPI Flash low power mode */ | void spi_flash_enter_low_power_mode(void) | /* Enter SPI Flash low power mode.
Enter SPI Flash low power mode */
void spi_flash_enter_low_power_mode(void) | {
SPI_FLASH0->READ_CTRL.reg = SPI_FLASH_READ_CTRL_RDATA_COUNT(0x0);
SPI_FLASH0->CMD_BUFFER0.reg = SPI_FLASH_CMD_ENTER_LOW_POWER;
SPI_FLASH0->DIRECTION.reg = SPI_FLASH_DIRECTION_CMD;
SPI_FLASH0->DMA_START_ADDRESS.reg = 0x0;
SPI_FLASH0->TRANSACTION_CTRL.reg = \
SPI_FLASH_TRANSACTION_CTRL_FLASH_TRANS_START | \
SPI_FLASH_TRANSACTION_CTRL_CMD_COUNT(0x01);
while (SPI_FLASH0->IRQ_STATUS.bit.FLASH_TRANS_DONE != \
SPI_FLASH_IRQ_STATUS_FLASH_TRANS_DONE) {
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Start a transfer on an endpoint of current USB MSC device Used to send a CBW packet, DATA packet, or a CSW packet. */ | static void uhi_msc_transfer(usb_ep_t endp, uint8_t *payload, uint16_t payload_size, uhd_callback_trans_t callback_end) | /* Start a transfer on an endpoint of current USB MSC device Used to send a CBW packet, DATA packet, or a CSW packet. */
static void uhi_msc_transfer(usb_ep_t endp, uint8_t *payload, uint16_t payload_size, uhd_callback_trans_t callback_end) | {
if (!uhd_ep_run(uhi_msc_dev_sel->dev->address,
endp, false, payload, payload_size,
UHI_MSC_SCSI_TIMEOUT, callback_end)) {
uhi_msc_scsi_sub_callback(false);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Returns zero on success or %-ENOENT on failure. */ | int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, struct notifier_block *n) | /* Returns zero on success or %-ENOENT on failure. */
int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh, struct notifier_block *n) | {
unsigned long flags;
int ret;
spin_lock_irqsave(&nh->lock, flags);
ret = notifier_chain_unregister(&nh->head, n);
spin_unlock_irqrestore(&nh->lock, flags);
synchronize_rcu();
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* @cache: the cache to search @index: the number of the additonal index to search (0<=index<indexes_count) @bdev: the device the cache entry should belong to @key: the key in the index */ | struct mb_cache_entry* mb_cache_entry_find_first(struct mb_cache *cache, int index, struct block_device *bdev, unsigned int key) | /* @cache: the cache to search @index: the number of the additonal index to search (0<=index<indexes_count) @bdev: the device the cache entry should belong to @key: the key in the index */
struct mb_cache_entry* mb_cache_entry_find_first(struct mb_cache *cache, int index, struct block_device *bdev, unsigned int key) | {
unsigned int bucket = hash_long(key, cache->c_bucket_bits);
struct list_head *l;
struct mb_cache_entry *ce;
mb_assert(index < mb_cache_indexes(cache));
spin_lock(&mb_cache_spinlock);
l = cache->c_indexes_hash[index][bucket].next;
ce = __mb_cache_entry_find(l, &cache->c_indexes_hash[index][bucket],
index, bdev, key);
spin_unlock(&mb_cache_spinlock);
return ce;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.