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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ?- X; f9 _% n7 u
  1. [code]EDMA sample test application' n: y; N( p$ o" {; W
  2. /*- E% I" K4 v" _+ T" M6 F  g  F" Z
  3. * edma_test.c
    0 }, A+ a. Y; d2 b8 C8 B+ L8 s
  4. *
    # D3 T4 F7 e. ?4 v9 M( r
  5. * brief  EDMA3 Test Application
    : C# b  S9 S- ^* l) V
  6. *  E2 {; F7 z/ g2 _
  7. *   This file contains EDMA3 Test code.+ B3 X4 ?8 g& I. Z
  8. *! \  l3 i+ ^0 r  M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 B2 z2 D0 q8 D+ i' H+ t+ `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 O) t! Q7 M" h8 l; ]" N/ G
  11. *         TO CHANGE.6 p8 c9 v2 M* w* Q) _
  12. *
      j! Z1 Q. ]1 b5 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ T0 E& q5 l- [1 z: [$ E
  14. *
    2 X/ {5 @, R: f
  15. * This program is free software; you can redistribute it and/or) s+ |/ O$ k9 {
  16. * modify it under the terms of the GNU General Public License as( D7 A* y- W; h
  17. * published by the Free Software Foundation version 2." O# y) `) S& }: V8 g
  18. *; d5 Z, j! ~# z9 P6 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ x* W5 p* b3 J
  20. * kind, whether express or implied; without even the implied warranty( ~- C5 p: @: H, f' P( Q8 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 v* U. X  u' y- t, ]) ~
  22. * GNU General Public License for more details.
    1 L& L; @# s! N( }' J
  23. */
    7 G  y* k$ o' i) z! G0 ^
  24. 3 m" Q) L% H7 I: ^1 c% n4 r6 `% F
  25. #include <linux/module.h>
    6 v& b) t2 F9 p' {1 H; O  Q* M, x
  26. #include <linux/init.h>
    " W  O' [. l) S$ g# l
  27. #include <linux/errno.h>
    # ?1 A3 Y6 l& Q4 f# M
  28. #include <linux/types.h>
    + Z2 D7 R+ c4 Q3 k3 W% |
  29. #include <linux/interrupt.h>/ X( U; k6 I7 d6 V  z, X2 p+ ^
  30. #include <asm/io.h>
    / W8 H. Z! V) I7 W
  31. #include <linux/moduleparam.h>* b9 P- C2 m0 L) ?$ k# F, h
  32. #include <linux/sysctl.h>
    % I; G1 A, P8 J( }: r1 Q
  33. #include <linux/mm.h>
    , M6 t' a  }, i+ s2 G; o
  34. #include <linux/dma-mapping.h>
    7 @' U9 J: ^# n8 M6 C5 s+ `

  35. * i/ Z! n' M5 m- H: O7 w; G
  36. #include <mach/memory.h>
    1 `- o+ e3 O7 L: |7 a+ s
  37. #include <mach/hardware.h>- j. f7 Z' _5 `: ?* a  A
  38. #include <mach/irqs.h>0 s+ l. L! W& `- ~, A. W9 w+ K
  39. #include <asm/hardware/edma.h>2 h* r" T2 [1 M1 H1 Q. X2 `2 H

  40. ; j8 a" d  Y( b+ `' u
  41. #undef EDMA3_DEBUG7 Y1 I6 @, C+ }2 e! H5 W
  42. /*#define EDMA3_DEBUG*/5 y# @. [% o7 X- @9 {

  43. , e; J) f* R" F5 g! S
  44. #ifdef EDMA3_DEBUG
    9 ^6 |  T: \; o3 x. y. ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 i* X8 n+ v- p$ Z  c6 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 ^5 [. t( I3 h; {, Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . D" q0 K( P+ q
  48. #else
    2 U3 Y. _" D- p' `& Y
  49. #define DMA_PRINTK( x... )
    4 c: c" x0 ]) Z  K3 r
  50. #define DMA_FN_IN3 p6 B, \0 @5 C
  51. #define DMA_FN_OUT: V. |* y) ]: g; L- x
  52. #endif
    ( E8 f3 a6 Q( G) N6 [
  53. / }$ S& n- H! Z! e7 b& i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 |: L8 P6 N6 F& e, U
  55. #define STATIC_SHIFT                3
    % n9 Q  |) l3 r2 h  N/ _
  56. #define TCINTEN_SHIFT               20
    9 \# X1 }1 ?+ X
  57. #define ITCINTEN_SHIFT              21
    5 ?% c! x- }# {2 Z
  58. #define TCCHEN_SHIFT                22
    ! N* W2 F: k* y0 E
  59. #define ITCCHEN_SHIFT               23% T  B# M% N- a; `# H4 W, E5 T3 Z
  60. : @" a9 J# K- d9 _+ `' |* c& G1 x% D
  61. static volatile int irqraised1 = 0;
    9 j/ G. G; y& X4 s5 r
  62. static volatile int irqraised2 = 0;5 C7 C6 i* M7 ]2 _, @
  63. - q5 R) M2 x6 x# f" R6 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / i* c; ^, P8 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  e: G, k2 K5 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( P$ P7 f2 K& n* \/ p: ~# U
  67. 6 ?8 ^$ q( s% @- z5 \2 ^0 ^  {
  68. dma_addr_t dmaphyssrc1 = 0;/ ?$ t: }) t. R7 j8 ]- A9 I8 C5 e
  69. dma_addr_t dmaphyssrc2 = 0;5 B) B; m5 F/ |& p4 q
  70. dma_addr_t dmaphysdest1 = 0;# p" l6 U% n! X; I6 B& |) ~& F
  71. dma_addr_t dmaphysdest2 = 0;9 r0 G, k/ O. s: {1 }

  72. 8 C: C% [3 B& B0 I/ d
  73. char *dmabufsrc1 = NULL;. l3 r) j; L1 b0 W. v
  74. char *dmabufsrc2 = NULL;
    " l9 h" l- |' M% d" X4 N. Z* G- H3 c
  75. char *dmabufdest1 = NULL;' L: f& [) k7 y0 b
  76. char *dmabufdest2 = NULL;4 r' y/ M( n9 M5 a9 T* w0 }* U6 D
  77.   v1 }) q& O. i" k) j
  78. static int acnt = 512;" C2 G8 t4 I' n  {" i+ g) \. x3 L
  79. static int bcnt = 8;
    $ z1 [6 y8 J2 Y5 B" Y' J
  80. static int ccnt = 8;
    ; R1 _! j$ Q0 o$ Q: x5 }  U* u
  81.   `8 u3 X0 u; \; Y, ^$ n
  82. module_param(acnt, int, S_IRUGO);
    # @. ?& ]4 F" ^! E
  83. module_param(bcnt, int, S_IRUGO);, X7 @9 m% g: P- V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ H& f1 z' \' D) F2 U% z0 x: l9 b1 Q' V& k, ^, G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 V# v3 S& |; @( v( d1 O1 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: y" ^6 _( ^! T! W% `0 h4 s! ^8 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 j0 K2 h/ T/ I2 s) T0 P; A! b  J' b) s1 ^+ I! `0 |8 B

$ J1 k4 |% V# I/ ^: Q; X. E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 12:39 , Processed in 0.048034 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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