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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ n0 `6 D2 Z$ e6 A* h  R, t; Y; ?$ ]
  1. [code]EDMA sample test application
    6 f3 H# R* m4 u& E$ J
  2. /*& Y& z& U/ h; |
  3. * edma_test.c* k% a! |$ T- z5 o3 @0 G  U& J
  4. *2 p% j! [/ S3 B0 ?
  5. * brief  EDMA3 Test Application
    6 `9 L) i9 J/ a4 x8 }
  6. *! U/ N4 H  R0 n+ A& e# O
  7. *   This file contains EDMA3 Test code.1 p# u6 |1 A& P! i- d% u8 w
  8. *; S1 Q% v' F! b7 t9 Z' F; e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 M. |6 y4 a- r% t- w& e" w* `( D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ A1 G% G/ `; d
  11. *         TO CHANGE.  |/ U; g& W! k. [9 r- |+ C
  12. *$ Z" |2 v% T& B0 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* {1 i5 Q' F5 r- X- I- f
  14. *
    6 U% d0 v0 \) i( ^9 n
  15. * This program is free software; you can redistribute it and/or4 n4 p$ X; F4 Z6 G
  16. * modify it under the terms of the GNU General Public License as2 w* p' }6 L+ w% B
  17. * published by the Free Software Foundation version 2.- {; V; Q' d% W# Y
  18. *! _* ]8 ?' F; K1 O; B* }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , t" ^! ^1 \) e% }7 F! o+ t5 l
  20. * kind, whether express or implied; without even the implied warranty
    % A/ ]1 M, [' m( y% x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& d0 |& _$ Z9 J  P% \1 }
  22. * GNU General Public License for more details.
    5 h6 t5 H8 V' y
  23. */
    ( Y, {( k' ^. P8 F% @( x( w$ }
  24. * y+ }! ^0 g) O! y& l
  25. #include <linux/module.h>: ^% [. D5 L1 \9 ^
  26. #include <linux/init.h>
    1 A$ r( Q: r! R( C+ n
  27. #include <linux/errno.h>5 q9 C) c2 C( i+ d: J" O
  28. #include <linux/types.h>6 q! E' j  ^2 R0 S
  29. #include <linux/interrupt.h>8 o) k+ c; W# y. p3 L- Y
  30. #include <asm/io.h>: z! D  K( s( A- N! f1 t
  31. #include <linux/moduleparam.h>, u4 O6 v8 |& @- ~
  32. #include <linux/sysctl.h>0 x3 C9 j0 s3 b
  33. #include <linux/mm.h>) E! ]$ z, Q5 r: U  a4 j
  34. #include <linux/dma-mapping.h>
    + n$ @# C4 J% a$ {6 k. K1 b5 D" q* R

  35. 1 [! |9 p, i1 F% Q
  36. #include <mach/memory.h>: p9 m7 ?# N' O, U, j0 C/ V
  37. #include <mach/hardware.h>0 j, r1 T1 t% y1 U5 \3 w4 D1 `* _9 e
  38. #include <mach/irqs.h>" N9 p4 S, C- C# k
  39. #include <asm/hardware/edma.h>& A  _6 [# B: r( A

  40. ) q3 Z" s1 Y: r% C) m% e
  41. #undef EDMA3_DEBUG* |; J; K2 Z9 t  P2 Q  m. p& m8 f0 n
  42. /*#define EDMA3_DEBUG*/1 t! q! z8 V9 S+ `
  43. % b9 y6 Y0 {& y; g, y0 A
  44. #ifdef EDMA3_DEBUG
    $ u. K' b1 J3 z: [" ]% W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), a, Z* q6 J: V* B7 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * k6 i! V  N) C0 f# k/ L) v; s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 g' l, @: ~  M/ ~2 [3 \, G
  48. #else8 U& a' C% T8 F# I7 W3 f) I' b* m
  49. #define DMA_PRINTK( x... )! P3 Q- Y; L5 S  c
  50. #define DMA_FN_IN
    " p- K) A& M5 w% l3 A- B: S
  51. #define DMA_FN_OUT
    8 m% W( s3 j; H3 f+ h( y: o
  52. #endif6 t: P. d' r5 I  z

  53. 1 I, R6 Q! x- J/ t$ t& i% \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' z) g3 v5 t& V# v8 Z" R# W1 ^
  55. #define STATIC_SHIFT                3
    9 ?! ?' M" w( d6 w- ?& m
  56. #define TCINTEN_SHIFT               209 A0 x# ]0 z! w% V$ p+ B8 i
  57. #define ITCINTEN_SHIFT              21: v! d+ d  }) m1 ?
  58. #define TCCHEN_SHIFT                22. K. I* |5 n* {7 @  u4 j: L5 W
  59. #define ITCCHEN_SHIFT               230 A6 X  e& q4 `
  60. , s7 A/ c5 j$ ]% ?0 j
  61. static volatile int irqraised1 = 0;
    ' U1 [7 J" g$ Q/ z5 q& l
  62. static volatile int irqraised2 = 0;1 u$ ^: h& F9 G+ z- u
  63. ! ?; r7 w' D" o% d- o. p2 d8 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& F1 `3 s) {  I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * d% C2 g/ }* A( V  j1 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" r0 G' s: H8 Y  t8 r9 W9 ?$ X

  67. ' E7 L6 P/ u9 }0 D
  68. dma_addr_t dmaphyssrc1 = 0;
    - p% [4 F# ^, T) A) u
  69. dma_addr_t dmaphyssrc2 = 0;
    / c4 I" F# r  o! _. h- V1 t
  70. dma_addr_t dmaphysdest1 = 0;1 ^) c$ }( [9 T
  71. dma_addr_t dmaphysdest2 = 0;
    7 E) g5 B: k) h8 z

  72. 0 X8 t) }. {$ l! X# t% r+ f! m
  73. char *dmabufsrc1 = NULL;
    ' }( j7 I5 N" k" ^# @' |
  74. char *dmabufsrc2 = NULL;
    $ ^7 Z2 j% ?) ^  m
  75. char *dmabufdest1 = NULL;( Y/ X' H: M2 i! L; V: K- E% W
  76. char *dmabufdest2 = NULL;3 z  k9 c$ |8 v* ?: F6 Y& V

  77. . a7 m8 x4 }" {# s* r1 ]4 }
  78. static int acnt = 512;$ G/ E3 H1 j) d' D5 a7 b7 M8 c9 t
  79. static int bcnt = 8;* c/ M) @* T$ t: P
  80. static int ccnt = 8;1 {  {1 O; e) l6 N# p* a: x

  81. & l( `3 H1 _; o2 V4 k0 ?9 \
  82. module_param(acnt, int, S_IRUGO);* Y- o; x. ?& ^% i2 \! X
  83. module_param(bcnt, int, S_IRUGO);
    / m& _6 b4 T+ Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( s. o- ~4 d$ a  V4 O. w5 q& U
2 P' c& w7 e' T( _, P/ B9 q" d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 V# a0 g. v( @- {) C8 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 H* `; }' T3 ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 }3 o+ e0 n3 @; b$ W
( h6 ?3 C6 B, S- G3 Y/ L% p
2 y$ i' v+ T$ \& a1 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 20:44 , Processed in 0.041297 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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