[PATCH 02/62] arm/gp32/smc/smc.c: Remove unused sm_ECCEncode() and sm_status()

Joel Sherrill joel.sherrill at oarcorp.com
Wed Oct 15 19:59:52 UTC 2014


---
 c/src/lib/libbsp/arm/gp32/smc/smc.c | 205 +-----------------------------------
 1 file changed, 1 insertion(+), 204 deletions(-)

diff --git a/c/src/lib/libbsp/arm/gp32/smc/smc.c b/c/src/lib/libbsp/arm/gp32/smc/smc.c
index 425a1df..3b8d5e2 100644
--- a/c/src/lib/libbsp/arm/gp32/smc/smc.c
+++ b/c/src/lib/libbsp/arm/gp32/smc/smc.c
@@ -103,36 +103,6 @@ static uint8_t sm_read(void)
   return data;
 }
 
-
-/* assumes chip enabled
-   bit 7: write protected = 0, write enabled = 1
-   bit 6: busy = 0, ready = 1
-   bit 0: success = 0, failed = 1
-
-   returns 1 on success, 0 on fail
-*/
-#if UNUSED
-static static uint8_t sm_status()
-{
-  uint8_t status;
-
-  sm_cle_en();
-  sm_write_en();
-  sm_write(READ_STATUS_CMD);
-  sm_write_dis();
-  sm_cle_dis();
-
-  sm_read_en();
-  status = sm_read();
-  sm_read_dis();
-
-  if (status == 0xC0)
-    return 1;
-  else
-    return 0;
-}
-#endif
-
 static void smc_read_id( uint8_t* buf, uint32_t length)
 {
   uint32_t i;
@@ -334,182 +304,9 @@ static void smc_init( void)
   smc_make_l2p();
 }
 
-/**********
- * Function: sm_ECCEncode (completely ripped, unaltered, from the samsung routines)
- * Remark:
- *  - adopted from "ECC Algorithm for SmartMedia V3.0"
- *    by Memory Product & Technology, Samsung Electronics Co. (ecc30.pdf)
- **********/
-int sm_ECCEncode(const uint8_t * p_buf, uint8_t * p_ecc)
-{
-  uint32_t i, j;
-  uint8_t paritr[256], tmp = 0, tmp2 = 0;
-  uint8_t data_table0[16] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 };
-  uint8_t data_table1[16] = { 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1 };
-  uint8_t sum = 0, paritc = 0;
-  uint8_t parit0c = 0, parit1c = 0, parit2c = 0, parit3c = 0;
-  uint8_t parit4c = 0, parit5c = 0, parit6c = 0, parit7c = 0;
-  uint8_t parit1_1, parit1_2, parit2_1, parit2_2, parit4_1, parit4_2;
-  uint8_t parit8_1 = 0, parit8_2 = 0, parit16_1 = 0, parit16_2 = 0, parit32_1 = 0, parit32_2 = 0;
-  uint8_t parit64_1 = 0, parit64_2 = 0, parit128_1 = 0, parit128_2 = 0, parit256_1 = 0, parit256_2 = 0;
-  uint8_t parit512_1 = 0, parit512_2 = 0, parit1024_1 = 0, parit1024_2 = 0;
-  uint8_t* paritr_ptr;
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; ++i, ++paritr_ptr, ++p_buf) {
-    paritc ^= *p_buf;
-    tmp = (*p_buf & 0xf0) >> 4;
-    tmp2 = *p_buf & 0x0f;
-
-    switch (tmp) {
-      case 0:
-      case 3:
-      case 5:
-      case 6:
-      case 9:
-      case 10:
-      case 12:
-      case 15:
-        *paritr_ptr = *(data_table0 + tmp2);
-        break;
-
-      case 1:
-      case 2:
-      case 4:
-      case 7:
-      case 8:
-      case 11:
-      case 13:
-      case 14:
-        *paritr_ptr = *(data_table1 + tmp2);
-        break;
-    }
-  }
-
-  parit0c = (paritc & 0x01) ? 1 : 0;
-  parit1c = (paritc & 0x02) ? 1 : 0;
-  parit2c = (paritc & 0x04) ? 1 : 0;
-  parit3c = (paritc & 0x08) ? 1 : 0;
-  parit4c = (paritc & 0x10) ? 1 : 0;
-  parit5c = (paritc & 0x20) ? 1 : 0;
-  parit6c = (paritc & 0x40) ? 1 : 0;
-  parit7c = (paritc & 0x80) ? 1 : 0;
-  parit1_2 = parit6c ^ parit4c ^ parit2c ^ parit0c;
-  parit1_1 = parit7c ^ parit5c ^ parit3c ^ parit1c;
-  parit2_2 = parit5c ^ parit4c ^ parit1c ^ parit0c;
-  parit2_1 = parit7c ^ parit6c ^ parit3c ^ parit2c;
-  parit4_2 = parit3c ^ parit2c ^ parit1c ^ parit0c;
-  parit4_1 = parit7c ^ parit6c ^ parit5c ^ parit4c;
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; ++i, ++paritr_ptr) {
-    sum ^= *paritr_ptr;
-  }
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; i += 2, paritr_ptr += 2) {
-    parit8_2 ^= *paritr_ptr;
-  }
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; i += 4, paritr_ptr += 4) {
-    parit16_2 ^= *paritr_ptr;
-    parit16_2 ^= *(paritr_ptr + 1);
-  }
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; i += 8, paritr_ptr += 8) {
-    for (j = 0; j <= 3; ++j) {
-      parit32_2 ^= *(paritr_ptr + j);
-    }
-  }
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; i += 16, paritr_ptr += 16) {
-    for (j = 0; j <= 7; ++j) {
-      parit64_2 ^= *(paritr_ptr + j);
-    }
-  }
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; i += 32, paritr_ptr += 32) {
-    for (j = 0; j <= 15; ++j) {
-      parit128_2 ^= *(paritr_ptr + j);
-    }
-  }
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; i += 64, paritr_ptr += 64) {
-    for (j = 0; j <= 31; ++j) {
-      parit256_2 ^= *(paritr_ptr + j);
-    }
-  }
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; i += 128, paritr_ptr += 128) {
-    for (j = 0; j <= 63; ++j) {
-      parit512_2 ^= *(paritr_ptr + j);
-    }
-  }
-
-  paritr_ptr = paritr;
-  for (i = 0; i < 256; i += 256, paritr_ptr += 256) {
-    for (j = 0; j <= 127; ++j) {
-      parit1024_2 ^= *(paritr_ptr + j);
-    }
-  }
-
-  if (sum==0) {
-    parit1024_1 = parit1024_2;
-    parit512_1 = parit512_2;
-    parit256_1 = parit256_2;
-    parit128_1 = parit128_2;
-    parit64_1 = parit64_2;
-    parit32_1 = parit32_2;
-    parit16_1 = parit16_2;
-    parit8_1 = parit8_2;
-  } else {
-    parit1024_1 = parit1024_2 ? 0 : 1;
-    parit512_1 = parit512_2 ? 0 : 1;
-    parit256_1 = parit256_2 ? 0 : 1;
-    parit128_1 = parit128_2 ? 0 : 1;
-    parit64_1 = parit64_2 ? 0 : 1;
-    parit32_1 = parit32_2 ? 0 : 1;
-    parit16_1 = parit16_2 ? 0 : 1;
-    parit8_1 = parit8_2 ? 0 : 1;
-  }
-
-  parit1_2 <<= 2;
-  parit1_1 <<= 3;
-  parit2_2 <<= 4;
-  parit2_1 <<= 5;
-  parit4_2 <<= 6;
-  parit4_1 <<= 7;
-  parit128_1 <<= 1;
-  parit256_2 <<= 2;
-  parit256_1 <<= 3;
-  parit512_2 <<= 4;
-  parit512_1 <<= 5;
-  parit1024_2 <<= 6;
-  parit1024_1 <<= 7;
-  parit8_1 <<= 1;
-  parit16_2 <<= 2;
-  parit16_1 <<= 3;
-  parit32_2 <<= 4;
-  parit32_1 <<= 5;
-  parit64_2 <<= 6;
-  parit64_1 <<= 7;
-
-  p_ecc[0] = ~(parit64_1 | parit64_2 | parit32_1 | parit32_2 | parit16_1 | parit16_2 | parit8_1 | parit8_2);
-  p_ecc[1] = ~(parit1024_1 |parit1024_2 | parit512_1 | parit512_2 | parit256_1 | parit256_2 | parit128_1 | parit128_2);
-  p_ecc[2] = ~(parit4_1 | parit4_2 | parit2_1 | parit2_2 | parit1_1 | parit1_2);
-
-  return 0;
-}
-
 /* smc_write --
  * write stub
-*/
+ */
 static int smc_write(rtems_blkdev_request *req)
 {
   rtems_blkdev_request_done(req, RTEMS_SUCCESSFUL);
-- 
1.9.3




More information about the devel mailing list