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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 d7 Q% G7 f" \
  1. [code]EDMA sample test application
    3 q, z3 W! y$ l6 y- j; G
  2. /*
    1 a$ b) [1 l( Q( Z7 z4 W
  3. * edma_test.c
    ; r; V5 a; `$ v7 S
  4. *
    0 ^8 g  |- i" N6 h
  5. * brief  EDMA3 Test Application/ S, k) z2 v/ d2 C: g8 t2 W  H
  6. *
    " l" _0 l( t( e
  7. *   This file contains EDMA3 Test code., X6 g% j1 Y9 ]% f, S! K
  8. *% r( }4 t& {" P) D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ J$ [# Y( ]' `* y5 W8 j9 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ J2 H. T: M4 E8 r) ^$ r  h' U
  11. *         TO CHANGE." e8 E4 ]1 }7 ?6 P# K/ Q
  12. *
    - a& ?# y! w1 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ W& e: I# o3 d  S* e0 b
  14. *
    # z  m- e1 I  m# f. r, j! m* E, H6 [% q
  15. * This program is free software; you can redistribute it and/or
    ! I6 M2 d" j% u; i- }; S! C
  16. * modify it under the terms of the GNU General Public License as& @+ F1 [! z" N$ g- g4 P! M! l3 z
  17. * published by the Free Software Foundation version 2.
    ! w" i5 Y! _$ C$ M8 A- G3 t
  18. *
    3 m+ n# V2 @, p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' p; w' t8 M6 W
  20. * kind, whether express or implied; without even the implied warranty% F6 p) v: w4 {8 |8 K* l$ ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 l6 }- Z$ \$ h1 f4 R, `# T' n0 y
  22. * GNU General Public License for more details.( _; ^5 c/ \3 {% X. W+ W5 \
  23. */' q8 W! s; `$ |' R

  24. % |; @% B: [; m! L, ~# h
  25. #include <linux/module.h>7 U: R5 x; L, `' t# _; w
  26. #include <linux/init.h>
    " a, [) O) V; t9 ~* N: Z+ A1 I+ ]. U
  27. #include <linux/errno.h>6 ~2 B& {# U9 q1 z( T
  28. #include <linux/types.h>3 W) h. C8 j8 Y$ R8 e& C! ^* H
  29. #include <linux/interrupt.h>7 C+ L( G8 A, J( D# ^$ r7 M. _
  30. #include <asm/io.h>
    % @. i7 Q7 M/ a
  31. #include <linux/moduleparam.h>9 q/ b* X, \' l8 b$ T
  32. #include <linux/sysctl.h>9 u& P  w2 x! b& X- n, J
  33. #include <linux/mm.h>
    , u6 |9 q7 g5 w' ]7 @1 H" U! v# C3 J
  34. #include <linux/dma-mapping.h>
    , x+ M$ e0 N/ C& g' s0 A
  35. 7 ^+ t4 k! d. X" Y, u6 _6 s7 `
  36. #include <mach/memory.h>
    " E! m0 B- [# |
  37. #include <mach/hardware.h>; f6 d8 P# V! m) k! M2 p
  38. #include <mach/irqs.h>3 X; }5 o3 @5 o% B, S
  39. #include <asm/hardware/edma.h>
    - V9 h8 d% O5 i/ w5 }3 H
  40. ' l7 ?" ~6 x. a" Q
  41. #undef EDMA3_DEBUG
    9 W) D% _' a# L3 M6 |, N
  42. /*#define EDMA3_DEBUG*/
    : m' z& k2 E9 p# p( b3 U
  43. 0 [: J2 N$ p- T% w( s* j
  44. #ifdef EDMA3_DEBUG3 Z+ }9 A. y5 X4 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): m0 T6 ~6 ]! Y/ \7 R& `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * Z  e. p, l0 X$ L6 Y0 w8 H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . R( H. H* u3 l' s$ r9 p; v
  48. #else
      N; ?5 t. H  v/ ]. t
  49. #define DMA_PRINTK( x... ). r# P5 g! U& {+ r1 a
  50. #define DMA_FN_IN
    0 T# b1 B4 x2 ?& a( S. Y- ?$ _
  51. #define DMA_FN_OUT
    ) F8 T- e/ w6 _' C
  52. #endif
    6 O2 U7 e) l6 E) r/ W1 K
  53. 8 H3 C6 M4 S! R% E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 }( P; `. Z& P) D' M5 j
  55. #define STATIC_SHIFT                3
    9 V* H+ ]5 V$ y
  56. #define TCINTEN_SHIFT               20
    . Z: l7 g- b* k8 _. x
  57. #define ITCINTEN_SHIFT              212 h- f/ R5 D0 k: e# _# B- g
  58. #define TCCHEN_SHIFT                22
    ; ?$ K( Y4 k9 ], V/ I3 N
  59. #define ITCCHEN_SHIFT               23
    ; W: n& ?6 {5 ~2 _
  60. 0 U6 j1 I) s6 K+ _/ G2 M9 `
  61. static volatile int irqraised1 = 0;
    3 |% l0 \) k8 ?, d) O' g; o$ I
  62. static volatile int irqraised2 = 0;
    8 M7 U- J, a8 G& k  [
  63. ' C/ ]  J' N! S" I  u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q) N4 B8 U& O% {. p% N/ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % h/ p1 `( U' K4 Z4 R, Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - x% O2 o( G1 }; W* N( t

  67. 9 y# J  s$ D9 I# ~
  68. dma_addr_t dmaphyssrc1 = 0;
    9 u$ ~' d$ e+ }, M4 P
  69. dma_addr_t dmaphyssrc2 = 0;
    2 N1 H- q% c* y2 D7 p
  70. dma_addr_t dmaphysdest1 = 0;
    * p. Z1 e1 S( B) l( @3 @
  71. dma_addr_t dmaphysdest2 = 0;' ^5 N, ~3 v" m/ L* R6 t$ w4 e, x9 }
  72. - \' Y6 m8 f5 f3 b7 M
  73. char *dmabufsrc1 = NULL;- ]7 G5 A' c  {! l# V/ `6 u
  74. char *dmabufsrc2 = NULL;' h  e6 r- j, Y
  75. char *dmabufdest1 = NULL;4 Y( {) |( _$ S$ X$ u; w
  76. char *dmabufdest2 = NULL;$ r7 q) S$ `) K' R+ z  F  \1 c% F

  77. 4 P  X7 K' S( O9 X: f- x8 d
  78. static int acnt = 512;
    8 [# H6 ]3 ~+ p% e/ c; [3 K
  79. static int bcnt = 8;
    ) A0 V  Y( t9 x- L8 J" k( d
  80. static int ccnt = 8;
    6 ?5 f: |; |1 l& l% K5 C. V
  81. 4 t, K$ B) H) l9 \* _9 S3 ~
  82. module_param(acnt, int, S_IRUGO);
    ' W; g2 U. B* K3 C
  83. module_param(bcnt, int, S_IRUGO);- R& p/ D6 h8 M% k( E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: q$ |! O: C  G
! H7 G( C9 c/ t! O! v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 r( z0 ]! C9 z- N/ x2 H( C6 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% d/ B  E# p4 O6 p( z$ u1 z$ y( Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& M1 _) p* q- V) v- V& _

) Y4 q' @; h& Y' C
( ?# p6 z  C5 a+ [8 p1 K2 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 01:33 , Processed in 0.039610 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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