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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 \$ s' h; I5 U8 o0 H
  1. [code]EDMA sample test application
    ( f: Q* L; U8 o' F5 N
  2. /*6 S8 i  i* G% _9 F# Q3 k" w7 J/ [) L
  3. * edma_test.c
    5 N" z1 V: P8 W* ^, x
  4. *7 q- {) ], ?" s# u  E! _' F5 C
  5. * brief  EDMA3 Test Application$ m, a7 `3 V0 O; E$ z0 B7 b
  6. *6 F  C6 f. ^9 q
  7. *   This file contains EDMA3 Test code.! q1 P. o; Z" A, N7 c" P
  8. *0 X, c6 o; J. F$ @4 G/ v! T$ d+ x3 J* D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ m: d7 T6 P. a# I, g& \2 m5 K' A4 g6 V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / @' S9 p' f* ?
  11. *         TO CHANGE.4 `. J$ S3 d" J' D* O0 p& q$ |+ {
  12. *4 _. P4 Q& d, G7 N8 z5 b% u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, R8 d4 S, ^2 d0 u4 N' I; b6 v
  14. *7 S% j6 y6 i( }  _) C; D
  15. * This program is free software; you can redistribute it and/or" D6 m  s" c9 q% X
  16. * modify it under the terms of the GNU General Public License as
    / j6 y: a) M0 b0 j
  17. * published by the Free Software Foundation version 2.
    . @9 z" \9 l: [2 A* [
  18. *0 a# }6 W" V0 w5 R2 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 D9 z6 T3 c& V* H
  20. * kind, whether express or implied; without even the implied warranty& \! ?0 i$ B5 _& b+ r# _* z+ k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 r8 `2 {! c& X% E' J" d: t/ z
  22. * GNU General Public License for more details.
    ( n, A, W4 ~" q7 v/ m% r6 i- L
  23. */
    ( _8 M: b; M2 M" _% g

  24.   ?/ V0 H7 a2 c' W: ?
  25. #include <linux/module.h>
    & F$ H8 l/ H$ ?% R' b
  26. #include <linux/init.h>
    ' V+ |2 z1 L( c
  27. #include <linux/errno.h>9 h# t' x8 s$ E6 p# e
  28. #include <linux/types.h>
    6 c) o% o% g: k- s6 F8 x
  29. #include <linux/interrupt.h>
    8 z- {6 Z. n# Q/ V+ p" m
  30. #include <asm/io.h>
    ; t- e. ]& B  z1 x
  31. #include <linux/moduleparam.h>9 W/ C2 J/ V6 o) l& V/ k
  32. #include <linux/sysctl.h>0 J, U" o! ^8 q) I
  33. #include <linux/mm.h>6 q8 l# M' u4 s
  34. #include <linux/dma-mapping.h>$ y1 R: m9 H" [

  35. 0 I2 H. n& p  I% k2 s
  36. #include <mach/memory.h>
    5 ?: D- f: @+ |1 i$ r3 R; ?( ^
  37. #include <mach/hardware.h>9 n, G, z9 P2 I, P& G
  38. #include <mach/irqs.h>
    3 ?& [* ]% k/ n: q! C5 ~3 s' h7 d: j1 n
  39. #include <asm/hardware/edma.h>
      q' {  I& [& m' B& B; l5 v

  40. , p# o  a# q- w' F3 j4 j
  41. #undef EDMA3_DEBUG% S  G: S7 \$ C/ e3 I( v& Y6 R7 |5 @
  42. /*#define EDMA3_DEBUG*/
    " r2 T% M4 T' x" h

  43. # C7 q! D* Z/ M# [0 F; U6 ~$ {
  44. #ifdef EDMA3_DEBUG. t0 C8 \: N1 S% Y$ G" O- F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - T$ C- n8 ^" p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 ]( @/ Y( U2 t& f  ~1 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ ~4 J( M! p7 l4 `8 @5 A
  48. #else
    4 O# o( ?9 O( s7 ^3 \2 p: Q
  49. #define DMA_PRINTK( x... )* Z) `) C! _- }: ?, ]1 t
  50. #define DMA_FN_IN) }! O: ~0 J8 w2 a' ?3 g1 X
  51. #define DMA_FN_OUT& M1 ~: H9 E) a7 ~, s5 s
  52. #endif
    ' f/ A4 N1 I, [- q  N

  53. $ y6 c. u6 Z' n1 @- z7 w$ I9 R" i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * U! ?5 L- _) }& T
  55. #define STATIC_SHIFT                3
    3 \: }6 t- ]$ n6 H
  56. #define TCINTEN_SHIFT               20: i$ h- \/ m! D% G
  57. #define ITCINTEN_SHIFT              217 Z* G) J& E) j
  58. #define TCCHEN_SHIFT                22
    / }# m5 ?: E6 E  K6 e: U
  59. #define ITCCHEN_SHIFT               236 H) }$ s: ]  o) P0 K

  60. " G. G; J* N' ]8 L% m8 i% s
  61. static volatile int irqraised1 = 0;: i$ _  z( x1 ^/ D9 \! b  D3 Q$ r
  62. static volatile int irqraised2 = 0;
    . ~, V9 o- e; {

  63. : D2 v0 m! `% Q! {. C( [4 O0 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : S5 q% N! Z9 ?* ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- N4 d+ _! J5 [+ S/ m0 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 Y6 b$ ?9 }7 P$ u+ j; Q

  67. ) y/ l3 d# i( E' K: C3 u
  68. dma_addr_t dmaphyssrc1 = 0;
    # n( r7 V8 I) q8 B: _  H& k0 H1 s
  69. dma_addr_t dmaphyssrc2 = 0;
    , n- f8 ^& k% g* ^
  70. dma_addr_t dmaphysdest1 = 0;
    - e2 U. q& }4 s9 B& y
  71. dma_addr_t dmaphysdest2 = 0;
    6 d( K3 N% @9 Z7 \

  72. . X# q+ F5 y/ o0 }% [2 Q
  73. char *dmabufsrc1 = NULL;! f1 `# I6 y3 z% j: J; F
  74. char *dmabufsrc2 = NULL;, ]  P1 x7 f4 A$ x. c8 }
  75. char *dmabufdest1 = NULL;
    . w3 b; H, y7 v+ i8 N
  76. char *dmabufdest2 = NULL;
    ! J3 u/ I2 q$ v/ ]! `& W! B

  77. 8 _0 z" h3 x1 J: m. P( \0 n1 {
  78. static int acnt = 512;& ~0 W- k) q2 ]6 y' g+ x. I" V6 ^
  79. static int bcnt = 8;& a/ O5 I' ?& Q' g' ?
  80. static int ccnt = 8;
    8 F+ ]; D) Z' c% i
  81. % U: E: l% D& Z+ Z. x4 T$ W
  82. module_param(acnt, int, S_IRUGO);7 s  Z/ ]; S) {' D) B
  83. module_param(bcnt, int, S_IRUGO);* j. t6 B& J6 }" I/ ?6 g: g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 g9 t# s: s  Z1 H
1 s' W5 ~2 \! F3 p3 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 Q) B, }" l0 z+ p% ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ U2 p& z! T: Z7 f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, l+ v2 F) ^4 |
, r% s+ `  L  b8 n) G  o2 v0 L2 Q8 ~

4 H" x2 N# c: m) J% R- B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-1 15:58 , Processed in 0.039225 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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