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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! |( k7 H! E- E9 O/ A& ?
  1. [code]EDMA sample test application
    ; c$ F/ A! O* ]# Z
  2. /*
    ) G& c, v; A, B+ S
  3. * edma_test.c
    , ^4 t; U; y$ a1 N# F8 g. v% i$ f
  4. *
    & D! W- T7 v* r" j. a
  5. * brief  EDMA3 Test Application
    1 b2 w( v1 B  Z# R
  6. *
    + U; Z& r/ [" Y4 y$ }
  7. *   This file contains EDMA3 Test code.
    , U  f$ U6 X+ i& F. ^  U
  8. *2 J' F" _, x& R; M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( e: S/ R( D  t4 p& ]5 h3 G- d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( T2 d8 W& f6 g7 s
  11. *         TO CHANGE.
    . A6 T+ U8 e! Y
  12. *0 x% f% `! k5 o, L6 ?" u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 [; M7 d8 {$ E6 Q! o3 a( i$ T
  14. *
    % y; |$ a: O. ]* w! d: v# _) i
  15. * This program is free software; you can redistribute it and/or
    7 s" ?2 c! t) q& g) i  E
  16. * modify it under the terms of the GNU General Public License as" y4 [6 ?) u( {6 d8 u
  17. * published by the Free Software Foundation version 2.
    ( H) u0 H, }4 `' u8 n) I* C
  18. *
    % u4 j2 ~; A7 Z# k6 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# _9 |. Z  X6 }3 o& h, l
  20. * kind, whether express or implied; without even the implied warranty
    # n# I" k: P5 b# `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & `  r2 B7 V  S4 P' Q8 e& x
  22. * GNU General Public License for more details.) t# r. R5 {+ Y* k9 x
  23. */: [% ]) T6 Z7 g+ I1 E

  24. 0 B3 @$ j$ I) o0 b- |
  25. #include <linux/module.h>
    ! o  Q9 ]9 c. |7 @( z
  26. #include <linux/init.h>
    5 y) ]/ [8 j1 {0 e: }' b8 p) M
  27. #include <linux/errno.h>
    % M3 M: e% R* b  H5 b
  28. #include <linux/types.h>' f" U& }, _/ a3 v0 s. L7 K' ^
  29. #include <linux/interrupt.h>
    # }' Y$ m$ E" j* z! A
  30. #include <asm/io.h>  K" h9 i6 a( @; d+ P5 M* c
  31. #include <linux/moduleparam.h>
    6 b9 d9 ]) D. f8 l
  32. #include <linux/sysctl.h>
    ; a  J3 C1 U$ J: P
  33. #include <linux/mm.h>, f) H7 R+ Z! l) e, W' Y$ b" b
  34. #include <linux/dma-mapping.h>
    4 U+ I0 @7 u5 S5 r- m
  35. ; Q1 x7 c: ?# K+ x  a+ ~+ D
  36. #include <mach/memory.h>
    ' D/ r) D& ]+ n. P
  37. #include <mach/hardware.h>
    # M( Z8 R0 P" E$ g* ?
  38. #include <mach/irqs.h>
    ) f% w! t( k1 l  z/ p: G' N
  39. #include <asm/hardware/edma.h>
    0 i3 n9 t8 y( @3 z* g$ g/ q; z8 n
  40. 9 @; [- w0 }1 Q2 [! `
  41. #undef EDMA3_DEBUG
    ' ]% k/ ]& j! O
  42. /*#define EDMA3_DEBUG*/
    ) N. a+ o5 U# u. V
  43. " Y. W6 h0 r3 G3 L3 y" k! H
  44. #ifdef EDMA3_DEBUG4 n* v0 U+ v% V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * c. F6 e* U* `9 Q6 w) v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) b1 n6 _8 l. n. W$ f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' t! N5 n# v! {9 `9 @3 V
  48. #else: B! m8 J9 e5 z  W- ?
  49. #define DMA_PRINTK( x... )- G+ W, n" `7 a. m
  50. #define DMA_FN_IN0 `! s/ \5 M. L: Z* i
  51. #define DMA_FN_OUT
    . J: q1 G% r7 f: T
  52. #endif5 g" g! X* o$ S4 A5 D

  53. ) R% C" \) i6 B3 E" ~- a3 K1 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ s! K8 k( f4 J- l; e+ k% x7 S* @
  55. #define STATIC_SHIFT                3
    4 x) Q5 |, A: r+ u# E- E& H7 d7 h9 T
  56. #define TCINTEN_SHIFT               20
    ) E; z) Y* E) n+ Q. N. \
  57. #define ITCINTEN_SHIFT              21
    7 Z" O  C7 G/ K  {- q4 r- o8 w  W
  58. #define TCCHEN_SHIFT                22
    + K* e- |" n( y) |. \1 G* O1 [
  59. #define ITCCHEN_SHIFT               23. U  \4 D0 V' H$ I9 e
  60. 3 j8 b( s/ @& l6 ~! F, B. N" E( K7 @0 N
  61. static volatile int irqraised1 = 0;" [+ O6 N& G2 e2 i9 Q
  62. static volatile int irqraised2 = 0;1 v6 j8 X& F( [! M$ S( z
  63. : q# W! k! m( J% \5 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. B6 ~  F, l. ?- u- {1 j% _9 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 l) Z6 R  [, P& x) P- W, u) p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , H; f+ N# a, T
  67. 3 F+ |$ W9 M, D5 N/ e1 q% U
  68. dma_addr_t dmaphyssrc1 = 0;
    8 w* v4 P3 j. _
  69. dma_addr_t dmaphyssrc2 = 0;
    / T+ b" g* V1 X9 V! W
  70. dma_addr_t dmaphysdest1 = 0;* a# J7 T# k: q( m$ M
  71. dma_addr_t dmaphysdest2 = 0;
    2 l8 s# }# c" C

  72. ( r/ H: \1 h+ W# ]5 \
  73. char *dmabufsrc1 = NULL;# w+ a' X% \- s! B  R5 m& s
  74. char *dmabufsrc2 = NULL;
    - K1 b, B$ q8 B/ o( O
  75. char *dmabufdest1 = NULL;6 k$ U& |* ?1 O* c% ^) B
  76. char *dmabufdest2 = NULL;+ J/ U; i+ U4 K; u1 i9 A, m

  77. , |$ G. n  L6 ~) m0 M
  78. static int acnt = 512;  z; S0 d! g. \9 i) k
  79. static int bcnt = 8;+ L; s  m0 F  \. B/ Z
  80. static int ccnt = 8;- \4 \: k& S& u( L

  81. . F2 o  a% K2 t
  82. module_param(acnt, int, S_IRUGO);
    0 z9 E0 Q# R/ r
  83. module_param(bcnt, int, S_IRUGO);
    / ^4 P1 Y) N0 t, Y7 ?7 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( ?6 d0 y3 z! ]: h! @+ x. m
3 T; K  _9 \# v4 H4 O+ O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ?' u  Y* r2 s/ W; @$ V/ O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  c5 E# @  Q8 R$ t. c6 @" g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  w/ o' ^$ [) \0 W' M) H
! Y9 o7 d/ t, L; G) L3 H
. T) h2 W( w2 u/ u+ n: K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 15:55 , Processed in 0.039381 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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