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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% g" N8 F5 k- j6 `4 m/ ]' g
  1. [code]EDMA sample test application1 g2 V, q. q+ O' L# Z3 l' `  R( F
  2. /*5 J# Y6 K* \, P; h! H' y5 [( N6 @
  3. * edma_test.c% K  c2 n, y! Y5 y& n/ h+ C
  4. *& R" c# m# X  O  C1 d; M
  5. * brief  EDMA3 Test Application, Q' i5 E( M; y0 n( h
  6. *+ e- J- a3 n2 n
  7. *   This file contains EDMA3 Test code.$ N6 Q& m2 M- y7 I9 H7 z. }
  8. *
      r+ p9 i3 G1 M# l5 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- j: P) q9 Y& e) o8 E/ ]" a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 F0 k6 E, n% p$ i3 R
  11. *         TO CHANGE.
    3 i3 Z  L. I" a% ^, O: |& P) F  x" }
  12. *% u8 f" O* |$ T: p# k: y/ s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , f- z& m2 h: D
  14. *" g7 V, q' y8 ~; k4 G& z
  15. * This program is free software; you can redistribute it and/or' w7 b* N. o4 j
  16. * modify it under the terms of the GNU General Public License as) B. `( z/ }* j8 X
  17. * published by the Free Software Foundation version 2.
    & v  B* L6 S; l" J6 ]
  18. *% _; }# q  X/ E/ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 ~5 ~( f* e+ s; a; L9 T2 F; Q
  20. * kind, whether express or implied; without even the implied warranty
    5 `) j* |: z# y! r- r2 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' J# r$ j3 |5 C) \5 \- _& G
  22. * GNU General Public License for more details.) C  I) U" `; A& P' @
  23. */
    ! ^' h. c" z4 V

  24. : M6 k/ p8 X* M) H1 y: |
  25. #include <linux/module.h>
    6 a: R# s& h, U" M
  26. #include <linux/init.h>
    & E+ o6 L  g8 S' p! p0 Q
  27. #include <linux/errno.h>
    & p6 D4 n/ ^- V) R  {/ b
  28. #include <linux/types.h>
    & w6 X/ o( [2 y4 A+ l0 Z; J
  29. #include <linux/interrupt.h>
    3 u; K7 b( S' o# l2 Q+ ?( M( ]
  30. #include <asm/io.h>
    9 S' U. T+ M/ W% y# D6 I1 O
  31. #include <linux/moduleparam.h>
    9 I- g1 w$ p. m0 e0 r
  32. #include <linux/sysctl.h>
    ; e! l( B' ^; a+ Z
  33. #include <linux/mm.h>
    - q2 g% }5 N6 X& D6 d7 h; @) |
  34. #include <linux/dma-mapping.h>
    8 J: H2 G8 ^+ y0 b& Z! C
  35. 0 n: k, C5 k" y+ l% q( |6 z
  36. #include <mach/memory.h>* e% H/ C' b9 H$ o1 k' E7 [
  37. #include <mach/hardware.h>
    0 i! p6 v% V. l9 C/ u
  38. #include <mach/irqs.h>% M; K! O9 F% _
  39. #include <asm/hardware/edma.h>
    ; q3 N0 ]* W, v) X

  40. $ N3 a. A5 [8 ~: z
  41. #undef EDMA3_DEBUG+ Z! V; V; ]6 c5 t4 K5 h4 F$ O
  42. /*#define EDMA3_DEBUG*/
    3 i% z( i' x1 M* R8 A+ W

  43. : I1 J; ?2 c  X( S
  44. #ifdef EDMA3_DEBUG
    6 K) ]( h: t7 Z& _  l7 z4 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f: z% H- r' Z; N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 ?: A0 o8 u' Z/ r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ ^8 ~9 i- `; w& `2 Q
  48. #else
    . M' ~5 h' @" c5 J- D4 `
  49. #define DMA_PRINTK( x... )
    ; x9 E% C  v: Z* u# J6 J0 K
  50. #define DMA_FN_IN
    % x, ]9 U8 l) R, K9 Y; _
  51. #define DMA_FN_OUT
    + G, F1 r0 u# h) e  G; U
  52. #endif
    * |/ |  k  [! b7 Z

  53.   W( `% X* L% S5 B4 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % a: L* `) f5 f) R
  55. #define STATIC_SHIFT                3
    7 H) T3 b# K0 d6 U7 o' r4 ]
  56. #define TCINTEN_SHIFT               20
    6 N9 L% [' N5 j
  57. #define ITCINTEN_SHIFT              21! o8 Y) |' |* [, h7 E
  58. #define TCCHEN_SHIFT                221 G8 Q/ c3 m1 [2 A
  59. #define ITCCHEN_SHIFT               23# q4 b: v6 S$ ]0 ^/ N( `
  60. 6 y8 Q, u, I* t
  61. static volatile int irqraised1 = 0;
    : \$ U# U1 y, v9 r3 u( ?0 Q
  62. static volatile int irqraised2 = 0;. L# d$ P( b# n/ K8 {
  63. 2 A6 c! y, a" i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 M" n2 R& Z& O; S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% x8 R, c  d6 l: q/ R. o7 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- h3 b& H: U0 m7 z

  67. & ?1 M8 |3 q6 }+ B) q8 e5 e
  68. dma_addr_t dmaphyssrc1 = 0;
    0 e8 L1 |, X1 C$ R0 g# K& H
  69. dma_addr_t dmaphyssrc2 = 0;
    2 {, P. p; a8 X( C
  70. dma_addr_t dmaphysdest1 = 0;( M, Q5 B+ i* c& l& S! U2 O7 t+ F# p
  71. dma_addr_t dmaphysdest2 = 0;7 M+ D  N% I# m; c1 V

  72. ; w/ s+ M$ ~; D! [* |& \! E( h
  73. char *dmabufsrc1 = NULL;
    6 x. A2 z3 A3 [* s3 ~& `; ?) W$ c
  74. char *dmabufsrc2 = NULL;
    0 d6 W' r: J( ~0 ?6 E4 f* s$ o
  75. char *dmabufdest1 = NULL;! i& o0 b3 q& _- V7 |" {
  76. char *dmabufdest2 = NULL;
    ; U; S. y- l3 ]/ C5 D: J9 q6 Y( U* g/ g

  77. + d, h4 l1 ?7 \5 k+ s6 w" d- ^& K! `! a
  78. static int acnt = 512;
    2 s' _6 Z7 o1 D  n
  79. static int bcnt = 8;# i6 f+ a' K1 z1 q8 u& n8 y
  80. static int ccnt = 8;1 V! k# |2 ?$ j* b3 K0 t0 }, ~
  81. . N5 W3 P) L7 }  i! v' `
  82. module_param(acnt, int, S_IRUGO);
    % ~4 M( V" c3 \/ c6 H5 [' n* ^
  83. module_param(bcnt, int, S_IRUGO);
    - m; |# a3 h$ E3 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) u' N7 }5 U/ O6 _- q+ C/ M. ?* p

8 O1 b* d4 `& C! ^) E* _) f! r; a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, r& a0 }1 d4 M9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) w- p$ ~9 G& N) ^% A" ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ J1 V. V6 m' h5 c6 \

  |1 W5 I# m" R7 T4 H$ c6 |
( P- ?  x8 @& j/ C' O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 20:03 , Processed in 0.043414 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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