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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : D# Q$ g: `5 Y$ J" C/ M
  1. [code]EDMA sample test application
    6 X* ~, W& {6 O4 U( _6 r  t/ r
  2. /*# |& y5 S/ f  D5 ?
  3. * edma_test.c
    , i  Q; {' b+ p# e
  4. *
    : E% e& A& t4 b! e; j, C
  5. * brief  EDMA3 Test Application
    6 R' q/ v; S# D6 N
  6. *
    1 @5 Z/ w, s. y3 t- z0 T  o# d
  7. *   This file contains EDMA3 Test code.
    2 C4 d) |, Y, j
  8. *
    8 `( K! |# N1 z7 M* u5 v) ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % E7 w$ A4 ~8 L8 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; r' b+ v5 U$ I5 o* F
  11. *         TO CHANGE.- x- A1 V+ _0 y9 F0 }
  12. *
    ' Y: C9 B; }) e- K7 v0 |7 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ I8 j, B: H! c; g$ e; e
  14. *
    $ b2 r" W. ~4 R; c
  15. * This program is free software; you can redistribute it and/or
    0 I  {( p1 W  \# r5 R; i
  16. * modify it under the terms of the GNU General Public License as0 O6 m' x. L1 G8 i
  17. * published by the Free Software Foundation version 2.
    5 M) D, J7 ]/ Q: ~  s8 F: u
  18. *% Q" P8 V- ^' |: Y& u% |5 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 H6 z4 C7 F3 q
  20. * kind, whether express or implied; without even the implied warranty
    8 y( w# ?8 ^' p0 k5 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 Q/ M& w7 w8 d' b
  22. * GNU General Public License for more details.% v. U# f& S3 {2 l0 [- ]+ X  |
  23. */+ D2 Z: E" T5 Y6 x7 X
  24. * e7 \0 @' w" {8 D( K/ }3 e
  25. #include <linux/module.h>
    / r+ \5 `; n& y0 f/ b- F; {) h; Q" R
  26. #include <linux/init.h>' }$ Q2 F& {3 {& \8 E
  27. #include <linux/errno.h>
    5 B( H& |7 ~- E+ j$ F, ]  ?3 A
  28. #include <linux/types.h>' d0 P- j$ R- `+ T4 p
  29. #include <linux/interrupt.h>8 l3 G, T. U3 |
  30. #include <asm/io.h>; R2 f8 ?7 Z0 m8 H: \( n/ g1 `3 M
  31. #include <linux/moduleparam.h>& R; E' X! H/ C. i/ |# E- N/ F8 _
  32. #include <linux/sysctl.h>, S' Q* F; B( Y/ a+ ?/ Q/ n
  33. #include <linux/mm.h>8 m8 t( {% k8 p1 f5 S/ v
  34. #include <linux/dma-mapping.h>: p. i4 p8 A( ^+ D0 a
  35. % k! w2 v% U% ]! z  S
  36. #include <mach/memory.h>
    2 |* x+ [  G" o: l/ |
  37. #include <mach/hardware.h>
    / q8 S" A1 C5 J% m! s8 Y
  38. #include <mach/irqs.h>+ m& S: j4 T4 k# F- k; D
  39. #include <asm/hardware/edma.h>% ^4 i/ H* Z9 G* l+ z+ J, R
  40.   B/ A. P9 C! M" G, X5 ~' P
  41. #undef EDMA3_DEBUG* y. z2 |) @- \# ]# R* {4 S& X
  42. /*#define EDMA3_DEBUG*/
    8 e+ n+ @4 b, E5 K; H5 e" a
  43. * B+ b6 f$ s, f. u
  44. #ifdef EDMA3_DEBUG
    ; w. v- E5 G! R& T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + q/ z# v- p3 c/ ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). K% c; r) s+ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % N0 t( r7 k6 }0 _  W2 u
  48. #else" Y* z) x; [" }6 J: X8 P. ?. @
  49. #define DMA_PRINTK( x... )* }% R+ E5 u; ?  U& j6 K$ V
  50. #define DMA_FN_IN3 {, c5 u. U' n! f- V6 ?
  51. #define DMA_FN_OUT
    : m# W5 I) |6 V3 w2 }2 K6 L% [
  52. #endif
    + ~1 N% {" _+ `( J8 T7 k, T

  53. 1 S$ N/ f" [: _/ }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! O0 a) ]) [: @' _
  55. #define STATIC_SHIFT                3. z1 g4 }( H" \1 m! b8 Z2 M
  56. #define TCINTEN_SHIFT               20
    1 r. P8 o+ s! Y$ L4 a8 @5 s
  57. #define ITCINTEN_SHIFT              21% _3 Q/ ], ~' \" W* q
  58. #define TCCHEN_SHIFT                22- K; N) \% H9 _' g, v- Y
  59. #define ITCCHEN_SHIFT               23/ l2 `7 @7 ]3 h& m9 _+ @8 O

  60. % }6 S; X. _3 N5 W( A3 l, M
  61. static volatile int irqraised1 = 0;
    , i; Q6 y, C2 P2 B
  62. static volatile int irqraised2 = 0;8 @" ]9 }! O& }  L$ Y% V/ {
  63. ! S- k+ W* ^, ]$ _" I9 ?( f5 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( `& g4 T9 j- V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' k- {  G6 L4 L7 ^3 j' l' l' A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 W' M, ~2 j. R8 g/ e5 v$ y; t' @

  67. 0 `; l% b2 m$ @" X7 Z* L
  68. dma_addr_t dmaphyssrc1 = 0;0 ^4 x0 v0 q/ h$ @. z2 i4 P) |
  69. dma_addr_t dmaphyssrc2 = 0;$ `2 {: D4 u! |* V2 [
  70. dma_addr_t dmaphysdest1 = 0;/ [% t( q% }; |8 U- E
  71. dma_addr_t dmaphysdest2 = 0;
    & ?4 I. q' I# r8 ]& q

  72. 3 i, m% [) a. t3 T  G
  73. char *dmabufsrc1 = NULL;
    8 w4 Q# |& R6 Y1 H. h
  74. char *dmabufsrc2 = NULL;4 G8 x' }* A. T3 ]& d3 ]
  75. char *dmabufdest1 = NULL;
    $ r& c+ N' y/ J" q
  76. char *dmabufdest2 = NULL;
    8 q- h$ u2 p# a$ @4 \1 x6 Z+ {
  77. / V1 w  X4 s, p2 k3 f. U
  78. static int acnt = 512;
    / u2 F. ]3 n9 A# `: t, `& {+ \
  79. static int bcnt = 8;
    ! J2 Q! _' j. ?! F( L
  80. static int ccnt = 8;
    - C8 y9 N( D! B6 n3 Y( J0 K: K6 k$ ^

  81. ' F* u+ w% s9 P$ |3 v' z
  82. module_param(acnt, int, S_IRUGO);2 n' J# X, `( r! M' t; x6 J  `2 O! e4 T
  83. module_param(bcnt, int, S_IRUGO);7 N4 y. I3 Y; ~" ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 ^& r4 o" I' l# |
0 e2 b; j# s- X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 n& K8 ?+ ?- l& Y7 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& |& c+ I: Q" n5 b: y6 }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" m9 p7 h6 w2 p( t6 P$ {- E/ X% w! o2 p! U! u! t4 k
2 S% ?+ ^/ I, R6 f% U6 n* w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 07:57 , Processed in 0.038972 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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