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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * W) ]; k/ G/ _  L
  1. [code]EDMA sample test application
    ! f3 B: z3 }  k, ?' H. g
  2. /*
    8 Y# o+ h+ O6 i; v/ Y  W( ~! P
  3. * edma_test.c
    : Z# G4 A/ ~. b
  4. *
    6 Y- N$ ]9 ~8 q$ T: ~
  5. * brief  EDMA3 Test Application  ?! s# h9 V, m& u7 t: ^
  6. *# a6 N7 J4 o; X% E0 Z, i% @
  7. *   This file contains EDMA3 Test code.
    ) z; Y( G  V3 C7 k9 I
  8. *
    & a- }5 y% n" e% C4 _, n# I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ E+ \* ]4 }! R# @7 x9 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + z$ }+ y: t$ u4 I/ b# J
  11. *         TO CHANGE.4 `$ Y3 n3 k* W7 d. Y
  12. *5 T0 [% L' c$ B7 @$ J  x5 M  R3 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + {4 _; F  j3 p4 \6 o' e  }
  14. *, i+ |9 g7 T) t' D' v
  15. * This program is free software; you can redistribute it and/or
      |$ n# G' h) g7 c$ D; g( i
  16. * modify it under the terms of the GNU General Public License as: A" t. _2 ]* \4 @
  17. * published by the Free Software Foundation version 2.0 }/ ~+ J1 Y; L$ q$ h7 C/ n( S
  18. *
    + H7 v- ~! e" p8 E. c5 O& ?  Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 h5 `5 b" ^9 l/ @! u/ w3 i& u
  20. * kind, whether express or implied; without even the implied warranty
    : G4 x% g3 i" \2 K7 A& |0 f3 R% Q6 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , v! k$ X/ U8 `' z
  22. * GNU General Public License for more details.
    ' C$ j; U8 }# ~/ I# E
  23. */
    ! a! {. S0 q2 M

  24. ! ~7 @9 d: y9 l& z& m' a
  25. #include <linux/module.h>
    ' X' G7 j# g0 ~8 J% H
  26. #include <linux/init.h>( o- E" B$ A  C' B
  27. #include <linux/errno.h>
    ; s/ u: W2 N3 A( R. H
  28. #include <linux/types.h>
      }) {7 `. D2 t5 d
  29. #include <linux/interrupt.h>
    ; v2 k! w6 X' f6 e5 f! [% t+ n
  30. #include <asm/io.h>
    ! ]: i% d/ f4 y" R
  31. #include <linux/moduleparam.h>
    . N3 Q: ?8 O6 g. z; W- ]5 w
  32. #include <linux/sysctl.h>
    " o) y2 {7 q7 N7 M: y8 {6 ~
  33. #include <linux/mm.h>* e  D1 s0 C0 M) `
  34. #include <linux/dma-mapping.h>  e* k+ \0 A: u* e$ ~

  35. - ?/ e& P% j1 w7 B! @5 D1 z
  36. #include <mach/memory.h>4 `4 o  V  @* k6 |, `. E" Z
  37. #include <mach/hardware.h>- n- S9 p/ w0 X, J7 |& D
  38. #include <mach/irqs.h>
    - E4 a9 J/ P( o
  39. #include <asm/hardware/edma.h>1 E: b, p4 G7 a1 x# z+ Z
  40. ! P' g5 E8 U; m1 r. |. X2 a
  41. #undef EDMA3_DEBUG$ O" I" ]! C8 q# Z
  42. /*#define EDMA3_DEBUG*/
    4 x& c+ b- I- F' p- [
  43. & Q/ P$ g/ L( z3 A2 J1 q* R
  44. #ifdef EDMA3_DEBUG
    4 L" L  N% C6 K0 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % D9 L# ?6 n1 R1 ~8 E& Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 S+ u  m# V% B7 \2 K' Q7 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 T* a0 |8 P* v  I) Q1 ]
  48. #else+ [( ?, x0 F8 _* J9 c% t5 |
  49. #define DMA_PRINTK( x... )
      [3 }$ M! S% h, V9 D  I. q
  50. #define DMA_FN_IN
    2 K( e7 w" G/ l! o% \- [
  51. #define DMA_FN_OUT
    - S+ g, y) z4 W9 w4 S$ r$ t  y+ [
  52. #endif
    1 R5 C: H% B% w  H" P# T0 q( ~. G
  53.   q! d- t& Z; Z5 R0 L! p' M/ v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); j- H2 q- a$ o* R4 |; L) c
  55. #define STATIC_SHIFT                3$ e5 B! t/ u. T9 w+ B: w
  56. #define TCINTEN_SHIFT               208 C$ p! M. n/ q) j; c2 E" L
  57. #define ITCINTEN_SHIFT              21
    3 u! y0 P4 A- z
  58. #define TCCHEN_SHIFT                22
    9 W# s- l8 z$ B
  59. #define ITCCHEN_SHIFT               23% m% o( h! c5 d, a0 H, D
  60. 8 ]5 j6 o/ U% ?8 K' z$ w8 a# ]; t
  61. static volatile int irqraised1 = 0;- N: `+ C8 {5 S; B* D8 C0 {* T4 v
  62. static volatile int irqraised2 = 0;% c3 x" r/ @9 L; k  ]- \! K# F1 E

  63. ' D% S8 X  A2 S& P+ [% e6 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! x7 D8 \# R- K5 C7 C& g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 l0 ?0 ]7 j+ U- E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; y2 Z( [0 g; i

  67. % ^1 \- M! M9 l, E0 I  n4 R
  68. dma_addr_t dmaphyssrc1 = 0;! f1 ?6 N, `  k8 G7 m
  69. dma_addr_t dmaphyssrc2 = 0;% S' r2 a- Y0 E, ]9 v
  70. dma_addr_t dmaphysdest1 = 0;
    : A0 X) h. ]8 H6 ]8 q* j+ m
  71. dma_addr_t dmaphysdest2 = 0;) f  j) p' x! }+ J

  72. 9 ~' @5 K+ J9 ?$ a$ A, w! W, c( g
  73. char *dmabufsrc1 = NULL;. M% x, T, M% p1 w2 h, M: W5 w
  74. char *dmabufsrc2 = NULL;
    7 l6 ?& N: f6 |; J' n2 I
  75. char *dmabufdest1 = NULL;
    4 K! c0 x" F, v' b+ f2 R3 V
  76. char *dmabufdest2 = NULL;
    * G, X3 \# A2 B( V6 O, W

  77. + j6 T% C. G" `! I" j
  78. static int acnt = 512;
    0 _5 h0 p0 N( O1 y4 [) M
  79. static int bcnt = 8;1 ~# R7 r) @! g1 R
  80. static int ccnt = 8;7 Y; \: S0 @; [; P. O/ k
  81. $ T5 ?2 b- H% m+ M
  82. module_param(acnt, int, S_IRUGO);
    5 t1 x* _3 I, i, |' @+ h
  83. module_param(bcnt, int, S_IRUGO);8 i6 H% ^1 h+ I# K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! E# |" c. r! D# ^* P$ G0 ?( H. F. A' i4 U  e* w0 Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 F# p. c) G, f  Q' Q1 L- B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 Q4 a2 q! v9 ~! k! t; c% U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 u0 z- S! H; ], [
( i/ r( Q' S* q( N5 S% s* P; q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 06:44 , Processed in 0.039174 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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