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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   q! u* {- H$ s4 K# T2 _" S+ I
  1. [code]EDMA sample test application/ f) g4 C3 b' e7 D4 q: f
  2. /*$ f# ?: k" n; o7 n( B, O
  3. * edma_test.c4 S: n* u6 S3 O) A, K
  4. *
    + i8 @9 [5 _! h6 z6 v8 q( B
  5. * brief  EDMA3 Test Application
    & F6 A0 D4 k( B' o2 X' g1 ]
  6. *
    $ n% z6 g7 G1 e& \+ Z4 ?1 u( D  U
  7. *   This file contains EDMA3 Test code.( P4 [7 I) y  B5 V, u9 d
  8. *, F& [% F4 `8 a. T, y$ y% C9 Q' H, x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + L6 A% L% Y1 ]2 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : ^; k' C1 r! _' D, b) P3 @% }
  11. *         TO CHANGE.
    % e4 }% V* w0 f: Z6 K# I2 M
  12. *
    4 C8 P  D8 Z, Q, j$ {% L0 _: P+ b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / S# i9 X! {1 c$ D" Z) ]7 G5 ?
  14. *
    . g" J8 y: x. m) N" X
  15. * This program is free software; you can redistribute it and/or- d/ z9 h* [2 G7 l2 A
  16. * modify it under the terms of the GNU General Public License as
    5 `0 Q; e6 H4 _. w
  17. * published by the Free Software Foundation version 2.
    / \1 C- ~3 Z4 o* G" u  W
  18. *
    5 ~0 K3 k3 L0 \0 ?: X" c' J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 ^7 _1 X; m9 w0 }( l
  20. * kind, whether express or implied; without even the implied warranty) W+ u3 i  v/ ~* A& R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 s" s: ^* t7 `
  22. * GNU General Public License for more details.' U! C7 h: M) h
  23. */
    3 ]+ f% H, Q+ t6 `3 D2 x4 N9 Z6 |
  24. - p* j% t1 ~1 j2 W! s* x0 j: y
  25. #include <linux/module.h>+ Z+ P5 ]5 t7 h8 e( H
  26. #include <linux/init.h>- ~4 [7 P" J" `( g+ D
  27. #include <linux/errno.h>- J$ A$ J& y7 g* u) P3 y' D
  28. #include <linux/types.h>8 L3 I" S! E$ N4 X: p* [0 d
  29. #include <linux/interrupt.h>
    - f1 v3 y" w, e$ Y8 P' R1 S. c" x
  30. #include <asm/io.h>9 a3 p9 W; |: i
  31. #include <linux/moduleparam.h>
    / q' D& x- p2 \2 B$ Q$ t  q. {
  32. #include <linux/sysctl.h>
    $ w# h0 _% H+ [5 L4 Q: K% i
  33. #include <linux/mm.h>4 w% Y# n0 }/ V/ s  Z6 W( j2 t
  34. #include <linux/dma-mapping.h>6 q4 X8 U6 x5 i( C

  35. & `# p. ^5 X# a# p6 s+ d9 U
  36. #include <mach/memory.h>8 g# f0 I1 g0 U9 [
  37. #include <mach/hardware.h>. c; t1 A! h+ I+ A9 t
  38. #include <mach/irqs.h>
    8 g% ~: [3 ~3 G! {) n9 _+ o
  39. #include <asm/hardware/edma.h>" B1 Q; b1 y& b/ i) n, ?' f; P

  40. " o1 b. P6 v9 f: V8 {5 m
  41. #undef EDMA3_DEBUG
      r6 v7 G; B3 u9 ?# z5 B) j2 l
  42. /*#define EDMA3_DEBUG*/4 T% F  o3 [) o
  43. " O) u9 `' X; i. I1 ^, g  ]  ?  A
  44. #ifdef EDMA3_DEBUG. T4 R7 ~) ^# i; E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T2 Y/ ?5 n5 f7 ~. f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! I' x9 X1 Y2 l3 D+ V8 G0 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* p* I- B! d0 s5 ?' ~0 Y* c* X
  48. #else
    9 e2 q( \* V3 b9 k/ K$ R
  49. #define DMA_PRINTK( x... )1 n% Q9 d& k2 g& C, \
  50. #define DMA_FN_IN& N# y$ E1 G) s1 j! x: M. Z5 R
  51. #define DMA_FN_OUT
    2 a4 ?; o0 a( G. k
  52. #endif
    : P2 S- s4 S, [" V3 j3 Q* m: ^& T
  53. 5 S9 x1 B: `. [  H( B9 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 o6 d& L: K5 N3 {# ]
  55. #define STATIC_SHIFT                3
    5 D6 {3 U! i& W( a- K# W1 d7 p9 p' l
  56. #define TCINTEN_SHIFT               20) z9 @' x" {  ]5 t& L3 G
  57. #define ITCINTEN_SHIFT              21+ l2 y; b( B2 S% [
  58. #define TCCHEN_SHIFT                22& ~& r/ ]* Y' Q7 z0 ~, s6 j
  59. #define ITCCHEN_SHIFT               236 E- N6 x5 A' U6 |
  60. * f! F2 q' {7 m' N1 j& P
  61. static volatile int irqraised1 = 0;
    ! X7 N+ |  y( g( y' k7 e% K
  62. static volatile int irqraised2 = 0;
      u( e' S% i. @. W) f# ?7 v3 O

  63. 6 I% E1 [8 q  Q" a8 v6 A) U1 n. d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i& W/ x" A5 i  F: q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y8 U3 O. {3 q  X3 Q6 ~% B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: {% V% f, B( b0 U

  67. ) p2 a- Q: N7 n5 m- m2 i2 ^! I+ [# |
  68. dma_addr_t dmaphyssrc1 = 0;
    9 R4 @2 F" q! F+ E
  69. dma_addr_t dmaphyssrc2 = 0;
    4 Y5 K( ~/ ?7 o( y. ^4 L
  70. dma_addr_t dmaphysdest1 = 0;+ @6 i0 Q* P) @7 U: n/ S& P
  71. dma_addr_t dmaphysdest2 = 0;# a) b/ B, |; \1 ^7 `

  72. % ^, B8 b. q: T( c
  73. char *dmabufsrc1 = NULL;5 K8 ~5 ]" S% Z
  74. char *dmabufsrc2 = NULL;
    , w- X2 d8 }. H* N. s% k0 }' Y
  75. char *dmabufdest1 = NULL;* x/ ?. c1 }; p* v1 Z6 s0 c* w
  76. char *dmabufdest2 = NULL;
    & m( P; J! [& a0 ^

  77. ' K+ @0 W5 ]2 R/ M% B- D
  78. static int acnt = 512;3 K+ \" U3 k  }/ Q/ R
  79. static int bcnt = 8;1 r( v! q; _, z  U0 t' \
  80. static int ccnt = 8;& n* T. u( H5 f/ r/ e
  81. 9 o* x9 Y. X/ W
  82. module_param(acnt, int, S_IRUGO);
    4 m" T  Q5 N5 b2 A
  83. module_param(bcnt, int, S_IRUGO);9 b2 M+ I2 ^& R4 d% C% S: ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, }( a& u* }9 m! A/ j8 `" u, g- w1 a& U- I3 j* l4 z2 [8 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) i2 ~3 g* j4 y# [9 G6 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 k* o9 D3 V+ I, l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) c9 t0 o& S% s9 R

1 L; b' d( z5 i! C2 J# J+ o) J9 s, \6 |( ?; P+ r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 16:20 , Processed in 0.041155 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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