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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / ^* r# k- z. n! ?8 O
  1. [code]EDMA sample test application
    ) h8 F0 l$ ^5 p  N6 m
  2. /*
    # w  D6 f9 z8 E) G0 C
  3. * edma_test.c; c' {6 ~  ]  A, ^7 A, y4 U- o
  4. *
      J1 t- d( L+ H" H& L( _
  5. * brief  EDMA3 Test Application
    9 X0 Z: R) S& v# h
  6. *6 C- w9 Q0 P- h" ?9 F5 x
  7. *   This file contains EDMA3 Test code.& x! U) m7 ?0 x+ [
  8. */ y% W- V- i( @# C: k9 U" v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 C$ S5 p  S& F0 [( _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' W  N* l( `1 G8 Y4 l8 U- m
  11. *         TO CHANGE.
    + q8 k0 v7 Q' s2 \* h0 ?
  12. *
    $ W' i. ^4 \6 m# }& E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % r' }6 L* `3 p6 p9 s  y3 @
  14. *
    / N6 M4 H9 V" |" W6 _6 y
  15. * This program is free software; you can redistribute it and/or
    4 i+ E( x3 {7 Q! u" }% A2 h  i0 d
  16. * modify it under the terms of the GNU General Public License as
    ( H/ i; R5 m( w) H6 r/ l- |' P
  17. * published by the Free Software Foundation version 2.
    # U0 {! {4 `# u
  18. *- N& [+ y$ F+ L! P1 J  ]  Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      O( c' I( t; ~% j
  20. * kind, whether express or implied; without even the implied warranty
    " K* t3 W3 Y: k7 l0 S6 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 I% [) d% \3 d
  22. * GNU General Public License for more details.$ E7 }! W5 |& `$ Y+ H9 \
  23. */: E1 Q; c( ~% \0 a0 p- ]
  24. + K) D6 n/ O& C+ I; |
  25. #include <linux/module.h>
    $ [& d/ Y1 ]! ~; A; @0 K
  26. #include <linux/init.h>
    " G! v4 L& ~- A, R, D; a
  27. #include <linux/errno.h>
    7 J+ q# f+ F; U2 }8 N6 C( z  c
  28. #include <linux/types.h>3 M9 O! t9 o, \/ i1 H# p* q
  29. #include <linux/interrupt.h>
    $ }( i+ o1 I  C& v
  30. #include <asm/io.h>
    % ?; F( F7 }- U$ ~/ m3 ?
  31. #include <linux/moduleparam.h>
    8 P7 h: O# K) w0 v6 F, Q
  32. #include <linux/sysctl.h># _; `/ W. z# Y
  33. #include <linux/mm.h>1 i# m! O9 `# L/ O
  34. #include <linux/dma-mapping.h>
    $ B6 o3 q! N' L" k3 O( {8 m
  35. & r* E, D! K9 o$ h% o( D
  36. #include <mach/memory.h>. j+ ~* x0 d, b( f, f3 X: o- d3 g
  37. #include <mach/hardware.h>
    + |( c' {8 l- p0 k$ [5 z
  38. #include <mach/irqs.h>' l- d! w$ b# K8 o; m! r
  39. #include <asm/hardware/edma.h>/ }$ R9 r  I. s* a, M9 ]+ `
  40. 7 K* ^: }, t. ]0 |, ^
  41. #undef EDMA3_DEBUG
    - P  s9 [6 a, O- l3 S$ @
  42. /*#define EDMA3_DEBUG*/. m: r" t# M" \

  43. * U! v* B$ o4 F. u7 S/ s
  44. #ifdef EDMA3_DEBUG) K) G# p7 [3 o/ y8 f4 a. H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - s; p# |, V) S+ a/ d( @, ]$ X( I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! W1 Y8 u$ t+ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 _' o1 O+ \) k7 u* o# _- T
  48. #else8 q: |; \% L* h6 ]" Y- m8 g" o
  49. #define DMA_PRINTK( x... )
    ' q# x: `) `4 t. \
  50. #define DMA_FN_IN! K" K8 `+ I' d6 f0 h6 i
  51. #define DMA_FN_OUT! P( y. {+ n; U3 p8 o
  52. #endif% j) D9 r0 a& Y4 Y, t
  53. + Q1 Z# X& l0 r4 J! r: k0 t; [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ R) `  y9 ]8 |5 X
  55. #define STATIC_SHIFT                32 ~+ n/ [( O4 z' E
  56. #define TCINTEN_SHIFT               20& \! @  `+ H* I' e' N
  57. #define ITCINTEN_SHIFT              216 y  g- H- n1 a' Q9 ^- k
  58. #define TCCHEN_SHIFT                22! i+ V. y0 w5 ~1 V2 _2 M2 }
  59. #define ITCCHEN_SHIFT               235 d) D( }4 ^3 u$ n3 N, n

  60. ( f# v' c0 n- v# Q* A  P( ~' S
  61. static volatile int irqraised1 = 0;0 m! V! i" G' o* c* A( Q1 S; V, U
  62. static volatile int irqraised2 = 0;# R' C* F3 Q, q9 p, A9 K
  63. . S* v, f; R% V. ?) Y% `* B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 V) L7 Q; u, A" U% c) [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Y8 p0 X# }( I# r1 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 D8 Z: [6 B1 P- j" m5 M$ g

  67. 1 F& Z3 \* Z9 C. V. z/ F
  68. dma_addr_t dmaphyssrc1 = 0;$ R1 y* X, `4 c$ Q6 ~
  69. dma_addr_t dmaphyssrc2 = 0;  J* c6 @3 V9 C5 }5 y0 c4 {' V, ^
  70. dma_addr_t dmaphysdest1 = 0;. D+ Z1 b: i& a3 ?" D% o* s
  71. dma_addr_t dmaphysdest2 = 0;8 D( ?& O( K( _# [: @
  72. 5 _1 N( k9 E" [5 W. u, d# |+ G5 q
  73. char *dmabufsrc1 = NULL;  f9 D$ r' f$ a8 E8 |/ b( Q, D! ^
  74. char *dmabufsrc2 = NULL;/ r. n1 [% L4 R
  75. char *dmabufdest1 = NULL;
    0 r. m6 t4 M; E$ K/ n
  76. char *dmabufdest2 = NULL;
    ; a! y3 V5 Z2 K. k- t- R: z4 y& E. X" i

  77. / |' r) ?( J. p% @
  78. static int acnt = 512;
    3 `  o" s9 E, ?8 u9 A: x) P
  79. static int bcnt = 8;
    ; P) i$ M9 y. l
  80. static int ccnt = 8;+ l2 L" v! c0 o0 R& P
  81. - X4 Z3 x# |$ k  Y5 G7 W
  82. module_param(acnt, int, S_IRUGO);; g0 B* y  j* P) E/ y
  83. module_param(bcnt, int, S_IRUGO);
    7 r5 k8 q) I8 S1 [) f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 H$ M2 T2 Z" X* l2 G* c: R

% H; y( Y" s- }# S- g$ X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 B9 o0 K$ d  Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* n) b  i; d$ \  c5 g- W0 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 d: ?* K, R2 p9 [* |& a5 ~
( }- @. k7 y% d6 F
! C+ b6 t$ W3 o& Q, q: W2 E6 \! |7 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 00:31 , Processed in 0.039089 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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