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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* E. J( T# R) F# i( n
  1. [code]EDMA sample test application
    : o0 D& i3 u# P, w6 K4 `& A5 Y( O
  2. /*$ e$ @0 N: M% T- f8 z
  3. * edma_test.c
    ) N/ C6 f, H" e
  4. *
    : ?2 P9 ?& u" r. i1 a/ M% ]2 d+ \
  5. * brief  EDMA3 Test Application* y9 V% f9 z, ^& E  R& c6 B( d- z& m
  6. *
    * ~4 s: z- \; ]" T4 h
  7. *   This file contains EDMA3 Test code.
    . t9 N# ~( z$ P: _" s8 _$ L
  8. *5 N& y+ ^# ^, q6 Y# u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 Q) ~# u; `% _8 ~2 [3 y+ d9 N) a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 @4 K( Z+ R& @' ^
  11. *         TO CHANGE.& ?( E" G+ p. K% k- Y. h2 ]) B* Y, ~( o
  12. *
    " a/ r6 u! v! Z3 i2 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 ~, b0 o' @, k! T8 p
  14. *
    + y: d0 [- w7 z: a
  15. * This program is free software; you can redistribute it and/or' Y1 ~5 {  e8 i2 f* ~' N
  16. * modify it under the terms of the GNU General Public License as
    + a* w; M( l7 B1 P( l+ j
  17. * published by the Free Software Foundation version 2.  O) w1 a% h5 F4 G( Y
  18. *1 ^' q. Y3 S$ ]4 l9 |* N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 k: b0 r& h7 y% Q
  20. * kind, whether express or implied; without even the implied warranty
    3 z3 E, f' y( w7 j' A6 t* ^* {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ v3 ~. x. r, E, H8 m- Q# l
  22. * GNU General Public License for more details.; e- O1 \8 g/ {. o9 ^; j1 U
  23. */
    2 h- I7 x* Q+ |$ g3 s

  24. ) a5 f6 M. F- g+ S7 M0 m
  25. #include <linux/module.h>6 L6 V1 V* A, W  r" z
  26. #include <linux/init.h>5 @/ E. u; l5 f( V* m' ]& x
  27. #include <linux/errno.h>+ d; v, I  M& r6 {
  28. #include <linux/types.h>" e) e' N4 C# I/ I
  29. #include <linux/interrupt.h>! f( m' R1 x5 D; E6 E
  30. #include <asm/io.h>- i  o4 V& B; t2 T4 f8 Y/ g' i
  31. #include <linux/moduleparam.h>
    2 `7 e; E: _4 z* j) P- S
  32. #include <linux/sysctl.h>, T. r. A. E& f1 H2 ~8 E; \
  33. #include <linux/mm.h>
    9 W! [4 s) T3 D- g
  34. #include <linux/dma-mapping.h>, h; q8 q; T& F4 h/ \6 C$ {! }+ v

  35. 0 x, O. M' v. F; g# Z  z
  36. #include <mach/memory.h>
    8 ?1 R3 @' s; D4 g! f" I, a
  37. #include <mach/hardware.h>/ M( T  X% r2 \+ b2 N7 \# ^
  38. #include <mach/irqs.h>5 s$ H( ^6 [3 }% n+ v1 m
  39. #include <asm/hardware/edma.h>
    0 c' H, Q0 B7 c* b, G' j

  40. 3 C" J3 J1 E" V0 i
  41. #undef EDMA3_DEBUG9 w2 ~3 c* d$ W" e% s/ T# o
  42. /*#define EDMA3_DEBUG*/
    . _1 r- f% N& ?& k& H- {* _; p
  43. 0 ^! ?9 v) f0 u" A3 N
  44. #ifdef EDMA3_DEBUG' ~1 s! A( v; N5 m: g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * A7 Z  E9 y' u' A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# z& M% l; ^( m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( a4 C# S5 Y# c+ q2 t( m1 L
  48. #else
    & y6 g# ~- f7 [* g4 S6 T) g2 ^  _
  49. #define DMA_PRINTK( x... )
    8 G- W0 Q* e% X! ~$ z' r
  50. #define DMA_FN_IN$ Z, V/ Y6 v$ D$ K) B+ i
  51. #define DMA_FN_OUT
    7 L6 Y4 f# V2 @4 I- g5 @% Q
  52. #endif' D8 Z+ _' d3 W+ v$ F# @

  53.   U' C6 r  ]1 F$ M8 `* u6 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 ~/ o. o8 y6 h4 G$ ?- \: _( m
  55. #define STATIC_SHIFT                3$ s6 E" U! \1 ?0 m  X
  56. #define TCINTEN_SHIFT               20( X/ k. q& x/ w* N8 m: b# T5 |
  57. #define ITCINTEN_SHIFT              21
    % u9 M0 q# r2 u: s% j
  58. #define TCCHEN_SHIFT                22! \6 g3 N4 M" h9 V  s% s
  59. #define ITCCHEN_SHIFT               23. M+ N7 h) z" ~8 u  e# d

  60. 9 m: y2 D* P  y
  61. static volatile int irqraised1 = 0;
    ; r" {/ T4 `( C3 g  z1 I
  62. static volatile int irqraised2 = 0;  R4 C5 \7 {- H* G5 p: G
  63. 8 Q2 B5 p+ g  K9 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! W* o, e0 X6 s/ W: D7 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # n7 ^8 i( b& T# H- Y  \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" F2 f0 B' m; H7 t0 D: l: b4 ^

  67. & Z/ R8 E, h. W, [9 W; Z8 }
  68. dma_addr_t dmaphyssrc1 = 0;9 q' @% I" U, M: v8 s1 r/ t3 s
  69. dma_addr_t dmaphyssrc2 = 0;; X  L' Q+ R* x7 |9 i5 _  K% V
  70. dma_addr_t dmaphysdest1 = 0;
    9 k: k- m% w$ Q. T$ u5 u
  71. dma_addr_t dmaphysdest2 = 0;
    ; M, F1 V$ ]$ U7 M# e: B: P
  72. ) x) E! ^" S9 F/ M. n: O4 J) h6 \
  73. char *dmabufsrc1 = NULL;
    8 O% _6 u  u( f
  74. char *dmabufsrc2 = NULL;
    - R' K2 B$ ?! S, _9 o& D! w2 h, W
  75. char *dmabufdest1 = NULL;
    & M' `7 u8 ^4 `4 L( H* f
  76. char *dmabufdest2 = NULL;' ]: f# I+ u9 {( h$ X% F
  77. " H4 ]+ c% W1 c7 @, x  t% y2 H- n: {
  78. static int acnt = 512;2 t9 R, f: [9 K/ U# |6 H
  79. static int bcnt = 8;5 b/ s* `- ]; _7 R
  80. static int ccnt = 8;
    1 A, Y6 \: E8 y

  81. $ o& W2 k0 c  |' k
  82. module_param(acnt, int, S_IRUGO);
    $ t2 Z4 f3 B% g4 Z7 ~& `8 b) r) E
  83. module_param(bcnt, int, S_IRUGO);3 J* K! M" c; O: A. T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 p& e; ^) L% U" l
; O; c+ A  o# ^( j3 f" v! Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 z: [" w5 n4 @( `) S: G& D) Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% q$ |( B7 N2 @4 B) g( T1 t4 u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 I6 B5 j" V' C$ W. r0 Q4 C3 D& e" O& h9 L% \
! w% K1 r  V; e! {; L0 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 01:07 , Processed in 0.091511 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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