Lines Matching refs:SS

998 			mem_set(fs->win, 0, SS(fs));
1062 if (move_window(fs, fs->fatbase + (bc / SS(fs))) != FR_OK) break;
1063 wc = fs->win[bc++ % SS(fs)]; /* Get 1st byte of the entry */
1064 if (move_window(fs, fs->fatbase + (bc / SS(fs))) != FR_OK) break;
1065 wc |= fs->win[bc % SS(fs)] << 8; /* Merge 2nd byte of the entry */
1070 if (move_window(fs, fs->fatbase + (clst / (SS(fs) / 2))) != FR_OK) break;
1071 val = ld_word(fs->win + clst * 2 % SS(fs)); /* Simple WORD array */
1075 if (move_window(fs, fs->fatbase + (clst / (SS(fs) / 4))) != FR_OK) break;
1076 val = ld_dword(fs->win + clst * 4 % SS(fs)) & 0x0FFFFFFF; /* Simple DWORD array but mask out upper 4 bits */
1114 res = move_window(fs, fs->fatbase + (bc / SS(fs)));
1116 p = fs->win + bc++ % SS(fs);
1119 res = move_window(fs, fs->fatbase + (bc / SS(fs)));
1121 p = fs->win + bc % SS(fs);
1127 res = move_window(fs, fs->fatbase + (clst / (SS(fs) / 2)));
1129 st_word(fs->win + clst * 2 % SS(fs), (WORD)val); /* Simple WORD array */
1134 res = move_window(fs, fs->fatbase + (clst / (SS(fs) / 4)));
1136 val = (val & 0x0FFFFFFF) | (ld_dword(fs->win + clst * 4 % SS(fs)) & 0xF0000000);
1137 st_dword(fs->win + clst * 4 % SS(fs), val);
1378 cl = (DWORD)(ofs / SS(fs) / fs->csize); /* Cluster order from top of the file */
1415 mem_set(fs->win, 0, SS(fs)); /* Clear window buffer */
1418 for (szb = ((DWORD)fs->csize * SS(fs) >= MAX_MALLOC) ? MAX_MALLOC : fs->csize * SS(fs), ibuf = 0; szb > SS(fs) && (ibuf = ff_memalloc(szb)) == 0; szb /= 2) ;
1419 if (szb > SS(fs)) { /* Buffer allocated? */
1421 szb /= SS(fs); /* Bytes -> Sectors */
1464 csz = (DWORD)fs->csize * SS(fs); /* Bytes per cluster */
1475 dp->sect += ofs / SS(fs); /* Sector# of the directory entry */
1477 dp->dir = fs->win + (ofs % SS(fs)); /* Pointer to the entry in the win[] */
1479 dp->dir = PARENTFS(fs)->win + (ofs % SS(PARENTFS(fs)));
1504 if (ofs % SS(fs) == 0) { /* Sector changed? */
1513 if ((ofs / SS(fs) & (fs->csize - 1)) == 0) { /* Cluster changed? */
1539 dp->dir = fs->win + ofs % SS(fs); /* Pointer to the entry in the win[] */
1541 dp->dir = PARENTFS(fs)->win + (ofs % SS(PARENTFS(fs)));
2600 dp->obj.sclust = ld_clust(fs, fs->win + dp->dptr % SS(fs)); /* Open next directory */
2602 dp->obj.sclust = ld_clust(PARENTFS(fs), PARENTFS(fs)->win + dp->dptr % SS(PARENTFS(fs)));
2763 mem_set(fs->win, 0, SS(fs));
2855 if (disk_ioctl(fs->pdrv, GET_SECTOR_SIZE, &SS(fs)) != RES_OK) return FR_DISK_ERR;
2856 if (SS(fs) > FF_MAX_SS || SS(fs) < FF_MIN_SS || (SS(fs) & (SS(fs) - 1))) return FR_DISK_ERR;
2860 fs->win = (BYTE*) ff_memalloc(SS(fs));
2873 if (ld_word(fs->win + BPB_BytsPerSec) != SS(fs)) return FR_NO_FILESYSTEM; /* (BPB_BytsPerSec must be equal to the physical sector size) */
2887 if (fs->n_rootdir % (SS(fs) / SZDIRE)) return FR_NO_FILESYSTEM; /* (Must be sector aligned) */
2896 sysect = nrsv + fasize + fs->n_rootdir / (SS(fs) / SZDIRE); /* RSV + FAT + DIR */
2922 if (fs->fsize < (szbfat + (SS(fs) - 1)) / SS(fs)) return FR_NO_FILESYSTEM; /* (BPB_FATSz must not be less than the size needed) */
3115 if (ld_word(fs->win + BPB_BytsPerSec) != SS(fs)) { /* (BPB_BytsPerSec must be equal to the physical sector size) */
3131 if (fs->n_rootdir % (SS(fs) / SZDIRE)) return FR_NO_FILESYSTEM; /* (Must be sector aligned) */
3140 sysect = nrsv + fasize + fs->n_rootdir / (SS(fs) / SZDIRE); /* RSV + FAT + DIR */
3166 if (fs->fsize < (szbfat + (SS(fs) - 1)) / SS(fs)) {
3234 mem_set(fs->win, 0, SS(fs));
3449 fp->buf = (BYTE*) ff_memalloc(SS(fs)); /* Init sector buffer */
3464 bcs = (DWORD)fs->csize * SS(fs); /* Cluster size in byte */
3472 if (res == FR_OK && ofs % SS(fs)) { /* Fill sector buffer if not on the sector boundary */
3477 fp->sect = sc + (DWORD)(ofs / SS(fs));
3565 if (fp->fptr % SS(fs) == 0) { /* On the sector boundary? */
3566 csect = (UINT)(fp->fptr / SS(fs) & (fs->csize - 1)); /* Sector offset in the cluster */
3587 cc = btr / SS(fs); /* When remaining bytes >= sector size, */
3597 copy_ret = LOS_CopyFromKernel(rbuff + ((fs->winsect - sect) * SS(fs)), SS(fs), fs->win, SS(fs));
3600 mem_cpy(rbuff + ((fs->winsect - sect) * SS(fs)), fs->win, SS(fs));
3606 copy_ret = LOS_CopyFromKernel(rbuff + ((fp->sect - sect) * SS(fs)), SS(fs), fp->buf, SS(fs));
3609 mem_cpy(rbuff + ((fp->sect - sect) * SS(fs)), fp->buf, SS(fs));
3614 rcnt = SS(fs) * cc; /* Number of bytes transferred */
3630 rcnt = SS(fs) - (UINT)fp->fptr % SS(fs); /* Number of bytes remains in the sector */
3635 copy_ret = LOS_CopyFromKernel(rbuff, rcnt, fs->win + fp->fptr % SS(fs), rcnt);
3640 copy_ret = LOS_CopyFromKernel(rbuff, rcnt, fp->buf + fp->fptr % SS(fs), rcnt);
3643 mem_cpy(rbuff, fp->buf + fp->fptr % SS(fs), rcnt); /* Extract partial sector */
3687 if (fp->fptr % SS(fs) == 0) { /* On the sector boundary? */
3688 csect = (UINT)(fp->fptr / SS(fs)) & (fs->csize - 1); /* Sector offset in the cluster */
3725 cc = btw / SS(fs); /* When remaining bytes >= sector size, */
3734 copy_ret = LOS_CopyToKernel(fs->win, SS(fs), wbuff + ((fs->winsect - sect) * SS(fs)), SS(fs));
3741 copy_ret = LOS_CopyToKernel(fp->buf, SS(fs), wbuff + ((fp->sect - sect) * SS(fs)), SS(fs));
3744 mem_cpy(fp->buf, wbuff + ((fp->sect - sect) * SS(fs)), SS(fs));
3750 wcnt = SS(fs) * cc; /* Number of bytes transferred */
3767 wcnt = SS(fs) - (UINT)fp->fptr % SS(fs); /* Number of bytes left in the sector */
3772 copy_ret = LOS_CopyToKernel(fs->win + fp->fptr % SS(fs), wcnt, wbuff, wcnt);
3777 copy_ret = LOS_CopyToKernel(fp->buf + fp->fptr % SS(fs), wcnt, wbuff, wcnt);
3780 mem_cpy(fp->buf + fp->fptr % SS(fs), wbuff, wcnt); /* Fit data to the sector */
4111 dsc += (DWORD)((ofs - 1) / SS(fs)) & (fs->csize - 1);
4112 if (fp->fptr % SS(fs) && dsc != fp->sect) { /* Refill sector cache if needed */
4137 bcs = (DWORD)fs->csize * SS(fs); /* Cluster size (byte) */
4177 if (ofs % SS(fs)) {
4180 nsect += (DWORD)(ofs / SS(fs));
4188 if (fp->fptr % SS(fs) && nsect != fp->sect) { /* Fill sector cache if needed */
4456 i %= SS(fs);
4540 n = (DWORD)fs->csize * SS(fs); /* Cluster size */
4812 mem_set(dir, 0, SS(fs));
4833 mem_set(dir, 0, SS(fs));
4839 mem_set(dir, 0, SS(fs));
5336 n = (DWORD)fs->csize * SS(fs); /* Cluster size */
5502 csect = (UINT)(fp->fptr / SS(fs) & (fs->csize - 1)); /* Sector offset in the cluster */
5503 if (fp->fptr % SS(fs) == 0) { /* On the sector boundary? */
5531 rcnt = SS(fs) - (UINT)fp->fptr % SS(fs); /* Number of bytes remains in the sector */
5533 rcnt = (*func)(dbuf + ((UINT)fp->fptr % SS(fs)), rcnt); /* Forward the file data */
6911 clust_size = (DWORD)fs->csize * SS(fs); /* Cluster size */