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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ l9 _; _0 R" D7 t  c, a/ x, v
  1. [code]EDMA sample test application# B: T; N+ m( j- N! V5 ~" o
  2. /*; G6 M, h- i3 @
  3. * edma_test.c
    8 U/ K4 D, {( \: r/ c6 ~. u) I; B) p
  4. ** ?- ]6 e+ o- D3 O5 h& o3 y0 F5 E* _6 k
  5. * brief  EDMA3 Test Application
    9 t! r* ~1 c3 A- P
  6. *# U& f$ O3 n8 y
  7. *   This file contains EDMA3 Test code./ g% @+ ^* {  U- H
  8. ** Q! S4 I" Q+ X. q0 t) G& F. h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* s' R* O! j5 N& P  C2 i6 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 F5 k6 R5 h/ a1 ^
  11. *         TO CHANGE.3 `  p: t% k1 s  W
  12. *% m5 G/ f6 ]% Z5 _' Y% L9 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 I4 c2 z  ?' C0 W! S
  14. *
    . ^  T# e: T& {3 [9 |) \
  15. * This program is free software; you can redistribute it and/or
    & U9 W6 W  |$ ~, M; [
  16. * modify it under the terms of the GNU General Public License as
      }$ E- `0 p1 ?( H1 L3 f& P/ {
  17. * published by the Free Software Foundation version 2.) I" _; ~! I7 u, m4 q8 _2 {* @
  18. *8 O: W0 x# x( `- ?9 G+ ?5 ~$ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 M' Y# F% j: _% C
  20. * kind, whether express or implied; without even the implied warranty
    9 x; [) g- i7 X+ L; }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' P! H/ ~4 O( t
  22. * GNU General Public License for more details.' g& a$ P9 X2 x6 {* P/ b0 E- n
  23. */
    3 n4 q* [, c& y0 W
  24. # W6 Q; J5 w9 c- V
  25. #include <linux/module.h>  q1 c. `- A$ B
  26. #include <linux/init.h>3 s. P: J  ^3 ~% |2 S. i
  27. #include <linux/errno.h>
    7 y' _: N. `9 ]0 Q# _. A
  28. #include <linux/types.h>
    5 x$ \3 r0 q8 r9 w3 {
  29. #include <linux/interrupt.h>
    ) k* k+ {+ _7 Z# U9 ~. n( q9 K3 G2 H
  30. #include <asm/io.h>
    , a3 I' [+ c: @" K& x
  31. #include <linux/moduleparam.h>
    & }3 b6 v- z) n0 `6 g; D3 o0 a
  32. #include <linux/sysctl.h># w/ s% K8 F& R! {2 g
  33. #include <linux/mm.h>3 X" R' u0 V) k
  34. #include <linux/dma-mapping.h>
    ( G+ ^' k; j1 G/ d

  35. ( {3 [& N& `, c
  36. #include <mach/memory.h>1 B' M$ D* B- Z2 f9 U$ J5 ?
  37. #include <mach/hardware.h>8 ?; @# ^9 Q8 `$ B9 L- P! X
  38. #include <mach/irqs.h>" ^! U* }; W5 e% b% Y
  39. #include <asm/hardware/edma.h>- K+ H& [  t  t
  40. 2 q) h# ]! A5 L: A/ G
  41. #undef EDMA3_DEBUG8 z$ t5 ?. h! {* H
  42. /*#define EDMA3_DEBUG*/
    4 Y: k( M- H& {5 y# ^

  43. , m7 [( S, b" e2 P! V
  44. #ifdef EDMA3_DEBUG
    9 S, p% k' }5 y$ k- ~5 t% Y2 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) u* a& w4 U- A! z1 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 i5 A6 @. i: ^' n4 O6 D; g# a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 l  Q: s4 e6 `
  48. #else
    - g& `# d) b: O# E
  49. #define DMA_PRINTK( x... )5 }+ i4 i6 a- A0 j( G! T( M8 y1 A# |  L
  50. #define DMA_FN_IN
    5 b3 X- `4 t, t, z8 u
  51. #define DMA_FN_OUT
    4 [1 n  V) \' ^, H  s
  52. #endif$ ?& R& i4 ^1 X; y( M. U0 d

  53. 2 Y& b* t; n! `9 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" g) R/ C1 `2 a4 q
  55. #define STATIC_SHIFT                3: D; ]" x$ c: S% C
  56. #define TCINTEN_SHIFT               201 ^$ O: g. L, p# s# [: O! `$ W1 n
  57. #define ITCINTEN_SHIFT              219 d5 L- I* P! `! ~* I
  58. #define TCCHEN_SHIFT                224 V* Y7 |, z1 ~
  59. #define ITCCHEN_SHIFT               23
      p+ i. c0 L3 o! v/ i! P1 q- o
  60. - q$ L  S. F9 c
  61. static volatile int irqraised1 = 0;; A6 w& G2 f$ Y
  62. static volatile int irqraised2 = 0;
    7 t) L$ [+ A6 A. P- C

  63. 1 _' W8 t/ k) {# p. b7 X  A; a/ ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Z6 K2 h4 ^; s2 \( S9 j" A/ y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D) p0 ?1 p) ^2 b% @3 `0 g' o2 M6 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 a: |3 l- ~/ Z) A0 @

  67. 8 s9 Z" t1 N# D: P# `" l
  68. dma_addr_t dmaphyssrc1 = 0;" E" T5 A& C' Y- u) ^) V
  69. dma_addr_t dmaphyssrc2 = 0;
    ! p+ F/ U4 B7 N1 M6 }( a: c  |
  70. dma_addr_t dmaphysdest1 = 0;; O# E, d4 `5 z, [. q3 }
  71. dma_addr_t dmaphysdest2 = 0;
    3 F3 Z2 C! K8 ~5 i

  72. , ]3 e6 ^; T4 A, \* @
  73. char *dmabufsrc1 = NULL;
    * ?; u7 A1 q/ A8 Y
  74. char *dmabufsrc2 = NULL;; K9 A* s) g3 {# i; v5 u0 c5 H
  75. char *dmabufdest1 = NULL;% Y5 x5 n7 b+ [2 W/ [7 Q& U
  76. char *dmabufdest2 = NULL;
    ( G1 L! m5 `- j* ?/ R  x) j- J
  77. , x8 W  N7 b4 v/ t8 y, M$ z0 J
  78. static int acnt = 512;
    / `2 H5 b$ s  M0 X& t6 k- i6 F
  79. static int bcnt = 8;
    % r7 X4 H' i9 x# t+ Q7 i: P4 x, U
  80. static int ccnt = 8;
    . `9 C5 \4 H) H+ U' b7 j
  81. * w9 J; V# C1 F
  82. module_param(acnt, int, S_IRUGO);
      h6 j# Z# k2 L: b
  83. module_param(bcnt, int, S_IRUGO);
    + |+ n5 i! Z" c* x  C1 h+ B, p! u8 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. \, V1 X2 L* T$ k7 X
' ?5 T* f4 D- L# X  x: N' s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 e% N' ~% p, U% E; N6 y# xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# u* j. d8 K3 A. W: p: T+ D( z% r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 i% A. _; H6 S) H- u
+ K# p+ k+ w% ~7 x6 X) N+ R6 @, h; [8 x8 ]' \0 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 17:10 , Processed in 0.041040 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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