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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 g, Y% L% L% F
  1. [code]EDMA sample test application$ h2 V4 l* P$ I$ ^
  2. /** X2 i, n8 p  a3 I8 k
  3. * edma_test.c
    + h6 @: [2 d; E" }$ T6 P$ ?
  4. *
    1 s. F0 E" V! q, v- V# q
  5. * brief  EDMA3 Test Application
    ; b" `( V% H$ l% I5 Y5 ^$ B
  6. *
    ! X9 p! f8 w. q( k9 ]
  7. *   This file contains EDMA3 Test code.
    - S$ B  E5 f. O) A) P! a
  8. *
    2 K8 I" M: @7 R/ z" V' Q6 J  K! F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # O6 J& _( Z/ d3 Q) p- \, f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " V. G9 R, Y9 \/ f* c
  11. *         TO CHANGE.) t; z& b9 W  @& X& e1 t# V
  12. *
    , \7 c# ]- ~/ _1 l! Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// A8 d* Z4 ~/ x+ q  U
  14. *
    ! y7 S9 G9 A4 l" j
  15. * This program is free software; you can redistribute it and/or6 R7 t4 z1 I# i2 {: Y/ l
  16. * modify it under the terms of the GNU General Public License as* p& f  p9 U3 J1 ~, c! ~3 [
  17. * published by the Free Software Foundation version 2.
    ; M0 @! v1 {0 l4 H6 T) c
  18. *
    ' c* ~" V* z+ g3 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 d  m; ~# |& n/ g1 f$ E$ D" |& d. P
  20. * kind, whether express or implied; without even the implied warranty- O! ?! I# n3 M, x% k; U; u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% M) P* k3 S( Z3 m' s
  22. * GNU General Public License for more details.
    . G" v3 o& g3 t# E
  23. */
    $ w& h% P( v0 ]2 ~2 f

  24. - q' \1 h, r, F+ u
  25. #include <linux/module.h>
    6 b8 w+ Y) @3 U
  26. #include <linux/init.h>
    ; n% o9 Z' {$ v; \3 F: _# P9 |. X
  27. #include <linux/errno.h>: @" p. I, D' W+ u
  28. #include <linux/types.h>
    7 h8 b! @, p5 h0 |
  29. #include <linux/interrupt.h>  p# p' B, \4 H8 L/ T. A4 b8 K1 i# R# I
  30. #include <asm/io.h>$ D/ \+ t( G. g. m" r
  31. #include <linux/moduleparam.h># Y0 J0 `& p; t$ Z9 Q
  32. #include <linux/sysctl.h>! c7 `9 s' W5 |- l: q8 ~* i2 O
  33. #include <linux/mm.h>
    . K5 D# s* K( x2 C8 w7 d6 ^
  34. #include <linux/dma-mapping.h>
    - k3 k0 W7 n+ @

  35. " t' M8 l" d5 p1 s
  36. #include <mach/memory.h>
    / s' ]  `6 [; u9 r" w/ n
  37. #include <mach/hardware.h>
    1 G0 |5 @2 c3 b: Q4 c
  38. #include <mach/irqs.h>. @, U- X8 {4 o
  39. #include <asm/hardware/edma.h>% f) A3 _' J0 m) Z

  40. ! l" X  R+ r, B1 y
  41. #undef EDMA3_DEBUG$ b% c% u5 J  Z: U2 E! P3 s
  42. /*#define EDMA3_DEBUG*/
    ! c6 S& c" X" Z" Z
  43. & [2 [9 `* p) f- M& C, x8 o
  44. #ifdef EDMA3_DEBUG
    $ C( k( q9 i& j, B6 j3 K* u/ r& x2 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 i, F! _5 b; E" s# e' U* j1 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % Q$ t8 Q0 I: y& q* G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % D1 Y4 P2 l* s; \* H. Z
  48. #else
      ?+ S3 ]5 h# M
  49. #define DMA_PRINTK( x... )0 m% y2 X( o' {, u+ {" _; @! e0 {
  50. #define DMA_FN_IN
    0 i* b$ P( n2 {$ n
  51. #define DMA_FN_OUT$ x% Q4 R* G- T4 G0 h. V
  52. #endif% N9 O1 ]( c4 j

  53. ; O. T6 C& j0 \: Z6 n5 S9 g$ l. B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). |% |9 t/ N! |% Q
  55. #define STATIC_SHIFT                3& u. j, M+ K  u
  56. #define TCINTEN_SHIFT               20
    - M/ I5 F6 H& o! B5 v, d; {
  57. #define ITCINTEN_SHIFT              21" w% d4 t% P" c- q5 T$ M' a
  58. #define TCCHEN_SHIFT                226 u- z  C1 M, p3 j
  59. #define ITCCHEN_SHIFT               23( w, I: \* p; V" B. @3 x' G/ Y

  60. 6 h! J% w8 k" [" ?
  61. static volatile int irqraised1 = 0;
    5 H% m. j6 R. Q
  62. static volatile int irqraised2 = 0;0 e  p& H7 M1 M7 T( q

  63. $ j, K$ d, U1 `# \& Q# h; C7 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 [0 h# E* o" @( k, M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& T: Q/ H  m6 Y$ r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R6 \2 y4 D. I+ F) Y. l

  67. 7 ]/ a+ x' G, a5 G5 a
  68. dma_addr_t dmaphyssrc1 = 0;: F, m, s: h% C" }! H) P
  69. dma_addr_t dmaphyssrc2 = 0;8 _1 _( m3 I/ W. T4 N: h' [
  70. dma_addr_t dmaphysdest1 = 0;, Q3 ?7 N2 N) }  _
  71. dma_addr_t dmaphysdest2 = 0;: X1 @. N2 y/ W) K1 r  l& z) k( b+ y
  72. & F* B" y5 E  l/ e, E- x( K
  73. char *dmabufsrc1 = NULL;7 Y8 I1 `7 D0 o4 O$ b; s
  74. char *dmabufsrc2 = NULL;( D* q/ }8 b" g) T
  75. char *dmabufdest1 = NULL;
    7 H( n% L5 a! v7 e$ L2 d! [; i/ Z
  76. char *dmabufdest2 = NULL;% @9 \( C$ f! u8 J# u  Q

  77. 5 R9 H3 v( ~' E) l2 g
  78. static int acnt = 512;6 c2 l* \% i5 Z; m7 U- m# d/ T
  79. static int bcnt = 8;; y, W% M4 q* Q
  80. static int ccnt = 8;' q5 c0 C) ?9 ]. u0 r
  81. 8 t; N0 l: L" m
  82. module_param(acnt, int, S_IRUGO);
      |4 |. |2 D+ {) q
  83. module_param(bcnt, int, S_IRUGO);
    8 g8 k9 |( C# ]8 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ y3 A! i3 s. }0 t: ?; t7 p8 p
% n( [" s4 B3 J1 j& k9 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: D9 C. h# w& T- }/ S; z" Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ Q8 h% @, A, v) N$ `* c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 N% o/ X" O& ^  ~8 P1 I+ j, k$ Q# w7 \2 M- o* m8 e& l

" G! u0 U% m! }" E: w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 03:33 , Processed in 0.039201 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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