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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 x1 o9 \2 T7 a: y
  1. [code]EDMA sample test application5 p% b% e2 G: M3 [+ ]+ L$ N+ Z0 a. t! c
  2. /*! C& i7 X0 ~" t3 B; M; G
  3. * edma_test.c! c, G4 M- l7 A& L. V6 l* I& m5 a
  4. *
    9 ?  n% K; K& D' m9 T
  5. * brief  EDMA3 Test Application% T$ n3 K! R' k
  6. *
    ' p" \6 [, H$ p: e, V
  7. *   This file contains EDMA3 Test code.
    % f. U! T) S) i3 |
  8. *" g0 l& R! @  O2 y2 G) e3 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# r% r5 {. O! G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 E" Z' U6 e+ B4 P7 P* R) \
  11. *         TO CHANGE.3 {' k& D6 @& U
  12. *
    2 a8 g6 q. O* H5 @9 J4 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ?, {- _% B0 ]; a
  14. *" a* c! i! U( f% w
  15. * This program is free software; you can redistribute it and/or
    5 ]6 F+ X: v- v8 Y1 d7 W
  16. * modify it under the terms of the GNU General Public License as' h9 [/ `$ D7 ]* S. A  `; [
  17. * published by the Free Software Foundation version 2.8 w+ i9 G% ~+ x1 l4 P
  18. *3 t# {2 ?3 G0 e, W+ K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / K& f1 D; X( R7 g5 Y
  20. * kind, whether express or implied; without even the implied warranty& J& m2 O+ h# O0 @% [5 Q1 p& a! {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 e4 {/ _7 Z8 U" W  g
  22. * GNU General Public License for more details.' E$ n/ c8 O/ u0 H- i. s0 [
  23. */5 W) a2 |! |- o, p% L" L: u

  24. ; [; d# @' L" B4 v& Q& @
  25. #include <linux/module.h>
    ; y) w9 b- w' A. y8 W+ p- H% a
  26. #include <linux/init.h>. p: e) S0 Q! H" `- s* p- P
  27. #include <linux/errno.h>. z$ ^" b2 C5 ~" Y7 R3 O
  28. #include <linux/types.h>
    ; f! g% t' m3 s4 w$ x
  29. #include <linux/interrupt.h># h8 D- ?; v/ B+ x1 h; g9 P
  30. #include <asm/io.h>
    9 }0 J5 I: C4 @3 U
  31. #include <linux/moduleparam.h>/ r% @' Z4 k/ X% y
  32. #include <linux/sysctl.h>. [9 I9 r/ }# D- Q: K3 n0 l# W
  33. #include <linux/mm.h>" L+ }3 V+ D; ]8 ~) W+ w" Z1 c3 l
  34. #include <linux/dma-mapping.h>' X. \3 F& z1 H( ?5 t7 r3 {# j
  35. & z: w$ }5 o1 G* u' }' d( y) l
  36. #include <mach/memory.h>0 T1 \1 h5 s9 D6 p$ q8 f
  37. #include <mach/hardware.h>, b! @1 N5 E1 T  r' K* W* Z# s/ X. k
  38. #include <mach/irqs.h>$ o& i- t3 D( `" J
  39. #include <asm/hardware/edma.h>
    1 T7 _. j8 q3 q9 m% n+ J9 m

  40. , f: o3 `% W, |
  41. #undef EDMA3_DEBUG
    : g0 Y( u- ?2 v
  42. /*#define EDMA3_DEBUG*/
    % H" B+ w, {) u; y# P8 ?

  43. 2 c" J6 |1 v' R& [5 k) _+ Q! z
  44. #ifdef EDMA3_DEBUG: C' N( j4 N) a, ?' E3 ?1 v& b" g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( s6 X; U7 [$ \: A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      Q4 k$ F) o* }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / W/ b  ^3 ~8 p$ L8 |3 c
  48. #else1 {+ y( D3 ?! M; {- T# K  L3 w
  49. #define DMA_PRINTK( x... )3 `! P+ y' o+ N! ^8 A: k& S/ @
  50. #define DMA_FN_IN
    : s8 O) y$ o) |& X
  51. #define DMA_FN_OUT
    ' L. {8 y* S. p  J6 A. C
  52. #endif
    - H7 X( L2 k1 y% K4 g0 M, `

  53. 0 }" Y0 [' ~: ~7 g: l! |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 ]/ z- [  `$ W. k  _
  55. #define STATIC_SHIFT                3
    , V3 `" ^7 C; o4 _; d
  56. #define TCINTEN_SHIFT               20( b. N& p& n9 o: ~
  57. #define ITCINTEN_SHIFT              21
    2 J% i% S5 e) W1 |+ Y
  58. #define TCCHEN_SHIFT                22
    0 q1 G. |- Q* t$ x$ x
  59. #define ITCCHEN_SHIFT               23
    5 l. g+ `9 M! @5 q7 ^

  60. , u# V* _3 N9 {
  61. static volatile int irqraised1 = 0;/ Z5 v% n2 X7 l0 i. w
  62. static volatile int irqraised2 = 0;) `' S: _  T6 ~" y

  63. ! j# u9 i/ C3 j$ j- z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ?  [3 I- l1 \2 E) C; E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ w! D0 t/ b+ b$ ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d3 t. }, [* G

  67. " u* G8 C  d) ^, Q" f2 c
  68. dma_addr_t dmaphyssrc1 = 0;7 s: j  f2 E# ]" z( j/ c. S: @
  69. dma_addr_t dmaphyssrc2 = 0;4 b& K" e% b9 Q& R- X( K
  70. dma_addr_t dmaphysdest1 = 0;- s% P- k! F9 i/ B. K, H! h, P
  71. dma_addr_t dmaphysdest2 = 0;
    7 Y; ?- @/ {, C+ ^
  72. " A) W. R- A1 T: |" J4 r& f; _
  73. char *dmabufsrc1 = NULL;
    & Y) Q. F1 I+ G, O1 J, W, G2 A- u
  74. char *dmabufsrc2 = NULL;
    % T0 z8 x1 c1 O7 n- \; x
  75. char *dmabufdest1 = NULL;
    7 ]6 ]5 x! r+ u/ B4 C
  76. char *dmabufdest2 = NULL;- E% T. s/ k2 {; B8 B

  77. 2 r; m9 ^! @: k8 S
  78. static int acnt = 512;1 h: o! W5 U* ]
  79. static int bcnt = 8;
    * j" ^3 E% q: s- u) I6 G
  80. static int ccnt = 8;6 z/ O7 Z: e# z9 H1 _

  81. 6 x! n, f1 b! i. N; V4 T" r# w9 J6 W
  82. module_param(acnt, int, S_IRUGO);) f- t/ |* Y4 h. B8 n0 {2 b
  83. module_param(bcnt, int, S_IRUGO);, j  R) U  d) [1 _, l- K5 F; X0 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ ^. d* e% L' U( Y8 c
" q- W6 y, D3 _. E* }- f' M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 n& e+ M- [$ karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ M" t, R" i, u1 I4 v' G# G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 w) h+ r% ~; c  z' @8 y
. a! n  Y0 v$ z  e1 F
5 ~1 B% H: K" o* d+ [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 14:17 , Processed in 0.039968 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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