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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; u" F+ J; n- q2 W! A9 }5 r! X
  1. [code]EDMA sample test application
    ( B8 n1 X$ f2 s2 x6 h, y, @
  2. /*) X. L, E- z( t  Q
  3. * edma_test.c
    : x+ I7 p- u4 L( {! [& ?
  4. *1 K5 n8 f# }# E- \1 Z( N
  5. * brief  EDMA3 Test Application
    % o- T4 n# n* M+ w9 A) t
  6. *
    ) @) \4 H) E8 ]
  7. *   This file contains EDMA3 Test code.1 S7 u* R0 U! b+ v+ Y8 m6 w3 b
  8. *$ h- }$ T) R+ \8 v( C6 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * f8 |# z& @0 ^+ q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & ]! Z% d; S$ a
  11. *         TO CHANGE.
    . D( i$ o' w) n/ a# ~' f& J
  12. *, M" O, Y+ C$ v) F& D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Z5 F/ K1 u7 o, u2 J
  14. *
    - j- ~. {! Z1 y" y4 ]
  15. * This program is free software; you can redistribute it and/or* \* ?8 }6 W  C# I
  16. * modify it under the terms of the GNU General Public License as
    ' y' [5 y* m2 v# g5 b, L7 g
  17. * published by the Free Software Foundation version 2.+ n. B. X, l& G! w: i
  18. *
    . V# j4 h0 q( Y9 e- R; b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  g3 J9 ?& x0 ~. r# V( b
  20. * kind, whether express or implied; without even the implied warranty
    2 ?( S1 N5 q6 c/ i. ~2 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ O, Y. G- P0 F& p% o
  22. * GNU General Public License for more details.+ c* s2 N- z& i" H: |* H
  23. */$ @5 e, \. J3 p9 y& _

  24. : P9 ~# x) d& ?8 \
  25. #include <linux/module.h>
    3 w9 F( ?, P) ?) U3 G. I" G) W  D; y
  26. #include <linux/init.h>
    2 P1 ^) f9 q" U# E( L( |) a
  27. #include <linux/errno.h>+ Z, d: k; I  u5 X) N& ]# Q1 d
  28. #include <linux/types.h>; y: C+ W' @8 J) X4 i( c
  29. #include <linux/interrupt.h>
    * W! I0 `& v! E
  30. #include <asm/io.h>( f3 a, w- A* [% u: P8 I% L( ^# x
  31. #include <linux/moduleparam.h>% z. v8 h; W0 B( f4 t
  32. #include <linux/sysctl.h>) k0 L6 v0 z+ e0 W. P. H
  33. #include <linux/mm.h>+ r9 \/ O0 l6 S0 v2 ]8 z* w; i
  34. #include <linux/dma-mapping.h>
    $ P* z; K8 X, a' U( B! D* g/ Q
  35. $ h( s# o' O/ N( |  \
  36. #include <mach/memory.h>* R, j0 R0 e' }. u$ v$ ?
  37. #include <mach/hardware.h>1 l" ?' I! t" T: [# Y
  38. #include <mach/irqs.h>
    6 W$ c& l$ j% L2 S1 _4 F9 a7 k
  39. #include <asm/hardware/edma.h>
    4 d+ X8 u# _0 b* _; ~" W1 B/ j- T
  40. 6 |/ k. n/ H2 Q! a$ I$ Z/ G# [
  41. #undef EDMA3_DEBUG% I3 Z, i8 m- M2 |4 y
  42. /*#define EDMA3_DEBUG*/: t2 F8 o# ~1 L0 c7 ]

  43. 9 h) V3 T  T9 H. H0 ?% q: X8 @% t
  44. #ifdef EDMA3_DEBUG
    5 F! B4 l& N% h5 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / S. R" W  n6 M8 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 u$ i5 W- w8 {3 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( J$ o) U) M- b5 e
  48. #else. O4 n  ^# T; J
  49. #define DMA_PRINTK( x... )6 u% V% Q2 ~2 X4 o) O, B7 [
  50. #define DMA_FN_IN% j) d( u! x" P4 K3 p
  51. #define DMA_FN_OUT
    6 {0 s; M8 o5 h. |  l7 K
  52. #endif1 K, R+ f9 d9 k: V0 B3 V, D

  53. 2 {" I$ d; I! s+ \$ n0 O3 n+ r9 O$ r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ l( ~/ ?' v& N: w6 G/ Q9 Y
  55. #define STATIC_SHIFT                3
    " i. i4 x- \/ B, R/ s
  56. #define TCINTEN_SHIFT               207 t2 ]& S# L4 E. ~/ K+ F  ^; K) p# p
  57. #define ITCINTEN_SHIFT              21
    ' W' O( n1 W; x, S
  58. #define TCCHEN_SHIFT                22
    2 E- q5 x% M# B, U8 `/ R) R
  59. #define ITCCHEN_SHIFT               23
    ) L3 l0 M# d) P: E- ~

  60. ' s' x6 Y$ @! }0 a) V7 I( W9 d
  61. static volatile int irqraised1 = 0;: R1 B9 J4 n. r$ o! c: ?8 J
  62. static volatile int irqraised2 = 0;) }( H0 o8 J" Z9 r  a) K! t1 e

  63. ; [0 V+ ]( g4 K' m. U- @" o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. V7 S3 H. L% n0 y8 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # S8 Y$ E- z5 Z2 L/ K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" U0 t5 k- A1 D/ V2 R

  67. 3 Z- w/ z; A6 s+ y5 H+ O
  68. dma_addr_t dmaphyssrc1 = 0;
    2 J4 X6 V/ q/ L/ n" P! q
  69. dma_addr_t dmaphyssrc2 = 0;: h  Z# E+ p! t8 C1 j1 ~# ?% `
  70. dma_addr_t dmaphysdest1 = 0;
    : R2 S" K, @: b; R1 I! Y
  71. dma_addr_t dmaphysdest2 = 0;# G- D( C+ [  u
  72. $ `" L: ]8 x. M4 M4 l- ~% {  M, r
  73. char *dmabufsrc1 = NULL;
    2 f( k1 X- S4 O5 y) X, W$ p/ L6 A3 ~
  74. char *dmabufsrc2 = NULL;3 U' c7 c  a+ Q; D+ H
  75. char *dmabufdest1 = NULL;
    9 i& e! M0 G4 v+ l& C2 z0 b# k
  76. char *dmabufdest2 = NULL;2 @7 N7 G/ V$ I+ y

  77. & {( {2 K+ l& {
  78. static int acnt = 512;# n* a0 E/ W4 I; u0 A1 k
  79. static int bcnt = 8;8 l; g/ Y% r8 a# F. @
  80. static int ccnt = 8;2 ^. |; U9 F& B+ o6 N

  81. : G# o1 x+ U$ k- z0 ]% u3 W
  82. module_param(acnt, int, S_IRUGO);% Y6 q( Y- E+ x  |! e
  83. module_param(bcnt, int, S_IRUGO);
    / a% H' R. m0 }0 v' \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 p5 s+ V+ Y$ Y% ?7 X6 ^# B
% q8 \! |- H7 c1 k5 n$ P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! j: U+ j# O7 H4 y+ k  i. L" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ R3 j3 R$ A; j- ]$ p. @/ l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' F( d; w5 t+ S1 \7 t

) m4 D& ]8 r3 M& a5 |  C( q' ^' l  ~9 T/ I7 t* E4 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 17:26 , Processed in 0.044636 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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