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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 u7 c" F7 m* e: r% }, w: h
  1. [code]EDMA sample test application
    0 v4 p8 v1 a4 `! K  d1 G& ?
  2. /*# _6 x; [" ~1 [! I9 N# {- W! b
  3. * edma_test.c
    ; r0 k* g, M+ {9 B2 u( b. ^
  4. *, p6 }& {6 N2 C
  5. * brief  EDMA3 Test Application# K% N' t3 `+ Q( M: m1 F
  6. *
    " C* _6 ~' u% f+ k
  7. *   This file contains EDMA3 Test code.
    + d% B2 ?0 {3 M, J5 P+ \0 _- {1 m
  8. *
    : y3 z5 g/ K9 |. `7 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. ~. P& k( b1 s( M' q1 y, `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! x, x# X- n3 w
  11. *         TO CHANGE.: I7 f2 U! H8 t! I, |$ N! n
  12. *
    # t) I& m- s+ f& \& E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , m# N, W  {4 U1 C
  14. *
    4 T! T+ v/ y9 `; c" E6 G3 ^" M
  15. * This program is free software; you can redistribute it and/or7 O  |( B" O7 m2 r
  16. * modify it under the terms of the GNU General Public License as- _, a& T) A9 G+ i8 A! O
  17. * published by the Free Software Foundation version 2.. m3 {/ ^5 d+ c1 C
  18. *. ~; }: l# x4 y* E6 N1 O0 M9 I% E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ h, ]) z5 `, G/ [' a2 I! H
  20. * kind, whether express or implied; without even the implied warranty7 L" y: A0 {$ h8 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 ~  C, G2 C+ q! G
  22. * GNU General Public License for more details.
    5 ]) e5 n0 `- c  s* l
  23. */
    # H; {& l; b- ^

  24. % Q. j% o$ D: v! O1 W) [4 b+ j
  25. #include <linux/module.h>5 y! T/ r, d8 p/ H$ ~) y  g4 R5 O. W
  26. #include <linux/init.h>
    $ m  T" v9 o" k' n- l' J
  27. #include <linux/errno.h>
    8 l# ?$ _8 q6 C' g7 c- I* W+ W
  28. #include <linux/types.h>; j3 N0 T; _7 s( T3 y7 y2 ~' \
  29. #include <linux/interrupt.h>
    ) `+ C8 y9 C+ f7 n9 @
  30. #include <asm/io.h>2 m! f5 w: l. o  u
  31. #include <linux/moduleparam.h>
    5 c/ q) x( [3 x+ `& c$ t  q
  32. #include <linux/sysctl.h>
    " _" X1 j/ S$ ~% ]* Q7 ]
  33. #include <linux/mm.h>
    , c$ m2 k* s& Z) i  X
  34. #include <linux/dma-mapping.h>  V6 ?" i/ l2 F& d
  35. 5 j. d$ R6 [; x8 B/ X6 R
  36. #include <mach/memory.h>
    6 D/ m8 Y4 }; s3 s) c
  37. #include <mach/hardware.h>
    ) x: w- i4 y0 Y
  38. #include <mach/irqs.h>
    $ f8 v8 V- C: B( J% x8 {8 p
  39. #include <asm/hardware/edma.h>- @; y. S, I- p$ z$ t: U

  40. 7 A7 p  B/ T( m' x/ R6 O* I
  41. #undef EDMA3_DEBUG# ]0 b$ u# J/ j& s1 ]
  42. /*#define EDMA3_DEBUG*/
    1 b3 }0 ~* ~) a& a( K

  43. % ~- [% c; W  h: e
  44. #ifdef EDMA3_DEBUG
    , z/ F/ O" d" o6 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 E( {% ?' J8 A6 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 \! V7 H. j8 O' E3 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* i9 S" |6 h( E& M2 ?
  48. #else
    ( M& D4 y2 C2 ]% v
  49. #define DMA_PRINTK( x... )
      z$ }) M+ E. a4 t- B( g; u4 W5 R6 ~
  50. #define DMA_FN_IN
    % K7 Z( ~8 x! J) G/ S
  51. #define DMA_FN_OUT" ]( ]& G4 c3 }9 t0 w
  52. #endif6 f" `4 }/ D3 F7 j* Z# d# ^5 \

  53. . M6 r, V7 V- \  J  j# x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 ]2 O! M. `  G7 B3 F* P: a
  55. #define STATIC_SHIFT                33 G6 y! J" r: y
  56. #define TCINTEN_SHIFT               20
    * E% |5 o" A) m3 w* X  S4 H% V
  57. #define ITCINTEN_SHIFT              21* W( J4 B' d) Z+ c
  58. #define TCCHEN_SHIFT                228 N9 l7 h0 F" M  E( y: L+ B
  59. #define ITCCHEN_SHIFT               234 B. \7 Z" g: \
  60. , u  U6 }6 H4 A8 b1 M3 C9 Q' X/ I
  61. static volatile int irqraised1 = 0;
    - b( H- z, L  v2 h! A
  62. static volatile int irqraised2 = 0;
    0 Y: B5 y8 {8 Y+ ?

  63. 2 ^) Z7 z5 p9 }2 d; \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + ]& f# {% \3 {  {. _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 J* g6 u+ w, v' l$ R- n$ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # z  k8 @! M% K2 P
  67. ; ~  x8 |% Q8 P; \
  68. dma_addr_t dmaphyssrc1 = 0;
    ' g* L5 `" _, g! H
  69. dma_addr_t dmaphyssrc2 = 0;/ Q) h0 [8 h( d) e) b# z/ C
  70. dma_addr_t dmaphysdest1 = 0;' Q! e9 B$ ]; w3 m6 D4 H
  71. dma_addr_t dmaphysdest2 = 0;+ u  Q3 \: `+ [! ^% D- A2 R
  72. , T$ B9 R# X# E) m1 R( F# T8 C2 w
  73. char *dmabufsrc1 = NULL;- b7 \8 O; [6 }& s1 m0 t, U4 U
  74. char *dmabufsrc2 = NULL;( d8 O0 o) A% _# C' ~! |" _
  75. char *dmabufdest1 = NULL;- n; o: g7 O8 `' |' ]. D/ m7 ~* ]
  76. char *dmabufdest2 = NULL;, o  B. X! p% X6 k$ o' }

  77. + A, Q. S' C2 e' p( B/ {
  78. static int acnt = 512;9 S3 M' _! ], I% `
  79. static int bcnt = 8;8 X7 x/ J9 w: s' }, \! |
  80. static int ccnt = 8;9 U% ?1 V0 [# T1 T5 [6 ?; e

  81. " k! G! r5 }0 f% b) T* {( Y
  82. module_param(acnt, int, S_IRUGO);
    $ ]$ Z" t2 \% }7 ~( u6 D7 t
  83. module_param(bcnt, int, S_IRUGO);9 {$ {; U' D' L; F; _9 N0 _# F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- T9 ?. G+ b4 h. g

" Z$ Z7 o; u9 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 V% g& X( b4 ?5 F, `9 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& I5 X" i  ~4 A5 I5 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- _+ T3 H5 F% P1 s$ N1 @
- J& G0 n' m: [: I5 ^5 K- r, ]0 f
- G3 y1 x. B4 x; ?" F4 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 22:31 , Processed in 0.038501 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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