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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 \- h, `) [$ V+ q5 P3 C+ _& e  z" v2 G
  1. [code]EDMA sample test application
    / l8 Y9 u3 @$ s3 S
  2. /*
    $ w0 X4 p% c7 f4 f% j7 J
  3. * edma_test.c
    4 I% C; o5 s! |8 k  Y
  4. *
    % B+ o. v& e7 x  z
  5. * brief  EDMA3 Test Application# Q. v3 j2 f9 K9 P
  6. *
    ; I3 X4 Y  E4 `& ~9 c' Q; Y+ g
  7. *   This file contains EDMA3 Test code.0 Q% `) l3 S+ m/ x6 R- }
  8. *
    4 z% n; L5 v) \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 c) R" R/ u- A; S6 r. Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 |% s% Y* }8 p, F2 }0 H; X2 f- R
  11. *         TO CHANGE.( d+ h( u2 C7 c2 E. x) w' {
  12. *
    . A0 ~* a8 j% w7 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. z$ n2 p+ L2 }  \1 L' W" E$ U
  14. *0 o% Y/ g1 n+ H" z
  15. * This program is free software; you can redistribute it and/or. F1 `5 ~4 P) a, z2 k
  16. * modify it under the terms of the GNU General Public License as
    + I5 S, ]' p. w  {8 S
  17. * published by the Free Software Foundation version 2.
    ; U: G- h$ p. @- F
  18. *% S, l9 T) X/ H, G7 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 b  w. t, [2 z. O4 t6 A$ e
  20. * kind, whether express or implied; without even the implied warranty: Y$ a6 X, }$ f9 M6 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 ~3 H* N$ y3 u; \
  22. * GNU General Public License for more details.
      e0 Q% x: W& E+ G2 J
  23. */; Z5 z. T' _9 K9 K6 ?1 X& X
  24. , `4 k/ O" u  @/ Z7 C$ z8 g) w
  25. #include <linux/module.h>3 ?( i" ~9 L+ G4 K$ Z) k
  26. #include <linux/init.h>
    1 l8 t  E- B2 G
  27. #include <linux/errno.h>
    5 t2 }! I4 {: i9 l1 ]2 i
  28. #include <linux/types.h>( {' A- m- c- c/ X, `; Y) g( H1 D- x
  29. #include <linux/interrupt.h>
    3 W" L# |; |( q2 G5 t: Q5 ^3 _
  30. #include <asm/io.h>: ]) Z  j8 q5 U. Q
  31. #include <linux/moduleparam.h>
    5 [& ]1 {, l. h( d" B6 X( Y& l
  32. #include <linux/sysctl.h>
    , v& B# v7 Y+ |( X3 p8 S7 W0 @
  33. #include <linux/mm.h>
    . G& [& s( `$ J) [
  34. #include <linux/dma-mapping.h>
    3 m! z, ^7 n) D. m+ u- a. @
  35. + X8 y3 G2 V" b5 o9 s/ k& U8 H6 Y( e
  36. #include <mach/memory.h>4 q& b; A, b0 B
  37. #include <mach/hardware.h>
    " K; a  D& p. s! j8 D2 b
  38. #include <mach/irqs.h>
    8 U  F) r( p7 j
  39. #include <asm/hardware/edma.h>
    2 u# n; R8 @5 c1 b( G: g

  40. . A% A) p0 {9 k! E6 X
  41. #undef EDMA3_DEBUG  J" A$ ]4 Y! r' Z
  42. /*#define EDMA3_DEBUG*/8 Q! H0 i8 _  L, D' V% K
  43. 5 u* O9 Z! s' L  n( M" n, O5 E
  44. #ifdef EDMA3_DEBUG8 D& _/ M6 ?% K2 v" _4 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# w/ V! y, c* j/ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 X2 R. H; T: y/ s/ d5 Y4 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , K, L8 _+ _- X0 C( S
  48. #else
    , s% u: b- I) Q4 N. Q1 @
  49. #define DMA_PRINTK( x... )7 Y; ]# X7 k% ?  v/ b
  50. #define DMA_FN_IN: j5 @* ^& y3 ~# k" U
  51. #define DMA_FN_OUT
    % ]2 ^) ~4 \  ^5 T+ T
  52. #endif
    # z$ V3 M: T: L* g3 K
  53. ! D' A/ l3 T  b+ b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' r- X# n/ A6 H$ I
  55. #define STATIC_SHIFT                34 E* o6 X8 v+ X( `, A& t
  56. #define TCINTEN_SHIFT               20
    & `0 ]  V3 `( H
  57. #define ITCINTEN_SHIFT              21  Q7 s7 ?3 R* N
  58. #define TCCHEN_SHIFT                22
    3 i5 K- ]% l- R2 b3 k
  59. #define ITCCHEN_SHIFT               23
    - p# |" v; T2 Y" u2 J0 F. Z
  60. 6 b0 V/ }. X( n3 B% S2 [
  61. static volatile int irqraised1 = 0;3 S, J  u" c  E$ T4 W% b
  62. static volatile int irqraised2 = 0;3 u2 i5 T. R! W7 }8 G7 J/ {" X
  63. 7 R# d+ m$ N3 k5 M/ Y' @8 W$ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 W0 a' _, V/ `  H8 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; O% R8 a& v5 Q" y$ [. T% V+ c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* m2 ~% v) O. C9 C# z

  67. % c/ l' [% ]% U! c* [  C8 I' n& ~
  68. dma_addr_t dmaphyssrc1 = 0;
    9 Q6 t7 z- V( z# R2 s0 I5 E: d* N( e1 g8 J
  69. dma_addr_t dmaphyssrc2 = 0;: W1 Q* G* i6 \! V
  70. dma_addr_t dmaphysdest1 = 0;  m9 ?+ q1 ]  ~- y' w1 w
  71. dma_addr_t dmaphysdest2 = 0;
    + G) M9 n) F5 n% S3 g3 ~( g
  72. ! e8 H3 }, a# H( m
  73. char *dmabufsrc1 = NULL;
    / X* X$ |+ u4 z) s" Y0 A- \% `9 G  A+ f# r
  74. char *dmabufsrc2 = NULL;" D: I" a4 m$ J; Y1 O
  75. char *dmabufdest1 = NULL;
    , W( t! O! ~- B* ^
  76. char *dmabufdest2 = NULL;* R1 X0 V% F; z, k7 c1 d. ^
  77. ) }9 C" T6 \, j
  78. static int acnt = 512;
    / m. N' F3 b  a  D
  79. static int bcnt = 8;
    8 o$ y% Z: o- j: G4 I% S: ?  p0 K
  80. static int ccnt = 8;7 _* o# }: j+ u$ B' k
  81. 3 V: o; ]3 k. P( G- c2 u6 Y2 U7 a( F
  82. module_param(acnt, int, S_IRUGO);2 v3 O+ D. z0 G' s7 s
  83. module_param(bcnt, int, S_IRUGO);
    ) b' [9 a" T4 ]% j( ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* r0 E( O: s+ p' r6 u  R) f* I

6 h+ \5 T# k+ u0 a; c& N, c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& m* Q5 z' s3 |$ F5 q1 ^0 H/ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* p0 |$ o$ w8 [# T, N3 C* G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 b$ s2 S3 P, T  }  E4 k$ w3 f: |% |" v% _, l3 ^/ a

% _# |- m8 j$ \* b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 10:39 , Processed in 0.037429 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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