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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" v6 X) |$ i. x3 Y# F
  1. [code]EDMA sample test application7 c$ j. w2 Y7 @  N7 e. U" S
  2. /*
    3 f8 E9 v9 N/ @4 j! C7 P1 G
  3. * edma_test.c/ W  q# h* L4 [1 U) [* H0 C
  4. *
    1 g# X' M0 W$ t
  5. * brief  EDMA3 Test Application6 O  j8 ]# Q, w3 y9 x
  6. *) Z1 c8 T/ i0 z
  7. *   This file contains EDMA3 Test code.- z) b- C. V8 w* R5 V
  8. *
    ' y4 l& \2 L( |" s. ?  b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% c9 s1 O; A) _  ^9 U8 X5 h: ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " R: _2 O' ?' w! u2 I- Z
  11. *         TO CHANGE.. G, Z; ]3 `9 m2 ^
  12. *
    # U. q( j4 G  e; p1 H  J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " k( P0 Y, k! P3 k/ S1 U) E& y
  14. *
    2 S7 z. l7 [- p9 s5 {
  15. * This program is free software; you can redistribute it and/or0 n$ r7 _, P! a
  16. * modify it under the terms of the GNU General Public License as
    # T0 T9 ~9 l) V6 x% u/ x
  17. * published by the Free Software Foundation version 2.* @+ [( Y# C! j! `1 K
  18. *+ m2 v& W6 r; `" j& T7 e3 Z1 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 t" N% M5 ^& j+ ^: q5 I
  20. * kind, whether express or implied; without even the implied warranty8 ], r- D4 _$ d# J- Z- k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ V. [1 u9 M$ ?
  22. * GNU General Public License for more details.* g- J6 t- N" |/ A: o' k% L3 |
  23. */9 _- u- S4 v; I& R
  24.   F. ?/ ]2 u* p, F4 x1 j
  25. #include <linux/module.h>
    . ~4 h/ }0 C' H& ^- W% L
  26. #include <linux/init.h>
      b- g+ Z2 H' i: v# Y
  27. #include <linux/errno.h>, f& {7 D2 b: T6 t8 [) J% j0 V
  28. #include <linux/types.h>
    + x, U! g9 s* }! n1 s4 r5 G
  29. #include <linux/interrupt.h>
    ) I, c& Q; Z  ?6 @/ A
  30. #include <asm/io.h>
    # O8 U0 `3 q, e# N1 v) _7 H8 ~
  31. #include <linux/moduleparam.h>) U0 X* K3 T; r7 x4 L! [$ P! O* E
  32. #include <linux/sysctl.h>* q2 L. \) z. a& `% x! h
  33. #include <linux/mm.h>
    ' ]9 i2 b1 b4 J, l8 y$ [4 E. N
  34. #include <linux/dma-mapping.h>) S/ I' D6 a9 ^4 T# p5 b1 a

  35. ' {' Z4 h: c2 x3 o" Q+ X* x
  36. #include <mach/memory.h>
    3 \- I  Q" E- I+ z9 w& B
  37. #include <mach/hardware.h>1 N* y& E" _' _* h" _2 {
  38. #include <mach/irqs.h>, z0 `; U. U" r' C4 S5 M/ M4 m  R
  39. #include <asm/hardware/edma.h>
    ) |7 b/ [6 l, b# h  |8 e
  40. * V- F5 D8 w0 ^3 \. ]
  41. #undef EDMA3_DEBUG; C; \( J. M% C: l
  42. /*#define EDMA3_DEBUG*/
    . R7 V& D9 e" [! E, V3 f
  43. + |$ j+ c' E8 ]0 N9 I: k  j
  44. #ifdef EDMA3_DEBUG. O; R; h0 u& \9 r- \* R6 U0 h: _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! I0 T6 ~. U  g. o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / Q6 o  d2 g( \( A/ z; Q. V+ U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , o- |  e/ f& |& E+ |
  48. #else$ ]  y: s& C: ^$ O( K. x# Z/ f
  49. #define DMA_PRINTK( x... )5 P1 }, g: _  y+ A" g
  50. #define DMA_FN_IN
    - M5 ~& Y3 m  e- @+ U# o
  51. #define DMA_FN_OUT
      `5 Z. s: Q, L5 Q9 B: G; t& l
  52. #endif" V' Z+ S& \) ]& J

  53. & X. R) w' ?$ ~7 M* r* V6 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): A+ y+ ~: l4 n& Y! o! s: x. {
  55. #define STATIC_SHIFT                3& b2 @9 x8 A" {
  56. #define TCINTEN_SHIFT               205 w, B, m. ?/ O2 y/ K# x
  57. #define ITCINTEN_SHIFT              21+ q- l! P4 b0 Q9 n$ x
  58. #define TCCHEN_SHIFT                22
    9 i' E5 M8 |3 {7 o2 O
  59. #define ITCCHEN_SHIFT               23
    $ @5 O8 x5 R* G/ c

  60. : N6 V- W! ^8 q$ S4 S& a5 V
  61. static volatile int irqraised1 = 0;7 z% Q' n2 o, M
  62. static volatile int irqraised2 = 0;
    1 I4 Q' v" P' ^1 M6 h* E% B' @

  63. ) Y/ O+ K6 Z- ]. n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / C& G4 x9 T% V4 r2 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* c$ V6 I, Y" m- g% m8 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I. u  R! J6 l7 z( I+ T* P3 X

  67. % T. e; u$ L7 Z/ ~. R5 ?! c
  68. dma_addr_t dmaphyssrc1 = 0;
    " W9 M5 Y; q( P& ^  |4 j  n
  69. dma_addr_t dmaphyssrc2 = 0;( ~1 f4 Z5 Q! b+ F: Z: e
  70. dma_addr_t dmaphysdest1 = 0;. y% v9 H7 H! b
  71. dma_addr_t dmaphysdest2 = 0;+ R( ^. A) ]8 z7 C. |) V

  72. $ v* f& S1 H  s$ ^9 P! u: q, @
  73. char *dmabufsrc1 = NULL;
    ! M2 Z! ]& j7 \6 V" z& L9 ^
  74. char *dmabufsrc2 = NULL;
    # \5 \/ E' l6 e$ P0 P
  75. char *dmabufdest1 = NULL;
    3 C: B6 r8 w0 L; q5 x5 O
  76. char *dmabufdest2 = NULL;8 Q. A' U& M, B% r, r
  77.   N& T' U/ f3 I, s; g8 }( F5 I( l
  78. static int acnt = 512;
    + W& `- W# ^( ]) D6 k
  79. static int bcnt = 8;
    ' g$ ~3 S5 b6 d5 z8 c7 P
  80. static int ccnt = 8;4 H' K8 U2 V' \2 z$ b4 K$ O8 B

  81. $ E, \$ _# k4 t, {
  82. module_param(acnt, int, S_IRUGO);
    " t: h* t% E5 D2 I) m" g2 u  h
  83. module_param(bcnt, int, S_IRUGO);
    ) H! {  ?0 J6 Q  q! p) |6 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 X  ^* }+ d4 j8 d- b3 j7 w1 S
; g9 `' X4 x2 M9 t. R* H% s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% X8 G9 u6 {! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 k- t5 Q" b' ]4 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 D: A& v, W0 J% a" X% V( K
4 j) }% p0 P2 O) F# j
6 d4 `3 t; N5 ?! W; {5 E& V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 21:50 , Processed in 0.042634 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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