OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& u' j$ A8 O7 u) `. C  C
  1. [code]EDMA sample test application" f3 ~  z8 F$ O7 b! w3 [2 C' H
  2. /*  O' N* n8 i/ @7 C% @7 ]
  3. * edma_test.c7 N" N. P+ _1 Y9 H5 z0 u# K. }) h
  4. *
    * G) ~. R* G7 t* B0 f
  5. * brief  EDMA3 Test Application
    % K( [2 v6 I9 U
  6. *
    # g8 y6 u4 ]! |7 B
  7. *   This file contains EDMA3 Test code.! w! T( B3 S: h9 `1 V$ @& S
  8. *
    $ L3 ]9 r! A7 ?3 _6 d, t8 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, U5 N4 D' q9 v. i8 m4 ^% o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & N# |# z* V5 {: G) G# ^- |7 a
  11. *         TO CHANGE.
    / j  z( V4 m; V: d* ~5 e
  12. *0 e& v" Q2 ?3 Q1 j" T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! e8 b; ?0 z0 W7 ?. _
  14. *
    + A4 l4 `3 \  F" B. B
  15. * This program is free software; you can redistribute it and/or
    * z: B# l0 T4 w" s  d6 z
  16. * modify it under the terms of the GNU General Public License as% g; g( K+ A6 y; ~
  17. * published by the Free Software Foundation version 2.) K* q  v9 Z! {. ]. F; r; @
  18. *
    4 A+ f3 `8 u, t1 O1 ^8 |! j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( `" Z% W8 o8 a$ ~0 e
  20. * kind, whether express or implied; without even the implied warranty2 x* ]. J/ B8 W& e  E8 W9 k+ x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " v1 W  K* w) N; T5 G' p
  22. * GNU General Public License for more details.
    # z; m' v1 h/ ^2 P8 g% u
  23. */
    + H6 v3 H7 F  R

  24. 1 K& u) d; z4 Z+ l. [2 h
  25. #include <linux/module.h>
      `# J& m4 c& Z; F1 V+ y
  26. #include <linux/init.h>
    1 q2 I" P. Q' ]  K. T7 g( w
  27. #include <linux/errno.h>
    1 [0 D* @/ Z6 s3 Y4 e6 |
  28. #include <linux/types.h>6 p. r  ~9 O, F! v7 H) ]; b
  29. #include <linux/interrupt.h># `" |' W) d* V* H0 f* m" i5 J
  30. #include <asm/io.h>
    . @1 S8 a5 f! u; n0 Y, P/ }
  31. #include <linux/moduleparam.h>
    % C/ ^3 s5 E/ X9 i1 p! h7 X
  32. #include <linux/sysctl.h>
    5 M* q: _. X4 U" P! D
  33. #include <linux/mm.h>1 ^  W: K1 y6 {5 A
  34. #include <linux/dma-mapping.h>
    0 q1 Z6 g) Q! c
  35. ! P, B% o7 y+ L. P  k. t% S# V' _% q
  36. #include <mach/memory.h>* u5 g) l3 N% x6 b% w1 z
  37. #include <mach/hardware.h>) ?/ [# x4 M& w2 ^1 d
  38. #include <mach/irqs.h>
    1 D; |# v( i" l+ e
  39. #include <asm/hardware/edma.h>
    * Y. X5 T2 ?; U. k  e( S

  40. " q3 R4 j+ s3 u* D. A' N# L$ ]# x6 B
  41. #undef EDMA3_DEBUG
    5 S1 n+ [1 G* J! d
  42. /*#define EDMA3_DEBUG*/
    & a& J% {9 O5 i) C0 H8 {, `
  43. * e1 N3 N8 m# u  ]! X: i
  44. #ifdef EDMA3_DEBUG
    1 ~; p' ?! ~: N6 _  d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 y, q% l7 |2 O! U9 o' p. ~& y; Z, M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' A, }# A8 N2 c' ?. |1 T, g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( U) b1 m6 Z7 p( U- ]
  48. #else( w7 p1 e5 z$ G; ^
  49. #define DMA_PRINTK( x... )
      x& O/ C  f+ [/ m, f3 b: P
  50. #define DMA_FN_IN
    2 ^% I4 w# ~( m  l" R, M8 K# i
  51. #define DMA_FN_OUT
    3 I8 k& `# D& S; U1 `7 W: @5 Y) d
  52. #endif! M- a3 k4 z' z+ T$ P

  53. ; {7 v+ g0 n% ?. _1 G1 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 ?3 X+ n2 F) ~; W
  55. #define STATIC_SHIFT                3
    1 R) Y( |$ y8 Q! l) `) O
  56. #define TCINTEN_SHIFT               201 f& u/ e; K8 U) L# b  D7 t& }
  57. #define ITCINTEN_SHIFT              21
    3 D" U. P$ A0 H) g' n2 ?% i4 U; O
  58. #define TCCHEN_SHIFT                22- @9 n) d. I1 }) o$ N% @
  59. #define ITCCHEN_SHIFT               23
    $ x$ r3 l: a! V$ G/ H& S% K& W* d
  60. 6 l4 A9 V" l' w. \% ]
  61. static volatile int irqraised1 = 0;: |% B+ b' G9 f4 u$ m/ C! x
  62. static volatile int irqraised2 = 0;
    & h8 |" U2 ~4 {; {% ]% q( ?5 z/ H. m

  63. 1 S1 g: }6 j$ s; }; o* @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) s+ Y3 K+ e& J3 b" q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 O9 ?* }, }: L: P! w. @- n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. S3 c+ M2 g; E) M  R4 }
  67. ! k! B+ }. w' W
  68. dma_addr_t dmaphyssrc1 = 0;" }3 P: ]% t$ K) X2 ~. D
  69. dma_addr_t dmaphyssrc2 = 0;$ N0 X/ `) D6 S& k7 ~
  70. dma_addr_t dmaphysdest1 = 0;
    $ q- V$ H; x5 D- v5 m) }, Q9 }
  71. dma_addr_t dmaphysdest2 = 0;+ q4 ?) ~1 |+ i& i

  72. + P& Y# W3 l$ T' h1 `
  73. char *dmabufsrc1 = NULL;
    6 w' M# u8 K& ?4 C; i+ F  O$ T& j
  74. char *dmabufsrc2 = NULL;
    * o( e( v# ~4 x, m  @7 r" I
  75. char *dmabufdest1 = NULL;
    $ w; Q, f. D9 T, u+ I
  76. char *dmabufdest2 = NULL;
    1 Y4 |8 C8 N/ L5 X1 r5 C) w1 r
  77. . ~& R3 t/ j; @
  78. static int acnt = 512;% O, M3 W4 i9 O8 j* u6 l
  79. static int bcnt = 8;0 r* |! D# x4 i7 N! c( y# {
  80. static int ccnt = 8;& i, |! B1 c- I
  81. % }0 J& q, j' j9 b& S. ^1 L8 y. W
  82. module_param(acnt, int, S_IRUGO);( B9 X/ l- a: Y% z
  83. module_param(bcnt, int, S_IRUGO);8 O8 w7 P) T3 }( \! z6 W2 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 q3 t4 R9 G8 |3 [5 I. w3 t9 R7 P! p2 {9 z. @* @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. `, ^2 [5 }$ z& C, U+ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ^" n% T9 l6 j* ]% @1 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- w5 [$ Z9 E6 P8 I& z; s2 q/ ^2 j, t; Z( K) a* y) @

& K" X5 R9 m2 r7 z0 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 12:57 , Processed in 0.039258 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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