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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 L6 J3 W" B) O: f* ]
  1. [code]EDMA sample test application
    , [; x5 Y9 z$ z& r
  2. /*/ r7 u8 o+ K) x$ U: y6 h5 _
  3. * edma_test.c
    , y/ A7 r( o, p& Y" J- d9 S
  4. *4 m! u( S+ u3 H- A' C
  5. * brief  EDMA3 Test Application
    8 ]& J9 `  ~9 \8 ?' }2 B
  6. *7 K- z$ c$ i- i
  7. *   This file contains EDMA3 Test code.7 O% v) c6 B/ ]5 P- k8 B
  8. *
    ( M+ ^% z+ E# @7 x: B& k1 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& J' {" R4 V, T( U& v. {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 q+ N  ]: x$ g9 {
  11. *         TO CHANGE.
    * R8 v: U1 V& ]
  12. *0 h0 W, |9 i5 o6 Y: q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% J: D6 z7 P9 [# D0 G1 V. q) k
  14. *- c: ^5 K1 P! ^3 |" s9 ^
  15. * This program is free software; you can redistribute it and/or
    0 a8 T# o7 L( m9 `8 r5 o$ }
  16. * modify it under the terms of the GNU General Public License as. N2 ]: S7 B$ l9 P
  17. * published by the Free Software Foundation version 2.: _- z! `. N$ e. r
  18. *, F* x! q2 V. P2 W. b! `8 W0 J5 |; W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ]+ ~  L3 I, n7 \+ g
  20. * kind, whether express or implied; without even the implied warranty# J: g1 R/ z7 N5 p# C4 t! g) p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, n+ K" ^1 ?' U' }
  22. * GNU General Public License for more details.
    - _' R5 _7 B$ O5 S% U/ `9 r
  23. */$ s% |7 ^8 G9 b; C" A+ m) N

  24. 5 \* R& C: W( }! \% A0 {
  25. #include <linux/module.h>
    ) v9 r( x( f. q
  26. #include <linux/init.h>
    ! \) A7 w8 S( |
  27. #include <linux/errno.h>
    9 x/ |/ y* d* i4 T( _& c3 q) w, u, p, q& O, P
  28. #include <linux/types.h>
    $ m! T+ i: w# x$ Q) l
  29. #include <linux/interrupt.h>' m- j1 Y) I; `0 b5 S, z- c1 V* h
  30. #include <asm/io.h>* c) h! T0 @& M3 [! X/ a: @
  31. #include <linux/moduleparam.h>5 r  \5 q* V  _& i* A  o; _1 y
  32. #include <linux/sysctl.h>
    0 n. F& o. l* e! Q4 e8 D) G
  33. #include <linux/mm.h>) @* s* z# W. O- C/ b( c  n
  34. #include <linux/dma-mapping.h>
    ) D! P3 R( W, Q/ g4 G- K
  35. 5 e' y% P; G* ]% P9 h8 V
  36. #include <mach/memory.h>" H& K6 M5 K8 C( `1 G4 C1 h% ?
  37. #include <mach/hardware.h>
    8 q; K$ E# \7 ^  P1 q1 g- q. _
  38. #include <mach/irqs.h>
    8 }+ j3 l: e9 ^9 g, S" |
  39. #include <asm/hardware/edma.h>
    8 c7 f( R( F4 J  U

  40. 4 x/ A9 v  p, T. _
  41. #undef EDMA3_DEBUG9 f$ B2 Y! w' j) X. U! v/ ^! }" \
  42. /*#define EDMA3_DEBUG*/
    , M) D% E5 s' Y; j* m

  43. ! i: _$ v  |6 E5 V; N/ l) `  m7 \
  44. #ifdef EDMA3_DEBUG  E2 M: D6 C$ [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - k+ x/ e( E2 G- L$ Q1 G3 }; Q1 S6 s3 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 m$ W. ?: O/ F3 Q4 {& R: Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 e8 e, s7 q: }3 H- Q% g
  48. #else
    8 d, V* K! f( R" a
  49. #define DMA_PRINTK( x... )
    3 ~; ]$ \5 G0 P+ i
  50. #define DMA_FN_IN: N3 u5 l+ v, i& n4 _7 I
  51. #define DMA_FN_OUT
    / n* b  @$ N  G( r
  52. #endif& L4 s6 N" f' h  Q

  53. ( e( g1 u/ q) L. g* F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). J/ v3 u. z7 H+ e2 ]2 Y
  55. #define STATIC_SHIFT                3' F* y$ l  F. K' l9 }
  56. #define TCINTEN_SHIFT               20% X6 Z0 X3 o% Y% N# V2 P. o- A
  57. #define ITCINTEN_SHIFT              215 e& F% K( R: x$ |: f
  58. #define TCCHEN_SHIFT                22
    & B( X5 m9 B2 T2 ], E
  59. #define ITCCHEN_SHIFT               23# E) c: O. {9 K0 v, I# ^0 U6 x$ F
  60. 9 ^+ h- @& E: d6 i/ M6 T
  61. static volatile int irqraised1 = 0;
    & [# u+ Q/ j3 u2 g; [+ Z9 w
  62. static volatile int irqraised2 = 0;
    6 S4 b, m& q8 q$ _  P" |
  63. " m. y  J/ z* j+ K5 @4 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % N( _6 B  x6 x8 N3 E  ^8 s4 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; O# B& B1 X* y- a5 o% Q( P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% t' z! {. J* }( |0 y7 K, m& [
  67. # J: I, k( u- p5 ~1 ^
  68. dma_addr_t dmaphyssrc1 = 0;
    1 Y* A5 ]8 i* F
  69. dma_addr_t dmaphyssrc2 = 0;
    2 E2 d6 P: z/ l& Z7 l$ u
  70. dma_addr_t dmaphysdest1 = 0;  N" ^/ P) _4 S
  71. dma_addr_t dmaphysdest2 = 0;# E& x. a  G/ U  L0 G

  72. . w  Z! T" B! I1 s* Z$ }3 B% i
  73. char *dmabufsrc1 = NULL;
    - D8 g- ^* k( I
  74. char *dmabufsrc2 = NULL;
    " {: i  b9 Q2 A% _; ?/ ^1 T$ F1 m3 h
  75. char *dmabufdest1 = NULL;
    7 m: P9 z/ m9 v8 `7 S
  76. char *dmabufdest2 = NULL;/ ~' b2 F1 f" B7 a& s/ _

  77. ! c; o* l: e: g1 G) E! T9 r# ?
  78. static int acnt = 512;# H1 F3 R  ~$ y. T' `/ S
  79. static int bcnt = 8;
    0 I# B0 K4 Q5 M9 u) C
  80. static int ccnt = 8;& Y" L" J6 X3 O. y. C4 w

  81. / l2 H1 G" v2 O+ d
  82. module_param(acnt, int, S_IRUGO);( ^+ G) w7 w' m" G
  83. module_param(bcnt, int, S_IRUGO);! c. S* @+ u& G) g3 G6 e0 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 g% U% B* g" F0 U1 j

4 e  X6 ]/ W' _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& x5 g0 q$ a9 q3 z/ x( Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 J# ~) X6 g: v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ _! k3 F# T/ ?6 t) n

5 T0 G: p' ^) a9 o9 }. y; k
6 d! {+ F! ~/ L: |. E3 W# ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 11:17 , Processed in 0.043223 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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