OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12190|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- h8 B6 Q1 b1 y6 c
  1. [code]EDMA sample test application
    0 A* |1 R  m: S, U9 g
  2. /*8 n& w& c, k/ N7 h7 @) @3 b9 N
  3. * edma_test.c
    $ ?6 m" M+ h1 _* i& @1 ?0 F" V  D
  4. *% ^( T' @, s; S; i
  5. * brief  EDMA3 Test Application$ ]- {; p* V( `) b0 P, F
  6. *' s' s& }8 ~" e9 C; _$ B5 ]1 s. B$ I
  7. *   This file contains EDMA3 Test code.
    & T9 A. U' a1 b3 |( ~3 l- v
  8. *
    * I  t& B* Z9 c  Y8 }! t. S7 r% h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( ^( Z2 o- d# c9 l8 ^) |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 G' a) _$ H0 N) q
  11. *         TO CHANGE.
    & G9 |( w% F. U4 C
  12. *, a! Z4 G! I( z; g! K) v2 R& @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 Y; s0 f4 F7 Y
  14. *5 |# s8 m. R  S( U( p* y
  15. * This program is free software; you can redistribute it and/or
    ) f5 z# K( H2 v4 o+ A
  16. * modify it under the terms of the GNU General Public License as
    / @- Y5 v5 ]) Q6 c4 @4 e% D  W
  17. * published by the Free Software Foundation version 2.6 s" d1 v+ n& ]( f! E8 k
  18. *
    3 {7 _& x% A6 Q" N! W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 F' Y! ^$ N- d2 v0 [
  20. * kind, whether express or implied; without even the implied warranty/ m4 R0 a1 B: G0 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( t# \- B% ~! i0 u7 R
  22. * GNU General Public License for more details.) T' f7 ], l# {6 p' |
  23. */
    9 o; [$ U6 o' i3 o
  24. 6 [- R  N8 D6 L# K  y: y
  25. #include <linux/module.h>( z, O; \, U4 O/ Y! I- H  l! f
  26. #include <linux/init.h>7 M2 O6 n: l8 Q; B+ O, K2 q
  27. #include <linux/errno.h>8 `6 k8 K1 `) M% @5 w3 O
  28. #include <linux/types.h>
    ! I9 j7 L  _8 f: a
  29. #include <linux/interrupt.h>, q8 e* b9 c, M; ]* M
  30. #include <asm/io.h>
    7 ^% O# Y6 S9 T& P; Z8 f2 ^# U' P
  31. #include <linux/moduleparam.h>
    $ a- g+ T% I+ W& k
  32. #include <linux/sysctl.h>5 G! O( @/ q$ ?1 y8 J
  33. #include <linux/mm.h>% \1 j& I- r. [3 V! l( N2 L' f' A
  34. #include <linux/dma-mapping.h>
    2 e( e: b! F$ y+ G) A: d- G
  35. 5 X& k& m) H6 j; O2 z% x
  36. #include <mach/memory.h>% ?6 N: |4 |6 G8 ~/ Y$ |" U
  37. #include <mach/hardware.h>! K+ u7 b* Q* M6 e& |2 D
  38. #include <mach/irqs.h>, _* |, @& i1 l' ]
  39. #include <asm/hardware/edma.h>
    8 I/ W" Z: o9 y$ `

  40. 9 N0 x" x# W9 A# D4 f% d- q
  41. #undef EDMA3_DEBUG
    3 q  i" T: i8 Z8 P  Y$ ]; S
  42. /*#define EDMA3_DEBUG*/& Z: @1 X2 u5 D2 c9 c8 r% i
  43.   p9 D4 T. W" I6 ~& j" Y
  44. #ifdef EDMA3_DEBUG9 j0 c5 g$ t" `; `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 C. s  E4 o* \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % Z. i5 E! ?, S8 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). M- T  |) e, m+ {7 w/ a
  48. #else3 s& L6 E4 Y4 A- h) ?$ T+ x
  49. #define DMA_PRINTK( x... )
    # J. y! Z- F: `6 L
  50. #define DMA_FN_IN
    . M6 v# ~4 i; a1 S6 @" [2 @
  51. #define DMA_FN_OUT( V* i$ |+ `' c) P  a
  52. #endif
    9 Y3 R+ |5 ?) ?( Q

  53. , B6 D( f! q0 _  T$ j6 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - `1 ^) @* r2 V
  55. #define STATIC_SHIFT                3& D5 M5 z- y7 m8 q
  56. #define TCINTEN_SHIFT               20
    ! R4 m1 c9 n7 ~2 n
  57. #define ITCINTEN_SHIFT              21
    ' L$ ]& u, {! y' o) Y
  58. #define TCCHEN_SHIFT                22% T& H! A9 @+ u# c+ p- W1 U0 V
  59. #define ITCCHEN_SHIFT               236 q6 J5 y$ M3 S, q
  60. & @* u7 M! c4 }' C5 Z
  61. static volatile int irqraised1 = 0;
    9 C( i$ _3 }1 n) f! x
  62. static volatile int irqraised2 = 0;
    - D# [9 f  E2 p9 a

  63. 4 V6 P+ |9 O; a- ]. A, ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " M: I) [+ ?# I0 ~; ]! J8 [: D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 d& a3 k: D( ?2 u9 t* k1 }3 k4 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- V3 b8 ^6 S. Q3 E; X

  67. % P7 H1 x" B( g6 E' n
  68. dma_addr_t dmaphyssrc1 = 0;
    ) R- {0 ]' o9 t6 ]6 R- D2 N
  69. dma_addr_t dmaphyssrc2 = 0;
    ( I' D. X: t% ~3 |* _, h0 ~7 L+ a, L
  70. dma_addr_t dmaphysdest1 = 0;
    ! F* L( R4 \/ x
  71. dma_addr_t dmaphysdest2 = 0;7 W2 V3 L4 Z  e$ p' K3 J
  72. ! I: I% S# N1 p
  73. char *dmabufsrc1 = NULL;' ~; d: Y$ C: b8 L
  74. char *dmabufsrc2 = NULL;
    5 b3 T+ Z. `, |8 d- ]5 W; Z
  75. char *dmabufdest1 = NULL;0 I9 ]8 A0 M9 s% a$ g8 ~; V5 L
  76. char *dmabufdest2 = NULL;7 f; ^, q4 O+ y1 @

  77. ! E2 a! Y; \6 f5 F6 A
  78. static int acnt = 512;
    * k$ t/ c) U. }0 Q
  79. static int bcnt = 8;
    $ [" _! g' k1 F, Z, }) Q+ [3 y  N
  80. static int ccnt = 8;6 w# o# Z# K: J  f; y
  81. 2 s: g* @! z1 q& @* Q) W( d
  82. module_param(acnt, int, S_IRUGO);
    5 p% G+ m& A7 ]# H$ s$ a
  83. module_param(bcnt, int, S_IRUGO);
    ) o8 k. l' y6 v  j/ j7 h9 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  n/ O0 H% D" a/ E& D

4 l6 L" s0 Y+ H( A      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; e, K" U* t8 B# b' rarm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( `8 R6 k7 }! N8 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. v- v/ @! l- K, b. ^! U
8 v( a3 S. t( E5 Y# `( n( L
: ~; g* e/ b( ^" K; g% W8 j7 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-3-4 19:51 , Processed in 0.052371 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表