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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# n* \# c* L+ H" C' \- n- T
  1. [code]EDMA sample test application( H: B/ H( \$ I, U- A, O6 J
  2. /*: \& Q6 H% j+ n! x" {
  3. * edma_test.c$ `2 \6 N1 t& W
  4. *
    ' W7 O. p7 |3 q5 Q# ^5 z* z
  5. * brief  EDMA3 Test Application; i# w) L' ~1 x, c* x3 p
  6. *( B8 ~& p' {3 N- ^) f/ Z
  7. *   This file contains EDMA3 Test code.6 |- v5 T2 A6 V4 U! A$ \
  8. *: Y) L* g- q4 @2 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 H4 M0 j7 v0 m; Y0 _2 k3 x$ ]- ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / c9 T5 m! q: s
  11. *         TO CHANGE.% X. |% J- K  R! K3 H5 L* }
  12. */ p+ a8 @' s/ y+ V) w% _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * e; ]( c& L3 M- [% E' t* L1 {
  14. *& G1 L& g& z# ^; [6 q' W( @
  15. * This program is free software; you can redistribute it and/or: x& h4 z3 z1 Z. N( d- `& w
  16. * modify it under the terms of the GNU General Public License as
      S. d- G3 a! t% X. x2 V2 E
  17. * published by the Free Software Foundation version 2.3 z. |" f. ?7 r3 u  \- \0 _
  18. *7 k4 m8 I0 l4 n1 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 g- i( Y7 _4 b/ R+ z  F- L
  20. * kind, whether express or implied; without even the implied warranty  |3 w- |, K- A1 p9 e# x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, k! Y: z/ N( n; O( k' Z
  22. * GNU General Public License for more details." e% I7 T9 |' R9 J  Q; S
  23. */
    * ^4 u7 l' l9 J, w
  24. 6 `. s) ^! t- n0 q4 ?
  25. #include <linux/module.h>
    4 x' M5 \; `6 f& L, V, R+ s
  26. #include <linux/init.h>7 N- E+ l1 Z6 n2 M+ n# q! l) ]# m( T
  27. #include <linux/errno.h>
    $ ~$ w0 X: H, y7 N: \0 ?# a, Q% [7 {
  28. #include <linux/types.h>
    " p, A# i# E) I# y* T& f
  29. #include <linux/interrupt.h>, n' u& E& D) C4 f8 b% _
  30. #include <asm/io.h>
    * }  G( a# k3 R6 a0 y- \( j; m2 E0 |
  31. #include <linux/moduleparam.h>
    ' ?+ v4 E0 a% T7 B! b
  32. #include <linux/sysctl.h>
    1 @. W8 q% d3 K, U( @2 r, ~
  33. #include <linux/mm.h>- ^; n! @: Y, G6 n$ F' C
  34. #include <linux/dma-mapping.h>
    $ L( P' z9 V  R. W

  35. : _/ \/ m) W5 X: H( g
  36. #include <mach/memory.h>
    5 A8 j3 o& w% c# Z5 F: H
  37. #include <mach/hardware.h>  w5 q5 \7 N, ^  F! ~
  38. #include <mach/irqs.h>0 h0 n/ f. j- T* o2 P
  39. #include <asm/hardware/edma.h>
    : p" s% u  l7 a; F% Y
  40. , M2 N2 o1 x7 Y/ u  N9 K3 j2 g
  41. #undef EDMA3_DEBUG
    , e! m; }, r: r
  42. /*#define EDMA3_DEBUG*/
    - Z% s3 K3 g9 V; {8 [

  43. / p" ~" T3 Q7 q1 z& |3 G7 |4 o
  44. #ifdef EDMA3_DEBUG
    : F( n  Y5 @8 U) R, h! t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * r- e2 k: S6 G0 Q6 x! ~/ h% v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 }+ `2 f. C0 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 P& d; v( Y$ M- n" l- k* E
  48. #else7 v/ k5 O1 Y! A1 A  h2 ]% b1 n
  49. #define DMA_PRINTK( x... )7 F5 x  ^4 G# d
  50. #define DMA_FN_IN
    1 f# ^& z5 Z4 I& e9 |6 i2 E9 D& L
  51. #define DMA_FN_OUT( [. a4 F4 i; A( i/ k0 V
  52. #endif; W0 ^4 e% H# N+ U! m* a+ y& Z

  53. * X! w! b( B+ t1 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . K( f. \: v3 j6 r. U& d( T
  55. #define STATIC_SHIFT                3* g# p, A* [3 ]& f5 A4 ]0 z* D
  56. #define TCINTEN_SHIFT               203 v2 o. l2 o! s4 U
  57. #define ITCINTEN_SHIFT              21* E- C, e: K! \6 [; ~5 B  d( M
  58. #define TCCHEN_SHIFT                227 H( ]7 i9 r6 m( l' P
  59. #define ITCCHEN_SHIFT               23- x- U0 n+ W& L+ H: h" x, G

  60. 7 u7 [: O+ j# @3 r, ^
  61. static volatile int irqraised1 = 0;
    * ?0 Q0 g. s* i' \
  62. static volatile int irqraised2 = 0;9 m$ Y" t" @0 D3 l- v, T

  63.   ]* q& E4 J3 ?1 u1 u& d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M  j2 Y5 g3 R6 h# R' }# }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 @( C6 X" S. [4 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 E  n2 t* k3 m- d) Q

  67. + T8 K6 O8 }  I: E3 ?5 g
  68. dma_addr_t dmaphyssrc1 = 0;) g3 \- H/ s0 w  A# x: A
  69. dma_addr_t dmaphyssrc2 = 0;7 U2 G; j& E2 A- ?! Z! d8 u
  70. dma_addr_t dmaphysdest1 = 0;& u4 n8 `* T6 h, e6 c6 H( A: Z
  71. dma_addr_t dmaphysdest2 = 0;
    ! M( b  \. n( j9 y
  72. $ k4 D) ], g7 H9 x5 s+ \
  73. char *dmabufsrc1 = NULL;( b' V9 G4 }) ~/ x6 d) D  q
  74. char *dmabufsrc2 = NULL;& Y$ q& t. n( B; Q% g0 |  a8 B
  75. char *dmabufdest1 = NULL;' {2 x, ^" u5 k& `" e
  76. char *dmabufdest2 = NULL;
    ' V9 F) T: _8 M7 j$ n. f

  77. * H7 C- i& n8 c2 ]$ a5 I, g
  78. static int acnt = 512;
    8 l; V# z7 k0 p$ Z  i" N* P
  79. static int bcnt = 8;) F9 F2 k3 b5 ]' u9 ^& Q
  80. static int ccnt = 8;
    - r/ P( G; b) C: Z) A
  81. / r% d  X' P- Y7 O1 w
  82. module_param(acnt, int, S_IRUGO);( O  x  \& y1 F& _
  83. module_param(bcnt, int, S_IRUGO);
    % V' s  g1 X- Y/ O: s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ l* L5 n  f+ ]2 x/ Z1 O* ]
5 ]( m/ A2 [$ I! S, f" l6 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 U) W+ V" ^3 E3 A0 J( m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% z9 o& r, Y% j2 L) H4 [* c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ a1 n/ n% V- t3 s9 |6 {! k, t2 N3 W9 E  U6 z  l. b: F

3 z6 ~' a3 Y$ O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 20:36 , Processed in 0.038883 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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