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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ h+ d, K9 b0 R- ], j. O! F; y9 H0 [
  1. [code]EDMA sample test application
    " B' N3 J* A# Z" b
  2. /*+ v1 G3 }* X) Z2 _0 V0 _
  3. * edma_test.c/ a' n- m3 a: A8 l- [2 o+ Q
  4. *" Y+ j4 ~- n  y! ]1 f3 ^
  5. * brief  EDMA3 Test Application
    & [7 p8 h( p7 b# d' T
  6. *% [4 S# ~3 k6 B- ?7 U
  7. *   This file contains EDMA3 Test code.' e7 O& B5 _( ?
  8. *0 t0 s- i; u3 b9 O$ D  v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: u3 K1 X7 f- S) L2 g8 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# k( r3 {/ |, T6 Q( K+ j0 e, f
  11. *         TO CHANGE.
    6 d  j! K0 @, j; x  U
  12. *
    0 |7 c6 S- c) h7 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # |1 z" O- l4 X! |* n/ r
  14. *
    0 h, E2 w: |* ^  |* O+ z
  15. * This program is free software; you can redistribute it and/or
    2 d3 {, X: j5 ~8 V0 A
  16. * modify it under the terms of the GNU General Public License as
    1 g+ \0 }5 k7 p0 o3 P; ^
  17. * published by the Free Software Foundation version 2.
    ( S+ q' G2 ]3 ~
  18. *; a" z4 y1 f+ m5 l0 A% K6 f. k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 o# O" h) T- u' h; R  N$ Z! z
  20. * kind, whether express or implied; without even the implied warranty
    " c# @/ g8 \% S+ [' u) Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ e6 Z; \2 S! t& p
  22. * GNU General Public License for more details.
    8 n' |+ E% Y' m  E* V* u  H% Y
  23. */+ S" H% }9 \2 Z' {+ C# W( `
  24. ) t+ e0 u* m; l, o' y
  25. #include <linux/module.h>" f! V1 G, F3 ?" z: Q
  26. #include <linux/init.h>3 L2 Q1 X3 G4 U% j$ C# _
  27. #include <linux/errno.h>* [2 N# L+ i, X. |$ B
  28. #include <linux/types.h>2 ~2 B9 b/ C0 a7 [- ~( t
  29. #include <linux/interrupt.h>
    7 H6 m! t4 F! V* \3 I3 h
  30. #include <asm/io.h>+ \2 f! o1 }* |6 q, b6 r
  31. #include <linux/moduleparam.h>
    . [, D1 `. U* W- j7 P
  32. #include <linux/sysctl.h>
    * @' v9 g5 U; O" o* q5 ], k7 F" b6 Z
  33. #include <linux/mm.h>0 D9 d% A# j, B) W
  34. #include <linux/dma-mapping.h>
    ( N, S" _0 b$ W4 ^) {  y* p' _- x

  35. - S: G9 K, C, d
  36. #include <mach/memory.h>2 Z1 u1 x8 O; O8 ]. L. S  k
  37. #include <mach/hardware.h>2 `# n6 ?2 y- a
  38. #include <mach/irqs.h>6 U) y) [, x* C$ S4 L1 V
  39. #include <asm/hardware/edma.h>
    ( k: e) C: s: B* K4 Z' O

  40. / e$ B. |5 z4 M1 K2 K& J
  41. #undef EDMA3_DEBUG# K5 A) b" H9 l5 b: J0 D" [8 h
  42. /*#define EDMA3_DEBUG*/
      X, V3 t+ b1 B+ F
  43. $ I/ ^$ g; [2 ?3 I6 h
  44. #ifdef EDMA3_DEBUG
    1 X+ C# T* p- n  R, g. P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). _, {$ m) B: Y# E& A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% @, C- w8 T$ b) Q% ]8 w1 s# Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ ~7 q9 ~, T! [, [* b
  48. #else
    / o! C! K& j# i& i" `
  49. #define DMA_PRINTK( x... )
    1 ]( g7 t0 A6 D4 {
  50. #define DMA_FN_IN4 [5 q: O$ _+ O( ?6 W; o
  51. #define DMA_FN_OUT4 Z3 X  R' f0 p: i
  52. #endif' l) b( w% s5 R% O- ^- [" M
  53. , P' S8 [% }9 j1 q" M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), ]0 S" W( ~$ }6 F
  55. #define STATIC_SHIFT                3
    , ^( J5 X3 {) U( O2 v; B+ }
  56. #define TCINTEN_SHIFT               20  T6 `* \0 r8 y$ A
  57. #define ITCINTEN_SHIFT              21
    ; r$ [: [- N: ^3 @
  58. #define TCCHEN_SHIFT                22, P- A6 ?: v- ~# b2 Q
  59. #define ITCCHEN_SHIFT               23
    2 A" f+ Z& @3 T
  60. $ Z+ k0 m! x1 `+ [3 W1 b3 b9 L. Y2 W
  61. static volatile int irqraised1 = 0;
    " F/ P  v; Y1 U' Z& f4 E4 _+ Y8 ^
  62. static volatile int irqraised2 = 0;
    ! V7 P9 C- R: Z& @' R
  63. ; ?/ x3 ?) o# B1 d# z7 ^4 l$ ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 h- Q' G/ ~- ?& x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }- `0 i2 h" f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y4 F6 ~& h+ G* O7 k/ }$ N
  67. . c/ Q& J5 d6 [: ~6 L
  68. dma_addr_t dmaphyssrc1 = 0;
    5 p) @  [% `: X! N: z% t/ v( d
  69. dma_addr_t dmaphyssrc2 = 0;
    6 a2 x7 E# e) w
  70. dma_addr_t dmaphysdest1 = 0;3 t1 m) T5 k' V% M. y
  71. dma_addr_t dmaphysdest2 = 0;
    + |/ A- v' K1 m

  72. 5 [4 S5 @' l$ I# ^% K8 m8 W
  73. char *dmabufsrc1 = NULL;
    ; w7 {# h; a  S4 a+ Y
  74. char *dmabufsrc2 = NULL;
    5 L4 J! C& f! Y: Z
  75. char *dmabufdest1 = NULL;
    9 k- T  ^1 t% n$ x' V1 n2 G" N* u
  76. char *dmabufdest2 = NULL;' H% T# c# b- H, o! y8 U
  77. 2 T. L" i  u! ]* ]' `! U
  78. static int acnt = 512;
    : h4 y" G" ]8 h$ c1 p! e+ T/ Z( x' D
  79. static int bcnt = 8;
    3 z& ^: J! ^; p
  80. static int ccnt = 8;5 h% _, ?8 o8 O& r$ e" r
  81. & i& R2 P# \$ o$ q
  82. module_param(acnt, int, S_IRUGO);1 \2 ]: u0 P, ^# V" F6 X! s* y
  83. module_param(bcnt, int, S_IRUGO);
    % C$ ]' u9 s# W1 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 z+ @1 I/ I! _6 R# V  N3 ?. O+ v

6 Z- e. y& ?' O" c& D/ s' |7 t0 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: z; ^7 s' g& u( p& z  ?) darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( z  Y1 r/ @* j# \+ z. v! t; Y' c) O% J% |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ g! O8 Q* y9 K; g1 G4 \- J$ A
2 v: {& F+ _& `  m& o

! B2 b- h; c5 u" x) z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 05:03 , Processed in 0.041122 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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