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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % y; U4 I0 a" }% p
  1. [code]EDMA sample test application8 m. P# m8 k0 o/ @1 w4 A
  2. /*& t" H+ n( n, X2 {2 o' w: i
  3. * edma_test.c
    ' V4 L1 T* w; ^7 m6 f
  4. *- b5 D, m3 j+ }8 y, M0 W, f" v
  5. * brief  EDMA3 Test Application$ Q; M2 G8 J5 ?& U% Z) B
  6. *
    1 b9 y/ \  `" T2 J0 w' N6 }$ \
  7. *   This file contains EDMA3 Test code.' O! ]3 p  Y" d  r
  8. *. j: E; I( {3 P2 ]% C: q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  l) v- B: |: q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 T4 F/ L  J$ t1 ?% U" Z0 i
  11. *         TO CHANGE.8 E* q6 r/ x3 S! X% f
  12. *" R9 l5 _1 T# r/ U$ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 j7 m- ~0 ~. a
  14. *
    5 D) C, k# O- `7 v  P
  15. * This program is free software; you can redistribute it and/or: W: w% b4 [) P- c0 y5 R" U" v
  16. * modify it under the terms of the GNU General Public License as7 ?& P0 L# {! M4 [5 a3 K# d* k
  17. * published by the Free Software Foundation version 2.
    5 b0 S; l& F% y+ L5 V  p
  18. *9 s4 @) [' Y9 O9 X7 B. }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 o4 s- U+ f/ l4 q, P
  20. * kind, whether express or implied; without even the implied warranty$ ]) g  P( w* \$ B, O1 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( m2 ~0 q5 F, I4 R2 E1 n
  22. * GNU General Public License for more details.9 _7 `: K  @& Y2 q5 j
  23. */8 k: s1 e+ H5 V$ L7 z

  24. 4 D# m/ C- L' g# o3 J% o
  25. #include <linux/module.h>+ x! `# M) t9 f) A# A
  26. #include <linux/init.h>$ x3 ~( \! ^, i+ [1 W8 D4 W3 P
  27. #include <linux/errno.h>
    9 o% K( k. u) v- o" U
  28. #include <linux/types.h>
    ; R7 z8 C- _$ G5 @. v
  29. #include <linux/interrupt.h>
    ( i- b" e2 y% P6 Q8 y. s
  30. #include <asm/io.h>
    & T" D! s( K6 _
  31. #include <linux/moduleparam.h>( ]+ A# h) v4 \  e6 W+ @  e4 J
  32. #include <linux/sysctl.h>
    4 Y# h) A8 b+ a
  33. #include <linux/mm.h>
    4 S7 j! C: w  b
  34. #include <linux/dma-mapping.h>
    : F. w: s4 D5 |* a" r$ h  e6 s

  35. " `) s% s0 Q& A, e* X2 `
  36. #include <mach/memory.h>8 k, n9 }/ E  I' h& i) F
  37. #include <mach/hardware.h>6 B! d& v4 q. I( ^2 ~# S
  38. #include <mach/irqs.h>1 h: L; V+ H  ~
  39. #include <asm/hardware/edma.h>
    - T$ ~% f3 e+ O( j0 t2 t

  40. ( f5 f" N" V* V7 ^( ^& U( E  X
  41. #undef EDMA3_DEBUG- O$ l) ]6 |$ `6 m) Y
  42. /*#define EDMA3_DEBUG*/
    " C3 d9 M+ Q. s) m3 Y

  43. 2 i( Y" `9 ^$ ^, p" u
  44. #ifdef EDMA3_DEBUG: y7 x! R, q; F) e2 [0 {6 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" f! M# j. a$ I5 N4 G7 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # H$ s4 r6 b7 w! H* s+ P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 G3 G2 U3 E/ b/ ^
  48. #else
      U& t& j- `) q' X* y* K6 U1 M
  49. #define DMA_PRINTK( x... ). k7 @6 u2 b3 D1 R( A& J+ c9 ?# R
  50. #define DMA_FN_IN/ b; ?* x  i5 I% h9 j
  51. #define DMA_FN_OUT2 k# A7 F8 B$ l6 B. M* j& o8 f
  52. #endif
    1 @  i( b9 Z$ y; H) X2 K; l
  53. . }) b0 [' ^  D  l1 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " S4 b/ h) V9 Q  w* e. s! Z
  55. #define STATIC_SHIFT                3
    " |  n' \  u1 e1 P/ _
  56. #define TCINTEN_SHIFT               20
    ! `7 y: m! {4 ~# X8 M! }, Z  N
  57. #define ITCINTEN_SHIFT              21* Z  n0 ]* L! o( J" K! a' ~; U
  58. #define TCCHEN_SHIFT                22
    " h9 `3 \- `6 e8 u, a, O
  59. #define ITCCHEN_SHIFT               23/ p- W: l0 @8 m
  60. 4 N: s( E: B" u! Z  |3 V
  61. static volatile int irqraised1 = 0;
    / @' I, Z7 K8 n/ i( ]
  62. static volatile int irqraised2 = 0;
    8 d7 s, J4 a. s# U/ Q" Z! a1 ]
  63. 7 W5 b( _" {4 B& Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 _4 E# D1 y" Q0 _7 X2 F7 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ]2 Z$ d' m0 C) R. b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 W( k& G" _: E, v+ n( n
  67. # b" J/ |# E- h7 {/ X/ D# ]% \
  68. dma_addr_t dmaphyssrc1 = 0;
    ( _% t; q6 l  R0 R7 N$ E0 s; r
  69. dma_addr_t dmaphyssrc2 = 0;
    / m+ c/ d4 U" n; k1 _
  70. dma_addr_t dmaphysdest1 = 0;, \6 z/ H/ F% R% O+ o2 _! U
  71. dma_addr_t dmaphysdest2 = 0;
    " P, X* I6 z) \1 j0 B5 W

  72. 8 N5 x; W' v& O4 j3 ^# t8 P/ x) ], c, l
  73. char *dmabufsrc1 = NULL;' G) `( l% m4 Q
  74. char *dmabufsrc2 = NULL;$ u* w8 g* r9 i9 ^% ~( f
  75. char *dmabufdest1 = NULL;
    - g% \+ B" }5 \$ p
  76. char *dmabufdest2 = NULL;7 r* d8 n+ c- @0 b' {4 e! r! z

  77. : Q& c3 {1 M3 B9 e3 t  {
  78. static int acnt = 512;
    , L# u" g; \; d* e! R% P& |& h
  79. static int bcnt = 8;! M: W! p( a9 s( r( j5 {6 c
  80. static int ccnt = 8;/ n4 k* S/ ?  h1 L! q
  81. 9 }. U  W( f9 }8 W& ]( M
  82. module_param(acnt, int, S_IRUGO);
    * b9 G6 G9 k/ l5 E- z
  83. module_param(bcnt, int, S_IRUGO);9 z" t2 Q$ v& C. `" X% W, W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 }/ e' `: R( m7 X- Q
4 B5 N* ^, H+ v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! O+ h5 |, @; v' d- F8 O' z' {
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ]/ y) D2 ^9 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ l" q% E& ?1 w# U* ?: W' Q+ ?

! E* {- k1 n0 b' |9 H0 j% [9 u9 I1 x/ M$ l9 X7 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 04:36 , Processed in 0.040108 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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