Revision 288cc44e

View differences:

unittests/periphery-lld/src/ut_alld_P9221R_v1.c
47 47
/* EXPORTED FUNCTIONS                                                         */
48 48
/******************************************************************************/
49 49

  
50

  
50 51
aos_utresult_t utAlldP9221rFunc(BaseSequentialStream* stream, aos_unittest_t* ut)
51 52
{
52 53
    aosDbgCheck(ut->data != NULL && ((ut_p9221rdata_t*)(ut->data))->PRd != NULL);
......
54 55
    // local variables
55 56
    aos_utresult_t result = {0, 0};
56 57
    uint32_t status;
57
    uint16_t data[40] = {0xAA55};
58
    uint8_t data[80] = {0xAA};
59
    int32_t x_alignment;
60
    int32_t y_alignment;
58 61

  
59 62
    chprintf(stream, "read registers...\n");
60
    status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_PARTNUMBER, data, 2*40, ((ut_p9221rdata_t*)ut->data)->timeout);
63
    status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_PARTNUMBER, data, 80, ((ut_p9221rdata_t*)ut->data)->timeout);
61 64
    if (status == APAL_STATUS_SUCCESS) {
62 65
      aosUtPassed(stream, &result);
63
      for(int i=0; i<40; i++){
64
          chprintf(stream, "register: 0x%02x, data: 0x%04X \n", 0x00+(2*i), data[i]);
66
      for(int i=0; i<8; i++){
67
          chprintf(stream, "register: 0x%02x, data: 0x%04X \n", 0x00+i, data[i]);
65 68
      }
66 69
    } else {
67 70
      aosUtFailed(stream, &result);
68 71
    }
69 72

  
70
    chprintf(stream, "read IE registers...\n");
71
    status = p9221r_lld_read_register(((ut_p9221rdata_t*)ut->data)->PRd, P9221R_LLD_REGISTER_INTERRUPTENABLE, data, 1, ((ut_p9221rdata_t*)ut->data)->timeout);
72
    if (status == APAL_STATUS_SUCCESS) {
73
      aosUtPassed(stream, &result);
74
      chprintf(stream, "register: 0x%02X, data: 0x%04X \n", (uint16_t)P9221R_LLD_REGISTER_INTERRUPTENABLE, data[0]);
75
    } else {
76
      aosUtFailed(stream, &result);
77
    }
73
   // chprintf(stream, "read x_alignment... \n");
74
   // status =  p9221r_lld_read_x_alignment(((ut_p9221rdata_t*)ut->data)->PRd, x_alignment, ((ut_p9221rdata_t*)ut->data)->timeout);
75
   // if (status == APAL_STATUS_SUCCESS) {
76
   //   aosUtPassed(stream, &result);
77
   //   chprintf(stream, "x_alignment: 0x%02x, data: %u \n", P9221R_LLD_REGISTER_ALIGNMENT_X, x_alignment);
78
   // } else {
79
   //   aosUtFailed(stream, &result);
80
   // }
81

  
82
    // chprintf(stream, "read y_alignment... \n");
83
    // status =  p9221r_lld_read_y_alignment(((ut_p9221rdata_t*)ut->data)->PRd, y_alignment, ((ut_p9221rdata_t*)ut->data)->timeout);
84
    // if (status == APAL_STATUS_SUCCESS) {
85
    //   aosUtPassed(stream, &result);
86
    //   chprintf(stream, "y_alignment: 0x%02x, data: %u \n", P9221R_LLD_REGISTER_ALIGNMENT_Y, y_alignment);
87
    // } else {
88
    //   aosUtFailed(stream, &result);
89
    // }
78 90

  
79 91
    return result;
80 92
}

Also available in: Unified diff