OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 A' b8 ]( t" Z  ^0 ^. ?) y
  1. [code]EDMA sample test application# c7 s" p7 L/ z9 ]  ^- C
  2. /*6 `, c/ W/ J, m4 g! ^" u
  3. * edma_test.c
    3 ^; k4 n: O! L/ y3 u( }; e
  4. *
    4 l8 V+ g% A) E, j
  5. * brief  EDMA3 Test Application
    , N6 V3 e5 [  ^" V
  6. *3 m* ^$ ~& |- u( f! j
  7. *   This file contains EDMA3 Test code.8 u* k0 C9 v) ]/ w" y' Z' n) c. R5 ?
  8. *
    : N5 M6 i! H. [* v: M0 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 F6 p5 v% c# H8 b# a  r5 M1 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 {. A7 U. B( D% Y4 o9 ]4 I# g7 ?
  11. *         TO CHANGE.
    3 |* w& G7 G& @! g/ ]- e0 A/ }
  12. *6 Z  j8 e6 b0 z8 {6 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 y2 ^) A2 ?/ Y) U3 o
  14. *3 ^' d* K6 y) o
  15. * This program is free software; you can redistribute it and/or+ o. B+ p3 [0 e3 Q9 x5 D
  16. * modify it under the terms of the GNU General Public License as
    9 e& t( |- {; l7 z  o. H
  17. * published by the Free Software Foundation version 2.
    ) F5 I: s+ c) s& P
  18. *; y. N$ ]+ S0 x" z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      ^8 c" i1 R! S3 d( {9 d
  20. * kind, whether express or implied; without even the implied warranty: K5 G0 N( e4 E' I$ Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- Y+ a3 h( K1 Y
  22. * GNU General Public License for more details.
    . p- J# g. @0 C- \# d! B7 k/ z
  23. */
    8 f* Y' R# Z% A+ @
  24. 0 H1 t% h6 h% [0 z, L# y, Z
  25. #include <linux/module.h>9 K6 c' e3 h$ e  {
  26. #include <linux/init.h>/ f+ `4 C' }  p# W9 ?+ y" t# a
  27. #include <linux/errno.h># `# v4 N, e( i" M* m6 l) C
  28. #include <linux/types.h>8 N0 {; ^- E9 j. o: J3 ^
  29. #include <linux/interrupt.h>
    1 g  K! O. w, R9 F3 y; R
  30. #include <asm/io.h>
    3 s* u) W/ \- `. f! H
  31. #include <linux/moduleparam.h>. M# @/ Y! s( Q- v) x
  32. #include <linux/sysctl.h>
    3 d2 Z; }: Q% L% |( y6 K. r
  33. #include <linux/mm.h>7 e. \  o2 U: k- f
  34. #include <linux/dma-mapping.h>
    3 i3 ]  k+ n! j) r% S

  35. 4 B( V- V3 a; i% \6 a7 P! U1 K
  36. #include <mach/memory.h>. i9 a7 T$ Y2 G
  37. #include <mach/hardware.h>+ T8 t: Q* U6 n4 e( S0 s$ \4 \5 A
  38. #include <mach/irqs.h>. y( [3 s2 u0 Z
  39. #include <asm/hardware/edma.h>; E$ j* Z; M( g* Y# O1 z
  40. , O3 Y$ l8 c/ Y3 s3 Y! t7 h
  41. #undef EDMA3_DEBUG
    6 W, @) W9 M4 B  w* C
  42. /*#define EDMA3_DEBUG*/8 `, H3 E3 P' {' Y8 J2 ~" q" H

  43. ! e/ @1 E2 f5 ?  c/ E
  44. #ifdef EDMA3_DEBUG
    3 w2 |' A) }# q8 i* \6 @: S2 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + j7 o3 I: u+ e2 e' o5 k6 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - w) `- c; ~, W0 F4 W* D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 J! I* a0 M. ]' X( g& g
  48. #else
    0 e  Z# ^; Q6 K9 O1 w
  49. #define DMA_PRINTK( x... )9 o& t5 e  y2 D
  50. #define DMA_FN_IN
    % h1 J* o9 L! c, a' U- B( C2 H
  51. #define DMA_FN_OUT
    ) t$ m* _3 u* }" M
  52. #endif$ G* m7 ^( k1 i9 A

  53. # s; o0 Z, }& w5 @$ [2 S! L( p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . ]* f  P3 }6 z( n1 ^
  55. #define STATIC_SHIFT                3
    & ~- o& O( U' c$ v3 M5 a; h; [8 p" T
  56. #define TCINTEN_SHIFT               20
    / ^; x7 M; Y7 `& [( p( }; x  p2 s
  57. #define ITCINTEN_SHIFT              214 f& e0 ?- u1 n/ H
  58. #define TCCHEN_SHIFT                22% Y  I( _( l5 n  H3 Q9 M. o
  59. #define ITCCHEN_SHIFT               23
    $ ?, p8 X7 B' E8 }! C* e1 o- D

  60. / z. {2 C$ v& O( B: L0 D, j) I
  61. static volatile int irqraised1 = 0;8 W# q+ B! D+ y3 d- x6 l. z
  62. static volatile int irqraised2 = 0;
    ; Q- {. T9 V/ M) [1 I
  63. 7 X' W% P% j; R/ D2 B; ~( z! I& o7 y5 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ d6 I0 C" T3 e/ k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 V1 S) i6 B' T' f+ R+ i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 [" T' s- q; [5 R. |
  67. % H! o4 l5 [3 I- @
  68. dma_addr_t dmaphyssrc1 = 0;
    * F$ h% a: @( F/ y
  69. dma_addr_t dmaphyssrc2 = 0;
    6 q2 j* u+ c4 o7 N
  70. dma_addr_t dmaphysdest1 = 0;
    8 x6 J+ B. ~9 ^! k) p9 i  ?& y+ G
  71. dma_addr_t dmaphysdest2 = 0;
    ' R4 ]  ^1 a, ]% k  ~: @. p3 I
  72. + r' i# |8 L, ~" n
  73. char *dmabufsrc1 = NULL;, o) ?' M! G! t* n8 y* H
  74. char *dmabufsrc2 = NULL;
    $ |! Y. d5 v0 N- B  S! c! Z& y) b. y
  75. char *dmabufdest1 = NULL;& g3 N4 a: j- ]0 ^; o, u4 l
  76. char *dmabufdest2 = NULL;0 e! B' l8 S4 B( y

  77. / i# l" L' e1 {( u; M( I
  78. static int acnt = 512;0 s4 |% d* ~& Y% C$ _: X% \3 g
  79. static int bcnt = 8;/ r: _( b) L1 s% J- Z$ _9 \% y" z
  80. static int ccnt = 8;2 q( ~) P4 g. O( O/ {
  81. ( L$ E4 U, e. I$ P( z
  82. module_param(acnt, int, S_IRUGO);
    3 y) `# |4 E' y0 r0 }  @- C9 q$ S4 |
  83. module_param(bcnt, int, S_IRUGO);& C+ z1 |, g3 c) K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. U) r! s$ q) S% v6 `9 n
/ {6 ~7 d: A) T$ s, N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 V  F! M- @& ^/ uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 p! k* {0 s! D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  S* [2 O* |: ]: z
) g+ @; e6 N' O; m8 d6 O3 n" {
3 J  s$ o- `" C( e1 @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 12:48 , Processed in 0.037645 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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