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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 U! J) [. D/ P. d1 f
  1. [code]EDMA sample test application- p! b5 I0 x; q4 p, {0 R' X
  2. /*& y  G0 O' q. Y8 f# R; G% J% g
  3. * edma_test.c5 r- \1 n& O* I
  4. *
    , V- }) n! O. q$ E
  5. * brief  EDMA3 Test Application
    1 x- Y4 I; q6 \4 Z" E
  6. */ B3 l' b$ Y" [7 L9 N' {, @
  7. *   This file contains EDMA3 Test code.
    , i. T: d4 o7 l3 W* k
  8. *
    ( P) P+ J0 S6 D# `( [( M, S6 O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" _/ `) U+ D8 s  l# |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) ]1 g0 t/ L) y, }6 g& e
  11. *         TO CHANGE.$ b9 `* ~6 ]3 L; I8 ^( ]
  12. *  j: h/ t7 v4 a7 t; b. M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 A& E4 A# p' c' i4 k
  14. *
    " I, p- u3 A. h1 A  o" T
  15. * This program is free software; you can redistribute it and/or
    6 t, t) ]0 \0 W2 ~
  16. * modify it under the terms of the GNU General Public License as! f& O/ ~$ I- x/ h
  17. * published by the Free Software Foundation version 2./ v0 a; r  K+ K. s
  18. *% C  a$ U, x9 e1 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 n+ q6 Q' x% K
  20. * kind, whether express or implied; without even the implied warranty0 n0 D: B. J# W/ Q  ^" {4 Z1 y, u9 m$ H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- }* J& Y3 v/ C; a2 Q9 c4 z) E" Z
  22. * GNU General Public License for more details.2 U) ^/ R9 P# v4 O5 h: J/ x6 @
  23. */! X9 e- m! w2 e2 R* P- T
  24. 1 x" x6 C8 F- H) N. K( e* @$ b: l
  25. #include <linux/module.h>
    : W  U4 @- N; I3 \8 A2 |! k
  26. #include <linux/init.h>" _; n/ {) H2 g
  27. #include <linux/errno.h>$ Y. j* p3 `) c- p& D  n
  28. #include <linux/types.h>
    ; w6 t+ _1 c5 U3 ~% L- g* g/ Q2 k
  29. #include <linux/interrupt.h>
    ; B8 X1 \+ Z  @# W: ?
  30. #include <asm/io.h>
    8 i5 [/ q1 n- d: w, Z, S
  31. #include <linux/moduleparam.h>
    : d4 c/ ^# b; j  r4 ?) `9 B, x' w
  32. #include <linux/sysctl.h>
    % n+ b; C6 b/ F, X
  33. #include <linux/mm.h>! j' c1 s( w; k8 Q
  34. #include <linux/dma-mapping.h>
    ) S3 C5 n0 d5 ^6 s

  35. " G% O1 S" S/ E5 N/ c3 ]6 t6 l
  36. #include <mach/memory.h>7 O+ h7 G1 s( z: A% P
  37. #include <mach/hardware.h>7 v8 Z4 S( h  I
  38. #include <mach/irqs.h>7 N7 B, A# \: T; W1 v6 ?# v
  39. #include <asm/hardware/edma.h>( x: Q0 b$ L/ C, j% c, h' @

  40. 9 z! L0 Y! O# T& _
  41. #undef EDMA3_DEBUG
    , ~# g/ Z) d' E1 y
  42. /*#define EDMA3_DEBUG*/
    " S- l; y( J5 U% t

  43. ) y; o6 ~$ B$ @% o2 X
  44. #ifdef EDMA3_DEBUG7 k2 _2 k$ g* ?1 `/ `; K: N# z5 E0 Z. }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 M5 t: [+ S+ U" H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 ], k. x2 c$ O' F) @- N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 _4 I! x: D) f' R- p- B! u
  48. #else- W7 a5 B/ a$ \0 @
  49. #define DMA_PRINTK( x... )* @, ]; F5 U4 O# O3 b
  50. #define DMA_FN_IN7 a% ^& x/ [1 X. U
  51. #define DMA_FN_OUT
    * `: L8 d! J& J# l7 H- t9 a
  52. #endif, h! T; H( P, w6 }

  53. % R# k& [# m8 {+ ~; R# F8 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 P" h* A% e, N
  55. #define STATIC_SHIFT                3
    ; Y! Q# P1 n+ P$ b) C2 G( i
  56. #define TCINTEN_SHIFT               203 _9 y" r- q8 {# t. t
  57. #define ITCINTEN_SHIFT              21( `+ f8 Y1 f4 V+ H5 W  K3 ^" M; d
  58. #define TCCHEN_SHIFT                22+ `4 c% h+ E: y# b& v% z
  59. #define ITCCHEN_SHIFT               23
    0 L" X; p- z+ g) k& u2 N5 w  {+ g9 d

  60. + L- ?0 T7 @' f  u% U2 U
  61. static volatile int irqraised1 = 0;
    ' ~! p+ h; \- A# B1 @/ A7 ~1 T. z
  62. static volatile int irqraised2 = 0;
    ) ]" `. k" S4 p  E) i3 @

  63. + ^9 k5 ~1 }4 S# V! x* P+ @" r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) b5 D! S/ Z, \! D0 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - x; v* Q$ [, \5 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 e# U* d& H) E4 R$ P
  67. . j1 u* Q) f. H' X' `7 O4 i2 G
  68. dma_addr_t dmaphyssrc1 = 0;6 _' r  q& p  ]% d7 G9 C1 w
  69. dma_addr_t dmaphyssrc2 = 0;8 y2 @$ U5 B4 m6 F3 P
  70. dma_addr_t dmaphysdest1 = 0;% X8 @1 K; _  z& a  ?
  71. dma_addr_t dmaphysdest2 = 0;
    ) S4 J3 g3 Z0 W# j2 }6 E
  72.   G6 J% _( J$ y# h; [7 ~  T
  73. char *dmabufsrc1 = NULL;% \# y8 y0 u  w  T+ q5 w
  74. char *dmabufsrc2 = NULL;) X" j" j$ ?. {4 j
  75. char *dmabufdest1 = NULL;
    , M8 s! q: x9 D' L
  76. char *dmabufdest2 = NULL;
    + J" w' Z/ J# k6 k. P" v0 P

  77.   W% f: }0 ^$ s& f3 l
  78. static int acnt = 512;
    & r7 I8 Y, I2 ]" h' k' ^
  79. static int bcnt = 8;
    3 W4 k: v( ]- e9 ~" w: p
  80. static int ccnt = 8;2 ~. d6 ]4 x9 H; g; @9 X7 J* ~1 l# l( A
  81. & ^& K& V) y& E
  82. module_param(acnt, int, S_IRUGO);0 R$ O" x) U  J+ F0 u
  83. module_param(bcnt, int, S_IRUGO);
    0 V% X7 v; N& E. K. @6 U- J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 v  b' F- @. ?% s/ N
  k1 Y" L; t; K+ C. |+ b* ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 c+ M! K- j  c: k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; y" i& D0 v- B: M; v9 R5 j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 n/ D) l# @! p& E- Z2 P+ L! k3 D- U( e- a3 b5 `
" `4 B* k7 ^0 P  v2 }$ D- z) m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 06:18 , Processed in 0.043802 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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