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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; N' d' {. ?' R; E. v1 Y
  1. [code]EDMA sample test application
    " K' R; Y" M; h) g% K5 ^
  2. /*
    & ]  M: i" \1 _; a3 ^1 j1 E
  3. * edma_test.c0 k( h6 \8 @; w6 ?
  4. *- e2 k4 D& S6 G; y9 J2 f9 I6 Z, f
  5. * brief  EDMA3 Test Application
    + Q+ W' H* {/ J9 F2 d
  6. *
    4 q; p7 n# b% c/ g5 [9 K7 ]/ j" _0 @
  7. *   This file contains EDMA3 Test code.7 p, h" D6 y) Q+ ]3 z, l! q3 A# x
  8. *
    - e$ }5 d; S- y1 s6 n4 U' _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; f3 B& D1 F' \. U, W, t5 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 n' n* G6 {/ \9 j/ ?9 H' Z/ i
  11. *         TO CHANGE.+ H! i: A- s/ P+ U$ F  t1 C, v
  12. *, s+ B: U8 ]; J) L# X9 z+ j# u+ {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( w6 n9 W2 h2 [8 l) |/ g
  14. *0 C, G' M* @# S- o$ X5 P4 y4 A
  15. * This program is free software; you can redistribute it and/or' g; ?. r& G0 ~
  16. * modify it under the terms of the GNU General Public License as3 j2 I$ o- [, m' b/ h! ~7 d" C
  17. * published by the Free Software Foundation version 2.
    ! j- F( E( G# E( A1 m
  18. *
    8 m5 h5 Y5 o4 l( W" ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 t' g4 Q7 C* c5 S/ E5 ~8 w
  20. * kind, whether express or implied; without even the implied warranty
    ; u3 [1 s4 _4 s- L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- I0 [) h! J3 e& m& U$ }* Y1 W. A
  22. * GNU General Public License for more details.
    & T3 u' c. c5 |
  23. */2 b1 I7 [; D" C; C) }

  24. * t3 n/ D$ q# I) A
  25. #include <linux/module.h>4 m1 X5 ~9 z' c! k4 V, a
  26. #include <linux/init.h>( i! u1 v4 j4 |/ E# ]2 @  [( l
  27. #include <linux/errno.h>
    / [  E4 ]% p+ }2 c
  28. #include <linux/types.h>
      e: l$ ^$ v0 s# g7 `  Z8 x, `
  29. #include <linux/interrupt.h>* C4 f) S4 g2 F) w
  30. #include <asm/io.h>' F; Z8 l9 S$ n5 l" B$ X
  31. #include <linux/moduleparam.h>
    ! y1 S+ v& Q0 ~- M4 E
  32. #include <linux/sysctl.h>5 d8 ~7 O0 S7 L% g+ D4 x/ O
  33. #include <linux/mm.h>
      ^# f2 y: x5 s8 B" [
  34. #include <linux/dma-mapping.h>7 d/ N4 I- W0 Y/ ]( I

  35. ) Q3 I4 T, J1 @
  36. #include <mach/memory.h>
    ; \: ~+ Q' j8 a
  37. #include <mach/hardware.h>
    8 Y, Y. I. J7 a9 f; o
  38. #include <mach/irqs.h>6 g( j% R" _' m( \) U
  39. #include <asm/hardware/edma.h>
    : a- {% n5 F" g# b% ?

  40. * s" [  Q( ~6 U( n+ Q
  41. #undef EDMA3_DEBUG
    3 R6 n9 P- ]5 ~# P1 Y( z" ?) y
  42. /*#define EDMA3_DEBUG*/
    - D$ F# `4 S/ d; r' ^& b. f

  43. - k& ]' J& a) I0 n6 K/ [
  44. #ifdef EDMA3_DEBUG" f" P4 ?9 ~$ g2 F, l/ M* s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " E! w- r+ f7 s! W/ R% c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; N) B8 t# `" @6 f7 m, k- q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 J* d  g. v' X5 h& x) ?- d6 _. s
  48. #else
    8 N, }& `! h2 j7 P! X# ]
  49. #define DMA_PRINTK( x... )9 N) P" _6 z6 ~# o
  50. #define DMA_FN_IN5 \) @5 _- S; C* X3 n! n
  51. #define DMA_FN_OUT9 a2 |1 S: ~9 V& m# ^. ~
  52. #endif
    4 X, {) ~/ `$ I

  53. . g2 e- M6 d+ F. |! s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 f* C/ E) u0 }" R1 k/ w* |
  55. #define STATIC_SHIFT                3: E+ Y8 C- k3 f- q; Y/ b" F
  56. #define TCINTEN_SHIFT               20
    2 U/ p* k8 B# K. [- J& g6 ~3 D
  57. #define ITCINTEN_SHIFT              21& R. H) Z! ?; R: C% v
  58. #define TCCHEN_SHIFT                22
    ( n' ?' I/ B; z' T# @. z$ \  g6 V
  59. #define ITCCHEN_SHIFT               23& n! E4 \2 i$ \* \
  60. : f# E4 \7 X0 i' u) e0 s
  61. static volatile int irqraised1 = 0;
    4 ~6 {9 z3 ?5 T( \2 E; |6 f
  62. static volatile int irqraised2 = 0;% x& s) S! K  a$ L" {+ D
  63. 3 ]9 r2 Q# L* g: q1 Z( c0 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # t1 X5 K; ~' N" I8 Y1 c/ m8 W# r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Q: T9 c: o2 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / C' A1 N3 M+ ?, ~: f2 ?. N

  67. 9 i3 O3 F0 G: c: y4 z
  68. dma_addr_t dmaphyssrc1 = 0;
    6 c7 A' I- m8 Y9 O  W% s
  69. dma_addr_t dmaphyssrc2 = 0;. j& ?2 H. z9 V' K/ V3 Q
  70. dma_addr_t dmaphysdest1 = 0;8 d9 u- g' }' Y, e' c9 C% U
  71. dma_addr_t dmaphysdest2 = 0;1 Y; E4 |( ~1 S# T( b/ f/ F
  72. 4 l8 O% v& K7 S2 Q+ F0 i: k; F
  73. char *dmabufsrc1 = NULL;- S% L5 h: g8 A
  74. char *dmabufsrc2 = NULL;% C* y* ]. K1 c
  75. char *dmabufdest1 = NULL;' S6 i1 L. R8 Z0 D! R# H2 e
  76. char *dmabufdest2 = NULL;9 B* K( i" w. f# V( v$ M% r

  77. ' a5 _: D# Q0 @( `7 z
  78. static int acnt = 512;6 ~% Q* N- q" {3 l
  79. static int bcnt = 8;/ ~  h( ^$ y7 y, H5 W7 {( W- s; M
  80. static int ccnt = 8;3 }2 v* r) P* G- C2 L6 Y  i

  81. : j" B! d  L; g/ j4 `5 R2 a
  82. module_param(acnt, int, S_IRUGO);
    # _5 m. s/ O. D$ `& U/ l
  83. module_param(bcnt, int, S_IRUGO);* F4 L* `. O4 r$ y* V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) w, t" y/ z" F; J' G& `/ Z
2 y/ m( O; R0 N% U1 G. ]; B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( T* R6 I/ g8 c2 Y6 U; M; B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ o. \% Z$ L4 E% @4 B+ K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  D' c4 s. O  U0 t7 B$ _8 g3 R/ Z) c

- ?" T. y& s$ c9 f- p6 X$ L7 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 11:27 , Processed in 0.039872 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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