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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, O% }* a! P1 h+ f8 T
  1. [code]EDMA sample test application" H+ A5 F7 s1 l7 l
  2. /*
    5 v' a! y4 {$ `3 y: y& D# m
  3. * edma_test.c3 o, ?  |; b7 A4 M4 h5 d
  4. *7 s2 l: X* }) W, H, ~$ k  ?3 a* n
  5. * brief  EDMA3 Test Application3 T1 l, o. [3 H8 A# @7 U- X
  6. *
    * L& y/ I: x  m# F7 _) H7 r
  7. *   This file contains EDMA3 Test code.
    ' }7 i, [/ o5 z" d6 d. v
  8. *- [3 q) `" U; m4 F; j6 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " G* Z. Q( l: |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 w5 N% W" }0 s5 i3 i. V7 P& E! O
  11. *         TO CHANGE.
    - t/ w4 j2 I1 h0 `' m
  12. *
    ; e! Z6 S& P4 |% y/ z5 F! o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 F8 g; E* V& v  [+ @! `  w" m: r
  14. */ s: A" @- e" X+ R
  15. * This program is free software; you can redistribute it and/or( K% G/ P% U7 L/ M
  16. * modify it under the terms of the GNU General Public License as& [! D( u, q1 b% e$ z; M
  17. * published by the Free Software Foundation version 2.
    : j2 Y( e5 f$ V7 H5 w
  18. *
    + i2 L2 \- j- o# B( r% K3 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & D$ T3 P! d* m) _2 v" j! |+ D1 g
  20. * kind, whether express or implied; without even the implied warranty# b/ a" W8 g. f- m! P" d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! g* m3 z( {- P0 Q
  22. * GNU General Public License for more details.; {3 d1 w* _! M3 E
  23. */
    1 v8 a7 ^) G0 {6 ~1 W" q* ?" b0 d/ s
  24.   ]1 ~2 `' f) a/ e) e" V
  25. #include <linux/module.h>
    1 d* n. @* v! M# K
  26. #include <linux/init.h>
    + x6 y4 v9 [+ ?
  27. #include <linux/errno.h>" s  ]* M3 F! k. |' V* [
  28. #include <linux/types.h>
    0 K0 m( b, e1 q# ~
  29. #include <linux/interrupt.h>
    " N, d9 v8 c. F% A% Y$ e: `# ?, l
  30. #include <asm/io.h>& y/ M7 J# v; n: {! D; L& i6 m
  31. #include <linux/moduleparam.h>) {* T! z" q$ W/ ]0 ?2 q" t
  32. #include <linux/sysctl.h>& v' y1 f; O* S
  33. #include <linux/mm.h>" ~+ E# r2 N$ [6 g
  34. #include <linux/dma-mapping.h>
    ) s& q. w/ y# H! K( f

  35. 0 n/ p4 ]$ }9 q; @  u9 }
  36. #include <mach/memory.h>  H2 q8 q! `( h$ M; z
  37. #include <mach/hardware.h>
    " p! s; H1 _4 e: `3 o' A
  38. #include <mach/irqs.h>
    ( V8 N! \- x* U; w
  39. #include <asm/hardware/edma.h>1 h. Z. G0 ?* g& q& \3 D
  40.   B- E' v- Y2 p, p
  41. #undef EDMA3_DEBUG  M9 q  M+ f( P! n4 C
  42. /*#define EDMA3_DEBUG*/
    ! \# a0 G6 C6 S. U

  43. " Y/ b& d& z$ ^$ n2 F* E
  44. #ifdef EDMA3_DEBUG
    4 u9 T9 {/ K, U5 J" f# L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - V% t! t: m, z5 C$ F! U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # _) t. ]1 N: W: ~5 ]% Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# n( I* _& q9 ]9 R( b* v
  48. #else+ I" j9 T3 L; y' h2 A& U; X+ ~3 B3 A
  49. #define DMA_PRINTK( x... )
    4 p" t% I/ j" w3 N% R
  50. #define DMA_FN_IN
    0 q" ^7 w  q0 U0 b
  51. #define DMA_FN_OUT- A; k2 n, J+ {3 j# H: V! j5 s
  52. #endif
    * R; o, _9 H8 @9 @  M+ p% M

  53. # s. F/ A3 ^7 M# ]  O4 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % @8 M$ V; w8 V1 ^0 p
  55. #define STATIC_SHIFT                3/ c5 ~  j7 @* _- j3 n7 E$ O
  56. #define TCINTEN_SHIFT               20
    " }( C) Y6 J( ^7 F1 W5 I
  57. #define ITCINTEN_SHIFT              219 A& h* q+ ~& z9 T7 t* _
  58. #define TCCHEN_SHIFT                228 _* B3 ^: e& i& f. Z1 w, l6 a# o9 X
  59. #define ITCCHEN_SHIFT               23
    ! W8 U* R6 {/ {

  60. % l+ P% |& z' r$ z; }5 }  f
  61. static volatile int irqraised1 = 0;& W/ `: l0 b. C
  62. static volatile int irqraised2 = 0;
    % I/ b! l. s- f- ]" T: {8 R, w
  63. # {& E3 k9 q) z& o" r. a6 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 u" K% [" X# q9 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & l; L$ {" Y$ n6 @6 S/ j0 }/ U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, J  |0 U) w3 \! i' R/ x
  67. , A/ N) y% u: m" A3 U3 [: T5 o
  68. dma_addr_t dmaphyssrc1 = 0;
    . j9 Q& Q; l3 X6 c
  69. dma_addr_t dmaphyssrc2 = 0;3 i8 ^6 \) v& i$ ^) {
  70. dma_addr_t dmaphysdest1 = 0;
    ) G- S$ R; C6 G. Q* L8 w5 [/ H" d# y
  71. dma_addr_t dmaphysdest2 = 0;
    9 I1 P" A4 x3 v) r) q8 Y
  72. $ l2 j2 p+ U- F* z! \
  73. char *dmabufsrc1 = NULL;
    / S6 r0 V/ U7 h) d7 Y% I( Z
  74. char *dmabufsrc2 = NULL;
    6 B+ F/ Z& G3 O; ?- A# D: F
  75. char *dmabufdest1 = NULL;
    * @) Q7 l& w* v& c- x! c  O
  76. char *dmabufdest2 = NULL;
    1 a% b% m% }* O
  77. 5 t9 }' C1 L" n, J' m
  78. static int acnt = 512;" N6 h: a7 U2 u5 ~: G
  79. static int bcnt = 8;: r7 s5 f5 X) ^: }+ X  @
  80. static int ccnt = 8;2 g" K, |3 s: f+ l  K3 n6 C

  81. , J& t  H$ O" ?* K
  82. module_param(acnt, int, S_IRUGO);
    5 B9 Y, n6 s6 ~, o9 [) Q
  83. module_param(bcnt, int, S_IRUGO);
    - M, D/ ?& v2 w4 m- Y0 }' A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 x" |- \! Y1 \5 K9 m* S$ o# W# n8 v' J# _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! S! j5 ^0 `% j4 {. }4 P; |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 a$ c# W! ], x- ?9 F- E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% Q1 N& \; ]6 z# o0 O
- s* A! N8 f+ F) _! \$ r3 w/ }, i- L6 J: Y  x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 23:35 , Processed in 0.038295 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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