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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 p0 _+ z; I& ?+ s* L" [
  1. [code]EDMA sample test application# F+ J; C8 Q; C' b( ]3 V% r& w$ B* o
  2. /*
    ( r: Z) X# e3 V, C3 |" k
  3. * edma_test.c' x( m* c1 @2 A, ~% N3 ^
  4. *
    * @! t8 I% m: a! T
  5. * brief  EDMA3 Test Application
    ' a8 P% Z8 }: _4 _# B% U* E1 i
  6. *- j1 |6 o! ]' s3 }
  7. *   This file contains EDMA3 Test code.' v. c2 L4 f! R( v* _+ ^$ \& ]
  8. *
    & D  t! V( _5 _6 f6 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & g6 {1 o* [1 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 g4 e7 u9 b* t+ X0 y! x
  11. *         TO CHANGE.3 A9 {8 k9 M7 V( z
  12. *4 c; o% i3 P. V, ]9 o* t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, e: h* `1 c" c6 |
  14. *& ~* d) s0 ?$ f3 M& X
  15. * This program is free software; you can redistribute it and/or
    + w1 ?0 b8 X4 t% w, h. p- p! W
  16. * modify it under the terms of the GNU General Public License as
    9 C6 A7 s! T3 [& h4 e* W8 u$ c. @9 ?& L
  17. * published by the Free Software Foundation version 2.
    " B+ k; O. K' d) V+ k+ ?* N
  18. *: r! N1 o' g/ Q! u  K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- F9 E  i2 z1 h8 ~6 u
  20. * kind, whether express or implied; without even the implied warranty, x8 m1 }( f: R/ l0 _2 `0 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 c4 t, ^, T: M7 a/ o
  22. * GNU General Public License for more details., R( N: L+ f8 `+ X
  23. */2 }4 B0 B5 f2 w2 d" [

  24. - k! ~9 c- B$ T9 R8 z, K6 o6 d
  25. #include <linux/module.h>
    ) O  @4 @- K/ H( e, C( h
  26. #include <linux/init.h>
    . M, {+ f+ X3 X" P& x0 u
  27. #include <linux/errno.h>
    : p! s, Z& `" p4 e
  28. #include <linux/types.h>( ]2 g" Q/ @) p/ J/ ]' V
  29. #include <linux/interrupt.h>, e9 m# W4 G3 k
  30. #include <asm/io.h>5 x( F, x2 X& q4 q/ d' K
  31. #include <linux/moduleparam.h>
    , |% w# E) g$ e
  32. #include <linux/sysctl.h>1 K4 [( |$ h! F, z# ]5 V! _# }
  33. #include <linux/mm.h>
    7 X, Z* s7 `; d* U) ?
  34. #include <linux/dma-mapping.h>4 K" z' M3 Y7 ~
  35. : f6 R3 d: v! M! b
  36. #include <mach/memory.h>
    $ p& N/ X% g  i3 s" O6 ~% l
  37. #include <mach/hardware.h>
    0 \$ C4 M& N! ?5 G% y
  38. #include <mach/irqs.h>7 u4 d( o" S0 _! n* z" f
  39. #include <asm/hardware/edma.h>2 j, v! D7 d6 m  E7 y

  40. : g8 J1 P/ s0 [& E
  41. #undef EDMA3_DEBUG
    ' `1 J. `6 b8 c8 N4 F
  42. /*#define EDMA3_DEBUG*/
    - X. B9 f' e7 |9 V

  43. ; O4 @% L  X" o7 C6 v) d! N. `5 s5 n
  44. #ifdef EDMA3_DEBUG
    , R" T5 H- g) e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; K6 [/ D: A% y7 z+ P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ I* w) Z" t! B, {/ q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      c& r8 @% [( f& G& b$ r9 h
  48. #else
    / e& L- m/ v- n& p7 M- H
  49. #define DMA_PRINTK( x... )  r0 M. x% p' [/ z0 \: D
  50. #define DMA_FN_IN
    1 J4 I2 V- o4 @8 i1 _4 e
  51. #define DMA_FN_OUT
    0 h) Q6 f- `9 `  y# E: ]9 [
  52. #endif
    3 x4 F1 Q  T5 [% o  W4 ~1 }5 X) S

  53.   {1 D) P$ L7 g# O* ^& Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 H% g" R. F0 A" d& z
  55. #define STATIC_SHIFT                3
    ( F2 z; n7 k' D8 q& i
  56. #define TCINTEN_SHIFT               20/ j5 ~) s1 y5 k
  57. #define ITCINTEN_SHIFT              218 H  l* A0 A. T: E
  58. #define TCCHEN_SHIFT                22
    - z) E  r) B- t" f1 R$ ?; g" _& \
  59. #define ITCCHEN_SHIFT               234 ]  L  C2 Z/ v. j
  60. ) L7 }5 k, M+ u  z5 m7 N- G
  61. static volatile int irqraised1 = 0;
    $ s, V# K, ^# B& g, z
  62. static volatile int irqraised2 = 0;
    . {  C1 C2 c- T% b/ t
  63. 2 N8 i5 x. K! i6 P! j' U8 R0 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % D, _' W9 l5 a  R0 ?  c7 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E* V4 z% d5 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : X- [) C1 {' o. |. U8 f, }
  67. $ b+ }( v. C. I! L0 A1 C
  68. dma_addr_t dmaphyssrc1 = 0;
    2 }7 k5 P* k; Q) I8 {/ c- b8 N& J
  69. dma_addr_t dmaphyssrc2 = 0;
    + D% V, Z2 }0 A2 P  ~# q. m
  70. dma_addr_t dmaphysdest1 = 0;
    % F- N  T, y# w, `( N/ z0 I
  71. dma_addr_t dmaphysdest2 = 0;  j3 E5 [8 E: g- F2 n' F
  72. & K' Q( f7 P) a. |/ j+ ?* w
  73. char *dmabufsrc1 = NULL;
    " F* I( `# ?+ k4 b
  74. char *dmabufsrc2 = NULL;
    4 m6 u* x" l( j  O) l  n
  75. char *dmabufdest1 = NULL;
    0 T; }( T  X9 ?  p
  76. char *dmabufdest2 = NULL;
    ) B- g, C  `$ u# m9 Z& H6 i

  77. 5 h( \; D* l! L3 Q- V
  78. static int acnt = 512;- K1 b* K1 j/ f% _) f% U' X1 H
  79. static int bcnt = 8;
    ! ^2 \- h' b- x1 D2 `( L
  80. static int ccnt = 8;
    + E4 L9 H6 ]+ L5 C5 J9 C: `  z: e( k

  81. . O: b0 |8 Z; o, S. s( s# s
  82. module_param(acnt, int, S_IRUGO);4 s1 ~5 v# T1 a$ d/ P* F" J! G
  83. module_param(bcnt, int, S_IRUGO);
    8 h9 m; M  q# p/ H  ^- D% i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  `( k6 ?" F8 c: d- x
8 k. F+ `. S7 v1 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# D6 F! D& W; h6 K" G. L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- h3 c' L+ F7 C3 a& u; \/ E  C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% D9 `) r7 r9 ?/ z1 c5 k

( F" U9 L4 t/ M4 E1 p6 S& y# O) ]. P/ I! Q7 f9 [# z$ ~' n' X0 ~. _8 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 21:20 , Processed in 0.038946 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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