Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FreescaleIAP SimpleDMA mbed-rtos mbed
Fork of CDMS_CODE by
Diff: COM_SND_TM.h
- Revision:
- 52:0bd68655c651
- Parent:
- 11:83acbe8e0ad1
- Child:
- 53:18db568f1098
--- a/COM_SND_TM.h Tue Jan 12 15:08:29 2016 +0000
+++ b/COM_SND_TM.h Thu Jan 14 06:16:42 2016 +0000
@@ -1,4 +1,4 @@
-void adf_not_SDcard();
+//void adf_not_SDcard();
#define S_FRAME_SIZE 48
#define ISR 40
@@ -11,6 +11,7 @@
const unsigned char EoS[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x1A,0x77,0xEF,0xC3,0x4A,0xEA,0x27,0x91,0x1A,0x77,0xEF,0xC3,0x4A,0xEA,0x27,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x1A,0x77,0xEF,0xC3,0x4A,0xEA,0x27,0x91,0x1A,0x77,0xEF,0xC3,0x4A,0xEA,0x27,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const unsigned char FCCH80[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
const unsigned char SCH40[] = {0x0a,0x3f,0x46,0xb4,0x00};
+const unsigned char EXOR_SEQ[] = {0x55,0xF1,0x51,0x3D,0xA7,0x42,0xAE,0x2E,0x2E,0x28,0x76,0x80,0x62,0x41,0xC4,0x75,0x4D,0x87,0xDB,0xE1,0x02,0x61,0x60,0x96,0x9C,0xCB,0x8A,0xBD,0x37,0xE4,0x72,0x5D,0xF2,0x19,0x62,0x06,0x9A,0xF9,0x38,0xB0,0x49,0x75,0xD0,0x17,0x1B,0xCC,0x0B,0xEB,0x1B,0x50,0xA2,0x2A,0x8E,0xFA,0x4D,0x6F,0x1B,0xF8,0x0F,0x97,0x39,0x25,0x60,0x55,0x9A,0xDF,0x1D,0x10,0x7F,0xBD,0x3E,0xBF,0xE5,0x68,0x02,0xD1,0x99,0x0D,0xDF,0x84,0x2E,0x15,0xE3,0x08,0xD7,0x44,0x10,0x41,0xCE,0x93,0xF6,0x59,0x71,0xD2,0xF7,0x1C,0x4A,0x44,0x2D,0xA9,0x44,0x98,0x3A,0x00,0x71,0xCC,0x2A,0x35,0xC1,0x81,0xCF,0x44,0xF7,0x6A,0x0E,0xE4,0xF2,0xFC,0xD6,0x0B,0xA8,0x95,0x7B,0x86,0xB5,0xF8,0x33,0xE9,0xBF,0x6A,0x0E,0xE6,0x53,0x82};
class SND_TM{
@@ -63,7 +64,7 @@
Base_tm*head = head_ptr;
type0_no = 0;
type1_no = 0;
- while(head->next_TM != NULL){
+ while(head != NULL){
switch( GETshort_or_long_tm(head->fields) ){
case 0:
type0_no++;
@@ -82,11 +83,10 @@
if(SEGMENT_NO > MAX_SEGMENT)
{
SEGMENT_NO = MAX_SEGMENT;
- segment_r = 1;
}
- else segment_r = 0;
+ if(SEGMENT_NO == 1) segment_r = 0; else segment_r = 1;
TOTAL_SEGMENT_NO -= SEGMENT_NO;
- LAST_SEGMENT_SIZE = total_frames*2%ISR;
+ LAST_SEGMENT_SIZE = total_frames*2%ISR?total_frames*2%ISR:ISR;
}
#define next_type_structure(ptr){\
@@ -141,6 +141,7 @@
// }
// return temp_ptr;
// }
+ #define exor(ptr) { for(int i=0 ; i<134; i++ ) ptr[i]=ptr[i]^EXOR_SEQ[i];}
#define first_type_structure( type,return_ptr) {\
@@ -185,7 +186,7 @@
next_type_structure(T1F_pointer);\
}\
}\
- TMframe_type1[0] = 1<<7 + ( (i-4)/10 )<<3;\
+ TMframe_type1[0] = (1<<7) + (( (i-4)/13 )<<3);\
TMframe_type1[3] = crc16_gen(TMframe_type1,3);\
if(T1F_pointer == NULL && i>12){\
for( ; i < 134 ; i++){\
@@ -314,6 +315,7 @@
DS_state = !DS_state;\
if (DS_f){\
DS_f = false;\
+ exor(ptr);\
convolution(ptr);\
interleave(convoluted_frame,interleave_data[0]);\
interleave(convoluted_frame+ 135,interleave_data[1]);}\
@@ -439,6 +441,7 @@
else{
Tframe_c = 0;
segment_c++;
+ if(segment_c >= SEGMENT_NO - 1 && TOTAL_SEGMENT_NO == 0) segment_r = 0; else segment_r = 1;
if(segment_c == SEGMENT_NO)
{eos_f = true;}
else{
@@ -472,9 +475,8 @@
if(SEGMENT_NO > MAX_SEGMENT)
{
SEGMENT_NO = MAX_SEGMENT;
- segment_r = 1;
}
- else segment_r = 0;
+ if(SEGMENT_NO == 1) segment_r = 0; else segment_r = 1;
TOTAL_SEGMENT_NO -= SEGMENT_NO;
reset_adf = true;//what does this do??
Sframe = true;
