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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( P4 X' B6 a0 O8 c9 N
  1. [code]EDMA sample test application5 B% K( Z0 {5 R% i. n6 V
  2. /*
    * r, q! C, o( t. H# f* `- s& Z5 B
  3. * edma_test.c
    5 f% w- p6 |. u; y* \1 l& Y* z1 T3 P
  4. *2 D+ s5 Y# M* y- G) [6 l
  5. * brief  EDMA3 Test Application. V5 y/ l; `3 ^* H! b
  6. *1 c8 _" s. `7 U! Q
  7. *   This file contains EDMA3 Test code.' m4 y* m* j# ^' z; A2 i
  8. *: d# B+ W( A2 `  m' [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; X# e8 [) G  j# H7 m6 F  s* a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 H5 \7 a5 |' S/ \8 t/ r/ n' g9 t- \& O
  11. *         TO CHANGE./ D( ?* l" d% ?2 ^( O: U' K. X
  12. *! d% z( |* p0 ~7 Y. {0 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- \2 ]/ f% J0 G2 M8 x
  14. *
    ) I' N. h6 F! _* x% o" a/ T7 F
  15. * This program is free software; you can redistribute it and/or
    ) F, w& B3 {5 z2 m3 m, B
  16. * modify it under the terms of the GNU General Public License as4 U1 g1 R1 N1 E/ Y  _3 z: L& y( k3 ^
  17. * published by the Free Software Foundation version 2.( Q" l, i. t4 `5 E, A* i
  18. *
    , U+ o* K8 k" B3 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: H$ j# o7 K  Z7 T8 p
  20. * kind, whether express or implied; without even the implied warranty- f' c8 ^5 g4 g/ G1 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 L# R/ {- i3 ^7 Q
  22. * GNU General Public License for more details.1 O6 d" W9 J$ ^6 g, f5 i6 K3 b2 O0 y6 S
  23. */7 r$ U% Z7 B1 k. ?2 {. X  `! N- P
  24. 2 D0 @* X! F, y" C3 t& I
  25. #include <linux/module.h>
    : l8 P  x3 {) o" C* O8 N8 p; q
  26. #include <linux/init.h>
    4 F0 m4 |9 p: T0 E
  27. #include <linux/errno.h>
    0 Q% K* ]2 E- X: S; J& L6 _
  28. #include <linux/types.h>
    : t( E) B" r5 u8 Q
  29. #include <linux/interrupt.h>
    $ M) ]6 Q0 K: o/ I% C1 F0 B; R. m
  30. #include <asm/io.h>
    ! x) H* C( D' E7 i  h
  31. #include <linux/moduleparam.h>
    ) n- e  ~. V/ q: r
  32. #include <linux/sysctl.h>) E5 _7 k: T4 _. J# N* \
  33. #include <linux/mm.h>
      J3 N, m" P2 r  h2 k% F$ P, |" `
  34. #include <linux/dma-mapping.h>
    , ?- r: `- K* x$ j0 Z

  35.   b4 x4 f5 i" b: b' m2 m
  36. #include <mach/memory.h>( `1 A( z5 G0 K. T: X& y
  37. #include <mach/hardware.h>
    8 y$ y/ W& Q; n, A3 }
  38. #include <mach/irqs.h>) n& C% A+ m# i1 x* \
  39. #include <asm/hardware/edma.h>
    ' W, N+ A  U. X* t( M
  40. 2 ~: y( R$ C, {+ s( l
  41. #undef EDMA3_DEBUG
    $ N. K" x* H3 t( C- s) J
  42. /*#define EDMA3_DEBUG*/
      w5 V& s5 g0 ~1 ^( a

  43. ! P6 ^: d/ w% `" X
  44. #ifdef EDMA3_DEBUG8 h( {5 O8 s- A, o( B2 b6 q( Q9 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 K4 f; y" D( d, D& d) `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , u1 {; d' H( M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X0 s. b+ C1 z; b
  48. #else
    ' k: Z/ |+ @9 k# y# W9 I
  49. #define DMA_PRINTK( x... )5 C% C, a8 A# ^" r' n8 }' P
  50. #define DMA_FN_IN6 A# z- J$ p! R
  51. #define DMA_FN_OUT, _) J, P, Z: }' `8 E; t
  52. #endif
    3 F8 L" F: Y0 z1 m
  53. 4 O& _  d" V' J7 d" e; f  M: Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 `3 T" m& z! E
  55. #define STATIC_SHIFT                3
    ' ]: j& y7 {" ^! Y9 R
  56. #define TCINTEN_SHIFT               20
    8 |" _0 f+ I+ ?0 l5 [# e
  57. #define ITCINTEN_SHIFT              21) ]& U) A2 V. P& T5 m: }
  58. #define TCCHEN_SHIFT                22! h% }8 U. K- m
  59. #define ITCCHEN_SHIFT               233 x" F( S( g2 Q/ u+ E4 E5 h

  60. 9 A" c9 x  y, L. Q/ E3 r# v$ }
  61. static volatile int irqraised1 = 0;3 \5 h+ N5 Z0 T6 ]9 x8 h* M
  62. static volatile int irqraised2 = 0;) ]3 N& m8 v9 [' G
  63. - f& n5 @, Q/ \, A  A+ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J# u0 v* ?+ f& C: T* L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ n  V; z7 }" o9 ~8 F" o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  c6 c$ G& L* N3 K- l

  67. ) f5 W: i! ^" Z7 t
  68. dma_addr_t dmaphyssrc1 = 0;
    ; Q. i; e  F9 Y$ b/ y
  69. dma_addr_t dmaphyssrc2 = 0;8 y) E2 c# v% z( E& U1 o$ `
  70. dma_addr_t dmaphysdest1 = 0;
    , L6 z$ f6 f8 ^2 Z
  71. dma_addr_t dmaphysdest2 = 0;8 `  f6 K8 D0 D! c% d5 u

  72. % v; |3 x7 `3 u' |
  73. char *dmabufsrc1 = NULL;
    . H: U: ?- _. Q/ G& Z/ y* Y
  74. char *dmabufsrc2 = NULL;" R% v! x7 Z5 y( y2 m1 b$ U
  75. char *dmabufdest1 = NULL;
    7 [0 Y- [* V/ g' P/ u& Y
  76. char *dmabufdest2 = NULL;+ `- \: E  t  _5 ^( f( R2 u
  77. 1 j/ ?! H8 @/ s, \0 [& E
  78. static int acnt = 512;
    , C1 a) L5 i; q( J) b/ C
  79. static int bcnt = 8;2 c5 V) `+ ?+ ~- w) r
  80. static int ccnt = 8;6 E4 m4 F& X1 r

  81. 2 F+ J/ @2 H6 y' n
  82. module_param(acnt, int, S_IRUGO);
    : x& q; m" ]/ d( D8 k' {
  83. module_param(bcnt, int, S_IRUGO);' i* X' l* a* C8 U8 _. H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& M- M! r6 Y) A3 B5 N& F: T3 d) s" g. n' t. A: l" s9 ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 t$ k* H9 U' |) l: Q) {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; h' X: t. S* T/ e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) h& Y) Q& F% _" R& r. l
* O9 r, _1 z) m: t: m

: N- T9 m; Z% G5 {+ o, z- A2 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 08:10 , Processed in 0.041144 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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