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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% N* v: I( O/ l0 z" H/ A
  1. [code]EDMA sample test application3 ^0 B: y9 B2 E( P; w* G
  2. /*3 P6 d7 d. _& s
  3. * edma_test.c! P7 o# F4 g7 I+ Z0 \
  4. *
    ) h5 ^% v3 i7 b! z8 ]) O
  5. * brief  EDMA3 Test Application
    8 h7 H8 Z5 X& K+ |9 q% Y
  6. *
    3 t1 z, F* `) O; ?! ^; p
  7. *   This file contains EDMA3 Test code.
    ! C0 @  E8 t! j) N3 _
  8. ** B, ]9 ]- V& L, A1 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" C, M% s" |5 x4 e" I, D/ z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . c/ l! w9 R# E/ _) j7 @6 \: y' V
  11. *         TO CHANGE.5 ~- b, j* ~* B8 o6 E
  12. *
    1 x+ l2 [( t- j/ ^9 ?: E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' `. Z  Z/ `" s! R2 T" E
  14. *  j: {# g. e% k5 K; R2 \
  15. * This program is free software; you can redistribute it and/or1 x2 F5 p; }8 ?! ^! ^
  16. * modify it under the terms of the GNU General Public License as& L$ I# V& A% @7 r5 F& v
  17. * published by the Free Software Foundation version 2.5 s6 E0 M% O3 G- Y2 d% y- c; [0 Z
  18. *
    1 ^' K" H8 `4 @3 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( @3 `. n$ x  ?% I* A' ~( H1 q
  20. * kind, whether express or implied; without even the implied warranty
    ) m# w+ @  n: g5 e" Y3 E4 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% h5 M# O7 W: Y2 A9 p1 `4 }9 G
  22. * GNU General Public License for more details.9 n7 t+ A3 b9 W
  23. */
    ! x7 y  M9 n% v
  24. 3 \7 i; _$ h; P$ q" _+ {
  25. #include <linux/module.h>
    : U: H; o  @* Y+ N5 B  |
  26. #include <linux/init.h>; O4 Z+ ?0 l5 E' Y7 u
  27. #include <linux/errno.h>
    4 _7 B- ]8 C/ g% R! J6 \
  28. #include <linux/types.h>( b, j: a% Y, `) j$ z
  29. #include <linux/interrupt.h>: E! `4 b0 ^" j. n
  30. #include <asm/io.h>7 ]0 a0 i' J7 l" K0 ~( d
  31. #include <linux/moduleparam.h>
    6 g, m( _* A* I* v
  32. #include <linux/sysctl.h>
    # F; c0 b0 k( z
  33. #include <linux/mm.h>
      F$ v+ W$ K% s  r) j- `# c3 ]
  34. #include <linux/dma-mapping.h>
    + D; _! [. Q6 `# a
  35. ! J; y+ h6 p4 Z
  36. #include <mach/memory.h>; G( h* u! p5 g' O3 G! R
  37. #include <mach/hardware.h>
    , ?3 b7 }. ]8 L- |4 V6 n
  38. #include <mach/irqs.h>
    % r. N: z+ N) H3 Q4 F
  39. #include <asm/hardware/edma.h>
    # x: M( K  h# f

  40. & S4 k5 Y1 |0 G( o* o0 o
  41. #undef EDMA3_DEBUG
    / X4 f! j* W2 X6 W5 ?% r
  42. /*#define EDMA3_DEBUG*/0 Y% t$ p7 L) H; q  W

  43. / a" [; [2 [- ~5 ~$ L  Y
  44. #ifdef EDMA3_DEBUG
    " z, r  J# z* U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 x$ Y) K  [! c' m8 o; B' x8 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); O% j' Y. f& S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 A5 X% g& ?  l8 ~
  48. #else
    0 D* Q  h5 A+ k  v6 G, Q( |
  49. #define DMA_PRINTK( x... )
    ! ^/ I5 ^0 w+ {: F
  50. #define DMA_FN_IN
      |- h- Z! x- M: N3 r8 `4 ^
  51. #define DMA_FN_OUT) i# `. `6 z8 Z2 A0 e' ^
  52. #endif  h9 U* g5 g) \. G( ]

  53. & F2 j7 O1 l5 U! C3 f- Y% L* u, j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 l, \8 i  h- i0 {+ K; \
  55. #define STATIC_SHIFT                3* j  y/ @  O. {
  56. #define TCINTEN_SHIFT               20
    0 ?0 i' f& Q3 b7 }% P
  57. #define ITCINTEN_SHIFT              21
    ! G3 r) W% u3 C( b, c
  58. #define TCCHEN_SHIFT                226 O9 J' r  b# h+ g! J; x! {
  59. #define ITCCHEN_SHIFT               23
    4 {) C7 `* w% J1 g5 h; Z' U1 n2 R
  60. / ~! C1 b2 y2 ~. s& g
  61. static volatile int irqraised1 = 0;
    0 n! N8 z- C, J$ G& c" h
  62. static volatile int irqraised2 = 0;
    1 {+ z, l- L: T3 s

  63. 6 n" t4 W$ \7 \; F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * K4 c! z0 F7 W1 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ]" M; Q3 {. o" q0 d+ D! s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 j* N( `: f' t, g2 j5 N
  67. 1 l& y# }/ h% T  r3 E
  68. dma_addr_t dmaphyssrc1 = 0;0 D' D4 F/ w7 n, ^9 l
  69. dma_addr_t dmaphyssrc2 = 0;# v5 w( P$ P+ \' s' _5 U
  70. dma_addr_t dmaphysdest1 = 0;
    ) N' _# o' ]4 o' c( l' }7 S7 R. g6 d
  71. dma_addr_t dmaphysdest2 = 0;
      o! a1 U7 M; p2 Y1 ]! {
  72. $ G# m, T: n/ A: ]
  73. char *dmabufsrc1 = NULL;0 ?- d# c) u' e" @1 }
  74. char *dmabufsrc2 = NULL;: ]# \# C( r. C$ |
  75. char *dmabufdest1 = NULL;
    . S  W" c6 G0 F6 [0 _" k3 K' ~
  76. char *dmabufdest2 = NULL;2 T- v5 E8 @# T& s6 X' J. s. G
  77.   D2 n- F; _" A! Z( g- N8 _7 O% V/ j
  78. static int acnt = 512;  ~. {# T- a' R6 a
  79. static int bcnt = 8;! o: C0 C8 g0 Z
  80. static int ccnt = 8;
    5 l  I$ p0 u" a1 I5 s0 K

  81. & l, ^5 L9 A( o( `: t, x) K
  82. module_param(acnt, int, S_IRUGO);) I2 A+ B, X; s; l! u. q7 D! G* C
  83. module_param(bcnt, int, S_IRUGO);
    7 o& }5 ], k7 s1 E! g8 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, A) v0 y& h' P2 E
$ r% F  X. Y5 K8 u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* p2 f6 c8 Y9 G' I" Karm-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: G& S8 {* \( V! t7 \$ z8 p2 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' o) s* {1 g5 F% l7 g4 ]
* h" J+ z& ^; o$ L9 y5 w+ @/ x0 ]$ S! F1 p- F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 22:29 , Processed in 0.041480 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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