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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' C2 n, R3 ~9 E# K; G
  1. [code]EDMA sample test application* P4 z' }4 L4 U0 J6 [! I1 a- ~
  2. /*- w7 y7 I  z$ A1 ~
  3. * edma_test.c
    8 C6 g' ~  x3 P  a7 [# J  c5 x) G$ Y
  4. *
    ) H6 E1 a' q% M* n/ B
  5. * brief  EDMA3 Test Application
      Y1 I5 b/ {; Y# C+ F6 Z
  6. *3 |# C( T* y2 h; c+ _' I
  7. *   This file contains EDMA3 Test code.- H4 @( t6 Q% j- o5 E) q0 t$ g% g$ v% q
  8. *
    8 |. d/ M/ c, T$ b7 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & g" O" ?+ @9 r# J2 Y* T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . s7 @- v5 [' v% H4 \; \% s, m
  11. *         TO CHANGE.
    : a3 C. i6 b2 [. C2 o
  12. *6 V2 _8 e* H% `& a' D4 ^" t4 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # m2 `' c) d, ^4 o
  14. *
    + g! v( y% o7 d% x# y1 Q2 a% N
  15. * This program is free software; you can redistribute it and/or1 d% d0 u; Y0 S0 N  M4 B
  16. * modify it under the terms of the GNU General Public License as" T" A" d$ |8 h! d/ H
  17. * published by the Free Software Foundation version 2.& d# |5 H1 v0 y6 N5 _
  18. *0 S8 |& q2 S/ E! O' y; e2 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 t$ i/ \. F" z/ [5 A) X3 j6 `
  20. * kind, whether express or implied; without even the implied warranty6 z7 L5 o3 `/ ~( R' D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& I9 \, w% x3 o$ H  k. u
  22. * GNU General Public License for more details.( b" a" g8 Z0 N
  23. */
    / f2 O3 {* r+ h- U& y, s# w

  24. 4 k) l$ g8 y# B  I' n$ E+ O
  25. #include <linux/module.h>
    & N  @0 p$ e9 n, V: w
  26. #include <linux/init.h>) t( A) @8 [" D7 b( }4 I
  27. #include <linux/errno.h>
    1 S: B% ]5 A1 \: N* X# U  i5 _
  28. #include <linux/types.h>
    8 y, w% {, H; h! b+ b( Q0 E
  29. #include <linux/interrupt.h>' I# A, Z& h0 S* F- ^) C1 r# ~
  30. #include <asm/io.h>  Y& P, F: R1 \# B) o3 N
  31. #include <linux/moduleparam.h>  K/ l) Q& s( H) ~) O, [) L! t2 J
  32. #include <linux/sysctl.h>
    - u2 d: I6 s& ?
  33. #include <linux/mm.h>
    & B( R7 K6 B- l) t
  34. #include <linux/dma-mapping.h>
    - ?8 ~2 h( k' L- Y  A1 q) R! {7 a

  35. ) a! ]2 x8 T! K& T
  36. #include <mach/memory.h>9 F3 z" j8 v' H
  37. #include <mach/hardware.h>
    * `. _, Z: |" F$ V
  38. #include <mach/irqs.h>
    " ?2 r3 p/ a; Q! o5 V5 t# K
  39. #include <asm/hardware/edma.h>
    $ `+ M5 }% h7 ?- c  G
  40. 7 j: S' q7 Q' i- F. l
  41. #undef EDMA3_DEBUG# J/ ]9 l- P* B. u
  42. /*#define EDMA3_DEBUG*/
    % H5 f! _# y( f4 M/ R
  43. ) n' e/ k  C# ]* G0 t& c, k; r6 g6 q
  44. #ifdef EDMA3_DEBUG% W2 |4 G, L; x$ h8 f* v7 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! H& D+ O# w( a( |9 E% M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& _: v: ^& h  @4 K/ q% G$ C* M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      c# s% d  g; D0 V6 u- S# @2 m8 y6 q
  48. #else
    5 b/ j; A& V; _$ i+ z2 {0 ]
  49. #define DMA_PRINTK( x... )
    # _- a1 T$ T6 v
  50. #define DMA_FN_IN
    5 {2 l% V+ b! M  ?
  51. #define DMA_FN_OUT
      E: m& S& V3 ]4 e+ M0 z
  52. #endif1 j' {; I/ \- P6 B

  53. 6 M8 z; ]0 z8 J$ P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * v2 k$ C4 h# X, V. i3 u
  55. #define STATIC_SHIFT                3* x* I. g% f/ Q3 e, ]% x. M) R
  56. #define TCINTEN_SHIFT               20
      L+ }' p. N! }
  57. #define ITCINTEN_SHIFT              21/ I% a3 I4 v" o$ |- x, r$ d1 A- L
  58. #define TCCHEN_SHIFT                22
    8 ?) f% I" B, P, t! l" y5 C+ P
  59. #define ITCCHEN_SHIFT               23+ N6 |+ y% b) W0 r9 w. }& {

  60. 8 c4 {9 H  U! R! m% i
  61. static volatile int irqraised1 = 0;
    + w, ~5 ~; c$ W- E$ j
  62. static volatile int irqraised2 = 0;
    ) J/ ^5 }$ \* X8 O: P% r- [4 a; t: P
  63. ) f3 ~( f/ B- ^1 t1 ]& E1 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, z" j/ k4 d8 z# g0 }5 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & {" \0 a# D4 ?/ j, I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 r2 \; X3 Q) p0 L, G- A2 u
  67. ! l4 M" ]% o8 _7 B% Y
  68. dma_addr_t dmaphyssrc1 = 0;
      L. l+ G0 t1 h* I  H
  69. dma_addr_t dmaphyssrc2 = 0;: I; @$ {4 M% s8 q) F
  70. dma_addr_t dmaphysdest1 = 0;8 v, J' _5 n- b; N& e
  71. dma_addr_t dmaphysdest2 = 0;
    " Z  z+ ^# O% P5 F" k; G+ ]
  72. ! C) E) K# L% v) @
  73. char *dmabufsrc1 = NULL;
    3 c( g$ J2 v5 j9 k
  74. char *dmabufsrc2 = NULL;
    ' Q* |. [( e4 e+ q
  75. char *dmabufdest1 = NULL;
    7 H; z, }* t6 }- g# L
  76. char *dmabufdest2 = NULL;! \$ h/ g& L6 }) I' O- T2 l
  77. % ]  ^/ L4 F7 Y+ _1 k
  78. static int acnt = 512;
    $ x- L1 D! X5 M  {
  79. static int bcnt = 8;
    % K3 y  J( X' @) b: ~5 X/ A
  80. static int ccnt = 8;
    6 U2 u# K  f  t: O, I2 S* `
  81. ( @+ E* H+ M3 d  L3 X
  82. module_param(acnt, int, S_IRUGO);
    3 Q7 [: v6 O7 O2 X) L$ _2 [2 l1 ^
  83. module_param(bcnt, int, S_IRUGO);
    2 a+ t& s8 x$ F+ ^) M* ?9 R& `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# k, F* B( u: P" ?5 i
! G& e; W6 ^) X0 L& K; ~; P+ R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( J) F' [1 P/ {: Y6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: g% K! v! l, }8 H7 n. Q- `4 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  h/ f; b/ C* H6 _5 z% B' X
% @1 m! s! E* g' ~
, V) B% d1 d0 d$ n# B: Z; q# u9 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 21:07 , Processed in 0.038518 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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