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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & D: r# G" ]4 ?
  1. [code]EDMA sample test application
    6 r. A, c/ y3 q1 R6 h' F
  2. /*4 M- }& y' {5 c
  3. * edma_test.c
    % _% t# b" e) m5 S2 S$ ?$ p! M
  4. *4 P/ Z" a8 u3 a7 y
  5. * brief  EDMA3 Test Application5 |+ E% F# g7 C+ _. P2 x% W
  6. *' L' w2 X3 f1 E' o
  7. *   This file contains EDMA3 Test code.
    - x% y8 j* I# ^" M( |9 _
  8. *
    9 z) ^; m8 N1 A  T: L: q- z! g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + w& a* o% a0 w8 E* ]7 Z8 l' k  T) D* ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* x9 X- B) N3 ~2 Q& ]
  11. *         TO CHANGE.2 X9 F( `! v$ r# a) V3 M7 E
  12. *
    4 P8 e8 h; d2 L& A* U* o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" A% `' H% [& n& ~) a5 I! i1 C
  14. *
      p% {- o( y/ u! r- ^
  15. * This program is free software; you can redistribute it and/or
    * L: e' i7 g2 F! X% Z4 ]7 e9 \
  16. * modify it under the terms of the GNU General Public License as
    , n2 f- A+ y: ?! T! c
  17. * published by the Free Software Foundation version 2.
    ' g/ }: [8 u. o2 k% r6 k
  18. *
    % s: q# Q6 a8 l; f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% g: r9 [# ?7 S5 c
  20. * kind, whether express or implied; without even the implied warranty
    & L; `% a: m- r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ B# Z; p& t- X+ Y# g
  22. * GNU General Public License for more details.6 J7 h2 d& F5 u3 V
  23. */( H, d5 L& P$ T. g+ o: }' M
  24. # K: O9 ?/ {2 o8 F& w& x5 T  Y% u
  25. #include <linux/module.h>
    & \$ ?( V% Z* r! X; c: x
  26. #include <linux/init.h>3 b. M8 a9 a2 n* m  p+ B
  27. #include <linux/errno.h>* P1 Q8 X) L7 e. `. ~
  28. #include <linux/types.h>
    " f0 q( M+ p2 n
  29. #include <linux/interrupt.h>
    + ~4 \) ?" p4 a# G. y
  30. #include <asm/io.h>5 Z/ @. B0 c- \2 b
  31. #include <linux/moduleparam.h>
    : G% V( Y' \! ?, l' T- X2 {! g8 Q
  32. #include <linux/sysctl.h>
    " B/ ^' O0 K2 I; j9 t
  33. #include <linux/mm.h>
      m% M4 N/ r# k* q. n5 \
  34. #include <linux/dma-mapping.h>" I! n" {! n" ?  n7 D; T) F2 y7 k
  35. " ~& Z: k$ n5 j) b# C
  36. #include <mach/memory.h>
    1 N$ \+ H1 W$ ?/ M% h) h( D
  37. #include <mach/hardware.h>1 O2 z' b) C5 y. V/ B$ e; k" Y
  38. #include <mach/irqs.h>$ z( Z% K. P* |) h1 L
  39. #include <asm/hardware/edma.h>7 u# x1 ~9 S! A9 U8 I4 o% n/ e
  40. # e! U' P9 d' s/ T; ^5 z- |, o
  41. #undef EDMA3_DEBUG
    / z) q7 ^5 y" E$ g  y3 `
  42. /*#define EDMA3_DEBUG*/, q- j) Y5 h; u" J& C' X+ C

  43. $ @: e  @; @8 R8 _
  44. #ifdef EDMA3_DEBUG  p7 H" d8 ~- A1 f4 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - A) V! C0 {' b0 W4 w0 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! f# k! t. A2 R' R6 x5 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # Q, c- g" y- D5 Q7 b4 S
  48. #else$ b5 C2 G- _' f7 t' Q  b2 L
  49. #define DMA_PRINTK( x... )
    % I9 e% T; J1 B# Z0 P5 f6 H+ r9 T; g
  50. #define DMA_FN_IN
    * ?! r& @8 v3 s& a
  51. #define DMA_FN_OUT
    * K# J6 l1 V) _# ?( ?
  52. #endif/ s; D- `& F' s5 n5 t% z
  53. 0 w4 N+ G7 u9 x+ K. G; v( \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& I+ Y7 i6 h9 s) j3 T
  55. #define STATIC_SHIFT                3
    ) S, f+ U$ t! K0 ~' f8 p% ~
  56. #define TCINTEN_SHIFT               200 z3 e% f# T1 B9 _- g5 }- D
  57. #define ITCINTEN_SHIFT              21
    1 {' O2 W, U2 n' I# o% `; K
  58. #define TCCHEN_SHIFT                22
    ( J5 Y3 B0 P7 i/ b9 |4 e$ o
  59. #define ITCCHEN_SHIFT               233 L$ x1 N. W  O

  60. ! e9 f# ^  @1 }9 \- M+ M
  61. static volatile int irqraised1 = 0;
    7 b1 r* \: [5 _* X
  62. static volatile int irqraised2 = 0;+ J" R; _) h. [" j0 a0 {' \9 _/ c$ h
  63. . M0 V9 @$ P! p" p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ n# z* E" Z. ?2 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 G7 i4 B. C$ h8 `# w# U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" @% l" T0 Q; V8 G; @
  67. 8 H- n, Q2 {7 K0 R8 l/ Z& Z
  68. dma_addr_t dmaphyssrc1 = 0;; Z9 v" {& A, X4 p0 f' J+ ~% ^
  69. dma_addr_t dmaphyssrc2 = 0;
    , a' N9 F3 b5 M+ X# @
  70. dma_addr_t dmaphysdest1 = 0;6 a5 `$ f$ e# a+ J
  71. dma_addr_t dmaphysdest2 = 0;
    ! D. O+ _/ g% E; x6 s; U9 H
  72. $ {- _2 i* r% M4 ~2 U
  73. char *dmabufsrc1 = NULL;' `, R' c2 B- K0 L4 T$ _
  74. char *dmabufsrc2 = NULL;2 U/ u7 J/ |9 B: x% A2 l0 o( Q
  75. char *dmabufdest1 = NULL;
    3 y  p4 }& v4 y3 S
  76. char *dmabufdest2 = NULL;
    ; k, X+ d4 Z* D: L5 ~4 j; |5 y

  77. ' F% o9 Q* p; Q$ P+ q
  78. static int acnt = 512;
    ' i- F  f: Z( n' K3 S: ?* b. W
  79. static int bcnt = 8;5 b6 w( x# ]9 _* `
  80. static int ccnt = 8;1 `6 f7 c( u0 K5 d# r( f
  81. % B1 ~# C% V. B# Z4 f0 H/ w1 y
  82. module_param(acnt, int, S_IRUGO);
    9 G* T- T# L3 b% \5 \! s9 N- G0 K
  83. module_param(bcnt, int, S_IRUGO);
    ) ?* g+ ^  y# a7 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* O  U) J2 ?7 l$ n- g

7 I0 g+ \9 Z" F$ A7 Y2 g$ M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* x* M, L0 `1 t/ Darm-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 E- G$ O1 o4 {2 I
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: \3 N. U9 |+ L6 t
1 P* q1 ^: q7 A/ D* a6 h0 c% Q3 M+ `" P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 08:06 , Processed in 0.039788 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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