Commit 09623580 authored by danicampora's avatar danicampora
Browse files

cc3200: Align SD card driver with new SDK release(1.1.0).

parent 1080802e
...@@ -360,6 +360,8 @@ DRESULT sd_disk_read (BYTE* pBuffer, DWORD ulSectorNumber, UINT SectorCount) { ...@@ -360,6 +360,8 @@ DRESULT sd_disk_read (BYTE* pBuffer, DWORD ulSectorNumber, UINT SectorCount) {
pBuffer += 4; pBuffer += 4;
} }
CardSendCmd(CMD_STOP_TRANS, 0); CardSendCmd(CMD_STOP_TRANS, 0);
// Wait for the command to complete
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
Res = RES_OK; Res = RES_OK;
} }
} }
...@@ -430,6 +432,8 @@ DRESULT sd_disk_write (const BYTE* pBuffer, DWORD ulSectorNumber, UINT SectorCou ...@@ -430,6 +432,8 @@ DRESULT sd_disk_write (const BYTE* pBuffer, DWORD ulSectorNumber, UINT SectorCou
// Wait for transfer complete // Wait for transfer complete
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC)); while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
CardSendCmd(CMD_STOP_TRANS, 0); CardSendCmd(CMD_STOP_TRANS, 0);
// Wait for the command to complete
while (!(MAP_SDHostIntStatus(SDHOST_BASE) & SDHOST_INT_TC));
Res = RES_OK; Res = RES_OK;
} }
} }
......
...@@ -131,11 +131,17 @@ STATIC mp_obj_t pybsd_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_ ...@@ -131,11 +131,17 @@ STATIC mp_obj_t pybsd_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_
pin_verify_af (pybsd_obj.af_cmd); pin_verify_af (pybsd_obj.af_cmd);
// configure the sdhost pins // configure the sdhost pins
// TODO: all pin configs must go through pin_config()
MAP_PinTypeSDHost(pybsd_obj.pin_d0->pin_num, pybsd_obj.af_d0); MAP_PinTypeSDHost(pybsd_obj.pin_d0->pin_num, pybsd_obj.af_d0);
MAP_PinTypeSDHost(pybsd_obj.pin_clk->pin_num, pybsd_obj.af_clk); MAP_PinTypeSDHost(pybsd_obj.pin_clk->pin_num, pybsd_obj.af_clk);
MAP_PinDirModeSet(pybsd_obj.pin_clk->pin_num, PIN_DIR_MODE_OUT); MAP_PinDirModeSet(pybsd_obj.pin_clk->pin_num, PIN_DIR_MODE_OUT);
MAP_PinTypeSDHost(pybsd_obj.pin_cmd->pin_num, pybsd_obj.af_cmd); MAP_PinTypeSDHost(pybsd_obj.pin_cmd->pin_num, pybsd_obj.af_cmd);
// enable pull-ups on data and cmd
// TODO: all pin configs must go through pin_config()
MAP_PinConfigSet(pybsd_obj.pin_d0->pin_num, PIN_STRENGTH_4MA, PIN_TYPE_STD_PU);
MAP_PinConfigSet(pybsd_obj.pin_cmd->pin_num, PIN_STRENGTH_4MA, PIN_TYPE_STD_PU);
// card detect pin was provided // card detect pin was provided
if (n_args == 7) { if (n_args == 7) {
pybsd_obj.pin_sd_detect = (pin_obj_t *)pin_find(args[6]); pybsd_obj.pin_sd_detect = (pin_obj_t *)pin_find(args[6]);
...@@ -152,6 +158,8 @@ STATIC mp_obj_t pybsd_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_ ...@@ -152,6 +158,8 @@ STATIC mp_obj_t pybsd_make_new (mp_obj_t type_in, mp_uint_t n_args, mp_uint_t n_
nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, mpexception_num_type_invalid_arguments)); nlr_raise(mp_obj_new_exception_msg(&mp_type_TypeError, mpexception_num_type_invalid_arguments));
} }
// TODO: register with the sleep module!!
pybsd_obj.base.type = &pyb_sd_type; pybsd_obj.base.type = &pyb_sd_type;
return &pybsd_obj; return &pybsd_obj;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment