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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 i3 O+ Q- b1 V  m' k* f2 a3 t1 a- q6 _
  1. [code]EDMA sample test application8 h% O+ F" B0 X3 B
  2. /*- u6 X  k% v! _( S
  3. * edma_test.c; P) r# ~8 K$ y0 x' S* p; q9 b
  4. *) H) V$ d' \: ^* `! d& o) F) \0 u6 |* _: E
  5. * brief  EDMA3 Test Application: x' [3 y8 w+ g) [( s
  6. *
    ( k0 N* M+ M& L) z& A! i  b, }
  7. *   This file contains EDMA3 Test code.
    5 S3 p* T$ U0 L% i$ x5 s( P: a
  8. *, Q, j& H. [% P$ H1 c: q3 w/ _; c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" w9 E# E9 N! D& G! ~6 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . ^. L7 f, m; f' V) f) w
  11. *         TO CHANGE.. ~& h7 U9 i5 b: u, z# l( Z
  12. *
    # K6 |7 ?  s! i8 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; U0 }6 Z: @6 u
  14. *
    , _& H. O+ ^+ X
  15. * This program is free software; you can redistribute it and/or
    : G& L$ _, s& {5 M. x9 d
  16. * modify it under the terms of the GNU General Public License as1 n. p1 E5 M! X& C- G! b$ s5 k; H
  17. * published by the Free Software Foundation version 2.
    $ t( J  ~( \: Y
  18. *
    ; {% t# n7 Y8 O( r# ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 a+ D  M( \8 b# W: E) Q/ ?& i2 [
  20. * kind, whether express or implied; without even the implied warranty1 {+ M8 u1 B+ Q& [& s1 I1 y. s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) g3 ^" N5 u& O( u) h
  22. * GNU General Public License for more details.' ]& S  f; `5 m0 H
  23. */  {! U7 W7 O# o1 F# Y8 ~

  24. 9 B* g( j7 G4 Q, A# D
  25. #include <linux/module.h>1 u2 J( h/ i0 Y$ }
  26. #include <linux/init.h># q$ H: c' `+ ^: ]% e
  27. #include <linux/errno.h>. s3 a6 f1 _6 T1 j! h2 e
  28. #include <linux/types.h>2 q0 ^- H$ o* l; Z6 M
  29. #include <linux/interrupt.h>7 P: _/ F+ s' `
  30. #include <asm/io.h>
    9 P! ]% L  Z* P( P& f0 Z
  31. #include <linux/moduleparam.h>
    3 N* ?  b- k7 e5 i* i* j
  32. #include <linux/sysctl.h>; e( V/ v( b5 t+ t
  33. #include <linux/mm.h>9 G$ X" }# P5 Y
  34. #include <linux/dma-mapping.h>
    8 M) R  |) I* F

  35. - x& g! ?  U) w4 R) m
  36. #include <mach/memory.h>7 i7 ^+ M3 L8 R) w  C3 d
  37. #include <mach/hardware.h>5 Y" E! R! f4 u' \9 _
  38. #include <mach/irqs.h>
    * W% `3 D2 }) w6 e
  39. #include <asm/hardware/edma.h>3 z' m0 ?, K( t& M! M, R
  40. 9 P  j( l8 e4 d( c( {
  41. #undef EDMA3_DEBUG1 e/ d0 k& B5 q6 H" R* W
  42. /*#define EDMA3_DEBUG*/
    , q1 }& T  O# j0 a/ a5 C
  43. 7 A- c' E  K: ^# a- I
  44. #ifdef EDMA3_DEBUG8 `9 j8 y) E# M  X4 a$ c. k% G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 J- T  G' [9 ^0 h. E- A9 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); [# T* y; t: r) u* |0 {5 J% l( G1 `4 P0 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 j! ~9 {# R) n* f/ {. G- a. u* g
  48. #else
    " c7 ]  S7 ^: s+ b0 Y( L# i
  49. #define DMA_PRINTK( x... )' u* O  K0 h$ U* C: ]- \) Q
  50. #define DMA_FN_IN* z4 `3 Y4 @8 f1 T
  51. #define DMA_FN_OUT, x5 @* a' A/ q( _+ ]' x
  52. #endif# i; j% w/ b4 }  y
  53. ' [6 s8 P) @6 E4 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ s% Y0 w8 X9 e' e
  55. #define STATIC_SHIFT                3
    , `; U9 Q8 c1 A, H
  56. #define TCINTEN_SHIFT               208 ]0 {5 G" l4 b* j6 G
  57. #define ITCINTEN_SHIFT              21
    & O! ]% g0 T. K
  58. #define TCCHEN_SHIFT                22
    ' l5 b/ E+ ^4 p! u# [% T' P: n' C' w
  59. #define ITCCHEN_SHIFT               230 d3 P) G* O" f; o# t2 R
  60. + J$ X2 y: V) r& m9 t, P& P
  61. static volatile int irqraised1 = 0;# l7 j% d( X* H8 A" j
  62. static volatile int irqraised2 = 0;
    3 h9 c6 `2 O3 `% I2 I
  63. 8 i/ w* A! O$ ^' e$ m9 M" K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) z; l+ H9 B( j& p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# Z. J  B8 T! w0 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & C2 W9 X& C/ a# Y
  67. 3 D5 [0 {& T1 A
  68. dma_addr_t dmaphyssrc1 = 0;1 ~- ?& j. e; K! @
  69. dma_addr_t dmaphyssrc2 = 0;
    , P6 d" @  f" r4 ~
  70. dma_addr_t dmaphysdest1 = 0;$ a$ ~/ T8 Z  z3 ]' |, b
  71. dma_addr_t dmaphysdest2 = 0;/ n1 g! ]5 F, Y/ X' i+ u  ]

  72. & `6 w" ^2 ^7 C- J0 p# H* o
  73. char *dmabufsrc1 = NULL;
      C4 m" m6 C: f& n/ k  K
  74. char *dmabufsrc2 = NULL;
    7 q# K! N( ?0 l8 R
  75. char *dmabufdest1 = NULL;
    . f) \( ?* J- l/ o
  76. char *dmabufdest2 = NULL;$ T$ T; {* V8 d

  77. " Z' b- f! B- R8 Y4 l
  78. static int acnt = 512;8 P+ h- [  v5 `, l* |$ A& E' s+ b1 C, Q
  79. static int bcnt = 8;
    2 q5 L. q" q5 G2 Z+ n' A
  80. static int ccnt = 8;8 B0 j0 h% T5 Q  G

  81. 8 A/ |: ?( `3 F- K& ^
  82. module_param(acnt, int, S_IRUGO);
    ) f7 W  Z, |- G: j* T
  83. module_param(bcnt, int, S_IRUGO);
    ) [) [4 |6 ?0 p: p! g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ a/ g6 d, Z4 |! d6 _- G9 H0 [. Y

8 |9 C! `6 Y5 e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" u4 f. o) n: r, W* F! }* U4 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 ~3 R) l5 ^8 Y. y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 g, r" Y" a) k+ Q  O8 n8 Q- ~" e. |! b# Y, F

7 G( r( S7 Y4 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 06:40 , Processed in 0.038422 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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