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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ e- l/ }" q" k1 }
  1. [code]EDMA sample test application
    0 e/ r8 B; S3 ~3 N
  2. /*7 q" A! Y+ N8 e. I, |: O
  3. * edma_test.c! Q4 s/ K$ H; o: z% F# D
  4. *- W3 y: }: e$ c! `+ |/ I
  5. * brief  EDMA3 Test Application1 H0 ?1 Y- o5 @* [7 s
  6. *
    9 ~; ]% N7 H, i$ R( T3 j* F
  7. *   This file contains EDMA3 Test code.5 R" v! e- g+ ]( K. x
  8. *
    1 ]; ^9 @8 P3 n$ t, f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& \. p" p$ f$ G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & K. |6 C" _& A2 V* l6 E
  11. *         TO CHANGE.$ k# B7 Q, f5 u$ j1 E  Q8 c
  12. *7 h4 ?1 P, A% W* ]( ?  D6 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 P( v6 x0 P$ ^- c- g) b
  14. *$ T( `: u$ C* I- S/ W6 F
  15. * This program is free software; you can redistribute it and/or
    " g7 x' e5 k' k
  16. * modify it under the terms of the GNU General Public License as
    # P9 O9 N  J* p. w9 p, {, i( {* `
  17. * published by the Free Software Foundation version 2.( }3 c7 v# _/ r9 C: u# ^
  18. *
    5 Q. S6 N4 s* X% u9 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# _4 v9 _+ q- B1 w
  20. * kind, whether express or implied; without even the implied warranty
    . P( B0 g4 \0 |& ?0 \! {0 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . Z, D* J: Y8 B% Y
  22. * GNU General Public License for more details.0 y% i5 v( \6 I8 Q2 {+ e4 f
  23. */
    & ~& L8 L* M, C- v

  24. 6 h, o/ k8 R- R- a
  25. #include <linux/module.h>
    ( P+ v: y# G4 {1 B9 `) }1 a4 a
  26. #include <linux/init.h>2 H1 z9 y7 T1 V& U! j  ]' B
  27. #include <linux/errno.h>
    $ C' o9 J  K1 U( E' D+ o# N; I! _
  28. #include <linux/types.h>1 h# m# D$ g: f; {! E
  29. #include <linux/interrupt.h>) \0 }2 Y( X1 Q
  30. #include <asm/io.h>/ F" f3 j8 |0 q. X, Q
  31. #include <linux/moduleparam.h>0 u4 V8 m8 |3 O5 x' B: R1 R  p
  32. #include <linux/sysctl.h>
    ( x( M4 G' Y: U+ C
  33. #include <linux/mm.h>
    ) i# e' w3 Q# k- \# d
  34. #include <linux/dma-mapping.h>  N. s& R5 b- p/ x# ~$ z% |
  35. ' @; z* w7 K2 S, e2 ~) _
  36. #include <mach/memory.h>  X1 s% A$ E/ m/ B0 B
  37. #include <mach/hardware.h>
    " D1 e) _; Z- |( Z. H# F6 O- |
  38. #include <mach/irqs.h>- U1 [; P6 w% }  w
  39. #include <asm/hardware/edma.h>
    ' ^  W/ F2 b$ G

  40. - j. A; R) i! |1 k: ]4 K: h
  41. #undef EDMA3_DEBUG' s) @1 k- F* C3 y; C2 I3 j  C
  42. /*#define EDMA3_DEBUG*/' K7 Z$ i" n6 a' G3 P- `0 a" X6 P' b
  43. 2 c6 }3 G( h4 S/ S1 v
  44. #ifdef EDMA3_DEBUG  A: d% W4 M+ N6 F: e  b" N( v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N# I) P) {0 C- e) S+ L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 a  z9 F5 g4 B( g! C0 ^% }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " {7 I1 M5 Q- @" x. k; H
  48. #else& O# T! K$ Y, F6 b& {
  49. #define DMA_PRINTK( x... )
    * h3 s$ L: p1 u% @7 L6 Y% g' y5 `
  50. #define DMA_FN_IN3 ?4 n/ R  i! j4 E! c3 P" Q0 i# v
  51. #define DMA_FN_OUT
    9 L, N4 {2 I. Z( }1 S! t
  52. #endif" M9 s8 b" P: |6 U

  53. 9 Q) @7 _6 a7 F- ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) g1 c8 n% I. I- z
  55. #define STATIC_SHIFT                3
    . T7 V/ g3 S& R7 y7 v% F
  56. #define TCINTEN_SHIFT               20
    5 n' j( U7 I, X" {3 K3 L+ p( F/ t
  57. #define ITCINTEN_SHIFT              21
    ! {' E4 h- \# t
  58. #define TCCHEN_SHIFT                22( O4 y* L$ r) A
  59. #define ITCCHEN_SHIFT               235 X' q  Z5 v  A# `$ {* Y
  60. 5 p7 n7 T  z2 I1 y2 d2 y5 W, n
  61. static volatile int irqraised1 = 0;5 u8 N, O( P/ h  D4 a, C! d: c9 Q
  62. static volatile int irqraised2 = 0;
    / S1 S- r" i1 N$ `' v6 e8 s$ e3 o
  63. 4 s7 K4 G' v8 S1 o6 z" P3 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ A: I9 m! W  x) |9 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " a3 Q" n. d/ N8 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 p; u0 B! q; |+ r$ {; L

  67. . j# O* U5 u' }! k
  68. dma_addr_t dmaphyssrc1 = 0;3 P8 Y; B+ {1 B8 b* \6 @0 V8 m
  69. dma_addr_t dmaphyssrc2 = 0;
    1 @+ d5 m7 z8 O, u: G  C, T( T+ D
  70. dma_addr_t dmaphysdest1 = 0;
    2 ^" T3 a$ m* t5 L$ {
  71. dma_addr_t dmaphysdest2 = 0;& o8 t) v" j) S' S
  72. * ^) ?+ S$ b1 ^% M7 A+ P6 y3 X
  73. char *dmabufsrc1 = NULL;$ G  o+ x& ]2 U7 x1 o
  74. char *dmabufsrc2 = NULL;. ~. Y* d( W6 v$ l1 ?8 X) }% }
  75. char *dmabufdest1 = NULL;0 o4 p  U' ?3 l
  76. char *dmabufdest2 = NULL;0 U7 F3 V; U" z$ ]
  77. 6 _  ^* f1 I2 u, F
  78. static int acnt = 512;# [5 G4 h- @$ b) |
  79. static int bcnt = 8;2 }# N! C! m4 C. [, f# D  E
  80. static int ccnt = 8;# g% U6 l/ ^( t, C7 j8 ?/ K, n: k

  81. 9 Q. i# k/ e( C  P
  82. module_param(acnt, int, S_IRUGO);, U, c' x4 q) l# w
  83. module_param(bcnt, int, S_IRUGO);* l. F" h4 M" ~5 ~) M% {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 E! ~- L6 y# D+ c1 Z% W& Y" T- R
% T8 f, D. b# r" c1 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& N8 X- ^: v* S5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- N' Y+ `7 |- T! J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, O% v# a3 ~7 c& w: G2 @/ L
9 H, o& B: a; H$ B! m) I5 L; o$ h) ?1 O( Q0 ]" r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 22:45 , Processed in 0.041924 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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