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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& s1 W% [& K2 j( z3 R5 y
  1. [code]EDMA sample test application! G5 y8 p/ Q, R+ w* {0 m
  2. /*
    " a( \5 a- M0 h5 N# u" a, {
  3. * edma_test.c0 B) D; w) d# Z7 k3 H5 o6 {
  4. *
    ( Z+ }# H2 P" O9 Q- ?3 b
  5. * brief  EDMA3 Test Application
    4 W2 z. ?6 a1 s, N
  6. *4 t; y! z! }! h
  7. *   This file contains EDMA3 Test code.
    ) \: Q  Z; J" a- X6 q0 A0 k( a$ x
  8. *# }8 ?1 t7 y# e( w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 Z8 n0 K! G4 B3 [9 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 U$ a$ S+ k+ ~* f, W" Q
  11. *         TO CHANGE.
    ; Q  o9 h8 |" ?
  12. *
    5 A5 h8 [0 ~5 A0 ]! G2 M% w1 S! G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" l  ?. e2 u/ k, [& J1 a' j) i
  14. *
    * L* C" b& l) O* k& n% f. [
  15. * This program is free software; you can redistribute it and/or
    - B3 y! ^( R+ q2 ]$ |
  16. * modify it under the terms of the GNU General Public License as
    9 {1 I. }7 T0 \. O. ^
  17. * published by the Free Software Foundation version 2.
      n8 |  G* E* q6 @5 b1 ?. _& N! w
  18. *" m0 T% G, U& E' E$ j6 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " a) t* f7 P0 S1 i2 e2 v0 L: c
  20. * kind, whether express or implied; without even the implied warranty
      y! [3 l6 o3 \0 w% Q0 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 \, |+ k$ Q+ g" d
  22. * GNU General Public License for more details.
    ' u4 [/ O- u. i0 y% N3 y) P
  23. */  [  |( q" n6 V+ v' n
  24. 3 ]# z$ m) q8 Y4 O
  25. #include <linux/module.h>
    $ M. a$ \1 V- W- q' i
  26. #include <linux/init.h>
    & E2 Z8 y! Q1 A! z/ v0 S8 `
  27. #include <linux/errno.h># m6 \' u& b" b% ^/ K
  28. #include <linux/types.h>, O, z; J1 w/ V) ?$ G1 r
  29. #include <linux/interrupt.h>
    ( j8 B1 i2 E0 x+ D
  30. #include <asm/io.h>: b6 h& I1 @: c& m
  31. #include <linux/moduleparam.h>+ A9 U$ e# [& b3 Y9 M- ~
  32. #include <linux/sysctl.h>
    3 I5 H% |; [) @- [
  33. #include <linux/mm.h>
    8 P0 P0 H- l, q! x8 @7 W
  34. #include <linux/dma-mapping.h>
    . J! Q  X0 l1 I! }3 N  k8 v. @5 H! I# {

  35. ) l& G' }4 t( M' r' V
  36. #include <mach/memory.h>8 b& W  ^0 |, U2 J
  37. #include <mach/hardware.h>1 A: I" l" H! @/ t
  38. #include <mach/irqs.h>
    . a. y) |( p4 ^2 ^6 Z
  39. #include <asm/hardware/edma.h>/ {# ?9 I6 y" X: P

  40. & B( w) H% O2 G0 `) x: y; |
  41. #undef EDMA3_DEBUG+ S  _) k  u; @7 y$ }
  42. /*#define EDMA3_DEBUG*/
    * H4 @6 s+ J0 U3 ^
  43. $ m; Q; k6 `% u# ]5 J
  44. #ifdef EDMA3_DEBUG  p( {* e/ P# }/ I- v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 s( A. r% b1 L$ g' l7 D4 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 d7 F# r3 I- V6 b4 ~9 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): B' V8 W" C  N0 T2 C: H; c0 |
  48. #else) I: a1 y5 J* B6 Q) y/ Y7 k
  49. #define DMA_PRINTK( x... )2 _6 u1 B1 `% i* W% F5 w
  50. #define DMA_FN_IN6 }( F/ z" G# y) {/ @6 L
  51. #define DMA_FN_OUT6 w- T* R" O7 C+ D' _' p3 B3 Q
  52. #endif% X9 i; l5 I. h1 j0 C) |
  53. ' s' k% V! ?: u1 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): U* [0 a/ o. u
  55. #define STATIC_SHIFT                3$ q8 S3 \8 x" Y1 g$ l# |$ y
  56. #define TCINTEN_SHIFT               20! e, R2 m# f) Y8 ^: B8 ?; Y! z# @
  57. #define ITCINTEN_SHIFT              21% c, m2 ~  P. h5 y8 }8 D
  58. #define TCCHEN_SHIFT                22* l# L+ ^0 H. B4 n: d& X
  59. #define ITCCHEN_SHIFT               23
    7 w- v( `0 |3 q8 \* u/ D+ f4 e# c
  60. 6 O  F! g- L9 i$ V5 a5 e1 H. f2 q& y
  61. static volatile int irqraised1 = 0;0 I( \# A8 N. k; R7 Z
  62. static volatile int irqraised2 = 0;3 D: R! j* n. ~# b3 ?
  63. / N& _0 F  E& f4 L1 q0 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ]! r5 G4 L: N# u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ?. b- T7 j6 {6 K1 L' Y3 ~  x6 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E2 X3 e7 g; z) y1 G& R

  67. 1 z) L4 a1 t" L4 ^( ^$ N
  68. dma_addr_t dmaphyssrc1 = 0;7 f" L! L3 N/ O+ C+ P
  69. dma_addr_t dmaphyssrc2 = 0;
    + L; y9 }3 t( |' \
  70. dma_addr_t dmaphysdest1 = 0;
    : n" m" T1 s+ R; \: S
  71. dma_addr_t dmaphysdest2 = 0;$ R! j) _/ E, \$ t
  72. 5 A5 b# C( a9 E" K
  73. char *dmabufsrc1 = NULL;
    : W, e" ~- h; W! I* s
  74. char *dmabufsrc2 = NULL;8 B" m8 O" A  ~' A
  75. char *dmabufdest1 = NULL;
      U: B  K) Y5 \0 u) E. C0 D
  76. char *dmabufdest2 = NULL;
    - R7 U$ V% g% k' w( ?
  77. ) O% f# z( j  e. V. s/ ]
  78. static int acnt = 512;# }) J& ?! M; p
  79. static int bcnt = 8;
    9 B; ]+ L7 N" q* f4 ^
  80. static int ccnt = 8;
    . m  |( w+ g% q
  81. 8 P0 u( ^7 p1 X4 }: g; d6 F6 w
  82. module_param(acnt, int, S_IRUGO);
    + }" q5 H. ^$ W  h3 f
  83. module_param(bcnt, int, S_IRUGO);/ o4 N7 ^. b9 Q+ y! [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: h5 w; B# q4 G; G! ~' p
7 Z2 k4 g& o8 N, p: k$ M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 d  y3 m2 A/ Z* \9 i% carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 {7 A% j% e/ Y# [/ ?) i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 x9 {( [0 v4 ~: u4 d
) b  D3 }3 N  g. a' }0 C
; J6 g" ], ~+ p/ p" Q! u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-16 01:14 , Processed in 0.041699 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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