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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! K( g3 R( `2 i  p; d4 X/ |- U
  1. [code]EDMA sample test application6 J3 g9 D6 Q4 }% w3 j- Y
  2. /*
    ) C4 c, }9 J1 g  x9 Z: i- L
  3. * edma_test.c' v. J1 \' }4 Z# d% U$ h
  4. *; K% Y8 ]' n. X( X5 p6 [: S2 x( W
  5. * brief  EDMA3 Test Application
    # y; z1 o  r- s* g, v6 C; N9 \
  6. *
    / D% Z! {. ^8 e0 C
  7. *   This file contains EDMA3 Test code.
      f( |3 u" }( L8 B, q3 ^
  8. *
      e" Z" P7 Q: b5 E+ E2 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* F. ]6 B) d: e8 c7 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Z5 }1 c6 W4 W) A* [' I$ z
  11. *         TO CHANGE.
    3 D! Q. s7 \: G' T
  12. *
    ( V$ y7 c! X& V) G# h5 }9 I' L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; s; l7 ^0 X" a. p& j7 O2 r5 ?
  14. *
    ; i/ _- w8 d: X1 S* f/ J
  15. * This program is free software; you can redistribute it and/or! U0 T& E" v% w: q7 ~3 A: m
  16. * modify it under the terms of the GNU General Public License as
    : ~# B1 h- Z2 h, k
  17. * published by the Free Software Foundation version 2.5 [6 m" V6 f" }$ N) P. A
  18. *
    8 ~/ V4 d6 r0 n2 r8 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' j0 n* q, {" z; U
  20. * kind, whether express or implied; without even the implied warranty  m8 ~: o9 g7 f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& N: s+ d5 [7 Q
  22. * GNU General Public License for more details.! H0 s6 p9 d) @- Z/ d1 @
  23. */
    0 Q8 ]( V5 Z3 ^7 }
  24. ) m  f( ?- [$ L% w' _* ~4 d
  25. #include <linux/module.h>, Q( o( P* G2 q2 [7 v) }
  26. #include <linux/init.h>
    ) Z: N/ d( l3 f& J
  27. #include <linux/errno.h>
    + @- J9 e3 r, S; H; P' k! m
  28. #include <linux/types.h>
    " J( d# ~3 {9 _7 m4 g- a) _
  29. #include <linux/interrupt.h>* ^* q7 v' ~- b
  30. #include <asm/io.h>: h: e" S. \" \! o5 _+ ~
  31. #include <linux/moduleparam.h>
    ; b; K, X* S: L' d, \6 a/ x
  32. #include <linux/sysctl.h>  v4 ?, ?$ Y$ X) L$ {
  33. #include <linux/mm.h>, K- e# P- s' N- P. a1 z- y
  34. #include <linux/dma-mapping.h>0 ~+ _) \3 E) h* g4 @$ p. {7 r

  35. ) ]6 O% Z7 V7 U8 R4 t
  36. #include <mach/memory.h>  ~0 Z. E0 z. k, v, B5 Q5 v7 p- k  [
  37. #include <mach/hardware.h>
    # I" u; q4 B: b3 }
  38. #include <mach/irqs.h>+ I9 ^, p, C+ Y/ f. d3 W
  39. #include <asm/hardware/edma.h>
    2 O! Q8 S3 ^( O7 U* U/ L
  40. 9 L" R( O4 g4 _( \; E
  41. #undef EDMA3_DEBUG
    ' {6 n: T' {2 E) l, e& V7 B
  42. /*#define EDMA3_DEBUG*/; l" T9 {: v3 f# n4 E
  43. ! C# V: c& r8 @) s, J' t: m
  44. #ifdef EDMA3_DEBUG) E9 d% W& q( w7 R6 K. m- x: ?5 {9 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f( K8 F1 _- h! ^$ g0 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 k4 M% F+ @( x& k; L5 ]! F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ Y: |% Z8 O- x1 U5 q
  48. #else  k- G! y. g; V2 B- O0 ]/ P
  49. #define DMA_PRINTK( x... )
    $ L0 Q. a( f9 G; x! z
  50. #define DMA_FN_IN
    & H. c( e9 }4 ^1 a9 ~
  51. #define DMA_FN_OUT- Y, w! \9 X, o( \* G' w8 ~
  52. #endif% s! A) X$ \) \, ]* S" j
  53. $ l  H  ]: v" y+ k# g. n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 a, H0 l2 q0 U4 E0 r1 a
  55. #define STATIC_SHIFT                3
    + X$ Y7 W" L0 ]8 M! ~- J
  56. #define TCINTEN_SHIFT               209 W( P% n( k& S9 x" w  |
  57. #define ITCINTEN_SHIFT              218 U& n* Y- E, U
  58. #define TCCHEN_SHIFT                22$ L/ R" u9 h# z+ U) j
  59. #define ITCCHEN_SHIFT               23
      g3 I3 |1 c: r; V5 U! B2 S

  60.   P7 {0 ?2 O  ~
  61. static volatile int irqraised1 = 0;
    " t& \+ n; \5 d% m; p" K8 ~, w
  62. static volatile int irqraised2 = 0;5 x- y% M4 l& ]) [3 n- h4 {" w
  63. % _/ G: c7 c0 t$ ~. n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d9 p& f( V+ m4 R, \2 W8 G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . O$ ]5 T" [9 [* f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d3 X1 g5 E" O$ `

  67. : f5 k! H5 m* j5 h
  68. dma_addr_t dmaphyssrc1 = 0;' f/ j# A$ J' v) F6 u
  69. dma_addr_t dmaphyssrc2 = 0;7 T2 Q% O% A! T4 [! j# p
  70. dma_addr_t dmaphysdest1 = 0;
    6 @6 K' B2 Q$ L1 B8 m
  71. dma_addr_t dmaphysdest2 = 0;2 z1 Z2 N6 q9 W
  72. 2 \8 w: b& q9 ?4 ]" p
  73. char *dmabufsrc1 = NULL;
    0 T1 |, @; [. Y3 j1 a
  74. char *dmabufsrc2 = NULL;
    + k$ S" B( |' A0 W. u* k
  75. char *dmabufdest1 = NULL;& k7 B7 z+ R( ^0 v
  76. char *dmabufdest2 = NULL;6 Q0 n  t5 N# w$ S+ a' {
  77. % \2 F( O4 C7 P% M5 Y8 [/ y1 _
  78. static int acnt = 512;
    + h% b1 r/ \6 q
  79. static int bcnt = 8;5 V5 J; [+ o+ y, P) w1 p- L
  80. static int ccnt = 8;6 f4 }6 c# I" r+ X% c0 w; `# N* U
  81. 3 [3 D  C; X6 |  |. o
  82. module_param(acnt, int, S_IRUGO);
    : Y: q/ W6 H2 Z+ ?5 [
  83. module_param(bcnt, int, S_IRUGO);
    6 q* L8 h* P+ }* N$ z4 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- I/ v" O+ m$ R. k( t7 ?
, \8 N$ N6 h! H1 j  n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ V$ h3 B- a; b4 T$ \1 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 X  v% I( w( N& D9 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' t0 Z5 \- j/ N( y; U
+ a, V6 s, x; b3 X5 F1 Y# J3 Z2 B- q: L' x' Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 14:22 , Processed in 0.040594 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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