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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 o! M! j+ Y5 S
  1. [code]EDMA sample test application
    4 y, M& `  W+ c* C: o
  2. /*% G1 @# H# ^) S1 b, h
  3. * edma_test.c  w3 w& H6 k2 L4 i5 h8 q
  4. *
    ( T, ?+ Y4 U; m9 V3 ~
  5. * brief  EDMA3 Test Application
    - I4 v2 D& W- C$ ^1 M
  6. *
    " U2 H( n# r# Q4 r$ l( {# k: s8 d! a
  7. *   This file contains EDMA3 Test code.
    % Q$ ]" ]% \3 o9 L: z  e/ D  F7 j
  8. *
    ' ]2 j: q3 I9 M( W2 p; Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ~+ {. u) _7 c+ g6 t' n4 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Z# H. F: `0 N% s- `* K' M
  11. *         TO CHANGE.
    $ X) u' h( [" C' W
  12. *' s5 P+ s: h0 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * R1 ]. Z* \1 ]3 P1 g0 Q) ?, r, \
  14. *7 l) ?6 ?+ h) e% h$ |# ?
  15. * This program is free software; you can redistribute it and/or
    ( J) t3 J7 e+ j6 `/ S5 _4 ^
  16. * modify it under the terms of the GNU General Public License as
    ( j  c$ _& f& f6 v! `7 \: q' @
  17. * published by the Free Software Foundation version 2.
    % y# g5 A5 X3 f; H7 {
  18. *
    2 |% O  z5 m/ y, a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : f1 Q# P1 g! a
  20. * kind, whether express or implied; without even the implied warranty
    % I" l% f, |, V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  V. X+ ~) @$ M/ {' }* L$ s0 |
  22. * GNU General Public License for more details.8 R/ F0 u: I7 D
  23. */
    ' Z% A$ B9 ?9 K* @6 q4 ^
  24. 5 N) V3 W4 Z% \; G# B
  25. #include <linux/module.h>
    3 Q  n# f+ b$ \+ i; F
  26. #include <linux/init.h>0 v( }' t2 b+ M% U
  27. #include <linux/errno.h>
    : O  _) J, E) W7 l' O+ D8 K% N
  28. #include <linux/types.h>
    . F: a# c' N3 t$ z
  29. #include <linux/interrupt.h>' E! _. V, J8 D1 P' ^8 }
  30. #include <asm/io.h>' O# Q* Y! q3 j5 I, ~
  31. #include <linux/moduleparam.h>8 o" Y+ q: z) I3 K& m8 [* {8 H
  32. #include <linux/sysctl.h>
    ! w- P& G; H. M4 C+ M3 ?6 x+ W- E# m
  33. #include <linux/mm.h>& W+ g6 x' {* f  C0 M8 X
  34. #include <linux/dma-mapping.h>, w8 ]9 _1 S6 j- G% E" i' X7 g* N+ M
  35. 8 P, z: x/ M6 X( u$ X5 M" z
  36. #include <mach/memory.h>
    9 f$ v5 u0 C9 y
  37. #include <mach/hardware.h>; W' `8 E+ G4 \; n' i2 u
  38. #include <mach/irqs.h>
    4 ^5 `. X" |  \" {
  39. #include <asm/hardware/edma.h>0 k' D' G: n/ k6 q! v- q

  40.   I8 T3 O+ Z5 ]. o7 }
  41. #undef EDMA3_DEBUG1 m( k7 D4 s: _/ i$ |: g) X
  42. /*#define EDMA3_DEBUG*/
    - I! R4 c. d+ H, E1 t* r/ ~
  43. - {5 n  D0 Q4 J" A9 x1 P: _; o! `, y
  44. #ifdef EDMA3_DEBUG5 m( U9 f( @; K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & ^' a& `+ A1 f0 a. z+ q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 P( f# ^* S3 L+ r, ?% V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 m- d" ]0 P' D% |- c- G; d! L
  48. #else
    , ^* O6 e& k- i4 z2 @, k
  49. #define DMA_PRINTK( x... )9 Q* \) b% g# r- @8 O
  50. #define DMA_FN_IN
    / w5 C! P/ n* A% Y- ?. C
  51. #define DMA_FN_OUT* n2 g! p* K2 g- s+ f- D9 }5 G9 j
  52. #endif
    ; B5 O1 c8 i* B1 q  v

  53. , T( W0 J1 ]0 Q" Q% t3 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! N) M4 \/ s! g; e
  55. #define STATIC_SHIFT                3
    9 {, H) I8 |% W3 d
  56. #define TCINTEN_SHIFT               20
    ' f3 I: f+ Z* X8 ~$ y$ y
  57. #define ITCINTEN_SHIFT              21
    ( M8 g: h8 P4 r/ Y; B& `
  58. #define TCCHEN_SHIFT                22
    4 a1 u# z4 M/ B/ V% u( Y
  59. #define ITCCHEN_SHIFT               23
    " E/ D( p6 d9 z; t' X) w* i
  60. : ^( B1 w; ]2 X6 t& \( G; Y
  61. static volatile int irqraised1 = 0;" M  l/ L4 D0 [* v
  62. static volatile int irqraised2 = 0;* d' b, G# u/ U% `9 T
  63. - K$ @2 _6 O( W% g( i. P1 I4 O* Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ L; u: T8 }9 h9 _; Q' Q0 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 C. q% W) p1 W! u9 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* F4 I5 n$ e) k

  67. , w8 j. y  g0 j0 g2 F
  68. dma_addr_t dmaphyssrc1 = 0;
    * z. s/ ^# p% |) u  p
  69. dma_addr_t dmaphyssrc2 = 0;$ s& q8 j3 S5 _- J7 j
  70. dma_addr_t dmaphysdest1 = 0;
    $ v0 Y' M; F1 G: s
  71. dma_addr_t dmaphysdest2 = 0;
    + x* B+ @4 T* C
  72. . {3 B, r4 [' G6 ~/ G2 z
  73. char *dmabufsrc1 = NULL;
    * E# ?& f' H+ V! w. z+ L5 J% A6 S
  74. char *dmabufsrc2 = NULL;
    ( c7 E) ]" ^+ B; H5 M' H
  75. char *dmabufdest1 = NULL;
    1 w: m- @% p4 v
  76. char *dmabufdest2 = NULL;
      t: x( Q& p, N$ u" S

  77. 7 a9 w1 _' L4 A# I4 V$ t
  78. static int acnt = 512;$ m" ^, U8 k8 t/ [/ R9 ]& T. q
  79. static int bcnt = 8;
    5 I3 Q2 L+ S1 r+ P5 S* R" Q
  80. static int ccnt = 8;
    ( {! [- h+ k! }! O5 L# s, R; W

  81. 3 _! j, Y, x0 _/ _/ i% O" q+ u. Y
  82. module_param(acnt, int, S_IRUGO);. K  I8 c, ?/ [; q
  83. module_param(bcnt, int, S_IRUGO);
    ' `, x6 C" t7 R- T! |9 @, O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  w+ g' F8 ^7 x# p8 E
3 `/ t4 f( [' |% ?+ ?3 N6 B# }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  ~; j2 z) Z# @1 J+ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( q% P* s, N  N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 w9 ^$ X: I! i5 H( t, _+ ]

5 z1 i2 k( Z$ w7 _$ k
/ U5 G. d5 s4 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-8 03:07 , Processed in 0.041622 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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