diff --git a/drivers/usbdev/usbmsc_scsi.c b/drivers/usbdev/usbmsc_scsi.c index 30e06be071..31c4b68ac0 100644 --- a/drivers/usbdev/usbmsc_scsi.c +++ b/drivers/usbdev/usbmsc_scsi.c @@ -508,7 +508,7 @@ static inline int usbmsc_cmdrequestsense(FAR struct usbmsc_dev_s *priv, static inline int usbmsc_cmdread6(FAR struct usbmsc_dev_s *priv) { FAR struct scsicmd_read6_s *read6 = (FAR struct scsicmd_read6_s *)priv->cdb; - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; int ret; priv->u.xfrlen = (uint16_t)read6->xfrlen; @@ -521,6 +521,8 @@ static inline int usbmsc_cmdread6(FAR struct usbmsc_dev_s *priv) USBMSC_FLAGS_DIRDEVICE2HOST | USBMSC_FLAGS_BLOCKXFR); if (ret == OK) { + lun = priv->lun; + /* Get the Logical Block Address (LBA) from cdb[] as the starting sector */ priv->sector = (uint32_t)(read6->mslba & SCSICMD_READ6_MSLBAMASK) << 16 | @@ -568,7 +570,7 @@ static inline int usbmsc_cmdread6(FAR struct usbmsc_dev_s *priv) static inline int usbmsc_cmdwrite6(FAR struct usbmsc_dev_s *priv) { FAR struct scsicmd_write6_s *write6 = (FAR struct scsicmd_write6_s *)priv->cdb; - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; int ret; priv->u.xfrlen = (uint16_t)write6->xfrlen; @@ -581,6 +583,8 @@ static inline int usbmsc_cmdwrite6(FAR struct usbmsc_dev_s *priv) USBMSC_FLAGS_DIRHOST2DEVICE | USBMSC_FLAGS_BLOCKXFR); if (ret == OK) { + lun = priv->lun; + /* Get the Logical Block Address (LBA) from cdb[] as the starting sector */ priv->sector = (uint32_t)(write6->mslba & SCSICMD_WRITE6_MSLBAMASK) << 16 | (uint32_t)usbmsc_getbe16(write6->lslba); @@ -880,7 +884,7 @@ static inline int usbmsc_cmdpreventmediumremoval(FAR struct usbmsc_dev_s *priv) #ifdef CONFIG_USBMSC_REMOVABLE FAR struct scsicmd_preventmediumremoval_s *pmr = (FAR struct scsicmd_preventmediumremoval_s *)priv->cdb; #endif - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; int ret; priv->u.alloclen = 0; @@ -888,6 +892,8 @@ static inline int usbmsc_cmdpreventmediumremoval(FAR struct usbmsc_dev_s *priv) USBMSC_FLAGS_DIRNONE); if (ret == OK) { + lun = priv->lun; + #ifndef CONFIG_USBMSC_REMOVABLE lun->sd = SCSI_KCQIR_INVALIDCOMMAND; ret = -EINVAL; @@ -919,7 +925,7 @@ static inline int usbmsc_cmdreadformatcapacity(FAR struct usbmsc_dev_s *priv, { FAR struct scsicmd_readformatcapcacities_s *rfc = (FAR struct scsicmd_readformatcapcacities_s *)priv->cdb; FAR struct scsiresp_readformatcapacities_s *hdr; - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; int ret; priv->u.alloclen = usbmsc_getbe16(rfc->alloclen); @@ -927,6 +933,8 @@ static inline int usbmsc_cmdreadformatcapacity(FAR struct usbmsc_dev_s *priv, USBMSC_FLAGS_DIRDEVICE2HOST); if (ret == OK) { + lun = priv->lun; + hdr = (FAR struct scsiresp_readformatcapacities_s *)buf; memset(hdr, 0, SCSIRESP_READFORMATCAPACITIES_SIZEOF); hdr->listlen = SCSIRESP_CURRCAPACITYDESC_SIZEOF; @@ -955,7 +963,7 @@ static int inline usbmsc_cmdreadcapacity10(FAR struct usbmsc_dev_s *priv, { FAR struct scsicmd_readcapacity10_s *rcc = (FAR struct scsicmd_readcapacity10_s *)priv->cdb; FAR struct scsiresp_readcapacity10_s *rcr = (FAR struct scsiresp_readcapacity10_s *)buf; - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; uint32_t lba; int ret; @@ -964,6 +972,8 @@ static int inline usbmsc_cmdreadcapacity10(FAR struct usbmsc_dev_s *priv, USBMSC_FLAGS_DIRDEVICE2HOST); if (ret == OK) { + lun = priv->lun; + /* Check the PMI and LBA fields */ lba = usbmsc_getbe32(rcc->lba); @@ -996,7 +1006,7 @@ static int inline usbmsc_cmdreadcapacity10(FAR struct usbmsc_dev_s *priv, static inline int usbmsc_cmdread10(FAR struct usbmsc_dev_s *priv) { struct scsicmd_read10_s *read10 = (struct scsicmd_read10_s *)priv->cdb; - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; int ret; priv->u.xfrlen = usbmsc_getbe16(read10->xfrlen); @@ -1004,6 +1014,8 @@ static inline int usbmsc_cmdread10(FAR struct usbmsc_dev_s *priv) USBMSC_FLAGS_DIRDEVICE2HOST | USBMSC_FLAGS_BLOCKXFR); if (ret == OK) { + lun = priv->lun; + /* Get the Logical Block Address (LBA) from cdb[] as the starting sector */ priv->sector = usbmsc_getbe32(read10->lba); @@ -1058,7 +1070,7 @@ static inline int usbmsc_cmdread10(FAR struct usbmsc_dev_s *priv) static inline int usbmsc_cmdwrite10(FAR struct usbmsc_dev_s *priv) { struct scsicmd_write10_s *write10 = (struct scsicmd_write10_s *)priv->cdb; - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; int ret; priv->u.xfrlen = usbmsc_getbe16(write10->xfrlen); @@ -1066,6 +1078,8 @@ static inline int usbmsc_cmdwrite10(FAR struct usbmsc_dev_s *priv) USBMSC_FLAGS_DIRHOST2DEVICE | USBMSC_FLAGS_BLOCKXFR); if (ret == OK) { + lun = priv->lun; + /* Get the Logical Block Address (LBA) from cdb[] as the starting sector */ priv->sector = usbmsc_getbe32(write10->lba); @@ -1129,7 +1143,7 @@ static inline int usbmsc_cmdwrite10(FAR struct usbmsc_dev_s *priv) static inline int usbmsc_cmdverify10(FAR struct usbmsc_dev_s *priv) { FAR struct scsicmd_verify10_s *verf = (FAR struct scsicmd_verify10_s *)priv->cdb; - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; uint32_t lba; uint16_t blocks; size_t sector; @@ -1141,6 +1155,8 @@ static inline int usbmsc_cmdverify10(FAR struct usbmsc_dev_s *priv) ret = usbmsc_setupcmd(priv, SCSICMD_VERIFY10_SIZEOF, USBMSC_FLAGS_DIRNONE); if (ret == OK) { + lun = priv->lun; + /* Verify the starting and ending LBA */ lba = usbmsc_getbe32(verf->lba); @@ -1317,7 +1333,7 @@ static int inline usbmsc_cmdmodesense10(FAR struct usbmsc_dev_s *priv, static inline int usbmsc_cmdread12(FAR struct usbmsc_dev_s *priv) { struct scsicmd_read12_s *read12 = (struct scsicmd_read12_s *)priv->cdb; - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; int ret; priv->u.xfrlen = usbmsc_getbe32(read12->xfrlen); @@ -1325,6 +1341,8 @@ static inline int usbmsc_cmdread12(FAR struct usbmsc_dev_s *priv) USBMSC_FLAGS_DIRDEVICE2HOST | USBMSC_FLAGS_BLOCKXFR); if (ret == OK) { + lun = priv->lun; + /* Get the Logical Block Address (LBA) from cdb[] as the starting sector */ priv->sector = usbmsc_getbe32(read12->lba); @@ -1379,7 +1397,7 @@ static inline int usbmsc_cmdread12(FAR struct usbmsc_dev_s *priv) static inline int usbmsc_cmdwrite12(FAR struct usbmsc_dev_s *priv) { struct scsicmd_write12_s *write12 = (struct scsicmd_write12_s *)priv->cdb; - FAR struct usbmsc_lun_s *lun = priv->lun; + FAR struct usbmsc_lun_s *lun; int ret; priv->u.xfrlen = usbmsc_getbe32(write12->xfrlen); @@ -1387,6 +1405,8 @@ static inline int usbmsc_cmdwrite12(FAR struct usbmsc_dev_s *priv) USBMSC_FLAGS_DIRHOST2DEVICE | USBMSC_FLAGS_BLOCKXFR); if (ret == OK) { + lun = priv->lun; + /* Get the Logical Block Address (LBA) from cdb[] as the starting sector */ priv->sector = usbmsc_getbe32(write12->lba); diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index f8bc539e3d..a6031c3183 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -168,7 +168,7 @@ # define CHILD_FLAG_TTYPE_TASK (0 << CHILD_FLAG_TTYPE_SHIFT) /* Normal user task */ # define CHILD_FLAG_TTYPE_PTHREAD (1 << CHILD_FLAG_TTYPE_SHIFT) /* User pthread */ # define CHILD_FLAG_TTYPE_KERNEL (2 << CHILD_FLAG_TTYPE_SHIFT) /* Kernel thread */ -#define CHILD_FLAG_EXITED (1 << 0) /* Bit 2: The child thread has exit'ed */ +#define CHILD_FLAG_EXITED (1 << 2) /* Bit 2: The child thread has exit'ed */ /* Bits 3-7: Available */ /* Sporadic scheduler flags */ diff --git a/net/sixlowpan/README.txt b/net/sixlowpan/README.txt index a311f5408d..ca8a513d6a 100644 --- a/net/sixlowpan/README.txt +++ b/net/sixlowpan/README.txt @@ -10,12 +10,14 @@ Optimal 6loWPAN Configuration 128 112 96 80 64 48 32 16 ---- ---- ---- ---- ---- ---- ---- ---- - xxxx xxxx xxxx xxxx xxxx 00ff fe00 MMMM 2-byte Rime address IEEE 48-bit MAC - fe80 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte Rime address IEEE EUI-64 + AAAA xxxx xxxx xxxx xxxx 00ff fe00 MMMM 2-byte Rime address IEEE 48-bit MAC + AAAA 0000 0000 0000 NNNN NNNN NNNN NNNN 8-byte Rime address IEEE EUI-64 - Where MMM is the 2-byte rime address XOR 0x0200. For example, the MAC + Where MMM is the 2-byte rime address XORed 0x0200. For example, the MAC address of 0xabcd would be 0xa9cd. And NNNN NNNN NNNN NNNN is the 8-byte - rime address address XOR 02000 0000 0000 0000 + rime address address XOR 02000 0000 0000 0000. + + For link-local address, AAAA is 0xfe80 3. MAC based link-local addresses @@ -33,9 +35,9 @@ Optimal 6loWPAN Configuration Fragmentation Headers --------------------- A fragment header is placed at the beginning of the outgoing packet just -after the MAC when the payload is too large to fit in a single IEEE 802.15.4 -frame. The fragment header contains three fields: Datagram size, datagram tag -and datagram offset. +after the MAC header when the payload is too large to fit in a single IEEE +802.15.4 frame. The fragment header contains three fields: Datagram size, +datagram tag and datagram offset. 1. Datagram size describes the total (un-fragmented) payload. 2. Datagram tag identifies the set of fragments and is used to match @@ -65,7 +67,7 @@ this is a HC1 compressed first frame of a packet This is the second frame of the same transfer: 41 88 01 cefa 3412 cdab ### 9-byte MAC header - e50e 000b 0a ### 5 byte FRAGN header + e50e 000b 0d ### 5 byte FRAGN header 42 ### SIXLOWPAN_DISPATCH_HC1 fb ### RIME_HC1_HC_UDP_HC1_ENCODING e0 ### RIME_HC1_HC_UDP_UDP_ENCODING @@ -81,5 +83,5 @@ This is the second frame of the same transfer: The payload length is encoded in the LS 11-bits of the first 16-bit value: In this example the payload size is 0x050e or 1,294. The tag is 0x000b. In -the second frame, the fifth byte contains the offset 0x0a which is 10 << 3 = -80 bytes, the size of the payload on the first packet. +the second frame, the fifth byte contains the offset 0x0d which is 13 << 3 = +104 bytes, the size of the payload on the first packet.