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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) p; i* u( K& Q: [* `
  1. [code]EDMA sample test application
    2 M. q% ?& o8 V% R( ~* B
  2. /*" _6 u& z6 X2 r- W: L: X, e* J6 N
  3. * edma_test.c
    , V! K: K+ H+ E; Y2 x
  4. *. V6 U; _; _0 f0 s4 }7 f
  5. * brief  EDMA3 Test Application
    0 ^/ U) b8 u& l! j, f( R
  6. *8 s% k( F0 M" ]
  7. *   This file contains EDMA3 Test code.8 i! Z$ c, O7 E6 W3 }; n
  8. *& \! l& l  s+ K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 c! w3 j* n3 I) N& c/ N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 e% P6 ?8 h3 h" A: v
  11. *         TO CHANGE.
    4 m! f+ y! P# U. T+ ^4 x
  12. *
    3 ^4 }0 t3 b( B; s+ i$ I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 h/ B! i& j$ |  p
  14. *
    ( z( |0 F# K1 d# z9 x
  15. * This program is free software; you can redistribute it and/or# ~& w8 N+ E& P  r6 X
  16. * modify it under the terms of the GNU General Public License as# L2 [3 J- n+ S0 @( T
  17. * published by the Free Software Foundation version 2.8 w- Z* I, K' W8 D
  18. *' D# \$ a2 @; Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 o, z; h. |9 x1 k4 O4 Q& S$ I  L2 }* n
  20. * kind, whether express or implied; without even the implied warranty
    : |1 X8 k- r& j7 I" Q8 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% x) {0 q5 g, `" `, m
  22. * GNU General Public License for more details.+ i( k0 j5 l" U& Y
  23. */8 Q9 c% g1 h9 p8 {; u$ H; h

  24.   c. v" k! L( G3 p; g, [6 P
  25. #include <linux/module.h>
    0 O1 w( r! T' C& B* n
  26. #include <linux/init.h>
    . c4 U" }$ V& i" q
  27. #include <linux/errno.h>+ a# d* Q2 ]: p$ q" e; P6 Y9 z% c5 u
  28. #include <linux/types.h>+ _5 R  D- L+ z, y% g( d* w
  29. #include <linux/interrupt.h>  s3 T$ C# a4 \4 t& F+ [4 n) J
  30. #include <asm/io.h>6 x, i& u! F: j3 T5 l
  31. #include <linux/moduleparam.h>! W" ]# Q( D3 ~$ y
  32. #include <linux/sysctl.h>
    4 b' U* E* A/ {( `7 j
  33. #include <linux/mm.h>8 x, d% U% C6 r& G
  34. #include <linux/dma-mapping.h>
    , C1 z" c7 Q1 B" u, W, B
  35. 5 z' L; P" m7 o# u" L1 i3 O5 R
  36. #include <mach/memory.h>$ g3 S5 q! O  k4 l" e6 i5 s
  37. #include <mach/hardware.h>3 E; B" K9 y" H4 s* i5 |
  38. #include <mach/irqs.h>
    - g# |! `9 z5 w
  39. #include <asm/hardware/edma.h>$ g6 B2 m% \7 c* W; w; N
  40. " H5 S( a  V2 f! [5 ~- `0 y
  41. #undef EDMA3_DEBUG
    3 U. p6 C9 w# t  e
  42. /*#define EDMA3_DEBUG*/
    # @$ t+ v' F5 M5 K- w2 I$ {

  43. ' ^9 o6 u" T6 U$ B
  44. #ifdef EDMA3_DEBUG
    ) v! L  V+ J1 s. `: R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): q2 E7 q- k5 [. r1 F, s+ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ]8 d% }, [4 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . j% i7 L3 `# |' M- z  U
  48. #else  {4 v+ n- ~3 z8 n
  49. #define DMA_PRINTK( x... )
    ) q  s$ Y& v9 j' n3 r* m! p6 ~
  50. #define DMA_FN_IN
    : Z( C( A) D7 w# S" ^- {* d5 x
  51. #define DMA_FN_OUT! j5 n' t0 {. T$ i7 f7 i
  52. #endif
    . i' l3 X, b4 i. U: u2 l( q( U" n8 ?

  53. 2 a! E! Y! g9 y! F. Q2 G+ e6 O9 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & y: q0 p3 @0 l" c. J
  55. #define STATIC_SHIFT                31 a6 o) i/ l( U
  56. #define TCINTEN_SHIFT               201 F1 n: b9 a2 l/ u6 H
  57. #define ITCINTEN_SHIFT              21. N$ c8 s/ D8 }; C) J
  58. #define TCCHEN_SHIFT                22
    . h) [/ p* z7 d1 d. O3 k
  59. #define ITCCHEN_SHIFT               23- s; j- E: \5 O
  60. 8 P% \/ p# i1 P+ L9 x
  61. static volatile int irqraised1 = 0;
    # H4 }. N. d- U
  62. static volatile int irqraised2 = 0;
    ) ?3 e' j: r' z4 {

  63. # ]/ V8 g- d3 n, I$ z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y( e$ `2 n+ P) |  d2 t6 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * s4 A0 N2 c% _6 v+ g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* c' u4 Y9 `6 F

  67. ) d) Y" F% t3 M. c& X
  68. dma_addr_t dmaphyssrc1 = 0;7 Z1 M  p2 ~% g: S
  69. dma_addr_t dmaphyssrc2 = 0;
    4 q6 H" [8 U0 q( |1 R
  70. dma_addr_t dmaphysdest1 = 0;
    6 x. i8 j7 M+ k
  71. dma_addr_t dmaphysdest2 = 0;
    8 a2 F4 ?( [+ \  R5 U' m4 o

  72. / [  H, f! V; x7 y! I7 u2 Z) v9 p
  73. char *dmabufsrc1 = NULL;/ T( F% @3 t, R4 O7 G
  74. char *dmabufsrc2 = NULL;' b& I6 n9 N: t# f
  75. char *dmabufdest1 = NULL;6 s* i3 t' E( h) ]
  76. char *dmabufdest2 = NULL;
    + `3 t2 ^8 ?4 ~2 e7 h

  77. " T; T( j0 j+ v. R
  78. static int acnt = 512;
    2 G+ ?8 R1 {* N/ E4 o+ E# t# |
  79. static int bcnt = 8;
    % q( n+ M3 l' F3 D9 I( j$ H
  80. static int ccnt = 8;& i& W5 e2 y  {) H

  81. : ?7 [' [4 l2 u
  82. module_param(acnt, int, S_IRUGO);8 q) g1 _7 V3 D: s
  83. module_param(bcnt, int, S_IRUGO);! ]9 K0 z+ e2 h) X) j7 d. x$ }. B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 _: W; v" b- @; c7 G

+ R  U+ [! W$ G7 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 E" \9 R1 T2 C7 u0 k; x4 r) v4 ]: u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ I3 k& @! d) r" o, B- C% b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, o- M2 e" ?; R) R& j& n* n
' _) x* h7 [& f6 J3 d. ~! X
6 B, Y' l, X8 i/ o/ Q  m5 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 12:34 , Processed in 0.039423 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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