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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  V! g- [) r+ d7 `
  1. [code]EDMA sample test application! y& i- ]$ |2 z3 C2 j
  2. /*4 A9 N$ \- s7 T" k6 P
  3. * edma_test.c
    . D% B9 _3 x0 ~* _# S! [, W
  4. *3 J, \5 _! `0 Q$ Y
  5. * brief  EDMA3 Test Application
    9 s) m/ }' |0 m( d
  6. *# c. C# j6 O, P
  7. *   This file contains EDMA3 Test code.% k9 A7 q4 `' }5 K$ n
  8. *$ G" l" t4 g( Y  w2 f9 q) g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 h( G2 _. v6 k& D' H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " o1 j$ e: ?1 ~" X0 [
  11. *         TO CHANGE.
    $ }# v5 q  |1 r; e
  12. *; L9 x4 }7 @% ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, U7 K$ B! J" M( z+ W$ N; s4 E8 w( J; G
  14. *+ G2 w- ]( D# y- [
  15. * This program is free software; you can redistribute it and/or! ^  M! ]) C7 L4 P9 A6 X' M6 t0 y1 U
  16. * modify it under the terms of the GNU General Public License as) D" C- Z% ], c6 k, t" K4 D* `
  17. * published by the Free Software Foundation version 2.
    ) _9 D+ w/ h) \1 F& [: r' @
  18. *( |$ |' [7 p, s1 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% q- N, f8 |* `
  20. * kind, whether express or implied; without even the implied warranty( G9 I/ Q+ S* z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 d+ ~( a& Y) U% k9 r  ^
  22. * GNU General Public License for more details.1 J& h8 j4 G  D5 c! L$ O* f
  23. */, _, S" Z8 o( F3 _! `0 E# I
  24. $ y9 {3 I2 ]* E/ j& {
  25. #include <linux/module.h>$ t, t0 R& q3 d
  26. #include <linux/init.h>
    # o+ z: o. s- k& x. k
  27. #include <linux/errno.h>
    % Z1 c# Z6 ~2 `- c& k, l, }! D
  28. #include <linux/types.h>. v# S* i: f. X! j, u& a5 U! R
  29. #include <linux/interrupt.h>8 p! y# D- @! u
  30. #include <asm/io.h>5 L/ d1 o2 p4 j9 s
  31. #include <linux/moduleparam.h>; r" z* ?4 N7 b: T
  32. #include <linux/sysctl.h>$ H, K7 W+ e$ F- G2 @* q1 U. z  ~4 m3 }
  33. #include <linux/mm.h>
    : L, ~- Z8 @$ p1 ^) Q
  34. #include <linux/dma-mapping.h>
    " b5 _3 e3 D! _8 I$ i5 G

  35. ; ]$ w( n" M$ V9 z" r+ n- x
  36. #include <mach/memory.h>
    & x  m* U' u, e* R: N, ~- V5 V
  37. #include <mach/hardware.h>: V. R; [2 {# ~
  38. #include <mach/irqs.h>% |" X! a" F% E+ V, R
  39. #include <asm/hardware/edma.h>2 v# W& [$ ?& @' P! `2 C! h( Q
  40. ) Q6 k' `3 C+ p8 c. u4 V( `/ J
  41. #undef EDMA3_DEBUG! V3 c5 b$ `1 D, d6 K
  42. /*#define EDMA3_DEBUG*/8 Q! m: |8 ~7 q: X
  43. 9 j) y, q3 k9 l8 O; @1 b
  44. #ifdef EDMA3_DEBUG
    # s* m( |0 }6 h) G2 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' f$ p& F; M( V6 `% m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 V- C+ T* N" }1 \- |7 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' ]& M( i3 @7 e9 E. r+ s8 T0 M
  48. #else
    : T; w; t1 O- _; {: _- Q- B9 H
  49. #define DMA_PRINTK( x... )2 Z  P) g* ^/ D8 f
  50. #define DMA_FN_IN4 {$ }2 _$ t1 z2 d$ v
  51. #define DMA_FN_OUT
    ; d- k) T' Q) s
  52. #endif0 ]  S! L  B; Z4 k( X5 y

  53. ' O" h5 \1 `6 u4 h' N- f/ o- O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). u' O% d# X7 Y% l8 o
  55. #define STATIC_SHIFT                3& I6 L- k' m" r) v* R) C! C; N& f
  56. #define TCINTEN_SHIFT               20$ m& C4 w& ~. v" M4 r) W6 N6 ~3 I
  57. #define ITCINTEN_SHIFT              21
    ) ]0 _6 F  K! r5 V4 x* i
  58. #define TCCHEN_SHIFT                22* T% h' Q* m- E, A# M
  59. #define ITCCHEN_SHIFT               23) Q+ ~6 }3 y; ?- \
  60. 4 a4 w$ s9 H  {$ |- t
  61. static volatile int irqraised1 = 0;
    : b9 {, @. v" R0 [+ f
  62. static volatile int irqraised2 = 0;' `# x+ j* o, k+ ?7 ?+ `  ^
  63. : o/ Q7 K& f. f; E6 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Z+ f' t/ z/ ^. N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 m4 u7 l  y' X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- f% d8 B1 ]* t  S

  67. ( g: J1 \$ d: Q4 F
  68. dma_addr_t dmaphyssrc1 = 0;+ @* s" N# U. U' T
  69. dma_addr_t dmaphyssrc2 = 0;
    ; n9 Q( H) Z! X" f& j  V. I& F
  70. dma_addr_t dmaphysdest1 = 0;2 [* C. V. g" W5 k! L! z8 l5 [
  71. dma_addr_t dmaphysdest2 = 0;
    & _- d: Q$ Q! P. m7 c% U" I
  72. + `& N2 K+ Z* {; w" x8 V
  73. char *dmabufsrc1 = NULL;
    9 K! q5 Z+ ?( r/ l0 d1 U
  74. char *dmabufsrc2 = NULL;- C) W+ e/ R2 ?; D% M  e# h
  75. char *dmabufdest1 = NULL;) |: S' B/ @$ I. L- f, w  t* Z
  76. char *dmabufdest2 = NULL;# b- H# }2 v) `# I8 S6 d3 c

  77. 8 G& P4 H+ r' H
  78. static int acnt = 512;
    1 Y. ]9 D5 }4 c2 c; W2 m; R2 s/ X
  79. static int bcnt = 8;
    " ~  V7 p3 d( H1 q
  80. static int ccnt = 8;' z, E( a% x) s( A
  81. ( K6 h8 [9 O1 |7 l8 S
  82. module_param(acnt, int, S_IRUGO);
    & Z( w& X, a) T6 m1 ?. i
  83. module_param(bcnt, int, S_IRUGO);
    1 W$ z1 K3 k2 t0 E! L" Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 B% T1 ~( ]- T$ v% a" N

8 }+ m6 Q8 g$ U$ F4 q! t: \7 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 h! D; ^, H7 L0 F: D, u3 [  B8 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ ~, e9 g: P% v3 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 F, j  Q' X: t; [2 G/ J5 g2 p3 w0 E% _% [9 N$ Q8 M

% }9 N: x9 m. S& p8 }1 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 17:40 , Processed in 0.040280 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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