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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Z% M3 y/ K) U6 V, S
  1. [code]EDMA sample test application
    , ^! S" e: W. A8 e8 c" E- K5 M
  2. /*
    / U  m) J1 F  g) {. }
  3. * edma_test.c
    : N, t8 X2 J) p% f" }! C
  4. *0 E! h# w, k! l; T1 r' {
  5. * brief  EDMA3 Test Application# k" c) R% Y- t! W( M
  6. *' R) l4 d% m: c% e
  7. *   This file contains EDMA3 Test code.! }6 k" j# u: {& U' U1 Y
  8. *$ I' |3 \( h5 P# @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" f* M' l, r. \: ?7 W: o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 c# ~* q8 l+ V) {7 `0 q0 z( _- n
  11. *         TO CHANGE.
    2 m% }5 {5 u' F5 r6 o. y
  12. *
    ! |  N+ l5 z- @9 a5 W" g4 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # m( D. P) _5 G! U' Y! d: c
  14. *
    " s/ X, Q4 K$ U/ w2 g! L% `
  15. * This program is free software; you can redistribute it and/or
    4 X2 U$ u: ?- [* r' J
  16. * modify it under the terms of the GNU General Public License as
    5 l% x' _4 v4 A6 C/ F# K
  17. * published by the Free Software Foundation version 2.) l8 Y: k2 v' L' P9 ]5 j
  18. *# u# O( M1 `# B" C3 g7 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : y2 c, L7 v! h: u
  20. * kind, whether express or implied; without even the implied warranty
    ' X$ G6 N8 M4 q  D9 |7 Z  K9 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; b5 l/ P& u, n- T4 q! Q" o
  22. * GNU General Public License for more details.
    ! W( F" T) H8 t; r
  23. */
    + g$ q' N1 O  [8 S3 t
  24. 3 T. b" _! K% I% |; b
  25. #include <linux/module.h>: y% _1 M/ ?! Y6 Q( o7 n
  26. #include <linux/init.h>6 h6 a/ e; V6 x: d* l
  27. #include <linux/errno.h>. u7 H, O: C9 ~9 ]- z
  28. #include <linux/types.h>
      H  m7 f; m" o$ V( H  k/ H' F
  29. #include <linux/interrupt.h>
    ! S8 E  O0 A$ B8 F, [! [& K
  30. #include <asm/io.h># O& ]: Q' a3 r2 M
  31. #include <linux/moduleparam.h>  {* r8 g2 |5 t
  32. #include <linux/sysctl.h>2 ^* k; k2 j5 h% a
  33. #include <linux/mm.h>& P+ B9 E0 u; m
  34. #include <linux/dma-mapping.h>
    & y: N: Q9 s# D( N. z& _. J  t2 L

  35. ! ~  A; K/ s4 w: W, A8 M
  36. #include <mach/memory.h>
    . \9 z: l; ?" w: r* s8 v
  37. #include <mach/hardware.h>
    6 h! U' R' [9 \0 p% b
  38. #include <mach/irqs.h>4 k. x- w4 e3 U( r3 h+ S
  39. #include <asm/hardware/edma.h>
    : O% g' e( r  I8 g# E

  40. / C3 U/ H  v# F% K9 M; X. I0 W
  41. #undef EDMA3_DEBUG9 _3 ]* X$ ?; n# `1 Q8 c
  42. /*#define EDMA3_DEBUG*/) b8 W' ^* D6 w. }% k, P$ A% Q

  43. ! k  A6 G( V! {* r; P) t6 l
  44. #ifdef EDMA3_DEBUG
    0 I. m' G3 w  Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 ?5 N$ i, i  k5 `6 g* ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . |1 L/ o1 A& Q/ `; O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : b2 m; J2 q5 K5 A6 h9 L, K
  48. #else# d  n+ G' g7 j1 H6 G! @
  49. #define DMA_PRINTK( x... )! ]8 w7 V- r( g  e
  50. #define DMA_FN_IN
    : A! O! I7 ]  W# K/ n- n9 F
  51. #define DMA_FN_OUT  C5 Z3 |$ f5 N" [8 P2 T3 I2 j
  52. #endif7 @" X/ h: y' W

  53. $ b+ }! r4 y; |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; O1 j+ ]9 ?2 N1 R, K8 O6 j
  55. #define STATIC_SHIFT                3
    ; u+ \9 {1 R1 A! u
  56. #define TCINTEN_SHIFT               20  J, D) X. Y9 \4 k( [. ~
  57. #define ITCINTEN_SHIFT              219 q, I- w* b- F1 c: O7 \* g/ v
  58. #define TCCHEN_SHIFT                22
    ' d! B$ ]' n. s7 s
  59. #define ITCCHEN_SHIFT               23
    : ^+ C7 b4 G( f

  60. ( m4 r' u" _! H4 N) w
  61. static volatile int irqraised1 = 0;# B6 S0 b* `& u! x+ S- A" c, W
  62. static volatile int irqraised2 = 0;8 C- G4 r% j" i' ~4 Z

  63. $ O0 w  C& T2 T- ~4 E; b! O/ c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* d! I9 ~( ~2 C0 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' B& v2 R6 s9 w$ C8 k, {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" `6 i, Y+ {) P
  67. ; M0 p- n- z- d# v, a
  68. dma_addr_t dmaphyssrc1 = 0;5 @0 [4 B% T9 i) H8 a
  69. dma_addr_t dmaphyssrc2 = 0;
    * i& ?- Q! g: V/ C6 e  T3 F. G
  70. dma_addr_t dmaphysdest1 = 0;$ R8 Y6 Q3 s1 w+ A
  71. dma_addr_t dmaphysdest2 = 0;2 g5 f# J: H: b3 _( L! T- o1 J% Q

  72. 3 ~  Z; A: ~; A" l  w& m
  73. char *dmabufsrc1 = NULL;
    + d4 W. o  C) {0 |0 ~( ]- V9 V3 {
  74. char *dmabufsrc2 = NULL;
    * l- G. q: d% u# ], v
  75. char *dmabufdest1 = NULL;; H# |, z% n4 ?! j: Q. ^
  76. char *dmabufdest2 = NULL;
    9 g1 p% k& F, l1 t

  77. 8 z4 U" e8 u, s' S) D6 i. o
  78. static int acnt = 512;
    5 T. ], Z/ p1 I; R! U0 B
  79. static int bcnt = 8;$ C. K+ T4 d  f0 Z6 t- a- X$ n+ d
  80. static int ccnt = 8;0 Z& U; Q1 ?; b8 `. P. ^' H4 P( n
  81. ' a& f8 f: M9 w5 F7 w
  82. module_param(acnt, int, S_IRUGO);# g. L# z$ `. i3 x
  83. module_param(bcnt, int, S_IRUGO);6 F9 s& k6 ?  M) s" _& \2 C: O! w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 }2 v$ D3 j1 b; V

2 F" l  Y( T8 \1 G- y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 V4 m5 N; k4 d2 u  ]( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* R/ J0 p. f& i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 D# }4 t7 _# T/ T& j- n
  Q; d2 A0 D+ D1 |! L: f0 j) k
; ^2 p, L( n% g- e2 e1 }9 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-15 20:52 , Processed in 0.041416 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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