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
|
|---|---|---|---|---|---|---|---|
/* Enables the PWM dead band output and sets the dead band delays. */
|
void PWMDeadBandEnable(unsigned long ulBase, unsigned long ulGen, unsigned short usRise, unsigned short usFall)
|
/* Enables the PWM dead band output and sets the dead band delays. */
void PWMDeadBandEnable(unsigned long ulBase, unsigned long ulGen, unsigned short usRise, unsigned short usFall)
|
{
ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE));
ASSERT(PWMGenValid(ulGen));
ASSERT(usRise < 4096);
ASSERT(usFall < 4096);
ulGen = PWM_GEN_BADDR(ulBase, ulGen);
HWREG(ulGen + PWM_O_X_DBRISE) = usRise;
HWREG(ulGen + PWM_O_X_DBFALL) = usFall;
HWREG(ulGen + PWM_O_X_DBCTL) |= PWM_X_DBCTL_ENABLE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns 1 when there's a match, 0 means no match. */
|
static int _scsih_srch_boot_encl_slot(u64 enclosure_logical_id, u16 slot_number, Mpi2BootDeviceEnclosureSlot_t *boot_device)
|
/* Returns 1 when there's a match, 0 means no match. */
static int _scsih_srch_boot_encl_slot(u64 enclosure_logical_id, u16 slot_number, Mpi2BootDeviceEnclosureSlot_t *boot_device)
|
{
return (enclosure_logical_id == le64_to_cpu(boot_device->
EnclosureLogicalID) && slot_number == le16_to_cpu(boot_device->
SlotNumber)) ? 1 : 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ppc440spe_desc_init_dma2pq - initialize the descriptor for PQ operation in DMA2 controller */
|
static void ppc440spe_desc_init_dma2pq(struct ppc440spe_adma_desc_slot *desc, int dst_cnt, int src_cnt, unsigned long flags)
|
/* ppc440spe_desc_init_dma2pq - initialize the descriptor for PQ operation in DMA2 controller */
static void ppc440spe_desc_init_dma2pq(struct ppc440spe_adma_desc_slot *desc, int dst_cnt, int src_cnt, unsigned long flags)
|
{
struct xor_cb *hw_desc = desc->hw_desc;
memset(desc->hw_desc, 0, sizeof(struct xor_cb));
desc->hw_next = NULL;
desc->src_cnt = src_cnt;
desc->dst_cnt = dst_cnt;
memset(desc->reverse_flags, 0, sizeof(desc->reverse_flags));
desc->descs_per_op = 0;
hw_desc->cbc = XOR_CBCR_TGT_BIT;
if (flags & DMA_PREP_INTERRUPT)
hw_desc->cbc |= XOR_CBCR_CBCE_BIT;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns u8 valued "handle" in the range (and S.O.D. order) {N,...,7,6,5,...,1} if successful. A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be considered an error by the caller. */
|
u8 mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
|
/* Returns u8 valued "handle" in the range (and S.O.D. order) {N,...,7,6,5,...,1} if successful. A return value of MPT_MAX_PROTOCOL_DRIVERS (including zero!) should be considered an error by the caller. */
u8 mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
|
{
u8 cb_idx;
last_drv_idx = MPT_MAX_PROTOCOL_DRIVERS;
for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) {
if (MptCallbacks[cb_idx] == NULL) {
MptCallbacks[cb_idx] = cbfunc;
MptDriverClass[cb_idx] = dclass;
MptEvHandlers[cb_idx] = NULL;
last_drv_idx = cb_idx;
break;
}
}
return last_drv_idx;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Event handler for the USB device Start Of Frame event. */
|
void EVENT_USB_Device_StartOfFrame(void)
|
/* Event handler for the USB device Start Of Frame event. */
void EVENT_USB_Device_StartOfFrame(void)
|
{
HID_Device_MillisecondElapsed(&MediaControl_HID_Interface);
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* aux_pw_on_ctrl: OIS chain on aux interface power on mode */
|
int32_t lsm6dso_aux_pw_on_ctrl_get(lsm6dso_ctx_t *ctx, lsm6dso_ois_on_t *val)
|
/* aux_pw_on_ctrl: OIS chain on aux interface power on mode */
int32_t lsm6dso_aux_pw_on_ctrl_get(lsm6dso_ctx_t *ctx, lsm6dso_ois_on_t *val)
|
{
lsm6dso_ctrl7_g_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t*)®, 1);
switch (reg.ois_on) {
case LSM6DSO_AUX_ON:
*val = LSM6DSO_AUX_ON;
break;
case LSM6DSO_AUX_ON_BY_AUX_INTERFACE:
*val = LSM6DSO_AUX_ON_BY_AUX_INTERFACE;
break;
default:
*val = LSM6DSO_AUX_ON;
break;
}
return ret;
}
|
alexander-g-dean/ESF
|
C++
| null | 41
|
/* Set the contents of a G_TYPE_LONG #GValue to @v_long. */
|
void g_value_set_long(GValue *value, glong v_long)
|
/* Set the contents of a G_TYPE_LONG #GValue to @v_long. */
void g_value_set_long(GValue *value, glong v_long)
|
{
g_return_if_fail (G_VALUE_HOLDS_LONG (value));
value->data[0].v_long = v_long;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Join two areas into a third which involves the other two */
|
void _lv_area_join(lv_area_t *a_res_p, const lv_area_t *a1_p, const lv_area_t *a2_p)
|
/* Join two areas into a third which involves the other two */
void _lv_area_join(lv_area_t *a_res_p, const lv_area_t *a1_p, const lv_area_t *a2_p)
|
{
a_res_p->x1 = LV_MIN(a1_p->x1, a2_p->x1);
a_res_p->y1 = LV_MIN(a1_p->y1, a2_p->y1);
a_res_p->x2 = LV_MAX(a1_p->x2, a2_p->x2);
a_res_p->y2 = LV_MAX(a1_p->y2, a2_p->y2);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Returns the length of data in the internal content */
|
size_t xmlBufUse(const xmlBufPtr buf)
|
/* Returns the length of data in the internal content */
size_t xmlBufUse(const xmlBufPtr buf)
|
{
if ((!buf) || (buf->error))
return 0;
CHECK_COMPAT(buf)
return(buf->use);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* If RsaContext is NULL, then return FALSE. If MessageHash is NULL, then return FALSE. If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE. If SigSize is large enough but Signature is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
|
BOOLEAN EFIAPI RsaPkcs1Sign(IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
|
/* If RsaContext is NULL, then return FALSE. If MessageHash is NULL, then return FALSE. If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE. If SigSize is large enough but Signature is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI RsaPkcs1Sign(IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
|
{
CALL_CRYPTO_SERVICE (RsaPkcs1Sign, (RsaContext, MessageHash, HashSize, Signature, SigSize), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* brief Return Frequency of CLK 1MHz return Frequency of CLK 1MHz */
|
static uint32_t CLOCK_GetClk1MFreq(void)
|
/* brief Return Frequency of CLK 1MHz return Frequency of CLK 1MHz */
static uint32_t CLOCK_GetClk1MFreq(void)
|
{
return 1000000U;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details. */
|
EFI_STATUS EmmcPeimSendStatus(IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, OUT UINT32 *DevStatus)
|
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.10.4 for details. */
EFI_STATUS EmmcPeimSendStatus(IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca, OUT UINT32 *DevStatus)
|
{
EMMC_COMMAND_BLOCK EmmcCmdBlk;
EMMC_STATUS_BLOCK EmmcStatusBlk;
EMMC_COMMAND_PACKET Packet;
EFI_STATUS Status;
ZeroMem (&EmmcCmdBlk, sizeof (EmmcCmdBlk));
ZeroMem (&EmmcStatusBlk, sizeof (EmmcStatusBlk));
ZeroMem (&Packet, sizeof (Packet));
Packet.EmmcCmdBlk = &EmmcCmdBlk;
Packet.EmmcStatusBlk = &EmmcStatusBlk;
Packet.Timeout = EMMC_TIMEOUT;
EmmcCmdBlk.CommandIndex = EMMC_SEND_STATUS;
EmmcCmdBlk.CommandType = EmmcCommandTypeAc;
EmmcCmdBlk.ResponseType = EmmcResponceTypeR1;
EmmcCmdBlk.CommandArgument = Rca << 16;
Status = EmmcPeimExecCmd (Slot, &Packet);
if (!EFI_ERROR (Status)) {
*DevStatus = EmmcStatusBlk.Resp0;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If @count is smaller than the length of the string, copies @count bytes and returns @count. */
|
long __strncpy_from_user(char *dst, const char __user *src, long count)
|
/* If @count is smaller than the length of the string, copies @count bytes and returns @count. */
long __strncpy_from_user(char *dst, const char __user *src, long count)
|
{
long res;
__do_strncpy_from_user(dst, src, count, res);
return res;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Update the current handler pointer. Load the pointer to the handler that must be passed as argument to the command functions. */
|
void cli_load_descriptor_pointer(struct cli_desc *dev, void *command_descriptor)
|
/* Update the current handler pointer. Load the pointer to the handler that must be passed as argument to the command functions. */
void cli_load_descriptor_pointer(struct cli_desc *dev, void *command_descriptor)
|
{
dev->device_descriptor = command_descriptor;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Sets the file enumerator as having pending operations. */
|
void g_file_enumerator_set_pending(GFileEnumerator *enumerator, gboolean pending)
|
/* Sets the file enumerator as having pending operations. */
void g_file_enumerator_set_pending(GFileEnumerator *enumerator, gboolean pending)
|
{
g_return_if_fail (G_IS_FILE_ENUMERATOR (enumerator));
enumerator->priv->pending = pending;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function is used to config the etu param. */
|
void wm_sc_set_etu(uint16_t etu)
|
/* This function is used to config the etu param. */
void wm_sc_set_etu(uint16_t etu)
|
{
uint32_t reg;
reg = tls_reg_read32(HR_UART2_BAUD_RATE_CTRL);
reg &= ~ 0xFFFF;
reg |= etu;
tls_reg_write32(HR_UART2_BAUD_RATE_CTRL, reg);}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Reports the status code specified by the parameters Type and Value. Status code also require an instance, caller ID, and extended data. This function passed in a zero instance, NULL extended data, and a caller ID of gEfiCallerIdGuid, which is the GUID for the module. */
|
EFI_STATUS EFIAPI ReportStatusCode(IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_VALUE Value)
|
/* Reports the status code specified by the parameters Type and Value. Status code also require an instance, caller ID, and extended data. This function passed in a zero instance, NULL extended data, and a caller ID of gEfiCallerIdGuid, which is the GUID for the module. */
EFI_STATUS EFIAPI ReportStatusCode(IN EFI_STATUS_CODE_TYPE Type, IN EFI_STATUS_CODE_VALUE Value)
|
{
return InternalReportStatusCode (Type, Value, 0, &gEfiCallerIdGuid, NULL);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* applesmc_calibrate - Set our "resting" values. Callers must hold applesmc_lock. */
|
static void applesmc_calibrate(void)
|
/* applesmc_calibrate - Set our "resting" values. Callers must hold applesmc_lock. */
static void applesmc_calibrate(void)
|
{
applesmc_read_motion_sensor(SENSOR_X, &rest_x);
applesmc_read_motion_sensor(SENSOR_Y, &rest_y);
rest_x = -rest_x;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* bio_integrity_mark_tail - Truncate bip_vec to be len bytes long @bip: Integrity vector to truncate @len: New length of integrity vector */
|
void bio_integrity_mark_tail(struct bio_integrity_payload *bip, unsigned int len)
|
/* bio_integrity_mark_tail - Truncate bip_vec to be len bytes long @bip: Integrity vector to truncate @len: New length of integrity vector */
void bio_integrity_mark_tail(struct bio_integrity_payload *bip, unsigned int len)
|
{
struct bio_vec *iv;
unsigned int i;
bip_for_each_vec(iv, bip, i) {
if (len == 0) {
bip->bip_vcnt = i;
return;
} else if (len >= iv->bv_len) {
len -= iv->bv_len;
} else {
iv->bv_len = len;
len = 0;
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* A list of QPs will be attached to this structure. */
|
static struct ipath_mcast* ipath_mcast_alloc(union ib_gid *mgid)
|
/* A list of QPs will be attached to this structure. */
static struct ipath_mcast* ipath_mcast_alloc(union ib_gid *mgid)
|
{
struct ipath_mcast *mcast;
mcast = kmalloc(sizeof *mcast, GFP_KERNEL);
if (!mcast)
goto bail;
mcast->mgid = *mgid;
INIT_LIST_HEAD(&mcast->qp_list);
init_waitqueue_head(&mcast->wait);
atomic_set(&mcast->refcount, 0);
mcast->n_attached = 0;
bail:
return mcast;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initiates a read packet operation without sending a NACK signal and a STOP condition when done.
This is the non-blocking equivalent of i2c_master_read_packet_wait_no_stop. */
|
enum status_code i2c_master_read_packet_job_no_nack(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
|
/* Initiates a read packet operation without sending a NACK signal and a STOP condition when done.
This is the non-blocking equivalent of i2c_master_read_packet_wait_no_stop. */
enum status_code i2c_master_read_packet_job_no_nack(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
|
{
Assert(module);
Assert(module->hw);
Assert(packet);
if (module->buffer_remaining > 0) {
return STATUS_BUSY;
}
module->send_stop = false;
module->send_nack = false;
return _i2c_master_read_packet(module, packet);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* set the gain table index corresponding to a specific WiFi region */
|
NMI_API sint8 m2m_wifi_set_gain_table_idx(uint8 u8GainTableIdx)
|
/* set the gain table index corresponding to a specific WiFi region */
NMI_API sint8 m2m_wifi_set_gain_table_idx(uint8 u8GainTableIdx)
|
{
sint8 ret = M2M_SUCCESS;
tstrM2mWiFiGainIdx strM2mGainTableIdx;
strM2mGainTableIdx.u8GainTableIdx = u8GainTableIdx;
ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SET_GAIN_TABLE_IDX, (uint8*)&strM2mGainTableIdx,sizeof(tstrM2mWiFiGainIdx), NULL, 0, 0);
return ret;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Code to send a message and wait for the reponse. */
|
static void receive_handler(struct ipmi_recv_msg *recv_msg, void *handler_data)
|
/* Code to send a message and wait for the reponse. */
static void receive_handler(struct ipmi_recv_msg *recv_msg, void *handler_data)
|
{
struct completion *comp = recv_msg->user_msg_data;
if (comp)
complete(comp);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configures the data size for the selected SPI. */
|
void SPI_ConfigDataSize(SPI_T *spi, SPI_DATA_LENGTH_T length)
|
/* Configures the data size for the selected SPI. */
void SPI_ConfigDataSize(SPI_T *spi, SPI_DATA_LENGTH_T length)
|
{
spi->CTRL1_B.DFLSEL = length;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* netlbl_cipsov4_remove_cb - netlbl_cipsov4_remove() callback for REMOVE @entry: LSM domain mapping entry */
|
static int netlbl_cipsov4_remove_cb(struct netlbl_dom_map *entry, void *arg)
|
/* netlbl_cipsov4_remove_cb - netlbl_cipsov4_remove() callback for REMOVE @entry: LSM domain mapping entry */
static int netlbl_cipsov4_remove_cb(struct netlbl_dom_map *entry, void *arg)
|
{
struct netlbl_domhsh_walk_arg *cb_arg = arg;
if (entry->type == NETLBL_NLTYPE_CIPSOV4 &&
entry->type_def.cipsov4->doi == cb_arg->doi)
return netlbl_domhsh_remove_entry(entry, cb_arg->audit_info);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Sets a Stall condition on an endpoint of the Low Level Driver. */
|
USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
/* Sets a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
|
{
HAL_StatusTypeDef hal_status = HAL_OK;
USBD_StatusTypeDef usb_status = USBD_OK;
hal_status = HAL_PCD_EP_SetStall(pdev->pData, ep_addr);
usb_status = USBD_Get_USB_Status(hal_status);
return usb_status;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Sends a command to read either a 16- or 32-bit data word from the remote CPU */
|
uint16_t IPCLtoRDataRead(volatile tIpcController *psController, uint32_t ulAddress, void *pvData, uint16_t usLength, uint16_t bBlock, uint32_t ulResponseFlag)
|
/* Sends a command to read either a 16- or 32-bit data word from the remote CPU */
uint16_t IPCLtoRDataRead(volatile tIpcController *psController, uint32_t ulAddress, void *pvData, uint16_t usLength, uint16_t bBlock, uint32_t ulResponseFlag)
|
{
uint16_t status;
tIpcMessage sMessage;
sMessage.ulcommand = IPC_DATA_READ;
sMessage.uladdress = ulAddress;
sMessage.uldataw1 = (ulResponseFlag & 0xFFFF0000)|(uint32_t)usLength;
sMessage.uldataw2 = (uint32_t)pvData;
IpcRegs.IPCSET.all |= (ulResponseFlag & 0xFFFF0000);
status = IpcPut (psController, &sMessage, bBlock);
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Enter Deep Power Down mode with co-operated instruction by the Cortex-M3. */
|
void CLKPWR_DeepPowerDown(void)
|
/* Enter Deep Power Down mode with co-operated instruction by the Cortex-M3. */
void CLKPWR_DeepPowerDown(void)
|
{
SCB->SCR = 0x4;
LPC_SC->PCON = 0x03;
__WFI();
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This function programs multiple words in the customer INFO space. */
|
int am_hal_flash_program_info(uint32_t ui32Value, uint32_t ui32InfoInst, uint32_t *pui32Src, uint32_t ui32Offset, uint32_t ui32NumWords)
|
/* This function programs multiple words in the customer INFO space. */
int am_hal_flash_program_info(uint32_t ui32Value, uint32_t ui32InfoInst, uint32_t *pui32Src, uint32_t ui32Offset, uint32_t ui32NumWords)
|
{
return g_am_hal_flash.flash_program_info(ui32Value, 0, pui32Src,
ui32Offset, ui32NumWords);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set timeout value for state specified by name */
|
int ip_vs_set_state_timeout(int *table, int num, const char *const *names, const char *name, int to)
|
/* Set timeout value for state specified by name */
int ip_vs_set_state_timeout(int *table, int num, const char *const *names, const char *name, int to)
|
{
int i;
if (!table || !name || !to)
return -EINVAL;
for (i = 0; i < num; i++) {
if (strcmp(names[i], name))
continue;
table[i] = to * HZ;
return 0;
}
return -ENOENT;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Instanciate a string and initialise it to a_string. */
|
CRString* cr_string_new_from_string(const gchar *a_string)
|
/* Instanciate a string and initialise it to a_string. */
CRString* cr_string_new_from_string(const gchar *a_string)
|
{
CRString *result = NULL ;
result = cr_string_new () ;
if (!result) {
cr_utils_trace_info ("Out of memory") ;
return NULL ;
}
if (a_string)
g_string_append (result->stryng, a_string) ;
return result ;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* get the bit state of ADCx software inserted channel start conversion */
|
FlagStatus adc_inserted_software_startconv_flag_get(uint32_t adc_periph)
|
/* get the bit state of ADCx software inserted channel start conversion */
FlagStatus adc_inserted_software_startconv_flag_get(uint32_t adc_periph)
|
{
FlagStatus reval = RESET;
if((uint32_t)RESET != (ADC_CTL1(adc_periph) & ADC_CTL1_SWICST)){
reval = SET;
}
return reval;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* An EEPROM read command starts by shifting out 0x60+address, and then shifting in the serial data. See the NatSemi databook for details. */
|
static unsigned short __init eeprom_op(long ioaddr, u32 cmd)
|
/* An EEPROM read command starts by shifting out 0x60+address, and then shifting in the serial data. See the NatSemi databook for details. */
static unsigned short __init eeprom_op(long ioaddr, u32 cmd)
|
{
unsigned eedata_out = 0;
int num_bits = EE_CMD_SIZE;
while (--num_bits >= 0) {
char outval = (cmd & (1<<num_bits)) ? EE_DATA_WRITE : 0;
write_reg_high(ioaddr, PROM_CMD, outval | EE_CLK_LOW);
write_reg_high(ioaddr, PROM_CMD, outval | EE_CLK_HIGH);
eedata_out <<= 1;
if (read_nibble(ioaddr, PROM_DATA) & EE_DATA_READ)
eedata_out++;
}
write_reg_high(ioaddr, PROM_CMD, EE_CLK_LOW & ~EE_CS);
return eedata_out;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Default read function for 16bit buswidth without endianness conversion. */
|
static u16 nand_read_word(struct mtd_info *mtd)
|
/* Default read function for 16bit buswidth without endianness conversion. */
static u16 nand_read_word(struct mtd_info *mtd)
|
{
struct nand_chip *chip = mtd_to_nand(mtd);
return readw(chip->IO_ADDR_R);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Notify the RX thread that there is data pending. */
|
void i2400mu_rx_kick(struct i2400mu *i2400mu)
|
/* Notify the RX thread that there is data pending. */
void i2400mu_rx_kick(struct i2400mu *i2400mu)
|
{
struct i2400m *i2400m = &i2400mu->i2400m;
struct device *dev = &i2400mu->usb_iface->dev;
d_fnstart(3, dev, "(i2400mu %p)\n", i2400m);
atomic_inc(&i2400mu->rx_pending_count);
wake_up_all(&i2400mu->rx_wq);
d_fnend(3, dev, "(i2400m %p) = void\n", i2400m);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* PCD MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
|
/* PCD MSP Initialization This function configures the hardware resources used in this example. */
void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hpcd->Instance==USB_OTG_FS)
{
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = USB_SOF_Pin|USB_ID_Pin|USB_DM_Pin|USB_DP_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = USB_VBUS_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(USB_VBUS_GPIO_Port, &GPIO_InitStruct);
__HAL_RCC_USB_OTG_FS_CLK_ENABLE();
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* brief Return Frequency of FRO 1MHz return Frequency of FRO 1MHz */
|
static uint32_t GetFro1MFreq(void)
|
/* brief Return Frequency of FRO 1MHz return Frequency of FRO 1MHz */
static uint32_t GetFro1MFreq(void)
|
{
return ((SYSCON->CLOCK_CTRL & SYSCON_CLOCK_CTRL_FRO1MHZ_CLK_ENA_MASK) != 0UL) ? 1000000U : 0U;
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Free-fall duration event. 1LSb = 1 / ODR. */
|
int32_t lsm6dso_ff_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
|
/* Free-fall duration event. 1LSb = 1 / ODR. */
int32_t lsm6dso_ff_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
|
{
lsm6dso_wake_up_dur_t wake_up_dur;
lsm6dso_free_fall_t free_fall;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR,
(uint8_t *)&wake_up_dur, 1);
if (ret == 0) {
ret = lsm6dso_read_reg(ctx, LSM6DSO_FREE_FALL, (uint8_t *)&free_fall,
1);
*val = (wake_up_dur.ff_dur << 5) + free_fall.ff_dur;
}
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* We just set the DMA start and count; the DMA interrupt routine will take care of formatting the samples (via the appropriate vidc_filler routine), and flag via vidc_audio_dma_interrupt when more data is required. */
|
static void vidc_audio_output_block(int dev, unsigned long buf, int total_count, int one)
|
/* We just set the DMA start and count; the DMA interrupt routine will take care of formatting the samples (via the appropriate vidc_filler routine), and flag via vidc_audio_dma_interrupt when more data is required. */
static void vidc_audio_output_block(int dev, unsigned long buf, int total_count, int one)
|
{
struct dma_buffparms *dmap = audio_devs[dev]->dmap_out;
unsigned long flags;
local_irq_save(flags);
dma_start = buf - (unsigned long)dmap->raw_buf_phys + (unsigned long)dmap->raw_buf;
dma_count = total_count;
local_irq_restore(flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Store back to the same location it was read from with ab_control_create_from_misc(). */
|
static int ab_control_store(struct blk_desc *dev_desc, const disk_partition_t *part_info, struct bootloader_control *abc)
|
/* Store back to the same location it was read from with ab_control_create_from_misc(). */
static int ab_control_store(struct blk_desc *dev_desc, const disk_partition_t *part_info, struct bootloader_control *abc)
|
{
ulong abc_offset, abc_blocks, ret;
abc_offset = offsetof(struct bootloader_message_ab, slot_suffix) /
part_info->blksz;
abc_blocks = DIV_ROUND_UP(sizeof(struct bootloader_control),
part_info->blksz);
ret = blk_dwrite(dev_desc, part_info->start + abc_offset, abc_blocks,
abc);
if (IS_ERR_VALUE(ret)) {
log_err("ANDROID: Could not write back the misc partition\n");
return -EIO;
}
return 0;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Initializes the CRYP MSP. This function configures the hardware resources used in this example: */
|
void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp)
|
/* Initializes the CRYP MSP. This function configures the hardware resources used in this example: */
void HAL_CRYP_MspInit(CRYP_HandleTypeDef *hcryp)
|
{
__HAL_RCC_CRYP_CLK_ENABLE();
HAL_NVIC_SetPriority(CRYP_IRQn, 4, 0);
HAL_NVIC_EnableIRQ(CRYP_IRQn);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* socrates_nand_read_word - read one word from the chip @mtd: MTD device structure */
|
static uint16_t socrates_nand_read_word(struct mtd_info *mtd)
|
/* socrates_nand_read_word - read one word from the chip @mtd: MTD device structure */
static uint16_t socrates_nand_read_word(struct mtd_info *mtd)
|
{
uint16_t word;
socrates_nand_read_buf(mtd, (uint8_t *)&word, sizeof(word));
return word;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Performs a software reset of a peripheral. This function performs a software reset of the specified peripheral. An individual peripheral reset signal is asserted for a brief period and then deasserted, returning the internal state of the peripheral to its reset condition. */
|
void xSysCtlPeripheralReset(unsigned long ulPeripheralID)
|
/* Performs a software reset of a peripheral. This function performs a software reset of the specified peripheral. An individual peripheral reset signal is asserted for a brief period and then deasserted, returning the internal state of the peripheral to its reset condition. */
void xSysCtlPeripheralReset(unsigned long ulPeripheralID)
|
{
SysCtlPeripheralReset(ulPeripheralID);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Select The Timer counter capture detect edge.
The */
|
void TimerCaptureEdgeSelect(unsigned long ulBase, unsigned long ulEdge)
|
/* Select The Timer counter capture detect edge.
The */
void TimerCaptureEdgeSelect(unsigned long ulBase, unsigned long ulEdge)
|
{
xASSERT((ulBase == TIMER3_BASE) || (ulBase == TIMER2_BASE) ||
(ulBase == TIMER1_BASE) || (ulBase == TIMER0_BASE));
xASSERT((ulEdge == TIMER_CAP_RISING) ||
(ulEdge == TIMER_CAP_BOTH) ||
(ulEdge == TIMER_CAP_FALLING));
xHWREG(ulBase + TIMER_O_TEXCON) &= ~TIMER_TEXCON_TEX_EDGE_M;
xHWREG(ulBase + TIMER_O_TEXCON) |= ulEdge;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Called by hardware driver to register itself with the CAPI subsystem. */
|
void register_capi_driver(struct capi_driver *driver)
|
/* Called by hardware driver to register itself with the CAPI subsystem. */
void register_capi_driver(struct capi_driver *driver)
|
{
unsigned long flags;
write_lock_irqsave(&capi_drivers_list_lock, flags);
list_add_tail(&driver->list, &capi_drivers);
write_unlock_irqrestore(&capi_drivers_list_lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
|
VOID* EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
|
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
|
{
VOID *Buffer;
Buffer = InternalAllocateZeroPool (EfiBootServicesData, AllocationSize);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_ALLOCATE_ZERO_POOL,
EfiBootServicesData,
Buffer,
AllocationSize,
NULL
);
}
return Buffer;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* the DMA engine is disabled after the end of transfer signal from DMA controller is detected */
|
void adc_dma_request_after_last_disable(uint32_t adc_periph)
|
/* the DMA engine is disabled after the end of transfer signal from DMA controller is detected */
void adc_dma_request_after_last_disable(uint32_t adc_periph)
|
{
ADC_CTL1(adc_periph) &= ~((uint32_t)ADC_CTL1_DDM);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This routine can be used from both task and interrupt context. */
|
atomic_val_t rhino_atomic_xor(atomic_t *target, atomic_val_t value)
|
/* This routine can be used from both task and interrupt context. */
atomic_val_t rhino_atomic_xor(atomic_t *target, atomic_val_t value)
|
{
CPSR_ALLOC();
atomic_val_t old_value;
RHINO_CPU_INTRPT_DISABLE();
old_value = *target;
*target ^= value;
RHINO_CPU_INTRPT_ENABLE();
return old_value;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Not so, for quite unobvious reasons - register pressure. In user mode vfork() cannot have a stack frame, and if done by calling the "clone()" system call directly, you do not have enough call-clobbered registers to hold all the information you need. */
|
asmlinkage int sys_vfork(unsigned long r2, unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs *pregs)
|
/* Not so, for quite unobvious reasons - register pressure. In user mode vfork() cannot have a stack frame, and if done by calling the "clone()" system call directly, you do not have enough call-clobbered registers to hold all the information you need. */
asmlinkage int sys_vfork(unsigned long r2, unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs *pregs)
|
{
return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, pregs->regs[15], pregs, 0, 0, 0);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Encodes and sends messages that contain only message id in the variable header. */
|
static int mqtt_message_id_only_enc(uint8_t message_type, uint16_t message_id, struct buf_ctx *buf)
|
/* Encodes and sends messages that contain only message id in the variable header. */
static int mqtt_message_id_only_enc(uint8_t message_type, uint16_t message_id, struct buf_ctx *buf)
|
{
int err_code;
uint8_t *start;
if (message_id == 0U) {
return -EINVAL;
}
buf->cur += MQTT_FIXED_HEADER_MAX_SIZE;
start = buf->cur;
err_code = pack_uint16(message_id, buf);
if (err_code != 0) {
return err_code;
}
return mqtt_encode_fixed_header(message_type, start, buf);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Push an element onto the Stack for Expression Dependencies. */
|
EFI_STATUS PushDependencyStack(IN OUT HII_DEPENDENCY_EXPRESSION ***Stack, IN OUT HII_DEPENDENCY_EXPRESSION ***StackPtr, IN OUT HII_DEPENDENCY_EXPRESSION ***StackEnd, IN HII_DEPENDENCY_EXPRESSION **Data)
|
/* Push an element onto the Stack for Expression Dependencies. */
EFI_STATUS PushDependencyStack(IN OUT HII_DEPENDENCY_EXPRESSION ***Stack, IN OUT HII_DEPENDENCY_EXPRESSION ***StackPtr, IN OUT HII_DEPENDENCY_EXPRESSION ***StackEnd, IN HII_DEPENDENCY_EXPRESSION **Data)
|
{
EFI_STATUS Status;
if (*StackPtr >= *StackEnd) {
Status = GrowDependencyStack (Stack, StackPtr, StackEnd);
if (EFI_ERROR (Status)) {
return Status;
}
}
CopyMem (*StackPtr, Data, sizeof (HII_DEPENDENCY_EXPRESSION *));
*StackPtr = *StackPtr + 1;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return the "partitionable endpoint" (pe) under which this device lies */
|
struct device_node* find_device_pe(struct device_node *dn)
|
/* Return the "partitionable endpoint" (pe) under which this device lies */
struct device_node* find_device_pe(struct device_node *dn)
|
{
while ((dn->parent) && PCI_DN(dn->parent) &&
(PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) {
dn = dn->parent;
}
return dn;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Produce one character in the parser's output buffer. */
|
STATIC VOID ParserCopy(OUT CHAR8 *Buffer, IN OUT UINTN *Position, IN UINTN Size, IN CHAR8 Char8)
|
/* Produce one character in the parser's output buffer. */
STATIC VOID ParserCopy(OUT CHAR8 *Buffer, IN OUT UINTN *Position, IN UINTN Size, IN CHAR8 Char8)
|
{
ASSERT (*Position < Size);
Buffer[(*Position)++] = Char8;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function searches into the Gcd Memory Space for descriptors (from StartIndex to EndIndex) that contains the memory range specified by BaseAddress and Length. */
|
EFI_STATUS SearchGcdMemorySpaces(IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap, IN UINTN NumberOfDescriptors, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, OUT UINTN *StartIndex, OUT UINTN *EndIndex)
|
/* This function searches into the Gcd Memory Space for descriptors (from StartIndex to EndIndex) that contains the memory range specified by BaseAddress and Length. */
EFI_STATUS SearchGcdMemorySpaces(IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap, IN UINTN NumberOfDescriptors, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, OUT UINTN *StartIndex, OUT UINTN *EndIndex)
|
{
UINTN Index;
*StartIndex = 0;
*EndIndex = 0;
for (Index = 0; Index < NumberOfDescriptors; Index++) {
if ((BaseAddress >= MemorySpaceMap[Index].BaseAddress) &&
(BaseAddress < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length)))
{
*StartIndex = Index;
}
if (((BaseAddress + Length - 1) >= MemorySpaceMap[Index].BaseAddress) &&
((BaseAddress + Length - 1) < (MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length)))
{
*EndIndex = Index;
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Program the MWDMA/UDMA modes for the AMD and Nvidia chipset. */
|
static void nv100_set_dmamode(struct ata_port *ap, struct ata_device *adev)
|
/* Program the MWDMA/UDMA modes for the AMD and Nvidia chipset. */
static void nv100_set_dmamode(struct ata_port *ap, struct ata_device *adev)
|
{
timing_setup(ap, adev, 0x50, adev->dma_mode, 3);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If 'write' is non-zero, then we wipe out the journal on disk; otherwise we merely suppress recovery. */
|
int journal_wipe(journal_t *journal, int write)
|
/* If 'write' is non-zero, then we wipe out the journal on disk; otherwise we merely suppress recovery. */
int journal_wipe(journal_t *journal, int write)
|
{
journal_superblock_t *sb;
int err = 0;
J_ASSERT (!(journal->j_flags & JFS_LOADED));
err = load_superblock(journal);
if (err)
return err;
sb = journal->j_superblock;
if (!journal->j_tail)
goto no_recovery;
printk (KERN_WARNING "JBD: %s recovery information on journal\n",
write ? "Clearing" : "Ignoring");
err = journal_skip_recovery(journal);
if (write)
journal_update_superblock(journal, 1);
no_recovery:
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns CRStatement at position itemnr, if itemnr > number of statements - 1, it will return NULL. */
|
CRStatement* cr_statement_get_from_list(CRStatement *a_this, int itemnr)
|
/* Returns CRStatement at position itemnr, if itemnr > number of statements - 1, it will return NULL. */
CRStatement* cr_statement_get_from_list(CRStatement *a_this, int itemnr)
|
{
CRStatement *cur = NULL;
int nr = 0;
g_return_val_if_fail (a_this, NULL);
for (cur = a_this; cur; cur = cur->next)
if (nr++ == itemnr)
return cur;
return NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Message: MulticastMediaReceptionAckMessage Opcode: 0x0021 Type: MediaControl Direction: dev2pbx VarLength: no */
|
static void handle_MulticastMediaReceptionAckMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: MulticastMediaReceptionAckMessage Opcode: 0x0021 Type: MediaControl Direction: dev2pbx VarLength: no */
static void handle_MulticastMediaReceptionAckMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
ptvcursor_add(cursor, hf_skinny_receptionStatus, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_passThruPartyID, 4, ENC_LITTLE_ENDIAN);
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* STUSB1602 checks the VCONN power switch Over Current Protection Fault Transition (bit1 0x12 */
|
VCONN_SW_OCP_Fault_Trans_TypeDef STUSB1602_VCONN_SW_OCP_Fault_Trans_Get(uint8_t Addr)
|
/* STUSB1602 checks the VCONN power switch Over Current Protection Fault Transition (bit1 0x12 */
VCONN_SW_OCP_Fault_Trans_TypeDef STUSB1602_VCONN_SW_OCP_Fault_Trans_Get(uint8_t Addr)
|
{
STUSB1602_HW_FAULT_STATUS_TRANS_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_HW_FAULT_STATUS_TRANS_REG, 1);
return (VCONN_SW_OCP_Fault_Trans_TypeDef)(reg.b.VCONN_SW_OCP_FAULT_TRANS);
}
|
st-one/X-CUBE-USB-PD
|
C++
| null | 110
|
/* mpt_device_driver_deregister - DeRegister device driver hooks @cb_idx: MPT protocol driver index */
|
void mpt_device_driver_deregister(u8 cb_idx)
|
/* mpt_device_driver_deregister - DeRegister device driver hooks @cb_idx: MPT protocol driver index */
void mpt_device_driver_deregister(u8 cb_idx)
|
{
struct mpt_pci_driver *dd_cbfunc;
MPT_ADAPTER *ioc;
if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS)
return;
dd_cbfunc = MptDeviceDriverHandlers[cb_idx];
list_for_each_entry(ioc, &ioc_list, list) {
if (dd_cbfunc->remove)
dd_cbfunc->remove(ioc->pcidev);
}
MptDeviceDriverHandlers[cb_idx] = NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* scan_devices() simply iterates through the device page. The type 0 is reserved to mean "end of devices". */
|
static void scan_devices(void)
|
/* scan_devices() simply iterates through the device page. The type 0 is reserved to mean "end of devices". */
static void scan_devices(void)
|
{
unsigned int i;
struct kvm_device_desc *d;
for (i = 0; i < PAGE_SIZE; i += desc_size(d)) {
d = kvm_devices + i;
if (d->type == 0)
break;
add_kvm_device(d, i);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* param base ACMP peripheral base address. param mask Status flags mask. See "_acmp_status_flags". */
|
void ACMP_ClearStatusFlags(CMP_Type *base, uint32_t mask)
|
/* param base ACMP peripheral base address. param mask Status flags mask. See "_acmp_status_flags". */
void ACMP_ClearStatusFlags(CMP_Type *base, uint32_t mask)
|
{
uint32_t tmp32 = (base->C0 & (~(CMP_C0_CFR_MASK | CMP_C0_CFF_MASK)));
if ((uint32_t)kACMP_OutputRisingEventFlag == (mask & (uint32_t)kACMP_OutputRisingEventFlag))
{
tmp32 |= CMP_C0_CFR_MASK;
}
if ((uint32_t)kACMP_OutputFallingEventFlag == (mask & (uint32_t)kACMP_OutputFallingEventFlag))
{
tmp32 |= CMP_C0_CFF_MASK;
}
base->C0 = tmp32;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Clears the designated bits in a write-protected 16/32-bit data word at a local CPU system address */
|
void IPCRtoLClearBits_Protected(tIpcMessage *psMessage)
|
/* Clears the designated bits in a write-protected 16/32-bit data word at a local CPU system address */
void IPCRtoLClearBits_Protected(tIpcMessage *psMessage)
|
{
uint16_t usLength;
EALLOW;
usLength = (uint16_t)psMessage->uldataw1;
if (usLength == IPC_LENGTH_16_BITS)
{
*(volatile uint16_t*)psMessage->uladdress &=
~((uint16_t) psMessage->uldataw2);
}
else if (usLength == IPC_LENGTH_32_BITS)
{
*(volatile unsigned long *)psMessage->uladdress &=
~(psMessage->uldataw2);
}
EDIS;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If called multiple times, then the data read will continue at the offset of the firmware configuration item where the previous read ended. */
|
VOID EFIAPI QemuFwCfgReadBytes(IN UINTN Size, IN VOID *Buffer)
|
/* If called multiple times, then the data read will continue at the offset of the firmware configuration item where the previous read ended. */
VOID EFIAPI QemuFwCfgReadBytes(IN UINTN Size, IN VOID *Buffer)
|
{
if (QemuFwCfgIsAvailable ()) {
InternalQemuFwCfgReadBytes (Size, Buffer);
} else {
ZeroMem (Buffer, Size);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is called at startup by init_etherarray() and then by etheraddr_string() as needed. To avoid doing an expensive fopen() on each call, the contents of 'etc_path("ethers")' is cached here in a linked-list 'eth0'. */
|
int ether_ntohost(char *name, struct ether_addr *e)
|
/* This function is called at startup by init_etherarray() and then by etheraddr_string() as needed. To avoid doing an expensive fopen() on each call, the contents of 'etc_path("ethers")' is cached here in a linked-list 'eth0'. */
int ether_ntohost(char *name, struct ether_addr *e)
|
{
const struct ether_entry *cache;
static int init = 0;
if (!init) {
init_ethers();
init = 1;
}
for (cache = eth0; cache; cache = cache->next)
if (!memcmp(&e->octet, &cache->eth_addr, ETHER_ADDR_LEN)) {
strcpy (name,cache->name);
return (0);
}
return (1);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* ID Command Function: MX25_RDID Arguments: Identification, 32 bit buffer to store id Description: The RDID instruction is to read the manufacturer ID of 1-byte and followed by Device ID of 2-byte. Return Message: FlashOperationSuccess */
|
ReturnMsg MX25_RDID(uint32_t *Identification)
|
/* ID Command Function: MX25_RDID Arguments: Identification, 32 bit buffer to store id Description: The RDID instruction is to read the manufacturer ID of 1-byte and followed by Device ID of 2-byte. Return Message: FlashOperationSuccess */
ReturnMsg MX25_RDID(uint32_t *Identification)
|
{
uint32_t temp;
uint8_t gDataBuffer[3];
CS_Low();
SendByte( FLASH_CMD_RDID, SIO );
gDataBuffer[0] = GetByte( SIO );
gDataBuffer[1] = GetByte( SIO );
gDataBuffer[2] = GetByte( SIO );
CS_High();
temp = gDataBuffer[0];
temp = (temp << 8) | gDataBuffer[1];
*Identification = (temp << 8) | gDataBuffer[2];
return FlashOperationSuccess;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Always get the target's kref when scheduling work on one its units. Each workqueue job is responsible to call sbp2_target_put() upon return. */
|
static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay)
|
/* Always get the target's kref when scheduling work on one its units. Each workqueue job is responsible to call sbp2_target_put() upon return. */
static void sbp2_queue_work(struct sbp2_logical_unit *lu, unsigned long delay)
|
{
sbp2_target_get(lu->tgt);
if (!queue_delayed_work(sbp2_wq, &lu->work, delay))
sbp2_target_put(lu->tgt);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* brief Return Frequency of SAI TX BCLK return Frequency of SAI TX BCLK */
|
uint32_t CLOCK_GetSaiTxBclkFreq(uint32_t id)
|
/* brief Return Frequency of SAI TX BCLK return Frequency of SAI TX BCLK */
uint32_t CLOCK_GetSaiTxBclkFreq(uint32_t id)
|
{
return s_Sai_Tx_Bclk_Freq[id];
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* USB_OTG_USBH_handle_hc_ISR This function indicates that one or more host channels has a pending. */
|
static uint32_t USB_OTG_USBH_handle_hc_ISR(USB_OTG_CORE_HANDLE *pdev)
|
/* USB_OTG_USBH_handle_hc_ISR This function indicates that one or more host channels has a pending. */
static uint32_t USB_OTG_USBH_handle_hc_ISR(USB_OTG_CORE_HANDLE *pdev)
|
{
USB_OTG_HAINT_TypeDef haint;
USB_OTG_HCCHAR_TypeDef hcchar;
uint32_t i = 0;
uint32_t retval = 0;
haint.d32 = USB_OTG_ReadHostAllChannels_intr(pdev);
for (i = 0; i < pdev->cfg.host_channels ; i++)
{
if (haint.b.chint & (1 << i))
{
hcchar.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[i]->HCCHAR);
if (hcchar.b.epdir)
{
retval |= USB_OTG_USBH_handle_hc_n_In_ISR (pdev, i);
}
else
{
retval |= USB_OTG_USBH_handle_hc_n_Out_ISR (pdev, i);
}
}
}
return retval;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* This function validates the ID Mapping array count for the ITS node. */
|
STATIC VOID EFIAPI ValidateItsIdMappingCount(IN UINT8 *Ptr, IN VOID *Context)
|
/* This function validates the ID Mapping array count for the ITS node. */
STATIC VOID EFIAPI ValidateItsIdMappingCount(IN UINT8 *Ptr, IN VOID *Context)
|
{
if (*(UINT32 *)Ptr != 0) {
IncrementErrorCount ();
Print (L"\nERROR: IORT ID Mapping count must be zero.");
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* @a_this: the this pointer of the current instance of #CRSimpleSel. @a_sel: the simple selector to append. Returns: the new list upon successfull completion, an error code otherwise. */
|
CRSimpleSel* cr_simple_sel_append_simple_sel(CRSimpleSel *a_this, CRSimpleSel *a_sel)
|
/* @a_this: the this pointer of the current instance of #CRSimpleSel. @a_sel: the simple selector to append. Returns: the new list upon successfull completion, an error code otherwise. */
CRSimpleSel* cr_simple_sel_append_simple_sel(CRSimpleSel *a_this, CRSimpleSel *a_sel)
|
{
CRSimpleSel *cur = NULL;
g_return_val_if_fail (a_sel, NULL);
if (a_this == NULL)
return a_sel;
for (cur = a_this; cur->next; cur = cur->next) ;
cur->next = a_sel;
a_sel->prev = cur;
return a_this;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Configure pins as Analog Input Output EVENT_OUT EXTI */
|
void MX_GPIO_Init(void)
|
/* Configure pins as Analog Input Output EVENT_OUT EXTI */
void MX_GPIO_Init(void)
|
{
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Free the integrity information(iint) associated with an inode. */
|
void ima_inode_free(struct inode *inode)
|
/* Free the integrity information(iint) associated with an inode. */
void ima_inode_free(struct inode *inode)
|
{
struct ima_iint_cache *iint;
spin_lock(&ima_iint_lock);
iint = radix_tree_delete(&ima_iint_store, (unsigned long)inode);
spin_unlock(&ima_iint_lock);
if (iint)
call_rcu(&iint->rcu, iint_rcu_free);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Timedia/SUNIX uses a mixture of BARs and offsets Ugh, this is ugly as all hell */
|
static int pci_timedia_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_port *port, int idx)
|
/* Timedia/SUNIX uses a mixture of BARs and offsets Ugh, this is ugly as all hell */
static int pci_timedia_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_port *port, int idx)
|
{
unsigned int bar = 0, offset = board->first_offset;
switch (idx) {
case 0:
bar = 0;
break;
case 1:
offset = board->uart_offset;
bar = 0;
break;
case 2:
bar = 1;
break;
case 3:
offset = board->uart_offset;
case 4:
case 5:
case 6:
case 7:
bar = idx - 2;
}
return setup_port(priv, port, bar, offset, board->reg_shift);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This routine prepares the mailbox command for unregistering remote port login. */
|
void lpfc_unreg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t rpi, LPFC_MBOXQ_t *pmb)
|
/* This routine prepares the mailbox command for unregistering remote port login. */
void lpfc_unreg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t rpi, LPFC_MBOXQ_t *pmb)
|
{
MAILBOX_t *mb;
mb = &pmb->u.mb;
memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
mb->un.varUnregLogin.rpi = (uint16_t) rpi;
mb->un.varUnregLogin.rsvd1 = 0;
mb->un.varUnregLogin.vpi = vpi + phba->vpi_base;
mb->mbxCommand = MBX_UNREG_LOGIN;
mb->mbxOwner = OWN_HOST;
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Stream data from gas sensor at specified intervals. */
|
void CN0429_StreamData(void)
|
/* Stream data from gas sensor at specified intervals. */
void CN0429_StreamData(void)
|
{
flushBuff(TXbuff, sizeof(TXbuff));
for (uint8_t i = 0; i < NUM_SENSORS; i++) {
if (detected_sensors[i]) {
flushBuff(gBuff, sizeof(gBuff));
snprintf((char*) gBuff, 64, "%ld, ",
CN0429_SensorReadoutPPB(sensor_addresses[i]));
strcat((char*) TXbuff, (char*) gBuff);
}
}
UART_TX((const char*) TXbuff);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* If -1 is return, then it was not possible to set the flags */
|
int mpt_set_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc)
|
/* If -1 is return, then it was not possible to set the flags */
int mpt_set_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc)
|
{
unsigned long flags;
int retval;
spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
if (ioc->ioc_reset_in_progress || ioc->taskmgmt_in_progress ||
(ioc->alt_ioc && ioc->alt_ioc->taskmgmt_in_progress)) {
retval = -1;
goto out;
}
retval = 0;
ioc->taskmgmt_in_progress = 1;
ioc->taskmgmt_quiesce_io = 1;
if (ioc->alt_ioc) {
ioc->alt_ioc->taskmgmt_in_progress = 1;
ioc->alt_ioc->taskmgmt_quiesce_io = 1;
}
out:
spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
return retval;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set the slave select pins of the specified SPI port.
The */
|
void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
|
/* Set the slave select pins of the specified SPI port.
The */
void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
|
{
xASSERT(ulBase == SPI0_BASE);
xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) ||
(ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1));
xHWREG(ulBase + SPI_SSR) |= ulSSMode;
xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M;
xHWREG(ulBase + SPI_SSR) |= ulSlaveSel;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* allocates a mac tree node from the pool
Allocates and initializes a mac tree node from the pool. */
|
IX_ETH_DB_PUBLIC MacTreeNode* ixEthDBAllocMacTreeNode(void)
|
/* allocates a mac tree node from the pool
Allocates and initializes a mac tree node from the pool. */
IX_ETH_DB_PUBLIC MacTreeNode* ixEthDBAllocMacTreeNode(void)
|
{
MacTreeNode *allocatedNode = NULL;
if (treePool != NULL)
{
LOCK_TREE_POOL;
allocatedNode = treePool;
treePool = treePool->nextFree;
UNLOCK_TREE_POOL;
memset(allocatedNode, 0, sizeof(MacTreeNode));
}
return allocatedNode;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Compute a default tile size based on the image characteristics and a requested value. If a request is <1 then we choose a size according to certain heuristics. */
|
void TIFFDefaultTileSize(TIFF *tif, uint32 *tw, uint32 *th)
|
/* Compute a default tile size based on the image characteristics and a requested value. If a request is <1 then we choose a size according to certain heuristics. */
void TIFFDefaultTileSize(TIFF *tif, uint32 *tw, uint32 *th)
|
{
(*tif->tif_deftilesize)(tif, tw, th);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Special handler for fault exception. Rip/Eip in SystemContext will be modified to the instruction after the exception instruction. */
|
VOID EFIAPI AdjustRipForFaultHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
|
/* Special handler for fault exception. Rip/Eip in SystemContext will be modified to the instruction after the exception instruction. */
VOID EFIAPI AdjustRipForFaultHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
|
{
mExceptionType = ExceptionType;
SystemContext.SystemContextX64->Rip += mFaultInstructionLength;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* I2C Set Fast Mode.
Set the clock frequency to the high clock rate mode (up to 400kHz). The actual clock frequency must be set with */
|
void i2c_set_fast_mode(uint32_t i2c)
|
/* I2C Set Fast Mode.
Set the clock frequency to the high clock rate mode (up to 400kHz). The actual clock frequency must be set with */
void i2c_set_fast_mode(uint32_t i2c)
|
{
I2C_CCR(i2c) |= I2C_CCR_FS;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Adds a new element at the tail of the queue. */
|
void g_queue_push_tail(GQueue *queue, gpointer data)
|
/* Adds a new element at the tail of the queue. */
void g_queue_push_tail(GQueue *queue, gpointer data)
|
{
g_return_if_fail (queue != NULL);
queue->tail = g_list_append (queue->tail, data);
if (queue->tail->next)
queue->tail = queue->tail->next;
else
queue->head = queue->tail;
queue->length++;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* It protects the ep0 request queue as well as ep0_state, not just the controller and indexed registers. And that lock stays held unless it needs to be dropped to allow reentering this driver ... like upcalls to the gadget driver, or adjusting endpoint halt status. */
|
static char* decode_ep0stage(u8 stage)
|
/* It protects the ep0 request queue as well as ep0_state, not just the controller and indexed registers. And that lock stays held unless it needs to be dropped to allow reentering this driver ... like upcalls to the gadget driver, or adjusting endpoint halt status. */
static char* decode_ep0stage(u8 stage)
|
{
switch (stage) {
case MUSB_EP0_STAGE_IDLE: return "idle";
case MUSB_EP0_STAGE_SETUP: return "setup";
case MUSB_EP0_STAGE_TX: return "in";
case MUSB_EP0_STAGE_RX: return "out";
case MUSB_EP0_STAGE_ACKWAIT: return "wait";
case MUSB_EP0_STAGE_STATUSIN: return "in/status";
case MUSB_EP0_STAGE_STATUSOUT: return "out/status";
default: return "?";
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Adds an unread alert to the given category then notifies the client if the given category is valid and enabled. */
|
int ble_svc_ans_unr_alert_add(uint8_t cat_id)
|
/* Adds an unread alert to the given category then notifies the client if the given category is valid and enabled. */
int ble_svc_ans_unr_alert_add(uint8_t cat_id)
|
{
uint8_t cat_bit_mask;
if (cat_id < BLE_SVC_ANS_CAT_NUM) {
cat_bit_mask = 1 << cat_id;
} else {
return BLE_HS_EINVAL;
}
if ((cat_bit_mask & ble_svc_ans_unr_alert_cat) == 0) {
return BLE_HS_EINVAL;
}
ble_svc_ans_unr_alert_cnt[cat_id] += 1;
return ble_svc_ans_unr_alert_notify(cat_id);
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* The resulting memory area is 32bit addressable and zeroed so it can be mapped to userspace without leaking data. */
|
void* vmalloc_32_user(unsigned long size)
|
/* The resulting memory area is 32bit addressable and zeroed so it can be mapped to userspace without leaking data. */
void* vmalloc_32_user(unsigned long size)
|
{
struct vm_struct *area;
void *ret;
ret = __vmalloc_node(size, 1, GFP_VMALLOC32 | __GFP_ZERO, PAGE_KERNEL,
-1, __builtin_return_address(0));
if (ret) {
area = find_vm_area(ret);
area->flags |= VM_USERMAP;
}
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disable the PWM interrupt of the PWM module.
//! The */
|
void PWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
/* Disable the PWM interrupt of the PWM module.
//! The */
void PWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
{
xASSERT(PWMBaseValid(ulBase));
xASSERT(((ulChannel >= 0) || (ulChannel <= 3)));
xASSERT((ulIntType == PWM_INT_CHXCC) || (ulIntType == PWM_INT_UEV1));
if (ulIntType == PWM_INT_UEV1)
{
xHWREG(ulBase + TIMER_DIER) &= ~PWM_INT_UEV1;
}
else
{
xHWREG(ulBase + TIMER_DIER) &= ~(PWM_INT_CHXCC << ulChannel);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Send bytes count. retval kStatus_NoTransferInProgress No send in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
|
status_t LPUART_TransferGetSendCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
|
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Send bytes count. retval kStatus_NoTransferInProgress No send in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
status_t LPUART_TransferGetSendCount(LPUART_Type *base, lpuart_handle_t *handle, uint32_t *count)
|
{
assert(handle);
assert(count);
if (kLPUART_TxIdle == handle->txState)
{
return kStatus_NoTransferInProgress;
}
*count = handle->txDataSizeAll - handle->txDataSize;
return kStatus_Success;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* SPI0 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
|
void SPI0_IRQHandler(void)
|
/* SPI0 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
void SPI0_IRQHandler(void)
|
{
unsigned long ulEventFlags;
unsigned long ulBase = SPI0_BASE;
ulEventFlags = xHWREG(ulBase + SPI_STATUS);
xHWREG(ulBase + SPI_STATUS) |= ulEventFlags;
if(g_pfnSPIHandlerCallbacks[0])
{
g_pfnSPIHandlerCallbacks[0](0, 0, ulEventFlags, 0);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Indicates whether the LPTIM operates in encoder mode. @rmtoll CFG ENC LPTIM_IsEnabledEncoderMode. */
|
uint32_t LPTIM_IsEnabledEncoderMode(LPTIM_Module *LPTIMx)
|
/* Indicates whether the LPTIM operates in encoder mode. @rmtoll CFG ENC LPTIM_IsEnabledEncoderMode. */
uint32_t LPTIM_IsEnabledEncoderMode(LPTIM_Module *LPTIMx)
|
{
return (((READ_BIT(LPTIMx->CFG, LPTIM_CFG_ENC) == LPTIM_CFG_ENC)? 1UL : 0UL));
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* If HmacSha256Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
|
BOOLEAN EFIAPI CryptoServiceHmacSha256SetKey(OUT VOID *HmacSha256Context, IN CONST UINT8 *Key, IN UINTN KeySize)
|
/* If HmacSha256Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceHmacSha256SetKey(OUT VOID *HmacSha256Context, IN CONST UINT8 *Key, IN UINTN KeySize)
|
{
return CALL_BASECRYPTLIB (HmacSha256.Services.SetKey, HmacSha256SetKey, (HmacSha256Context, Key, KeySize), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Send DRAM command data should be formated using DCMD_Xxxx macro or emrsXCommand structure */
|
void dram_init_command(uint32_t data)
|
/* Send DRAM command data should be formated using DCMD_Xxxx macro or emrsXCommand structure */
void dram_init_command(uint32_t data)
|
{
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_DATA_REG, data);
qrk_pci_write_config_dword(QUARK_HOST_BRIDGE, MSG_CTRL_EXT_REG, 0);
msg_port_setup(MSG_OP_DRAM_INIT, MEM_CTLR, 0);
DPF(D_REGWR, "WR32 %03X %08X %08X\n", MEM_CTLR, 0, data);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Copy the generic stub into the new buffer and fixup the vector number and jump target address. */
|
VOID CreateEntryStub(IN EFI_EXCEPTION_TYPE ExceptionType, OUT VOID **Stub)
|
/* Copy the generic stub into the new buffer and fixup the vector number and jump target address. */
VOID CreateEntryStub(IN EFI_EXCEPTION_TYPE ExceptionType, OUT VOID **Stub)
|
{
UINT8 *StubCopy;
StubCopy = *Stub;
StubCopy[0x1] = (UINT8)ExceptionType;
*(UINT32 *)&StubCopy[0x3] = (UINT32)((UINTN)CommonIdtEntry - (UINTN)&StubCopy[StubSize]);
return;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This routine is used to process all PCI devices' Option Rom on a certain root bridge. */
|
VOID ProcessOptionRom(IN PCI_IO_DEVICE *Bridge, IN UINT64 RomBase, IN UINT64 MaxLength)
|
/* This routine is used to process all PCI devices' Option Rom on a certain root bridge. */
VOID ProcessOptionRom(IN PCI_IO_DEVICE *Bridge, IN UINT64 RomBase, IN UINT64 MaxLength)
|
{
LIST_ENTRY *CurrentLink;
PCI_IO_DEVICE *Temp;
CurrentLink = Bridge->ChildList.ForwardLink;
while (CurrentLink != NULL && CurrentLink != &Bridge->ChildList) {
Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);
if (!IsListEmpty (&Temp->ChildList)) {
ProcessOptionRom (Temp, RomBase, MaxLength);
}
if ((Temp->RomSize != 0) && (Temp->RomSize <= MaxLength)) {
LoadOpRomImage (Temp, RomBase);
}
CurrentLink = CurrentLink->ForwardLink;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Read a value from ucPhyReg within the PHY. *plStatus will be set to pdFALSE if there is an error. */
|
static unsigned short prvReadPHY(unsigned char ucPhyReg, long *plStatus)
|
/* Read a value from ucPhyReg within the PHY. *plStatus will be set to pdFALSE if there is an error. */
static unsigned short prvReadPHY(unsigned char ucPhyReg, long *plStatus)
|
{
long x;
const long lMaxTime = 10;
EMAC->MADR = DP83848C_DEF_ADR | ucPhyReg;
EMAC->MCMD = MCMD_READ;
for( x = 0; x < lMaxTime; x++ )
{
if( ( EMAC->MIND & MIND_BUSY ) == 0 )
{
break;
}
vTaskDelay( emacSHORT_DELAY );
}
EMAC->MCMD = 0;
if( x >= lMaxTime )
{
*plStatus = pdFAIL;
}
return( EMAC->MRDD );
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Provide a default dump_stack() function for architectures which don't implement their own. */
|
void dump_stack(void)
|
/* Provide a default dump_stack() function for architectures which don't implement their own. */
void dump_stack(void)
|
{
printk(KERN_NOTICE
"This architecture does not implement dump_stack()\n");
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initializes the TIMER Time base Unit according to the specified parameters in the timer_handle_t and create the associated handle. */
|
ald_status_t ald_timer_base_init(ald_timer_handle_t *hperh)
|
/* Initializes the TIMER Time base Unit according to the specified parameters in the timer_handle_t and create the associated handle. */
ald_status_t ald_timer_base_init(ald_timer_handle_t *hperh)
|
{
if (hperh == NULL)
return ALD_ERROR;
assert_param(IS_TIMER_INSTANCE(hperh->perh));
assert_param(IS_TIMER_COUNTER_MODE(hperh->init.mode));
assert_param(IS_TIMER_CLOCK_DIVISION(hperh->init.clk_div));
if (hperh->state == ALD_TIMER_STATE_RESET)
hperh->lock = UNLOCK;
hperh->state = ALD_TIMER_STATE_BUSY;
timer_base_set_config(hperh->perh, &hperh->init);
hperh->state = ALD_TIMER_STATE_READY;
return ALD_OK;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called when we switch away from DATA IN or DATA OUT phases. */
|
static void fas216_stoptransfer(FAS216_Info *info)
|
/* Called when we switch away from DATA IN or DATA OUT phases. */
static void fas216_stoptransfer(FAS216_Info *info)
|
{
fas216_checkmagic(info);
if (info->dma.transfer_type == fasdma_real_all ||
info->dma.transfer_type == fasdma_real_block)
info->dma.stop(info->host, &info->scsi.SCp);
fas216_cleanuptransfer(info);
if (info->scsi.phase == PHASE_DATAIN) {
unsigned int fifo;
fifo = fas216_readb(info, REG_CFIS) & CFIS_CF;
while (fifo && info->scsi.SCp.ptr) {
*info->scsi.SCp.ptr = fas216_readb(info, REG_FF);
fas216_updateptrs(info, 1);
fifo--;
}
} else {
fas216_cmd(info, CMD_FLUSHFIFO);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Perform automated behaviors in response to any iface that loses oper-up state.
This is how conn_mgr_conn automatically takes such ifaces admin-down if they are not persistent. */
|
static void conn_mgr_conn_handle_iface_down(struct net_if *iface)
|
/* Perform automated behaviors in response to any iface that loses oper-up state.
This is how conn_mgr_conn automatically takes such ifaces admin-down if they are not persistent. */
static void conn_mgr_conn_handle_iface_down(struct net_if *iface)
|
{
if (!conn_mgr_if_is_bound(iface)) {
return;
}
if (conn_mgr_if_get_flag(iface, CONN_MGR_IF_PERSISTENT)) {
return;
}
conn_mgr_conn_if_auto_admin_down(iface);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Description: Allocates and returns a string filled with the contents of the &substring_t @s. The caller is responsible for freeing the returned string with kfree(). */
|
char* match_strdup(const substring_t *s)
|
/* Description: Allocates and returns a string filled with the contents of the &substring_t @s. The caller is responsible for freeing the returned string with kfree(). */
char* match_strdup(const substring_t *s)
|
{
size_t sz = s->to - s->from + 1;
char *p = kmalloc(sz, GFP_KERNEL);
if (p)
match_strlcpy(p, s, sz);
return p;
}
|
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.