Beispiel #1
0
/**
 * @brief Set the base memory address where data will be read from or
 *        written to.
 *
 * You must not call this function while the channel is enabled.
 *
 * If the DMA memory size is 16 bits, the address is automatically
 * aligned to a half-word.  If the DMA memory size is 32 bits, the
 * address is aligned to a word.
 *
 * @param dev DMA Device
 * @param channel Channel whose base memory address to set.
 * @param addr Memory base address to use.
 */
void dma_set_mem_addr(dma_dev *dev, dma_channel channel, __io void *addr) {
    dma_channel_reg_map *chan_regs;

    ASSERT_FAULT(!dma_is_channel_enabled(dev, channel));

    chan_regs = dma_channel_regs(dev, channel);
    chan_regs->CMAR = (uint32)addr;
}
Beispiel #2
0
void dma_set_per_addr(dma_dev *dev, dma_channel channel, volatile void *addr) {
    dma_channel_reg_map *chan_regs;

    ASSERT_FAULT(!dma_is_channel_enabled(dev, channel));

    chan_regs = dma_channel_regs(dev, channel);
    chan_regs->CPAR = (uint32)addr;
}
Beispiel #3
0
/* FIXME Dataflow on endpoint 0 RX/TX status is based off of ST's
 * code, and is ugly/confusing in its use of SaveRState/SaveTState.
 * Fixing this requires filling in handle_in0(), handle_setup0(),
 * handle_out0(). */
static inline uint8 dispatch_endpt_zero(uint16 istr_dir) {
    uint32 epr = (uint16)USB_BASE->EP[0];

    if (!(epr & (USB_EP_CTR_TX | USB_EP_SETUP | USB_EP_CTR_RX))) {
        return 0;
    }

    /* Cache RX/TX statuses in SaveRState/SaveTState, respectively.
     * The various handle_foo0() may clobber these values
     * before we reset them at the end of this routine. */
    SaveRState = epr & USB_EP_STAT_RX;
    SaveTState = epr & USB_EP_STAT_TX;

    /* Set actual RX/TX statuses to NAK while we're thinking */
    set_rx_tx_status0(USB_EP_STAT_RX_NAK, USB_EP_STAT_TX_NAK);

    if (istr_dir == 0) {
        /* ST RM0008: "If DIR bit=0, CTR_TX bit is set in the USB_EPnR
         * register related to the interrupting endpoint.  The
         * interrupting transaction is of IN type (data transmitted by
         * the USB peripheral to the host PC)." */
        ASSERT_FAULT(epr & USB_EP_CTR_TX);
        usb_clear_ctr_tx(USB_EP0);
        handle_in0();
    } else {
        /* RM0008: "If DIR bit=1, CTR_RX bit or both CTR_TX/CTR_RX
         * are set in the USB_EPnR register related to the
         * interrupting endpoint. The interrupting transaction is of
         * OUT type (data received by the USB peripheral from the host
         * PC) or two pending transactions are waiting to be
         * processed."
         *
         * [mbolivar] Note how the following control flow (which
         * replicates ST's) doesn't seem to actually handle both
         * interrupts that are ostensibly pending when both CTR_RX and
         * CTR_TX are set.
         *
         * TODO sort this mess out.
         */
        if (epr & USB_EP_CTR_TX) {
            usb_clear_ctr_tx(USB_EP0);
            handle_in0();
        } else {                /* SETUP or CTR_RX */
            /* SETUP is held constant while CTR_RX is set, so clear it
             * either way */
            usb_clear_ctr_rx(USB_EP0);
            if (epr & USB_EP_SETUP) {
                handle_setup0();
            } else {            /* CTR_RX */
                handle_out0();
            }
        }
    }

    set_rx_tx_status0(SaveRState, SaveTState);
    return 1;
}
Beispiel #4
0
void dma_set_num_transfers(dma_dev *dev,
                           dma_channel channel,
                           uint16 num_transfers) {
    dma_channel_reg_map *channel_regs;

    ASSERT_FAULT(!dma_is_channel_enabled(dev, channel));

    channel_regs = dma_channel_regs(dev, channel);
    channel_regs->CNDTR = num_transfers;
}
Beispiel #5
0
void dma_set_priority(dma_dev *dev,
                      dma_channel channel,
                      dma_priority priority) {
    dma_channel_reg_map *channel_regs;
    uint32 ccr;

    ASSERT_FAULT(!dma_is_channel_enabled(dev, channel));

    channel_regs = dma_channel_regs(dev, channel);
    ccr = channel_regs->CCR;
    ccr &= ~DMA_CCR_PL;
    ccr |= (priority << 12);
    channel_regs->CCR = ccr;
}
Beispiel #6
0
/* pll_cfg->data must point to a valid struct stm32f1_rcc_pll_data. */
void rcc_configure_pll(rcc_pll_cfg *pll_cfg)
{
    stm32f1_rcc_pll_data *data = pll_cfg->data;
    rcc_pll_multiplier pll_mul = data->pll_mul;
    uint32 cfgr;
    /* Check that the PLL is disabled. */
    ASSERT_FAULT(!rcc_is_clk_on(RCC_CLK_PLL));

    cfgr = RCC_BASE->CFGR;
    cfgr &= ~(RCC_CFGR_PLLSRC | RCC_CFGR_PLLMUL);
    cfgr |= pll_cfg->pllsrc | pll_mul;

    RCC_BASE->CFGR = cfgr;
}
Beispiel #7
0
/* Basic and general purpose timers have a single IRQ line, which is
 * shared by all interrupts supported by a particular timer. */
static void enable_bas_gen_irq(timer_dev *dev) {
    nvic_irq_num irq_num;
    switch (dev->clk_id) {
    case RCC_TIMER2:
        irq_num = NVIC_TIMER2;
        break;
    case RCC_TIMER3:
        irq_num = NVIC_TIMER3;
        break;
    case RCC_TIMER4:
        irq_num = NVIC_TIMER4;
        break;
    case RCC_TIMER5:
        irq_num = NVIC_TIMER5;
        break;
    case RCC_TIMER6:
        irq_num = NVIC_TIMER6;
        break;
    case RCC_TIMER7:
        irq_num = NVIC_TIMER7;
        break;
    case RCC_TIMER9:
        irq_num = NVIC_TIMER1_BRK_TIMER9;
        break;
    case RCC_TIMER10:
        irq_num = NVIC_TIMER1_UP_TIMER10;
        break;
    case RCC_TIMER11:
        irq_num = NVIC_TIMER1_TRG_COM_TIMER11;
        break;
    case RCC_TIMER12:
        irq_num = NVIC_TIMER8_BRK_TIMER12;
        break;
    case RCC_TIMER13:
        irq_num = NVIC_TIMER8_UP_TIMER13;
        break;
    case RCC_TIMER14:
        irq_num = NVIC_TIMER8_TRG_COM_TIMER14;
        break;
    default:
        ASSERT_FAULT(0);
        return;
    }
    nvic_irq_enable(irq_num);
}
Beispiel #8
0
/**
 * Sets the mode of an individual timer channel.
 *
 * Note that not all timers can be configured in every mode.  For
 * example, basic timers cannot be configured to output compare mode.
 * Be sure to use a timer which is appropriate for the mode you want.
 *
 * @param dev Timer whose channel mode to set
 * @param channel Relevant channel
 * @param mode New timer mode for channel
 */
void timer_set_mode(timer_dev *dev, uint8 channel, timer_mode mode) {
    ASSERT_FAULT(channel > 0 && channel <= 4);

    /* TODO decide about the basic timers */
    ASSERT(dev->type != TIMER_BASIC);
    if (dev->type == TIMER_BASIC)
        return;

    switch (mode) {
    case TIMER_DISABLED:
        disable_channel(dev, channel);
        break;
    case TIMER_PWM:
        pwm_mode(dev, channel);
        break;
    case TIMER_OUTPUT_COMPARE:
        output_compare_mode(dev, channel);
        break;
    }
}
Beispiel #9
0
static void _testEPRs(void)
{
    const String NAMESPACE = "aa/bb";
    const String CLASSNAME = "MyClass";

    CIMRepository r(repositoryRoot, CIMRepository::MODE_XML);
    WsmToCimRequestMapper mapper(&r);

    // Test mapping of EPRs
    CIMObjectPath objectPath;
    WsmEndpointReference epr;
    epr.address = "http://www.acme.com:5988/wsman";
    epr.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
    epr.selectorSet->selectors.
        append(WsmSelector("prop1", "value1"));
    epr.selectorSet->selectors.
        append(WsmSelector("__cimnamespace", NAMESPACE));
    mapper.convertEPRToObjectPath(epr, objectPath);
    PEGASUS_TEST_ASSERT(objectPath.toString() ==
        "//www.acme.com/aa/bb:MyClass.prop1=\"value1\"");

    // Test mapping of EPR values
    WsmValue wsmEprValue(epr);
    CIMValue cimObjpathValue(CIMTYPE_REFERENCE, false);
    mapper.convertWsmToCimValue(wsmEprValue, NAMESPACE, cimObjpathValue);
    CIMObjectPath objectPath1;
    cimObjpathValue.get(objectPath1);
    PEGASUS_TEST_ASSERT(objectPath1.toString() ==
        "//www.acme.com/aa/bb:MyClass.prop1=\"value1\"");

    // Test mapping of EPR array values
    WsmEndpointReference epr1;
    epr1.address = "http://www.acme1.com:5988/wsman";
    epr1.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
    epr1.selectorSet->selectors.
        append(WsmSelector("prop1", "value2"));
    epr1.selectorSet->selectors.
        append(WsmSelector("__cimnamespace", NAMESPACE));
    Array<WsmEndpointReference> eprArray;
    eprArray.append(epr);
    eprArray.append(epr1);
    WsmValue wsmEprArrayValue(eprArray);
    CIMValue cimObjpathArrayValue(CIMTYPE_REFERENCE, true);
    mapper.convertWsmToCimValue(
        wsmEprArrayValue, NAMESPACE, cimObjpathArrayValue);
    Array<CIMObjectPath> objectPathArray;
    cimObjpathArrayValue.get(objectPathArray);
    PEGASUS_TEST_ASSERT(objectPathArray[0].toString() ==
        "//www.acme.com/aa/bb:MyClass.prop1=\"value1\"");
    PEGASUS_TEST_ASSERT(objectPathArray[1].toString() ==
        "//www.acme1.com/aa/bb:MyClass.prop1=\"value2\"");

    // Test invalid __cimnamespace selector type
    WsmEndpointReference epr2;
    epr2.address = "http://www.acme.com:5988/wsman";
    epr2.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
    epr2.selectorSet->selectors.
        append(WsmSelector("__cimnamespace", epr1));
    ASSERT_FAULT(
        mapper.convertEPRToObjectPath(epr2, objectPath),
        "wsman:InvalidSelectors");

    // Test illegal __cimnamespace name
    WsmEndpointReference epr3;
    epr3.address = "http://www.acme.com:5988/wsman";
    epr3.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
    epr3.selectorSet->selectors.
        append(WsmSelector("__cimnamespace", "garbage namespace #@!"));
    ASSERT_FAULT(
        mapper.convertEPRToObjectPath(epr3, objectPath),
        "wsman:InvalidSelectors");

    // Test illegal property name
    WsmEndpointReference epr4;
    epr4.address = "http://www.acme.com:5988/wsman";
    epr4.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
    epr4.selectorSet->selectors.
        append(WsmSelector("__cimnamespace", NAMESPACE));
    epr4.selectorSet->selectors.
        append(WsmSelector("prop 1", "value"));
    ASSERT_FAULT(
        mapper.convertEPRToObjectPath(epr4, objectPath),
        "wsman:InvalidSelectors");

    // Test non-existent property name
    WsmEndpointReference epr5;
    epr5.address = "http://www.acme.com:5988/wsman";
    epr5.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
    epr5.selectorSet->selectors.
        append(WsmSelector("__cimnamespace", NAMESPACE));
    epr5.selectorSet->selectors.
        append(WsmSelector("prop3", "value"));
    ASSERT_FAULT(
        mapper.convertEPRToObjectPath(epr5, objectPath),
        "wsman:InvalidSelectors");

    // Test type mismatch in key types
    WsmEndpointReference epr6;
    epr6.address = "https://www.acme.com:5988/wsman";
    epr6.resourceUri = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/MyClass";
    epr6.selectorSet->selectors.
        append(WsmSelector("__cimnamespace", NAMESPACE));
    epr6.selectorSet->selectors.
        append(WsmSelector("prop3", epr1));
    ASSERT_FAULT(
        mapper.convertEPRToObjectPath(epr6, objectPath),
        "wsman:InvalidSelectors");

    // Test anonymous address in EPR
    String addr1 = mapper.convertEPRAddressToHostname(WSM_ADDRESS_ANONYMOUS);
    PEGASUS_TEST_ASSERT(addr1 == String::EMPTY);

    // Test malformed EPR addresses
    ASSERT_FAULT(
        mapper.convertEPRAddressToHostname("garbage"),
        "wsa:InvalidMessageInformationHeader");

    ASSERT_FAULT(
        mapper.convertEPRAddressToHostname("http://blah"),
        "wsa:InvalidMessageInformationHeader");

    ASSERT_FAULT(
        mapper.convertEPRAddressToHostname("http://bsa#@^&sa/wsman"),
        "wsa:InvalidMessageInformationHeader");
}
Beispiel #10
0
static void _testInstances(void)
{
    const String NAMESPACE = "aa/bb";
    const String CLASSNAME = "MyClass";

    CIMRepository r(repositoryRoot, CIMRepository::MODE_XML);
    WsmToCimRequestMapper mapper(&r);

    // Create a repository entry
    r.createNameSpace(NAMESPACE);
    CIMClass cimClass(CLASSNAME);
    cimClass.addProperty(CIMProperty(CIMName("prop1"), String::EMPTY));
    cimClass.addProperty(CIMProperty(CIMName("prop2"), String::EMPTY));
    r.createClass(NAMESPACE, cimClass);

    CIMInstance cimInst;
    WsmInstance wsmInst(CLASSNAME);
    WsmValue val1("value1");
    WsmValue val2("value2");

    // Test mapping of instances
    wsmInst.addProperty(WsmProperty(String("prop1"), val1));
    wsmInst.addProperty(WsmProperty(String("prop2"), val2));
    mapper.convertWsmToCimInstance(wsmInst, NAMESPACE, cimInst);

    String str1, str2;
    PEGASUS_TEST_ASSERT(cimInst.getClassName().getString() == CLASSNAME);
    PEGASUS_TEST_ASSERT(
        cimInst.getProperty(0).getName().getString() == "prop1");
    PEGASUS_TEST_ASSERT(cimInst.getProperty(0).getType() == CIMTYPE_STRING);
    cimInst.getProperty(0).getValue().get(str1);
    PEGASUS_TEST_ASSERT(str1 == "value1");
    PEGASUS_TEST_ASSERT(
        cimInst.getProperty(1).getName().getString() == "prop2");
    PEGASUS_TEST_ASSERT(cimInst.getProperty(1).getType() == CIMTYPE_STRING);
    cimInst.getProperty(1).getValue().get(str2);
    PEGASUS_TEST_ASSERT(str2 == "value2");

    // Test mapping of instance values
    WsmValue wsmInstValue(wsmInst);
    CIMValue cimInstValue(CIMTYPE_INSTANCE, false);
    mapper.convertWsmToCimValue(wsmInstValue, NAMESPACE, cimInstValue);
    CIMInstance cimInst1;
    cimInstValue.get(cimInst1);
    PEGASUS_TEST_ASSERT(cimInst1.getClassName().getString() == CLASSNAME);
    PEGASUS_TEST_ASSERT(
        cimInst1.getProperty(0).getName().getString() == "prop1");
    PEGASUS_TEST_ASSERT(cimInst1.getProperty(0).getType() == CIMTYPE_STRING);
    cimInst1.getProperty(0).getValue().get(str1);
    PEGASUS_TEST_ASSERT(str1 == "value1");
    PEGASUS_TEST_ASSERT(
        cimInst1.getProperty(1).getName().getString() == "prop2");
    PEGASUS_TEST_ASSERT(cimInst1.getProperty(1).getType() == CIMTYPE_STRING);
    cimInst1.getProperty(1).getValue().get(str2);
    PEGASUS_TEST_ASSERT(str2 == "value2");

    // Test mapping of instance array values
    WsmInstance wsmInst1(CLASSNAME);
    WsmValue val3("value3");
    WsmValue val4("value4");
    wsmInst1.addProperty(WsmProperty(String("prop1"), val3));
    wsmInst1.addProperty(WsmProperty(String("prop2"), val4));
    Array<WsmInstance> wsmInstArray;
    wsmInstArray.append(wsmInst);
    wsmInstArray.append(wsmInst1);
    WsmValue wsmInstArrayValue(wsmInstArray);
    CIMValue cimInstArrayValue(CIMTYPE_INSTANCE, true);
    mapper.convertWsmToCimValue(
        wsmInstArrayValue, NAMESPACE, cimInstArrayValue);
    Array<CIMInstance> cimInstArray;
    cimInstArrayValue.get(cimInstArray);
    PEGASUS_TEST_ASSERT(cimInstArray.size() == 2);

    PEGASUS_TEST_ASSERT(
        cimInstArray[0].getClassName().getString() == CLASSNAME);
    PEGASUS_TEST_ASSERT(
        cimInstArray[0].getProperty(0).getName().getString() == "prop1");
    PEGASUS_TEST_ASSERT(
        cimInstArray[0].getProperty(0).getType() == CIMTYPE_STRING);
    cimInstArray[0].getProperty(0).getValue().get(str1);
    PEGASUS_TEST_ASSERT(str1 == "value1");
    PEGASUS_TEST_ASSERT(
        cimInstArray[0].getProperty(1).getName().getString() == "prop2");
    PEGASUS_TEST_ASSERT(
        cimInstArray[0].getProperty(1).getType() == CIMTYPE_STRING);
    cimInstArray[0].getProperty(1).getValue().get(str2);
    PEGASUS_TEST_ASSERT(str2 == "value2");

    PEGASUS_TEST_ASSERT(
        cimInstArray[1].getClassName().getString() == CLASSNAME);
    PEGASUS_TEST_ASSERT(
        cimInstArray[1].getProperty(0).getName().getString() == "prop1");
    PEGASUS_TEST_ASSERT(
        cimInstArray[1].getProperty(0).getType() == CIMTYPE_STRING);
    cimInstArray[1].getProperty(0).getValue().get(str1);
    PEGASUS_TEST_ASSERT(str1 == "value3");
    PEGASUS_TEST_ASSERT(
        cimInstArray[1].getProperty(1).getName().getString() == "prop2");
    PEGASUS_TEST_ASSERT(
        cimInstArray[1].getProperty(1).getType() == CIMTYPE_STRING);
    cimInstArray[1].getProperty(1).getValue().get(str2);
    PEGASUS_TEST_ASSERT(str2 == "value4");

    // Test non-existent class
    try
    {
        wsmInst.setClassName("garbage");
        mapper.convertWsmToCimInstance(wsmInst, NAMESPACE, cimInst);
        PEGASUS_TEST_ASSERT(0);
    }
    catch (CIMException& e)
    {
        PEGASUS_TEST_ASSERT(e.getCode() == CIM_ERR_NOT_FOUND);
    }

    // Test non-existent property
    {
        WsmValue val("value3");
        wsmInst.setClassName(CLASSNAME);
        wsmInst.addProperty(WsmProperty(String("prop3"), val));
        ASSERT_FAULT(
            mapper.convertWsmToCimInstance(wsmInst, NAMESPACE, cimInst),
            "wsman:SchemaValidationError");
    }
}
Beispiel #11
0
static void _testConversionErrors(void)
{
    WsmToCimRequestMapper mapper((CIMRepository*) 0);

    // Invalid boolean
    {
        CIMValue cimValue(CIMTYPE_BOOLEAN, false);
        WsmValue wsmValue("test");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    // Invalid uint/sint
    {
        CIMValue cimValue(CIMTYPE_UINT8, false);
        WsmValue wsmValue("test");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_SINT8, false);
        WsmValue wsmValue("test");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    // Uint/sint out of bounds errors
    {
        CIMValue cimValue(CIMTYPE_SINT8, false);
        WsmValue wsmValue("-222");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_SINT16, false);
        WsmValue wsmValue("-777777");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_SINT32, false);
        WsmValue wsmValue("-4444444444");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_UINT8, false);
        WsmValue wsmValue("333");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_UINT16, false);
        WsmValue wsmValue("777777");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_UINT32, false);
        WsmValue wsmValue("4444444444");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    // Invalid real values
    {
        CIMValue cimValue(CIMTYPE_REAL32, false);
        WsmValue wsmValue("35.54.32");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_REAL64, false);
        WsmValue wsmValue("35.54.32");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    // Test special floating point values. The only special values allowed
    // are INF, -INF and NaN
    {
        CIMValue cimValue(CIMTYPE_REAL32, false);
        WsmValue wsmValue("+INF");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_REAL32, false);
        WsmValue wsmValue("0x2");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_REAL32, false);
        WsmValue wsmValue("nan");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_REAL32, false);
        WsmValue wsmValue("inf");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    {
        CIMValue cimValue(CIMTYPE_REAL32, false);
        WsmValue wsmValue("i");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    // Invalid char16
    {
        CIMValue cimValue(CIMTYPE_CHAR16, false);
        WsmValue wsmValue("35.54.32");
        ASSERT_FAULT(
            mapper.convertWsmToCimValue(wsmValue, CIMNamespaceName(), cimValue),
            "wxf:InvalidRepresentation");
    }

    // Invalid class URI
    {
        ASSERT_FAULT(
            mapper.convertResourceUriToClassName("garbage"),
            "wsa:DestinationUnreachable");
    }

    {
        String classURI = String(WSM_RESOURCEURI_CIMSCHEMAV2) + "/My{}Class";
        ASSERT_FAULT(
            mapper.convertResourceUriToClassName(classURI),
            "wsa:DestinationUnreachable");
    }

    // Invalid date/time
    {
        CIMDateTime cimDT;

        // Invalid dates
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("-2004-12-01", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("+2004-12-01", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-+2-01", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12- 1", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("322004-12-01", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-112-01", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-00", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12:01", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01ZX", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01Z+01:30", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01+001:30", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01+01:030", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-0101:30", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01+25:30", cimDT),
            "wxf:InvalidRepresentation");
         ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01+22:66", cimDT),
            "wxf:InvalidRepresentation");
       ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01+++1:3", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01-01:-6", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01-01:66", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01Z+:.", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("4324g432", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("a-e-3Z", cimDT),
            "wxf:InvalidRepresentation");

        // Invalid Datetimes
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01T", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01T11:22:33X", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01T11:22:33.Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01T11:22:33.44Z0", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01T11:22:33.44Z+0", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("004-12-01T11:22:33.44Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01T11Z22:33.44Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01T11:22:133.44Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-01T11:22.133Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("--T::", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("1-1-1T1:1:1", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime(" 004-12-01T11:22:33Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-+2-01T11:22:33Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12- 1T11:22:33Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-1T11:22:33Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-11T-1:22:33Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-11T11:+2:33Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-11T11:22: 3Z", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-11T11:22:33.X", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-11T11:22:33.+1", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-11T11:22:33.+1S", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-11T11:22:33+25:00", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("2004-12-11T11:22:33+22:66", cimDT),
            "wxf:InvalidRepresentation");


        // Invalid intervals
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("PT", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1YT", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P100", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("PT100", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("PT100K", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("PT100Y", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("PT100D", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1M1Y", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1D1M", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1DT1M1H", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1DTM", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1YT1Y", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1YT1M1.S", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1YT1M1S.0", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1YT1H1.2M", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1YT1HT1M", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P-1Y", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P-1M", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P-1D", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("PT-1H", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("PT-1M", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("PT-1S", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P 1Y", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P~Y", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P22.33S", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("PT22.33S1Y", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P999999999Y", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P9999999999Y", cimDT),
            "wxf:InvalidRepresentation");
        ASSERT_FAULT(
            mapper.convertWsmToCimDatetime("P1Y9999999999S", cimDT),
            "wxf:InvalidRepresentation");
    }
}