Exemplo n.º 1
0
acoral_32 acoral_mount(acoral_char *source,const char *target,
					   const acoral_char *filesystemtype,acoral_u32 mountflags,
					   const void *data)
{
	acoral_u32 ret;
	acoral_32 fs_ret;
	ret=acoral_mutex_pend(fs_mutex,0);
	if(ret!=MUTEX_SUCCED)
		return -1;
	fs_ret=AddFileDriver(FsCommand,source,GetDrive(target));
	if(fs_ret==-1)
	{
		acoral_mutex_post(fs_mutex);
		return -1;
	}
	acoral_mutex_post(fs_mutex);
	return 0;
}
Exemplo n.º 2
0
void main(void)
{
	Int16  temp_cnt;

	ICR = 0xff2e;	/* IDLE Control Register */
					/* mem port, io port and cpu idle active */

	/* Peripheral_Reset  */
	CSL_SYSCTRL_REGS->PSRCR = 0x0020;

	CSL_SYSCTRL_REGS->PCGCR1 = 0x0000;
	CSL_SYSCTRL_REGS->PCGCR2 = 0x0000;
	CSL_SYSCTRL_REGS->PRCR = 0x00bf;

/* VERY IMPORTANT !!! */
/* PPMODE1 (SPI, GPIO, UART, and I2S2):
    7 signals of the SPI module,
    6 GPIO signals(GP[17:12]),
    4 signals of the UART module,
    4 signals of the I2S2 module

   SP1MODE2 (GP[11:6]). 6 GPIO signals (GP[11:6])
   SP0MODE0 (MMC/SD0). All 6 signals of the MMC/SD0
*/
	CSL_SYSCTRL_REGS->EBSR = (CSL_SYS_EBSR_PPMODE_MODE1 << 12)
							|(CSL_SYS_EBSR_SP1MODE_MODE2 << 10)
							|(CSL_SYS_EBSR_SP0MODE_MODE0 << 8);

	asm("	bit(ST1, #ST1_INTM) = #1");

	INTR_init();
	PLL_init(3658);		// system clock set to 120MHz
	TIMER_init();
	EZDSP5535_GPIO_init();
	EZDSP5535_I2C_init();		/* Initialize I2C */

	Audio_init(7);				/* Initialise to bandwidth=7kHz */

	EZDSP5535_LCD_init();
	LCD_print("G722.1 Receiver  ", 17, 0);
	LCD_print("16kbps  ", 8, 1);
	EZDSP5535_SPI_init();
	Si446x_Init();

	EZDSP5535_SAR_init();
	DiskInit();
	FileInit();

	AddFileDriver(SDCammand, NULL);

	asm("	bit(ST1, #ST1_INTM) = #0");

	bApi_Set_Receive();
	while(1) {
		if(gpioIsrStatus == 1) {
			temp_cnt = SPI_recvData(spibuffer);

			gpioIsrStatus = 0;
			CSL_GPIO_REGS->IOINTFLG1 = 0x0800;
		}

		if(spiIsrStatus == 1) {
//			SpiWriteByte(CMD_FIFO_INFO, 0);
			SpiWriteByte(CMD_GET_INT_STATUS, 0);
			bApi_Set_Receive();
			if(audioProcessing())	continue;

			spiIsrStatus = 0;
		}

		fileProcessing();

		asm("	idle");
	}

//	RemoveFileDriver(SDCammand);
}
Exemplo n.º 3
0
void main(void)
{
	Int16  *samples;
	HANDLE FHandle = Not_Open_FILE;
	Int16  *out_words = &rawOutWords[1];
	Uint8  *byte16 = &RfByte[2];	
	Int16  mlt_coefs[DCT_LENGTH];
	Int16  mag_shift[2];
	Int16  old_mag_shift[2];
	Uint16 number_of_bits_per_frame;
	Uint16 number_of_bytes_per_frame;
	Uint16 number_of_16bit_words_per_frame;
	Int16  offset;
	Int16  key;
	Uint16 chn;		// left and right channel, 0 or 1
	Int16  sent_buffer_cnt = 0;
	Uint8  *sent_buffer;
	
	ICR = 0xff2e;	/* IDLE Control Register */
					/* mem port, io port and cpu idle active */

	DSP_zero(xmt_l, DCT_LENGTH);
	DSP_zero(xmt_r, DCT_LENGTH);
	/* Peripheral_Reset  */
	CSL_SYSCTRL_REGS->PSRCR = 0x0020;

	CSL_SYSCTRL_REGS->PCGCR1 = 0x0000;
	CSL_SYSCTRL_REGS->PCGCR2 = 0x0000;
	CSL_SYSCTRL_REGS->PRCR = 0x00bf;

	CSL_SYSCTRL_REGS->EBSR = (CSL_SYS_EBSR_PPMODE_MODE1 << 12)
							| (0 << 8) | (2 << 10);//GPIO(11-6)
	asm("	bit(ST1, #ST1_INTM) = #1");

	number_of_bits_per_frame = (Uint16)(BITRATE * 20);	// BITRATE in kbps
	number_of_bytes_per_frame = (Uint16)(number_of_bits_per_frame>>3);
	number_of_16bit_words_per_frame = (Uint16)(number_of_bits_per_frame>>4);

	INTR_init();
	PLL_init();
	TIMER_init();
	EZDSP5535_GPIO_init();
	DMA_audio_init(DCT_LENGTH);

	EZDSP5535_I2C_init();		/* Initialize I2C */
	aic3204_init(6);			/* Initialize codec */
	EZDSP5535_LCD_init();
	EZDSP5535_I2S_init();		/* Initialize I2S */
	LCD_print("G722.1 Send       ", 17, 0);
	LCD_print("16kbps  ", 8, 1);
	EZDSP5535_SPI_init();
	Si446x_Init();
	EZDSP5535_SAR_init();
	DiskInit();
	FileInit();
	AddFileDriver(SDCammand, NULL);

	sam2coef_init();
	coef2sam_init();
	rawOutWords[0] = 0x6b21;
	RfByte[0] = 0x21; RfByte[1] = 0x6b;		// little-endian

	old_mag_shift[0] = 0;
	old_mag_shift[1] = 0;
	asm("	bit(ST1, #ST1_INTM) = #0");

	SpiWriteByte(CMD_GET_INT_STATUS, 0);	// clear interrupt pending
	while(1) {
		if(pingpong >= 0) {
			offset = (pingpong>>1) * DCT_LENGTH;
/*******************************************************************
 * LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT LEFT
 *******************************************************************/
			chn = LEFT;
			samples = &rcv_l[offset];		// Read frame of samples from mem.
			// Convert input samples to rmlt coefs
			mag_shift[chn] = samples_to_rmlt_coefs(samples, mlt_coefs, chn);
			// Encode the mlt coefs
			encoder(number_of_bits_per_frame, mlt_coefs, mag_shift[chn], out_words);
			byte16 = &RfByte[2];
			byte16[-2] = 0x6b; byte16[-1] = 0x20;
			DSP_word2byte(byte16, out_words, number_of_16bit_words_per_frame);
			
			// process the out_words into decoder_mlt_coefs
			decoder(out_words, mlt_coefs, &mag_shift[chn], &old_mag_shift[chn]);

			samples = &xmt_l[offset];		// Write frame of output samples
			// convert the decoder_mlt_coefs to samples
			rmlt_coefs_to_samples(mlt_coefs, samples, mag_shift[chn], chn);

/*******************************************************************
 * RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT RIGHT 
 *******************************************************************/
			chn = RIGHT;
			samples = &rcv_r[offset];		// Read frame of samples from mem.
			// Convert input samples to rmlt coefs
			mag_shift[chn] = samples_to_rmlt_coefs(samples, mlt_coefs, chn);
			// Encode the mlt coefs
			encoder(number_of_bits_per_frame, mlt_coefs, mag_shift[chn], out_words);

			byte16 = &RfByte[number_of_bytes_per_frame + 4];
			byte16[-2] = 0x6b; byte16[-1] = 0x21;
			DSP_word2byte(byte16, out_words, number_of_16bit_words_per_frame);

			// process the out_words into decoder_mlt_coefs
			decoder(out_words, mlt_coefs, &mag_shift[chn], &old_mag_shift[chn]);

			samples = &xmt_r[offset];		// Write frame of output samples
			// convert the decoder_mlt_coefs to samples
			rmlt_coefs_to_samples(mlt_coefs, samples, mag_shift[chn], chn);

			if (FHandle != Not_Open_FILE)	// Write output bitstream
				FileWrite(RfByte, 2*number_of_bytes_per_frame+4, FHandle);

			pingpong = -1;
			sent_buffer = RfByte;
			sent_buffer_cnt = 0;
		}
		if(spiIsrStatus == 1) {
			bApi_Set_Send(43);
			spiIsrStatus = 0;
		}
		if(sent_buffer_cnt < 2) {
			if(gpioIsrStatus == 1) {
				SPI_sendData(sent_buffer, number_of_bytes_per_frame+2);
				sent_buffer += number_of_bytes_per_frame+2;
				sent_buffer_cnt++;
				gpioIsrStatus = 0;
				CSL_GPIO_REGS->IOINTFLG1 = 0x0800;
			}
		}

//		key = EZDSP5535_SAR_getKey();
		key = -1;
		if(key == SW1)
		if(FHandle == Not_Open_FILE)
		{
			LCD_print("RECORDING......", 15, 0);
			FHandle = FileOpen("A:\\VOICE000.TXT", FILE_FLAGS_WRITE);
		}
		if(key == SW2)
		if(FHandle != Not_Open_FILE)
		{
			LCD_print("SAVE VOICE000.DAT", 17, 0); 
			FileClose(FHandle);
			AllCacheWriteBack();
			FHandle = Not_Open_FILE;
		}
		asm("	idle");
	}