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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & }& B: d) M: ~
  1. [code]EDMA sample test application
    3 |% `& L8 [9 v6 A
  2. /*( J: E  h+ q3 Z2 {0 L
  3. * edma_test.c1 v0 t  \5 V/ {; n4 G- o+ W
  4. *, d* k! q3 X8 D+ J
  5. * brief  EDMA3 Test Application
    1 Q4 j$ p" O/ s2 X# o
  6. *
    $ M- B" X0 c- Y8 }
  7. *   This file contains EDMA3 Test code.. ?; w  }; P, Y  b
  8. *( l9 D- R2 G& q. C3 U/ s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 I0 ~& ^, C: R4 t  A% o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) f' o3 T; K2 v" R2 b
  11. *         TO CHANGE.) P0 }4 e, O) f: `9 {
  12. *
    3 e, y$ i3 V2 I, f5 \7 q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# _# e0 W+ ?2 c3 x/ J# G/ Q" |8 j5 ~
  14. *
    0 E% _+ U6 s) K4 q4 D2 G; Q% p
  15. * This program is free software; you can redistribute it and/or
    : B& [9 _6 F3 x/ |6 T/ Z" G3 g& x
  16. * modify it under the terms of the GNU General Public License as
    1 y! X4 p2 K$ l# m
  17. * published by the Free Software Foundation version 2.
    5 I$ h: q# }7 u
  18. *1 U5 w& l, \/ P7 o7 q6 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * t  U2 `3 N  M) t+ I
  20. * kind, whether express or implied; without even the implied warranty) r* z- S' c' G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % e; `. g# J8 [# W
  22. * GNU General Public License for more details.! Y/ Z; B! V9 H0 M! @: ^; e
  23. */4 b: v' t+ A6 v, ?, _- y+ d" X
  24. 0 v" ~3 {: ^. ?( H8 B; ?$ U
  25. #include <linux/module.h>
    - Z+ Q! O& T/ K7 H4 e/ V7 N8 J
  26. #include <linux/init.h>  E1 [+ L: G7 U7 ?
  27. #include <linux/errno.h>4 k; \8 N" h+ n5 O: x
  28. #include <linux/types.h>- L1 p6 J2 @" ^2 q7 g
  29. #include <linux/interrupt.h>
    % O& {1 {# X! ^& U% ^7 i
  30. #include <asm/io.h>
    ( e1 r  R. V4 B1 O% h! f5 |
  31. #include <linux/moduleparam.h>
      a, v; H- \2 C8 f+ {
  32. #include <linux/sysctl.h>, r* \: b' y1 H) b0 J/ X' G
  33. #include <linux/mm.h>
    ' ~" x" e2 ]8 @- O2 _/ \" R4 Q
  34. #include <linux/dma-mapping.h>( E5 @, w3 [, q

  35. 2 p5 r/ y+ J+ }: Z" O4 x
  36. #include <mach/memory.h>, S5 J9 e! ]7 i/ B/ w( U
  37. #include <mach/hardware.h>
    4 H1 w7 X# I$ t9 b* ~! I
  38. #include <mach/irqs.h>
    % b& j# U8 `7 g1 ]# c
  39. #include <asm/hardware/edma.h>  l( k: D2 N/ M, {' E
  40. 4 K) r: U& ^+ b6 ^
  41. #undef EDMA3_DEBUG
    - H" d9 Q, X- v- _; k/ [
  42. /*#define EDMA3_DEBUG*/% K* _. p! R% Y4 d% X% Q8 |" b
  43. $ K& H0 G6 V# E
  44. #ifdef EDMA3_DEBUG" n" I/ q3 g' r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ u: v2 e9 v0 @2 k- x$ O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , P7 U* C/ n+ f0 ~  L$ K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 {9 [- ^$ F, w, w* [3 |( c/ [
  48. #else, ~8 b' n! A! O& g0 b2 O/ ]3 J
  49. #define DMA_PRINTK( x... )
      ^$ o! D% A: I- h+ Z( ]& i
  50. #define DMA_FN_IN
    # C0 L% e( P9 m
  51. #define DMA_FN_OUT: `7 t. l' O: r1 |' J0 B3 Q& b! f0 i9 l
  52. #endif
    ; r1 I1 I" h7 l/ D, f, d' W

  53.   h5 Y! i% B! O1 l1 B7 A/ ^% |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - ?' ?% O6 ^; S7 \
  55. #define STATIC_SHIFT                3, E: K0 C" v! L+ M
  56. #define TCINTEN_SHIFT               20
    ) Y; d5 Y( X3 U
  57. #define ITCINTEN_SHIFT              21. c2 M- w3 d* `) D1 M9 z
  58. #define TCCHEN_SHIFT                22
    - H2 c5 k% }# E* b; l% U
  59. #define ITCCHEN_SHIFT               23
    ' a8 K& n8 r/ u+ i/ z. s  r
  60. - s/ o3 y* L7 z
  61. static volatile int irqraised1 = 0;
    $ F" @- Y( q  K; M. O0 _
  62. static volatile int irqraised2 = 0;
    , N* o% T/ z( D; Z; l

  63. 7 ?1 @! Q0 Z1 U# a- y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 i3 D" w, e) {+ f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @' [( y$ b# `, R# ]) Z' c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : N3 U& T$ d2 S* u. s
  67. ) g& B2 q6 \/ D
  68. dma_addr_t dmaphyssrc1 = 0;& w$ J: z6 `6 w% z8 S* V3 Y
  69. dma_addr_t dmaphyssrc2 = 0;
      F7 V& a& B; j* Y
  70. dma_addr_t dmaphysdest1 = 0;
    : y% e4 c' M! R  I
  71. dma_addr_t dmaphysdest2 = 0;4 |" z# D$ {( m

  72. ! ^1 V# w8 Y; V4 i4 W6 v7 M
  73. char *dmabufsrc1 = NULL;8 a3 `# p8 q& l# A$ ]$ H) U) |) V2 N4 @
  74. char *dmabufsrc2 = NULL;
    & g; e, \( m9 C3 ]3 v" L6 E
  75. char *dmabufdest1 = NULL;
    9 g9 Q& I! \! s/ F, L) W
  76. char *dmabufdest2 = NULL;
    ' x) v* i- n1 Q/ C7 A+ c

  77. 0 P9 s0 b4 E: z# @6 r- ?, G
  78. static int acnt = 512;
    8 l# b: j6 n7 r: S
  79. static int bcnt = 8;
    $ J# A! |$ f& n7 G2 I
  80. static int ccnt = 8;
    " d+ \' |  G. p( T
  81. % t% [& M( y3 p4 s# u$ W5 k2 A
  82. module_param(acnt, int, S_IRUGO);- x/ U( X1 y% @: a$ u& S( q# b
  83. module_param(bcnt, int, S_IRUGO);* K$ Q# M4 J# s( U9 T2 i4 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) o: P  c, A# |; U  V; v+ l# v  y% \; L4 ~" `( c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 c" J. m$ h! {6 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) A, N6 a% [4 K# l! y0 o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 b  z5 _$ G" \) L6 @8 B# M, }& J) Y
' l3 {  a! `. _0 O) D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 00:42 , Processed in 0.040353 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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