Exemplo n.º 1
0
static void* _pio_retrive_group(const struct _pin *pin, uint32_t periph_id)
{
	if (!matrix_is_peripheral_secured(MATRIX1, periph_id)) {
		return (void*) &PIOA->PIO_IO_GROUP[pin->group];
	} else {
		return (void*) &PIOA->PIO_PIO_[pin->group];
	}
}
Exemplo n.º 2
0
Arquivo: aic.c Projeto: wugsh/wgs
/**
 * \brief Configure corresponding handler for the interrupts coming from the given (unique) source (ID_xxx).
 *
 * \param source  Interrupt source to configure.
 * \param handler handler for the interrupt.
 */
void aic_set_source_vector(uint32_t source, void (*handler)(void))
{
	Aic *aic = AIC;

	if (SFR->SFR_AICREDIR == 0) {
		Matrix* matrix = get_peripheral_matrix(source);
		if (matrix_is_peripheral_secured(matrix, source))
			aic = SAIC;
	}
	_aic_set_source_vector(aic, source, handler);
}
Exemplo n.º 3
0
static void* _pio_configure_pins(const struct _pin *pin, uint32_t periph_id)
{
	PioPio_* piogroup = &PIOA->PIO_PIO_[pin->group];
	if (!matrix_is_peripheral_secured(MATRIX1, periph_id)) {
		piogroup->S_PIO_SIONR = pin->mask;
		return (void*) &PIOA->PIO_IO_GROUP[pin->group];
	} else {
		piogroup->S_PIO_SIOSR = pin->mask;
		return (void*) piogroup;
	}
}
Exemplo n.º 4
0
Arquivo: aic.c Projeto: wugsh/wgs
/**
 * \brief Configure interrupts' source mode.
 *
 * \param source  Interrupt source to configure.
 * \param mode    mode combined of priority level and interrupt source type.
 */
void aic_configure(uint32_t source, uint8_t mode)
{
	if (SFR->SFR_AICREDIR) {
		_aic_configure_it(source, mode);
		return;
	}

	Matrix* matrix = get_peripheral_matrix(source);
	if (!matrix_is_peripheral_secured(matrix, source)) {
		_aic_configure_it(source, mode);
	} else {
		// Does not apply for SAIC
	}
}
Exemplo n.º 5
0
Arquivo: aic.c Projeto: wugsh/wgs
/**
 * \brief Disables interrupts coming from the given (unique) source (ID_xxx).
 *
 * \param source  Interrupt source to disable.
 */
void aic_disable(uint32_t source)
{
	if (SFR->SFR_AICREDIR) {
		_aic_disable_it(AIC, source);
		return;
	}

	Matrix* matrix = get_peripheral_matrix(source);
	if (!matrix_is_peripheral_secured(matrix, source)) {
		_aic_disable_it(AIC, source);
	} else {
		_aic_disable_it(SAIC, source);
	}
}
Exemplo n.º 6
0
Arquivo: aic.c Projeto: wugsh/wgs
/**
 * \brief Configure interrupts' source mode.
 *
 * \param source  Interrupt source to configure.
 * \param mode    mode combined of priority level and interrupt source type.
 */
void aic_set_or_clear(uint32_t source, uint8_t set)
{
	Aic *aic = AIC;

	if (SFR->SFR_AICREDIR == 0) {
		Matrix* matrix = get_peripheral_matrix(source);
		if (matrix_is_peripheral_secured(matrix, source))
			aic = SAIC;
	}

	if (set) {
		_aic_set_it(aic, source);
	} else {
		_aic_clear_it(aic, source);
	}
}
Exemplo n.º 7
0
static void _piod_handler(void)
{
	uint32_t status = 0;
	unsigned int i = 0;
	if (matrix_is_peripheral_secured(MATRIX1, ID_PIOD))
		status = PIOA->PIO_PIO_[PIO_GROUP_D].S_PIO_ISR;
	else
		status = PIOA->PIO_IO_GROUP[PIO_GROUP_D].PIO_ISR;

	for (i = 0; i < ARRAY_SIZE(_handlers); ++i) {
		if (_handlers[i].mask & status) {
			_handlers[i].handler(PIO_GROUP_D, status,
					_handlers[i].user_arg);
		}
	}
}