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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( J' G) X4 r- [3 `; M* V
  1. [code]EDMA sample test application. n, j# |& v! }0 r; j: R! m% G
  2. /*
    " d: J& J$ A- G* M( X
  3. * edma_test.c1 E% f3 D0 V/ _# }. v6 r/ v$ a! w
  4. *
    " K: o7 w. I1 {! E3 N9 E
  5. * brief  EDMA3 Test Application
    3 {& x9 F. X: u: O7 N! d$ w3 p4 p/ ~: M
  6. *
    / t+ D! ~! K& P7 c2 I  Q% K
  7. *   This file contains EDMA3 Test code.
    & Z% M- T# n0 E! u
  8. *
    . V/ ~1 L2 E  ?" T: y: }0 x8 n9 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / E/ s1 J/ F9 k( T2 j/ T3 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ ]$ s" h5 i) Z, V
  11. *         TO CHANGE.
    * l( _3 K  x: V, M/ T
  12. *
    2 u$ |4 d- @: O& a2 r$ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# ~4 S7 p9 L" `8 L/ b# J9 r
  14. *
    : |4 L4 j! ?6 a0 o' V
  15. * This program is free software; you can redistribute it and/or' y( F$ `% q* @2 o- ^. {! q" z
  16. * modify it under the terms of the GNU General Public License as2 w6 ^$ c! {! Z% x* x3 \* K
  17. * published by the Free Software Foundation version 2.. s0 K( g; p% M7 W, @; Z! o
  18. *
    $ P" t) Y7 e% s) q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! E9 U6 A5 q+ w- v9 R
  20. * kind, whether express or implied; without even the implied warranty
    2 q! A2 c# x% @* k: A' ~" b5 z! G4 B6 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- B5 u# T3 [7 n' X, J9 p
  22. * GNU General Public License for more details.7 c9 Z9 p& [+ d3 y
  23. */
    3 X# q9 R- q4 i1 N
  24.   B- t& _8 E) y( d$ P
  25. #include <linux/module.h>  j2 N3 W  g# R" g3 m
  26. #include <linux/init.h>
    ' e! q4 ~' Y/ h0 t9 ^
  27. #include <linux/errno.h>
    2 }( M9 j5 h5 J9 F9 ?. P$ t
  28. #include <linux/types.h>4 {2 A2 U7 M3 ]' B6 v
  29. #include <linux/interrupt.h>6 w6 _* V+ {) T; R' I# O: Q% K6 ^
  30. #include <asm/io.h>* I( D0 x% Q) R" K1 R' ?! r' E, b" x
  31. #include <linux/moduleparam.h>
    - k' z' b8 C  i* d5 K' I# A
  32. #include <linux/sysctl.h>
    6 G5 `( W7 K1 W1 Y8 r7 b6 \3 Q0 w5 R
  33. #include <linux/mm.h>5 Q" T8 {" c1 D( O; C! N! p" x
  34. #include <linux/dma-mapping.h>
    5 _; K+ W6 j& l7 H6 D! D

  35. : A; M  h" r5 z" D4 ^7 P4 f
  36. #include <mach/memory.h>& ~. l2 T( L4 N( \* _8 b, p
  37. #include <mach/hardware.h>
    7 J- `, }) |/ R7 U) K  }
  38. #include <mach/irqs.h>
      P7 y( ]1 }. a4 r; c9 [! x: e
  39. #include <asm/hardware/edma.h>1 Z4 j9 f9 q( o' P$ A6 {3 Y6 l1 [  D

  40. * v. ^) U5 E  L% g! ?
  41. #undef EDMA3_DEBUG9 N! W$ b! ]' P+ A0 J6 L& M8 H
  42. /*#define EDMA3_DEBUG*/
    ) `; n; I5 k, d

  43. 2 t9 ?! ~9 |& _' V0 r' y
  44. #ifdef EDMA3_DEBUG  y9 E1 Y6 q. ]8 c8 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! ^2 h9 K, V- _. y9 N* F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) x6 N. Y) u7 d1 X( `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & [' e9 W! m; `; K
  48. #else& A( B0 ]3 t5 z/ D+ D1 l4 H) q
  49. #define DMA_PRINTK( x... )
    . ~* t$ s  ?* k% S8 A4 x
  50. #define DMA_FN_IN
    4 U$ B0 z0 U/ |/ C5 n2 e
  51. #define DMA_FN_OUT
    7 b. b. s' |1 o  f) j6 G$ x) |6 p7 l- C
  52. #endif
    / a4 `$ s. Y2 X8 c

  53. ; p; ]& y' `$ O3 N+ Q# d* o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( r! Z9 B; K( `7 |; L& \
  55. #define STATIC_SHIFT                3
      q" N3 B7 f1 r% `; }: }! ?' ~  {
  56. #define TCINTEN_SHIFT               20' g2 [/ y) `! p: X4 ?$ i$ n4 N
  57. #define ITCINTEN_SHIFT              21
    % J2 M# ~2 n" a
  58. #define TCCHEN_SHIFT                22; \& `" ^3 h, v: J
  59. #define ITCCHEN_SHIFT               23% n3 B# z& Y+ D# B  q3 P

  60. : W- _3 M  z' d5 Q
  61. static volatile int irqraised1 = 0;
      U; c4 F2 S4 R$ t
  62. static volatile int irqraised2 = 0;
    ( g% E% w; X+ k* C

  63. # N6 k6 b" s5 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) X. f$ v! }5 W0 I1 d* i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# P) s) N9 o, q( t) k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k, [: x9 t5 T! D6 ^
  67. ; T4 _% y+ a2 v/ J7 I2 S7 ?" s# D. L) H
  68. dma_addr_t dmaphyssrc1 = 0;: `1 g8 a' W! ]- w4 m  M+ `! `
  69. dma_addr_t dmaphyssrc2 = 0;
      K) L$ a+ Z0 i3 m6 a- g
  70. dma_addr_t dmaphysdest1 = 0;# S3 u- D3 v: Z" m* G" G0 W( D' B& @
  71. dma_addr_t dmaphysdest2 = 0;3 i% a; S7 u# X1 M* Y/ T

  72. # ^* [7 n7 o- d' w; \& A: b" _
  73. char *dmabufsrc1 = NULL;" o  J2 f2 t  r
  74. char *dmabufsrc2 = NULL;
    ' _! u1 m+ `4 C/ Z  U- r
  75. char *dmabufdest1 = NULL;
    + z" l8 ]+ o! X* E. v
  76. char *dmabufdest2 = NULL;
    % [/ Z# h. {! q9 u  v9 {
  77. 6 r% G4 W9 `' g" w7 ^4 }6 Q$ @1 [
  78. static int acnt = 512;4 u- f, J8 D( i% x* Q! g
  79. static int bcnt = 8;
    2 w+ N: [! ^+ _4 @1 j. l" R
  80. static int ccnt = 8;4 T) _- m3 k% }6 ^* l' [, d

  81. 5 L) r3 Y- ~( B- _
  82. module_param(acnt, int, S_IRUGO);: [& u8 o2 c" q: l$ b
  83. module_param(bcnt, int, S_IRUGO);  o& _0 n3 v$ ^; Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: o" b+ Q' `& E9 r& h9 _1 Z% I) I) T* S9 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' \3 ]+ Y' {/ a6 W* `- K+ N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 H+ [% O* S  K* V& s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 P3 z  r, v0 N, J; Z
* ^, [: ?* k: h5 n8 j  c

' a0 c) ~7 h  u0 Y+ p( e9 c) e& e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 14:03 , Processed in 0.040761 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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