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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& |: ^! d' V( n! c
  1. [code]EDMA sample test application
    3 X& G3 \; _+ z( O. a
  2. /*
    ( o/ [! Z& Z& i" I: h% C
  3. * edma_test.c
    : G/ Q4 F0 ~6 a$ `" y& ]
  4. *5 c1 K2 `+ Q8 j2 q; g2 p, V/ D8 b$ y
  5. * brief  EDMA3 Test Application
    1 i3 {- M/ N  D! i6 f  J' K
  6. *8 y" U/ h6 j% ~$ S  {1 R5 F
  7. *   This file contains EDMA3 Test code.) [* W. u( b! h& `
  8. *. X, p/ I& {/ \# {. B) r9 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 w/ F; h% T; x, n  c! l6 @* Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& I1 {8 X3 F& K+ ^; H
  11. *         TO CHANGE.( Q1 I* m4 q! G9 q( f
  12. *% O( r; M- a' n* j* m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( H  k+ x. f4 r/ o
  14. *
    2 o1 e% E3 a. x; x: C( f- {
  15. * This program is free software; you can redistribute it and/or6 C$ k7 E: l! D, m- p% `
  16. * modify it under the terms of the GNU General Public License as
    $ K5 X5 f2 U/ l1 o
  17. * published by the Free Software Foundation version 2.
    1 @- O3 X$ }( w7 [* L  M
  18. *8 s% u5 e- `2 K6 s2 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% }; {+ p) s; i' ~7 u$ c
  20. * kind, whether express or implied; without even the implied warranty
    # l, _. D( E! i. I+ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 k. P* Q9 ~& e9 d. e( _
  22. * GNU General Public License for more details.
    3 }8 j4 c# x' s5 l, H6 Z9 ]3 W" A
  23. */
    0 p  b( [: E; `5 R

  24. & |1 ^4 }  F5 Y$ n8 h) D6 [' t
  25. #include <linux/module.h>/ T) Q! B3 B' T4 E0 `
  26. #include <linux/init.h>
    % i9 S9 b9 s& `+ a; ]8 ?% ~
  27. #include <linux/errno.h># M0 q( P; l1 `, m& N) n& u: }
  28. #include <linux/types.h>
    # h: k$ ]- z: l+ E6 B% X1 E& \
  29. #include <linux/interrupt.h>
    + o# e* S1 y2 Y( N! \
  30. #include <asm/io.h>9 m+ I' \9 q: C- O( m: y
  31. #include <linux/moduleparam.h>
    $ S7 Q2 D) ^2 d1 }7 B: U/ V
  32. #include <linux/sysctl.h>9 h, U( N) z- i# H+ |
  33. #include <linux/mm.h>
    8 m5 P5 C: d% Y( G1 Q
  34. #include <linux/dma-mapping.h>
    / ~8 Z; p' k& {5 o" [7 z! w
  35. " \: j+ m) U* S* [; U: J7 d
  36. #include <mach/memory.h>
    5 o3 u. m3 X3 x4 D1 A9 m; A) y
  37. #include <mach/hardware.h>5 b7 m5 j/ n1 C! S8 @1 c
  38. #include <mach/irqs.h>
    5 B, [# E4 I% a2 u. N1 f1 L
  39. #include <asm/hardware/edma.h>+ v0 o0 h% E. C, v
  40. 3 f* ~, \; N' F2 R
  41. #undef EDMA3_DEBUG
    9 _$ G5 |0 ?2 a1 u% a; M
  42. /*#define EDMA3_DEBUG*/+ |; @" C0 w- O, H4 d4 n
  43. , `/ M+ J( C$ W2 E" S
  44. #ifdef EDMA3_DEBUG
    & o. S$ n& J( n0 `$ X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 b8 O) M& r, [- {2 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- z6 c4 G7 o9 F4 F" ?# P* @2 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " @* k% S- W5 J- v; G
  48. #else! j- D5 A; _# M4 ~
  49. #define DMA_PRINTK( x... )" c6 m$ x+ s8 \' _' B3 P9 R
  50. #define DMA_FN_IN1 `( q5 B. H- R- O" d
  51. #define DMA_FN_OUT5 k  C7 |6 V9 `3 U$ B7 n) f$ q  ?4 U
  52. #endif
    1 ]8 ~6 L$ y4 m: C& u: B9 G
  53. 9 z. l; [5 x" d4 h* q- f  H( c6 v1 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" L( G$ {5 Q) S
  55. #define STATIC_SHIFT                3
    - j% c2 i& n; Y8 |  i
  56. #define TCINTEN_SHIFT               200 x4 n# K2 S7 e; I/ T1 P
  57. #define ITCINTEN_SHIFT              212 e# P9 M& D2 v& a
  58. #define TCCHEN_SHIFT                22' N$ Q, \" |8 C
  59. #define ITCCHEN_SHIFT               23
    . H. y6 ?3 v: r- k9 F1 I- v
  60. ; |. r6 U. e( E4 E% u8 Z2 w9 C
  61. static volatile int irqraised1 = 0;
    ) d' E8 c! a4 P8 J$ j
  62. static volatile int irqraised2 = 0;
    3 t5 D# j* D: w* `4 d& q
  63. * ?+ h, ]  S- g" l# G- b+ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : a  `: t' y$ S8 {! f5 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Y+ \1 M* h8 i+ W# n! J4 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: F8 V) r' w/ q
  67. 1 ]0 {3 j1 B* N* p( I4 w3 f- D3 O) u
  68. dma_addr_t dmaphyssrc1 = 0;
    * {: C. ^  H( P  Q$ ?* U
  69. dma_addr_t dmaphyssrc2 = 0;7 C: P3 c+ {) o! S
  70. dma_addr_t dmaphysdest1 = 0;
    : X# V* C; F8 z. ]
  71. dma_addr_t dmaphysdest2 = 0;
    : t$ C! D  d' d1 n+ l

  72. 3 _: y4 J3 Y( ^. T
  73. char *dmabufsrc1 = NULL;
    0 s+ ^' D; T# B6 k' u
  74. char *dmabufsrc2 = NULL;
    6 y1 Z$ b. s3 M0 u6 l$ e& }; A
  75. char *dmabufdest1 = NULL;
    * I5 ^* m3 q' g# p
  76. char *dmabufdest2 = NULL;/ H, e+ @! @( v! ]. y* S+ s% o8 @

  77. % C6 H. k4 n- y6 [0 Y& g/ y
  78. static int acnt = 512;& R7 i; N8 c! x; y
  79. static int bcnt = 8;/ \0 Z8 s$ I" c- H* `
  80. static int ccnt = 8;! @, ?& C3 q* Y8 ^
  81. 5 ~8 U- n  f3 C1 Z" Q3 @% Z
  82. module_param(acnt, int, S_IRUGO);
    5 v5 {  y4 n0 F' l: U# c
  83. module_param(bcnt, int, S_IRUGO);
    2 K5 g5 a- U2 G+ \: p8 Y) @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% H7 s  \" E) M# W, h3 W% p1 \

& q4 C2 H7 C! M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 I# ]5 t3 e/ yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 o1 O' A. M- {- @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; v4 n4 g6 V7 G' q& w  \; j
" d/ M" k8 u1 b% k6 m7 Q( Q2 ]4 G5 _
( [$ ^( u) D: s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 02:10 , Processed in 0.047937 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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