本文整理汇总了C++中CHECK_ARG_LESS_THAN函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_ARG_LESS_THAN函数的具体用法?C++ CHECK_ARG_LESS_THAN怎么用?C++ CHECK_ARG_LESS_THAN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHECK_ARG_LESS_THAN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: opp_dra7xx_set
/* ------------------------------------------------------------------------*//**
* @FUNCTION opp_dra7xx_set
* @BRIEF change OPP of a given voltage domain.
* @RETURNS 0 in case of success
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_CPU
* OMAPCONF_ERR_NOT_AVAILABLE
* @param[in] vdd_id: voltage domain ID
* @param[in] opp_id: ID of the OPP to be set
* @DESCRIPTION change OPP of a given voltage domain.
*//*------------------------------------------------------------------------ */
int opp_dra7xx_set(voltdm_dra7xx_id vdd_id, opp_dra7xx_id opp_id)
{
CHECK_ARG_LESS_THAN(vdd_id, VDD_DRA7XX_ID_MAX, OMAPCONF_ERR_ARG);
CHECK_ARG_LESS_THAN(opp_id, OPP_DRA7XX_ID_MAX, OMAPCONF_ERR_ARG);
opp_dra7xx_init();
printf("Sorry, not yet implemented...\n");
return OMAPCONF_ERR_NOT_AVAILABLE;
}
示例2: opp54xx_set
/* ------------------------------------------------------------------------*//**
* @FUNCTION opp54xx_set
* @BRIEF change OPP of a given voltage domain.
* @RETURNS 0 in case of success
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_CPU
* OMAPCONF_ERR_NOT_AVAILABLE
* @param[in] vdd_id: voltage domain ID
* @param[in] opp_id: ID of the OPP to be set
* @DESCRIPTION change OPP of a given voltage domain.
*//*------------------------------------------------------------------------ */
int opp54xx_set(voltdm54xx_id vdd_id, opp54xx_id opp_id)
{
CHECK_CPU(54xx, OMAPCONF_ERR_CPU);
CHECK_ARG_LESS_THAN(vdd_id, VDD54XX_ID_MAX, OMAPCONF_ERR_ARG);
CHECK_ARG_LESS_THAN(opp_id, OPP54XX_ID_MAX, OMAPCONF_ERR_ARG);
opp54xx_init();
printf("Sorry, not yet implemented...\n");
return OMAPCONF_ERR_NOT_AVAILABLE;
}
示例3: CHECK_ARG_LESS_THAN
/* ------------------------------------------------------------------------*//**
* @FUNCTION sr44xx_golden_settings_get
* @BRIEF return SR module golden settings.
* @RETURNS SR module name on success
* "FIXME" string in case of error
* @param[in] sr_id: SR module ID
* opp_id: OPP ID
* @DESCRIPTION return SR module golden settings, for a given chip,
* module and OPP.
*//*------------------------------------------------------------------------ */
const sr_audit_settings *sr44xx_golden_settings_get(omap4_sr_module_id sr_id,
opp44xx_id opp_id)
{
omap_chip chip_id;
CHECK_ARG_LESS_THAN(sr_id, OMAP4_SR_ID_MAX, NULL);
CHECK_ARG_LESS_THAN(opp_id, OPP44XX_ID_MAX, NULL);
chip_id = cpu_get();
dprintf("%s(): sr_id=%d opp_id=%d chip_id=%d\n", __func__,
sr_id, opp_id, chip_id);
return sr44xx_golden_settings[chip_id][sr_id][opp_id];
}
示例4: sr54xx_export
/* ------------------------------------------------------------------------*//**
* @FUNCTION sr54xx_export
* @BRIEF export module register content to file, in XML format.
* @RETURNS 0 in case of success
* OMAPCONF_ERR_CPU
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_REG_ACCESS
* @param[in,out] fp: output file stream (opened for write operations)
* @param[in] id: SR module ID
* @DESCRIPTION export module register content to file, in XML format.
*//*------------------------------------------------------------------------ */
int sr54xx_export(FILE *fp, sr54xx_mod_id id)
{
reg **mod;
unsigned int i;
CHECK_CPU(54xx, OMAPCONF_ERR_CPU);
CHECK_NULL_ARG(fp, OMAPCONF_ERR_ARG);
CHECK_ARG_LESS_THAN(id, SR54XX_MODS_COUNT, OMAPCONF_ERR_ARG);
if (!sr54xx_is_enabled(id)) {
printf("%s export: module not running, skipping "
"registers export.\n", sr54xx_mod_name_get(id));
return 0;
}
mod = sr54xx_mods[id];
fprintf(fp, " <submodule id=\"%u\" name=\"%s\">\n",
id, sr54xx_mod_name_get(id));
for (i = 0; i < OMAP5430_SMARTREFLEX_CORE_MOD_REGCOUNT; i++)
fprintf(fp, " <register id=\"%u\" name=\"%s\" "
"addr=\"0x%08X\" data=\"0x%08X\" />\n", i,
(mod[i])->name, (mod[i])->addr, reg_read(mod[i]));
fprintf(fp, " </submodule>\n");
return 0;
}
示例5: smps_step_get
/* ------------------------------------------------------------------------*//**
* @FUNCTION smps_step_get
* @BRIEF return SMPS regulator voltage step (in microvolts)
* @RETURNS > 0 voltage step in microvolts
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_NOT_AVAILABLE
* @param[in] smps_id: valid SMPS ID
* @DESCRIPTION return SMPS regulator voltage step (in microvolts)
*//*------------------------------------------------------------------------ */
long smps_step_get(pmic_smps_id smps_id)
{
long step;
CHECK_ARG_LESS_THAN(smps_id, PMIC_SMPS_ID_MAX, (long) OMAPCONF_ERR_ARG);
if (!pmic_detection_done())
pmic_detect();
switch (pmic_chip[smps_id]) {
case PMIC_TWL6030:
case PMIC_TWL6032:
case PMIC_TWL6034:
case PMIC_TWL6035:
step = twl603x_smps_step_get();
break;
case PMIC_TPS62361:
step = tps62361_smps_step_get();
break;
case PMIC_TPS659038:
step = tps659038_smps_step_get();
break;
case PMIC_TPS65217A:
case PMIC_TPS65217B:
case PMIC_TPS65217C:
case PMIC_TPS65217D:
step = tps65217x_smps_step_get();
default:
step = (long) OMAPCONF_ERR_NOT_AVAILABLE;
}
dprintf("%s(%s): step=%lduV\n", __func__, smps_name_get(smps_id), step);
return step;
}
示例6: voltdm54xx_voltage_set
/* ------------------------------------------------------------------------*//**
* @FUNCTION voltdm54xx_voltage_set
* @BRIEF set voltage of given voltage domain
* @RETURNS 0 in case of success
* OMAPCONF_ERR_CPU
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_NOT_AVAILABLE
* OMAPCONF_ERR_REG_ACCESS
* OMAPCONF_ERR_INTERNAL
* @param[in] id: valid voltage domain ID
* @DESCRIPTION set voltage of given voltage domain
*//*------------------------------------------------------------------------ */
int voltdm54xx_voltage_set(voltdm54xx_id id, unsigned long uv)
{
CHECK_CPU(54xx, (double) OMAPCONF_ERR_CPU);
CHECK_ARG_LESS_THAN(id, VDD54XX_ID_MAX, (double) OMAPCONF_ERR_ARG);
/* Retrieve domain state */
switch (id) {
case VDD54XX_WKUP:
return OMAPCONF_ERR_NOT_AVAILABLE;
case VDD54XX_MPU:
return smps_voltage_set(PMIC_SMPS_MPU, uv);
break;
case VDD54XX_MM:
return smps_voltage_set(PMIC_SMPS_MM, uv);
break;
case VDD54XX_CORE:
return smps_voltage_set(PMIC_SMPS_CORE, uv);
break;
default:
return OMAPCONF_ERR_ARG;
}
}
示例7: CHECK_ARG_LESS_THAN
/* ------------------------------------------------------------------------*//**
* @FUNCTION smps_name_get
* @BRIEF return PMIC SMPS name as a string
* @RETURNS PMIC SMPS name as a string in case of success
* NULL in case of error
* @param[in] smps_id: valid SMPS ID
* @DESCRIPTION return PMIC SMPS name as a string
*//*------------------------------------------------------------------------ */
const char *smps_name_get(pmic_smps_id smps_id)
{
CHECK_ARG_LESS_THAN(smps_id, PMIC_SMPS_ID_MAX, NULL);
switch (cpu_get()) {
case OMAP_4430:
case OMAP_4460:
case OMAP_4470:
return smps44xx_names[smps_id];
break;
case OMAP_5430:
case OMAP_5432:
return smps54xx_names[smps_id];
break;
case DRA_75X:
return smps_dra7xx_names[smps_id];
break;
case AM_3352:
case AM_3354:
case AM_3356:
case AM_3357:
case AM_3358:
case AM_3359:
return smps_am335x_names[smps_id];
break;
default:
return smps44xx_names[smps_id];
}
}
示例8: voltdm54xx_por_nominal_voltage_get
/* ------------------------------------------------------------------------*//**
* @FUNCTION voltdm54xx_por_nominal_voltage_get
* @BRIEF return the Plan of Record (POR) nominal voltage
* of a given voltage domain for a given OPP.
* @RETURNS supply voltage in case of success (>= 0.0)
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_CPU
* @param[in] id: valid voltage domain ID
* @DESCRIPTION return the Plan of Record (POR) nominal voltage
* of a given voltage domain for a given OPP.
*//*------------------------------------------------------------------------ */
double voltdm54xx_por_nominal_voltage_get(voltdm54xx_id id, opp54xx_id opp_id)
{
double volt;
CHECK_CPU(54xx, (double) OMAPCONF_ERR_CPU);
CHECK_ARG_LESS_THAN(id, VDD54XX_ID_MAX, (double) OMAPCONF_ERR_ARG);
CHECK_ARG_LESS_THAN(id, VDD54XX_ID_MAX, (double) OMAPCONF_ERR_ARG);
volt = voltdm54xx_por_nominal_voltages_table_es1[id][opp_id];
dprintf("%s(%s): %s POR nominal volt=%lfV\n", __func__,
opp54xx_name_get(opp_id),
voltdm54xx_name_get(id), volt);
return volt;
}
示例9: voltdm_am335x_voltage_get
/* ------------------------------------------------------------------------*//**
* @FUNCTION voltdm_am335x_voltage_get
* @BRIEF find the current supply voltage of a domain
* @RETURNS supply voltage in case of success (>= 0.0)
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_CPU
* OMAPCONF_ERR_REG_ACCESS
* OMAPCONF_ERR_NOT_AVAILABLE
* @param[in] id: valid voltage domain ID
* @DESCRIPTION find the current supply voltage of a domain,
* taking care of the voltage domain state
* (ON/ON_LP/RET/OFF)
* NB: use PRCM VP VOLTAGE register to retrieve ON voltage.
* Hence SR/VP/VC have to be at least initialized
* (SR could be disabled)
*//*------------------------------------------------------------------------ */
double voltdm_am335x_voltage_get(voltdm_am335x_id id)
{
double volt;
CHECK_ARG_LESS_THAN(id, VDD_AM335X_ID_MAX, (double) OMAPCONF_ERR_ARG);
switch (id) {
case VDD_AM335X_CORE:
volt = smps_voltage_get(PMIC_SMPS_CORE);
break;
case VDD_AM335X_MPU:
volt = smps_voltage_get(PMIC_SMPS_MPU);
break;
case VDD_AM335X_RTC:
volt = smps_voltage_get(PMIC_SMPS_ID_MAX);
break;
default:
return (double) OMAPCONF_ERR_ARG;
}
dprintf("%s(%s): volt=%lfV\n", __func__, voltdm_am335x_name_get(id), volt);
return volt;
}
示例10: voltdm54xx_nominal_voltage_get
/* ------------------------------------------------------------------------*//**
* @FUNCTION voltdm54xx_nominal_voltage_get
* @BRIEF return the nominal voltage of a given voltage domain
* @RETURNS supply voltage in case of success (>= 0.0)
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_CPU
* OMAPCONF_ERR_NOT_AVAILABLE
* @param[in] id: valid voltage domain ID
* @DESCRIPTION return the nominal voltage of a given voltage domain.
*//*------------------------------------------------------------------------ */
double voltdm54xx_nominal_voltage_get(voltdm54xx_id id)
{
int ret;
double volt;
vc54xx_registers vc_regs;
unsigned char cmd_on, cmd_onlp, cmd_ret, cmd_off;
CHECK_CPU(54xx, (double) OMAPCONF_ERR_CPU);
CHECK_ARG_LESS_THAN(id, VDD54XX_ID_MAX, (double) OMAPCONF_ERR_ARG);
ret = vc54xx_registers_get(&vc_regs);
if (ret != 0)
return (double) ret;
ret = vc54xx_cmd_values_get(id, &vc_regs,
&cmd_on, &cmd_onlp, &cmd_ret, &cmd_off);
if (ret != 0)
return (double) ret;
volt = smps_vsel2volt(vdd_id2smps_id(id), cmd_on);
dprintf("%s(%s): nominal volt=%lfV\n", __func__,
voltdm54xx_name_get(id), volt);
return volt;
}
示例11: CHECK_ARG_LESS_THAN
/* ------------------------------------------------------------------------*//**
* @FUNCTION voltdm54xx_id2s
* @BRIEF convert voltage domain ID into voltage domain name, as
* defined in voltdm.h.
* @RETURNS Voltage Domain name, as defined in voltdm.h.
* NULL in case of invalid voltage domain ID
* @param[in] id: voltage domain ID
* @DESCRIPTION convert voltage domain ID to voltage domain name.
*//*------------------------------------------------------------------------ */
const char *voltdm54xx_id2s(voltdm54xx_id id)
{
const char *s;
CHECK_ARG_LESS_THAN(id, VDD54XX_ID_MAX, NULL);
switch (id) {
case VDD54XX_WKUP:
s = VDD_WKUP;
break;
case VDD54XX_MPU:
s = VDD_MPU;
break;
case VDD54XX_MM:
s = VDD_MM;
break;
case VDD54XX_CORE:
s = VDD_CORE;
break;
default:
s = NULL;
}
dprintf("%s(%d) = %s\n", __func__, id, s);
return s;
}
示例12: voltdm54xx_voltage_get
/* ------------------------------------------------------------------------*//**
* @FUNCTION voltdm54xx_voltage_get
* @BRIEF find the current supply voltage of a domain
* @RETURNS supply voltage in case of success (>= 0.0)
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_CPU
* OMAPCONF_ERR_REG_ACCESS
* OMAPCONF_ERR_NOT_AVAILABLE
* @param[in] id: valid voltage domain ID
* @DESCRIPTION find the current supply voltage of a domain,
* taking care of the voltage domain state
* (ON/ON_LP/RET/OFF)
* NB: use PRCM VP VOLTAGE register to retrieve ON voltage.
* Hence SR/VP/VC have to be at least initialized
* (SR could be disabled)
*//*------------------------------------------------------------------------ */
double voltdm54xx_voltage_get(voltdm54xx_id id)
{
double volt;
CHECK_CPU(54xx, (double) OMAPCONF_ERR_CPU);
CHECK_ARG_LESS_THAN(id, VDD54XX_ID_MAX, (double) OMAPCONF_ERR_ARG);
switch (id) {
case VDD54XX_WKUP:
return (double) OMAPCONF_ERR_NOT_AVAILABLE;
case VDD54XX_MPU:
volt = smps_voltage_get(PMIC_SMPS_MPU);
break;
case VDD54XX_MM:
volt = smps_voltage_get(PMIC_SMPS_MM);
break;
case VDD54XX_CORE:
volt = smps_voltage_get(PMIC_SMPS_CORE);
break;
default:
return (double) OMAPCONF_ERR_ARG;
}
dprintf("%s(%s): volt=%lfV\n", __func__, voltdm54xx_name_get(id), volt);
return volt;
}
示例13: prm54xx_import
/* ------------------------------------------------------------------------*//**
* @FUNCTION prm54xx_import
* @BRIEF import OMAP PRM registers from XML file
* @RETURNS 0 in case of success
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_UNEXPECTED
* @param[in,out] fp: XML import file descriptor
* @param[in] id: CM module ID
* @DESCRIPTION import OMAP PRM registers from XML file,
* generated with lib54xx_export().
*//*------------------------------------------------------------------------ */
int prm54xx_import(FILE *fp, prm54xx_mod_id id)
{
reg **mod;
char line[256], sline[256];
char *xml_entry;
int ret, i, n;
CHECK_NULL_ARG(fp, OMAPCONF_ERR_ARG);
CHECK_ARG_LESS_THAN(id, PRM54XX_MODS_COUNT, OMAPCONF_ERR_ARG);
if (cpu_revision_get() == REV_ES1_0)
mod = prm54xxes1_mods[id];
else
mod = prm54xx_mods[id];
rewind(fp);
/* Search for the PRM module tag */
sprintf(sline, "<submodule id=\"%u\" name=\"%s\">",
id, prm54xx_mod_name_get(id));
while (fgets(line, sizeof(line), fp) != NULL) {
if (strstr(line, sline) == NULL)
continue;
/* Import register content */
for (i = 0; mod[i] != NULL; i++) {
if (fgets(line, sizeof(line), fp) == NULL)
return OMAPCONF_ERR_UNEXPECTED;
line[strlen(line) - 1] = '\0'; /* remove ending '\n' */
xml_entry = strstr(line, "<"); /* remove spaces */
dprintf("%s(%u (%s)): xml_entry=%s\n", __func__, id,
prm54xx_mod_name_get(id), xml_entry);
/* Check register id is correct */
ret = sscanf(xml_entry, "<register id=\"%u\" %s",
&n, sline);
if (ret != 2) {
dprintf("%s(%u (%s)): could not get id\n",
__func__, id, prm54xx_mod_name_get(id));
return OMAPCONF_ERR_UNEXPECTED;
}
if (n != i) {
dprintf(
"%s(%u (%s)): register id does not match! (n=%u, i=%u)\n",
__func__, id,
prm54xx_mod_name_get(id), n, i);
return OMAPCONF_ERR_UNEXPECTED;
}
ret = reg_xml_import(mod[i], xml_entry);
if (ret != 0)
return ret;
}
dprintf("%s(%u (%s)): all registers imported.\n", __func__, id,
prm54xx_mod_name_get(id));
break;
}
return 0;
}
示例14: lib54xx_voltage_set
/* ------------------------------------------------------------------------*//**
* @FUNCTION lib54xx_voltage_set
* @BRIEF change voltage of a given voltage domain, switching
* CPUFreq governor to "userspace" & disabling smart-reflex
* @RETURNS 0 on success
* OMAPCONF_ERR_CPU
* OMAPCONF_ERR_ARG
* OMAPCONF_ERR_NOT_AVAILABLE
* OMAPCONF_ERR_REG_ACCESS
* OMAPCONF_ERR_INTERNAL
* @param[in] vdd_id: voltage domain ID
* @param[in] volt: new supply voltage (in volt)
* @DESCRIPTION change voltage of a given voltage domain, switching
* CPUFreq governor to "userspace" & disabling smart-reflex
*//*------------------------------------------------------------------------ */
int lib54xx_voltage_set(voltdm54xx_id vdd_id, double volt)
{
int ret, ret_cpufreq;
char prev_gov[CPUFREQ_GOV_MAX_NAME_LENGTH];
sr54xx_mod_id sr_id;
CHECK_CPU(54xx, OMAPCONF_ERR_CPU);
CHECK_ARG_LESS_THAN(vdd_id, VDD54XX_ID_MAX, OMAPCONF_ERR_ARG);
/*
* Switch governor to 'userspace' otherwise voltage change will be
* overriden in case of OPP change.
*/
printf("Warning: switching CPUFreq governor to 'userspace', otherwise "
"voltage change will be overriden...\n");
ret_cpufreq = cpufreq_scaling_governor_set("userspace", prev_gov);
if (ret_cpufreq < 0)
printf("Warning: failed to switch governor. Voltage will be "
"overriden in case of OPP change.\n");
else
printf("CPUFreq governor switched to 'userspace'.\n");
/*
* Disable Smart-Reflex (if running) otherwise voltage change will be
* overriden.
*/
sr_id = sr54xx_vddid2srid(vdd_id);
if (sr54xx_avs_is_enabled(sr_id)) {
printf("Warning: %s Smart-Reflex AVS is enabled. "
"Disabling it...\n", voltdm54xx_name_get(vdd_id));
ret = sr54xx_avs_enable(sr_id, 0);
if (ret == 0)
printf("Smartreflex disabled.\n\n");
else
printf("Warning: Could not disable Smart-Reflex AVS. "
"Voltage may be overriden.\n\n");
} else {
printf("Smartreflex disabled.\n\n");
}
ret = voltdm54xx_voltage_set(vdd_id,
(unsigned long) (volt * 1000000));
if (ret != 0) {
fprintf(stderr, "Oups, could not change %s voltage to "
"%.3lfV ... (%d)\n\n",
voltdm54xx_name_get(vdd_id), volt, ret);
} else {
printf("%s supply voltage set to %1.3lfV (vsel = 0x%02X).\n\n",
voltdm54xx_name_get(vdd_id), volt,
smps_uvolt2vsel(vdd_id2smps_id(vdd_id),
(unsigned long) (volt * 1000000)));
printf("Warning:\n"
" - Do not re-enable %s smartreflex or new voltage "
"will be overriden.\n"
" - Do not change OPP (or use CPUFREQ) or new voltage"
" will be overriden.\n\n", voltdm54xx_name_get(vdd_id));
}
return ret;
}
示例15: pwrdm54xx_has_pwrstst_reg
/* ------------------------------------------------------------------------*//**
* @FUNCTION pwrdm54xx_has_pwrstst_reg
* @BRIEF return 1 if power domain features PM_xyz_PWRSTST,
* 0 otherwise.
* @RETURNS 1 if power domain features PM_xyz_PWRSTST register
* 0 otherwise
* @param[in] id: valid power domain ID
* @DESCRIPTION return 1 if power domain features PM_xyz_PWRSTST,
* 0 otherwise.
*//*------------------------------------------------------------------------ */
unsigned int pwrdm54xx_has_pwrstst_reg(pwrdm54xx_id id)
{
if (!cpu_is_omap54xx())
return 0;
CHECK_ARG_LESS_THAN(id, PWRDM54XX_ID_MAX, 0);
return (pwrdm54xx_pwrstst_table[id] != NULL);
}