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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ]$ [3 V. l8 e7 W2 \  W6 U- q3 `! z
  1. [code]EDMA sample test application$ g- X; q4 X6 K. {
  2. /*$ U3 L6 Y8 z0 \. C9 r5 y, N
  3. * edma_test.c2 N1 l: Q0 k% P' A$ l* U
  4. *6 R. U( V3 ?7 O) v
  5. * brief  EDMA3 Test Application3 W2 \$ q$ Y/ y% O0 L$ n  C. b
  6. *& M  t& [8 F5 k: ~
  7. *   This file contains EDMA3 Test code.  X( c9 b9 l" @& Q  J
  8. *0 n. [2 x5 L" _4 P8 L; }2 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 e0 I, Y3 z7 I2 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( w* f- u1 Q/ l# F# M
  11. *         TO CHANGE.' H) Q4 C7 W! k  W4 S3 @
  12. *. ?1 k1 V1 }$ R8 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % C1 L2 ?$ G9 ~, w( s
  14. *
    8 `' J1 e: O5 ?3 [
  15. * This program is free software; you can redistribute it and/or' ?3 w$ L# A/ Q
  16. * modify it under the terms of the GNU General Public License as
    1 C- _( x, S+ h. t
  17. * published by the Free Software Foundation version 2.
    2 y. V) q$ @" k6 c; b& [
  18. *3 M* I& D# _4 U/ z; s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* Y: d- g' R3 A4 U
  20. * kind, whether express or implied; without even the implied warranty
    , U6 I& A% k/ c1 o+ |1 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, g+ a7 e: d# I4 [2 S3 H
  22. * GNU General Public License for more details.4 t2 I( F1 @8 r0 p. O+ R4 Q. [
  23. */3 x" _; f/ V1 C
  24. # O/ n  j: x2 {- z
  25. #include <linux/module.h>; T5 {9 z# f- w( X6 k- g4 s! |  e
  26. #include <linux/init.h>
    6 t  T  A% g' H+ U% O
  27. #include <linux/errno.h>
    3 q5 k& z' y) `  O
  28. #include <linux/types.h>3 n3 j2 q2 Q' _8 B# n
  29. #include <linux/interrupt.h>* D0 u: X$ g0 p) r5 u8 m7 c
  30. #include <asm/io.h># B/ [( W9 w2 ]1 ^
  31. #include <linux/moduleparam.h>
    , X& Z1 t5 t5 K
  32. #include <linux/sysctl.h>! O, A: K! d/ L, C8 R
  33. #include <linux/mm.h>
    , r, w( |9 y; Z% p% g2 v$ A( X
  34. #include <linux/dma-mapping.h>6 A8 Z/ W! f6 q
  35. $ S9 O* k: o$ R
  36. #include <mach/memory.h>
    ! t8 X2 X- ?0 r1 b1 N0 |* v
  37. #include <mach/hardware.h>
    $ K/ _, y5 e! L2 f- m6 O  j! _
  38. #include <mach/irqs.h>( d: e+ u" _$ K; `. k# M) U
  39. #include <asm/hardware/edma.h>
    8 l7 o' I; A: m! q- q7 ^
  40. : E: m, E. t  |. P) @
  41. #undef EDMA3_DEBUG! x& p/ F- \, z/ X" e3 z
  42. /*#define EDMA3_DEBUG*/
      p" z8 X8 p2 a: C

  43. 4 G1 J% u& {( T! v" }
  44. #ifdef EDMA3_DEBUG9 u" r( s  h' a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 T( _$ ?+ W+ I, O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ M& p8 T1 F; `( N1 a% o# _6 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 v7 r  t. t8 U9 d+ @
  48. #else
    . h6 ?6 E. Q3 K" a, n/ a7 s$ {
  49. #define DMA_PRINTK( x... )5 U, f) u  h" C4 G+ H3 A
  50. #define DMA_FN_IN
    * d: t4 Z- _: {" w- K: a+ Q, t$ d
  51. #define DMA_FN_OUT
    5 o) c: f2 X1 A7 k" Q" P  F
  52. #endif8 b1 {6 Z( K) a3 ]

  53. . O9 j! R9 `( I: v% |' ?7 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 W: ]- i+ ~5 g: j% A
  55. #define STATIC_SHIFT                3
    # F& F1 Y2 D3 z
  56. #define TCINTEN_SHIFT               20
    3 G" b2 s& j; p( `: y
  57. #define ITCINTEN_SHIFT              21
    . ?4 F- X+ V5 s, m4 [6 Y
  58. #define TCCHEN_SHIFT                22
    / q# C$ e. M. |8 K- V
  59. #define ITCCHEN_SHIFT               23
    3 J' m& \# L3 c- O- r, w# t: N
  60. ' G% l' s9 N7 y% `& K% \7 |: c
  61. static volatile int irqraised1 = 0;
    6 P0 u0 I5 x: S
  62. static volatile int irqraised2 = 0;
    5 o" y3 {" B. j/ D! C2 Y
  63. $ \7 G9 E9 c  v3 I  l8 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N2 @3 B+ ?" o1 k3 D, j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 E' u- z4 i+ Z. k5 [' ]) Z- P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) o% E  \* I+ d

  67. " O& J7 d* b# x. J
  68. dma_addr_t dmaphyssrc1 = 0;
    2 ?3 s) d7 T2 S$ j3 o4 |
  69. dma_addr_t dmaphyssrc2 = 0;
    2 T: _% j( M4 f  e0 l  F3 w4 w. }& N3 t
  70. dma_addr_t dmaphysdest1 = 0;1 Z( ~) H/ f; B
  71. dma_addr_t dmaphysdest2 = 0;
    ' T& c( v6 y5 ]8 v' L5 M' f
  72. " j0 ]6 C/ ^* ?4 q" `$ A! H& a. k
  73. char *dmabufsrc1 = NULL;
    3 F, O, B% j$ H* n/ i* H
  74. char *dmabufsrc2 = NULL;1 t, ~0 W6 \8 V: D7 h0 g
  75. char *dmabufdest1 = NULL;
    ( j! r7 E; U; T/ e: j$ i
  76. char *dmabufdest2 = NULL;0 R* D- a- t- @, H+ s

  77. 8 ^, }; [! r7 c/ U  ~3 H
  78. static int acnt = 512;+ v$ y" e8 o# L( N, D
  79. static int bcnt = 8;0 r) ~1 U" X  t, G8 y$ {8 Q
  80. static int ccnt = 8;3 C2 }5 K7 m7 q# j  {  q) q. u
  81. . p, J1 Q3 X* q: A# A8 ]/ t0 y
  82. module_param(acnt, int, S_IRUGO);
    " s& S3 ^) u7 G' j! J
  83. module_param(bcnt, int, S_IRUGO);
    : U0 w$ i- h) A5 e/ u: A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. G' G- \. F6 ]+ G

+ q7 s- k( i- A6 l: C" s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" }) f7 q; [- d3 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  @+ k( S# y5 J( s! G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ M% X, r' G$ g' u

6 q) K8 J. [: J( s0 j; \# c
! {" ?+ S( L- f# F1 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 02:19 , Processed in 0.046093 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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