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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: f4 A/ m6 e. f$ f$ y
  1. [code]EDMA sample test application
    6 t( ^, g  ?. h
  2. /*
    ( E! d3 J& W  e
  3. * edma_test.c
    # c. u" S* J# X3 F% v; v
  4. *! L6 E' }/ O% X4 O9 C+ N! k' n+ l. \" K
  5. * brief  EDMA3 Test Application. n: @( O  O1 f, u* Z
  6. *
    3 c5 R% S8 R) y
  7. *   This file contains EDMA3 Test code.% p) L. x* r0 g0 p; Y' G- t: q  I
  8. *3 E! N, _& D- ^  I6 d, U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 {9 `3 N  [7 O! L' X( t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 |  N% E3 S' s8 [; V+ e% }
  11. *         TO CHANGE.& W2 O( _  U/ G* R) X: [
  12. *
    / r* r# z* e; A1 W- x0 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ {# e* T9 r# Q( o
  14. *
    6 i6 o2 [6 ]- ?! g# I# U7 u
  15. * This program is free software; you can redistribute it and/or
    ) Y/ s0 |/ f" {' @- C" U. i
  16. * modify it under the terms of the GNU General Public License as7 M" n7 y( K: e! w- V) b
  17. * published by the Free Software Foundation version 2./ t# a  ?# ]' v, |$ v1 k
  18. *
    $ \  h; Q8 `0 b6 [  }2 y  g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" }6 z/ Q7 I! S, Q1 M. |6 ^
  20. * kind, whether express or implied; without even the implied warranty
    0 d8 c. V/ r7 L8 Z6 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  a# A6 @# q$ M2 G
  22. * GNU General Public License for more details.
    4 \1 p1 h% ]3 d4 x% Z% S* W
  23. */
    , W2 p$ R: U2 e

  24. 5 U% B8 G5 b) X$ b9 u$ F
  25. #include <linux/module.h>
    ! W+ O, q0 h4 @' l. s
  26. #include <linux/init.h>( O  o1 L) G  Q% t
  27. #include <linux/errno.h>
    ( F5 I( q% C: g8 K  A/ T
  28. #include <linux/types.h>* G' r% X" I+ H
  29. #include <linux/interrupt.h>
    ' r4 N# I: f$ V% k1 w2 _
  30. #include <asm/io.h>$ x9 o. U/ f6 I* r* g
  31. #include <linux/moduleparam.h>
    : ^# k4 w0 Y* l* l6 J9 P
  32. #include <linux/sysctl.h>( ?+ [' n2 l. J/ {" \  Z& ~
  33. #include <linux/mm.h>
    ' }7 t% j; B" W- z8 O) C" j
  34. #include <linux/dma-mapping.h>
    , }* \4 A8 D* E' U6 m- O) U
  35. $ e, ^/ Q7 [) I4 B
  36. #include <mach/memory.h>7 K4 O$ s2 k; C2 V0 h4 A
  37. #include <mach/hardware.h>3 x) Q9 n1 U% k; D7 l% I/ f
  38. #include <mach/irqs.h>& q. X. W' W2 t8 e7 {
  39. #include <asm/hardware/edma.h>
    5 `$ R" V6 j5 \- ?* {

  40. * M( G- O' U: {2 g1 @( |( @; e
  41. #undef EDMA3_DEBUG
    8 ?3 x. Z' v, j' o8 [7 O
  42. /*#define EDMA3_DEBUG*/
    - l0 L$ D& L7 V7 H
  43. 9 r1 r( H: Z4 b% s. M
  44. #ifdef EDMA3_DEBUG
    1 ~3 C* l: O$ o% U4 ]; |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % h( \# C0 K5 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) A/ C( D$ ~" b2 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) @! e6 r4 ^6 p% K0 C3 v7 Y/ q9 Q& E
  48. #else$ s+ f- p* j% Y- E$ |, P
  49. #define DMA_PRINTK( x... )7 u3 p/ P  c7 w) U" @8 x
  50. #define DMA_FN_IN& |# d2 b  f& j3 b6 ^" @
  51. #define DMA_FN_OUT6 H5 Y6 n4 J) T7 t& K1 c( o; c8 ?: {
  52. #endif2 U$ T, H: w  m& c1 n- T5 G# J
  53. 5 {7 b; o/ |+ I' K' W+ K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . X$ b9 o0 `2 n) c, m2 S4 c
  55. #define STATIC_SHIFT                33 e$ R. o: w2 w" ~. Q
  56. #define TCINTEN_SHIFT               20
      s0 x' ?6 a4 g8 ]
  57. #define ITCINTEN_SHIFT              212 ^, I  S3 e# J# E* r; q& ]& ~) m
  58. #define TCCHEN_SHIFT                22
      W- Z/ r- |/ H/ T5 ~
  59. #define ITCCHEN_SHIFT               23; `) U+ n3 D4 Q3 {0 b+ c
  60. - W0 R& r9 `7 |9 f( w5 Q
  61. static volatile int irqraised1 = 0;
    : R8 I6 P/ V  b
  62. static volatile int irqraised2 = 0;
    & _$ a0 H# g5 H  ]

  63. ! p/ w; x9 F; W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ], J; S( k' d( i' W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  p! b/ _% j) O' a( i! c- y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 |7 h3 j1 k# W& y
  67. . @: w' [+ ~( k5 J
  68. dma_addr_t dmaphyssrc1 = 0;
    6 J$ H! E- g0 J3 h
  69. dma_addr_t dmaphyssrc2 = 0;
    * l, k  ^$ D! ]
  70. dma_addr_t dmaphysdest1 = 0;( G2 B/ c- k( @# |% g8 @2 X. h" m, ?
  71. dma_addr_t dmaphysdest2 = 0;/ y0 R& ]0 T/ a) Y  h+ Q. {- |' v

  72. 1 z- M1 `1 `- U  I2 C% |
  73. char *dmabufsrc1 = NULL;
    6 c+ @* w5 b" a- Y, y( q5 T, b
  74. char *dmabufsrc2 = NULL;' k. ?9 l5 D/ X
  75. char *dmabufdest1 = NULL;# [6 u& T2 Q" A0 N) {" ?1 e$ ], O
  76. char *dmabufdest2 = NULL;" D- c. X/ r4 t) |  P8 f! G$ P

  77. 3 H- |4 a- D& K6 p/ O
  78. static int acnt = 512;; L* D5 [: p; J0 ?7 j: |/ N
  79. static int bcnt = 8;+ ~0 n# T) ~9 H( N1 n, L3 w- V
  80. static int ccnt = 8;
    - g. a4 G3 F- l2 b6 y
  81. - I/ F0 l9 V- }: K7 f: P  v
  82. module_param(acnt, int, S_IRUGO);
    . B; ]# y7 a8 V( V$ w
  83. module_param(bcnt, int, S_IRUGO);5 ~; s$ P6 Q. y6 l/ W! C: H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- O1 r$ W  z, M- i
9 U: h4 |3 `9 z3 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% h9 x- y4 j! ~5 R6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' _4 f5 ?  C# j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 G+ k0 V& y+ h; Z# F! c

) m3 A, P! ?+ |9 P2 B4 Z  |0 F1 p6 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 03:22 , Processed in 0.042237 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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