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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W: f$ M* S3 w+ _
  1. [code]EDMA sample test application
    5 C# m% u# T7 w7 ]( `: `8 P
  2. /*# A9 I2 S: o( U0 Z" N' w2 `$ _
  3. * edma_test.c
    % `4 e; \; W. G0 Z/ a5 t- @
  4. *' A$ d7 P2 _% ^- ^- N/ y
  5. * brief  EDMA3 Test Application; r; m1 h- |0 w7 d7 [4 f4 c
  6. *
    ( m. P# W3 ]9 \1 v3 E) G/ ]
  7. *   This file contains EDMA3 Test code.+ v# Y5 @$ ]! I! K
  8. *, ]  t! Y" O  }& j8 |( V/ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 m$ z: G; `5 u4 [6 ~7 t, W) ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. ~/ J8 p( f! H) S. V+ t
  11. *         TO CHANGE.7 f. A& Y2 A% m# Y$ O/ n2 `4 ?
  12. *& W9 b3 Z' F' @( b; L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % G; S, \7 U* O( D1 g; ~( @% I) n
  14. *& T$ c1 K+ ^5 E, ~; U& q: ~" y
  15. * This program is free software; you can redistribute it and/or) ^/ z: ]- S. S# }+ b9 _
  16. * modify it under the terms of the GNU General Public License as3 c% P! a: a- D+ a2 y3 u
  17. * published by the Free Software Foundation version 2.
    / v$ e7 x2 z; w  t
  18. *
    1 p& N1 R% r" ~0 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& h8 H! n- i# Q4 X8 V7 l- E5 V
  20. * kind, whether express or implied; without even the implied warranty' R0 C8 A6 m+ ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 V( m2 u( U: L3 q" A$ \
  22. * GNU General Public License for more details.
    , k. b* x; j* K8 L* m
  23. */' i7 x1 J2 P; z6 a7 B; i% w
  24. " }7 y( b4 E- R
  25. #include <linux/module.h>  U- {% F, @* Q. X7 k
  26. #include <linux/init.h>5 U8 T$ z$ d8 Z( ?+ e" z( W! t
  27. #include <linux/errno.h>+ V5 b3 o, W% X) m8 O" q
  28. #include <linux/types.h>' q; [- L1 r" w: S% ]
  29. #include <linux/interrupt.h>  l  V" C4 d  T' I
  30. #include <asm/io.h>$ P' B6 Y9 w% X4 G
  31. #include <linux/moduleparam.h>: h# E3 K* t) m" \9 C9 k3 Y
  32. #include <linux/sysctl.h>6 _9 \# k8 V! g% u
  33. #include <linux/mm.h>
    7 N: Y* |. K" Q' W/ e
  34. #include <linux/dma-mapping.h>; X/ @$ |. s/ p; i7 j
  35. ' d9 D( @! g0 n# v" U% v% U& ]  I
  36. #include <mach/memory.h>
    / c1 q4 ]' r$ a6 N) ]4 p+ P
  37. #include <mach/hardware.h>
    5 `. \; Z9 Z$ B) F) Z2 U
  38. #include <mach/irqs.h>
    1 u8 r) Q7 O* H
  39. #include <asm/hardware/edma.h>' c5 ~3 j, x- `5 |+ }

  40. . d; D0 |9 T  m! O( D. q4 {% ^* {
  41. #undef EDMA3_DEBUG
    / i( U3 j! E5 ^0 Y6 ]. ~" r7 x
  42. /*#define EDMA3_DEBUG*/. d0 S0 c( W  P' X# u, E9 I2 d

  43. 7 W+ n+ a1 N% Z$ [
  44. #ifdef EDMA3_DEBUG$ E* L% A' \2 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  E5 E! ]- ^1 \+ p- O/ |1 V- W6 K4 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& l- v0 i9 Q+ n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 V1 a6 t. D) N# I6 ^
  48. #else
    # G2 [) p& U1 {5 Y& j
  49. #define DMA_PRINTK( x... )( |( U  T6 g/ Z+ _
  50. #define DMA_FN_IN
    * Q4 K* v/ U1 x
  51. #define DMA_FN_OUT
    ; P- u6 }& v/ m! T# j# T
  52. #endif3 L( X3 u+ i5 i  K- {, e
  53. 2 M! J& P$ \* M8 E8 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 w4 W# u6 l; ~/ A* w, K* h( j
  55. #define STATIC_SHIFT                3, {. H9 A+ o8 f2 e" a0 Q0 t4 M( I
  56. #define TCINTEN_SHIFT               20
    ) u+ G, Z/ H  r3 m" l5 C; S. j
  57. #define ITCINTEN_SHIFT              21% {, Z8 J, `, i
  58. #define TCCHEN_SHIFT                22) E+ j$ v, q5 P2 X
  59. #define ITCCHEN_SHIFT               23
    6 t4 i# i2 C. Z/ T4 G8 s

  60. ( l2 ]2 F- S: t
  61. static volatile int irqraised1 = 0;2 J! M3 ~8 K9 j2 G
  62. static volatile int irqraised2 = 0;
    9 ?. t. m) `) u1 [! ?& [: `/ {

  63. 3 A6 h+ T  y. k$ v2 g2 ?/ W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* P/ g" s: z( [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - [0 v8 ~  J" X& i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + P- U7 G% j. \: Y" z! w4 P1 J0 S  A
  67. 5 N" [/ P: w' q$ t/ X
  68. dma_addr_t dmaphyssrc1 = 0;
    , ^! I4 ~8 t7 Q  O7 e
  69. dma_addr_t dmaphyssrc2 = 0;: f- e" x& N* q! s
  70. dma_addr_t dmaphysdest1 = 0;
    $ y& o1 l2 l+ y. W- d8 Y# Q
  71. dma_addr_t dmaphysdest2 = 0;
    % c$ c# [9 F+ D4 S- {; e: d
  72. # x  C8 H# m- C) l5 ^' U8 g* F
  73. char *dmabufsrc1 = NULL;8 d- D# T7 V1 j. o9 W  \7 ]1 n6 T% Q
  74. char *dmabufsrc2 = NULL;) D7 U- F: q. `" A$ w
  75. char *dmabufdest1 = NULL;
    7 A+ s9 a, C) n) [8 s
  76. char *dmabufdest2 = NULL;
      N0 v. l9 T/ B  X/ i" z: p. b

  77. . ^" c% Z* w4 @3 e/ ^: }
  78. static int acnt = 512;6 F; C; O7 t9 |+ F6 n  J5 z- @
  79. static int bcnt = 8;6 e) c- Y7 g, I  T6 u. A* N' f' A
  80. static int ccnt = 8;& R/ m+ Y8 X, x! M: n8 `) q
  81. 4 b5 @* {# q4 m  E" D
  82. module_param(acnt, int, S_IRUGO);
    0 v* A, T% n; l  Q9 ]
  83. module_param(bcnt, int, S_IRUGO);7 d& k3 `5 x2 v7 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( e/ L. Y" Z0 ?% t+ v) }, [
# P0 I& ~( K% P: k5 ?( \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% E# N) w& v) n# Earm-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 y! h' ]# D. Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' C4 g4 b. y. D- w3 j
* j/ }, N& J8 O3 P6 e) \/ d

. j, E3 [% }# c# B( K( i6 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 16:07 , Processed in 0.040269 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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