136 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			136 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								/****************************************************************************
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
							 | 
						||
| 
								 | 
							
								 * be copied by any method or incorporated into another program without
							 | 
						||
| 
								 | 
							
								 * the express written consent of Aerospace C.Power. This Information or any portion
							 | 
						||
| 
								 | 
							
								 * thereof remains the property of Aerospace C.Power. The Information contained herein
							 | 
						||
| 
								 | 
							
								 * is believed to be accurate and Aerospace C.Power assumes no responsibility or
							 | 
						||
| 
								 | 
							
								 * liability for its use in any way and conveys no license or title under
							 | 
						||
| 
								 | 
							
								 * any patent or copyright and makes no representation or warranty that this
							 | 
						||
| 
								 | 
							
								 * Information is free from patent or copyright infringement.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * ****************************************************************************/
							 | 
						||
| 
								 | 
							
								#include "stdio.h"
							 | 
						||
| 
								 | 
							
								#include "stdint.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								int main(int argc,char *argv[])
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    FILE* fp;
							 | 
						||
| 
								 | 
							
								    uint8_t i;
							 | 
						||
| 
								 | 
							
								    int start_tone,end_tone;
							 | 
						||
| 
								 | 
							
								    int start_index,end_index;
							 | 
						||
| 
								 | 
							
								    int start_bit,end_bit;
							 | 
						||
| 
								 | 
							
								    int start_dw,end_dw;
							 | 
						||
| 
								 | 
							
								    uint32_t tone_mask_table[48];
							 | 
						||
| 
								 | 
							
								    fp = fopen("tone_mask.h","w+");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    //scanf("%d%d",&start_tone,&end_tone);
							 | 
						||
| 
								 | 
							
								    start_tone = atoi(argv[1]);
							 | 
						||
| 
								 | 
							
								    end_tone = atoi(argv[2]);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    start_index = start_tone >> 5;
							 | 
						||
| 
								 | 
							
								    end_index = end_tone >> 5;
							 | 
						||
| 
								 | 
							
								    start_bit = start_tone & 0x1f;
							 | 
						||
| 
								 | 
							
								    end_bit = end_tone & 0x1f;
							 | 
						||
| 
								 | 
							
								    start_dw = 0xffffffff << start_bit;
							 | 
						||
| 
								 | 
							
								    end_dw = 0xffffffff >> (31 - end_bit);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "#ifndef TONEMASK_H");
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "#define TONEMASK_H");
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "#include \"hw_tonemask.h\"");
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "plc_tonemask_table all_mask_tone_mask_table = {");
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    {");
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    for(i = 0; i < 48; i++)
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        if(i < start_index || i > end_index)
							 | 
						||
| 
								 | 
							
								            tone_mask_table[i] = 0x00000000;
							 | 
						||
| 
								 | 
							
								        if(i == start_index && i != end_index)
							 | 
						||
| 
								 | 
							
								            tone_mask_table[i] = start_dw;
							 | 
						||
| 
								 | 
							
								        if(i == end_index && i != start_index)
							 | 
						||
| 
								 | 
							
								            tone_mask_table[i] = end_dw;
							 | 
						||
| 
								 | 
							
								        if(i == end_index && i == start_index)
							 | 
						||
| 
								 | 
							
								            tone_mask_table[i] = start_dw & end_dw;
							 | 
						||
| 
								 | 
							
								        if(i > start_index && i < end_index)
							 | 
						||
| 
								 | 
							
								            tone_mask_table[i] = 0xffffffff;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        if(i % 4 == 0)
							 | 
						||
| 
								 | 
							
								            fprintf(fp, "        ");
							 | 
						||
| 
								 | 
							
								        fprintf(fp, "0x%08x,", tone_mask_table[i]);
							 | 
						||
| 
								 | 
							
								        if(((i + 1) % 4) == 0)
							 | 
						||
| 
								 | 
							
								            fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								        else
							 | 
						||
| 
								 | 
							
								            fputc(' ', fp);
							 | 
						||
| 
								 | 
							
								        //printf("0x%08x ",tone_mask_table[i]);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    }");
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								    fputc('}', fp);
							 | 
						||
| 
								 | 
							
								    fputc(';', fp);
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "plc_band_table_t all_mask_band_table = {\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    0, // valid_tone_number, 1536 max\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    0, // resv0\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    0, // start tone\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    0, // resv1\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    0, // end tone\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    0, // resv2\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    {   // TMI\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW0\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW1\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW2\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW3\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW4\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW5\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW6\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW7\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW8\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW9\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW10\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW11\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW12\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW13\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW14\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    },\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    {   // ext TMI\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW0\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW1\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW2\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW3\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW4\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW5\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW6\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW7\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW8\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW9\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW10\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW11\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW12\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW13\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "        { 0, 0, 0, 0 },  // DW14\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    },\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    0,   // resv 3\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "    0,   // resv 4\n");
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "};\n");
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    fprintf(fp, "#endif");
							 | 
						||
| 
								 | 
							
								    fputc('\n', fp);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    fclose(fp);
							 | 
						||
| 
								 | 
							
								    return 0;
							 | 
						||
| 
								 | 
							
								}
							 |