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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' M2 A( Q* M# M  @  g: N" B+ H
  1. [code]EDMA sample test application
    & K% N  H$ i6 y* e6 k7 y
  2. /*
    1 B6 _5 P; N6 z
  3. * edma_test.c
    ' W+ y. R. D) m8 C7 Y2 O* e
  4. *
    4 e+ ~2 z5 B9 j
  5. * brief  EDMA3 Test Application. {% Q. R2 l9 N2 S$ z, n; p
  6. *
    0 s6 G: G0 p- V9 ^/ }2 Y, M
  7. *   This file contains EDMA3 Test code.
    * q" i8 f, M, L5 ?
  8. *
    6 s% z- J, ~; n5 Z2 a* m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 h2 [. y( y7 i  `: Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; V; U5 s7 V: l' T
  11. *         TO CHANGE.
    % s; z3 z5 @0 f8 N5 U1 F0 w) i+ V
  12. ** O$ S. h( }' |) h7 }1 e9 H6 T# J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- n2 w1 U! f0 U( `) h- ^" f
  14. *6 T0 G0 @+ i1 a, Y0 Y' @
  15. * This program is free software; you can redistribute it and/or. V! J4 k; X% A3 p
  16. * modify it under the terms of the GNU General Public License as/ A. U) u% O( V
  17. * published by the Free Software Foundation version 2.% `+ K: R" l  W% i& G
  18. *' i9 F1 X  X! |% |8 H2 O, \: L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & [  K0 D+ G( W9 d" c( r: v- V2 v8 x
  20. * kind, whether express or implied; without even the implied warranty
      v9 `* n9 `' D. M  i- z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 }, C4 K) z" l- P* W! Z& B- ^
  22. * GNU General Public License for more details.8 ~7 X' P, }$ e% ]
  23. */
    2 ?$ V) n) p% w) y1 F" j! B
  24. 8 k- Y3 R. B- K! D4 ?
  25. #include <linux/module.h>
    " Y( H& S/ v$ f" y% X. ]. f4 I
  26. #include <linux/init.h>
    ; h8 ~+ K0 Z. H; Y# e# p6 E
  27. #include <linux/errno.h>
    : c3 r, E; I: H* r; a8 _
  28. #include <linux/types.h>  P  N1 E' v2 \1 c( \. j3 \' F
  29. #include <linux/interrupt.h>. x5 ~4 C' J* T  I+ Z0 s9 R
  30. #include <asm/io.h>) V! q; w1 U' _2 p6 L
  31. #include <linux/moduleparam.h>
    ( S- O0 l1 A( {3 [
  32. #include <linux/sysctl.h>
    ( J- R+ |8 i" ?- d/ ~
  33. #include <linux/mm.h>
    ! @, K# a3 [; w+ S7 _, u! ]/ a2 ?
  34. #include <linux/dma-mapping.h>9 a- }! m2 [& x+ ~' F" @9 q

  35. 9 q" D7 G  C5 S  L2 X6 t3 `
  36. #include <mach/memory.h>
    & M! t5 u" B) K# R4 L, }
  37. #include <mach/hardware.h>
      Q2 k  ~( M7 h8 R5 F
  38. #include <mach/irqs.h>, r" e( ]4 r- i/ K
  39. #include <asm/hardware/edma.h>
    ' T4 K: k6 ^  F" V$ F

  40. 2 z; D, i# D8 I) X7 H
  41. #undef EDMA3_DEBUG
    4 i( i$ |" l7 N; ~7 `
  42. /*#define EDMA3_DEBUG*/
    * c. i1 m3 b: G6 b5 z

  43. * u& S4 a$ z" x
  44. #ifdef EDMA3_DEBUG
    2 n) `% m( e3 J4 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 ^! _6 R. C$ ]6 v- o1 `" z! A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; M3 b4 t  G# f' h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): h: g1 c+ }" C; ?
  48. #else
    ! E0 P$ H* b  w" v! h; s
  49. #define DMA_PRINTK( x... )
    ! t. E7 t$ |9 V* B
  50. #define DMA_FN_IN
    8 o# I) t- c) h$ v
  51. #define DMA_FN_OUT
    : K$ B' n) m6 r3 j" T5 |  c* l
  52. #endif
    , Q$ U6 ^6 n5 u& O2 {

  53. + `4 x: b, Y7 r5 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% T- O6 u5 q- T" {% c: B, o
  55. #define STATIC_SHIFT                3
    * u- h; a) u5 q  K$ m* R
  56. #define TCINTEN_SHIFT               20
    0 c; m) ?0 [: }5 M: f$ H! u
  57. #define ITCINTEN_SHIFT              219 j+ I9 `% _! |7 A/ w" y# \! A4 y
  58. #define TCCHEN_SHIFT                22
    : Y# }* u% ~0 B# k5 g
  59. #define ITCCHEN_SHIFT               23
    * j7 O) A  q) Q% _+ X! ^
  60. ) b# j2 R. x; L1 q! o% @8 P9 |1 T
  61. static volatile int irqraised1 = 0;2 z- n; w3 q* ?7 ?+ @/ W
  62. static volatile int irqraised2 = 0;
    ( L7 \1 D. |0 z' L
  63. ) B' M7 A+ Q+ C7 y) W0 o! i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 k5 o+ V; v3 y5 l. u; _1 j5 k. z. Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, U3 P1 W! N7 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 v& s( Q! e( }& p  m2 V3 {
  67. 7 s8 @1 y. e7 a8 H; }" d
  68. dma_addr_t dmaphyssrc1 = 0;
    * s! h; t6 g7 k6 i
  69. dma_addr_t dmaphyssrc2 = 0;- z, ]! c* U6 n. y0 v
  70. dma_addr_t dmaphysdest1 = 0;
    , O; w+ T, T+ ~. E5 |
  71. dma_addr_t dmaphysdest2 = 0;( r1 I4 C4 i. ~5 H
  72. ; G8 z, \9 n- G8 K% z
  73. char *dmabufsrc1 = NULL;
    7 r# F7 f1 B# Z: F) S; g& f9 }
  74. char *dmabufsrc2 = NULL;
    6 C/ G, V, n8 E9 v% \
  75. char *dmabufdest1 = NULL;
    . L" A) C. [+ e% F8 F0 Y
  76. char *dmabufdest2 = NULL;
    3 b6 X6 ~/ y. w1 u( K. I1 t3 \

  77. # {  @, K5 m% o6 m; X  [5 y
  78. static int acnt = 512;$ t' K0 Z! n+ N! P2 F% |& j* A& Y
  79. static int bcnt = 8;6 m* s4 }$ C2 F; r  I! b
  80. static int ccnt = 8;
    2 p: K* o; S# F# U

  81. ( Q! D" |/ @: P, c7 Z% {0 D! _- m
  82. module_param(acnt, int, S_IRUGO);0 x1 Q4 E: P: e8 S2 y
  83. module_param(bcnt, int, S_IRUGO);% F1 y3 Z5 |1 Q  Z8 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: ]- L* S$ h7 {/ J# v0 W$ r
& ~% @5 E- _0 g1 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 q; I1 }$ z  E( E7 s. q! r, W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! f& ]- J# F' @9 a3 X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  v1 a& V$ b: B* d
8 D3 v. v! e+ x9 E# `" Y
; u( x& n7 |* c; W) D+ q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 06:16 , Processed in 0.039331 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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