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 |
|---|---|---|---|---|---|---|---|
/* Command response callback function for sd_ble_gattc_read BLE command.
Callback for decoding the command response return code. */ | static uint32_t gattc_read_rsp_dec(const uint8_t *p_buffer, uint16_t length) | /* Command response callback function for sd_ble_gattc_read BLE command.
Callback for decoding the command response return code. */
static uint32_t gattc_read_rsp_dec(const uint8_t *p_buffer, uint16_t length) | {
uint32_t result_code;
const uint32_t err_code = ble_gattc_read_rsp_dec(p_buffer, length, &result_code);
APP_ERROR_CHECK(err_code);
return result_code;
} | labapart/polymcu | C++ | null | 201 |
/* Called when opening the input device. This will submit the URB to the usb system so we start getting reports */ | static int gtco_input_open(struct input_dev *inputdev) | /* Called when opening the input device. This will submit the URB to the usb system so we start getting reports */
static int gtco_input_open(struct input_dev *inputdev) | {
struct gtco *device = input_get_drvdata(inputdev);
device->urbinfo->dev = device->usbdev;
if (usb_submit_urb(device->urbinfo, GFP_KERNEL))
return -EIO;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* DESCRIPTION Block the given device request queue to prevent from further processing until the started timer has expired or an related interrupt was received. */ | static void dasd_3990_erp_block_queue(struct dasd_ccw_req *erp, int expires) | /* DESCRIPTION Block the given device request queue to prevent from further processing until the started timer has expired or an related interrupt was received. */
static void dasd_3990_erp_block_queue(struct dasd_ccw_req *erp, int expires) | {
struct dasd_device *device = erp->startdev;
unsigned long flags;
DBF_DEV_EVENT(DBF_INFO, device,
"blocking request queue for %is", expires/HZ);
spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags);
dasd_device_set_stop_bits(device, DASD_STOPPED_PENDING);
spin_unlock_irqrestore(get_ccwdev_lock(device->cdev), flags);
erp->status = DASD_CQR_FILLED;
if (erp->block)
dasd_block_set_timer(erp->block, expires);
else
dasd_device_set_timer(device, expires);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The driver must have called iscsi_remove_session before calling this. */ | void iscsi_session_teardown(struct iscsi_cls_session *cls_session) | /* The driver must have called iscsi_remove_session before calling this. */
void iscsi_session_teardown(struct iscsi_cls_session *cls_session) | {
struct iscsi_session *session = cls_session->dd_data;
struct module *owner = cls_session->transport->owner;
struct Scsi_Host *shost = session->host;
iscsi_pool_free(&session->cmdpool);
kfree(session->password);
kfree(session->password_in);
kfree(session->username);
kfree(session->username_in);
kfree(session->targetname);
kfree(session->initiatorname);
kfree(session->ifacename);
iscsi_destroy_session(cls_session);
iscsi_host_dec_session_cnt(shost);
module_put(owner);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Functions for powering up/down the bay, puts the bay device into reset state as well */ | static void ohare_mb_power(struct media_bay_info *bay, int on_off) | /* Functions for powering up/down the bay, puts the bay device into reset state as well */
static void ohare_mb_power(struct media_bay_info *bay, int on_off) | {
if (on_off) {
MB_BIC(bay, OHARE_FCR, OH_BAY_RESET_N);
MB_BIC(bay, OHARE_FCR, OH_BAY_POWER_N);
} else {
MB_BIC(bay, OHARE_FCR, OH_BAY_DEV_MASK);
MB_BIC(bay, OHARE_FCR, OH_FLOPPY_ENABLE);
MB_BIS(bay, OHARE_FCR, OH_BAY_POWER_N);
MB_BIS(bay, OHARE_FCR, OH_BAY_RESET_N);
MB_BIS(bay, OHARE_FCR, OH_IDE1_RESET_N);
}
MB_BIC(bay, OHARE_MBCR, 0x00000F00);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return the maximum key which can be store into a radix tree with height HEIGHT. */ | static unsigned long radix_tree_maxindex(unsigned int height) | /* Return the maximum key which can be store into a radix tree with height HEIGHT. */
static unsigned long radix_tree_maxindex(unsigned int height) | {
return height_to_maxindex[height];
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the DMA interrupt flag of a channel. */ | xtBoolean DMAChannelIntFlagGet(unsigned long ulChannelID, unsigned long ulIntFlags) | /* Get the DMA interrupt flag of a channel. */
xtBoolean DMAChannelIntFlagGet(unsigned long ulChannelID, unsigned long ulIntFlags) | {
xASSERT(xDMAChannelIDValid(ulChannelID));
xASSERT(ulIntFlags == DMA_EVENT_TC);
return ((xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_DSR_BCR_DONE) | ulIntFlags)
? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* RETURNS: 0 when ATAPI DMA can be used nonzero otherwise */ | int atapi_check_dma(struct ata_queued_cmd *qc) | /* RETURNS: 0 when ATAPI DMA can be used nonzero otherwise */
int atapi_check_dma(struct ata_queued_cmd *qc) | {
struct ata_port *ap = qc->ap;
if (!(qc->dev->horkage & ATA_HORKAGE_ATAPI_MOD16_DMA) &&
unlikely(qc->nbytes & 15))
return 1;
if (ap->ops->check_atapi_dma)
return ap->ops->check_atapi_dma(qc);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns the transmit or the receive CRC register value for the specified SPI. */ | uint16_t SPI_GetCRCDat(SPI_Module *SPIx, uint8_t SPI_CRC) | /* Returns the transmit or the receive CRC register value for the specified SPI. */
uint16_t SPI_GetCRCDat(SPI_Module *SPIx, uint8_t SPI_CRC) | {
uint16_t crcreg = 0;
assert_param(IS_SPI_PERIPH(SPIx));
assert_param(IS_SPI_CRC(SPI_CRC));
if (SPI_CRC != SPI_CRC_RX)
{
crcreg = SPIx->CRCTDAT;
}
else
{
crcreg = SPIx->CRCRDAT;
}
return crcreg;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* @cmd: command block to be used for cancelling the HCAM */ | static void pmcraid_cancel_ccn(struct pmcraid_cmd *cmd) | /* @cmd: command block to be used for cancelling the HCAM */
static void pmcraid_cancel_ccn(struct pmcraid_cmd *cmd) | {
pmcraid_info("response for Cancel LDN CDB[0] = %x ioasc = %x\n",
cmd->ioa_cb->ioarcb.cdb[0],
le32_to_cpu(cmd->ioa_cb->ioasa.ioasc));
pmcraid_reinit_cmdblk(cmd);
pmcraid_cancel_hcam(cmd,
PMCRAID_HCAM_CODE_CONFIG_CHANGE,
pmcraid_ioa_shutdown);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the value of the speaker gain from the specified @ucontrol setting. */ | static int speaker_unmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | /* Set the value of the speaker gain from the specified @ucontrol setting. */
static int speaker_unmute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | {
spk_unmute_state(ucontrol->value.integer.value[0]);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* s2io_ethtool_getpause_data -Pause frame frame generation and reception. @sp : private member of the device structure, which is a pointer to the s2io_nic structure. @ep : pointer to the structure with pause parameters given by ethtool. Description: Returns the Pause frame generation and reception capability of the NIC. Return value: void */ | static void s2io_ethtool_getpause_data(struct net_device *dev, struct ethtool_pauseparam *ep) | /* s2io_ethtool_getpause_data -Pause frame frame generation and reception. @sp : private member of the device structure, which is a pointer to the s2io_nic structure. @ep : pointer to the structure with pause parameters given by ethtool. Description: Returns the Pause frame generation and reception capability of the NIC. Return value: void */
static void s2io_ethtool_getpause_data(struct net_device *dev, struct ethtool_pauseparam *ep) | {
u64 val64;
struct s2io_nic *sp = netdev_priv(dev);
struct XENA_dev_config __iomem *bar0 = sp->bar0;
val64 = readq(&bar0->rmac_pause_cfg);
if (val64 & RMAC_PAUSE_GEN_ENABLE)
ep->tx_pause = true;
if (val64 & RMAC_PAUSE_RX_ENABLE)
ep->rx_pause = true;
ep->autoneg = false;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return 1 if two futex_keys are equal, 0 otherwise. */ | static int match_futex(union futex_key *key1, union futex_key *key2) | /* Return 1 if two futex_keys are equal, 0 otherwise. */
static int match_futex(union futex_key *key1, union futex_key *key2) | {
return (key1 && key2
&& key1->both.word == key2->both.word
&& key1->both.ptr == key2->both.ptr
&& key1->both.offset == key2->both.offset);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function will take the led on board off. */ | void rt_hw_board_led_off(rt_uint32_t led) | /* This function will take the led on board off. */
void rt_hw_board_led_off(rt_uint32_t led) | {
led_data &= ~led;
XGpio_DiscreteWrite(&gpio_output, 1, led_data);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sets the ACMP channel used for capacative sensing. */ | void ACMP_CapsenseChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef channel) | /* Sets the ACMP channel used for capacative sensing. */
void ACMP_CapsenseChannelSet(ACMP_TypeDef *acmp, ACMP_Channel_TypeDef channel) | {
EFM_ASSERT(channel < _ACMP_INPUTSEL_NEGSEL_1V25);
SET_BIT_FIELD(acmp->INPUTSEL, _ACMP_INPUTSEL_POSSEL_MASK, channel,
_ACMP_INPUTSEL_POSSEL_SHIFT);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This function creates a new radio button group, allocating required memory and properly initializing the object. If there is not enough memory, the function returns NULL. The radio button group will keep a reference count for its members, and will be automatically destroyed when the last member is destroyed. */ | struct wtk_radio_group* wtk_radio_group_create(void) | /* This function creates a new radio button group, allocating required memory and properly initializing the object. If there is not enough memory, the function returns NULL. The radio button group will keep a reference count for its members, and will be automatically destroyed when the last member is destroyed. */
struct wtk_radio_group* wtk_radio_group_create(void) | {
struct wtk_radio_group *radio_group
= membag_alloc(sizeof(struct wtk_radio_group));
if (!radio_group) {
goto outofmem_radio_group;
}
radio_group->num_references = 0;
radio_group->selected = NULL;
return radio_group;
outofmem_radio_group:
return NULL;
} | memfault/zero-to-main | C++ | null | 200 |
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeUint16Add(IN UINT16 Augend, IN UINT16 Addend, OUT UINT16 *Result) | /* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT16_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint16Add(IN UINT16 Augend, IN UINT16 Addend, OUT UINT16 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (((UINT16)(Augend + Addend)) >= Augend) {
*Result = (UINT16)(Augend + Addend);
Status = RETURN_SUCCESS;
} else {
*Result = UINT16_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get the Interrupt status (High Threshold or Low Threshold Interrupt). */ | int32_t VEML6030_GetIntStatus(VEML6030_Object_t *pObj, uint32_t *status) | /* Get the Interrupt status (High Threshold or Low Threshold Interrupt). */
int32_t VEML6030_GetIntStatus(VEML6030_Object_t *pObj, uint32_t *status) | {
int32_t ret = 0;
uint16_t data = 0;
if (pObj == NULL)
{
ret = VEML6030_INVALID_PARAM;
}
else if(veml6030_read_reg(&pObj->Ctx, VEML6030_REG_ALS_INT, &data, 2)!=0)
{
ret = VEML6030_ERROR ;
}
else
{
if((data &0x8000) == 0x8000)
{
*status = VEML6030_INT_TH_HIGH;
}
else if((data &0x4000) == 0x4000)
{
*status = VEML6030_INT_TH_LOW;
}
else
{
*status = VEML6030_INT_TH_NONE;
}
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* iscsi_tcp_xmit_qlen - return the number of bytes queued for xmit */ | static int iscsi_sw_tcp_xmit_qlen(struct iscsi_conn *conn) | /* iscsi_tcp_xmit_qlen - return the number of bytes queued for xmit */
static int iscsi_sw_tcp_xmit_qlen(struct iscsi_conn *conn) | {
struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
struct iscsi_segment *segment = &tcp_sw_conn->out.segment;
return segment->total_copied - segment->total_size;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Locate an existing ppp unit. The caller should have locked the all_ppp_mutex. */ | static struct ppp * ppp_find_unit(struct ppp_net *pn, int unit) | /* Locate an existing ppp unit. The caller should have locked the all_ppp_mutex. */
static struct ppp * ppp_find_unit(struct ppp_net *pn, int unit) | {
return unit_find(&pn->units_idr, unit);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* See the Unified Extensible Firmware Interface (UEFI) specification for details. */ | static void EFIAPI efi_restore_tpl(efi_uintn_t old_tpl) | /* See the Unified Extensible Firmware Interface (UEFI) specification for details. */
static void EFIAPI efi_restore_tpl(efi_uintn_t old_tpl) | {
EFI_ENTRY("0x%zx", old_tpl);
if (old_tpl > efi_tpl)
EFI_PRINT("WARNING: old_tpl > current_tpl in %s\n", __func__);
efi_tpl = old_tpl;
if (efi_tpl > TPL_HIGH_LEVEL)
efi_tpl = TPL_HIGH_LEVEL;
efi_timer_check();
EFI_EXIT(EFI_SUCCESS);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI CryptoServiceRsaCheckKey(IN VOID *RsaContext) | /* If RsaContext is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceRsaCheckKey(IN VOID *RsaContext) | {
return CALL_BASECRYPTLIB (Rsa.Services.CheckKey, RsaCheckKey, (RsaContext), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If FirstString is NULL, then ASSERT(). If SecondString is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and FirstString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and SecondString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). */ | INTN EFIAPI AsciiStriCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString) | /* If FirstString is NULL, then ASSERT(). If SecondString is NULL, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and FirstString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). If PcdMaximumAsciiStringLength is not zero and SecondString contains more than PcdMaximumAsciiStringLength ASCII characters, not including the Null-terminator, then ASSERT(). */
INTN EFIAPI AsciiStriCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString) | {
CHAR8 UpperFirstString;
CHAR8 UpperSecondString;
ASSERT (AsciiStrSize (FirstString));
ASSERT (AsciiStrSize (SecondString));
UpperFirstString = AsciiCharToUpper (*FirstString);
UpperSecondString = AsciiCharToUpper (*SecondString);
while ((*FirstString != '\0') && (*SecondString != '\0') && (UpperFirstString == UpperSecondString)) {
FirstString++;
SecondString++;
UpperFirstString = AsciiCharToUpper (*FirstString);
UpperSecondString = AsciiCharToUpper (*SecondString);
}
return UpperFirstString - UpperSecondString;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* 'find_public()' - Find a public function, type, etc. */ | static mxml_node_t * find_public(mxml_node_t *node, mxml_node_t *top, const char *name) | /* 'find_public()' - Find a public function, type, etc. */
static mxml_node_t * find_public(mxml_node_t *node, mxml_node_t *top, const char *name) | {
mxml_node_t *description,
*comment;
for (node = mxmlFindElement(node, top, name, NULL, NULL,
node == top ? MXML_DESCEND_FIRST :
MXML_NO_DESCEND);
node;
node = mxmlFindElement(node, top, name, NULL, NULL, MXML_NO_DESCEND))
{
description = mxmlFindElement(node, node, "description", NULL, NULL,
MXML_DESCEND_FIRST);
if (!description)
continue;
for (comment = description->child; comment; comment = comment->next)
if ((comment->type == MXML_TEXT &&
strstr(comment->value.text.string, "@private@")) ||
(comment->type == MXML_OPAQUE &&
strstr(comment->value.opaque, "@private@")))
break;
if (!comment)
{
return (node);
}
}
return (NULL);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* gameport_disconnect_port() unbinds a port from its driver. As a side effect all child ports are unbound and destroyed. */ | static void gameport_disconnect_port(struct gameport *gameport) | /* gameport_disconnect_port() unbinds a port from its driver. As a side effect all child ports are unbound and destroyed. */
static void gameport_disconnect_port(struct gameport *gameport) | {
struct gameport *s, *parent;
if (gameport->child) {
for (s = gameport; s->child; s = s->child);
do {
parent = s->parent;
device_release_driver(&s->dev);
gameport_destroy_port(s);
} while ((s = parent) != gameport);
}
device_release_driver(&gameport->dev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables LPUART Wakeup in STOP2 mode. */ | void LPUART_EnableWakeUpStop(FunctionalState Cmd) | /* Enables or disables LPUART Wakeup in STOP2 mode. */
void LPUART_EnableWakeUpStop(FunctionalState Cmd) | {
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
LPUART->CTRL |= CTRL_WUSTP_SET;
}
else
{
LPUART->CTRL &= CTRL_WUSTP_RESET;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set the clock rate of the specified I2C port.
The */ | void I2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk) | /* Set the clock rate of the specified I2C port.
The */
void I2CMasterInit(unsigned long ulBase, unsigned long ulI2CClk) | {
unsigned long ulHclk;
unsigned long ulDiv;
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
if (ulBase == I2C0_BASE)
{
SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0);
}
xHWREG(ulBase + I2C_O_CON) = I2C_CON_ENS1;
ulHclk = SysCtlHClockGet();
ulDiv = (unsigned long) (((ulHclk * 10)/(ulI2CClk * 4) + 5) / 10 - 1);
xHWREG(ulBase + I2C_O_CLK) = ulDiv;
xHWREG(ulBase + I2C_O_CON) = 0;
xHWREG(ulBase + I2C_O_CON) = I2C_CON_ENS1;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Context: This function must not be called in interrupt context. */ | void isc_unregister(unsigned int isc) | /* Context: This function must not be called in interrupt context. */
void isc_unregister(unsigned int isc) | {
spin_lock(&isc_ref_lock);
if (isc > MAX_ISC || isc_refs[isc] == 0) {
WARN_ON(1);
goto out_unlock;
}
if (isc_refs[isc] == 1)
ctl_clear_bit(6, 31 - isc);
isc_refs[isc]--;
out_unlock:
spin_unlock(&isc_ref_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* put a byte (8bits) to a pointer
Caller should ensure parameters are valid. */ | void BytesPut8(void *ptr, uint8_t v) | /* put a byte (8bits) to a pointer
Caller should ensure parameters are valid. */
void BytesPut8(void *ptr, uint8_t v) | {
uint8_t *p = (uint8_t *)ptr;
p[0] = v;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or Disables the TimeStamp on Tamper Detection Event. */ | void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState) | /* Enables or Disables the TimeStamp on Tamper Detection Event. */
void RTC_TimeStampOnTamperDetectionCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
RTC->TMPCFG |= (uint32_t)RTC_TMPCFG_TPTS;
}
else
{
RTC->TMPCFG &= (uint32_t)~RTC_TMPCFG_TPTS;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Since: 2.24 Returns: the new address of the allocated memory */ | gpointer g_realloc_n(gpointer mem, gsize n_blocks, gsize n_block_bytes) | /* Since: 2.24 Returns: the new address of the allocated memory */
gpointer g_realloc_n(gpointer mem, gsize n_blocks, gsize n_block_bytes) | {
if (SIZE_OVERFLOWS (n_blocks, n_block_bytes))
{
g_error ("%s: overflow allocating %"G_GSIZE_FORMAT"*%"G_GSIZE_FORMAT" bytes",
G_STRLOC, n_blocks, n_block_bytes);
}
return g_realloc (mem, n_blocks * n_block_bytes);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Check whether the CPU supports the GIC system register interface (any version) */ | BOOLEAN EFIAPI ArmHasGicSystemRegisters(VOID) | /* Check whether the CPU supports the GIC system register interface (any version) */
BOOLEAN EFIAPI ArmHasGicSystemRegisters(VOID) | {
return ((ArmReadIdPfr1 () & ARM_PFR1_GIC) != 0);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns 1 if the passed-in block region (start_blk, start_blk+count) is valid; 0 if some part of the block region overlaps with filesystem metadata blocks. */ | int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk, unsigned int count) | /* Returns 1 if the passed-in block region (start_blk, start_blk+count) is valid; 0 if some part of the block region overlaps with filesystem metadata blocks. */
int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk, unsigned int count) | {
struct ext4_system_zone *entry;
struct rb_node *n = sbi->system_blks.rb_node;
if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) ||
(start_blk + count < start_blk) ||
(start_blk + count > ext4_blocks_count(sbi->s_es)))
return 0;
while (n) {
entry = rb_entry(n, struct ext4_system_zone, node);
if (start_blk + count - 1 < entry->start_blk)
n = n->rb_left;
else if (start_blk >= (entry->start_blk + entry->count))
n = n->rb_right;
else
return 0;
}
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* deinitialize the host pipes used for the HID class */ | void usbh_hid_itf_deinit(usbh_host *uhost) | /* deinitialize the host pipes used for the HID class */
void usbh_hid_itf_deinit(usbh_host *uhost) | {
usbh_hid_handler *hid = (usbh_hid_handler *)uhost->active_class->class_data;
if (0x00U != hid->pipe_in) {
usb_pipe_halt (uhost->data, hid->pipe_in);
usbh_pipe_free (uhost->data, hid->pipe_in);
hid->pipe_in = 0U;
}
if (0x00U != hid->pipe_out) {
usb_pipe_halt (uhost->data, hid->pipe_out);
usbh_pipe_free (uhost->data, hid->pipe_out);
hid->pipe_out = 0U;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Returns a property from the given offset of the property. */ | CONST struct fdt_property* EFIAPI FdtGetPropertyByOffset(IN CONST VOID *Fdt, IN INT32 Offset, IN INT32 *Length) | /* Returns a property from the given offset of the property. */
CONST struct fdt_property* EFIAPI FdtGetPropertyByOffset(IN CONST VOID *Fdt, IN INT32 Offset, IN INT32 *Length) | {
return fdt_get_property_by_offset (Fdt, Offset, Length);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* ibmvfc_set_tgt_action - Set the next init action for the target @tgt: ibmvfc target struct @action: action to perform */ | static void ibmvfc_set_tgt_action(struct ibmvfc_target *tgt, enum ibmvfc_target_action action) | /* ibmvfc_set_tgt_action - Set the next init action for the target @tgt: ibmvfc target struct @action: action to perform */
static void ibmvfc_set_tgt_action(struct ibmvfc_target *tgt, enum ibmvfc_target_action action) | {
switch (tgt->action) {
case IBMVFC_TGT_ACTION_DEL_RPORT:
break;
default:
if (action == IBMVFC_TGT_ACTION_DEL_RPORT)
tgt->add_rport = 0;
tgt->action = action;
break;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the TIMER Capture Compare Channel x. */ | static void timer_ccx_channel_cmd(TIMER_TypeDef *TIMERx, ald_timer_channel_t ch, type_func_t state) | /* Enables or disables the TIMER Capture Compare Channel x. */
static void timer_ccx_channel_cmd(TIMER_TypeDef *TIMERx, ald_timer_channel_t ch, type_func_t state) | {
assert_param(IS_TIMER_CC2_INSTANCE(TIMERx));
assert_param(IS_TIMER_CHANNELS(ch));
switch (ch) {
case ALD_TIMER_CHANNEL_1:
MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC1EN_MSK, state << TIMER_CCEP_CC1EN_POS);
break;
case ALD_TIMER_CHANNEL_2:
MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC2EN_MSK, state << TIMER_CCEP_CC2EN_POS);
break;
case ALD_TIMER_CHANNEL_3:
MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC3EN_MSK, state << TIMER_CCEP_CC3EN_POS);
break;
case ALD_TIMER_CHANNEL_4:
MODIFY_REG(TIMERx->CCEP, TIMER_CCEP_CC4EN_MSK, state << TIMER_CCEP_CC4EN_POS);
break;
default:
break;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* buffer_icap_device_read - Transfer bytes from ICAP to the storage buffer. @drvdata: a pointer to the drvdata. @offset: The storage buffer start address. @count: The number of words (32 bit) to read from the device (ICAP). */ | static int buffer_icap_device_read(struct hwicap_drvdata *drvdata, u32 offset, u32 count) | /* buffer_icap_device_read - Transfer bytes from ICAP to the storage buffer. @drvdata: a pointer to the drvdata. @offset: The storage buffer start address. @count: The number of words (32 bit) to read from the device (ICAP). */
static int buffer_icap_device_read(struct hwicap_drvdata *drvdata, u32 offset, u32 count) | {
s32 retries = 0;
void __iomem *base_address = drvdata->base_address;
if (buffer_icap_busy(base_address))
return -EBUSY;
if ((offset + count) > XHI_MAX_BUFFER_INTS)
return -EINVAL;
buffer_icap_set_size(base_address, (count << 2));
buffer_icap_set_offset(base_address, offset);
buffer_icap_set_rnc(base_address, XHI_READBACK);
while (buffer_icap_busy(base_address)) {
retries++;
if (retries > XHI_MAX_RETRIES)
return -EBUSY;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures the ST25DV ITtime duration for the GPO pulse.
Needs the I2C Password presentation to be effective. */ | int32_t BSP_NFCTAG_WriteITPulse(uint32_t Instance, const ST25DV_PULSE_DURATION ITtime) | /* Configures the ST25DV ITtime duration for the GPO pulse.
Needs the I2C Password presentation to be effective. */
int32_t BSP_NFCTAG_WriteITPulse(uint32_t Instance, const ST25DV_PULSE_DURATION ITtime) | {
UNUSED(Instance);
return ST25DV_WriteITPulse(&NfcTagObj, ITtime);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Returns CR_OK upon successfull completion, an error code if something bad happened. */ | enum CRStatus cr_statement_ruleset_get_declarations(CRStatement *a_this, CRDeclaration **a_decl_list) | /* Returns CR_OK upon successfull completion, an error code if something bad happened. */
enum CRStatus cr_statement_ruleset_get_declarations(CRStatement *a_this, CRDeclaration **a_decl_list) | {
g_return_val_if_fail (a_this
&& a_this->type == RULESET_STMT
&& a_this->kind.ruleset
&& a_decl_list, CR_BAD_PARAM_ERROR);
*a_decl_list = a_this->kind.ruleset->decl_list;
return CR_OK;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Free the root bridge instances array returned from */ | VOID EFIAPI PciHostBridgeFreeRootBridges(PCI_ROOT_BRIDGE *Bridges, UINTN Count) | /* Free the root bridge instances array returned from */
VOID EFIAPI PciHostBridgeFreeRootBridges(PCI_ROOT_BRIDGE *Bridges, UINTN Count) | {
PciHostBridgeUtilityFreeRootBridges (Bridges, Count);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* clone buffer for upper or lower layer, because original buffer should be stored in l2cap */ | RTK_BUFFER* RtbCloneBuffer(IN RTK_BUFFER *pDataBuffer) | /* clone buffer for upper or lower layer, because original buffer should be stored in l2cap */
RTK_BUFFER* RtbCloneBuffer(IN RTK_BUFFER *pDataBuffer) | {
RTK_BUFFER* pNewBuffer = NULL;
if(pDataBuffer)
{
pNewBuffer = RtbAllocate(pDataBuffer->Length,0);
if(!pNewBuffer)
{
return NULL;
}
if(pDataBuffer && pDataBuffer->Data)
memcpy(pNewBuffer->Data, pDataBuffer->Data, pDataBuffer->Length);
else
{
RtbFree(pNewBuffer);
return NULL;
}
pNewBuffer->Length = pDataBuffer->Length;
}
return pNewBuffer;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Parse the flags string from a .flags attribute list into the vartype enum. */ | enum env_flags_vartype env_flags_parse_vartype(const char *flags) | /* Parse the flags string from a .flags attribute list into the vartype enum. */
enum env_flags_vartype env_flags_parse_vartype(const char *flags) | {
char *type;
if (strlen(flags) <= ENV_FLAGS_VARTYPE_LOC)
return env_flags_vartype_string;
type = strchr(env_flags_vartype_rep,
flags[ENV_FLAGS_VARTYPE_LOC]);
if (type != NULL)
return (enum env_flags_vartype)
(type - &env_flags_vartype_rep[0]);
printf("## Warning: Unknown environment variable type '%c'\n",
flags[ENV_FLAGS_VARTYPE_LOC]);
return env_flags_vartype_string;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Read a sequence of DPORT registers to the buffer, SMP-safe version.
This implementation uses a method of the pre-reading of the APB register before reading the register of the DPORT, without stall other CPU. There is disable/enable interrupt. */ | void IRAM_ATTR esp_dport_access_read_buffer(uint32_t *buff_out, uint32_t address, uint32_t num_words) | /* Read a sequence of DPORT registers to the buffer, SMP-safe version.
This implementation uses a method of the pre-reading of the APB register before reading the register of the DPORT, without stall other CPU. There is disable/enable interrupt. */
void IRAM_ATTR esp_dport_access_read_buffer(uint32_t *buff_out, uint32_t address, uint32_t num_words) | {
DPORT_INTERRUPT_DISABLE();
for (uint32_t i = 0; i < num_words; ++i) {
buff_out[i] = DPORT_SEQUENCE_REG_READ(address + i * 4);
}
DPORT_INTERRUPT_RESTORE();
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* Clear All Status Flags.
Clears program error, end of operation, busy flags. */ | void flash_clear_status_flags(void) | /* Clear All Status Flags.
Clears program error, end of operation, busy flags. */
void flash_clear_status_flags(void) | {
flash_clear_pgperr_flag();
flash_clear_eop_flag();
flash_clear_bsy_flag();
}
/**@} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* When the velocity hardware is unloaded this function is called. It will clean up the notifiers and the unregister the PCI driver interface for this hardware. This in turn cleans up all discovered interfaces before returning from the function */ | static void __exit velocity_cleanup_module(void) | /* When the velocity hardware is unloaded this function is called. It will clean up the notifiers and the unregister the PCI driver interface for this hardware. This in turn cleans up all discovered interfaces before returning from the function */
static void __exit velocity_cleanup_module(void) | {
velocity_unregister_notifier();
pci_unregister_driver(&velocity_driver);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks if the given audio group contains a beep generator @regs: HDA registers @nid: Node ID to check */ | static int audio_group_has_beep_node(struct hda_regs *regs, uint nid) | /* Checks if the given audio group contains a beep generator @regs: HDA registers @nid: Node ID to check */
static int audio_group_has_beep_node(struct hda_regs *regs, uint nid) | {
uint response;
int ret;
ret = exec_verb(regs, hda_verb(nid, HDA_VERB_GET_PARAMS,
GET_PARAMS_AUDIO_GROUP_CAPS),
&response);
if (ret < 0) {
printf("Audio: Error reading audio group caps %d\n", nid);
return 0;
}
return !!(response & AUDIO_GROUP_CAPS_BEEP_GEN);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* kobject_del - unlink kobject from hierarchy. @kobj: object. */ | void kobject_del(struct kobject *kobj) | /* kobject_del - unlink kobject from hierarchy. @kobj: object. */
void kobject_del(struct kobject *kobj) | {
if (!kobj)
return;
sysfs_remove_dir(kobj);
kobj->state_in_sysfs = 0;
kobj_kset_leave(kobj);
kobject_put(kobj->parent);
kobj->parent = NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If SPDIF capture and slaved to SPDIF-IN, setting runtime rate to the external rate */ | static void juli_spdif_in_open(struct snd_ice1712 *ice, struct snd_pcm_substream *substream) | /* If SPDIF capture and slaved to SPDIF-IN, setting runtime rate to the external rate */
static void juli_spdif_in_open(struct snd_ice1712 *ice, struct snd_pcm_substream *substream) | {
struct juli_spec *spec = ice->spec;
struct snd_pcm_runtime *runtime = substream->runtime;
int rate;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK ||
!ice->is_spdif_master(ice))
return;
rate = snd_ak4114_external_rate(spec->ak4114);
if (rate >= runtime->hw.rate_min && rate <= runtime->hw.rate_max) {
runtime->hw.rate_min = rate;
runtime->hw.rate_max = rate;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disabling interrupts for the entire performance monitoring unit. */ | void ps3_disable_pm_interrupts(u32 cpu) | /* Disabling interrupts for the entire performance monitoring unit. */
void ps3_disable_pm_interrupts(u32 cpu) | {
ps3_get_and_clear_pm_interrupts(cpu);
ps3_write_pm(cpu, pm_status, 0);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Return TRUE if port is online, else return FALSE */ | bfa_boolean_t bfa_fcs_port_is_online(struct bfa_fcs_port_s *port) | /* Return TRUE if port is online, else return FALSE */
bfa_boolean_t bfa_fcs_port_is_online(struct bfa_fcs_port_s *port) | {
return bfa_sm_cmp_state(port, bfa_fcs_port_sm_online);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Functons for CSS ID. To get ID other than 0, this should be called when !cgroup_is_removed(). */ | unsigned short css_id(struct cgroup_subsys_state *css) | /* Functons for CSS ID. To get ID other than 0, this should be called when !cgroup_is_removed(). */
unsigned short css_id(struct cgroup_subsys_state *css) | {
struct css_id *cssid = rcu_dereference(css->id);
if (cssid)
return cssid->id;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This function sets the amount of time to wait before firing the watchdog timer to TimerPeriod 100 ns units. If TimerPeriod is 0, then the watchdog timer is disabled. */ | EFI_STATUS EFIAPI WatchdogTimerDriverSetTimerPeriod(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod) | /* This function sets the amount of time to wait before firing the watchdog timer to TimerPeriod 100 ns units. If TimerPeriod is 0, then the watchdog timer is disabled. */
EFI_STATUS EFIAPI WatchdogTimerDriverSetTimerPeriod(IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, IN UINT64 TimerPeriod) | {
mWatchdogTimerPeriod = TimerPeriod;
return gBS->SetTimer (
mWatchdogTimerEvent,
(mWatchdogTimerPeriod == 0) ? TimerCancel : TimerRelative,
mWatchdogTimerPeriod
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */ | EFI_STATUS EFIAPI SdBlockIoPeimReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer) | /* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */
EFI_STATUS EFIAPI SdBlockIoPeimReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer) | {
EFI_STATUS Status;
SD_PEIM_HC_PRIVATE_DATA *Private;
Status = EFI_SUCCESS;
Private = GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
Status = SdBlockIoPeimReadBlocks (
PeiServices,
&Private->BlkIoPpi,
DeviceIndex,
StartLBA,
BufferSize,
Buffer
);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return all enabled IOS Interrupts.
This function may be used to return all enabled IOS interrupts. */ | uint32_t am_hal_ios_int_enable_get(void) | /* Return all enabled IOS Interrupts.
This function may be used to return all enabled IOS interrupts. */
uint32_t am_hal_ios_int_enable_get(void) | {
return AM_REG(IOSLAVE, INTEN);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* psmouse_initialize() initializes the mouse to a sane state. */ | static void psmouse_initialize(struct psmouse *psmouse) | /* psmouse_initialize() initializes the mouse to a sane state. */
static void psmouse_initialize(struct psmouse *psmouse) | {
if (psmouse_max_proto != PSMOUSE_PS2) {
psmouse->set_rate(psmouse, psmouse->rate);
psmouse->set_resolution(psmouse, psmouse->resolution);
ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Opens an endpoint of the low level driver. */ | USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps) | /* Opens an endpoint of the low level driver. */
USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps) | {
HAL_StatusTypeDef hal_status = HAL_OK;
USBD_StatusTypeDef usb_status = USBD_OK;
hal_status = HAL_PCD_EP_Open(pdev->pData, ep_addr, ep_mps, ep_type);
usb_status = USBD_Get_USB_Status(hal_status);
return usb_status;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This function will enable Bandgap self bias feature before powering down or there will be risk of Bandgap not starting properly. */ | void PMU_EnableBandgapSelfBiasBeforePowerDown(void) | /* This function will enable Bandgap self bias feature before powering down or there will be risk of Bandgap not starting properly. */
void PMU_EnableBandgapSelfBiasBeforePowerDown(void) | {
uint32_t temp32;
temp32 = ANATOP_AI_Read(kAI_Itf_Bandgap, kAI_BANDGAP_CTRL0);
temp32 &= ~AI_BANDGAP_CTRL0_REFTOP_SELFBIASOFF_MASK;
ANATOP_AI_Write(kAI_Itf_Bandgap, kAI_BANDGAP_CTRL0, temp32);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Register/Clear TX wakeup callback.
This function is usually invoked with NULL callback from the TX wakeup callback itself, to unregister. Once the callback has resumed the application task, there is no need to invoke the callback again. */ | uint8_t gmac_dev_set_tx_wakeup_callback(gmac_device_t *p_gmac_dev, gmac_dev_wakeup_cb_t func_wakeup_cb, uint8_t uc_threshold) | /* Register/Clear TX wakeup callback.
This function is usually invoked with NULL callback from the TX wakeup callback itself, to unregister. Once the callback has resumed the application task, there is no need to invoke the callback again. */
uint8_t gmac_dev_set_tx_wakeup_callback(gmac_device_t *p_gmac_dev, gmac_dev_wakeup_cb_t func_wakeup_cb, uint8_t uc_threshold) | {
if (func_wakeup_cb == NULL) {
p_gmac_dev->func_wakeup_cb = NULL;
} else {
if (uc_threshold <= p_gmac_dev->us_tx_list_size) {
p_gmac_dev->func_wakeup_cb = func_wakeup_cb;
p_gmac_dev->uc_wakeup_threshold = uc_threshold;
} else {
return GMAC_PARAM;
}
}
return GMAC_OK;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* The counter can either count up by 1 or count down by 1. If the physical performance counter counts by a larger increment, then the counter values must be translated. The properties of the counter can be retrieved from */ | UINT64 EFIAPI GetPerformanceCounter(VOID) | /* The counter can either count up by 1 or count down by 1. If the physical performance counter counts by a larger increment, then the counter values must be translated. The properties of the counter can be retrieved from */
UINT64 EFIAPI GetPerformanceCounter(VOID) | {
return (UINT64)(UINT32)InternalX86GetTimerTick (InternalX86GetApicBase ());
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param count Number of bytes received so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count. */ | status_t FLEXIO_UART_TransferGetReceiveCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count) | /* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param count Number of bytes received so far by the non-blocking transaction. retval kStatus_NoTransferInProgress transfer has finished or no transfer in progress. retval kStatus_Success Successfully return the count. */
status_t FLEXIO_UART_TransferGetReceiveCount(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, size_t *count) | {
assert(handle != NULL);
assert(count != NULL);
if ((uint8_t)kFLEXIO_UART_RxIdle == handle->rxState)
{
return kStatus_NoTransferInProgress;
}
*count = handle->rxDataSizeAll - handle->rxDataSize;
return kStatus_Success;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* this function is a POSIX compliant version, which will close the open file descriptor. */ | int close(int fd) | /* this function is a POSIX compliant version, which will close the open file descriptor. */
int close(int fd) | {
int result;
struct dfs_file *file;
file = fd_get(fd);
if (file == NULL)
{
rt_set_errno(-EBADF);
return -1;
}
result = dfs_file_close(file);
if (result < 0)
{
rt_set_errno(result);
return -1;
}
fd_release(fd);
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Since Signature and WriteQueueSize have been known, Crc can be calculated out, then the work space header will be fixed. */ | VOID InitializeLocalWorkSpaceHeader(IN UINTN WorkSpaceLength) | /* Since Signature and WriteQueueSize have been known, Crc can be calculated out, then the work space header will be fixed. */
VOID InitializeLocalWorkSpaceHeader(IN UINTN WorkSpaceLength) | {
if (CompareGuid (&gEdkiiWorkingBlockSignatureGuid, &mWorkingBlockHeader.Signature)) {
return;
}
SetMem (
&mWorkingBlockHeader,
sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER),
FTW_ERASED_BYTE
);
CopyMem (
&mWorkingBlockHeader.Signature,
&gEdkiiWorkingBlockSignatureGuid,
sizeof (EFI_GUID)
);
mWorkingBlockHeader.WriteQueueSize = WorkSpaceLength - sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER);
mWorkingBlockHeader.Crc = FtwCalculateCrc32 (
&mWorkingBlockHeader,
sizeof (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER)
);
mWorkingBlockHeader.WorkingBlockValid = FTW_VALID_STATE;
mWorkingBlockHeader.WorkingBlockInvalid = FTW_INVALID_STATE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* remove_descriptors informs the card the descriptors are no longer valid by setting the address in the card to 0x00. */ | static void remove_descriptors(struct xircom_private *card) | /* remove_descriptors informs the card the descriptors are no longer valid by setting the address in the card to 0x00. */
static void remove_descriptors(struct xircom_private *card) | {
unsigned int val;
enter("remove_descriptors");
val = 0;
outl(val, card->io_port + CSR3);
outl(val, card->io_port + CSR4);
leave("remove_descriptors");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set clocks for bypass mode for reboot to work. */ | void omap2_clk_prepare_for_reboot(void) | /* Set clocks for bypass mode for reboot to work. */
void omap2_clk_prepare_for_reboot(void) | {
u32 rate;
if (vclk == NULL || sclk == NULL)
return;
rate = clk_get_rate(sclk);
clk_set_rate(vclk, rate);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* USART RS485 mode configuration.
Configure USART in RS485 mode, asynchronous, 8 bits, 1 stop bit, no parity, 256000 bauds and enable its transmitter and receiver. */ | static void configure_usart(void) | /* USART RS485 mode configuration.
Configure USART in RS485 mode, asynchronous, 8 bits, 1 stop bit, no parity, 256000 bauds and enable its transmitter and receiver. */
static void configure_usart(void) | {
const sam_usart_opt_t usart_console_settings = {
BOARD_USART_BAUDRATE,
US_MR_CHRL_8_BIT,
US_MR_PAR_NO,
US_MR_NBSTOP_1_BIT,
US_MR_CHMODE_NORMAL,
0
};
sysclk_enable_peripheral_clock(BOARD_ID_USART);
usart_init_rs485(BOARD_USART, &usart_console_settings,
sysclk_get_peripheral_bus_hz(BOARD_USART));
usart_disable_interrupt(BOARD_USART, ALL_INTERRUPT_MASK);
usart_enable_tx(BOARD_USART);
usart_enable_rx(BOARD_USART);
NVIC_EnableIRQ(USART_IRQn);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Returns pointer to buffer where information was written. */ | const char* mptscsih_info(struct Scsi_Host *SChost) | /* Returns pointer to buffer where information was written. */
const char* mptscsih_info(struct Scsi_Host *SChost) | {
MPT_SCSI_HOST *h;
int size = 0;
h = shost_priv(SChost);
if (h) {
if (h->info_kbuf == NULL)
if ((h->info_kbuf = kmalloc(0x1000, GFP_KERNEL)) == NULL)
return h->info_kbuf;
h->info_kbuf[0] = '\0';
mpt_print_ioc_summary(h->ioc, h->info_kbuf, &size, 0, 0);
h->info_kbuf[size-1] = '\0';
}
return h->info_kbuf;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deinitializes the SPIx peripheral registers to their default reset values (Affects also the I2Ss). */ | void SPI_I2S_DeInit(SPI_TypeDef *SPIx) | /* Deinitializes the SPIx peripheral registers to their default reset values (Affects also the I2Ss). */
void SPI_I2S_DeInit(SPI_TypeDef *SPIx) | {
assert_param(IS_SPI_ALL_PERIPH(SPIx));
if (SPIx == SPI1)
{
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, ENABLE);
RCC_APB2PeriphResetCmd(RCC_APB2Periph_SPI1, DISABLE);
}
else if (SPIx == SPI2)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI2, DISABLE);
}
else
{
if (SPIx == SPI3)
{
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_SPI3, DISABLE);
}
}
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* This function must be called before emac_open() if you want to override the default mac address. */ | void davinci_eth_set_mac_addr(const u_int8_t *addr) | /* This function must be called before emac_open() if you want to override the default mac address. */
void davinci_eth_set_mac_addr(const u_int8_t *addr) | {
int i;
for (i = 0; i < sizeof (davinci_eth_mac_addr); i++) {
davinci_eth_mac_addr[i] = addr[i];
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* These functions support sending signals using preallocated sigqueue structures. This is needed "because realtime applications cannot afford to lose notifications of asynchronous events, like timer expirations or I/O completions". In the case of Posix Timers we allocate the sigqueue structure from the timer_create. If this allocation fails we are able to report the failure to the application with an EAGAIN error. */ | struct sigqueue* sigqueue_alloc(void) | /* These functions support sending signals using preallocated sigqueue structures. This is needed "because realtime applications cannot afford to lose notifications of asynchronous events, like timer expirations or I/O completions". In the case of Posix Timers we allocate the sigqueue structure from the timer_create. If this allocation fails we are able to report the failure to the application with an EAGAIN error. */
struct sigqueue* sigqueue_alloc(void) | {
struct sigqueue *q = __sigqueue_alloc(-1, current, GFP_KERNEL, 0);
if (q)
q->flags |= SIGQUEUE_PREALLOC;
return q;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read Line6 device serial number. (POD, TonePort, GuitarPort) */ | int line6_read_serial_number(struct usb_line6 *line6, int *serial_number) | /* Read Line6 device serial number. (POD, TonePort, GuitarPort) */
int line6_read_serial_number(struct usb_line6 *line6, int *serial_number) | {
return line6_read_data(line6, 0x80d0, serial_number, sizeof(*serial_number));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base SPDIF base pointer. param buffer Pointer to the data to be read. param size Bytes to be read. */ | void SPDIF_ReadBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size) | /* param base SPDIF base pointer. param buffer Pointer to the data to be read. param size Bytes to be read. */
void SPDIF_ReadBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size) | {
assert(buffer != NULL);
assert((size % 6U) == 0U);
uint32_t i = 0, j = 0, data = 0;
while (i < size)
{
while ((SPDIF_GetStatusFlag(base) & (uint32_t)kSPDIF_RxFIFOFull) == 0x00U)
{
}
data = SPDIF_ReadLeftData(base);
for (j = 0; j < 3U; j++)
{
*buffer = ((uint8_t)(data >> (j * 8U)) & 0xFFU);
buffer++;
}
data = SPDIF_ReadRightData(base);
for (j = 0; j < 3U; j++)
{
*buffer = ((uint8_t)(data >> (j * 8U)) & 0xFFU);
buffer++;
}
i += 6U;
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Return PWM channel number according to pin name. */ | u32 pwmout_pin2chan(PinName pin) | /* Return PWM channel number according to pin name. */
u32 pwmout_pin2chan(PinName pin) | {
int i = 0;
for(;i < 19;i++){
if(pin2chan[i][0] == pin){
return (pin2chan[i][2] | BIT_PWM_TIM_IDX_FLAG);
}
}
return NC;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Called on initialization to set up the /proc/device-tree subtree */ | void __init proc_device_tree_init(void) | /* Called on initialization to set up the /proc/device-tree subtree */
void __init proc_device_tree_init(void) | {
struct device_node *root;
proc_device_tree = proc_mkdir("device-tree", NULL);
if (proc_device_tree == NULL)
return;
root = of_find_node_by_path("/");
if (root == NULL) {
printk(KERN_ERR "/proc/device-tree: can't find root\n");
return;
}
proc_device_tree_add_node(root, proc_device_tree);
of_node_put(root);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* TIM MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) | /* TIM MSP Initialization This function configures the hardware resources used in this example: */
void HAL_TIM_OC_MspInit(TIM_HandleTypeDef *htim) | {
GPIO_InitTypeDef GPIO_InitStruct;
TIMx_CLK_ENABLE();
TIMx_CHANNEL_GPIO_PORT();
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF2_TIM3;
GPIO_InitStruct.Pin = GPIO_PIN_CHANNEL1;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_CHANNEL2;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_CHANNEL3;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_CHANNEL4;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
HAL_NVIC_SetPriority(TIM3_IRQn, 0, 1);
HAL_NVIC_EnableIRQ(TIM3_IRQn);
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Functions for configuring the media bay for a given type of device, enable the related busses */ | static int ohare_mb_setup_bus(struct media_bay_info *bay, u8 device_id) | /* Functions for configuring the media bay for a given type of device, enable the related busses */
static int ohare_mb_setup_bus(struct media_bay_info *bay, u8 device_id) | {
switch(device_id) {
case MB_FD:
case MB_FD1:
MB_BIS(bay, OHARE_FCR, OH_BAY_FLOPPY_ENABLE);
MB_BIS(bay, OHARE_FCR, OH_FLOPPY_ENABLE);
return 0;
case MB_CD:
MB_BIC(bay, OHARE_FCR, OH_IDE1_RESET_N);
MB_BIS(bay, OHARE_FCR, OH_BAY_IDE_ENABLE);
return 0;
case MB_PCI:
MB_BIS(bay, OHARE_FCR, OH_BAY_PCI_ENABLE);
return 0;
}
return -ENODEV;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first) */ | void md5_finish(md5_state_t *ctx, guint8 digest[16]) | /* Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first) */
void md5_finish(md5_state_t *ctx, guint8 digest[16]) | {
guint count;
guint8 *p;
count = (ctx->bits[0] >> 3) & 0x3F;
p = (guint8 *) ctx->in + count;
*p++ = 0x80;
count = 64 - 1 - count;
if (count < 8) {
memset(p, 0, count);
byteReverse(ctx->in, 16);
MD5Transform(ctx->buf, ctx->in);
memset(ctx->in, 0, 56);
} else {
memset(p, 0, count - 8);
}
byteReverse(ctx->in, 14);
ctx->in[14] = ctx->bits[0];
ctx->in[15] = ctx->bits[1];
MD5Transform(ctx->buf, ctx->in);
byteReverse(ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(md5_state_t));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Get Value for given Name from a NameValue Storage. */ | EFI_STATUS GetValueByName(IN BROWSER_STORAGE *Storage, IN CHAR16 *Name, IN OUT CHAR16 **Value, IN GET_SET_QUESTION_VALUE_WITH GetValueFrom) | /* Get Value for given Name from a NameValue Storage. */
EFI_STATUS GetValueByName(IN BROWSER_STORAGE *Storage, IN CHAR16 *Name, IN OUT CHAR16 **Value, IN GET_SET_QUESTION_VALUE_WITH GetValueFrom) | {
LIST_ENTRY *Link;
NAME_VALUE_NODE *Node;
if ((GetValueFrom != GetSetValueWithEditBuffer) && (GetValueFrom != GetSetValueWithBuffer)) {
return EFI_INVALID_PARAMETER;
}
*Value = NULL;
Link = GetFirstNode (&Storage->NameValueListHead);
while (!IsNull (&Storage->NameValueListHead, Link)) {
Node = NAME_VALUE_NODE_FROM_LINK (Link);
if (StrCmp (Name, Node->Name) == 0) {
if (GetValueFrom == GetSetValueWithEditBuffer) {
NewStringCpy (Value, Node->EditValue);
} else {
NewStringCpy (Value, Node->Value);
}
return EFI_SUCCESS;
}
Link = GetNextNode (&Storage->NameValueListHead, Link);
}
return EFI_NOT_FOUND;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Use the VMGEXIT instruction to handle a VMMCALL event. */ | STATIC UINT64 VmmCallExit(IN OUT GHCB *Ghcb, IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN CC_INSTRUCTION_DATA *InstructionData) | /* Use the VMGEXIT instruction to handle a VMMCALL event. */
STATIC UINT64 VmmCallExit(IN OUT GHCB *Ghcb, IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN CC_INSTRUCTION_DATA *InstructionData) | {
UINT64 Status;
CcDecodeModRm (Regs, InstructionData);
Ghcb->SaveArea.Rax = Regs->Rax;
CcExitVmgSetOffsetValid (Ghcb, GhcbRax);
Ghcb->SaveArea.Cpl = (UINT8)(Regs->Cs & 0x3);
CcExitVmgSetOffsetValid (Ghcb, GhcbCpl);
Status = CcExitVmgExit (Ghcb, SVM_EXIT_VMMCALL, 0, 0);
if (Status != 0) {
return Status;
}
if (!CcExitVmgIsOffsetValid (Ghcb, GhcbRax)) {
return UnsupportedExit (Ghcb, Regs, InstructionData);
}
Regs->Rax = Ghcb->SaveArea.Rax;
return 0;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* dispose of the data dangling from the corpse of a asymmetric key */ | static void asymmetric_key_destroy(struct key *key) | /* dispose of the data dangling from the corpse of a asymmetric key */
static void asymmetric_key_destroy(struct key *key) | {
struct asymmetric_key_subtype *subtype = asymmetric_key_subtype(key);
struct asymmetric_key_ids *kids = key->payload.data[asym_key_ids];
void *data = key->payload.data[asym_crypto];
void *auth = key->payload.data[asym_auth];
key->payload.data[asym_crypto] = NULL;
key->payload.data[asym_subtype] = NULL;
key->payload.data[asym_key_ids] = NULL;
key->payload.data[asym_auth] = NULL;
if (subtype) {
subtype->destroy(data, auth);
module_put(subtype->owner);
}
asymmetric_key_free_kids(kids);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This implementation assumes that the flash chips are uniform sector devices. This is true for all likely JSE devices. */ | static void flash_get_offsets(ulong base, flash_info_t *info) | /* This implementation assumes that the flash chips are uniform sector devices. This is true for all likely JSE devices. */
static void flash_get_offsets(ulong base, flash_info_t *info) | {
unsigned idx;
unsigned long sector_size = info->size / info->sector_count;
for (idx = 0; idx < info->sector_count; idx += 1) {
info->start[idx] = base + (idx * sector_size);
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Write USB Device Endpoint Data Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */ | U32 USBD_WriteEP(U32 EPNum, U8 *pData, U32 cnt) | /* Write USB Device Endpoint Data Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */
U32 USBD_WriteEP(U32 EPNum, U8 *pData, U32 cnt) | {
U32 num, *pv, n;
U16 statusEP;
num = EPNum & 0x0F;
pv = (U32 *)(USB_PMA_ADDR + 2 * ((pBUF_DSCR + num)->ADDR_TX));
for (n = 0; n < (cnt + 1) / 2; n++) {
*pv++ = __UNALIGNED_UINT16_READ(pData);
pData += 2;
}
(pBUF_DSCR + num)->COUNT_TX = cnt;
statusEP = EPxREG(num);
if ((statusEP & EP_STAT_TX) != EP_TX_STALL) {
EP_Status(EPNum, EP_TX_VALID);
}
return (cnt);
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Internal function. Converts a memory range to use new attributes. */ | VOID CoreUpdateMemoryAttributes(IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 NumberOfPages, IN UINT64 NewAttributes) | /* Internal function. Converts a memory range to use new attributes. */
VOID CoreUpdateMemoryAttributes(IN EFI_PHYSICAL_ADDRESS Start, IN UINT64 NumberOfPages, IN UINT64 NewAttributes) | {
CoreAcquireMemoryLock ();
CoreConvertPagesEx (Start, NumberOfPages, FALSE, (EFI_MEMORY_TYPE)0, TRUE, NewAttributes);
CoreReleaseMemoryLock ();
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks if Big Number equals to the given Num. */ | BOOLEAN EFIAPI BigNumIsWord(IN CONST VOID *Bn, IN UINTN Num) | /* Checks if Big Number equals to the given Num. */
BOOLEAN EFIAPI BigNumIsWord(IN CONST VOID *Bn, IN UINTN Num) | {
CALL_CRYPTO_SERVICE (BigNumIsWord, (Bn, Num), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns: (transfer none): the corresponding plugin if @type is a dynamic type, NULL otherwise */ | GTypePlugin* g_type_get_plugin(GType type) | /* Returns: (transfer none): the corresponding plugin if @type is a dynamic type, NULL otherwise */
GTypePlugin* g_type_get_plugin(GType type) | {
TypeNode *node;
node = lookup_type_node_I (type);
return node ? node->plugin : NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Skip a number of bytes at the start of a pbuf */ | struct pbuf* pbuf_skip(struct pbuf *in, u16_t in_offset, u16_t *out_offset) | /* Skip a number of bytes at the start of a pbuf */
struct pbuf* pbuf_skip(struct pbuf *in, u16_t in_offset, u16_t *out_offset) | {
return (struct pbuf*)(size_t)pbuf_skip_const(in, in_offset, out_offset);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Set a value 1 to the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIOPinSet(unsigned long ulPort, unsigned long ulPins) | /* Set a value 1 to the specified pin(s).
The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinSet(unsigned long ulPort, unsigned long ulPins) | {
xASSERT(GPIOBaseValid(ulPort));
xHWREG(ulPort + GPIO_PSOR) = ulPins;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function locks a locking object.
All other threads that call this function before this thread calls the osi_LockObjUnlock would be suspended */ | OsiReturnVal_e _osi_LockObjLock(OsiLockObj_t *pLockObj, OsiTime_t Timeout) | /* This function locks a locking object.
All other threads that call this function before this thread calls the osi_LockObjUnlock would be suspended */
OsiReturnVal_e _osi_LockObjLock(OsiLockObj_t *pLockObj, OsiTime_t Timeout) | {
if(pdTRUE == xSemaphoreTake( *pLockObj, ( TickType_t ) Timeout ))
{
return OSI_OK;
}
else
{
return OSI_OPERATION_FAILED;
}
} | micropython/micropython | C++ | Other | 18,334 |
/* Overwrite current step count. WARNING: This function writes to DMP memory and could potentially encounter a race condition if called while the pedometer is enabled. */ | int dmp_set_pedometer_step_count(unsigned long count) | /* Overwrite current step count. WARNING: This function writes to DMP memory and could potentially encounter a race condition if called while the pedometer is enabled. */
int dmp_set_pedometer_step_count(unsigned long count) | {
unsigned char tmp[4];
tmp[0] = (unsigned char)((count >> 24) & 0xFF);
tmp[1] = (unsigned char)((count >> 16) & 0xFF);
tmp[2] = (unsigned char)((count >> 8) & 0xFF);
tmp[3] = (unsigned char)(count & 0xFF);
return mpu_write_mem(D_PEDSTD_STEPCTR, 4, tmp);
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* RETURNS: True if @encoder is part of the mode_config, false otherwise. */ | bool drm_helper_encoder_in_use(struct drm_encoder *encoder) | /* RETURNS: True if @encoder is part of the mode_config, false otherwise. */
bool drm_helper_encoder_in_use(struct drm_encoder *encoder) | {
struct drm_connector *connector;
struct drm_device *dev = encoder->dev;
list_for_each_entry(connector, &dev->mode_config.connector_list, head)
if (connector->encoder == encoder)
return true;
return false;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Common code to handle map devices which are simple RAM (C) 2000 Red Hat. GPL'd. */ | static int mapram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *) | /* Common code to handle map devices which are simple RAM (C) 2000 Red Hat. GPL'd. */
static int mapram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *) | {
struct map_info *map = mtd->priv;
map_copy_from(map, buf, from, len);
*retlen = len;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes a short to the given ITM stimulus register. */ | void am_hal_itm_stimulus_reg_short_write(uint32_t ui32StimReg, uint16_t ui16Value) | /* Writes a short to the given ITM stimulus register. */
void am_hal_itm_stimulus_reg_short_write(uint32_t ui32StimReg, uint16_t ui16Value) | {
uint32_t ui32StimAddr;
ui32StimAddr = (AM_REG_ITM_STIM0_O + (4 * ui32StimReg));
while (!AM_REGVAL(ui32StimAddr));
*((volatile uint16_t *) ui32StimAddr) = ui16Value;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable TPM1 channel 0(A) and channel 1(B) triggers selected for ADC0. */ | void ADC0TPMTriggerEnable(void) | /* Enable TPM1 channel 0(A) and channel 1(B) triggers selected for ADC0. */
void ADC0TPMTriggerEnable(void) | {
xHWREG(SIM_SOPT7) &= ~SIM_SOPT7_ADC0ALTTRGEN;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Convert a character index (in an UTF-8 text) to byte index. E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long */ | static uint32_t lv_txt_utf8_get_byte_id(const char *txt, uint32_t utf8_id) | /* Convert a character index (in an UTF-8 text) to byte index. E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long */
static uint32_t lv_txt_utf8_get_byte_id(const char *txt, uint32_t utf8_id) | {
uint32_t i;
uint32_t byte_cnt = 0;
for(i = 0; i < utf8_id; i++) {
byte_cnt += lv_txt_encoded_size(&txt[byte_cnt]);
}
return byte_cnt;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Set LED2 to Blinking mode for an infinite loop (toggle period based on value provided as input parameter). */ | void LED_Blinking(uint32_t Period) | /* Set LED2 to Blinking mode for an infinite loop (toggle period based on value provided as input parameter). */
void LED_Blinking(uint32_t Period) | {
while (1)
{
LL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
LL_mDelay(Period);
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Return value: CAIRO_STATUS_SUCCESS if successful or CAIRO_STATUS_NO_MEMORY if out of memory. */ | void _cairo_hash_table_remove(cairo_hash_table_t *hash_table, cairo_hash_entry_t *key) | /* Return value: CAIRO_STATUS_SUCCESS if successful or CAIRO_STATUS_NO_MEMORY if out of memory. */
void _cairo_hash_table_remove(cairo_hash_table_t *hash_table, cairo_hash_entry_t *key) | {
*_cairo_hash_table_lookup_exact_key (hash_table, key) = DEAD_ENTRY;
hash_table->live_entries--;
hash_table->cache[key->hash & 31] = NULL;
if (hash_table->iterating == 0) {
_cairo_hash_table_manage (hash_table);
}
} | xboot/xboot | C++ | MIT License | 779 |
/* This function prints user info on PC com port and initiates RX transfer. */ | void StartReception(void) | /* This function prints user info on PC com port and initiates RX transfer. */
void StartReception(void) | {
pBufferReadyForReception = aRXBufferA;
pBufferReadyForUser = aRXBufferB;
uwNbReceivedChars = 0;
PrintInfo(&huart3, aTextInfoStart, COUNTOF(aTextInfoStart));
if (HAL_OK != HAL_UARTEx_ReceiveToIdle_DMA(&huart3, aRXBufferUser, RX_BUFFER_SIZE))
{
Error_Handler();
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* use this as the physical section index that this memsection uses. */ | static ssize_t show_mem_phys_index(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) | /* use this as the physical section index that this memsection uses. */
static ssize_t show_mem_phys_index(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) | {
struct memory_block *mem =
container_of(dev, struct memory_block, sysdev);
return sprintf(buf, "%08lx\n", mem->phys_index);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables the oscillator clock for frequency error counter. */ | void CRS_FrequencyErrorCounterCmd(FunctionalState NewState) | /* Enables or disables the oscillator clock for frequency error counter. */
void CRS_FrequencyErrorCounterCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
CRS->CR |= CRS_CR_CEN;
}
else
{
CRS->CR &= ~CRS_CR_CEN;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* param base DCP peripheral base address param handle Handle used for the request. param algo Underlaying algorithm to use for hash computation. param input Input data param inputSize Size of input data in bytes param output Output hash data param outputSize Output parameter storing the size of the output hash in bytes return Status of the one call hash operation. */ | status_t DCP_HASH(DCP_Type *base, dcp_handle_t *handle, dcp_hash_algo_t algo, const uint8_t *input, size_t inputSize, uint8_t *output, size_t *outputSize) | /* param base DCP peripheral base address param handle Handle used for the request. param algo Underlaying algorithm to use for hash computation. param input Input data param inputSize Size of input data in bytes param output Output hash data param outputSize Output parameter storing the size of the output hash in bytes return Status of the one call hash operation. */
status_t DCP_HASH(DCP_Type *base, dcp_handle_t *handle, dcp_hash_algo_t algo, const uint8_t *input, size_t inputSize, uint8_t *output, size_t *outputSize) | {
dcp_hash_ctx_t hashCtx;
status_t status;
status = DCP_HASH_Init(base, handle, &hashCtx, algo);
if (status != kStatus_Success)
{
return status;
}
status = DCP_HASH_Update(base, &hashCtx, input, inputSize);
if (status != kStatus_Success)
{
return status;
}
status = DCP_HASH_Finish(base, &hashCtx, output, outputSize);
return status;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.