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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - m' {; ~5 j/ {
  1. [code]EDMA sample test application
      G( O2 S# {9 X" t8 p& S* N4 m
  2. /*
    9 G) z  }. B* p; M" [' p) B8 T
  3. * edma_test.c( A1 O8 G. e& g5 ?9 p
  4. *5 W/ l; v3 j4 ?5 O4 d# _6 |
  5. * brief  EDMA3 Test Application
    & X, v  |# B2 C" w. h+ o8 }
  6. *
    # `  o8 `* p; k# K+ t0 H
  7. *   This file contains EDMA3 Test code.& L$ F! x8 G& F3 _
  8. *4 w' `  L) G7 l& G; o- Q2 @" T5 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 j9 `: U' ]- @* O  v( |* `. u3 B- d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 p6 Z& B2 Q+ e/ R. F/ W
  11. *         TO CHANGE.4 t& D7 [' k" X8 }0 w7 Y
  12. *
    6 e7 P3 N) S0 s) Q* f( ]5 h1 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' b7 R6 y* X& ?1 H" |  b4 x2 r* y
  14. *
    ; ~6 E3 k; M9 Z2 Q5 D3 @
  15. * This program is free software; you can redistribute it and/or
    + E* v! }3 y2 H2 a. R: m! p% x. G' s
  16. * modify it under the terms of the GNU General Public License as
    % I6 [9 x: E' S
  17. * published by the Free Software Foundation version 2.
    ) x( B7 r( g% Z' r0 H# B
  18. *
    4 ~5 N: _. @" _3 e  f0 _* R  z3 m# j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% R* t0 K9 ]+ z' P, m6 u1 U
  20. * kind, whether express or implied; without even the implied warranty$ X7 t# u  Z2 N% {5 t8 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( g+ m5 R; {/ c& _  K
  22. * GNU General Public License for more details.
    0 i% D8 I5 A/ ]* F$ W
  23. */
    - b2 c" ?+ ~) g$ ?. c, r
  24. ! `( r( `8 A4 e, D& I
  25. #include <linux/module.h>
    - |4 b, S3 t; p; P- {( i: k
  26. #include <linux/init.h>
    ' V( l2 W6 |' i0 z9 k3 Q
  27. #include <linux/errno.h>' N8 h% k0 h$ |% I$ a7 V% Z! ~# F; |
  28. #include <linux/types.h>
    % y. F  p- N) n0 N* q1 O3 y
  29. #include <linux/interrupt.h>
    ! r  h( z3 G& A2 `5 C" z
  30. #include <asm/io.h>" r) Y& g& s1 ?
  31. #include <linux/moduleparam.h>
    8 c$ g2 V, f: g* n) x
  32. #include <linux/sysctl.h>
    * N* J6 d: m, I
  33. #include <linux/mm.h>. j+ L& D9 X" }; S# n- p- t; Y- `
  34. #include <linux/dma-mapping.h>( o) Y* i& P; Q

  35. 6 o+ Y) t  p0 ?5 E4 s; }8 B% i
  36. #include <mach/memory.h>1 w; Q. I5 I# N# }" _0 L6 C
  37. #include <mach/hardware.h>6 e  t- |$ W: V" b" E% |
  38. #include <mach/irqs.h>) ]: B, H; P2 f
  39. #include <asm/hardware/edma.h>
    + H: o2 R  q9 s, H

  40. 9 z1 J+ W+ l' ]% J% j* _# f
  41. #undef EDMA3_DEBUG
    ; v3 ?+ M' d: z% t- `2 t
  42. /*#define EDMA3_DEBUG*/
    & t7 b% A5 }) x# ~+ b
  43. ' h. O* C, w0 H
  44. #ifdef EDMA3_DEBUG. M8 g" Q+ ^! c7 p% [+ n' y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 g/ I( ^: }  t* h: J* o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      O; a$ M* x( x7 R/ W( ]0 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - O4 x$ G- d7 f) n
  48. #else
    & T4 i' j1 [; }% g+ b! r) t& @
  49. #define DMA_PRINTK( x... )7 j% ^/ f" H& k/ n$ @4 c3 A
  50. #define DMA_FN_IN
    ; H* E- c5 r; X. e
  51. #define DMA_FN_OUT% u4 U' H3 l7 S, y
  52. #endif6 c" a  i0 y- \- |. {

  53. * O, b4 }, V" J5 |' z$ Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# e$ m( y) w" E0 B4 w) g2 Q
  55. #define STATIC_SHIFT                32 f7 i- j1 j; v
  56. #define TCINTEN_SHIFT               20: k$ Y/ y4 S8 C, S/ O
  57. #define ITCINTEN_SHIFT              21
    - k$ h, _; i; q9 \: K
  58. #define TCCHEN_SHIFT                22
    ( i% ?, i* }5 f5 Q5 q$ A
  59. #define ITCCHEN_SHIFT               23; M9 O: S) u1 S: A. ?  [/ [

  60. & T, d. h$ Y; ]
  61. static volatile int irqraised1 = 0;$ N5 a/ ?* j" z9 Y8 C+ U* R
  62. static volatile int irqraised2 = 0;
    & T8 |9 x: s8 f

  63. 0 b* j+ Y' Y9 d6 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, w  {, D! p: E- V5 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ D; j4 a) H( l5 Z) M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & U0 [! v& u+ M$ {, T/ M# [

  67. / \' ~! U2 t3 D6 f1 D0 s9 `
  68. dma_addr_t dmaphyssrc1 = 0;
    1 k9 @9 d$ H  i+ i) n
  69. dma_addr_t dmaphyssrc2 = 0;( Z" t& X& P6 `7 q
  70. dma_addr_t dmaphysdest1 = 0;& p$ N0 I% C; b8 H5 i) @. O1 J5 W, r
  71. dma_addr_t dmaphysdest2 = 0;" ~2 }' `- g0 w* f( \
  72. " i2 X0 e: w( c7 V
  73. char *dmabufsrc1 = NULL;
    4 ^% G( O3 a# p0 l+ \
  74. char *dmabufsrc2 = NULL;0 E9 k, Q- f# p/ [. L
  75. char *dmabufdest1 = NULL;
    # u0 C  n8 f# ~- M  l8 Q7 r
  76. char *dmabufdest2 = NULL;
    . S! v# S& V$ O' w7 e+ A

  77. - y4 J* }( a0 m' R  V, X
  78. static int acnt = 512;2 s/ L! C' j" `3 J& o/ D) l, N: L
  79. static int bcnt = 8;
    * {, v5 v" l: X  [2 {
  80. static int ccnt = 8;
    ( D: v$ H+ Z+ z! L; j- j" j4 y
  81. / C) d: Y# t( M9 R
  82. module_param(acnt, int, S_IRUGO);( |+ {3 V9 L5 J
  83. module_param(bcnt, int, S_IRUGO);8 `- s, `9 W7 E  U, `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  }/ v0 ]' x. G, D9 E6 J) q( M( _4 r/ [( c# |: r& d* i. }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 P1 M: j" F% m8 x4 Q/ S6 U4 {6 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" U4 ~$ O* o2 |0 {3 P7 z6 q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  \1 |+ F8 }. Y4 p
2 N/ z! t  a2 ?- K$ _) u' h  X6 f8 J% ?! F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 16:54 , Processed in 0.039069 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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