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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # g5 D5 C* O: u( Y. h8 `" m
  1. [code]EDMA sample test application
    ' p* O; l2 W7 n! }
  2. /*! `' i; ]: y1 o" m& I
  3. * edma_test.c; S/ q0 k; s8 w- j
  4. *
    1 q8 e. ]9 H7 I- w8 |( X
  5. * brief  EDMA3 Test Application
    " K! F5 H0 s+ `7 j, a2 q- k: y' @
  6. *2 k6 e# i7 D, b- J: R. d$ e
  7. *   This file contains EDMA3 Test code.
    " N1 V* w, k! `* @4 d
  8. *
    " A; T) r+ d& t/ Q: ~* h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / \- A- x# s% J8 B5 |% s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . l0 H; u; L3 m$ k# t. y1 X4 N
  11. *         TO CHANGE.
    $ {5 d7 {+ j# y$ H* m
  12. *
    & _& `6 t7 ]# t* n# v% e1 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , S$ O5 v$ n2 _2 ]
  14. *
    ; t3 t2 _- L2 l
  15. * This program is free software; you can redistribute it and/or
      m$ N2 r2 {, S+ W7 T" w
  16. * modify it under the terms of the GNU General Public License as
    $ o6 A) X5 `2 d' S1 q
  17. * published by the Free Software Foundation version 2.
    ! z% v0 c5 E, d2 \+ x; y
  18. *
    7 H/ o, t1 ?( p' C- `* ^2 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 e0 d7 I- P% j; @( l: U
  20. * kind, whether express or implied; without even the implied warranty* Q: b, h7 t$ i5 B4 t; ^. F# S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 X8 M1 f! K/ l- |
  22. * GNU General Public License for more details./ G- k& [9 g9 ~" W" o
  23. */
    2 Q, n- Y6 T4 I% [& [# V: h( C1 l
  24. / a: t3 E- T. H0 E2 t" P
  25. #include <linux/module.h>
    + W7 p5 f* W8 K5 }
  26. #include <linux/init.h>6 h8 o- N) x- x4 L7 d3 y
  27. #include <linux/errno.h>
      o0 p( ?7 [* Y3 z
  28. #include <linux/types.h>$ @" U( G8 H& Z0 o- I  E
  29. #include <linux/interrupt.h>
    " B) b8 o+ f, b% Q  H8 _4 K3 F
  30. #include <asm/io.h>
    - v$ d6 c, p/ H* h
  31. #include <linux/moduleparam.h>
    5 P+ l! D" N" j) W6 n8 t
  32. #include <linux/sysctl.h>
    8 H# j) n) P, `  b+ h- o
  33. #include <linux/mm.h>' G0 C: K4 P0 }7 z- |) d$ n
  34. #include <linux/dma-mapping.h>
      \% E4 [; e! w+ W9 O
  35. & t  w) O6 @' Z
  36. #include <mach/memory.h>
    . e% z7 F. X7 J( ~) `# k
  37. #include <mach/hardware.h># K* |1 y8 b; K8 w+ s- B' Q
  38. #include <mach/irqs.h>8 {' S! N: q* w1 o0 S2 [
  39. #include <asm/hardware/edma.h>
      F# z: c5 |+ X" ^1 I6 r3 ]

  40. * z  L3 ?  m4 ]+ f( i  v
  41. #undef EDMA3_DEBUG
    . N" `3 K; Q% @/ n) |
  42. /*#define EDMA3_DEBUG*/+ \/ Y# N# i. `& [8 c* M9 l
  43. ; T* O( E: G6 M
  44. #ifdef EDMA3_DEBUG
    : v: s4 J6 Y( \* [* g4 ^0 B" b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . Q, b! Q# e1 k+ l0 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 C) U# p& G+ y3 f% R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 y1 {/ [7 U( e
  48. #else5 ~% {. k2 E3 E& I8 N1 t5 Y
  49. #define DMA_PRINTK( x... )4 u/ }" t/ g, r3 K
  50. #define DMA_FN_IN' ]- q2 r6 i" o: W- G* R! W
  51. #define DMA_FN_OUT0 \3 j8 w' {! s- a  u& R
  52. #endif
    - E' r7 Q6 E5 y: p8 V% ]

  53. 9 A' }( P1 i" m' }# e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). W/ k, [' k" W: F+ X. F
  55. #define STATIC_SHIFT                3
    : c& n8 C7 i8 g" g8 F. \
  56. #define TCINTEN_SHIFT               20
    5 G! M4 k% ^6 w. C+ E) @( s' O9 a
  57. #define ITCINTEN_SHIFT              21* u6 X; ?5 j2 o
  58. #define TCCHEN_SHIFT                22
    5 p0 y6 [1 r2 A' w5 v
  59. #define ITCCHEN_SHIFT               233 d( ]' p5 G, ?1 z

  60. 3 y1 o7 W/ P* ^1 l) H
  61. static volatile int irqraised1 = 0;
    6 ^) U4 k; s! L  x2 Q( R* W; [( K
  62. static volatile int irqraised2 = 0;: T6 F$ {7 {6 _

  63. - T. ]6 S9 ^. f. z8 l( J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 q; E( `- |% ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # y( F% W: r# Y  V( |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . V) z: B4 m! f" u% _9 W

  67. - H2 h1 C3 }- E9 s! f
  68. dma_addr_t dmaphyssrc1 = 0;
    0 T' e/ C9 g2 r: g6 x. |8 G. W
  69. dma_addr_t dmaphyssrc2 = 0;
    . R8 @/ `8 j! M3 E( h. m* {! ]
  70. dma_addr_t dmaphysdest1 = 0;- y/ y. l: y6 b+ ?' t" Q
  71. dma_addr_t dmaphysdest2 = 0;7 K! {. r$ k# W; ^6 {

  72. , [! s+ m8 I! d& c, h
  73. char *dmabufsrc1 = NULL;
    $ U0 C! a+ `/ b$ g8 \5 V
  74. char *dmabufsrc2 = NULL;
    ' Q* [3 O: H0 a7 [5 A) |$ a% F; C1 q
  75. char *dmabufdest1 = NULL;
    3 H3 r6 W6 n: r, I& U
  76. char *dmabufdest2 = NULL;, I, J  A# m* h( x$ I
  77. 2 P' A3 X9 d! @, g0 U4 _
  78. static int acnt = 512;
    0 O$ j  e! x+ c% h+ g4 q& y* e
  79. static int bcnt = 8;5 s. N8 Q/ K9 v  g
  80. static int ccnt = 8;
    4 V: @+ l8 ~$ J% \: n0 G

  81. ; Y8 V" t! H/ {; `/ W
  82. module_param(acnt, int, S_IRUGO);( U/ k6 ^# j" R: {2 r
  83. module_param(bcnt, int, S_IRUGO);5 m, ?. l8 K. [+ y: w. U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 d: Q1 _7 U$ J5 J" ^
8 H, z  t. A$ c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- W4 a/ S: g, ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 W- {5 A2 S6 o" B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# n! D3 A+ v$ t3 ^( P& a- U7 e# k/ ?. m% T9 P/ W
( w: z8 Q7 B9 ^6 b( E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 10:45 , Processed in 0.042460 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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