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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / c- S' I" W$ }, v
  1. [code]EDMA sample test application
    ! r( E, T- Q% }" [; k8 T" t
  2. /*) I2 F3 f: P) i0 C; |
  3. * edma_test.c
    % g7 B$ }  a' c/ p. w$ R9 v
  4. *
    + B$ i$ F0 n4 E, {* U' t
  5. * brief  EDMA3 Test Application0 t6 O$ ^6 Y& W8 f3 v5 q% P& G
  6. *' U7 n. Z+ w3 |" W" r
  7. *   This file contains EDMA3 Test code.
    % K5 \! D  l6 d; o8 B9 V* Y  F
  8. *
    , ?( `% J; O0 c0 D; _9 T% L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; P! M4 g' s0 l2 J% m5 `$ H9 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % {0 e7 J! r- c6 h, q5 t5 g' j
  11. *         TO CHANGE.9 u, f$ W0 P2 L) L1 Y
  12. *1 d0 `& ]+ r( [3 S* b4 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 l3 c4 e# l! c0 h6 s$ k) z
  14. *
    1 Z+ n! i( |0 z' X' l
  15. * This program is free software; you can redistribute it and/or
    5 F  m4 y9 F" o
  16. * modify it under the terms of the GNU General Public License as9 a: y  C; e* P. \, G, w# v
  17. * published by the Free Software Foundation version 2." Y. `/ Y6 @! s6 n: g
  18. *
    % S+ J6 X3 B& x5 H: M6 |4 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 I, D# ]& Q( h( l1 Z5 e( y4 F* @3 j0 K
  20. * kind, whether express or implied; without even the implied warranty+ E7 W3 e4 n$ e& P( ?  S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : K# G7 I4 L% u7 q) _
  22. * GNU General Public License for more details.
    ; |* l! _  y* J1 U* ?: Q
  23. */+ f( u; m9 ]) s; X6 x

  24. # v+ K9 {- N/ M
  25. #include <linux/module.h>
    # ^( I: }  l: n
  26. #include <linux/init.h>1 `7 I/ _/ m6 B- W5 y- d. H
  27. #include <linux/errno.h>, ^6 X7 s2 @, U7 F
  28. #include <linux/types.h>; g- |  a, S2 c& ?- g( Y: D
  29. #include <linux/interrupt.h>
    ( _; s) Q6 [- S% Q, @7 w8 X* g3 ?
  30. #include <asm/io.h>
    / L1 \+ l. p3 g- \( p- z1 A- A
  31. #include <linux/moduleparam.h>+ S& Q) J, Q# ?, h  o0 E7 F2 @
  32. #include <linux/sysctl.h>
    + k0 c! C4 ?' `" L$ ]
  33. #include <linux/mm.h>) U# @% x# k' G
  34. #include <linux/dma-mapping.h>
    : [! i$ Q8 u6 A. [$ R1 Z# G! ~

  35.   e4 c) W& B( V, l
  36. #include <mach/memory.h>
    ) e0 F, F+ J2 @, T
  37. #include <mach/hardware.h>
      a) p0 o! S" B( c
  38. #include <mach/irqs.h>: B. R6 s$ _! z" a% e, I" m
  39. #include <asm/hardware/edma.h>
    2 F6 z! D& G0 j' w( y

  40. 6 P6 H3 X' V3 [( v. g
  41. #undef EDMA3_DEBUG
    $ m* }+ B$ s6 {- L0 n, \+ C9 M$ v
  42. /*#define EDMA3_DEBUG*/0 i: W0 [0 d  D8 V1 @* f2 E: e& d

  43. : d. T5 R8 p' G, a) D5 [) s
  44. #ifdef EDMA3_DEBUG
    5 w5 H) x2 g) M- j1 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), x/ b' v: U# c; i, K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( S$ q9 B6 Q! E7 c9 g- Y% W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + a6 }' V( q; f1 `4 z
  48. #else2 _( ?- O4 s4 x
  49. #define DMA_PRINTK( x... )9 q& S6 N- p  |! {$ x% S$ }
  50. #define DMA_FN_IN( b  j; w$ |& o- e' M
  51. #define DMA_FN_OUT+ D. c( U" s2 `! B% X/ H# @1 |: e
  52. #endif
    3 V! `0 H" j, {

  53. 9 G2 c& W1 v' v  N' p  C7 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  M+ G+ f1 L* Q5 ~6 p+ X
  55. #define STATIC_SHIFT                3" @  g) P& ?9 Q- j. R* q
  56. #define TCINTEN_SHIFT               208 `7 G0 E2 v; u4 [& G$ X8 ?* |
  57. #define ITCINTEN_SHIFT              21
    ( D5 c; a/ Y. y, e# x8 P2 w/ k
  58. #define TCCHEN_SHIFT                22
    7 Y7 t# t, S3 T- K: W" a9 o: b. X. Z
  59. #define ITCCHEN_SHIFT               23
    8 P- n# x9 j, `( x' D0 @

  60. * Z: i3 L% u0 @. U! a( q# ?
  61. static volatile int irqraised1 = 0;
    / u0 C9 u$ X0 t7 g, Y
  62. static volatile int irqraised2 = 0;
    ; ~( b# s' j, I8 O+ v% `, }( R
  63. 3 Q  r$ w0 }8 q0 S! C: s$ e" ]0 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  g1 h9 b0 o  Y& m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / F# N( z4 E! [9 ]/ x* C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & Y6 b% f( f4 J3 e" o* K

  67. ) C- N( h# y1 u# r2 d$ d- k
  68. dma_addr_t dmaphyssrc1 = 0;
    0 K6 C9 K. h( P) Q) M- a. B, j7 L8 M
  69. dma_addr_t dmaphyssrc2 = 0;
    1 _2 }7 K5 K2 T% r
  70. dma_addr_t dmaphysdest1 = 0;' K; B% D, l' }3 H- A
  71. dma_addr_t dmaphysdest2 = 0;: ~2 l* m3 o8 s/ C  m& A

  72. ; u. q: D1 w, W
  73. char *dmabufsrc1 = NULL;) N/ {  g. e4 s3 G7 k! {% E
  74. char *dmabufsrc2 = NULL;2 a& g1 B* s- [7 S
  75. char *dmabufdest1 = NULL;
    4 p. C+ k! Z: R4 q7 |- z
  76. char *dmabufdest2 = NULL;/ y& N1 }# d  E5 l/ Z( m; {
  77. & h' ]" I) F3 n% \' N! G
  78. static int acnt = 512;* l' z! z, v/ W; V" E' F" V
  79. static int bcnt = 8;
    % Z* p3 V! ?/ f6 {# i% Q
  80. static int ccnt = 8;3 W+ d* ~# H( w, `

  81. ( n3 e* \9 a+ L5 h6 }
  82. module_param(acnt, int, S_IRUGO);
    4 w# m4 G9 R8 `1 P5 S" C
  83. module_param(bcnt, int, S_IRUGO);. H! Z5 J0 Q2 s) T, W' ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ w: c2 W9 K9 a/ Y2 J
; }6 u$ ?* L' }6 t/ B# M* s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# e- ]* ~7 }4 t8 s; v$ q% _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  Y0 O. @: L$ G7 G7 k5 ?; @# z/ {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 v' T0 M" O# d! _( V, H4 [" m4 h+ j' P4 p7 h! D" f5 V. R
$ _8 R' F7 ?: V) Y. S5 i% C% \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 21:08 , Processed in 0.037759 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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