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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - o# {- \0 k, D
  1. [code]EDMA sample test application
    ( h: {  z" C7 W7 D5 ~3 X1 A' T
  2. /*, J4 q9 S2 ~; ]+ w
  3. * edma_test.c9 e  T: V( V. g9 [6 }' z" A
  4. *
    ; u+ |1 h2 P) v" r& S! A# ?
  5. * brief  EDMA3 Test Application7 @: H7 b% M1 J( X
  6. *# {: u: ?! V# D) S
  7. *   This file contains EDMA3 Test code.7 G; w/ r8 g5 `, A1 T# u
  8. *
    8 t4 U0 k+ i5 N  i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 {8 [3 M6 t: k3 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  Z1 S( K' V+ ~. `3 P/ v
  11. *         TO CHANGE.
    1 v* l. M0 t8 f* j! P
  12. *: i' \& [8 Q3 C0 D% d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; R* M, b3 `! v2 U
  14. *: {# O/ G5 K( M" s+ Y
  15. * This program is free software; you can redistribute it and/or
    * r% k$ r' S4 O
  16. * modify it under the terms of the GNU General Public License as' U8 k1 l: f8 C  [' f5 Y; E
  17. * published by the Free Software Foundation version 2.
    . [0 C# f6 Y0 W% W
  18. *! U# ^" j0 R# [& D$ d+ |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 [- J. h* M" V  |7 _; m, c4 m
  20. * kind, whether express or implied; without even the implied warranty
    , I7 i8 X! U+ f4 j% M4 f5 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 M7 k; b+ d2 J  \- h0 D
  22. * GNU General Public License for more details.. R: E. I+ I" T# X
  23. */
    % w; N8 n. k) j/ h

  24. 3 n5 D, ]* l' F6 Z7 J
  25. #include <linux/module.h>
    % F  v7 G! [* K, o$ `
  26. #include <linux/init.h>
    & k* z, R1 z; Y5 t4 j
  27. #include <linux/errno.h>" W' J! R  Q: X
  28. #include <linux/types.h>4 o7 \* J9 W9 C6 u
  29. #include <linux/interrupt.h>
    2 v9 W. }8 |- W5 u
  30. #include <asm/io.h>
    , }$ w- W0 `4 U) U5 |7 z
  31. #include <linux/moduleparam.h>
    " @( v: D# ~) Y. c, b4 H
  32. #include <linux/sysctl.h>7 d$ s5 |% q5 b- o% `2 z3 b- S4 m8 E
  33. #include <linux/mm.h>; r( v2 t0 T3 y0 O) ~
  34. #include <linux/dma-mapping.h>
    3 j: r/ o1 u! f; a+ s6 Q1 V8 t

  35. . f0 \$ {) ~" n( w; I' t6 l
  36. #include <mach/memory.h>
    * Q4 ?) E) z6 ^- a
  37. #include <mach/hardware.h>4 r% y7 z0 f. T) Y
  38. #include <mach/irqs.h>
    + s1 G- ~; n6 i
  39. #include <asm/hardware/edma.h>6 }) W/ J8 }, M

  40. ' v" z) a0 d& [
  41. #undef EDMA3_DEBUG5 ^2 {0 C- X. D4 |
  42. /*#define EDMA3_DEBUG*/
    9 o& l  w. e" E
  43. $ e6 [6 v% u  \7 V
  44. #ifdef EDMA3_DEBUG
    8 m1 t$ T0 M; g2 X; Q4 o% Q9 n, T' `: \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): a+ c, V! u+ K% l3 ^0 I9 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . Z, _9 `; s! w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) l4 |0 v8 R/ `4 T3 {2 w1 w& z8 s2 U
  48. #else
    - B! v2 B. K  r1 [' m5 S
  49. #define DMA_PRINTK( x... )% M1 N/ }8 p1 ~
  50. #define DMA_FN_IN+ x# l" \! m" R/ p' \% y
  51. #define DMA_FN_OUT4 s; M6 u, c: R: Y/ e$ P
  52. #endif- z! t, W  f! R1 y+ K& L( h; S, k" ?7 \
  53. ; d" a& y+ J% n/ l  C6 v, r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " K* B7 t5 p, M  j% |9 f" w; ^
  55. #define STATIC_SHIFT                3
    1 w7 w* ~" [- A4 x* y2 X
  56. #define TCINTEN_SHIFT               20
    ' h4 H, B3 W) i" {2 b8 X
  57. #define ITCINTEN_SHIFT              21
    1 d7 W3 [8 t, U' t
  58. #define TCCHEN_SHIFT                22
    7 d: C% Z* q1 w" X5 O
  59. #define ITCCHEN_SHIFT               23
    : e- s1 O) X$ \, x

  60. 6 c  q; H+ J1 t0 B
  61. static volatile int irqraised1 = 0;
    . ~0 z9 w: O# }2 X# h) F
  62. static volatile int irqraised2 = 0;, U4 Z, a/ f# J' E

  63. ( f, Q4 B1 Y8 C9 r, F7 @0 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 V1 @) e" ~+ I- M9 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, F0 O. J% @4 v. V9 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 A; h% m4 L) W2 v. W( _9 E

  67. 6 p9 i  M# X: n: r- c/ ?
  68. dma_addr_t dmaphyssrc1 = 0;  g3 V8 p* ?2 i
  69. dma_addr_t dmaphyssrc2 = 0;
    9 T* D  Y9 y3 t. B, {
  70. dma_addr_t dmaphysdest1 = 0;
    8 e, F, }( J  T) J, o
  71. dma_addr_t dmaphysdest2 = 0;
    ) V7 ~5 r0 G. t# M% _! e
  72. : M4 J2 p  \( Y2 W6 I
  73. char *dmabufsrc1 = NULL;- i) w5 \0 s0 s3 L! S; `0 r
  74. char *dmabufsrc2 = NULL;, ?. y: D* Z2 G, I: j7 z: J
  75. char *dmabufdest1 = NULL;9 z( f! N1 y; K2 ]3 r9 X' l; `
  76. char *dmabufdest2 = NULL;. W- M9 t3 Z9 f+ S* L2 r
  77. " m5 f, L) w# J9 r# [( ^' r0 @9 ]3 m
  78. static int acnt = 512;% f2 f: |+ `5 p6 m0 L4 @! N. i
  79. static int bcnt = 8;
    9 _& y: e) m1 I) Y4 i) n! s$ h4 U
  80. static int ccnt = 8;
    3 O6 S: T! m' Y# U9 l4 c/ C
  81. & F# |1 z4 `$ N3 V
  82. module_param(acnt, int, S_IRUGO);
    % \1 x* w; ?0 v4 Y3 N! }
  83. module_param(bcnt, int, S_IRUGO);3 h. z" P! y) J- m6 j$ R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 ?- j+ p* W  h" Y' q3 F
$ S! ?- q- V8 G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 t6 k' G+ T5 g4 U6 \& q/ m) Oarm-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 }3 M! |. @4 r) b  o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 ^' e  ^) d" s5 l: Q  p2 @4 D

, i5 o1 n6 j( K0 q, b" j# J% [; f( g8 |, b; C8 q8 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-8 04:14 , Processed in 0.038349 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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