uint32_t mg_task_reg = mflash_bank->base + MG_REG_OFFSET;
duration_t duration;
int ret;
- long long t=0;
+ long long t = 0;
duration_start_measure(&duration);
if (wait == mg_io_wait_bsy)
return ERROR_OK;
} else {
- switch(wait)
+ switch (wait)
{
case mg_io_wait_not_bsy:
return ERROR_OK;
duration_stop_measure(&duration, NULL);
- t=duration.duration.tv_usec/1000;
- t+=duration.duration.tv_sec*1000;
+ t = duration.duration.tv_usec/1000;
+ t += duration.duration.tv_sec*1000;
if (t > time)
break;
if ((ret = target_read_u8(target, mg_task_reg + MG_REG_DRV_CTRL, &value)) != ERROR_OK)
return ret;
- if(on) {
+ if (on) {
value |= (mg_io_rbit_devc_srst);
} else {
value &= ~mg_io_rbit_devc_srst;
if (ret == ERROR_OK) {
command_print(cmd_ctx, "mflash (total %" PRIu32 " sectors) found at 0x%8.8" PRIx32 "",
- mflash_bank->drv_info->tot_sects, mflash_bank->base );
+ mflash_bank->drv_info->tot_sects, mflash_bank->base);
}
return ret;
uint8_t *buff_ptr = buff;
duration_t duration;
- if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, mg_io_cmd_read)) != ERROR_OK )
+ if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, mg_io_cmd_read)) != ERROR_OK)
return ret;
address = mflash_bank->base + MG_BUFFER_OFFSET;
uint8_t *buff_ptr = buff;
duration_t duration;
- if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, cmd)) != ERROR_OK )
+ if ((ret = mg_dsk_io_cmd(sect_num, sect_cnt, cmd)) != ERROR_OK)
return ret;
address = mflash_bank->base + MG_BUFFER_OFFSET;
{
int i, M;
- for (i = 1, M=0; i < 512; i <<= 1, feedback_div >>= 1)
+ for (i = 1, M = 0; i < 512; i <<= 1, feedback_div >>= 1)
M += (feedback_div & 1) * i;
return M + 2;
int i, NO;
for (i = 0, NO = 1; i < 2; ++i, output_div >>= 1)
- if(output_div & 1)
+ if (output_div & 1)
NO = NO << 1;
return NO;
CLK_OUT = XIN * ((double)M / N) / NO;
- if ((int)((CLK_OUT+ROUND) / DIV)
+ if ((int)((CLK_OUT + ROUND) / DIV)
== (int)(MG_PLL_CLK_OUT / DIV)) {
if (mg_is_valid_pll(XIN, N, CLK_OUT, NO) == ERROR_OK)
{