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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. N2 w3 i) z3 t% a- b7 z) v* B
  1. [code]EDMA sample test application6 q7 K9 H+ a6 O0 `6 h
  2. /*
    $ v8 \2 \1 a5 c3 E
  3. * edma_test.c
    5 M0 |& J9 x6 n9 P, O/ B- \, L
  4. *
    8 u: g6 G* m- ]  s3 V# D" w5 \! m
  5. * brief  EDMA3 Test Application
    ! o& }  z& U; M6 v& z
  6. *
    - E$ f% _5 u$ t! v
  7. *   This file contains EDMA3 Test code.9 F" `4 y; x. e& l
  8. *
    2 i; ~4 n! u8 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% B3 j/ ~" s3 S9 p9 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; E& j, H( P6 X4 n! M) n8 z, o
  11. *         TO CHANGE.3 ?2 A! J% d9 ~6 g8 b
  12. *
    * R) q# q4 X7 e8 U2 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + p: M3 y# M) \3 H! d
  14. *, \9 e' i6 h3 }) w! X
  15. * This program is free software; you can redistribute it and/or
    2 N3 x3 G8 _% W4 t/ ]. H
  16. * modify it under the terms of the GNU General Public License as
    2 h; g" e/ N6 S6 k
  17. * published by the Free Software Foundation version 2.
    / k3 h% U* F- h4 ]3 s" t
  18. *- m4 ?/ N) |, f) S, s8 |  _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / f$ o3 R& o; n  G) e  D4 y! b# @7 M
  20. * kind, whether express or implied; without even the implied warranty
    6 _! [- O5 a) r5 H* S4 ~- G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) ]1 F0 K/ J6 O  R$ z" N0 i, M  P
  22. * GNU General Public License for more details.
    ( I( S2 @+ t# @1 N% @
  23. */* W& A! M: ~6 Z6 `
  24. 7 V$ D0 B& |5 _6 U
  25. #include <linux/module.h>; ~6 V3 `% b% f) b9 i) x
  26. #include <linux/init.h>7 i. @0 r. X- W6 k% C
  27. #include <linux/errno.h>* o% T: C; ^/ i+ T( L  r
  28. #include <linux/types.h>2 S( D# w% o0 `$ M
  29. #include <linux/interrupt.h>
    - v# K) m+ `- s3 j5 ?& y
  30. #include <asm/io.h>2 P* l: r$ y6 d" a
  31. #include <linux/moduleparam.h>1 ?# o, \, q% c
  32. #include <linux/sysctl.h>
    5 i: _/ S( v/ m: o7 l+ E
  33. #include <linux/mm.h>0 ?5 F* N9 ?; C$ \' X4 _* c0 @# M* M; @
  34. #include <linux/dma-mapping.h>
    ) t, |0 F6 l% \% |7 {: _3 x

  35. . b$ x+ E4 _1 v+ G3 Y
  36. #include <mach/memory.h>0 ~' y8 F2 t; \/ `( l1 O7 M# p
  37. #include <mach/hardware.h>
    2 H$ b- [: T6 |- C; z
  38. #include <mach/irqs.h>' f. s# R$ _! W( u) F/ M7 }3 d
  39. #include <asm/hardware/edma.h>
    5 E2 |8 S; p5 c

  40. 3 a2 E6 A, d' R% H. a) ~7 f2 b7 i) p
  41. #undef EDMA3_DEBUG
    , J0 J7 q- H  ^
  42. /*#define EDMA3_DEBUG*/$ \/ `- y+ p% C
  43. ! d! H; h: F& `8 X& K( u9 n
  44. #ifdef EDMA3_DEBUG
    : z/ `( [8 r0 w$ c  d# ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" }  A2 F: i6 I  J) G' i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 n- t6 R3 C" q4 [9 l8 B: \. u4 k, Y" Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 Q+ D) W' |0 q" q* T
  48. #else; n; Q6 |5 z6 X* e
  49. #define DMA_PRINTK( x... )6 f1 l5 L* H0 h) N# o
  50. #define DMA_FN_IN8 N' F' K0 M. v- }0 I) r5 H
  51. #define DMA_FN_OUT
    1 Y! o  h* M" D+ l  \- Z
  52. #endif. o$ R. u1 L+ q" b: w! w& s  d3 L

  53. ) s% n" T8 r, _2 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 |5 K, I& w& P3 \% P! U  I" v
  55. #define STATIC_SHIFT                3
    $ L  W0 u# `8 n: v  c; V. `0 H! i
  56. #define TCINTEN_SHIFT               20
    6 O4 b% n* g: Q% ]0 t1 o
  57. #define ITCINTEN_SHIFT              21
    4 g9 U  e. }, A4 U- ^9 L$ \! Q
  58. #define TCCHEN_SHIFT                22
    7 z+ K9 Q7 r# L8 }* M- ~
  59. #define ITCCHEN_SHIFT               23
    $ f4 r1 n9 D$ S2 P
  60. 1 h8 s  j: x  r1 T+ S, Y& e
  61. static volatile int irqraised1 = 0;
    % N5 E, Q: E- L, |/ ^7 r9 i
  62. static volatile int irqraised2 = 0;4 ~$ X% T1 E( d4 j' R% H! J

  63. 6 X9 A9 @2 F) \1 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 f8 D+ {; c4 H1 G% l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b0 ~7 r# [$ t5 E; K7 {8 M: f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , A, L8 O3 G  P: h
  67. 8 j( X. N7 K7 `8 A, J9 r
  68. dma_addr_t dmaphyssrc1 = 0;
    1 B& Z; E' t6 O9 C8 |
  69. dma_addr_t dmaphyssrc2 = 0;1 c# d* L1 ~  d
  70. dma_addr_t dmaphysdest1 = 0;  E' F9 M* X0 j$ v; i
  71. dma_addr_t dmaphysdest2 = 0;
    1 ]7 k7 _2 W7 U, H

  72. $ w" [) z! s5 A6 W; D' t: g
  73. char *dmabufsrc1 = NULL;
    9 y" G. d- V! c# ^' ~
  74. char *dmabufsrc2 = NULL;
    # _1 l' ]" m  ~3 u
  75. char *dmabufdest1 = NULL;, c" Y/ j1 S3 ^  M8 P' P
  76. char *dmabufdest2 = NULL;
    : V! I2 [  e& {1 N; J/ S

  77. 2 c) E# B9 W- B" E
  78. static int acnt = 512;6 q, p& ]) r, h) t! Q
  79. static int bcnt = 8;: E4 s  E, D, [# M, ?- Z
  80. static int ccnt = 8;
    " x8 \5 r( B& _* ^5 N
  81. ' ?4 z1 F7 m& |
  82. module_param(acnt, int, S_IRUGO);
    0 C0 ~7 d/ w: [, d8 S9 ~
  83. module_param(bcnt, int, S_IRUGO);5 N) `0 L4 ?5 f, E6 R$ Z; F2 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 s$ H5 x' ~2 G- s  x
# L# C9 e- n6 t  v3 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  m7 ~% B- I7 v: U2 P( Z' l; O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( r2 l2 p) n, A$ g* H$ p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ {% Z5 w; q) ]$ y$ b( ?
9 p! X. F, ^: O

" a/ h! J- T( Z9 n$ H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 17:26 , Processed in 0.039694 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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