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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 ]" u6 }, K+ D" D* h, ]! Q
  1. [code]EDMA sample test application
    , O9 K' a% g6 F) f0 B
  2. /*9 Q0 w0 e) M5 |0 X
  3. * edma_test.c
      N) u- Q. F. H/ Q' c' Z
  4. *
    - p% z  K7 k6 `$ }# g9 l
  5. * brief  EDMA3 Test Application1 P; J0 J$ `- ^8 I/ |
  6. *3 T$ O$ k' R$ I7 i* ^
  7. *   This file contains EDMA3 Test code.) d+ d* m& Z3 |: W. ]# K+ N' v
  8. *+ J! Z6 N: v, t) K" q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 r0 J; r: @( B/ [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : }; G/ |1 k  e/ G+ z
  11. *         TO CHANGE./ M: @4 p/ J4 q/ d3 k: z8 l) l' ]
  12. *3 P, V) g. f1 J5 w6 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 f5 l: f, h2 U5 U6 g( K9 ?* K
  14. *' g) L( d; N9 h
  15. * This program is free software; you can redistribute it and/or
    2 E7 U' {- P* g$ M* q$ u/ v
  16. * modify it under the terms of the GNU General Public License as
    8 @1 n, |# i* Y2 r$ i% j" i
  17. * published by the Free Software Foundation version 2.9 l' [8 n8 y  a. ~2 G/ K- `/ R1 I
  18. ** i" |% a4 E! m0 c. C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 @- q8 p1 y1 L* \( w
  20. * kind, whether express or implied; without even the implied warranty& l+ s4 Y& m/ {, ]8 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; [- _) \  G, x
  22. * GNU General Public License for more details.: u' h) e" @" S+ y% S  L+ `
  23. */2 d' Y* C: p8 B6 n3 t( J
  24. / t3 A0 L9 G; H  Q' T7 W
  25. #include <linux/module.h>
    + [& w, u) R# h' b* j
  26. #include <linux/init.h>
    : }) q) I9 }: R4 g0 b
  27. #include <linux/errno.h>
    0 _! d* K. I+ G4 f
  28. #include <linux/types.h>
    / f5 v+ L( z6 p$ \6 k+ Q7 E1 R
  29. #include <linux/interrupt.h>
    ( s/ |" ~  t/ X7 l  S. w
  30. #include <asm/io.h>+ p% i$ h! ^+ f. j
  31. #include <linux/moduleparam.h>" v6 }( [7 }% p( G
  32. #include <linux/sysctl.h>
    0 y- x* ~7 x/ _
  33. #include <linux/mm.h>
    7 k3 S% n1 _/ M% ]% U: r) E4 W7 g  X
  34. #include <linux/dma-mapping.h>
    " h* M( g, N  E+ v. r. O  W. B

  35. / h6 e# X* z, y4 V8 n9 V' f
  36. #include <mach/memory.h>
    3 s( X2 z5 P* G, p* c$ m* B
  37. #include <mach/hardware.h>
    3 T- v% ]7 O0 j# o" w
  38. #include <mach/irqs.h>
    * c% g2 W' r  g8 s# v5 c9 H
  39. #include <asm/hardware/edma.h>/ S. |6 n! q& f& G
  40. * {5 q' C5 U! F: P  T" @8 t: r
  41. #undef EDMA3_DEBUG! p+ L( u+ _8 k4 H3 n. R: v
  42. /*#define EDMA3_DEBUG*/
    % A8 l3 I. M; A4 f' c- W
  43. 1 Y, [! S' O1 @$ X/ a5 P( F. x. k
  44. #ifdef EDMA3_DEBUG7 s( U! ~) c' ^; z' r3 H! s6 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ r# `. j' g7 M$ e9 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 i; i: [9 v3 J0 L' Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 M8 X$ V1 @& @/ A
  48. #else
      |& v3 N8 f! V$ d9 c/ n
  49. #define DMA_PRINTK( x... )( p: j, I: J+ j6 j6 }0 T
  50. #define DMA_FN_IN7 ?, Z& Y* n5 t6 K5 X/ y
  51. #define DMA_FN_OUT/ K2 g  v8 Y; Z9 t% X6 H
  52. #endif
    6 R8 w  W  W4 \8 `& O  {
  53. . O! U: [2 }) r/ @4 Q" {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): o6 ~1 h6 U) h2 M' g4 S
  55. #define STATIC_SHIFT                3$ w. l$ [) d4 n0 k
  56. #define TCINTEN_SHIFT               20  M! i/ Q0 e+ u+ q
  57. #define ITCINTEN_SHIFT              21
    ( ~: D1 @, s( G
  58. #define TCCHEN_SHIFT                22
    ( i" P! |- E5 ~2 W( S, g
  59. #define ITCCHEN_SHIFT               23
    1 b, b0 z. \  Y
  60. * S1 x) Q- p4 H3 t: K2 e6 a
  61. static volatile int irqraised1 = 0;
    % v! j  b* k  G8 ?) m6 I9 P
  62. static volatile int irqraised2 = 0;/ D7 P4 \8 M3 n0 e( U" |' U# h/ N/ k  r
  63. 1 C) |8 o3 T$ [! I6 U' ~. ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( X$ g9 V  E) I1 @# h( E& J, m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j2 ]% Y' L& b) ?* ?; }$ W' l. ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]" P/ p- A3 n0 A4 ^& i2 i; Y$ o

  67. - V9 b) s3 U& H8 a4 I; p
  68. dma_addr_t dmaphyssrc1 = 0;, @$ L3 \% j# H+ }' L
  69. dma_addr_t dmaphyssrc2 = 0;9 M5 e: x, \3 [6 Z) a2 o2 M
  70. dma_addr_t dmaphysdest1 = 0;1 c- q; ~( ^! K+ q" d
  71. dma_addr_t dmaphysdest2 = 0;5 K& g3 b2 Y9 ]% j' M9 [" P

  72. ( F% U: |% C, m: K/ b& _
  73. char *dmabufsrc1 = NULL;3 A' d6 R8 N$ u! X* n: E5 p
  74. char *dmabufsrc2 = NULL;
    ( U3 e# ^: m6 M
  75. char *dmabufdest1 = NULL;$ b7 T7 i$ C& J; A7 y
  76. char *dmabufdest2 = NULL;
    " I1 u  f4 c7 }/ @

  77. - ^4 ^0 W: }3 j! D9 D
  78. static int acnt = 512;; p6 G" v% p+ W9 `5 m% N! D# Z
  79. static int bcnt = 8;
    ( ?0 ]6 e! J% _3 I1 G
  80. static int ccnt = 8;4 `/ C! `. Q) E8 _$ F: Z& m

  81. % w4 `* w& U- Y. M5 p
  82. module_param(acnt, int, S_IRUGO);
    3 L4 I9 V- V, g3 l/ a
  83. module_param(bcnt, int, S_IRUGO);
    $ N1 \8 O6 R7 N6 F3 G+ K5 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 L: ?3 ]7 B  H. E' H% h5 h# O3 _. F5 e( E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) q4 f* ]( L5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ^. T  ~7 q3 I7 D; c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! W$ m6 x& D2 H/ u- w% J. S

/ O' j0 G- e. Y2 q! z+ b3 K& D- v" v& j1 A+ U( V9 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-13 17:08 , Processed in 0.054776 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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