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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% U; \1 `, Q' ]8 p% ]7 ?
  1. [code]EDMA sample test application
    # _7 f; H4 H* R) R1 y- K
  2. /*
    + X! L6 O: L% o6 h) M- N0 E' @
  3. * edma_test.c( O1 ~5 Q& K, N4 d' _0 S$ ?( |
  4. *
    / A' F8 a; x+ x& B; O* y& h
  5. * brief  EDMA3 Test Application
      o! p: D" T9 ]& R: X- t5 E
  6. *1 v% `. x* @" Q" @
  7. *   This file contains EDMA3 Test code.7 f& v5 y. J4 N
  8. *
    ( I! L' D8 B: b; u5 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: L2 F8 m: N' H, u% _3 {2 |0 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! q3 f! M. Q' L. I* b
  11. *         TO CHANGE.
    5 m# z# C) r6 o% c
  12. *
    : X* P, D* l" o3 c% M; Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      G7 c0 t( S0 ?2 C
  14. *. {& r6 J) t- K  X' S
  15. * This program is free software; you can redistribute it and/or
    ; ]. T9 T( `$ L. a# M9 ~
  16. * modify it under the terms of the GNU General Public License as. W& M& l" z. L' t1 C
  17. * published by the Free Software Foundation version 2.
    ! r! V) p# ]9 ^1 h1 p
  18. *8 b( W' T4 G/ S$ ]1 S  ^1 ?# Y8 E1 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # a6 x- i# o* u
  20. * kind, whether express or implied; without even the implied warranty
    1 {/ e% o9 v2 K7 O/ J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - p# I# P' ]3 F9 [8 Y
  22. * GNU General Public License for more details.
    # C/ \$ @! Q+ G1 V
  23. */
    5 _9 a+ S" ^. s$ N; a

  24.   v/ y/ |$ l( s
  25. #include <linux/module.h>
      j9 e' N- G$ {
  26. #include <linux/init.h>
    ! f+ ]2 \: {2 r  K
  27. #include <linux/errno.h>% }: V; i2 r/ e
  28. #include <linux/types.h>
    " f5 `/ X  F, R) A
  29. #include <linux/interrupt.h>$ \+ [" V" r) E; M2 _/ [# d
  30. #include <asm/io.h>: j* b2 R2 p# m) i9 Q- E6 g8 |
  31. #include <linux/moduleparam.h>  S& ~( c, M% r# q& |
  32. #include <linux/sysctl.h># I8 X. T; Q3 \7 M+ Q
  33. #include <linux/mm.h>+ q! c6 c2 ]+ D+ D" k7 `( `
  34. #include <linux/dma-mapping.h>5 D& |. K4 D; ]( ~& B6 i2 k

  35. 4 K) b0 X- B8 j* G, T4 ^' l" c
  36. #include <mach/memory.h>
    # K& l3 X' W# g
  37. #include <mach/hardware.h>8 \" D# n: `; I! w
  38. #include <mach/irqs.h>8 f( J0 y4 t1 M
  39. #include <asm/hardware/edma.h>
    # i9 S+ b8 Z9 I# z1 O4 O( o+ |/ w
  40. 7 n0 t) }% Z3 z+ q
  41. #undef EDMA3_DEBUG# Z6 ^) V8 |0 H$ i& c
  42. /*#define EDMA3_DEBUG*// g0 C# D( r& ?9 p4 F( q
  43. $ O9 q  b2 ?3 ]
  44. #ifdef EDMA3_DEBUG
    $ j' Q+ Q4 r% h* L1 _' C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" }! b% _. ]3 o( P8 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 ?/ `% x: I1 a  y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 n0 k" {, y( l# K  R' O
  48. #else
    $ O6 ]7 ?: Y& B% e# Q$ k2 w" y
  49. #define DMA_PRINTK( x... )
      G9 G( F; |! L' ~
  50. #define DMA_FN_IN
      K3 ]% f+ ]+ ~" ?. {4 h- Z
  51. #define DMA_FN_OUT
    # [8 ]4 t" V4 R
  52. #endif6 N4 T6 L7 a  ~# H! x, c* @

  53. 2 ?& V* Y4 W8 N9 E6 ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ~% I# h2 G4 g1 _. n) L
  55. #define STATIC_SHIFT                3
    $ m) e8 N* r, l, z: U5 ~3 D
  56. #define TCINTEN_SHIFT               20
    7 h5 A4 {5 e& k1 R8 r7 G9 f% Z6 I
  57. #define ITCINTEN_SHIFT              21
    , A" \9 O) @; F9 Y3 x, H& Y& B2 g
  58. #define TCCHEN_SHIFT                22
    ; I0 f4 E+ ~5 [! Y) n7 `9 e; P
  59. #define ITCCHEN_SHIFT               23
    8 X& {9 G! |, v& A
  60. # u3 m: A& e7 h& X1 K2 n
  61. static volatile int irqraised1 = 0;$ }9 w! V$ s6 O" x0 E+ U7 b/ F+ r% v
  62. static volatile int irqraised2 = 0;
    ; p' g5 D( H1 y" k8 [7 V) M
  63. / g, J/ h+ s% T" q( W" Y2 H2 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) O% b- j7 W9 N, l8 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _5 u# A' G/ i$ |0 `5 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      c6 s; e+ k/ U$ X

  67. , x; T/ Q! Z8 Y8 D0 A! r
  68. dma_addr_t dmaphyssrc1 = 0;
    " ~1 D" @7 @( Z* b( R8 N
  69. dma_addr_t dmaphyssrc2 = 0;) p1 T* ^# h6 v# S0 W
  70. dma_addr_t dmaphysdest1 = 0;+ E$ E! W. O/ A$ d3 ]6 B
  71. dma_addr_t dmaphysdest2 = 0;
    ( H/ J7 A. U, D$ w: b! ~

  72. ( O% b) k& X  V3 l/ O0 m3 G
  73. char *dmabufsrc1 = NULL;) ]# ]9 Y  r3 o, V3 D0 k
  74. char *dmabufsrc2 = NULL;
    8 Z  d+ J9 f8 g/ w- R  R' c
  75. char *dmabufdest1 = NULL;
    ( q; P( C" R& u; Y) T: U
  76. char *dmabufdest2 = NULL;0 U* X( y5 F0 D, a& |# N% C+ n# v
  77. . U3 B$ N% K$ K' X7 U
  78. static int acnt = 512;4 @- ?9 \7 f8 r6 i
  79. static int bcnt = 8;9 o) B8 m% l: U. c* n: i6 @. E7 u
  80. static int ccnt = 8;
    . z' {4 J/ M# H! l5 D  o! P% M
  81.   N( H# N# c0 G: L: r
  82. module_param(acnt, int, S_IRUGO);
    . t7 S  T# Y4 O1 P4 c' J
  83. module_param(bcnt, int, S_IRUGO);
      Z" |) B" K5 W. K9 `% B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( K* x/ j0 }- w( V- x! Y+ _$ U4 m
( X, t5 ?( b6 @- w: T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ K3 \8 G& f% m& b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% C2 `. a$ Y& E( u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! }+ m  ]* S7 r9 K% S% R! {* ]
: N- P, v) N) E" h; v3 k

, c, {) ?2 c1 L+ C7 F+ o+ t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 18:38 , Processed in 0.044862 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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