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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% u2 N& O9 f% k' ]
  1. [code]EDMA sample test application
    : V% M* _4 k4 n* A
  2. /*
      V+ Y; S* r) K2 @* j" v
  3. * edma_test.c8 @2 C8 a9 n; l, n7 q/ C0 K* Z
  4. *
    4 [8 L5 D* P/ y4 x$ Q
  5. * brief  EDMA3 Test Application' n( N. ?2 E. |3 ]: [
  6. *5 p6 D. [6 \3 A- W: O  b2 P$ ?
  7. *   This file contains EDMA3 Test code.5 Q" q  B9 Z: W7 _* W
  8. *7 E- z; v. x7 }: B7 J, s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 o  P  E' I" J' t1 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 R; `6 m/ H/ c4 R: f$ z2 |+ n5 J
  11. *         TO CHANGE.) s/ ~! c! {) W: D& _: v# i7 M
  12. *& R9 S. O: n6 G! Y& g4 H* \( S& U3 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 y/ Z$ R% p7 N0 Z$ y  t  w
  14. *
    ' ~& z4 t% R, ~) a- k2 e. p& t2 d
  15. * This program is free software; you can redistribute it and/or, v' Q0 Z# `% F4 h" t
  16. * modify it under the terms of the GNU General Public License as4 S+ G, r- M& N1 Y. c, }# U  M
  17. * published by the Free Software Foundation version 2./ ^6 \8 b6 s4 l3 K( \1 f
  18. *
    : X  m# u. {* k- E. W, z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 S6 f0 _' e+ k" o5 Q2 ]
  20. * kind, whether express or implied; without even the implied warranty9 Z8 h0 Z1 F7 G/ h1 ]; N0 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# x2 `1 L' a- O5 F7 X4 y& T
  22. * GNU General Public License for more details." d9 F3 K; @' p) n
  23. */
    ) `; H" l, C% k7 \/ p6 G

  24. ) q0 B4 H$ W: Y( G1 {
  25. #include <linux/module.h>9 h/ Y7 v$ c: n1 h; u9 G8 Y
  26. #include <linux/init.h>$ O1 R  d( A& S0 B- v: j2 U
  27. #include <linux/errno.h>
    $ D5 Z' w, I4 m8 i( a1 n: w( x
  28. #include <linux/types.h>- |5 m7 u! A! J/ T2 q
  29. #include <linux/interrupt.h>
    : c/ f/ u8 y( e2 u8 N
  30. #include <asm/io.h># {# i3 o+ N% f8 l' W$ [$ e- |
  31. #include <linux/moduleparam.h>
    " F! T$ ~% \/ `: N2 a
  32. #include <linux/sysctl.h>
    " j, X8 k! w) Y: Z+ j+ U1 \
  33. #include <linux/mm.h>5 B8 k. k2 M- j5 ]$ S4 V: ^7 Q
  34. #include <linux/dma-mapping.h>& k' g' {# B+ }3 U8 x

  35. $ A! ^: c, P  I! D7 v! w
  36. #include <mach/memory.h>5 l2 R, {* Q. m; R8 g+ N7 Q
  37. #include <mach/hardware.h>
    2 O8 q; w8 ]  R
  38. #include <mach/irqs.h>4 z5 @. i  `* H5 M  X
  39. #include <asm/hardware/edma.h>+ A& S5 D# j# @( X6 d  v
  40. 9 f% _; \) I: J& p1 V- ?
  41. #undef EDMA3_DEBUG- E* }  N. ^$ n" g( U- _
  42. /*#define EDMA3_DEBUG*/
    ! e* J# v4 i- T! Q6 I9 r6 e/ _

  43. 4 D# Q! n- a. ?1 H5 g3 }/ q
  44. #ifdef EDMA3_DEBUG$ [) F" @8 f+ u1 c. r: ^/ I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / C( a& }2 P4 P* K/ d$ G% K( K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 [; B0 ^+ ~; _3 }; {( R9 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 ~1 j% R) j& i. n
  48. #else
    8 f. U$ A1 j( p: i3 ^3 O& D0 R
  49. #define DMA_PRINTK( x... )
    # M6 H, |1 }1 |# w2 L6 A. o
  50. #define DMA_FN_IN
    % Z7 z# U* l% Y7 k* K
  51. #define DMA_FN_OUT
    ) O7 p2 U% K. d$ h4 h
  52. #endif. L* @' j# t. V; d- y

  53. ; L/ W: J; r" ?3 G1 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( t) Q. D0 ?) ]4 ?! q1 d  ]# N. a; M
  55. #define STATIC_SHIFT                3( P2 B9 e1 p9 ]# j
  56. #define TCINTEN_SHIFT               20
      F7 D: G6 x3 p. q2 [# W
  57. #define ITCINTEN_SHIFT              21
      e% T% ?& `" }- [( z% f: m
  58. #define TCCHEN_SHIFT                22
    ) Q9 r: @/ V( q2 H! m
  59. #define ITCCHEN_SHIFT               23
    " r8 q( J- W1 b0 Q# ]; k
  60. 3 S: [( w) n9 I& s# E. @
  61. static volatile int irqraised1 = 0;
    7 d. M, e! {. y6 \/ F5 W
  62. static volatile int irqraised2 = 0;# |+ t$ P4 |( U

  63. ! ~/ S) M/ R# P3 E3 \3 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # F1 q3 O, {; b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Q" a0 j- F7 M, \& @6 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( L/ q6 ?+ ^/ x$ \7 g2 [
  67. # }& C/ a7 S0 s- z9 F' M
  68. dma_addr_t dmaphyssrc1 = 0;
    " n( ^/ E1 a" b3 ], [6 Y
  69. dma_addr_t dmaphyssrc2 = 0;" q5 [8 w" c8 I- e
  70. dma_addr_t dmaphysdest1 = 0;1 s( c3 ~9 E: G2 S6 Q9 H
  71. dma_addr_t dmaphysdest2 = 0;& ~8 N0 A' B9 g4 j/ o: K( o+ }

  72. + t+ X2 c" j# _; ]7 ~% w
  73. char *dmabufsrc1 = NULL;% S4 x; [/ P1 C3 \' C& [$ |0 l- Z
  74. char *dmabufsrc2 = NULL;
    ( k% a: Z4 R, h: Q5 u$ E
  75. char *dmabufdest1 = NULL;! Y1 K9 r4 a- U1 m3 s; d0 G
  76. char *dmabufdest2 = NULL;
    3 o' h+ a) t( m2 u8 L
  77. + s" t9 @/ d! E) y, w, f
  78. static int acnt = 512;
    + _4 f  g+ g4 z
  79. static int bcnt = 8;
    1 L. B! a) Z: b9 X5 D8 _# n+ G
  80. static int ccnt = 8;
    , `( M3 q6 p; |$ o
  81. 2 S0 |' T1 \% N* H& ^, E3 t
  82. module_param(acnt, int, S_IRUGO);
      K0 _5 l, L7 q% q& u
  83. module_param(bcnt, int, S_IRUGO);; S+ ]! G4 R2 ]! A0 a& L1 ~3 Q" i  K0 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 X- @+ i2 F: g3 r# s+ J. B* R
& F7 |6 s/ M' @1 g( {% E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* ^7 d2 x6 ?0 z3 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# P8 `5 Z. @/ T9 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 r) k+ u  `# a/ ~3 x2 q0 J
0 J4 I! U; _, S3 i

- T9 j# _9 t( o* u! Q  H# }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 13:44 , Processed in 0.045759 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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