forked from xuos/xiuos
add g_uart_selected array for ch438
This commit is contained in:
parent
52aa3c5abd
commit
00e0a48ee7
|
@ -36,8 +36,6 @@ void CH438Demo(void)
|
|||
char buffer[256];
|
||||
int readlen;
|
||||
|
||||
// while(1)
|
||||
// {
|
||||
fd = open("/dev/extuart_dev3", O_RDWR);
|
||||
m0fd = open("/dev/gpout0", O_RDWR);
|
||||
m1fd = open("/dev/gpout1", O_RDWR);
|
||||
|
@ -82,6 +80,5 @@ void CH438Demo(void)
|
|||
}
|
||||
|
||||
close(fd);
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -87,6 +87,35 @@ static pthread_cond_t cond[CH438PORTNUM] =
|
|||
PTHREAD_COND_INITIALIZER
|
||||
};
|
||||
|
||||
/* This array shows whether the current serial port is selected */
|
||||
static bool const g_uart_selected[CH438PORTNUM] =
|
||||
{
|
||||
#ifdef CONFIG_CH438_EXTUART0
|
||||
[0] = true,
|
||||
#endif
|
||||
#ifdef CONFIG_CH438_EXTUART1
|
||||
[1] = true,
|
||||
#endif
|
||||
#ifdef CONFIG_CH438_EXTUART2
|
||||
[2] = true,
|
||||
#endif
|
||||
#ifdef CONFIG_CH438_EXTUART3
|
||||
[3] = true,
|
||||
#endif
|
||||
#ifdef CONFIG_CH438_EXTUART4
|
||||
[4] = true,
|
||||
#endif
|
||||
#ifdef CONFIG_CH438_EXTUART5
|
||||
[5] = true,
|
||||
#endif
|
||||
#ifdef CONFIG_CH438_EXTUART6
|
||||
[6] = true,
|
||||
#endif
|
||||
#ifdef CONFIG_CH438_EXTUART7
|
||||
[7] = true,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* ch438 Callback work queue structure */
|
||||
static struct work_s g_ch438irqwork;
|
||||
|
||||
|
@ -135,7 +164,7 @@ static FAR void getInterruptStatus(FAR void *arg)
|
|||
{
|
||||
for(i = 0; i < CH438PORTNUM; i++)
|
||||
{
|
||||
if(gInterruptStatus & Interruptnum[i])
|
||||
if(g_uart_selected[i] && (gInterruptStatus & Interruptnum[i]))
|
||||
{
|
||||
pthread_mutex_lock(&mutex[i]);
|
||||
done[i] = true;
|
||||
|
@ -572,6 +601,11 @@ static void Ch438InitDefault(void)
|
|||
/* Initialize the mutex */
|
||||
for(i = 0; i < CH438PORTNUM; i++)
|
||||
{
|
||||
if(!g_uart_selected[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = pthread_mutex_init(&mutex[i], NULL);
|
||||
if(ret != 0)
|
||||
{
|
||||
|
@ -582,6 +616,11 @@ static void Ch438InitDefault(void)
|
|||
/* Initialize the condition variable */
|
||||
for(i = 0; i < CH438PORTNUM; i++)
|
||||
{
|
||||
if(!g_uart_selected[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = pthread_cond_init(&cond[i], NULL);
|
||||
if(ret != 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue