OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + N" E+ W+ g+ V8 \( Z5 s& y4 C
  1. [code]EDMA sample test application
    3 T+ [. [" X5 E+ A
  2. /*9 ~* V, k6 H; r' ?! Z/ A& K8 c
  3. * edma_test.c
    , h1 \9 p4 H. x) z
  4. *; w) ]& K* u+ B* |6 u
  5. * brief  EDMA3 Test Application/ O3 T3 i: G9 ?/ I
  6. *
    + n" w. ]9 H* T. N
  7. *   This file contains EDMA3 Test code." T0 O. W; u7 P" O8 M( y+ l
  8. *$ s1 `" r, l5 w7 S8 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' ^$ r) ?: h( G& H2 t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 S' O: `9 O$ Y! A* U  k
  11. *         TO CHANGE.8 ^" s, @+ ~% R( Z! B
  12. *
    8 E! ~: O3 }6 r8 v6 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & z& o& E$ S# H
  14. *9 A" A4 H2 W' G0 v! _" b& y' P
  15. * This program is free software; you can redistribute it and/or( u" J5 Z9 F& B2 O
  16. * modify it under the terms of the GNU General Public License as- g+ r- V# v8 Y7 L5 ~* W
  17. * published by the Free Software Foundation version 2." `7 E: l4 `9 F
  18. ** t  c' M, \8 ^; Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( e% R! m' }8 z
  20. * kind, whether express or implied; without even the implied warranty
    ! \1 u2 s9 ^5 ]6 @  D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % a) B7 i# c! D2 u
  22. * GNU General Public License for more details.1 f, r* V+ s7 o1 S+ |" ?
  23. */
    : U2 T8 J" u0 W
  24. # p) {) y. [# D8 _+ f, d! A& ]
  25. #include <linux/module.h>! h9 @2 Q8 n; r; d
  26. #include <linux/init.h>
    / ]+ y9 \* I& n6 e
  27. #include <linux/errno.h>' K% u) S) e; I" w9 f" K9 [( i
  28. #include <linux/types.h>0 C& b. i# e1 v
  29. #include <linux/interrupt.h>
    8 T) i# m* S! Y4 B2 o  {
  30. #include <asm/io.h>6 N# f. U% @# R2 |" l
  31. #include <linux/moduleparam.h>
    * @8 ]' V1 j6 j
  32. #include <linux/sysctl.h>
    ( f6 ^( |8 T9 v. w3 _
  33. #include <linux/mm.h>
    . b  E% ^5 H5 y" x
  34. #include <linux/dma-mapping.h>- a. N3 h; y0 R& s) t
  35. # t1 z0 ]. E, J+ T% J# N
  36. #include <mach/memory.h>
    . l) D6 l$ A) T2 t
  37. #include <mach/hardware.h>3 y  w" P% B" e& i; d
  38. #include <mach/irqs.h>
    : |; C9 i( A, ?) Y3 `) ^. p
  39. #include <asm/hardware/edma.h>$ w2 L# S! B' W
  40. 7 ^6 H) O% R" S8 j1 y3 N
  41. #undef EDMA3_DEBUG
    - @( W# X5 h. ~( a( q5 O
  42. /*#define EDMA3_DEBUG*/
    . i" m2 a) h- j7 l- V5 W

  43. * v* z4 c& v9 k. }# G( ~) J
  44. #ifdef EDMA3_DEBUG
    2 V4 G. z4 T4 I# R9 p) b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( y3 J$ [% a# t$ M" Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 M) l( ^" z5 I" K  Y9 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) s) D' p1 E2 m
  48. #else. H7 m; Q$ T4 M" Z0 A8 w  s
  49. #define DMA_PRINTK( x... )
    - n6 H4 x! C+ X9 j: e' i2 S
  50. #define DMA_FN_IN
    : O: M, C9 n  C6 F7 C1 N
  51. #define DMA_FN_OUT
    2 k3 D+ G; m& ?) g* I( F# h9 y3 q
  52. #endif
    * M' b, p# O1 x5 Q
  53. / u; W; }) V4 w6 t. L9 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( q3 ^: D( D, N. `5 o* C
  55. #define STATIC_SHIFT                3
    % T4 T0 i' k6 ?2 Z2 Y' r- v1 [
  56. #define TCINTEN_SHIFT               206 ~. c+ I" r. A8 ~$ |
  57. #define ITCINTEN_SHIFT              21
    ) C, P' H" P/ L. f7 a
  58. #define TCCHEN_SHIFT                22% T8 k' Z; I3 O3 y2 |
  59. #define ITCCHEN_SHIFT               23! A  `8 P' a% W+ _. K: f# e
  60. # J+ v6 `8 H2 n- e
  61. static volatile int irqraised1 = 0;
    " x7 r# ^& l6 P/ K- I1 e
  62. static volatile int irqraised2 = 0;
    % k9 s- h8 C: ]5 d6 w" P! m" X7 \
  63. * A1 F3 X# V) B% h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Y) f! T+ l) `$ E0 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) e# {. i  j+ u7 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / c2 v0 w- L5 O4 ^1 B) J

  67. 3 S8 R1 Q6 W/ g& P) |2 O
  68. dma_addr_t dmaphyssrc1 = 0;
    " X, q) R7 }4 @7 b! G/ x. q1 A8 x
  69. dma_addr_t dmaphyssrc2 = 0;7 M! _2 G2 z- `  u
  70. dma_addr_t dmaphysdest1 = 0;
    ( V( r- P6 I- |# S  b2 N# s* o
  71. dma_addr_t dmaphysdest2 = 0;
    0 `+ l' n# T4 W6 ]( X) ?
  72. 6 X* k9 I1 j' T6 I" Y! W; J
  73. char *dmabufsrc1 = NULL;
    3 x3 g$ r! C+ n  J: R" ?% f
  74. char *dmabufsrc2 = NULL;
    1 I0 q5 _& l: g0 }( o+ `. {+ A
  75. char *dmabufdest1 = NULL;
    $ ~$ a# P+ Q$ F% G8 H; U& v
  76. char *dmabufdest2 = NULL;
    1 a2 D  g8 |5 V6 N/ b2 R
  77. , c1 {6 m, p: \
  78. static int acnt = 512;1 I7 {2 o/ K1 D. S: z  I# ]" m
  79. static int bcnt = 8;
    ) P0 r# R- M# B7 @6 V' I& _! A/ J
  80. static int ccnt = 8;
    ! r3 X4 N5 r, K' _5 I1 l( w. ?

  81. $ Q# {; J" q* a5 {
  82. module_param(acnt, int, S_IRUGO);
    2 s! [- ~! p; \4 I& M' t) V* ~+ A
  83. module_param(bcnt, int, S_IRUGO);% Y7 T. C4 z+ e' r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( ^7 _. j7 K" M5 ]# P1 t7 T$ ^

& G( q3 ?$ g( ?& @# B) X8 V4 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  Y; `+ N; I5 d. R. U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 W. O5 `( d2 W5 d1 H$ y  M( t, I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 `4 ], d3 p- c5 r
9 k" d; U( j/ B6 l7 Z$ O, R4 d& |- ?* b! C9 Q; w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-7 21:59 , Processed in 0.037045 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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