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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , J3 A1 \4 t; X7 I3 U
  1. [code]EDMA sample test application9 K# M& `( n: n7 N' {
  2. /*
    8 ^+ [1 L( A7 D
  3. * edma_test.c
    " H0 Y0 S: I' o  D1 v6 H
  4. *( X% c% H6 x: a5 ?  Z; y" p3 ?
  5. * brief  EDMA3 Test Application
    6 |" e9 y: Z" o1 d; p4 W( k
  6. *( z, ~  x) r/ f4 Z: y! j  G. o
  7. *   This file contains EDMA3 Test code.: m# ~; h' z& R% M- r& l/ A
  8. *
    ! N1 J  I: P# z! u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / l& o: M+ x1 t1 P; s2 S6 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% T3 V0 C. q" [9 [4 Z1 G+ @
  11. *         TO CHANGE.
    : S% ]: }9 _. {) }& r
  12. *
    5 z* Z- A5 B% t, j+ k: y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 [5 [9 M0 \5 g
  14. *" U+ z5 J* [: s! Q3 }/ k/ n
  15. * This program is free software; you can redistribute it and/or3 ^9 u3 w( X5 V) K  x
  16. * modify it under the terms of the GNU General Public License as" m$ x0 e6 L- @+ k* ^
  17. * published by the Free Software Foundation version 2.
    4 V: z! z2 X6 g' U
  18. *& q3 _/ J: \; O5 ?3 f! F8 V; J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' Y) F0 r2 j0 `, r) _7 q# Q' e
  20. * kind, whether express or implied; without even the implied warranty& h' E0 }. z/ g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" S" {! x5 a; y  a& `0 E5 u6 b! p
  22. * GNU General Public License for more details.
    & e6 d, d8 B9 S4 O
  23. */
    6 N$ m# ~# w! [. J8 q( e6 u
  24. 5 Z6 f, ~+ s( D, r" J
  25. #include <linux/module.h>* c1 c  I. ^2 M
  26. #include <linux/init.h>
    $ W5 y6 V7 L( K" U! g& \
  27. #include <linux/errno.h>7 U# h( l4 R+ M
  28. #include <linux/types.h># K2 @5 M4 q  P
  29. #include <linux/interrupt.h>
    4 i* M6 V) U- r  H7 L
  30. #include <asm/io.h>1 ~' }3 f  K. Q1 n4 w
  31. #include <linux/moduleparam.h>0 x1 c+ v2 q5 r+ k
  32. #include <linux/sysctl.h>
    # |# ~& i2 c+ p3 c2 J2 |# v
  33. #include <linux/mm.h>
    , H2 |* S% _& u( K6 E: k7 Q
  34. #include <linux/dma-mapping.h>
    * `0 C/ C5 r) I$ R$ F& ]
  35. , V( U( {0 }( O. Z# a  ~8 `
  36. #include <mach/memory.h>
    / V1 Y& z/ `% K9 m& A
  37. #include <mach/hardware.h>
    2 Y7 E7 `: ?# y& D' M4 l
  38. #include <mach/irqs.h>
    4 Z3 v& v$ f! l. I
  39. #include <asm/hardware/edma.h>
    & B9 v, Z' U* y& u  O; G

  40. . h9 B, @  P; p0 x( l
  41. #undef EDMA3_DEBUG/ k$ E2 B4 }( I/ w( w" [, ?1 k: g
  42. /*#define EDMA3_DEBUG*/( c& }: @! H# C: b8 Y
  43. % |" }) P7 o7 F$ S3 L
  44. #ifdef EDMA3_DEBUG$ E6 d1 }+ e& t# r$ w% g' H4 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! y; F9 d- z( ?) ?% [0 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 `% f) g  D) Y$ ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 S9 d8 |+ ~  Y# j; ]
  48. #else
    1 S/ K6 p! `6 w( C3 [. {4 K
  49. #define DMA_PRINTK( x... )
    4 u2 T- f* m3 L, ^
  50. #define DMA_FN_IN; {. s( }4 L# K$ c- k
  51. #define DMA_FN_OUT* A9 T  B4 T9 Y& Y7 R
  52. #endif
    9 _+ K9 U. [1 {; j8 A/ ~, _' l  s8 B5 W

  53. 1 H6 o4 q* [' J( x, R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # p8 ?" V1 g7 I1 B' O
  55. #define STATIC_SHIFT                3
    # r4 `  w+ t7 o5 l
  56. #define TCINTEN_SHIFT               20
    " m5 w8 `# f: f$ ?( ^8 ]9 r2 n
  57. #define ITCINTEN_SHIFT              21
    , G7 L! q/ Y* p9 V& O) W% w
  58. #define TCCHEN_SHIFT                22
    5 R& z& ^$ m' ~
  59. #define ITCCHEN_SHIFT               23+ X/ O% l& A# o6 {7 w5 L  V
  60. 8 N* {3 G* g( c6 l. b- \5 P, K/ q3 K
  61. static volatile int irqraised1 = 0;0 z2 P$ s+ ^. ?! @7 \' S8 t9 _
  62. static volatile int irqraised2 = 0;
    9 T+ h& E1 l+ u! q% v( C

  63. ' ^' V. l3 ~! d: j7 T  J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * z0 L  U. D9 r: l& z% ]- i  Y! p+ G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ W; v7 ~2 f5 t6 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 f2 n6 l) y2 o0 Y: s: `
  67. 1 G8 q$ c2 l9 k. m, n
  68. dma_addr_t dmaphyssrc1 = 0;( j3 n/ g8 l5 b1 B. ]/ f9 E8 O
  69. dma_addr_t dmaphyssrc2 = 0;8 V) v+ T  K- X& l  |1 f" |
  70. dma_addr_t dmaphysdest1 = 0;' n, I, Z& K* ]9 G% L4 B& f: {
  71. dma_addr_t dmaphysdest2 = 0;+ {$ ?# C0 ]7 P' d2 ]
  72. + _7 o. l6 p$ p
  73. char *dmabufsrc1 = NULL;
      P) f7 u' e, o* c
  74. char *dmabufsrc2 = NULL;! Z$ H! Q2 @/ `- T! P6 v
  75. char *dmabufdest1 = NULL;: L* A  h; A) W* x
  76. char *dmabufdest2 = NULL;
    % M! N: Z; d2 h6 a& ?
  77. ) g6 i4 c# J" H; S% G' ]' g$ U6 L
  78. static int acnt = 512;1 R3 n2 m) V/ l( g: ^5 D2 o/ J
  79. static int bcnt = 8;" I5 u' r, [  w- X- {/ o
  80. static int ccnt = 8;
    , I0 S4 ]0 H+ g% N

  81. 9 U7 O! @% R+ B. P; {# ?* m
  82. module_param(acnt, int, S_IRUGO);
    # ]* D7 h& t7 t" r
  83. module_param(bcnt, int, S_IRUGO);1 L1 i* u$ y3 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: n9 Q5 ?" r0 ~; V) i
2 l) L' j; w: w0 o7 o  P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: z/ Z% p) A& e/ n+ J  ^: narm-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" v+ |3 }/ W: X9 ^1 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& m7 _8 b: }: J) N- |$ d' C1 h6 Q; Z& o; Q9 x2 ^6 ^  c* A& Y

, n/ G9 N" z1 ]0 Z6 S3 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 06:16 , Processed in 0.039296 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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